@@ -57,14 +57,9 @@ import { threadShellFromProjection } from "../orchestration-v2/ProjectionStore.t
5757import * as EventSink from "../orchestration-v2/EventSink.ts" ;
5858import * as Orchestrator from "../orchestration-v2/Orchestrator.ts" ;
5959import * as ThreadManagementService from "../orchestration-v2/ThreadManagementService.ts" ;
60- import {
61- type ProviderAdapterV2Event ,
62- ProviderAdapterProtocolError ,
63- type ProviderAdapterV2Shape ,
64- type ProviderAdapterV2TurnInput ,
65- } from "@t3tools/provider-core/server/ProviderAdapter" ;
6660import * as ProviderAdapterRegistry from "../orchestration-v2/ProviderAdapterRegistry.ts" ;
67- import * as ProviderContinuationRequests from "@t3tools/provider-core/server/continuationRequests" ;
61+ import * as ProviderContinuationRequests from "@t3tools/provider-core/server/ProviderContinuationRequests" ;
62+ import * as McpProviderSessions from "@t3tools/provider-core/server/McpProviderSessions" ;
6863import { checkpointWorkspace } from "@t3tools/provider-testing/replayWorkspace" ;
6964import * as ProviderReplayHarness from "../orchestration-v2/testkit/ProviderReplayHarness.ts" ;
7065import {
@@ -79,6 +74,7 @@ import * as ServerSecretStore from "../auth/ServerSecretStore.ts";
7974import * as McpHttpServer from "./McpHttpServer.ts" ;
8075import * as McpInvocationContext from "./McpInvocationContext.ts" ;
8176import { delegatedTaskRun , hasPendingChildRuns } from "./OrchestratorMcpService.ts" ;
77+ import * as ProviderAdapter from "@t3tools/provider-core/server/ProviderAdapter" ;
8278
8379// Effect returns a declared tool failure as `isError` with its encoded payload
8480// as JSON text, never as `structuredContent`.
@@ -146,7 +142,7 @@ interface CapturedTurn {
146142}
147143
148144function unsupported ( driver : ProviderDriverKind , detail : string ) {
149- return Effect . fail ( new ProviderAdapterProtocolError ( { driver, detail } ) ) ;
145+ return Effect . fail ( new ProviderAdapter . ProviderAdapterProtocolError ( { driver, detail } ) ) ;
150146}
151147
152148function makeProviderSnapshot ( input : {
@@ -185,18 +181,20 @@ function makeDeterministicAdapter(input: {
185181 readonly driver : ProviderDriverKind ;
186182 readonly capabilities : OrchestrationV2ProviderCapabilities ;
187183 readonly capturedTurns : Ref . Ref < ReadonlyArray < CapturedTurn > > ;
188- readonly shouldComplete : ( turn : ProviderAdapterV2TurnInput ) => boolean ;
189- readonly terminalGate ?: ( turn : ProviderAdapterV2TurnInput ) => Deferred . Deferred < void > | undefined ;
190- readonly response : ( turn : ProviderAdapterV2TurnInput ) => string ;
191- } ) : ProviderAdapterV2Shape {
184+ readonly shouldComplete : ( turn : ProviderAdapter . ProviderAdapterV2TurnInput ) => boolean ;
185+ readonly terminalGate ?: (
186+ turn : ProviderAdapter . ProviderAdapterV2TurnInput ,
187+ ) => Deferred . Deferred < void > | undefined ;
188+ readonly response : ( turn : ProviderAdapter . ProviderAdapterV2TurnInput ) => string ;
189+ } ) : ProviderAdapter . ProviderAdapterV2 [ "Service" ] {
192190 return {
193191 instanceId : input . instanceId ,
194192 driver : input . driver ,
195193 getCapabilities : ( ) => Effect . succeed ( input . capabilities ) ,
196194 planSelectionTransition : ( ) => Effect . succeed ( { type : "apply_on_next_turn" } ) ,
197195 openSession : ( sessionInput ) =>
198196 Effect . gen ( function * ( ) {
199- const events = yield * PubSub . unbounded < ProviderAdapterV2Event > ( ) ;
197+ const events = yield * PubSub . unbounded < ProviderAdapter . ProviderAdapterV2Event > ( ) ;
200198 const now = yield * DateTime . now ;
201199 const providerSession : OrchestrationV2ProviderSession = {
202200 id : sessionInput . providerSessionId ,
@@ -211,12 +209,12 @@ function makeDeterministicAdapter(input: {
211209 lastError : null ,
212210 } ;
213211
214- const publish = ( providerEvents : ReadonlyArray < ProviderAdapterV2Event > ) =>
212+ const publish = ( providerEvents : ReadonlyArray < ProviderAdapter . ProviderAdapterV2Event > ) =>
215213 Effect . forEach ( providerEvents , ( event ) => PubSub . publish ( events , event ) , {
216214 discard : true ,
217215 } ) ;
218216 const runOrdinals = new Map < ProviderTurnId , number > ( ) ;
219- const turnInputs = new Map < ProviderTurnId , ProviderAdapterV2TurnInput > ( ) ;
217+ const turnInputs = new Map < ProviderTurnId , ProviderAdapter . ProviderAdapterV2TurnInput > ( ) ;
220218
221219 return {
222220 instanceId : input . instanceId ,
@@ -3813,7 +3811,9 @@ describe("orchestrator MCP toolkit", () => {
38133811 Layer . provideMerge ( McpServer . McpServer . layer ) ,
38143812 Layer . provideMerge ( layerOrchestration ) ,
38153813 Layer . provide (
3816- CodexOrchestratorReplayHarness . makeProviderAdapterRegistryLayer ( transcript ) ,
3814+ CodexOrchestratorReplayHarness . makeProviderAdapterRegistryLayer ( transcript ) . pipe (
3815+ Layer . provide ( McpProviderSessions . layer ) ,
3816+ ) ,
38173817 ) ,
38183818 Layer . provide ( layerProviderRegistry ) ,
38193819 Layer . provide ( layerUnusedScheduledTaskStub ) ,
0 commit comments