@tickernelz/wardmote-adapter-utils 2026.1108.2 → 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
|
@@ -5,7 +5,7 @@ import os from "node:os";
|
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { describe, expect, it } from "vitest";
|
|
7
7
|
import { CONNECTION_INTENT_AGENT_GUIDANCE } from "@tickernelz/wardmote-shared";
|
|
8
|
-
import { readPaperclipRuntimeSkillEntries, applyPaperclipWorkspaceEnv, appendWithByteCap, buildPersistentSkillSnapshot, buildRuntimeMountedSkillSnapshot, buildInvocationEnvForLogs, buildPaperclipEnv, buildRuntimeToolsEnv,
|
|
8
|
+
import { readPaperclipRuntimeSkillEntries, applyPaperclipWorkspaceEnv, appendWithByteCap, buildPersistentSkillSnapshot, buildRuntimeMountedSkillSnapshot, buildInvocationEnvForLogs, buildPaperclipEnv, buildRuntimeToolsEnv, DEFAULT_WARDMOTE_AGENT_PROMPT_TEMPLATE, DEFAULT_WARDMOTE_CONVERSATION_PROMPT_TEMPLATE, paperclipAgentPromptTemplate, isPaperclipExternalChatContractTurn, isPaperclipExternalChatQuestionResponseTurn, isPaperclipExternalChatTurn, materializePaperclipSkillCopy, WARDMOTE_OPERATIONAL_SKILL_KEY, WARDMOTE_FEEDBACK_SKILL_KEYS, refreshPaperclipWorkspaceEnvForExecution, renderPaperclipWakePrompt, resolveLegacyPaperclipDesiredSkillNames, resolvePaperclipDesiredSkillNames, selectPaperclipTaskMarkdown, selectInitialCommunicationGuidance, hydrateFreshSessionHandoff, runningProcesses, runChildProcess, sanitizeSshRemoteEnv, sanitizeInheritedPaperclipEnv, isForbiddenConfigEnvKey, signalRunningProcess, shapePaperclipWorkspaceEnvForExecution, rewriteWorkspaceCwdEnvVarsForExecution, stringifyPaperclipWakePayload, ensurePaperclipSkillSymlink, relinkPaperclipSkillsFromOtherInstalls, UNMANAGED_BACKGROUND_TASK_LIVENESS_REASON, UNMANAGED_BACKGROUND_TASK_STOP_REASON, WATCHDOG_DEFAULT_MANDATE, } from "./server-utils.js";
|
|
9
9
|
describe("ensurePaperclipSkillSymlink", () => {
|
|
10
10
|
const bundled = (root, version, skill) => path.join(root, "installs", version, "node_modules", "@tickernelz", "wardmote-server", "skills", skill);
|
|
11
11
|
it("moves a skill link from an older Paperclip install to the current one and leaves foreign links alone", async () => {
|
|
@@ -59,7 +59,7 @@ describe("ensurePaperclipSkillSymlink", () => {
|
|
|
59
59
|
});
|
|
60
60
|
});
|
|
61
61
|
it("reserves identity credentials even for mixed-case inherited or configured keys", () => {
|
|
62
|
-
const keys = ["
|
|
62
|
+
const keys = ["WARDMOTE_AGENT_KEY_ID", "Paperclip_Agent_Public_Key", "paperclip_agent_private_key"];
|
|
63
63
|
const inherited = Object.fromEntries(keys.map(key => [key, "host-override"]));
|
|
64
64
|
expect(sanitizeInheritedPaperclipEnv({ ...inherited, PATH: "/usr/bin" })).toEqual({ PATH: "/usr/bin" });
|
|
65
65
|
for (const key of keys)
|
|
@@ -80,33 +80,33 @@ describe("runtime connection tool delivery", () => {
|
|
|
80
80
|
};
|
|
81
81
|
it("delivers the complete environment contract and canonical guidance", () => {
|
|
82
82
|
expect(buildRuntimeToolsEnv(access)).toEqual({
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
83
|
+
WARDMOTE_RUNTIME_TOOLS_MCP_URL: access.mcpEndpoint,
|
|
84
|
+
WARDMOTE_RUNTIME_TOOLS_TOKEN: access.bearerToken,
|
|
85
|
+
WARDMOTE_RUNTIME_TOOLS_EXPIRES_AT: access.expiresAt,
|
|
86
|
+
WARDMOTE_RUNTIME_TOOLS_CONNECTIONS_SEARCH_URL: access.rest.connectionsSearch,
|
|
87
|
+
WARDMOTE_RUNTIME_TOOLS_CONNECTION_REQUEST_URL: access.rest.connectionRequest,
|
|
88
|
+
WARDMOTE_RUNTIME_TOOLS_AVAILABLE: "connections_search,connection_request",
|
|
89
|
+
WARDMOTE_RUNTIME_TOOLS_GUIDANCE: CONNECTION_INTENT_AGENT_GUIDANCE,
|
|
90
90
|
});
|
|
91
91
|
});
|
|
92
92
|
it("does not leak descriptor identity through guidance", () => {
|
|
93
93
|
const env = buildRuntimeToolsEnv(access);
|
|
94
|
-
expect(env.
|
|
95
|
-
expect(env.
|
|
94
|
+
expect(env.WARDMOTE_RUNTIME_TOOLS_GUIDANCE).not.toContain(access.bearerToken);
|
|
95
|
+
expect(env.WARDMOTE_RUNTIME_TOOLS_GUIDANCE).not.toContain(access.mcpEndpoint);
|
|
96
96
|
});
|
|
97
97
|
it("is absent outside an active runtime descriptor", () => {
|
|
98
98
|
expect(buildRuntimeToolsEnv(undefined)).toEqual({});
|
|
99
99
|
});
|
|
100
100
|
it("uses the exact same guidance in the default heartbeat prompt", () => {
|
|
101
|
-
expect(
|
|
102
|
-
expect(
|
|
103
|
-
expect(
|
|
104
|
-
expect(
|
|
101
|
+
expect(DEFAULT_WARDMOTE_AGENT_PROMPT_TEMPLATE).toContain(CONNECTION_INTENT_AGENT_GUIDANCE);
|
|
102
|
+
expect(DEFAULT_WARDMOTE_CONVERSATION_PROMPT_TEMPLATE).toContain(CONNECTION_INTENT_AGENT_GUIDANCE);
|
|
103
|
+
expect(DEFAULT_WARDMOTE_CONVERSATION_PROMPT_TEMPLATE).not.toContain("Execution contract:");
|
|
104
|
+
expect(DEFAULT_WARDMOTE_CONVERSATION_PROMPT_TEMPLATE).not.toContain("child issues");
|
|
105
105
|
});
|
|
106
106
|
});
|
|
107
107
|
describe("legacy adapter skill selection", () => {
|
|
108
108
|
const operationalEntry = {
|
|
109
|
-
key:
|
|
109
|
+
key: WARDMOTE_OPERATIONAL_SKILL_KEY,
|
|
110
110
|
runtimeName: "paperclip",
|
|
111
111
|
};
|
|
112
112
|
const optionalEntry = {
|
|
@@ -117,10 +117,10 @@ describe("legacy adapter skill selection", () => {
|
|
|
117
117
|
expect(resolveLegacyPaperclipDesiredSkillNames({}, [
|
|
118
118
|
operationalEntry,
|
|
119
119
|
optionalEntry,
|
|
120
|
-
])).toEqual([
|
|
120
|
+
])).toEqual([WARDMOTE_OPERATIONAL_SKILL_KEY]);
|
|
121
121
|
});
|
|
122
122
|
it("keeps the operational skill selected after an explicit empty replacement", () => {
|
|
123
|
-
expect(resolveLegacyPaperclipDesiredSkillNames({ paperclipSkillSync: { desiredSkills: [] } }, [operationalEntry, optionalEntry])).toEqual([
|
|
123
|
+
expect(resolveLegacyPaperclipDesiredSkillNames({ paperclipSkillSync: { desiredSkills: [] } }, [operationalEntry, optionalEntry])).toEqual([WARDMOTE_OPERATIONAL_SKILL_KEY]);
|
|
124
124
|
});
|
|
125
125
|
it("does not force optional skills or synthesize a missing operational entry", () => {
|
|
126
126
|
const config = {
|
|
@@ -129,17 +129,17 @@ describe("legacy adapter skill selection", () => {
|
|
|
129
129
|
expect(resolveLegacyPaperclipDesiredSkillNames(config, [
|
|
130
130
|
operationalEntry,
|
|
131
131
|
optionalEntry,
|
|
132
|
-
])).toEqual([
|
|
132
|
+
])).toEqual([WARDMOTE_OPERATIONAL_SKILL_KEY, optionalEntry.key]);
|
|
133
133
|
expect(resolveLegacyPaperclipDesiredSkillNames(config, [optionalEntry])).toEqual([optionalEntry.key]);
|
|
134
134
|
});
|
|
135
135
|
it("leaves the configurable resolver available for native runners", () => {
|
|
136
136
|
expect(resolvePaperclipDesiredSkillNames({}, [operationalEntry])).toEqual([]);
|
|
137
137
|
});
|
|
138
138
|
it("makes feedback available to existing legacy agents without opting native agents into API skills", () => {
|
|
139
|
-
const inventory = [operationalEntry, ...
|
|
139
|
+
const inventory = [operationalEntry, ...WARDMOTE_FEEDBACK_SKILL_KEYS.map((key) => ({ key }))];
|
|
140
140
|
for (const config of [{}, { paperclipSkillSync: { desiredSkills: [] } }]) {
|
|
141
141
|
expect(resolveLegacyPaperclipDesiredSkillNames(config, inventory)).toEqual([
|
|
142
|
-
|
|
142
|
+
WARDMOTE_OPERATIONAL_SKILL_KEY, ...WARDMOTE_FEEDBACK_SKILL_KEYS,
|
|
143
143
|
]);
|
|
144
144
|
expect(resolvePaperclipDesiredSkillNames(config, inventory)).toEqual([]);
|
|
145
145
|
}
|
|
@@ -178,10 +178,10 @@ async function waitForTextMatch(read, pattern, timeoutMs = 1_000) {
|
|
|
178
178
|
describe("buildInvocationEnvForLogs", () => {
|
|
179
179
|
it("redacts inline secrets from resolved command metadata", () => {
|
|
180
180
|
const loggedEnv = buildInvocationEnvForLogs({ SAFE_VALUE: "visible" }, {
|
|
181
|
-
resolvedCommand: "env OPENAI_API_KEY=sk-live-example
|
|
181
|
+
resolvedCommand: "env OPENAI_API_KEY=sk-live-example WARDMOTE_API_KEY='paperclip-quoted-secret' custom-acp --paperclip-api-key=paperclip-flag-secret --token ghp_example_secret",
|
|
182
182
|
});
|
|
183
183
|
expect(loggedEnv.SAFE_VALUE).toBe("visible");
|
|
184
|
-
expect(loggedEnv.
|
|
184
|
+
expect(loggedEnv.WARDMOTE_RESOLVED_COMMAND).toBe("env OPENAI_API_KEY=***REDACTED*** WARDMOTE_API_KEY='***REDACTED***' custom-acp --paperclip-api-key=***REDACTED*** --token ***REDACTED***");
|
|
185
185
|
});
|
|
186
186
|
});
|
|
187
187
|
describe("sanitizeSshRemoteEnv", () => {
|
|
@@ -295,7 +295,7 @@ describe("materializePaperclipSkillCopy", () => {
|
|
|
295
295
|
});
|
|
296
296
|
describe("adapter skill snapshots", () => {
|
|
297
297
|
const requiredEntry = {
|
|
298
|
-
key: "
|
|
298
|
+
key: "tickernelz/wardmote/paperclip",
|
|
299
299
|
runtimeName: "paperclip",
|
|
300
300
|
source: "/runtime/paperclip",
|
|
301
301
|
};
|
|
@@ -949,7 +949,7 @@ describe("renderPaperclipWakePrompt", () => {
|
|
|
949
949
|
expect(prompt).not.toContain("a successful process exit or final response is not sufficient");
|
|
950
950
|
expect(prompt).not.toContain("acknowledge the latest comment");
|
|
951
951
|
expect(prompt).not.toContain("checkout: already claimed");
|
|
952
|
-
expect(prompt).not.toContain("POST /api/issues/$
|
|
952
|
+
expect(prompt).not.toContain("POST /api/issues/$WARDMOTE_TASK_ID/checkout");
|
|
953
953
|
}
|
|
954
954
|
const freshPrompt = renderPaperclipWakePrompt(ordinaryExternalChatWake);
|
|
955
955
|
expect(freshPrompt).toContain("Answer the pending comments directly, in order");
|
|
@@ -1150,8 +1150,8 @@ describe("renderPaperclipWakePrompt", () => {
|
|
|
1150
1150
|
});
|
|
1151
1151
|
it("keeps task and chat defaults to identity and connection guidance", () => {
|
|
1152
1152
|
for (const template of [
|
|
1153
|
-
|
|
1154
|
-
|
|
1153
|
+
DEFAULT_WARDMOTE_AGENT_PROMPT_TEMPLATE,
|
|
1154
|
+
DEFAULT_WARDMOTE_CONVERSATION_PROMPT_TEMPLATE,
|
|
1155
1155
|
]) {
|
|
1156
1156
|
expect(template).toBe(`You are agent {{agent.id}} ({{agent.name}}).\n\n${CONNECTION_INTENT_AGENT_GUIDANCE}`);
|
|
1157
1157
|
}
|
|
@@ -1169,7 +1169,7 @@ describe("renderPaperclipWakePrompt", () => {
|
|
|
1169
1169
|
expect(template).toContain("Use child issues");
|
|
1170
1170
|
expect(template).toContain("instead of polling agents, sessions, or processes");
|
|
1171
1171
|
expect(template).toContain("Create child issues directly when you know what needs to be done");
|
|
1172
|
-
expect(template).toContain("using `issueId: $
|
|
1172
|
+
expect(template).toContain("using `issueId: $WARDMOTE_TASK_ID`");
|
|
1173
1173
|
// URL paths in prompt text carry real ids or env vars, never brace
|
|
1174
1174
|
// placeholders: agents paste these lines verbatim, and a literal {issueId}
|
|
1175
1175
|
// reaches the server as /api/issues/%7BissueId%7D and 404s.
|
|
@@ -1202,7 +1202,7 @@ describe("renderPaperclipWakePrompt", () => {
|
|
|
1202
1202
|
});
|
|
1203
1203
|
expect(prompt).toContain("## Paperclip Wake Payload");
|
|
1204
1204
|
expect(prompt).not.toContain("Execution contract:");
|
|
1205
|
-
expect(
|
|
1205
|
+
expect(DEFAULT_WARDMOTE_AGENT_PROMPT_TEMPLATE).not.toContain("Execution contract:");
|
|
1206
1206
|
});
|
|
1207
1207
|
it("does not restore generic procedures on resume or with the legacy opt-in", () => {
|
|
1208
1208
|
const payload = {
|
|
@@ -1560,7 +1560,7 @@ describe("renderPaperclipWakePrompt", () => {
|
|
|
1560
1560
|
comments: [],
|
|
1561
1561
|
fallbackFetchNeeded: false,
|
|
1562
1562
|
});
|
|
1563
|
-
const composed = [wakePrompt,
|
|
1563
|
+
const composed = [wakePrompt, DEFAULT_WARDMOTE_AGENT_PROMPT_TEMPLATE].join("\n\n");
|
|
1564
1564
|
expect(composed).toContain(CONNECTION_INTENT_AGENT_GUIDANCE);
|
|
1565
1565
|
expect(composed).not.toContain("Execution contract:");
|
|
1566
1566
|
});
|
|
@@ -2830,14 +2830,14 @@ describe("applyPaperclipWorkspaceEnv", () => {
|
|
|
2830
2830
|
agentHome: "/tmp/agent-home",
|
|
2831
2831
|
});
|
|
2832
2832
|
expect(env).toEqual({
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2833
|
+
WARDMOTE_WORKSPACE_CWD: "/tmp/workspace",
|
|
2834
|
+
WARDMOTE_WORKSPACE_SOURCE: "project_primary",
|
|
2835
|
+
WARDMOTE_WORKSPACE_STRATEGY: "git_worktree",
|
|
2836
|
+
WARDMOTE_WORKSPACE_ID: "workspace-1",
|
|
2837
|
+
WARDMOTE_WORKSPACE_REPO_URL: "https://github.com/paperclipai/paperclip.git",
|
|
2838
|
+
WARDMOTE_WORKSPACE_REPO_REF: "main",
|
|
2839
|
+
WARDMOTE_WORKSPACE_BRANCH: "feature/test",
|
|
2840
|
+
WARDMOTE_WORKSPACE_WORKTREE_PATH: "/tmp/worktree",
|
|
2841
2841
|
AGENT_HOME: "/tmp/agent-home",
|
|
2842
2842
|
});
|
|
2843
2843
|
});
|
|
@@ -3031,9 +3031,9 @@ describe("rewriteWorkspaceCwdEnvVarsForExecution", () => {
|
|
|
3031
3031
|
describe("refreshPaperclipWorkspaceEnvForExecution", () => {
|
|
3032
3032
|
it("rewrites Paperclip workspace env to the prepared remote runtime cwd", () => {
|
|
3033
3033
|
const env = {
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3034
|
+
WARDMOTE_WORKSPACE_CWD: "/remote/workspace",
|
|
3035
|
+
WARDMOTE_WORKSPACE_WORKTREE_PATH: "/host/worktree",
|
|
3036
|
+
WARDMOTE_WORKSPACES_JSON: JSON.stringify([
|
|
3037
3037
|
{ workspaceId: "workspace-1", cwd: "/remote/workspace" },
|
|
3038
3038
|
{ workspaceId: "workspace-2", cwd: "/tmp/other" },
|
|
3039
3039
|
]),
|
|
@@ -3066,10 +3066,10 @@ describe("refreshPaperclipWorkspaceEnvForExecution", () => {
|
|
|
3066
3066
|
},
|
|
3067
3067
|
],
|
|
3068
3068
|
});
|
|
3069
|
-
expect(env.
|
|
3070
|
-
expect(env.
|
|
3069
|
+
expect(env.WARDMOTE_WORKSPACE_CWD).toBe("/remote/workspace/.paperclip-runtime/runs/run-1/workspace");
|
|
3070
|
+
expect(env.WARDMOTE_WORKSPACE_WORKTREE_PATH).toBeUndefined();
|
|
3071
3071
|
expect(env.QA_PROJECT_WORKSPACE_CWD).toBe("/remote/workspace/.paperclip-runtime/runs/run-1/workspace");
|
|
3072
|
-
expect(JSON.parse(env.
|
|
3072
|
+
expect(JSON.parse(env.WARDMOTE_WORKSPACES_JSON ?? "[]")).toEqual([
|
|
3073
3073
|
{
|
|
3074
3074
|
workspaceId: "workspace-1",
|
|
3075
3075
|
cwd: "/remote/workspace/.paperclip-runtime/runs/run-1/workspace",
|
|
@@ -3081,9 +3081,9 @@ describe("refreshPaperclipWorkspaceEnvForExecution", () => {
|
|
|
3081
3081
|
});
|
|
3082
3082
|
it("forwards resolved adapter env but never overrides Paperclip runtime env", () => {
|
|
3083
3083
|
const env = {
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3084
|
+
WARDMOTE_RUN_ID: "run-1",
|
|
3085
|
+
WARDMOTE_TASK_ID: "issue-1",
|
|
3086
|
+
WARDMOTE_API_URL: "http://runtime:3100",
|
|
3087
3087
|
};
|
|
3088
3088
|
refreshPaperclipWorkspaceEnvForExecution({
|
|
3089
3089
|
env,
|
|
@@ -3093,50 +3093,50 @@ describe("refreshPaperclipWorkspaceEnvForExecution", () => {
|
|
|
3093
3093
|
// Server-resolved secret_ref value arrives as a plain string here.
|
|
3094
3094
|
OPENROUTER_API_KEY: "resolved-secret-value",
|
|
3095
3095
|
// Reserved-namespace keys must not clobber runtime identity/wake vars.
|
|
3096
|
-
|
|
3097
|
-
|
|
3096
|
+
WARDMOTE_TASK_ID: "attacker-issue",
|
|
3097
|
+
WARDMOTE_API_URL: "http://evil:9999",
|
|
3098
3098
|
},
|
|
3099
3099
|
workspaceCwd: null,
|
|
3100
3100
|
});
|
|
3101
3101
|
expect(env.OOGA_BOOGA_123).toBe("plain-value");
|
|
3102
3102
|
expect(env.OPENROUTER_API_KEY).toBe("resolved-secret-value");
|
|
3103
|
-
expect(env.
|
|
3104
|
-
expect(env.
|
|
3103
|
+
expect(env.WARDMOTE_TASK_ID).toBe("issue-1");
|
|
3104
|
+
expect(env.WARDMOTE_API_URL).toBe("http://runtime:3100");
|
|
3105
3105
|
});
|
|
3106
|
-
it("applies a configured
|
|
3106
|
+
it("applies a configured WARDMOTE_* key only when Paperclip has not set it", () => {
|
|
3107
3107
|
const env = {};
|
|
3108
3108
|
refreshPaperclipWorkspaceEnvForExecution({
|
|
3109
3109
|
env,
|
|
3110
3110
|
envConfig: {
|
|
3111
|
-
|
|
3111
|
+
WARDMOTE_CLOUD_PROVIDER_TOKEN: "cloud-token",
|
|
3112
3112
|
},
|
|
3113
3113
|
workspaceCwd: null,
|
|
3114
3114
|
});
|
|
3115
|
-
// Paperclip did not assign this
|
|
3115
|
+
// Paperclip did not assign this WARDMOTE_*-named key for the run, so the
|
|
3116
3116
|
// configured value flows through to the spawned process.
|
|
3117
|
-
expect(env.
|
|
3117
|
+
expect(env.WARDMOTE_CLOUD_PROVIDER_TOKEN).toBe("cloud-token");
|
|
3118
3118
|
});
|
|
3119
3119
|
it("does not restore the retired wake JSON variable from config", () => {
|
|
3120
3120
|
const env = {};
|
|
3121
3121
|
refreshPaperclipWorkspaceEnvForExecution({
|
|
3122
3122
|
env,
|
|
3123
|
-
envConfig: {
|
|
3123
|
+
envConfig: { WARDMOTE_WAKE_PAYLOAD_JSON: "stale wake" },
|
|
3124
3124
|
workspaceCwd: null,
|
|
3125
3125
|
});
|
|
3126
|
-
expect(env).not.toHaveProperty("
|
|
3126
|
+
expect(env).not.toHaveProperty("WARDMOTE_WAKE_PAYLOAD_JSON");
|
|
3127
3127
|
});
|
|
3128
|
-
it("never accepts
|
|
3128
|
+
it("never accepts WARDMOTE_API_KEY from config env", () => {
|
|
3129
3129
|
const env = {};
|
|
3130
3130
|
refreshPaperclipWorkspaceEnvForExecution({
|
|
3131
3131
|
env,
|
|
3132
3132
|
envConfig: {
|
|
3133
|
-
|
|
3133
|
+
WARDMOTE_API_KEY: "explicit-key",
|
|
3134
3134
|
},
|
|
3135
3135
|
workspaceCwd: null,
|
|
3136
3136
|
});
|
|
3137
|
-
// The harness-minted run token is the only
|
|
3137
|
+
// The harness-minted run token is the only WARDMOTE_API_KEY source;
|
|
3138
3138
|
// a configured value is dropped even when Paperclip has not set one.
|
|
3139
|
-
expect(env.
|
|
3139
|
+
expect(env.WARDMOTE_API_KEY).toBeUndefined();
|
|
3140
3140
|
});
|
|
3141
3141
|
});
|
|
3142
3142
|
describe("appendWithByteCap", () => {
|
|
@@ -3149,10 +3149,10 @@ describe("appendWithByteCap", () => {
|
|
|
3149
3149
|
});
|
|
3150
3150
|
describe("buildPaperclipEnv", () => {
|
|
3151
3151
|
const ENV_KEYS = [
|
|
3152
|
-
"
|
|
3153
|
-
"
|
|
3154
|
-
"
|
|
3155
|
-
"
|
|
3152
|
+
"WARDMOTE_API_URL",
|
|
3153
|
+
"WARDMOTE_RUNTIME_API_URL",
|
|
3154
|
+
"WARDMOTE_LISTEN_HOST",
|
|
3155
|
+
"WARDMOTE_LISTEN_PORT",
|
|
3156
3156
|
"HOST",
|
|
3157
3157
|
"PORT",
|
|
3158
3158
|
];
|
|
@@ -3176,33 +3176,33 @@ describe("buildPaperclipEnv", () => {
|
|
|
3176
3176
|
}
|
|
3177
3177
|
}
|
|
3178
3178
|
}
|
|
3179
|
-
it("prefers an explicit
|
|
3179
|
+
it("prefers an explicit WARDMOTE_API_URL override over the derived runtime URL", () => {
|
|
3180
3180
|
withEnv({
|
|
3181
|
-
|
|
3182
|
-
|
|
3181
|
+
WARDMOTE_API_URL: "http://localhost:3100",
|
|
3182
|
+
WARDMOTE_RUNTIME_API_URL: "http://203.0.113.7:3100",
|
|
3183
3183
|
}, () => {
|
|
3184
3184
|
const env = buildPaperclipEnv({
|
|
3185
3185
|
id: "agent-1",
|
|
3186
3186
|
companyId: "company-1",
|
|
3187
3187
|
});
|
|
3188
|
-
expect(env.
|
|
3189
|
-
expect(env.
|
|
3190
|
-
expect(env.
|
|
3188
|
+
expect(env.WARDMOTE_API_URL).toBe("http://localhost:3100");
|
|
3189
|
+
expect(env.WARDMOTE_AGENT_ID).toBe("agent-1");
|
|
3190
|
+
expect(env.WARDMOTE_COMPANY_ID).toBe("company-1");
|
|
3191
3191
|
});
|
|
3192
3192
|
});
|
|
3193
3193
|
it("falls back to the derived runtime URL when no explicit override is set", () => {
|
|
3194
|
-
withEnv({
|
|
3194
|
+
withEnv({ WARDMOTE_RUNTIME_API_URL: "http://203.0.113.7:3100" }, () => {
|
|
3195
3195
|
const env = buildPaperclipEnv({ id: "agent-1", companyId: "company-1" });
|
|
3196
|
-
expect(env.
|
|
3196
|
+
expect(env.WARDMOTE_API_URL).toBe("http://203.0.113.7:3100");
|
|
3197
3197
|
});
|
|
3198
3198
|
});
|
|
3199
3199
|
it("derives a listen-host URL when neither override is set", () => {
|
|
3200
|
-
withEnv({
|
|
3200
|
+
withEnv({ WARDMOTE_LISTEN_HOST: "0.0.0.0", WARDMOTE_LISTEN_PORT: "3200" }, () => {
|
|
3201
3201
|
const env = buildPaperclipEnv({
|
|
3202
3202
|
id: "agent-1",
|
|
3203
3203
|
companyId: "company-1",
|
|
3204
3204
|
});
|
|
3205
|
-
expect(env.
|
|
3205
|
+
expect(env.WARDMOTE_API_URL).toBe("http://localhost:3200");
|
|
3206
3206
|
});
|
|
3207
3207
|
});
|
|
3208
3208
|
});
|