11import "~/index.css" ;
22import * as DateTime from "effect/DateTime" ;
3- import { EnvironmentId , NodeId , ThreadId } from "@t3tools/contracts" ;
3+ import {
4+ EnvironmentId ,
5+ NodeId ,
6+ ProviderDriverKind ,
7+ ProviderInstanceId ,
8+ ThreadId ,
9+ type OrchestrationV2ThreadProjection ,
10+ type ServerProvider ,
11+ } from "@t3tools/contracts" ;
412import * as Cause from "effect/Cause" ;
513import { AsyncResult } from "effect/reactivity" ;
614import { expect , it , vi } from "vite-plus/test" ;
@@ -12,6 +20,7 @@ const state = vi.hoisted(() => ({
1220 projection : null as unknown ,
1321 commandSucceeds : false ,
1422 relatedShells : [ ] as unknown [ ] ,
23+ providers : new Map < EnvironmentId , ReadonlyArray < ServerProvider > > ( ) ,
1524 threadTitles : { } as Record < string , string > ,
1625 archivedThreads : [ ] as unknown [ ] ,
1726} ) ) ;
@@ -46,7 +55,7 @@ vi.mock(import("../../state/environments"), () => ({
4655 useEnvironments : ( ( ) => [ ] ) as never ,
4756 usePrimaryEnvironment : ( ( ) => null ) as never ,
4857 useEnvironment : ( ( ) => null ) as never ,
49- useEnvironmentProviders : ( ( ) => new Map ( ) ) as never ,
58+ useEnvironmentProviders : ( ) => state . providers ,
5059} ) ) ;
5160vi . mock ( import ( "../../state/peerLinks" ) , ( ) => ( {
5261 peerLinkEnvironment : { readThread : { } } as never ,
@@ -81,6 +90,7 @@ function setup() {
8190 useRightPanelStore . setState ( useRightPanelStore . getInitialState ( ) ) ;
8291 state . commandSucceeds = false ;
8392 state . relatedShells = [ ] ;
93+ state . providers = new Map ( ) ;
8494 state . threadTitles = { source : "Source" } ;
8595 state . archivedThreads = [ ] ;
8696 state . projection = {
@@ -303,6 +313,98 @@ it("shows a lineage thread's full title in its tooltip", async () => {
303313 ) ;
304314} ) ;
305315
316+ it ( "updates the lineage hover card when a delegated child changes Fast mode" , async ( ) => {
317+ setup ( ) ;
318+ const projection = makeThreadProjectionFixture ( ) ;
319+ const childId = ThreadId . make ( "opus-child" ) ;
320+ const instanceId = ProviderInstanceId . make ( "claudeAgent" ) ;
321+ const model = "claude-opus-5-5" ;
322+ const title = "Opus child" ;
323+ const selection = ( fastMode : boolean ) => ( {
324+ instanceId,
325+ model,
326+ options : [ { id : "fastMode" , value : fastMode } ] ,
327+ } ) ;
328+ const provider : ServerProvider = {
329+ instanceId,
330+ driver : ProviderDriverKind . make ( "claudeAgent" ) ,
331+ enabled : true ,
332+ installed : true ,
333+ version : null ,
334+ status : "ready" ,
335+ auth : { status : "authenticated" } ,
336+ checkedAt : DateTime . formatIso ( projection . thread . updatedAt ) ,
337+ models : [
338+ {
339+ slug : model ,
340+ name : "Opus 5.5" ,
341+ isCustom : false ,
342+ capabilities : {
343+ optionDescriptors : [ { id : "fastMode" , label : "Fast" , type : "boolean" } ] ,
344+ } ,
345+ } ,
346+ ] ,
347+ slashCommands : [ ] ,
348+ skills : [ ] ,
349+ } ;
350+ state . providers . set ( environmentId , [ provider ] ) ;
351+ state . projection = {
352+ ...projection ,
353+ subagents : [
354+ {
355+ id : NodeId . make ( "agent" ) ,
356+ threadId : projection . thread . id ,
357+ runId : null ,
358+ parentNodeId : NodeId . make ( "parent" ) ,
359+ childThreadId : childId ,
360+ providerThreadId : null ,
361+ nativeTaskRef : null ,
362+ prompt : "Inspect the change" ,
363+ title,
364+ origin : "app_owned" ,
365+ createdBy : "agent" ,
366+ status : "running" ,
367+ driver : provider . driver ,
368+ providerInstanceId : instanceId ,
369+ model,
370+ modelSelection : selection ( false ) ,
371+ result : null ,
372+ startedAt : projection . thread . updatedAt ,
373+ completedAt : null ,
374+ updatedAt : projection . thread . updatedAt ,
375+ } ,
376+ ] ,
377+ } satisfies OrchestrationV2ThreadProjection ;
378+ const childShell = ( fastMode : boolean ) => ( {
379+ ...projection . thread ,
380+ id : childId ,
381+ title,
382+ providerInstanceId : instanceId ,
383+ modelSelection : selection ( fastMode ) ,
384+ lineage : { parentThreadId : projection . thread . id , relationshipToParent : "subagent" } ,
385+ } ) ;
386+ const panel = ( ) => (
387+ < ThreadRelationshipsPanel
388+ environmentId = { environmentId }
389+ threadId = { projection . thread . id }
390+ showLineage
391+ showSideChats = { false }
392+ />
393+ ) ;
394+
395+ state . relatedShells = [ childShell ( true ) ] ;
396+ await using screen = await render ( panel ( ) ) ;
397+ await userEvent . hover ( screen . getByText ( title , { exact : true } ) ) ;
398+ const popup = page . getByText ( "Opus 5.5" , { exact : true } ) ;
399+ const fast = page . getByText ( "Fast mode on" , { exact : true } ) ;
400+ await expect . element ( fast ) . toBeInTheDocument ( ) ;
401+
402+ state . relatedShells = [ childShell ( false ) ] ;
403+ await screen . rerender ( panel ( ) ) ;
404+ await expect . element ( popup ) . toBeVisible ( ) ;
405+ await expect . element ( fast ) . not . toBeInTheDocument ( ) ;
406+ } ) ;
407+
306408it ( "shows a side chat's full title in its tooltip" , async ( ) => {
307409 setup ( ) ;
308410 const longTitle = "Side chat question with a title that the side chat row truncates" ;
0 commit comments