aibroker 0.58.1 → 0.60.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.
Files changed (84) hide show
  1. package/dist/adapters/iterm/core.d.ts +12 -1
  2. package/dist/adapters/iterm/core.d.ts.map +1 -1
  3. package/dist/adapters/iterm/core.js +32 -5
  4. package/dist/adapters/iterm/core.js.map +1 -1
  5. package/dist/adapters/iterm/sessions.d.ts +28 -0
  6. package/dist/adapters/iterm/sessions.d.ts.map +1 -1
  7. package/dist/adapters/iterm/sessions.js +101 -4
  8. package/dist/adapters/iterm/sessions.js.map +1 -1
  9. package/dist/adapters/pailot/gateway.d.ts.map +1 -1
  10. package/dist/adapters/pailot/gateway.js +46 -11
  11. package/dist/adapters/pailot/gateway.js.map +1 -1
  12. package/dist/core/hybrid.d.ts +10 -1
  13. package/dist/core/hybrid.d.ts.map +1 -1
  14. package/dist/core/hybrid.js +50 -15
  15. package/dist/core/hybrid.js.map +1 -1
  16. package/dist/core/persistence.d.ts +51 -2
  17. package/dist/core/persistence.d.ts.map +1 -1
  18. package/dist/core/persistence.js +45 -1
  19. package/dist/core/persistence.js.map +1 -1
  20. package/dist/core/session-match.d.ts +23 -0
  21. package/dist/core/session-match.d.ts.map +1 -1
  22. package/dist/core/session-match.js +25 -11
  23. package/dist/core/session-match.js.map +1 -1
  24. package/dist/core/state.d.ts +7 -1
  25. package/dist/core/state.d.ts.map +1 -1
  26. package/dist/core/state.js +13 -3
  27. package/dist/core/state.js.map +1 -1
  28. package/dist/daemon/cli.js +3 -0
  29. package/dist/daemon/cli.js.map +1 -1
  30. package/dist/daemon/commands.d.ts.map +1 -1
  31. package/dist/daemon/commands.js +8 -0
  32. package/dist/daemon/commands.js.map +1 -1
  33. package/dist/daemon/core-handlers.d.ts +28 -0
  34. package/dist/daemon/core-handlers.d.ts.map +1 -1
  35. package/dist/daemon/core-handlers.js +215 -59
  36. package/dist/daemon/core-handlers.js.map +1 -1
  37. package/dist/daemon/dispatch.d.ts +60 -1
  38. package/dist/daemon/dispatch.d.ts.map +1 -1
  39. package/dist/daemon/dispatch.js +389 -18
  40. package/dist/daemon/dispatch.js.map +1 -1
  41. package/dist/daemon/inbound.d.ts +4 -0
  42. package/dist/daemon/inbound.d.ts.map +1 -1
  43. package/dist/daemon/inbound.js +134 -29
  44. package/dist/daemon/inbound.js.map +1 -1
  45. package/dist/daemon/index.d.ts.map +1 -1
  46. package/dist/daemon/index.js +42 -0
  47. package/dist/daemon/index.js.map +1 -1
  48. package/dist/daemon/manage.d.ts +37 -0
  49. package/dist/daemon/manage.d.ts.map +1 -1
  50. package/dist/daemon/manage.js +179 -13
  51. package/dist/daemon/manage.js.map +1 -1
  52. package/dist/daemon/session-content.d.ts.map +1 -1
  53. package/dist/daemon/session-content.js +4 -2
  54. package/dist/daemon/session-content.js.map +1 -1
  55. package/dist/daemon/todoist-pending.d.ts +45 -0
  56. package/dist/daemon/todoist-pending.d.ts.map +1 -0
  57. package/dist/daemon/todoist-pending.js +58 -0
  58. package/dist/daemon/todoist-pending.js.map +1 -0
  59. package/dist/daemon/todoist-reply.d.ts +10 -0
  60. package/dist/daemon/todoist-reply.d.ts.map +1 -1
  61. package/dist/daemon/todoist-reply.js +1 -0
  62. package/dist/daemon/todoist-reply.js.map +1 -1
  63. package/dist/daemon/todoist-webhook.d.ts +29 -0
  64. package/dist/daemon/todoist-webhook.d.ts.map +1 -1
  65. package/dist/daemon/todoist-webhook.js +334 -209
  66. package/dist/daemon/todoist-webhook.js.map +1 -1
  67. package/dist/ipc/client.d.ts.map +1 -1
  68. package/dist/ipc/client.js +24 -3
  69. package/dist/ipc/client.js.map +1 -1
  70. package/dist/ipc/validate.d.ts +2 -0
  71. package/dist/ipc/validate.d.ts.map +1 -1
  72. package/dist/ipc/validate.js +6 -1
  73. package/dist/ipc/validate.js.map +1 -1
  74. package/dist/mcp/index.js +19 -2
  75. package/dist/mcp/index.js.map +1 -1
  76. package/dist/transport/screen.d.ts.map +1 -1
  77. package/dist/transport/screen.js +30 -4
  78. package/dist/transport/screen.js.map +1 -1
  79. package/dist/transport/sync-facade.d.ts +15 -2
  80. package/dist/transport/sync-facade.d.ts.map +1 -1
  81. package/dist/transport/sync-facade.js +16 -3
  82. package/dist/transport/sync-facade.js.map +1 -1
  83. package/hooks/drain-mailbox.mjs +34 -8
  84. package/package.json +2 -2
