@1presence/bridge 0.63.0 → 0.65.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/claude.js +26 -4
- package/package.json +1 -1
package/dist/claude.js
CHANGED
|
@@ -663,7 +663,10 @@ export function spawnClaude(params) {
|
|
|
663
663
|
// callable tools and confabulated tool calls as text. See vault/Bugs.md.)
|
|
664
664
|
cwd: BRIDGE_CWD,
|
|
665
665
|
abortController: abort,
|
|
666
|
-
includePartialMessages:
|
|
666
|
+
includePartialMessages: true, // token-level streaming: emit stream_event partial deltas so
|
|
667
|
+
// Local Mode streams like hosted (see the stream_event case below).
|
|
668
|
+
// The whole `assistant` message STILL arrives and stays
|
|
669
|
+
// authoritative for tool_use / usage / storage / the tool-XML scrub.
|
|
667
670
|
permissionMode: 'default',
|
|
668
671
|
env: safeEnv,
|
|
669
672
|
// Surface the SDK/CLI's own stderr. In verbose mode pass everything; in
|
|
@@ -830,9 +833,28 @@ export function spawnClaude(params) {
|
|
|
830
833
|
}
|
|
831
834
|
break;
|
|
832
835
|
}
|
|
833
|
-
//
|
|
834
|
-
//
|
|
835
|
-
//
|
|
836
|
+
// Partial assistant deltas (includePartialMessages:true). Forward ONLY
|
|
837
|
+
// text deltas, as the gateway translator's {type:'text'} partial event,
|
|
838
|
+
// so Local Mode paints token-by-token like hosted. The whole `assistant`
|
|
839
|
+
// message still arrives after and stays authoritative for tool_use, usage,
|
|
840
|
+
// storage and the tool-XML scrub — so partials bypass handleEvent (they
|
|
841
|
+
// carry text only; the whole message is what handleEvent scans). Other
|
|
842
|
+
// partial event kinds (input_json_delta, thinking, message_start/stop) are
|
|
843
|
+
// SDK-internal and dropped. NOTE: partials are forwarded pre-scrub — the
|
|
844
|
+
// confab-tool-XML guard in handleEvent only cleans the whole message
|
|
845
|
+
// (storage). That guard exists for the no-callable-tools case; this bridge
|
|
846
|
+
// has callable tools, so confabulated XML shouldn't occur in a live turn.
|
|
847
|
+
case 'stream_event': {
|
|
848
|
+
const se = m;
|
|
849
|
+
const ev = se.event;
|
|
850
|
+
if (ev?.type === 'content_block_delta' && ev.delta?.type === 'text_delta' && ev.delta.text) {
|
|
851
|
+
onEvent({ type: 'text', text: ev.delta.text });
|
|
852
|
+
}
|
|
853
|
+
break;
|
|
854
|
+
}
|
|
855
|
+
// Everything else (status, hooks, notifications, thinking tokens, …) is
|
|
856
|
+
// SDK-internal — not part of the CLI event contract the gateway/accumulator
|
|
857
|
+
// understand, so it is dropped.
|
|
836
858
|
default:
|
|
837
859
|
break;
|
|
838
860
|
}
|