11import "~/index.css" ;
2- import { EnvironmentId , ThreadId , TurnItemId } from "@t3tools/contracts" ;
2+ import { EnvironmentId , ProviderDriverKind , ThreadId , TurnItemId } from "@t3tools/contracts" ;
33import * as DateTime from "effect/DateTime" ;
44import { expect , it , vi } from "vite-plus/test" ;
55import { page } from "vite-plus/test/browser" ;
@@ -14,34 +14,58 @@ import { ThreadNow } from "./ThreadNow";
1414
1515it ( "opens full command details for short labels and keeps pending tasks current" , async ( ) => {
1616 const command = "python3 audit.py -j 6\n> scratch/audit.log 2>&1" ;
17- const view = ( description ?: string , status : "running" | "completed" = "completed" ) => (
17+ const commandItem = ( status : "running" | "completed" ) => ( {
18+ id : TurnItemId . make ( "bash-1" ) ,
19+ threadId : ThreadId . make ( "thread" ) ,
20+ runId : null ,
21+ nodeId : null ,
22+ providerThreadId : null ,
23+ providerTurnId : null ,
24+ nativeItemRef : null ,
25+ parentItemId : null ,
26+ ordinal : 1 ,
27+ status,
28+ title : null ,
29+ startedAt : null ,
30+ completedAt : null ,
31+ updatedAt : DateTime . makeUnsafe ( "2026-11-09T00:00:00Z" ) ,
32+ type : "command_execution" as const ,
33+ input : command ,
34+ output : "Command running in background with ID: native-task" ,
35+ } ) ;
36+ const view = (
37+ description ?: string ,
38+ status : "running" | "completed" = "completed" ,
39+ explicitItem = true ,
40+ ) => (
1841 < ThreadNow
1942 attention = { null }
2043 syncPhase = { null }
2144 goal = { null }
2245 work = { backgroundWorkNowItem ( {
2346 environmentId : EnvironmentId . make ( "test" ) ,
2447 threadId : ThreadId . make ( "thread" ) ,
25- tasks : [ { taskId : "bash-1" , kind : "command" , description, command, awaited : true } ] ,
48+ tasks : [
49+ {
50+ taskId : "native-task" ,
51+ itemId : explicitItem ? TurnItemId . make ( "bash-1" ) : undefined ,
52+ kind : "command" ,
53+ description,
54+ command,
55+ awaited : true ,
56+ } ,
57+ ] ,
2658 turnItems : [
59+ commandItem ( status ) ,
2760 {
28- id : TurnItemId . make ( "bash-1" ) ,
29- threadId : ThreadId . make ( "thread" ) ,
30- runId : null ,
31- nodeId : null ,
32- providerThreadId : null ,
33- providerTurnId : null ,
34- nativeItemRef : null ,
35- parentItemId : null ,
36- ordinal : 1 ,
37- status,
38- title : null ,
39- startedAt : null ,
40- completedAt : null ,
41- updatedAt : DateTime . makeUnsafe ( "2026-11-09T00:00:00Z" ) ,
42- type : "command_execution" ,
43- input : command ,
44- output : "Command running in background with ID: bash-1" ,
61+ ...commandItem ( "running" ) ,
62+ id : TurnItemId . make ( "native-match" ) ,
63+ nativeItemRef : {
64+ driver : ProviderDriverKind . make ( "codex" ) ,
65+ nativeId : "native-task" ,
66+ strength : "strong" ,
67+ } ,
68+ ordinal : 2 ,
4569 } ,
4670 ] ,
4771 stopDisabled : false ,
@@ -66,6 +90,8 @@ it("opens full command details for short labels and keeps pending tasks current"
6690 . element ( page . getByRole ( "heading" , { name : "Check remaining modules" } ) )
6791 . toBeVisible ( ) ;
6892 await expect . element ( page . getByText ( "Command output stream" ) ) . toBeVisible ( ) ;
93+ await screen . rerender ( view ( "Native fallback" , "completed" , false ) ) ;
94+ await expect . element ( page . getByText ( "Command output stream" ) ) . toBeVisible ( ) ;
6995 await page . getByRole ( "button" , { name : "Close" , exact : true } ) . click ( ) ;
7096 await expect . element ( page . getByRole ( "dialog" ) ) . not . toBeInTheDocument ( ) ;
7197} ) ;
0 commit comments