acp-kernel 0.0.58-pr.212.72 → 0.0.58
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/index.js +20 -114
- package/dist/index.js.map +1 -1
- package/dist/parse-compress-input.d.ts +0 -2
- package/dist/parse-compress-input.d.ts.map +1 -1
- package/dist/recommend.d.ts.map +1 -1
- package/dist/wire/anthropic.d.ts.map +1 -1
- package/dist/wire/index.js +5 -27
- package/dist/wire/index.js.map +1 -1
- package/dist/wire/openai.d.ts.map +1 -1
- package/dist/wire/responses.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -5,8 +5,6 @@ export interface CompressParseDiagnostics {
|
|
|
5
5
|
ok: boolean;
|
|
6
6
|
/** Why the input parsed the way it did. */
|
|
7
7
|
kind: CompressParseKind;
|
|
8
|
-
/** True when the winning parse came from single→double quote repair. */
|
|
9
|
-
quoteSalvage?: boolean;
|
|
10
8
|
/** First 800 chars of the raw string input (string inputs only). */
|
|
11
9
|
rawPrefix?: string;
|
|
12
10
|
/** Raw string input length (string inputs only). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-compress-input.d.ts","sourceRoot":"","sources":["../src/parse-compress-input.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"parse-compress-input.d.ts","sourceRoot":"","sources":["../src/parse-compress-input.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,MAAM,MAAM,iBAAiB,GACvB,IAAI,GACJ,aAAa,GACb,YAAY,GACZ,iBAAiB,GACjB,mBAAmB,GACnB,gBAAgB,GAChB,WAAW,GACX,iBAAiB,CAAC;AAExB,MAAM,WAAW,wBAAwB;IACrC,uDAAuD;IACvD,EAAE,EAAE,OAAO,CAAC;IACZ,2CAA2C;IAC3C,IAAI,EAAE,iBAAiB,CAAC;IACxB,oEAAoE;IACpE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iFAAiF;IACjF,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,0DAA0D;IAC1D,YAAY,EAAE,MAAM,CAAC;IACrB,oEAAoE;IACpE,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,mBAAmB;IAChC,MAAM,EAAE,iBAAiB,EAAE,CAAC;IAC5B,WAAW,EAAE,wBAAwB,CAAC;CACzC;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,mBAAmB,CAmBjG"}
|
package/dist/recommend.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recommend.d.ts","sourceRoot":"","sources":["../src/recommend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EACV,iBAAiB,EACjB,MAAM,EACN,aAAa,EACb,WAAW,EAEZ,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"recommend.d.ts","sourceRoot":"","sources":["../src/recommend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EACV,iBAAiB,EACjB,MAAM,EACN,aAAa,EACb,WAAW,EAEZ,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAoBnD,wBAAgB,aAAa,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAE3D;AAgBD;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,WAAW,EAAE,EACvB,KAAK,EAAE,gBAAgB,EACvB,MAAM,EAAE,MAAM,EACd,WAAW,G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B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,GAAG,kBAAkB,EAAE,CAAC;IACvC,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B,CAAC;AAGF,wBAAgB,aAAa,CAAC,MAAM,EAAE,oBAAoB,CAAC,QAAQ,CAAC,GAAG,MAAM,CAI5E;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,oBAAoB,CAAC,QAAQ,CAAC,GAAG,MAAM,GAAG,kBAAkB,EAAE,CAMjH;AAED,KAAK,IAAI,GAAG;IAAE,IAAI,EAAE,WAAW,EAAE,CAAC;IAAC,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,CAAC;AAEzE,wBAAgB,eAAe,CAAC,IAAI,EAAE,oBAAoB,GAAG,IAAI,CAyEhE;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,WAAW,EAAE,EAAE,aAAa,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,gBAAgB,EAAE,CA0DjH;AAED;;;;yBAIyB;AACzB,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,oBAAoB,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAKpG"}
|
package/dist/wire/index.js
CHANGED
|
@@ -35,7 +35,6 @@ function anthropicToCore(body) {
|
|
|
35
35
|
const msgs = [];
|
|
36
36
|
const cacheControls = /* @__PURE__ */ new Map();
|
|
37
37
|
const clusters = new ClusterCounter();
|
|
38
|
-
const toolNames = /* @__PURE__ */ new Map();
|
|
39
38
|
for (const m of body.messages) {
|
|
40
39
|
const blocks = typeof m.content === "string" ? [{ type: "text", text: m.content }] : m.content;
|
|
41
40
|
for (const b of blocks) {
|
|
@@ -61,7 +60,6 @@ function anthropicToCore(body) {
|
|
|
61
60
|
toolCallId: b.id,
|
|
62
61
|
text: safeStringify(b.input)
|
|
63
62
|
});
|
|
64
|
-
toolNames.set(b.id, b.name);
|
|
65
63
|
if (b.cache_control) cacheControls.set(id, b.cache_control);
|
|
66
64
|
break;
|
|
67
65
|
}
|
|
@@ -69,14 +67,12 @@ function anthropicToCore(body) {
|
|
|
69
67
|
const text = typeof b.content === "string" ? b.content : b.content.map((c) => c.text).join("\n");
|
|
70
68
|
const base = deriveMessageId("tool", "tool-result", text, { toolCallId: b.tool_use_id });
|
|
71
69
|
const id = clusters.next(base);
|
|
72
|
-
const name = toolNames.get(b.tool_use_id);
|
|
73
70
|
msgs.push({
|
|
74
71
|
id,
|
|
75
72
|
role: "tool",
|
|
76
73
|
contentType: "tool-result",
|
|
77
74
|
toolCallId: b.tool_use_id,
|
|
78
75
|
text,
|
|
79
|
-
...name ? { toolName: name } : {},
|
|
80
76
|
...b.is_error === true ? { toolIsError: true } : {}
|
|
81
77
|
});
|
|
82
78
|
if (b.cache_control) cacheControls.set(id, b.cache_control);
|
|
@@ -233,7 +229,6 @@ function openaiToCore(body) {
|
|
|
233
229
|
const msgs = [];
|
|
234
230
|
const systemParts = [];
|
|
235
231
|
const clusters = new ClusterCounter();
|
|
236
|
-
const toolNames = /* @__PURE__ */ new Map();
|
|
237
232
|
for (const m of body.messages) {
|
|
238
233
|
switch (m.role) {
|
|
239
234
|
case "system":
|
|
@@ -301,7 +296,6 @@ function openaiToCore(body) {
|
|
|
301
296
|
toolCallId: tc.id,
|
|
302
297
|
text: tc.function.arguments ?? ""
|
|
303
298
|
});
|
|
304
|
-
toolNames.set(tc.id, tc.function.name);
|
|
305
299
|
}
|
|
306
300
|
}
|
|
307
301
|
break;
|
|
@@ -310,14 +304,12 @@ function openaiToCore(body) {
|
|
|
310
304
|
const base = deriveMessageId("tool", "tool-result", stringContent(m.content), {
|
|
311
305
|
toolCallId: m.tool_call_id ?? ""
|
|
312
306
|
});
|
|
313
|
-
const name = m.name || toolNames.get(m.tool_call_id ?? "");
|
|
314
307
|
msgs.push({
|
|
315
308
|
id: clusters.next(base),
|
|
316
309
|
role: "tool",
|
|
317
310
|
contentType: "tool-result",
|
|
318
311
|
toolCallId: m.tool_call_id ?? "",
|
|
319
|
-
text: stringContent(m.content)
|
|
320
|
-
...name ? { toolName: name } : {}
|
|
312
|
+
text: stringContent(m.content)
|
|
321
313
|
});
|
|
322
314
|
break;
|
|
323
315
|
}
|
|
@@ -422,7 +414,7 @@ function allImageParts(content) {
|
|
|
422
414
|
if (typeof p !== "object" || p === null) continue;
|
|
423
415
|
if (!("type" in p) || p.type !== "image_url" || !("image_url" in p)) continue;
|
|
424
416
|
const imagePart = p;
|
|
425
|
-
const url = imagePart.image_url
|
|
417
|
+
const url = imagePart.image_url.url;
|
|
426
418
|
if (typeof url === "string" && parseDataUrl(url)) out.push(p);
|
|
427
419
|
}
|
|
428
420
|
return out;
|
|
@@ -436,14 +428,6 @@ var OPAQUE_ITEM_TYPES = /* @__PURE__ */ new Set([
|
|
|
436
428
|
function isOpaqueItem(item) {
|
|
437
429
|
return OPAQUE_ITEM_TYPES.has(item.type);
|
|
438
430
|
}
|
|
439
|
-
var EASY_INPUT_ROLES = /* @__PURE__ */ new Set(["user", "assistant", "system", "developer"]);
|
|
440
|
-
function normalizeEasyInputItem(item) {
|
|
441
|
-
if (typeof item.type === "string") return item;
|
|
442
|
-
if (EASY_INPUT_ROLES.has(String(item.role))) {
|
|
443
|
-
return { ...item, type: "message" };
|
|
444
|
-
}
|
|
445
|
-
return item;
|
|
446
|
-
}
|
|
447
431
|
function shouldDropAllReasoning() {
|
|
448
432
|
return (process.env.ACP_REASONING_KEEP ?? "").trim().toLowerCase() === "none";
|
|
449
433
|
}
|
|
@@ -480,7 +464,6 @@ function responsesToCore(body) {
|
|
|
480
464
|
const layout = [];
|
|
481
465
|
let droppedReasoning = 0;
|
|
482
466
|
const clusters = new ClusterCounter();
|
|
483
|
-
const toolNames = /* @__PURE__ */ new Map();
|
|
484
467
|
let idx = 0;
|
|
485
468
|
if (typeof body.instructions === "string" && body.instructions.trim()) systemParts.push(body.instructions);
|
|
486
469
|
if (typeof body.input === "string") {
|
|
@@ -488,8 +471,7 @@ function responsesToCore(body) {
|
|
|
488
471
|
msgs.push({ id, role: "user", contentType: "text", text: body.input });
|
|
489
472
|
return { msgs, systemParts, preamble, customToolCallIds, layout, droppedReasoning, stringInput: { original: body.input, coreId: id } };
|
|
490
473
|
}
|
|
491
|
-
for (const
|
|
492
|
-
const item = normalizeEasyInputItem(raw);
|
|
474
|
+
for (const item of body.input) {
|
|
493
475
|
let coreId;
|
|
494
476
|
if (isOpaqueItem(item)) preamble.push(item);
|
|
495
477
|
switch (item.type) {
|
|
@@ -564,15 +546,13 @@ function responsesToCore(body) {
|
|
|
564
546
|
text: call.arguments ?? "",
|
|
565
547
|
rawResponsesItem: item
|
|
566
548
|
});
|
|
567
|
-
toolNames.set(call.call_id, call.name);
|
|
568
549
|
break;
|
|
569
550
|
}
|
|
570
551
|
case "function_call_output": {
|
|
571
552
|
const output = item;
|
|
572
553
|
const text = typeof output.output === "string" ? output.output : JSON.stringify(output.output);
|
|
573
554
|
coreId = clusters.next(deriveMessageId("tool", "tool-result", text, { toolCallId: output.call_id }));
|
|
574
|
-
|
|
575
|
-
msgs.push({ id: coreId, role: "tool", contentType: "tool-result", toolCallId: output.call_id, text, ...name ? { toolName: name } : {}, rawResponsesItem: item });
|
|
555
|
+
msgs.push({ id: coreId, role: "tool", contentType: "tool-result", toolCallId: output.call_id, text, rawResponsesItem: item });
|
|
576
556
|
break;
|
|
577
557
|
}
|
|
578
558
|
case "computer_call":
|
|
@@ -594,7 +574,6 @@ function responsesToCore(body) {
|
|
|
594
574
|
const argText = ctc.input ?? ctc.arguments ?? "";
|
|
595
575
|
coreId = clusters.next(deriveMessageId("assistant", "tool-call", argText, { toolCallId: callId, toolName: ctc.name ?? "custom" }));
|
|
596
576
|
msgs.push({ id: coreId, role: "assistant", contentType: "tool-call", toolName: ctc.name ?? "custom", toolCallId: callId, text: argText, rawResponsesItem: item });
|
|
597
|
-
toolNames.set(callId, ctc.name ?? "custom");
|
|
598
577
|
break;
|
|
599
578
|
}
|
|
600
579
|
case "custom_tool_call_output": {
|
|
@@ -603,8 +582,7 @@ function responsesToCore(body) {
|
|
|
603
582
|
customToolCallIds.add(callId);
|
|
604
583
|
const outText = typeof ctco.output === "string" ? ctco.output : JSON.stringify(ctco.output ?? "");
|
|
605
584
|
coreId = clusters.next(deriveMessageId("tool", "tool-result", outText, { toolCallId: callId }));
|
|
606
|
-
|
|
607
|
-
msgs.push({ id: coreId, role: "tool", contentType: "tool-result", toolCallId: callId, text: outText, ...name ? { toolName: name } : {}, rawResponsesItem: item });
|
|
585
|
+
msgs.push({ id: coreId, role: "tool", contentType: "tool-result", toolCallId: callId, text: outText, rawResponsesItem: item });
|
|
608
586
|
break;
|
|
609
587
|
}
|
|
610
588
|
default:
|