@@ -28,14 +28,17 @@
28
28
  * them sends whoever reads the result looking in the wrong place.
29
29
  */
30
30
  import { mkdirSync, writeFileSync, readdirSync, statSync, unlinkSync } from "node:fs";
31
+ import { execFileSync } from "node:child_process";
31
32
  import { homedir } from "node:os";
32
33
  import { join } from "node:path";
33
- import { snapshotAllSessions } from "../transport/sync-facade.js";
34
+ import { saveJson, loadJson } from "../core/json-store.js";
35
+ import { audit } from "./audit.js";
36
+ import { snapshotAllSessions, wasLastEnumerationReliable } from "../transport/sync-facade.js";
34
37
  import { findCuratedPaiProject, launchResolvedPaiProject, invalidatePaiProjectCache, } from "./pai-projects.js";
35
38
  import { getAllPersistentSessionNames, lookupPersistentName } from "../core/persistence.js";
36
39
  import { flatten, isClaudeReady, isInputBoxEmpty, hasBeenSubmitted, realIO, } from "./terminal-screen.js";
37
40
  import { log } from "../core/log.js";
38
- import { matchSession } from "../core/session-match.js";
41
+ import { matchAllSessions } from "../core/session-match.js";
39
42
  /** A spawned Claude needs to boot and run its `/Name … go` preamble first. */
40
43
  const DEFAULT_SPAWN_TIMEOUT_MS = 90_000;
41
44
  const DEFAULT_DELIVER_TIMEOUT_MS = 120_000;
@@ -57,18 +60,33 @@ export const TASK_PREFIX = "[Task]";
57
60
  // here because these were dispatch's before `ask` needed them too.
58
61
  export { isClaudeReady, hasBeenSubmitted, flatten, realIO, } from "./terminal-screen.js";
59
62
  /**
60
- * Find a running session for `project`.
63
+ * Every running session for `project`, the one most likely to receive first.
61
64
  *
62
65
  * Matches the project's display name, canonical name and every curated alias,
63
66
  * case-insensitively — session labels and aliases disagree on capitalisation
64
67
  * often enough that an exact match silently spawns a duplicate tab.
68
+ *
69
+ * More than one session can legitimately carry the name: a stale tab that
70
+ * registered the name while the real session held it keeps answering to it
71
+ * until its binding is pruned (2026-09-26: both daily sweeps parked on exactly
72
+ * that corpse while the live session was never probed). So this returns ALL
73
+ * same-name hits, a measured-Claude one first, and the caller works down the
74
+ * list until a session answers.
65
75
  */
