@paperclipai/adapter-acpx-local 0.3.1
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/cli/format-event.d.ts +2 -0
- package/dist/cli/format-event.d.ts.map +1 -0
- package/dist/cli/format-event.js +128 -0
- package/dist/cli/format-event.js.map +1 -0
- package/dist/cli/format-event.test.d.ts +2 -0
- package/dist/cli/format-event.test.d.ts.map +1 -0
- package/dist/cli/format-event.test.js +88 -0
- package/dist/cli/format-event.test.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/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +45 -0
- package/dist/index.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 +94 -0
- package/dist/server/config-schema.js.map +1 -0
- package/dist/server/execute.d.ts +18 -0
- package/dist/server/execute.d.ts.map +1 -0
- package/dist/server/execute.js +1010 -0
- package/dist/server/execute.js.map +1 -0
- package/dist/server/execute.test.d.ts +2 -0
- package/dist/server/execute.test.d.ts.map +1 -0
- package/dist/server/execute.test.js +330 -0
- package/dist/server/execute.test.js.map +1 -0
- package/dist/server/index.d.ts +6 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +6 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/session-codec.d.ts +3 -0
- package/dist/server/session-codec.d.ts.map +1 -0
- package/dist/server/session-codec.js +48 -0
- package/dist/server/session-codec.js.map +1 -0
- package/dist/server/skills.d.ts +4 -0
- package/dist/server/skills.d.ts.map +1 -0
- package/dist/server/skills.js +86 -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 +267 -0
- package/dist/server/test.js.map +1 -0
- package/dist/server/test.test.d.ts +2 -0
- package/dist/server/test.test.d.ts.map +1 -0
- package/dist/server/test.test.js +38 -0
- package/dist/server/test.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 +143 -0
- package/dist/ui/build-config.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 +148 -0
- package/dist/ui/parse-stdout.js.map +1 -0
- package/dist/ui/parse-stdout.test.d.ts +2 -0
- package/dist/ui/parse-stdout.test.d.ts.map +1 -0
- package/dist/ui/parse-stdout.test.js +106 -0
- package/dist/ui/parse-stdout.test.js.map +1 -0
- package/package.json +64 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-event.d.ts","sourceRoot":"","sources":["../../src/cli/format-event.ts"],"names":[],"mappings":"AAkDA,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAsEtE"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import pc from "picocolors";
|
|
2
|
+
function parseJson(line) {
|
|
3
|
+
try {
|
|
4
|
+
const parsed = JSON.parse(line);
|
|
5
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed))
|
|
6
|
+
return null;
|
|
7
|
+
return parsed;
|
|
8
|
+
}
|
|
9
|
+
catch {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function asString(value, fallback = "") {
|
|
14
|
+
return typeof value === "string" ? value : fallback;
|
|
15
|
+
}
|
|
16
|
+
function asNumber(value, fallback = 0) {
|
|
17
|
+
return typeof value === "number" && Number.isFinite(value) ? value : fallback;
|
|
18
|
+
}
|
|
19
|
+
function stringify(value) {
|
|
20
|
+
if (typeof value === "string")
|
|
21
|
+
return value;
|
|
22
|
+
if (value === null || value === undefined)
|
|
23
|
+
return "";
|
|
24
|
+
try {
|
|
25
|
+
return JSON.stringify(value, null, 2);
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return String(value);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function pickToolUseId(parsed) {
|
|
32
|
+
return (asString(parsed.toolCallId) ||
|
|
33
|
+
asString(parsed.toolUseId) ||
|
|
34
|
+
asString(parsed.id));
|
|
35
|
+
}
|
|
36
|
+
function statusLine(parsed) {
|
|
37
|
+
const text = asString(parsed.text).trim();
|
|
38
|
+
const tag = asString(parsed.tag).trim();
|
|
39
|
+
const used = asNumber(parsed.used, -1);
|
|
40
|
+
const size = asNumber(parsed.size, -1);
|
|
41
|
+
const parts = [];
|
|
42
|
+
if (text)
|
|
43
|
+
parts.push(text);
|
|
44
|
+
if (tag && !text)
|
|
45
|
+
parts.push(tag);
|
|
46
|
+
if (used >= 0 && size > 0)
|
|
47
|
+
parts.push(`(${used}/${size} ctx)`);
|
|
48
|
+
return parts.join(" ") || tag || "status";
|
|
49
|
+
}
|
|
50
|
+
export function printAcpxStreamEvent(raw, debug) {
|
|
51
|
+
const line = raw.trim();
|
|
52
|
+
if (!line)
|
|
53
|
+
return;
|
|
54
|
+
const parsed = parseJson(line);
|
|
55
|
+
if (!parsed) {
|
|
56
|
+
if (debug)
|
|
57
|
+
console.log(pc.gray(line));
|
|
58
|
+
else
|
|
59
|
+
console.log(line);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const type = asString(parsed.type);
|
|
63
|
+
if (type === "acpx.session") {
|
|
64
|
+
const agent = asString(parsed.agent, "acpx");
|
|
65
|
+
const session = asString(parsed.acpSessionId) ||
|
|
66
|
+
asString(parsed.sessionId) ||
|
|
67
|
+
asString(parsed.runtimeSessionName);
|
|
68
|
+
const mode = asString(parsed.mode);
|
|
69
|
+
const permissionMode = asString(parsed.permissionMode);
|
|
70
|
+
const tail = [mode, permissionMode].filter(Boolean).join(" / ");
|
|
71
|
+
const suffix = tail ? ` [${tail}]` : "";
|
|
72
|
+
console.log(pc.blue(`${agent} session${session ? `: ${session}` : ""}${suffix}`));
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (type === "acpx.text_delta") {
|
|
76
|
+
const text = asString(parsed.text);
|
|
77
|
+
if (!text)
|
|
78
|
+
return;
|
|
79
|
+
const channel = asString(parsed.channel) || asString(parsed.stream);
|
|
80
|
+
const isThought = channel === "thought" || channel === "thinking";
|
|
81
|
+
if (isThought)
|
|
82
|
+
console.log(pc.gray(text));
|
|
83
|
+
else
|
|
84
|
+
process.stdout.write(pc.green(text));
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
if (type === "acpx.tool_call") {
|
|
88
|
+
const name = asString(parsed.name, "acp_tool");
|
|
89
|
+
const status = asString(parsed.status);
|
|
90
|
+
const id = pickToolUseId(parsed);
|
|
91
|
+
const header = status ? `tool_call: ${name} [${status}]` : `tool_call: ${name}`;
|
|
92
|
+
const idSuffix = id ? ` (${id})` : "";
|
|
93
|
+
const isError = status === "failed" || status === "cancelled";
|
|
94
|
+
console.log((isError ? pc.red : pc.yellow)(`${header}${idSuffix}`));
|
|
95
|
+
if (parsed.input !== undefined) {
|
|
96
|
+
console.log(pc.gray(stringify(parsed.input)));
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
const text = asString(parsed.text).trim();
|
|
100
|
+
if (text)
|
|
101
|
+
console.log(pc.gray(text));
|
|
102
|
+
}
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
if (type === "acpx.tool_result") {
|
|
106
|
+
const isError = parsed.isError === true || parsed.error !== undefined;
|
|
107
|
+
console.log((isError ? pc.red : pc.cyan)(`tool_result: ${asString(parsed.name, "acp_tool")}`));
|
|
108
|
+
const content = stringify(parsed.content ?? parsed.output ?? parsed.error);
|
|
109
|
+
if (content)
|
|
110
|
+
console.log((isError ? pc.red : pc.gray)(content));
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
if (type === "acpx.status") {
|
|
114
|
+
console.log(pc.gray(`status: ${statusLine(parsed)}`));
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
if (type === "acpx.result") {
|
|
118
|
+
const summary = asString(parsed.summary, asString(parsed.stopReason, asString(parsed.subtype, "complete")));
|
|
119
|
+
console.log(pc.blue(`result: ${summary}`));
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
if (type === "acpx.error") {
|
|
123
|
+
console.log(pc.red(`error: ${asString(parsed.message, line)}`));
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
console.log(debug ? pc.gray(line) : line);
|
|
127
|
+
}
|
|
128
|
+
//# 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,SAAS,CAAC,IAAY;IAC7B,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAChC,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;YAAE,OAAO,IAAI,CAAC;QACxF,OAAO,MAAiC,CAAC;IAC3C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,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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I,OAAO;YAAE,OAAO,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;QAChE,OAAO;IACT,CAAC;IACD,IAAI,IAAI,KAAK,aAAa,EAAE,CAAC;QAC3B,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;QACtD,OAAO;IACT,CAAC;IACD,IAAI,IAAI,KAAK,aAAa,EAAE,CAAC;QAC3B,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;QAC5G,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,OAAO,EAAE,CAAC,CAAC,CAAC;QAC3C,OAAO;IACT,CAAC;IACD,IAAI,IAAI,KAAK,YAAY,EAAE,CAAC;QAC1B,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,UAAU,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;QAChE,OAAO;IACT,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-event.test.d.ts","sourceRoot":"","sources":["../../src/cli/format-event.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
2
|
+
import { printAcpxStreamEvent } from "./format-event.js";
|
|
3
|
+
function emit(payload) {
|
|
4
|
+
return JSON.stringify(payload);
|
|
5
|
+
}
|
|
6
|
+
function captureOutput() {
|
|
7
|
+
const log = [];
|
|
8
|
+
const stdout = [];
|
|
9
|
+
const logSpy = vi.spyOn(console, "log").mockImplementation((value) => {
|
|
10
|
+
log.push(String(value ?? ""));
|
|
11
|
+
});
|
|
12
|
+
const stdoutSpy = vi.spyOn(process.stdout, "write").mockImplementation(((chunk) => {
|
|
13
|
+
stdout.push(String(chunk ?? ""));
|
|
14
|
+
return true;
|
|
15
|
+
}));
|
|
16
|
+
return {
|
|
17
|
+
capture: { log, stdout },
|
|
18
|
+
restore: () => {
|
|
19
|
+
logSpy.mockRestore();
|
|
20
|
+
stdoutSpy.mockRestore();
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function strip(value) {
|
|
25
|
+
return value.replace(/\x1b\[[0-9;]*m/g, "");
|
|
26
|
+
}
|
|
27
|
+
describe("printAcpxStreamEvent", () => {
|
|
28
|
+
let captured;
|
|
29
|
+
let restore;
|
|
30
|
+
beforeEach(() => {
|
|
31
|
+
const result = captureOutput();
|
|
32
|
+
captured = result.capture;
|
|
33
|
+
restore = result.restore;
|
|
34
|
+
});
|
|
35
|
+
afterEach(() => {
|
|
36
|
+
restore();
|
|
37
|
+
});
|
|
38
|
+
it("renders acpx.session as a labeled session header", () => {
|
|
39
|
+
printAcpxStreamEvent(emit({
|
|
40
|
+
type: "acpx.session",
|
|
41
|
+
agent: "claude",
|
|
42
|
+
acpSessionId: "acp-1",
|
|
43
|
+
mode: "persistent",
|
|
44
|
+
permissionMode: "approve-all",
|
|
45
|
+
}), false);
|
|
46
|
+
expect(captured.log.map(strip)).toEqual(["claude session: acp-1 [persistent / approve-all]"]);
|
|
47
|
+
});
|
|
48
|
+
it("streams output text_delta to stdout for live progress", () => {
|
|
49
|
+
printAcpxStreamEvent(emit({ type: "acpx.text_delta", text: "hello", channel: "output" }), false);
|
|
50
|
+
expect(captured.log).toEqual([]);
|
|
51
|
+
expect(captured.stdout.map(strip)).toEqual(["hello"]);
|
|
52
|
+
});
|
|
53
|
+
it("renders thought text_delta on its own line", () => {
|
|
54
|
+
printAcpxStreamEvent(emit({ type: "acpx.text_delta", text: "thinking…", channel: "thought" }), false);
|
|
55
|
+
expect(captured.log.map(strip)).toEqual(["thinking…"]);
|
|
56
|
+
});
|
|
57
|
+
it("renders tool_call with status and id", () => {
|
|
58
|
+
printAcpxStreamEvent(emit({
|
|
59
|
+
type: "acpx.tool_call",
|
|
60
|
+
name: "read",
|
|
61
|
+
toolCallId: "tool-1",
|
|
62
|
+
status: "running",
|
|
63
|
+
text: "read README.md",
|
|
64
|
+
}), false);
|
|
65
|
+
expect(captured.log.map(strip)).toEqual([
|
|
66
|
+
"tool_call: read [running] (tool-1)",
|
|
67
|
+
"read README.md",
|
|
68
|
+
]);
|
|
69
|
+
});
|
|
70
|
+
it("renders status events with optional context window", () => {
|
|
71
|
+
printAcpxStreamEvent(emit({ type: "acpx.status", tag: "context_window", used: 100, size: 200000 }), false);
|
|
72
|
+
expect(captured.log.map(strip)).toEqual(["status: context_window (100/200000 ctx)"]);
|
|
73
|
+
});
|
|
74
|
+
it("renders acpx.result and acpx.error", () => {
|
|
75
|
+
printAcpxStreamEvent(emit({ type: "acpx.result", summary: "completed", stopReason: "end_turn" }), false);
|
|
76
|
+
printAcpxStreamEvent(emit({ type: "acpx.error", message: "auth required" }), false);
|
|
77
|
+
expect(captured.log.map(strip)).toEqual(["result: completed", "error: auth required"]);
|
|
78
|
+
});
|
|
79
|
+
it("falls back to plain output for non-JSON lines", () => {
|
|
80
|
+
printAcpxStreamEvent("not json", false);
|
|
81
|
+
expect(captured.log).toEqual(["not json"]);
|
|
82
|
+
});
|
|
83
|
+
it("still emits unknown / non-JSON lines when debug is enabled", () => {
|
|
84
|
+
printAcpxStreamEvent("not json", true);
|
|
85
|
+
expect(strip(captured.log[0])).toBe("not json");
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
//# sourceMappingURL=format-event.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-event.test.js","sourceRoot":"","sources":["../../src/cli/format-event.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEzD,SAAS,IAAI,CAAC,OAAgC;IAC5C,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC;AAOD,SAAS,aAAa;IACpB,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,MAAM,MAAM,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,kBAAkB,CAAC,CAAC,KAAe,EAAE,EAAE;QAC7E,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;IACH,MAAM,SAAS,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,KAAc,EAAE,EAAE;QACzF,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC;QACjC,OAAO,IAAI,CAAC;IACd,CAAC,CAAgC,CAAC,CAAC;IACnC,OAAO;QACL,OAAO,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE;QACxB,OAAO,EAAE,GAAG,EAAE;YACZ,MAAM,CAAC,WAAW,EAAE,CAAC;YACrB,SAAS,CAAC,WAAW,EAAE,CAAC;QAC1B,CAAC;KACF,CAAC;AACJ,CAAC;AAED,SAAS,KAAK,CAAC,KAAa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,UAAU,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;QACzG,oBAAoB,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,eAAe,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;QACpF,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,mBAAmB,EAAE,sBAAsB,CAAC,CAAC,CAAC;IACzF,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;QACvD,oBAAoB,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;QACxC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4DAA4D,EAAE,GAAG,EAAE;QACpE,oBAAoB,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QACvC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const type = "acpx_local";
|
|
2
|
+
export declare const label = "ACPX (local)";
|
|
3
|
+
export declare const DEFAULT_ACPX_LOCAL_AGENT = "claude";
|
|
4
|
+
export declare const DEFAULT_ACPX_LOCAL_MODE = "persistent";
|
|
5
|
+
export declare const DEFAULT_ACPX_LOCAL_PERMISSION_MODE = "approve-all";
|
|
6
|
+
export declare const DEFAULT_ACPX_LOCAL_NON_INTERACTIVE_PERMISSIONS = "deny";
|
|
7
|
+
export declare const DEFAULT_ACPX_LOCAL_TIMEOUT_SEC = 0;
|
|
8
|
+
export declare const acpxAgentOptions: readonly [{
|
|
9
|
+
readonly id: "claude";
|
|
10
|
+
readonly label: "Claude via ACPX";
|
|
11
|
+
}, {
|
|
12
|
+
readonly id: "codex";
|
|
13
|
+
readonly label: "Codex via ACPX";
|
|
14
|
+
}, {
|
|
15
|
+
readonly id: "custom";
|
|
16
|
+
readonly label: "Custom ACP command";
|
|
17
|
+
}];
|
|
18
|
+
export declare const agentConfigurationDoc = "# acpx_local agent configuration\n\nAdapter: acpx_local\n\nUse when:\n- The agent should run through Agent Client Protocol via ACPX on the Paperclip host or a managed execution environment.\n- You want one built-in adapter that can target Claude, Codex, or a custom ACP server command.\n- You need Paperclip-managed session identity and live streamed ACP events in later ACPX runtime phases.\n\nDon't use when:\n- You need today's stable Claude Code or Codex CLI wrapper behavior. Use claude_local or codex_local until acpx_local runtime execution is enabled.\n- The host cannot satisfy ACPX's Node >=22.12.0 prerequisite.\n- The agent runtime is not an ACP server and cannot be launched through ACPX.\n\nCore fields:\n- agent (string, optional): claude, codex, or custom. Defaults to claude.\n- agentCommand (string, optional): custom ACP command when agent=custom, or an override for a built-in ACP agent command.\n- mode (string, optional): persistent or oneshot. Defaults to persistent.\n- cwd (string, optional): default absolute working directory fallback for the agent process.\n- permissionMode (string, optional): defaults to approve-all, meaning ACPX permission requests are auto-approved.\n- nonInteractivePermissions (string, optional): fallback behavior when ACPX cannot ask interactively. Supported values are deny and fail.\n- stateDir (string, optional): ACPX state directory. Defaults to a Paperclip-managed company/agent scoped location.\n- instructionsFilePath (string, optional): absolute path to a markdown instructions file used by Paperclip prompt construction.\n- promptTemplate (string, optional): run prompt template.\n- bootstrapPromptTemplate (string, optional): first-run bootstrap prompt template.\n- timeoutSec (number, optional): run timeout in seconds. Defaults to 0, meaning no adapter timeout.\n- env (object, optional): KEY=VALUE environment variables or secret bindings.\n\nDependency decision:\n- acpx_local declares direct dependencies on acpx, @agentclientprotocol/claude-agent-acp, and @zed-industries/codex-acp so the built-in adapter has deterministic package resolution instead of relying on globally installed ACP commands.\n- ACPX currently requires Node >=22.12.0. Paperclip keeps the repo-wide Node >=20 engine and surfaces the stricter runtime prerequisite through acpx_local diagnostics.\n";
|
|
19
|
+
//# 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,eAAe,CAAC;AACjC,eAAO,MAAM,KAAK,iBAAiB,CAAC;AAEpC,eAAO,MAAM,wBAAwB,WAAW,CAAC;AACjD,eAAO,MAAM,uBAAuB,eAAe,CAAC;AACpD,eAAO,MAAM,kCAAkC,gBAAgB,CAAC;AAChE,eAAO,MAAM,8CAA8C,SAAS,CAAC;AACrE,eAAO,MAAM,8BAA8B,IAAI,CAAC;AAEhD,eAAO,MAAM,gBAAgB;;;;;;;;;EAInB,CAAC;AAEX,eAAO,MAAM,qBAAqB,wyEA+BjC,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export const type = "acpx_local";
|
|
2
|
+
export const label = "ACPX (local)";
|
|
3
|
+
export const DEFAULT_ACPX_LOCAL_AGENT = "claude";
|
|
4
|
+
export const DEFAULT_ACPX_LOCAL_MODE = "persistent";
|
|
5
|
+
export const DEFAULT_ACPX_LOCAL_PERMISSION_MODE = "approve-all";
|
|
6
|
+
export const DEFAULT_ACPX_LOCAL_NON_INTERACTIVE_PERMISSIONS = "deny";
|
|
7
|
+
export const DEFAULT_ACPX_LOCAL_TIMEOUT_SEC = 0;
|
|
8
|
+
export const acpxAgentOptions = [
|
|
9
|
+
{ id: "claude", label: "Claude via ACPX" },
|
|
10
|
+
{ id: "codex", label: "Codex via ACPX" },
|
|
11
|
+
{ id: "custom", label: "Custom ACP command" },
|
|
12
|
+
];
|
|
13
|
+
export const agentConfigurationDoc = `# acpx_local agent configuration
|
|
14
|
+
|
|
15
|
+
Adapter: acpx_local
|
|
16
|
+
|
|
17
|
+
Use when:
|
|
18
|
+
- The agent should run through Agent Client Protocol via ACPX on the Paperclip host or a managed execution environment.
|
|
19
|
+
- You want one built-in adapter that can target Claude, Codex, or a custom ACP server command.
|
|
20
|
+
- You need Paperclip-managed session identity and live streamed ACP events in later ACPX runtime phases.
|
|
21
|
+
|
|
22
|
+
Don't use when:
|
|
23
|
+
- You need today's stable Claude Code or Codex CLI wrapper behavior. Use claude_local or codex_local until acpx_local runtime execution is enabled.
|
|
24
|
+
- The host cannot satisfy ACPX's Node >=22.12.0 prerequisite.
|
|
25
|
+
- The agent runtime is not an ACP server and cannot be launched through ACPX.
|
|
26
|
+
|
|
27
|
+
Core fields:
|
|
28
|
+
- agent (string, optional): claude, codex, or custom. Defaults to claude.
|
|
29
|
+
- agentCommand (string, optional): custom ACP command when agent=custom, or an override for a built-in ACP agent command.
|
|
30
|
+
- mode (string, optional): persistent or oneshot. Defaults to persistent.
|
|
31
|
+
- cwd (string, optional): default absolute working directory fallback for the agent process.
|
|
32
|
+
- permissionMode (string, optional): defaults to approve-all, meaning ACPX permission requests are auto-approved.
|
|
33
|
+
- nonInteractivePermissions (string, optional): fallback behavior when ACPX cannot ask interactively. Supported values are deny and fail.
|
|
34
|
+
- stateDir (string, optional): ACPX state directory. Defaults to a Paperclip-managed company/agent scoped location.
|
|
35
|
+
- instructionsFilePath (string, optional): absolute path to a markdown instructions file used by Paperclip prompt construction.
|
|
36
|
+
- promptTemplate (string, optional): run prompt template.
|
|
37
|
+
- bootstrapPromptTemplate (string, optional): first-run bootstrap prompt template.
|
|
38
|
+
- timeoutSec (number, optional): run timeout in seconds. Defaults to 0, meaning no adapter timeout.
|
|
39
|
+
- env (object, optional): KEY=VALUE environment variables or secret bindings.
|
|
40
|
+
|
|
41
|
+
Dependency decision:
|
|
42
|
+
- acpx_local declares direct dependencies on acpx, @agentclientprotocol/claude-agent-acp, and @zed-industries/codex-acp so the built-in adapter has deterministic package resolution instead of relying on globally installed ACP commands.
|
|
43
|
+
- ACPX currently requires Node >=22.12.0. Paperclip keeps the repo-wide Node >=20 engine and surfaces the stricter runtime prerequisite through acpx_local diagnostics.
|
|
44
|
+
`;
|
|
45
|
+
//# 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,YAAY,CAAC;AACjC,MAAM,CAAC,MAAM,KAAK,GAAG,cAAc,CAAC;AAEpC,MAAM,CAAC,MAAM,wBAAwB,GAAG,QAAQ,CAAC;AACjD,MAAM,CAAC,MAAM,uBAAuB,GAAG,YAAY,CAAC;AACpD,MAAM,CAAC,MAAM,kCAAkC,GAAG,aAAa,CAAC;AAChE,MAAM,CAAC,MAAM,8CAA8C,GAAG,MAAM,CAAC;AACrE,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC;AAEhD,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,iBAAiB,EAAE;IAC1C,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE;IACxC,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,oBAAoB,EAAE;CACrC,CAAC;AAEX,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BpC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-schema.d.ts","sourceRoot":"","sources":["../../src/server/config-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAUtE,wBAAgB,eAAe,IAAI,mBAAmB,CA2FrD"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { DEFAULT_ACPX_LOCAL_AGENT, DEFAULT_ACPX_LOCAL_MODE, DEFAULT_ACPX_LOCAL_NON_INTERACTIVE_PERMISSIONS, DEFAULT_ACPX_LOCAL_PERMISSION_MODE, DEFAULT_ACPX_LOCAL_TIMEOUT_SEC, acpxAgentOptions, } from "../index.js";
|
|
2
|
+
export function getConfigSchema() {
|
|
3
|
+
return {
|
|
4
|
+
fields: [
|
|
5
|
+
{
|
|
6
|
+
key: "agent",
|
|
7
|
+
label: "ACP agent",
|
|
8
|
+
type: "select",
|
|
9
|
+
default: DEFAULT_ACPX_LOCAL_AGENT,
|
|
10
|
+
required: true,
|
|
11
|
+
options: acpxAgentOptions.map((agent) => ({ value: agent.id, label: agent.label })),
|
|
12
|
+
hint: "Choose the ACP agent launched through ACPX.",
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
key: "agentCommand",
|
|
16
|
+
label: "Agent command",
|
|
17
|
+
type: "text",
|
|
18
|
+
hint: "Required for custom agents; optional override for built-in Claude or Codex ACP commands.",
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
key: "mode",
|
|
22
|
+
label: "Session mode",
|
|
23
|
+
type: "select",
|
|
24
|
+
default: DEFAULT_ACPX_LOCAL_MODE,
|
|
25
|
+
options: [
|
|
26
|
+
{ value: "persistent", label: "Persistent" },
|
|
27
|
+
{ value: "oneshot", label: "One shot" },
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
key: "permissionMode",
|
|
32
|
+
label: "Permission mode",
|
|
33
|
+
type: "select",
|
|
34
|
+
default: DEFAULT_ACPX_LOCAL_PERMISSION_MODE,
|
|
35
|
+
options: [
|
|
36
|
+
{ value: "approve-all", label: "Approve all" },
|
|
37
|
+
{ value: "default", label: "Approve reads" },
|
|
38
|
+
],
|
|
39
|
+
hint: "Defaults to maximum permissions. Approve reads grants read-only requests and asks for approval on writes.",
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
key: "nonInteractivePermissions",
|
|
43
|
+
label: "Non-interactive permissions",
|
|
44
|
+
type: "select",
|
|
45
|
+
default: DEFAULT_ACPX_LOCAL_NON_INTERACTIVE_PERMISSIONS,
|
|
46
|
+
options: [
|
|
47
|
+
{ value: "deny", label: "Deny" },
|
|
48
|
+
{ value: "fail", label: "Fail" },
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
key: "cwd",
|
|
53
|
+
label: "Working directory",
|
|
54
|
+
type: "text",
|
|
55
|
+
hint: "Absolute fallback directory. Paperclip execution workspaces can override this at runtime.",
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
key: "stateDir",
|
|
59
|
+
label: "State directory",
|
|
60
|
+
type: "text",
|
|
61
|
+
hint: "Optional ACPX session state directory. Defaults to Paperclip-managed company/agent scoped storage.",
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
key: "instructionsFilePath",
|
|
65
|
+
label: "Instructions file",
|
|
66
|
+
type: "text",
|
|
67
|
+
hint: "Optional absolute path to markdown instructions injected into the run prompt.",
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
key: "promptTemplate",
|
|
71
|
+
label: "Prompt template",
|
|
72
|
+
type: "textarea",
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
key: "bootstrapPromptTemplate",
|
|
76
|
+
label: "Bootstrap prompt template",
|
|
77
|
+
type: "textarea",
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
key: "timeoutSec",
|
|
81
|
+
label: "Timeout seconds",
|
|
82
|
+
type: "number",
|
|
83
|
+
default: DEFAULT_ACPX_LOCAL_TIMEOUT_SEC,
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
key: "env",
|
|
87
|
+
label: "Environment JSON",
|
|
88
|
+
type: "textarea",
|
|
89
|
+
hint: "Optional JSON object of environment values or secret bindings.",
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=config-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-schema.js","sourceRoot":"","sources":["../../src/server/config-schema.ts"],"names":[],"mappings":"AACA,OAAO,EACL,wBAAwB,EACxB,uBAAuB,EACvB,8CAA8C,EAC9C,kCAAkC,EAClC,8BAA8B,EAC9B,gBAAgB,GACjB,MAAM,aAAa,CAAC;AAErB,MAAM,UAAU,eAAe;IAC7B,OAAO;QACL,MAAM,EAAE;YACN;gBACE,GAAG,EAAE,OAAO;gBACZ,KAAK,EAAE,WAAW;gBAClB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,wBAAwB;gBACjC,QAAQ,EAAE,IAAI;gBACd,OAAO,EAAE,gBAAgB,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;gBACnF,IAAI,EAAE,6CAA6C;aACpD;YACD;gBACE,GAAG,EAAE,cAAc;gBACnB,KAAK,EAAE,eAAe;gBACtB,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,0FAA0F;aACjG;YACD;gBACE,GAAG,EAAE,MAAM;gBACX,KAAK,EAAE,cAAc;gBACrB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,uBAAuB;gBAChC,OAAO,EAAE;oBACP,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE;oBAC5C,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE;iBACxC;aACF;YACD;gB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BACV,KAAK,EAAE,kBAAkB;gBACzB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,gEAAgE;aACvE;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { AdapterExecutionContext, AdapterExecutionResult } from "@paperclipai/adapter-utils";
|
|
2
|
+
import { type AcpRuntime, type AcpRuntimeHandle, type AcpRuntimeOptions } from "acpx/runtime";
|
|
3
|
+
type AcpxRuntimeFactory = (options: AcpRuntimeOptions) => AcpRuntime;
|
|
4
|
+
interface RuntimeCacheEntry {
|
|
5
|
+
runtime: AcpRuntime;
|
|
6
|
+
handle: AcpRuntimeHandle;
|
|
7
|
+
fingerprint: string;
|
|
8
|
+
lastUsedAt: number;
|
|
9
|
+
}
|
|
10
|
+
interface ExecuteDeps {
|
|
11
|
+
createRuntime?: AcpxRuntimeFactory;
|
|
12
|
+
now?: () => number;
|
|
13
|
+
warmHandles?: Map<string, RuntimeCacheEntry>;
|
|
14
|
+
}
|
|
15
|
+
export declare function createAcpxLocalExecutor(deps?: ExecuteDeps): (ctx: AdapterExecutionContext) => Promise<AdapterExecutionResult>;
|
|
16
|
+
export declare const execute: (ctx: AdapterExecutionContext) => Promise<AdapterExecutionResult>;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=execute.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../src/server/execute.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAsBlG,OAAO,EAML,KAAK,UAAU,EAEf,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EAGvB,MAAM,cAAc,CAAC;AActB,KAAK,kBAAkB,GAAG,CAAC,OAAO,EAAE,iBAAiB,KAAK,UAAU,CAAC;AAErE,UAAU,iBAAiB;IACzB,OAAO,EAAE,UAAU,CAAC;IACpB,MAAM,EAAE,gBAAgB,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,WAAW;IACnB,aAAa,CAAC,EAAE,kBAAkB,CAAC;IACnC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;CAC9C;AAk4BD,wBAAgB,uBAAuB,CAAC,IAAI,GAAE,WAAgB,IAKrB,KAAK,uBAAuB,KAAG,OAAO,CAAC,sBAAsB,CAAC,CAgPtG;AAED,eAAO,MAAM,OAAO,QAlP0B,uBAAuB,KAAG,OAAO,CAAC,sBAAsB,CAkPtD,CAAC"}
|