@tangle-network/sdk-provider-cli-base 0.13.108 → 0.13.110
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/adapters/amp/index.d.mts +1 -1
- package/dist/adapters/amp/index.mjs +1 -1
- package/dist/adapters/exo/index.d.mts +1 -1
- package/dist/adapters/exo/index.mjs +1 -1
- package/dist/adapters/factory-droids/index.d.mts +1 -1
- package/dist/adapters/factory-droids/index.mjs +1 -1
- package/dist/adapters/grok/index.d.mts +1 -1
- package/dist/adapters/grok/index.mjs +1 -1
- package/dist/adapters/hermes/index.d.mts +1 -1
- package/dist/adapters/hermes/index.mjs +1 -1
- package/dist/adapters/nanoclaw/index.d.mts +1 -1
- package/dist/adapters/nanoclaw/index.mjs +1 -1
- package/dist/adapters/nanocode/index.d.mts +1 -1
- package/dist/adapters/nanocode/index.mjs +1 -1
- package/dist/adapters/openclaw/index.d.mts +1 -1
- package/dist/adapters/openclaw/index.mjs +1 -1
- package/dist/adapters/prime/index.d.mts +1 -1
- package/dist/adapters/prime/index.mjs +1 -1
- package/dist/{index-CX7MWkZK.d.mts → index-CghBvmcZ.d.mts} +6 -4
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{src-BVg56gUM.mjs → src-B-JlLsMB.mjs} +396 -382
- package/package.json +5 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Et as CliProviderAdapterBase, Ut as CliProviderConfig, Vt as CliExecArgs, qt as ExecutionState } from "../../index-
|
|
1
|
+
import { Et as CliProviderAdapterBase, Ut as CliProviderConfig, Vt as CliExecArgs, qt as ExecutionState } from "../../index-CghBvmcZ.mjs";
|
|
2
2
|
import { StreamParserConfig } from "@tangle-network/sdk-cli-runner";
|
|
3
3
|
import { McpConfig, ProviderConfig, StreamEvent } from "@tangle-network/agent-interface";
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Bt as toolResultEvents, Ft as reasoningEvents, It as sessionObservedEvents,
|
|
1
|
+
import { Bt as toolResultEvents, Ft as reasoningEvents, It as sessionObservedEvents, N as localMcpArgv, O as recordCliTokenUsage, P as localMcpEnv, Rt as textDeltaEvents, S as jsonEventParser, Vt as toolStartEvents, k as CliProviderAdapterBase } from "../../src-B-JlLsMB.mjs";
|
|
2
2
|
//#region src/adapters/amp/types.ts
|
|
3
3
|
/**
|
|
4
4
|
* Type guard for AMP events.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Et as CliProviderAdapterBase, Tn as CliTurnSpawn, Ut as CliProviderConfig, Vt as CliExecArgs, qt as ExecutionState, wn as CliTurnProcess } from "../../index-
|
|
1
|
+
import { Et as CliProviderAdapterBase, Tn as CliTurnSpawn, Ut as CliProviderConfig, Vt as CliExecArgs, qt as ExecutionState, wn as CliTurnProcess } from "../../index-CghBvmcZ.mjs";
|
|
2
2
|
import { StreamParserConfig } from "@tangle-network/sdk-cli-runner";
|
|
3
3
|
import { StreamEvent } from "@tangle-network/agent-interface";
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as plaintextResponseParser, It as sessionObservedEvents, k as CliProviderAdapterBase } from "../../src-B-JlLsMB.mjs";
|
|
2
2
|
import { normalizeOpenAiCompatibleBaseUrl, resolveTangleRouterDefaults } from "@tangle-network/agent-interface";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
//#region src/adapters/exo/adapter.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Et as CliProviderAdapterBase, Ut as CliProviderConfig, Vt as CliExecArgs, qt as ExecutionState } from "../../index-
|
|
1
|
+
import { Et as CliProviderAdapterBase, Ut as CliProviderConfig, Vt as CliExecArgs, qt as ExecutionState } from "../../index-CghBvmcZ.mjs";
|
|
2
2
|
import { StreamParserConfig } from "@tangle-network/sdk-cli-runner";
|
|
3
3
|
import { AgentExecutionInput, AgentExecutionResult, BackendCapabilities, InteractionResponse, McpConfig, ProviderConfig, SdkHostServices, StreamEvent } from "@tangle-network/agent-interface";
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Bt as toolResultEvents,
|
|
1
|
+
import { Bt as toolResultEvents, F as enabledInteractionKinds, Ft as reasoningEvents, It as sessionObservedEvents, Lt as streamPartBase, M as isLocalMcpConfig, N as localMcpArgv, O as recordCliTokenUsage, P as localMcpEnv, Rt as textDeltaEvents, S as jsonEventParser, V as withTurnInteractions, Vt as toolStartEvents, g as McpInteractionSupport, k as CliProviderAdapterBase } from "../../src-B-JlLsMB.mjs";
|
|
2
2
|
import { createHash, randomUUID } from "node:crypto";
|
|
3
3
|
import { InteractionKind } from "@tangle-network/agent-interface";
|
|
4
4
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Et as CliProviderAdapterBase, Ut as CliProviderConfig, Vt as CliExecArgs, qt as ExecutionState } from "../../index-
|
|
1
|
+
import { Et as CliProviderAdapterBase, Ut as CliProviderConfig, Vt as CliExecArgs, qt as ExecutionState } from "../../index-CghBvmcZ.mjs";
|
|
2
2
|
import { StreamParserConfig } from "@tangle-network/sdk-cli-runner";
|
|
3
3
|
import { StreamEvent } from "@tangle-network/agent-interface";
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as plaintextResponseParser, It as sessionObservedEvents, ht as prependPromptSection, k as CliProviderAdapterBase } from "../../src-B-JlLsMB.mjs";
|
|
2
2
|
//#region src/adapters/grok/adapter.ts
|
|
3
3
|
const DECLARE_MODEL = "d=$HOME/.grok; [ -z \"$GROK_HOME\" ] || d=$GROK_HOME; t=\"[model.\\\"$1\\\"]\"; mkdir -p \"$d\" && { grep -qxF \"$t\" \"$d/managed_config.toml\" 2>/dev/null || printf '%s\\nmodel = \"%s\"\\n' \"$t\" \"$1\" >> \"$d/managed_config.toml\"; }; shift; exec \"$@\"";
|
|
4
4
|
var GrokProviderAdapter = class extends CliProviderAdapterBase {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Et as CliProviderAdapterBase, Ut as CliProviderConfig, Vt as CliExecArgs, n as HarnessId, qt as ExecutionState } from "../../index-
|
|
1
|
+
import { Et as CliProviderAdapterBase, Ut as CliProviderConfig, Vt as CliExecArgs, n as HarnessId, qt as ExecutionState } from "../../index-CghBvmcZ.mjs";
|
|
2
2
|
import { i as PreparedAttachment } from "../../prompt-input-CD7okX8T.mjs";
|
|
3
3
|
import { StreamParserConfig } from "@tangle-network/sdk-cli-runner";
|
|
4
4
|
import { InputPart, McpConfig, StreamEvent } from "@tangle-network/agent-interface";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { It as sessionObservedEvents,
|
|
1
|
+
import { C as plaintextResponseParser, It as sessionObservedEvents, M as isLocalMcpConfig, N as localMcpArgv, O as recordCliTokenUsage, P as localMcpEnv, ht as prependPromptSection, k as CliProviderAdapterBase, pt as partitionImageAttachments } from "../../src-B-JlLsMB.mjs";
|
|
2
2
|
import { resolveTangleRouterDefaults } from "@tangle-network/agent-interface";
|
|
3
3
|
import { writeFile } from "node:fs/promises";
|
|
4
4
|
import { dirname, join } from "node:path";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Et as CliProviderAdapterBase, Ut as CliProviderConfig, Vt as CliExecArgs, n as HarnessId, qt as ExecutionState } from "../../index-
|
|
1
|
+
import { Et as CliProviderAdapterBase, Ut as CliProviderConfig, Vt as CliExecArgs, n as HarnessId, qt as ExecutionState } from "../../index-CghBvmcZ.mjs";
|
|
2
2
|
import { StreamParserConfig } from "@tangle-network/sdk-cli-runner";
|
|
3
3
|
import { StreamEvent } from "@tangle-network/agent-interface";
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as plaintextResponseParser, E as parseCliUsageLine, It as sessionObservedEvents, O as recordCliTokenUsage, ht as prependPromptSection, k as CliProviderAdapterBase } from "../../src-B-JlLsMB.mjs";
|
|
2
2
|
import { normalizeOpenAiCompatibleBaseUrl, resolveTangleRouterDefaults } from "@tangle-network/agent-interface";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
//#region src/adapters/nanoclaw/adapter.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Et as CliProviderAdapterBase, Ut as CliProviderConfig, Vt as CliExecArgs, qt as ExecutionState } from "../../index-
|
|
1
|
+
import { Et as CliProviderAdapterBase, Ut as CliProviderConfig, Vt as CliExecArgs, qt as ExecutionState } from "../../index-CghBvmcZ.mjs";
|
|
2
2
|
import { i as PreparedAttachment } from "../../prompt-input-CD7okX8T.mjs";
|
|
3
3
|
import { StreamParserConfig } from "@tangle-network/sdk-cli-runner";
|
|
4
4
|
import { InputPart, StreamEvent } from "@tangle-network/agent-interface";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as plaintextResponseParser, It as sessionObservedEvents, ht as prependPromptSection, k as CliProviderAdapterBase } from "../../src-B-JlLsMB.mjs";
|
|
2
2
|
import { qualifyModelId } from "@tangle-network/agent-profile-materialize";
|
|
3
3
|
import { normalizeOpenAiCompatibleBaseUrl, resolveTangleRouterDefaults } from "@tangle-network/agent-interface";
|
|
4
4
|
import { join } from "node:path";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Et as CliProviderAdapterBase, Ut as CliProviderConfig, Vt as CliExecArgs, c as WorkspacePlanApplication, n as HarnessId, qt as ExecutionState } from "../../index-
|
|
1
|
+
import { Et as CliProviderAdapterBase, Ut as CliProviderConfig, Vt as CliExecArgs, c as WorkspacePlanApplication, n as HarnessId, qt as ExecutionState } from "../../index-CghBvmcZ.mjs";
|
|
2
2
|
import { StreamParserConfig } from "@tangle-network/sdk-cli-runner";
|
|
3
3
|
import { CliAuthFile, ProviderConfig, StreamEvent } from "@tangle-network/agent-interface";
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { It as sessionObservedEvents, O as recordCliTokenUsage, Pt as finalTextEvent, h as nativeEffortArgs, ht as prependPromptSection, k as CliProviderAdapterBase } from "../../src-B-JlLsMB.mjs";
|
|
2
2
|
import { resolveTangleRouterDefaults } from "@tangle-network/agent-interface";
|
|
3
3
|
//#region src/adapters/openclaw/adapter.ts
|
|
4
4
|
/** openclaw's default agent id; the synthesized config declares only it. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Dn as AcpBridgeSpawn, Mt as AcpContentBlock, On as AcpProcessSpec, Rt as AcpTurn, Tt as AcpProviderAdapterBase, jt as AcpBridgeConfig } from "../../index-
|
|
1
|
+
import { Dn as AcpBridgeSpawn, Mt as AcpContentBlock, On as AcpProcessSpec, Rt as AcpTurn, Tt as AcpProviderAdapterBase, jt as AcpBridgeConfig } from "../../index-CghBvmcZ.mjs";
|
|
2
2
|
import { i as PreparedAttachment } from "../../prompt-input-CD7okX8T.mjs";
|
|
3
3
|
import { PRIME_AGENT_DIR_ENV_VAR, PRIME_AGENT_DIR_ENV_VARS, PRIME_HARNESS_STATE_ENV_DENYLIST, PRIME_KERNEL_DEAD_MARKERS, PRIME_KERNEL_ENV_PASSTHROUGH, PRIME_MCP_UNSUPPORTED_REASON, PrimeHarnessStateError, PrimeMaterializeOptions, PrimeProfileControls, PrimeProfileControls as PrimeProfileControls$1, PrimeProfileError, PrimeProfileSkill, PrimeProfileSubagent, assertPrimeModelAgreement, hasPrimeProfileMaterial, matchPrimeKernelDeadMarker, materializePrimeProfileControls, primeAgentDirEnv, primeProfileNeedsAgentDir, primeSubagentEntryId as subagentEntryId, primeThinkingLevel, prunePrimeProfileMaterial, readPrimeProfileControls } from "@tangle-network/agent-profile-materialize";
|
|
4
4
|
import { RpcBridge } from "@tangle-network/sdk-cli-runner";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ht as prependPromptSection, qt as spawnAcpBridge,
|
|
1
|
+
import { ht as prependPromptSection, qt as spawnAcpBridge, w as AcpProviderAdapterBase } from "../../src-B-JlLsMB.mjs";
|
|
2
2
|
import { PRIME_AGENT_DIR_ENV_VAR, PRIME_AGENT_DIR_ENV_VARS, PRIME_HARNESS_STATE_ENV_DENYLIST, PRIME_HARNESS_STATE_ENV_DENYLIST as PRIME_HARNESS_STATE_ENV_DENYLIST$1, PRIME_KERNEL_DEAD_MARKERS, PRIME_KERNEL_ENV_PASSTHROUGH, PRIME_KERNEL_ENV_PASSTHROUGH as PRIME_KERNEL_ENV_PASSTHROUGH$1, PRIME_MCP_UNSUPPORTED_REASON, PrimeHarnessStateError, PrimeProfileError, assertPrimeModelAgreement, assertPrimeModelAgreement as assertPrimeModelAgreement$1, buildPiModelsConfig, hasPrimeProfileMaterial, matchPrimeKernelDeadMarker, materializePrimeProfileControls, materializePrimeProfileControls as materializePrimeProfileControls$1, primeAgentDirEnv, primeAgentDirEnv as primeAgentDirEnv$1, primeHarnessStatePath, primeProfileNeedsAgentDir, primeSubagentEntryId as subagentEntryId, primeThinkingLevel, primeThinkingLevel as primeThinkingLevel$1, prunePrimeProfileMaterial, readPrimeProfileControls, readPrimeProfileControls as readPrimeProfileControls$1, writePrimeAgentFile } from "@tangle-network/agent-profile-materialize";
|
|
3
3
|
import { isAbsolute, join, relative, sep } from "node:path";
|
|
4
4
|
import { existsSync, lchownSync, lstatSync, mkdirSync } from "node:fs";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { i as PreparedAttachment, o as preparePromptInputParts } from "./prompt-input-CD7okX8T.mjs";
|
|
2
2
|
import { AskUserBridge, DEFAULT_INTERACTION_DECISION_TIMEOUT_MS as PERMISSION_DECISION_TIMEOUT_MS, InteractionBroker, InteractionBroker as InteractionBroker$1, InteractionHttpBridge, PermissionPromptBridge, RequestPermissionBridge, RequestPlanBridge, brokerInteractionTools as brokerInteractionTools$1 } from "@tangle-network/agent-core/interactions";
|
|
3
3
|
import * as _$_tangle_network_agent_profile_materialize0 from "@tangle-network/agent-profile-materialize";
|
|
4
|
-
import { ApplyWorkspacePlanOptions, BindableLaunchControl, CODEX_DISABLED_FEATURE_ARGS, HarnessId, HarnessId as HarnessId$1, PlanFile, SECRET_REFERENCE as SECRET_REFERENCE$1, SECRET_REFERENCE_PREFIX, WorkspacePlan, WorkspacePlanApplication, WorkspacePlanApplication as WorkspacePlanApplication$1, WorkspacePlanReceipt, codexDeveloperInstructionArgs } from "@tangle-network/agent-profile-materialize";
|
|
4
|
+
import { ApplyWorkspacePlanOptions, BindableLaunchControl, CODEX_DISABLED_FEATURE_ARGS, HarnessId, HarnessId as HarnessId$1, PlanFile, SECRET_REFERENCE as SECRET_REFERENCE$1, SECRET_REFERENCE_PREFIX as SECRET_REFERENCE_PREFIX$1, WorkspacePlan, WorkspacePlanApplication, WorkspacePlanApplication as WorkspacePlanApplication$1, WorkspacePlanReceipt, codexDeveloperInstructionArgs } from "@tangle-network/agent-profile-materialize";
|
|
5
5
|
import { CliExecResult, CliExitResult, CliLauncher, CliProcess, CliSpawnConfig, InvalidAttachmentError, JsonRpcError, RpcBridge, StreamParserConfig } from "@tangle-network/sdk-cli-runner";
|
|
6
6
|
import { AgentExecutionInput, AgentExecutionOutcome, AgentExecutionResult, AgentProfile, AgentProfileSecretProvider, AgentRuntimeAttachments, BackendCapabilities, BackendMessage, CliAuthFile, DurablePlan, GetMessagesOptions, HarnessType, InputPart, InteractionExecutionBinding, InteractionResponse, LocalMcpConfig, McpConfig, McpStatusResponse, PlanProviderState, ProviderConfig, ProxySecretReceipt, ReasoningEffort, RequestedInteractions, SdkHostServices, SdkPlanHost, SdkProviderAdapter, StreamEvent, TokenUsage, ToolPart } from "@tangle-network/agent-interface";
|
|
7
7
|
import { HarnessSessionContract } from "@tangle-network/cli-agent-registry/session-contract";
|
|
@@ -147,7 +147,7 @@ declare function secretSessionTurnQueue(view: string): {
|
|
|
147
147
|
/** A shared launch never serves a secret MCP server to an agent on the executor's UID, nor a stdio one without a root sidecar to bridge it. */
|
|
148
148
|
declare function sharedSecretMcpRefused(servers: readonly SecretProfileMcpServer[], agentUid: number | undefined): boolean;
|
|
149
149
|
/** Spawn a turn under its session's MCP lease: the session's turns hold it one at a time, each until its process exits. */
|
|
150
|
-
declare function spawnUnderSecretMcpLease(scope: string, signal: AbortSignal, lease: () => Promise<SecretProfileMcpLease | undefined>, spawn: () => CliTurnProcess | Promise<CliTurnProcess>): Promise<CliTurnProcess>;
|
|
150
|
+
declare function spawnUnderSecretMcpLease(scope: string, signal: AbortSignal, lease: (retain: (release: SecretProfileMcpLease) => void) => Promise<SecretProfileMcpLease | undefined>, spawn: () => CliTurnProcess | Promise<CliTurnProcess>): Promise<CliTurnProcess>;
|
|
151
151
|
/** An HTTP URL on loopback with an explicit port and no URL credentials. */
|
|
152
152
|
declare function isLoopbackEndpoint(value: unknown): boolean;
|
|
153
153
|
//#endregion
|
|
@@ -521,6 +521,8 @@ declare abstract class CliAdapterProfile<TConfig extends CliProviderConfig = Cli
|
|
|
521
521
|
protected readonly supportsSecretProfileRevisions: boolean;
|
|
522
522
|
/** The shared launch writes file secrets as `{env:}` references this adapter serves itself (#19297). */
|
|
523
523
|
protected readonly referencesSharedFileSecrets: boolean;
|
|
524
|
+
/** The shared launch keeps environment secrets as references its spawn serves. */
|
|
525
|
+
protected readonly referencesSharedEnvironmentSecrets: boolean;
|
|
524
526
|
private readonly profileSecretProvider;
|
|
525
527
|
private readonly secretProfileRuntimeKeyProvider;
|
|
526
528
|
/** The executor's MCP proxy, as the owner of the secret scopes this adapter opens. */
|
|
@@ -1419,5 +1421,5 @@ declare function homeXdgEnv(home: string): {
|
|
|
1419
1421
|
XDG_STATE_HOME: string;
|
|
1420
1422
|
};
|
|
1421
1423
|
//#endregion
|
|
1422
|
-
export { InteractionMcpServer$1 as $, enabledInteractionKinds as $t, ROUTER_MODEL_CATALOG_TIMEOUT_MS as A, ACP_PROTOCOL_VERSION as At, trackReasoningBlock as B, assertAcpTurnFinished as Bt, NATIVE_SESSION_CONTRACTS$1 as C, untilSettledOrAborted as Cn, wasNeverLaunched as Ct, provenStoreBinary as D, AcpBridgeSpawn as Dn, runtimeSecretsOverlay as Dt, isTrustedStoreBinary as E, PreparedCliLaunch as En, CliProviderAdapterBase as Et, resolveRouterModelLimits as F, AcpNewSessionResult as Ft, readCliTokenUsage as G, CliProviderOptions as Gt, nativeEffortArgs as H, CliExecutionInput as Ht, resolveRouterModelReasoningEfforts as I, AcpPromptResult as It, localMcpArgv as J, InteractionToggleConfig as Jt, recordCliTokenUsage as K, EphemeralContextInput as Kt, RepeatedToolFailure as L, AcpSessionUpdateParams as Lt, RouterModelLimits as M, AcpContentBlock as Mt, RouterModelLimitsResult as N, AcpInitializeParams as Nt, refuseSecretLaunch as O, AcpProcessSpec as On, createExecutionState as Ot, findRouterCatalogEntry as P, AcpInitializeResult as Pt, DEFAULT_INTERACTION_MCP_SERVER_NAME as Q, TurnEndReason as Qt, RepeatedToolFailureGuardOptions as R, AcpTurn as Rt, secretMcpScope as S, spawnUnderSecretMcpLease as Sn, rejectNotLaunched as St, assertSealedNativeHome as T, CliTurnSpawn as Tn, AcpProviderAdapterBase as Tt, accumulateCliTokenUsage as U, CliProviderConfig as Ut, kimiThinkingArgs as V, CliExecArgs as Vt, parseCliUsageLine as W, CliProviderLogger as Wt, McpInteractionSupport as X, PerTurnInteractionInput as Xt, localMcpEnv as Y, InteractionToggleKind as Yt, AskUserBridge as Z, ToolCallState as Zt, textDeltaEvents as _, resolveReferences as _n, jsonEventParser as _t, PERMISSION_DECISION_TIMEOUT_MS as a, withTurnInteractions as an, interactionMcpToolName as at, toolStartEvents as b, servableStdioServer as bn, SessionRehydrationError as bt, WorkspacePlanApplication$1 as c, SecretProfileMcpLease as cn, deterministicFilePartId as ct, TerminalPlanSupport as d, directStdioMcpServers as dn, EXECUTION_CORRELATION_HEADERS as dt, interactionToggleEnabled as en, InteractionMcpServerConfig$1 as et, TerminalPlanSupportOptions as f, exposedStdioServer as fn, EXECUTION_ID_HEADER as ft, streamPartBase as g, requireRecord as gn, PlaintextResponse as gt, sessionObservedEvents as h, joinQueue as hn, executionCorrelationHeaders as ht, InteractionHttpBridge as i, withEphemeralContext as in, brokerInteractionTools$1 as it, ResolveRouterModelLimitsInput as j, AcpBridgeConfig as jt, resolveExecutableRealpath as k, spawnAcpBridge as kn, ACP_MIN_PROTOCOL_VERSION as kt, codexDeveloperInstructionArgs as l, SecretProfileMcpServer as ln, inferMediaType as lt, reasoningEvents as m, isPlainRecord as mn, MANAGED_QUOTE_VERSION_HEADER as mt, HarnessId$1 as n, turnEndReason as nn, RequestPermissionBridge as nt, SECRET_REFERENCE$1 as o, SHARED_WORKSPACE_DIR_ENV as on, buildFileUrl as ot, finalTextEvent as p, isLoopbackEndpoint as pn, EXECUTION_TRACE_HEADER as pt, isLocalMcpConfig as q, ExecutionState as qt, InteractionBroker$1 as r, turnInteractionEnabled as rn, RequestPlanBridge as rt, SECRET_REFERENCE_PREFIX as s, SecretProfileMcpCredentialProxy as sn, deriveFilePart as st, CODEX_DISABLED_FEATURE_ARGS as t, readEphemeralContext as tn, PermissionPromptBridge as tt, homeXdgEnv as u, assertSealedNativeSearchPath as un, trackFilePart as ut, textSnapshotEvents as v, secretSessionTurnQueue as vn, plaintextResponseParser as vt, SEALED_NATIVE_HOME_LAYOUT as w, CliTurnProcess as wn, mapAcpSessionUpdate as wt, forgetSessionScopes as x, sharedSecretMcpRefused as xn, failureAfterCleanup as xt, toolResultEvents as y, servableMcpServer as yn, InvalidAttachmentError as yt, createRepeatedToolFailureGuard as z, acpContentText as zt };
|
|
1423
|
-
//# sourceMappingURL=index-
|
|
1424
|
+
export { InteractionMcpServer$1 as $, enabledInteractionKinds as $t, ROUTER_MODEL_CATALOG_TIMEOUT_MS as A, ACP_PROTOCOL_VERSION as At, trackReasoningBlock as B, assertAcpTurnFinished as Bt, NATIVE_SESSION_CONTRACTS$1 as C, untilSettledOrAborted as Cn, wasNeverLaunched as Ct, provenStoreBinary as D, AcpBridgeSpawn as Dn, runtimeSecretsOverlay as Dt, isTrustedStoreBinary as E, PreparedCliLaunch as En, CliProviderAdapterBase as Et, resolveRouterModelLimits as F, AcpNewSessionResult as Ft, readCliTokenUsage as G, CliProviderOptions as Gt, nativeEffortArgs as H, CliExecutionInput as Ht, resolveRouterModelReasoningEfforts as I, AcpPromptResult as It, localMcpArgv as J, InteractionToggleConfig as Jt, recordCliTokenUsage as K, EphemeralContextInput as Kt, RepeatedToolFailure as L, AcpSessionUpdateParams as Lt, RouterModelLimits as M, AcpContentBlock as Mt, RouterModelLimitsResult as N, AcpInitializeParams as Nt, refuseSecretLaunch as O, AcpProcessSpec as On, createExecutionState as Ot, findRouterCatalogEntry as P, AcpInitializeResult as Pt, DEFAULT_INTERACTION_MCP_SERVER_NAME as Q, TurnEndReason as Qt, RepeatedToolFailureGuardOptions as R, AcpTurn as Rt, secretMcpScope as S, spawnUnderSecretMcpLease as Sn, rejectNotLaunched as St, assertSealedNativeHome as T, CliTurnSpawn as Tn, AcpProviderAdapterBase as Tt, accumulateCliTokenUsage as U, CliProviderConfig as Ut, kimiThinkingArgs as V, CliExecArgs as Vt, parseCliUsageLine as W, CliProviderLogger as Wt, McpInteractionSupport as X, PerTurnInteractionInput as Xt, localMcpEnv as Y, InteractionToggleKind as Yt, AskUserBridge as Z, ToolCallState as Zt, textDeltaEvents as _, resolveReferences as _n, jsonEventParser as _t, PERMISSION_DECISION_TIMEOUT_MS as a, withTurnInteractions as an, interactionMcpToolName as at, toolStartEvents as b, servableStdioServer as bn, SessionRehydrationError as bt, WorkspacePlanApplication$1 as c, SecretProfileMcpLease as cn, deterministicFilePartId as ct, TerminalPlanSupport as d, directStdioMcpServers as dn, EXECUTION_CORRELATION_HEADERS as dt, interactionToggleEnabled as en, InteractionMcpServerConfig$1 as et, TerminalPlanSupportOptions as f, exposedStdioServer as fn, EXECUTION_ID_HEADER as ft, streamPartBase as g, requireRecord as gn, PlaintextResponse as gt, sessionObservedEvents as h, joinQueue as hn, executionCorrelationHeaders as ht, InteractionHttpBridge as i, withEphemeralContext as in, brokerInteractionTools$1 as it, ResolveRouterModelLimitsInput as j, AcpBridgeConfig as jt, resolveExecutableRealpath as k, spawnAcpBridge as kn, ACP_MIN_PROTOCOL_VERSION as kt, codexDeveloperInstructionArgs as l, SecretProfileMcpServer as ln, inferMediaType as lt, reasoningEvents as m, isPlainRecord as mn, MANAGED_QUOTE_VERSION_HEADER as mt, HarnessId$1 as n, turnEndReason as nn, RequestPermissionBridge as nt, SECRET_REFERENCE$1 as o, SHARED_WORKSPACE_DIR_ENV as on, buildFileUrl as ot, finalTextEvent as p, isLoopbackEndpoint as pn, EXECUTION_TRACE_HEADER as pt, isLocalMcpConfig as q, ExecutionState as qt, InteractionBroker$1 as r, turnInteractionEnabled as rn, RequestPlanBridge as rt, SECRET_REFERENCE_PREFIX$1 as s, SecretProfileMcpCredentialProxy as sn, deriveFilePart as st, CODEX_DISABLED_FEATURE_ARGS as t, readEphemeralContext as tn, PermissionPromptBridge as tt, homeXdgEnv as u, assertSealedNativeSearchPath as un, trackFilePart as ut, textSnapshotEvents as v, secretSessionTurnQueue as vn, plaintextResponseParser as vt, SEALED_NATIVE_HOME_LAYOUT as w, CliTurnProcess as wn, mapAcpSessionUpdate as wt, forgetSessionScopes as x, sharedSecretMcpRefused as xn, failureAfterCleanup as xt, toolResultEvents as y, servableMcpServer as yn, InvalidAttachmentError as yt, createRepeatedToolFailureGuard as z, acpContentText as zt };
|
|
1425
|
+
//# sourceMappingURL=index-CghBvmcZ.d.mts.map
|
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as InteractionMcpServer, $t as enabledInteractionKinds, A as ROUTER_MODEL_CATALOG_TIMEOUT_MS, At as ACP_PROTOCOL_VERSION, B as trackReasoningBlock, Bt as assertAcpTurnFinished, C as NATIVE_SESSION_CONTRACTS, Cn as untilSettledOrAborted, Ct as wasNeverLaunched, D as provenStoreBinary, Dn as AcpBridgeSpawn, Dt as runtimeSecretsOverlay, E as isTrustedStoreBinary, En as PreparedCliLaunch, Et as CliProviderAdapterBase, F as resolveRouterModelLimits, Ft as AcpNewSessionResult, G as readCliTokenUsage, Gt as CliProviderOptions, H as nativeEffortArgs, Ht as CliExecutionInput, I as resolveRouterModelReasoningEfforts, It as AcpPromptResult, J as localMcpArgv, Jt as InteractionToggleConfig, K as recordCliTokenUsage, Kt as EphemeralContextInput, L as RepeatedToolFailure, Lt as AcpSessionUpdateParams, M as RouterModelLimits, Mt as AcpContentBlock, N as RouterModelLimitsResult, Nt as AcpInitializeParams, O as refuseSecretLaunch, On as AcpProcessSpec, Ot as createExecutionState, P as findRouterCatalogEntry, Pt as AcpInitializeResult, Q as DEFAULT_INTERACTION_MCP_SERVER_NAME, Qt as TurnEndReason, R as RepeatedToolFailureGuardOptions, Rt as AcpTurn, S as secretMcpScope, Sn as spawnUnderSecretMcpLease, St as rejectNotLaunched, T as assertSealedNativeHome, Tn as CliTurnSpawn, Tt as AcpProviderAdapterBase, U as accumulateCliTokenUsage, Ut as CliProviderConfig, V as kimiThinkingArgs, Vt as CliExecArgs, W as parseCliUsageLine, Wt as CliProviderLogger, X as McpInteractionSupport, Xt as PerTurnInteractionInput, Y as localMcpEnv, Yt as InteractionToggleKind, Z as AskUserBridge, Zt as ToolCallState, _ as textDeltaEvents, _n as resolveReferences, _t as jsonEventParser, a as PERMISSION_DECISION_TIMEOUT_MS, an as withTurnInteractions, at as interactionMcpToolName, b as toolStartEvents, bn as servableStdioServer, bt as SessionRehydrationError, c as WorkspacePlanApplication, cn as SecretProfileMcpLease, ct as deterministicFilePartId, d as TerminalPlanSupport, dn as directStdioMcpServers, dt as EXECUTION_CORRELATION_HEADERS, en as interactionToggleEnabled, et as InteractionMcpServerConfig, f as TerminalPlanSupportOptions, fn as exposedStdioServer, ft as EXECUTION_ID_HEADER, g as streamPartBase, gn as requireRecord, gt as PlaintextResponse, h as sessionObservedEvents, hn as joinQueue, ht as executionCorrelationHeaders, i as InteractionHttpBridge, in as withEphemeralContext, it as brokerInteractionTools, j as ResolveRouterModelLimitsInput, jt as AcpBridgeConfig, k as resolveExecutableRealpath, kn as spawnAcpBridge, kt as ACP_MIN_PROTOCOL_VERSION, l as codexDeveloperInstructionArgs, ln as SecretProfileMcpServer, lt as inferMediaType, m as reasoningEvents, mn as isPlainRecord, mt as MANAGED_QUOTE_VERSION_HEADER, n as HarnessId, nn as turnEndReason, nt as RequestPermissionBridge, o as SECRET_REFERENCE, on as SHARED_WORKSPACE_DIR_ENV, ot as buildFileUrl, p as finalTextEvent, pn as isLoopbackEndpoint, pt as EXECUTION_TRACE_HEADER, q as isLocalMcpConfig, qt as ExecutionState, r as InteractionBroker, rn as turnInteractionEnabled, rt as RequestPlanBridge, s as SECRET_REFERENCE_PREFIX, sn as SecretProfileMcpCredentialProxy, st as deriveFilePart, t as CODEX_DISABLED_FEATURE_ARGS, tn as readEphemeralContext, tt as PermissionPromptBridge, u as homeXdgEnv, un as assertSealedNativeSearchPath, ut as trackFilePart, v as textSnapshotEvents, vn as secretSessionTurnQueue, vt as plaintextResponseParser, w as SEALED_NATIVE_HOME_LAYOUT, wn as CliTurnProcess, wt as mapAcpSessionUpdate, x as forgetSessionScopes, xn as sharedSecretMcpRefused, xt as failureAfterCleanup, y as toolResultEvents, yn as servableMcpServer, yt as InvalidAttachmentError, z as createRepeatedToolFailureGuard, zt as acpContentText } from "./index-
|
|
1
|
+
import { $ as InteractionMcpServer, $t as enabledInteractionKinds, A as ROUTER_MODEL_CATALOG_TIMEOUT_MS, At as ACP_PROTOCOL_VERSION, B as trackReasoningBlock, Bt as assertAcpTurnFinished, C as NATIVE_SESSION_CONTRACTS, Cn as untilSettledOrAborted, Ct as wasNeverLaunched, D as provenStoreBinary, Dn as AcpBridgeSpawn, Dt as runtimeSecretsOverlay, E as isTrustedStoreBinary, En as PreparedCliLaunch, Et as CliProviderAdapterBase, F as resolveRouterModelLimits, Ft as AcpNewSessionResult, G as readCliTokenUsage, Gt as CliProviderOptions, H as nativeEffortArgs, Ht as CliExecutionInput, I as resolveRouterModelReasoningEfforts, It as AcpPromptResult, J as localMcpArgv, Jt as InteractionToggleConfig, K as recordCliTokenUsage, Kt as EphemeralContextInput, L as RepeatedToolFailure, Lt as AcpSessionUpdateParams, M as RouterModelLimits, Mt as AcpContentBlock, N as RouterModelLimitsResult, Nt as AcpInitializeParams, O as refuseSecretLaunch, On as AcpProcessSpec, Ot as createExecutionState, P as findRouterCatalogEntry, Pt as AcpInitializeResult, Q as DEFAULT_INTERACTION_MCP_SERVER_NAME, Qt as TurnEndReason, R as RepeatedToolFailureGuardOptions, Rt as AcpTurn, S as secretMcpScope, Sn as spawnUnderSecretMcpLease, St as rejectNotLaunched, T as assertSealedNativeHome, Tn as CliTurnSpawn, Tt as AcpProviderAdapterBase, U as accumulateCliTokenUsage, Ut as CliProviderConfig, V as kimiThinkingArgs, Vt as CliExecArgs, W as parseCliUsageLine, Wt as CliProviderLogger, X as McpInteractionSupport, Xt as PerTurnInteractionInput, Y as localMcpEnv, Yt as InteractionToggleKind, Z as AskUserBridge, Zt as ToolCallState, _ as textDeltaEvents, _n as resolveReferences, _t as jsonEventParser, a as PERMISSION_DECISION_TIMEOUT_MS, an as withTurnInteractions, at as interactionMcpToolName, b as toolStartEvents, bn as servableStdioServer, bt as SessionRehydrationError, c as WorkspacePlanApplication, cn as SecretProfileMcpLease, ct as deterministicFilePartId, d as TerminalPlanSupport, dn as directStdioMcpServers, dt as EXECUTION_CORRELATION_HEADERS, en as interactionToggleEnabled, et as InteractionMcpServerConfig, f as TerminalPlanSupportOptions, fn as exposedStdioServer, ft as EXECUTION_ID_HEADER, g as streamPartBase, gn as requireRecord, gt as PlaintextResponse, h as sessionObservedEvents, hn as joinQueue, ht as executionCorrelationHeaders, i as InteractionHttpBridge, in as withEphemeralContext, it as brokerInteractionTools, j as ResolveRouterModelLimitsInput, jt as AcpBridgeConfig, k as resolveExecutableRealpath, kn as spawnAcpBridge, kt as ACP_MIN_PROTOCOL_VERSION, l as codexDeveloperInstructionArgs, ln as SecretProfileMcpServer, lt as inferMediaType, m as reasoningEvents, mn as isPlainRecord, mt as MANAGED_QUOTE_VERSION_HEADER, n as HarnessId, nn as turnEndReason, nt as RequestPermissionBridge, o as SECRET_REFERENCE, on as SHARED_WORKSPACE_DIR_ENV, ot as buildFileUrl, p as finalTextEvent, pn as isLoopbackEndpoint, pt as EXECUTION_TRACE_HEADER, q as isLocalMcpConfig, qt as ExecutionState, r as InteractionBroker, rn as turnInteractionEnabled, rt as RequestPlanBridge, s as SECRET_REFERENCE_PREFIX, sn as SecretProfileMcpCredentialProxy, st as deriveFilePart, t as CODEX_DISABLED_FEATURE_ARGS, tn as readEphemeralContext, tt as PermissionPromptBridge, u as homeXdgEnv, un as assertSealedNativeSearchPath, ut as trackFilePart, v as textSnapshotEvents, vn as secretSessionTurnQueue, vt as plaintextResponseParser, w as SEALED_NATIVE_HOME_LAYOUT, wn as CliTurnProcess, wt as mapAcpSessionUpdate, x as forgetSessionScopes, xn as sharedSecretMcpRefused, xt as failureAfterCleanup, y as toolResultEvents, yn as servableMcpServer, yt as InvalidAttachmentError, z as createRepeatedToolFailureGuard, zt as acpContentText } from "./index-CghBvmcZ.mjs";
|
|
2
2
|
import { a as partitionImageAttachments, i as PreparedAttachment, n as MAX_TOTAL_INLINE_IMAGE_BYTES, o as preparePromptInputParts, r as PROMPT_SECTION_SEPARATOR, s as prependPromptSection, t as MAX_INLINE_IMAGE_BYTES } from "./prompt-input-CD7okX8T.mjs";
|
|
3
3
|
export { ACP_MIN_PROTOCOL_VERSION, ACP_PROTOCOL_VERSION, AcpBridgeConfig, AcpBridgeSpawn, AcpContentBlock, AcpInitializeParams, AcpInitializeResult, AcpNewSessionResult, AcpProcessSpec, AcpPromptResult, AcpProviderAdapterBase, AcpSessionUpdateParams, AcpTurn, AskUserBridge, CODEX_DISABLED_FEATURE_ARGS, CliExecArgs, CliExecutionInput, CliProviderAdapterBase, CliProviderConfig, CliProviderLogger, CliProviderOptions, CliTurnProcess, CliTurnSpawn, DEFAULT_INTERACTION_MCP_SERVER_NAME, EXECUTION_CORRELATION_HEADERS, EXECUTION_ID_HEADER, EXECUTION_TRACE_HEADER, EphemeralContextInput, ExecutionState, HarnessId, InteractionBroker, InteractionHttpBridge, InteractionMcpServer, InteractionMcpServerConfig, InteractionToggleConfig, InteractionToggleKind, InvalidAttachmentError, MANAGED_QUOTE_VERSION_HEADER, MAX_INLINE_IMAGE_BYTES, MAX_TOTAL_INLINE_IMAGE_BYTES, McpInteractionSupport, NATIVE_SESSION_CONTRACTS, PERMISSION_DECISION_TIMEOUT_MS, PROMPT_SECTION_SEPARATOR, PerTurnInteractionInput, PermissionPromptBridge, PlaintextResponse, PreparedAttachment, PreparedCliLaunch, ROUTER_MODEL_CATALOG_TIMEOUT_MS, RepeatedToolFailure, RepeatedToolFailureGuardOptions, RequestPermissionBridge, RequestPlanBridge, ResolveRouterModelLimitsInput, RouterModelLimits, RouterModelLimitsResult, SEALED_NATIVE_HOME_LAYOUT, SECRET_REFERENCE, SECRET_REFERENCE_PREFIX, SHARED_WORKSPACE_DIR_ENV, SecretProfileMcpCredentialProxy, SecretProfileMcpLease, SecretProfileMcpServer, SessionRehydrationError, TerminalPlanSupport, TerminalPlanSupportOptions, ToolCallState, TurnEndReason, WorkspacePlanApplication, accumulateCliTokenUsage, acpContentText, assertAcpTurnFinished, assertSealedNativeHome, assertSealedNativeSearchPath, brokerInteractionTools, buildFileUrl, codexDeveloperInstructionArgs, createExecutionState, createRepeatedToolFailureGuard, deriveFilePart, deterministicFilePartId, directStdioMcpServers, enabledInteractionKinds, executionCorrelationHeaders, exposedStdioServer, failureAfterCleanup, finalTextEvent, findRouterCatalogEntry, forgetSessionScopes, homeXdgEnv, inferMediaType, interactionMcpToolName, interactionToggleEnabled, isLocalMcpConfig, isLoopbackEndpoint, isPlainRecord, isTrustedStoreBinary, joinQueue, jsonEventParser, kimiThinkingArgs, localMcpArgv, localMcpEnv, mapAcpSessionUpdate, nativeEffortArgs, parseCliUsageLine, partitionImageAttachments, plaintextResponseParser, preparePromptInputParts, prependPromptSection, provenStoreBinary, readCliTokenUsage, readEphemeralContext, reasoningEvents, recordCliTokenUsage, refuseSecretLaunch, rejectNotLaunched, requireRecord, resolveExecutableRealpath, resolveReferences, resolveRouterModelLimits, resolveRouterModelReasoningEfforts, runtimeSecretsOverlay, secretMcpScope, secretSessionTurnQueue, servableMcpServer, servableStdioServer, sessionObservedEvents, sharedSecretMcpRefused, spawnAcpBridge, spawnUnderSecretMcpLease, streamPartBase, textDeltaEvents, textSnapshotEvents, toolResultEvents, toolStartEvents, trackFilePart, trackReasoningBlock, turnEndReason, turnInteractionEnabled, untilSettledOrAborted, wasNeverLaunched, withEphemeralContext, withTurnInteractions };
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as servableStdioServer, A as createRepeatedToolFailureGuard, At as MANAGED_QUOTE_VERSION_HEADER, B as withEphemeralContext, Bt as toolResultEvents, C as plaintextResponseParser, Ct as failureAfterCleanup, D as readCliTokenUsage, Dt as EXECUTION_CORRELATION_HEADERS, E as parseCliUsageLine, Et as runtimeSecretsOverlay, F as enabledInteractionKinds, Ft as reasoningEvents, G as exposedStdioServer, Gt as acpContentText, H as SHARED_WORKSPACE_DIR_ENV, Ht as trackReasoningBlock, I as interactionToggleEnabled, It as sessionObservedEvents, J as joinQueue, K as isLoopbackEndpoint, Kt as assertAcpTurnFinished, L as readEphemeralContext, Lt as streamPartBase, M as isLocalMcpConfig, Mt as homeXdgEnv, N as localMcpArgv, Nt as mapAcpSessionUpdate, O as recordCliTokenUsage, Ot as EXECUTION_ID_HEADER, P as localMcpEnv, Pt as finalTextEvent, Q as servableMcpServer, R as turnEndReason, Rt as textDeltaEvents, S as jsonEventParser, St as SessionRehydrationError, T as accumulateCliTokenUsage, Tt as wasNeverLaunched, U as assertSealedNativeSearchPath, Ut as ACP_MIN_PROTOCOL_VERSION, V as withTurnInteractions, Vt as toolStartEvents, W as directStdioMcpServers, Wt as ACP_PROTOCOL_VERSION, X as resolveReferences, Y as requireRecord, Z as secretSessionTurnQueue, _ as TerminalPlanSupport, _t as deriveFilePart, a as SECRET_REFERENCE, at as assertSealedNativeHome, b as brokerInteractionTools, bt as trackFilePart, c as forgetSessionScopes, ct as refuseSecretLaunch, d as findRouterCatalogEntry, dt as MAX_TOTAL_INLINE_IMAGE_BYTES, et as sharedSecretMcpRefused, f as resolveRouterModelLimits, ft as PROMPT_SECTION_SEPARATOR, g as McpInteractionSupport, gt as buildFileUrl, h as nativeEffortArgs, ht as prependPromptSection, i as PERMISSION_DECISION_TIMEOUT_MS, it as SEALED_NATIVE_HOME_LAYOUT, j as createExecutionState, jt as executionCorrelationHeaders, k as CliProviderAdapterBase, kt as EXECUTION_TRACE_HEADER, l as secretMcpScope, lt as resolveExecutableRealpath, m as kimiThinkingArgs, mt as preparePromptInputParts, n as InteractionBroker, nt as untilSettledOrAborted, o as SECRET_REFERENCE_PREFIX, ot as isTrustedStoreBinary, p as resolveRouterModelReasoningEfforts, pt as partitionImageAttachments, q as isPlainRecord, qt as spawnAcpBridge, r as InteractionHttpBridge, rt as NATIVE_SESSION_CONTRACTS, s as codexDeveloperInstructionArgs, st as provenStoreBinary, t as CODEX_DISABLED_FEATURE_ARGS, tt as spawnUnderSecretMcpLease, u as ROUTER_MODEL_CATALOG_TIMEOUT_MS, ut as MAX_INLINE_IMAGE_BYTES, v as DEFAULT_INTERACTION_MCP_SERVER_NAME, vt as deterministicFilePartId, w as AcpProviderAdapterBase, wt as rejectNotLaunched, x as interactionMcpToolName, xt as InvalidAttachmentError, y as InteractionMcpServer, yt as inferMediaType, z as turnInteractionEnabled, zt as textSnapshotEvents } from "./src-B-JlLsMB.mjs";
|
|
2
2
|
export { ACP_MIN_PROTOCOL_VERSION, ACP_PROTOCOL_VERSION, AcpProviderAdapterBase, CODEX_DISABLED_FEATURE_ARGS, CliProviderAdapterBase, DEFAULT_INTERACTION_MCP_SERVER_NAME, EXECUTION_CORRELATION_HEADERS, EXECUTION_ID_HEADER, EXECUTION_TRACE_HEADER, InteractionBroker, InteractionHttpBridge, InteractionMcpServer, InvalidAttachmentError, MANAGED_QUOTE_VERSION_HEADER, MAX_INLINE_IMAGE_BYTES, MAX_TOTAL_INLINE_IMAGE_BYTES, McpInteractionSupport, NATIVE_SESSION_CONTRACTS, PERMISSION_DECISION_TIMEOUT_MS, PROMPT_SECTION_SEPARATOR, ROUTER_MODEL_CATALOG_TIMEOUT_MS, SEALED_NATIVE_HOME_LAYOUT, SECRET_REFERENCE, SECRET_REFERENCE_PREFIX, SHARED_WORKSPACE_DIR_ENV, SessionRehydrationError, TerminalPlanSupport, accumulateCliTokenUsage, acpContentText, assertAcpTurnFinished, assertSealedNativeHome, assertSealedNativeSearchPath, brokerInteractionTools, buildFileUrl, codexDeveloperInstructionArgs, createExecutionState, createRepeatedToolFailureGuard, deriveFilePart, deterministicFilePartId, directStdioMcpServers, enabledInteractionKinds, executionCorrelationHeaders, exposedStdioServer, failureAfterCleanup, finalTextEvent, findRouterCatalogEntry, forgetSessionScopes, homeXdgEnv, inferMediaType, interactionMcpToolName, interactionToggleEnabled, isLocalMcpConfig, isLoopbackEndpoint, isPlainRecord, isTrustedStoreBinary, joinQueue, jsonEventParser, kimiThinkingArgs, localMcpArgv, localMcpEnv, mapAcpSessionUpdate, nativeEffortArgs, parseCliUsageLine, partitionImageAttachments, plaintextResponseParser, preparePromptInputParts, prependPromptSection, provenStoreBinary, readCliTokenUsage, readEphemeralContext, reasoningEvents, recordCliTokenUsage, refuseSecretLaunch, rejectNotLaunched, requireRecord, resolveExecutableRealpath, resolveReferences, resolveRouterModelLimits, resolveRouterModelReasoningEfforts, runtimeSecretsOverlay, secretMcpScope, secretSessionTurnQueue, servableMcpServer, servableStdioServer, sessionObservedEvents, sharedSecretMcpRefused, spawnAcpBridge, spawnUnderSecretMcpLease, streamPartBase, textDeltaEvents, textSnapshotEvents, toolResultEvents, toolStartEvents, trackFilePart, trackReasoningBlock, turnEndReason, turnInteractionEnabled, untilSettledOrAborted, wasNeverLaunched, withEphemeralContext, withTurnInteractions };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DEFAULT_INTERACTION_DECISION_TIMEOUT_MS as PERMISSION_DECISION_TIMEOUT_MS, InteractionBroker, InteractionBroker as InteractionBroker$1, InteractionHttpBridge, brokerInteractionTools, brokerInteractionTools as brokerInteractionTools$1 } from "@tangle-network/agent-core/interactions";
|
|
2
|
-
import { CODEX_DISABLED_FEATURE_ARGS, HARNESS_LAUNCH_MATERIALIZE_OPTIONS, SECRET_REFERENCE, SECRET_REFERENCE as SECRET_REFERENCE$1, SECRET_REFERENCE_PREFIX, UNAVAILABLE_AGENT_PROFILE_SECRET_PROVIDER, applyWorkspacePlanWithSecretProvider, bindLaunchToolBinDirs, bindSecretSessionView, codexDeveloperInstructionArgs, enforceWorkspacePlanSupport, ensurePublicConcurrentProfileRoots, joinSystemPromptAdditions, keepsHarnessSystemPrompt, materializeProfile, modelIdsMatch, parseSandboxToolBinDirs, preparePublicConcurrentProfileRevision, prepareSecretConcurrentProfileRevision, resolveAgentProfileResources, secretSessionViewWorkspace, workspacePlanSecretCount } from "@tangle-network/agent-profile-materialize";
|
|
2
|
+
import { CODEX_DISABLED_FEATURE_ARGS, HARNESS_LAUNCH_MATERIALIZE_OPTIONS, SECRET_REFERENCE, SECRET_REFERENCE as SECRET_REFERENCE$1, SECRET_REFERENCE_PREFIX, SECRET_REFERENCE_PREFIX as SECRET_REFERENCE_PREFIX$1, UNAVAILABLE_AGENT_PROFILE_SECRET_PROVIDER, applyWorkspacePlanWithSecretProvider, bindLaunchToolBinDirs, bindSecretSessionView, codexDeveloperInstructionArgs, digestEnvName, enforceWorkspacePlanSupport, ensurePublicConcurrentProfileRoots, joinSystemPromptAdditions, keepsHarnessSystemPrompt, materializeProfile, modelIdsMatch, parseSandboxToolBinDirs, preparePublicConcurrentProfileRevision, prepareSecretConcurrentProfileRevision, resolveAgentProfileResources, secretSessionViewWorkspace, workspacePlanSecretCount } from "@tangle-network/agent-profile-materialize";
|
|
3
3
|
import { BridgeClosedError, InvalidAttachmentError, JsonRpcError, RpcRequestTimeoutError, execCli, launchCliProcess, resolveRawCapturePath, spawnCliProcess, spawnRpcBridge } from "@tangle-network/sdk-cli-runner";
|
|
4
4
|
import { createHash, createHmac, randomUUID } from "node:crypto";
|
|
5
5
|
import { AgentExecutionError, AgentExecutionOutcomeSchema, AgentRuntimeAttachmentsSchema, InteractionExecutionBindingSchema, InteractionKind, ProxySecretReceiptSchema, REASONING_EFFORTS, agentProfileSchema, nativeReasoningControl, normalizeInputParts } from "@tangle-network/agent-interface";
|
|
@@ -17,10 +17,10 @@ import { isRecord, isRecord as isPlainRecord } from "@tangle-network/agent-core"
|
|
|
17
17
|
import * as W3C from "@tangle-network/agent-trace-contract";
|
|
18
18
|
import { z } from "zod";
|
|
19
19
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
20
|
+
import { addAbortListener } from "node:events";
|
|
20
21
|
import { DatabaseSync } from "node:sqlite";
|
|
21
22
|
import { StringDecoder } from "node:string_decoder";
|
|
22
23
|
import { DEFAULT_INTERACTION_MCP_SERVER_NAME, InteractionMcpServer, interactionMcpToolName } from "@tangle-network/agent-core/interactions/mcp";
|
|
23
|
-
import { addAbortListener } from "node:events";
|
|
24
24
|
//#region src/acp-process-launch.ts
|
|
25
25
|
/** Spawn an ACP agent over NDJSON stdio from `env` alone, never the sidecar's own environment. The adapter owns abort, so no signal. */
|
|
26
26
|
function spawnAcpBridge(request) {
|
|
@@ -1537,6 +1537,366 @@ function prependPromptSection(section, body) {
|
|
|
1537
1537
|
return section ? `${section}${PROMPT_SECTION_SEPARATOR}${body}` : body;
|
|
1538
1538
|
}
|
|
1539
1539
|
//#endregion
|
|
1540
|
+
//#region src/secret-native-proof.ts
|
|
1541
|
+
const proofKey = Symbol.for("tangle.secret-native-binary-proofs");
|
|
1542
|
+
const runtime$1 = globalThis;
|
|
1543
|
+
const proven = runtime$1[proofKey] ?? /* @__PURE__ */ new Set();
|
|
1544
|
+
runtime$1[proofKey] = proven;
|
|
1545
|
+
/** Prove an immutable executable, under the launch's own identity and environment. */
|
|
1546
|
+
async function provenStoreBinary(expected, config) {
|
|
1547
|
+
if (!config.isolatedIdentity || config.inheritEnv !== false) refuseSecretLaunch("Secret native binary proof requires an isolated identity and environment", { path: config.command });
|
|
1548
|
+
const command = resolveExecutableRealpath(config.command, config.env?.PATH);
|
|
1549
|
+
if (!command || !isTrustedStoreBinary(command)) refuseSecretLaunch("Secret native launch requires a root-owned Nix store binary", { path: command ?? config.command });
|
|
1550
|
+
const key = `${command}\0${expected}`;
|
|
1551
|
+
if (proven.has(key)) return command;
|
|
1552
|
+
const probe = await execCli({
|
|
1553
|
+
command,
|
|
1554
|
+
cwd: config.cwd,
|
|
1555
|
+
env: config.env,
|
|
1556
|
+
inheritEnv: config.inheritEnv,
|
|
1557
|
+
signal: config.signal,
|
|
1558
|
+
isolatedIdentity: config.isolatedIdentity,
|
|
1559
|
+
args: ["--version"],
|
|
1560
|
+
spawnOptions: config.isolatedIdentity,
|
|
1561
|
+
timeoutMs: 15e3
|
|
1562
|
+
});
|
|
1563
|
+
const version = probe.stdout?.trim();
|
|
1564
|
+
if (!probe.exit.success || version !== expected) refuseSecretLaunch(`Secret native launch expected ${expected} at ${command}, received no matching version`, { exitCode: probe.exit.code });
|
|
1565
|
+
proven.add(key);
|
|
1566
|
+
return command;
|
|
1567
|
+
}
|
|
1568
|
+
/** A reported version alone cannot establish an immutable executable. */
|
|
1569
|
+
function isTrustedStoreBinary(realpath) {
|
|
1570
|
+
if (!realpath.startsWith("/nix/store/")) return false;
|
|
1571
|
+
try {
|
|
1572
|
+
for (const path of [realpath, dirname(realpath)]) {
|
|
1573
|
+
const stat = fs$1.lstatSync(path);
|
|
1574
|
+
if (stat.uid !== 0 || (stat.mode & 18) !== 0) return false;
|
|
1575
|
+
}
|
|
1576
|
+
return true;
|
|
1577
|
+
} catch {
|
|
1578
|
+
return false;
|
|
1579
|
+
}
|
|
1580
|
+
}
|
|
1581
|
+
/** The real file a launch of `command` executes under `pathEnv`. */
|
|
1582
|
+
function resolveExecutableRealpath(command, pathEnv) {
|
|
1583
|
+
if (command.includes("/") && !isAbsolute(command)) return void 0;
|
|
1584
|
+
const candidates = command.includes("/") ? [command] : (pathEnv ?? "").split(":").filter(isAbsolute).map((dir) => join(dir, command));
|
|
1585
|
+
for (const candidate of candidates) try {
|
|
1586
|
+
fs$1.accessSync(candidate, fs$1.constants.X_OK);
|
|
1587
|
+
if (fs$1.statSync(candidate).isFile()) return fs$1.realpathSync(candidate);
|
|
1588
|
+
} catch {}
|
|
1589
|
+
}
|
|
1590
|
+
const SEALED_NATIVE_HOME_LAYOUT = {
|
|
1591
|
+
codex: [
|
|
1592
|
+
[
|
|
1593
|
+
".",
|
|
1594
|
+
1016,
|
|
1595
|
+
true
|
|
1596
|
+
],
|
|
1597
|
+
[
|
|
1598
|
+
".codex",
|
|
1599
|
+
1016,
|
|
1600
|
+
true
|
|
1601
|
+
],
|
|
1602
|
+
[
|
|
1603
|
+
".agents",
|
|
1604
|
+
360,
|
|
1605
|
+
true
|
|
1606
|
+
],
|
|
1607
|
+
[
|
|
1608
|
+
".codex/skills",
|
|
1609
|
+
360,
|
|
1610
|
+
true
|
|
1611
|
+
],
|
|
1612
|
+
[
|
|
1613
|
+
".codex/rules",
|
|
1614
|
+
360,
|
|
1615
|
+
true
|
|
1616
|
+
],
|
|
1617
|
+
[
|
|
1618
|
+
".codex/config.toml",
|
|
1619
|
+
288,
|
|
1620
|
+
false
|
|
1621
|
+
],
|
|
1622
|
+
[
|
|
1623
|
+
".codex/AGENTS.md",
|
|
1624
|
+
288,
|
|
1625
|
+
false
|
|
1626
|
+
],
|
|
1627
|
+
[
|
|
1628
|
+
".codex/AGENTS.override.md",
|
|
1629
|
+
288,
|
|
1630
|
+
false
|
|
1631
|
+
],
|
|
1632
|
+
[
|
|
1633
|
+
".codex/hooks.json",
|
|
1634
|
+
288,
|
|
1635
|
+
false
|
|
1636
|
+
]
|
|
1637
|
+
],
|
|
1638
|
+
opencode: [[
|
|
1639
|
+
".",
|
|
1640
|
+
456,
|
|
1641
|
+
true
|
|
1642
|
+
], [
|
|
1643
|
+
".opencode",
|
|
1644
|
+
360,
|
|
1645
|
+
true
|
|
1646
|
+
]]
|
|
1647
|
+
};
|
|
1648
|
+
function assertSealedNativeHome(home, gid, layout) {
|
|
1649
|
+
for (const [relative, mode, directory] of layout) {
|
|
1650
|
+
const path = join(home, relative);
|
|
1651
|
+
const stat = fs$1.lstatSync(path);
|
|
1652
|
+
if (fs$1.realpathSync(path) !== path || stat.uid !== 0 || stat.gid !== gid || (stat.mode & 4095) !== mode || stat.isDirectory() !== directory) refuseSecretLaunch(`Secret native HOME authority is not sealed at ${path}: expected uid0 gid${gid} mode${mode.toString(8)} directory=${directory}; actual uid${stat.uid} gid${stat.gid} mode${(stat.mode & 4095).toString(8)} directory=${stat.isDirectory()}`);
|
|
1653
|
+
}
|
|
1654
|
+
}
|
|
1655
|
+
/** Only selected structural facts enter a refusal; payloads and causes never do. */
|
|
1656
|
+
function refuseSecretLaunch(reason, { path, expected, actual, exitCode } = {}) {
|
|
1657
|
+
const detail = JSON.stringify({
|
|
1658
|
+
path,
|
|
1659
|
+
expected,
|
|
1660
|
+
actual
|
|
1661
|
+
}).slice(0, 768);
|
|
1662
|
+
throw new Error(detail === "{}" ? reason : `${reason} ${detail}`, { cause: typeof exitCode === "number" || exitCode === null ? { exitCode } : void 0 });
|
|
1663
|
+
}
|
|
1664
|
+
//#endregion
|
|
1665
|
+
//#region src/secret-profile-mcp.ts
|
|
1666
|
+
function requireRecord(raw, message) {
|
|
1667
|
+
return isRecord(raw) ? raw : refuseSecretLaunch(message);
|
|
1668
|
+
}
|
|
1669
|
+
/** Snapshot the executor's projection; it may only replace an admitted stdio launch. */
|
|
1670
|
+
function directStdioMcpServers(lease, servers) {
|
|
1671
|
+
const direct = /* @__PURE__ */ new Map();
|
|
1672
|
+
const projection = lease?.directStdio;
|
|
1673
|
+
if (projection === void 0) return direct;
|
|
1674
|
+
if (!Array.isArray(projection)) refuseSecretLaunch("Direct MCP projection must be an array");
|
|
1675
|
+
for (const item of projection) {
|
|
1676
|
+
const original = servers.find((server) => server.name === item?.name);
|
|
1677
|
+
const environment = isRecord(item?.environment) ? { ...item.environment } : void 0;
|
|
1678
|
+
if (!isRecord(item) || Object.keys(item).some((key) => ![
|
|
1679
|
+
"name",
|
|
1680
|
+
"command",
|
|
1681
|
+
"environment"
|
|
1682
|
+
].includes(key)) || !original || !("command" in original) || direct.has(original.name) || JSON.stringify(item.command) !== JSON.stringify(original.command) || !environment || Object.keys(environment).length !== Object.keys(original.environment).length || Object.keys(original.environment).some((key) => !Object.hasOwn(environment, key) || typeof environment[key] !== "string")) refuseSecretLaunch("Direct MCP projection differs from admitted stdio");
|
|
1683
|
+
direct.set(original.name, Object.freeze({
|
|
1684
|
+
name: original.name,
|
|
1685
|
+
command: Object.freeze([...original.command]),
|
|
1686
|
+
environment: Object.freeze(environment)
|
|
1687
|
+
}));
|
|
1688
|
+
}
|
|
1689
|
+
return direct;
|
|
1690
|
+
}
|
|
1691
|
+
/** A config value with its secret references resolved, or undefined. */
|
|
1692
|
+
function resolveReferences(value, references, secrets) {
|
|
1693
|
+
let unresolved = false;
|
|
1694
|
+
const resolved = value.replace(SECRET_REFERENCE, (_match, reference) => {
|
|
1695
|
+
const secret = references[reference];
|
|
1696
|
+
if (secret === void 0) unresolved = true;
|
|
1697
|
+
if (secret) secrets?.add(secret);
|
|
1698
|
+
return secret ?? "";
|
|
1699
|
+
});
|
|
1700
|
+
return unresolved || /\{(?:env|file):/.test(resolved) ? void 0 : resolved;
|
|
1701
|
+
}
|
|
1702
|
+
/** The plain env entry by which a shared-launch stdio server opts into the bridge: the one workspace subdirectory it may write. */
|
|
1703
|
+
const SHARED_WORKSPACE_DIR_ENV = "TANGLE_SHARED_WORKSPACE_DIR";
|
|
1704
|
+
/**
|
|
1705
|
+
* A stdio server the executor can run: its command and its environment with
|
|
1706
|
+
* every secret reference resolved, and on the shared launch its mounts and
|
|
1707
|
+
* the subdirectory of `workspaceRoot` it declares.
|
|
1708
|
+
*/
|
|
1709
|
+
function servableStdioServer(name, entry, references, mount) {
|
|
1710
|
+
const command = entry.command;
|
|
1711
|
+
if (!Array.isArray(command) || command.length === 0 || command.some((part) => typeof part !== "string" || /\{(?:env|file):/.test(part))) return "its command is not a fixed argument list";
|
|
1712
|
+
if (entry.cwd !== void 0) return "it names a working directory";
|
|
1713
|
+
const declared = entry.environment === void 0 ? {} : entry.environment;
|
|
1714
|
+
if (!isRecord(declared)) return "its environment is not a map";
|
|
1715
|
+
const dir = declared[SHARED_WORKSPACE_DIR_ENV];
|
|
1716
|
+
const rule = !mount ? void 0 : typeof dir !== "string" || /\{(?:env|file):/.test(dir) ? "a plain value" : !dir || /[/\0]/.test(dir) || dir.includes("..") ? "one segment, no /, .. or NUL" : dir.startsWith(".") ? "without a leading ." : dir === "workspaces" && "other than workspaces";
|
|
1717
|
+
if (rule) return `its ${SHARED_WORKSPACE_DIR_ENV} must be ${rule}`;
|
|
1718
|
+
const environment = {};
|
|
1719
|
+
const secrets = /* @__PURE__ */ new Set();
|
|
1720
|
+
for (const [variable, value] of Object.entries(declared)) {
|
|
1721
|
+
if (typeof value !== "string") return `its ${variable} is not text`;
|
|
1722
|
+
const resolved = resolveReferences(value, references, secrets);
|
|
1723
|
+
if (resolved === void 0) return `its ${variable} names a value the executor cannot resolve`;
|
|
1724
|
+
environment[variable] = resolved;
|
|
1725
|
+
}
|
|
1726
|
+
return {
|
|
1727
|
+
name,
|
|
1728
|
+
command,
|
|
1729
|
+
environment,
|
|
1730
|
+
secrets: [...secrets],
|
|
1731
|
+
...mount && {
|
|
1732
|
+
files: mount.files,
|
|
1733
|
+
workspace: join(mount.workspaceRoot, dir)
|
|
1734
|
+
}
|
|
1735
|
+
};
|
|
1736
|
+
}
|
|
1737
|
+
/**
|
|
1738
|
+
* An undeclared shared-launch stdio server, until the default flips: its
|
|
1739
|
+
* entry with every reference resolved for the turn's inline config, which the
|
|
1740
|
+
* agent can read, and its warning, naming each enabled remote server that
|
|
1741
|
+
* holds one of the same references.
|
|
1742
|
+
*/
|
|
1743
|
+
function exposedStdioServer(entry, references, servers) {
|
|
1744
|
+
const text = JSON.stringify(entry);
|
|
1745
|
+
const held = text.match(SECRET_REFERENCE) ?? [];
|
|
1746
|
+
const sharedWith = Object.keys(servers).filter((other) => servers[other]?.type === "remote" && servers[other]?.enabled !== false && held.some((ref) => JSON.stringify(servers[other]).includes(ref)));
|
|
1747
|
+
return {
|
|
1748
|
+
entry: JSON.parse(text.replace(SECRET_REFERENCE, (_, ref) => JSON.stringify(references[ref] ?? "").slice(1, -1))),
|
|
1749
|
+
warning: {
|
|
1750
|
+
reason: "default flips to bridge-or-refuse on 2026-11-23 (or after 24 h with no such warning); declare TANGLE_SHARED_WORKSPACE_DIR to be bridged",
|
|
1751
|
+
...sharedWith.length ? { sharedWith } : {}
|
|
1752
|
+
}
|
|
1753
|
+
};
|
|
1754
|
+
}
|
|
1755
|
+
/** A remote server the executor can serve: its fixed upstream URL and every header with its secret references resolved. */
|
|
1756
|
+
function servableMcpServer(name, entry, references) {
|
|
1757
|
+
const url = entry.url;
|
|
1758
|
+
if (typeof url !== "string" || /\{(?:env|file):/.test(url)) return "its URL is not a fixed address";
|
|
1759
|
+
try {
|
|
1760
|
+
const parsed = new URL(url);
|
|
1761
|
+
if (parsed.protocol !== "https:" && parsed.protocol !== "http:") return "its URL is not http(s)";
|
|
1762
|
+
} catch {
|
|
1763
|
+
return "its URL is not a fixed address";
|
|
1764
|
+
}
|
|
1765
|
+
const headers = {};
|
|
1766
|
+
const declared = entry.headers === void 0 ? {} : entry.headers;
|
|
1767
|
+
if (!isRecord(declared)) return "its headers are not a map";
|
|
1768
|
+
for (const [header, value] of Object.entries(declared)) {
|
|
1769
|
+
if (typeof value !== "string") return `its ${header} header is not text`;
|
|
1770
|
+
const resolved = resolveReferences(value, references);
|
|
1771
|
+
if (resolved === void 0) return `its ${header} header names a value the executor cannot resolve`;
|
|
1772
|
+
headers[header] = resolved;
|
|
1773
|
+
}
|
|
1774
|
+
return {
|
|
1775
|
+
name,
|
|
1776
|
+
url,
|
|
1777
|
+
headers
|
|
1778
|
+
};
|
|
1779
|
+
}
|
|
1780
|
+
const cleanupKey = Symbol.for("tangle.secret-native-turn-cleanup");
|
|
1781
|
+
const awaitQueuedTurn = (turn) => turn[cleanupKey]?.() ?? turn;
|
|
1782
|
+
/** Earlier physical cleanup must succeed before another holder is admitted. */
|
|
1783
|
+
function joinQueue(queues, key) {
|
|
1784
|
+
const previous = queues.get(key) ?? Promise.resolve();
|
|
1785
|
+
let finish;
|
|
1786
|
+
let notify;
|
|
1787
|
+
let cleanup;
|
|
1788
|
+
let recovering;
|
|
1789
|
+
const ready = new Promise((resolve) => {
|
|
1790
|
+
notify = resolve;
|
|
1791
|
+
});
|
|
1792
|
+
const finished = new Promise((resolve) => {
|
|
1793
|
+
finish = resolve;
|
|
1794
|
+
});
|
|
1795
|
+
const release = () => {
|
|
1796
|
+
finish();
|
|
1797
|
+
notify();
|
|
1798
|
+
};
|
|
1799
|
+
const tail = previous.then(() => finished);
|
|
1800
|
+
tail[cleanupKey] = async () => {
|
|
1801
|
+
await awaitQueuedTurn(previous);
|
|
1802
|
+
await ready;
|
|
1803
|
+
if (cleanup) {
|
|
1804
|
+
recovering ??= Promise.resolve().then(cleanup).then(() => {
|
|
1805
|
+
cleanup = void 0;
|
|
1806
|
+
release();
|
|
1807
|
+
}).finally(() => {
|
|
1808
|
+
recovering = void 0;
|
|
1809
|
+
});
|
|
1810
|
+
await recovering;
|
|
1811
|
+
}
|
|
1812
|
+
await tail;
|
|
1813
|
+
};
|
|
1814
|
+
queues.set(key, tail);
|
|
1815
|
+
tail.then(() => {
|
|
1816
|
+
delete tail[cleanupKey];
|
|
1817
|
+
if (queues.get(key) === tail) queues.delete(key);
|
|
1818
|
+
});
|
|
1819
|
+
return {
|
|
1820
|
+
previous: awaitQueuedTurn(previous),
|
|
1821
|
+
release,
|
|
1822
|
+
retryCleanup(retry) {
|
|
1823
|
+
cleanup ??= retry;
|
|
1824
|
+
notify();
|
|
1825
|
+
}
|
|
1826
|
+
};
|
|
1827
|
+
}
|
|
1828
|
+
function untilSettledOrAborted(previous, signal) {
|
|
1829
|
+
const aborted = () => signal.reason ?? /* @__PURE__ */ new Error("Secret native turn aborted before its session view was free");
|
|
1830
|
+
if (signal.aborted) {
|
|
1831
|
+
previous.catch(() => {});
|
|
1832
|
+
return Promise.reject(aborted());
|
|
1833
|
+
}
|
|
1834
|
+
return new Promise((resolve, reject) => {
|
|
1835
|
+
const listener = addAbortListener(signal, () => reject(aborted()));
|
|
1836
|
+
previous.then(resolve, reject).finally(() => listener[Symbol.dispose]());
|
|
1837
|
+
});
|
|
1838
|
+
}
|
|
1839
|
+
/** Every native discovery ancestor is sealed and free of ambient configuration. */
|
|
1840
|
+
function assertSealedNativeSearchPath(cwd, configNames) {
|
|
1841
|
+
for (let child = cwd;; child = dirname(child)) {
|
|
1842
|
+
const stat = lstatSync(child);
|
|
1843
|
+
if (!stat.isDirectory() || stat.isSymbolicLink() || realpathSync(child) !== child || stat.uid !== 0 || (stat.mode & 18) !== 0 || child !== cwd && configNames.some((name) => lstatSync(join(child, name), { throwIfNoEntry: false }))) throw new Error("Secret native launch has mutable or ambient discovery authority");
|
|
1844
|
+
if (dirname(child) === child) break;
|
|
1845
|
+
}
|
|
1846
|
+
}
|
|
1847
|
+
/** One session view changes only after its previous physical native process exits. */
|
|
1848
|
+
const turnsKey = Symbol.for("tangle.secret-native-session-turns");
|
|
1849
|
+
const turnsRuntime = globalThis;
|
|
1850
|
+
const sessionTurns = turnsRuntime[turnsKey] ?? /* @__PURE__ */ new Map();
|
|
1851
|
+
turnsRuntime[turnsKey] = sessionTurns;
|
|
1852
|
+
function secretSessionTurnQueue(view) {
|
|
1853
|
+
return joinQueue(sessionTurns, view);
|
|
1854
|
+
}
|
|
1855
|
+
/** A shared launch never serves a secret MCP server to an agent on the executor's UID, nor a stdio one without a root sidecar to bridge it. */
|
|
1856
|
+
function sharedSecretMcpRefused(servers, agentUid) {
|
|
1857
|
+
return servers.length > 0 && (!agentUid || servers.some((server) => "command" in server) && process.getuid?.() !== 0);
|
|
1858
|
+
}
|
|
1859
|
+
/** Spawn a turn under its session's MCP lease: the session's turns hold it one at a time, each until its process exits. */
|
|
1860
|
+
async function spawnUnderSecretMcpLease(scope, signal, lease, spawn) {
|
|
1861
|
+
const queue = secretSessionTurnQueue(scope);
|
|
1862
|
+
let release;
|
|
1863
|
+
const done = async () => {
|
|
1864
|
+
try {
|
|
1865
|
+
await release?.();
|
|
1866
|
+
queue.release();
|
|
1867
|
+
} catch (error) {
|
|
1868
|
+
queue.retryCleanup(done);
|
|
1869
|
+
throw error;
|
|
1870
|
+
}
|
|
1871
|
+
};
|
|
1872
|
+
try {
|
|
1873
|
+
await untilSettledOrAborted(queue.previous, signal);
|
|
1874
|
+
release = await lease((held) => {
|
|
1875
|
+
release = held;
|
|
1876
|
+
}) ?? release;
|
|
1877
|
+
const turn = await spawn();
|
|
1878
|
+
turn.exitPromise = turn.exitPromise.finally(done);
|
|
1879
|
+
return turn;
|
|
1880
|
+
} catch (error) {
|
|
1881
|
+
await done();
|
|
1882
|
+
throw error;
|
|
1883
|
+
}
|
|
1884
|
+
}
|
|
1885
|
+
/** An HTTP URL on loopback with an explicit port and no URL credentials. */
|
|
1886
|
+
function isLoopbackEndpoint(value) {
|
|
1887
|
+
if (typeof value !== "string") return false;
|
|
1888
|
+
try {
|
|
1889
|
+
const url = new URL(value);
|
|
1890
|
+
return url.protocol === "http:" && [
|
|
1891
|
+
"127.0.0.1",
|
|
1892
|
+
"[::1]",
|
|
1893
|
+
"localhost"
|
|
1894
|
+
].includes(url.hostname) && url.port !== "" && !url.username && !url.password;
|
|
1895
|
+
} catch {
|
|
1896
|
+
return false;
|
|
1897
|
+
}
|
|
1898
|
+
}
|
|
1899
|
+
//#endregion
|
|
1540
1900
|
//#region src/types.ts
|
|
1541
1901
|
function interactionToggleEnabled(config, kind) {
|
|
1542
1902
|
return config === true || typeof config === "object" && config !== null && config[kind] === true;
|
|
@@ -1611,6 +1971,8 @@ var CliAdapterProfile = class extends CliAdapterLifecycle {
|
|
|
1611
1971
|
supportsSecretProfileRevisions = false;
|
|
1612
1972
|
/** The shared launch writes file secrets as `{env:}` references this adapter serves itself (#19297). */
|
|
1613
1973
|
referencesSharedFileSecrets = false;
|
|
1974
|
+
/** The shared launch keeps environment secrets as references its spawn serves. */
|
|
1975
|
+
referencesSharedEnvironmentSecrets = false;
|
|
1614
1976
|
profileSecretProvider;
|
|
1615
1977
|
secretProfileRuntimeKeyProvider;
|
|
1616
1978
|
/** The executor's MCP proxy, as the owner of the secret scopes this adapter opens. */
|
|
@@ -1759,14 +2121,23 @@ var CliAdapterProfile = class extends CliAdapterLifecycle {
|
|
|
1759
2121
|
...options,
|
|
1760
2122
|
secretFileSlotReferences: references
|
|
1761
2123
|
} : options);
|
|
2124
|
+
if (this.referencesSharedEnvironmentSecrets) for (const [name, value] of Object.entries(plan.env)) {
|
|
2125
|
+
if (typeof value === "string") continue;
|
|
2126
|
+
const reference = digestEnvName(SECRET_REFERENCE_PREFIX, name);
|
|
2127
|
+
const resolved = application.spawn.env[name];
|
|
2128
|
+
const bearer = value.format === "bearer";
|
|
2129
|
+
references[reference] = bearer ? resolved.slice(7) : resolved;
|
|
2130
|
+
application.spawn.env[name] = `${bearer ? "Bearer " : ""}{env:${reference}}`;
|
|
2131
|
+
}
|
|
1762
2132
|
if (Object.keys(references).length > 0) this.secretProfileRevisions.set(application, {
|
|
1763
2133
|
references,
|
|
1764
2134
|
files: plan.files.filter((file) => file.source === "user" && file.root !== "agent")
|
|
1765
2135
|
});
|
|
1766
|
-
const exposed = workspacePlanSecretCount(
|
|
2136
|
+
const exposed = workspacePlanSecretCount({
|
|
1767
2137
|
...plan,
|
|
1768
|
-
files: []
|
|
1769
|
-
|
|
2138
|
+
...this.referencesSharedFileSecrets ? { files: [] } : {},
|
|
2139
|
+
...this.referencesSharedEnvironmentSecrets ? { env: {} } : {}
|
|
2140
|
+
});
|
|
1770
2141
|
if (exposed > 0) this.logger.warn("profile_secret_exposed_shared_launch", {
|
|
1771
2142
|
harness: plan.harness,
|
|
1772
2143
|
secretSlots: exposed
|
|
@@ -1891,7 +2262,8 @@ var CliAdapterProfile = class extends CliAdapterLifecycle {
|
|
|
1891
2262
|
const merged = { ...environment };
|
|
1892
2263
|
for (const [name, value] of Object.entries(profilePlan.spawn.env)) {
|
|
1893
2264
|
const existing = merged[name];
|
|
1894
|
-
|
|
2265
|
+
const resolved = this.referencesSharedEnvironmentSecrets && !this.config.secretProfileRevisionRoot ? resolveReferences(value, this.secretProfileReferences(profilePlan) ?? {}) : value;
|
|
2266
|
+
if (existing !== void 0 && existing !== value && existing !== resolved || preserveClearedVariables && existing === void 0 && Object.hasOwn(environment, name) && !this.profilePlanMayFillClearedEnvironmentVariable(name, value)) throw new Error(`profile environment conflicts with provider environment: ${name}`);
|
|
1895
2267
|
merged[name] = value;
|
|
1896
2268
|
}
|
|
1897
2269
|
return merged;
|
|
@@ -2406,147 +2778,22 @@ function readCgroupFile(name) {
|
|
|
2406
2778
|
return;
|
|
2407
2779
|
}
|
|
2408
2780
|
}
|
|
2409
|
-
/** The sandbox's OOM-kill count: a running total for the whole box. */
|
|
2410
|
-
function oomKills() {
|
|
2411
|
-
const events = readCgroupFile("memory.events") ?? "";
|
|
2412
|
-
return Number(/^oom_kill (\d+)$/m.exec(events)?.[1] ?? 0);
|
|
2413
|
-
}
|
|
2414
|
-
/** Creates a new execution state. */
|
|
2415
|
-
function createExecutionState(sessionId, messageId, workspaceRoot) {
|
|
2416
|
-
return {
|
|
2417
|
-
sessionId,
|
|
2418
|
-
messageId: messageId ?? randomUUID(),
|
|
2419
|
-
workspaceRoot,
|
|
2420
|
-
toolCalls: /* @__PURE__ */ new Map(),
|
|
2421
|
-
textBuffer: "",
|
|
2422
|
-
reasoningBuffer: [],
|
|
2423
|
-
oomKillsAtStart: oomKills()
|
|
2424
|
-
};
|
|
2425
|
-
}
|
|
2426
|
-
//#endregion
|
|
2427
|
-
//#region src/secret-native-proof.ts
|
|
2428
|
-
const proofKey = Symbol.for("tangle.secret-native-binary-proofs");
|
|
2429
|
-
const runtime$1 = globalThis;
|
|
2430
|
-
const proven = runtime$1[proofKey] ?? /* @__PURE__ */ new Set();
|
|
2431
|
-
runtime$1[proofKey] = proven;
|
|
2432
|
-
/** Prove an immutable executable, under the launch's own identity and environment. */
|
|
2433
|
-
async function provenStoreBinary(expected, config) {
|
|
2434
|
-
if (!config.isolatedIdentity || config.inheritEnv !== false) refuseSecretLaunch("Secret native binary proof requires an isolated identity and environment", { path: config.command });
|
|
2435
|
-
const command = resolveExecutableRealpath(config.command, config.env?.PATH);
|
|
2436
|
-
if (!command || !isTrustedStoreBinary(command)) refuseSecretLaunch("Secret native launch requires a root-owned Nix store binary", { path: command ?? config.command });
|
|
2437
|
-
const key = `${command}\0${expected}`;
|
|
2438
|
-
if (proven.has(key)) return command;
|
|
2439
|
-
const probe = await execCli({
|
|
2440
|
-
command,
|
|
2441
|
-
cwd: config.cwd,
|
|
2442
|
-
env: config.env,
|
|
2443
|
-
inheritEnv: config.inheritEnv,
|
|
2444
|
-
signal: config.signal,
|
|
2445
|
-
isolatedIdentity: config.isolatedIdentity,
|
|
2446
|
-
args: ["--version"],
|
|
2447
|
-
spawnOptions: config.isolatedIdentity,
|
|
2448
|
-
timeoutMs: 15e3
|
|
2449
|
-
});
|
|
2450
|
-
const version = probe.stdout?.trim();
|
|
2451
|
-
if (!probe.exit.success || version !== expected) refuseSecretLaunch(`Secret native launch expected ${expected} at ${command}, received no matching version`, { exitCode: probe.exit.code });
|
|
2452
|
-
proven.add(key);
|
|
2453
|
-
return command;
|
|
2454
|
-
}
|
|
2455
|
-
/** A reported version alone cannot establish an immutable executable. */
|
|
2456
|
-
function isTrustedStoreBinary(realpath) {
|
|
2457
|
-
if (!realpath.startsWith("/nix/store/")) return false;
|
|
2458
|
-
try {
|
|
2459
|
-
for (const path of [realpath, dirname(realpath)]) {
|
|
2460
|
-
const stat = fs$1.lstatSync(path);
|
|
2461
|
-
if (stat.uid !== 0 || (stat.mode & 18) !== 0) return false;
|
|
2462
|
-
}
|
|
2463
|
-
return true;
|
|
2464
|
-
} catch {
|
|
2465
|
-
return false;
|
|
2466
|
-
}
|
|
2467
|
-
}
|
|
2468
|
-
/** The real file a launch of `command` executes under `pathEnv`. */
|
|
2469
|
-
function resolveExecutableRealpath(command, pathEnv) {
|
|
2470
|
-
if (command.includes("/") && !isAbsolute(command)) return void 0;
|
|
2471
|
-
const candidates = command.includes("/") ? [command] : (pathEnv ?? "").split(":").filter(isAbsolute).map((dir) => join(dir, command));
|
|
2472
|
-
for (const candidate of candidates) try {
|
|
2473
|
-
fs$1.accessSync(candidate, fs$1.constants.X_OK);
|
|
2474
|
-
if (fs$1.statSync(candidate).isFile()) return fs$1.realpathSync(candidate);
|
|
2475
|
-
} catch {}
|
|
2476
|
-
}
|
|
2477
|
-
const SEALED_NATIVE_HOME_LAYOUT = {
|
|
2478
|
-
codex: [
|
|
2479
|
-
[
|
|
2480
|
-
".",
|
|
2481
|
-
1016,
|
|
2482
|
-
true
|
|
2483
|
-
],
|
|
2484
|
-
[
|
|
2485
|
-
".codex",
|
|
2486
|
-
1016,
|
|
2487
|
-
true
|
|
2488
|
-
],
|
|
2489
|
-
[
|
|
2490
|
-
".agents",
|
|
2491
|
-
360,
|
|
2492
|
-
true
|
|
2493
|
-
],
|
|
2494
|
-
[
|
|
2495
|
-
".codex/skills",
|
|
2496
|
-
360,
|
|
2497
|
-
true
|
|
2498
|
-
],
|
|
2499
|
-
[
|
|
2500
|
-
".codex/rules",
|
|
2501
|
-
360,
|
|
2502
|
-
true
|
|
2503
|
-
],
|
|
2504
|
-
[
|
|
2505
|
-
".codex/config.toml",
|
|
2506
|
-
288,
|
|
2507
|
-
false
|
|
2508
|
-
],
|
|
2509
|
-
[
|
|
2510
|
-
".codex/AGENTS.md",
|
|
2511
|
-
288,
|
|
2512
|
-
false
|
|
2513
|
-
],
|
|
2514
|
-
[
|
|
2515
|
-
".codex/AGENTS.override.md",
|
|
2516
|
-
288,
|
|
2517
|
-
false
|
|
2518
|
-
],
|
|
2519
|
-
[
|
|
2520
|
-
".codex/hooks.json",
|
|
2521
|
-
288,
|
|
2522
|
-
false
|
|
2523
|
-
]
|
|
2524
|
-
],
|
|
2525
|
-
opencode: [[
|
|
2526
|
-
".",
|
|
2527
|
-
456,
|
|
2528
|
-
true
|
|
2529
|
-
], [
|
|
2530
|
-
".opencode",
|
|
2531
|
-
360,
|
|
2532
|
-
true
|
|
2533
|
-
]]
|
|
2534
|
-
};
|
|
2535
|
-
function assertSealedNativeHome(home, gid, layout) {
|
|
2536
|
-
for (const [relative, mode, directory] of layout) {
|
|
2537
|
-
const path = join(home, relative);
|
|
2538
|
-
const stat = fs$1.lstatSync(path);
|
|
2539
|
-
if (fs$1.realpathSync(path) !== path || stat.uid !== 0 || stat.gid !== gid || (stat.mode & 4095) !== mode || stat.isDirectory() !== directory) refuseSecretLaunch(`Secret native HOME authority is not sealed at ${path}: expected uid0 gid${gid} mode${mode.toString(8)} directory=${directory}; actual uid${stat.uid} gid${stat.gid} mode${(stat.mode & 4095).toString(8)} directory=${stat.isDirectory()}`);
|
|
2540
|
-
}
|
|
2541
|
-
}
|
|
2542
|
-
/** Only selected structural facts enter a refusal; payloads and causes never do. */
|
|
2543
|
-
function refuseSecretLaunch(reason, { path, expected, actual, exitCode } = {}) {
|
|
2544
|
-
const detail = JSON.stringify({
|
|
2545
|
-
path,
|
|
2546
|
-
expected,
|
|
2547
|
-
actual
|
|
2548
|
-
}).slice(0, 768);
|
|
2549
|
-
throw new Error(detail === "{}" ? reason : `${reason} ${detail}`, { cause: typeof exitCode === "number" || exitCode === null ? { exitCode } : void 0 });
|
|
2781
|
+
/** The sandbox's OOM-kill count: a running total for the whole box. */
|
|
2782
|
+
function oomKills() {
|
|
2783
|
+
const events = readCgroupFile("memory.events") ?? "";
|
|
2784
|
+
return Number(/^oom_kill (\d+)$/m.exec(events)?.[1] ?? 0);
|
|
2785
|
+
}
|
|
2786
|
+
/** Creates a new execution state. */
|
|
2787
|
+
function createExecutionState(sessionId, messageId, workspaceRoot) {
|
|
2788
|
+
return {
|
|
2789
|
+
sessionId,
|
|
2790
|
+
messageId: messageId ?? randomUUID(),
|
|
2791
|
+
workspaceRoot,
|
|
2792
|
+
toolCalls: /* @__PURE__ */ new Map(),
|
|
2793
|
+
textBuffer: "",
|
|
2794
|
+
reasoningBuffer: [],
|
|
2795
|
+
oomKillsAtStart: oomKills()
|
|
2796
|
+
};
|
|
2550
2797
|
}
|
|
2551
2798
|
//#endregion
|
|
2552
2799
|
//#region src/session-preparation.ts
|
|
@@ -4684,239 +4931,6 @@ async function resolveRouterModelLimits(input) {
|
|
|
4684
4931
|
};
|
|
4685
4932
|
}
|
|
4686
4933
|
//#endregion
|
|
4687
|
-
//#region src/secret-profile-mcp.ts
|
|
4688
|
-
function requireRecord(raw, message) {
|
|
4689
|
-
return isRecord(raw) ? raw : refuseSecretLaunch(message);
|
|
4690
|
-
}
|
|
4691
|
-
/** Snapshot the executor's projection; it may only replace an admitted stdio launch. */
|
|
4692
|
-
function directStdioMcpServers(lease, servers) {
|
|
4693
|
-
const direct = /* @__PURE__ */ new Map();
|
|
4694
|
-
const projection = lease?.directStdio;
|
|
4695
|
-
if (projection === void 0) return direct;
|
|
4696
|
-
if (!Array.isArray(projection)) refuseSecretLaunch("Direct MCP projection must be an array");
|
|
4697
|
-
for (const item of projection) {
|
|
4698
|
-
const original = servers.find((server) => server.name === item?.name);
|
|
4699
|
-
const environment = isRecord(item?.environment) ? { ...item.environment } : void 0;
|
|
4700
|
-
if (!isRecord(item) || Object.keys(item).some((key) => ![
|
|
4701
|
-
"name",
|
|
4702
|
-
"command",
|
|
4703
|
-
"environment"
|
|
4704
|
-
].includes(key)) || !original || !("command" in original) || direct.has(original.name) || JSON.stringify(item.command) !== JSON.stringify(original.command) || !environment || Object.keys(environment).length !== Object.keys(original.environment).length || Object.keys(original.environment).some((key) => !Object.hasOwn(environment, key) || typeof environment[key] !== "string")) refuseSecretLaunch("Direct MCP projection differs from admitted stdio");
|
|
4705
|
-
direct.set(original.name, Object.freeze({
|
|
4706
|
-
name: original.name,
|
|
4707
|
-
command: Object.freeze([...original.command]),
|
|
4708
|
-
environment: Object.freeze(environment)
|
|
4709
|
-
}));
|
|
4710
|
-
}
|
|
4711
|
-
return direct;
|
|
4712
|
-
}
|
|
4713
|
-
/** A config value with its secret references resolved, or undefined. */
|
|
4714
|
-
function resolveReferences(value, references, secrets) {
|
|
4715
|
-
let unresolved = false;
|
|
4716
|
-
const resolved = value.replace(SECRET_REFERENCE, (_match, reference) => {
|
|
4717
|
-
const secret = references[reference];
|
|
4718
|
-
if (secret === void 0) unresolved = true;
|
|
4719
|
-
if (secret) secrets?.add(secret);
|
|
4720
|
-
return secret ?? "";
|
|
4721
|
-
});
|
|
4722
|
-
return unresolved || /\{(?:env|file):/.test(resolved) ? void 0 : resolved;
|
|
4723
|
-
}
|
|
4724
|
-
/** The plain env entry by which a shared-launch stdio server opts into the bridge: the one workspace subdirectory it may write. */
|
|
4725
|
-
const SHARED_WORKSPACE_DIR_ENV = "TANGLE_SHARED_WORKSPACE_DIR";
|
|
4726
|
-
/**
|
|
4727
|
-
* A stdio server the executor can run: its command and its environment with
|
|
4728
|
-
* every secret reference resolved, and on the shared launch its mounts and
|
|
4729
|
-
* the subdirectory of `workspaceRoot` it declares.
|
|
4730
|
-
*/
|
|
4731
|
-
function servableStdioServer(name, entry, references, mount) {
|
|
4732
|
-
const command = entry.command;
|
|
4733
|
-
if (!Array.isArray(command) || command.length === 0 || command.some((part) => typeof part !== "string" || /\{(?:env|file):/.test(part))) return "its command is not a fixed argument list";
|
|
4734
|
-
if (entry.cwd !== void 0) return "it names a working directory";
|
|
4735
|
-
const declared = entry.environment === void 0 ? {} : entry.environment;
|
|
4736
|
-
if (!isRecord(declared)) return "its environment is not a map";
|
|
4737
|
-
const dir = declared[SHARED_WORKSPACE_DIR_ENV];
|
|
4738
|
-
const rule = !mount ? void 0 : typeof dir !== "string" || /\{(?:env|file):/.test(dir) ? "a plain value" : !dir || /[/\0]/.test(dir) || dir.includes("..") ? "one segment, no /, .. or NUL" : dir.startsWith(".") ? "without a leading ." : dir === "workspaces" && "other than workspaces";
|
|
4739
|
-
if (rule) return `its ${SHARED_WORKSPACE_DIR_ENV} must be ${rule}`;
|
|
4740
|
-
const environment = {};
|
|
4741
|
-
const secrets = /* @__PURE__ */ new Set();
|
|
4742
|
-
for (const [variable, value] of Object.entries(declared)) {
|
|
4743
|
-
if (typeof value !== "string") return `its ${variable} is not text`;
|
|
4744
|
-
const resolved = resolveReferences(value, references, secrets);
|
|
4745
|
-
if (resolved === void 0) return `its ${variable} names a value the executor cannot resolve`;
|
|
4746
|
-
environment[variable] = resolved;
|
|
4747
|
-
}
|
|
4748
|
-
return {
|
|
4749
|
-
name,
|
|
4750
|
-
command,
|
|
4751
|
-
environment,
|
|
4752
|
-
secrets: [...secrets],
|
|
4753
|
-
...mount && {
|
|
4754
|
-
files: mount.files,
|
|
4755
|
-
workspace: join(mount.workspaceRoot, dir)
|
|
4756
|
-
}
|
|
4757
|
-
};
|
|
4758
|
-
}
|
|
4759
|
-
/**
|
|
4760
|
-
* An undeclared shared-launch stdio server, until the default flips: its
|
|
4761
|
-
* entry with every reference resolved for the turn's inline config, which the
|
|
4762
|
-
* agent can read, and its warning, naming each enabled remote server that
|
|
4763
|
-
* holds one of the same references.
|
|
4764
|
-
*/
|
|
4765
|
-
function exposedStdioServer(entry, references, servers) {
|
|
4766
|
-
const text = JSON.stringify(entry);
|
|
4767
|
-
const held = text.match(SECRET_REFERENCE) ?? [];
|
|
4768
|
-
const sharedWith = Object.keys(servers).filter((other) => servers[other]?.type === "remote" && servers[other]?.enabled !== false && held.some((ref) => JSON.stringify(servers[other]).includes(ref)));
|
|
4769
|
-
return {
|
|
4770
|
-
entry: JSON.parse(text.replace(SECRET_REFERENCE, (_, ref) => JSON.stringify(references[ref] ?? "").slice(1, -1))),
|
|
4771
|
-
warning: {
|
|
4772
|
-
reason: "default flips to bridge-or-refuse on 2026-11-23 (or after 24 h with no such warning); declare TANGLE_SHARED_WORKSPACE_DIR to be bridged",
|
|
4773
|
-
...sharedWith.length ? { sharedWith } : {}
|
|
4774
|
-
}
|
|
4775
|
-
};
|
|
4776
|
-
}
|
|
4777
|
-
/** A remote server the executor can serve: its fixed upstream URL and every header with its secret references resolved. */
|
|
4778
|
-
function servableMcpServer(name, entry, references) {
|
|
4779
|
-
const url = entry.url;
|
|
4780
|
-
if (typeof url !== "string" || /\{(?:env|file):/.test(url)) return "its URL is not a fixed address";
|
|
4781
|
-
try {
|
|
4782
|
-
const parsed = new URL(url);
|
|
4783
|
-
if (parsed.protocol !== "https:" && parsed.protocol !== "http:") return "its URL is not http(s)";
|
|
4784
|
-
} catch {
|
|
4785
|
-
return "its URL is not a fixed address";
|
|
4786
|
-
}
|
|
4787
|
-
const headers = {};
|
|
4788
|
-
const declared = entry.headers === void 0 ? {} : entry.headers;
|
|
4789
|
-
if (!isRecord(declared)) return "its headers are not a map";
|
|
4790
|
-
for (const [header, value] of Object.entries(declared)) {
|
|
4791
|
-
if (typeof value !== "string") return `its ${header} header is not text`;
|
|
4792
|
-
const resolved = resolveReferences(value, references);
|
|
4793
|
-
if (resolved === void 0) return `its ${header} header names a value the executor cannot resolve`;
|
|
4794
|
-
headers[header] = resolved;
|
|
4795
|
-
}
|
|
4796
|
-
return {
|
|
4797
|
-
name,
|
|
4798
|
-
url,
|
|
4799
|
-
headers
|
|
4800
|
-
};
|
|
4801
|
-
}
|
|
4802
|
-
const cleanupKey = Symbol.for("tangle.secret-native-turn-cleanup");
|
|
4803
|
-
const awaitQueuedTurn = (turn) => turn[cleanupKey]?.() ?? turn;
|
|
4804
|
-
/** Earlier physical cleanup must succeed before another holder is admitted. */
|
|
4805
|
-
function joinQueue(queues, key) {
|
|
4806
|
-
const previous = queues.get(key) ?? Promise.resolve();
|
|
4807
|
-
let finish;
|
|
4808
|
-
let notify;
|
|
4809
|
-
let cleanup;
|
|
4810
|
-
let recovering;
|
|
4811
|
-
const ready = new Promise((resolve) => {
|
|
4812
|
-
notify = resolve;
|
|
4813
|
-
});
|
|
4814
|
-
const finished = new Promise((resolve) => {
|
|
4815
|
-
finish = resolve;
|
|
4816
|
-
});
|
|
4817
|
-
const release = () => {
|
|
4818
|
-
finish();
|
|
4819
|
-
notify();
|
|
4820
|
-
};
|
|
4821
|
-
const tail = previous.then(() => finished);
|
|
4822
|
-
tail[cleanupKey] = async () => {
|
|
4823
|
-
await awaitQueuedTurn(previous);
|
|
4824
|
-
await ready;
|
|
4825
|
-
if (cleanup) {
|
|
4826
|
-
recovering ??= Promise.resolve().then(cleanup).then(() => {
|
|
4827
|
-
cleanup = void 0;
|
|
4828
|
-
release();
|
|
4829
|
-
}).finally(() => {
|
|
4830
|
-
recovering = void 0;
|
|
4831
|
-
});
|
|
4832
|
-
await recovering;
|
|
4833
|
-
}
|
|
4834
|
-
await tail;
|
|
4835
|
-
};
|
|
4836
|
-
queues.set(key, tail);
|
|
4837
|
-
tail.then(() => {
|
|
4838
|
-
delete tail[cleanupKey];
|
|
4839
|
-
if (queues.get(key) === tail) queues.delete(key);
|
|
4840
|
-
});
|
|
4841
|
-
return {
|
|
4842
|
-
previous: awaitQueuedTurn(previous),
|
|
4843
|
-
release,
|
|
4844
|
-
retryCleanup(retry) {
|
|
4845
|
-
cleanup ??= retry;
|
|
4846
|
-
notify();
|
|
4847
|
-
}
|
|
4848
|
-
};
|
|
4849
|
-
}
|
|
4850
|
-
function untilSettledOrAborted(previous, signal) {
|
|
4851
|
-
const aborted = () => signal.reason ?? /* @__PURE__ */ new Error("Secret native turn aborted before its session view was free");
|
|
4852
|
-
if (signal.aborted) {
|
|
4853
|
-
previous.catch(() => {});
|
|
4854
|
-
return Promise.reject(aborted());
|
|
4855
|
-
}
|
|
4856
|
-
return new Promise((resolve, reject) => {
|
|
4857
|
-
const listener = addAbortListener(signal, () => reject(aborted()));
|
|
4858
|
-
previous.then(resolve, reject).finally(() => listener[Symbol.dispose]());
|
|
4859
|
-
});
|
|
4860
|
-
}
|
|
4861
|
-
/** Every native discovery ancestor is sealed and free of ambient configuration. */
|
|
4862
|
-
function assertSealedNativeSearchPath(cwd, configNames) {
|
|
4863
|
-
for (let child = cwd;; child = dirname(child)) {
|
|
4864
|
-
const stat = lstatSync(child);
|
|
4865
|
-
if (!stat.isDirectory() || stat.isSymbolicLink() || realpathSync(child) !== child || stat.uid !== 0 || (stat.mode & 18) !== 0 || child !== cwd && configNames.some((name) => lstatSync(join(child, name), { throwIfNoEntry: false }))) throw new Error("Secret native launch has mutable or ambient discovery authority");
|
|
4866
|
-
if (dirname(child) === child) break;
|
|
4867
|
-
}
|
|
4868
|
-
}
|
|
4869
|
-
/** One session view changes only after its previous physical native process exits. */
|
|
4870
|
-
const turnsKey = Symbol.for("tangle.secret-native-session-turns");
|
|
4871
|
-
const turnsRuntime = globalThis;
|
|
4872
|
-
const sessionTurns = turnsRuntime[turnsKey] ?? /* @__PURE__ */ new Map();
|
|
4873
|
-
turnsRuntime[turnsKey] = sessionTurns;
|
|
4874
|
-
function secretSessionTurnQueue(view) {
|
|
4875
|
-
return joinQueue(sessionTurns, view);
|
|
4876
|
-
}
|
|
4877
|
-
/** A shared launch never serves a secret MCP server to an agent on the executor's UID, nor a stdio one without a root sidecar to bridge it. */
|
|
4878
|
-
function sharedSecretMcpRefused(servers, agentUid) {
|
|
4879
|
-
return servers.length > 0 && (!agentUid || servers.some((server) => "command" in server) && process.getuid?.() !== 0);
|
|
4880
|
-
}
|
|
4881
|
-
/** Spawn a turn under its session's MCP lease: the session's turns hold it one at a time, each until its process exits. */
|
|
4882
|
-
async function spawnUnderSecretMcpLease(scope, signal, lease, spawn) {
|
|
4883
|
-
const queue = secretSessionTurnQueue(scope);
|
|
4884
|
-
let release;
|
|
4885
|
-
const done = async () => {
|
|
4886
|
-
try {
|
|
4887
|
-
await release?.();
|
|
4888
|
-
queue.release();
|
|
4889
|
-
} catch (error) {
|
|
4890
|
-
queue.retryCleanup(done);
|
|
4891
|
-
throw error;
|
|
4892
|
-
}
|
|
4893
|
-
};
|
|
4894
|
-
try {
|
|
4895
|
-
await untilSettledOrAborted(queue.previous, signal);
|
|
4896
|
-
release = await lease();
|
|
4897
|
-
const turn = await spawn();
|
|
4898
|
-
turn.exitPromise = turn.exitPromise.finally(done);
|
|
4899
|
-
return turn;
|
|
4900
|
-
} catch (error) {
|
|
4901
|
-
await done();
|
|
4902
|
-
throw error;
|
|
4903
|
-
}
|
|
4904
|
-
}
|
|
4905
|
-
/** An HTTP URL on loopback with an explicit port and no URL credentials. */
|
|
4906
|
-
function isLoopbackEndpoint(value) {
|
|
4907
|
-
if (typeof value !== "string") return false;
|
|
4908
|
-
try {
|
|
4909
|
-
const url = new URL(value);
|
|
4910
|
-
return url.protocol === "http:" && [
|
|
4911
|
-
"127.0.0.1",
|
|
4912
|
-
"[::1]",
|
|
4913
|
-
"localhost"
|
|
4914
|
-
].includes(url.hostname) && url.port !== "" && !url.username && !url.password;
|
|
4915
|
-
} catch {
|
|
4916
|
-
return false;
|
|
4917
|
-
}
|
|
4918
|
-
}
|
|
4919
|
-
//#endregion
|
|
4920
4934
|
//#region src/secret-profile-scope.ts
|
|
4921
4935
|
const key = Symbol.for("tangle.secret-profile-mcp.scopes");
|
|
4922
4936
|
const runtime = globalThis;
|
|
@@ -4943,6 +4957,6 @@ async function forgetSessionScopes(target) {
|
|
|
4943
4957
|
}
|
|
4944
4958
|
}
|
|
4945
4959
|
//#endregion
|
|
4946
|
-
export {
|
|
4960
|
+
export { servableStdioServer as $, createRepeatedToolFailureGuard as A, MANAGED_QUOTE_VERSION_HEADER as At, withEphemeralContext as B, toolResultEvents as Bt, plaintextResponseParser as C, failureAfterCleanup as Ct, readCliTokenUsage as D, EXECUTION_CORRELATION_HEADERS as Dt, parseCliUsageLine as E, runtimeSecretsOverlay as Et, enabledInteractionKinds as F, reasoningEvents as Ft, exposedStdioServer as G, acpContentText as Gt, SHARED_WORKSPACE_DIR_ENV as H, trackReasoningBlock as Ht, interactionToggleEnabled as I, sessionObservedEvents as It, joinQueue as J, isLoopbackEndpoint as K, assertAcpTurnFinished as Kt, readEphemeralContext as L, streamPartBase as Lt, isLocalMcpConfig as M, homeXdgEnv as Mt, localMcpArgv as N, mapAcpSessionUpdate as Nt, recordCliTokenUsage as O, EXECUTION_ID_HEADER as Ot, localMcpEnv as P, finalTextEvent as Pt, servableMcpServer as Q, turnEndReason as R, textDeltaEvents as Rt, jsonEventParser as S, SessionRehydrationError as St, accumulateCliTokenUsage as T, wasNeverLaunched as Tt, assertSealedNativeSearchPath as U, ACP_MIN_PROTOCOL_VERSION as Ut, withTurnInteractions as V, toolStartEvents as Vt, directStdioMcpServers as W, ACP_PROTOCOL_VERSION as Wt, resolveReferences as X, requireRecord as Y, secretSessionTurnQueue as Z, TerminalPlanSupport as _, deriveFilePart as _t, SECRET_REFERENCE$1 as a, assertSealedNativeHome as at, brokerInteractionTools$1 as b, trackFilePart as bt, forgetSessionScopes as c, refuseSecretLaunch as ct, findRouterCatalogEntry as d, MAX_TOTAL_INLINE_IMAGE_BYTES as dt, sharedSecretMcpRefused as et, resolveRouterModelLimits as f, PROMPT_SECTION_SEPARATOR as ft, McpInteractionSupport as g, buildFileUrl as gt, nativeEffortArgs as h, prependPromptSection as ht, PERMISSION_DECISION_TIMEOUT_MS as i, SEALED_NATIVE_HOME_LAYOUT as it, createExecutionState as j, executionCorrelationHeaders as jt, CliProviderAdapterBase as k, EXECUTION_TRACE_HEADER as kt, secretMcpScope as l, resolveExecutableRealpath as lt, kimiThinkingArgs as m, preparePromptInputParts as mt, InteractionBroker$1 as n, untilSettledOrAborted as nt, SECRET_REFERENCE_PREFIX$1 as o, isTrustedStoreBinary as ot, resolveRouterModelReasoningEfforts as p, partitionImageAttachments as pt, isPlainRecord as q, spawnAcpBridge as qt, InteractionHttpBridge as r, NATIVE_SESSION_CONTRACTS$1 as rt, codexDeveloperInstructionArgs as s, provenStoreBinary as st, CODEX_DISABLED_FEATURE_ARGS as t, spawnUnderSecretMcpLease as tt, ROUTER_MODEL_CATALOG_TIMEOUT_MS as u, MAX_INLINE_IMAGE_BYTES as ut, DEFAULT_INTERACTION_MCP_SERVER_NAME as v, deterministicFilePartId as vt, AcpProviderAdapterBase as w, rejectNotLaunched as wt, interactionMcpToolName as x, InvalidAttachmentError as xt, InteractionMcpServer$1 as y, inferMediaType as yt, turnInteractionEnabled as z, textSnapshotEvents as zt };
|
|
4947
4961
|
|
|
4948
|
-
//# sourceMappingURL=src-
|
|
4962
|
+
//# sourceMappingURL=src-B-JlLsMB.mjs.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/sdk-provider-cli-base",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.110",
|
|
4
4
|
"description": "Base adapter for CLI-based AI agent providers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.mjs",
|
|
@@ -60,9 +60,9 @@
|
|
|
60
60
|
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
61
61
|
"@tangle-network/agent-core": "^1.0.3",
|
|
62
62
|
"@tangle-network/agent-interface": "^5.10.27",
|
|
63
|
-
"@tangle-network/agent-profile-materialize": "1.1.
|
|
63
|
+
"@tangle-network/agent-profile-materialize": "1.1.129",
|
|
64
64
|
"@tangle-network/agent-trace-contract": "^2.2.0",
|
|
65
|
-
"@tangle-network/cli-agent-registry": "0.15.
|
|
65
|
+
"@tangle-network/cli-agent-registry": "0.15.104",
|
|
66
66
|
"@tangle-network/sdk-cli-runner": "0.3.12",
|
|
67
67
|
"@tangle-network/sdk-session-persistence": "0.7.13",
|
|
68
68
|
"zod": "4.6.7"
|
|
@@ -79,8 +79,8 @@
|
|
|
79
79
|
"registry": "https://registry.npmjs.org"
|
|
80
80
|
},
|
|
81
81
|
"tangleRelease": {
|
|
82
|
-
"sourceSha": "
|
|
83
|
-
"mergedAt": "2026-11-
|
|
82
|
+
"sourceSha": "73c23efadd4a8611ff6601407411151009e56d17",
|
|
83
|
+
"mergedAt": "2026-11-16T21:54:28-08:00"
|
|
84
84
|
},
|
|
85
85
|
"scripts": {
|
|
86
86
|
"build": "tsdown",
|