66
- export function findSessionForProject(project, sessions) {
76
+ export function findSessionsForProject(project, sessions) {
67
77
  // Exact and separator-folded only — never substring. A project called `sl`
68
78
  // would otherwise match any session whose title contains those letters, and
69
79
  // here a wrong match does not spawn, it delivers work to the wrong session.
70
- const hit = matchSession([project.displayName, project.name, project.slug, ...project.names], sessions, { kinds: ["exact", "normalised"] });
71
- return hit ? { id: hit.session.id, label: hit.label } : null;
80
+ return matchAllSessions([project.displayName, project.name, project.slug, ...project.names], sessions, {
81
+ kinds: ["exact", "normalised"],
82
+ // A measured Claude pane outranks a measured shell; no measurement is a
83
+ // tie broken by enumeration order, which is the old single-hit behavior.
84
+ prefer: (s) => (s.isClaude === true ? 2 : s.isClaude === false ? 0 : 1),
85
+ }).map((h) => ({ id: h.session.id, label: h.label }));
86
+ }
87
+ /** The single best session for `project` — see findSessionsForProject. */
88
+ export function findSessionForProject(project, sessions) {
89
+ return findSessionsForProject(project, sessions)[0] ?? null;
72
90
  }
73
91
  /** Enumerate live sessions with their persistent (PAI) names resolved. */
74
92
  function liveSessions() {
@@ -78,6 +96,7 @@ function liveSessions() {
78
96
  id: s.id,
79
97
  name: s.name,
80
98
  paiName: lookupPersistentName(persistent, s.id, s.aibrokerId),
99
+ isClaude: s.isClaude,
81
100
  }));
82
101
  }
