@tickernelz/paperclip-pro-adapter-claude-local 2026.925.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/LICENSE +22 -0
- package/dist/cli/format-event.d.ts +2 -0
- package/dist/cli/format-event.d.ts.map +1 -0
- package/dist/cli/format-event.js +141 -0
- package/dist/cli/format-event.js.map +1 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +2 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/quota-probe.d.ts +3 -0
- package/dist/cli/quota-probe.d.ts.map +1 -0
- package/dist/cli/quota-probe.js +106 -0
- package/dist/cli/quota-probe.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +90 -0
- package/dist/index.js.map +1 -0
- package/dist/index.test.d.ts +2 -0
- package/dist/index.test.d.ts.map +1 -0
- package/dist/index.test.js +35 -0
- package/dist/index.test.js.map +1 -0
- package/dist/server/acp.auth.test.d.ts +2 -0
- package/dist/server/acp.auth.test.d.ts.map +1 -0
- package/dist/server/acp.auth.test.js +581 -0
- package/dist/server/acp.auth.test.js.map +1 -0
- package/dist/server/acp.d.ts +68 -0
- package/dist/server/acp.d.ts.map +1 -0
- package/dist/server/acp.js +779 -0
- package/dist/server/acp.js.map +1 -0
- package/dist/server/acp.quota.test.d.ts +2 -0
- package/dist/server/acp.quota.test.d.ts.map +1 -0
- package/dist/server/acp.quota.test.js +114 -0
- package/dist/server/acp.quota.test.js.map +1 -0
- package/dist/server/acp.test.d.ts +2 -0
- package/dist/server/acp.test.d.ts.map +1 -0
- package/dist/server/acp.test.js +1153 -0
- package/dist/server/acp.test.js.map +1 -0
- package/dist/server/auth-check.d.ts +8 -0
- package/dist/server/auth-check.d.ts.map +1 -0
- package/dist/server/auth-check.js +8 -0
- package/dist/server/auth-check.js.map +1 -0
- package/dist/server/claude-config.d.ts +49 -0
- package/dist/server/claude-config.d.ts.map +1 -0
- package/dist/server/claude-config.js +279 -0
- package/dist/server/claude-config.js.map +1 -0
- package/dist/server/claude-config.test.d.ts +2 -0
- package/dist/server/claude-config.test.d.ts.map +1 -0
- package/dist/server/claude-config.test.js +197 -0
- package/dist/server/claude-config.test.js.map +1 -0
- package/dist/server/cli-capabilities.d.ts +26 -0
- package/dist/server/cli-capabilities.d.ts.map +1 -0
- package/dist/server/cli-capabilities.js +115 -0
- package/dist/server/cli-capabilities.js.map +1 -0
- package/dist/server/config-schema.d.ts +3 -0
- package/dist/server/config-schema.d.ts.map +1 -0
- package/dist/server/config-schema.js +67 -0
- package/dist/server/config-schema.js.map +1 -0
- package/dist/server/engine-availability.test.d.ts +2 -0
- package/dist/server/engine-availability.test.d.ts.map +1 -0
- package/dist/server/engine-availability.test.js +41 -0
- package/dist/server/engine-availability.test.js.map +1 -0
- package/dist/server/execute.acp-fallback.test.d.ts +2 -0
- package/dist/server/execute.acp-fallback.test.d.ts.map +1 -0
- package/dist/server/execute.acp-fallback.test.js +104 -0
- package/dist/server/execute.acp-fallback.test.js.map +1 -0
- package/dist/server/execute.d.ts +23 -0
- package/dist/server/execute.d.ts.map +1 -0
- package/dist/server/execute.js +1089 -0
- package/dist/server/execute.js.map +1 -0
- package/dist/server/execute.remote.test.d.ts +2 -0
- package/dist/server/execute.remote.test.d.ts.map +1 -0
- package/dist/server/execute.remote.test.js +484 -0
- package/dist/server/execute.remote.test.js.map +1 -0
- package/dist/server/index.d.ts +16 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +84 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/models.d.ts +13 -0
- package/dist/server/models.d.ts.map +1 -0
- package/dist/server/models.js +153 -0
- package/dist/server/models.js.map +1 -0
- package/dist/server/parse.d.ts +58 -0
- package/dist/server/parse.d.ts.map +1 -0
- package/dist/server/parse.js +459 -0
- package/dist/server/parse.js.map +1 -0
- package/dist/server/parse.test.d.ts +2 -0
- package/dist/server/parse.test.d.ts.map +1 -0
- package/dist/server/parse.test.js +419 -0
- package/dist/server/parse.test.js.map +1 -0
- package/dist/server/permissions.d.ts +14 -0
- package/dist/server/permissions.d.ts.map +1 -0
- package/dist/server/permissions.js +13 -0
- package/dist/server/permissions.js.map +1 -0
- package/dist/server/permissions.test.d.ts +2 -0
- package/dist/server/permissions.test.d.ts.map +1 -0
- package/dist/server/permissions.test.js +22 -0
- package/dist/server/permissions.test.js.map +1 -0
- package/dist/server/probe-diagnostics.d.ts +102 -0
- package/dist/server/probe-diagnostics.d.ts.map +1 -0
- package/dist/server/probe-diagnostics.js +140 -0
- package/dist/server/probe-diagnostics.js.map +1 -0
- package/dist/server/probe-diagnostics.test.d.ts +2 -0
- package/dist/server/probe-diagnostics.test.d.ts.map +1 -0
- package/dist/server/probe-diagnostics.test.js +114 -0
- package/dist/server/probe-diagnostics.test.js.map +1 -0
- package/dist/server/probe-env.d.ts +42 -0
- package/dist/server/probe-env.d.ts.map +1 -0
- package/dist/server/probe-env.js +149 -0
- package/dist/server/probe-env.js.map +1 -0
- package/dist/server/probe-env.test.d.ts +2 -0
- package/dist/server/probe-env.test.d.ts.map +1 -0
- package/dist/server/probe-env.test.js +135 -0
- package/dist/server/probe-env.test.js.map +1 -0
- package/dist/server/probe-redaction.test.d.ts +2 -0
- package/dist/server/probe-redaction.test.d.ts.map +1 -0
- package/dist/server/probe-redaction.test.js +86 -0
- package/dist/server/probe-redaction.test.js.map +1 -0
- package/dist/server/prompt-cache.d.ts +17 -0
- package/dist/server/prompt-cache.d.ts.map +1 -0
- package/dist/server/prompt-cache.js +126 -0
- package/dist/server/prompt-cache.js.map +1 -0
- package/dist/server/quota-keychain.test.d.ts +2 -0
- package/dist/server/quota-keychain.test.d.ts.map +1 -0
- package/dist/server/quota-keychain.test.js +83 -0
- package/dist/server/quota-keychain.test.js.map +1 -0
- package/dist/server/quota.d.ts +30 -0
- package/dist/server/quota.d.ts.map +1 -0
- package/dist/server/quota.js +543 -0
- package/dist/server/quota.js.map +1 -0
- package/dist/server/setup-token-characterization.test.d.ts +2 -0
- package/dist/server/setup-token-characterization.test.d.ts.map +1 -0
- package/dist/server/setup-token-characterization.test.js +123 -0
- package/dist/server/setup-token-characterization.test.js.map +1 -0
- package/dist/server/setup-token-parse.d.ts +47 -0
- package/dist/server/setup-token-parse.d.ts.map +1 -0
- package/dist/server/setup-token-parse.js +506 -0
- package/dist/server/setup-token-parse.js.map +1 -0
- package/dist/server/setup-token-parse.test.d.ts +2 -0
- package/dist/server/setup-token-parse.test.d.ts.map +1 -0
- package/dist/server/setup-token-parse.test.js +587 -0
- package/dist/server/setup-token-parse.test.js.map +1 -0
- package/dist/server/setup-token-runner.d.ts +115 -0
- package/dist/server/setup-token-runner.d.ts.map +1 -0
- package/dist/server/setup-token-runner.js +317 -0
- package/dist/server/setup-token-runner.js.map +1 -0
- package/dist/server/setup-token-runner.test.d.ts +2 -0
- package/dist/server/setup-token-runner.test.d.ts.map +1 -0
- package/dist/server/setup-token-runner.test.js +336 -0
- package/dist/server/setup-token-runner.test.js.map +1 -0
- package/dist/server/skills.d.ts +8 -0
- package/dist/server/skills.d.ts.map +1 -0
- package/dist/server/skills.js +42 -0
- package/dist/server/skills.js.map +1 -0
- package/dist/server/test.d.ts +3 -0
- package/dist/server/test.d.ts.map +1 -0
- package/dist/server/test.js +434 -0
- package/dist/server/test.js.map +1 -0
- package/dist/server/test.probe.test.d.ts +2 -0
- package/dist/server/test.probe.test.d.ts.map +1 -0
- package/dist/server/test.probe.test.js +608 -0
- package/dist/server/test.probe.test.js.map +1 -0
- package/dist/server/test.remote.test.d.ts +2 -0
- package/dist/server/test.remote.test.d.ts.map +1 -0
- package/dist/server/test.remote.test.js +149 -0
- package/dist/server/test.remote.test.js.map +1 -0
- package/dist/ui/build-config.d.ts +3 -0
- package/dist/ui/build-config.d.ts.map +1 -0
- package/dist/ui/build-config.js +76 -0
- package/dist/ui/build-config.js.map +1 -0
- package/dist/ui/build-config.test.d.ts +2 -0
- package/dist/ui/build-config.test.d.ts.map +1 -0
- package/dist/ui/build-config.test.js +68 -0
- package/dist/ui/build-config.test.js.map +1 -0
- package/dist/ui/index.d.ts +3 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +3 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/parse-stdout.d.ts +3 -0
- package/dist/ui/parse-stdout.d.ts.map +1 -0
- package/dist/ui/parse-stdout.js +153 -0
- package/dist/ui/parse-stdout.js.map +1 -0
- package/package.json +63 -0
- package/skills/agentmail/SKILL.md +70 -0
- package/skills/paperclip/SKILL.md +712 -0
- package/skills/paperclip/references/api-reference.md +1675 -0
- package/skills/paperclip/references/artifacts.md +158 -0
- package/skills/paperclip/references/cases.md +295 -0
- package/skills/paperclip/references/company-skills.md +266 -0
- package/skills/paperclip/references/issue-workspaces.md +80 -0
- package/skills/paperclip/references/routines.md +231 -0
- package/skills/paperclip/references/workflows.md +141 -0
- package/skills/paperclip/scripts/paperclip-upload-artifact.sh +592 -0
- package/skills/paperclip-board/SKILL.md +619 -0
- package/skills/paperclip-converting-plans-to-tasks/SKILL.md +60 -0
- package/skills/paperclip-create-agent/SKILL.md +179 -0
- package/skills/paperclip-create-agent/references/agent-instruction-templates.md +123 -0
- package/skills/paperclip-create-agent/references/agents/coder.md +64 -0
- package/skills/paperclip-create-agent/references/agents/qa.md +88 -0
- package/skills/paperclip-create-agent/references/agents/securityengineer.md +135 -0
- package/skills/paperclip-create-agent/references/agents/uxdesigner.md +115 -0
- package/skills/paperclip-create-agent/references/api-reference.md +110 -0
- package/skills/paperclip-create-agent/references/baseline-role-guide.md +168 -0
- package/skills/paperclip-create-agent/references/draft-review-checklist.md +95 -0
- package/skills/para-memory-files/SKILL.md +100 -0
- package/skills/para-memory-files/references/schemas.md +35 -0
- package/skills/slack/SKILL.md +65 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Paperclip AI
|
|
4
|
+
Copyright (c) 2026 Zhafron Adani Kautsar (paperclip-pro fork modifications)
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-event.d.ts","sourceRoot":"","sources":["../../src/cli/format-event.ts"],"names":[],"mappings":"AAyCA,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAsGxE"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import pc from "picocolors";
|
|
2
|
+
import { printAcpxStreamEvent } from "@tickernelz/paperclip-pro-adapter-utils/acpx-engine/cli";
|
|
3
|
+
function asErrorText(value) {
|
|
4
|
+
if (typeof value === "string")
|
|
5
|
+
return value;
|
|
6
|
+
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
7
|
+
return "";
|
|
8
|
+
const obj = value;
|
|
9
|
+
const message = (typeof obj.message === "string" && obj.message) ||
|
|
10
|
+
(typeof obj.error === "string" && obj.error) ||
|
|
11
|
+
(typeof obj.code === "string" && obj.code) ||
|
|
12
|
+
"";
|
|
13
|
+
if (message)
|
|
14
|
+
return message;
|
|
15
|
+
try {
|
|
16
|
+
return JSON.stringify(obj);
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
return "";
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function printToolResult(block) {
|
|
23
|
+
const isError = block.is_error === true;
|
|
24
|
+
let text = "";
|
|
25
|
+
if (typeof block.content === "string") {
|
|
26
|
+
text = block.content;
|
|
27
|
+
}
|
|
28
|
+
else if (Array.isArray(block.content)) {
|
|
29
|
+
const parts = [];
|
|
30
|
+
for (const part of block.content) {
|
|
31
|
+
if (typeof part !== "object" || part === null || Array.isArray(part))
|
|
32
|
+
continue;
|
|
33
|
+
const record = part;
|
|
34
|
+
if (typeof record.text === "string")
|
|
35
|
+
parts.push(record.text);
|
|
36
|
+
}
|
|
37
|
+
text = parts.join("\n");
|
|
38
|
+
}
|
|
39
|
+
console.log((isError ? pc.red : pc.cyan)(`tool_result${isError ? " (error)" : ""}`));
|
|
40
|
+
if (text) {
|
|
41
|
+
console.log((isError ? pc.red : pc.gray)(text));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export function printClaudeStreamEvent(raw, debug) {
|
|
45
|
+
const line = raw.trim();
|
|
46
|
+
if (!line)
|
|
47
|
+
return;
|
|
48
|
+
let parsed = null;
|
|
49
|
+
try {
|
|
50
|
+
parsed = JSON.parse(line);
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
console.log(line);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const type = typeof parsed.type === "string" ? parsed.type : "";
|
|
57
|
+
if (type.startsWith("acpx.")) {
|
|
58
|
+
printAcpxStreamEvent(line, debug);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (type === "system" && parsed.subtype === "init") {
|
|
62
|
+
const model = typeof parsed.model === "string" ? parsed.model : "unknown";
|
|
63
|
+
const sessionId = typeof parsed.session_id === "string" ? parsed.session_id : "";
|
|
64
|
+
console.log(pc.blue(`Claude initialized (model: ${model}${sessionId ? `, session: ${sessionId}` : ""})`));
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if (type === "assistant") {
|
|
68
|
+
const message = typeof parsed.message === "object" && parsed.message !== null && !Array.isArray(parsed.message)
|
|
69
|
+
? parsed.message
|
|
70
|
+
: {};
|
|
71
|
+
const content = Array.isArray(message.content) ? message.content : [];
|
|
72
|
+
for (const blockRaw of content) {
|
|
73
|
+
if (typeof blockRaw !== "object" || blockRaw === null || Array.isArray(blockRaw))
|
|
74
|
+
continue;
|
|
75
|
+
const block = blockRaw;
|
|
76
|
+
const blockType = typeof block.type === "string" ? block.type : "";
|
|
77
|
+
if (blockType === "text") {
|
|
78
|
+
const text = typeof block.text === "string" ? block.text : "";
|
|
79
|
+
if (text)
|
|
80
|
+
console.log(pc.green(`assistant: ${text}`));
|
|
81
|
+
}
|
|
82
|
+
else if (blockType === "thinking") {
|
|
83
|
+
const text = typeof block.thinking === "string" ? block.thinking : "";
|
|
84
|
+
if (text)
|
|
85
|
+
console.log(pc.gray(`thinking: ${text}`));
|
|
86
|
+
}
|
|
87
|
+
else if (blockType === "tool_use") {
|
|
88
|
+
const name = typeof block.name === "string" ? block.name : "unknown";
|
|
89
|
+
console.log(pc.yellow(`tool_call: ${name}`));
|
|
90
|
+
if (block.input !== undefined) {
|
|
91
|
+
console.log(pc.gray(JSON.stringify(block.input, null, 2)));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
if (type === "user") {
|
|
98
|
+
const message = typeof parsed.message === "object" && parsed.message !== null && !Array.isArray(parsed.message)
|
|
99
|
+
? parsed.message
|
|
100
|
+
: {};
|
|
101
|
+
const content = Array.isArray(message.content) ? message.content : [];
|
|
102
|
+
for (const blockRaw of content) {
|
|
103
|
+
if (typeof blockRaw !== "object" || blockRaw === null || Array.isArray(blockRaw))
|
|
104
|
+
continue;
|
|
105
|
+
const block = blockRaw;
|
|
106
|
+
if (typeof block.type === "string" && block.type === "tool_result") {
|
|
107
|
+
printToolResult(block);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
if (type === "result") {
|
|
113
|
+
const usage = typeof parsed.usage === "object" && parsed.usage !== null && !Array.isArray(parsed.usage)
|
|
114
|
+
? parsed.usage
|
|
115
|
+
: {};
|
|
116
|
+
const input = Number(usage.input_tokens ?? 0);
|
|
117
|
+
const output = Number(usage.output_tokens ?? 0);
|
|
118
|
+
const cached = Number(usage.cache_read_input_tokens ?? 0);
|
|
119
|
+
const cost = Number(parsed.total_cost_usd ?? 0);
|
|
120
|
+
const subtype = typeof parsed.subtype === "string" ? parsed.subtype : "";
|
|
121
|
+
const isError = parsed.is_error === true;
|
|
122
|
+
const resultText = typeof parsed.result === "string" ? parsed.result : "";
|
|
123
|
+
if (resultText) {
|
|
124
|
+
console.log(pc.green("result:"));
|
|
125
|
+
console.log(resultText);
|
|
126
|
+
}
|
|
127
|
+
const errors = Array.isArray(parsed.errors) ? parsed.errors.map(asErrorText).filter(Boolean) : [];
|
|
128
|
+
if (subtype.startsWith("error") || isError || errors.length > 0) {
|
|
129
|
+
console.log(pc.red(`claude_result: subtype=${subtype || "unknown"} is_error=${isError ? "true" : "false"}`));
|
|
130
|
+
if (errors.length > 0) {
|
|
131
|
+
console.log(pc.red(`claude_errors: ${errors.join(" | ")}`));
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
console.log(pc.blue(`tokens: in=${Number.isFinite(input) ? input : 0} out=${Number.isFinite(output) ? output : 0} cached=${Number.isFinite(cached) ? cached : 0} cost=$${Number.isFinite(cost) ? cost.toFixed(6) : "0.000000"}`));
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
if (debug) {
|
|
138
|
+
console.log(pc.gray(line));
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
//# 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;AAC5B,OAAO,EAAE,oBAAoB,EAAE,MAAM,yDAAyD,CAAC;AAE/F,SAAS,WAAW,CAAC,KAAc;IACjC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACnF,MAAM,GAAG,GAAG,KAAgC,CAAC;IAC7C,MAAM,OAAO,GACX,CAAC,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,IAAI,GAAG,CAAC,OAAO,CAAC;QAChD,CAAC,OAAO,GAAG,CAAC,KAAK,KAAK,QAAQ,IAAI,GAAG,CAAC,KAAK,CAAC;QAC5C,CAAC,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,CAAC;QAC1C,EAAE,CAAC;IACL,IAAI,OAAO;QAAE,OAAO,OAAO,CAAC;IAC5B,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAC,KAA8B;IACrD,MAAM,OAAO,GAAG,KAAK,CAAC,QA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,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quota-probe.d.ts","sourceRoot":"","sources":["../../src/cli/quota-probe.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { captureClaudeCliUsageText, fetchClaudeCliQuota, fetchClaudeQuota, getQuotaWindows, parseClaudeCliUsageText, readClaudeAuthStatus, readClaudeToken, } from "../server/quota.js";
|
|
3
|
+
function parseArgs(argv) {
|
|
4
|
+
return {
|
|
5
|
+
json: argv.includes("--json"),
|
|
6
|
+
includeRawCli: argv.includes("--raw-cli"),
|
|
7
|
+
oauthOnly: argv.includes("--oauth-only"),
|
|
8
|
+
cliOnly: argv.includes("--cli-only"),
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
function stringifyError(error) {
|
|
12
|
+
return error instanceof Error ? error.message : String(error);
|
|
13
|
+
}
|
|
14
|
+
async function main() {
|
|
15
|
+
const args = parseArgs(process.argv.slice(2));
|
|
16
|
+
if (args.oauthOnly && args.cliOnly) {
|
|
17
|
+
throw new Error("Choose either --oauth-only or --cli-only, not both.");
|
|
18
|
+
}
|
|
19
|
+
const authStatus = await readClaudeAuthStatus();
|
|
20
|
+
const token = await readClaudeToken();
|
|
21
|
+
const result = {
|
|
22
|
+
timestamp: new Date().toISOString(),
|
|
23
|
+
authStatus,
|
|
24
|
+
tokenAvailable: token != null,
|
|
25
|
+
};
|
|
26
|
+
if (!args.cliOnly) {
|
|
27
|
+
if (!token) {
|
|
28
|
+
result.oauth = {
|
|
29
|
+
ok: false,
|
|
30
|
+
error: "No Claude OAuth access token found in local credentials files.",
|
|
31
|
+
windows: [],
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
try {
|
|
36
|
+
result.oauth = {
|
|
37
|
+
ok: true,
|
|
38
|
+
windows: await fetchClaudeQuota(token),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
result.oauth = {
|
|
43
|
+
ok: false,
|
|
44
|
+
error: stringifyError(error),
|
|
45
|
+
windows: [],
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (!args.oauthOnly) {
|
|
51
|
+
try {
|
|
52
|
+
const rawCliText = args.includeRawCli ? await captureClaudeCliUsageText() : null;
|
|
53
|
+
const windows = rawCliText ? parseClaudeCliUsageText(rawCliText) : await fetchClaudeCliQuota();
|
|
54
|
+
result.cli = rawCliText
|
|
55
|
+
? {
|
|
56
|
+
ok: true,
|
|
57
|
+
windows,
|
|
58
|
+
rawText: rawCliText,
|
|
59
|
+
}
|
|
60
|
+
: {
|
|
61
|
+
ok: true,
|
|
62
|
+
windows,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
result.cli = {
|
|
67
|
+
ok: false,
|
|
68
|
+
error: stringifyError(error),
|
|
69
|
+
windows: [],
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (!args.oauthOnly && !args.cliOnly) {
|
|
74
|
+
try {
|
|
75
|
+
result.aggregated = await getQuotaWindows();
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
result.aggregated = {
|
|
79
|
+
ok: false,
|
|
80
|
+
error: stringifyError(error),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
const oauthOk = result.oauth?.ok === true;
|
|
85
|
+
const cliOk = result.cli?.ok === true;
|
|
86
|
+
const aggregatedOk = result.aggregated?.ok === true;
|
|
87
|
+
const ok = oauthOk || cliOk || aggregatedOk;
|
|
88
|
+
if (args.json || process.stdout.isTTY === false) {
|
|
89
|
+
console.log(JSON.stringify({ ok, ...result }, null, 2));
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
console.log(`timestamp: ${result.timestamp}`);
|
|
93
|
+
console.log(`auth: ${JSON.stringify(authStatus)}`);
|
|
94
|
+
console.log(`tokenAvailable: ${token != null}`);
|
|
95
|
+
if (result.oauth)
|
|
96
|
+
console.log(`oauth: ${JSON.stringify(result.oauth, null, 2)}`);
|
|
97
|
+
if (result.cli)
|
|
98
|
+
console.log(`cli: ${JSON.stringify(result.cli, null, 2)}`);
|
|
99
|
+
if (result.aggregated)
|
|
100
|
+
console.log(`aggregated: ${JSON.stringify(result.aggregated, null, 2)}`);
|
|
101
|
+
}
|
|
102
|
+
if (!ok)
|
|
103
|
+
process.exitCode = 1;
|
|
104
|
+
}
|
|
105
|
+
await main();
|
|
106
|
+
//# sourceMappingURL=quota-probe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quota-probe.js","sourceRoot":"","sources":["../../src/cli/quota-probe.ts"],"names":[],"mappings":";AAEA,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,gBAAgB,EAChB,eAAe,EACf,uBAAuB,EACvB,oBAAoB,EACpB,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAS5B,SAAS,SAAS,CAAC,IAAc;IAC/B,OAAO;QACL,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAC7B,aAAa,EAAE,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;QACzC,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC;QACxC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC;KACrC,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,KAAc;IACpC,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM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E,CAAC;QAChD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,GAAG,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC1D,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,cAAc,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC;QAC9C,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;QACnD,OAAO,CAAC,GAAG,CAAC,mBAAmB,KAAK,IAAI,IAAI,EAAE,CAAC,CAAC;QAChD,IAAI,MAAM,CAAC,KAAK;YAAE,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;QACjF,IAAI,MAAM,CAAC,GAAG;YAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;QAC3E,IAAI,MAAM,CAAC,UAAU;YAAE,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IAClG,CAAC;IAED,IAAI,CAAC,EAAE;QAAE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,IAAI,EAAE,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const DEFAULT_CLAUDE_LOCAL_MODEL = "claude-opus-5";
|
|
2
|
+
/** Resolve Paperclip's default without replacing an explicit provider model. */
|
|
3
|
+
export declare function resolveClaudeModel(model: unknown, env?: Record<string, unknown>): string;
|
|
4
|
+
export declare const type = "claude_local";
|
|
5
|
+
export declare function claudeLocalReasoningEffortsForModel(model: string): readonly string[];
|
|
6
|
+
export declare const label = "Claude Code";
|
|
7
|
+
export declare const SANDBOX_INSTALL_COMMAND = "npm install -g @anthropic-ai/claude-code";
|
|
8
|
+
export declare const models: {
|
|
9
|
+
id: string;
|
|
10
|
+
label: string;
|
|
11
|
+
}[];
|
|
12
|
+
export declare const agentConfigurationDoc = "# claude_local agent configuration\n\nAdapter: claude_local\n\nCore fields:\n- engine (string, optional): defaults to ACP, including legacy unset/\"auto\" values. Missing prerequisites and execution failures fail the run without changing engines. Set \"cli\" to explicitly select the CLI engine.\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 injected at runtime\n- model (string, optional): Claude model id. Missing or blank defaults to claude-opus-5 in both CLI and ACP, including existing agents. Explicit model IDs and ANTHROPIC_MODEL overrides are preserved. Bedrock/Vertex without an explicit model retain their provider default.\n- effort (string, optional): model-specific reasoning effort passed via --effort (low|medium|high; current Opus, Sonnet 5, and Fable models also support xhigh|max)\n- chrome (boolean, optional): pass --chrome when running Claude\n- promptTemplate (string, optional): run prompt template\n- maxTurnsPerRun (number, optional): max turns for one run\n- dangerouslySkipPermissions (boolean, optional, default true): allow non-interactive Claude runs to proceed without approval prompts. Local and remote targets receive --dangerously-skip-permissions for all built-in and connected tools. Managed sandbox targets also identify themselves to Claude so root container launches support bypass. Non-sandbox root processes must run Claude as a non-root user; Paperclip does not silently downgrade the requested mode.\n- command (string, optional): defaults to \"claude\"\n- extraArgs (string[], optional): additional CLI args\n- env (object, optional): KEY=VALUE environment variables\n- workspaceStrategy (object, optional): execution workspace strategy; currently supports { type: \"git_worktree\", baseRef?, branchTemplate?, worktreeParentDir? }\n- workspaceRuntime (object, optional): reserved for workspace runtime metadata; workspace runtime services are manually controlled from the workspace UI and are not auto-started by heartbeats\n- filesystemScope (string, optional): set to \"workspace\" to confine local CLI filesystem access with Bubblewrap. Off by default. The workspace and Claude config remain writable; other host paths are hidden.\n- filesystemExtraPaths (array, optional): additional absolute host paths exposed inside the workspace sandbox. String entries are read-only; object entries use { path: \"/absolute/path\", access: \"ro\" | \"rw\" }.\n- filesystemSandboxCommand (string, optional): Bubblewrap executable name or absolute path; defaults to \"bwrap\". Linux only.\n- networkScope (string, optional): \"deny\" blocks all network egress; \"allowlist\" permits only networkAllowlist targets through Paperclip's HTTP(S) proxy. Off by default.\n- networkAllowlist (string[], optional): exact hostnames, hostname:port entries, or origin URLs. Include the configured Claude provider origin, such as \"api.anthropic.com\", Bedrock/Vertex endpoints, or a custom gateway.\n\nACP fields (only when engine=\"acp\"):\n- agentCommand (string, optional): override for the Claude ACP server command; defaults to the package-local claude-agent-acp binary\n- mode (string, optional, default \"persistent\"): ACP session mode (\"persistent\" or \"oneshot\")\n- stateDir (string, optional): ACP session state directory; defaults to Paperclip-managed company/agent scoped storage\n- nonInteractivePermissions (string, optional, default \"deny\"): fallback when the ACP agent asks for input outside an interactive session\n- warmHandleIdleMs (number, optional, default 0): keep the ACP process warm for this many ms after a successful run\n\nOperational fields:\n- timeoutSec (number, optional): run timeout in seconds\n- graceSec (number, optional): SIGTERM grace period in seconds\n\nNotes:\n- Claude Opus 5.5 uses model ID `claude-opus-5-5` and requires Claude Code v2.1.280 or later.\n- filesystemScope and networkScope are spawn-level confinement and are orthogonal to Claude permission flags. Both require Bubblewrap on the host and explicit engine=\"cli\"; default or explicit ACP is rejected because ACP confinement is not yet supported. networkScope=\"allowlist\" injects HTTP_PROXY/HTTPS_PROXY for the CLI while its private network namespace blocks direct sockets, so every required provider/API hostname must be listed explicitly.\n- The Claude ACP lane requires Node >=24.11.0 and @agentclientprotocol/claude-agent-acp to be installed with this adapter package. Missing prerequisites fail both default and explicit ACP runs with an actionable setup error; the adapter never switches engines automatically.\n- For ACP runs, model selection is passed through ANTHROPIC_MODEL at ACP server startup; Paperclip-managed Claude permissions and ephemeral skill materialization are handled by the shared ACP engine.\n- When Paperclip realizes a workspace/runtime for a run, it injects PAPERCLIP_WORKSPACE_* and PAPERCLIP_RUNTIME_* env vars for agent-side tooling.\n";
|
|
13
|
+
//# 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,0BAA0B,kBAAkB,CAAC;AAE1D,gFAAgF;AAChF,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,OAAO,EACd,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAChC,MAAM,CAeR;AAED,eAAO,MAAM,IAAI,iBAAiB,CAAC;AAEnC,wBAAgB,mCAAmC,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAQpF;AACD,eAAO,MAAM,KAAK,gBAAgB,CAAC;AAEnC,eAAO,MAAM,uBAAuB,6CAA6C,CAAC;AAElF,eAAO,MAAM,MAAM;;;GAalB,CAAC;AAEF,eAAO,MAAM,qBAAqB,09JA0CjC,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
export const DEFAULT_CLAUDE_LOCAL_MODEL = "claude-opus-5";
|
|
2
|
+
/** Resolve Paperclip's default without replacing an explicit provider model. */
|
|
3
|
+
export function resolveClaudeModel(model, env = {}) {
|
|
4
|
+
const configured = typeof model === "string" ? model.trim() : "";
|
|
5
|
+
if (configured)
|
|
6
|
+
return configured;
|
|
7
|
+
const environmentModel = typeof env.ANTHROPIC_MODEL === "string" ? env.ANTHROPIC_MODEL.trim() : "";
|
|
8
|
+
if (environmentModel)
|
|
9
|
+
return environmentModel;
|
|
10
|
+
// These providers use their own model IDs and region-specific defaults.
|
|
11
|
+
const providerFlag = (value) => value === "1" || value === "true";
|
|
12
|
+
if (providerFlag(env.CLAUDE_CODE_USE_BEDROCK)
|
|
13
|
+
|| providerFlag(env.CLAUDE_CODE_USE_VERTEX)
|
|
14
|
+
|| (typeof env.ANTHROPIC_BEDROCK_BASE_URL === "string" && env.ANTHROPIC_BEDROCK_BASE_URL.trim())) {
|
|
15
|
+
return "";
|
|
16
|
+
}
|
|
17
|
+
return DEFAULT_CLAUDE_LOCAL_MODEL;
|
|
18
|
+
}
|
|
19
|
+
export const type = "claude_local";
|
|
20
|
+
export function claudeLocalReasoningEffortsForModel(model) {
|
|
21
|
+
const id = model.trim().replace(/\[1m\]$/, "").replace(/^(?:(?:us|eu|apac|global)\.)?anthropic\./, "");
|
|
22
|
+
if (/^claude-haiku-/.test(id))
|
|
23
|
+
return [];
|
|
24
|
+
if (/^claude-(?:opus-5(?:-5)?|opus-4-[78]|sonnet-5|fable-5(?:-1)?)$/.test(id)) {
|
|
25
|
+
return ["low", "medium", "high", "xhigh", "max"];
|
|
26
|
+
}
|
|
27
|
+
if (/^claude-(?:opus|sonnet)-4-6(?:-v1)?$/.test(id))
|
|
28
|
+
return ["low", "medium", "high", "max"];
|
|
29
|
+
return ["low", "medium", "high"];
|
|
30
|
+
}
|
|
31
|
+
export const label = "Claude Code";
|
|
32
|
+
export const SANDBOX_INSTALL_COMMAND = "npm install -g @anthropic-ai/claude-code";
|
|
33
|
+
export const models = [
|
|
34
|
+
{ id: "claude-opus-4-8", label: "Claude Opus 4.8" },
|
|
35
|
+
{ id: "claude-sonnet-5", label: "Claude Sonnet 5" },
|
|
36
|
+
{ id: "claude-fable-5-1", label: "Claude Fable 5.1" },
|
|
37
|
+
{ id: "claude-fable-5", label: "Claude Fable 5" },
|
|
38
|
+
{ id: "claude-mythos-5", label: "Claude Mythos 5" },
|
|
39
|
+
{ id: "claude-opus-5-5", label: "Claude Opus 5.5" },
|
|
40
|
+
{ id: "claude-opus-5", label: "Claude Opus 5" },
|
|
41
|
+
{ id: "claude-opus-4-7", label: "Claude Opus 4.7" },
|
|
42
|
+
{ id: "claude-opus-4-6", label: "Claude Opus 4.6" },
|
|
43
|
+
{ id: "claude-sonnet-4-6", label: "Claude Sonnet 4.6" },
|
|
44
|
+
{ id: "claude-sonnet-4-5", label: "Claude Sonnet 4.5" },
|
|
45
|
+
{ id: "claude-haiku-4-5", label: "Claude Haiku 4.5" },
|
|
46
|
+
];
|
|
47
|
+
export const agentConfigurationDoc = `# claude_local agent configuration
|
|
48
|
+
|
|
49
|
+
Adapter: claude_local
|
|
50
|
+
|
|
51
|
+
Core fields:
|
|
52
|
+
- engine (string, optional): defaults to ACP, including legacy unset/"auto" values. Missing prerequisites and execution failures fail the run without changing engines. Set "cli" to explicitly select the CLI engine.
|
|
53
|
+
- cwd (string, optional): default absolute working directory fallback for the agent process (created if missing when possible)
|
|
54
|
+
- instructionsFilePath (string, optional): absolute path to a markdown instructions file injected at runtime
|
|
55
|
+
- model (string, optional): Claude model id. Missing or blank defaults to ${DEFAULT_CLAUDE_LOCAL_MODEL} in both CLI and ACP, including existing agents. Explicit model IDs and ANTHROPIC_MODEL overrides are preserved. Bedrock/Vertex without an explicit model retain their provider default.
|
|
56
|
+
- effort (string, optional): model-specific reasoning effort passed via --effort (low|medium|high; current Opus, Sonnet 5, and Fable models also support xhigh|max)
|
|
57
|
+
- chrome (boolean, optional): pass --chrome when running Claude
|
|
58
|
+
- promptTemplate (string, optional): run prompt template
|
|
59
|
+
- maxTurnsPerRun (number, optional): max turns for one run
|
|
60
|
+
- dangerouslySkipPermissions (boolean, optional, default true): allow non-interactive Claude runs to proceed without approval prompts. Local and remote targets receive --dangerously-skip-permissions for all built-in and connected tools. Managed sandbox targets also identify themselves to Claude so root container launches support bypass. Non-sandbox root processes must run Claude as a non-root user; Paperclip does not silently downgrade the requested mode.
|
|
61
|
+
- command (string, optional): defaults to "claude"
|
|
62
|
+
- extraArgs (string[], optional): additional CLI args
|
|
63
|
+
- env (object, optional): KEY=VALUE environment variables
|
|
64
|
+
- workspaceStrategy (object, optional): execution workspace strategy; currently supports { type: "git_worktree", baseRef?, branchTemplate?, worktreeParentDir? }
|
|
65
|
+
- workspaceRuntime (object, optional): reserved for workspace runtime metadata; workspace runtime services are manually controlled from the workspace UI and are not auto-started by heartbeats
|
|
66
|
+
- filesystemScope (string, optional): set to "workspace" to confine local CLI filesystem access with Bubblewrap. Off by default. The workspace and Claude config remain writable; other host paths are hidden.
|
|
67
|
+
- filesystemExtraPaths (array, optional): additional absolute host paths exposed inside the workspace sandbox. String entries are read-only; object entries use { path: "/absolute/path", access: "ro" | "rw" }.
|
|
68
|
+
- filesystemSandboxCommand (string, optional): Bubblewrap executable name or absolute path; defaults to "bwrap". Linux only.
|
|
69
|
+
- networkScope (string, optional): "deny" blocks all network egress; "allowlist" permits only networkAllowlist targets through Paperclip's HTTP(S) proxy. Off by default.
|
|
70
|
+
- networkAllowlist (string[], optional): exact hostnames, hostname:port entries, or origin URLs. Include the configured Claude provider origin, such as "api.anthropic.com", Bedrock/Vertex endpoints, or a custom gateway.
|
|
71
|
+
|
|
72
|
+
ACP fields (only when engine="acp"):
|
|
73
|
+
- agentCommand (string, optional): override for the Claude ACP server command; defaults to the package-local claude-agent-acp binary
|
|
74
|
+
- mode (string, optional, default "persistent"): ACP session mode ("persistent" or "oneshot")
|
|
75
|
+
- stateDir (string, optional): ACP session state directory; defaults to Paperclip-managed company/agent scoped storage
|
|
76
|
+
- nonInteractivePermissions (string, optional, default "deny"): fallback when the ACP agent asks for input outside an interactive session
|
|
77
|
+
- warmHandleIdleMs (number, optional, default 0): keep the ACP process warm for this many ms after a successful run
|
|
78
|
+
|
|
79
|
+
Operational fields:
|
|
80
|
+
- timeoutSec (number, optional): run timeout in seconds
|
|
81
|
+
- graceSec (number, optional): SIGTERM grace period in seconds
|
|
82
|
+
|
|
83
|
+
Notes:
|
|
84
|
+
- Claude Opus 5.5 uses model ID \`claude-opus-5-5\` and requires Claude Code v2.1.280 or later.
|
|
85
|
+
- filesystemScope and networkScope are spawn-level confinement and are orthogonal to Claude permission flags. Both require Bubblewrap on the host and explicit engine="cli"; default or explicit ACP is rejected because ACP confinement is not yet supported. networkScope="allowlist" injects HTTP_PROXY/HTTPS_PROXY for the CLI while its private network namespace blocks direct sockets, so every required provider/API hostname must be listed explicitly.
|
|
86
|
+
- The Claude ACP lane requires Node >=24.11.0 and @agentclientprotocol/claude-agent-acp to be installed with this adapter package. Missing prerequisites fail both default and explicit ACP runs with an actionable setup error; the adapter never switches engines automatically.
|
|
87
|
+
- For ACP runs, model selection is passed through ANTHROPIC_MODEL at ACP server startup; Paperclip-managed Claude permissions and ephemeral skill materialization are handled by the shared ACP engine.
|
|
88
|
+
- When Paperclip realizes a workspace/runtime for a run, it injects PAPERCLIP_WORKSPACE_* and PAPERCLIP_RUNTIME_* env vars for agent-side tooling.
|
|
89
|
+
`;
|
|
90
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,0BAA0B,GAAG,eAAe,CAAC;AAE1D,gFAAgF;AAChF,MAAM,UAAU,kBAAkB,CAChC,KAAc,EACd,GAAG,GAA4B,EAAE;IAEjC,MAAM,UAAU,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACjE,IAAI,UAAU;QAAE,OAAO,UAAU,CAAC;IAClC,MAAM,gBAAgB,GAAG,OAAO,GAAG,CAAC,eAAe,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACnG,IAAI,gBAAgB;QAAE,OAAO,gBAAgB,CAAC;IAC9C,wEAAwE;IACxE,MAAM,YAAY,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC,KAAK,KAAK,GAAG,IAAI,KAAK,KAAK,MAAM,CAAC;IAC3E,IACE,YAAY,CAAC,GAAG,CAAC,uBAAuB,CAAC;WACtC,YAAY,CAAC,GAAG,CAAC,sBAAsB,CAAC;WACx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gB,EAAE;IACjD,EAAE,EAAE,EAAE,iBAAiB,EAAE,KAAK,EAAE,iBAAiB,EAAE;IACnD,EAAE,EAAE,EAAE,iBAAiB,EAAE,KAAK,EAAE,iBAAiB,EAAE;IACnD,EAAE,EAAE,EAAE,eAAe,EAAE,KAAK,EAAE,eAAe,EAAE;IAC/C,EAAE,EAAE,EAAE,iBAAiB,EAAE,KAAK,EAAE,iBAAiB,EAAE;IACnD,EAAE,EAAE,EAAE,iBAAiB,EAAE,KAAK,EAAE,iBAAiB,EAAE;IACnD,EAAE,EAAE,EAAE,mBAAmB,EAAE,KAAK,EAAE,mBAAmB,EAAE;IACvD,EAAE,EAAE,EAAE,mBAAmB,EAAE,KAAK,EAAE,mBAAmB,EAAE;IACvD,EAAE,EAAE,EAAE,kBAAkB,EAAE,KAAK,EAAE,kBAAkB,EAAE;CACtD,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;4EAQuC,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkCrG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { claudeLocalReasoningEffortsForModel, DEFAULT_CLAUDE_LOCAL_MODEL, resolveClaudeModel } from "./index.js";
|
|
3
|
+
import { minimumClaudeCliVersionForModel } from "./server/cli-capabilities.js";
|
|
4
|
+
describe("Claude model defaults", () => {
|
|
5
|
+
it.each(["claude-opus-5-5", "us.anthropic.claude-opus-5-5", "global.anthropic.claude-opus-5-5[1m]"])("requires a current CLI and offers all efforts for %s", (model) => {
|
|
6
|
+
expect(minimumClaudeCliVersionForModel(model)).toBe("2.1.280");
|
|
7
|
+
expect(claudeLocalReasoningEffortsForModel(model)).toEqual(["low", "medium", "high", "xhigh", "max"]);
|
|
8
|
+
});
|
|
9
|
+
it("keeps model-specific Claude reasoning limits", () => {
|
|
10
|
+
expect(claudeLocalReasoningEffortsForModel("claude-fable-5-1")).toContain("xhigh");
|
|
11
|
+
expect(claudeLocalReasoningEffortsForModel("claude-sonnet-5")).toContain("max");
|
|
12
|
+
expect(claudeLocalReasoningEffortsForModel("claude-sonnet-4-6")).toEqual(["low", "medium", "high", "max"]);
|
|
13
|
+
expect(claudeLocalReasoningEffortsForModel("claude-haiku-4-5")).toEqual([]);
|
|
14
|
+
expect(claudeLocalReasoningEffortsForModel("custom-model")).toEqual(["low", "medium", "high"]);
|
|
15
|
+
});
|
|
16
|
+
it.each([undefined, null, "", " "])("uses Opus 5 for an unset model (%j)", (model) => {
|
|
17
|
+
expect(DEFAULT_CLAUDE_LOCAL_MODEL).toBe("claude-opus-5");
|
|
18
|
+
expect(resolveClaudeModel(model)).toBe("claude-opus-5");
|
|
19
|
+
});
|
|
20
|
+
it("keeps explicit model IDs ahead of environment overrides", () => {
|
|
21
|
+
expect(resolveClaudeModel(" claude-sonnet-4-5 ", { ANTHROPIC_MODEL: "opus" }))
|
|
22
|
+
.toBe("claude-sonnet-4-5");
|
|
23
|
+
expect(resolveClaudeModel("", { ANTHROPIC_MODEL: " custom-model " })).toBe("custom-model");
|
|
24
|
+
});
|
|
25
|
+
it.each([
|
|
26
|
+
{ CLAUDE_CODE_USE_BEDROCK: "1" },
|
|
27
|
+
{ CLAUDE_CODE_USE_BEDROCK: "true" },
|
|
28
|
+
{ ANTHROPIC_BEDROCK_BASE_URL: "https://bedrock.example" },
|
|
29
|
+
{ CLAUDE_CODE_USE_VERTEX: "1" },
|
|
30
|
+
])("keeps provider-specific defaults for %j", (env) => {
|
|
31
|
+
expect(resolveClaudeModel(undefined, env)).toBe("");
|
|
32
|
+
expect(resolveClaudeModel("provider-model", env)).toBe("provider-model");
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=index.test.js.map
|
|
@@ -0,0 +1 @@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