Skip to content

Commit cb46c62

Browse files
test(provider-pi): cover continuation offers through the driver (pingdotgg#17407)
1 parent 7a2b1c7 commit cb46c62

1 file changed

Lines changed: 25 additions & 2 deletions

File tree

‎packages/provider-pi/src/server/adapter.test.ts‎

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,13 @@ import * as McpProviderSession from "@t3tools/provider-core/server/mcpSession";
3737
import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
3838
import * as ProviderAdapter from "@t3tools/provider-core/server/ProviderAdapter";
3939
import { handoffBudget } from "@t3tools/provider-core/server/handoffBudget";
40-
import { makePiAdapterV2, PI_PROVIDER, type PiAdapterV2Options } from "./adapter.ts";
40+
import { HostProcessEnvironment } from "@t3tools/shared/hostProcess";
41+
import {
42+
makePiAdapterV2,
43+
PiAdapterV2Driver,
44+
PI_PROVIDER,
45+
type PiAdapterV2Options,
46+
} from "./adapter.ts";
4147
import { makePiRpcConnection, type PiRpcRecord } from "./rpc.ts";
4248

4349
const layerTest = Layer.mergeAll(
@@ -317,11 +323,28 @@ const makeAdapter = Effect.fnUntraced(function* (
317323
? forkFake.spawner.spawn(command)
318324
: fake.spawner.spawn(command),
319325
);
326+
// Continuation cases go through the driver, which wires the offer from the
327+
// environment the way production does.
328+
if (continuationRequests !== undefined) {
329+
return yield* PiAdapterV2Driver.create({
330+
instanceId: PI_INSTANCE_ID,
331+
displayName: undefined,
332+
enabled: true,
333+
environment: [],
334+
config: { enabled: true, binaryPath: "pi", launchArgs, customModels: [] },
335+
}).pipe(
336+
Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner),
337+
Effect.provideService(HostProcessEnvironment, {}),
338+
Effect.provideService(ProviderContinuationRequests.ProviderContinuationRequests, {
339+
...continuationRequests,
340+
take: Effect.never,
341+
}),
342+
);
343+
}
320344
return yield* makePiAdapterV2({
321345
instanceId: PI_INSTANCE_ID,
322346
settings: { enabled: true, binaryPath: "pi", launchArgs, customModels: [] },
323347
environment: {},
324-
...(continuationRequests === undefined ? {} : { continuationRequests }),
325348
}).pipe(Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner));
326349
});
327350

0 commit comments

Comments
 (0)