|
| 1 | +import * as Crypto from "effect/Crypto"; |
| 2 | +import * as Path from "effect/Path"; |
1 | 3 | import * as HostProcess from "@t3tools/shared/HostProcess"; |
2 | 4 | import { AgentScope } from "@t3tools/shared/AgentScope"; |
3 | 5 | import { getModelSelectionStringOptionValue } from "@t3tools/shared/model"; |
@@ -414,6 +416,8 @@ export const makePiAdapterV2 = Effect.fn("makePiAdapterV2")(function* ( |
414 | 416 | const spawner = yield* ChildProcessSpawner.ChildProcessSpawner; |
415 | 417 | const agentScope = yield* AgentScope; |
416 | 418 | const fileSystem = yield* FileSystem.FileSystem; |
| 419 | + const crypto = yield* Crypto.Crypto; |
| 420 | + const path = yield* Path.Path; |
417 | 421 | const idAllocator = yield* IdAllocator.IdAllocatorV2; |
418 | 422 | const host = yield* ProviderHost.ProviderHost; |
419 | 423 | const mcpSessions = yield* McpProviderSessions.McpProviderSessions; |
@@ -451,21 +455,22 @@ export const makePiAdapterV2 = Effect.fn("makePiAdapterV2")(function* ( |
451 | 455 | const scope = yield* Effect.scope; |
452 | 456 | const cwd = input.runtimePolicy.cwd ?? host.paths.cwd; |
453 | 457 | const mcpSession = yield* mcpSessions.read(input.threadId); |
454 | | - const provideCacheFs = <A, E>(effect: Effect.Effect<A, E, FileSystem.FileSystem>) => |
455 | | - effect.pipe( |
456 | | - Effect.provideService(FileSystem.FileSystem, fileSystem), |
457 | | - Effect.mapError( |
458 | | - (cause) => |
459 | | - new ProviderAdapter.ProviderAdapterOpenSessionError({ |
460 | | - driver: PI_PROVIDER, |
461 | | - providerSessionId: input.providerSessionId, |
462 | | - cause, |
463 | | - }), |
464 | | - ), |
465 | | - ); |
466 | 458 | // Always inject the permission hook even without MCP credentials; otherwise Supervised becomes unrestricted. |
467 | | - const extensionPath = yield* provideCacheFs( |
468 | | - materializePiT3McpExtension(host.paths.providerStatusCacheDir, instructionOverrides), |
| 459 | + const extensionPath = yield* materializePiT3McpExtension( |
| 460 | + host.paths.providerStatusCacheDir, |
| 461 | + instructionOverrides, |
| 462 | + ).pipe( |
| 463 | + Effect.provideService(FileSystem.FileSystem, fileSystem), |
| 464 | + Effect.provideService(Crypto.Crypto, crypto), |
| 465 | + Effect.provideService(Path.Path, path), |
| 466 | + Effect.mapError( |
| 467 | + (cause) => |
| 468 | + new ProviderAdapter.ProviderAdapterOpenSessionError({ |
| 469 | + driver: PI_PROVIDER, |
| 470 | + providerSessionId: input.providerSessionId, |
| 471 | + cause, |
| 472 | + }), |
| 473 | + ), |
469 | 474 | ); |
470 | 475 | const resolvedLaunchArgs = resolvePiLaunchArgs(options.settings.launchArgs); |
471 | 476 | if (!resolvedLaunchArgs.ok) { |
@@ -3312,6 +3317,8 @@ function piUiResponse( |
3312 | 3317 | } |
3313 | 3318 |
|
3314 | 3319 | export type PiAdapterV2DriverEnv = |
| 3320 | + | Crypto.Crypto |
| 3321 | + | Path.Path |
3315 | 3322 | | ChildProcessSpawner.ChildProcessSpawner |
3316 | 3323 | | FileSystem.FileSystem |
3317 | 3324 | | IdAllocator.IdAllocatorV2 |
|
0 commit comments