83
102
  /**
@@ -158,6 +177,7 @@ export async function submitAndConfirm(sessionId, body, timeoutMs, io = realIO,
158
177
  const realDeps = {
159
178
  resolve: findCuratedPaiProject,
160
179
  sessions: liveSessions,
180
+ sessionsReliable: wasLastEnumerationReliable,
161
181
  deliver: submitAndConfirm,
162
182
  capture: (id) => realIO.capture(id),
163
183
  now: () => Date.now(),
@@ -197,7 +217,8 @@ export async function dispatch(projectName, message, opts = {}, deps = realDeps)
197
217
  const label = project.displayName || project.name;
198
218
  const body = `${opts.prefix ?? TASK_PREFIX} ${message}`;
199
219
  // ── already running? ──
200
- const existing = findSessionForProject(project, deps.sessions());
220
+ const candidates = findSessionsForProject(project, deps.sessions());
221
+ const existing = candidates[0] ?? null;
201
222
  if (existing) {
202
223
  if (left() <= 0) {
203
224
  return {
@@ -213,29 +234,65 @@ export async function dispatch(projectName, message, opts = {}, deps = realDeps)
213
234
  // EXECUTES what it is sent. Task bodies are multi-line and full of
214
235
  // backticks, so this is the difference between a failed delivery and
215
236
  // running fragments of a task description as commands.
216
- const frame = deps.capture(existing.id);
217
- if (frame !== null && !isClaudeReady(frame)) {
237
+ //
238
+ // Several sessions can answer to one name (a stale tab that stole it, a
239
+ // leftover binding), and on 2026-09-26/27 the first one being a corpse was
240
+ // read as the name itself being dead — the caller parked both daily sweeps
241
+ // while the live holder of the name was never probed. So EVERY same-name
242
+ // session is probed and the first one showing a live Claude takes the work;
243
+ // only "none of them is running Claude" is the final verdict.
244
+ let ready = null;
245
+ let sawShell = null;
246
+ for (const c of candidates) {
247
+ const frame = deps.capture(c.id);
248
+ if (frame === null)
249
+ continue; // unreadable: not evidence either way
250
+ if (isClaudeReady(frame)) {
251
+ ready = c;
252
+ break;
253
+ }
254
+ sawShell ??= c;
255
+ }
256
+ if (!ready && sawShell) {
218
257
  return {
219
258
  outcome: "unreachable",
220
259
  project: label,
221
- session: existing.label,
222
- reason: `Session "${existing.label}" is no longer running Claude — its terminal is at a shell ` +
223
- `prompt. Nothing was sent, because a shell would execute the message rather than read it.`,
260
+ session: sawShell.label,
261
+ reason: `Session "${sawShell.label}" is no longer running Claude — its terminal is at a shell ` +
262
+ `prompt. Nothing was sent, because a shell would execute the message rather than read it.` +
263
+ (candidates.length > 1
264
+ ? ` All ${candidates.length} sessions answering to "${existing.label}" were probed; none is running Claude.`
265
+ : ""),
224
266
  };
225
267
  }
268
+ // Every probe unreadable: fall through and attempt delivery to the first
269
+ // candidate, as the single-hit guard always did — its own unreadable
270
+ // outcome is the honest report then.
271
+ const target = ready ?? existing;
272
+ // Write-ahead: a record on disk BEFORE the type, not after. `queued` means
273
+ // the text left our hands for Claude Code's own in-terminal queue, which we
274
+ // cannot see into — if that queue drops it (pane closed, session killed
275
+ // mid-turn, daemon restarted and nobody re-checked) there was previously
276
+ // NOTHING anywhere recording that this dispatch ever happened. Deleted
277
+ // below the moment delivery is actually confirmed; kept otherwise so
278
+ // redriveQueuedDispatches() has something to find.
279
+ const queuedRecordPath = writeQueuedRecord(projectName, label, message, opts.prefix, opts.redriveCount);
226
280
  // One attempt, never three. The text is already in a live session's input
227
281
  // box; typing it again does not retry, it duplicates — one trigger became
228
282
  // three full job sweeps on 2026-08-01. Retries belong to the spawn path
229
283
  // below, where an earlier attempt may genuinely never have landed.
230
- const res = await deps.deliver(existing.id, body, deliverTimeoutMs(), undefined, 1);
284
+ const res = await deps.deliver(target.id, body, deliverTimeoutMs(), undefined, 1);
231
285
  if (res === "ok") {
232
- return { outcome: "delivered", project: label, session: existing.label, reason: "" };
286
+ deleteQueuedRecord(queuedRecordPath);
287
+ return { outcome: "delivered", project: label, session: target.label, reason: "" };
233
288
  }
234
289
  if (res === "unreadable") {
290
+ // Never typed — nothing was queued anywhere, so there is nothing to redrive.
291
+ deleteQueuedRecord(queuedRecordPath);
235
292
  return {
236
293
  outcome: "unreachable",
237
294
  project: label,
238
- session: existing.label,
295
+ session: target.label,
239
296
  reason: `Live session found but ${ackReason(res)}.`,
240
297
  };
241
298
  }
@@ -247,9 +304,27 @@ export async function dispatch(projectName, message, opts = {}, deps = realDeps)
247
304
  return {
248
305
  outcome: "queued",
249
306
  project: label,
250
- session: existing.label,
251
- reason: `Typed into live session "${existing.label}", which was still working and had not read it ` +
252
- `within the window. This is delivery, not failure — do NOT retry.`,
307
+ session: target.label,
308
+ reason: `Typed into live session "${target.label}", which was still working and had not read it ` +
309
+ `within the window. This is delivery, not failure — do NOT retry. Recorded at ${queuedRecordPath} ` +
310
+ `in case it turns out to have been lost; redriven once on the next daemon start.`,
311
+ };
312
+ }
313
+ // Enumeration itself may have failed rather than truthfully found nothing —
314
+ // an osascript hiccup returns `[]` indistinguishable from an empty machine.
315
+ // Reading that as "target absent" spawns a session next to one that already
316
+ // exists, or — worse — the write for that spawn can land on whatever pane
317
+ // happened to be current, which is exactly how a launch command ends up
318
+ // typed into a live Claude pane instead of a fresh shell. Unknown is not
319
+ // absent: report it as a transient failure so the caller retries instead of
320
+ // either giving up (`unlaunchable`) or launching blind.
321
+ if (!deps.sessionsReliable()) {
322
+ return {
323
+ outcome: "unreachable",
324
+ project: label,
325
+ session: "",
326
+ reason: `Session enumeration failed, so whether "${label}" already has a live session could not be ` +
327
+ `confirmed. Not launching one on an unverified "no session" — retry once enumeration recovers.`,
253
328
  };
254
329
  }
255
330
  if (opts.noSpawn) {
@@ -404,4 +479,300 @@ function pruneWorkOrders(dir) {
404
479
  // is a reason to skip the sweep, not to fail the work order.
405
480
  }
406
481
  }
482
+ const QUEUED_DIR = join(homedir(), ".aibroker", "queued-dispatches");
483
+ /** Persist a queued dispatch before it is typed. Returns the record's path. */
484
+ function writeQueuedRecord(project, label, message, prefix, redriveCount) {
485
+ const path = join(QUEUED_DIR, `${Date.now()}-${Math.random().toString(36).slice(2, 8)}.json`);
486
+ const record = { project, label, message, prefix, createdAt: Date.now() };
487
+ if (redriveCount !== undefined)
488
+ record.redriveCount = redriveCount;
489
+ try {
490
+ saveJson(path, record, { backup: false });
491
+ }
492
+ catch (err) {
493
+ log(`dispatch: could not persist queued-dispatch record for "${label}": ${err instanceof Error ? err.message : String(err)}`);
494
+ }
495
+ return path;
496
+ }
497
+ function deleteQueuedRecord(path) {
498
+ try {
499
+ unlinkSync(path);
500
+ }
501
+ catch { /* already gone, or never written */ }
502
+ }
503
+ /**
504
+ * How long a queued (typed-but-unacked) dispatch is left alone before it is
505
+ * treated as possibly lost. Long enough that a genuinely busy Claude turn has
506
+ * finished and consumed it — the sweeps this exists for run for minutes, not
507
+ * hours — short enough to catch a same-morning daemon restart like 2026-09-23's
508
+ * (07:37 dispatch, 07:42/07:44 restarts, never redriven because nothing
509
+ * persisted the attempt).
510
+ */
511
+ const QUEUED_REDRIVE_GRACE_MS = 5 * 60 * 1000;
512
+ // ── was a queued dispatch in fact consumed? ────────────────────────────────
513
+ //
514
+ // Real fault, 2026-09-24: a dispatch typed into a busy session at 06:56 was
515
+ // read and handled by that session minutes later — it is in its transcript —
516
+ // but the queued record stayed on disk, because nothing marks a record
517
+ // consumed. Every daemon restart then re-typed the same message into the same
518
+ // session (the 11:02 restart delivered it a second time), and THAT delivery
519
+ // wrote its own record, so each restart meant one more duplicate, forever.
520
+ // The transcript is the ground truth of what a session actually received, so
521
+ // it is what decides whether a redrive is a recovery or a duplicate.
522
+ /**
523
+ * Substrings that identify `message` inside a transcript entry.
524
+ *
525
+ * Both ends, not just the head: a long body delivered into a busy input box
526
+ * can lose its head (measured 2026-09-24: ~700 of ~5000 chars survived, and
527
+ * they were the tail), so a head-only needle would miss exactly the deliveries
528
+ * that most need finding. Drawn from single lines and capped, so a needle
529
+ * never spans a newline.
530
+ */
531
+ function transcriptNeedles(message) {
532
+ const lines = message.split("\n").map((l) => l.trim()).filter((l) => l.length > 0);
533
+ if (!lines.length)
534
+ return [];
535
+ return [...new Set([lines[0].slice(0, 80), lines[lines.length - 1].slice(-80)])];
536
+ }
537
+ /**
538
+ * Does the target project's transcript already hold this message?
539
+ *
540
+ * true — a user message created after the record contains a distinctive
541
+ * slice of it: the session received it, redelivering duplicates.
542
+ * false — transcript resolvable, message absent: a redrive is warranted.
543
+ * undefined — no transcript could be resolved (no curated project, no
544
+ * rootPath, no ~/.claude/projects dir for it): cannot tell.
545
+ */
546
+ async function queuedDispatchConsumed(record, deps) {
547
+ if (typeof record.createdAt !== "number")
548
+ return undefined;
549
+ const needles = transcriptNeedles(record.message);
550
+ if (!needles.length)
551
+ return undefined;
552
+ const project = await deps.resolve(record.project).catch(() => undefined);
553
+ const rootPath = project?.rootPath;
554
+ if (!rootPath)
555
+ return undefined;
556
+ // Same encoding Claude Code uses for ~/.claude/projects/<dir>: every
557
+ // non-alphanumeric in the cwd becomes a dash — measured against real dirs
558
+ // ("/Users/x/.claude" -> "-Users-x--claude"). The five newest transcripts
559
+ // cover every session that could have consumed it recently.
560
+ const dir = join(homedir(), ".claude", "projects", rootPath.replace(/[^a-zA-Z0-9]/g, "-"));
561
+ let files;
562
+ try {
563
+ files = readdirSync(dir)
564
+ .filter((f) => f.endsWith(".jsonl"))
565
+ .map((f) => ({ f, m: statSync(join(dir, f)).mtimeMs }))
566
+ .sort((a, b) => b.m - a.m)
567
+ .slice(0, 5)
568
+ .map((e) => e.f);
569
+ }
570
+ catch {
571
+ return undefined;
572
+ }
573
+ if (!files.length)
574
+ return undefined;
575
+ // grep for the JSON-ESCAPED spelling: a needle containing a quote never
576
+ // appears verbatim in a JSONL line, only as its escaped form. Whole-file
577
+ // scans, because the consumed entry can sit far above a busy session's tail.
578
+ const patterns = needles.flatMap((n) => ["-e", JSON.stringify(n).slice(1, -1)]);
579
+ for (const f of files) {
580
+ let hits;
581
+ try {
582
+ hits = execFileSync("/usr/bin/grep", ["-F", ...patterns, join(dir, f)], {
583
+ encoding: "utf8",
584
+ timeout: 10_000,
585
+ maxBuffer: 32 * 1024 * 1024,
586
+ });
587
+ }
588
+ catch {
589
+ continue; // no match in this file (grep exits 1) — next transcript
590
+ }
591
+ for (const line of hits.split("\n")) {
592
+ if (!line.trim())
593
+ continue;
594
+ let entry;
595
+ try {
596
+ entry = JSON.parse(line);
597
+ }
598
+ catch {
599
+ continue; // truncated by a concurrent write — skip it
600
+ }
601
+ // Typed-in text only. Tool results are user-type entries too and can
602
+ // echo the body (a session reading the record file itself), which is
603
+ // a mention, not a delivery.
604
+ if (entry?.type !== "user")
605
+ continue;
606
+ const content = entry.message?.content;
607
+ const text = typeof content === "string"
608
+ ? content
609
+ : Array.isArray(content)
610
+ ? content.filter((c) => c?.type === "text").map((c) => c.text).join("\n")
611
+ : "";
612
+ if (!text)
613
+ continue;
614
+ const at = entry.timestamp ? Date.parse(entry.timestamp) : NaN;
615
+ if (Number.isNaN(at) || at < record.createdAt)
616
+ continue;
617
+ if (needles.some((n) => text.includes(n)))
618
+ return true;
619
+ }
620
+ }
621
+ return false;
622
+ }
623
+ // ── a queued todoist dispatch must still be current ─────────────────────────
624
+ //
625
+ // Real fault, 2026-09-24 (records 1790226222101/1790226253580): a dispatch sat
626
+ // queued for 4h and was then re-driven, long after the run it asked for had
627
+ // happened and been completed. A todoist dispatch's `[todoist:<id>` trailer
628
+ // names the task it came from, and that task says whether the order is still
629
+ // wanted: unfetchable means the trigger is closed, and a due date moved far
630
+ // past the queueing moment means the occurrence was completed since.
631
+ /** How far the due date may legitimately sit past queueing: a trigger fires ON its due time, so anything further is a new occurrence. */
632
+ const REDRIVE_DUE_TOLERANCE_MS = 60 * 60 * 1000;
633
+ const TODOIST_TRAILER = /\[todoist:(\d+)(?:\s+in:[^\]]*)?\]/;
634
+ /**
635
+ * Why this record's todoist task makes a redrive stale, or undefined when the
636
+ * dispatch is still current — or cannot be judged, which must NOT drop it.
637
+ */
638
+ async function staleTodoistTrailer(record, fetchImpl) {
639
+ const taskId = TODOIST_TRAILER.exec(record.message)?.[1];
640
+ if (!taskId)
641
+ return undefined;
642
+ try {
643
+ const { fetchParentTask } = await import("./todoist-reply.js");
644
+ const parent = await fetchParentTask(taskId, fetchImpl);
645
+ const due = parent.due?.date ? Date.parse(parent.due.date) : NaN;
646
+ if (Number.isFinite(due) && due > record.createdAt + REDRIVE_DUE_TOLERANCE_MS) {
647
+ return `task ${taskId} is due ${parent.due?.date}, well past the ${new Date(record.createdAt).toISOString()} it was queued at — the occurrence advanced, the run already happened`;
648
+ }
649
+ return undefined;
650
+ }
651
+ catch (err) {
652
+ // A fetch that never got an answer says nothing about the task: keep the
653
+ // record. Only a definitive "gone" (404/401/…, per the webhook's own
654
+ // transient/permanent classifier) is evidence the trigger is closed.
655
+ const { isTransientTodoistError } = await import("./todoist-webhook.js");
656
+ if (isTransientTodoistError(err))
657
+ return undefined;
658
+ return `task ${taskId} is no longer fetchable (${err instanceof Error ? err.message : String(err)}) — closed since the dispatch was queued`;
659
+ }
660
+ }
661
+ /**
662
+ * Re-attempt every queued dispatch still on disk from before this start.
663
+ * Call once, at daemon startup.
664
+ *
665
+ * Not provably exactly-once: if the original typed input was in fact consumed
666
+ * moments after its own delivery window closed, this can deliver a second
667
+ * copy — the same risk `dispatch()`'s single-attempt rule accepts for a normal
668
+ * retry. The alternative is what actually happened: a dispatch typed into a
669
+ * live session, never run, nothing anywhere to say so, and no way to recover
670
+ * it. A record aged past the grace period is stronger evidence of loss than of
671
+ * a slow turn.
672
+ *
673
+ * Bounded, not a retry loop: a record whose todoist task has since closed or
674
+ * completed is dropped as stale, a record whose transcript shows the session
675
+ * already received it is deleted as consumed, a record that has already had
676
+ * its one redrive is dropped without sending, and whatever this pass leaves
677
+ * behind (still `queued`, `unreachable`, `unlaunchable`) is dropped after one
678
+ * audited attempt rather than kept for the next restart, so a daemon that
679
+ * restarts repeatedly cannot turn this into a duplicate-dispatch storm.
680
+ */
681
+ export async function redriveQueuedDispatches(deps = realDeps) {
682
+ let names;
683
+ try {
684
+ names = readdirSync(QUEUED_DIR).filter((n) => n.endsWith(".json"));
685
+ }
686
+ catch {
687
+ return; // directory does not exist yet — nothing was ever queued
688
+ }
689
+ const cutoff = Date.now() - QUEUED_REDRIVE_GRACE_MS;
690
+ for (const name of names) {
691
+ const path = join(QUEUED_DIR, name);
692
+ let record;
693
+ try {
694
+ if (statSync(path).mtimeMs >= cutoff)
695
+ continue; // still inside its own delivery window
696
+ const loaded = loadJson(path);
697
+ if (loaded.status !== "ok") {
698
+ deleteQueuedRecord(path);
699
+ continue;
700
+ }
701
+ record = loaded.data;
702
+ }
703
+ catch {
704
+ continue;
705
+ }
706
+ // Second generation, one chance only. This record was written BY a redrive
707
+ // whose transcript could not be checked; sending it again would make every
708
+ // restart one more duplicate of the same work order.
709
+ if ((record.redriveCount ?? 0) >= 1) {
710
+ log(`dispatch: dropping queued dispatch for "${record.label}" — already redriven once ` +
711
+ `(from ${new Date(record.createdAt).toISOString()}) and never confirmed, not sending it again`);
712
+ audit({
713
+ action: "dispatch-redrive",
714
+ actor: "aibroker:daemon-start",
715
+ target: record.project,
716
+ outcome: "dropped",
717
+ body: record.message,
718
+ reason: "already redriven once and never confirmed — dropped rather than risk another duplicate",
719
+ meta: { project: record.project, originallyQueuedAt: record.createdAt, redriveCount: record.redriveCount },
720
+ });
721
+ deleteQueuedRecord(path);
722
+ continue;
723
+ }
724
+ // Still current? A todoist-trailer dispatch names its task; if that task
725
+ // has since been completed (due advanced) or closed, re-driving would
726
+ // resurrect a run that already happened. Checked before the transcript
727
+ // scan: one task lookup is cheaper than grepping five transcripts, and it
728
+ // answers first when both would apply.
729
+ const stale = await staleTodoistTrailer(record, deps.todoistFetch ?? fetch);
730
+ if (stale) {
731
+ log(`dispatch: dropping queued dispatch for "${record.label}" — ${stale}`);
732
+ audit({
733
+ action: "dispatch-redrive",
734
+ actor: "aibroker:daemon-start",
735
+ target: record.project,
736
+ outcome: "dropped",
737
+ body: record.message,
738
+ reason: stale,
739
+ meta: { project: record.project, originallyQueuedAt: record.createdAt },
740
+ });
741
+ deleteQueuedRecord(path);
742
+ continue;
743
+ }
744
+ // Consumed already? The transcript says whether the session ever read it.
745
+ const consumed = await queuedDispatchConsumed(record, deps);
746
+ if (consumed) {
747
+ log(`dispatch: queued dispatch for "${record.label}" already consumed, not redriving`);
748
+ audit({
749
+ action: "dispatch-redrive",
750
+ actor: "aibroker:daemon-start",
751
+ target: record.project,
752
+ outcome: "consumed",
753
+ body: record.message,
754
+ reason: "found in the target project's transcript after the record was written — the first delivery landed",
755
+ meta: { project: record.project, originallyQueuedAt: record.createdAt },
756
+ });
757
+ deleteQueuedRecord(path);
758
+ continue;
759
+ }
760
+ log(`dispatch: redriving queued dispatch for "${record.label}" left over from ` +
761
+ `${new Date(record.createdAt).toISOString()} (${path})`);
762
+ const result = await dispatch(record.project, record.message, { prefix: record.prefix, redriveCount: 1 }, deps);
763
+ audit({
764
+ action: "dispatch-redrive",
765
+ actor: "aibroker:daemon-start",
766
+ target: result.session || record.project,
767
+ outcome: result.outcome,
768
+ body: record.message,
769
+ reason: result.reason || undefined,
770
+ meta: { project: result.project, originallyQueuedAt: record.createdAt },
771
+ });
772
+ // Delete unconditionally: `delivered`/`spawned` need no further record, and
773
+ // a fresh `queued` result already wrote ITS OWN record above — marked
774
+ // redriveCount so the next start drops it instead of redelivering.
775
+ deleteQueuedRecord(path);
776
+ }
777
+ }
407
778
  //# sourceMappingURL=dispatch.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dispatch.js","sourceRoot":"","sources":["../../src/daemon/dispatch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACtF,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,yBAAyB,GAE1B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,4BAA4B,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE5F,OAAO,EAGL,OAAO,EAEP,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,MAAM,GAGP,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AA8DxD,8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BAAkB;YAC1B,KAAK,EAAE,uBAAuB;YAC9B,MAAM,EAAE,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO;YACxC,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,IAAI,EAAE,MAAM,CAAC,OAAO;YACpB,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,SAAS;YAClC,IAAI,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,kBAAkB,EAAE,MAAM,CAAC,SAAS,EAAE;SACxE,CAAC,CAAC;QACH,4EAA4E;QAC5E,sEAAsE;QACtE,mEAAmE;QACnE,kBAAkB,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;AACH,CAAC"}
