11import {
22 CommandId ,
3- type EnvironmentId ,
43 type RunId ,
54 isProviderAvailable ,
65 MessageId ,
@@ -108,6 +107,7 @@ import {
108107 type McpInvocationScope ,
109108 type McpThreadInvocationScope ,
110109 requireThreadScope ,
110+ threadLinkFor ,
111111} from "./McpInvocationContext.ts" ;
112112import * as Metrics from "../observability/Metrics.ts" ;
113113import {
@@ -752,15 +752,15 @@ function threadPullRequests(
752752}
753753
754754function listItemFromShell (
755- environmentId : EnvironmentId ,
755+ scope : McpInvocationScope ,
756756 shell : OrchestrationV2ThreadShell ,
757757 nowMs : number ,
758758) : OrchestratorMcpThreadListItem {
759759 return {
760760 threadId : shell . id ,
761761 projectId : shell . projectId ,
762762 title : shell . title ,
763- link : formatThreadLink ( { environmentId , threadId : shell . id } ) ,
763+ link : threadLinkFor ( scope , shell . id ) ,
764764 createdBy : shell . createdBy ,
765765 creationSource : shell . creationSource ,
766766 status : shell . activityRunStatus ?? shell . status ,
@@ -782,7 +782,7 @@ function listItemFromShell(
782782}
783783
784784function threadDetail (
785- environmentId : EnvironmentId ,
785+ scope : McpInvocationScope ,
786786 projection : Pick < OrchestrationV2ThreadProjection , "thread" | "runs" | "runtimeRequests" > ,
787787 itemCount : number ,
788788 shell : OrchestrationV2ThreadShell ,
@@ -794,7 +794,7 @@ function threadDetail(
794794 threadId : projection . thread . id ,
795795 projectId : projection . thread . projectId ,
796796 title : projection . thread . title ,
797- link : formatThreadLink ( { environmentId , threadId : projection . thread . id } ) ,
797+ link : threadLinkFor ( scope , projection . thread . id ) ,
798798 createdBy : projection . thread . createdBy ,
799799 creationSource : projection . thread . creationSource ,
800800 status : active ?. status ?? latest ?. status ?? "idle" ,
@@ -2806,7 +2806,7 @@ const make = Effect.gen(function* () {
28062806 return {
28072807 projectId,
28082808 currentThreadId : parent ?. thread . id ?? null ,
2809- threads : page . map ( ( shell ) => listItemFromShell ( scope . environmentId , shell , nowMs ) ) ,
2809+ threads : page . map ( ( shell ) => listItemFromShell ( scope , shell , nowMs ) ) ,
28102810 nextCursor,
28112811 total : filtered . length ,
28122812 } satisfies OrchestratorMcpThreadListResult ;
@@ -2887,7 +2887,7 @@ const make = Effect.gen(function* () {
28872887 }
28882888 return {
28892889 thread : threadDetail (
2890- scope . environmentId ,
2890+ scope ,
28912891 target ,
28922892 timeline . totalItems ,
28932893 shell ,
@@ -2951,7 +2951,7 @@ const make = Effect.gen(function* () {
29512951 ) ;
29522952 return {
29532953 threadId : input . threadId ,
2954- link : formatThreadLink ( { environmentId : scope . environmentId , threadId : input . threadId } ) ,
2954+ link : threadLinkFor ( scope , input . threadId ) ,
29552955 messageId,
29562956 runId : result . run . id ,
29572957 ...( result . run . delegatedTaskId === undefined ? { } : { taskId : result . run . delegatedTaskId } ) ,
0 commit comments