@tangle-network/sdk-provider-cli-base 0.13.107 → 0.13.108
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.mjs +1 -1
- package/dist/adapters/exo/index.mjs +1 -1
- package/dist/adapters/factory-droids/index.mjs +1 -1
- package/dist/adapters/grok/index.mjs +1 -1
- package/dist/adapters/hermes/index.mjs +1 -1
- package/dist/adapters/nanoclaw/index.mjs +1 -1
- package/dist/adapters/nanocode/index.mjs +1 -1
- package/dist/adapters/openclaw/index.mjs +1 -1
- package/dist/adapters/prime/index.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{src-CHtyVoNN.mjs → src-BVg56gUM.mjs} +128 -127
- package/package.json +3 -3
|
@@ -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, L as jsonEventParser, Rt as textDeltaEvents, U as recordCliTokenUsage, Vt as toolStartEvents, W as CliProviderAdapterBase, nt as localMcpEnv, tt as localMcpArgv } from "../../src-BVg56gUM.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 { It as sessionObservedEvents, R as plaintextResponseParser, W as CliProviderAdapterBase } from "../../src-BVg56gUM.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 { Bt as toolResultEvents, Ft as reasoningEvents, It as sessionObservedEvents,
|
|
1
|
+
import { Bt as toolResultEvents, Ft as reasoningEvents, It as sessionObservedEvents, L as jsonEventParser, Lt as streamPartBase, Rt as textDeltaEvents, U as recordCliTokenUsage, Vt as toolStartEvents, W as CliProviderAdapterBase, et as isLocalMcpConfig, j as McpInteractionSupport, lt as withTurnInteractions, nt as localMcpEnv, rt as enabledInteractionKinds, tt as localMcpArgv } from "../../src-BVg56gUM.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 { It as sessionObservedEvents, R as plaintextResponseParser, W as CliProviderAdapterBase, ht as prependPromptSection } from "../../src-BVg56gUM.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 { It as sessionObservedEvents, R as plaintextResponseParser, U as recordCliTokenUsage, W as CliProviderAdapterBase, et as isLocalMcpConfig, ht as prependPromptSection, nt as localMcpEnv, pt as partitionImageAttachments, tt as localMcpArgv } from "../../src-BVg56gUM.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 { It as sessionObservedEvents, R as plaintextResponseParser, U as recordCliTokenUsage, V as parseCliUsageLine, W as CliProviderAdapterBase, ht as prependPromptSection } from "../../src-BVg56gUM.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 { It as sessionObservedEvents, R as plaintextResponseParser, W as CliProviderAdapterBase, ht as prependPromptSection } from "../../src-BVg56gUM.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 {
|
|
1
|
+
import { A as nativeEffortArgs, It as sessionObservedEvents, Pt as finalTextEvent, U as recordCliTokenUsage, W as CliProviderAdapterBase, ht as prependPromptSection } from "../../src-BVg56gUM.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 { ht as prependPromptSection, qt as spawnAcpBridge, z as AcpProviderAdapterBase } from "../../src-BVg56gUM.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";
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as createExecutionState, A as
|
|
1
|
+
import { $ as createExecutionState, A as nativeEffortArgs, At as MANAGED_QUOTE_VERSION_HEADER, B as accumulateCliTokenUsage, Bt as toolResultEvents, C as spawnUnderSecretMcpLease, Ct as failureAfterCleanup, D as resolveRouterModelLimits, Dt as EXECUTION_CORRELATION_HEADERS, E as findRouterCatalogEntry, Et as runtimeSecretsOverlay, F as brokerInteractionTools, Ft as reasoningEvents, G as createRepeatedToolFailureGuard, Gt as acpContentText, H as readCliTokenUsage, Ht as trackReasoningBlock, I as interactionMcpToolName, It as sessionObservedEvents, J as assertSealedNativeHome, K as NATIVE_SESSION_CONTRACTS, Kt as assertAcpTurnFinished, L as jsonEventParser, Lt as streamPartBase, M as TerminalPlanSupport, Mt as homeXdgEnv, N as DEFAULT_INTERACTION_MCP_SERVER_NAME, Nt as mapAcpSessionUpdate, O as resolveRouterModelReasoningEfforts, Ot as EXECUTION_ID_HEADER, P as InteractionMcpServer, Pt as finalTextEvent, Q as resolveExecutableRealpath, R as plaintextResponseParser, Rt as textDeltaEvents, S as sharedSecretMcpRefused, St as SessionRehydrationError, T as ROUTER_MODEL_CATALOG_TIMEOUT_MS, Tt as wasNeverLaunched, U as recordCliTokenUsage, Ut as ACP_MIN_PROTOCOL_VERSION, V as parseCliUsageLine, Vt as toolStartEvents, W as CliProviderAdapterBase, Wt as ACP_PROTOCOL_VERSION, X as provenStoreBinary, Y as isTrustedStoreBinary, Z as refuseSecretLaunch, _ as requireRecord, _t as deriveFilePart, a as SECRET_REFERENCE, at as readEphemeralContext, b as servableMcpServer, bt as trackFilePart, c as forgetSessionScopes, ct as withEphemeralContext, d as assertSealedNativeSearchPath, dt as MAX_TOTAL_INLINE_IMAGE_BYTES, et as isLocalMcpConfig, f as directStdioMcpServers, ft as PROMPT_SECTION_SEPARATOR, g as joinQueue, gt as buildFileUrl, h as isPlainRecord, ht as prependPromptSection, i as PERMISSION_DECISION_TIMEOUT_MS, it as interactionToggleEnabled, j as McpInteractionSupport, jt as executionCorrelationHeaders, k as kimiThinkingArgs, kt as EXECUTION_TRACE_HEADER, l as secretMcpScope, lt as withTurnInteractions, m as isLoopbackEndpoint, mt as preparePromptInputParts, n as InteractionBroker, nt as localMcpEnv, o as SECRET_REFERENCE_PREFIX, ot as turnEndReason, p as exposedStdioServer, pt as partitionImageAttachments, q as SEALED_NATIVE_HOME_LAYOUT, qt as spawnAcpBridge, r as InteractionHttpBridge, rt as enabledInteractionKinds, s as codexDeveloperInstructionArgs, st as turnInteractionEnabled, t as CODEX_DISABLED_FEATURE_ARGS, tt as localMcpArgv, u as SHARED_WORKSPACE_DIR_ENV, ut as MAX_INLINE_IMAGE_BYTES, v as resolveReferences, vt as deterministicFilePartId, w as untilSettledOrAborted, wt as rejectNotLaunched, x as servableStdioServer, xt as InvalidAttachmentError, y as secretSessionTurnQueue, yt as inferMediaType, z as AcpProviderAdapterBase, zt as textSnapshotEvents } from "./src-BVg56gUM.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 };
|
|
@@ -2424,6 +2424,131 @@ function createExecutionState(sessionId, messageId, workspaceRoot) {
|
|
|
2424
2424
|
};
|
|
2425
2425
|
}
|
|
2426
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 });
|
|
2550
|
+
}
|
|
2551
|
+
//#endregion
|
|
2427
2552
|
//#region src/session-preparation.ts
|
|
2428
2553
|
async function prepareExecutionSession(context, input) {
|
|
2429
2554
|
let sessionId = input.sessionId;
|
|
@@ -3570,6 +3695,7 @@ var CliProviderAdapterBase = class extends CliAdapterMcp {
|
|
|
3570
3695
|
this.ensureInitialized();
|
|
3571
3696
|
const sessionId = input.sessionId ?? randomUUID();
|
|
3572
3697
|
const { executionProfile, profilePlan } = await this.materializeTurnProfile(input, sessionId);
|
|
3698
|
+
if (Object.keys(this.secretProfileReferences(profilePlan) ?? {}).length > 0) refuseSecretLaunch("Prepared launch cannot hold a profile secret MCP lease; use execute instead");
|
|
3573
3699
|
const workspaceRoot = input.workspaceRoot ?? this.storagePath;
|
|
3574
3700
|
const preparedInput = await this.preparePromptInput(normalizeInputParts(input), workspaceRoot, sessionId);
|
|
3575
3701
|
const promptText = this.composePromptText(preparedInput.promptText, input);
|
|
@@ -4558,131 +4684,6 @@ async function resolveRouterModelLimits(input) {
|
|
|
4558
4684
|
};
|
|
4559
4685
|
}
|
|
4560
4686
|
//#endregion
|
|
4561
|
-
//#region src/secret-native-proof.ts
|
|
4562
|
-
const proofKey = Symbol.for("tangle.secret-native-binary-proofs");
|
|
4563
|
-
const runtime$1 = globalThis;
|
|
4564
|
-
const proven = runtime$1[proofKey] ?? /* @__PURE__ */ new Set();
|
|
4565
|
-
runtime$1[proofKey] = proven;
|
|
4566
|
-
/** Prove an immutable executable, under the launch's own identity and environment. */
|
|
4567
|
-
async function provenStoreBinary(expected, config) {
|
|
4568
|
-
if (!config.isolatedIdentity || config.inheritEnv !== false) refuseSecretLaunch("Secret native binary proof requires an isolated identity and environment", { path: config.command });
|
|
4569
|
-
const command = resolveExecutableRealpath(config.command, config.env?.PATH);
|
|
4570
|
-
if (!command || !isTrustedStoreBinary(command)) refuseSecretLaunch("Secret native launch requires a root-owned Nix store binary", { path: command ?? config.command });
|
|
4571
|
-
const key = `${command}\0${expected}`;
|
|
4572
|
-
if (proven.has(key)) return command;
|
|
4573
|
-
const probe = await execCli({
|
|
4574
|
-
command,
|
|
4575
|
-
cwd: config.cwd,
|
|
4576
|
-
env: config.env,
|
|
4577
|
-
inheritEnv: config.inheritEnv,
|
|
4578
|
-
signal: config.signal,
|
|
4579
|
-
isolatedIdentity: config.isolatedIdentity,
|
|
4580
|
-
args: ["--version"],
|
|
4581
|
-
spawnOptions: config.isolatedIdentity,
|
|
4582
|
-
timeoutMs: 15e3
|
|
4583
|
-
});
|
|
4584
|
-
const version = probe.stdout?.trim();
|
|
4585
|
-
if (!probe.exit.success || version !== expected) refuseSecretLaunch(`Secret native launch expected ${expected} at ${command}, received no matching version`, { exitCode: probe.exit.code });
|
|
4586
|
-
proven.add(key);
|
|
4587
|
-
return command;
|
|
4588
|
-
}
|
|
4589
|
-
/** A reported version alone cannot establish an immutable executable. */
|
|
4590
|
-
function isTrustedStoreBinary(realpath) {
|
|
4591
|
-
if (!realpath.startsWith("/nix/store/")) return false;
|
|
4592
|
-
try {
|
|
4593
|
-
for (const path of [realpath, dirname(realpath)]) {
|
|
4594
|
-
const stat = fs$1.lstatSync(path);
|
|
4595
|
-
if (stat.uid !== 0 || (stat.mode & 18) !== 0) return false;
|
|
4596
|
-
}
|
|
4597
|
-
return true;
|
|
4598
|
-
} catch {
|
|
4599
|
-
return false;
|
|
4600
|
-
}
|
|
4601
|
-
}
|
|
4602
|
-
/** The real file a launch of `command` executes under `pathEnv`. */
|
|
4603
|
-
function resolveExecutableRealpath(command, pathEnv) {
|
|
4604
|
-
if (command.includes("/") && !isAbsolute(command)) return void 0;
|
|
4605
|
-
const candidates = command.includes("/") ? [command] : (pathEnv ?? "").split(":").filter(isAbsolute).map((dir) => join(dir, command));
|
|
4606
|
-
for (const candidate of candidates) try {
|
|
4607
|
-
fs$1.accessSync(candidate, fs$1.constants.X_OK);
|
|
4608
|
-
if (fs$1.statSync(candidate).isFile()) return fs$1.realpathSync(candidate);
|
|
4609
|
-
} catch {}
|
|
4610
|
-
}
|
|
4611
|
-
const SEALED_NATIVE_HOME_LAYOUT = {
|
|
4612
|
-
codex: [
|
|
4613
|
-
[
|
|
4614
|
-
".",
|
|
4615
|
-
1016,
|
|
4616
|
-
true
|
|
4617
|
-
],
|
|
4618
|
-
[
|
|
4619
|
-
".codex",
|
|
4620
|
-
1016,
|
|
4621
|
-
true
|
|
4622
|
-
],
|
|
4623
|
-
[
|
|
4624
|
-
".agents",
|
|
4625
|
-
360,
|
|
4626
|
-
true
|
|
4627
|
-
],
|
|
4628
|
-
[
|
|
4629
|
-
".codex/skills",
|
|
4630
|
-
360,
|
|
4631
|
-
true
|
|
4632
|
-
],
|
|
4633
|
-
[
|
|
4634
|
-
".codex/rules",
|
|
4635
|
-
360,
|
|
4636
|
-
true
|
|
4637
|
-
],
|
|
4638
|
-
[
|
|
4639
|
-
".codex/config.toml",
|
|
4640
|
-
288,
|
|
4641
|
-
false
|
|
4642
|
-
],
|
|
4643
|
-
[
|
|
4644
|
-
".codex/AGENTS.md",
|
|
4645
|
-
288,
|
|
4646
|
-
false
|
|
4647
|
-
],
|
|
4648
|
-
[
|
|
4649
|
-
".codex/AGENTS.override.md",
|
|
4650
|
-
288,
|
|
4651
|
-
false
|
|
4652
|
-
],
|
|
4653
|
-
[
|
|
4654
|
-
".codex/hooks.json",
|
|
4655
|
-
288,
|
|
4656
|
-
false
|
|
4657
|
-
]
|
|
4658
|
-
],
|
|
4659
|
-
opencode: [[
|
|
4660
|
-
".",
|
|
4661
|
-
456,
|
|
4662
|
-
true
|
|
4663
|
-
], [
|
|
4664
|
-
".opencode",
|
|
4665
|
-
360,
|
|
4666
|
-
true
|
|
4667
|
-
]]
|
|
4668
|
-
};
|
|
4669
|
-
function assertSealedNativeHome(home, gid, layout) {
|
|
4670
|
-
for (const [relative, mode, directory] of layout) {
|
|
4671
|
-
const path = join(home, relative);
|
|
4672
|
-
const stat = fs$1.lstatSync(path);
|
|
4673
|
-
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()}`);
|
|
4674
|
-
}
|
|
4675
|
-
}
|
|
4676
|
-
/** Only selected structural facts enter a refusal; payloads and causes never do. */
|
|
4677
|
-
function refuseSecretLaunch(reason, { path, expected, actual, exitCode } = {}) {
|
|
4678
|
-
const detail = JSON.stringify({
|
|
4679
|
-
path,
|
|
4680
|
-
expected,
|
|
4681
|
-
actual
|
|
4682
|
-
}).slice(0, 768);
|
|
4683
|
-
throw new Error(detail === "{}" ? reason : `${reason} ${detail}`, { cause: typeof exitCode === "number" || exitCode === null ? { exitCode } : void 0 });
|
|
4684
|
-
}
|
|
4685
|
-
//#endregion
|
|
4686
4687
|
//#region src/secret-profile-mcp.ts
|
|
4687
4688
|
function requireRecord(raw, message) {
|
|
4688
4689
|
return isRecord(raw) ? raw : refuseSecretLaunch(message);
|
|
@@ -4942,6 +4943,6 @@ async function forgetSessionScopes(target) {
|
|
|
4942
4943
|
}
|
|
4943
4944
|
}
|
|
4944
4945
|
//#endregion
|
|
4945
|
-
export { createExecutionState as $,
|
|
4946
|
+
export { createExecutionState as $, nativeEffortArgs as A, MANAGED_QUOTE_VERSION_HEADER as At, accumulateCliTokenUsage as B, toolResultEvents as Bt, spawnUnderSecretMcpLease as C, failureAfterCleanup as Ct, resolveRouterModelLimits as D, EXECUTION_CORRELATION_HEADERS as Dt, findRouterCatalogEntry as E, runtimeSecretsOverlay as Et, brokerInteractionTools$1 as F, reasoningEvents as Ft, createRepeatedToolFailureGuard as G, acpContentText as Gt, readCliTokenUsage as H, trackReasoningBlock as Ht, interactionMcpToolName as I, sessionObservedEvents as It, assertSealedNativeHome as J, NATIVE_SESSION_CONTRACTS$1 as K, assertAcpTurnFinished as Kt, jsonEventParser as L, streamPartBase as Lt, TerminalPlanSupport as M, homeXdgEnv as Mt, DEFAULT_INTERACTION_MCP_SERVER_NAME as N, mapAcpSessionUpdate as Nt, resolveRouterModelReasoningEfforts as O, EXECUTION_ID_HEADER as Ot, InteractionMcpServer$1 as P, finalTextEvent as Pt, resolveExecutableRealpath as Q, plaintextResponseParser as R, textDeltaEvents as Rt, sharedSecretMcpRefused as S, SessionRehydrationError as St, ROUTER_MODEL_CATALOG_TIMEOUT_MS as T, wasNeverLaunched as Tt, recordCliTokenUsage as U, ACP_MIN_PROTOCOL_VERSION as Ut, parseCliUsageLine as V, toolStartEvents as Vt, CliProviderAdapterBase as W, ACP_PROTOCOL_VERSION as Wt, provenStoreBinary as X, isTrustedStoreBinary as Y, refuseSecretLaunch as Z, requireRecord as _, deriveFilePart as _t, SECRET_REFERENCE$1 as a, readEphemeralContext as at, servableMcpServer as b, trackFilePart as bt, forgetSessionScopes as c, withEphemeralContext as ct, assertSealedNativeSearchPath as d, MAX_TOTAL_INLINE_IMAGE_BYTES as dt, isLocalMcpConfig as et, directStdioMcpServers as f, PROMPT_SECTION_SEPARATOR as ft, joinQueue as g, buildFileUrl as gt, isPlainRecord as h, prependPromptSection as ht, PERMISSION_DECISION_TIMEOUT_MS as i, interactionToggleEnabled as it, McpInteractionSupport as j, executionCorrelationHeaders as jt, kimiThinkingArgs as k, EXECUTION_TRACE_HEADER as kt, secretMcpScope as l, withTurnInteractions as lt, isLoopbackEndpoint as m, preparePromptInputParts as mt, InteractionBroker$1 as n, localMcpEnv as nt, SECRET_REFERENCE_PREFIX as o, turnEndReason as ot, exposedStdioServer as p, partitionImageAttachments as pt, SEALED_NATIVE_HOME_LAYOUT as q, spawnAcpBridge as qt, InteractionHttpBridge as r, enabledInteractionKinds as rt, codexDeveloperInstructionArgs as s, turnInteractionEnabled as st, CODEX_DISABLED_FEATURE_ARGS as t, localMcpArgv as tt, SHARED_WORKSPACE_DIR_ENV as u, MAX_INLINE_IMAGE_BYTES as ut, resolveReferences as v, deterministicFilePartId as vt, untilSettledOrAborted as w, rejectNotLaunched as wt, servableStdioServer as x, InvalidAttachmentError as xt, secretSessionTurnQueue as y, inferMediaType as yt, AcpProviderAdapterBase as z, textSnapshotEvents as zt };
|
|
4946
4947
|
|
|
4947
|
-
//# sourceMappingURL=src-
|
|
4948
|
+
//# sourceMappingURL=src-BVg56gUM.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.108",
|
|
4
4
|
"description": "Base adapter for CLI-based AI agent providers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.mjs",
|
|
@@ -79,8 +79,8 @@
|
|
|
79
79
|
"registry": "https://registry.npmjs.org"
|
|
80
80
|
},
|
|
81
81
|
"tangleRelease": {
|
|
82
|
-
"sourceSha": "
|
|
83
|
-
"mergedAt": "2026-11-16T19:
|
|
82
|
+
"sourceSha": "cf28db313cb28826df29ab6638c4953327a94349",
|
|
83
|
+
"mergedAt": "2026-11-16T19:57:07-08:00"
|
|
84
84
|
},
|
|
85
85
|
"scripts": {
|
|
86
86
|
"build": "tsdown",
|