@vanillagreen/pi-claude-bridge 4.0.1 → 4.0.2
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/README.md +5 -1
- package/bundle/connector-inventory.js +8 -7
- package/bundle/index.js +254 -74
- package/package.json +3 -2
- package/src/assistant-stream.ts +4 -3
- package/src/billing-identity.ts +116 -0
- package/src/bridge-state.ts +9 -6
- package/src/connector-audit.ts +9 -5
- package/src/connector-inventory.ts +8 -8
- package/src/connectors.ts +1 -0
- package/src/consume-query.ts +17 -2
- package/src/index.ts +210 -42
- package/src/native-provider.ts +3 -1
- package/src/query-state.ts +65 -11
- package/src/query-teardown.ts +16 -0
- package/src/session-persistence.ts +5 -5
- package/src/session-verify.ts +5 -5
- package/src/tool-pairing-audit.ts +2 -1
|
@@ -168,12 +168,12 @@ export function shouldRestorePersistedBridgeEntry(
|
|
|
168
168
|
currentPiSessionId: string | undefined,
|
|
169
169
|
currentCwd: string | undefined,
|
|
170
170
|
): string | undefined {
|
|
171
|
-
if (!persisted.piSessionId) return "missing piSessionId";
|
|
171
|
+
if (!persisted.piSessionId) return "restore-session-missing=piSessionId\nMissing piSessionId.";
|
|
172
172
|
if (currentPiSessionId && persisted.piSessionId !== currentPiSessionId) {
|
|
173
|
-
return `
|
|
173
|
+
return `restore-session-mismatch=${persisted.piSessionId} current=${currentPiSessionId}\nThe persisted session differs from the active session.`;
|
|
174
174
|
}
|
|
175
175
|
if (currentCwd && canonicalize(persisted.cwd) !== canonicalize(currentCwd)) {
|
|
176
|
-
return `cwd
|
|
176
|
+
return `restore-cwd-mismatch=${persisted.cwd} current=${currentCwd}\nThe persisted working directory differs from the active directory.`;
|
|
177
177
|
}
|
|
178
178
|
return undefined;
|
|
179
179
|
}
|
|
@@ -419,7 +419,7 @@ export function planIncrementalPromptBatch(
|
|
|
419
419
|
// throwing — CC may be more tolerant than our checks, so a false positive
|
|
420
420
|
// shouldn't block the user. Pure logic is in session-verify.js; this wrapper
|
|
421
421
|
// fans each warning out to debug log + piUI notify + diagDump.
|
|
422
|
-
function verifyWrittenSession(
|
|
422
|
+
export function verifyWrittenSession(
|
|
423
423
|
jsonlPath: string,
|
|
424
424
|
expectedSessionId: string,
|
|
425
425
|
expectedRecordCount: number,
|
|
@@ -436,7 +436,7 @@ function verifyWrittenSession(
|
|
|
436
436
|
// reason — an absolute cwd carries the username; the diagDump keeps the
|
|
437
437
|
// absolute forms.
|
|
438
438
|
safeNotify(
|
|
439
|
-
|
|
439
|
+
`${msg}\n` +
|
|
440
440
|
`cwd=${displayPath(cwd)} realpath=${displayPath(safeRealpath(cwd))}\n` +
|
|
441
441
|
`Please copy and paste this message into a new issue at https://github.com/vanillagreencom/kendex/issues/new` +
|
|
442
442
|
(DEBUG ? ` and attach ${DEBUG_LOG_PATH}` : ` (rerun with CLAUDE_BRIDGE_DEBUG=1 to capture a debug log)`),
|
package/src/session-verify.ts
CHANGED
|
@@ -57,28 +57,28 @@ export function verifyWrittenSession(jsonlPath: string, expectedSessionId: strin
|
|
|
57
57
|
try {
|
|
58
58
|
st = statSync(jsonlPath);
|
|
59
59
|
} catch (e) {
|
|
60
|
-
warnings.push(`file missing after save
|
|
60
|
+
warnings.push(`session-file-missing=${jsonlPath}\nFile missing after save: ${e.message}`);
|
|
61
61
|
return warnings;
|
|
62
62
|
}
|
|
63
63
|
let summary;
|
|
64
64
|
try {
|
|
65
65
|
summary = summarizeJsonl(jsonlPath);
|
|
66
66
|
} catch (e) {
|
|
67
|
-
warnings.push(`file
|
|
67
|
+
warnings.push(`session-file-unreadable=${jsonlPath}\nFile unreadable: size=${st.size} error=${e.message}`);
|
|
68
68
|
return warnings;
|
|
69
69
|
}
|
|
70
70
|
if (summary.count !== expectedRecordCount) {
|
|
71
|
-
warnings.push(`record
|
|
71
|
+
warnings.push(`session-record-count=${summary.count} expected=${expectedRecordCount}\nRecord count differs: path=${jsonlPath} bytes=${st.size}`);
|
|
72
72
|
return warnings;
|
|
73
73
|
}
|
|
74
74
|
try {
|
|
75
75
|
const firstRec = JSON.parse(summary.firstLine ?? "");
|
|
76
76
|
const lastRec = JSON.parse(summary.lastLine ?? "");
|
|
77
77
|
if (firstRec.sessionId !== expectedSessionId || lastRec.sessionId !== expectedSessionId) {
|
|
78
|
-
warnings.push(`
|
|
78
|
+
warnings.push(`session-id-drift=${expectedSessionId} first=${firstRec.sessionId} last=${lastRec.sessionId}\nSession identity differs from the expected identity.`);
|
|
79
79
|
}
|
|
80
80
|
} catch (e) {
|
|
81
|
-
warnings.push(`
|
|
81
|
+
warnings.push(`session-json-invalid=${jsonlPath}\nMalformed JSONL: ${e.message}`);
|
|
82
82
|
}
|
|
83
83
|
return warnings;
|
|
84
84
|
}
|
|
@@ -122,7 +122,8 @@ export function findUnpairedToolUses(messages: Array<{ role?: string; content?:
|
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
export const LOST_TOOL_RESULT_TEXT =
|
|
125
|
-
"
|
|
125
|
+
"tool-result-lost=interrupted\n"
|
|
126
|
+
+ "Claude bridge: the result of this tool call was lost before the session was rebuilt "
|
|
126
127
|
+ "(the turn was interrupted). Treat the call as failed — it may or may not have executed. "
|
|
127
128
|
+ "Re-run the tool if its output is still needed.";
|
|
128
129
|
|