authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-10-08 23:07:15-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-10-08 23:07:15-07:00
logcb46c62504aca99295a4a8879644625a20685b7f
tree6b77bfb0f4babc311e3ca478d9ede5ed9c0bd1f2
parent7a2b1c72beed4f560aebb41aa7b26e0792eeb938
signature Signed by PGP key B5690EEEBB952194

test(provider-pi): cover continuation offers through the driver (#17407)


1 files changed, 25 insertions(+), 2 deletions(-)

packages/provider-pi/src/server/adapter.test.ts+25-2
......@@ -37,7 +37,13 @@ import * as McpProviderSession from "@t3tools/provider-core/server/mcpSession";
3737import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
3838import * as ProviderAdapter from "@t3tools/provider-core/server/ProviderAdapter";
3939import { handoffBudget } from "@t3tools/provider-core/server/handoffBudget";
40import { makePiAdapterV2, PI_PROVIDER, type PiAdapterV2Options } from "./adapter.ts";
40import { HostProcessEnvironment } from "@t3tools/shared/hostProcess";
41import {
42 makePiAdapterV2,
43 PiAdapterV2Driver,
44 PI_PROVIDER,
45 type PiAdapterV2Options,
46} from "./adapter.ts";
4147import { makePiRpcConnection, type PiRpcRecord } from "./rpc.ts";
4248
4349const 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