@tangle-network/sdk-provider-cli-base 0.13.1 → 0.13.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -891,9 +891,12 @@ declare function plaintextResponseParser<TEvent>(state: ExecutionState, onEvent:
891
891
  }): StreamParserConfig<TEvent>;
892
892
  //#endregion
893
893
  //#region src/execution-request-headers.d.ts
894
+ declare const EXECUTION_ID_HEADER = "X-Tangle-Execution-ID";
894
895
  /** Router column that joins a model request to the turn trace that caused it. */
895
896
  declare const EXECUTION_TRACE_HEADER = "X-Tangle-Trace-ID";
896
897
  declare const MANAGED_QUOTE_VERSION_HEADER = "X-Tangle-Managed-Quote-Version";
898
+ /** Every header a turn's correlation may set, lowercased. */
899
+ declare const EXECUTION_CORRELATION_HEADERS: string[];
897
900
  /**
898
901
  * Capture diagnostic identity without forwarding caller-supplied transport headers.
899
902
  * `traceId` is the turn's trace id; a value no header can carry is omitted,
@@ -1244,5 +1247,5 @@ declare function homeXdgEnv(home: string): {
1244
1247
  XDG_STATE_HOME: string;
1245
1248
  };
1246
1249
  //#endregion
1247
- export { ACP_MIN_PROTOCOL_VERSION, ACP_PROTOCOL_VERSION, AcpBridgeConfig, type AcpBridgeSpawn, AcpContentBlock, AcpInitializeParams, AcpInitializeResult, AcpNewSessionResult, type AcpProcessSpec, AcpPromptResult, AcpProviderAdapterBase, AcpSessionUpdateParams, AcpTurn, type AskUserBridge, CODEX_DISABLED_FEATURE_ARGS, CliExecArgs, CliExecutionInput, CliProviderAdapterBase, CliProviderConfig, CliProviderLogger, CliProviderOptions, type CliTurnProcess, type CliTurnSpawn, DEFAULT_INTERACTION_MCP_SERVER_NAME, EXECUTION_TRACE_HEADER, EphemeralContextInput, ExecutionState, type 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, type PermissionPromptBridge, PlaintextResponse, PreparedAttachment, type PreparedCliLaunch, RepeatedToolFailure, RepeatedToolFailureGuardOptions, type RequestPermissionBridge, type RequestPlanBridge, SEALED_NATIVE_HOME_LAYOUT, SECRET_REFERENCE, SECRET_REFERENCE_PREFIX, SecretProfileMcpCredentialProxy, SecretProfileMcpServer, SessionRehydrationError, TerminalPlanSupport, TerminalPlanSupportOptions, ToolCallState, TurnEndReason, type WorkspacePlanApplication, accumulateCliTokenUsage, acpContentText, assertSealedNativeHome, assertSealedNativeSearchPath, brokerInteractionTools, buildFileUrl, codexDeveloperInstructionArgs, createExecutionState, createRepeatedToolFailureGuard, deriveFilePart, deterministicFilePartId, 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 };
1250
+ export { ACP_MIN_PROTOCOL_VERSION, ACP_PROTOCOL_VERSION, AcpBridgeConfig, type AcpBridgeSpawn, AcpContentBlock, AcpInitializeParams, AcpInitializeResult, AcpNewSessionResult, type AcpProcessSpec, AcpPromptResult, AcpProviderAdapterBase, AcpSessionUpdateParams, AcpTurn, type AskUserBridge, CODEX_DISABLED_FEATURE_ARGS, CliExecArgs, CliExecutionInput, CliProviderAdapterBase, CliProviderConfig, CliProviderLogger, CliProviderOptions, type CliTurnProcess, type CliTurnSpawn, DEFAULT_INTERACTION_MCP_SERVER_NAME, EXECUTION_CORRELATION_HEADERS, EXECUTION_ID_HEADER, EXECUTION_TRACE_HEADER, EphemeralContextInput, ExecutionState, type 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, type PermissionPromptBridge, PlaintextResponse, PreparedAttachment, type PreparedCliLaunch, RepeatedToolFailure, RepeatedToolFailureGuardOptions, type RequestPermissionBridge, type RequestPlanBridge, SEALED_NATIVE_HOME_LAYOUT, SECRET_REFERENCE, SECRET_REFERENCE_PREFIX, SecretProfileMcpCredentialProxy, SecretProfileMcpServer, SessionRehydrationError, TerminalPlanSupport, TerminalPlanSupportOptions, ToolCallState, TurnEndReason, type WorkspacePlanApplication, accumulateCliTokenUsage, acpContentText, assertSealedNativeHome, assertSealedNativeSearchPath, brokerInteractionTools, buildFileUrl, codexDeveloperInstructionArgs, createExecutionState, createRepeatedToolFailureGuard, deriveFilePart, deterministicFilePartId, 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 };
1248
1251
  //# sourceMappingURL=index.d.mts.map
package/dist/index.mjs CHANGED
@@ -13,6 +13,7 @@ import { execFile } from "node:child_process";
13
13
  import { isDeepStrictEqual, promisify } from "node:util";
14
14
  import { messageStorageDirOf } from "@tangle-network/cli-agent-registry";
15
15
  import { NATIVE_SESSION_CONTRACTS, NATIVE_SESSION_CONTRACTS as NATIVE_SESSION_CONTRACTS$1, configDirHomeEnv } from "@tangle-network/cli-agent-registry/native-session-contracts";
16
+ import * as W3C from "@tangle-network/agent-trace-contract";
16
17
  import { z } from "zod";
17
18
  import { fileURLToPath, pathToFileURL } from "node:url";
18
19
  import { DatabaseSync } from "node:sqlite";
@@ -954,14 +955,22 @@ async function terminateTurnProcess(process, activeProcesses) {
954
955
  //#endregion
955
956
  //#region src/execution-request-headers.ts
956
957
  const headerValue = z.string().regex(/^[\x21-\x2b\x2d-\x7e]{1,256}$/);
958
+ const EXECUTION_ID_HEADER = "X-Tangle-Execution-ID";
957
959
  const CORRELATION_FIELDS = {
958
960
  "X-Tangle-Environment-ID": "environmentId",
959
961
  "X-Tangle-Session-ID": "sessionId",
960
- "X-Tangle-Execution-ID": "executionId"
962
+ [EXECUTION_ID_HEADER]: "executionId"
961
963
  };
962
964
  /** Router column that joins a model request to the turn trace that caused it. */
