hiveagents-runtime 0.0.0-stage → 0.1.0-beta.3
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/LICENSE +202 -0
- package/README.md +89 -2
- package/dist/adapter-kit.d.ts +37 -0
- package/dist/adapter-kit.js +34 -0
- package/dist/adapter-kit.js.map +1 -0
- package/dist/agent-Bj5YPrO7.d.ts +169 -0
- package/dist/agent-D6OXR7UF.js +24 -0
- package/dist/agent-D6OXR7UF.js.map +1 -0
- package/dist/agent-readiness-KSGNKTGK.js +19 -0
- package/dist/agent-readiness-KSGNKTGK.js.map +1 -0
- package/dist/capture-runtime-GP6NZ2ee.d.ts +54 -0
- package/dist/chunk-2RK74GCA.js +2397 -0
- package/dist/chunk-2RK74GCA.js.map +1 -0
- package/dist/chunk-3TIYA3K5.js +55 -0
- package/dist/chunk-3TIYA3K5.js.map +1 -0
- package/dist/chunk-6FIXXWNM.js +1 -0
- package/dist/chunk-6FIXXWNM.js.map +1 -0
- package/dist/chunk-6XIJW65Q.js +52 -0
- package/dist/chunk-6XIJW65Q.js.map +1 -0
- package/dist/chunk-7LDQKJKI.js +248 -0
- package/dist/chunk-7LDQKJKI.js.map +1 -0
- package/dist/chunk-CPN4DOXH.js +115 -0
- package/dist/chunk-CPN4DOXH.js.map +1 -0
- package/dist/chunk-DAXPAV2L.js +810 -0
- package/dist/chunk-DAXPAV2L.js.map +1 -0
- package/dist/chunk-DQEMIGKC.js +291 -0
- package/dist/chunk-DQEMIGKC.js.map +1 -0
- package/dist/chunk-DZFFGUIA.js +81 -0
- package/dist/chunk-DZFFGUIA.js.map +1 -0
- package/dist/chunk-EEUYQFCP.js +106 -0
- package/dist/chunk-EEUYQFCP.js.map +1 -0
- package/dist/chunk-G6JV7WV6.js +521 -0
- package/dist/chunk-G6JV7WV6.js.map +1 -0
- package/dist/chunk-GFVYNPLS.js +118 -0
- package/dist/chunk-GFVYNPLS.js.map +1 -0
- package/dist/chunk-GS5U3KUN.js +201 -0
- package/dist/chunk-GS5U3KUN.js.map +1 -0
- package/dist/chunk-HB7FBSH2.js +960 -0
- package/dist/chunk-HB7FBSH2.js.map +1 -0
- package/dist/chunk-HZFZX5A3.js +21 -0
- package/dist/chunk-HZFZX5A3.js.map +1 -0
- package/dist/chunk-J7VAYJKM.js +595 -0
- package/dist/chunk-J7VAYJKM.js.map +1 -0
- package/dist/chunk-NCNSHOF7.js +52 -0
- package/dist/chunk-NCNSHOF7.js.map +1 -0
- package/dist/chunk-RH5A5U7G.js +202 -0
- package/dist/chunk-RH5A5U7G.js.map +1 -0
- package/dist/chunk-RX3XZENU.js +385 -0
- package/dist/chunk-RX3XZENU.js.map +1 -0
- package/dist/chunk-RXU2Q2HF.js +49 -0
- package/dist/chunk-RXU2Q2HF.js.map +1 -0
- package/dist/chunk-TG7NTMTR.js +208 -0
- package/dist/chunk-TG7NTMTR.js.map +1 -0
- package/dist/chunk-TWGEYWMO.js +1217 -0
- package/dist/chunk-TWGEYWMO.js.map +1 -0
- package/dist/chunk-UZPDDQVJ.js +2910 -0
- package/dist/chunk-UZPDDQVJ.js.map +1 -0
- package/dist/chunk-WMKO5XOE.js +601 -0
- package/dist/chunk-WMKO5XOE.js.map +1 -0
- package/dist/chunk-WOQBVJH5.js +175 -0
- package/dist/chunk-WOQBVJH5.js.map +1 -0
- package/dist/chunk-WVT5SEKC.js +581 -0
- package/dist/chunk-WVT5SEKC.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +26 -0
- package/dist/cli.js.map +1 -0
- package/dist/errors-BNHvvjn9.d.ts +98 -0
- package/dist/execution-halt-B8G0fOKS.d.ts +12 -0
- package/dist/execution-types-ClYYqPQP.d.ts +239 -0
- package/dist/host-ledger-VPRWVVOS.js +25 -0
- package/dist/host-ledger-VPRWVVOS.js.map +1 -0
- package/dist/hosted-runtime.d.ts +168 -0
- package/dist/hosted-runtime.js +858 -0
- package/dist/hosted-runtime.js.map +1 -0
- package/dist/index-B86C6VAD.d.ts +41 -0
- package/dist/index.d.ts +344 -0
- package/dist/index.js +8825 -0
- package/dist/index.js.map +1 -0
- package/dist/memory-items-BSTC0_R0.d.ts +28 -0
- package/dist/memory-tools.d.ts +222 -0
- package/dist/memory-tools.js +923 -0
- package/dist/memory-tools.js.map +1 -0
- package/dist/orchestration/dynamic.d.ts +854 -0
- package/dist/orchestration/dynamic.js +3150 -0
- package/dist/orchestration/dynamic.js.map +1 -0
- package/dist/orchestration/graph.d.ts +11 -0
- package/dist/orchestration/graph.js +9 -0
- package/dist/orchestration/graph.js.map +1 -0
- package/dist/orchestration/index.d.ts +2385 -0
- package/dist/orchestration/index.js +6409 -0
- package/dist/orchestration/index.js.map +1 -0
- package/dist/orchestration/log.d.ts +301 -0
- package/dist/orchestration/log.js +3058 -0
- package/dist/orchestration/log.js.map +1 -0
- package/dist/orchestration/memory.d.ts +711 -0
- package/dist/orchestration/memory.js +27 -0
- package/dist/orchestration/memory.js.map +1 -0
- package/dist/provider-DX5Mf0uq.d.ts +151 -0
- package/dist/routing/index.d.ts +29 -0
- package/dist/routing/index.js +386 -0
- package/dist/routing/index.js.map +1 -0
- package/dist/routing/learning/index.d.ts +433 -0
- package/dist/routing/learning/index.js +2502 -0
- package/dist/routing/learning/index.js.map +1 -0
- package/dist/runtime-BSjrnxeF.d.ts +283 -0
- package/dist/runtime-OISPXS4I.js +19 -0
- package/dist/runtime-OISPXS4I.js.map +1 -0
- package/dist/store-types-2YdceOMy.d.ts +78 -0
- package/dist/types-BB7KqceP.d.ts +52 -0
- package/dist/types-CIqkKXix.d.ts +86 -0
- package/dist/types-DTFc1qO6.d.ts +1065 -0
- package/dist/types-DYex3p7_.d.ts +88 -0
- package/docs/licenses/ruflo-memory-MIT.txt +21 -0
- package/docs/releases/0.1.0-beta.3.md +13 -0
- package/package.json +114 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/public/agent-readiness.ts","../src/core/capabilities.ts","../src/core/subscription-exec.ts","../src/session/negotiation.ts","../src/session/exec-capabilities.ts","../src/session/mcp-envelope.ts"],"sourcesContent":["import { types } from 'node:util';\nimport { realpath } from 'node:fs/promises';\nimport type { ExecAdapter, ExecProbeTurn } from '../adapters/provider.js';\nimport type { CliCompatibilityAssessment } from '../compatibility/manifest.js';\nimport { OperationScope } from '../control/operation-scope.js';\nimport { validateSettlementOption } from '../control/exec-settlement.js';\nimport { validateTimeoutMs } from '../process/run-process.js';\nimport { selectTransport } from '../core/capabilities.js';\nimport { freeze } from '../shared/json.js';\nimport { buildEnvironment } from '../core/environment.js';\nimport { assertRespondCompatibility, assertRespondAuth } from '../core/respond-policy.js';\nimport { createExecutablePin, experimentalGates, PinnedExecAdapter, type ExecReprobe } from '../core/registry.js';\nimport type { Runtime } from '../core/runtime.js';\nimport { SubscriptionExecAdapter } from '../core/subscription-exec.js';\nimport { authenticationState, hasConfirmedSubscription, isAuthenticationConfirmed } from '../core/auth-evidence.js';\nimport { buildSafetyEnvelope, negotiateCapabilities, controlFeatures } from '../session/negotiation.js';\nimport { buildExecFeatures } from '../session/exec-capabilities.js';\nimport { envelopeMcpServers } from '../session/mcp-envelope.js';\nimport { CliNotInstalledError, NotAuthenticatedError, UnexpectedAuthSourceError, UnsupportedCliVersionError, UnsupportedCapabilityError } from './errors.js';\nimport type { AgentOptions, AgentReadiness, AgentReadinessOptions, CapabilityReport, CapabilityStatus, ModelInfo, NegotiatedPlan, PermissionIntent, RuntimeWarning, SessionPersistence } from './types.js';\n\nexport interface PreparedAgent {\n readonly readiness: AgentReadiness;\n readonly launchPlan: NegotiatedPlan;\n cwd: string;\n permissions: PermissionIntent;\n sessionAdapter: ExecAdapter;\n}\n\n/** Preparation has no session side effects; callers choose whether to retain its result. */\nexport async function prepareAgent(\n options: Readonly<AgentOptions>, runtime: Runtime, model: ModelInfo,\n persistence: SessionPersistence = 'provider', scope?: OperationScope,\n): Promise<PreparedAgent> {\n const probe = async <T>(work: () => Promise<T> | T): Promise<T> => scope ? scope.race(work) : work();\n let sessionAdapter: ExecAdapter;\n const transport = agentTransport(options, runtime, model.provider, persistence);\n runtime.registration(model.provider).validateOptions(options, transport);\n const cwd = await probe(() => realpath(options.cwd ?? process.cwd()));\n const requestedPermissions = options.permissions ?? { mode: 'analyze' };\n const directories = requestedPermissions.additionalDirectories;\n const additionalDirectories = directories\n ? await Promise.all(directories.map((directory) => probe(() => realpath(directory))))\n : undefined;\n const permissionsIntent: PermissionIntent = {\n ...requestedPermissions,\n ...(additionalDirectories === undefined ? {} : { additionalDirectories }),\n };\n const adapter = runtime.adapter(model.provider);\n const env = agentEnvironment(options);\n const installation = await probe(() => adapter.detect(env, scope));\n if (!installation.installed) {\n throw new CliNotInstalledError(model.provider, { retryable: false });\n }\n const providerOptions = model.provider === 'claude' ? options.providerOptions?.claude\n : model.provider === 'codex' ? options.providerOptions?.codex : options.providerOptions?.external?.[model.provider];\n const authTurn: ExecProbeTurn | undefined = options.requireAuth === 'subscription'\n ? { cwd, contextArgs: runtime.registration(model.provider).translateContext(options.context).args,\n ...(providerOptions === undefined ? {} : { providerOptions }) }\n : undefined;\n const auth = await probe(() => adapter.auth(env, scope, authTurn));\n if (!isAuthenticationConfirmed(auth)\n && !(authenticationState(auth) === 'unknown' && options.requireAuth !== 'subscription')) {\n throw new NotAuthenticatedError(model.provider, {\n retryable: false,\n ...(installation.version === undefined ? {} : { cliVersion: installation.version }),\n });\n }\n const compatibility: CliCompatibilityAssessment | undefined = installation.version\n ? await probe(() => adapter.compatibility?.(env, installation.version!, scope))\n : undefined;\n if (transport === 'exec' && installation.version && compatibility?.features.turns === 'unsupported') {\n throw new UnsupportedCliVersionError(model.provider, installation.version, {\n provider: model.provider,\n transport: 'exec',\n cliVersion: installation.version,\n retryable: false,\n sanitizedDiagnostics: { missingFlags: compatibility.missingFlags },\n });\n }\n if (options.requireAuth === 'subscription' && !hasConfirmedSubscription(auth)) {\n throw new UnexpectedAuthSourceError(model.provider, {\n retryable: false,\n sanitizedDiagnostics: { detectedSource: auth.source },\n });\n }\n if (options.effort && model.supportedEffort\n && !model.supportedEffort.includes(options.effort)) {\n throw new UnsupportedCapabilityError(\n { provider: model.provider, transport: 'exec', retryable: false },\n `Effort \"${options.effort}\" is not supported by ${model.id}`,\n );\n }\n const context = runtime.registration(model.provider).translateContext(options.context);\n const permissions = runtime.registration(model.provider).translatePermissions(\n permissionsIntent,\n transport,\n );\n assertRespondCompatibility(options, compatibility);\n const unsupported = [...context.unsupported, ...permissions.report.unsupported];\n if (options.permissions?.strict !== false && unsupported.length > 0) {\n throw new UnsupportedCapabilityError(\n { provider: model.provider, transport, retryable: false },\n `Requested policy cannot be enforced: ${unsupported.join(', ')}`,\n );\n }\n const compatibilityWarnings: RuntimeWarning[] = compatibility === undefined\n ? [{ code: 'COMPATIBILITY_NOT_PROBED', message: 'CLI help capabilities were not probed' }]\n : compatibility.evidence === 'live-contract'\n ? []\n : [{\n code: compatibility.missingFlags.length > 0 ? 'CLI_FLAGS_MISSING' : 'HELP_PROBED_ONLY',\n message: compatibility.missingFlags.length > 0\n ? `Installed CLI is missing flags: ${compatibility.missingFlags.join(', ')}`\n : `${model.provider} ${installation.version ?? 'unknown'} is help-probed but not live-contract verified`,\n }];\n const capabilities: CapabilityReport = {\n provider: model.provider,\n transport,\n features: buildExecFeatures(compatibility?.features, model.provider, !!adapter.stream),\n unsupported,\n warnings: [\n ...(auth.state === 'unknown' ? [{ code: 'AUTH_UNVERIFIED', message: 'Authentication is unverified; the requested turn will confirm it' }] : []),\n ...context.warnings.map((message) => ({ code: 'CONTEXT_PARTIAL', message })),\n ...compatibilityWarnings,\n ],\n contextSources: context.report,\n enforcement: permissions.report,\n };\n const executableRealpath = installation.realpath ?? installation.path ?? '';\n const fingerprint = `${model.provider}:${installation.version ?? 'unknown'}:${executableRealpath}`;\n const controlRegistration = runtime.controlRegistration(model.provider);\n if (transport === 'control' && controlRegistration) capabilities.features = controlFeatures(controlRegistration);\n const negotiatedCapabilities = negotiateCapabilities({\n transport,\n registration: controlRegistration,\n features: capabilities.features,\n fingerprint,\n });\n assertRequiredCapabilities(options, model, negotiatedCapabilities, transport);\n const requireSubscription = (exec: ExecAdapter) => transport === 'exec' && options.requireAuth === 'subscription'\n ? new SubscriptionExecAdapter(exec) : exec;\n const pin = await probe(() => createExecutablePin(installation.launchTarget?.command ?? executableRealpath, installation.version, { target: installation.launchTarget, identityFiles: installation.identityFiles }));\n if (pin) {\n const pinnedBase = runtime.adapterWithTarget(model.provider, pin.launchTarget ?? { command: pin.realpath, argsPrefix: [] });\n const reprobe: ExecReprobe = async (probeEnv, previous, context) => {\n const probed = await pinnedBase.detect(probeEnv, context);\n if (!probed.installed) {\n throw new CliNotInstalledError(model.provider, { retryable: false });\n }\n {\n const version = probed.version ?? previous.cliVersion ?? 'unknown';\n const reassessed = await pinnedBase.compatibility?.(probeEnv, version, context);\n assertRespondCompatibility(options, reassessed);\n assertRequiredCapabilities(options, model, negotiateCapabilities({\n transport,\n registration: controlRegistration,\n features: buildExecFeatures(reassessed?.features, model.provider, !!pinnedBase.stream),\n fingerprint,\n }), transport);\n if (options.permissions?.mode === 'respond') assertRespondAuth(options, await pinnedBase.auth(probeEnv, context, authTurn));\n if (reassessed?.features.turns === 'unsupported') {\n throw new UnsupportedCliVersionError(model.provider, version, {\n provider: model.provider,\n transport: 'exec',\n cliVersion: version,\n retryable: false,\n sanitizedDiagnostics: { missingFlags: reassessed.missingFlags },\n });\n }\n }\n const next = await createExecutablePin(\n probed.launchTarget?.command ?? probed.realpath ?? probed.path ?? previous.realpath,\n probed.version ?? previous.cliVersion,\n { target: probed.launchTarget ?? previous.launchTarget, identityFiles: probed.identityFiles ?? previous.identityFiles?.map((file) => file.realpath) },\n );\n if (!next) throw new CliNotInstalledError(model.provider, { retryable: false });\n return next;\n };\n sessionAdapter = new PinnedExecAdapter(requireSubscription(pinnedBase), pin, reprobe);\n } else {\n sessionAdapter = requireSubscription(adapter);\n }\n const envelope = buildSafetyEnvelope({\n tools: [...(permissionsIntent.mode === 'respond' ? options.providerOptions?.claude?.tools ?? [] : []),\n ...(options.tools ?? []).map(tool => tool.name)],\n mcpServers: envelopeMcpServers({\n provider: model.provider, transport, cwd, providerOptions,\n contextArgs: context.args, permissionArgs: permissions.args, applicationTools: options.tools?.length ?? 0,\n }),\n cwd,\n permissions: permissionsIntent,\n environmentVariables: Object.keys(env),\n executableRealpath,\n modelId: model.id,\n enforcedBy: permissions.report.effective.enforcedBy,\n });\n const readiness: AgentReadiness = {\n ready: true,\n provider: model.provider,\n model,\n installation,\n auth,\n capabilities,\n plan: {\n provider: model.provider,\n transport,\n fingerprint: {\n adapterVersion: transport === 'control' && controlRegistration\n ? controlRegistration.adapterVersion\n : runtime.registration(model.provider).exec.adapterVersion,\n cliVersion: installation.version ?? 'unknown',\n executableRealpath: pin?.realpath ?? executableRealpath,\n ...(pin === undefined ? {} : { executableDigest: pin.digest }),\n ...(pin?.launchIdentityDigest === undefined ? {} : { launchIdentityDigest: pin.launchIdentityDigest }),\n ...(transport === 'control' && controlRegistration?.protocolVersion !== undefined\n ? { protocolVersion: controlRegistration.protocolVersion }\n : {}),\n ...(transport === 'control' && controlRegistration?.sdkVersion !== undefined\n ? { sdkVersion: controlRegistration.sdkVersion }\n : {}),\n },\n capabilities: negotiatedCapabilities,\n envelope,\n warnings: capabilities.warnings,\n },\n };\n const launchPlan = freeze(structuredClone(readiness.plan));\n return { cwd, permissions: permissionsIntent, sessionAdapter, launchPlan, readiness: freeze(structuredClone(readiness)) };\n}\n\nfunction assertRequiredCapabilities(\n options: Readonly<AgentOptions>, model: ModelInfo,\n negotiated: Record<string, CapabilityStatus>,\n transport: 'exec' | 'control',\n): void {\n for (const [name, value] of Object.entries(options.capabilities ?? {})) {\n if (value !== true && value !== 'required') continue;\n const key = name === 'tokenDeltas' ? 'messageDeltas' : name;\n const support = negotiated[key]?.support ?? 'unknown';\n if (support === 'unknown' || support === 'none') {\n throw new UnsupportedCapabilityError(\n { provider: model.provider, transport, retryable: false },\n `Required capability ${name} is ${support} on the ${transport} transport; unknown evidence does not satisfy a required capability`,\n );\n }\n }\n}\n\nexport function agentEnvironment(options: Readonly<AgentOptions>): NodeJS.ProcessEnv {\n const profile = options.context?.profile ?? 'native';\n return buildEnvironment(options.environment ?? { mode: profile === 'native' ? 'inherit' : 'minimal' });\n}\n\nexport function agentTransport(\n options: Readonly<AgentOptions>, runtime: Runtime, provider: string, persistence: SessionPersistence = 'provider',\n) {\n const controlRegistered = runtime.controlRegistration(provider) !== undefined;\n const preference = options.transport ?? 'auto';\n return selectTransport({\n provider,\n preference: options.pinned && preference === 'auto' ? 'exec' : preference,\n requirements: options.capabilities ?? {},\n persistence,\n controlRegistered,\n controlAvailable: controlRegistered && experimentalGates(options.providerOptions).control,\n execCapabilities: runtime.registration(provider).execCapabilities,\n });\n}\n\n/** Snapshot and validate before starting any asynchronous preparation. */\nexport async function freshAgentReadiness(\n options: Readonly<AgentOptions>, runtime: Runtime, model: ModelInfo,\n readinessOptions: AgentReadinessOptions,\n): Promise<AgentReadiness> {\n if (!readinessOptions || typeof readinessOptions !== 'object' || types.isProxy(readinessOptions)\n || ![Object.prototype, null].includes(Object.getPrototypeOf(readinessOptions))) {\n throw new TypeError('Readiness options must be a plain object');\n }\n const snapshot: Record<string, unknown> = Object.create(null);\n for (const key of Reflect.ownKeys(readinessOptions)) {\n const descriptor = Object.getOwnPropertyDescriptor(readinessOptions, key)!;\n if (typeof key !== 'string' || !['signal', 'timeoutMs', 'awaitSettlement'].includes(key)\n || !Object.hasOwn(descriptor, 'value')) throw new TypeError('Invalid readiness option');\n snapshot[key] = descriptor.value;\n }\n const { signal, timeoutMs, awaitSettlement } = snapshot;\n if (signal !== undefined && !(signal instanceof AbortSignal)) throw new TypeError('signal must be an AbortSignal');\n if (timeoutMs !== undefined && typeof timeoutMs !== 'number') throw new TypeError('timeoutMs must be a number');\n validateSettlementOption(awaitSettlement);\n const scope = new OperationScope(Object.assign(Object.create(null), {\n timeoutMs: validateTimeoutMs(timeoutMs), ...(signal === undefined ? {} : { signal }),\n context: { provider: model.provider, retryable: true },\n }));\n try {\n return (await scope.race(() => prepareAgent(options, runtime, model, 'provider', scope))).readiness;\n } finally {\n try {\n if (awaitSettlement) { await scope.drain(); scope.rethrowExecutionHalt(); }\n } finally { scope.dispose(); }\n }\n}\n","import {\n RequiredTransportUnavailableError,\n UnsupportedCapabilityError,\n} from '../public/errors.js';\nimport { controlUnavailableMessage } from './registry.js';\nimport type {\n CapabilityRequirements,\n CapabilitySupport,\n ProviderId,\n SessionPersistence,\n TransportKind,\n TransportPreference,\n} from '../public/types.js';\n\nconst CONTROL_ONLY: ReadonlyArray<keyof CapabilityRequirements> = [\n 'interactiveApprovals',\n 'userInputDuringTurn',\n 'steering',\n 'inProcessTools',\n 'dynamicPermissions',\n 'sessionInspection',\n 'checkpointOrRollback',\n // Ningún exec CLI confirma un fork sin prompt; exigirlo debe rutear a control\n // en vez de elegir exec y fallar cerrado después.\n 'forkWithoutPrompt',\n];\n\nexport interface TransportSelectionInput {\n provider: ProviderId;\n execCapabilities?: Readonly<Record<string, CapabilitySupport>> | undefined;\n preference: TransportPreference;\n requirements: CapabilityRequirements;\n persistence: SessionPersistence;\n controlAvailable: boolean;\n /** A control adapter is registered but the experimentalControl gate is off. */\n controlRegistered?: boolean;\n}\n\nfunction controlUnavailable(input: TransportSelectionInput, detail: string): never {\n if (input.controlRegistered ?? false) {\n throw new UnsupportedCapabilityError(\n { provider: input.provider, transport: 'control', retryable: false },\n `${detail}; the ${input.provider} control adapter is registered but requires the explicit experimentalControl opt-in`,\n );\n }\n throw new RequiredTransportUnavailableError(\n { provider: input.provider, transport: 'control', retryable: false },\n `${detail}; ${controlUnavailableMessage(input.provider)}`,\n );\n}\n\nfunction requiredControlCapabilities(input: TransportSelectionInput): string[] {\n const required = CONTROL_ONLY.filter((name) => {\n const value = input.requirements[name];\n return value === true || value === 'required';\n });\n const processPersistence = input.requirements.processPersistence;\n if (input.persistence === 'process' || processPersistence === true || processPersistence === 'required') {\n required.push('processPersistence');\n }\n const deltas = input.requirements.messageDeltas ?? input.requirements.tokenDeltas;\n if ((input.execCapabilities?.messageDeltas === 'unsupported' || input.execCapabilities?.tokenDeltas === 'unsupported' || input.provider === 'codex') && (deltas === true || deltas === 'required')) {\n required.push('messageDeltas');\n }\n return [...new Set(required)];\n}\n\nexport function selectTransport(input: TransportSelectionInput): TransportKind {\n const requiresControl = requiredControlCapabilities(input);\n\n if (input.preference === 'exec' && requiresControl.length > 0) {\n throw new UnsupportedCapabilityError(\n { provider: input.provider, transport: 'exec', retryable: false },\n `Exec transport cannot provide: ${requiresControl.join(', ')}`,\n );\n }\n\n if (input.preference === 'control') {\n if (!input.controlAvailable) {\n controlUnavailable(input, 'Control transport was explicitly requested');\n }\n return 'control';\n }\n\n if (requiresControl.length > 0) {\n if (!input.controlAvailable) {\n controlUnavailable(input, `Capabilities require control transport: ${requiresControl.join(', ')}`);\n }\n return 'control';\n }\n\n return 'exec';\n}\n","import { settleExecScope } from '../control/exec-settlement.js';\nimport { raceExecWork, resultUsage, streamStepUsage } from '../control/exec-usage.js';\nimport type { AdapterStreamItem, ExecAdapter, ExecProbeContext, ExecProbeTurn, ExecTurnRequest } from '../adapters/provider.js';\nimport { OperationScope } from '../control/operation-scope.js';\nimport { isAuthenticationConfirmed } from './auth-evidence.js';\nimport { NotAuthenticatedError, UnexpectedAuthSourceError } from '../public/errors.js';\n\n/** A CLI login can change while a session remains open, independently of its binary. */\nexport class SubscriptionExecAdapter implements ExecAdapter {\n readonly id: ExecAdapter['id'];\n stream?: NonNullable<ExecAdapter['stream']>;\n\n constructor(readonly inner: ExecAdapter) {\n this.id = inner.id;\n const stream = inner.stream?.bind(inner);\n if (stream) {\n const check = this.#check.bind(this);\n this.stream = async function* (request) {\n const scope = new OperationScope({ timeoutMs: request.timeoutMs, ...(request.signal ? { signal: request.signal } : {}), context: { provider: inner.id, transport: 'exec', retryable: true } });\n let iterator: AsyncIterator<AdapterStreamItem> | undefined, exhausted = false;\n try {\n await scope.race(() => check(request, scope));\n iterator = stream({ ...request, requireSubscription: true, timeoutMs: scope.remainingMs(), signal: scope.signal })[Symbol.asyncIterator]();\n for (;;) {\n const step = await raceExecWork(scope, () => iterator!.next(), request.awaitSettlement, streamStepUsage);\n if (step.done) { exhausted = true; return; }\n yield step.value;\n }\n } finally { await settleExecScope(scope, request.awaitSettlement, iterator, exhausted); }\n };\n }\n }\n\n detect(env: NodeJS.ProcessEnv, context?: ExecProbeContext) { return this.inner.detect(env, context); }\n auth(env: NodeJS.ProcessEnv, context?: ExecProbeContext, turn?: ExecProbeTurn) { return this.inner.auth(env, context, turn); }\n models() { return this.inner.models(); }\n async compatibility(env: NodeJS.ProcessEnv, version: string, context?: ExecProbeContext) {\n return this.inner.compatibility?.(env, version, context);\n }\n\n async execute(request: ExecTurnRequest) {\n const scope = new OperationScope({ timeoutMs: request.timeoutMs, ...(request.signal ? { signal: request.signal } : {}), context: { provider: this.id, transport: 'exec', retryable: true } });\n try {\n await scope.race(() => this.#check(request, scope));\n return await raceExecWork(scope, () => this.inner.execute({ ...request, requireSubscription: true, timeoutMs: scope.remainingMs(), signal: scope.signal }), request.awaitSettlement, resultUsage);\n } finally { if (request.awaitSettlement) await scope.drain(); scope.dispose(); }\n }\n\n async #check(request: ExecTurnRequest, scope: ExecProbeContext): Promise<void> {\n const context = { provider: this.id, transport: 'exec' as const, retryable: false };\n const auth = await this.inner.auth(request.env, scope, {\n cwd: request.cwd, contextArgs: request.contextArgs,\n ...(request.providerOptions === undefined ? {} : { providerOptions: request.providerOptions }),\n });\n if (!isAuthenticationConfirmed(auth)) throw new NotAuthenticatedError(this.id, context);\n if (auth.source !== 'subscription') {\n throw new UnexpectedAuthSourceError(this.id, {\n ...context, sanitizedDiagnostics: { detectedSource: auth.source },\n });\n }\n }\n}\n","import type { ControlAdapterRegistration } from '../core/registry.js';\nimport type {\n CapabilityStatus,\n CapabilitySupport,\n EnforcementReport,\n PermissionIntent,\n PermissionModeCeiling,\n SafetyEnvelope,\n TransportKind,\n} from '../public/types.js';\n\n/**\n * Compiles what a `Session` will actually be opened under: the negotiated\n * capability verdicts and the immutable SafetyEnvelope. Both are derived from\n * evidence gathered during readiness, never from adapter internals.\n */\n\nconst PERMISSION_MODE_CEILINGS: Record<PermissionIntent['mode'], PermissionModeCeiling> = {\n analyze: 'plan',\n respond: 'default',\n edit: 'acceptEdits',\n unrestricted: 'bypassPermissions',\n};\n\n/** Keep the public legacy report scoped to the selected transport too. */\nexport function controlFeatures(registration: ControlAdapterRegistration): Record<string, CapabilitySupport> {\n const features = Object.fromEntries(Object.entries(registration.capabilityVerdicts).map(([name, support]) => [\n name, support === 'full' ? 'supported' : support === 'none' ? 'unsupported'\n : support === 'unknown' ? 'unverified' : 'partial',\n ])) as Record<string, CapabilitySupport>;\n features.tokenDeltas = features.messageDeltas ?? 'unverified';\n return features;\n}\n\nfunction statusFromLegacy(support: CapabilitySupport, fingerprint: string): CapabilityStatus {\n const normalized = support === 'supported'\n ? 'full'\n : support === 'unsupported' ? 'none' : support === 'unverified' ? 'unknown' : 'partial';\n return {\n support: normalized,\n evidence: [{ source: 'compatibility-manifest', fingerprint }],\n };\n}\n\nexport function negotiateCapabilities(input: {\n transport: TransportKind;\n registration: ControlAdapterRegistration | undefined;\n features: Record<string, CapabilitySupport>;\n fingerprint: string;\n}): Record<string, CapabilityStatus> {\n const { registration } = input;\n const negotiated: Record<string, CapabilityStatus> = input.transport === 'control' && registration\n ? Object.fromEntries(\n Object.entries(registration.capabilityVerdicts).map(([name, support]) => [\n name,\n {\n support,\n evidence: [{ source: registration.evidenceSource, fingerprint: input.fingerprint }],\n } satisfies CapabilityStatus,\n ]),\n )\n : Object.fromEntries(\n Object.entries(input.features).map(([name, support]) => [\n name,\n statusFromLegacy(support, input.fingerprint),\n ]),\n );\n // Exec token deltas are the runtime's message-delta channel; expose the\n // portable name so requirements negotiate against one vocabulary.\n if (negotiated.tokenDeltas && !negotiated.messageDeltas) {\n negotiated.messageDeltas = negotiated.tokenDeltas;\n }\n return negotiated;\n}\n\nexport function buildSafetyEnvelope(input: {\n cwd: string;\n permissions: PermissionIntent;\n environmentVariables: string[];\n executableRealpath: string;\n modelId: string;\n enforcedBy: EnforcementReport['effective']['enforcedBy'];\n tools?: string[];\n /** MCP server names and config-layer markers (see `mcp-envelope.ts`); absent means none. */\n mcpServers?: string[];\n}): SafetyEnvelope {\n const { permissions } = input;\n return {\n authorityEpoch: crypto.randomUUID(),\n filesystem: {\n readonlyRoots: [input.cwd, ...(permissions.additionalDirectories ?? [])],\n writableRoots: permissions.mode === 'analyze' || permissions.mode === 'respond'\n ? []\n : [input.cwd, ...(permissions.additionalDirectories ?? [])],\n },\n network: permissions.network === 'allow' ? [{ protocol: 'https', host: '*' }] : [],\n tools: [...(input.tools ?? [])],\n executables: input.executableRealpath ? [input.executableRealpath] : [],\n mcpServers: [...(input.mcpServers ?? [])],\n environmentVariables: input.environmentVariables,\n settingsPersistence: 'none',\n enforcedBy: input.enforcedBy,\n permissionModeCeiling: PERMISSION_MODE_CEILINGS[permissions.mode],\n modelAllowlist: [input.modelId],\n };\n}\n","import type { CapabilitySupport, ProviderId } from '../public/types.js';\n\n/** Provider evidence cannot advertise channels the exec host cannot transport. */\nexport function buildExecFeatures(\n reported: Record<string, CapabilitySupport> = {},\n provider: ProviderId,\n streaming: boolean,\n): Record<string, CapabilitySupport> {\n const deltas = streaming\n ? reported.messageDeltas ?? reported.tokenDeltas ?? (provider === 'codex' ? 'unsupported' : 'unverified')\n : 'unsupported';\n return {\n turns: 'unverified',\n resume: 'unverified',\n forkWithPrompt: 'unverified',\n structuredOutput: 'unverified',\n ...reported,\n tokenDeltas: deltas,\n messageDeltas: deltas,\n forkWithoutPrompt: 'unsupported',\n images: 'unsupported',\n files: 'unsupported',\n interactiveApprovals: 'unsupported',\n userInputDuringTurn: 'unsupported',\n steering: 'unsupported',\n inProcessTools: 'unsupported',\n dynamicPermissions: 'unsupported',\n sessionInspection: 'unsupported',\n checkpointOrRollback: 'unsupported',\n processPersistence: 'unsupported',\n };\n}\n","import { resolve } from 'node:path';\n\n/**\n * What `SafetyEnvelope.mcpServers` records: the MCP servers a launch can reach,\n * by name where the SDK hands them over, and by marker where a configuration\n * layer the SDK does not read can add more.\n *\n * Claude exec (`providerOptions.claude.mcpConfigs`, `--mcp-config`):\n * - An inline JSON config contributes its server names.\n * - A path contributes `config:<absolute path>`, resolved against the agent's\n * cwd as the CLI resolves it. Readiness does not read the file: the CLI reads\n * it again on every turn, so names read now would describe a snapshot the\n * turn may no longer use. The marker records the authority that is actually\n * granted, \"whatever this file defines when the turn starts\".\n * - Inline text that is not a `{\"mcpServers\":{...}}` object contributes\n * `config:inline`, so its presence stays visible.\n * - Unless the launch passes `--strict-mcp-config` (`strictMcpConfig: true`,\n * or the `respond` intent) or `--safe-mode` (the `clean` profile), the CLI\n * also loads the servers of its own settings, project `.mcp.json` and\n * plugins: `config:claude-settings`.\n *\n * Codex exec (`providerOptions.codex.config`, `--config key=TOML`):\n * - `mcp_servers: { <name>: {...} }` and dotted keys `mcp_servers.<name>[.…]`\n * contribute `<name>`; an `mcp_servers` value that is not a table contributes\n * `config:inline`.\n * - Unless the launch passes `--ignore-user-config` (`ignoreUserConfig: true`,\n * or the `project`/`clean` profiles), `$CODEX_HOME/config.toml` loads with\n * its `mcp_servers`, and so does `<cwd>/.codex/config.toml` when that user\n * config marks the project as trusted: `config:codex-user` stands for both\n * layers. Codex control always loads them (it accepts only the native\n * profile), so it carries the marker too.\n *\n * Claude control registers the in-process `oar_application` server when the\n * agent has application tools. Codex control hands application tools over as\n * dynamic tools, not MCP, so they appear in `tools` only. Whatever the Claude\n * Agent SDK loads from settings by itself is not reflected.\n */\nexport const INLINE_MCP_CONFIG_MARKER = 'config:inline';\nexport const CLAUDE_SETTINGS_MCP_MARKER = 'config:claude-settings';\nexport const CODEX_USER_CONFIG_MARKER = 'config:codex-user';\n/** Mirrors `APPLICATION_TOOL_SERVER` in the Claude control adapter; a test keeps them equal. */\nexport const CLAUDE_APPLICATION_TOOL_SERVER = 'oar_application';\n\nexport interface EnvelopeMcpInput {\n provider: string;\n transport: 'exec' | 'control';\n cwd: string;\n /** The provider's own options object (`providerOptions.claude`, `.codex`). */\n providerOptions: Readonly<Record<string, unknown>> | undefined;\n contextArgs: readonly string[];\n permissionArgs: readonly string[];\n applicationTools: number;\n}\n\nexport function envelopeMcpServers(input: EnvelopeMcpInput): string[] {\n const options = input.providerOptions;\n if (input.provider === 'claude' && input.transport === 'exec') {\n const servers = mcpServersFromClaudeConfigs(options?.mcpConfigs, input.cwd);\n const strict = options?.strictMcpConfig === true || input.permissionArgs.includes('--strict-mcp-config');\n if (!strict && !input.contextArgs.includes('--safe-mode')) servers.push(CLAUDE_SETTINGS_MCP_MARKER);\n return servers;\n }\n if (input.provider === 'claude') return input.applicationTools > 0 ? [CLAUDE_APPLICATION_TOOL_SERVER] : [];\n if (input.provider === 'codex') {\n // Codex control refuses `mcp_servers` keys in its config, so only exec reads them.\n const servers = input.transport === 'exec' ? mcpServersFromCodexConfig(options?.config) : [];\n const ignored = input.contextArgs.includes('--ignore-user-config')\n || (input.transport === 'exec' && options?.ignoreUserConfig === true);\n if (!ignored) servers.push(CODEX_USER_CONFIG_MARKER);\n return servers;\n }\n return [];\n}\n\nexport function mcpServersFromClaudeConfigs(configs: unknown, cwd: string): string[] {\n if (!Array.isArray(configs)) return [];\n const servers = new Set<string>();\n for (const config of configs) {\n // Malformed entries are refused by the exec adapter before any turn runs.\n if (typeof config !== 'string' || config.trim() === '') continue;\n if (!config.trimStart().startsWith('{')) {\n servers.add(`config:${resolve(cwd, config)}`);\n continue;\n }\n const names = inlineServerNames(config);\n if (names === undefined) servers.add(INLINE_MCP_CONFIG_MARKER);\n else for (const name of names) servers.add(name);\n }\n return [...servers];\n}\n\n/** Server names in a Codex `--config` object, as the exec adapter turns each key into `key=TOML`. */\nexport function mcpServersFromCodexConfig(config: unknown): string[] {\n if (!isTable(config)) return [];\n const servers = new Set<string>();\n for (const [key, value] of Object.entries(config)) {\n if (key === 'mcp_servers') {\n if (isTable(value)) for (const name of Object.keys(value)) servers.add(name);\n else servers.add(INLINE_MCP_CONFIG_MARKER);\n } else if (key.startsWith('mcp_servers.')) {\n // The adapter accepts only dotted bare keys, so the second segment is the server name.\n servers.add(key.split('.')[1]!);\n }\n }\n return [...servers];\n}\n\nfunction isTable(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === 'object' && !Array.isArray(value);\n}\n\nfunction inlineServerNames(config: string): string[] | undefined {\n try {\n const parsed = JSON.parse(config) as unknown;\n const map = isTable(parsed) ? parsed.mcpServers : undefined;\n return isTable(map) ? Object.keys(map) : undefined;\n } catch {\n return undefined;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,aAAa;AACtB,SAAS,gBAAgB;;;ACazB,IAAM,eAA4D;AAAA,EAChE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA;AAAA,EAGA;AACF;AAaA,SAAS,mBAAmB,OAAgC,QAAuB;AACjF,MAAI,MAAM,qBAAqB,OAAO;AACpC,UAAM,IAAI;AAAA,MACR,EAAE,UAAU,MAAM,UAAU,WAAW,WAAW,WAAW,MAAM;AAAA,MACnE,GAAG,MAAM,SAAS,MAAM,QAAQ;AAAA,IAClC;AAAA,EACF;AACA,QAAM,IAAI;AAAA,IACR,EAAE,UAAU,MAAM,UAAU,WAAW,WAAW,WAAW,MAAM;AAAA,IACnE,GAAG,MAAM,KAAK,0BAA0B,MAAM,QAAQ,CAAC;AAAA,EACzD;AACF;AAEA,SAAS,4BAA4B,OAA0C;AAC7E,QAAM,WAAW,aAAa,OAAO,CAAC,SAAS;AAC7C,UAAM,QAAQ,MAAM,aAAa,IAAI;AACrC,WAAO,UAAU,QAAQ,UAAU;AAAA,EACrC,CAAC;AACD,QAAM,qBAAqB,MAAM,aAAa;AAC9C,MAA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,IAC5E,UAAE;AAAU,YAAM,QAAQ;AAAA,IAAG;AAAA,EAC/B;AACF;","names":["context"]}
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
runCli
|
|
4
|
+
} from "./chunk-DQEMIGKC.js";
|
|
5
|
+
import "./chunk-UZPDDQVJ.js";
|
|
6
|
+
import "./chunk-HZFZX5A3.js";
|
|
7
|
+
import "./chunk-WVT5SEKC.js";
|
|
8
|
+
import "./chunk-3TIYA3K5.js";
|
|
9
|
+
import "./chunk-2RK74GCA.js";
|
|
10
|
+
import "./chunk-J7VAYJKM.js";
|
|
11
|
+
import "./chunk-G6JV7WV6.js";
|
|
12
|
+
import "./chunk-6FIXXWNM.js";
|
|
13
|
+
import "./chunk-DAXPAV2L.js";
|
|
14
|
+
import "./chunk-6XIJW65Q.js";
|
|
15
|
+
import "./chunk-RXU2Q2HF.js";
|
|
16
|
+
import "./chunk-TWGEYWMO.js";
|
|
17
|
+
import "./chunk-GS5U3KUN.js";
|
|
18
|
+
import "./chunk-EEUYQFCP.js";
|
|
19
|
+
import "./chunk-RX3XZENU.js";
|
|
20
|
+
import "./chunk-7LDQKJKI.js";
|
|
21
|
+
import "./chunk-NCNSHOF7.js";
|
|
22
|
+
import "./chunk-TG7NTMTR.js";
|
|
23
|
+
|
|
24
|
+
// src/cli/main.ts
|
|
25
|
+
process.exitCode = await runCli(process.argv.slice(2));
|
|
26
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cli/main.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { runCli } from './run-cli.js';\n\nprocess.exitCode = await runCli(process.argv.slice(2));\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAIA,QAAQ,WAAW,MAAM,OAAO,QAAQ,KAAK,MAAM,CAAC,CAAC;","names":[]}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { P as ProviderId, b as TransportKind, S as SessionRef, U as Usage } from './types-DTFc1qO6.js';
|
|
2
|
+
|
|
3
|
+
/** Closed semantic facts, classified before native prose is discarded. No retry/reset authority. */
|
|
4
|
+
interface FailureClassification {
|
|
5
|
+
kind: 'not-authenticated' | 'unknown-model' | 'model-unavailable' | 'usage-limit' | 'untrusted-workspace' | 'session-not-found' | 'provider-unavailable' | 'protocol';
|
|
6
|
+
reason?: 'request-rejected' | 'provider-overloaded' | 'transport' | 'execution-limit' | 'unknown';
|
|
7
|
+
/** Provider-reported reset in epoch milliseconds; only present on a confirmed usage rejection. */
|
|
8
|
+
retryAt?: number;
|
|
9
|
+
}
|
|
10
|
+
interface ErrorContext {
|
|
11
|
+
provider?: ProviderId;
|
|
12
|
+
transport?: TransportKind;
|
|
13
|
+
cliVersion?: string;
|
|
14
|
+
session?: SessionRef;
|
|
15
|
+
retryable: boolean;
|
|
16
|
+
rawCode?: string;
|
|
17
|
+
sanitizedDiagnostics?: unknown;
|
|
18
|
+
/** Provider-reported usage for a failed attempt or local output rejection. Absent when unknown. */
|
|
19
|
+
observedUsage?: Usage;
|
|
20
|
+
failure?: Readonly<FailureClassification>;
|
|
21
|
+
}
|
|
22
|
+
type RuntimeErrorCode = 'EXECUTION_HALTED' | 'ADMISSION_REFUSED' | 'CLI_NOT_INSTALLED' | 'NOT_AUTHENTICATED' | 'UNEXPECTED_AUTH_SOURCE' | 'UNSUPPORTED_CLI_VERSION' | 'UNKNOWN_PROVIDER' | 'UNKNOWN_MODEL' | 'AMBIGUOUS_MODEL' | 'MODEL_PROVIDER_MISMATCH' | 'MODEL_UNAVAILABLE_FOR_AUTH' | 'UNSUPPORTED_CAPABILITY' | 'REQUIRED_TRANSPORT_UNAVAILABLE' | 'SESSION_NOT_FOUND' | 'SESSION_MISMATCH' | 'SESSION_BUSY' | 'SESSION_INTERRUPTED' | 'PROTOCOL_ERROR' | 'STRUCTURED_OUTPUT_ERROR' | 'APPROVAL_REQUIRED' | 'INTERACTION_EXPIRED' | 'TIMEOUT' | 'ABORTED' | 'OUTPUT_LIMIT' | 'USAGE_LIMIT' | 'UNTRUSTED_WORKSPACE' | 'PROVIDER_UNAVAILABLE';
|
|
23
|
+
declare class AgentRuntimeError extends Error {
|
|
24
|
+
readonly code: RuntimeErrorCode;
|
|
25
|
+
readonly context: Readonly<ErrorContext>;
|
|
26
|
+
constructor(code: RuntimeErrorCode, message: string, context: ErrorContext, options?: ErrorOptions);
|
|
27
|
+
}
|
|
28
|
+
type ContextInput = ErrorContext;
|
|
29
|
+
declare class CliNotInstalledError extends AgentRuntimeError {
|
|
30
|
+
constructor(provider: ProviderId, context: ContextInput);
|
|
31
|
+
}
|
|
32
|
+
declare class NotAuthenticatedError extends AgentRuntimeError {
|
|
33
|
+
constructor(provider: ProviderId, context: ContextInput);
|
|
34
|
+
}
|
|
35
|
+
declare class UnexpectedAuthSourceError extends AgentRuntimeError {
|
|
36
|
+
constructor(provider: ProviderId, context: ContextInput);
|
|
37
|
+
}
|
|
38
|
+
declare class UnsupportedCliVersionError extends AgentRuntimeError {
|
|
39
|
+
constructor(provider: ProviderId, version: string, context: ContextInput);
|
|
40
|
+
}
|
|
41
|
+
declare class UnknownModelError extends AgentRuntimeError {
|
|
42
|
+
readonly requested: string;
|
|
43
|
+
readonly suggestions: string[];
|
|
44
|
+
constructor(requested: string, suggestions?: string[], context?: ContextInput);
|
|
45
|
+
}
|
|
46
|
+
declare class AmbiguousModelError extends AgentRuntimeError {
|
|
47
|
+
readonly requested: string;
|
|
48
|
+
readonly providers: ProviderId[];
|
|
49
|
+
constructor(requested: string, providers: ProviderId[]);
|
|
50
|
+
}
|
|
51
|
+
declare class ModelProviderMismatchError extends AgentRuntimeError {
|
|
52
|
+
constructor(requested: string, provider: ProviderId, inferred: ProviderId);
|
|
53
|
+
}
|
|
54
|
+
declare class ModelUnavailableForAuthError extends AgentRuntimeError {
|
|
55
|
+
constructor(provider: ProviderId, model: string, context: ContextInput);
|
|
56
|
+
}
|
|
57
|
+
declare const UnsupportedCapabilityError: new (context: ContextInput, message?: string) => AgentRuntimeError;
|
|
58
|
+
/**
|
|
59
|
+
* The Agent was given pinned constraints, but this turn has no verified channel to deliver them
|
|
60
|
+
* on. Nothing ran. `reason` says why; `allowUnpinned` on the option runs such turns anyway.
|
|
61
|
+
*/
|
|
62
|
+
declare class PinnedGuaranteeUnavailableError extends UnsupportedCapabilityError {
|
|
63
|
+
readonly reason: string;
|
|
64
|
+
constructor(context: ContextInput, reason: string);
|
|
65
|
+
}
|
|
66
|
+
declare const RequiredTransportUnavailableError: new (context: ContextInput, message?: string) => AgentRuntimeError;
|
|
67
|
+
declare const SessionNotFoundError: new (context: ContextInput, message?: string) => AgentRuntimeError;
|
|
68
|
+
declare const SessionMismatchError: new (context: ContextInput, message?: string) => AgentRuntimeError;
|
|
69
|
+
declare const SessionBusyError: new (context: ContextInput, message?: string) => AgentRuntimeError;
|
|
70
|
+
declare const SessionInterruptedError: new (context: ContextInput, message?: string) => AgentRuntimeError;
|
|
71
|
+
declare const ProtocolError: new (context: ContextInput, message?: string) => AgentRuntimeError;
|
|
72
|
+
declare const StructuredOutputError: new (context: ContextInput, message?: string) => AgentRuntimeError;
|
|
73
|
+
declare const ApprovalRequiredError: new (context: ContextInput, message?: string) => AgentRuntimeError;
|
|
74
|
+
declare const InteractionExpiredError: new (context: ContextInput, message?: string) => AgentRuntimeError;
|
|
75
|
+
declare const TimeoutError: new (context: ContextInput, message?: string) => AgentRuntimeError;
|
|
76
|
+
declare const AbortError: new (context: ContextInput, message?: string) => AgentRuntimeError;
|
|
77
|
+
declare const OutputLimitError: new (context: ContextInput, message?: string) => AgentRuntimeError;
|
|
78
|
+
declare const UsageLimitError: new (context: ContextInput, message?: string) => AgentRuntimeError;
|
|
79
|
+
/** Reads one nominal provider rejection; no prose, coercion, cause traversal or scheduling. */
|
|
80
|
+
declare function observedUsageLimitReset(error: unknown, provider: string, nowMs?: number): number | undefined;
|
|
81
|
+
declare const UntrustedWorkspaceError: new (context: ContextInput, message?: string) => AgentRuntimeError;
|
|
82
|
+
declare const ProviderUnavailableError: new (context: ContextInput, message?: string) => AgentRuntimeError;
|
|
83
|
+
declare class UnknownProviderError extends AgentRuntimeError {
|
|
84
|
+
constructor(provider: ProviderId);
|
|
85
|
+
}
|
|
86
|
+
type AdmissionRefusalReason = 'concurrency-limit' | 'hourly-limit' | 'daily-limit' | 'quota-cooldown' | 'wait-timeout';
|
|
87
|
+
/** Closed admission classification only. Its fields grant no retry, fallback, lease or release permission. */
|
|
88
|
+
declare class AdmissionRefusedError extends AgentRuntimeError {
|
|
89
|
+
readonly provider: ProviderId;
|
|
90
|
+
readonly reason: AdmissionRefusalReason;
|
|
91
|
+
readonly receiptDigest: string;
|
|
92
|
+
constructor(provider: ProviderId, input: {
|
|
93
|
+
readonly reason: AdmissionRefusalReason;
|
|
94
|
+
readonly receiptDigest: string;
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export { AgentRuntimeError as A, CliNotInstalledError as C, type ErrorContext as E, type FailureClassification as F, InteractionExpiredError as I, ModelProviderMismatchError as M, NotAuthenticatedError as N, OutputLimitError as O, ProtocolError as P, type RuntimeErrorCode as R, SessionBusyError as S, TimeoutError as T, UnexpectedAuthSourceError as U, AbortError as a, type AdmissionRefusalReason as b, AdmissionRefusedError as c, AmbiguousModelError as d, ApprovalRequiredError as e, ModelUnavailableForAuthError as f, PinnedGuaranteeUnavailableError as g, ProviderUnavailableError as h, RequiredTransportUnavailableError as i, SessionInterruptedError as j, SessionMismatchError as k, SessionNotFoundError as l, StructuredOutputError as m, UnknownModelError as n, UnknownProviderError as o, UnsupportedCapabilityError as p, UnsupportedCliVersionError as q, UntrustedWorkspaceError as r, UsageLimitError as s, observedUsageLimitReset as t };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { A as AgentRuntimeError, E as ErrorContext } from './errors-BNHvvjn9.js';
|
|
2
|
+
|
|
3
|
+
/** A failed infrastructure boundary must stop execution, selection and dependent retries. */
|
|
4
|
+
declare class ExecutionHaltedError extends AgentRuntimeError {
|
|
5
|
+
constructor(context?: Omit<ErrorContext, 'retryable'>, options?: ErrorOptions);
|
|
6
|
+
}
|
|
7
|
+
/** Genuine nominal errors only; oversized native error graphs are conservatively halting. */
|
|
8
|
+
declare function isExecutionHalted(error: unknown): boolean;
|
|
9
|
+
/** Preserve the original outer aggregate/cause, without invoking provider getters or proxy traps. */
|
|
10
|
+
declare function rethrowExecutionHalt(error: unknown): void;
|
|
11
|
+
|
|
12
|
+
export { ExecutionHaltedError as E, isExecutionHalted as i, rethrowExecutionHalt as r };
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { J as JsonValue } from './types-DYex3p7_.js';
|
|
2
|
+
import { U as Usage, A as AgentEvent } from './types-DTFc1qO6.js';
|
|
3
|
+
import { E as ExecutionHaltedError } from './execution-halt-B8G0fOKS.js';
|
|
4
|
+
import { P as PayloadReference, R as RunIdentity } from './types-BB7KqceP.js';
|
|
5
|
+
|
|
6
|
+
interface DecisionBinding {
|
|
7
|
+
readonly input: JsonValue;
|
|
8
|
+
readonly inputHash: string;
|
|
9
|
+
readonly authorityHash: string;
|
|
10
|
+
readonly inputVersion: string;
|
|
11
|
+
readonly authorityVersion: string;
|
|
12
|
+
}
|
|
13
|
+
interface DecisionAuthorization {
|
|
14
|
+
decision: 'allow' | 'wait' | 'deny';
|
|
15
|
+
reason: string;
|
|
16
|
+
/** Epoch milliseconds; checked again after async authorization and durable intent persistence. */
|
|
17
|
+
expiresAt: number;
|
|
18
|
+
nextAt?: number;
|
|
19
|
+
}
|
|
20
|
+
interface DecisionReceipt {
|
|
21
|
+
intentId: string;
|
|
22
|
+
inputHash: string;
|
|
23
|
+
authorityHash: string;
|
|
24
|
+
inputVersion: string;
|
|
25
|
+
authorityVersion: string;
|
|
26
|
+
approval: DecisionAuthorization;
|
|
27
|
+
resultHash: string;
|
|
28
|
+
evidence: string[];
|
|
29
|
+
verifiedAt: number;
|
|
30
|
+
}
|
|
31
|
+
interface DecisionRecord {
|
|
32
|
+
format: 1;
|
|
33
|
+
id: string;
|
|
34
|
+
binding: DecisionBinding;
|
|
35
|
+
status: 'waiting' | 'denied' | 'intent' | 'dispatched' | 'verified' | 'needs-owner';
|
|
36
|
+
attempts: number;
|
|
37
|
+
reason: string;
|
|
38
|
+
authorization?: DecisionAuthorization;
|
|
39
|
+
intentId?: string;
|
|
40
|
+
result?: JsonValue;
|
|
41
|
+
receipt?: DecisionReceipt;
|
|
42
|
+
}
|
|
43
|
+
/** App-owned, exclusive for the entire run including callback drainage. No expiry-based takeover. */
|
|
44
|
+
interface DecisionLease {
|
|
45
|
+
load(): Promise<unknown | undefined>;
|
|
46
|
+
/** Atomic durable replacement; rejection must never be reported as a completed effect. */
|
|
47
|
+
save(record: DecisionRecord): Promise<void>;
|
|
48
|
+
release(): Promise<void>;
|
|
49
|
+
}
|
|
50
|
+
interface DecisionStore {
|
|
51
|
+
acquire(id: string): Promise<DecisionLease>;
|
|
52
|
+
}
|
|
53
|
+
interface DecisionContext {
|
|
54
|
+
readonly id: string;
|
|
55
|
+
readonly binding: DecisionBinding;
|
|
56
|
+
readonly signal: AbortSignal;
|
|
57
|
+
}
|
|
58
|
+
interface DecisionEffectContext extends DecisionContext {
|
|
59
|
+
readonly intentId: string;
|
|
60
|
+
readonly attempt: number;
|
|
61
|
+
}
|
|
62
|
+
interface DecisionRunOptions {
|
|
63
|
+
id: string;
|
|
64
|
+
binding: DecisionBinding;
|
|
65
|
+
signal?: AbortSignal;
|
|
66
|
+
now?: () => number;
|
|
67
|
+
/** App condition only; a true condition never grants authority. */
|
|
68
|
+
condition?: (context: DecisionContext) => boolean | Promise<boolean>;
|
|
69
|
+
/** Trusted application port; called afresh immediately before every new dispatch. */
|
|
70
|
+
authorize(context: DecisionContext): DecisionAuthorization | Promise<DecisionAuthorization>;
|
|
71
|
+
/** Synchronous trusted check of live input/authority identity after persistence, immediately before dispatch.
|
|
72
|
+
* execute must check again at its own effect boundary if it awaits other work first. */
|
|
73
|
+
isCurrent(context: DecisionContext): boolean;
|
|
74
|
+
execute(context: DecisionEffectContext): JsonValue | Promise<JsonValue>;
|
|
75
|
+
verify(result: JsonValue, context: DecisionEffectContext): {
|
|
76
|
+
verified: boolean;
|
|
77
|
+
evidence: readonly string[];
|
|
78
|
+
} | Promise<{
|
|
79
|
+
verified: boolean;
|
|
80
|
+
evidence: readonly string[];
|
|
81
|
+
}>;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
interface TraceIdentity {
|
|
85
|
+
episodeId: string;
|
|
86
|
+
task: {
|
|
87
|
+
id: string;
|
|
88
|
+
version: string;
|
|
89
|
+
inputDigest: string;
|
|
90
|
+
};
|
|
91
|
+
source: {
|
|
92
|
+
id: string;
|
|
93
|
+
version: string;
|
|
94
|
+
digest: string;
|
|
95
|
+
};
|
|
96
|
+
profile: {
|
|
97
|
+
id: string;
|
|
98
|
+
version: string;
|
|
99
|
+
digest: string;
|
|
100
|
+
};
|
|
101
|
+
provider?: string;
|
|
102
|
+
model?: string;
|
|
103
|
+
transport?: string;
|
|
104
|
+
cliVersion?: string;
|
|
105
|
+
}
|
|
106
|
+
/** Metadata only. Arbitrary fields, free text, raw provider events and tool payloads are rejected. */
|
|
107
|
+
interface TraceEventInput {
|
|
108
|
+
type: string;
|
|
109
|
+
phaseId?: string;
|
|
110
|
+
parentId?: string;
|
|
111
|
+
sessionId?: string;
|
|
112
|
+
turnId?: string;
|
|
113
|
+
status?: string;
|
|
114
|
+
code?: string;
|
|
115
|
+
count?: number;
|
|
116
|
+
toolId?: string;
|
|
117
|
+
subagentId?: string;
|
|
118
|
+
interactionId?: string;
|
|
119
|
+
usage?: Usage;
|
|
120
|
+
}
|
|
121
|
+
interface TraceEntry extends TraceEventInput {
|
|
122
|
+
sequence: number;
|
|
123
|
+
timestamp: number;
|
|
124
|
+
}
|
|
125
|
+
type TraceTerminalStatus = 'completed' | 'failed' | 'cancelled';
|
|
126
|
+
interface TraceEpisode {
|
|
127
|
+
format: 1;
|
|
128
|
+
identity: TraceIdentity;
|
|
129
|
+
status: 'running' | TraceTerminalStatus;
|
|
130
|
+
startedAt: number;
|
|
131
|
+
updatedAt: number;
|
|
132
|
+
finishedAt?: number;
|
|
133
|
+
entries: readonly TraceEntry[];
|
|
134
|
+
/** Corruption checksum, not an authentication signature against store writers. */
|
|
135
|
+
digest: string;
|
|
136
|
+
}
|
|
137
|
+
/** Trusted app port: exclusive across all clients for this episode; never expires active ownership. */
|
|
138
|
+
interface TraceLease {
|
|
139
|
+
load(): Promise<unknown | undefined>;
|
|
140
|
+
/** Atomic durable save. Reject failures rather than reporting undurable progress. */
|
|
141
|
+
save(episode: TraceEpisode): Promise<void>;
|
|
142
|
+
release(): Promise<void>;
|
|
143
|
+
}
|
|
144
|
+
interface TraceStore {
|
|
145
|
+
acquire(episodeId: string): Promise<TraceLease>;
|
|
146
|
+
}
|
|
147
|
+
interface TraceWriter {
|
|
148
|
+
append(event: TraceEventInput): Promise<void>;
|
|
149
|
+
observe?(event: AgentEvent): Promise<void>;
|
|
150
|
+
}
|
|
151
|
+
interface TraceRecorder extends TraceWriter {
|
|
152
|
+
observe(event: AgentEvent): Promise<void>;
|
|
153
|
+
snapshot(): TraceEpisode;
|
|
154
|
+
finish(status: TraceTerminalStatus): Promise<TraceEpisode>;
|
|
155
|
+
/** Waits for already submitted writes, then releases. Safe to call more than once. */
|
|
156
|
+
close(): Promise<void>;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
interface LogArtifactBinding {
|
|
160
|
+
readonly sourceId: string;
|
|
161
|
+
readonly systemId: string;
|
|
162
|
+
readonly generation: number;
|
|
163
|
+
}
|
|
164
|
+
interface LogArtifactOptions {
|
|
165
|
+
readonly directory: string;
|
|
166
|
+
readonly binding: LogArtifactBinding;
|
|
167
|
+
readonly maxBytes?: number;
|
|
168
|
+
readonly maxPending?: number;
|
|
169
|
+
}
|
|
170
|
+
interface LogArtifactReadOptions {
|
|
171
|
+
readonly signal?: AbortSignal;
|
|
172
|
+
}
|
|
173
|
+
interface LogArtifactWriteOptions extends LogArtifactReadOptions {
|
|
174
|
+
readonly mediaType: PayloadReference['mediaType'];
|
|
175
|
+
}
|
|
176
|
+
/** Byte integrity/durability data only, never execution, recovery or release permission. */
|
|
177
|
+
interface LogArtifactVerification {
|
|
178
|
+
readonly kind: 'verified' | 'missing' | 'corrupt';
|
|
179
|
+
readonly reference: PayloadReference;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/** Optional private artifact storage. Refs/pins are DATA; the execution log owns its transactional reference records. No GC or permission API. */
|
|
183
|
+
declare function createLogArtifactStore(input: LogArtifactOptions): Promise<Readonly<{
|
|
184
|
+
write(input: string | Uint8Array, operation: LogArtifactWriteOptions): Promise<PayloadReference>;
|
|
185
|
+
verify(input: PayloadReference, operation?: LogArtifactReadOptions): Promise<LogArtifactVerification>;
|
|
186
|
+
read(input: PayloadReference, operation?: LogArtifactReadOptions): Promise<Uint8Array>;
|
|
187
|
+
snapshot: () => Readonly<{
|
|
188
|
+
faulted: boolean;
|
|
189
|
+
quarantined: number;
|
|
190
|
+
pending: number;
|
|
191
|
+
maxPending: number;
|
|
192
|
+
maxBytes: number;
|
|
193
|
+
}>;
|
|
194
|
+
}>>;
|
|
195
|
+
|
|
196
|
+
type ExecutionArtifactStore = Pick<Awaited<ReturnType<typeof createLogArtifactStore>>, 'write' | 'read' | 'verify'>;
|
|
197
|
+
interface LogExecutionDatabaseOptions {
|
|
198
|
+
readonly databasePath: string;
|
|
199
|
+
readonly systemId: string;
|
|
200
|
+
readonly busyTimeoutMs?: number;
|
|
201
|
+
readonly artifactStore?: ExecutionArtifactStore;
|
|
202
|
+
readonly maxRecordBytes?: number;
|
|
203
|
+
}
|
|
204
|
+
interface ManagedEffectAssociation {
|
|
205
|
+
readonly identity: RunIdentity;
|
|
206
|
+
readonly stepId: string;
|
|
207
|
+
readonly effectKey: string;
|
|
208
|
+
readonly operation: Readonly<{
|
|
209
|
+
id: string;
|
|
210
|
+
version: string;
|
|
211
|
+
targetDigest: string;
|
|
212
|
+
contentDigest: string;
|
|
213
|
+
provider?: string;
|
|
214
|
+
model?: string;
|
|
215
|
+
}>;
|
|
216
|
+
readonly parentEffectKey?: string;
|
|
217
|
+
}
|
|
218
|
+
interface CapturedEffectAssociation extends ManagedEffectAssociation {
|
|
219
|
+
readonly sourceId: string;
|
|
220
|
+
}
|
|
221
|
+
interface ExecutionOwnership {
|
|
222
|
+
readonly format: 1;
|
|
223
|
+
readonly sourceId: string;
|
|
224
|
+
readonly kind: 'decision' | 'workflow';
|
|
225
|
+
readonly runKey: string;
|
|
226
|
+
readonly identity: RunIdentity;
|
|
227
|
+
readonly ownerId: string;
|
|
228
|
+
}
|
|
229
|
+
interface StandaloneStoppedAcknowledgement {
|
|
230
|
+
readonly ownerStopped: true;
|
|
231
|
+
}
|
|
232
|
+
type LogExecutionFailure = 'INVALID_STATE' | 'STORAGE_UNCERTAIN' | 'INTEGRITY' | 'RUN_OWNED' | 'EFFECT_BINDING_CONFLICT' | 'OUTCOME_UNKNOWN' | 'CLOSED' | 'PAYLOAD_CODEC_REQUIRED' | 'PAYLOAD_UNAVAILABLE' | 'CODEC_LIMIT' | 'CODEC_BUSY';
|
|
233
|
+
/** Nominal SDK halt: infrastructure/effect uncertainty is not negative model-quality evidence. */
|
|
234
|
+
declare class LogExecutionError extends ExecutionHaltedError {
|
|
235
|
+
readonly reason: LogExecutionFailure;
|
|
236
|
+
constructor(reason: LogExecutionFailure);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
export { type CapturedEffectAssociation as C, type DecisionBinding as D, type ExecutionOwnership as E, type LogExecutionDatabaseOptions as L, type ManagedEffectAssociation as M, type StandaloneStoppedAcknowledgement as S, type TraceEventInput as T, type DecisionRecord as a, type DecisionStore as b, type DecisionLease as c, type ExecutionArtifactStore as d, type LogArtifactBinding as e, type LogArtifactOptions as f, type LogArtifactReadOptions as g, type LogArtifactVerification as h, type LogArtifactWriteOptions as i, LogExecutionError as j, type LogExecutionFailure as k, createLogArtifactStore as l, type DecisionRunOptions as m, type TraceStore as n, type TraceIdentity as o, type TraceRecorder as p, type TraceEpisode as q, type TraceLease as r, type DecisionContext as s, type DecisionEffectContext as t, type DecisionAuthorization as u, type DecisionReceipt as v, type TraceEntry as w, type TraceTerminalStatus as x, type TraceWriter as y };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
HOST_LAUNCH_LIMITS,
|
|
3
|
+
HostLedger,
|
|
4
|
+
LaunchQuotaRecordError,
|
|
5
|
+
LaunchRefusedError,
|
|
6
|
+
LaunchReleaseError,
|
|
7
|
+
WAITER_LEASE_MS,
|
|
8
|
+
hostLaunchLimits,
|
|
9
|
+
hostLedgerPath,
|
|
10
|
+
inspectLegacyLaunchBudget
|
|
11
|
+
} from "./chunk-HB7FBSH2.js";
|
|
12
|
+
import "./chunk-RXU2Q2HF.js";
|
|
13
|
+
import "./chunk-TG7NTMTR.js";
|
|
14
|
+
export {
|
|
15
|
+
HOST_LAUNCH_LIMITS,
|
|
16
|
+
HostLedger,
|
|
17
|
+
LaunchQuotaRecordError,
|
|
18
|
+
LaunchRefusedError,
|
|
19
|
+
LaunchReleaseError,
|
|
20
|
+
WAITER_LEASE_MS,
|
|
21
|
+
hostLaunchLimits,
|
|
22
|
+
hostLedgerPath,
|
|
23
|
+
inspectLegacyLaunchBudget
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=host-ledger-VPRWVVOS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|