@tangle-network/sdk-provider-cli-base 0.13.66 → 0.13.67
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/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-DePFb23d.d.mts → index-e8cyc1fi.d.mts} +43 -32
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/{src-CqOi8nrB.mjs → src-DtA6aq0e.mjs} +100 -79
- package/package.json +5 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Bt as ExecutionState, It as CliProviderConfig, Pt as CliExecArgs, gt as CliProviderAdapterBase } from "../../index-e8cyc1fi.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 {
|
|
1
|
+
import { Dt as sessionObservedEvents, Et as reasoningEvents, H as recordCliTokenUsage, I as jsonEventParser, J as localMcpEnv, Mt as toolStartEvents, U as CliProviderAdapterBase, jt as toolResultEvents, kt as textDeltaEvents, q as localMcpArgv } from "../../src-DtA6aq0e.mjs";
|
|
2
2
|
//#region src/adapters/amp/types.ts
|
|
3
3
|
/**
|
|
4
4
|
* Type guard for AMP events.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Bt as ExecutionState, It as CliProviderConfig, Pt as CliExecArgs, gt as CliProviderAdapterBase } from "../../index-e8cyc1fi.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 { A as McpInteractionSupport,
|
|
1
|
+
import { A as McpInteractionSupport, Dt as sessionObservedEvents, Et as reasoningEvents, H as recordCliTokenUsage, I as jsonEventParser, J as localMcpEnv, K as isLocalMcpConfig, Mt as toolStartEvents, Ot as streamPartBase, U as CliProviderAdapterBase, Y as enabledInteractionKinds, jt as toolResultEvents, kt as textDeltaEvents, q as localMcpArgv, tt as withTurnInteractions } from "../../src-DtA6aq0e.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 {
|
|
1
|
+
import { Bt as ExecutionState, It as CliProviderConfig, Pt as CliExecArgs, gt as CliProviderAdapterBase } from "../../index-e8cyc1fi.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 { Dt as sessionObservedEvents, L as plaintextResponseParser, U as CliProviderAdapterBase, st as prependPromptSection } from "../../src-DtA6aq0e.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 {
|
|
1
|
+
import { Bt as ExecutionState, It as CliProviderConfig, Pt as CliExecArgs, gt as CliProviderAdapterBase, n as HarnessId } from "../../index-e8cyc1fi.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 {
|
|
1
|
+
import { Dt as sessionObservedEvents, H as recordCliTokenUsage, J as localMcpEnv, K as isLocalMcpConfig, L as plaintextResponseParser, U as CliProviderAdapterBase, at as partitionImageAttachments, q as localMcpArgv, st as prependPromptSection } from "../../src-DtA6aq0e.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 {
|
|
1
|
+
import { Bt as ExecutionState, It as CliProviderConfig, Pt as CliExecArgs, gt as CliProviderAdapterBase, n as HarnessId } from "../../index-e8cyc1fi.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 { B as parseCliUsageLine,
|
|
1
|
+
import { B as parseCliUsageLine, Dt as sessionObservedEvents, H as recordCliTokenUsage, L as plaintextResponseParser, U as CliProviderAdapterBase, st as prependPromptSection } from "../../src-DtA6aq0e.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 {
|
|
1
|
+
import { Bt as ExecutionState, It as CliProviderConfig, Pt as CliExecArgs, gt as CliProviderAdapterBase } from "../../index-e8cyc1fi.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 { Dt as sessionObservedEvents, L as plaintextResponseParser, U as CliProviderAdapterBase, st as prependPromptSection } from "../../src-DtA6aq0e.mjs";
|
|
2
2
|
import { normalizeOpenAiCompatibleBaseUrl, resolveTangleRouterDefaults } from "@tangle-network/agent-interface";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
//#region src/adapters/nanocode/adapter.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Bt as ExecutionState, It as CliProviderConfig, Pt as CliExecArgs, gt as CliProviderAdapterBase, n as HarnessId, o as WorkspacePlanApplication } from "../../index-e8cyc1fi.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 { Dt as sessionObservedEvents, H as recordCliTokenUsage, Tt as finalTextEvent, U as CliProviderAdapterBase, k as nativeEffortArgs, st as prependPromptSection } from "../../src-DtA6aq0e.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 {
|
|
1
|
+
import { Tt as AcpContentBlock, gn as AcpProcessSpec, hn as AcpBridgeSpawn, ht as AcpProviderAdapterBase, jt as AcpTurn, wt as AcpBridgeConfig } from "../../index-e8cyc1fi.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 {
|
|
1
|
+
import { R as AcpProviderAdapterBase, Rt as spawnAcpBridge, st as prependPromptSection } from "../../src-DtA6aq0e.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";
|
|
@@ -317,6 +317,8 @@ interface AcpNewSessionResult {
|
|
|
317
317
|
interface AcpPromptResult {
|
|
318
318
|
stopReason: "end_turn" | "max_tokens" | "max_turn_requests" | "refusal" | "cancelled" | string;
|
|
319
319
|
}
|
|
320
|
+
/** A turn finishes on end_turn or max_tokens; any other stop leaves it unfinished. */
|
|
321
|
+
declare function assertAcpTurnFinished(provider: string, stopReason: string | undefined): void;
|
|
320
322
|
/** `session/update` notification params; only the mapped kinds are typed. */
|
|
321
323
|
interface AcpSessionUpdateParams {
|
|
322
324
|
sessionId: string;
|
|
@@ -564,7 +566,7 @@ declare abstract class CliAdapterSessions<TConfig extends CliProviderConfig = Cl
|
|
|
564
566
|
buildExecArgs: (nativeSessionId: string) => CliExecArgs;
|
|
565
567
|
input: AgentExecutionInput;
|
|
566
568
|
timeoutMs?: number;
|
|
567
|
-
}): string | Promise<string>;
|
|
569
|
+
}): string | undefined | Promise<string | undefined>;
|
|
568
570
|
/**
|
|
569
571
|
* Make a pre-minted native session durable before the CLI starts, for a
|
|
570
572
|
* harness that would otherwise write nothing until its first model reply
|
|
@@ -843,7 +845,6 @@ declare abstract class AcpProviderAdapterBase<TConfig extends AcpBridgeConfig, T
|
|
|
843
845
|
protected evictAcpSession(sessionId: string, reason: string): void;
|
|
844
846
|
protected evictAcpSessionsWhere(matches: (processKey: string) => boolean, reason: string): void;
|
|
845
847
|
private mapAcpUpdate;
|
|
846
|
-
private mapToolStatus;
|
|
847
848
|
private formatBridgeError;
|
|
848
849
|
private sessionSetupError;
|
|
849
850
|
healthCheck(): Promise<boolean>;
|
|
@@ -856,6 +857,16 @@ declare abstract class AcpProviderAdapterBase<TConfig extends AcpBridgeConfig, T
|
|
|
856
857
|
protected buildMcpAddArgs(_name: string, _config: McpConfig | LocalMcpConfig): string[];
|
|
857
858
|
}
|
|
858
859
|
//#endregion
|
|
860
|
+
//#region src/acp-session-updates.d.ts
|
|
861
|
+
/** Shared native ACP translation; provider hooks retain their failure policy. */
|
|
862
|
+
declare function mapAcpSessionUpdate({
|
|
863
|
+
update
|
|
864
|
+
}: AcpSessionUpdateParams, state: ExecutionState, options: {
|
|
865
|
+
provider: string;
|
|
866
|
+
onToolFailed?: (text: string | undefined) => StreamEvent[];
|
|
867
|
+
onUnknownToolStatus?: (status: string) => void;
|
|
868
|
+
}): StreamEvent[];
|
|
869
|
+
//#endregion
|
|
859
870
|
//#region src/errors.d.ts
|
|
860
871
|
/**
|
|
861
872
|
* A session's persisted transcript exists but could not be read for replay
|
|
@@ -1069,34 +1080,6 @@ declare function recordCliTokenUsage(state: ExecutionState, ...sources: unknown[
|
|
|
1069
1080
|
declare function accumulateCliTokenUsage(state: ExecutionState, ...sources: unknown[]): boolean;
|
|
1070
1081
|
declare function parseCliUsageLine(line: string): Record<string, unknown> | undefined;
|
|
1071
1082
|
//#endregion
|
|
1072
|
-
//#region src/secret-native-proof.d.ts
|
|
1073
|
-
type BinaryLaunch = Pick<CliSpawnConfig, "command" | "cwd" | "env" | "signal" | "isolatedIdentity"> & {
|
|
1074
|
-
inheritEnv: boolean;
|
|
1075
|
-
};
|
|
1076
|
-
/** Prove an immutable executable, under the launch's own identity and environment. */
|
|
1077
|
-
declare function provenStoreBinary(expected: string, config: BinaryLaunch): Promise<string>;
|
|
1078
|
-
/** A reported version alone cannot establish an immutable executable. */
|
|
1079
|
-
declare function isTrustedStoreBinary(realpath: string): boolean;
|
|
1080
|
-
/** The real file a launch of `command` executes under `pathEnv`. */
|
|
1081
|
-
declare function resolveExecutableRealpath(command: string, pathEnv: string | undefined): string | undefined;
|
|
1082
|
-
type SealedEntry = readonly [relative: string, mode: number, directory: boolean];
|
|
1083
|
-
declare const SEALED_NATIVE_HOME_LAYOUT: {
|
|
1084
|
-
readonly codex: readonly [readonly [".", 1016, true], readonly [".codex", 1016, true], readonly [".agents", 360, true], readonly [".codex/skills", 360, true], readonly [".codex/rules", 360, true], readonly [".codex/config.toml", 288, false], readonly [".codex/AGENTS.md", 288, false], readonly [".codex/AGENTS.override.md", 288, false], readonly [".codex/hooks.json", 288, false]];
|
|
1085
|
-
readonly opencode: readonly [readonly [".", 456, true], readonly [".opencode", 360, true]];
|
|
1086
|
-
};
|
|
1087
|
-
declare function assertSealedNativeHome(home: string, gid: number, layout: readonly SealedEntry[]): void;
|
|
1088
|
-
type RefusalDetail = {
|
|
1089
|
-
path?: string;
|
|
1090
|
-
exitCode?: number | null;
|
|
1091
|
-
} & Partial<Record<"expected" | "actual", string | number | boolean>>;
|
|
1092
|
-
/** Only selected structural facts enter a refusal; payloads and causes never do. */
|
|
1093
|
-
declare function refuseSecretLaunch(reason: string, {
|
|
1094
|
-
path,
|
|
1095
|
-
expected,
|
|
1096
|
-
actual,
|
|
1097
|
-
exitCode
|
|
1098
|
-
}?: RefusalDetail): never;
|
|
1099
|
-
//#endregion
|
|
1100
1083
|
//#region src/reasoning-effort.d.ts
|
|
1101
1084
|
/** The argv carrying `nativeReasoningControl` for a profile effort, or none. */
|
|
1102
1085
|
declare function nativeEffortArgs(harness: HarnessType, effort: ReasoningEffort | undefined): string[];
|
|
@@ -1167,6 +1150,34 @@ declare function createRepeatedToolFailureGuard(options: RepeatedToolFailureGuar
|
|
|
1167
1150
|
} | undefined;
|
|
1168
1151
|
};
|
|
1169
1152
|
//#endregion
|
|
1153
|
+
//#region src/secret-native-proof.d.ts
|
|
1154
|
+
type BinaryLaunch = Pick<CliSpawnConfig, "command" | "cwd" | "env" | "signal" | "isolatedIdentity"> & {
|
|
1155
|
+
inheritEnv: boolean;
|
|
1156
|
+
};
|
|
1157
|
+
/** Prove an immutable executable, under the launch's own identity and environment. */
|
|
1158
|
+
declare function provenStoreBinary(expected: string, config: BinaryLaunch): Promise<string>;
|
|
1159
|
+
/** A reported version alone cannot establish an immutable executable. */
|
|
1160
|
+
declare function isTrustedStoreBinary(realpath: string): boolean;
|
|
1161
|
+
/** The real file a launch of `command` executes under `pathEnv`. */
|
|
1162
|
+
declare function resolveExecutableRealpath(command: string, pathEnv: string | undefined): string | undefined;
|
|
1163
|
+
type SealedEntry = readonly [relative: string, mode: number, directory: boolean];
|
|
1164
|
+
declare const SEALED_NATIVE_HOME_LAYOUT: {
|
|
1165
|
+
readonly codex: readonly [readonly [".", 1016, true], readonly [".codex", 1016, true], readonly [".agents", 360, true], readonly [".codex/skills", 360, true], readonly [".codex/rules", 360, true], readonly [".codex/config.toml", 288, false], readonly [".codex/AGENTS.md", 288, false], readonly [".codex/AGENTS.override.md", 288, false], readonly [".codex/hooks.json", 288, false]];
|
|
1166
|
+
readonly opencode: readonly [readonly [".", 456, true], readonly [".opencode", 360, true]];
|
|
1167
|
+
};
|
|
1168
|
+
declare function assertSealedNativeHome(home: string, gid: number, layout: readonly SealedEntry[]): void;
|
|
1169
|
+
type RefusalDetail = {
|
|
1170
|
+
path?: string;
|
|
1171
|
+
exitCode?: number | null;
|
|
1172
|
+
} & Partial<Record<"expected" | "actual", string | number | boolean>>;
|
|
1173
|
+
/** Only selected structural facts enter a refusal; payloads and causes never do. */
|
|
1174
|
+
declare function refuseSecretLaunch(reason: string, {
|
|
1175
|
+
path,
|
|
1176
|
+
expected,
|
|
1177
|
+
actual,
|
|
1178
|
+
exitCode
|
|
1179
|
+
}?: RefusalDetail): never;
|
|
1180
|
+
//#endregion
|
|
1170
1181
|
//#region src/secret-profile-scope.d.ts
|
|
1171
1182
|
type ScopeOwner = {
|
|
1172
1183
|
readonly proxy?: SecretProfileMcpCredentialProxy;
|
|
@@ -1270,5 +1281,5 @@ declare function homeXdgEnv(home: string): {
|
|
|
1270
1281
|
XDG_STATE_HOME: string;
|
|
1271
1282
|
};
|
|
1272
1283
|
//#endregion
|
|
1273
|
-
export { deterministicFilePartId as $,
|
|
1274
|
-
//# sourceMappingURL=index-
|
|
1284
|
+
export { deterministicFilePartId as $, SECRET_REFERENCE as $t, createRepeatedToolFailureGuard as A, AcpSessionUpdateParams as At, localMcpEnv as B, ExecutionState as Bt, assertSealedNativeHome as C, ACP_PROTOCOL_VERSION as Ct, resolveExecutableRealpath as D, AcpInitializeResult as Dt, refuseSecretLaunch as E, AcpInitializeParams as Et, parseCliUsageLine as F, CliExecutionInput as Ft, InteractionMcpServerConfig$1 as G, TurnEndReason as Gt, AskUserBridge as H, InteractionToggleKind as Ht, readCliTokenUsage as I, CliProviderConfig as It, RequestPlanBridge as J, readEphemeralContext as Jt, PermissionPromptBridge as K, enabledInteractionKinds as Kt, recordCliTokenUsage as L, CliProviderLogger as Lt, kimiThinkingArgs as M, acpContentText as Mt, nativeEffortArgs as N, assertAcpTurnFinished as Nt, RepeatedToolFailure as O, AcpNewSessionResult as Ot, accumulateCliTokenUsage as P, CliExecArgs as Pt, deriveFilePart as Q, withTurnInteractions as Qt, isLocalMcpConfig as R, CliProviderOptions as Rt, SEALED_NATIVE_HOME_LAYOUT as S, ACP_MIN_PROTOCOL_VERSION as St, provenStoreBinary as T, AcpContentBlock as Tt, DEFAULT_INTERACTION_MCP_SERVER_NAME as U, PerTurnInteractionInput as Ut, McpInteractionSupport as V, InteractionToggleConfig as Vt, InteractionMcpServer$1 as W, ToolCallState as Wt, interactionMcpToolName as X, turnInteractionEnabled as Xt, brokerInteractionTools$1 as Y, turnEndReason as Yt, buildFileUrl as Z, withEphemeralContext as Zt, toolResultEvents as _, spawnAcpBridge as _n, runtimeSecretsOverlay as _t, PERMISSION_DECISION_TIMEOUT_MS as a, directStdioMcpServers as an, MANAGED_QUOTE_VERSION_HEADER as at, secretMcpScope as b, CliTurnSpawn as bt, homeXdgEnv as c, joinQueue as cn, jsonEventParser as ct, finalTextEvent as d, secretSessionTurnQueue as dn, SessionRehydrationError as dt, SECRET_REFERENCE_PREFIX as en, inferMediaType as et, reasoningEvents as f, servableMcpServer as fn, rejectNotLaunched as ft, textSnapshotEvents as g, AcpProcessSpec as gn, CliProviderAdapterBase as gt, textDeltaEvents as h, AcpBridgeSpawn as hn, AcpProviderAdapterBase as ht, InteractionHttpBridge as i, assertSealedNativeSearchPath as in, EXECUTION_TRACE_HEADER as it, trackReasoningBlock as j, AcpTurn as jt, RepeatedToolFailureGuardOptions as k, AcpPromptResult as kt, TerminalPlanSupport as l, requireRecord as ln, plaintextResponseParser as lt, streamPartBase as m, untilSettledOrAborted as mn, mapAcpSessionUpdate as mt, HarnessId$1 as n, SecretProfileMcpLease as nn, EXECUTION_CORRELATION_HEADERS as nt, WorkspacePlanApplication$1 as o, isLoopbackEndpoint as on, executionCorrelationHeaders as ot, sessionObservedEvents as p, servableStdioServer as pn, wasNeverLaunched as pt, RequestPermissionBridge as q, interactionToggleEnabled as qt, InteractionBroker$1 as r, SecretProfileMcpServer as rn, EXECUTION_ID_HEADER as rt, codexDeveloperInstructionArgs as s, isPlainRecord as sn, PlaintextResponse as st, CODEX_DISABLED_FEATURE_ARGS as t, SecretProfileMcpCredentialProxy as tn, trackFilePart as tt, TerminalPlanSupportOptions as u, resolveReferences as un, InvalidAttachmentError as ut, toolStartEvents as v, createExecutionState as vt, isTrustedStoreBinary as w, AcpBridgeConfig as wt, NATIVE_SESSION_CONTRACTS$1 as x, PreparedCliLaunch as xt, forgetSessionScopes as y, CliTurnProcess as yt, localMcpArgv as z, EphemeralContextInput as zt };
|
|
1285
|
+
//# sourceMappingURL=index-e8cyc1fi.d.mts.map
|
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as deterministicFilePartId, $t as
|
|
1
|
+
import { $ as deterministicFilePartId, $t as SECRET_REFERENCE, A as createRepeatedToolFailureGuard, At as AcpSessionUpdateParams, B as localMcpEnv, Bt as ExecutionState, C as assertSealedNativeHome, Ct as ACP_PROTOCOL_VERSION, D as resolveExecutableRealpath, Dt as AcpInitializeResult, E as refuseSecretLaunch, Et as AcpInitializeParams, F as parseCliUsageLine, Ft as CliExecutionInput, G as InteractionMcpServerConfig, Gt as TurnEndReason, H as AskUserBridge, Ht as InteractionToggleKind, I as readCliTokenUsage, It as CliProviderConfig, J as RequestPlanBridge, Jt as readEphemeralContext, K as PermissionPromptBridge, Kt as enabledInteractionKinds, L as recordCliTokenUsage, Lt as CliProviderLogger, M as kimiThinkingArgs, Mt as acpContentText, N as nativeEffortArgs, Nt as assertAcpTurnFinished, O as RepeatedToolFailure, Ot as AcpNewSessionResult, P as accumulateCliTokenUsage, Pt as CliExecArgs, Q as deriveFilePart, Qt as withTurnInteractions, R as isLocalMcpConfig, Rt as CliProviderOptions, S as SEALED_NATIVE_HOME_LAYOUT, St as ACP_MIN_PROTOCOL_VERSION, T as provenStoreBinary, Tt as AcpContentBlock, U as DEFAULT_INTERACTION_MCP_SERVER_NAME, Ut as PerTurnInteractionInput, V as McpInteractionSupport, Vt as InteractionToggleConfig, W as InteractionMcpServer, Wt as ToolCallState, X as interactionMcpToolName, Xt as turnInteractionEnabled, Y as brokerInteractionTools, Yt as turnEndReason, Z as buildFileUrl, Zt as withEphemeralContext, _ as toolResultEvents, _n as spawnAcpBridge, _t as runtimeSecretsOverlay, a as PERMISSION_DECISION_TIMEOUT_MS, an as directStdioMcpServers, at as MANAGED_QUOTE_VERSION_HEADER, b as secretMcpScope, bt as CliTurnSpawn, c as homeXdgEnv, cn as joinQueue, ct as jsonEventParser, d as finalTextEvent, dn as secretSessionTurnQueue, dt as SessionRehydrationError, en as SECRET_REFERENCE_PREFIX, et as inferMediaType, f as reasoningEvents, fn as servableMcpServer, ft as rejectNotLaunched, g as textSnapshotEvents, gn as AcpProcessSpec, gt as CliProviderAdapterBase, h as textDeltaEvents, hn as AcpBridgeSpawn, ht as AcpProviderAdapterBase, i as InteractionHttpBridge, in as assertSealedNativeSearchPath, it as EXECUTION_TRACE_HEADER, j as trackReasoningBlock, jt as AcpTurn, k as RepeatedToolFailureGuardOptions, kt as AcpPromptResult, l as TerminalPlanSupport, ln as requireRecord, lt as plaintextResponseParser, m as streamPartBase, mn as untilSettledOrAborted, mt as mapAcpSessionUpdate, n as HarnessId, nn as SecretProfileMcpLease, nt as EXECUTION_CORRELATION_HEADERS, o as WorkspacePlanApplication, on as isLoopbackEndpoint, ot as executionCorrelationHeaders, p as sessionObservedEvents, pn as servableStdioServer, pt as wasNeverLaunched, q as RequestPermissionBridge, qt as interactionToggleEnabled, r as InteractionBroker, rn as SecretProfileMcpServer, rt as EXECUTION_ID_HEADER, s as codexDeveloperInstructionArgs, sn as isPlainRecord, st as PlaintextResponse, t as CODEX_DISABLED_FEATURE_ARGS, tn as SecretProfileMcpCredentialProxy, tt as trackFilePart, u as TerminalPlanSupportOptions, un as resolveReferences, ut as InvalidAttachmentError, v as toolStartEvents, vt as createExecutionState, w as isTrustedStoreBinary, wt as AcpBridgeConfig, x as NATIVE_SESSION_CONTRACTS, xt as PreparedCliLaunch, y as forgetSessionScopes, yt as CliTurnProcess, z as localMcpArgv, zt as EphemeralContextInput } from "./index-e8cyc1fi.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
|
-
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, RepeatedToolFailure, RepeatedToolFailureGuardOptions, RequestPermissionBridge, RequestPlanBridge, SEALED_NATIVE_HOME_LAYOUT, SECRET_REFERENCE, SECRET_REFERENCE_PREFIX, SecretProfileMcpCredentialProxy, SecretProfileMcpLease, SecretProfileMcpServer, SessionRehydrationError, TerminalPlanSupport, TerminalPlanSupportOptions, ToolCallState, TurnEndReason, WorkspacePlanApplication, accumulateCliTokenUsage, acpContentText, assertSealedNativeHome, assertSealedNativeSearchPath, brokerInteractionTools, buildFileUrl, codexDeveloperInstructionArgs, createExecutionState, createRepeatedToolFailureGuard, deriveFilePart, deterministicFilePartId, directStdioMcpServers, enabledInteractionKinds, executionCorrelationHeaders, finalTextEvent, forgetSessionScopes, homeXdgEnv, inferMediaType, interactionMcpToolName, interactionToggleEnabled, isLocalMcpConfig, isLoopbackEndpoint, isPlainRecord, isTrustedStoreBinary, joinQueue, jsonEventParser, kimiThinkingArgs, localMcpArgv, localMcpEnv, nativeEffortArgs, parseCliUsageLine, partitionImageAttachments, plaintextResponseParser, preparePromptInputParts, prependPromptSection, provenStoreBinary, readCliTokenUsage, readEphemeralContext, reasoningEvents, recordCliTokenUsage, refuseSecretLaunch, rejectNotLaunched, requireRecord, resolveExecutableRealpath, resolveReferences, runtimeSecretsOverlay, secretMcpScope, secretSessionTurnQueue, servableMcpServer, servableStdioServer, sessionObservedEvents, spawnAcpBridge, streamPartBase, textDeltaEvents, textSnapshotEvents, toolResultEvents, toolStartEvents, trackFilePart, trackReasoningBlock, turnEndReason, turnInteractionEnabled, untilSettledOrAborted, wasNeverLaunched, withEphemeralContext, withTurnInteractions };
|
|
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, RepeatedToolFailure, RepeatedToolFailureGuardOptions, RequestPermissionBridge, RequestPlanBridge, SEALED_NATIVE_HOME_LAYOUT, SECRET_REFERENCE, SECRET_REFERENCE_PREFIX, SecretProfileMcpCredentialProxy, SecretProfileMcpLease, SecretProfileMcpServer, SessionRehydrationError, TerminalPlanSupport, TerminalPlanSupportOptions, ToolCallState, TurnEndReason, WorkspacePlanApplication, accumulateCliTokenUsage, acpContentText, assertAcpTurnFinished, assertSealedNativeHome, assertSealedNativeSearchPath, brokerInteractionTools, buildFileUrl, codexDeveloperInstructionArgs, createExecutionState, createRepeatedToolFailureGuard, deriveFilePart, deterministicFilePartId, directStdioMcpServers, enabledInteractionKinds, executionCorrelationHeaders, finalTextEvent, 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, runtimeSecretsOverlay, secretMcpScope, secretSessionTurnQueue, servableMcpServer, servableStdioServer, sessionObservedEvents, spawnAcpBridge, 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 turnInteractionEnabled, A as McpInteractionSupport, At as
|
|
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, SEALED_NATIVE_HOME_LAYOUT, SECRET_REFERENCE, SECRET_REFERENCE_PREFIX, SessionRehydrationError, TerminalPlanSupport, accumulateCliTokenUsage, acpContentText, assertSealedNativeHome, assertSealedNativeSearchPath, brokerInteractionTools, buildFileUrl, codexDeveloperInstructionArgs, createExecutionState, createRepeatedToolFailureGuard, deriveFilePart, deterministicFilePartId, directStdioMcpServers, enabledInteractionKinds, executionCorrelationHeaders, finalTextEvent, forgetSessionScopes, homeXdgEnv, inferMediaType, interactionMcpToolName, interactionToggleEnabled, isLocalMcpConfig, isLoopbackEndpoint, isPlainRecord, isTrustedStoreBinary, joinQueue, jsonEventParser, kimiThinkingArgs, localMcpArgv, localMcpEnv, nativeEffortArgs, parseCliUsageLine, partitionImageAttachments, plaintextResponseParser, preparePromptInputParts, prependPromptSection, provenStoreBinary, readCliTokenUsage, readEphemeralContext, reasoningEvents, recordCliTokenUsage, refuseSecretLaunch, rejectNotLaunched, requireRecord, resolveExecutableRealpath, resolveReferences, runtimeSecretsOverlay, secretMcpScope, secretSessionTurnQueue, servableMcpServer, servableStdioServer, sessionObservedEvents, spawnAcpBridge, streamPartBase, textDeltaEvents, textSnapshotEvents, toolResultEvents, toolStartEvents, trackFilePart, trackReasoningBlock, turnEndReason, turnInteractionEnabled, untilSettledOrAborted, wasNeverLaunched, withEphemeralContext, withTurnInteractions };
|
|
1
|
+
import { $ as turnInteractionEnabled, A as McpInteractionSupport, At as textSnapshotEvents, B as parseCliUsageLine, C as assertSealedNativeHome, Ct as homeXdgEnv, D as resolveExecutableRealpath, Dt as sessionObservedEvents, E as refuseSecretLaunch, Et as reasoningEvents, F as interactionMcpToolName, Ft as ACP_PROTOCOL_VERSION, G as createExecutionState, H as recordCliTokenUsage, I as jsonEventParser, It as acpContentText, J as localMcpEnv, K as isLocalMcpConfig, L as plaintextResponseParser, Lt as assertAcpTurnFinished, M as DEFAULT_INTERACTION_MCP_SERVER_NAME, Mt as toolStartEvents, N as InteractionMcpServer, Nt as trackReasoningBlock, O as kimiThinkingArgs, Ot as streamPartBase, P as brokerInteractionTools, Pt as ACP_MIN_PROTOCOL_VERSION, Q as turnEndReason, R as AcpProviderAdapterBase, Rt as spawnAcpBridge, S as SEALED_NATIVE_HOME_LAYOUT, St as executionCorrelationHeaders, T as provenStoreBinary, Tt as finalTextEvent, U as CliProviderAdapterBase, V as readCliTokenUsage, W as createRepeatedToolFailureGuard, X as interactionToggleEnabled, Y as enabledInteractionKinds, Z as readEphemeralContext, _ as secretSessionTurnQueue, _t as runtimeSecretsOverlay, a as codexDeveloperInstructionArgs, at as partitionImageAttachments, b as untilSettledOrAborted, bt as EXECUTION_TRACE_HEADER, c as SECRET_REFERENCE, ct as buildFileUrl, d as directStdioMcpServers, dt as inferMediaType, et as withEphemeralContext, f as isLoopbackEndpoint, ft as trackFilePart, g as resolveReferences, gt as wasNeverLaunched, h as requireRecord, ht as rejectNotLaunched, i as PERMISSION_DECISION_TIMEOUT_MS, it as PROMPT_SECTION_SEPARATOR, j as TerminalPlanSupport, jt as toolResultEvents, k as nativeEffortArgs, kt as textDeltaEvents, l as SECRET_REFERENCE_PREFIX, lt as deriveFilePart, m as joinQueue, mt as SessionRehydrationError, n as InteractionBroker, nt as MAX_INLINE_IMAGE_BYTES, o as forgetSessionScopes, ot as preparePromptInputParts, p as isPlainRecord, pt as InvalidAttachmentError, q as localMcpArgv, r as InteractionHttpBridge, rt as MAX_TOTAL_INLINE_IMAGE_BYTES, s as secretMcpScope, st as prependPromptSection, t as CODEX_DISABLED_FEATURE_ARGS, tt as withTurnInteractions, u as assertSealedNativeSearchPath, ut as deterministicFilePartId, v as servableMcpServer, vt as EXECUTION_CORRELATION_HEADERS, w as isTrustedStoreBinary, wt as mapAcpSessionUpdate, x as NATIVE_SESSION_CONTRACTS, xt as MANAGED_QUOTE_VERSION_HEADER, y as servableStdioServer, yt as EXECUTION_ID_HEADER, z as accumulateCliTokenUsage } from "./src-DtA6aq0e.mjs";
|
|
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, SEALED_NATIVE_HOME_LAYOUT, SECRET_REFERENCE, SECRET_REFERENCE_PREFIX, SessionRehydrationError, TerminalPlanSupport, accumulateCliTokenUsage, acpContentText, assertAcpTurnFinished, assertSealedNativeHome, assertSealedNativeSearchPath, brokerInteractionTools, buildFileUrl, codexDeveloperInstructionArgs, createExecutionState, createRepeatedToolFailureGuard, deriveFilePart, deterministicFilePartId, directStdioMcpServers, enabledInteractionKinds, executionCorrelationHeaders, finalTextEvent, 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, runtimeSecretsOverlay, secretMcpScope, secretSessionTurnQueue, servableMcpServer, servableStdioServer, sessionObservedEvents, spawnAcpBridge, streamPartBase, textDeltaEvents, textSnapshotEvents, toolResultEvents, toolStartEvents, trackFilePart, trackReasoningBlock, turnEndReason, turnInteractionEnabled, untilSettledOrAborted, wasNeverLaunched, withEphemeralContext, withTurnInteractions };
|
|
@@ -53,6 +53,10 @@ function withAgentEnvironment(env, agent) {
|
|
|
53
53
|
/** The ACP protocol version this client speaks, and the oldest it accepts. */
|
|
54
54
|
const ACP_PROTOCOL_VERSION = 1;
|
|
55
55
|
const ACP_MIN_PROTOCOL_VERSION = 1;
|
|
56
|
+
/** A turn finishes on end_turn or max_tokens; any other stop leaves it unfinished. */
|
|
57
|
+
function assertAcpTurnFinished(provider, stopReason) {
|
|
58
|
+
if (stopReason !== "end_turn" && stopReason !== "max_tokens") throw new Error(`${provider} stopped the turn unfinished (stop reason ${stopReason ?? "missing"}): send the next turn to continue it`);
|
|
59
|
+
}
|
|
56
60
|
/** Text carried by ACP content blocks, including tool-call content. */
|
|
57
61
|
function acpContentText(content) {
|
|
58
62
|
if (!content) return "";
|
|
@@ -288,17 +292,23 @@ function toolResultEvents(state, result) {
|
|
|
288
292
|
}
|
|
289
293
|
//#endregion
|
|
290
294
|
//#region src/acp-session-updates.ts
|
|
295
|
+
const thoughts = /* @__PURE__ */ new WeakMap();
|
|
291
296
|
/** An agent message or thought chunk: text extends the message part, thought joins reasoning. */
|
|
292
297
|
function acpMessageChunkEvents(kind, update, state) {
|
|
293
298
|
const text = acpContentText(update.content);
|
|
294
299
|
if (!text) return [];
|
|
295
|
-
if (kind === "agent_message_chunk")
|
|
296
|
-
|
|
297
|
-
|
|
300
|
+
if (kind === "agent_message_chunk") {
|
|
301
|
+
thoughts.delete(state);
|
|
302
|
+
return textDeltaEvents(state, text);
|
|
303
|
+
}
|
|
304
|
+
const thinking = (thoughts.get(state) ?? "") + text;
|
|
305
|
+
thoughts.set(state, thinking);
|
|
306
|
+
return reasoningEvents(state, thinking, { signalPhase: false });
|
|
298
307
|
}
|
|
299
308
|
/** A new tool call: recorded as running and reported as its tool part. */
|
|
300
309
|
function acpToolCallEvents(update, state) {
|
|
301
310
|
const call = update;
|
|
311
|
+
thoughts.delete(state);
|
|
302
312
|
const name = call.title ?? call.kind ?? "tool";
|
|
303
313
|
return toolStartEvents(state, {
|
|
304
314
|
id: call.toolCallId,
|
|
@@ -312,6 +322,7 @@ function acpToolCallEvents(update, state) {
|
|
|
312
322
|
*/
|
|
313
323
|
function applyAcpToolCallUpdate(existing, mapped, change) {
|
|
314
324
|
const outputText = acpContentText(change.content);
|
|
325
|
+
if (change.rawInput !== void 0) existing.input = change.rawInput;
|
|
315
326
|
if (mapped === "running" && outputText) existing.output = typeof existing.output === "string" ? existing.output + outputText : outputText;
|
|
316
327
|
existing.status = mapped;
|
|
317
328
|
if (mapped === "completed" || mapped === "failed") {
|
|
@@ -370,6 +381,51 @@ function acpPlanEvents(update, state, provider) {
|
|
|
370
381
|
}
|
|
371
382
|
}];
|
|
372
383
|
}
|
|
384
|
+
/** Shared native ACP translation; provider hooks retain their failure policy. */
|
|
385
|
+
function mapAcpSessionUpdate({ update }, state, options) {
|
|
386
|
+
if (!update || typeof update !== "object") return [];
|
|
387
|
+
const kind = update.sessionUpdate;
|
|
388
|
+
if (kind === "agent_message_chunk" || kind === "agent_thought_chunk") return acpMessageChunkEvents(kind, update, state);
|
|
389
|
+
if (kind === "tool_call") return acpToolCallEvents(update, state);
|
|
390
|
+
if (kind === "tool_call_update") {
|
|
391
|
+
const change = update;
|
|
392
|
+
const existing = state.toolCalls.get(change.toolCallId);
|
|
393
|
+
if (!existing) return [];
|
|
394
|
+
let status;
|
|
395
|
+
switch (change.status) {
|
|
396
|
+
case "completed":
|
|
397
|
+
case "failed":
|
|
398
|
+
status = change.status;
|
|
399
|
+
break;
|
|
400
|
+
case "in_progress":
|
|
401
|
+
status = "running";
|
|
402
|
+
break;
|
|
403
|
+
case "pending":
|
|
404
|
+
case void 0:
|
|
405
|
+
status = "pending";
|
|
406
|
+
break;
|
|
407
|
+
default:
|
|
408
|
+
options.onUnknownToolStatus?.(change.status);
|
|
409
|
+
status = "running";
|
|
410
|
+
}
|
|
411
|
+
const text = applyAcpToolCallUpdate(existing, status, change);
|
|
412
|
+
return [...status === "failed" ? options.onToolFailed?.(typeof existing.output === "string" ? existing.output : text || void 0) ?? [] : [], ...acpToolCallUpdateEvents(existing, state)];
|
|
413
|
+
}
|
|
414
|
+
if (kind === "plan") return acpPlanEvents(update, state, options.provider);
|
|
415
|
+
if (kind === "available_commands_update") return [{
|
|
416
|
+
type: "raw",
|
|
417
|
+
backend: options.provider,
|
|
418
|
+
event: {
|
|
419
|
+
sessionUpdate: kind,
|
|
420
|
+
availableCommands: update.availableCommands ?? []
|
|
421
|
+
}
|
|
422
|
+
}];
|
|
423
|
+
return [{
|
|
424
|
+
type: "raw",
|
|
425
|
+
backend: options.provider,
|
|
426
|
+
event: update
|
|
427
|
+
}];
|
|
428
|
+
}
|
|
373
429
|
//#endregion
|
|
374
430
|
//#region src/provider-config.ts
|
|
375
431
|
/**
|
|
@@ -1841,7 +1897,7 @@ var CliAdapterSessions = class extends CliAdapterProfile {
|
|
|
1841
1897
|
* decides here whether a process started earlier can serve it.
|
|
1842
1898
|
*/
|
|
1843
1899
|
mintNativeSessionId(_context) {
|
|
1844
|
-
return randomUUID();
|
|
1900
|
+
return this.sessionContract()?.identity.kind === "pre-minted" ? randomUUID() : void 0;
|
|
1845
1901
|
}
|
|
1846
1902
|
/**
|
|
1847
1903
|
* Make a pre-minted native session durable before the CLI starts, for a
|
|
@@ -3250,7 +3306,7 @@ var CliProviderAdapterBase = class extends CliAdapterMcp {
|
|
|
3250
3306
|
profilePlan
|
|
3251
3307
|
});
|
|
3252
3308
|
const timeoutMs = input.timeoutMs;
|
|
3253
|
-
const mintedSessionId = sessionContract
|
|
3309
|
+
const mintedSessionId = sessionContract && sessionContract.identity.kind !== "first-event" && !providerSessionId ? params.reserveHeldProcess === false ? sessionContract.identity.kind === "pre-minted" ? randomUUID() : void 0 : await this.mintNativeSessionId({
|
|
3254
3310
|
sessionId,
|
|
3255
3311
|
workspaceRoot,
|
|
3256
3312
|
config: executionConfig,
|
|
@@ -3294,7 +3350,7 @@ var CliProviderAdapterBase = class extends CliAdapterMcp {
|
|
|
3294
3350
|
const { workspaceRoot, sessionContract, mintedSessionId } = launch;
|
|
3295
3351
|
const nativeBindStarted = performance.now();
|
|
3296
3352
|
if (mintedSessionId) await this.reserveNativeSession(mintedSessionId, { workspaceRoot });
|
|
3297
|
-
const knownNativeSessionId = sessionContract
|
|
3353
|
+
const knownNativeSessionId = sessionContract && sessionContract.identity.kind !== "first-event" ? mintedSessionId ?? providerSessionId : void 0;
|
|
3298
3354
|
if (knownNativeSessionId) {
|
|
3299
3355
|
observer.onEvent({
|
|
3300
3356
|
type: "native.session.observed",
|
|
@@ -3715,8 +3771,7 @@ var AcpProviderAdapterBase = class extends CliProviderAdapterBase {
|
|
|
3715
3771
|
const recorded = this.takeTurnFailure(sessionId);
|
|
3716
3772
|
if (recorded) throw recorded;
|
|
3717
3773
|
recordCliTokenUsage(state, promptResult);
|
|
3718
|
-
|
|
3719
|
-
if (stop !== "end_turn" && stop !== "max_tokens") throw new Error(`${this.provider} stopped the turn unfinished (stop reason ${stop ?? "missing"}): send the next turn to continue it`);
|
|
3774
|
+
assertAcpTurnFinished(this.provider, promptResult?.stopReason);
|
|
3720
3775
|
onEvent?.({
|
|
3721
3776
|
type: "status",
|
|
3722
3777
|
status: "completed"
|
|
@@ -3966,48 +4021,14 @@ var AcpProviderAdapterBase = class extends CliProviderAdapterBase {
|
|
|
3966
4021
|
for (const [sessionId, entry] of [...this.acpSessions]) if (matches(entry.processKey)) this.evictAcpSession(sessionId, reason);
|
|
3967
4022
|
}
|
|
3968
4023
|
mapAcpUpdate(params, state, sessionId) {
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
if (!existing) return [];
|
|
3978
|
-
const mapped = this.mapToolStatus(change.status);
|
|
3979
|
-
const outputText = applyAcpToolCallUpdate(existing, mapped, change);
|
|
3980
|
-
return [...mapped === "failed" ? this.onToolFailed(sessionId, typeof existing.output === "string" ? existing.output : outputText || void 0) : [], ...acpToolCallUpdateEvents(existing, state)];
|
|
3981
|
-
}
|
|
3982
|
-
if (kind === "plan") return acpPlanEvents(update, state, this.provider);
|
|
3983
|
-
if (kind === "available_commands_update") return [{
|
|
3984
|
-
type: "raw",
|
|
3985
|
-
backend: this.provider,
|
|
3986
|
-
event: {
|
|
3987
|
-
sessionUpdate: "available_commands_update",
|
|
3988
|
-
availableCommands: update.availableCommands ?? []
|
|
3989
|
-
}
|
|
3990
|
-
}];
|
|
3991
|
-
return [{
|
|
3992
|
-
type: "raw",
|
|
3993
|
-
backend: this.provider,
|
|
3994
|
-
event: update
|
|
3995
|
-
}];
|
|
3996
|
-
}
|
|
3997
|
-
mapToolStatus(status) {
|
|
3998
|
-
switch (status) {
|
|
3999
|
-
case "completed": return "completed";
|
|
4000
|
-
case "failed": return "failed";
|
|
4001
|
-
case "in_progress": return "running";
|
|
4002
|
-
case "pending":
|
|
4003
|
-
case void 0: return "pending";
|
|
4004
|
-
default:
|
|
4005
|
-
this.logger.warn(`${this.provider}: unknown tool_call_update status`, {
|
|
4006
|
-
status,
|
|
4007
|
-
mappedTo: "running"
|
|
4008
|
-
});
|
|
4009
|
-
return "running";
|
|
4010
|
-
}
|
|
4024
|
+
return mapAcpSessionUpdate(params, state, {
|
|
4025
|
+
provider: this.provider,
|
|
4026
|
+
onToolFailed: (text) => this.onToolFailed(sessionId, text),
|
|
4027
|
+
onUnknownToolStatus: (status) => this.logger.warn(`${this.provider}: unknown tool_call_update status`, {
|
|
4028
|
+
status,
|
|
4029
|
+
mappedTo: "running"
|
|
4030
|
+
})
|
|
4031
|
+
});
|
|
4011
4032
|
}
|
|
4012
4033
|
formatBridgeError(raw) {
|
|
4013
4034
|
if (raw instanceof BridgeClosedError) return `${this.provider} bridge closed unexpectedly: ${raw.message}`;
|
|
@@ -4299,6 +4320,33 @@ var McpInteractionSupport = class {
|
|
|
4299
4320
|
}
|
|
4300
4321
|
};
|
|
4301
4322
|
//#endregion
|
|
4323
|
+
//#region src/reasoning-effort.ts
|
|
4324
|
+
/** How each CLI takes agent-interface's native control token on its argv. */
|
|
4325
|
+
const EFFORT_FLAG = {
|
|
4326
|
+
"claude-code": (value) => ["--effort", value],
|
|
4327
|
+
codex: (value) => ["-c", `model_reasoning_effort=${value}`],
|
|
4328
|
+
openclaw: (value) => ["--thinking", value],
|
|
4329
|
+
pi: (value) => ["--thinking", value]
|
|
4330
|
+
};
|
|
4331
|
+
/** The argv carrying `nativeReasoningControl` for a profile effort, or none. */
|
|
4332
|
+
function nativeEffortArgs(harness, effort) {
|
|
4333
|
+
const value = nativeReasoningControl(harness, effort ?? null);
|
|
4334
|
+
const flag = EFFORT_FLAG[harness];
|
|
4335
|
+
return value === null || flag === void 0 ? [] : flag(value);
|
|
4336
|
+
}
|
|
4337
|
+
/**
|
|
4338
|
+
* Kimi stays local until #14839: the sandbox ships kimi-cli 1.49.0 as
|
|
4339
|
+
* `kimi-code` (binary `--thinking`/`--no-thinking`) while other paths run
|
|
4340
|
+
* kimi-code 2.x. A model whose name has "thinking" or "reason" always thinks
|
|
4341
|
+
* (kimi-cli `derive_model_capabilities`), so `off` throws there.
|
|
4342
|
+
*/
|
|
4343
|
+
function kimiThinkingArgs(level, modelId) {
|
|
4344
|
+
if (level === void 0) return [];
|
|
4345
|
+
const off = level === "none" || level === "minimal";
|
|
4346
|
+
if (!REASONING_EFFORTS.includes(level) || off && /thinking|reason/i.test(modelId ?? "")) throw new Error(`kimi-code cannot honor reasoning effort "${level}"`);
|
|
4347
|
+
return off ? ["--no-thinking"] : ["--thinking"];
|
|
4348
|
+
}
|
|
4349
|
+
//#endregion
|
|
4302
4350
|
//#region src/secret-native-proof.ts
|
|
4303
4351
|
const proofKey = Symbol.for("tangle.secret-native-binary-proofs");
|
|
4304
4352
|
const runtime$1 = globalThis;
|
|
@@ -4424,33 +4472,6 @@ function refuseSecretLaunch(reason, { path, expected, actual, exitCode } = {}) {
|
|
|
4424
4472
|
throw new Error(detail === "{}" ? reason : `${reason} ${detail}`, { cause: typeof exitCode === "number" || exitCode === null ? { exitCode } : void 0 });
|
|
4425
4473
|
}
|
|
4426
4474
|
//#endregion
|
|
4427
|
-
//#region src/reasoning-effort.ts
|
|
4428
|
-
/** How each CLI takes agent-interface's native control token on its argv. */
|
|
4429
|
-
const EFFORT_FLAG = {
|
|
4430
|
-
"claude-code": (value) => ["--effort", value],
|
|
4431
|
-
codex: (value) => ["-c", `model_reasoning_effort=${value}`],
|
|
4432
|
-
openclaw: (value) => ["--thinking", value],
|
|
4433
|
-
pi: (value) => ["--thinking", value]
|
|
4434
|
-
};
|
|
4435
|
-
/** The argv carrying `nativeReasoningControl` for a profile effort, or none. */
|
|
4436
|
-
function nativeEffortArgs(harness, effort) {
|
|
4437
|
-
const value = nativeReasoningControl(harness, effort ?? null);
|
|
4438
|
-
const flag = EFFORT_FLAG[harness];
|
|
4439
|
-
return value === null || flag === void 0 ? [] : flag(value);
|
|
4440
|
-
}
|
|
4441
|
-
/**
|
|
4442
|
-
* Kimi stays local until #14839: the sandbox ships kimi-cli 1.49.0 as
|
|
4443
|
-
* `kimi-code` (binary `--thinking`/`--no-thinking`) while other paths run
|
|
4444
|
-
* kimi-code 2.x. A model whose name has "thinking" or "reason" always thinks
|
|
4445
|
-
* (kimi-cli `derive_model_capabilities`), so `off` throws there.
|
|
4446
|
-
*/
|
|
4447
|
-
function kimiThinkingArgs(level, modelId) {
|
|
4448
|
-
if (level === void 0) return [];
|
|
4449
|
-
const off = level === "none" || level === "minimal";
|
|
4450
|
-
if (!REASONING_EFFORTS.includes(level) || off && /thinking|reason/i.test(modelId ?? "")) throw new Error(`kimi-code cannot honor reasoning effort "${level}"`);
|
|
4451
|
-
return off ? ["--no-thinking"] : ["--thinking"];
|
|
4452
|
-
}
|
|
4453
|
-
//#endregion
|
|
4454
4475
|
//#region src/secret-profile-mcp.ts
|
|
4455
4476
|
/** Executor-held MCP credentials shared by native private-profile adapters. */
|
|
4456
4477
|
const SECRET_REFERENCE_PREFIX = "TANGLE_PROFILE_SECRET_";
|
|
@@ -4654,6 +4675,6 @@ async function forgetSessionScopes(target) {
|
|
|
4654
4675
|
}
|
|
4655
4676
|
}
|
|
4656
4677
|
//#endregion
|
|
4657
|
-
export { turnInteractionEnabled as $, McpInteractionSupport as A,
|
|
4678
|
+
export { turnInteractionEnabled as $, McpInteractionSupport as A, textSnapshotEvents as At, parseCliUsageLine as B, assertSealedNativeHome as C, homeXdgEnv as Ct, resolveExecutableRealpath as D, sessionObservedEvents as Dt, refuseSecretLaunch as E, reasoningEvents as Et, interactionMcpToolName as F, ACP_PROTOCOL_VERSION as Ft, createExecutionState as G, recordCliTokenUsage as H, jsonEventParser as I, acpContentText as It, localMcpEnv as J, isLocalMcpConfig as K, plaintextResponseParser as L, assertAcpTurnFinished as Lt, DEFAULT_INTERACTION_MCP_SERVER_NAME as M, toolStartEvents as Mt, InteractionMcpServer$1 as N, trackReasoningBlock as Nt, kimiThinkingArgs as O, streamPartBase as Ot, brokerInteractionTools$1 as P, ACP_MIN_PROTOCOL_VERSION as Pt, turnEndReason as Q, AcpProviderAdapterBase as R, spawnAcpBridge as Rt, SEALED_NATIVE_HOME_LAYOUT as S, executionCorrelationHeaders as St, provenStoreBinary as T, finalTextEvent as Tt, CliProviderAdapterBase as U, readCliTokenUsage as V, createRepeatedToolFailureGuard as W, interactionToggleEnabled as X, enabledInteractionKinds as Y, readEphemeralContext as Z, secretSessionTurnQueue as _, runtimeSecretsOverlay as _t, codexDeveloperInstructionArgs as a, partitionImageAttachments as at, untilSettledOrAborted as b, EXECUTION_TRACE_HEADER as bt, SECRET_REFERENCE as c, buildFileUrl as ct, directStdioMcpServers as d, inferMediaType as dt, withEphemeralContext as et, isLoopbackEndpoint as f, trackFilePart as ft, resolveReferences as g, wasNeverLaunched as gt, requireRecord as h, rejectNotLaunched as ht, PERMISSION_DECISION_TIMEOUT_MS as i, PROMPT_SECTION_SEPARATOR as it, TerminalPlanSupport as j, toolResultEvents as jt, nativeEffortArgs as k, textDeltaEvents as kt, SECRET_REFERENCE_PREFIX as l, deriveFilePart as lt, joinQueue as m, SessionRehydrationError as mt, InteractionBroker$1 as n, MAX_INLINE_IMAGE_BYTES as nt, forgetSessionScopes as o, preparePromptInputParts as ot, isPlainRecord as p, InvalidAttachmentError as pt, localMcpArgv as q, InteractionHttpBridge as r, MAX_TOTAL_INLINE_IMAGE_BYTES as rt, secretMcpScope as s, prependPromptSection as st, CODEX_DISABLED_FEATURE_ARGS as t, withTurnInteractions as tt, assertSealedNativeSearchPath as u, deterministicFilePartId as ut, servableMcpServer as v, EXECUTION_CORRELATION_HEADERS as vt, isTrustedStoreBinary as w, mapAcpSessionUpdate as wt, NATIVE_SESSION_CONTRACTS$1 as x, MANAGED_QUOTE_VERSION_HEADER as xt, servableStdioServer as y, EXECUTION_ID_HEADER as yt, accumulateCliTokenUsage as z };
|
|
4658
4679
|
|
|
4659
|
-
//# sourceMappingURL=src-
|
|
4680
|
+
//# sourceMappingURL=src-DtA6aq0e.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.67",
|
|
4
4
|
"description": "Base adapter for CLI-based AI agent providers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.mjs",
|
|
@@ -56,9 +56,9 @@
|
|
|
56
56
|
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
57
57
|
"@tangle-network/agent-core": "^1.0.3",
|
|
58
58
|
"@tangle-network/agent-interface": "^5.10.22",
|
|
59
|
-
"@tangle-network/agent-profile-materialize": "1.1.
|
|
59
|
+
"@tangle-network/agent-profile-materialize": "1.1.102",
|
|
60
60
|
"@tangle-network/agent-trace-contract": "^2.2.0",
|
|
61
|
-
"@tangle-network/cli-agent-registry": "0.15.
|
|
61
|
+
"@tangle-network/cli-agent-registry": "0.15.78",
|
|
62
62
|
"@tangle-network/sdk-cli-runner": "0.3.12",
|
|
63
63
|
"@tangle-network/sdk-session-persistence": "0.7.9",
|
|
64
64
|
"zod": "4.6.7"
|
|
@@ -75,8 +75,8 @@
|
|
|
75
75
|
"registry": "https://registry.npmjs.org"
|
|
76
76
|
},
|
|
77
77
|
"tangleRelease": {
|
|
78
|
-
"sourceSha": "
|
|
79
|
-
"mergedAt": "2026-11-
|
|
78
|
+
"sourceSha": "c4b4ddcb9f7e8b4b416c40026d8c5eb85bbedef5",
|
|
79
|
+
"mergedAt": "2026-11-10T17:06:36-08:00"
|
|
80
80
|
},
|
|
81
81
|
"scripts": {
|
|
82
82
|
"build": "tsdown",
|