963
965
  const EXECUTION_TRACE_HEADER = "X-Tangle-Trace-ID";
964
966
  const MANAGED_QUOTE_VERSION_HEADER = "X-Tangle-Managed-Quote-Version";
967
+ /** Every header a turn's correlation may set, lowercased. */
968
+ const EXECUTION_CORRELATION_HEADERS = [
969
+ ...Object.keys(CORRELATION_FIELDS),
970
+ EXECUTION_TRACE_HEADER,
971
+ MANAGED_QUOTE_VERSION_HEADER,
972
+ "traceparent"
973
+ ].map((name) => name.toLowerCase());
965
974
  const managedQuoteVersion = z.string().regex(/^mmq_[a-f0-9]{40}$/);
966
975
  /**
967
976
  * Capture diagnostic identity without forwarding caller-supplied transport headers.
@@ -969,12 +978,16 @@ const managedQuoteVersion = z.string().regex(/^mmq_[a-f0-9]{40}$/);
969
978
  * because a trace is diagnostic and must never refuse the run.
970
979
  */
971
980
  function executionCorrelationHeaders(binding, traceId, quoteVersion) {
972
- const quote = quoteVersion === void 0 ? void 0 : managedQuoteVersion.parse(quoteVersion);
981
+ const quote = managedQuoteVersion.optional().parse(quoteVersion);
973
982
  if (quote !== void 0 && binding === void 0) throw new Error("Managed quote requires an exact execution binding");
974
983
  const trace = headerValue.safeParse(traceId);
975
- const traced = trace.success ? { [EXECUTION_TRACE_HEADER]: trace.data } : {};
976
- if (binding === void 0) return trace.success ? Object.freeze(traced) : void 0;
977
- const headers = { ...traced };
984
+ const headers = {};
985
+ if (trace.success) {
986
+ headers[EXECUTION_TRACE_HEADER] = trace.data;
987
+ const span = W3C.toW3CSpanId(`${trace.data}:sidecar`);
988
+ headers.traceparent = `00-${W3C.toW3CTraceId(trace.data)}-${span}-01`;
989
+ }
990
+ if (binding === void 0) return trace.success ? Object.freeze(headers) : void 0;
978
991
  if (quote !== void 0) headers[MANAGED_QUOTE_VERSION_HEADER] = quote;
979
992
  for (const [name, field] of Object.entries(CORRELATION_FIELDS)) {
980
993
  const value = headerValue.safeParse(binding[field]);
@@ -1526,7 +1539,7 @@ var CliAdapterProfile = class extends CliAdapterLifecycle {
1526
1539
  }, toolBinDirs, [...parseSandboxToolBinDirs(env.SANDBOX_TOOL_BIN_DIRS), ...parseSandboxToolBinDirs(process.env.SANDBOX_TOOL_BIN_DIRS)]);
1527
1540
  }
