@tickernelz/wardmote-adapter-utils 2026.1108.1 → 2026.1109.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/dist/acpx-engine/ephemeral-session-environment.test.js +5 -5
- package/dist/acpx-engine/ephemeral-session-environment.test.js.map +1 -1
- package/dist/acpx-engine/execute-identity.test.js +11 -11
- package/dist/acpx-engine/execute-identity.test.js.map +1 -1
- package/dist/acpx-engine/execute.d.ts.map +1 -1
- package/dist/acpx-engine/execute.js +39 -40
- package/dist/acpx-engine/execute.js.map +1 -1
- package/dist/acpx-engine/execute.test.js +78 -78
- 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/operator-stop.test.js +2 -2
- package/dist/acpx-engine/operator-stop.test.js.map +1 -1
- package/dist/acpx-engine/run-site-sandbox.test.js +3 -3
- package/dist/acpx-engine/run-site-sandbox.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 +13 -13
- package/dist/acpx-engine/startup-characterization.test.js.map +1 -1
- package/dist/acpx-engine/startup-timing.test.js +2 -2
- package/dist/acpx-engine/startup-timing.test.js.map +1 -1
- package/dist/acpx-engine/terminal-session-failure.js +1 -1
- package/dist/acpx-engine/terminal-session-failure.js.map +1 -1
- package/dist/command-managed-runtime.test.js +2 -2
- package/dist/command-managed-runtime.test.js.map +1 -1
- package/dist/directory-merge-lock.test.js +2 -2
- package/dist/directory-merge-lock.test.js.map +1 -1
- package/dist/execution-target-sandbox.test.js +102 -102
- package/dist/execution-target-sandbox.test.js.map +1 -1
- package/dist/execution-target-stdin-race.test.js +25 -25
- package/dist/execution-target-stdin-race.test.js.map +1 -1
- package/dist/execution-target.d.ts.map +1 -1
- package/dist/execution-target.js +59 -60
- package/dist/execution-target.js.map +1 -1
- package/dist/execution-target.test.js +2 -2
- package/dist/execution-target.test.js.map +1 -1
- package/dist/forbidden-config-env.test.d.ts +2 -0
- package/dist/forbidden-config-env.test.d.ts.map +1 -0
- package/dist/forbidden-config-env.test.js +35 -0
- package/dist/forbidden-config-env.test.js.map +1 -0
- package/dist/git-workspace-sync.js +1 -1
- package/dist/git-workspace-sync.js.map +1 -1
- package/dist/github-launcher-environment.test.js +31 -31
- package/dist/github-launcher-environment.test.js.map +1 -1
- package/dist/github-launcher.js +9 -9
- package/dist/github-launcher.js.map +1 -1
- package/dist/index.d.ts +3 -3
- 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.test.js +8 -8
- package/dist/local-process-sandbox.test.js.map +1 -1
- package/dist/provider-models/codex.d.ts.map +1 -1
- package/dist/provider-models/codex.js +2 -2
- package/dist/provider-models/codex.js.map +1 -1
- package/dist/run-oom-score.d.ts +1 -1
- package/dist/run-oom-score.d.ts.map +1 -1
- package/dist/run-oom-score.js +1 -1
- package/dist/run-oom-score.js.map +1 -1
- package/dist/runner-connectivity.d.ts +2 -2
- package/dist/runner-connectivity.d.ts.map +1 -1
- package/dist/runner-connectivity.js +5 -5
- package/dist/runner-connectivity.js.map +1 -1
- package/dist/sandbox-callback-bridge.js +27 -27
- package/dist/sandbox-callback-bridge.js.map +1 -1
- package/dist/sandbox-callback-bridge.test.js +27 -27
- package/dist/sandbox-callback-bridge.test.js.map +1 -1
- package/dist/sandbox-install-command.js +4 -4
- package/dist/sandbox-install-command.js.map +1 -1
- package/dist/sandbox-managed-runtime.test.js +4 -4
- package/dist/sandbox-managed-runtime.test.js.map +1 -1
- package/dist/sandbox-run-log-stream.js +4 -4
- package/dist/sandbox-run-log-stream.js.map +1 -1
- package/dist/server-utils-env.test.js +2 -2
- package/dist/server-utils-env.test.js.map +1 -1
- package/dist/server-utils.d.ts +5 -5
- package/dist/server-utils.d.ts.map +1 -1
- package/dist/server-utils.js +87 -87
- package/dist/server-utils.js.map +1 -1
- package/dist/server-utils.test.js +75 -75
- package/dist/server-utils.test.js.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.js +2 -2
- package/dist/ssh.js.map +1 -1
- package/dist/test-support/mcp-isolation-harness.js +1 -1
- package/dist/test-support/mcp-isolation-harness.js.map +1 -1
- package/dist/{paperclip-mcp-mount.d.ts → wardmote-mcp-mount.d.ts} +1 -1
- package/dist/wardmote-mcp-mount.d.ts.map +1 -0
- package/dist/{paperclip-mcp-mount.js → wardmote-mcp-mount.js} +10 -10
- package/dist/wardmote-mcp-mount.js.map +1 -0
- package/dist/{paperclip-mcp.d.ts → wardmote-mcp.d.ts} +9 -9
- package/dist/wardmote-mcp.d.ts.map +1 -0
- package/dist/{paperclip-mcp.js → wardmote-mcp.js} +36 -36
- package/dist/wardmote-mcp.js.map +1 -0
- package/dist/wardmote-mcp.test.d.ts +2 -0
- package/dist/wardmote-mcp.test.d.ts.map +1 -0
- package/dist/{paperclip-mcp.test.js → wardmote-mcp.test.js} +14 -14
- package/dist/wardmote-mcp.test.js.map +1 -0
- package/dist/{paperclip-runner-permissions.d.ts → wardmote-runner-permissions.d.ts} +18 -18
- package/dist/wardmote-runner-permissions.d.ts.map +1 -0
- package/dist/{paperclip-runner-permissions.js → wardmote-runner-permissions.js} +22 -22
- package/dist/wardmote-runner-permissions.js.map +1 -0
- package/dist/wardmote-runner-permissions.test.d.ts +2 -0
- package/dist/wardmote-runner-permissions.test.d.ts.map +1 -0
- package/dist/{paperclip-runner-permissions.test.js → wardmote-runner-permissions.test.js} +7 -7
- package/dist/wardmote-runner-permissions.test.js.map +1 -0
- package/dist/workspace-manifest.js +1 -1
- package/dist/workspace-manifest.js.map +1 -1
- package/dist/workspace-manifest.test.js +2 -2
- package/dist/workspace-manifest.test.js.map +1 -1
- package/dist/workspace-restore-merge.js +5 -5
- package/dist/workspace-restore-merge.js.map +1 -1
- package/dist/workspace-restore-merge.test.js +27 -27
- package/dist/workspace-restore-merge.test.js.map +1 -1
- package/node_modules/@clack/core/dist/index.d.mts +5 -3
- package/node_modules/@clack/core/dist/index.mjs +70 -67
- package/node_modules/@clack/core/package.json +3 -2
- package/node_modules/@clack/prompts/dist/index.d.mts +5 -4
- package/node_modules/@clack/prompts/dist/index.mjs +212 -187
- package/node_modules/@clack/prompts/package.json +3 -3
- package/node_modules/sisteransi/dist/index.d.ts +33 -0
- package/node_modules/sisteransi/dist/index.js +57 -0
- package/node_modules/sisteransi/package.json +18 -7
- package/node_modules/sisteransi/readme.md +19 -6
- package/package.json +2 -2
- package/dist/env-aliases-run.test.d.ts +0 -2
- package/dist/env-aliases-run.test.d.ts.map +0 -1
- package/dist/env-aliases-run.test.js +0 -49
- package/dist/env-aliases-run.test.js.map +0 -1
- package/dist/paperclip-mcp-mount.d.ts.map +0 -1
- package/dist/paperclip-mcp-mount.js.map +0 -1
- package/dist/paperclip-mcp.d.ts.map +0 -1
- package/dist/paperclip-mcp.js.map +0 -1
- package/dist/paperclip-mcp.test.d.ts +0 -2
- package/dist/paperclip-mcp.test.d.ts.map +0 -1
- package/dist/paperclip-mcp.test.js.map +0 -1
- package/dist/paperclip-runner-permissions.d.ts.map +0 -1
- package/dist/paperclip-runner-permissions.js.map +0 -1
- package/dist/paperclip-runner-permissions.test.d.ts +0 -2
- package/dist/paperclip-runner-permissions.test.d.ts.map +0 -1
- package/dist/paperclip-runner-permissions.test.js.map +0 -1
- package/node_modules/sisteransi/src/index.js +0 -58
- package/node_modules/sisteransi/src/sisteransi.d.ts +0 -35
|
@@ -104,11 +104,11 @@ describe("sandbox adapter execution targets", () => {
|
|
|
104
104
|
}
|
|
105
105
|
function encodeTailTick(stdout, stderr) {
|
|
106
106
|
return [
|
|
107
|
-
"
|
|
107
|
+
"__WARDMOTE_RUN_LOG_STDOUT__",
|
|
108
108
|
stdout.toString("base64"),
|
|
109
|
-
"
|
|
109
|
+
"__WARDMOTE_RUN_LOG_STDERR__",
|
|
110
110
|
stderr.toString("base64"),
|
|
111
|
-
"
|
|
111
|
+
"__WARDMOTE_RUN_LOG_END__",
|
|
112
112
|
"",
|
|
113
113
|
].join("\n");
|
|
114
114
|
}
|
|
@@ -231,7 +231,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
231
231
|
timeoutMs: 30_000, runner: createLocalSandboxRunner(),
|
|
232
232
|
};
|
|
233
233
|
const challenge = randomBytes(32);
|
|
234
|
-
const result = await runAdapterExecutionTargetProcess("identity-remote", target, process.execPath, ["-e", `const {sign}=require('node:crypto');process.stdout.write(sign(null,Buffer.from(process.argv[1],'hex'),process.env.
|
|
234
|
+
const result = await runAdapterExecutionTargetProcess("identity-remote", target, process.execPath, ["-e", `const {sign}=require('node:crypto');process.stdout.write(sign(null,Buffer.from(process.argv[1],'hex'),process.env.WARDMOTE_AGENT_PRIVATE_KEY).toString('base64'));`, challenge.toString("hex")], {
|
|
235
235
|
cwd: rootDir, env: buildAgentIdentityEnv(identity), timeoutSec: 5, graceSec: 1, onLog: async () => { },
|
|
236
236
|
});
|
|
237
237
|
expect(result.exitCode).toBe(0);
|
|
@@ -434,7 +434,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
434
434
|
if (strings.some((text) => Buffer.byteLength(text) >= 131_072)) {
|
|
435
435
|
return { exitCode: 127, stdout: "", stderr: "argument list too long: env\n", timedOut: false, signal: null, pid: null, startedAt: null };
|
|
436
436
|
}
|
|
437
|
-
if (input.env?.
|
|
437
|
+
if (input.env?.WARDMOTE_PROCESS_SESSION_DIR || input.args?.[1]?.includes("nohup node")) {
|
|
438
438
|
const sessionRoot = path.join(runtimeRootDir, "process-sessions");
|
|
439
439
|
const entries = await readdir(sessionRoot, { withFileTypes: true });
|
|
440
440
|
const sessionDir = path.join(sessionRoot, entries.find((entry) => entry.isDirectory()).name);
|
|
@@ -530,7 +530,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
530
530
|
target: {
|
|
531
531
|
kind: "remote", transport: "sandbox", providerKey: "local-test", remoteCwd: rootDir,
|
|
532
532
|
runner: { execute: async (input) => {
|
|
533
|
-
if (input.env?.
|
|
533
|
+
if (input.env?.WARDMOTE_PROCESS_SESSION_DIR || input.args?.[1]?.includes("nohup node")) {
|
|
534
534
|
const sessionRoot = path.join(rootDir, "process-sessions");
|
|
535
535
|
const entries = await readdir(sessionRoot, { withFileTypes: true });
|
|
536
536
|
const payloadPath = path.join(sessionRoot, entries.find((entry) => entry.isDirectory()).name, "command.b64");
|
|
@@ -2257,12 +2257,12 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2257
2257
|
});
|
|
2258
2258
|
try {
|
|
2259
2259
|
expect(bridge).not.toBeNull();
|
|
2260
|
-
expect(bridge?.env.
|
|
2261
|
-
expect(bridge?.env.
|
|
2262
|
-
expect(bridge?.env.
|
|
2263
|
-
const response = await fetch(`${bridge.env.
|
|
2260
|
+
expect(bridge?.env.WARDMOTE_API_URL).toMatch(/^http:\/\/127\.0\.0\.1:\d+$/);
|
|
2261
|
+
expect(bridge?.env.WARDMOTE_API_KEY).not.toBe("real-run-jwt");
|
|
2262
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("queue_v1");
|
|
2263
|
+
const response = await fetch(`${bridge.env.WARDMOTE_API_URL}/api/agents/me`, {
|
|
2264
2264
|
headers: {
|
|
2265
|
-
authorization: `Bearer ${bridge.env.
|
|
2265
|
+
authorization: `Bearer ${bridge.env.WARDMOTE_API_KEY}`,
|
|
2266
2266
|
accept: "application/json",
|
|
2267
2267
|
},
|
|
2268
2268
|
});
|
|
@@ -2413,7 +2413,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2413
2413
|
expect(runner.execute).toHaveBeenCalledWith(expect.objectContaining({
|
|
2414
2414
|
command: "sh",
|
|
2415
2415
|
cwd: "/workspace",
|
|
2416
|
-
env: {
|
|
2416
|
+
env: { WARDMOTE_SANDBOX_EXEC_CHANNEL: "bridge" },
|
|
2417
2417
|
timeoutMs: 50,
|
|
2418
2418
|
}));
|
|
2419
2419
|
});
|
|
@@ -2534,14 +2534,14 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2534
2534
|
try {
|
|
2535
2535
|
expect(bridge).not.toBeNull();
|
|
2536
2536
|
const shellProbe = [
|
|
2537
|
-
"const url = `${process.env.
|
|
2538
|
-
"fetch(url, { headers: { authorization: `Bearer ${process.env.
|
|
2537
|
+
"const url = `${process.env.WARDMOTE_API_URL}/api/agents/me`;",
|
|
2538
|
+
"fetch(url, { headers: { authorization: `Bearer ${process.env.WARDMOTE_API_KEY}`, accept: 'application/json' } })",
|
|
2539
2539
|
" .then(async (response) => {",
|
|
2540
2540
|
" const body = await response.json();",
|
|
2541
2541
|
" process.stdout.write(JSON.stringify({",
|
|
2542
2542
|
" status: response.status,",
|
|
2543
2543
|
" body,",
|
|
2544
|
-
" bridgeMode: process.env.
|
|
2544
|
+
" bridgeMode: process.env.WARDMOTE_API_BRIDGE_MODE,",
|
|
2545
2545
|
" }));",
|
|
2546
2546
|
" })",
|
|
2547
2547
|
" .catch((error) => {",
|
|
@@ -2564,16 +2564,16 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2564
2564
|
bridgeMode: "queue_v1",
|
|
2565
2565
|
});
|
|
2566
2566
|
expect(`${result.stdout}\n${result.stderr}`).not.toContain("real-run-jwt");
|
|
2567
|
-
expect(`${result.stdout}\n${result.stderr}`).not.toContain(bridge.env.
|
|
2567
|
+
expect(`${result.stdout}\n${result.stderr}`).not.toContain(bridge.env.WARDMOTE_API_KEY);
|
|
2568
2568
|
const runnerCommandText = JSON.stringify(runner.execute.mock.calls.map(([call]) => ({
|
|
2569
2569
|
command: call.command,
|
|
2570
2570
|
args: call.args,
|
|
2571
2571
|
})));
|
|
2572
2572
|
expect(runnerCommandText).not.toContain("real-run-jwt");
|
|
2573
|
-
expect(runnerCommandText).not.toContain(bridge.env.
|
|
2573
|
+
expect(runnerCommandText).not.toContain(bridge.env.WARDMOTE_API_KEY);
|
|
2574
2574
|
const runtimeFiles = (await readRuntimeTextFiles(runtimeRootDir)).join("\n");
|
|
2575
2575
|
expect(runtimeFiles).not.toContain("real-run-jwt");
|
|
2576
|
-
expect(runtimeFiles).not.toContain(bridge.env.
|
|
2576
|
+
expect(runtimeFiles).not.toContain(bridge.env.WARDMOTE_API_KEY);
|
|
2577
2577
|
expect(requests).toEqual([{
|
|
2578
2578
|
method: "GET",
|
|
2579
2579
|
url: "/api/agents/me",
|
|
@@ -2699,10 +2699,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2699
2699
|
maxBodyBytes: 512,
|
|
2700
2700
|
});
|
|
2701
2701
|
try {
|
|
2702
|
-
const response = await fetch(`${bridge.env.
|
|
2702
|
+
const response = await fetch(`${bridge.env.WARDMOTE_API_URL}/api/issues/issue-1/comments`, {
|
|
2703
2703
|
method: "POST",
|
|
2704
2704
|
headers: {
|
|
2705
|
-
authorization: `Bearer ${bridge.env.
|
|
2705
|
+
authorization: `Bearer ${bridge.env.WARDMOTE_API_KEY}`,
|
|
2706
2706
|
"content-type": "application/json",
|
|
2707
2707
|
},
|
|
2708
2708
|
body: JSON.stringify({ body: "Status update." }),
|
|
@@ -2784,10 +2784,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2784
2784
|
maxBodyBytes: 512,
|
|
2785
2785
|
});
|
|
2786
2786
|
try {
|
|
2787
|
-
const response = await fetch(`${bridge.env.
|
|
2787
|
+
const response = await fetch(`${bridge.env.WARDMOTE_API_URL}/api/issues/issue-1`, {
|
|
2788
2788
|
method: "GET",
|
|
2789
2789
|
headers: {
|
|
2790
|
-
authorization: `Bearer ${bridge.env.
|
|
2790
|
+
authorization: `Bearer ${bridge.env.WARDMOTE_API_KEY}`,
|
|
2791
2791
|
},
|
|
2792
2792
|
});
|
|
2793
2793
|
// The forward returns a retryable 502 with no indeterminate marker, so the
|
|
@@ -2855,10 +2855,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2855
2855
|
hostApiUrl: `http://127.0.0.1:${address.port}`,
|
|
2856
2856
|
});
|
|
2857
2857
|
try {
|
|
2858
|
-
const response = await fetch(`${bridge.env.
|
|
2858
|
+
const response = await fetch(`${bridge.env.WARDMOTE_API_URL}/api/issues/issue-1/comments`, {
|
|
2859
2859
|
method: "POST",
|
|
2860
2860
|
headers: {
|
|
2861
|
-
authorization: `Bearer ${bridge.env.
|
|
2861
|
+
authorization: `Bearer ${bridge.env.WARDMOTE_API_KEY}`,
|
|
2862
2862
|
"content-type": "application/json",
|
|
2863
2863
|
},
|
|
2864
2864
|
body: JSON.stringify({ body: "Status update." }),
|
|
@@ -2905,14 +2905,14 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2905
2905
|
throw new Error("Expected the bridge local-origin test API server to listen on a TCP port.");
|
|
2906
2906
|
}
|
|
2907
2907
|
// Simulate a deployment where a public base URL is configured: server boot
|
|
2908
|
-
// exports the public origin via
|
|
2909
|
-
// and the local listen host/port via
|
|
2908
|
+
// exports the public origin via WARDMOTE_RUNTIME_API_URL / WARDMOTE_API_URL
|
|
2909
|
+
// and the local listen host/port via WARDMOTE_LISTEN_HOST / WARDMOTE_LISTEN_PORT.
|
|
2910
2910
|
// The wildcard listen host must map to the loopback address of the same
|
|
2911
2911
|
// family (0.0.0.0 -> 127.0.0.1), where the test API server is bound.
|
|
2912
|
-
vi.stubEnv("
|
|
2913
|
-
vi.stubEnv("
|
|
2914
|
-
vi.stubEnv("
|
|
2915
|
-
vi.stubEnv("
|
|
2912
|
+
vi.stubEnv("WARDMOTE_RUNTIME_API_URL", "https://public.example.invalid");
|
|
2913
|
+
vi.stubEnv("WARDMOTE_API_URL", "https://public.example.invalid");
|
|
2914
|
+
vi.stubEnv("WARDMOTE_LISTEN_HOST", "0.0.0.0");
|
|
2915
|
+
vi.stubEnv("WARDMOTE_LISTEN_PORT", String(address.port));
|
|
2916
2916
|
const target = {
|
|
2917
2917
|
kind: "remote",
|
|
2918
2918
|
transport: "sandbox",
|
|
@@ -2932,9 +2932,9 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2932
2932
|
});
|
|
2933
2933
|
try {
|
|
2934
2934
|
expect(bridge).not.toBeNull();
|
|
2935
|
-
const response = await fetch(`${bridge.env.
|
|
2935
|
+
const response = await fetch(`${bridge.env.WARDMOTE_API_URL}/api/agents/me`, {
|
|
2936
2936
|
headers: {
|
|
2937
|
-
authorization: `Bearer ${bridge.env.
|
|
2937
|
+
authorization: `Bearer ${bridge.env.WARDMOTE_API_KEY}`,
|
|
2938
2938
|
accept: "application/json",
|
|
2939
2939
|
},
|
|
2940
2940
|
});
|
|
@@ -2974,10 +2974,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2974
2974
|
}
|
|
2975
2975
|
// Neither the public URL envs nor the listen host/port should matter when
|
|
2976
2976
|
// the caller passes an explicit hostApiUrl.
|
|
2977
|
-
vi.stubEnv("
|
|
2978
|
-
vi.stubEnv("
|
|
2979
|
-
vi.stubEnv("
|
|
2980
|
-
vi.stubEnv("
|
|
2977
|
+
vi.stubEnv("WARDMOTE_RUNTIME_API_URL", "https://public.example.invalid");
|
|
2978
|
+
vi.stubEnv("WARDMOTE_API_URL", "https://public.example.invalid");
|
|
2979
|
+
vi.stubEnv("WARDMOTE_LISTEN_HOST", "203.0.113.1");
|
|
2980
|
+
vi.stubEnv("WARDMOTE_LISTEN_PORT", "9");
|
|
2981
2981
|
const target = {
|
|
2982
2982
|
kind: "remote",
|
|
2983
2983
|
transport: "sandbox",
|
|
@@ -2998,9 +2998,9 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2998
2998
|
});
|
|
2999
2999
|
try {
|
|
3000
3000
|
expect(bridge).not.toBeNull();
|
|
3001
|
-
const response = await fetch(`${bridge.env.
|
|
3001
|
+
const response = await fetch(`${bridge.env.WARDMOTE_API_URL}/api/agents/me`, {
|
|
3002
3002
|
headers: {
|
|
3003
|
-
authorization: `Bearer ${bridge.env.
|
|
3003
|
+
authorization: `Bearer ${bridge.env.WARDMOTE_API_KEY}`,
|
|
3004
3004
|
accept: "application/json",
|
|
3005
3005
|
},
|
|
3006
3006
|
});
|
|
@@ -3043,8 +3043,8 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3043
3043
|
const openDuplexChannel = async (openInput) => {
|
|
3044
3044
|
control.openCount += 1;
|
|
3045
3045
|
const joined = openInput.command.join(" ");
|
|
3046
|
-
const nonce = /
|
|
3047
|
-
const port = /
|
|
3046
|
+
const nonce = /WARDMOTE_BRIDGE_NONCE='([^']*)'/.exec(joined)?.[1] ?? "";
|
|
3047
|
+
const port = /WARDMOTE_BRIDGE_PORT='([^']*)'/.exec(joined)?.[1] ?? "";
|
|
3048
3048
|
let dataListener = null;
|
|
3049
3049
|
let exitListener = null;
|
|
3050
3050
|
const channel = {
|
|
@@ -3104,9 +3104,9 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3104
3104
|
const openDuplexChannel = async (openInput) => {
|
|
3105
3105
|
control.openCount += 1;
|
|
3106
3106
|
const joined = openInput.command.join(" ");
|
|
3107
|
-
const nonce = /
|
|
3108
|
-
const port = /
|
|
3109
|
-
const bridgeToken = /
|
|
3107
|
+
const nonce = /WARDMOTE_BRIDGE_NONCE='([^']*)'/.exec(joined)?.[1] ?? "";
|
|
3108
|
+
const port = /WARDMOTE_BRIDGE_PORT='([^']*)'/.exec(joined)?.[1] ?? "";
|
|
3109
|
+
const bridgeToken = /WARDMOTE_BRIDGE_TOKEN='([^']*)'/.exec(joined)?.[1] ?? "";
|
|
3110
3110
|
const [hostSide, sandboxSide] = duplexPair();
|
|
3111
3111
|
const dataListeners = [];
|
|
3112
3112
|
const exitListeners = [];
|
|
@@ -3294,16 +3294,16 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3294
3294
|
try {
|
|
3295
3295
|
expect(bridge).not.toBeNull();
|
|
3296
3296
|
expect(openCount).toBe(1);
|
|
3297
|
-
expect(bridge?.env.
|
|
3297
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("queue_v1");
|
|
3298
3298
|
const fallback = counters.find((c) => c.metric === DUPLEX_COUNTER_FALLBACK_TOTAL);
|
|
3299
3299
|
expect(fallback?.dimensions.fallback_reason).toBe("channel_open_failed");
|
|
3300
3300
|
// The queue fallback keeps the 415 gate for the attachment upload path:
|
|
3301
3301
|
// it never admits a binary body, and it never forwards the request to
|
|
3302
3302
|
// the host.
|
|
3303
|
-
const uploadResponse = await fetch(`${bridge.env.
|
|
3303
|
+
const uploadResponse = await fetch(`${bridge.env.WARDMOTE_API_URL}/api/companies/co-1/issues/issue-1/attachments`, {
|
|
3304
3304
|
method: "POST",
|
|
3305
3305
|
headers: {
|
|
3306
|
-
authorization: `Bearer ${bridge.env.
|
|
3306
|
+
authorization: `Bearer ${bridge.env.WARDMOTE_API_KEY}`,
|
|
3307
3307
|
"content-type": "application/octet-stream",
|
|
3308
3308
|
},
|
|
3309
3309
|
body: Buffer.from([0x50, 0x4b, 0x03, 0x04]),
|
|
@@ -3352,10 +3352,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3352
3352
|
try {
|
|
3353
3353
|
expect(bridge).not.toBeNull();
|
|
3354
3354
|
expect(control.openCount).toBe(1);
|
|
3355
|
-
expect(bridge?.env.
|
|
3355
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
3356
3356
|
// The host builds the origin from the port it assigned, never from a frame.
|
|
3357
|
-
expect(bridge?.env.
|
|
3358
|
-
expect(bridge?.env.
|
|
3357
|
+
expect(bridge?.env.WARDMOTE_API_URL).toMatch(/^http:\/\/127\.0\.0\.1:\d+$/);
|
|
3358
|
+
expect(bridge?.env.WARDMOTE_API_KEY).not.toBe("real-run-jwt");
|
|
3359
3359
|
// The sandbox gateway forwards one agent request as one real HTTP/2
|
|
3360
3360
|
// stream, over the one session that runs directly on the sandbox
|
|
3361
3361
|
// channel. The host serves it with the real token and the run id.
|
|
@@ -3416,7 +3416,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3416
3416
|
try {
|
|
3417
3417
|
// The http2 transport served, and it still streams run logs with the same
|
|
3418
3418
|
// gate and the same log line as the file path.
|
|
3419
|
-
expect(bridge?.env.
|
|
3419
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
3420
3420
|
expect(bridge?.runLogTail).toBeTruthy();
|
|
3421
3421
|
expect(combinedStream(logs, "stdout")).toContain("Sandbox run log streaming enabled");
|
|
3422
3422
|
const wrapped = bridge.runLogTail.create().wrapCommand("agent-cli", ["--message", "hello world"]);
|
|
@@ -3455,7 +3455,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3455
3455
|
enableSandboxDuplexBridge: true,
|
|
3456
3456
|
});
|
|
3457
3457
|
try {
|
|
3458
|
-
expect(bridge?.env.
|
|
3458
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
3459
3459
|
expect(bridge?.runLogTail ?? null).toBeNull();
|
|
3460
3460
|
}
|
|
3461
3461
|
finally {
|
|
@@ -3501,7 +3501,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3501
3501
|
duplexObservabilityRecorder: adapterExecutionTargetDuplexObservabilityRecorder(openTarget),
|
|
3502
3502
|
});
|
|
3503
3503
|
try {
|
|
3504
|
-
expect(openBridge?.env.
|
|
3504
|
+
expect(openBridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
3505
3505
|
const open = counters.find((record) => record.metric === DUPLEX_COUNTER_CHANNEL_OPEN_TOTAL);
|
|
3506
3506
|
expect(open?.dimensions.transport).toBe("http2");
|
|
3507
3507
|
expect(open?.dimensions.provider).toBe("daytona");
|
|
@@ -3533,7 +3533,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3533
3533
|
duplexObservabilityRecorder: adapterExecutionTargetDuplexObservabilityRecorder(fallbackTarget),
|
|
3534
3534
|
});
|
|
3535
3535
|
try {
|
|
3536
|
-
expect(fallbackBridge?.env.
|
|
3536
|
+
expect(fallbackBridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("queue_v1");
|
|
3537
3537
|
const fallback = counters.find((record) => record.metric === DUPLEX_COUNTER_FALLBACK_TOTAL);
|
|
3538
3538
|
expect(fallback?.dimensions.fallback_reason).toBe("gate_off");
|
|
3539
3539
|
expect(fallback?.dimensions.transport).toBe("file");
|
|
@@ -3575,7 +3575,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3575
3575
|
expect(bridge).not.toBeNull();
|
|
3576
3576
|
// Neither gate combination opened a duplex channel; the file bridge serves.
|
|
3577
3577
|
expect(control.openCount).toBe(0);
|
|
3578
|
-
expect(bridge?.env.
|
|
3578
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("queue_v1");
|
|
3579
3579
|
}
|
|
3580
3580
|
finally {
|
|
3581
3581
|
await bridge?.stop();
|
|
@@ -3633,7 +3633,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3633
3633
|
expect(bridge).not.toBeNull();
|
|
3634
3634
|
expect(control.openCount).toBe(1);
|
|
3635
3635
|
// Fail closed: the file bridge serves after the bounded cleanup.
|
|
3636
|
-
expect(bridge?.env.
|
|
3636
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("queue_v1");
|
|
3637
3637
|
// The bounded cleanup left no live provider session.
|
|
3638
3638
|
expect(control.closeCount + control.stopCount).toBeGreaterThanOrEqual(1);
|
|
3639
3639
|
}
|
|
@@ -3699,8 +3699,8 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3699
3699
|
expect(bridge).not.toBeNull();
|
|
3700
3700
|
// The address-bearing READY frame failed the strict schema, so the host
|
|
3701
3701
|
// fell closed to the file bridge and built no channel-supplied endpoint.
|
|
3702
|
-
expect(bridge?.env.
|
|
3703
|
-
expect(bridge?.env.
|
|
3702
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("queue_v1");
|
|
3703
|
+
expect(bridge?.env.WARDMOTE_API_URL).not.toContain(String(attackerPort));
|
|
3704
3704
|
expect(control.closeCount + control.stopCount).toBeGreaterThanOrEqual(1);
|
|
3705
3705
|
// Give any stray forward a moment, then assert the attacker got nothing.
|
|
3706
3706
|
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
@@ -3744,7 +3744,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3744
3744
|
enableSandboxDuplexBridge: true,
|
|
3745
3745
|
});
|
|
3746
3746
|
try {
|
|
3747
|
-
expect(bridge?.env.
|
|
3747
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
3748
3748
|
await waitForCondition(() => sessionRef.current !== null, "the http2 client session to open", 4000);
|
|
3749
3749
|
// An unlisted route answers 403 over the real HTTP/2 stream and never
|
|
3750
3750
|
// reaches the host API — the route allowlist holds on the http2 path.
|
|
@@ -3865,7 +3865,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3865
3865
|
enableSandboxDuplexBridge: true,
|
|
3866
3866
|
});
|
|
3867
3867
|
try {
|
|
3868
|
-
expect(bridge?.env.
|
|
3868
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
3869
3869
|
await waitForCondition(() => sessionRef.current !== null, "the http2 client session to open", 4000);
|
|
3870
3870
|
const response = await http2TestRequest(sessionRef.current, {
|
|
3871
3871
|
method: "POST",
|
|
@@ -3965,7 +3965,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3965
3965
|
duplexObservabilityRecorder: recorder,
|
|
3966
3966
|
});
|
|
3967
3967
|
try {
|
|
3968
|
-
expect(bridge?.env.
|
|
3968
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
3969
3969
|
await waitForCondition(() => sessionRef.current !== null, "the http2 client session to open", 4000);
|
|
3970
3970
|
const response = await http2TestRequest(sessionRef.current, {
|
|
3971
3971
|
method: "GET",
|
|
@@ -4023,7 +4023,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4023
4023
|
duplexObservabilityRecorder: recorder,
|
|
4024
4024
|
});
|
|
4025
4025
|
try {
|
|
4026
|
-
expect(bridge?.env.
|
|
4026
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("queue_v1");
|
|
4027
4027
|
const fallback = counters.find((c) => c.metric === DUPLEX_COUNTER_FALLBACK_TOTAL);
|
|
4028
4028
|
expect(fallback).toBeDefined();
|
|
4029
4029
|
const approvedReasons = [
|
|
@@ -4095,7 +4095,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4095
4095
|
});
|
|
4096
4096
|
try {
|
|
4097
4097
|
// The channel never opened, so the host serves the file bridge.
|
|
4098
|
-
expect(bridge?.env.
|
|
4098
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("queue_v1");
|
|
4099
4099
|
// The channel-open span and the fallback counter name the exact stage.
|
|
4100
4100
|
const openSpan = spans.find((s) => s.name === DUPLEX_SPAN_CHANNEL_OPEN && s.dimensions.outcome === "error");
|
|
4101
4101
|
expect(openSpan?.dimensions.fallback_reason).toBe(expectedReason);
|
|
@@ -4148,7 +4148,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4148
4148
|
duplexObservabilityRecorder: recorder,
|
|
4149
4149
|
});
|
|
4150
4150
|
try {
|
|
4151
|
-
expect(bridge?.env.
|
|
4151
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
4152
4152
|
await waitForCondition(() => sessionRef.current !== null, "the http2 client session to open", 4000);
|
|
4153
4153
|
if (dispatchFirst) {
|
|
4154
4154
|
const response = await http2TestRequest(sessionRef.current, {
|
|
@@ -4207,7 +4207,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4207
4207
|
});
|
|
4208
4208
|
try {
|
|
4209
4209
|
// The throwing recorder never blocked the http2 selection.
|
|
4210
|
-
expect(bridge?.env.
|
|
4210
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
4211
4211
|
await waitForCondition(() => sessionRef.current !== null, "the http2 client session to open", 4000);
|
|
4212
4212
|
const response = await http2TestRequest(sessionRef.current, {
|
|
4213
4213
|
method: "GET",
|
|
@@ -4260,8 +4260,8 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4260
4260
|
runner,
|
|
4261
4261
|
effectiveCapabilities: duplexCapabilities(true),
|
|
4262
4262
|
};
|
|
4263
|
-
const previousDebug = process.env.
|
|
4264
|
-
process.env.
|
|
4263
|
+
const previousDebug = process.env.WARDMOTE_BRIDGE_DEBUG;
|
|
4264
|
+
process.env.WARDMOTE_BRIDGE_DEBUG = "1";
|
|
4265
4265
|
let bridge = null;
|
|
4266
4266
|
try {
|
|
4267
4267
|
bridge = await startAdapterExecutionTargetPaperclipBridge({
|
|
@@ -4277,7 +4277,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4277
4277
|
logLines.push(chunk);
|
|
4278
4278
|
},
|
|
4279
4279
|
});
|
|
4280
|
-
expect(bridge?.env.
|
|
4280
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
4281
4281
|
await waitForCondition(() => sessionRef.current !== null, "the http2 client session to open", 4000);
|
|
4282
4282
|
// Dispatch one real HTTP/2 stream that carries the sentinel route,
|
|
4283
4283
|
// query, and body. The route allowlist accepts an arbitrary issue id
|
|
@@ -4305,9 +4305,9 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4305
4305
|
}
|
|
4306
4306
|
finally {
|
|
4307
4307
|
if (previousDebug === undefined)
|
|
4308
|
-
delete process.env.
|
|
4308
|
+
delete process.env.WARDMOTE_BRIDGE_DEBUG;
|
|
4309
4309
|
else
|
|
4310
|
-
process.env.
|
|
4310
|
+
process.env.WARDMOTE_BRIDGE_DEBUG = previousDebug;
|
|
4311
4311
|
sessionRef.current?.close();
|
|
4312
4312
|
await bridge?.stop();
|
|
4313
4313
|
await api.close();
|
|
@@ -4348,7 +4348,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4348
4348
|
duplexObservabilityRecorder: recorder,
|
|
4349
4349
|
});
|
|
4350
4350
|
try {
|
|
4351
|
-
expect(bridge?.env.
|
|
4351
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
4352
4352
|
await waitForCondition(() => sessionRef.current !== null, "the http2 client session to open", 4000);
|
|
4353
4353
|
const response = await http2TestRequest(sessionRef.current, {
|
|
4354
4354
|
method: "GET",
|
|
@@ -4419,7 +4419,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4419
4419
|
expect(bridge).not.toBeNull();
|
|
4420
4420
|
expect(control.openCount).toBe(1);
|
|
4421
4421
|
// The cap drove the failure, so the file bridge serves after the bounded cleanup.
|
|
4422
|
-
expect(bridge?.env.
|
|
4422
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("queue_v1");
|
|
4423
4423
|
const fallback = counters.find((c) => c.metric === DUPLEX_COUNTER_FALLBACK_TOTAL);
|
|
4424
4424
|
expect(fallback?.dimensions.fallback_reason).toBe("contaminated");
|
|
4425
4425
|
// The bounded cleanup left no live provider session.
|
|
@@ -4476,7 +4476,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4476
4476
|
expect(bridge).not.toBeNull();
|
|
4477
4477
|
expect(control.openCount).toBe(1);
|
|
4478
4478
|
// The cap drove the failure, so the file bridge serves after the bounded cleanup.
|
|
4479
|
-
expect(bridge?.env.
|
|
4479
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("queue_v1");
|
|
4480
4480
|
const fallback = counters.find((c) => c.metric === DUPLEX_COUNTER_FALLBACK_TOTAL);
|
|
4481
4481
|
expect(fallback?.dimensions.fallback_reason).toBe("contaminated");
|
|
4482
4482
|
expect(control.closeCount + control.stopCount).toBeGreaterThanOrEqual(1);
|
|
@@ -4650,7 +4650,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4650
4650
|
expect(scanUnits).toBeLessThanOrEqual(4 * totalBytes);
|
|
4651
4651
|
// The gate skipped the noise and accepted the READY frame, so the http2
|
|
4652
4652
|
// transport serves and no fallback fired.
|
|
4653
|
-
expect(bridge?.env.
|
|
4653
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
4654
4654
|
const fallback = counters.find((c) => c.metric === DUPLEX_COUNTER_FALLBACK_TOTAL);
|
|
4655
4655
|
expect(fallback).toBeUndefined();
|
|
4656
4656
|
}
|
|
@@ -4672,7 +4672,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4672
4672
|
// in the code. The preface scan then starts only on the bytes the gate
|
|
4673
4673
|
// retained after that accepted line.
|
|
4674
4674
|
const { runner, control } = makeHttp2SelectionRunner((ctx) => {
|
|
4675
|
-
ctx.emitRaw("sh -c exec env
|
|
4675
|
+
ctx.emitRaw("sh -c exec env WARDMOTE_BRIDGE_NONCE=... node gateway.mjs\n");
|
|
4676
4676
|
ctx.emitRaw('{"version":2,"type":"ready"}\n');
|
|
4677
4677
|
ctx.emitRaw("x".repeat(50_000)); // an arbitrarily long prologue, no fixed length
|
|
4678
4678
|
ctx.emitReady();
|
|
@@ -4705,7 +4705,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4705
4705
|
// The gate skipped the echo, the partial frame, and the long prologue,
|
|
4706
4706
|
// then accepted the READY frame, so the http2 transport serves and no
|
|
4707
4707
|
// fallback fired.
|
|
4708
|
-
expect(bridge?.env.
|
|
4708
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
4709
4709
|
const fallback = counters.find((c) => c.metric === DUPLEX_COUNTER_FALLBACK_TOTAL);
|
|
4710
4710
|
expect(fallback).toBeUndefined();
|
|
4711
4711
|
}
|
|
@@ -4753,7 +4753,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4753
4753
|
expect(bridge).not.toBeNull();
|
|
4754
4754
|
expect(control.openCount).toBe(1);
|
|
4755
4755
|
// The wrong nonce failed the handshake, so the file bridge serves.
|
|
4756
|
-
expect(bridge?.env.
|
|
4756
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("queue_v1");
|
|
4757
4757
|
const fallback = counters.find((c) => c.metric === DUPLEX_COUNTER_FALLBACK_TOTAL);
|
|
4758
4758
|
expect(fallback?.dimensions.fallback_reason).toBe("ready_nonce_mismatch");
|
|
4759
4759
|
// The bounded cleanup left no live provider session.
|
|
@@ -4810,7 +4810,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4810
4810
|
expect(bridge).not.toBeNull();
|
|
4811
4811
|
expect(control.openCount).toBe(1);
|
|
4812
4812
|
// The cap drove the failure before READY acceptance, so the file bridge serves.
|
|
4813
|
-
expect(bridge?.env.
|
|
4813
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("queue_v1");
|
|
4814
4814
|
const fallback = counters.find((c) => c.metric === DUPLEX_COUNTER_FALLBACK_TOTAL);
|
|
4815
4815
|
expect(fallback?.dimensions.fallback_reason).toBe("contaminated");
|
|
4816
4816
|
// The bounded cleanup left no live provider session.
|
|
@@ -4854,7 +4854,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4854
4854
|
duplexObservabilityRecorder: recorder,
|
|
4855
4855
|
});
|
|
4856
4856
|
try {
|
|
4857
|
-
expect(bridge?.env.
|
|
4857
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("queue_v1");
|
|
4858
4858
|
const openSpan = spans.find((span) => span.name === DUPLEX_SPAN_CHANNEL_OPEN);
|
|
4859
4859
|
expect(openSpan).toBeDefined();
|
|
4860
4860
|
expect(openSpan?.dimensions).toMatchObject({
|
|
@@ -4903,7 +4903,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4903
4903
|
enableSandboxDuplexBridge: true,
|
|
4904
4904
|
});
|
|
4905
4905
|
try {
|
|
4906
|
-
expect(bridge?.env.
|
|
4906
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
4907
4907
|
await waitForCondition(() => sessionRef.current !== null, "the http2 client session to open", 4000);
|
|
4908
4908
|
const response = await http2TestRequest(sessionRef.current, {
|
|
4909
4909
|
method: "GET",
|
|
@@ -4970,7 +4970,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4970
4970
|
forwardTimeoutMs: 60_000,
|
|
4971
4971
|
});
|
|
4972
4972
|
try {
|
|
4973
|
-
expect(bridge?.env.
|
|
4973
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
4974
4974
|
await waitForCondition(() => sessionRef.current !== null, "the http2 client session to open", 4000);
|
|
4975
4975
|
const response = await http2TestRequest(sessionRef.current, {
|
|
4976
4976
|
method: "GET",
|
|
@@ -5027,7 +5027,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5027
5027
|
expect(bridge).not.toBeNull();
|
|
5028
5028
|
expect(control.openCount).toBe(1);
|
|
5029
5029
|
// The missing preface aborted the open; the file bridge serves.
|
|
5030
|
-
expect(bridge?.env.
|
|
5030
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("queue_v1");
|
|
5031
5031
|
const fallback = counters.find((c) => c.metric === DUPLEX_COUNTER_FALLBACK_TOTAL);
|
|
5032
5032
|
expect(fallback?.dimensions.fallback_reason).toBe("preface_missing");
|
|
5033
5033
|
// The bounded cleanup left no live provider session.
|
|
@@ -5069,7 +5069,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5069
5069
|
try {
|
|
5070
5070
|
expect(bridge).not.toBeNull();
|
|
5071
5071
|
expect(control.openCount).toBe(0);
|
|
5072
|
-
expect(bridge?.env.
|
|
5072
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("queue_v1");
|
|
5073
5073
|
const fallback = counters.find((c) => c.metric === DUPLEX_COUNTER_FALLBACK_TOTAL);
|
|
5074
5074
|
expect(fallback?.dimensions.fallback_reason).toBe("gate_off");
|
|
5075
5075
|
}
|
|
@@ -5117,7 +5117,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5117
5117
|
// The host opened the channel exactly once for the whole run — no retry
|
|
5118
5118
|
// loop re-attempted http2_v1 after the fallback.
|
|
5119
5119
|
expect(control.openCount).toBe(1);
|
|
5120
|
-
expect(bridge?.env.
|
|
5120
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("queue_v1");
|
|
5121
5121
|
// Exactly one fallback record — the transition never repeats.
|
|
5122
5122
|
const fallbacks = counters.filter((c) => c.metric === DUPLEX_COUNTER_FALLBACK_TOTAL);
|
|
5123
5123
|
expect(fallbacks).toHaveLength(1);
|
|
@@ -5147,7 +5147,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5147
5147
|
const readySentAtMs = { value: 0 };
|
|
5148
5148
|
const openDuplexChannel = async (openInput) => {
|
|
5149
5149
|
const joined = openInput.command.join(" ");
|
|
5150
|
-
const nonce = /
|
|
5150
|
+
const nonce = /WARDMOTE_BRIDGE_NONCE='([^']*)'/.exec(joined)?.[1] ?? "";
|
|
5151
5151
|
let dataListener = null;
|
|
5152
5152
|
const channel = {
|
|
5153
5153
|
write: (data) => {
|
|
@@ -5197,7 +5197,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5197
5197
|
// The preface never arrived, so the open fell back to the file bridge —
|
|
5198
5198
|
// and across the whole open attempt, including the wait after READY,
|
|
5199
5199
|
// the host wrote zero bytes to the channel.
|
|
5200
|
-
expect(bridge?.env.
|
|
5200
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("queue_v1");
|
|
5201
5201
|
expect(hostWrites).toHaveLength(0);
|
|
5202
5202
|
}
|
|
5203
5203
|
finally {
|
|
@@ -5248,7 +5248,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5248
5248
|
});
|
|
5249
5249
|
try {
|
|
5250
5250
|
// The invalid line was skipped as noise, and READY still passed.
|
|
5251
|
-
expect(bridge?.env.
|
|
5251
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
5252
5252
|
const logDump = logLines.join("");
|
|
5253
5253
|
expect(logDump).not.toContain(INVALID_LINE_SENTINEL);
|
|
5254
5254
|
}
|
|
@@ -5293,7 +5293,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5293
5293
|
duplexObservabilityRecorder: recorder,
|
|
5294
5294
|
});
|
|
5295
5295
|
try {
|
|
5296
|
-
expect(bridge?.env.
|
|
5296
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
5297
5297
|
// The agent turn completes cleanly before the channel ends.
|
|
5298
5298
|
expect(bridge?.settleRunDisposition?.()).toEqual({ failed: false, lossReason: null });
|
|
5299
5299
|
emitExit();
|
|
@@ -5349,7 +5349,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5349
5349
|
maxBodyBytes: 1,
|
|
5350
5350
|
});
|
|
5351
5351
|
try {
|
|
5352
|
-
expect(bridge?.env.
|
|
5352
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
5353
5353
|
await waitForCondition(() => sessionRef.current !== null, "the http2 client session to open", 4000);
|
|
5354
5354
|
const response = await http2TestRequest(sessionRef.current, {
|
|
5355
5355
|
method: "GET",
|
|
@@ -5407,7 +5407,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5407
5407
|
maxBodyBytes: 1,
|
|
5408
5408
|
});
|
|
5409
5409
|
try {
|
|
5410
|
-
expect(bridge?.env.
|
|
5410
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
5411
5411
|
await waitForCondition(() => sessionRef.current !== null, "the http2 client session to open", 4000);
|
|
5412
5412
|
const response = await http2TestRequest(sessionRef.current, {
|
|
5413
5413
|
method: "POST",
|
|
@@ -5482,7 +5482,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5482
5482
|
forwardTimeoutMs: 60_000,
|
|
5483
5483
|
});
|
|
5484
5484
|
try {
|
|
5485
|
-
expect(bridge?.env.
|
|
5485
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
5486
5486
|
await waitForCondition(() => sessionRef.current !== null, "the http2 client session to open", 4000);
|
|
5487
5487
|
const clientStream = sessionRef.current.request({
|
|
5488
5488
|
":method": "GET",
|
|
@@ -5561,7 +5561,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5561
5561
|
enableSandboxDuplexBridge: true,
|
|
5562
5562
|
});
|
|
5563
5563
|
try {
|
|
5564
|
-
expect(bridge?.env.
|
|
5564
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
5565
5565
|
await waitForCondition(() => sessionRef.current !== null, "the http2 client session to open", 4000);
|
|
5566
5566
|
// A capacity denial reaches the client as the retryable 503 the
|
|
5567
5567
|
// HTTP/2 bridge server's own capacity-denial path answers
|
|
@@ -5648,7 +5648,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5648
5648
|
const concatSpy = vi.spyOn(Buffer, "concat");
|
|
5649
5649
|
const readerCancelSpy = vi.spyOn(ReadableStreamDefaultReader.prototype, "cancel");
|
|
5650
5650
|
try {
|
|
5651
|
-
expect(bridge?.env.
|
|
5651
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
5652
5652
|
await waitForCondition(() => sessionRef.current !== null, "the http2 client session to open", 4000);
|
|
5653
5653
|
// A capacity denial must reach the client as the retryable 503 the
|
|
5654
5654
|
// HTTP/2 bridge server's own capacity-denial path answers, not the
|
|
@@ -5758,7 +5758,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5758
5758
|
enableSandboxDuplexBridge: true,
|
|
5759
5759
|
});
|
|
5760
5760
|
try {
|
|
5761
|
-
expect(bridge?.env.
|
|
5761
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
5762
5762
|
await waitForCondition(() => sessionRef.current !== null, "the http2 client session to open", 4000);
|
|
5763
5763
|
const response = await http2TestRequest(sessionRef.current, {
|
|
5764
5764
|
method: "POST",
|
|
@@ -5836,7 +5836,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5836
5836
|
enableSandboxDuplexBridge: true,
|
|
5837
5837
|
});
|
|
5838
5838
|
try {
|
|
5839
|
-
expect(bridge?.env.
|
|
5839
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
5840
5840
|
await waitForCondition(() => sessionRef.current !== null, "the http2 client session to open", 4000);
|
|
5841
5841
|
const responses = await Promise.all(Array.from({ length: HTTP2_BRIDGE_MAX_CONCURRENT_STREAMS }, () => http2TestRequest(sessionRef.current, {
|
|
5842
5842
|
method: "POST",
|
|
@@ -5900,7 +5900,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5900
5900
|
maxBodyBytes: 100,
|
|
5901
5901
|
});
|
|
5902
5902
|
try {
|
|
5903
|
-
expect(bridge?.env.
|
|
5903
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
5904
5904
|
await waitForCondition(() => sessionRef.current !== null, "the http2 client session to open", 4000);
|
|
5905
5905
|
const response = await http2TestRequest(sessionRef.current, {
|
|
5906
5906
|
method: "POST",
|
|
@@ -5965,11 +5965,11 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5965
5965
|
hostApiUrl: `http://127.0.0.1:${address.port}`,
|
|
5966
5966
|
});
|
|
5967
5967
|
try {
|
|
5968
|
-
expect(bridge?.env.
|
|
5969
|
-
const response = await fetch(`${bridge.env.
|
|
5968
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("queue_v1");
|
|
5969
|
+
const response = await fetch(`${bridge.env.WARDMOTE_API_URL}/api/issues/abc/comments`, {
|
|
5970
5970
|
method: "POST",
|
|
5971
5971
|
headers: {
|
|
5972
|
-
authorization: `Bearer ${bridge.env.
|
|
5972
|
+
authorization: `Bearer ${bridge.env.WARDMOTE_API_KEY}`,
|
|
5973
5973
|
"content-type": "application/json",
|
|
5974
5974
|
},
|
|
5975
5975
|
body: JSON.stringify({ body: "hello" }),
|
|
@@ -6019,7 +6019,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
6019
6019
|
enableSandboxDuplexBridge: true,
|
|
6020
6020
|
duplexReadinessTimeoutMs: 2_000,
|
|
6021
6021
|
});
|
|
6022
|
-
const mode = bridge?.env.
|
|
6022
|
+
const mode = bridge?.env.WARDMOTE_API_BRIDGE_MODE;
|
|
6023
6023
|
await bridge?.stop();
|
|
6024
6024
|
await api.close();
|
|
6025
6025
|
return { mode, control };
|
|
@@ -6030,7 +6030,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
6030
6030
|
it("PTY replay: accepts READY after an echoed prompt and wrapper line", async () => {
|
|
6031
6031
|
const { mode } = await runReadinessReplay((ctx) => {
|
|
6032
6032
|
ctx.emitRaw("daytona@212487a7f3c9:~$ exec 2>'/tmp/paperclip-duplex-x.log'; stty raw -echo; " +
|
|
6033
|
-
"exec 'bash' '-c' 'exec env
|
|
6033
|
+
"exec 'bash' '-c' 'exec env WARDMOTE_BRIDGE_NONCE=" + ctx.nonce + " node gateway.mjs'\r\n");
|
|
6034
6034
|
ctx.emitRaw('{"version":2,"type":"ready","nonce":"' + ctx.nonce + '"}\n');
|
|
6035
6035
|
ctx.connectHttp2();
|
|
6036
6036
|
});
|
|
@@ -6148,7 +6148,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
6148
6148
|
enableSandboxDuplexBridge: true,
|
|
6149
6149
|
});
|
|
6150
6150
|
try {
|
|
6151
|
-
expect(bridge?.env.
|
|
6151
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
6152
6152
|
await waitForCondition(() => sessionRef.current !== null, "the http2 client session to open", 4000);
|
|
6153
6153
|
const response = await http2TestRequest(sessionRef.current, {
|
|
6154
6154
|
method: "GET",
|
|
@@ -6205,7 +6205,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
6205
6205
|
try {
|
|
6206
6206
|
expect(bridge).not.toBeNull();
|
|
6207
6207
|
expect(control.openCount).toBe(1);
|
|
6208
|
-
expect(bridge?.env.
|
|
6208
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
6209
6209
|
await waitForCondition(() => sessionRef.current !== null, "the http2 client session to open", 4000);
|
|
6210
6210
|
const response = await http2TestRequest(sessionRef.current, {
|
|
6211
6211
|
method: "GET",
|