@paperclipai/server 2026.830.0-canary.13 → 2026.830.0-canary.15
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/build-info.json +1 -1
- package/dist/vendor/paperclip-runner/cli/acpx-sidecar-input.d.ts +4 -0
- package/dist/vendor/paperclip-runner/cli/acpx-sidecar-input.d.ts.map +1 -0
- package/dist/vendor/paperclip-runner/cli/acpx-sidecar-input.js +14 -0
- package/dist/vendor/paperclip-runner/cli/acpx-sidecar-input.js.map +1 -0
- package/dist/vendor/paperclip-runner/cli/serial-input-queue.d.ts +6 -0
- package/dist/vendor/paperclip-runner/cli/serial-input-queue.d.ts.map +1 -0
- package/dist/vendor/paperclip-runner/cli/serial-input-queue.js +19 -0
- package/dist/vendor/paperclip-runner/cli/serial-input-queue.js.map +1 -0
- package/dist/vendor/paperclip-runner/drivers/acpx/acp-question-adapter.d.ts +22 -0
- package/dist/vendor/paperclip-runner/drivers/acpx/acp-question-adapter.d.ts.map +1 -0
- package/dist/vendor/paperclip-runner/drivers/acpx/acp-question-adapter.js +269 -0
- package/dist/vendor/paperclip-runner/drivers/acpx/acp-question-adapter.js.map +1 -0
- package/dist/vendor/paperclip-runner/drivers/acpx/driver-profile.d.ts +13 -0
- package/dist/vendor/paperclip-runner/drivers/acpx/driver-profile.d.ts.map +1 -0
- package/dist/vendor/paperclip-runner/drivers/acpx/driver-profile.js +112 -0
- package/dist/vendor/paperclip-runner/drivers/acpx/driver-profile.js.map +1 -0
- package/dist/vendor/paperclip-runner/drivers/acpx/environment.d.ts +20 -0
- package/dist/vendor/paperclip-runner/drivers/acpx/environment.d.ts.map +1 -0
- package/dist/vendor/paperclip-runner/drivers/acpx/environment.js +62 -0
- package/dist/vendor/paperclip-runner/drivers/acpx/environment.js.map +1 -0
- package/dist/vendor/paperclip-runner/drivers/acpx/model-verification.d.ts +18 -0
- package/dist/vendor/paperclip-runner/drivers/acpx/model-verification.d.ts.map +1 -0
- package/dist/vendor/paperclip-runner/drivers/acpx/model-verification.js +42 -0
- package/dist/vendor/paperclip-runner/drivers/acpx/model-verification.js.map +1 -0
- package/dist/vendor/paperclip-runner/drivers/acpx/permission-policy.d.ts +25 -0
- package/dist/vendor/paperclip-runner/drivers/acpx/permission-policy.d.ts.map +1 -0
- package/dist/vendor/paperclip-runner/drivers/acpx/permission-policy.js +27 -0
- package/dist/vendor/paperclip-runner/drivers/acpx/permission-policy.js.map +1 -0
- package/dist/vendor/paperclip-runner/drivers/acpx/qualified-profiles.d.ts +36 -0
- package/dist/vendor/paperclip-runner/drivers/acpx/qualified-profiles.d.ts.map +1 -0
- package/dist/vendor/paperclip-runner/drivers/acpx/qualified-profiles.js +71 -0
- package/dist/vendor/paperclip-runner/drivers/acpx/qualified-profiles.js.map +1 -0
- package/dist/vendor/paperclip-runner/drivers/acpx/sidecar-protocol.d.ts +67 -0
- package/dist/vendor/paperclip-runner/drivers/acpx/sidecar-protocol.d.ts.map +1 -0
- package/dist/vendor/paperclip-runner/drivers/acpx/sidecar-protocol.js +92 -0
- package/dist/vendor/paperclip-runner/drivers/acpx/sidecar-protocol.js.map +1 -0
- package/package.json +18 -18
package/dist/build-info.json
CHANGED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function enqueueAcpxSidecarInput(pending: Promise<void>, operation: () => Promise<void>, onError: (error: unknown) => void | Promise<void>): Promise<void>;
|
|
2
|
+
export declare function recordAcpxBootstrapFailure(current: Error | null, command: string, error: Error): Error | null;
|
|
3
|
+
export declare function acpxBootstrapBlockedError(failure: Error | null, command: string): Error | null;
|
|
4
|
+
//# sourceMappingURL=acpx-sidecar-input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acpx-sidecar-input.d.ts","sourceRoot":"","sources":["../../src/cli/acpx-sidecar-input.ts"],"names":[],"mappings":"AAIA,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,EACtB,SAAS,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,EAC9B,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAChD,OAAO,CAAC,IAAI,CAAC,CAEf;AAED,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,KAAK,GAAG,IAAI,EACrB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,KAAK,GACX,KAAK,GAAG,IAAI,CAEd;AAED,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,KAAK,GAAG,IAAI,EACrB,OAAO,EAAE,MAAM,GACd,KAAK,GAAG,IAAI,CAMd"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { enqueueSerialInput } from "./serial-input-queue.js";
|
|
2
|
+
const ACPX_BOOTSTRAP_COMMANDS = new Set(["initialize", "session.open"]);
|
|
3
|
+
export function enqueueAcpxSidecarInput(pending, operation, onError) {
|
|
4
|
+
return enqueueSerialInput(pending, operation, onError);
|
|
5
|
+
}
|
|
6
|
+
export function recordAcpxBootstrapFailure(current, command, error) {
|
|
7
|
+
return current ?? (ACPX_BOOTSTRAP_COMMANDS.has(command) ? error : null);
|
|
8
|
+
}
|
|
9
|
+
export function acpxBootstrapBlockedError(failure, command) {
|
|
10
|
+
return failure
|
|
11
|
+
? new Error(`ACPX provider bootstrap failed before ${command}: ${failure.message}`)
|
|
12
|
+
: null;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=acpx-sidecar-input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acpx-sidecar-input.js","sourceRoot":"","sources":["../../src/cli/acpx-sidecar-input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,MAAM,uBAAuB,GAAG,IAAI,GAAG,CAAC,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC,CAAC;AAExE,MAAM,UAAU,uBAAuB,CACrC,OAAsB,EACtB,SAA8B,EAC9B,OAAiD;IAEjD,OAAO,kBAAkB,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;AACzD,CAAC;AAED,MAAM,UAAU,0BAA0B,CACxC,OAAqB,EACrB,OAAe,EACf,KAAY;IAEZ,OAAO,OAAO,IAAI,CAAC,uBAAuB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAC1E,CAAC;AAED,MAAM,UAAU,yBAAyB,CACvC,OAAqB,EACrB,OAAe;IAEf,OAAO,OAAO;QACZ,CAAC,CAAC,IAAI,KAAK,CACP,yCAAyC,OAAO,KAAK,OAAO,CAAC,OAAO,EAAE,CACvE;QACH,CAAC,CAAC,IAAI,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Append one asynchronous input operation to a queue that always remains
|
|
3
|
+
* usable after an operation or diagnostic callback fails.
|
|
4
|
+
*/
|
|
5
|
+
export declare function enqueueSerialInput(pending: Promise<void>, operation: () => Promise<void>, onError: (error: unknown) => void | Promise<void>): Promise<void>;
|
|
6
|
+
//# sourceMappingURL=serial-input-queue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serial-input-queue.d.ts","sourceRoot":"","sources":["../../src/cli/serial-input-queue.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,EACtB,SAAS,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,EAC9B,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAChD,OAAO,CAAC,IAAI,CAAC,CAYf"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Append one asynchronous input operation to a queue that always remains
|
|
3
|
+
* usable after an operation or diagnostic callback fails.
|
|
4
|
+
*/
|
|
5
|
+
export function enqueueSerialInput(pending, operation, onError) {
|
|
6
|
+
const reportError = (error) => {
|
|
7
|
+
try {
|
|
8
|
+
// Diagnostics are best-effort side effects, not input-queue work. Start
|
|
9
|
+
// them in order, but never give an uncooperative callback authority to
|
|
10
|
+
// block later frames or the shutdown drain.
|
|
11
|
+
void Promise.resolve(onError(error)).catch(() => undefined);
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
// Diagnostics must not poison the queue or skip later input frames.
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
return pending.catch(reportError).then(operation).catch(reportError);
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=serial-input-queue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serial-input-queue.js","sourceRoot":"","sources":["../../src/cli/serial-input-queue.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAsB,EACtB,SAA8B,EAC9B,OAAiD;IAEjD,MAAM,WAAW,GAAG,CAAC,KAAc,EAAQ,EAAE;QAC3C,IAAI,CAAC;YACH,wEAAwE;YACxE,uEAAuE;YACvE,4CAA4C;YAC5C,KAAK,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QAC9D,CAAC;QAAC,MAAM,CAAC;YACP,oEAAoE;QACtE,CAAC;IACH,CAAC,CAAC;IACF,OAAO,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;AACvE,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type PaperclipQuestionSet } from "../../contracts/question-set.js";
|
|
2
|
+
export interface AcpFormElicitationRequest {
|
|
3
|
+
mode: string;
|
|
4
|
+
message?: unknown;
|
|
5
|
+
requestedSchema?: unknown;
|
|
6
|
+
}
|
|
7
|
+
export type AcpFormContent = Record<string, string | number | boolean | string[]>;
|
|
8
|
+
export interface AcpAcceptElicitationResponse {
|
|
9
|
+
action: "accept";
|
|
10
|
+
content: AcpFormContent;
|
|
11
|
+
}
|
|
12
|
+
export interface NormalizedAcpForm {
|
|
13
|
+
questionSet: PaperclipQuestionSet;
|
|
14
|
+
/** Convert a validated Paperclip response back into typed ACP content. */
|
|
15
|
+
accept(response: unknown): AcpAcceptElicitationResponse;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* ACP remains private to this adapter. Only the normalized question set is
|
|
19
|
+
* allowed to cross the Paperclip runtime-request boundary.
|
|
20
|
+
*/
|
|
21
|
+
export declare function normalizeAcpFormElicitation(request: AcpFormElicitationRequest): NormalizedAcpForm | null;
|
|
22
|
+
//# sourceMappingURL=acp-question-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acp-question-adapter.d.ts","sourceRoot":"","sources":["../../../src/drivers/acpx/acp-question-adapter.ts"],"names":[],"mappings":"AAEA,OAAO,EAOL,KAAK,oBAAoB,EAC1B,MAAM,iCAAiC,CAAC;AAKzC,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,MAAM,cAAc,GAAG,MAAM,CACjC,MAAM,EACN,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,EAAE,CACrC,CAAC;AAEF,MAAM,WAAW,4BAA4B;IAC3C,MAAM,EAAE,QAAQ,CAAC;IACjB,OAAO,EAAE,cAAc,CAAC;CACzB;AASD,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,oBAAoB,CAAC;IAClC,0EAA0E;IAC1E,MAAM,CAAC,QAAQ,EAAE,OAAO,GAAG,4BAA4B,CAAC;CACzD;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,yBAAyB,GACjC,iBAAiB,GAAG,IAAI,CAyD1B"}
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { PAPERCLIP_QUESTION_SET_SCHEMA, parsePaperclipQuestionResponse, parsePaperclipQuestionSet, } from "../../contracts/question-set.js";
|
|
3
|
+
const MAX_ACP_FORM_FIELDS = 64;
|
|
4
|
+
const MAX_ACP_FIELD_OPTIONS = 128;
|
|
5
|
+
/**
|
|
6
|
+
* ACP remains private to this adapter. Only the normalized question set is
|
|
7
|
+
* allowed to cross the Paperclip runtime-request boundary.
|
|
8
|
+
*/
|
|
9
|
+
export function normalizeAcpFormElicitation(request) {
|
|
10
|
+
const rawRequest = record(request);
|
|
11
|
+
if (rawRequest.mode !== "form")
|
|
12
|
+
return null;
|
|
13
|
+
const schema = record(rawRequest.requestedSchema);
|
|
14
|
+
const properties = record(schema.properties);
|
|
15
|
+
const propertyEntries = Object.entries(properties);
|
|
16
|
+
if (propertyEntries.length === 0 ||
|
|
17
|
+
propertyEntries.length > MAX_ACP_FORM_FIELDS) {
|
|
18
|
+
throw new Error(`ACP form elicitation must define between 1 and ${MAX_ACP_FORM_FIELDS} supported properties`);
|
|
19
|
+
}
|
|
20
|
+
const propertyNames = new Set(propertyEntries.map(([name]) => name));
|
|
21
|
+
const required = new Set(Array.isArray(schema.required)
|
|
22
|
+
? schema.required
|
|
23
|
+
.filter((value) => typeof value === "string" && propertyNames.has(value))
|
|
24
|
+
: []);
|
|
25
|
+
const bindings = propertyEntries.map(([propertyName, value], index) => normalizeField(propertyName, value, index, required.has(propertyName)));
|
|
26
|
+
const title = optionalText(schema.title) ?? "Additional information needed";
|
|
27
|
+
const descriptions = [
|
|
28
|
+
optionalText(rawRequest.message),
|
|
29
|
+
optionalText(schema.description),
|
|
30
|
+
]
|
|
31
|
+
.filter((value) => value !== title)
|
|
32
|
+
.filter((value, position, all) => Boolean(value) && all.indexOf(value) === position);
|
|
33
|
+
const questionSet = parsePaperclipQuestionSet({
|
|
34
|
+
schema: PAPERCLIP_QUESTION_SET_SCHEMA,
|
|
35
|
+
title,
|
|
36
|
+
...(descriptions.length > 0
|
|
37
|
+
? { description: descriptions.join("\n\n") }
|
|
38
|
+
: {}),
|
|
39
|
+
submitLabel: "Submit answers",
|
|
40
|
+
questions: bindings.map((binding) => binding.question),
|
|
41
|
+
});
|
|
42
|
+
return {
|
|
43
|
+
questionSet,
|
|
44
|
+
accept(response) {
|
|
45
|
+
const parsed = parsePaperclipQuestionResponse(questionSet, response);
|
|
46
|
+
return {
|
|
47
|
+
action: "accept",
|
|
48
|
+
content: acpContent(bindings, parsed),
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function normalizeField(propertyName, value, index, required) {
|
|
54
|
+
const property = record(value);
|
|
55
|
+
const type = text(property.type);
|
|
56
|
+
const id = stableFieldId(propertyName, index);
|
|
57
|
+
const header = optionalText(property.title) ?? propertyName;
|
|
58
|
+
const prompt = optionalText(property.description) ?? header;
|
|
59
|
+
const base = { id, header, prompt, required };
|
|
60
|
+
if (type === "string") {
|
|
61
|
+
const nativeOptions = enumOptions(property.oneOf ?? property.anyOf, property.enum);
|
|
62
|
+
if (nativeOptions.length > 0) {
|
|
63
|
+
const normalized = normalizeOptions(nativeOptions);
|
|
64
|
+
return {
|
|
65
|
+
propertyName,
|
|
66
|
+
property,
|
|
67
|
+
optionValues: normalized.values,
|
|
68
|
+
question: {
|
|
69
|
+
...base,
|
|
70
|
+
answerMode: "single_select",
|
|
71
|
+
options: normalized.options,
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
const minLength = finiteNonNegativeInteger(property.minLength);
|
|
76
|
+
const maxLength = finiteNonNegativeInteger(property.maxLength);
|
|
77
|
+
const pattern = optionalText(property.pattern);
|
|
78
|
+
return {
|
|
79
|
+
propertyName,
|
|
80
|
+
property,
|
|
81
|
+
optionValues: new Map(),
|
|
82
|
+
question: {
|
|
83
|
+
...base,
|
|
84
|
+
answerMode: "text",
|
|
85
|
+
textValidation: {
|
|
86
|
+
inputType: "text",
|
|
87
|
+
...(minLength !== undefined ? { minLength } : {}),
|
|
88
|
+
...(maxLength !== undefined ? { maxLength } : {}),
|
|
89
|
+
...(pattern !== undefined ? { pattern } : {}),
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
if (type === "number" || type === "integer") {
|
|
95
|
+
const minimum = finiteNumber(property.minimum);
|
|
96
|
+
const maximum = finiteNumber(property.maximum);
|
|
97
|
+
return {
|
|
98
|
+
propertyName,
|
|
99
|
+
property,
|
|
100
|
+
optionValues: new Map(),
|
|
101
|
+
question: {
|
|
102
|
+
...base,
|
|
103
|
+
answerMode: "text",
|
|
104
|
+
textValidation: {
|
|
105
|
+
inputType: type,
|
|
106
|
+
...(minimum !== undefined ? { minimum } : {}),
|
|
107
|
+
...(maximum !== undefined ? { maximum } : {}),
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
if (type === "boolean") {
|
|
113
|
+
const normalized = normalizeOptions([
|
|
114
|
+
{ value: "true", label: "Yes" },
|
|
115
|
+
{ value: "false", label: "No" },
|
|
116
|
+
]);
|
|
117
|
+
return {
|
|
118
|
+
propertyName,
|
|
119
|
+
property,
|
|
120
|
+
optionValues: normalized.values,
|
|
121
|
+
question: {
|
|
122
|
+
...base,
|
|
123
|
+
answerMode: "single_select",
|
|
124
|
+
options: normalized.options,
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
if (type === "array") {
|
|
129
|
+
const items = record(property.items);
|
|
130
|
+
const nativeOptions = enumOptions(items.anyOf ?? items.oneOf, items.enum);
|
|
131
|
+
if (nativeOptions.length === 0) {
|
|
132
|
+
throw new Error(`ACP multi-select property ${propertyName} must define enum, anyOf, or oneOf options`);
|
|
133
|
+
}
|
|
134
|
+
const normalized = normalizeOptions(nativeOptions);
|
|
135
|
+
return {
|
|
136
|
+
propertyName,
|
|
137
|
+
property,
|
|
138
|
+
optionValues: normalized.values,
|
|
139
|
+
question: {
|
|
140
|
+
...base,
|
|
141
|
+
answerMode: "multi_select",
|
|
142
|
+
options: normalized.options,
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
throw new Error(`Unsupported ACP elicitation property type ${JSON.stringify(type)} for ${propertyName}`);
|
|
147
|
+
}
|
|
148
|
+
function acpContent(bindings, response) {
|
|
149
|
+
const content = {};
|
|
150
|
+
for (const binding of bindings) {
|
|
151
|
+
const answer = response.answers[binding.question.id];
|
|
152
|
+
if (!answer)
|
|
153
|
+
continue;
|
|
154
|
+
const type = text(binding.property.type);
|
|
155
|
+
if (type === "string" && binding.question.answerMode === "text") {
|
|
156
|
+
if (answer.text !== undefined)
|
|
157
|
+
setContent(content, binding.propertyName, answer.text);
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
if (type === "number" || type === "integer") {
|
|
161
|
+
if (answer.text !== undefined)
|
|
162
|
+
setContent(content, binding.propertyName, Number(answer.text));
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
if (type === "boolean") {
|
|
166
|
+
const selected = answer.selectedOptionIds?.[0];
|
|
167
|
+
if (selected !== undefined)
|
|
168
|
+
setContent(content, binding.propertyName, binding.optionValues.get(selected) === "true");
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
const selectedValues = (answer.selectedOptionIds ?? []).map((id) => {
|
|
172
|
+
const selected = binding.optionValues.get(id);
|
|
173
|
+
if (selected === undefined)
|
|
174
|
+
throw new Error(`ACP option ${id} is no longer available`);
|
|
175
|
+
return selected;
|
|
176
|
+
});
|
|
177
|
+
if (type === "array")
|
|
178
|
+
setContent(content, binding.propertyName, selectedValues);
|
|
179
|
+
else if (selectedValues[0] !== undefined)
|
|
180
|
+
setContent(content, binding.propertyName, selectedValues[0]);
|
|
181
|
+
}
|
|
182
|
+
return content;
|
|
183
|
+
}
|
|
184
|
+
function setContent(content, propertyName, value) {
|
|
185
|
+
Object.defineProperty(content, propertyName, {
|
|
186
|
+
configurable: true,
|
|
187
|
+
enumerable: true,
|
|
188
|
+
value,
|
|
189
|
+
writable: true,
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
function enumOptions(titled, values) {
|
|
193
|
+
const source = Array.isArray(titled)
|
|
194
|
+
? titled
|
|
195
|
+
: Array.isArray(values)
|
|
196
|
+
? values
|
|
197
|
+
: [];
|
|
198
|
+
if (source.length > MAX_ACP_FIELD_OPTIONS) {
|
|
199
|
+
throw new Error(`ACP elicitation fields cannot define more than ${MAX_ACP_FIELD_OPTIONS} options`);
|
|
200
|
+
}
|
|
201
|
+
if (Array.isArray(titled)) {
|
|
202
|
+
return titled.map((entry, index) => {
|
|
203
|
+
const option = record(entry);
|
|
204
|
+
const optionValue = requiredText(option.const, `ACP enum option ${index} const`);
|
|
205
|
+
const description = optionalText(option.description);
|
|
206
|
+
return {
|
|
207
|
+
value: optionValue,
|
|
208
|
+
label: optionalText(option.title) ?? optionValue,
|
|
209
|
+
...(description !== undefined ? { description } : {}),
|
|
210
|
+
};
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
return source.map((value, index) => {
|
|
214
|
+
const native = requiredText(value, `ACP enum option ${index}`);
|
|
215
|
+
return { value: native, label: native };
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
function normalizeOptions(nativeOptions) {
|
|
219
|
+
const values = new Map();
|
|
220
|
+
const options = nativeOptions.map((option, index) => {
|
|
221
|
+
const id = `option-${index + 1}`;
|
|
222
|
+
values.set(id, option.value);
|
|
223
|
+
return {
|
|
224
|
+
id,
|
|
225
|
+
label: option.label,
|
|
226
|
+
...(option.description !== undefined
|
|
227
|
+
? { description: option.description }
|
|
228
|
+
: {}),
|
|
229
|
+
};
|
|
230
|
+
});
|
|
231
|
+
return { options, values };
|
|
232
|
+
}
|
|
233
|
+
function stableFieldId(value, index) {
|
|
234
|
+
const readable = value
|
|
235
|
+
.trim()
|
|
236
|
+
.replace(/[^A-Za-z0-9._:-]+/g, "-")
|
|
237
|
+
.replace(/^-+|-+$/g, "")
|
|
238
|
+
.slice(0, 96);
|
|
239
|
+
const digest = createHash("sha256").update(value).digest("hex").slice(0, 12);
|
|
240
|
+
return `field-${index + 1}-${readable || "value"}-${digest}`;
|
|
241
|
+
}
|
|
242
|
+
function record(value) {
|
|
243
|
+
return typeof value === "object" && value !== null && !Array.isArray(value)
|
|
244
|
+
? value
|
|
245
|
+
: {};
|
|
246
|
+
}
|
|
247
|
+
function text(value) {
|
|
248
|
+
return typeof value === "string" ? value : "";
|
|
249
|
+
}
|
|
250
|
+
function optionalText(value) {
|
|
251
|
+
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
252
|
+
}
|
|
253
|
+
function requiredText(value, field) {
|
|
254
|
+
const result = optionalText(value);
|
|
255
|
+
if (!result)
|
|
256
|
+
throw new Error(`${field} is required`);
|
|
257
|
+
return result;
|
|
258
|
+
}
|
|
259
|
+
function finiteNumber(value) {
|
|
260
|
+
return typeof value === "number" && Number.isFinite(value)
|
|
261
|
+
? value
|
|
262
|
+
: undefined;
|
|
263
|
+
}
|
|
264
|
+
function finiteNonNegativeInteger(value) {
|
|
265
|
+
return Number.isSafeInteger(value) && Number(value) >= 0
|
|
266
|
+
? Number(value)
|
|
267
|
+
: undefined;
|
|
268
|
+
}
|
|
269
|
+
//# sourceMappingURL=acp-question-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acp-question-adapter.js","sourceRoot":"","sources":["../../../src/drivers/acpx/acp-question-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EACL,6BAA6B,EAC7B,8BAA8B,EAC9B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C,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;QACtD,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;QACf,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { HarnessDriverConfigValidation, HarnessDriverDescriptor } from "../../contracts/harness-driver.js";
|
|
2
|
+
import type { NativeAcpxPermissionMode } from "../../contracts/native-execution.js";
|
|
3
|
+
import type { NativeSessionCapabilities } from "../../contracts/types.js";
|
|
4
|
+
import { type QualifiedAcpxAgent } from "./qualified-profiles.js";
|
|
5
|
+
export interface ValidatedAcpxDriverConfig extends Record<string, unknown> {
|
|
6
|
+
agent: QualifiedAcpxAgent;
|
|
7
|
+
model: string;
|
|
8
|
+
permissionMode: NativeAcpxPermissionMode;
|
|
9
|
+
}
|
|
10
|
+
export declare function acpxCapabilities(agent: QualifiedAcpxAgent): NativeSessionCapabilities;
|
|
11
|
+
export declare function acpxDriverDescriptor(agent: QualifiedAcpxAgent): HarnessDriverDescriptor;
|
|
12
|
+
export declare function validateAcpxDriverConfig(value: unknown): HarnessDriverConfigValidation;
|
|
13
|
+
//# sourceMappingURL=driver-profile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"driver-profile.d.ts","sourceRoot":"","sources":["../../../src/drivers/acpx/driver-profile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,6BAA6B,EAC7B,uBAAuB,EACxB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AACpF,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAE1E,OAAO,EAIL,KAAK,kBAAkB,EACxB,MAAM,yBAAyB,CAAC;AAUjC,MAAM,WAAW,yBAA0B,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACxE,KAAK,EAAE,kBAAkB,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,wBAAwB,CAAC;CAC1C;AAED,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,kBAAkB,GACxB,yBAAyB,CAyB3B;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,kBAAkB,GACxB,uBAAuB,CAazB;AAED,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,OAAO,GACb,6BAA6B,CAkD/B"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { providerFamilyCapabilities } from "../../provider-events.js";
|
|
2
|
+
import { ACPX_DRIVER_KIND, QUALIFIED_ACPX_VERSION, resolveQualifiedAcpxProfile, } from "./qualified-profiles.js";
|
|
3
|
+
const ACPX_AGENTS = ["pi", "claude", "codex"];
|
|
4
|
+
const ACPX_PERMISSION_MODES = [
|
|
5
|
+
"approve-all",
|
|
6
|
+
"approve-reads",
|
|
7
|
+
"deny-all",
|
|
8
|
+
];
|
|
9
|
+
const ACPX_CONFIG_FIELDS = new Set(["agent", "model", "permissionMode"]);
|
|
10
|
+
export function acpxCapabilities(agent) {
|
|
11
|
+
return {
|
|
12
|
+
resume: true,
|
|
13
|
+
typedEvents: true,
|
|
14
|
+
typedEventFamilies: providerFamilyCapabilities({
|
|
15
|
+
plan: agent === "pi" ? "unsupported" : "available",
|
|
16
|
+
tool_execution: "available",
|
|
17
|
+
model_identity: "available",
|
|
18
|
+
review: "available",
|
|
19
|
+
provider_notice: "available",
|
|
20
|
+
artifact: "policy_disabled",
|
|
21
|
+
}),
|
|
22
|
+
steering: false,
|
|
23
|
+
interruption: true,
|
|
24
|
+
structuredResult: true,
|
|
25
|
+
read: true,
|
|
26
|
+
reconciliation: true,
|
|
27
|
+
usage: true,
|
|
28
|
+
dynamicTools: true,
|
|
29
|
+
runtimeRequestResolution: true,
|
|
30
|
+
runtimeRequestHandoff: true,
|
|
31
|
+
goals: false,
|
|
32
|
+
threadLineage: false,
|
|
33
|
+
unsupported: ["steering", "goals", "threadLineage"],
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export function acpxDriverDescriptor(agent) {
|
|
37
|
+
return {
|
|
38
|
+
kind: ACPX_DRIVER_KIND,
|
|
39
|
+
displayName: `${displayAgent(agent)} via ACPX`,
|
|
40
|
+
version: QUALIFIED_ACPX_VERSION,
|
|
41
|
+
protocolVersion: "acp/v1",
|
|
42
|
+
runtimeContextCapabilities: {
|
|
43
|
+
instructions: "native",
|
|
44
|
+
skills: "native",
|
|
45
|
+
mcp: "native",
|
|
46
|
+
},
|
|
47
|
+
capabilities: acpxCapabilities(agent),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export function validateAcpxDriverConfig(value) {
|
|
51
|
+
const config = record(value);
|
|
52
|
+
if (config === null) {
|
|
53
|
+
return invalid("", "invalid_config", "ACPX config must be an object.");
|
|
54
|
+
}
|
|
55
|
+
const unknownField = Object.keys(config).find((field) => !ACPX_CONFIG_FIELDS.has(field));
|
|
56
|
+
if (unknownField !== undefined) {
|
|
57
|
+
return invalid(unknownField, "unknown_field", `ACPX config does not support ${unknownField}.`);
|
|
58
|
+
}
|
|
59
|
+
const agent = text(config.agent);
|
|
60
|
+
if (!isAcpxAgent(agent)) {
|
|
61
|
+
return invalid("agent", "invalid_agent", "ACPX agent must be pi, claude, or codex.");
|
|
62
|
+
}
|
|
63
|
+
const model = text(config.model);
|
|
64
|
+
try {
|
|
65
|
+
resolveQualifiedAcpxProfile(agent, model);
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
return invalid("model", "invalid_model", safeErrorMessage(error));
|
|
69
|
+
}
|
|
70
|
+
const permissionMode = Object.prototype.hasOwnProperty.call(config, "permissionMode")
|
|
71
|
+
? text(config.permissionMode)
|
|
72
|
+
: "approve-all";
|
|
73
|
+
if (!isPermissionMode(permissionMode)) {
|
|
74
|
+
return invalid("permissionMode", "invalid_permission_mode", "ACPX permission mode must be approve-all, approve-reads, or deny-all.");
|
|
75
|
+
}
|
|
76
|
+
const validated = {
|
|
77
|
+
agent,
|
|
78
|
+
model,
|
|
79
|
+
permissionMode,
|
|
80
|
+
};
|
|
81
|
+
return { ok: true, config: validated, issues: [] };
|
|
82
|
+
}
|
|
83
|
+
function invalid(path, code, message) {
|
|
84
|
+
return { ok: false, config: null, issues: [{ path, code, message }] };
|
|
85
|
+
}
|
|
86
|
+
function isAcpxAgent(value) {
|
|
87
|
+
return ACPX_AGENTS.includes(value);
|
|
88
|
+
}
|
|
89
|
+
function isPermissionMode(value) {
|
|
90
|
+
return ACPX_PERMISSION_MODES.includes(value);
|
|
91
|
+
}
|
|
92
|
+
function displayAgent(agent) {
|
|
93
|
+
if (agent === "pi")
|
|
94
|
+
return "Pi";
|
|
95
|
+
if (agent === "claude")
|
|
96
|
+
return "Claude";
|
|
97
|
+
return "Codex";
|
|
98
|
+
}
|
|
99
|
+
function record(value) {
|
|
100
|
+
return typeof value === "object" && value !== null && !Array.isArray(value)
|
|
101
|
+
? value
|
|
102
|
+
: null;
|
|
103
|
+
}
|
|
104
|
+
function text(value) {
|
|
105
|
+
return typeof value === "string" ? value : "";
|
|
106
|
+
}
|
|
107
|
+
function safeErrorMessage(error) {
|
|
108
|
+
return error instanceof Error
|
|
109
|
+
? error.message.slice(0, 1_000)
|
|
110
|
+
: "Invalid model.";
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=driver-profile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"driver-profile.js","sourceRoot":"","sources":["../../../src/drivers/acpx/driver-profile.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,2BAA2B,GAE5B,MAAM,yBAAyB,CAAC;AAEjC,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAU,CAAC;AACvD,MAAM,qBAAqB,GAAG;IAC5B,aA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AC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC;QAC/B,CAAC,CAAC,gBAAgB,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { QualifiedAcpxAgent } from "./qualified-profiles.js";
|
|
2
|
+
declare const sanitizedAcpxSpawnInputBrand: unique symbol;
|
|
3
|
+
/**
|
|
4
|
+
* Opaque child-process input produced only after the host environment crosses
|
|
5
|
+
* the ACPX credential allowlist. Future ACPX launchers accept this boundary
|
|
6
|
+
* object rather than an arbitrary `process.env`-shaped value.
|
|
7
|
+
*/
|
|
8
|
+
export interface SanitizedAcpxSpawnInput {
|
|
9
|
+
readonly env: Readonly<NodeJS.ProcessEnv>;
|
|
10
|
+
readonly [sanitizedAcpxSpawnInputBrand]: true;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Build the only host-environment input that may cross an ACPX child-process
|
|
14
|
+
* launch boundary. Agent-specific homes are added by the later runtime sandbox;
|
|
15
|
+
* Paperclip transport and native MCP credentials are never inherited from the
|
|
16
|
+
* host process.
|
|
17
|
+
*/
|
|
18
|
+
export declare function createSanitizedAcpxSpawnInput(environment: NodeJS.ProcessEnv | undefined, agent: QualifiedAcpxAgent): SanitizedAcpxSpawnInput;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=environment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../../src/drivers/acpx/environment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAElE,OAAO,CAAC,MAAM,4BAA4B,EAAE,OAAO,MAAM,CAAC;AAE1D;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAC1C,QAAQ,CAAC,CAAC,4BAA4B,CAAC,EAAE,IAAI,CAAC;CAC/C;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAC3C,WAAW,EAAE,MAAM,CAAC,UAAU,GAAG,SAAS,EAC1C,KAAK,EAAE,kBAAkB,GACxB,uBAAuB,CAqDzB"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build the only host-environment input that may cross an ACPX child-process
|
|
3
|
+
* launch boundary. Agent-specific homes are added by the later runtime sandbox;
|
|
4
|
+
* Paperclip transport and native MCP credentials are never inherited from the
|
|
5
|
+
* host process.
|
|
6
|
+
*/
|
|
7
|
+
export function createSanitizedAcpxSpawnInput(environment, agent) {
|
|
8
|
+
const source = environment ?? process.env;
|
|
9
|
+
const result = {};
|
|
10
|
+
const credentialNames = agent === "pi"
|
|
11
|
+
? ["OPENROUTER_API_KEY"]
|
|
12
|
+
: agent === "claude"
|
|
13
|
+
? ["ANTHROPIC_API_KEY", "CLAUDE_CODE_OAUTH_TOKEN"]
|
|
14
|
+
: [
|
|
15
|
+
"OPENAI_API_KEY",
|
|
16
|
+
"CODEX_API_KEY",
|
|
17
|
+
];
|
|
18
|
+
const allowed = new Set([
|
|
19
|
+
"PATH",
|
|
20
|
+
"LANG",
|
|
21
|
+
"LANGUAGE",
|
|
22
|
+
"TZ",
|
|
23
|
+
"TMPDIR",
|
|
24
|
+
"TEMP",
|
|
25
|
+
"TMP",
|
|
26
|
+
"SSL_CERT_FILE",
|
|
27
|
+
"SSL_CERT_DIR",
|
|
28
|
+
"NODE_EXTRA_CA_CERTS",
|
|
29
|
+
"HTTP_PROXY",
|
|
30
|
+
"HTTPS_PROXY",
|
|
31
|
+
"NO_PROXY",
|
|
32
|
+
"ALL_PROXY",
|
|
33
|
+
"http_proxy",
|
|
34
|
+
"https_proxy",
|
|
35
|
+
"no_proxy",
|
|
36
|
+
"all_proxy",
|
|
37
|
+
"RUST_BACKTRACE",
|
|
38
|
+
"PAPERCLIP_NATIVE_MCP_NAME",
|
|
39
|
+
"PAPERCLIP_NATIVE_MCP_URL",
|
|
40
|
+
...credentialNames,
|
|
41
|
+
]);
|
|
42
|
+
let retainedBytes = 0;
|
|
43
|
+
for (const [key, value] of Object.entries(source)) {
|
|
44
|
+
if (typeof value !== "string")
|
|
45
|
+
continue;
|
|
46
|
+
if (!allowed.has(key) && !/^LC_[A-Z0-9_]{1,32}$/.test(key))
|
|
47
|
+
continue;
|
|
48
|
+
if (key.includes("\0") || value.includes("\0")) {
|
|
49
|
+
throw new Error("ACPX environment contains a null byte");
|
|
50
|
+
}
|
|
51
|
+
const entryBytes = Buffer.byteLength(key) + Buffer.byteLength(value);
|
|
52
|
+
if (entryBytes > 64 * 1024 || retainedBytes + entryBytes > 256 * 1024) {
|
|
53
|
+
throw new Error("ACPX environment exceeds its bounded launch size");
|
|
54
|
+
}
|
|
55
|
+
retainedBytes += entryBytes;
|
|
56
|
+
result[key] = value;
|
|
57
|
+
}
|
|
58
|
+
return Object.freeze({
|
|
59
|
+
env: Object.freeze(result),
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=environment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment.js","sourceRoot":"","sources":["../../../src/drivers/acpx/environment.ts"],"names":[],"mappings":"AAcA;;;;;GAKG;AACH,MAAM,UAAU,6BAA6B,CAC3C,WAA0C,EAC1C,KAAyB;IAEzB,MAAM,MAAM,GAAG,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC;IAC1C,MAAM,MAAM,GAAsB,EAAE,CAAC;IACrC,MAAM,eAAe,GACnB,KAAK,KAAK,IAAI;QACZ,CAAC,CAAC,CAAC,oBAAoB,CAAC;QACxB,CAAC,CAAC,KAAK,KAAK,QAAQ;YAClB,CAAC,CAAC,CAAC,mBAAmB,EAAE,yBAAyB,CAAC;YAClD,CAAC,CAAC;gBACE,gBAAgB;gBAChB,eAAe;aAChB,CAAC;IACV,MAAM,OAAO,GAA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C3B,CAA4B,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { QualifiedAcpxProfile } from "./qualified-profiles.js";
|
|
2
|
+
export interface AcpxModelStatus {
|
|
3
|
+
models?: {
|
|
4
|
+
currentModelId?: string;
|
|
5
|
+
availableModelIds?: readonly string[];
|
|
6
|
+
};
|
|
7
|
+
[key: string]: unknown;
|
|
8
|
+
}
|
|
9
|
+
export interface AcpxModelControl {
|
|
10
|
+
getStatus?: () => Promise<AcpxModelStatus>;
|
|
11
|
+
setModel?: (model: string) => Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Select and verify the exact qualified model before a billable prompt can be
|
|
15
|
+
* accepted. A provider selector is normalized only after ACP reports it.
|
|
16
|
+
*/
|
|
17
|
+
export declare function requireVerifiedAcpxModel(control: AcpxModelControl, profile: QualifiedAcpxProfile): Promise<AcpxModelStatus>;
|
|
18
|
+
//# sourceMappingURL=model-verification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-verification.d.ts","sourceRoot":"","sources":["../../../src/drivers/acpx/model-verification.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAEpE,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE;QACP,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;KACvC,CAAC;IACF,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,CAAC,EAAE,MAAM,OAAO,CAAC,eAAe,CAAC,CAAC;IAC3C,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7C;AAED;;;GAGG;AACH,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,gBAAgB,EACzB,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,eAAe,CAAC,CAwB1B"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Select and verify the exact qualified model before a billable prompt can be
|
|
3
|
+
* accepted. A provider selector is normalized only after ACP reports it.
|
|
4
|
+
*/
|
|
5
|
+
export async function requireVerifiedAcpxModel(control, profile) {
|
|
6
|
+
if (!control.getStatus) {
|
|
7
|
+
throw new Error("ACPX agent cannot verify its effective model");
|
|
8
|
+
}
|
|
9
|
+
const requestedModel = profile.qualificationModel;
|
|
10
|
+
let status = await control.getStatus();
|
|
11
|
+
const mustSelectCanonical = profile.reportedModelId !== requestedModel ||
|
|
12
|
+
status.models?.currentModelId !== requestedModel;
|
|
13
|
+
if (mustSelectCanonical) {
|
|
14
|
+
if (!control.setModel) {
|
|
15
|
+
throw new Error("ACPX agent cannot verify its canonical model through ACP config options");
|
|
16
|
+
}
|
|
17
|
+
await control.setModel(requestedModel);
|
|
18
|
+
status = await control.getStatus();
|
|
19
|
+
}
|
|
20
|
+
if (status.models?.currentModelId !== profile.reportedModelId) {
|
|
21
|
+
throw new Error(`ACPX effective model mismatch: requested ${requestedModel}, expected ACP selector ${profile.reportedModelId}, received ${status.models?.currentModelId ?? "unverified"}`);
|
|
22
|
+
}
|
|
23
|
+
return normalizeQualifiedModelStatus(status, profile);
|
|
24
|
+
}
|
|
25
|
+
function normalizeQualifiedModelStatus(status, profile) {
|
|
26
|
+
const available = status.models?.availableModelIds ?? [];
|
|
27
|
+
const normalizedAvailable = Array.from(new Set(available.map((modelId) => modelId === profile.reportedModelId
|
|
28
|
+
? profile.qualificationModel
|
|
29
|
+
: modelId)));
|
|
30
|
+
if (!normalizedAvailable.includes(profile.qualificationModel)) {
|
|
31
|
+
normalizedAvailable.push(profile.qualificationModel);
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
...status,
|
|
35
|
+
models: {
|
|
36
|
+
...status.models,
|
|
37
|
+
currentModelId: profile.qualificationModel,
|
|
38
|
+
availableModelIds: normalizedAvailable,
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=model-verification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-verification.js","sourceRoot":"","sources":["../../../src/drivers/acpx/model-verification.ts"],"names":[],"mappings":"AAeA;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,OAAyB,EACzB,OAA6B;IAE7B,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAClE,CAAC;IACD,MAAM,cAAc,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAClD,IAAI,MAAM,GAAG,MAAM,OAAO,CAAC,SAAS,EAAE,CAAC;IACvC,MAAM,mBAAmB,GACvB,OAAO,CAAC,eAAe,KAAK,cAAc;QAC1C,MAAM,CAAC,MAAM,EAAE,cAAc,KAAK,cAAc,CAAC;IACnD,IAAI,mBAAmB,EAAE,CAAC;QACxB,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CACb,yEAAyE,CAC1E,CAAC;QACJ,CAAC;QACD,MAAM,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;QACvC,MAAM,GAAG,MAAM,OAAO,CAAC,SAAS,EAAE,CAAC;IACrC,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,EAAE,cAAc,KAAK,OAAO,CAAC,eAAe,EAAE,CAAC;QAC9D,MAAM,IAAI,KAAK,CACb,4CAA4C,cAAc,2BAA2B,OAAO,CAAC,eAAe,cAAc,MAAM,CAAC,MAAM,EAAE,cAAc,IAAI,YAAY,EAAE,CAC1K,CAAC;IACJ,CAAC;IACD,OAAO,6BAA6B,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACxD,CAAC;AAED,SAAS,6BAA6B,CACpC,MAAuB,EACvB,OAA6B;IAE7B,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,iBAAiB,IAAI,EAAE,CAAC;IACzD,MAAM,mBAAmB,GAAG,KAAK,CAAC,IAAI,CACpC,IAAI,GAAG,CACL,SAAS,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CACxB,OAAO,KAAK,OAAO,CAAC,eAAe;QACjC,CAAC,CAAC,OAAO,CAAC,kBAAkB;QAC5B,CAAC,CAAC,OAAO,CACZ,CACF,CACF,CAAC;IACF,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE,CAAC;QAC9D,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACvD,CAAC;IACD,OAAO;QACL,GAAG,MAAM;QACT,MAAM,EAAE;YACN,GAAG,MAAM,CAAC,MAAM;YAChB,cAAc,EAAE,OAAO,CAAC,kBAAkB;YAC1C,iBAAiB,EAAE,mBAAmB;SACvC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { NativeAcpxPermissionMode } from "../../contracts/native-execution.js";
|
|
2
|
+
import type { QualifiedAcpxAgent } from "./qualified-profiles.js";
|
|
3
|
+
export interface AcpxPermissionRequestLike {
|
|
4
|
+
inferredKind?: unknown;
|
|
5
|
+
raw?: unknown;
|
|
6
|
+
}
|
|
7
|
+
export type AcpxPermissionDisposition = "allow_once" | "reject_once" | "delegate";
|
|
8
|
+
export interface AcpxPermissionPolicyOptions {
|
|
9
|
+
/** Descriptive configuration only; never proof that a request is authorized. */
|
|
10
|
+
runnerOwnedMcpServerNames?: ReadonlySet<string>;
|
|
11
|
+
/** Descriptive configuration only; never proof that a request is authorized. */
|
|
12
|
+
allConfiguredMcpServersAreRunnerOwned?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface AcpxRuntimePermissionPolicy {
|
|
15
|
+
autoApprove?: readonly string[];
|
|
16
|
+
escalate?: readonly string[];
|
|
17
|
+
defaultAction: "approve" | "deny" | "escalate";
|
|
18
|
+
}
|
|
19
|
+
export declare function acpxRuntimePermissionPolicy(mode: NativeAcpxPermissionMode): AcpxRuntimePermissionPolicy;
|
|
20
|
+
/**
|
|
21
|
+
* Decide the local part of an ACP permission request. `delegate` means the
|
|
22
|
+
* caller must ask the coordinator and fail closed when no delegate exists.
|
|
23
|
+
*/
|
|
24
|
+
export declare function decideAcpxPermission(_agent: QualifiedAcpxAgent, mode: NativeAcpxPermissionMode, _request: AcpxPermissionRequestLike, _options?: AcpxPermissionPolicyOptions): AcpxPermissionDisposition;
|
|
25
|
+
//# sourceMappingURL=permission-policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permission-policy.d.ts","sourceRoot":"","sources":["../../../src/drivers/acpx/permission-policy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AACpF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAElE,MAAM,WAAW,yBAAyB;IACxC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,MAAM,MAAM,yBAAyB,GACnC,YAAY,GAAG,aAAa,GAAG,UAAU,CAAC;AAE5C,MAAM,WAAW,2BAA2B;IAC1C,gFAAgF;IAChF,yBAAyB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAChD,gFAAgF;IAChF,qCAAqC,CAAC,EAAE,OAAO,CAAC;CACjD;AAED,MAAM,WAAW,2BAA2B;IAC1C,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7B,aAAa,EAAE,SAAS,GAAG,MAAM,GAAG,UAAU,CAAC;CAChD;AAED,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,wBAAwB,GAC7B,2BAA2B,CAQ7B;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,kBAAkB,EAC1B,IAAI,EAAE,wBAAwB,EAC9B,QAAQ,EAAE,yBAAyB,EACnC,QAAQ,GAAE,2BAAgC,GACzC,yBAAyB,CAQ3B"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export function acpxRuntimePermissionPolicy(mode) {
|
|
2
|
+
if (mode === "approve-all")
|
|
3
|
+
return { defaultAction: "approve" };
|
|
4
|
+
if (mode === "deny-all")
|
|
5
|
+
return { defaultAction: "deny" };
|
|
6
|
+
// ACPX derives permission kinds from provider-originated requests. Until the
|
|
7
|
+
// host can bind a request to independent authority, no kind is safe to
|
|
8
|
+
// auto-approve. Escalation delegates to the coordinator and otherwise fails
|
|
9
|
+
// closed through the non-interactive permission policy.
|
|
10
|
+
return { defaultAction: "escalate" };
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Decide the local part of an ACP permission request. `delegate` means the
|
|
14
|
+
* caller must ask the coordinator and fail closed when no delegate exists.
|
|
15
|
+
*/
|
|
16
|
+
export function decideAcpxPermission(_agent, mode, _request, _options = {}) {
|
|
17
|
+
if (mode === "deny-all")
|
|
18
|
+
return "reject_once";
|
|
19
|
+
if (mode === "approve-all")
|
|
20
|
+
return "allow_once";
|
|
21
|
+
// inferredKind and raw semantic/MCP metadata both originate outside the
|
|
22
|
+
// runner trust boundary. Neither can grant local read or semantic authority.
|
|
23
|
+
// A future verified decision must carry runner-issued call identity bound to
|
|
24
|
+
// the run-scoped catalog; absent that proof, the coordinator decides.
|
|
25
|
+
return "delegate";
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=permission-policy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permission-policy.js","sourceRoot":"","sources":["../../../src/drivers/acpx/permission-policy.ts"],"names":[],"mappings":"AAwBA,MAAM,UAAU,2BAA2B,CACzC,IAA8B;IAE9B,IAAI,IAAI,KAAK,aAAa;QAAE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,CAAC;IAChE,IAAI,IAAI,KAAK,UAAU;QAAE,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,CAAC;IAC1D,6EAA6E;IAC7E,uEAAuE;IACvE,4EAA4E;IAC5E,wDAAwD;IACxD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC;AACvC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAClC,MAA0B,EAC1B,IAA8B,EAC9B,QAAmC,EACnC,QAAQ,GAAgC,EAAE;IAE1C,IAAI,IAAI,KAAK,UAAU;QAAE,OAAO,aAAa,CAAC;IAC9C,IAAI,IAAI,KAAK,aAAa;QAAE,OAAO,YAAY,CAAC;IAChD,wEAAwE;IACxE,6EAA6E;IAC7E,6EAA6E;IAC7E,sEAAsE;IACtE,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export declare const QUALIFIED_ACPX_VERSION: "0.13.1";
|
|
2
|
+
export declare const ACPX_DRIVER_KIND: "acpx_runtime";
|
|
3
|
+
export declare const ACPX_DRIVER_PROTOCOL_VERSION: 1;
|
|
4
|
+
import type { NativeAcpxAgent } from "../../contracts/native-execution.js";
|
|
5
|
+
export type QualifiedAcpxAgent = NativeAcpxAgent;
|
|
6
|
+
export interface QualifiedAcpxProfile {
|
|
7
|
+
readonly driverKind: typeof ACPX_DRIVER_KIND;
|
|
8
|
+
readonly protocolVersion: typeof ACPX_DRIVER_PROTOCOL_VERSION;
|
|
9
|
+
readonly acpxVersion: typeof QUALIFIED_ACPX_VERSION;
|
|
10
|
+
readonly agent: QualifiedAcpxAgent;
|
|
11
|
+
readonly agentProfileVersion: 1;
|
|
12
|
+
readonly agentServerPackage: string;
|
|
13
|
+
readonly agentServerVersion: string;
|
|
14
|
+
readonly agentRuntimePackage: string | null;
|
|
15
|
+
readonly agentRuntimeVersion: string | null;
|
|
16
|
+
readonly commandDigest: string;
|
|
17
|
+
readonly qualificationModel: string;
|
|
18
|
+
/**
|
|
19
|
+
* Model identifier the pinned ACP server reports after accepting the exact
|
|
20
|
+
* qualification model. Most agents echo the requested model. Claude's ACP
|
|
21
|
+
* server deliberately exposes its stable SDK selector (`sonnet`) while the
|
|
22
|
+
* SDK resolves that selector to the canonical wire model
|
|
23
|
+
* (`claude-sonnet-5`). Paperclip verifies the exact request was accepted
|
|
24
|
+
* before treating this identifier as the qualified effective model.
|
|
25
|
+
*/
|
|
26
|
+
readonly reportedModelId: string;
|
|
27
|
+
readonly permissionPolicy: "interactive";
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Digests bind the closed profile declaration (package, version, runtime and
|
|
31
|
+
* model), not a caller-controlled executable. The environment probe separately
|
|
32
|
+
* verifies the resolved package files before a billable prompt is admitted.
|
|
33
|
+
*/
|
|
34
|
+
export declare const QUALIFIED_ACPX_PROFILES: Readonly<Record<QualifiedAcpxAgent, QualifiedAcpxProfile>>;
|
|
35
|
+
export declare function resolveQualifiedAcpxProfile(agent: QualifiedAcpxAgent, requestedModel: string): QualifiedAcpxProfile;
|
|
36
|
+
//# sourceMappingURL=qualified-profiles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qualified-profiles.d.ts","sourceRoot":"","sources":["../../../src/drivers/acpx/qualified-profiles.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,EAAG,QAAiB,CAAC;AACxD,eAAO,MAAM,gBAAgB,EAAG,cAAuB,CAAC;AACxD,eAAO,MAAM,4BAA4B,EAAG,CAAU,CAAC;AAEvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAE3E,MAAM,MAAM,kBAAkB,GAAG,eAAe,CAAC;AAEjD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,UAAU,EAAE,OAAO,gBAAgB,CAAC;IAC7C,QAAQ,CAAC,eAAe,EAAE,OAAO,4BAA4B,CAAC;IAC9D,QAAQ,CAAC,WAAW,EAAE,OAAO,sBAAsB,CAAC;IACpD,QAAQ,CAAC,KAAK,EAAE,kBAAkB,CAAC;IACnC,QAAQ,CAAC,mBAAmB,EAAE,CAAC,CAAC;IAChC,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5C,QAAQ,CAAC,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5C,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC;;;;;;;OAOG;IACH,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,gBAAgB,EAAE,aAAa,CAAC;CAC1C;AAED;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAC5C,MAAM,CAAC,kBAAkB,EAAE,oBAAoB,CAAC,CAkDhD,CAAC;AAEH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,kBAAkB,EACzB,cAAc,EAAE,MAAM,GACrB,oBAAoB,CAQtB"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export const QUALIFIED_ACPX_VERSION = "0.13.1";
|
|
2
|
+
export const ACPX_DRIVER_KIND = "acpx_runtime";
|
|
3
|
+
export const ACPX_DRIVER_PROTOCOL_VERSION = 1;
|
|
4
|
+
/**
|
|
5
|
+
* Digests bind the closed profile declaration (package, version, runtime and
|
|
6
|
+
* model), not a caller-controlled executable. The environment probe separately
|
|
7
|
+
* verifies the resolved package files before a billable prompt is admitted.
|
|
8
|
+
*/
|
|
9
|
+
export const QUALIFIED_ACPX_PROFILES = deepFreeze({
|
|
10
|
+
pi: {
|
|
11
|
+
driverKind: ACPX_DRIVER_KIND,
|
|
12
|
+
protocolVersion: ACPX_DRIVER_PROTOCOL_VERSION,
|
|
13
|
+
acpxVersion: QUALIFIED_ACPX_VERSION,
|
|
14
|
+
agent: "pi",
|
|
15
|
+
agentProfileVersion: 1,
|
|
16
|
+
agentServerPackage: "pi-acp",
|
|
17
|
+
agentServerVersion: "0.0.33",
|
|
18
|
+
agentRuntimePackage: "@earendil-works/pi-coding-agent",
|
|
19
|
+
agentRuntimeVersion: "0.84.2",
|
|
20
|
+
commandDigest: "sha256:8c696f38296d53d0061fa11534570c5ddd951b63532aed30e0f1fcc676dc169f",
|
|
21
|
+
qualificationModel: "openrouter/deepseek/deepseek-v4-flash-0731",
|
|
22
|
+
reportedModelId: "openrouter/deepseek/deepseek-v4-flash-0731",
|
|
23
|
+
permissionPolicy: "interactive",
|
|
24
|
+
},
|
|
25
|
+
claude: {
|
|
26
|
+
driverKind: ACPX_DRIVER_KIND,
|
|
27
|
+
protocolVersion: ACPX_DRIVER_PROTOCOL_VERSION,
|
|
28
|
+
acpxVersion: QUALIFIED_ACPX_VERSION,
|
|
29
|
+
agent: "claude",
|
|
30
|
+
agentProfileVersion: 1,
|
|
31
|
+
agentServerPackage: "@agentclientprotocol/claude-agent-acp",
|
|
32
|
+
agentServerVersion: "0.70.0",
|
|
33
|
+
agentRuntimePackage: null,
|
|
34
|
+
agentRuntimeVersion: null,
|
|
35
|
+
commandDigest: "sha256:9d73d1f0f121fb96cc8badb28c22d5bff02d8582eb2e40360a81c189e1b9422a",
|
|
36
|
+
qualificationModel: "claude-sonnet-5",
|
|
37
|
+
reportedModelId: "sonnet",
|
|
38
|
+
permissionPolicy: "interactive",
|
|
39
|
+
},
|
|
40
|
+
codex: {
|
|
41
|
+
driverKind: ACPX_DRIVER_KIND,
|
|
42
|
+
protocolVersion: ACPX_DRIVER_PROTOCOL_VERSION,
|
|
43
|
+
acpxVersion: QUALIFIED_ACPX_VERSION,
|
|
44
|
+
agent: "codex",
|
|
45
|
+
agentProfileVersion: 1,
|
|
46
|
+
agentServerPackage: "@agentclientprotocol/codex-acp",
|
|
47
|
+
agentServerVersion: "1.6.2",
|
|
48
|
+
agentRuntimePackage: null,
|
|
49
|
+
agentRuntimeVersion: null,
|
|
50
|
+
commandDigest: "sha256:94049b3e3c3aee87de62703786e4fa81d031d7bd979f99bdf516d84f28791a79",
|
|
51
|
+
qualificationModel: "gpt-5.6-sol",
|
|
52
|
+
reportedModelId: "gpt-5.6-sol",
|
|
53
|
+
permissionPolicy: "interactive",
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
export function resolveQualifiedAcpxProfile(agent, requestedModel) {
|
|
57
|
+
const profile = QUALIFIED_ACPX_PROFILES[agent];
|
|
58
|
+
if (requestedModel !== profile.qualificationModel) {
|
|
59
|
+
throw new Error(`ACPX ${agent} profile requires exact model ${profile.qualificationModel}; received ${requestedModel}`);
|
|
60
|
+
}
|
|
61
|
+
return structuredClone(profile);
|
|
62
|
+
}
|
|
63
|
+
function deepFreeze(value) {
|
|
64
|
+
if (typeof value !== "object" || value === null || Object.isFrozen(value))
|
|
65
|
+
return value;
|
|
66
|
+
Object.freeze(value);
|
|
67
|
+
for (const child of Object.values(value))
|
|
68
|
+
deepFreeze(child);
|
|
69
|
+
return value;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=qualified-profiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qualified-profiles.js","sourceRoot":"","sources":["../../../src/drivers/acpx/qualified-profiles.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG,QAAiB,CAAC;AACxD,MAAM,CAAC,MAAM,gBAAgB,GAAG,cAAuB,CAAC;AACxD,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAU,CAAC;AA8BvD;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAEhC,UAAU,CAAC;IACb,EAAE,EAAE;QACF,UAAU,EAAE,gBAAgB;QAC5B,eA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BAAkB,EAAE,CAAC;QAClD,MAAM,IAAI,KAAK,CACb,QAAQ,KAAK,iCAAiC,OAAO,CAAC,kBAAkB,cAAc,cAAc,EAAE,CACvG,CAAC;IACJ,CAAC;IACD,OAAO,eAAe,CAAC,OAAO,CAAC,CAAC;AAClC,CAAC;AAED,SAAS,UAAU,CAAI,KAAQ;IAC7B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QACvE,OAAO,KAAK,CAAC;IACf,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACrB,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;QAAE,UAAU,CAAC,KAAK,CAAC,CAAC;IAC5D,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { QualifiedAcpxAgent } from "./qualified-profiles.js";
|
|
2
|
+
import type { NativeRuntimeContextSnapshot } from "../../contracts/runtime-context.js";
|
|
3
|
+
import type { NativeAcpxPermissionMode } from "../../contracts/native-execution.js";
|
|
4
|
+
import { type GeneratedAcpxSidecarCommand, type GeneratedAcpxSidecarEventType } from "./generated-sidecar-contract.js";
|
|
5
|
+
export declare const ACPX_SIDECAR_PROTOCOL_VERSION: 2;
|
|
6
|
+
export declare const ACPX_SIDECAR_MAX_FRAME_BYTES: number;
|
|
7
|
+
export interface AcpxSidecarRequest {
|
|
8
|
+
protocolVersion: typeof ACPX_SIDECAR_PROTOCOL_VERSION;
|
|
9
|
+
id: number;
|
|
10
|
+
command: GeneratedAcpxSidecarCommand;
|
|
11
|
+
params: Record<string, unknown>;
|
|
12
|
+
}
|
|
13
|
+
export interface AcpxSidecarResponse {
|
|
14
|
+
protocolVersion: typeof ACPX_SIDECAR_PROTOCOL_VERSION;
|
|
15
|
+
id: number;
|
|
16
|
+
ok: boolean;
|
|
17
|
+
result?: Record<string, unknown>;
|
|
18
|
+
error?: {
|
|
19
|
+
code: string;
|
|
20
|
+
message: string;
|
|
21
|
+
retryable: boolean;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export interface AcpxSidecarEvent {
|
|
25
|
+
protocolVersion: typeof ACPX_SIDECAR_PROTOCOL_VERSION;
|
|
26
|
+
sequence: number;
|
|
27
|
+
eventType: GeneratedAcpxSidecarEventType;
|
|
28
|
+
runId: string | null;
|
|
29
|
+
turnId: string | null;
|
|
30
|
+
payload: Record<string, unknown>;
|
|
31
|
+
}
|
|
32
|
+
export interface AcpxSidecarOpenParams {
|
|
33
|
+
runtimeDirectory: string;
|
|
34
|
+
normalizedSessionId: string;
|
|
35
|
+
workingDirectory: string;
|
|
36
|
+
agent: QualifiedAcpxAgent;
|
|
37
|
+
model: string;
|
|
38
|
+
permissionMode: NativeAcpxPermissionMode;
|
|
39
|
+
permissionModePinned: boolean;
|
|
40
|
+
systemInstructions: string;
|
|
41
|
+
runtimeContext: NativeRuntimeContextSnapshot | null;
|
|
42
|
+
tools: readonly Readonly<Record<string, unknown>>[];
|
|
43
|
+
providerSessionKey?: string;
|
|
44
|
+
expectedIdentity?: AcpxExpectedSessionIdentity;
|
|
45
|
+
}
|
|
46
|
+
export interface AcpxExpectedSessionIdentity {
|
|
47
|
+
kind: "acpx";
|
|
48
|
+
normalizedSessionId: string;
|
|
49
|
+
acpxRecordId: string;
|
|
50
|
+
backendSessionId: string;
|
|
51
|
+
agentSessionId: string;
|
|
52
|
+
profileDigest: string;
|
|
53
|
+
workspaceDigest: string;
|
|
54
|
+
requestedModel: string;
|
|
55
|
+
effectiveModel: string;
|
|
56
|
+
permissionMode?: NativeAcpxPermissionMode;
|
|
57
|
+
}
|
|
58
|
+
export declare function parseAcpxSidecarRequest(value: unknown): AcpxSidecarRequest;
|
|
59
|
+
export declare function boundedSidecarValue(value: unknown, maxBytes?: number): Record<string, unknown>;
|
|
60
|
+
export declare function sanitizeAcpxPlanEntries(value: unknown): Array<{
|
|
61
|
+
content: string;
|
|
62
|
+
status: "pending" | "in_progress" | "completed";
|
|
63
|
+
priority: string | null;
|
|
64
|
+
}>;
|
|
65
|
+
export declare function record(value: unknown): Record<string, unknown>;
|
|
66
|
+
export declare function text(value: unknown, fallback?: string): string;
|
|
67
|
+
//# sourceMappingURL=sidecar-protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sidecar-protocol.d.ts","sourceRoot":"","sources":["../../../src/drivers/acpx/sidecar-protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AACvF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AACpF,OAAO,EAGL,KAAK,2BAA2B,EAChC,KAAK,6BAA6B,EACnC,MAAM,iCAAiC,CAAC;AAEzC,eAAO,MAAM,6BAA6B,GACD,CAAC;AAC1C,eAAO,MAAM,4BAA4B,QAAc,CAAC;AAExD,MAAM,WAAW,kBAAkB;IACjC,eAAe,EAAE,OAAO,6BAA6B,CAAC;IACtD,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,2BAA2B,CAAC;IACrC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED,MAAM,WAAW,mBAAmB;IAClC,eAAe,EAAE,OAAO,6BAA6B,CAAC;IACtD,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,OAAO,CAAA;KAAE,CAAC;CAC/D;AAED,MAAM,WAAW,gBAAgB;IAC/B,eAAe,EAA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MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAkBzB;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,CAAC;IAC7D,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,SAAS,GAAG,aAAa,GAAG,WAAW,CAAC;IAChD,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB,CAAC,CAqBD;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAI9D;AAED,wBAAgB,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,SAAK,GAAG,MAAM,CAE1D"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { GENERATED_ACPX_SIDECAR_COMMANDS, GENERATED_ACPX_SIDECAR_PROTOCOL_VERSION, } from "./generated-sidecar-contract.js";
|
|
2
|
+
export const ACPX_SIDECAR_PROTOCOL_VERSION = GENERATED_ACPX_SIDECAR_PROTOCOL_VERSION;
|
|
3
|
+
export const ACPX_SIDECAR_MAX_FRAME_BYTES = 1024 * 1024;
|
|
4
|
+
export function parseAcpxSidecarRequest(value) {
|
|
5
|
+
let serialized;
|
|
6
|
+
try {
|
|
7
|
+
serialized = JSON.stringify(value);
|
|
8
|
+
}
|
|
9
|
+
catch {
|
|
10
|
+
throw new Error("ACPX sidecar request is not JSON serializable");
|
|
11
|
+
}
|
|
12
|
+
if (!serialized ||
|
|
13
|
+
Buffer.byteLength(serialized) > ACPX_SIDECAR_MAX_FRAME_BYTES) {
|
|
14
|
+
throw new Error("ACPX sidecar request exceeds the frame limit");
|
|
15
|
+
}
|
|
16
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
17
|
+
throw new Error("ACPX sidecar request must be an object");
|
|
18
|
+
}
|
|
19
|
+
const request = value;
|
|
20
|
+
if (Object.keys(request).some((key) => !["protocolVersion", "id", "command", "params"].includes(key))) {
|
|
21
|
+
throw new Error("ACPX sidecar request contains an unknown field");
|
|
22
|
+
}
|
|
23
|
+
if (request.protocolVersion !== ACPX_SIDECAR_PROTOCOL_VERSION) {
|
|
24
|
+
throw new Error("unsupported ACPX sidecar protocol version");
|
|
25
|
+
}
|
|
26
|
+
if (!Number.isSafeInteger(request.id) || Number(request.id) < 1)
|
|
27
|
+
throw new Error("sidecar request id must be a positive integer");
|
|
28
|
+
const command = text(request.command);
|
|
29
|
+
if (!GENERATED_ACPX_SIDECAR_COMMANDS.includes(command))
|
|
30
|
+
throw new Error("unsupported ACPX sidecar command");
|
|
31
|
+
if (typeof request.params !== "object" ||
|
|
32
|
+
request.params === null ||
|
|
33
|
+
Array.isArray(request.params)) {
|
|
34
|
+
throw new Error("ACPX sidecar request params must be an object");
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
protocolVersion: ACPX_SIDECAR_PROTOCOL_VERSION,
|
|
38
|
+
id: Number(request.id),
|
|
39
|
+
command: command,
|
|
40
|
+
params: structuredClone(request.params),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export function boundedSidecarValue(value, maxBytes = 64 * 1024) {
|
|
44
|
+
if (!Number.isSafeInteger(maxBytes) || maxBytes < 1) {
|
|
45
|
+
throw new Error("ACPX sidecar value limit must be a positive integer");
|
|
46
|
+
}
|
|
47
|
+
try {
|
|
48
|
+
const serialized = JSON.stringify(value);
|
|
49
|
+
if (!serialized || Buffer.byteLength(serialized) > maxBytes) {
|
|
50
|
+
return { omitted: true, reason: "payload_limit" };
|
|
51
|
+
}
|
|
52
|
+
const parsed = JSON.parse(serialized);
|
|
53
|
+
return typeof parsed === "object" &&
|
|
54
|
+
parsed !== null &&
|
|
55
|
+
!Array.isArray(parsed)
|
|
56
|
+
? parsed
|
|
57
|
+
: { omitted: true, reason: "object_required" };
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
return { omitted: true, reason: "serialization_failed" };
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
export function sanitizeAcpxPlanEntries(value) {
|
|
64
|
+
if (!Array.isArray(value))
|
|
65
|
+
return [];
|
|
66
|
+
return value.slice(0, 256).flatMap((candidate) => {
|
|
67
|
+
const entry = record(candidate);
|
|
68
|
+
const content = text(entry.content).trim().slice(0, 4_000);
|
|
69
|
+
const status = text(entry.status);
|
|
70
|
+
if (!content ||
|
|
71
|
+
(status !== "pending" &&
|
|
72
|
+
status !== "in_progress" &&
|
|
73
|
+
status !== "completed"))
|
|
74
|
+
return [];
|
|
75
|
+
return [
|
|
76
|
+
{
|
|
77
|
+
content,
|
|
78
|
+
status,
|
|
79
|
+
priority: text(entry.priority).slice(0, 80) || null,
|
|
80
|
+
},
|
|
81
|
+
];
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
export function record(value) {
|
|
85
|
+
return typeof value === "object" && value !== null && !Array.isArray(value)
|
|
86
|
+
? value
|
|
87
|
+
: {};
|
|
88
|
+
}
|
|
89
|
+
export function text(value, fallback = "") {
|
|
90
|
+
return typeof value === "string" ? value : fallback;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=sidecar-protocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sidecar-protocol.js","sourceRoot":"","sources":["../../../src/drivers/acpx/sidecar-protocol.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,+BAA+B,EAC/B,uCAAuC,GAGxC,MAAM,iCAAiC,CAAC;AAEzC,MAAM,CAAC,MAAM,6BAA6B,GACxC,uCAAuC,CAAC;AAC1C,MAAM,CAAC,MAAM,4BAA4B,GAAG,IAAI,GAAG,IAAI,CAAC;AAsDxD,MAAM,UAAU,uBAAuB,CAAC,KAAc;IACpD,IAAI,UAAkB,CAAC;IACvB,IAAI,CAAC;QACH,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;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
"version": "2026.830.0-canary.
|
|
3
|
+
"version": "2026.830.0-canary.15",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"homepage": "https://github.com/paperclipai/paperclip",
|
|
6
6
|
"bugs": {
|
|
@@ -29,22 +29,22 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@aws-sdk/client-s3": "^3.1115.0",
|
|
31
31
|
"@opentelemetry/api": "^1.9.0",
|
|
32
|
-
"@paperclipai/adapter-claude-local": "2026.830.0-canary.
|
|
33
|
-
"@paperclipai/adapter-codex-local": "2026.830.0-canary.
|
|
34
|
-
"@paperclipai/adapter-cursor-cloud": "2026.830.0-canary.
|
|
35
|
-
"@paperclipai/adapter-cursor-local": "2026.830.0-canary.
|
|
36
|
-
"@paperclipai/adapter-gemini-local": "2026.830.0-canary.
|
|
37
|
-
"@paperclipai/adapter-grok-local": "2026.830.0-canary.
|
|
38
|
-
"@paperclipai/adapter-kimi-local": "2026.830.0-canary.
|
|
39
|
-
"@paperclipai/adapter-openclaw-gateway": "2026.830.0-canary.
|
|
40
|
-
"@paperclipai/adapter-opencode-local": "2026.830.0-canary.
|
|
41
|
-
"@paperclipai/adapter-pi-local": "2026.830.0-canary.
|
|
42
|
-
"@paperclipai/adapter-utils": "2026.830.0-canary.
|
|
43
|
-
"@paperclipai/db": "2026.830.0-canary.
|
|
44
|
-
"@paperclipai/hermes-paperclip-adapter": "2026.830.0-canary.
|
|
45
|
-
"@paperclipai/plugin-sdk": "2026.830.0-canary.
|
|
46
|
-
"@paperclipai/shared": "2026.830.0-canary.
|
|
47
|
-
"@paperclipai/skills-catalog": "2026.830.0-canary.
|
|
32
|
+
"@paperclipai/adapter-claude-local": "2026.830.0-canary.15",
|
|
33
|
+
"@paperclipai/adapter-codex-local": "2026.830.0-canary.15",
|
|
34
|
+
"@paperclipai/adapter-cursor-cloud": "2026.830.0-canary.15",
|
|
35
|
+
"@paperclipai/adapter-cursor-local": "2026.830.0-canary.15",
|
|
36
|
+
"@paperclipai/adapter-gemini-local": "2026.830.0-canary.15",
|
|
37
|
+
"@paperclipai/adapter-grok-local": "2026.830.0-canary.15",
|
|
38
|
+
"@paperclipai/adapter-kimi-local": "2026.830.0-canary.15",
|
|
39
|
+
"@paperclipai/adapter-openclaw-gateway": "2026.830.0-canary.15",
|
|
40
|
+
"@paperclipai/adapter-opencode-local": "2026.830.0-canary.15",
|
|
41
|
+
"@paperclipai/adapter-pi-local": "2026.830.0-canary.15",
|
|
42
|
+
"@paperclipai/adapter-utils": "2026.830.0-canary.15",
|
|
43
|
+
"@paperclipai/db": "2026.830.0-canary.15",
|
|
44
|
+
"@paperclipai/hermes-paperclip-adapter": "2026.830.0-canary.15",
|
|
45
|
+
"@paperclipai/plugin-sdk": "2026.830.0-canary.15",
|
|
46
|
+
"@paperclipai/shared": "2026.830.0-canary.15",
|
|
47
|
+
"@paperclipai/skills-catalog": "2026.830.0-canary.15",
|
|
48
48
|
"@vercel/connect": "0.6.1",
|
|
49
49
|
"ajv": "^8.20.0",
|
|
50
50
|
"ajv-formats": "^3.0.1",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"zod": "^4.4.3"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
|
-
"@paperclipai/paperclip-runner": "2026.830.0-canary.
|
|
71
|
+
"@paperclipai/paperclip-runner": "2026.830.0-canary.15",
|
|
72
72
|
"@types/express": "^5.0.0",
|
|
73
73
|
"@types/express-serve-static-core": "^5.1.3",
|
|
74
74
|
"@types/jsdom": "^30.0.0",
|