@@ -185,6 +185,8 @@ export interface DeliveryResult {
185
185
  ok: boolean;
186
186
  /** What happened, for the audit trail and the caller's 200 body. */
187
187
  detail: string;
188
+ /** Set when the failure is an absent owner session — queue it, don't give up. */
189
+ retry?: boolean;
188
190
  }
189
191
  /**
190
192
  * Record that this machine just wrote to an issue, so its echo can be known.
@@ -217,4 +219,6 @@ export declare function shouldIgnore(route: InboundRoute, payload: unknown): str
217
219
  */
218
220
  export declare function isTrusted(route: InboundRoute, payload: unknown): boolean;
219
221
  export declare function deliverInbound(route: InboundRoute, payload: unknown): Promise<DeliveryResult>;
222
+ /** For tests: run one retry pass immediately, without waiting for the timer. */
223
+ export declare function __retryPendingNow(): Promise<void>;
220
224
  //# sourceMappingURL=inbound.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"inbound.d.ts","sourceRoot":"","sources":["../../src/daemon/inbound.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAWH,iEAAiE;AACjE,eAAO,MAAM,WAAW,WAAW,CAAC;AAEpC,wCAAwC;AACxC,eAAO,MAAM,YAAY,qBAAqB,CAAC;AAE/C,6CAA6C;AAC7C,eAAO,MAAM,QAAQ,QAAY,CAAC;AAMlC,MAAM,MAAM,WAAW,GAA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