@penclipai/adapter-opencode-local 2026.401.0-canary.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.
Files changed (66) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cli/format-event.d.ts +2 -0
  3. package/dist/cli/format-event.d.ts.map +1 -0
  4. package/dist/cli/format-event.js +115 -0
  5. package/dist/cli/format-event.js.map +1 -0
  6. package/dist/cli/index.d.ts +2 -0
  7. package/dist/cli/index.d.ts.map +1 -0
  8. package/dist/cli/index.js +2 -0
  9. package/dist/cli/index.js.map +1 -0
  10. package/dist/index.d.ts +8 -0
  11. package/dist/index.d.ts.map +1 -0
  12. package/dist/index.js +46 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/server/execute.d.ts +3 -0
  15. package/dist/server/execute.d.ts.map +1 -0
  16. package/dist/server/execute.js +352 -0
  17. package/dist/server/execute.js.map +1 -0
  18. package/dist/server/index.d.ts +8 -0
  19. package/dist/server/index.d.ts.map +1 -0
  20. package/dist/server/index.js +63 -0
  21. package/dist/server/index.js.map +1 -0
  22. package/dist/server/models.d.ts +20 -0
  23. package/dist/server/models.d.ts.map +1 -0
  24. package/dist/server/models.js +166 -0
  25. package/dist/server/models.js.map +1 -0
  26. package/dist/server/models.test.d.ts +2 -0
  27. package/dist/server/models.test.d.ts.map +1 -0
  28. package/dist/server/models.test.js +22 -0
  29. package/dist/server/models.test.js.map +1 -0
  30. package/dist/server/parse.d.ts +13 -0
  31. package/dist/server/parse.d.ts.map +1 -0
  32. package/dist/server/parse.js +97 -0
  33. package/dist/server/parse.js.map +1 -0
  34. package/dist/server/parse.test.d.ts +2 -0
  35. package/dist/server/parse.test.d.ts.map +1 -0
  36. package/dist/server/parse.test.js +48 -0
  37. package/dist/server/parse.test.js.map +1 -0
  38. package/dist/server/runtime-config.d.ts +11 -0
  39. package/dist/server/runtime-config.d.ts.map +1 -0
  40. package/dist/server/runtime-config.js +75 -0
  41. package/dist/server/runtime-config.js.map +1 -0
  42. package/dist/server/runtime-config.test.d.ts +2 -0
  43. package/dist/server/runtime-config.test.d.ts.map +1 -0
  44. package/dist/server/runtime-config.test.js +60 -0
  45. package/dist/server/runtime-config.test.js.map +1 -0
  46. package/dist/server/skills.d.ts +8 -0
  47. package/dist/server/skills.d.ts.map +1 -0
  48. package/dist/server/skills.js +73 -0
  49. package/dist/server/skills.js.map +1 -0
  50. package/dist/server/test.d.ts +3 -0
  51. package/dist/server/test.d.ts.map +1 -0
  52. package/dist/server/test.js +316 -0
  53. package/dist/server/test.js.map +1 -0
  54. package/dist/ui/build-config.d.ts +3 -0
  55. package/dist/ui/build-config.d.ts.map +1 -0
  56. package/dist/ui/build-config.js +88 -0
  57. package/dist/ui/build-config.js.map +1 -0
  58. package/dist/ui/index.d.ts +3 -0
  59. package/dist/ui/index.d.ts.map +1 -0
  60. package/dist/ui/index.js +3 -0
  61. package/dist/ui/index.js.map +1 -0
  62. package/dist/ui/parse-stdout.d.ts +3 -0
  63. package/dist/ui/parse-stdout.d.ts.map +1 -0
  64. package/dist/ui/parse-stdout.js +141 -0
  65. package/dist/ui/parse-stdout.js.map +1 -0
  66. package/package.json +55 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Paperclip AI
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,2 @@
1
+ export declare function printOpenCodeStreamEvent(raw: string, _debug: boolean): void;
2
+ //# sourceMappingURL=format-event.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-event.d.ts","sourceRoot":"","sources":["../../src/cli/format-event.ts"],"names":[],"mappings":"AAyCA,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,CA+E3E"}
@@ -0,0 +1,115 @@
1
+ import pc from "picocolors";
2
+ function safeJsonParse(text) {
3
+ try {
4
+ return JSON.parse(text);
5
+ }
6
+ catch {
7
+ return null;
8
+ }
9
+ }
10
+ function asRecord(value) {
11
+ if (typeof value !== "object" || value === null || Array.isArray(value))
12
+ return null;
13
+ return value;
14
+ }
15
+ function asString(value, fallback = "") {
16
+ return typeof value === "string" ? value : fallback;
17
+ }
18
+ function asNumber(value, fallback = 0) {
19
+ return typeof value === "number" && Number.isFinite(value) ? value : fallback;
20
+ }
21
+ function errorText(value) {
22
+ if (typeof value === "string")
23
+ return value;
24
+ const rec = asRecord(value);
25
+ if (!rec)
26
+ return "";
27
+ const data = asRecord(rec.data);
28
+ const message = asString(rec.message) ||
29
+ asString(data?.message) ||
30
+ asString(rec.name) ||
31
+ "";
32
+ if (message)
33
+ return message;
34
+ try {
35
+ return JSON.stringify(rec);
36
+ }
37
+ catch {
38
+ return "";
39
+ }
40
+ }
41
+ export function printOpenCodeStreamEvent(raw, _debug) {
42
+ const line = raw.trim();
43
+ if (!line)
44
+ return;
45
+ const parsed = asRecord(safeJsonParse(line));
46
+ if (!parsed) {
47
+ console.log(line);
48
+ return;
49
+ }
50
+ const type = asString(parsed.type);
51
+ if (type === "step_start") {
52
+ const sessionId = asString(parsed.sessionID);
53
+ console.log(pc.blue(`step started${sessionId ? ` (session: ${sessionId})` : ""}`));
54
+ return;
55
+ }
56
+ if (type === "text") {
57
+ const part = asRecord(parsed.part);
58
+ const text = asString(part?.text).trim();
59
+ if (text)
60
+ console.log(pc.green(`assistant: ${text}`));
61
+ return;
62
+ }
63
+ if (type === "reasoning") {
64
+ const part = asRecord(parsed.part);
65
+ const text = asString(part?.text).trim();
66
+ if (text)
67
+ console.log(pc.gray(`thinking: ${text}`));
68
+ return;
69
+ }
70
+ if (type === "tool_use") {
71
+ const part = asRecord(parsed.part);
72
+ const tool = asString(part?.tool, "tool");
73
+ const callID = asString(part?.callID);
74
+ const state = asRecord(part?.state);
75
+ const status = asString(state?.status);
76
+ const isError = status === "error";
77
+ const metadata = asRecord(state?.metadata);
78
+ console.log(pc.yellow(`tool_call: ${tool}${callID ? ` (${callID})` : ""}`));
79
+ if (status) {
80
+ const metaParts = [`status=${status}`];
81
+ if (metadata) {
82
+ for (const [key, value] of Object.entries(metadata)) {
83
+ if (value !== undefined && value !== null)
84
+ metaParts.push(`${key}=${value}`);
85
+ }
86
+ }
87
+ console.log((isError ? pc.red : pc.gray)(`tool_result ${metaParts.join(" ")}`));
88
+ }
89
+ const output = (asString(state?.output) || asString(state?.error)).trim();
90
+ if (output)
91
+ console.log((isError ? pc.red : pc.gray)(output));
92
+ return;
93
+ }
94
+ if (type === "step_finish") {
95
+ const part = asRecord(parsed.part);
96
+ const tokens = asRecord(part?.tokens);
97
+ const cache = asRecord(tokens?.cache);
98
+ const input = asNumber(tokens?.input, 0);
99
+ const output = asNumber(tokens?.output, 0) + asNumber(tokens?.reasoning, 0);
100
+ const cached = asNumber(cache?.read, 0);
101
+ const cost = asNumber(part?.cost, 0);
102
+ const reason = asString(part?.reason, "step");
103
+ console.log(pc.blue(`step finished: reason=${reason}`));
104
+ console.log(pc.blue(`tokens: in=${input} out=${output} cached=${cached} cost=$${cost.toFixed(6)}`));
105
+ return;
106
+ }
107
+ if (type === "error") {
108
+ const message = errorText(parsed.error ?? parsed.message);
109
+ if (message)
110
+ console.log(pc.red(`error: ${message}`));
111
+ return;
112
+ }
113
+ console.log(line);
114
+ }
115
+ //# sourceMappingURL=format-event.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-event.js","sourceRoot":"","sources":["../../src/cli/format-event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,SAAS,aAAa,CAAC,IAAY;IACjC,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACrF,OAAO,KAAgC,CAAC;AAC1C,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc,EAAE,QAAQ,GAAG,EAAE;IAC7C,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC;AACtD,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc,EAAE,QAAQ,GAAG,CAAC;IAC5C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC;AAChF,CAAC;AAED,SAAS,SAAS,CAAC,KAAc;IAC/B,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,MAAM,GAAG,GAAG,QAAQ,CAAC,K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AK,EAAE,CAAC,CAAC,CAAC;QACzC,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;QAC5E,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACxC,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACrC,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAC9C,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,yBAAyB,MAAM,EAAE,CAAC,CAAC,CAAC;QACxD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,cAAc,KAAK,QAAQ,MAAM,WAAW,MAAM,UAAU,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACpG,OAAO;IACT,CAAC;IAED,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;QACrB,MAAM,OAAO,GAAG,SAAS,CAAC,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC;QAC1D,IAAI,OAAO;YAAE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,UAAU,OAAO,EAAE,CAAC,CAAC,CAAC;QACtD,OAAO;IACT,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACpB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { printOpenCodeStreamEvent } from "./format-event.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { printOpenCodeStreamEvent } from "./format-event.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,8 @@
1
+ export declare const type = "opencode_local";
2
+ export declare const label = "OpenCode (local)";
3
+ export declare const models: Array<{
4
+ id: string;
5
+ label: string;
6
+ }>;
7
+ export declare const agentConfigurationDoc = "# opencode_local agent configuration\n\nAdapter: opencode_local\n\nUse when:\n- You want Paperclip to run OpenCode locally as the agent runtime\n- You want provider/model routing in OpenCode format (provider/model)\n- You want OpenCode session resume across heartbeats via --session\n\nDon't use when:\n- You need webhook-style external invocation (use openclaw_gateway or http)\n- You only need one-shot shell commands (use process)\n- OpenCode CLI is not installed on the machine\n\nCore fields:\n- cwd (string, optional): default absolute working directory fallback for the agent process (created if missing when possible)\n- instructionsFilePath (string, optional): absolute path to a markdown instructions file prepended to the run prompt\n- model (string, required): OpenCode model id in provider/model format (for example anthropic/claude-sonnet-4-5)\n- variant (string, optional): provider-specific model variant (for example minimal|low|medium|high|max)\n- dangerouslySkipPermissions (boolean, optional): inject a runtime OpenCode config that allows `external_directory` access without interactive prompts; defaults to true for unattended Paperclip runs\n- promptTemplate (string, optional): run prompt template\n- command (string, optional): defaults to \"opencode\"\n- extraArgs (string[], optional): additional CLI args\n- env (object, optional): KEY=VALUE environment variables\n\nOperational fields:\n- timeoutSec (number, optional): run timeout in seconds\n- graceSec (number, optional): SIGTERM grace period in seconds\n\nNotes:\n- OpenCode supports multiple providers and models. Use `opencode models` to list available options in provider/model format.\n- Paperclip requires an explicit `model` value for `opencode_local` agents.\n- Runs are executed with: opencode run --format json ...\n- Sessions are resumed with --session when stored session cwd matches current cwd.\n- The adapter sets OPENCODE_DISABLE_PROJECT_CONFIG=true to prevent OpenCode from writing an opencode.json config file into the project working directory. Model selection is passed via the --model CLI flag instead.\n- When `dangerouslySkipPermissions` is enabled, Paperclip injects a temporary runtime config with `permission.external_directory=allow` so headless runs do not stall on approval prompts.\n";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,mBAAmB,CAAC;AACrC,eAAO,MAAM,KAAK,qBAAqB,CAAC;AAExC,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAM,CAAC;AAE/D,eAAO,MAAM,qBAAqB,qwEAyCjC,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,46 @@
1
+ export const type = "opencode_local";
2
+ export const label = "OpenCode (local)";
3
+ export const models = [];
4
+ export const agentConfigurationDoc = `# opencode_local agent configuration
5
+
6
+ Adapter: opencode_local
7
+
8
+ Use when:
9
+ - You want Paperclip to run OpenCode locally as the agent runtime
10
+ - You want provider/model routing in OpenCode format (provider/model)
11
+ - You want OpenCode session resume across heartbeats via --session
12
+
13
+ Don't use when:
14
+ - You need webhook-style external invocation (use openclaw_gateway or http)
15
+ - You only need one-shot shell commands (use process)
16
+ - OpenCode CLI is not installed on the machine
17
+
18
+ Core fields:
19
+ - cwd (string, optional): default absolute working directory fallback for the agent process (created if missing when possible)
20
+ - instructionsFilePath (string, optional): absolute path to a markdown instructions file prepended to the run prompt
21
+ - model (string, required): OpenCode model id in provider/model format (for example anthropic/claude-sonnet-4-5)
22
+ - variant (string, optional): provider-specific model variant (for example minimal|low|medium|high|max)
23
+ - dangerouslySkipPermissions (boolean, optional): inject a runtime OpenCode config that allows \`external_directory\` access without interactive prompts; defaults to true for unattended Paperclip runs
24
+ - promptTemplate (string, optional): run prompt template
25
+ - command (string, optional): defaults to "opencode"
26
+ - extraArgs (string[], optional): additional CLI args
27
+ - env (object, optional): KEY=VALUE environment variables
28
+
29
+ Operational fields:
30
+ - timeoutSec (number, optional): run timeout in seconds
31
+ - graceSec (number, optional): SIGTERM grace period in seconds
32
+
33
+ Notes:
34
+ - OpenCode supports multiple providers and models. Use \
35
+ \`opencode models\` to list available options in provider/model format.
36
+ - Paperclip requires an explicit \`model\` value for \`opencode_local\` agents.
37
+ - Runs are executed with: opencode run --format json ...
38
+ - Sessions are resumed with --session when stored session cwd matches current cwd.
39
+ - The adapter sets OPENCODE_DISABLE_PROJECT_CONFIG=true to prevent OpenCode from \
40
+ writing an opencode.json config file into the project working directory. Model \
41
+ selection is passed via the --model CLI flag instead.
42
+ - When \`dangerouslySkipPermissions\` is enabled, Paperclip injects a temporary \
43
+ runtime config with \`permission.external_directory=allow\` so headless runs do \
44
+ not stall on approval prompts.
45
+ `;
46
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,IAAI,GAAG,gBAAgB,CAAC;AACrC,MAAM,CAAC,MAAM,KAAK,GAAG,kBAAkB,CAAC;AAExC,MAAM,CAAC,MAAM,MAAM,GAAyC,EAAE,CAAC;AAE/D,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyCpC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type AdapterExecutionContext, type AdapterExecutionResult } from "@penclipai/adapter-utils";
2
+ export declare function execute(ctx: AdapterExecutionContext): Promise<AdapterExecutionResult>;
3
+ //# sourceMappingURL=execute.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../src/server/execute.ts"],"names":[],"mappings":"AAIA,OAAO,EAA+B,KAAK,uBAAuB,EAAE,KAAK,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAkGlI,wBAAsB,OAAO,CAAC,GAAG,EAAE,uBAAuB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CA8U3F"}
@@ -0,0 +1,352 @@
1
+ import fs from "node:fs/promises";
2
+ import os from "node:os";
3
+ import path from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ import { inferOpenAiCompatibleBiller } from "@penclipai/adapter-utils";
6
+ import { asString, asNumber, asStringArray, parseObject, buildPaperclipEnv, joinPromptSections, buildInvocationEnvForLogs, ensureAbsoluteDirectory, ensureCommandResolvable, ensurePaperclipSkillSymlink, ensurePathInEnv, resolveCommandForLogs, renderTemplate, runChildProcess, readPaperclipRuntimeSkillEntries, resolvePaperclipDesiredSkillNames, } from "@penclipai/adapter-utils/server-utils";
7
+ import { isOpenCodeUnknownSessionError, parseOpenCodeJsonl } from "./parse.js";
8
+ import { ensureOpenCodeModelConfiguredAndAvailable } from "./models.js";
9
+ import { removeMaintainerOnlySkillSymlinks } from "@penclipai/adapter-utils/server-utils";
10
+ import { prepareOpenCodeRuntimeConfig } from "./runtime-config.js";
11
+ const __moduleDir = path.dirname(fileURLToPath(import.meta.url));
12
+ function firstNonEmptyLine(text) {
13
+ return (text
14
+ .split(/\r?\n/)
15
+ .map((line) => line.trim())
16
+ .find(Boolean) ?? "");
17
+ }
18
+ function parseModelProvider(model) {
19
+ if (!model)
20
+ return null;
21
+ const trimmed = model.trim();
22
+ if (!trimmed.includes("/"))
23
+ return null;
24
+ return trimmed.slice(0, trimmed.indexOf("/")).trim() || null;
25
+ }
26
+ function resolveOpenCodeBiller(env, provider) {
27
+ return inferOpenAiCompatibleBiller(env, null) ?? provider ?? "unknown";
28
+ }
29
+ function resolveRuntimeHome(configEnv = {}) {
30
+ const configuredHome = asString(configEnv.HOME, "").trim();
31
+ const processHome = typeof process.env.HOME === "string" && process.env.HOME.trim().length > 0
32
+ ? process.env.HOME.trim()
33
+ : "";
34
+ return path.resolve(configuredHome || processHome || os.homedir());
35
+ }
36
+ function claudeSkillsHome(configEnv = {}) {
37
+ return path.join(resolveRuntimeHome(configEnv), ".claude", "skills");
38
+ }
39
+ async function ensureOpenCodeSkillsInjected(onLog, skillsEntries, desiredSkillNames, configEnv = {}) {
40
+ const skillsHome = claudeSkillsHome(configEnv);
41
+ await fs.mkdir(skillsHome, { recursive: true });
42
+ const desiredSet = new Set(desiredSkillNames ?? skillsEntries.map((entry) => entry.key));
43
+ const selectedEntries = skillsEntries.filter((entry) => desiredSet.has(entry.key));
44
+ const removedSkills = await removeMaintainerOnlySkillSymlinks(skillsHome, selectedEntries.map((entry) => entry.runtimeName));
45
+ for (const skillName of removedSkills) {
46
+ await onLog("stderr", `[paperclip] Removed maintainer-only OpenCode skill "${skillName}" from ${skillsHome}\n`);
47
+ }
48
+ for (const entry of selectedEntries) {
49
+ const target = path.join(skillsHome, entry.runtimeName);
50
+ try {
51
+ const result = await ensurePaperclipSkillSymlink(entry.source, target);
52
+ if (result === "skipped")
53
+ continue;
54
+ await onLog("stderr", `[paperclip] ${result === "repaired" ? "Repaired" : "Injected"} OpenCode skill "${entry.key}" into ${skillsHome}\n`);
55
+ }
56
+ catch (err) {
57
+ await onLog("stderr", `[paperclip] Failed to inject OpenCode skill "${entry.key}" into ${skillsHome}: ${err instanceof Error ? err.message : String(err)}\n`);
58
+ }
59
+ }
60
+ }
61
+ export async function execute(ctx) {
62
+ const { runId, agent, runtime, config, context, onLog, onMeta, onSpawn, authToken } = ctx;
63
+ const promptTemplate = asString(config.promptTemplate, "You are agent {{agent.id}} ({{agent.name}}). Continue your Paperclip work.");
64
+ const command = asString(config.command, "opencode");
65
+ const model = asString(config.model, "").trim();
66
+ const variant = asString(config.variant, "").trim();
67
+ const workspaceContext = parseObject(context.paperclipWorkspace);
68
+ const workspaceCwd = asString(workspaceContext.cwd, "");
69
+ const workspaceSource = asString(workspaceContext.source, "");
70
+ const workspaceId = asString(workspaceContext.workspaceId, "");
71
+ const workspaceRepoUrl = asString(workspaceContext.repoUrl, "");
72
+ const workspaceRepoRef = asString(workspaceContext.repoRef, "");
73
+ const agentHome = asString(workspaceContext.agentHome, "");
74
+ const workspaceHints = Array.isArray(context.paperclipWorkspaces)
75
+ ? context.paperclipWorkspaces.filter((value) => typeof value === "object" && value !== null)
76
+ : [];
77
+ const configuredCwd = asString(config.cwd, "");
78
+ const useConfiguredInsteadOfAgentHome = workspaceSource === "agent_home" && configuredCwd.length > 0;
79
+ const effectiveWorkspaceCwd = useConfiguredInsteadOfAgentHome ? "" : workspaceCwd;
80
+ const cwd = effectiveWorkspaceCwd || configuredCwd || process.cwd();
81
+ await ensureAbsoluteDirectory(cwd, { createIfMissing: true });
82
+ const envConfig = parseObject(config.env);
83
+ const openCodeSkillEntries = await readPaperclipRuntimeSkillEntries(config, __moduleDir);
84
+ const desiredOpenCodeSkillNames = resolvePaperclipDesiredSkillNames(config, openCodeSkillEntries);
85
+ await ensureOpenCodeSkillsInjected(onLog, openCodeSkillEntries, desiredOpenCodeSkillNames, envConfig);
86
+ const hasExplicitApiKey = typeof envConfig.PAPERCLIP_API_KEY === "string" && envConfig.PAPERCLIP_API_KEY.trim().length > 0;
87
+ const env = { ...buildPaperclipEnv(agent) };
88
+ env.PAPERCLIP_RUN_ID = runId;
89
+ const wakeTaskId = (typeof context.taskId === "string" && context.taskId.trim().length > 0 && context.taskId.trim()) ||
90
+ (typeof context.issueId === "string" && context.issueId.trim().length > 0 && context.issueId.trim()) ||
91
+ null;
92
+ const wakeReason = typeof context.wakeReason === "string" && context.wakeReason.trim().length > 0
93
+ ? context.wakeReason.trim()
94
+ : null;
95
+ const wakeCommentId = (typeof context.wakeCommentId === "string" && context.wakeCommentId.trim().length > 0 && context.wakeCommentId.trim()) ||
96
+ (typeof context.commentId === "string" && context.commentId.trim().length > 0 && context.commentId.trim()) ||
97
+ null;
98
+ const approvalId = typeof context.approvalId === "string" && context.approvalId.trim().length > 0
99
+ ? context.approvalId.trim()
100
+ : null;
101
+ const approvalStatus = typeof context.approvalStatus === "string" && context.approvalStatus.trim().length > 0
102
+ ? context.approvalStatus.trim()
103
+ : null;
104
+ const linkedIssueIds = Array.isArray(context.issueIds)
105
+ ? context.issueIds.filter((value) => typeof value === "string" && value.trim().length > 0)
106
+ : [];
107
+ if (wakeTaskId)
108
+ env.PAPERCLIP_TASK_ID = wakeTaskId;
109
+ if (wakeReason)
110
+ env.PAPERCLIP_WAKE_REASON = wakeReason;
111
+ if (wakeCommentId)
112
+ env.PAPERCLIP_WAKE_COMMENT_ID = wakeCommentId;
113
+ if (approvalId)
114
+ env.PAPERCLIP_APPROVAL_ID = approvalId;
115
+ if (approvalStatus)
116
+ env.PAPERCLIP_APPROVAL_STATUS = approvalStatus;
117
+ if (linkedIssueIds.length > 0)
118
+ env.PAPERCLIP_LINKED_ISSUE_IDS = linkedIssueIds.join(",");
119
+ if (effectiveWorkspaceCwd)
120
+ env.PAPERCLIP_WORKSPACE_CWD = effectiveWorkspaceCwd;
121
+ if (workspaceSource)
122
+ env.PAPERCLIP_WORKSPACE_SOURCE = workspaceSource;
123
+ if (workspaceId)
124
+ env.PAPERCLIP_WORKSPACE_ID = workspaceId;
125
+ if (workspaceRepoUrl)
126
+ env.PAPERCLIP_WORKSPACE_REPO_URL = workspaceRepoUrl;
127
+ if (workspaceRepoRef)
128
+ env.PAPERCLIP_WORKSPACE_REPO_REF = workspaceRepoRef;
129
+ if (agentHome)
130
+ env.AGENT_HOME = agentHome;
131
+ if (workspaceHints.length > 0)
132
+ env.PAPERCLIP_WORKSPACES_JSON = JSON.stringify(workspaceHints);
133
+ for (const [key, value] of Object.entries(envConfig)) {
134
+ if (typeof value === "string")
135
+ env[key] = value;
136
+ }
137
+ // Prevent OpenCode from writing an opencode.json config file into the
138
+ // project working directory (which would pollute the git repo). Model
139
+ // selection is already handled via the --model CLI flag. Set after the
140
+ // envConfig loop so user overrides cannot disable this guard.
141
+ env.OPENCODE_DISABLE_PROJECT_CONFIG = "true";
142
+ if (!hasExplicitApiKey && authToken) {
143
+ env.PAPERCLIP_API_KEY = authToken;
144
+ }
145
+ const preparedRuntimeConfig = await prepareOpenCodeRuntimeConfig({ env, config });
146
+ try {
147
+ const runtimeEnv = Object.fromEntries(Object.entries(ensurePathInEnv({ ...process.env, ...preparedRuntimeConfig.env })).filter((entry) => typeof entry[1] === "string"));
148
+ await ensureCommandResolvable(command, cwd, runtimeEnv);
149
+ const resolvedCommand = await resolveCommandForLogs(command, cwd, runtimeEnv);
150
+ const loggedEnv = buildInvocationEnvForLogs(preparedRuntimeConfig.env, {
151
+ runtimeEnv,
152
+ includeRuntimeKeys: ["HOME"],
153
+ resolvedCommand,
154
+ });
155
+ await ensureOpenCodeModelConfiguredAndAvailable({
156
+ model,
157
+ command,
158
+ cwd,
159
+ env: runtimeEnv,
160
+ });
161
+ const timeoutSec = asNumber(config.timeoutSec, 0);
162
+ const graceSec = asNumber(config.graceSec, 20);
163
+ const extraArgs = (() => {
164
+ const fromExtraArgs = asStringArray(config.extraArgs);
165
+ if (fromExtraArgs.length > 0)
166
+ return fromExtraArgs;
167
+ return asStringArray(config.args);
168
+ })();
169
+ const runtimeSessionParams = parseObject(runtime.sessionParams);
170
+ const runtimeSessionId = asString(runtimeSessionParams.sessionId, runtime.sessionId ?? "");
171
+ const runtimeSessionCwd = asString(runtimeSessionParams.cwd, "");
172
+ const canResumeSession = runtimeSessionId.length > 0 &&
173
+ (runtimeSessionCwd.length === 0 || path.resolve(runtimeSessionCwd) === path.resolve(cwd));
174
+ const sessionId = canResumeSession ? runtimeSessionId : null;
175
+ if (runtimeSessionId && !canResumeSession) {
176
+ await onLog("stdout", `[paperclip] OpenCode session "${runtimeSessionId}" was saved for cwd "${runtimeSessionCwd}" and will not be resumed in "${cwd}".\n`);
177
+ }
178
+ const instructionsFilePath = asString(config.instructionsFilePath, "").trim();
179
+ const resolvedInstructionsFilePath = instructionsFilePath
180
+ ? path.resolve(cwd, instructionsFilePath)
181
+ : "";
182
+ const instructionsDir = resolvedInstructionsFilePath ? `${path.dirname(resolvedInstructionsFilePath)}/` : "";
183
+ let instructionsPrefix = "";
184
+ if (resolvedInstructionsFilePath) {
185
+ try {
186
+ const instructionsContents = await fs.readFile(resolvedInstructionsFilePath, "utf8");
187
+ instructionsPrefix =
188
+ `${instructionsContents}\n\n` +
189
+ `The above agent instructions were loaded from ${resolvedInstructionsFilePath}. ` +
190
+ `Resolve any relative file references from ${instructionsDir}.\n\n`;
191
+ }
192
+ catch (err) {
193
+ const reason = err instanceof Error ? err.message : String(err);
194
+ await onLog("stdout", `[paperclip] Warning: could not read agent instructions file "${resolvedInstructionsFilePath}": ${reason}\n`);
195
+ }
196
+ }
197
+ const commandNotes = (() => {
198
+ const notes = [...preparedRuntimeConfig.notes];
199
+ if (!resolvedInstructionsFilePath)
200
+ return notes;
201
+ if (instructionsPrefix.length > 0) {
202
+ notes.push(`Loaded agent instructions from ${resolvedInstructionsFilePath}`);
203
+ notes.push(`Prepended instructions + path directive to stdin prompt (relative references from ${instructionsDir}).`);
204
+ return notes;
205
+ }
206
+ notes.push(`Configured instructionsFilePath ${resolvedInstructionsFilePath}, but file could not be read; continuing without injected instructions.`);
207
+ return notes;
208
+ })();
209
+ const bootstrapPromptTemplate = asString(config.bootstrapPromptTemplate, "");
210
+ const templateData = {
211
+ agentId: agent.id,
212
+ companyId: agent.companyId,
213
+ runId,
214
+ company: { id: agent.companyId },
215
+ agent,
216
+ run: { id: runId, source: "on_demand" },
217
+ context,
218
+ };
219
+ const renderedPrompt = renderTemplate(promptTemplate, templateData);
220
+ const renderedBootstrapPrompt = !sessionId && bootstrapPromptTemplate.trim().length > 0
221
+ ? renderTemplate(bootstrapPromptTemplate, templateData).trim()
222
+ : "";
223
+ const sessionHandoffNote = asString(context.paperclipSessionHandoffMarkdown, "").trim();
224
+ const localizationPromptNote = asString(context.paperclipLocalizationPromptMarkdown, "").trim();
225
+ const prompt = joinPromptSections([
226
+ instructionsPrefix,
227
+ renderedBootstrapPrompt,
228
+ sessionHandoffNote,
229
+ localizationPromptNote,
230
+ renderedPrompt,
231
+ ]);
232
+ const promptMetrics = {
233
+ promptChars: prompt.length,
234
+ instructionsChars: instructionsPrefix.length,
235
+ bootstrapPromptChars: renderedBootstrapPrompt.length,
236
+ sessionHandoffChars: sessionHandoffNote.length,
237
+ localizationPromptChars: localizationPromptNote.length,
238
+ heartbeatPromptChars: renderedPrompt.length,
239
+ };
240
+ const buildArgs = (resumeSessionId) => {
241
+ const args = ["run", "--format", "json"];
242
+ if (resumeSessionId)
243
+ args.push("--session", resumeSessionId);
244
+ if (model)
245
+ args.push("--model", model);
246
+ if (variant)
247
+ args.push("--variant", variant);
248
+ if (extraArgs.length > 0)
249
+ args.push(...extraArgs);
250
+ return args;
251
+ };
252
+ const runAttempt = async (resumeSessionId) => {
253
+ const args = buildArgs(resumeSessionId);
254
+ if (onMeta) {
255
+ await onMeta({
256
+ adapterType: "opencode_local",
257
+ command: resolvedCommand,
258
+ cwd,
259
+ commandNotes,
260
+ commandArgs: [...args, `<stdin prompt ${prompt.length} chars>`],
261
+ env: loggedEnv,
262
+ prompt,
263
+ promptMetrics,
264
+ context,
265
+ });
266
+ }
267
+ const proc = await runChildProcess(runId, command, args, {
268
+ cwd,
269
+ env: runtimeEnv,
270
+ stdin: prompt,
271
+ timeoutSec,
272
+ graceSec,
273
+ onSpawn,
274
+ onLog,
275
+ });
276
+ return {
277
+ proc,
278
+ rawStderr: proc.stderr,
279
+ parsed: parseOpenCodeJsonl(proc.stdout),
280
+ };
281
+ };
282
+ const toResult = (attempt, clearSessionOnMissingSession = false) => {
283
+ if (attempt.proc.timedOut) {
284
+ return {
285
+ exitCode: attempt.proc.exitCode,
286
+ signal: attempt.proc.signal,
287
+ timedOut: true,
288
+ errorMessage: `Timed out after ${timeoutSec}s`,
289
+ clearSession: clearSessionOnMissingSession,
290
+ };
291
+ }
292
+ const resolvedSessionId = attempt.parsed.sessionId ??
293
+ (clearSessionOnMissingSession ? null : runtimeSessionId ?? runtime.sessionId ?? null);
294
+ const resolvedSessionParams = resolvedSessionId
295
+ ? {
296
+ sessionId: resolvedSessionId,
297
+ cwd,
298
+ ...(workspaceId ? { workspaceId } : {}),
299
+ ...(workspaceRepoUrl ? { repoUrl: workspaceRepoUrl } : {}),
300
+ ...(workspaceRepoRef ? { repoRef: workspaceRepoRef } : {}),
301
+ }
302
+ : null;
303
+ const parsedError = typeof attempt.parsed.errorMessage === "string" ? attempt.parsed.errorMessage.trim() : "";
304
+ const stderrLine = firstNonEmptyLine(attempt.proc.stderr);
305
+ const rawExitCode = attempt.proc.exitCode;
306
+ const synthesizedExitCode = parsedError && (rawExitCode ?? 0) === 0 ? 1 : rawExitCode;
307
+ const fallbackErrorMessage = parsedError ||
308
+ stderrLine ||
309
+ `OpenCode exited with code ${synthesizedExitCode ?? -1}`;
310
+ const modelId = model || null;
311
+ return {
312
+ exitCode: synthesizedExitCode,
313
+ signal: attempt.proc.signal,
314
+ timedOut: false,
315
+ errorMessage: (synthesizedExitCode ?? 0) === 0 ? null : fallbackErrorMessage,
316
+ usage: {
317
+ inputTokens: attempt.parsed.usage.inputTokens,
318
+ outputTokens: attempt.parsed.usage.outputTokens,
319
+ cachedInputTokens: attempt.parsed.usage.cachedInputTokens,
320
+ },
321
+ sessionId: resolvedSessionId,
322
+ sessionParams: resolvedSessionParams,
323
+ sessionDisplayId: resolvedSessionId,
324
+ provider: parseModelProvider(modelId),
325
+ biller: resolveOpenCodeBiller(runtimeEnv, parseModelProvider(modelId)),
326
+ model: modelId,
327
+ billingType: "unknown",
328
+ costUsd: attempt.parsed.costUsd,
329
+ resultJson: {
330
+ stdout: attempt.proc.stdout,
331
+ stderr: attempt.proc.stderr,
332
+ },
333
+ summary: attempt.parsed.summary,
334
+ clearSession: Boolean(clearSessionOnMissingSession && !attempt.parsed.sessionId),
335
+ };
336
+ };
337
+ const initial = await runAttempt(sessionId);
338
+ const initialFailed = !initial.proc.timedOut && ((initial.proc.exitCode ?? 0) !== 0 || Boolean(initial.parsed.errorMessage));
339
+ if (sessionId &&
340
+ initialFailed &&
341
+ isOpenCodeUnknownSessionError(initial.proc.stdout, initial.rawStderr)) {
342
+ await onLog("stdout", `[paperclip] OpenCode session "${sessionId}" is unavailable; retrying with a fresh session.\n`);
343
+ const retry = await runAttempt(null);
344
+ return toResult(retry, true);
345
+ }
346
+ return toResult(initial);
347
+ }
348
+ finally {
349
+ await preparedRuntimeConfig.cleanup();
350
+ }
351
+ }
352
+ //# sourceMappingURL=execute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execute.js","sourceRoot":"","sources":["../../src/server/execute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,2BAA2B,EAA6D,MAAM,0BAA0B,CAAC;AAClI,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,yBAAyB,EACzB,uBAAuB,EACvB,uBAAuB,EACvB,2BAA2B,EAC3B,eAAe,EACf,qBAAqB,EACrB,cAAc,EACd,eAAe,EACf,gCAAgC,EAChC,iCAAiC,GAClC,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,6BAA6B,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAC/E,OAAO,EAAE,yCAAyC,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,iCAAiC,EAAE,MAAM,uCAAuC,CAAC;AAC1F,OAAO,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAEnE,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAEjE,SAAS,iBAAiB,CAAC,IAAY;IACrC,OAAO,CACL,IAAI;SACD,KAAK,CAAC,OAAO,CAAC;SACd,GAAG,CAAC,CAAC,IAAI,EAA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AC;YAAS,CAAC;QACT,MAAM,qBAAqB,CAAC,OAAO,EAAE,CAAC;IACxC,CAAC;AACH,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { AdapterSessionCodec } from "@penclipai/adapter-utils";
2
+ export declare const sessionCodec: AdapterSessionCodec;
3
+ export { execute } from "./execute.js";
4
+ export { listOpenCodeSkills, syncOpenCodeSkills } from "./skills.js";
5
+ export { testEnvironment } from "./test.js";
6
+ export { listOpenCodeModels, discoverOpenCodeModels, ensureOpenCodeModelConfiguredAndAvailable, resetOpenCodeModelsCacheForTests, } from "./models.js";
7
+ export { parseOpenCodeJsonl, isOpenCodeUnknownSessionError } from "./parse.js";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAMpE,eAAO,MAAM,YAAY,EAAE,mBAsD1B,CAAC;AAEF,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,yCAAyC,EACzC,gCAAgC,GACjC,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,kBAAkB,EAAE,6BAA6B,EAAE,MAAM,YAAY,CAAC"}