| author | |
| committer | |
| log | 2c7a446e657e705c257db28540819f4c0115b2fc |
| tree | 36f0376370207f6a7fbca2c57098834b064614a0 |
| parent | b0ee7dd48f868c5c02884345f723bebaf616b13d |
| signature | Signed by PGP key B5690EEEBB952194 |
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>14 files changed, 112 insertions(+), 117 deletions(-)
packages/provider-core/src/server/adapterDriver.ts+6-2| ... | ... | @@ -7,7 +7,7 @@ import * as Schema from "effect/Schema"; |
| 7 | 7 | import type * as Effect from "effect/Effect"; |
| 8 | 8 | import type * as Scope from "effect/Scope"; |
| 9 | 9 | |
| 10 | import type { ProviderAdapterV2Shape } from "@t3tools/provider-core/server/ProviderAdapter"; | |
| 10 | import type * as ProviderAdapter from "@t3tools/provider-core/server/ProviderAdapter"; | |
| 11 | 11 | |
| 12 | 12 | export class ProviderAdapterDriverCreateError extends Schema.TaggedError<ProviderAdapterDriverCreateError>()( |
| 13 | 13 | "ProviderAdapterDriverCreateError", |
| ... | ... | @@ -38,7 +38,11 @@ export interface ProviderAdapterDriver<Config, R = never> { |
| 38 | 38 | readonly defaultConfig: () => Config; |
| 39 | 39 | readonly create: ( |
| 40 | 40 | input: ProviderAdapterDriverCreateInput<Config>, |
| 41 | ) => Effect.Effect<ProviderAdapterV2Shape, ProviderAdapterDriverCreateError, R | Scope.Scope>; | |
| 41 | ) => Effect.Effect< | |
| 42 | ProviderAdapter.ProviderAdapterV2Shape, | |
| 43 | ProviderAdapterDriverCreateError, | |
| 44 | R | Scope.Scope | |
| 45 | >; | |
| 42 | 46 | } |
| 43 | 47 | |
| 44 | 48 | export type AnyProviderAdapterDriver<R = never> = ProviderAdapterDriver<any, R>; |
packages/provider-core/src/server/driver.ts+2-2| ... | ... | @@ -37,7 +37,7 @@ import type * as Effect from "effect/Effect"; |
| 37 | 37 | import type * as Schema from "effect/Schema"; |
| 38 | 38 | import type * as Scope from "effect/Scope"; |
| 39 | 39 | |
| 40 | import type { ProviderAdapterV2Shape } from "./ProviderAdapter.ts"; | |
| 40 | import type * as ProviderAdapter from "./ProviderAdapter.ts"; | |
| 41 | 41 | import type { ProviderAuthController } from "./auth.ts"; |
| 42 | 42 | import type { ProviderDriverError } from "./errors.ts"; |
| 43 | 43 | import type { ServerProviderShape } from "./snapshot.ts"; |
| ... | ... | @@ -101,7 +101,7 @@ export interface ProviderInstance { |
| 101 | 101 | ProviderConsumeResetCreditOutcome, |
| 102 | 102 | ProviderDriverError |
| 103 | 103 | >; |
| 104 | readonly orchestrationAdapter: ProviderAdapterV2Shape; | |
| 104 | readonly orchestrationAdapter: ProviderAdapter.ProviderAdapterV2Shape; | |
| 105 | 105 | readonly textGeneration: ProviderTextGeneration; |
| 106 | 106 | readonly auth?: ProviderAuthController; |
| 107 | 107 | readonly acpSessionManagement?: { |
packages/provider-core/src/server/failure.test.ts+2-2| ... | ... | @@ -19,7 +19,7 @@ import { |
| 19 | 19 | ContextHandoffBudgetError, |
| 20 | 20 | } from "./failure.ts"; |
| 21 | 21 | import * as IdAllocator from "./IdAllocator.ts"; |
| 22 | import { ProviderAdapterTurnStartError } from "@t3tools/provider-core/server/ProviderAdapter"; | |
| 22 | import * as ProviderAdapter from "@t3tools/provider-core/server/ProviderAdapter"; | |
| 23 | 23 | |
| 24 | 24 | it("redacts credentials and URL secrets from provider failures", () => { |
| 25 | 25 | const failure = makeProviderFailure({ |
| ... | ... | @@ -88,7 +88,7 @@ it("does not expose arbitrary cause messages and preserves explicit messages", ( |
| 88 | 88 | }); |
| 89 | 89 | |
| 90 | 90 | it("preserves actionable handoff errors wrapped by turn startup", () => { |
| 91 | const cause = new ProviderAdapterTurnStartError({ | |
| 91 | const cause = new ProviderAdapter.ProviderAdapterTurnStartError({ | |
| 92 | 92 | driver: ProviderDriverKind.make("codex"), |
| 93 | 93 | threadId: ThreadId.make("thread:handoff-error"), |
| 94 | 94 | providerThreadId: ProviderThreadId.make("provider-thread:handoff-error"), |
packages/provider-core/src/server/failure.ts+3-3| ... | ... | @@ -13,7 +13,7 @@ import type { |
| 13 | 13 | import * as DateTime from "effect/DateTime"; |
| 14 | 14 | import * as Cause from "effect/Cause"; |
| 15 | 15 | |
| 16 | import type { IdAllocatorV2Shape } from "./IdAllocator.ts"; | |
| 16 | import type * as IdAllocator from "./IdAllocator.ts"; | |
| 17 | 17 | import * as Schema from "effect/Schema"; |
| 18 | 18 | |
| 19 | 19 | /** Raised when portable history does not fit the target provider's context window. */ |
| ... | ... | @@ -172,7 +172,7 @@ export function makeProviderFailure(input: { |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | export function makeProviderFailureTurnItem(input: { |
| 175 | readonly idAllocator: IdAllocatorV2Shape; | |
| 175 | readonly idAllocator: IdAllocator.IdAllocatorV2Shape; | |
| 176 | 176 | readonly driver: ProviderDriverKind; |
| 177 | 177 | readonly threadId: ThreadId; |
| 178 | 178 | readonly runId: RunId | null; |
| ... | ... | @@ -210,7 +210,7 @@ export function makeProviderFailureTurnItem(input: { |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | export function makeProviderRetryTurnItem(input: { |
| 213 | readonly idAllocator: IdAllocatorV2Shape; | |
| 213 | readonly idAllocator: IdAllocator.IdAllocatorV2Shape; | |
| 214 | 214 | readonly driver: ProviderDriverKind; |
| 215 | 215 | readonly threadId: ThreadId; |
| 216 | 216 | readonly runId: RunId | null; |
packages/provider-core/src/server/managedProvider.test.ts+5-5| ... | ... | @@ -16,7 +16,7 @@ import * as Ref from "effect/Ref"; |
| 16 | 16 | import * as Stream from "effect/Stream"; |
| 17 | 17 | import { TestClock } from "effect/testing"; |
| 18 | 18 | |
| 19 | import { ProviderHost, type ProviderHostShape } from "./ProviderHost.ts"; | |
| 19 | import * as ProviderHost from "./ProviderHost.ts"; | |
| 20 | 20 | import { makeManagedServerProvider } from "./managedProvider.ts"; |
| 21 | 21 | |
| 22 | 22 | const emptyCapabilities = createModelCapabilities({ optionDescriptors: [] }); |
| ... | ... | @@ -99,11 +99,11 @@ const refreshedSnapshotSecond: ServerProvider = { |
| 99 | 99 | /** A host whose settings never change and whose background demand is fixed. */ |
| 100 | 100 | function layerProviderHost(input: { |
| 101 | 101 | readonly runBackgroundWork: boolean; |
| 102 | readonly settings?: Pick<ProviderHostShape, "settings">["settings"]; | |
| 102 | readonly settings?: Pick<ProviderHost.ProviderHostShape, "settings">["settings"]; | |
| 103 | 103 | }) { |
| 104 | 104 | return Layer.succeed( |
| 105 | ProviderHost, | |
| 106 | ProviderHost.of({ | |
| 105 | ProviderHost.ProviderHost, | |
| 106 | ProviderHost.ProviderHost.of({ | |
| 107 | 107 | paths: { |
| 108 | 108 | cwd: process.cwd(), |
| 109 | 109 | baseDir: "/t3", |
| ... | ... | @@ -281,7 +281,7 @@ describe("makeManagedServerProvider", () => { |
| 281 | 281 | }; |
| 282 | 282 | const serverSettingsRef = yield* Ref.make(initialServerSettings); |
| 283 | 283 | const serverSettingsChanges = yield* PubSub.unbounded<typeof initialServerSettings>(); |
| 284 | const hostSettings: ProviderHostShape["settings"] = { | |
| 284 | const hostSettings: ProviderHost.ProviderHostShape["settings"] = { | |
| 285 | 285 | get: Ref.get(serverSettingsRef), |
| 286 | 286 | changes: Stream.empty, |
| 287 | 287 | subscribe: PubSub.subscribe(serverSettingsChanges).pipe( |
packages/provider-core/src/server/managedProvider.ts+7-3| ... | ... | @@ -15,7 +15,7 @@ import * as Scope from "effect/Scope"; |
| 15 | 15 | import * as Stream from "effect/Stream"; |
| 16 | 16 | import * as Semaphore from "effect/Semaphore"; |
| 17 | 17 | |
| 18 | import { ProviderHost } from "./ProviderHost.ts"; | |
| 18 | import * as ProviderHost from "./ProviderHost.ts"; | |
| 19 | 19 | import { applyUsageLimitsUpdate, resolveUsageLimitsAfterProbe } from "./usageLimits.ts"; |
| 20 | 20 | import type { ServerProviderShape } from "./snapshot.ts"; |
| 21 | 21 | |
| ... | ... | @@ -53,8 +53,12 @@ export const makeManagedServerProvider = Effect.fn("makeManagedServerProvider")( |
| 53 | 53 | readonly refreshInterval?: Duration.Input; |
| 54 | 54 | readonly refreshOnInterval?: boolean; |
| 55 | 55 | readonly checkProviderOnSettingsChange?: (previous: Settings, next: Settings) => boolean; |
| 56 | }): Effect.fn.Return<ServerProviderShape, ServerSettingsError, Scope.Scope | ProviderHost> { | |
| 57 | const host = yield* ProviderHost; | |
| 56 | }): Effect.fn.Return< | |
| 57 | ServerProviderShape, | |
| 58 | ServerSettingsError, | |
| 59 | Scope.Scope | ProviderHost.ProviderHost | |
| 60 | > { | |
| 61 | const host = yield* ProviderHost.ProviderHost; | |
| 58 | 62 | const refreshSemaphore = yield* Semaphore.make(1); |
| 59 | 63 | const changesPubSub = yield* Effect.acquireRelease( |
| 60 | 64 | PubSub.unbounded<ServerProvider>(), |
packages/provider-core/src/server/snapshotSettings.ts+2-2| ... | ... | @@ -3,7 +3,7 @@ import * as Effect from "effect/Effect"; |
| 3 | 3 | import * as Equal from "effect/Equal"; |
| 4 | 4 | import * as Stream from "effect/Stream"; |
| 5 | 5 | |
| 6 | import type { ProviderHostShape } from "./ProviderHost.ts"; | |
| 6 | import type * as ProviderHost from "./ProviderHost.ts"; | |
| 7 | 7 | |
| 8 | 8 | export interface ProviderSnapshotSettings<Settings> { |
| 9 | 9 | readonly provider: Settings; |
| ... | ... | @@ -29,7 +29,7 @@ export function haveProviderSnapshotSettingsChanged<Settings>( |
| 29 | 29 | |
| 30 | 30 | export function makeProviderSnapshotSettingsSource<Settings>( |
| 31 | 31 | provider: Settings, |
| 32 | settings: ProviderHostShape["settings"], | |
| 32 | settings: ProviderHost.ProviderHostShape["settings"], | |
| 33 | 33 | ): { |
| 34 | 34 | readonly getSettings: Effect.Effect<ProviderSnapshotSettings<Settings>, ServerSettingsError>; |
| 35 | 35 | readonly streamSettings: Stream.Stream<ProviderSnapshotSettings<Settings>>; |
packages/provider-muse/src/server/adapter.test.ts+20-17| ... | ... | @@ -31,17 +31,13 @@ import * as Queue from "effect/Queue"; |
| 31 | 31 | import * as Schema from "effect/Schema"; |
| 32 | 32 | import * as Stream from "effect/Stream"; |
| 33 | 33 | |
| 34 | import { ProviderHost } from "@t3tools/provider-core/server/ProviderHost"; | |
| 34 | import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost"; | |
| 35 | 35 | import { layerTestProviderHost } from "@t3tools/provider-testing/host"; |
| 36 | 36 | import * as McpProviderSession from "@t3tools/provider-core/server/mcpSession"; |
| 37 | 37 | import type { MuseItem } from "./protocol.ts"; |
| 38 | 38 | import type { MuseSdkHost } from "./sdk.ts"; |
| 39 | 39 | import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator"; |
| 40 | import { | |
| 41 | ProviderAdapterV2RuntimePolicy, | |
| 42 | type ProviderAdapterV2Event, | |
| 43 | type ProviderAdapterV2TurnInput, | |
| 44 | } from "@t3tools/provider-core/server/ProviderAdapter"; | |
| 40 | import * as ProviderAdapter from "@t3tools/provider-core/server/ProviderAdapter"; | |
| 45 | 41 | import type { ProviderContinuationRequest } from "@t3tools/provider-core/server/continuationRequests"; |
| 46 | 42 | import { makeMuseAdapterV2, type MuseAdapterV2Options } from "./adapter.ts"; |
| 47 | 43 | |
| ... | ... | @@ -55,7 +51,7 @@ const INSTANCE_ID = ProviderInstanceId.make("muse_work"); |
| 55 | 51 | const THREAD_ID = ThreadId.make("thread-muse-test"); |
| 56 | 52 | const MODEL = "muse-spark-1.3-contributor"; |
| 57 | 53 | const museSettings = Schema.decodeSync(MuseSettings)({ enabled: true }); |
| 58 | const runtimePolicy = ProviderAdapterV2RuntimePolicy.make({ | |
| 54 | const runtimePolicy = ProviderAdapter.ProviderAdapterV2RuntimePolicy.make({ | |
| 59 | 55 | runtimeMode: "full-access", |
| 60 | 56 | interactionMode: "default", |
| 61 | 57 | cwd: null, |
| ... | ... | @@ -204,7 +200,7 @@ const makeHarness = Effect.fnUntraced(function* ( |
| 204 | 200 | settings: museSettings, |
| 205 | 201 | environment: { PATH: "/fake/bin" }, |
| 206 | 202 | idAllocator: yield* IdAllocator.IdAllocatorV2, |
| 207 | host: yield* ProviderHost, | |
| 203 | host: yield* ProviderHost.ProviderHost, | |
| 208 | 204 | fileSystem: yield* FileSystem.FileSystem, |
| 209 | 205 | createHost: async () => (hostCount++ === 0 ? fake.host : (replacement ?? fake).host), |
| 210 | 206 | ...overrides, |
| ... | ... | @@ -216,8 +212,8 @@ const makeHarness = Effect.fnUntraced(function* ( |
| 216 | 212 | runtimePolicy: policy, |
| 217 | 213 | ...(initialNativeThreadId ? { initialNativeThreadId } : {}), |
| 218 | 214 | }); |
| 219 | const emitted = yield* Queue.unbounded<ProviderAdapterV2Event>(); | |
| 220 | const allEvents: ProviderAdapterV2Event[] = []; | |
| 215 | const emitted = yield* Queue.unbounded<ProviderAdapter.ProviderAdapterV2Event>(); | |
| 216 | const allEvents: ProviderAdapter.ProviderAdapterV2Event[] = []; | |
| 221 | 217 | const eventsEnded = yield* Deferred.make<Exit.Exit<void, Stream.Error<typeof runtime.events>>>(); |
| 222 | 218 | yield* runtime.events.pipe( |
| 223 | 219 | Stream.runForEach((event) => |
| ... | ... | @@ -236,14 +232,21 @@ const makeHarness = Effect.fnUntraced(function* ( |
| 236 | 232 | runtimePolicy: policy, |
| 237 | 233 | ...(existingProviderThread ? { existingProviderThread } : {}), |
| 238 | 234 | }); |
| 239 | const takeEvent = Effect.fnUntraced(function* <T extends ProviderAdapterV2Event["type"]>( | |
| 235 | const takeEvent = Effect.fnUntraced(function* < | |
| 236 | T extends ProviderAdapter.ProviderAdapterV2Event["type"], | |
| 237 | >( | |
| 240 | 238 | type: T, |
| 241 | predicate: (event: Extract<ProviderAdapterV2Event, { type: T }>) => boolean = () => true, | |
| 239 | predicate: ( | |
| 240 | event: Extract<ProviderAdapter.ProviderAdapterV2Event, { type: T }>, | |
| 241 | ) => boolean = () => true, | |
| 242 | 242 | ) { |
| 243 | 243 | while (true) { |
| 244 | 244 | const event = yield* Queue.take(emitted); |
| 245 | if (event.type === type && predicate(event as Extract<ProviderAdapterV2Event, { type: T }>)) { | |
| 246 | return event as Extract<ProviderAdapterV2Event, { type: T }>; | |
| 245 | if ( | |
| 246 | event.type === type && | |
| 247 | predicate(event as Extract<ProviderAdapter.ProviderAdapterV2Event, { type: T }>) | |
| 248 | ) { | |
| 249 | return event as Extract<ProviderAdapter.ProviderAdapterV2Event, { type: T }>; | |
| 247 | 250 | } |
| 248 | 251 | } |
| 249 | 252 | }); |
| ... | ... | @@ -275,7 +278,7 @@ const turnInput = Effect.fnUntraced(function* ( |
| 275 | 278 | providerThread: OrchestrationV2ProviderThread, |
| 276 | 279 | runOrdinal = 1, |
| 277 | 280 | policy = runtimePolicy, |
| 278 | ): Effect.fn.Return<ProviderAdapterV2TurnInput> { | |
| 281 | ): Effect.fn.Return<ProviderAdapter.ProviderAdapterV2TurnInput> { | |
| 279 | 282 | const now = yield* DateTime.now; |
| 280 | 283 | const threadId = providerThread.appThreadId ?? THREAD_ID; |
| 281 | 284 | const selection = modelSelection(providerThread.providerInstanceId); |
| ... | ... | @@ -436,7 +439,7 @@ describe("MuseAdapterV2", () => { |
| 436 | 439 | settings: museSettings, |
| 437 | 440 | environment: { PATH: "/fake/bin" }, |
| 438 | 441 | idAllocator: yield* IdAllocator.IdAllocatorV2, |
| 439 | host: yield* ProviderHost, | |
| 442 | host: yield* ProviderHost.ProviderHost, | |
| 440 | 443 | fileSystem: yield* FileSystem.FileSystem, |
| 441 | 444 | createHost: async () => fake.host, |
| 442 | 445 | }); |
| ... | ... | @@ -833,7 +836,7 @@ describe("MuseAdapterV2", () => { |
| 833 | 836 | it.effect("keeps a workflow child's approval pending for the user past the turn's end", () => |
| 834 | 837 | Effect.gen(function* () { |
| 835 | 838 | const fake = yield* makeFakeMuse(); |
| 836 | const policy = ProviderAdapterV2RuntimePolicy.make({ | |
| 839 | const policy = ProviderAdapter.ProviderAdapterV2RuntimePolicy.make({ | |
| 837 | 840 | ...runtimePolicy, |
| 838 | 841 | runtimeMode: "approval-required", |
| 839 | 842 | }); |
packages/provider-muse/src/server/adapter.ts+39-52| ... | ... | @@ -35,7 +35,7 @@ import * as Semaphore from "effect/Semaphore"; |
| 35 | 35 | import * as Scope from "effect/Scope"; |
| 36 | 36 | import * as Stream from "effect/Stream"; |
| 37 | 37 | |
| 38 | import type { ProviderHostShape } from "@t3tools/provider-core/server/ProviderHost"; | |
| 38 | import type * as ProviderHost from "@t3tools/provider-core/server/ProviderHost"; | |
| 39 | 39 | import * as McpProviderSession from "@t3tools/provider-core/server/mcpSession"; |
| 40 | 40 | import { buildRuntimeInstructions } from "@t3tools/provider-core/server/runtimeInstructions"; |
| 41 | 41 | import { museModelCapabilities, resolveMuseReasoningEffort } from "./modelCatalog.ts"; |
| ... | ... | @@ -63,35 +63,13 @@ import { |
| 63 | 63 | type createMuseSdkHost, |
| 64 | 64 | type MuseSdkHost, |
| 65 | 65 | } from "./sdk.ts"; |
| 66 | import type { EventNdjsonLogger } from "@t3tools/provider-core/server/ProviderEventLoggers"; | |
| 66 | import type * as ProviderEventLoggers from "@t3tools/provider-core/server/ProviderEventLoggers"; | |
| 67 | 67 | import { |
| 68 | 68 | providerMessageTextWithAttachmentPaths, |
| 69 | 69 | isProviderNativeImageAttachment, |
| 70 | 70 | } from "@t3tools/provider-core/server/attachmentPrompt"; |
| 71 | 71 | import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator"; |
| 72 | import { | |
| 73 | ProviderAdapterEnsureThreadError, | |
| 74 | ProviderAdapterForkThreadError, | |
| 75 | ProviderAdapterInterruptError, | |
| 76 | ProviderAdapterOpenSessionError, | |
| 77 | ProviderAdapterProtocolError, | |
| 78 | ProviderAdapterReadThreadSnapshotError, | |
| 79 | ProviderAdapterResumeThreadError, | |
| 80 | ProviderAdapterRollbackThreadError, | |
| 81 | ProviderAdapterRuntimeRequestResponseError, | |
| 82 | ProviderAdapterSteerRunError, | |
| 83 | ProviderAdapterTurnStartError, | |
| 84 | ProviderAdapterV2, | |
| 85 | type ProviderAdapterV2Error, | |
| 86 | type ProviderAdapterV2Event, | |
| 87 | type ProviderAdapterV2EnsureThreadInput, | |
| 88 | type ProviderAdapterV2OpenSessionInput, | |
| 89 | type ProviderAdapterV2SessionRuntime, | |
| 90 | type ProviderAdapterV2Shape, | |
| 91 | type ProviderAdapterV2ThreadSnapshot, | |
| 92 | type ProviderAdapterV2TurnInput, | |
| 93 | type ProviderAdapterV2TurnMessage, | |
| 94 | } from "@t3tools/provider-core/server/ProviderAdapter"; | |
| 72 | import * as ProviderAdapter from "@t3tools/provider-core/server/ProviderAdapter"; | |
| 95 | 73 | import { |
| 96 | 74 | backgroundWorkNotification, |
| 97 | 75 | type BackgroundWorkReport, |
| ... | ... | @@ -102,8 +80,8 @@ import { turnScopedSelectionTransition } from "@t3tools/provider-core/server/sel |
| 102 | 80 | import { museItemStatus, museToolPresentation } from "./itemPresentation.ts"; |
| 103 | 81 | |
| 104 | 82 | const MUSE_PROVIDER = ProviderDriverKind.make("muse"); |
| 105 | const isOpenSessionError = Schema.is(ProviderAdapterOpenSessionError); | |
| 106 | const isProtocolError = Schema.is(ProviderAdapterProtocolError); | |
| 83 | const isOpenSessionError = Schema.is(ProviderAdapter.ProviderAdapterOpenSessionError); | |
| 84 | const isProtocolError = Schema.is(ProviderAdapter.ProviderAdapterProtocolError); | |
| 107 | 85 | |
| 108 | 86 | const MuseProviderCapabilitiesV2 = { |
| 109 | 87 | runtimePolicy: { enforcement: "native" }, |
| ... | ... | @@ -204,12 +182,12 @@ export interface MuseAdapterV2Options { |
| 204 | 182 | readonly settings: MuseSettings; |
| 205 | 183 | readonly environment: NodeJS.ProcessEnv; |
| 206 | 184 | readonly idAllocator: IdAllocator.IdAllocatorV2["Service"]; |
| 207 | readonly host: ProviderHostShape; | |
| 185 | readonly host: ProviderHost.ProviderHostShape; | |
| 208 | 186 | readonly fileSystem: FileSystem.FileSystem; |
| 209 | 187 | readonly modelCatalog?: Effect.Effect<ReadonlyArray<ServerProviderModel>>; |
| 210 | 188 | readonly createHost?: typeof createMuseSdkHost; |
| 211 | 189 | readonly requestTimeoutMs?: number; |
| 212 | readonly nativeEventLogger?: EventNdjsonLogger; | |
| 190 | readonly nativeEventLogger?: ProviderEventLoggers.EventNdjsonLogger; | |
| 213 | 191 | /** Where a turn Muse starts on its own (a finished workflow's report) asks for its run. */ |
| 214 | 192 | readonly continuationRequests?: { |
| 215 | 193 | readonly offer: ( |
| ... | ... | @@ -219,7 +197,7 @@ export interface MuseAdapterV2Options { |
| 219 | 197 | } |
| 220 | 198 | |
| 221 | 199 | interface ActiveTurn { |
| 222 | readonly input: ProviderAdapterV2TurnInput; | |
| 200 | readonly input: ProviderAdapter.ProviderAdapterV2TurnInput; | |
| 223 | 201 | providerTurn: OrchestrationV2ProviderTurn; |
| 224 | 202 | readonly nativeId: string; |
| 225 | 203 | /** Turns Muse started on its own while this run was active, which this run shows. */ |
| ... | ... | @@ -267,21 +245,23 @@ const TOOLS_WITH_NATIVE_ROWS = new Set(["write_todos", "request_user_input", "wo |
| 267 | 245 | const responseAnswerSchema = Schema.Union([Schema.String, Schema.Array(Schema.String)]); |
| 268 | 246 | |
| 269 | 247 | /** One scoped Muse host owns one native session; the orchestrator owns app runs and queuing. */ |
| 270 | export function makeMuseAdapterV2(options: MuseAdapterV2Options): ProviderAdapterV2Shape { | |
| 248 | export function makeMuseAdapterV2( | |
| 249 | options: MuseAdapterV2Options, | |
| 250 | ): ProviderAdapter.ProviderAdapterV2Shape { | |
| 271 | 251 | const { idAllocator } = options; |
| 272 | 252 | const protocolError = (detail: string, payload?: unknown) => |
| 273 | new ProviderAdapterProtocolError({ | |
| 253 | new ProviderAdapter.ProviderAdapterProtocolError({ | |
| 274 | 254 | driver: MUSE_PROVIDER, |
| 275 | 255 | detail, |
| 276 | 256 | ...(payload === undefined ? {} : { payload }), |
| 277 | 257 | }); |
| 278 | return ProviderAdapterV2.of({ | |
| 258 | return ProviderAdapter.ProviderAdapterV2.of({ | |
| 279 | 259 | instanceId: options.instanceId, |
| 280 | 260 | driver: MUSE_PROVIDER, |
| 281 | 261 | getCapabilities: () => Effect.succeed(MuseProviderCapabilitiesV2), |
| 282 | 262 | planSelectionTransition: () => Effect.succeed(turnScopedSelectionTransition()), |
| 283 | 263 | openSession: Effect.fn("MuseAdapterV2.openSession")(function* ( |
| 284 | input: ProviderAdapterV2OpenSessionInput, | |
| 264 | input: ProviderAdapter.ProviderAdapterV2OpenSessionInput, | |
| 285 | 265 | ) { |
| 286 | 266 | if (!options.settings.enabled) return yield* protocolError("Muse Code is disabled"); |
| 287 | 267 | if (input.runtimePolicy.interactionMode === "plan") |
| ... | ... | @@ -307,8 +287,8 @@ export function makeMuseAdapterV2(options: MuseAdapterV2Options): ProviderAdapte |
| 307 | 287 | lastError: null, |
| 308 | 288 | }; |
| 309 | 289 | const events = yield* Queue.unbounded< |
| 310 | ProviderAdapterV2Event, | |
| 311 | ProviderAdapterV2Error | Cause.Done | |
| 290 | ProviderAdapter.ProviderAdapterV2Event, | |
| 291 | ProviderAdapter.ProviderAdapterV2Error | Cause.Done | |
| 312 | 292 | >(); |
| 313 | 293 | type Inbox = |
| 314 | 294 | | { type: "notification"; method: string; params: unknown; epoch: number } |
| ... | ... | @@ -344,7 +324,7 @@ export function makeMuseAdapterV2(options: MuseAdapterV2Options): ProviderAdapte |
| 344 | 324 | let wake: |
| 345 | 325 | | { readonly nativeId: string; readonly events: Array<[string, unknown]> } |
| 346 | 326 | | undefined; |
| 347 | const emit = (event: ProviderAdapterV2Event) => | |
| 327 | const emit = (event: ProviderAdapter.ProviderAdapterV2Event) => | |
| 348 | 328 | Queue.offer(events, event).pipe(Effect.asVoid); |
| 349 | 329 | const decode = <A, I>(schema: Schema.Codec<A, I>, data: unknown) => |
| 350 | 330 | Schema.decodeUnknownEffect(schema)(data).pipe( |
| ... | ... | @@ -1400,7 +1380,7 @@ export function makeMuseAdapterV2(options: MuseAdapterV2Options): ProviderAdapte |
| 1400 | 1380 | ).pipe( |
| 1401 | 1381 | Effect.mapError( |
| 1402 | 1382 | (error) => |
| 1403 | new ProviderAdapterOpenSessionError({ | |
| 1383 | new ProviderAdapter.ProviderAdapterOpenSessionError({ | |
| 1404 | 1384 | driver: MUSE_PROVIDER, |
| 1405 | 1385 | providerSessionId: input.providerSessionId, |
| 1406 | 1386 | cause: error.cause, |
| ... | ... | @@ -1472,7 +1452,9 @@ export function makeMuseAdapterV2(options: MuseAdapterV2Options): ProviderAdapte |
| 1472 | 1452 | ); |
| 1473 | 1453 | yield* launchHost(); |
| 1474 | 1454 | |
| 1475 | const register = Effect.fnUntraced(function* (args: ProviderAdapterV2EnsureThreadInput) { | |
| 1455 | const register = Effect.fnUntraced(function* ( | |
| 1456 | args: ProviderAdapter.ProviderAdapterV2EnsureThreadInput, | |
| 1457 | ) { | |
| 1476 | 1458 | if (broken || closed) |
| 1477 | 1459 | return yield* protocolError("Muse host is unavailable; reopen the session"); |
| 1478 | 1460 | if (active) |
| ... | ... | @@ -1592,7 +1574,9 @@ export function makeMuseAdapterV2(options: MuseAdapterV2Options): ProviderAdapte |
| 1592 | 1574 | ), |
| 1593 | 1575 | ); |
| 1594 | 1576 | }); |
| 1595 | const prompt = Effect.fnUntraced(function* (message: ProviderAdapterV2TurnMessage) { | |
| 1577 | const prompt = Effect.fnUntraced(function* ( | |
| 1578 | message: ProviderAdapter.ProviderAdapterV2TurnMessage, | |
| 1579 | ) { | |
| 1596 | 1580 | const parts: SendUserTurnOptions<unknown>["input"] = []; |
| 1597 | 1581 | const text = providerMessageTextWithAttachmentPaths({ |
| 1598 | 1582 | text: message.text, |
| ... | ... | @@ -1635,7 +1619,7 @@ export function makeMuseAdapterV2(options: MuseAdapterV2Options): ProviderAdapte |
| 1635 | 1619 | ); |
| 1636 | 1620 | }); |
| 1637 | 1621 | const start = Effect.fnUntraced(function* ( |
| 1638 | turnInput: ProviderAdapterV2TurnInput, | |
| 1622 | turnInput: ProviderAdapter.ProviderAdapterV2TurnInput, | |
| 1639 | 1623 | compact = false, |
| 1640 | 1624 | ) { |
| 1641 | 1625 | if (!validateThread(turnInput.providerThread) || broken || closed) |
| ... | ... | @@ -1783,7 +1767,10 @@ export function makeMuseAdapterV2(options: MuseAdapterV2Options): ProviderAdapte |
| 1783 | 1767 | // Only messages are read back; T3 owns turn and item history. |
| 1784 | 1768 | const snapshot = Effect.fnUntraced(function* ( |
| 1785 | 1769 | current: OrchestrationV2ProviderThread, |
| 1786 | ): Effect.fn.Return<ProviderAdapterV2ThreadSnapshot, ProviderAdapterV2Error> { | |
| 1770 | ): Effect.fn.Return< | |
| 1771 | ProviderAdapter.ProviderAdapterV2ThreadSnapshot, | |
| 1772 | ProviderAdapter.ProviderAdapterV2Error | |
| 1773 | > { | |
| 1787 | 1774 | const result = yield* request("session/read", { excludeItems: false }, false).pipe( |
| 1788 | 1775 | Effect.flatMap((value) => decode(MuseSessionResult, value)), |
| 1789 | 1776 | ); |
| ... | ... | @@ -1821,7 +1808,7 @@ export function makeMuseAdapterV2(options: MuseAdapterV2Options): ProviderAdapte |
| 1821 | 1808 | providerPayload: items, |
| 1822 | 1809 | }; |
| 1823 | 1810 | }); |
| 1824 | const runtime: ProviderAdapterV2SessionRuntime = { | |
| 1811 | const runtime: ProviderAdapter.ProviderAdapterV2SessionRuntime = { | |
| 1825 | 1812 | instanceId: options.instanceId, |
| 1826 | 1813 | driver: MUSE_PROVIDER, |
| 1827 | 1814 | providerSessionId: input.providerSessionId, |
| ... | ... | @@ -1836,7 +1823,7 @@ export function makeMuseAdapterV2(options: MuseAdapterV2Options): ProviderAdapte |
| 1836 | 1823 | commands.withPermits(1), |
| 1837 | 1824 | Effect.mapError( |
| 1838 | 1825 | (cause) => |
| 1839 | new ProviderAdapterEnsureThreadError({ | |
| 1826 | new ProviderAdapter.ProviderAdapterEnsureThreadError({ | |
| 1840 | 1827 | driver: MUSE_PROVIDER, |
| 1841 | 1828 | threadId: args.threadId, |
| 1842 | 1829 | cause, |
| ... | ... | @@ -1853,7 +1840,7 @@ export function makeMuseAdapterV2(options: MuseAdapterV2Options): ProviderAdapte |
| 1853 | 1840 | commands.withPermits(1), |
| 1854 | 1841 | Effect.mapError( |
| 1855 | 1842 | (cause) => |
| 1856 | new ProviderAdapterResumeThreadError({ | |
| 1843 | new ProviderAdapter.ProviderAdapterResumeThreadError({ | |
| 1857 | 1844 | driver: MUSE_PROVIDER, |
| 1858 | 1845 | providerSessionId: input.providerSessionId, |
| 1859 | 1846 | providerThreadId: args.providerThread.id, |
| ... | ... | @@ -1866,7 +1853,7 @@ export function makeMuseAdapterV2(options: MuseAdapterV2Options): ProviderAdapte |
| 1866 | 1853 | commands.withPermits(1), |
| 1867 | 1854 | Effect.mapError( |
| 1868 | 1855 | (cause) => |
| 1869 | new ProviderAdapterTurnStartError({ | |
| 1856 | new ProviderAdapter.ProviderAdapterTurnStartError({ | |
| 1870 | 1857 | driver: MUSE_PROVIDER, |
| 1871 | 1858 | threadId: args.threadId, |
| 1872 | 1859 | providerThreadId: args.providerThread.id, |
| ... | ... | @@ -1897,7 +1884,7 @@ export function makeMuseAdapterV2(options: MuseAdapterV2Options): ProviderAdapte |
| 1897 | 1884 | commands.withPermits(1), |
| 1898 | 1885 | Effect.mapError( |
| 1899 | 1886 | (cause) => |
| 1900 | new ProviderAdapterSteerRunError({ | |
| 1887 | new ProviderAdapter.ProviderAdapterSteerRunError({ | |
| 1901 | 1888 | driver: MUSE_PROVIDER, |
| 1902 | 1889 | providerThreadId: args.providerThread.id, |
| 1903 | 1890 | providerTurnId: args.providerTurnId, |
| ... | ... | @@ -1946,7 +1933,7 @@ export function makeMuseAdapterV2(options: MuseAdapterV2Options): ProviderAdapte |
| 1946 | 1933 | commands.withPermits(1), |
| 1947 | 1934 | Effect.mapError( |
| 1948 | 1935 | (cause) => |
| 1949 | new ProviderAdapterInterruptError({ | |
| 1936 | new ProviderAdapter.ProviderAdapterInterruptError({ | |
| 1950 | 1937 | driver: MUSE_PROVIDER, |
| 1951 | 1938 | providerThreadId: args.providerThread.id, |
| 1952 | 1939 | providerTurnId: args.providerTurnId, |
| ... | ... | @@ -1999,7 +1986,7 @@ export function makeMuseAdapterV2(options: MuseAdapterV2Options): ProviderAdapte |
| 1999 | 1986 | }).pipe( |
| 2000 | 1987 | Effect.mapError( |
| 2001 | 1988 | (cause) => |
| 2002 | new ProviderAdapterRuntimeRequestResponseError({ | |
| 1989 | new ProviderAdapter.ProviderAdapterRuntimeRequestResponseError({ | |
| 2003 | 1990 | driver: MUSE_PROVIDER, |
| 2004 | 1991 | requestId: args.requestId, |
| 2005 | 1992 | cause, |
| ... | ... | @@ -2014,7 +2001,7 @@ export function makeMuseAdapterV2(options: MuseAdapterV2Options): ProviderAdapte |
| 2014 | 2001 | commands.withPermits(1), |
| 2015 | 2002 | Effect.mapError( |
| 2016 | 2003 | (cause) => |
| 2017 | new ProviderAdapterReadThreadSnapshotError({ | |
| 2004 | new ProviderAdapter.ProviderAdapterReadThreadSnapshotError({ | |
| 2018 | 2005 | driver: MUSE_PROVIDER, |
| 2019 | 2006 | providerThreadId: args.providerThread.id, |
| 2020 | 2007 | cause, |
| ... | ... | @@ -2025,7 +2012,7 @@ export function makeMuseAdapterV2(options: MuseAdapterV2Options): ProviderAdapte |
| 2025 | 2012 | // portable context handoff for forks and does not rewind Muse conversations. |
| 2026 | 2013 | rollbackThread: (args) => |
| 2027 | 2014 | Effect.fail( |
| 2028 | new ProviderAdapterRollbackThreadError({ | |
| 2015 | new ProviderAdapter.ProviderAdapterRollbackThreadError({ | |
| 2029 | 2016 | driver: MUSE_PROVIDER, |
| 2030 | 2017 | providerThreadId: args.providerThread.id, |
| 2031 | 2018 | checkpointId: args.target.checkpointId, |
| ... | ... | @@ -2034,7 +2021,7 @@ export function makeMuseAdapterV2(options: MuseAdapterV2Options): ProviderAdapte |
| 2034 | 2021 | ), |
| 2035 | 2022 | forkThread: (args) => |
| 2036 | 2023 | Effect.fail( |
| 2037 | new ProviderAdapterForkThreadError({ | |
| 2024 | new ProviderAdapter.ProviderAdapterForkThreadError({ | |
| 2038 | 2025 | driver: MUSE_PROVIDER, |
| 2039 | 2026 | providerThreadId: args.sourceProviderThread.id, |
| 2040 | 2027 | cause: "Muse Code does not support native forks in T3 Code.", |
packages/provider-muse/src/server/driver.ts+3-3| ... | ... | @@ -8,7 +8,7 @@ import * as Schema from "effect/Schema"; |
| 8 | 8 | import { HttpClient } from "effect/http"; |
| 9 | 9 | import { ChildProcessSpawner } from "effect/process"; |
| 10 | 10 | |
| 11 | import { ProviderHost } from "@t3tools/provider-core/server/ProviderHost"; | |
| 11 | import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost"; | |
| 12 | 12 | import { expandHomePath } from "@t3tools/provider-core/server/pathExpansion"; |
| 13 | 13 | import { makeMuseTextGeneration } from "./textGeneration.ts"; |
| 14 | 14 | import { ProviderDriverError } from "@t3tools/provider-core/server/errors"; |
| ... | ... | @@ -42,7 +42,7 @@ const decodeMuseSettings = Schema.decodeSync(MuseSettings); |
| 42 | 42 | |
| 43 | 43 | export type MuseDriverEnv = |
| 44 | 44 | | IdAllocator.IdAllocatorV2 |
| 45 | | ProviderHost | |
| 45 | | ProviderHost.ProviderHost | |
| 46 | 46 | | ChildProcessSpawner.ChildProcessSpawner |
| 47 | 47 | | FileSystem.FileSystem |
| 48 | 48 | | HttpClient.HttpClient |
| ... | ... | @@ -60,7 +60,7 @@ export const MuseDriver: ProviderDriver<MuseSettings, MuseDriverEnv> = { |
| 60 | 60 | const fileSystem = yield* FileSystem.FileSystem; |
| 61 | 61 | const path = yield* Path.Path; |
| 62 | 62 | const httpClient = yield* HttpClient.HttpClient; |
| 63 | const host = yield* ProviderHost; | |
| 63 | const host = yield* ProviderHost.ProviderHost; | |
| 64 | 64 | const eventLoggers = yield* ProviderEventLoggers.ProviderEventLoggers; |
| 65 | 65 | const { cwd } = host.paths; |
| 66 | 66 | const idAllocator = yield* IdAllocator.IdAllocatorV2; |
packages/provider-pi/src/server/adapter.test.ts+10-13| ... | ... | @@ -33,16 +33,12 @@ import * as TestClock from "effect/testing/TestClock"; |
| 33 | 33 | import { ChildProcess, ChildProcessSpawner } from "effect/process"; |
| 34 | 34 | import { HostProcessEnvironment } from "@t3tools/shared/hostProcess"; |
| 35 | 35 | |
| 36 | import { ProviderHost } from "@t3tools/provider-core/server/ProviderHost"; | |
| 36 | import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost"; | |
| 37 | 37 | import { layerTestProviderHost } from "@t3tools/provider-testing/host"; |
| 38 | 38 | import * as ProviderContinuationRequests from "@t3tools/provider-core/server/continuationRequests"; |
| 39 | 39 | import * as McpProviderSession from "@t3tools/provider-core/server/mcpSession"; |
| 40 | 40 | import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator"; |
| 41 | import { | |
| 42 | ProviderAdapterV2RuntimePolicy, | |
| 43 | type ProviderAdapterV2Event, | |
| 44 | type ProviderAdapterV2SessionRuntime, | |
| 45 | } from "@t3tools/provider-core/server/ProviderAdapter"; | |
| 41 | import * as ProviderAdapter from "@t3tools/provider-core/server/ProviderAdapter"; | |
| 46 | 42 | import { handoffBudget } from "@t3tools/provider-core/server/handoffBudget"; |
| 47 | 43 | import { |
| 48 | 44 | makePiAdapterV2, |
| ... | ... | @@ -68,7 +64,7 @@ const FAKE_SESSION_FILE = "/fake/.pi/agent/sessions/--workspace--/0001_abc.jsonl |
| 68 | 64 | /** Deliberately outside the valid pid range so a group-kill can never land. */ |
| 69 | 65 | const FAKE_PID = 999_999_999; |
| 70 | 66 | |
| 71 | const runtimePolicy = ProviderAdapterV2RuntimePolicy.make({ | |
| 67 | const runtimePolicy = ProviderAdapter.ProviderAdapterV2RuntimePolicy.make({ | |
| 72 | 68 | runtimeMode: "full-access", |
| 73 | 69 | interactionMode: "default", |
| 74 | 70 | cwd: null, |
| ... | ... | @@ -331,7 +327,7 @@ const makeAdapter = Effect.fnUntraced(function* ( |
| 331 | 327 | continuationRequests?: PiAdapterV2Options["continuationRequests"], |
| 332 | 328 | ) { |
| 333 | 329 | const idAllocator = yield* IdAllocator.IdAllocatorV2; |
| 334 | const host = yield* ProviderHost; | |
| 330 | const host = yield* ProviderHost.ProviderHost; | |
| 335 | 331 | const fileSystem = yield* FileSystem.FileSystem; |
| 336 | 332 | const spawner = |
| 337 | 333 | forkFake === undefined |
| ... | ... | @@ -383,12 +379,12 @@ const openRuntime = Effect.fnUntraced(function* ( |
| 383 | 379 | modelSelection: modelSelection(model), |
| 384 | 380 | runtimePolicy, |
| 385 | 381 | }); |
| 386 | const emitted = yield* Queue.unbounded<ProviderAdapterV2Event>(); | |
| 382 | const emitted = yield* Queue.unbounded<ProviderAdapter.ProviderAdapterV2Event>(); | |
| 387 | 383 | yield* runtime.events.pipe( |
| 388 | 384 | Stream.runForEach((event) => Queue.offer(emitted, event)), |
| 389 | 385 | Effect.forkScoped, |
| 390 | 386 | ); |
| 391 | const takeEvent = (predicate: (event: ProviderAdapterV2Event) => boolean) => | |
| 387 | const takeEvent = (predicate: (event: ProviderAdapter.ProviderAdapterV2Event) => boolean) => | |
| 392 | 388 | Effect.gen(function* () { |
| 393 | 389 | while (true) { |
| 394 | 390 | const event = yield* Queue.take(emitted); |
| ... | ... | @@ -426,7 +422,7 @@ const makeAppThread = Effect.fnUntraced(function* (model: string, threadId = THR |
| 426 | 422 | }); |
| 427 | 423 | |
| 428 | 424 | const startTurn = Effect.fnUntraced(function* ( |
| 429 | runtime: ProviderAdapterV2SessionRuntime, | |
| 425 | runtime: ProviderAdapter.ProviderAdapterV2SessionRuntime, | |
| 430 | 426 | providerThread: OrchestrationV2ProviderThread, |
| 431 | 427 | model = "default", |
| 432 | 428 | attachments: ReadonlyArray<ChatAttachment> = [], |
| ... | ... | @@ -832,8 +828,9 @@ describe("PiAdapterV2", () => { |
| 832 | 828 | }); |
| 833 | 829 | yield* fake.emit({ type: "agent_start" }); |
| 834 | 830 | yield* Queue.take(offers); |
| 835 | const requests: Array<Extract<ProviderAdapterV2Event, { type: "runtime_request.updated" }>> = | |
| 836 | []; | |
| 831 | const requests: Array< | |
| 832 | Extract<ProviderAdapter.ProviderAdapterV2Event, { type: "runtime_request.updated" }> | |
| 833 | > = []; | |
| 837 | 834 | fake.deferNextModelSelection(); |
| 838 | 835 | const starting = yield* startTurn( |
| 839 | 836 | runtime, |
packages/provider-pi/src/server/adapter.ts+5-5| ... | ... | @@ -60,7 +60,7 @@ import * as Semaphore from "effect/Semaphore"; |
| 60 | 60 | import * as Stream from "effect/Stream"; |
| 61 | 61 | import { ChildProcessSpawner } from "effect/process"; |
| 62 | 62 | |
| 63 | import { ProviderHost, type ProviderHostShape } from "@t3tools/provider-core/server/ProviderHost"; | |
| 63 | import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost"; | |
| 64 | 64 | import { mcpToolPresentation } from "@t3tools/provider-core/server/mcpToolPresentation"; |
| 65 | 65 | import * as McpProviderSession from "@t3tools/provider-core/server/mcpSession"; |
| 66 | 66 | import { |
| ... | ... | @@ -231,7 +231,7 @@ export interface PiAdapterV2Options { |
| 231 | 231 | readonly spawner: ChildProcessSpawner.ChildProcessSpawner["Service"]; |
| 232 | 232 | readonly fileSystem: FileSystem.FileSystem; |
| 233 | 233 | readonly idAllocator: IdAllocator.IdAllocatorV2["Service"]; |
| 234 | readonly host: ProviderHostShape; | |
| 234 | readonly host: ProviderHost.ProviderHostShape; | |
| 235 | 235 | readonly continuationRequests?: { |
| 236 | 236 | readonly offer: ( |
| 237 | 237 | request: ProviderContinuationRequests.ProviderContinuationRequest, |
| ... | ... | @@ -3201,7 +3201,7 @@ export type PiAdapterV2DriverEnv = |
| 3201 | 3201 | | ChildProcessSpawner.ChildProcessSpawner |
| 3202 | 3202 | | FileSystem.FileSystem |
| 3203 | 3203 | | IdAllocator.IdAllocatorV2 |
| 3204 | | ProviderHost; | |
| 3204 | | ProviderHost.ProviderHost; | |
| 3205 | 3205 | |
| 3206 | 3206 | export const PiAdapterV2Driver: ProviderAdapterDriver<PiSettings, PiAdapterV2DriverEnv> = { |
| 3207 | 3207 | driverKind: PI_DRIVER_KIND, |
| ... | ... | @@ -3213,7 +3213,7 @@ export const PiAdapterV2Driver: ProviderAdapterDriver<PiSettings, PiAdapterV2Dri |
| 3213 | 3213 | const spawner = yield* ChildProcessSpawner.ChildProcessSpawner; |
| 3214 | 3214 | const fileSystem = yield* FileSystem.FileSystem; |
| 3215 | 3215 | const idAllocator = yield* IdAllocator.IdAllocatorV2; |
| 3216 | const host = yield* ProviderHost; | |
| 3216 | const host = yield* ProviderHost.ProviderHost; | |
| 3217 | 3217 | const continuationRequests = yield* ProviderContinuationRequests.ProviderContinuationRequests; |
| 3218 | 3218 | return makePiAdapterV2({ |
| 3219 | 3219 | instanceId: input.instanceId, |
| ... | ... | @@ -3249,7 +3249,7 @@ const layer: Layer.Layer<ProviderAdapter.ProviderAdapterV2, never, PiAdapterV2Dr |
| 3249 | 3249 | const spawner = yield* ChildProcessSpawner.ChildProcessSpawner; |
| 3250 | 3250 | const fileSystem = yield* FileSystem.FileSystem; |
| 3251 | 3251 | const idAllocator = yield* IdAllocator.IdAllocatorV2; |
| 3252 | const host = yield* ProviderHost; | |
| 3252 | const host = yield* ProviderHost.ProviderHost; | |
| 3253 | 3253 | const continuationRequests = yield* ProviderContinuationRequests.ProviderContinuationRequests; |
| 3254 | 3254 | return makePiAdapterV2({ |
| 3255 | 3255 | instanceId: PI_DEFAULT_INSTANCE_ID, |
packages/provider-pi/src/server/driver.ts+3-3| ... | ... | @@ -15,7 +15,7 @@ import * as Schema from "effect/Schema"; |
| 15 | 15 | import { HttpClient } from "effect/http"; |
| 16 | 16 | import { ChildProcessSpawner } from "effect/process"; |
| 17 | 17 | |
| 18 | import { ProviderHost } from "@t3tools/provider-core/server/ProviderHost"; | |
| 18 | import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost"; | |
| 19 | 19 | import { makePiTextGeneration } from "./textGeneration.ts"; |
| 20 | 20 | import { PiAdapterV2Driver, type PiAdapterV2DriverEnv } from "./adapter.ts"; |
| 21 | 21 | import { ProviderDriverError } from "@t3tools/provider-core/server/errors"; |
| ... | ... | @@ -56,7 +56,7 @@ const UPDATE = makePackageManagedProviderMaintenanceResolver({ |
| 56 | 56 | |
| 57 | 57 | export type PiDriverEnv = |
| 58 | 58 | | PiAdapterV2DriverEnv |
| 59 | | ProviderHost | |
| 59 | | ProviderHost.ProviderHost | |
| 60 | 60 | | ChildProcessSpawner.ChildProcessSpawner |
| 61 | 61 | | FileSystem.FileSystem |
| 62 | 62 | | HttpClient.HttpClient |
| ... | ... | @@ -92,7 +92,7 @@ export const PiDriver: ProviderDriver<PiSettings, PiDriverEnv> = { |
| 92 | 92 | const fileSystem = yield* FileSystem.FileSystem; |
| 93 | 93 | const pathService = yield* Path.Path; |
| 94 | 94 | const httpClient = yield* HttpClient.HttpClient; |
| 95 | const host = yield* ProviderHost; | |
| 95 | const host = yield* ProviderHost.ProviderHost; | |
| 96 | 96 | const { cwd } = host.paths; |
| 97 | 97 | const processEnv = mergeProviderInstanceEnvironment(environment); |
| 98 | 98 | const continuationIdentity = defaultProviderContinuationIdentity({ |
packages/provider-testing/src/host.ts+5-5| ... | ... | @@ -1,12 +1,12 @@ |
| 1 | 1 | /** |
| 2 | * A `ProviderHost` for driver and adapter tests. Its directories live in a | |
| 2 | * A `ProviderHost.ProviderHost` for driver and adapter tests. Its directories live in a | |
| 3 | 3 | * scoped temp directory, settings are fixed, and background work always runs |
| 4 | 4 | * unless the test says otherwise. |
| 5 | 5 | * |
| 6 | 6 | * @module provider-testing/host |
| 7 | 7 | */ |
| 8 | 8 | import { DEFAULT_SERVER_SETTINGS, type ServerSettings } from "@t3tools/contracts"; |
| 9 | import { ProviderHost } from "@t3tools/provider-core/server/ProviderHost"; | |
| 9 | import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost"; | |
| 10 | 10 | import * as Effect from "effect/Effect"; |
| 11 | 11 | import * as FileSystem from "effect/FileSystem"; |
| 12 | 12 | import * as Layer from "effect/Layer"; |
| ... | ... | @@ -23,9 +23,9 @@ export interface TestProviderHostOptions { |
| 23 | 23 | |
| 24 | 24 | export const layerTestProviderHost = ( |
| 25 | 25 | options: TestProviderHostOptions = {}, |
| 26 | ): Layer.Layer<ProviderHost, never, FileSystem.FileSystem | Path.Path> => | |
| 26 | ): Layer.Layer<ProviderHost.ProviderHost, never, FileSystem.FileSystem | Path.Path> => | |
| 27 | 27 | Layer.effect( |
| 28 | ProviderHost, | |
| 28 | ProviderHost.ProviderHost, | |
| 29 | 29 | Effect.gen(function* () { |
| 30 | 30 | const fileSystem = yield* FileSystem.FileSystem; |
| 31 | 31 | const path = yield* Path.Path; |
| ... | ... | @@ -39,7 +39,7 @@ export const layerTestProviderHost = ( |
| 39 | 39 | yield* fileSystem.makeDirectory(directory, { recursive: true }).pipe(Effect.orDie); |
| 40 | 40 | } |
| 41 | 41 | const settings = options.settings ?? DEFAULT_SERVER_SETTINGS; |
| 42 | return ProviderHost.of({ | |
| 42 | return ProviderHost.ProviderHost.of({ | |
| 43 | 43 | paths: { cwd: options.cwd ?? process.cwd(), baseDir, stateDir, providerStatusCacheDir }, |
| 44 | 44 | settings: { |
| 45 | 45 | get: Effect.succeed(settings), |