1528
1541
  bindExecutionCorrelation(environment, correlationHeaders) {
1529
- if (correlationHeaders !== void 0 && Object.keys(correlationHeaders).some((name) => name !== "X-Tangle-Trace-ID")) this.logger.warn("Native model request correlation is unsupported", { provider: this.provider });
1542
+ if (correlationHeaders?.["X-Tangle-Execution-ID"] !== void 0) this.logger.warn("Native model request correlation is unsupported", { provider: this.provider });
1530
1543
  return environment;
1531
1544
  }
1532
1545
  /** Launcher controls this adapter OWNS on the spawn it starts — see `BINDABLE_LAUNCH_CONTROLS` in the materializer. */
@@ -3355,7 +3368,7 @@ var CliProviderAdapterBase = class extends CliAdapterMcp {
3355
3368
  sessionId,
3356
3369
  providerSessionId: options.providerSessionId,
3357
3370
  executionSignal: input.abortSignal ?? new AbortController().signal,
3358
- correlationHeaders: executionCorrelationHeaders(input.interactionBinding, input.traceId, void 0),
3371
+ correlationHeaders: executionCorrelationHeaders(input.interactionBinding, input.traceId),
3359
3372
  executionProfile,
3360
3373
  profilePlan,
3361
3374
  attachments: preparedInput.attachments,
@@ -4556,6 +4569,6 @@ async function forgetSessionScopes(target) {
4556
4569
  }
4557
4570
  }
4558
4571
  //#endregion
4559
- export { ACP_MIN_PROTOCOL_VERSION, ACP_PROTOCOL_VERSION, AcpProviderAdapterBase, CODEX_DISABLED_FEATURE_ARGS, CliProviderAdapterBase, DEFAULT_INTERACTION_MCP_SERVER_NAME, 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, 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 };
4572
+ 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, 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 };
4560
4573
 
4561
4574
  //# sourceMappingURL=index.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.1",
3
+ "version": "0.13.3",
4
4
  "description": "Base adapter for CLI-based AI agent providers",
5
5
  "type": "module",
6
6
  "main": "./dist/index.mjs",
@@ -24,8 +24,9 @@
24
24
  "@modelcontextprotocol/sdk": "^1.32.1",
25
25
  "@tangle-network/agent-core": "^1.0.0",
26
26
  "@tangle-network/agent-interface": "^5.10.13",
27
- "@tangle-network/agent-profile-materialize": "1.1.25",
28
- "@tangle-network/cli-agent-registry": "0.15.1",
27
+ "@tangle-network/agent-profile-materialize": "1.1.26",
28
+ "@tangle-network/agent-trace-contract": "^2.2.0",
29
+ "@tangle-network/cli-agent-registry": "0.15.2",
29
30
  "@tangle-network/sdk-cli-runner": "0.3.6",
30
31
  "@tangle-network/sdk-session-persistence": "0.7.2",
31
32
  "zod": "4.6.6"
@@ -42,8 +43,8 @@
42
43
  "registry": "https://registry.npmjs.org"
43
44
  },
44
45
  "tangleRelease": {
45
- "sourceSha": "40d962aa0db50ba5bf53f55ac724694e1b13acde",
46
- "mergedAt": "2026-11-02T10:03:01-08:00"
46
+ "sourceSha": "410434944bcd4ddf514b3374f92cc9d2cfc8997a",
47
+ "mergedAt": "2026-11-03T10:05:22-08:00"
47
48
  },
48
49
  "scripts": {
49
50
  "build": "tsdown",