@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.
@@ -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 `piSessionId mismatch (persisted=${persisted.piSessionId} current=${currentPiSessionId})`;
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 mismatch (persisted=${persisted.cwd} current=${currentCwd})`;
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
- `Session file issue: ${msg}\n` +
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)`),
@@ -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 — path=${jsonlPath} err=${e.message}`);
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 unreadable — path=${jsonlPath} size=${st.size} err=${e.message}`);
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 count mismatch — expected=${expectedRecordCount} actual=${summary.count} path=${jsonlPath} bytes=${st.size}`);
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(`sessionId drift — expected=${expectedSessionId} first=${firstRec.sessionId} last=${lastRec.sessionId}`);
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(`malformed JSONL — path=${jsonlPath} err=${e.message}`);
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
- "Claude bridge: the result of this tool call was lost before the session was rebuilt "
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