@1presence/bridge 0.22.0 → 0.23.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 +6 -2
- package/dist/index.js +8 -4
- package/package.json +1 -1
package/dist/claude.js
CHANGED
|
@@ -97,8 +97,12 @@ function spawnClaude(params) {
|
|
|
97
97
|
// - `--no-session-persistence` keeps no jsonl on disk. The bridge has zero
|
|
98
98
|
// local filesystem dependency for continuity; Firestore is the only
|
|
99
99
|
// source of truth.
|
|
100
|
-
// - `--session-id <
|
|
101
|
-
//
|
|
100
|
+
// - `--session-id <uuid>` must be a fresh UUID per spawn: the CLI treats
|
|
101
|
+
// this flag as a "claim a new session ID" operation and rejects the
|
|
102
|
+
// second spawn with "Session ID X is already in use" if we reuse one
|
|
103
|
+
// across turns of a chat — even with --no-session-persistence. The
|
|
104
|
+
// bridge passes the per-spawn `conversationId` here; the presence
|
|
105
|
+
// sessionId is correlated separately via bridge logs and spool records.
|
|
102
106
|
const args = [
|
|
103
107
|
'--print',
|
|
104
108
|
'--input-format', 'stream-json',
|
package/dist/index.js
CHANGED
|
@@ -171,10 +171,14 @@ async function handleMessage(conversationId, text, sessionId, history, auth, vau
|
|
|
171
171
|
const accumulator = (0, accumulator_1.makeBridgeAccumulator)();
|
|
172
172
|
const startedAt = Date.now();
|
|
173
173
|
const turnSessionId = sessionId ?? conversationId; // gateway always supplies one; defensive fallback
|
|
174
|
-
//
|
|
175
|
-
//
|
|
176
|
-
//
|
|
177
|
-
|
|
174
|
+
// The CLI's `--session-id` is treated as a "claim this new session ID"
|
|
175
|
+
// operation — passing the same UUID across turns of one chat (which is
|
|
176
|
+
// what the presence sessionId is) makes turn 2 fail with "Session ID X
|
|
177
|
+
// is already in use", even with --no-session-persistence. Use the
|
|
178
|
+
// per-spawn conversationId instead — continuity comes from history
|
|
179
|
+
// replay via --input-format stream-json, not from CLI session tracking.
|
|
180
|
+
// turnSessionId is still kept for spool records / log correlation.
|
|
181
|
+
const claudePinnedSessionId = isUuid(conversationId) ? conversationId : crypto.randomUUID();
|
|
178
182
|
function buildSpoolRecord(usage, model) {
|
|
179
183
|
const s = accumulator.state();
|
|
180
184
|
return {
|