sessionpipe-core 0.13.4 → 0.13.6

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/control.js CHANGED
@@ -1,4 +1,4 @@
1
- // sessionpipe-core 0.13.4 · Apache-2.0 · https://sessionpipe.org
1
+ // sessionpipe-core 0.13.6 · Apache-2.0 · https://sessionpipe.org
2
2
 
3
3
  // src/control/frames.ts
4
4
  function hostOf(receiver) {
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- // sessionpipe-core 0.13.4 · Apache-2.0 · https://sessionpipe.org
1
+ // sessionpipe-core 0.13.6 · Apache-2.0 · https://sessionpipe.org
2
2
  var __defProp = Object.defineProperty;
3
3
  var __export = (target, all) => {
4
4
  for (var name in all)
@@ -387,6 +387,7 @@ var queuedPrompt = (a) => {
387
387
  };
388
388
  var channelText = (text) => /^<channel\b[^>]*>([\s\S]*)<\/channel>$/.exec(text)?.[1]?.trim() ?? "";
389
389
  var INTERRUPTED = /^\[Request interrupted by user[^\]]*\]$/;
390
+ var NO_REPLY = "No response requested.";
390
391
  var HOOK_FEEDBACK = /^[A-Za-z]+ hook feedback:\n/;
391
392
  var hookDelivery = (text) => {
392
393
  const head = HOOK_FEEDBACK.exec(text);
@@ -433,7 +434,10 @@ function readClaude(lines, from) {
433
434
  else if (!fromAgent(origin)) ask(peerAsk(origin, raw), { injected: true, ...id ? { id } : {} });
434
435
  } else if (j.type === "assistant" && Array.isArray(c)) {
435
436
  const text = textParts(c, ["text"]).trim();
436
- if (text) {
437
+ if (text === NO_REPLY && j.message.model === "<synthetic>") {
438
+ msgs.push({ role: "interrupt", text: "", at, line: i });
439
+ turnOver = true;
440
+ } else if (text) {
437
441
  msgs.push({ role: "assistant", text, at, line: i });
438
442
  saidLine = i;
439
443
  turnOver = false;
@@ -2317,6 +2321,7 @@ function startAcp(o) {
2317
2321
  pending.clear();
2318
2322
  };
2319
2323
  child.on("error", (e) => left(`couldn't start ${label}: ${e.message}`));
2324
+ child.stdin?.on("error", (e) => left(`${label} stopped taking input: ${e.message}`));
2320
2325
  let dead = false;
2321
2326
  const exited = (code, signal) => {
2322
2327
  dead = true;
@@ -3356,27 +3361,35 @@ function detectCaps(bin, timeoutMs = 3e4) {
3356
3361
  return { ...caps, unread: `\`${path10.basename(bin)} --help\` ${why}` };
3357
3362
  }
3358
3363
  }
3359
- function transcriptIn(session, dir) {
3364
+ var DISK = { statSync: statSync5, readdirSync: readdirSync4 };
3365
+ function transcriptIn(session, dir, anySpelling, disk) {
3360
3366
  let projects = [];
3361
3367
  try {
3362
3368
  projects = readdirSync4(path10.join(dir, "projects"), { withFileTypes: true });
3363
3369
  } catch {
3364
3370
  return null;
3365
3371
  }
3372
+ const spellings = anySpelling ? [.../* @__PURE__ */ new Set([session, session.toLowerCase(), session.toUpperCase()])] : [session];
3373
+ const same = anySpelling ? (n, want) => n.toLowerCase() === want.toLowerCase() : Object.is;
3366
3374
  for (const p of projects) {
3367
3375
  if (!p.isDirectory()) continue;
3368
- const file = path10.join(dir, "projects", p.name, `${session}.jsonl`);
3369
- try {
3370
- if (statSync5(file).isFile()) return { file, configDir: dir, project: p.name };
3371
- } catch {
3376
+ const folder = path10.join(dir, "projects", p.name);
3377
+ for (const spelling of spellings) {
3378
+ const want = `${spelling}.jsonl`;
3379
+ try {
3380
+ if (!disk.statSync(path10.join(folder, want)).isFile()) continue;
3381
+ const name = disk.readdirSync(folder).find((n) => same(n, want));
3382
+ if (name) return { file: path10.join(folder, name), configDir: dir, project: p.name };
3383
+ } catch {
3384
+ }
3372
3385
  }
3373
3386
  }
3374
3387
  return null;
3375
3388
  }
3376
- function findTranscript(session, dirs) {
3389
+ function findTranscript(session, dirs, o = {}) {
3377
3390
  if (!UUID_RE2.test(session)) return null;
3378
3391
  for (const dir of dirs) {
3379
- const t = transcriptIn(session, dir);
3392
+ const t = transcriptIn(session, dir, !!o.anySpelling, o.disk ?? DISK);
3380
3393
  if (t) return t;
3381
3394
  }
3382
3395
  return null;
@@ -3385,7 +3398,7 @@ function findTranscripts(session, dirs) {
3385
3398
  if (!UUID_RE2.test(session)) return [];
3386
3399
  const out = [];
3387
3400
  for (const dir of dirs) {
3388
- const t = transcriptIn(session, dir);
3401
+ const t = transcriptIn(session, dir, false, DISK);
3389
3402
  if (t) out.push(t);
3390
3403
  }
3391
3404
  return out;