@tangle-network/agent-runtime 0.79.0 → 0.79.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent.js +3 -2
- package/dist/agent.js.map +1 -1
- package/dist/{chunk-GZX3PI7V.js → chunk-2DS6T46I.js} +3 -3
- package/dist/{chunk-N2JJDGLJ.js → chunk-75V2XXYJ.js} +8 -6
- package/dist/{chunk-N2JJDGLJ.js.map → chunk-75V2XXYJ.js.map} +1 -1
- package/dist/{chunk-F6G3SSHY.js → chunk-SONQUREI.js} +2 -2
- package/dist/{chunk-EZ2QESTP.js → chunk-TSDKBFZP.js} +34 -925
- package/dist/chunk-TSDKBFZP.js.map +1 -0
- package/dist/chunk-Z3RRRPRB.js +916 -0
- package/dist/chunk-Z3RRRPRB.js.map +1 -0
- package/dist/{coordination-09JTQnlF.d.ts → coordination-BoEPhGas.d.ts} +7 -62
- package/dist/environment-provider.d.ts +66 -0
- package/dist/environment-provider.js +16 -0
- package/dist/environment-provider.js.map +1 -0
- package/dist/index.d.ts +4 -3
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/{loop-runner-bin-Ddgf4DkS.d.ts → loop-runner-bin-DCr5OMe5.d.ts} +2 -2
- package/dist/loop-runner-bin.d.ts +4 -3
- package/dist/loop-runner-bin.js +4 -3
- package/dist/loops.d.ts +9 -6
- package/dist/loops.js +9 -7
- package/dist/mcp/bin.js +2 -1
- package/dist/mcp/bin.js.map +1 -1
- package/dist/mcp/index.d.ts +6 -4
- package/dist/mcp/index.js +9 -7
- package/dist/mcp/index.js.map +1 -1
- package/dist/{worktree-CUn0d-ZT.d.ts → types-C1sozrte.d.ts} +1 -123
- package/dist/worktree-CpptK3oF.d.ts +125 -0
- package/dist/{worktree-fanout-DwwatTdY.d.ts → worktree-fanout-CtQrRDME.d.ts} +2 -1
- package/package.json +9 -1
- package/dist/chunk-EZ2QESTP.js.map +0 -1
- /package/dist/{chunk-GZX3PI7V.js.map → chunk-2DS6T46I.js.map} +0 -0
- /package/dist/{chunk-F6G3SSHY.js.map → chunk-SONQUREI.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/runtime/util.ts","../src/runtime/environment-provider.ts"],"sourcesContent":["/**\n * @experimental\n *\n * Internal loop-kernel utilities shared across the kernel, drivers, and the\n * sandbox-acquire layer. Not part of the public barrel surface.\n */\n\nimport type { SandboxInstance } from '@tangle-network/sandbox'\nimport type { LoopTokenUsage } from './types'\n\n/**\n * Best-effort sandbox delete. Skips instances without a `delete` (test fakes);\n * swallows errors (the platform reaps on expiry). Returns `false` when delete\n * threw, `true` otherwise, so callers can surface a leak if they choose.\n */\nexport async function deleteBoxSafe(box: SandboxInstance | undefined): Promise<boolean> {\n if (!box || typeof (box as { delete?: unknown }).delete !== 'function') return true\n try {\n await box.delete()\n return true\n } catch {\n return false\n }\n}\n\n/** Short base36 id for trace correlation. Not cryptographic, not collision-free. */\nexport function randomSuffix(len = 8): string {\n return Math.random()\n .toString(36)\n .slice(2, 2 + len)\n}\n\n/** Collision-resistant id for sandbox naming (find-by-name recovery must be unique). */\nexport function randomUuid(): string {\n return crypto.randomUUID()\n}\n\n/** Construct an AbortError. Downstream code pattern-matches on `err.name`. */\nexport function abortError(): Error {\n const err = new Error('aborted')\n err.name = 'AbortError'\n return err\n}\n\n/** Throw an AbortError. */\nexport function throwAbort(): never {\n throw abortError()\n}\n\n/** Throw if the signal is already aborted; otherwise no-op. */\nexport function throwIfAborted(signal: AbortSignal | undefined): void {\n if (signal?.aborted) throw abortError()\n}\n\n/** True for any error whose `name` is `AbortError` (the cross-kernel abort contract). */\nexport function isAbortError(err: unknown): boolean {\n return err instanceof Error && err.name === 'AbortError'\n}\n\n/**\n * Sleep that resolves early on abort and always clears its timer so it never\n * keeps the event loop alive. Resolves (does not reject) on abort — callers\n * re-check the signal explicitly after the sleep.\n */\nexport function sleep(ms: number, signal?: AbortSignal): Promise<void> {\n return new Promise((resolve) => {\n if (signal?.aborted) {\n resolve()\n return\n }\n let onAbort: (() => void) | undefined\n const timer = setTimeout(() => {\n if (onAbort && signal) signal.removeEventListener('abort', onAbort)\n resolve()\n }, ms)\n if (signal) {\n onAbort = () => {\n clearTimeout(timer)\n resolve()\n }\n signal.addEventListener('abort', onAbort, { once: true })\n }\n })\n}\n\n/**\n * Race a promise against a timeout. Resolves with the value if it settles in\n * time, otherwise resolves with `undefined`. Always clears the timer.\n */\nexport function withTimeout<T>(promise: Promise<T>, ms: number): Promise<T | undefined> {\n return new Promise<T | undefined>((resolve) => {\n const timer = setTimeout(() => resolve(undefined), ms)\n promise.then(\n (value) => {\n clearTimeout(timer)\n resolve(value)\n },\n () => {\n clearTimeout(timer)\n resolve(undefined)\n },\n )\n })\n}\n\ninterface StringifyOptions {\n /** Pretty-print with 2-space indent. Default false (compact). */\n pretty?: boolean\n /** Truncate to this many chars, appending `…`. Default unbounded. */\n max?: number\n}\n\n/**\n * `JSON.stringify` with a `String()` fallback on throw (cyclic / non-JSON).\n * Strings pass through unstringified so a preview of a string output is the\n * string itself, not a quoted re-encoding.\n */\nexport function stringifySafe(value: unknown, opts: StringifyOptions = {}): string {\n let s: string\n try {\n if (typeof value === 'string') {\n s = value\n } else {\n const json = opts.pretty ? JSON.stringify(value, null, 2) : JSON.stringify(value)\n s = json ?? String(value)\n }\n } catch {\n s = String(value)\n }\n if (opts.max !== undefined && s.length > opts.max) return `${s.slice(0, opts.max)}…`\n return s\n}\n\n/** A fresh zero token-usage accumulator. */\nexport function zeroTokenUsage(): LoopTokenUsage {\n return { input: 0, output: 0 }\n}\n\n/** Add `delta` into `acc` in place. Missing fields count as zero. */\nexport function addTokenUsage(acc: LoopTokenUsage, delta: Partial<LoopTokenUsage>): void {\n acc.input += delta.input ?? 0\n acc.output += delta.output ?? 0\n}\n\n/**\n * Map `items` through `fn` with at most `limit` calls in flight at once,\n * preserving input order in the result. On the first `fn` rejection no NEW\n * items are picked up; already-in-flight calls are awaited, then the first\n * error is rethrown. `limit` is clamped to ≥ 1.\n *\n * Used where a burst of provisioning (e.g. forking N child boxes) must respect\n * the loop's concurrency bound instead of firing all N at once.\n */\nexport async function mapWithConcurrency<T, R>(\n items: readonly T[],\n limit: number,\n fn: (item: T, index: number) => Promise<R>,\n): Promise<R[]> {\n const bound = Math.max(1, Math.floor(limit))\n const results = new Array<R>(items.length)\n let next = 0\n let failed = false\n const worker = async (): Promise<void> => {\n while (!failed) {\n const i = next\n next += 1\n if (i >= items.length) return\n try {\n results[i] = await fn(items[i] as T, i)\n } catch (err) {\n failed = true\n throw err\n }\n }\n }\n const workerCount = Math.min(bound, items.length)\n await Promise.all(Array.from({ length: workerCount }, () => worker()))\n return results\n}\n","import type {\n AgentProfile,\n AgentProfileValidationResult,\n InputPart,\n TokenUsage,\n} from '@tangle-network/agent-interface'\nimport type {\n AgentEnvironment,\n AgentEnvironmentCapabilities,\n AgentEnvironmentEvent,\n AgentEnvironmentProvider,\n AgentEnvironmentQuery,\n AgentEnvironmentStatus,\n AgentEnvironmentSummary,\n AgentProfileRef,\n AgentSession,\n AgentSessionRef,\n AgentSessionStatus,\n AgentTurnInput,\n AgentTurnResult,\n CheckpointRef,\n CheckpointRequest,\n CreateAgentEnvironmentInput,\n ExecRequest,\n ExecResult,\n ForkRequest,\n PlacementInfo,\n ResourceRequest,\n} from '@tangle-network/agent-interface/environment-provider'\nimport type {\n BackendType,\n CreateSandboxOptions,\n PromptOptions,\n PromptResult,\n SandboxEvent,\n ExecResult as SandboxExecResult,\n SandboxInstance,\n} from '@tangle-network/sandbox'\nimport type {\n Executor,\n ExecutorContext,\n ExecutorFactory,\n ExecutorResult,\n Runtime,\n Spend,\n UsageEvent,\n} from './supervise/types'\nimport type { LoopSandboxPlacement, SandboxClient } from './types'\nimport { zeroTokenUsage } from './util'\n\n// Keep this file loadable from the lean `./environment-provider` export without agent-eval installed.\nclass ValidationError extends Error {\n constructor(message: string, options?: { cause?: unknown }) {\n super(message, options)\n this.name = 'ValidationError'\n }\n}\n\nexport type {\n AgentEnvironment,\n AgentEnvironmentCapabilities,\n AgentEnvironmentEvent,\n AgentEnvironmentProvider,\n AgentEnvironmentQuery,\n AgentEnvironmentStatus,\n AgentEnvironmentSummary,\n AgentProfileRef,\n AgentSession,\n AgentSessionRef,\n AgentSessionStatus,\n AgentTurnInput,\n AgentTurnResult,\n CheckpointRef,\n CheckpointRequest,\n CreateAgentEnvironmentInput,\n ExecRequest,\n ExecResult,\n ForkRequest,\n PlacementInfo,\n ResourceRequest,\n WorkspaceRequest,\n} from '@tangle-network/agent-interface/environment-provider'\n\n/** Provider object or registry name accepted by runtime provider adapters.\n * @experimental */\nexport type AgentEnvironmentProviderRef = AgentEnvironmentProvider | string\n\n/** In-memory registry for named `AgentEnvironmentProvider` instances.\n * @experimental */\nexport interface AgentEnvironmentProviderRegistry {\n register(provider: AgentEnvironmentProvider, options?: { replace?: boolean }): void\n has(name: string): boolean\n get(name: string): AgentEnvironmentProvider | undefined\n require(name: string): AgentEnvironmentProvider\n names(): string[]\n providers(): AgentEnvironmentProvider[]\n capabilities(name: string): Promise<AgentEnvironmentCapabilities>\n}\n\n/** Create a registry that resolves provider names to concrete provider instances.\n * @experimental */\nexport function createAgentEnvironmentProviderRegistry(\n providers: Iterable<AgentEnvironmentProvider> = [],\n): AgentEnvironmentProviderRegistry {\n const entries = new Map<string, AgentEnvironmentProvider>()\n\n const registry: AgentEnvironmentProviderRegistry = {\n register(provider, options = {}): void {\n if (!provider.name) {\n throw new ValidationError('agent environment provider registry: provider.name required')\n }\n if (!options.replace && entries.has(provider.name)) {\n throw new ValidationError(\n `agent environment provider registry: provider \"${provider.name}\" already registered`,\n )\n }\n entries.set(provider.name, provider)\n },\n has(name): boolean {\n return entries.has(name)\n },\n get(name): AgentEnvironmentProvider | undefined {\n return entries.get(name)\n },\n require(name): AgentEnvironmentProvider {\n const provider = entries.get(name)\n if (!provider) {\n const available = Array.from(entries.keys()).sort()\n const suffix = available.length > 0 ? `; available: ${available.join(', ')}` : ''\n throw new ValidationError(\n `agent environment provider registry: provider \"${name}\" is not registered${suffix}`,\n )\n }\n return provider\n },\n names(): string[] {\n return Array.from(entries.keys()).sort()\n },\n providers(): AgentEnvironmentProvider[] {\n return registry.names().map((name) => registry.require(name))\n },\n async capabilities(name): Promise<AgentEnvironmentCapabilities> {\n return registry.require(name).capabilities()\n },\n }\n\n for (const provider of providers) registry.register(provider)\n return registry\n}\n\n/** Resolve a provider instance or registry name, failing loudly when a name is unknown.\n * @experimental */\nexport function resolveAgentEnvironmentProvider(\n provider: AgentEnvironmentProviderRef,\n registry?: AgentEnvironmentProviderRegistry,\n): AgentEnvironmentProvider {\n if (typeof provider !== 'string') return provider\n if (!registry) {\n throw new ValidationError(\n `agent environment provider \"${provider}\" requires an AgentEnvironmentProviderRegistry`,\n )\n }\n return registry.require(provider)\n}\n\n/** Options for exposing an `AgentEnvironmentProvider` through the legacy sandbox client port.\n * @experimental */\nexport interface ProviderAsSandboxClientOptions {\n defaults?: Partial<CreateAgentEnvironmentInput>\n requireTerminalEvent?: boolean\n mapCreateOptions?: (\n options: CreateSandboxOptions | undefined,\n ) => Partial<CreateAgentEnvironmentInput>\n}\n\n/** Adapt a neutral environment provider to the `SandboxClient` interface used by existing loop paths.\n * @experimental */\nexport function providerAsSandboxClient(\n provider: AgentEnvironmentProvider,\n options: ProviderAsSandboxClientOptions = {},\n): SandboxClient {\n return {\n async create(createOptions?: CreateSandboxOptions): Promise<SandboxInstance> {\n const mapped = {\n ...(options.defaults ?? {}),\n ...createInputFromSandboxOptions(createOptions),\n ...(options.mapCreateOptions?.(createOptions) ?? {}),\n }\n if (mapped.profile === undefined) {\n throw new ValidationError(\n `providerAsSandboxClient(${provider.name}): profile required in defaults or CreateSandboxOptions.backend.profile`,\n )\n }\n const environment = await provider.create(mapped as CreateAgentEnvironmentInput)\n return environmentAsSandboxInstance(environment, {\n requireTerminalEvent: options.requireTerminalEvent ?? true,\n })\n },\n }\n}\n\n/** Options for wrapping the current Tangle sandbox client as an environment provider.\n * @experimental */\nexport interface SandboxClientProviderOptions {\n name?: string\n defaultBackend?: BackendType\n capabilities?:\n | AgentEnvironmentCapabilities\n | (() => AgentEnvironmentCapabilities | Promise<AgentEnvironmentCapabilities>)\n validateProfile?: (\n profile: AgentProfileRef,\n ) => AgentProfileValidationResult | Promise<AgentProfileValidationResult>\n mapCreateInput?: (input: CreateAgentEnvironmentInput) => CreateSandboxOptions\n}\n\n/** Adapt a `SandboxClient` into the shared `AgentEnvironmentProvider` contract.\n * @experimental */\nexport function sandboxClientAsProvider(\n client: SandboxClient,\n options: SandboxClientProviderOptions = {},\n): AgentEnvironmentProvider {\n const providerName = options.name ?? 'tangle-sandbox'\n return {\n name: providerName,\n capabilities: async () => {\n if (options.capabilities) {\n return typeof options.capabilities === 'function'\n ? options.capabilities()\n : options.capabilities\n }\n return defaultTangleSandboxCapabilities()\n },\n ...(options.validateProfile ? { validateProfile: options.validateProfile } : {}),\n async create(input: CreateAgentEnvironmentInput): Promise<AgentEnvironment> {\n const createOptions =\n options.mapCreateInput?.(input) ??\n sandboxOptionsFromCreateInput(input, options.defaultBackend ?? 'opencode')\n const box = await client.create(createOptions)\n return sandboxInstanceAsEnvironment(box, providerName, client)\n },\n ...(hasGet(client)\n ? {\n async get(id: string): Promise<AgentEnvironment | null> {\n const box = await client.get(id)\n return box ? sandboxInstanceAsEnvironment(box, providerName, client) : null\n },\n }\n : {}),\n ...(hasList(client)\n ? {\n async list(query?: AgentEnvironmentQuery): Promise<AgentEnvironmentSummary[]> {\n const boxes = await client.list(query?.providerOptions)\n return boxes.map((box) => ({\n id: String(box.id),\n provider: providerName,\n name: typeof box.name === 'string' ? box.name : undefined,\n status: statusFromUnknown(readBoxStatus(box)),\n metadata: readBoxMetadata(box),\n }))\n },\n }\n : {}),\n }\n}\n\n/** Options for running a provider as a supervise-mode executor.\n * @experimental */\nexport interface ProviderExecutorOptions {\n defaults?: Partial<CreateAgentEnvironmentInput>\n runtime?: Runtime\n destroyOnSettle?: boolean\n requireTerminalEvent?: boolean\n taskToTurn?: (task: unknown, specProfile: AgentProfile) => AgentTurnInput\n}\n\n/** Adapt an environment provider into an `ExecutorFactory` for `createExecutor`.\n * @experimental */\nexport function providerAsExecutor(\n provider: AgentEnvironmentProvider,\n options: ProviderExecutorOptions = {},\n): ExecutorFactory<unknown> {\n return (spec, ctx) => createProviderExecutor(provider, spec.profile, ctx, options)\n}\n\nfunction createProviderExecutor(\n provider: AgentEnvironmentProvider,\n profile: AgentProfile,\n ctx: ExecutorContext,\n options: ProviderExecutorOptions,\n): Executor<unknown> {\n const controller = new AbortController()\n const abortIfSignalled = () => {\n if (ctx.signal.aborted) controller.abort()\n }\n abortIfSignalled()\n if (!ctx.signal.aborted) ctx.signal.addEventListener('abort', abortIfSignalled, { once: true })\n\n let environment: AgentEnvironment | undefined\n let artifact: ExecutorResult<unknown> | undefined\n\n return {\n runtime: options.runtime ?? (provider.name as Runtime),\n execute(task, signal): AsyncIterable<UsageEvent> {\n return streamProviderExecutor({\n provider,\n profile,\n task,\n signal,\n controller,\n options,\n onEnvironment: (env) => {\n environment = env\n },\n onArtifact: (next) => {\n artifact = next\n },\n })\n },\n async teardown(_grace): Promise<{ destroyed: boolean }> {\n controller.abort()\n await environment?.destroy?.()\n return { destroyed: true }\n },\n resultArtifact(): ExecutorResult<unknown> {\n if (!artifact) {\n throw new ValidationError(\n `providerAsExecutor(${provider.name}): resultArtifact() read before stream drained`,\n )\n }\n return artifact\n },\n }\n}\n\ninterface StreamProviderExecutorArgs {\n provider: AgentEnvironmentProvider\n profile: AgentProfile\n task: unknown\n signal: AbortSignal\n controller: AbortController\n options: ProviderExecutorOptions\n onEnvironment: (environment: AgentEnvironment) => void\n onArtifact: (artifact: ExecutorResult<unknown>) => void\n}\n\nasync function* streamProviderExecutor(\n args: StreamProviderExecutorArgs,\n): AsyncIterable<UsageEvent> {\n const started = Date.now()\n const linked = mergeAbortSignals(args.signal, args.controller.signal)\n const environment = await args.provider.create({\n ...(args.options.defaults ?? {}),\n profile: args.profile,\n signal: linked,\n })\n args.onEnvironment(environment)\n\n const turn =\n args.options.taskToTurn?.(args.task, args.profile) ?? taskToTurnInput(args.task, linked)\n const events: AgentEnvironmentEvent[] = []\n const tokens = zeroTokenUsage()\n let usd = 0\n let text = ''\n let terminal = false\n try {\n for await (const event of environment.stream({ ...turn, signal: linked })) {\n events.push(event)\n text += textFromEnvironmentEvent(event)\n const usage = usageFromEnvironmentEvent(event)\n if (usage.input || usage.output) {\n tokens.input += usage.input\n tokens.output += usage.output\n yield { kind: 'tokens', input: usage.input, output: usage.output }\n }\n if (usage.usd) {\n usd += usage.usd\n yield { kind: 'cost', usd: usage.usd }\n }\n if (isTerminalEnvironmentEvent(event)) terminal = true\n }\n if ((args.options.requireTerminalEvent ?? true) && !terminal) {\n throw new ValidationError(\n `providerAsExecutor(${args.provider.name}): stream ended without a terminal result/done/status event`,\n )\n }\n yield { kind: 'iteration' }\n const result = resultFromEvents(events, text)\n const spent: Spend = {\n iterations: 1,\n tokens,\n usd,\n ms: Date.now() - started,\n }\n args.onArtifact({\n outRef: contentRef(`provider:${args.provider.name}`, result),\n out: result,\n spent,\n })\n } finally {\n if (args.options.destroyOnSettle ?? true) await environment.destroy?.()\n }\n}\n\nfunction createInputFromSandboxOptions(\n options: CreateSandboxOptions | undefined,\n): Partial<CreateAgentEnvironmentInput> {\n const profile = options?.backend?.profile as AgentProfileRef | undefined\n const backend = options?.backend?.type\n return {\n ...(profile !== undefined ? { profile } : {}),\n ...(backend ? { backend } : {}),\n workspace: {\n ...(options?.environment ? { environment: options.environment } : {}),\n ...(options?.image ? { image: options.image } : {}),\n ...(options?.git?.url ? { repoUrl: options.git.url } : {}),\n ...(options?.git?.ref ? { gitRef: options.git.ref } : {}),\n },\n ...(options?.resources ? { resources: options.resources as ResourceRequest } : {}),\n ...(options?.env ? { env: options.env } : {}),\n ...(options?.secrets ? { secrets: options.secrets } : {}),\n ...(options?.metadata ? { metadata: options.metadata } : {}),\n ...(options?.name ? { name: options.name } : {}),\n ...(options?.idempotencyKey ? { idempotencyKey: options.idempotencyKey } : {}),\n providerOptions: { sandboxCreateOptions: options ?? {} },\n }\n}\n\nfunction sandboxOptionsFromCreateInput(\n input: CreateAgentEnvironmentInput,\n defaultBackend: BackendType,\n): CreateSandboxOptions {\n const backendType = (input.backend ?? defaultBackend) as BackendType\n const workspace = input.workspace ?? {}\n const providerOptions = input.providerOptions?.sandboxCreateOptions\n const base =\n providerOptions && typeof providerOptions === 'object'\n ? ({ ...(providerOptions as CreateSandboxOptions) } as CreateSandboxOptions)\n : ({} satisfies CreateSandboxOptions)\n return {\n ...base,\n ...(workspace.environment ? { environment: workspace.environment } : {}),\n ...(workspace.image ? { image: workspace.image } : {}),\n ...(workspace.repoUrl ? { git: { url: workspace.repoUrl, ref: workspace.gitRef } } : {}),\n ...(input.resources ? { resources: input.resources as CreateSandboxOptions['resources'] } : {}),\n ...(input.env ? { env: input.env } : {}),\n ...(Array.isArray(input.secrets) ? { secrets: input.secrets } : {}),\n ...(input.metadata ? { metadata: input.metadata } : {}),\n ...(input.name ? { name: input.name } : {}),\n ...(input.idempotencyKey ? { idempotencyKey: input.idempotencyKey } : {}),\n backend: {\n ...(base.backend ?? {}),\n type: backendType,\n profile: input.profile,\n },\n }\n}\n\nfunction environmentAsSandboxInstance(\n environment: AgentEnvironment,\n options: { requireTerminalEvent: boolean },\n): SandboxInstance {\n const box = {\n id: environment.id,\n name: environment.name,\n status: 'running',\n async refresh(): Promise<void> {\n await environment.refresh?.()\n },\n async *streamPrompt(\n message: string | InputPart[],\n promptOptions?: PromptOptions,\n ): AsyncGenerator<SandboxEvent> {\n let terminal = false\n const input = turnInputFromPrompt(message, promptOptions)\n for await (const event of environment.stream(input)) {\n if (isTerminalEnvironmentEvent(event)) terminal = true\n const usageEvent = usageSandboxEvent(event)\n if (usageEvent) yield usageEvent\n yield sandboxEventFromEnvironmentEvent(event)\n }\n if (options.requireTerminalEvent && !terminal) {\n throw new ValidationError(\n `providerAsSandboxClient(${environment.provider}): stream ended without a terminal result/done/status event`,\n )\n }\n },\n async prompt(\n message: string | InputPart[],\n promptOptions?: PromptOptions,\n ): Promise<PromptResult> {\n const events: AgentEnvironmentEvent[] = []\n let text = ''\n let usage: TokenUsage | undefined\n let terminal = false\n for await (const event of environment.stream(turnInputFromPrompt(message, promptOptions))) {\n events.push(event)\n if (isTerminalEnvironmentEvent(event)) terminal = true\n text += textFromEnvironmentEvent(event)\n usage = mergeTokenUsage(usage, event.usage)\n }\n if (options.requireTerminalEvent && !terminal) {\n throw new ValidationError(\n `providerAsSandboxClient(${environment.provider}): prompt ended without a terminal result/done/status event`,\n )\n }\n return {\n response: resultFromEvents(events, text).content,\n success: true,\n durationMs: 0,\n ...(usage ? { usage } : {}),\n }\n },\n ...(environment.dispatch\n ? {\n async dispatchPrompt(message: string | InputPart[], promptOptions?: PromptOptions) {\n const session = await environment.dispatch?.(\n turnInputFromPrompt(message, promptOptions),\n )\n if (!session)\n throw new ValidationError('providerAsSandboxClient: dispatch returned no session')\n return sandboxDispatchResultFromSessionRef(session)\n },\n }\n : {}),\n ...(environment.session\n ? {\n session(id: string) {\n return sessionAsSandboxSession(environment.session?.(id))\n },\n }\n : {}),\n ...(environment.read ? { read: environment.read.bind(environment) } : {}),\n ...(environment.write ? { write: environment.write.bind(environment) } : {}),\n ...(environment.exec\n ? {\n exec: environment.exec.bind(environment),\n }\n : {}),\n ...(environment.checkpoint\n ? {\n async checkpoint(checkpointOptions?: CheckpointRequest) {\n const checkpoint = await environment.checkpoint?.(checkpointOptions)\n return { checkpointId: checkpoint?.id, id: checkpoint?.id }\n },\n }\n : {}),\n ...(environment.fork\n ? {\n async fork(checkpointId: string, forkOptions?: ForkRequest) {\n const forked = await environment.fork?.({ id: checkpointId }, forkOptions)\n if (!forked)\n throw new ValidationError('providerAsSandboxClient: fork returned no environment')\n return environmentAsSandboxInstance(forked, options)\n },\n }\n : {}),\n async delete(): Promise<void> {\n await environment.destroy?.()\n },\n }\n return box as unknown as SandboxInstance\n}\n\nfunction sandboxInstanceAsEnvironment(\n box: SandboxInstance,\n providerName: string,\n client: SandboxClient,\n): AgentEnvironment {\n const environment: AgentEnvironment = {\n id: String(box.id),\n provider: providerName,\n ...(typeof box.name === 'string' ? { name: box.name } : {}),\n async status(): Promise<AgentEnvironmentStatus> {\n await maybeRefresh(box)\n return statusFromUnknown(readBoxStatus(box))\n },\n async *stream(input: AgentTurnInput): AsyncIterable<AgentEnvironmentEvent> {\n for await (const event of box.streamPrompt(\n promptFromTurnInput(input),\n promptOptionsFromTurnInput(input),\n )) {\n yield environmentEventFromSandboxEvent(event)\n }\n },\n ...(hasDispatchPrompt(box)\n ? {\n async dispatch(input: AgentTurnInput): Promise<AgentSessionRef> {\n const dispatched = await box.dispatchPrompt(\n promptFromTurnInput(input),\n promptOptionsFromTurnInput(input),\n )\n return sessionRefFromSandboxDispatch(dispatched, providerName)\n },\n }\n : {}),\n ...(hasSession(box)\n ? {\n session(id: string): AgentSession {\n return sandboxSessionAsAgentSession(box.session(id))\n },\n }\n : {}),\n ...(hasRead(box) ? { read: box.read.bind(box) } : {}),\n ...(hasWrite(box) ? { write: box.write.bind(box) } : {}),\n ...(hasExec(box)\n ? {\n async exec(command: string, options?: ExecRequest): Promise<ExecResult> {\n return execResultFromSandboxExecResult(await box.exec(command, options as never))\n },\n }\n : {}),\n ...(hasCheckpoint(box)\n ? {\n async checkpoint(options?: CheckpointRequest): Promise<CheckpointRef> {\n const result = await box.checkpoint(options as never)\n return { id: checkpointIdFromResult(result), provider: providerName }\n },\n }\n : {}),\n ...(hasFork(box)\n ? {\n async fork(checkpoint: CheckpointRef, options?: ForkRequest): Promise<AgentEnvironment> {\n const forked = await box.fork(checkpoint.id, options as never)\n return sandboxInstanceAsEnvironment(forked, providerName, client)\n },\n }\n : {}),\n async placement(): Promise<PlacementInfo> {\n return placementInfoFromLoopPlacement(client.describePlacement?.(box), box)\n },\n async refresh(): Promise<void> {\n await maybeRefresh(box)\n },\n async destroy(): Promise<void> {\n await destroyBox(box)\n },\n }\n return environment\n}\n\nfunction sandboxSessionAsAgentSession(session: SandboxSessionLike): AgentSession {\n return {\n id: session.id,\n async status(): Promise<AgentSessionStatus | null> {\n const status = await session.status()\n if (!status) return null\n return sessionStatusFromUnknown((status as { status?: unknown }).status)\n },\n async *events(options?: {\n since?: string\n signal?: AbortSignal\n }): AsyncIterable<AgentEnvironmentEvent> {\n for await (const event of session.events(options))\n yield environmentEventFromSandboxEvent(event)\n },\n async result(): Promise<AgentTurnResult> {\n return agentTurnResultFromPromptResult(await session.result())\n },\n async prompt(input: AgentTurnInput): Promise<AgentTurnResult> {\n return agentTurnResultFromPromptResult(\n await session.prompt(promptFromTurnInput(input), promptOptionsFromTurnInput(input)),\n )\n },\n cancel(): Promise<void> {\n return session.cancel()\n },\n }\n}\n\nfunction sessionAsSandboxSession(session: AgentSession | undefined): unknown {\n if (!session) throw new ValidationError('providerAsSandboxClient: session(id) returned undefined')\n return {\n id: session.id,\n status: session.status.bind(session),\n async *events(options?: {\n since?: string\n signal?: AbortSignal\n }): AsyncGenerator<SandboxEvent> {\n for await (const event of session.events(options))\n yield sandboxEventFromEnvironmentEvent(event)\n },\n async result(): Promise<PromptResult> {\n return promptResultFromAgentTurnResult(await session.result())\n },\n async prompt(message: string | InputPart[], options?: PromptOptions): Promise<PromptResult> {\n return promptResultFromAgentTurnResult(\n await session.prompt(turnInputFromPrompt(message, options)),\n )\n },\n cancel: session.cancel.bind(session),\n }\n}\n\nfunction environmentEventFromSandboxEvent(event: SandboxEvent): AgentEnvironmentEvent {\n const data =\n event.data && typeof event.data === 'object'\n ? (event.data as Record<string, unknown>)\n : ({} as Record<string, unknown>)\n return {\n type: String(event.type),\n data,\n ...(event.id ? { id: event.id } : {}),\n usage: tokenUsageFromData(data),\n providerEvent: event,\n }\n}\n\nfunction sandboxEventFromEnvironmentEvent(event: AgentEnvironmentEvent): SandboxEvent {\n return {\n type: event.type,\n data: {\n ...event.data,\n ...(event.usage ? { usage: tokenUsageData(event.usage) } : {}),\n },\n ...(event.id ? { id: event.id } : {}),\n }\n}\n\nfunction usageSandboxEvent(event: AgentEnvironmentEvent): SandboxEvent | undefined {\n if (!event.usage || isUsageType(event.type)) return undefined\n const usage = tokenUsageData(event.usage)\n if (\n usage.inputTokens === undefined &&\n usage.outputTokens === undefined &&\n usage.totalCostUsd === undefined\n ) {\n return undefined\n }\n return { type: 'llm_call', data: usage }\n}\n\nfunction tokenUsageData(usage: TokenUsage): Record<string, number | undefined> {\n return {\n inputTokens: usage.inputTokens,\n outputTokens: usage.outputTokens,\n totalCostUsd: usage.cost,\n }\n}\n\nfunction turnInputFromPrompt(\n message: string | InputPart[],\n options?: PromptOptions,\n): AgentTurnInput {\n return {\n ...(typeof message === 'string' ? { prompt: message } : { parts: message }),\n ...(options?.sessionId ? { sessionId: options.sessionId } : {}),\n ...(options?.model ? { model: options.model } : {}),\n ...(options?.timeoutMs ? { timeoutMs: options.timeoutMs } : {}),\n ...(options?.executionId ? { executionId: options.executionId } : {}),\n ...(options?.lastEventId ? { lastEventId: options.lastEventId } : {}),\n ...(options?.turnId ? { turnId: options.turnId } : {}),\n ...(options?.detach !== undefined ? { detach: options.detach } : {}),\n ...(options?.context ? { context: options.context } : {}),\n ...(options?.signal ? { signal: options.signal } : {}),\n ...(options?.backend ? { providerOptions: { backend: options.backend } } : {}),\n }\n}\n\nfunction promptFromTurnInput(input: AgentTurnInput): string | InputPart[] {\n if (input.parts) return input.parts\n return input.prompt ?? ''\n}\n\nfunction promptOptionsFromTurnInput(input: AgentTurnInput): PromptOptions {\n return {\n ...(input.sessionId ? { sessionId: input.sessionId } : {}),\n ...(input.model ? { model: input.model } : {}),\n ...(input.timeoutMs ? { timeoutMs: input.timeoutMs } : {}),\n ...(input.context ? { context: input.context } : {}),\n ...(input.signal ? { signal: input.signal } : {}),\n ...(input.executionId ? { executionId: input.executionId } : {}),\n ...(input.lastEventId ? { lastEventId: input.lastEventId } : {}),\n ...(input.turnId ? { turnId: input.turnId } : {}),\n ...(input.detach !== undefined ? { detach: input.detach } : {}),\n }\n}\n\nfunction taskToTurnInput(task: unknown, signal: AbortSignal): AgentTurnInput {\n return { prompt: taskToPrompt(task), signal }\n}\n\nfunction taskToPrompt(task: unknown): string {\n if (typeof task === 'string') return task\n if (task && typeof task === 'object') {\n const record = task as Record<string, unknown>\n for (const key of ['prompt', 'content', 'task', 'message']) {\n if (typeof record[key] === 'string') return record[key]\n }\n }\n return JSON.stringify(task)\n}\n\nfunction resultFromEvents(\n events: AgentEnvironmentEvent[],\n fallbackText: string,\n): { content: string; events: AgentEnvironmentEvent[] } {\n for (let i = events.length - 1; i >= 0; i -= 1) {\n const event = events[i]\n const text = event ? resultTextFromData(event.data) : undefined\n if (text !== undefined) return { content: text, events }\n }\n return { content: fallbackText, events }\n}\n\nfunction textFromEnvironmentEvent(event: AgentEnvironmentEvent): string {\n if (\n typeof event.normalized === 'object' &&\n event.normalized &&\n event.normalized.type === 'message.part.updated'\n ) {\n return typeof event.normalized.delta === 'string' ? event.normalized.delta : ''\n }\n const data = event.data\n for (const key of ['delta', 'chunk', 'content', 'text']) {\n if (typeof data[key] === 'string' && !isTerminalEnvironmentEvent(event)) return data[key]\n }\n return ''\n}\n\nfunction resultTextFromData(data: Record<string, unknown>): string | undefined {\n for (const key of ['finalText', 'text', 'response', 'resultSummary', 'content']) {\n if (typeof data[key] === 'string') return data[key]\n }\n return undefined\n}\n\nfunction isTerminalEnvironmentEvent(event: AgentEnvironmentEvent): boolean {\n if (event.type === 'result' || event.type === 'done' || event.type === 'final') return true\n if (event.type.endsWith('.completed') || event.type.endsWith('.failed')) return true\n if (event.type === 'status') {\n const status = event.data.status\n return status === 'completed' || status === 'failed' || status === 'cancelled'\n }\n return false\n}\n\nfunction isUsageType(type: string): boolean {\n return type === 'llm_call' || type === 'usage' || type === 'cost.usage'\n}\n\nfunction usageFromEnvironmentEvent(event: AgentEnvironmentEvent): {\n input: number\n output: number\n usd: number\n} {\n const usage = event.usage ?? tokenUsageFromData(event.data)\n return {\n input: finiteNumber(usage?.inputTokens) ?? 0,\n output: finiteNumber(usage?.outputTokens) ?? 0,\n usd:\n finiteNumber(usage?.cost) ??\n finiteNumber(event.data.costUsd) ??\n finiteNumber(event.data.totalCostUsd) ??\n 0,\n }\n}\n\nfunction tokenUsageFromData(data: Record<string, unknown>): TokenUsage | undefined {\n const usageRecord =\n data.usage && typeof data.usage === 'object'\n ? (data.usage as Record<string, unknown>)\n : data.tokenUsage && typeof data.tokenUsage === 'object'\n ? (data.tokenUsage as Record<string, unknown>)\n : data\n const inputTokens =\n finiteNumber(usageRecord.inputTokens) ??\n finiteNumber(usageRecord.tokensIn) ??\n finiteNumber(usageRecord.prompt_tokens)\n const outputTokens =\n finiteNumber(usageRecord.outputTokens) ??\n finiteNumber(usageRecord.tokensOut) ??\n finiteNumber(usageRecord.completion_tokens)\n const cost =\n finiteNumber(usageRecord.cost) ??\n finiteNumber(usageRecord.costUsd) ??\n finiteNumber(usageRecord.totalCostUsd) ??\n finiteNumber(data.costUsd) ??\n finiteNumber(data.totalCostUsd)\n if (inputTokens === undefined && outputTokens === undefined && cost === undefined)\n return undefined\n return {\n inputTokens: inputTokens ?? 0,\n outputTokens: outputTokens ?? 0,\n ...(cost !== undefined ? { cost } : {}),\n }\n}\n\nfunction mergeTokenUsage(\n left: TokenUsage | undefined,\n right: TokenUsage | undefined,\n): TokenUsage | undefined {\n if (!left) return right\n if (!right) return left\n return {\n inputTokens: left.inputTokens + right.inputTokens,\n outputTokens: left.outputTokens + right.outputTokens,\n ...(left.cost !== undefined || right.cost !== undefined\n ? { cost: (left.cost ?? 0) + (right.cost ?? 0) }\n : {}),\n }\n}\n\nfunction finiteNumber(value: unknown): number | undefined {\n return typeof value === 'number' && Number.isFinite(value) ? value : undefined\n}\n\nfunction promptResultFromAgentTurnResult(result: AgentTurnResult): PromptResult {\n return {\n response: result.text,\n success: result.success,\n durationMs: 0,\n ...(result.error ? { error: result.error } : {}),\n ...(result.usage ? { usage: result.usage } : {}),\n }\n}\n\nfunction agentTurnResultFromPromptResult(result: PromptResult): AgentTurnResult {\n const record = result as unknown as Record<string, unknown>\n const text =\n typeof record.response === 'string'\n ? record.response\n : typeof record.text === 'string'\n ? record.text\n : typeof record.finalText === 'string'\n ? record.finalText\n : ''\n const success = typeof record.success === 'boolean' ? record.success : true\n return {\n text,\n success,\n ...(typeof record.error === 'string' ? { error: record.error } : {}),\n usage: tokenUsageFromData(record),\n }\n}\n\nfunction sandboxDispatchResultFromSessionRef(session: AgentSessionRef): Record<string, unknown> {\n const hasStatus = session.metadata && Object.hasOwn(session.metadata, 'status')\n const status = hasStatus ? sessionStatusFromUnknown(session.metadata?.status) : 'running'\n return {\n sessionId: session.id,\n status,\n alreadyExisted: session.metadata?.alreadyExisted === true,\n }\n}\n\nfunction sessionRefFromSandboxDispatch(dispatched: unknown, providerName: string): AgentSessionRef {\n const record =\n dispatched && typeof dispatched === 'object'\n ? (dispatched as Record<string, unknown>)\n : undefined\n const id = record?.sessionId ?? record?.id\n if (typeof id !== 'string' || id.length === 0) {\n throw new ValidationError('sandboxClientAsProvider: dispatch returned no session id')\n }\n if (!record) {\n throw new ValidationError('sandboxClientAsProvider: dispatch returned no session record')\n }\n return {\n id,\n provider: providerName,\n metadata: {\n ...(record.status ? { status: record.status } : {}),\n ...(record.alreadyExisted !== undefined ? { alreadyExisted: record.alreadyExisted } : {}),\n },\n }\n}\n\nfunction execResultFromSandboxExecResult(result: SandboxExecResult): ExecResult {\n const record = result as unknown as Record<string, unknown>\n const exitCode = finiteNumber(record.exitCode) ?? finiteNumber(record.code)\n if (exitCode === undefined) {\n throw new ValidationError('sandboxClientAsProvider: exec returned no exit code')\n }\n return {\n exitCode,\n stdout: typeof record.stdout === 'string' ? record.stdout : '',\n stderr: typeof record.stderr === 'string' ? record.stderr : '',\n }\n}\n\nfunction statusFromUnknown(status: unknown): AgentEnvironmentStatus {\n if (status === 'pending' || status === 'provisioning' || status === 'running') return status\n if (status === 'stopped' || status === 'failed' || status === 'expired') return status\n if (status === 'completed') return 'stopped'\n if (status === 'cancelled') return 'stopped'\n return 'unknown'\n}\n\nfunction sessionStatusFromUnknown(status: unknown): AgentSessionStatus | null {\n if (status === 'completed' || status === 'cancelled') return status\n return statusFromUnknown(status)\n}\n\nfunction readBoxStatus(box: SandboxInstance): unknown {\n return (box as unknown as { status?: unknown }).status\n}\n\nfunction readBoxMetadata(box: SandboxInstance): Record<string, unknown> | undefined {\n const metadata = (box as unknown as { metadata?: unknown }).metadata\n return metadata && typeof metadata === 'object'\n ? (metadata as Record<string, unknown>)\n : undefined\n}\n\nasync function maybeRefresh(box: SandboxInstance): Promise<void> {\n const refresh = (box as unknown as { refresh?: () => Promise<void> }).refresh\n if (typeof refresh === 'function') await refresh.call(box)\n}\n\nasync function destroyBox(box: SandboxInstance): Promise<void> {\n const deleteBox = (box as unknown as { delete?: () => Promise<void> }).delete\n if (typeof deleteBox === 'function') await deleteBox.call(box)\n}\n\nfunction placementInfoFromLoopPlacement(\n placement: LoopSandboxPlacement | undefined,\n box: SandboxInstance,\n): PlacementInfo {\n if (!placement) return { kind: 'sandbox', sandboxId: String(box.id) }\n return {\n kind: placement.kind === 'fleet' ? 'fleet' : 'sandbox',\n ...(placement.sandboxId ? { sandboxId: placement.sandboxId } : { sandboxId: String(box.id) }),\n ...(placement.fleetId ? { fleetId: placement.fleetId } : {}),\n ...(placement.machineId ? { machineId: placement.machineId } : {}),\n }\n}\n\nfunction checkpointIdFromResult(result: unknown): string {\n const record = result && typeof result === 'object' ? (result as Record<string, unknown>) : {}\n const id = record.checkpointId ?? record.id\n if (typeof id !== 'string' || id.length === 0) {\n throw new ValidationError('sandboxClientAsProvider: checkpoint returned no checkpoint id')\n }\n return id\n}\n\nfunction defaultTangleSandboxCapabilities(): AgentEnvironmentCapabilities {\n return {\n profile: {\n namedProfiles: true,\n systemPrompt: true,\n instructions: true,\n tools: true,\n permissions: true,\n mcp: true,\n subagents: true,\n resources: {\n files: true,\n instructions: true,\n tools: true,\n skills: true,\n agents: true,\n commands: true,\n },\n hooks: true,\n modes: true,\n runtimeUpdate: true,\n validation: true,\n },\n streaming: { live: true, replay: true, detach: true, turnIdempotency: true },\n sessions: { continue: true, list: true, messages: true },\n workspace: { read: true, write: true, exec: true, git: true, upload: true, download: true },\n branching: { checkpoint: true, fork: true },\n placement: true,\n usage: true,\n confidential: true,\n }\n}\n\nfunction mergeAbortSignals(a: AbortSignal, b: AbortSignal): AbortSignal {\n const controller = new AbortController()\n const abort = () => controller.abort()\n if (a.aborted || b.aborted) controller.abort()\n else {\n a.addEventListener('abort', abort, { once: true })\n b.addEventListener('abort', abort, { once: true })\n }\n return controller.signal\n}\n\nfunction contentRef(prefix: string, value: unknown): string {\n let str: string\n try {\n str = JSON.stringify(value) ?? String(value)\n } catch {\n str = String(value)\n }\n let hash = 0x811c9dc5\n for (let i = 0; i < str.length; i += 1) {\n hash ^= str.charCodeAt(i)\n hash = Math.imul(hash, 0x01000193)\n }\n return `${prefix}:${(hash >>> 0).toString(16).padStart(8, '0')}`\n}\n\nfunction hasGet(\n client: SandboxClient,\n): client is SandboxClient & { get(id: string): Promise<SandboxInstance | null> } {\n return typeof (client as { get?: unknown }).get === 'function'\n}\n\nfunction hasList(\n client: SandboxClient,\n): client is SandboxClient & { list(options?: unknown): Promise<SandboxInstance[]> } {\n return typeof (client as { list?: unknown }).list === 'function'\n}\n\nfunction hasDispatchPrompt(box: SandboxInstance): box is SandboxInstance & {\n dispatchPrompt(message: string | InputPart[], options?: PromptOptions): Promise<unknown>\n} {\n return typeof (box as { dispatchPrompt?: unknown }).dispatchPrompt === 'function'\n}\n\nfunction hasSession(\n box: SandboxInstance,\n): box is SandboxInstance & { session(id: string): SandboxSessionLike } {\n return typeof (box as { session?: unknown }).session === 'function'\n}\n\nfunction hasRead(box: SandboxInstance): box is SandboxInstance & {\n read(path: string, options?: { sessionId?: string }): Promise<string>\n} {\n return typeof (box as { read?: unknown }).read === 'function'\n}\n\nfunction hasWrite(\n box: SandboxInstance,\n): box is SandboxInstance & { write(path: string, content: string): Promise<void> } {\n return typeof (box as { write?: unknown }).write === 'function'\n}\n\nfunction hasExec(box: SandboxInstance): box is SandboxInstance & {\n exec(command: string, options?: unknown): Promise<SandboxExecResult>\n} {\n return typeof (box as { exec?: unknown }).exec === 'function'\n}\n\nfunction hasCheckpoint(\n box: SandboxInstance,\n): box is SandboxInstance & { checkpoint(options?: unknown): Promise<unknown> } {\n return typeof (box as { checkpoint?: unknown }).checkpoint === 'function'\n}\n\nfunction hasFork(box: SandboxInstance): box is SandboxInstance & {\n fork(checkpointId: string, options?: unknown): Promise<SandboxInstance>\n} {\n return typeof (box as { fork?: unknown }).fork === 'function'\n}\n\ninterface SandboxSessionLike {\n readonly id: string\n status(): Promise<unknown | null>\n events(options?: { since?: string; signal?: AbortSignal }): AsyncIterable<SandboxEvent>\n result(): Promise<PromptResult>\n prompt(message: string | InputPart[], options?: PromptOptions): Promise<PromptResult>\n cancel(): Promise<void>\n}\n"],"mappings":";AAeA,eAAsB,cAAc,KAAoD;AACtF,MAAI,CAAC,OAAO,OAAQ,IAA6B,WAAW,WAAY,QAAO;AAC/E,MAAI;AACF,UAAM,IAAI,OAAO;AACjB,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAGO,SAAS,aAAa,MAAM,GAAW;AAC5C,SAAO,KAAK,OAAO,EAChB,SAAS,EAAE,EACX,MAAM,GAAG,IAAI,GAAG;AACrB;AAGO,SAAS,aAAqB;AACnC,SAAO,OAAO,WAAW;AAC3B;AAGO,SAAS,aAAoB;AAClC,QAAM,MAAM,IAAI,MAAM,SAAS;AAC/B,MAAI,OAAO;AACX,SAAO;AACT;AAGO,SAAS,aAAoB;AAClC,QAAM,WAAW;AACnB;AAGO,SAAS,eAAe,QAAuC;AACpE,MAAI,QAAQ,QAAS,OAAM,WAAW;AACxC;AAGO,SAAS,aAAa,K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wB;AAC1D,MAAI;AACJ,MAAI;AACF,UAAM,KAAK,UAAU,KAAK,KAAK,OAAO,KAAK;AAAA,EAC7C,QAAQ;AACN,UAAM,OAAO,KAAK;AAAA,EACpB;AACA,MAAI,OAAO;AACX,WAAS,IAAI,GAAG,IAAI,IAAI,QAAQ,KAAK,GAAG;AACtC,YAAQ,IAAI,WAAW,CAAC;AACxB,WAAO,KAAK,KAAK,MAAM,QAAU;AAAA,EACnC;AACA,SAAO,GAAG,MAAM,KAAK,SAAS,GAAG,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG,CAAC;AAChE;AAEA,SAAS,OACP,QACgF;AAChF,SAAO,OAAQ,OAA6B,QAAQ;AACtD;AAEA,SAAS,QACP,QACmF;AACnF,SAAO,OAAQ,OAA8B,SAAS;AACxD;AAEA,SAAS,kBAAkB,KAEzB;AACA,SAAO,OAAQ,IAAqC,mBAAmB;AACzE;AAEA,SAAS,WACP,KACsE;AACtE,SAAO,OAAQ,IAA8B,YAAY;AAC3D;AAEA,SAAS,QAAQ,KAEf;AACA,SAAO,OAAQ,IAA2B,SAAS;AACrD;AAEA,SAAS,SACP,KACkF;AAClF,SAAO,OAAQ,IAA4B,UAAU;AACvD;AAEA,SAAS,QAAQ,KAEf;AACA,SAAO,OAAQ,IAA2B,SAAS;AACrD;AAEA,SAAS,cACP,KAC8E;AAC9E,SAAO,OAAQ,IAAiC,eAAe;AACjE;AAEA,SAAS,QAAQ,KAEf;AACA,SAAO,OAAQ,IAA2B,SAAS;AACrD;","names":[]}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AgentProfile
|
|
1
|
+
import { E as ExecutorFactory, b as ExecutorRegistry, h as Spend, c as Agent, i as Scope, d as ResultBlobStore, B as Budget } from './types-C1sozrte.js';
|
|
2
|
+
import { AgentProfile } from '@tangle-network/agent-interface';
|
|
3
3
|
import { U as UiLens, a as UiFinding, C as CoderTask } from './substrate-rNj6TDc3.js';
|
|
4
4
|
import { e as LoopTraceEmitter, c as LoopTraceEvent, S as SandboxClient, A as AgentRunSpec, E as ExecCtx } from './types-BF-MEsQB.js';
|
|
5
|
-
import { SandboxEvent, SandboxInstance,
|
|
5
|
+
import { SandboxEvent, SandboxInstance, BackendType } from '@tangle-network/sandbox';
|
|
6
6
|
import { AgentEvalError } from '@tangle-network/agent-eval';
|
|
7
7
|
import { O as OtelExporter } from './otel-export-BKmNwiCb.js';
|
|
8
8
|
import { T as ToolSpec, R as RouterConfig } from './router-client-CMAWGv1h.js';
|
|
9
|
+
import { d as DeliverableSpec } from './worktree-CpptK3oF.js';
|
|
9
10
|
import { L as LocalHarness } from './local-harness-DU7yV6mG.js';
|
|
10
|
-
import {
|
|
11
|
+
import { ProviderExecutorOptions, AgentEnvironmentProviderRegistry } from './environment-provider.js';
|
|
12
|
+
import { AgentEnvironmentProvider } from '@tangle-network/agent-interface/environment-provider';
|
|
11
13
|
|
|
12
14
|
/**
|
|
13
15
|
* @experimental
|
|
@@ -1536,63 +1538,6 @@ declare class InMemoryFeedbackStore implements FeedbackStore {
|
|
|
1536
1538
|
*/
|
|
1537
1539
|
declare function eventToSnapshot(event: FeedbackEvent): DelegationFeedbackSnapshot;
|
|
1538
1540
|
|
|
1539
|
-
/** Provider object or registry name accepted by runtime provider adapters.
|
|
1540
|
-
* @experimental */
|
|
1541
|
-
type AgentEnvironmentProviderRef = AgentEnvironmentProvider | string;
|
|
1542
|
-
/** In-memory registry for named `AgentEnvironmentProvider` instances.
|
|
1543
|
-
* @experimental */
|
|
1544
|
-
interface AgentEnvironmentProviderRegistry {
|
|
1545
|
-
register(provider: AgentEnvironmentProvider, options?: {
|
|
1546
|
-
replace?: boolean;
|
|
1547
|
-
}): void;
|
|
1548
|
-
has(name: string): boolean;
|
|
1549
|
-
get(name: string): AgentEnvironmentProvider | undefined;
|
|
1550
|
-
require(name: string): AgentEnvironmentProvider;
|
|
1551
|
-
names(): string[];
|
|
1552
|
-
providers(): AgentEnvironmentProvider[];
|
|
1553
|
-
capabilities(name: string): Promise<AgentEnvironmentCapabilities>;
|
|
1554
|
-
}
|
|
1555
|
-
/** Create a registry that resolves provider names to concrete provider instances.
|
|
1556
|
-
* @experimental */
|
|
1557
|
-
declare function createAgentEnvironmentProviderRegistry(providers?: Iterable<AgentEnvironmentProvider>): AgentEnvironmentProviderRegistry;
|
|
1558
|
-
/** Resolve a provider instance or registry name, failing loudly when a name is unknown.
|
|
1559
|
-
* @experimental */
|
|
1560
|
-
declare function resolveAgentEnvironmentProvider(provider: AgentEnvironmentProviderRef, registry?: AgentEnvironmentProviderRegistry): AgentEnvironmentProvider;
|
|
1561
|
-
/** Options for exposing an `AgentEnvironmentProvider` through the legacy sandbox client port.
|
|
1562
|
-
* @experimental */
|
|
1563
|
-
interface ProviderAsSandboxClientOptions {
|
|
1564
|
-
defaults?: Partial<CreateAgentEnvironmentInput>;
|
|
1565
|
-
requireTerminalEvent?: boolean;
|
|
1566
|
-
mapCreateOptions?: (options: CreateSandboxOptions | undefined) => Partial<CreateAgentEnvironmentInput>;
|
|
1567
|
-
}
|
|
1568
|
-
/** Adapt a neutral environment provider to the `SandboxClient` interface used by existing loop paths.
|
|
1569
|
-
* @experimental */
|
|
1570
|
-
declare function providerAsSandboxClient(provider: AgentEnvironmentProvider, options?: ProviderAsSandboxClientOptions): SandboxClient;
|
|
1571
|
-
/** Options for wrapping the current Tangle sandbox client as an environment provider.
|
|
1572
|
-
* @experimental */
|
|
1573
|
-
interface SandboxClientProviderOptions {
|
|
1574
|
-
name?: string;
|
|
1575
|
-
defaultBackend?: BackendType;
|
|
1576
|
-
capabilities?: AgentEnvironmentCapabilities | (() => AgentEnvironmentCapabilities | Promise<AgentEnvironmentCapabilities>);
|
|
1577
|
-
validateProfile?: (profile: AgentProfileRef) => AgentProfileValidationResult | Promise<AgentProfileValidationResult>;
|
|
1578
|
-
mapCreateInput?: (input: CreateAgentEnvironmentInput) => CreateSandboxOptions;
|
|
1579
|
-
}
|
|
1580
|
-
/** Adapt a `SandboxClient` into the shared `AgentEnvironmentProvider` contract.
|
|
1581
|
-
* @experimental */
|
|
1582
|
-
declare function sandboxClientAsProvider(client: SandboxClient, options?: SandboxClientProviderOptions): AgentEnvironmentProvider;
|
|
1583
|
-
/** Options for running a provider as a supervise-mode executor.
|
|
1584
|
-
* @experimental */
|
|
1585
|
-
interface ProviderExecutorOptions {
|
|
1586
|
-
defaults?: Partial<CreateAgentEnvironmentInput>;
|
|
1587
|
-
runtime?: Runtime;
|
|
1588
|
-
destroyOnSettle?: boolean;
|
|
1589
|
-
requireTerminalEvent?: boolean;
|
|
1590
|
-
taskToTurn?: (task: unknown, specProfile: AgentProfile) => AgentTurnInput;
|
|
1591
|
-
}
|
|
1592
|
-
/** Adapt an environment provider into an `ExecutorFactory` for `createExecutor`.
|
|
1593
|
-
* @experimental */
|
|
1594
|
-
declare function providerAsExecutor(provider: AgentEnvironmentProvider, options?: ProviderExecutorOptions): ExecutorFactory<unknown>;
|
|
1595
|
-
|
|
1596
1541
|
/**
|
|
1597
1542
|
* @experimental
|
|
1598
1543
|
*
|
|
@@ -2125,4 +2070,4 @@ interface CoordinationTools {
|
|
|
2125
2070
|
/** Build the driver's MCP tools over a live scope. */
|
|
2126
2071
|
declare function createCoordinationTools(opts: CoordinationToolsOptions): CoordinationTools;
|
|
2127
2072
|
|
|
2128
|
-
export { type DelegationTaskQueueOptions as $, type AnalystRegistry as A, type DelegateResearchArgs as B, type CappedDelegationTrace as C, type DelegationExecutor as D, type DelegateResearchConfig as E, type FleetHandle as F, type DelegateResearchResult as G, type DelegateResult as H, type DelegateRunCtx as I, type DelegateUiAuditConfig as J, type DelegateUiAuditRoute as K, type DelegationError as L, type DelegationFeedbackSnapshot as M, type DelegationHistoryEntry as N, DelegationPersistenceError as O, type DelegationProfile as P, type DelegationProgress as Q, type DelegationRecord as R, type DelegationResultPayload as S, type DelegationResumeContext as T, type UiAuditorDelegate as U, type DelegationResumeDriver as V, type DelegationResumeTick as W, type DelegationRunContext as X, DelegationStateCorruptError as Y, type DelegationStatus as Z, type DelegationStore as _, DelegationTaskQueue as a, type ExecutorConfig as a$, type DelegationTraceCaps as a0, type DelegationTraceCollector as a1, type DelegationTraceSpan as a2, type DetachedSessionDelegateOptions as a3, type DetachedSessionRefParts as a4, type DetachedTurn as a5, type DetachedTurnResumeDriverOptions as a6, type DetachedWinnerSelection as a7, type DriveTurnCapableBox as a8, type DriveTurnTick as a9, type SubmitOutput as aA, type TraceContext as aB, type UiAuditorDelegationOutput as aC, buildDelegationTraceSpans as aD, capDelegationTrace as aE, coderTaskFromArgs as aF, composeLoopTraceEmitters as aG, createCoordinationTools as aH, createDelegateHandler as aI, createDelegationTraceCollector as aJ, createDetachedTurnResumeDriver as aK, createFleetWorkspaceExecutor as aL, createInProcessTransport as aM, createMcpServer as aN, createPropagatingTraceEmitter as aO, createSiblingSandboxExecutor as aP, detachedSessionDelegate as aQ, detachedTurnEvents as aR, eventToSnapshot as aS, formatDetachedSessionRef as aT, hashIdempotencyInput as aU, parseDetachedSessionRef as aV, readTraceContextFromEnv as aW, runDetachedTurn as aX, settleDetachedCoderTurn as aY, traceContextToEnv as aZ, validateDelegateArgs as a_, type FeedbackEvent as aa, type FeedbackRating as ab, type FeedbackRefersTo as ac, FileDelegationStore as ad, type FileDelegationStoreOptions as ae, type FleetWorkspaceExecutorOptions as af, InMemoryDelegationStore as ag, InMemoryFeedbackStore as ah, type JsonRpcMessage as ai, type JsonRpcResponse as aj, type MakeWorkerAgent as ak, type McpServer as al, type McpServerOptions as am, type McpToolDescriptor as an, type McpTransport as ao, type Question as ap, type QuestionDecision as aq, type QuestionPolicy as ar, type QuestionRecord as as, type ResearchOutputShape as at, type ResearchSource as au, type RunDetachedTurnOptions as av, type SettleDetachedCoderTurnOptions as aw, type SettledWorker as ax, type SiblingSandboxExecutorOptions as ay, type SubmitInput as az, type FeedbackStore as b, type
|
|
2073
|
+
export { type DelegationTaskQueueOptions as $, type AnalystRegistry as A, type DelegateResearchArgs as B, type CappedDelegationTrace as C, type DelegationExecutor as D, type DelegateResearchConfig as E, type FleetHandle as F, type DelegateResearchResult as G, type DelegateResult as H, type DelegateRunCtx as I, type DelegateUiAuditConfig as J, type DelegateUiAuditRoute as K, type DelegationError as L, type DelegationFeedbackSnapshot as M, type DelegationHistoryEntry as N, DelegationPersistenceError as O, type DelegationProfile as P, type DelegationProgress as Q, type DelegationRecord as R, type DelegationResultPayload as S, type DelegationResumeContext as T, type UiAuditorDelegate as U, type DelegationResumeDriver as V, type DelegationResumeTick as W, type DelegationRunContext as X, DelegationStateCorruptError as Y, type DelegationStatus as Z, type DelegationStore as _, DelegationTaskQueue as a, type ExecutorConfig as a$, type DelegationTraceCaps as a0, type DelegationTraceCollector as a1, type DelegationTraceSpan as a2, type DetachedSessionDelegateOptions as a3, type DetachedSessionRefParts as a4, type DetachedTurn as a5, type DetachedTurnResumeDriverOptions as a6, type DetachedWinnerSelection as a7, type DriveTurnCapableBox as a8, type DriveTurnTick as a9, type SubmitOutput as aA, type TraceContext as aB, type UiAuditorDelegationOutput as aC, buildDelegationTraceSpans as aD, capDelegationTrace as aE, coderTaskFromArgs as aF, composeLoopTraceEmitters as aG, createCoordinationTools as aH, createDelegateHandler as aI, createDelegationTraceCollector as aJ, createDetachedTurnResumeDriver as aK, createFleetWorkspaceExecutor as aL, createInProcessTransport as aM, createMcpServer as aN, createPropagatingTraceEmitter as aO, createSiblingSandboxExecutor as aP, detachedSessionDelegate as aQ, detachedTurnEvents as aR, eventToSnapshot as aS, formatDetachedSessionRef as aT, hashIdempotencyInput as aU, parseDetachedSessionRef as aV, readTraceContextFromEnv as aW, runDetachedTurn as aX, settleDetachedCoderTurn as aY, traceContextToEnv as aZ, validateDelegateArgs as a_, type FeedbackEvent as aa, type FeedbackRating as ab, type FeedbackRefersTo as ac, FileDelegationStore as ad, type FileDelegationStoreOptions as ae, type FleetWorkspaceExecutorOptions as af, InMemoryDelegationStore as ag, InMemoryFeedbackStore as ah, type JsonRpcMessage as ai, type JsonRpcResponse as aj, type MakeWorkerAgent as ak, type McpServer as al, type McpServerOptions as am, type McpToolDescriptor as an, type McpTransport as ao, type Question as ap, type QuestionDecision as aq, type QuestionPolicy as ar, type QuestionRecord as as, type ResearchOutputShape as at, type ResearchSource as au, type RunDetachedTurnOptions as av, type SettleDetachedCoderTurnOptions as aw, type SettledWorker as ax, type SiblingSandboxExecutorOptions as ay, type SubmitInput as az, type FeedbackStore as b, type BusEvent as b0, type BusRecord as b1, type BusStats as b2, type EventBus as b3, type ProviderSeam as b4, type PublishOptions as b5, cliWorktreeExecutor as b6, createEventBus as b7, createExecutor as b8, createExecutorRegistry as b9, type DelegateFeedbackResult as c, type DelegateFeedbackArgs as d, type DelegateUiAuditArgs as e, type DelegateUiAuditResult as f, type DelegationHistoryResult as g, type DelegationHistoryArgs as h, type DelegationStatusResult as i, type DelegationStatusArgs as j, type CoderDelegate as k, type CoderReview as l, type CoderReviewer as m, type CoordinationEvent as n, type CoordinationTools as o, type CoordinationToolsOptions as p, DELEGATE_DESCRIPTION as q, DELEGATE_INPUT_SCHEMA as r, DELEGATE_TOOL_NAME as s, DELEGATION_TRACE_MAX_BYTES as t, DELEGATION_TRACE_MAX_SPANS as u, type DelegateArgs as v, type DelegateCodeArgs as w, type DelegateCodeConfig as x, type DelegateCodeResult as y, type DelegateHandlerOptions as z };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { AgentProfile, AgentProfileValidationResult } from '@tangle-network/agent-interface';
|
|
2
|
+
import { AgentEnvironmentProvider, AgentEnvironmentCapabilities, CreateAgentEnvironmentInput, AgentTurnInput, AgentProfileRef } from '@tangle-network/agent-interface/environment-provider';
|
|
3
|
+
export { AgentEnvironment, AgentEnvironmentCapabilities, AgentEnvironmentEvent, AgentEnvironmentProvider, AgentEnvironmentQuery, AgentEnvironmentStatus, AgentEnvironmentSummary, AgentProfileRef, AgentSession, AgentSessionRef, AgentSessionStatus, AgentTurnInput, AgentTurnResult, CheckpointRef, CheckpointRequest, CreateAgentEnvironmentInput, ExecRequest, ExecResult, ForkRequest, PlacementInfo, ResourceRequest, WorkspaceRequest } from '@tangle-network/agent-interface/environment-provider';
|
|
4
|
+
import { CreateSandboxOptions, BackendType } from '@tangle-network/sandbox';
|
|
5
|
+
import { R as Runtime, E as ExecutorFactory } from './types-C1sozrte.js';
|
|
6
|
+
import { S as SandboxClient } from './types-BF-MEsQB.js';
|
|
7
|
+
import '@tangle-network/agent-eval';
|
|
8
|
+
|
|
9
|
+
/** Provider object or registry name accepted by runtime provider adapters.
|
|
10
|
+
* @experimental */
|
|
11
|
+
type AgentEnvironmentProviderRef = AgentEnvironmentProvider | string;
|
|
12
|
+
/** In-memory registry for named `AgentEnvironmentProvider` instances.
|
|
13
|
+
* @experimental */
|
|
14
|
+
interface AgentEnvironmentProviderRegistry {
|
|
15
|
+
register(provider: AgentEnvironmentProvider, options?: {
|
|
16
|
+
replace?: boolean;
|
|
17
|
+
}): void;
|
|
18
|
+
has(name: string): boolean;
|
|
19
|
+
get(name: string): AgentEnvironmentProvider | undefined;
|
|
20
|
+
require(name: string): AgentEnvironmentProvider;
|
|
21
|
+
names(): string[];
|
|
22
|
+
providers(): AgentEnvironmentProvider[];
|
|
23
|
+
capabilities(name: string): Promise<AgentEnvironmentCapabilities>;
|
|
24
|
+
}
|
|
25
|
+
/** Create a registry that resolves provider names to concrete provider instances.
|
|
26
|
+
* @experimental */
|
|
27
|
+
declare function createAgentEnvironmentProviderRegistry(providers?: Iterable<AgentEnvironmentProvider>): AgentEnvironmentProviderRegistry;
|
|
28
|
+
/** Resolve a provider instance or registry name, failing loudly when a name is unknown.
|
|
29
|
+
* @experimental */
|
|
30
|
+
declare function resolveAgentEnvironmentProvider(provider: AgentEnvironmentProviderRef, registry?: AgentEnvironmentProviderRegistry): AgentEnvironmentProvider;
|
|
31
|
+
/** Options for exposing an `AgentEnvironmentProvider` through the legacy sandbox client port.
|
|
32
|
+
* @experimental */
|
|
33
|
+
interface ProviderAsSandboxClientOptions {
|
|
34
|
+
defaults?: Partial<CreateAgentEnvironmentInput>;
|
|
35
|
+
requireTerminalEvent?: boolean;
|
|
36
|
+
mapCreateOptions?: (options: CreateSandboxOptions | undefined) => Partial<CreateAgentEnvironmentInput>;
|
|
37
|
+
}
|
|
38
|
+
/** Adapt a neutral environment provider to the `SandboxClient` interface used by existing loop paths.
|
|
39
|
+
* @experimental */
|
|
40
|
+
declare function providerAsSandboxClient(provider: AgentEnvironmentProvider, options?: ProviderAsSandboxClientOptions): SandboxClient;
|
|
41
|
+
/** Options for wrapping the current Tangle sandbox client as an environment provider.
|
|
42
|
+
* @experimental */
|
|
43
|
+
interface SandboxClientProviderOptions {
|
|
44
|
+
name?: string;
|
|
45
|
+
defaultBackend?: BackendType;
|
|
46
|
+
capabilities?: AgentEnvironmentCapabilities | (() => AgentEnvironmentCapabilities | Promise<AgentEnvironmentCapabilities>);
|
|
47
|
+
validateProfile?: (profile: AgentProfileRef) => AgentProfileValidationResult | Promise<AgentProfileValidationResult>;
|
|
48
|
+
mapCreateInput?: (input: CreateAgentEnvironmentInput) => CreateSandboxOptions;
|
|
49
|
+
}
|
|
50
|
+
/** Adapt a `SandboxClient` into the shared `AgentEnvironmentProvider` contract.
|
|
51
|
+
* @experimental */
|
|
52
|
+
declare function sandboxClientAsProvider(client: SandboxClient, options?: SandboxClientProviderOptions): AgentEnvironmentProvider;
|
|
53
|
+
/** Options for running a provider as a supervise-mode executor.
|
|
54
|
+
* @experimental */
|
|
55
|
+
interface ProviderExecutorOptions {
|
|
56
|
+
defaults?: Partial<CreateAgentEnvironmentInput>;
|
|
57
|
+
runtime?: Runtime;
|
|
58
|
+
destroyOnSettle?: boolean;
|
|
59
|
+
requireTerminalEvent?: boolean;
|
|
60
|
+
taskToTurn?: (task: unknown, specProfile: AgentProfile) => AgentTurnInput;
|
|
61
|
+
}
|
|
62
|
+
/** Adapt an environment provider into an `ExecutorFactory` for `createExecutor`.
|
|
63
|
+
* @experimental */
|
|
64
|
+
declare function providerAsExecutor(provider: AgentEnvironmentProvider, options?: ProviderExecutorOptions): ExecutorFactory<unknown>;
|
|
65
|
+
|
|
66
|
+
export { type AgentEnvironmentProviderRef, type AgentEnvironmentProviderRegistry, type ProviderAsSandboxClientOptions, type ProviderExecutorOptions, type SandboxClientProviderOptions, createAgentEnvironmentProviderRegistry, providerAsExecutor, providerAsSandboxClient, resolveAgentEnvironmentProvider, sandboxClientAsProvider };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createAgentEnvironmentProviderRegistry,
|
|
3
|
+
providerAsExecutor,
|
|
4
|
+
providerAsSandboxClient,
|
|
5
|
+
resolveAgentEnvironmentProvider,
|
|
6
|
+
sandboxClientAsProvider
|
|
7
|
+
} from "./chunk-Z3RRRPRB.js";
|
|
8
|
+
import "./chunk-DGUM43GV.js";
|
|
9
|
+
export {
|
|
10
|
+
createAgentEnvironmentProviderRegistry,
|
|
11
|
+
providerAsExecutor,
|
|
12
|
+
providerAsSandboxClient,
|
|
13
|
+
resolveAgentEnvironmentProvider,
|
|
14
|
+
sandboxClientAsProvider
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=environment-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/index.d.ts
CHANGED
|
@@ -9,15 +9,16 @@ import { Scenario as Scenario$1, SurfaceProposer, JudgeConfig, MutableSurface, D
|
|
|
9
9
|
import { AgentProfile as AgentProfile$1 } from '@tangle-network/agent-interface';
|
|
10
10
|
import { S as SurfaceImprovementEdit } from './improvement-adapter-CioiEE2z.js';
|
|
11
11
|
import { I as ImprovementAdapter } from './types-BC3bZpH0.js';
|
|
12
|
-
export { D as DELEGATED_LOOP_MODES, a as DelegatedLoopMode, b as DelegatedLoopRegistry, c as DelegatedLoopResult, d as DelegatedLoopRunner, L as LoopRunnerCliArgs, e as LoopRunnerCliResult, R as ResearchLoopResult, f as ResearchLoopRunnerOptions, g as RunDelegatedLoopOptions, V as VetoedFact, W as WorktreeLoopRunnerOptions, h as auditLoopRunner, i as isDelegatedLoopMode, p as parseLoopRunnerArgv, r as researchLoopRunner, j as runDelegatedLoop, k as runLoopRunnerCli, s as selfImproveLoopRunner, w as worktreeLoopRunner } from './loop-runner-bin-
|
|
12
|
+
export { D as DELEGATED_LOOP_MODES, a as DelegatedLoopMode, b as DelegatedLoopRegistry, c as DelegatedLoopResult, d as DelegatedLoopRunner, L as LoopRunnerCliArgs, e as LoopRunnerCliResult, R as ResearchLoopResult, f as ResearchLoopRunnerOptions, g as RunDelegatedLoopOptions, V as VetoedFact, W as WorktreeLoopRunnerOptions, h as auditLoopRunner, i as isDelegatedLoopMode, p as parseLoopRunnerArgv, r as researchLoopRunner, j as runDelegatedLoop, k as runLoopRunnerCli, s as selfImproveLoopRunner, w as worktreeLoopRunner } from './loop-runner-bin-DCr5OMe5.js';
|
|
13
13
|
export { m as mcpToolsForRuntimeMcp, a as mcpToolsForRuntimeMcpSubset } from './openai-tools-B-3v06BE.js';
|
|
14
14
|
export { E as EvalRunEvent, a as EvalRunGeneration, b as EvalRunsExportConfig, c as EvalRunsExportResult, I as INTELLIGENCE_WIRE_VERSION, L as LoopSpanNode, d as OtelAttribute, e as OtelExportConfig, O as OtelExporter, f as OtelSpan, g as buildLoopOtelSpans, h as buildLoopSpanNodes, i as createOtelExporter, j as exportEvalRuns, l as loopEventToOtelSpan } from './otel-export-BKmNwiCb.js';
|
|
15
15
|
import '@tangle-network/sandbox';
|
|
16
16
|
import './local-harness-DU7yV6mG.js';
|
|
17
17
|
import 'node:child_process';
|
|
18
18
|
import './kb-gate-CuzMYGYM.js';
|
|
19
|
-
import './
|
|
20
|
-
import './worktree-fanout-
|
|
19
|
+
import './types-C1sozrte.js';
|
|
20
|
+
import './worktree-fanout-CtQrRDME.js';
|
|
21
|
+
import './worktree-CpptK3oF.js';
|
|
21
22
|
|
|
22
23
|
/**
|
|
23
24
|
* @stable
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
mcpToolsForRuntimeMcp,
|
|
3
3
|
mcpToolsForRuntimeMcpSubset
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-SONQUREI.js";
|
|
5
5
|
import {
|
|
6
6
|
DEFAULT_ROUTER_BASE_URL,
|
|
7
7
|
cleanModelId,
|
|
@@ -20,16 +20,16 @@ import {
|
|
|
20
20
|
runLoopRunnerCli,
|
|
21
21
|
selfImproveLoopRunner,
|
|
22
22
|
worktreeLoopRunner
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-2DS6T46I.js";
|
|
24
24
|
import "./chunk-FNMGYYSS.js";
|
|
25
|
-
import "./chunk-
|
|
25
|
+
import "./chunk-75V2XXYJ.js";
|
|
26
26
|
import {
|
|
27
27
|
assertModelAllowed,
|
|
28
28
|
composeRuntimeHooks,
|
|
29
29
|
defineRuntimeHooks,
|
|
30
30
|
notifyRuntimeDecisionPoint,
|
|
31
31
|
notifyRuntimeHookEvent
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-TSDKBFZP.js";
|
|
33
33
|
import {
|
|
34
34
|
INTELLIGENCE_WIRE_VERSION,
|
|
35
35
|
buildLoopOtelSpans,
|
|
@@ -38,6 +38,7 @@ import {
|
|
|
38
38
|
exportEvalRuns,
|
|
39
39
|
loopEventToOtelSpan
|
|
40
40
|
} from "./chunk-VMNEQHJR.js";
|
|
41
|
+
import "./chunk-Z3RRRPRB.js";
|
|
41
42
|
import "./chunk-IODKUOBA.js";
|
|
42
43
|
import "./chunk-T2HVQVB4.js";
|
|
43
44
|
import {
|