@pikiloom/kernel 0.3.3 → 0.3.4
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/drivers/claude.js +17 -0
- package/package.json +1 -1
package/dist/drivers/claude.js
CHANGED
|
@@ -540,6 +540,23 @@ export function handleClaudeEvent(ev, s, emit) {
|
|
|
540
540
|
// as the reply nor counts as real output (the no-op-resume recovery keys off that emptiness).
|
|
541
541
|
if (ev.message?.model === '<synthetic>' && isClaudeSyntheticResumeNoise(claudeContentText(ev.message?.content)))
|
|
542
542
|
return;
|
|
543
|
+
// API-error message: Claude surfaces a failed model call (401 auth, overloaded, quota, …) not as a
|
|
544
|
+
// result code but as a synthetic assistant message — model '<synthetic>', a lone text block carrying
|
|
545
|
+
// the human-readable error ("Failed to authenticate. API Error: 401 …"), and a TOP-LEVEL `error` tag
|
|
546
|
+
// on the event (e.g. "authentication_failed"; the persisted transcript also stamps `isApiErrorMessage`).
|
|
547
|
+
// It is NOT model output. Routing its text through the normal path below would make the error render
|
|
548
|
+
// as the assistant's reply body (原文). Send it to `s.error` — the run-end notice, same slot as the
|
|
549
|
+
// `result{is_error}` branch below — and never to `s.text`. The trailing `result` also flags the error
|
|
550
|
+
// (and would set `s.error` too), but claiming it here keeps a narration-less turn from double-rendering
|
|
551
|
+
// (body + notice), and preserves any real narration already streamed before the call failed.
|
|
552
|
+
const apiErrorTag = typeof ev.error === 'string' ? ev.error.trim() : (ev.isApiErrorMessage ? 'api_error' : '');
|
|
553
|
+
if (apiErrorTag) {
|
|
554
|
+
if (!s.error) {
|
|
555
|
+
const msg = claudeContentText(ev.message?.content).trim();
|
|
556
|
+
s.error = msg || `Claude reported an API error (${apiErrorTag})`;
|
|
557
|
+
}
|
|
558
|
+
return;
|
|
559
|
+
}
|
|
543
560
|
const contents = ev.message?.content || [];
|
|
544
561
|
for (const b of contents) {
|
|
545
562
|
if (b?.type !== 'tool_use')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pikiloom/kernel",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "Heterogeneous coding agents (Claude / Codex / Gemini / ACP) -> an interaction-friendly, accumulating session snapshot + control handle, over pluggable surfaces (IM, Web, tunnel, TUI). The reusable core pikiloom itself is built on.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|