@tickernelz/wardmote-adapter-utils 2026.1109.0 → 2026.1111.0
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/README.md +1 -1
- package/dist/acpx-engine/composed-run-characterization.test.js +13 -16
- package/dist/acpx-engine/composed-run-characterization.test.js.map +1 -1
- package/dist/acpx-engine/ephemeral-session-environment.test.js +1 -1
- package/dist/acpx-engine/ephemeral-session-environment.test.js.map +1 -1
- package/dist/acpx-engine/execute-identity.test.js +3 -3
- package/dist/acpx-engine/execute-identity.test.js.map +1 -1
- package/dist/acpx-engine/execute.d.ts +2 -28
- package/dist/acpx-engine/execute.d.ts.map +1 -1
- package/dist/acpx-engine/execute.js +135 -196
- package/dist/acpx-engine/execute.js.map +1 -1
- package/dist/acpx-engine/execute.test.js +171 -187
- package/dist/acpx-engine/execute.test.js.map +1 -1
- package/dist/acpx-engine/filesystem-protocol.test.js +1 -1
- package/dist/acpx-engine/filesystem-protocol.test.js.map +1 -1
- package/dist/acpx-engine/managed-codex-skills-manifest.d.ts +3 -0
- package/dist/acpx-engine/managed-codex-skills-manifest.d.ts.map +1 -0
- package/dist/acpx-engine/managed-codex-skills-manifest.js +30 -0
- package/dist/acpx-engine/managed-codex-skills-manifest.js.map +1 -0
- package/dist/acpx-engine/managed-codex-skills-manifest.test.d.ts +2 -0
- package/dist/acpx-engine/managed-codex-skills-manifest.test.d.ts.map +1 -0
- package/dist/acpx-engine/managed-codex-skills-manifest.test.js +29 -0
- package/dist/acpx-engine/managed-codex-skills-manifest.test.js.map +1 -0
- package/dist/acpx-engine/operator-stop.test.js +1 -1
- package/dist/acpx-engine/operator-stop.test.js.map +1 -1
- package/dist/acpx-engine/remote-spawn-smoke.test.js +5 -5
- package/dist/acpx-engine/remote-spawn-smoke.test.js.map +1 -1
- package/dist/acpx-engine/run-contracts.d.ts +5 -15
- package/dist/acpx-engine/run-contracts.d.ts.map +1 -1
- package/dist/acpx-engine/run-contracts.js.map +1 -1
- package/dist/acpx-engine/run-fault-matrix.test.js +7 -7
- package/dist/acpx-engine/run-fault-matrix.test.js.map +1 -1
- package/dist/acpx-engine/run-site-sandbox.d.ts +5 -12
- package/dist/acpx-engine/run-site-sandbox.d.ts.map +1 -1
- package/dist/acpx-engine/run-site-sandbox.js +4 -16
- package/dist/acpx-engine/run-site-sandbox.js.map +1 -1
- package/dist/acpx-engine/run-site-sandbox.test.js +10 -13
- package/dist/acpx-engine/run-site-sandbox.test.js.map +1 -1
- package/dist/acpx-engine/settlement-characterization.test.js +20 -20
- package/dist/acpx-engine/settlement-characterization.test.js.map +1 -1
- package/dist/acpx-engine/spawn-smoke.test.js +6 -6
- package/dist/acpx-engine/spawn-smoke.test.js.map +1 -1
- package/dist/acpx-engine/startup-characterization.test.js +14 -18
- package/dist/acpx-engine/startup-characterization.test.js.map +1 -1
- package/dist/acpx-engine/startup-timing.d.ts +27 -45
- package/dist/acpx-engine/startup-timing.d.ts.map +1 -1
- package/dist/acpx-engine/startup-timing.js +1 -19
- package/dist/acpx-engine/startup-timing.js.map +1 -1
- package/dist/acpx-engine/turn-characterization.test.js +3 -3
- package/dist/acpx-engine/turn-characterization.test.js.map +1 -1
- package/dist/acpx-engine/turn-sequence.js +1 -1
- package/dist/acpx-engine/turn-sequence.js.map +1 -1
- package/dist/chat-file-delivery.d.ts +2 -2
- package/dist/chat-file-delivery.d.ts.map +1 -1
- package/dist/chat-file-delivery.js +4 -4
- package/dist/chat-file-delivery.js.map +1 -1
- package/dist/chat-file-delivery.test.js +9 -9
- package/dist/chat-file-delivery.test.js.map +1 -1
- package/dist/command-managed-runtime.js +5 -5
- package/dist/command-managed-runtime.js.map +1 -1
- package/dist/command-managed-runtime.test.js +36 -38
- package/dist/command-managed-runtime.test.js.map +1 -1
- package/dist/directory-merge-lock.test.js +1 -1
- package/dist/directory-merge-lock.test.js.map +1 -1
- package/dist/execution-target-sandbox.test.js +259 -267
- package/dist/execution-target-sandbox.test.js.map +1 -1
- package/dist/execution-target-stdin-race.test.js +55 -65
- package/dist/execution-target-stdin-race.test.js.map +1 -1
- package/dist/execution-target.d.ts +6 -36
- package/dist/execution-target.d.ts.map +1 -1
- package/dist/execution-target.js +35 -86
- package/dist/execution-target.js.map +1 -1
- package/dist/execution-target.test.js +1 -1
- package/dist/execution-target.test.js.map +1 -1
- package/dist/forbidden-config-env.test.js +2 -2
- package/dist/forbidden-config-env.test.js.map +1 -1
- package/dist/git-workspace-sync.d.ts +2 -2
- package/dist/git-workspace-sync.d.ts.map +1 -1
- package/dist/git-workspace-sync.js +7 -7
- package/dist/git-workspace-sync.js.map +1 -1
- package/dist/git-workspace-sync.test.js +61 -61
- package/dist/git-workspace-sync.test.js.map +1 -1
- package/dist/github-launcher-environment.test.js +5 -5
- package/dist/github-launcher-environment.test.js.map +1 -1
- package/dist/github-launcher.js +8 -8
- package/dist/github-launcher.test.js +5 -5
- package/dist/github-launcher.test.js.map +1 -1
- package/dist/http2-bridge-server.test.js +1 -1
- package/dist/http2-bridge-server.test.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/local-process-sandbox.js +7 -7
- package/dist/local-process-sandbox.js.map +1 -1
- package/dist/local-process-sandbox.test.js +16 -16
- package/dist/local-process-sandbox.test.js.map +1 -1
- package/dist/mcp-isolation.integration.test.js +4 -4
- package/dist/mcp-isolation.integration.test.js.map +1 -1
- package/dist/prompt-sections.test.js +11 -11
- package/dist/prompt-sections.test.js.map +1 -1
- package/dist/provider-models/claude.d.ts +0 -1
- package/dist/provider-models/claude.d.ts.map +1 -1
- package/dist/provider-models/claude.js +0 -1
- package/dist/provider-models/claude.js.map +1 -1
- package/dist/remote-managed-runtime.js +6 -6
- package/dist/remote-managed-runtime.js.map +1 -1
- package/dist/remote-managed-runtime.test.js +14 -14
- package/dist/remote-managed-runtime.test.js.map +1 -1
- package/dist/retired-marker-names.d.ts +2 -0
- package/dist/retired-marker-names.d.ts.map +1 -0
- package/dist/retired-marker-names.js +2 -0
- package/dist/retired-marker-names.js.map +1 -0
- package/dist/retired-skill-names.d.ts +3 -0
- package/dist/retired-skill-names.d.ts.map +1 -0
- package/dist/retired-skill-names.js +8 -0
- package/dist/retired-skill-names.js.map +1 -0
- package/dist/runner-connectivity.d.ts +5 -5
- package/dist/runner-connectivity.d.ts.map +1 -1
- package/dist/runner-connectivity.js +11 -11
- package/dist/runner-connectivity.js.map +1 -1
- package/dist/runner-connectivity.test.js +21 -21
- package/dist/runner-connectivity.test.js.map +1 -1
- package/dist/runtime-progress.d.ts.map +1 -1
- package/dist/runtime-progress.js +1 -4
- package/dist/runtime-progress.js.map +1 -1
- package/dist/runtime-progress.test.js +13 -13
- package/dist/runtime-progress.test.js.map +1 -1
- package/dist/sandbox-callback-bridge.d.ts +1 -16
- package/dist/sandbox-callback-bridge.d.ts.map +1 -1
- package/dist/sandbox-callback-bridge.js +28 -61
- package/dist/sandbox-callback-bridge.js.map +1 -1
- package/dist/sandbox-callback-bridge.test.js +67 -88
- package/dist/sandbox-callback-bridge.test.js.map +1 -1
- package/dist/sandbox-file-sync.test.js +9 -9
- package/dist/sandbox-file-sync.test.js.map +1 -1
- package/dist/sandbox-managed-runtime.d.ts +0 -30
- package/dist/sandbox-managed-runtime.d.ts.map +1 -1
- package/dist/sandbox-managed-runtime.js +12 -34
- package/dist/sandbox-managed-runtime.js.map +1 -1
- package/dist/sandbox-managed-runtime.test.js +130 -140
- package/dist/sandbox-managed-runtime.test.js.map +1 -1
- package/dist/sandbox-run-log-stream.js +1 -1
- package/dist/sandbox-run-log-stream.js.map +1 -1
- package/dist/server-utils-env.test.js +8 -7
- package/dist/server-utils-env.test.js.map +1 -1
- package/dist/server-utils.d.ts +118 -144
- package/dist/server-utils.d.ts.map +1 -1
- package/dist/server-utils.js +243 -270
- package/dist/server-utils.js.map +1 -1
- package/dist/server-utils.test.js +274 -257
- package/dist/server-utils.test.js.map +1 -1
- package/dist/skill-library-manifest.d.ts +2 -2
- package/dist/skill-library-manifest.d.ts.map +1 -1
- package/dist/skill-library-manifest.test.js +4 -4
- package/dist/skill-library-manifest.test.js.map +1 -1
- package/dist/ssh-fixture.test.js +57 -57
- package/dist/ssh-fixture.test.js.map +1 -1
- package/dist/ssh.d.ts.map +1 -1
- package/dist/ssh.js +16 -38
- package/dist/ssh.js.map +1 -1
- package/dist/test-fixtures/prompt-context.d.ts +5 -5
- package/dist/test-fixtures/prompt-context.js +5 -5
- package/dist/test-fixtures/prompt-context.js.map +1 -1
- package/dist/tool-profile.d.ts +1 -1
- package/dist/tool-profile.d.ts.map +1 -1
- package/dist/tool-profile.js +1 -1
- package/dist/tool-profile.js.map +1 -1
- package/dist/types.d.ts +13 -31
- package/dist/types.d.ts.map +1 -1
- package/dist/wardmote-mcp-mount.d.ts +9 -9
- package/dist/wardmote-mcp-mount.d.ts.map +1 -1
- package/dist/wardmote-mcp-mount.js +9 -9
- package/dist/wardmote-mcp-mount.js.map +1 -1
- package/dist/wardmote-mcp.d.ts +23 -25
- package/dist/wardmote-mcp.d.ts.map +1 -1
- package/dist/wardmote-mcp.js +32 -33
- package/dist/wardmote-mcp.js.map +1 -1
- package/dist/wardmote-mcp.test.js +52 -52
- package/dist/wardmote-mcp.test.js.map +1 -1
- package/dist/wardmote-runner-permissions.d.ts +14 -19
- package/dist/wardmote-runner-permissions.d.ts.map +1 -1
- package/dist/wardmote-runner-permissions.js +8 -13
- package/dist/wardmote-runner-permissions.js.map +1 -1
- package/dist/wardmote-runner-permissions.test.js +32 -32
- package/dist/wardmote-runner-permissions.test.js.map +1 -1
- package/dist/workspace-git-stream.test.js +1 -1
- package/dist/workspace-git-stream.test.js.map +1 -1
- package/dist/workspace-manifest.test.js +3 -3
- package/dist/workspace-manifest.test.js.map +1 -1
- package/dist/workspace-restore-diagnostics.js +1 -1
- package/dist/workspace-restore-diagnostics.js.map +1 -1
- package/dist/workspace-restore-diagnostics.test.js +5 -5
- package/dist/workspace-restore-diagnostics.test.js.map +1 -1
- package/dist/workspace-restore-merge.js +3 -3
- package/dist/workspace-restore-merge.js.map +1 -1
- package/dist/workspace-restore-merge.test.js +50 -56
- package/dist/workspace-restore-merge.test.js.map +1 -1
- package/dist/workspace-restore-result.test.js +2 -2
- package/dist/workspace-restore-result.test.js.map +1 -1
- package/dist/workspace-restore-teardown.test.js +6 -6
- package/dist/workspace-restore-teardown.test.js.map +1 -1
- package/package.json +2 -2
package/dist/execution-target.js
CHANGED
|
@@ -84,9 +84,8 @@ function resolveHostForUrl(rawHost) {
|
|
|
84
84
|
return `[${host}]`;
|
|
85
85
|
return host;
|
|
86
86
|
}
|
|
87
|
-
function
|
|
87
|
+
function resolveDefaultWardmoteApiUrl() {
|
|
88
88
|
const runtimeHost = resolveHostForUrl(process.env.WARDMOTE_LISTEN_HOST ?? process.env.HOST ?? "localhost");
|
|
89
|
-
// 3100 matches the default Paperclip dev server port when the runtime does not provide one.
|
|
90
89
|
const runtimePort = process.env.WARDMOTE_LISTEN_PORT ?? process.env.PORT ?? "3100";
|
|
91
90
|
return `http://${runtimeHost}:${runtimePort}`;
|
|
92
91
|
}
|
|
@@ -172,7 +171,7 @@ export function resolveAdapterExecutionTargetCwd(target, configuredCwd, localFal
|
|
|
172
171
|
}
|
|
173
172
|
return adapterExecutionTargetRemoteCwd(target, localFallbackCwd);
|
|
174
173
|
}
|
|
175
|
-
export function
|
|
174
|
+
export function adapterExecutionTargetUsesWardmoteBridge(target) {
|
|
176
175
|
return target?.kind === "remote";
|
|
177
176
|
}
|
|
178
177
|
export function describeAdapterExecutionTarget(target) {
|
|
@@ -233,10 +232,6 @@ export function formatAdapterExecutionTimeoutErrorMessage(resolution) {
|
|
|
233
232
|
`(timeoutSec=${resolution.timeoutSec}, ${describeAdapterExecutionTimeoutSource(resolution.source)}). ` +
|
|
234
233
|
`Set adapterConfig.timeoutSec to raise it.`);
|
|
235
234
|
}
|
|
236
|
-
/**
|
|
237
|
-
* One-line start-of-run statement of the effective wall-clock timeout and its
|
|
238
|
-
* source. Callers prefix with `[paperclip] ` and append a newline.
|
|
239
|
-
*/
|
|
240
235
|
export function formatAdapterExecutionTimeoutStartLogLine(resolution) {
|
|
241
236
|
if (resolution.timeoutSec <= 0) {
|
|
242
237
|
if (resolution.source === "configured") {
|
|
@@ -385,7 +380,7 @@ function applyRunDispositionSeam(result, settleRunDisposition) {
|
|
|
385
380
|
if (!disposition.failed)
|
|
386
381
|
return result;
|
|
387
382
|
const lossReason = disposition.lossReason ?? "other";
|
|
388
|
-
const note = `[
|
|
383
|
+
const note = `[wardmote] The sandbox duplex control channel was lost (${lossReason}) before the run completed.\n`;
|
|
389
384
|
const separator = result.stderr.length > 0 && !result.stderr.endsWith("\n") ? "\n" : "";
|
|
390
385
|
return {
|
|
391
386
|
...result,
|
|
@@ -682,7 +677,7 @@ export async function ensureAdapterExecutionTargetRuntimeCommandInstalled(input)
|
|
|
682
677
|
if (!recheck.timedOut && recheck.exitCode === 0) {
|
|
683
678
|
if (input.onLog) {
|
|
684
679
|
const reason = result.timedOut ? "timed out" : `exited ${result.exitCode ?? "?"}`;
|
|
685
|
-
await input.onLog("stderr", `[
|
|
680
|
+
await input.onLog("stderr", `[wardmote] Install command ${reason} (${installCommand}) but ${detectCommand} is on PATH; continuing.\n`);
|
|
686
681
|
}
|
|
687
682
|
return;
|
|
688
683
|
}
|
|
@@ -695,16 +690,6 @@ export async function ensureAdapterExecutionTargetRuntimeCommandInstalled(input)
|
|
|
695
690
|
export async function ensureAdapterExecutionTargetFile(runId, target, filePath, options) {
|
|
696
691
|
await runAdapterExecutionTargetShellCommand(runId, target, `mkdir -p ${shellQuote(path.posix.dirname(filePath))} && : > ${shellQuote(filePath)}`, options);
|
|
697
692
|
}
|
|
698
|
-
/**
|
|
699
|
-
* Ensure a working directory exists (and is a directory) on the execution target.
|
|
700
|
-
*
|
|
701
|
-
* For local targets this delegates to the local `ensureAbsoluteDirectory` helper
|
|
702
|
-
* (Node fs). For remote (SSH/sandbox) targets it shells out and runs
|
|
703
|
-
* `mkdir -p` (when allowed) followed by a `[ -d ]` check so the result reflects
|
|
704
|
-
* the directory state inside the environment, not on the Paperclip host.
|
|
705
|
-
*
|
|
706
|
-
* Throws an Error with a human-readable message on failure.
|
|
707
|
-
*/
|
|
708
693
|
export async function ensureAdapterExecutionTargetDirectory(runId, target, cwd, options) {
|
|
709
694
|
const createIfMissing = options.createIfMissing ?? false;
|
|
710
695
|
if (!target || target.kind === "local") {
|
|
@@ -917,7 +902,7 @@ export async function prepareAdapterExecutionTargetRuntime(input) {
|
|
|
917
902
|
};
|
|
918
903
|
}
|
|
919
904
|
export function runtimeAssetDir(prepared, key, fallbackRemoteCwd) {
|
|
920
|
-
return prepared.assetDirs[key] ?? path.posix.join(fallbackRemoteCwd, ".
|
|
905
|
+
return prepared.assetDirs[key] ?? path.posix.join(fallbackRemoteCwd, ".wardmote-runtime", key);
|
|
921
906
|
}
|
|
922
907
|
/** Keep sandbox housekeeping within the producer-owned Runner runtime. */
|
|
923
908
|
export function githubOperationLauncherDirectory(input) {
|
|
@@ -925,8 +910,8 @@ export function githubOperationLauncherDirectory(input) {
|
|
|
925
910
|
if (!/^[a-zA-Z0-9_-]+$/.test(input.runId))
|
|
926
911
|
throw new Error("Invalid GitHub launcher run ID");
|
|
927
912
|
return input.target?.kind === "remote"
|
|
928
|
-
? path.posix.join(input.target.remoteCwd, ".
|
|
929
|
-
: path.join(os.tmpdir(), "
|
|
913
|
+
? path.posix.join(input.target.remoteCwd, ".wardmote-runtime", ...(input.target.transport === "sandbox" ? ["paperclip-runner"] : []), "github", input.runId)
|
|
914
|
+
: path.join(os.tmpdir(), "wardmote-github-runtime", input.runId);
|
|
930
915
|
}
|
|
931
916
|
/** Call only after execution settles, before releasing its remote environment lease. */
|
|
932
917
|
export async function cleanupGitHubOperationLaunchers(input) {
|
|
@@ -1131,12 +1116,7 @@ export async function prepareGitHubOperationLaunchers(input) {
|
|
|
1131
1116
|
}
|
|
1132
1117
|
function buildBridgeResponseHeaders(response) {
|
|
1133
1118
|
const out = {};
|
|
1134
|
-
|
|
1135
|
-
// possibly-committed mutation with the `indeterminate` outcome. The in-sandbox
|
|
1136
|
-
// server reads that header to map the 504 to a terminal 409. If the forward
|
|
1137
|
-
// drops the header, the server keeps the retryable 504 and a caller that
|
|
1138
|
-
// retries 5xx can repeat a mutation that already committed.
|
|
1139
|
-
for (const key of ["content-type", "etag", "last-modified", "x-paperclip-bridge-outcome"]) {
|
|
1119
|
+
for (const key of ["content-type", "etag", "last-modified", "x-wardmote-bridge-outcome"]) {
|
|
1140
1120
|
const value = response.headers.get(key);
|
|
1141
1121
|
if (value && value.trim().length > 0)
|
|
1142
1122
|
out[key] = value.trim();
|
|
@@ -1236,12 +1216,6 @@ async function writeProcessSessionProxyScript(dir, port, token) {
|
|
|
1236
1216
|
await fs.writeFile(proxyPath, getProcessSessionProxySource({ port, token }), { mode: 0o700 });
|
|
1237
1217
|
return proxyPath;
|
|
1238
1218
|
}
|
|
1239
|
-
// Content-hash-skip the process-session remote script write, mirroring the
|
|
1240
|
-
// sandbox callback bridge entrypoint sha256 gate. The script is a static
|
|
1241
|
-
// Paperclip-authored `.mjs` that only changes when the build changes, so on a
|
|
1242
|
-
// warm start (same sandbox, script already present) the single sha-gate exec
|
|
1243
|
-
// skips the ~3-exec base64 upload entirely. `syncRemoteTextFileWithHashSkip`
|
|
1244
|
-
// fails loud on a check error rather than silently re-uploading.
|
|
1245
1219
|
async function syncProcessSessionRemoteScript(input) {
|
|
1246
1220
|
const { uploaded } = await syncRemoteTextFileWithHashSkip({
|
|
1247
1221
|
runner: input.runner,
|
|
@@ -1251,7 +1225,7 @@ async function syncProcessSessionRemoteScript(input) {
|
|
|
1251
1225
|
body: getProcessSessionRemoteSource({ outputToStdout: input.outputToStdout === true }),
|
|
1252
1226
|
label: "Process session remote script",
|
|
1253
1227
|
action: "sync process session remote script",
|
|
1254
|
-
lockDir: path.posix.join(input.remoteScriptDir, ".
|
|
1228
|
+
lockDir: path.posix.join(input.remoteScriptDir, ".wardmote-process-session-script.lock"),
|
|
1255
1229
|
timeoutMs: input.timeoutMs,
|
|
1256
1230
|
shellCommand: input.shellCommand,
|
|
1257
1231
|
});
|
|
@@ -1311,7 +1285,7 @@ export async function startAdapterExecutionTargetProcessSessionBridge(input) {
|
|
|
1311
1285
|
const timeoutMs = typeof input.timeoutSec === "number" && Number.isFinite(input.timeoutSec) && input.timeoutSec > 0
|
|
1312
1286
|
? Math.trunc(input.timeoutSec * 1000)
|
|
1313
1287
|
: target.timeoutMs ?? undefined;
|
|
1314
|
-
const bridgeRuntimeDir = path.posix.join(input.runtimeRootDir?.trim() || path.posix.join(target.remoteCwd, ".
|
|
1288
|
+
const bridgeRuntimeDir = path.posix.join(input.runtimeRootDir?.trim() || path.posix.join(target.remoteCwd, ".wardmote-runtime", input.adapterKey), "process-sessions");
|
|
1315
1289
|
const sessionId = randomUUID();
|
|
1316
1290
|
const sessionDir = path.posix.join(bridgeRuntimeDir, sessionId);
|
|
1317
1291
|
const stdinDir = path.posix.join(sessionDir, "stdin");
|
|
@@ -1339,9 +1313,6 @@ export async function startAdapterExecutionTargetProcessSessionBridge(input) {
|
|
|
1339
1313
|
shellCommand,
|
|
1340
1314
|
outputToStdout: streamOutput,
|
|
1341
1315
|
});
|
|
1342
|
-
// Resolve the launch env AFTER the env-independent setup above, so a caller
|
|
1343
|
-
// can defer it until an upstream dependency (e.g. the paperclip bridge's env)
|
|
1344
|
-
// is ready without blocking the dir/script setup.
|
|
1345
1316
|
const launchEnv = typeof input.env === "function" ? await input.env() : input.env;
|
|
1346
1317
|
const commandPayload = Buffer.from(JSON.stringify({
|
|
1347
1318
|
command: input.command,
|
|
@@ -1391,7 +1362,7 @@ export async function startAdapterExecutionTargetProcessSessionBridge(input) {
|
|
|
1391
1362
|
// event files with the host poll below. The streamed path launches the wrapper
|
|
1392
1363
|
// as one foreground session command further down instead, so skip this.
|
|
1393
1364
|
if (!streamOutput) {
|
|
1394
|
-
await onLog("stdout", `[
|
|
1365
|
+
await onLog("stdout", `[wardmote] Starting ACP process session bridge in sandbox (${target.providerKey ?? "provider"}).\n`);
|
|
1395
1366
|
const startResult = await runSandboxBridgeControlCommand(runner, {
|
|
1396
1367
|
command: shellCommand,
|
|
1397
1368
|
args: shellCommandArgs([
|
|
@@ -1474,11 +1445,11 @@ export async function startAdapterExecutionTargetProcessSessionBridge(input) {
|
|
|
1474
1445
|
"SIGHUP", "SIGINT", "SIGQUIT", "SIGILL", "SIGABRT", "SIGFPE", "SIGKILL",
|
|
1475
1446
|
"SIGSEGV", "SIGPIPE", "SIGALRM", "SIGTERM", "SIGBUS", "SIGXCPU", "SIGXFSZ",
|
|
1476
1447
|
].includes(event.signal) ? event.signal : "unknown";
|
|
1477
|
-
logFailureWithoutWaiting(`[
|
|
1448
|
+
logFailureWithoutWaiting(`[wardmote] ACP process session terminal: source=${source} outcome=${outcome} exitCode=${code} signal=${signal}.\n`);
|
|
1478
1449
|
};
|
|
1479
1450
|
const pendingRemoteEvents = [];
|
|
1480
1451
|
const token = createSandboxCallbackBridgeToken(18);
|
|
1481
|
-
const proxyDir = await fs.mkdtemp(path.join(os.tmpdir(), "
|
|
1452
|
+
const proxyDir = await fs.mkdtemp(path.join(os.tmpdir(), "wardmote-process-session-proxy-"));
|
|
1482
1453
|
// `stop()` waits on this promise, bounded, for the wrapper's `shutdownAck`
|
|
1483
1454
|
// event. `deliverRemoteEvent` resolves it below and never forwards the
|
|
1484
1455
|
// event further: it is a host-internal control ack, not part of the ACP
|
|
@@ -1631,7 +1602,7 @@ export async function startAdapterExecutionTargetProcessSessionBridge(input) {
|
|
|
1631
1602
|
}
|
|
1632
1603
|
// stop() awaits this input chain before sending shutdown. Run-log
|
|
1633
1604
|
// persistence must not hold teardown open when it stalls or fails.
|
|
1634
|
-
logFailureWithoutWaiting(`[
|
|
1605
|
+
logFailureWithoutWaiting(`[wardmote] ${message}\n`);
|
|
1635
1606
|
}
|
|
1636
1607
|
});
|
|
1637
1608
|
}
|
|
@@ -1729,7 +1700,7 @@ export async function startAdapterExecutionTargetProcessSessionBridge(input) {
|
|
|
1729
1700
|
for (const line of text.split(/\n/))
|
|
1730
1701
|
parseFrameLine(line);
|
|
1731
1702
|
};
|
|
1732
|
-
await onLog("stdout", `[
|
|
1703
|
+
await onLog("stdout", `[wardmote] Starting streamed ACP process session bridge in sandbox (${target.providerKey ?? "provider"}).\n`);
|
|
1733
1704
|
// Fire the long-lived command; do NOT await it here. `useSession` forces the
|
|
1734
1705
|
// persistent session so the provider streams the wrapper stdout back through
|
|
1735
1706
|
// `onLog`. On resolve, the terminal re-parse fills any frames the live stream
|
|
@@ -1896,7 +1867,7 @@ export async function startAdapterExecutionTargetProcessSessionBridge(input) {
|
|
|
1896
1867
|
]);
|
|
1897
1868
|
stopReadingForShutdownAck = true;
|
|
1898
1869
|
if (!acknowledgedInTime) {
|
|
1899
|
-
logFailureWithoutWaiting(`[
|
|
1870
|
+
logFailureWithoutWaiting(`[wardmote] ACP process session wrapper did not acknowledge shutdown within ${DEFAULT_PROCESS_SESSION_SHUTDOWN_WAIT_MS}ms; removing the session directory anyway.\n`);
|
|
1900
1871
|
}
|
|
1901
1872
|
// Unconditional: this removal runs whether or not the wrapper
|
|
1902
1873
|
// acknowledged, and whether or not any event (real or forged) arrived
|
|
@@ -2109,7 +2080,7 @@ let probeSeq = 0;
|
|
|
2109
2080
|
// a poll cycle ever lists the directory during the probe's short window.
|
|
2110
2081
|
function nextProbeFileName() {
|
|
2111
2082
|
probeSeq += 1;
|
|
2112
|
-
return ".
|
|
2083
|
+
return ".wardmote-birthtime-probe-" + process.pid + "-" + probeSeq;
|
|
2113
2084
|
}
|
|
2114
2085
|
|
|
2115
2086
|
// Proves a directory's reported birthtimeMs is a real creation time, not a
|
|
@@ -3430,11 +3401,11 @@ async function closeDuplexChannelWithinBudget(channel, budgetMs) {
|
|
|
3430
3401
|
}
|
|
3431
3402
|
let attachmentMaxBytesSource = null;
|
|
3432
3403
|
/** Lets the host supply its live attachment size limit so the bridge body cap follows Instance Settings. */
|
|
3433
|
-
export function
|
|
3404
|
+
export function setWardmoteBridgeAttachmentMaxBytesSource(source) {
|
|
3434
3405
|
attachmentMaxBytesSource = source;
|
|
3435
3406
|
}
|
|
3436
|
-
export async function
|
|
3437
|
-
if (!
|
|
3407
|
+
export async function startAdapterExecutionTargetWardmoteBridge(input) {
|
|
3408
|
+
if (!adapterExecutionTargetUsesWardmoteBridge(input.target)) {
|
|
3438
3409
|
return null;
|
|
3439
3410
|
}
|
|
3440
3411
|
if (!input.target || input.target.kind !== "remote") {
|
|
@@ -3444,7 +3415,7 @@ export async function startAdapterExecutionTargetPaperclipBridge(input) {
|
|
|
3444
3415
|
const onLog = input.onLog ?? (async () => { });
|
|
3445
3416
|
const hostApiToken = input.hostApiToken?.trim() ?? "";
|
|
3446
3417
|
if (hostApiToken.length === 0) {
|
|
3447
|
-
throw new Error("Sandbox bridge mode requires a host-side
|
|
3418
|
+
throw new Error("Sandbox bridge mode requires a host-side Wardmote API token.");
|
|
3448
3419
|
}
|
|
3449
3420
|
// The forward budget for one relayed request. It stays at the broker's default
|
|
3450
3421
|
// forward budget (30 s) when the caller sets no option, so current behavior
|
|
@@ -3452,7 +3423,7 @@ export async function startAdapterExecutionTargetPaperclipBridge(input) {
|
|
|
3452
3423
|
const forwardTimeoutMs = input.forwardTimeoutMs ?? DEFAULT_DUPLEX_BROKER_BUDGETS.forwardTimeoutMs;
|
|
3453
3424
|
const runtimeRootDir = input.runtimeRootDir?.trim().length
|
|
3454
3425
|
? input.runtimeRootDir.trim()
|
|
3455
|
-
: path.posix.join(target.remoteCwd, ".
|
|
3426
|
+
: path.posix.join(target.remoteCwd, ".wardmote-runtime", input.adapterKey);
|
|
3456
3427
|
const bridgeRuntimeDir = path.posix.join(runtimeRootDir, "paperclip-bridge");
|
|
3457
3428
|
const queueDir = path.posix.join(bridgeRuntimeDir, "queue");
|
|
3458
3429
|
const assetRemoteDir = path.posix.join(bridgeRuntimeDir, "server");
|
|
@@ -3466,25 +3437,13 @@ export async function startAdapterExecutionTargetPaperclipBridge(input) {
|
|
|
3466
3437
|
const maxBodyBytes = typeof input.maxBodyBytes === "number" && Number.isFinite(input.maxBodyBytes) && input.maxBodyBytes > 0
|
|
3467
3438
|
? Math.trunc(input.maxBodyBytes)
|
|
3468
3439
|
: defaultBodyBytes;
|
|
3469
|
-
|
|
3470
|
-
// API, so forwarded sandbox calls must target the LOCAL listen origin. The
|
|
3471
|
-
// WARDMOTE_RUNTIME_API_URL / WARDMOTE_API_URL exports now prefer a
|
|
3472
|
-
// configured public base URL, which is the origin browsers and external
|
|
3473
|
-
// agents use; routing this in-process loopback hop through the network edge
|
|
3474
|
-
// breaks deployments whose public origin sits behind a session-gated proxy
|
|
3475
|
-
// (every forwarded agent API call is rejected at the edge). Server boot
|
|
3476
|
-
// exports WARDMOTE_LISTEN_HOST / WARDMOTE_LISTEN_PORT before any run
|
|
3477
|
-
// executes, and resolveDefaultPaperclipApiUrl() maps wildcard listen hosts
|
|
3478
|
-
// to the loopback address of the same family (0.0.0.0 -> 127.0.0.1,
|
|
3479
|
-
// :: -> [::1]), so the fallback is always loopback-reachable.
|
|
3480
|
-
// input.hostApiUrl stays available as an explicit override seam.
|
|
3481
|
-
const hostApiUrl = input.hostApiUrl?.trim() || resolveDefaultPaperclipApiUrl();
|
|
3440
|
+
const hostApiUrl = input.hostApiUrl?.trim() || resolveDefaultWardmoteApiUrl();
|
|
3482
3441
|
const shellCommand = adapterExecutionTargetShellCommand(target);
|
|
3483
3442
|
const runner = adapterExecutionTargetCommandRunner(target);
|
|
3484
3443
|
const bridgeTimeoutMs = typeof input.timeoutSec === "number" && Number.isFinite(input.timeoutSec) && input.timeoutSec > 0
|
|
3485
3444
|
? Math.trunc(input.timeoutSec * 1000)
|
|
3486
3445
|
: adapterExecutionTargetTimeoutMs(target);
|
|
3487
|
-
await onLog("stdout", `[
|
|
3446
|
+
await onLog("stdout", `[wardmote] Starting sandbox callback bridge for ${input.adapterKey} in ${bridgeRuntimeDir}.\n`);
|
|
3488
3447
|
const bridgeAsset = await createSandboxCallbackBridgeAsset();
|
|
3489
3448
|
// The provider-scoped telemetry facade for the fixed duplex observability
|
|
3490
3449
|
// surface. It maps the raw provider key through the allowlist one time, so no
|
|
@@ -3504,11 +3463,6 @@ export async function startAdapterExecutionTargetPaperclipBridge(input) {
|
|
|
3504
3463
|
// those values appear in the host process's stdout when this flag is enabled.
|
|
3505
3464
|
// Only intended for active debugging in trusted environments.
|
|
3506
3465
|
const bridgeDebugEnabled = isBridgeDebugEnabled(process.env);
|
|
3507
|
-
// One forward of a relayed sandbox request onto the existing Paperclip API
|
|
3508
|
-
// path. The forward applies the real host token and the signed run id, so the
|
|
3509
|
-
// token replacement and the run attribution stay in one place for both the
|
|
3510
|
-
// file bridge and the duplex broker. The sandbox request carries only the
|
|
3511
|
-
// bridge token; the real agent token never leaves the host.
|
|
3512
3466
|
const forwardBridgeRequest = async (request, signal, options) => {
|
|
3513
3467
|
const method = request.method.trim().toUpperCase() || "GET";
|
|
3514
3468
|
// The per-request debug log prints the method, the path, and the query. The
|
|
@@ -3516,7 +3470,7 @@ export async function startAdapterExecutionTargetPaperclipBridge(input) {
|
|
|
3516
3470
|
// file path keeps the existing behavior.
|
|
3517
3471
|
const emitDebugLog = bridgeDebugEnabled && options?.suppressDebugLog !== true;
|
|
3518
3472
|
if (emitDebugLog) {
|
|
3519
|
-
await onLog("stdout", `[
|
|
3473
|
+
await onLog("stdout", `[wardmote] Bridge proxy ${method} ${request.path}${request.query ? `?${request.query}` : ""}\n`);
|
|
3520
3474
|
}
|
|
3521
3475
|
const headers = new Headers();
|
|
3522
3476
|
for (const [key, value] of Object.entries(request.headers)) {
|
|
@@ -3525,7 +3479,7 @@ export async function startAdapterExecutionTargetPaperclipBridge(input) {
|
|
|
3525
3479
|
headers.set(key, value);
|
|
3526
3480
|
}
|
|
3527
3481
|
headers.set("authorization", `Bearer ${hostApiToken}`);
|
|
3528
|
-
headers.set("x-
|
|
3482
|
+
headers.set("x-wardmote-run-id", input.runId);
|
|
3529
3483
|
// Abort the forward when the caller aborts the request (its per-iteration
|
|
3530
3484
|
// timeout or watchdog fired, or the broker's forward budget ended), or after
|
|
3531
3485
|
// the forward budget here, whichever comes first.
|
|
@@ -3548,7 +3502,7 @@ export async function startAdapterExecutionTargetPaperclipBridge(input) {
|
|
|
3548
3502
|
}
|
|
3549
3503
|
const response = await fetch(buildBridgeForwardUrl(hostApiUrl, request), forwardInit);
|
|
3550
3504
|
if (emitDebugLog) {
|
|
3551
|
-
await onLog("stdout", `[
|
|
3505
|
+
await onLog("stdout", `[wardmote] Bridge proxy response ${response.status} for ${method} ${request.path}${request.query ? `?${request.query}` : ""}\n`);
|
|
3552
3506
|
}
|
|
3553
3507
|
// The host delivered response headers, so the response-body read starts after
|
|
3554
3508
|
// the host processed the request. A later response-body read failure (a body
|
|
@@ -3597,7 +3551,7 @@ export async function startAdapterExecutionTargetPaperclipBridge(input) {
|
|
|
3597
3551
|
status: 504,
|
|
3598
3552
|
headers: {
|
|
3599
3553
|
"content-type": "application/json",
|
|
3600
|
-
"x-
|
|
3554
|
+
"x-wardmote-bridge-outcome": "indeterminate",
|
|
3601
3555
|
},
|
|
3602
3556
|
body: Buffer.from(JSON.stringify({
|
|
3603
3557
|
error: error instanceof Error ? error.message : String(error),
|
|
@@ -3707,7 +3661,7 @@ export async function startAdapterExecutionTargetPaperclipBridge(input) {
|
|
|
3707
3661
|
? "entrypoint_sync_failed"
|
|
3708
3662
|
: "channel_open_failed";
|
|
3709
3663
|
duplexChannelOpen.fallback(reason);
|
|
3710
|
-
await onLog("stderr", `[
|
|
3664
|
+
await onLog("stderr", `[wardmote] Could not open the sandbox duplex channel (${reason}). Using the file bridge.\n`);
|
|
3711
3665
|
channel = null;
|
|
3712
3666
|
}
|
|
3713
3667
|
if (channel) {
|
|
@@ -3725,7 +3679,7 @@ export async function startAdapterExecutionTargetPaperclipBridge(input) {
|
|
|
3725
3679
|
gate.disposePendingReplay();
|
|
3726
3680
|
await closeDuplexChannelWithinBudget(channel, DEFAULT_DUPLEX_CLEANUP_BUDGET_MS);
|
|
3727
3681
|
duplexChannelOpen.fallback(duplexReadinessFallbackReason(readiness.reason));
|
|
3728
|
-
await onLog("stderr", `[
|
|
3682
|
+
await onLog("stderr", `[wardmote] Sandbox duplex readiness failed (${readiness.reason}). Using the file bridge.\n`);
|
|
3729
3683
|
}
|
|
3730
3684
|
else {
|
|
3731
3685
|
// Readiness passed. The gate retained every byte that followed the
|
|
@@ -3749,7 +3703,7 @@ export async function startAdapterExecutionTargetPaperclipBridge(input) {
|
|
|
3749
3703
|
gate.disposePendingReplay();
|
|
3750
3704
|
await closeDuplexChannelWithinBudget(openedChannel, DEFAULT_DUPLEX_CLEANUP_BUDGET_MS);
|
|
3751
3705
|
duplexChannelOpen.fallback("preface_missing");
|
|
3752
|
-
await onLog("stderr", "[
|
|
3706
|
+
await onLog("stderr", "[wardmote] Sandbox HTTP/2 client preface did not appear inside the bounded readiness buffer (preface_missing). Using the file bridge.\n");
|
|
3753
3707
|
}
|
|
3754
3708
|
else {
|
|
3755
3709
|
// The run disposition latch for the http2_v1 path, in the same
|
|
@@ -3772,7 +3726,7 @@ export async function startAdapterExecutionTargetPaperclipBridge(input) {
|
|
|
3772
3726
|
}
|
|
3773
3727
|
const lossClass = anyStreamDispatched ? "post_dispatch" : "pre_dispatch";
|
|
3774
3728
|
duplexObservability.recordLoss(lossClass, reason);
|
|
3775
|
-
void onLog("stderr", `[
|
|
3729
|
+
void onLog("stderr", `[wardmote] Sandbox HTTP/2 channel lost (${reason}). The run fails.\n`);
|
|
3776
3730
|
};
|
|
3777
3731
|
// The forward handler applies the real host token and the run id
|
|
3778
3732
|
// through the existing `forwardBridgeRequest` — the same function
|
|
@@ -3846,7 +3800,7 @@ export async function startAdapterExecutionTargetPaperclipBridge(input) {
|
|
|
3846
3800
|
// reaches `recordHttp2Loss` the same way any other write fault does.
|
|
3847
3801
|
boundDuplex.on("error", () => recordHttp2Loss("write_error"));
|
|
3848
3802
|
duplexChannelOpen.ready();
|
|
3849
|
-
await onLog("stdout", "[
|
|
3803
|
+
await onLog("stdout", "[wardmote] Sandbox HTTP/2 transport ready; serving the host-assigned origin.\n");
|
|
3850
3804
|
// Stream run logs on the http2 path with the same gate and the same
|
|
3851
3805
|
// log line as the file path. The http2 path starts no file-bridge
|
|
3852
3806
|
// worker, so create the log directory before the tail starts.
|
|
@@ -3866,7 +3820,7 @@ export async function startAdapterExecutionTargetPaperclipBridge(input) {
|
|
|
3866
3820
|
logsDir: duplexLogsDir,
|
|
3867
3821
|
shellCommand,
|
|
3868
3822
|
});
|
|
3869
|
-
await onLog("stdout", "[
|
|
3823
|
+
await onLog("stdout", "[wardmote] Sandbox run log streaming enabled for this run.\n");
|
|
3870
3824
|
}
|
|
3871
3825
|
return {
|
|
3872
3826
|
env: {
|
|
@@ -3904,11 +3858,6 @@ export async function startAdapterExecutionTargetPaperclipBridge(input) {
|
|
|
3904
3858
|
timeoutMs: bridgeTimeoutMs,
|
|
3905
3859
|
shellCommand,
|
|
3906
3860
|
});
|
|
3907
|
-
// `startSandboxCallbackBridgeWorker` keeps its awaited queue-directory
|
|
3908
|
-
// setup on the active `bridge.paperclip` step, and runs each request under
|
|
3909
|
-
// the run parent context (see `runWithRuntimeParent` inside that function).
|
|
3910
|
-
// So the startup `mkdir` execs stay parented to the step, and every later
|
|
3911
|
-
// request `sandbox.exec` span parents to the live run span.
|
|
3912
3861
|
worker = await startSandboxCallbackBridgeWorker({
|
|
3913
3862
|
client,
|
|
3914
3863
|
queueDir,
|
|
@@ -3948,7 +3897,7 @@ export async function startAdapterExecutionTargetPaperclipBridge(input) {
|
|
|
3948
3897
|
logsDir: sandboxCallbackBridgeDirectories(queueDir).logsDir,
|
|
3949
3898
|
shellCommand,
|
|
3950
3899
|
});
|
|
3951
|
-
await onLog("stdout", "[
|
|
3900
|
+
await onLog("stdout", "[wardmote] Sandbox run log streaming enabled for this run.\n");
|
|
3952
3901
|
}
|
|
3953
3902
|
return {
|
|
3954
3903
|
env: {
|