shadok-ai 0.14.6 → 0.14.8

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 CHANGED
@@ -683,7 +683,7 @@ client, or immediately on an explicit `stop` (which ends it for everyone).
683
683
  | `{type:"auto-retry"}` / `-cancelled` / `-gave-up` | transient API error being retried |
684
684
  | `{type:"version", …}` / `{type:"server-reload", version}` | update available / server updated, reload |
685
685
  | `{type:"term-data", data}` | **experimental** — raw pane output (base64) for a client-side terminal emulator |
686
- | `{type:"gone"}` / `{type:"error", message, code?}` / `{type:"exited", code}` / `{type:"stopped"}` | session lost, errors, termination. `error.code` is `"busy"` for a prompt refused mid-turn and `"logged-out"` for a spawn refused because the instance isn't signed in — so a machine client needn't match on the message text |
686
+ | `{type:"gone"}` / `{type:"error", message, code?}` / `{type:"exited", code}` / `{type:"stopped"}` | session lost, errors, termination. `error.code` is `"busy"` for a prompt refused mid-turn and `"logged-out"` for a spawn refused because the instance isn't signed in, `"resume-refused"` for a `resume` whose shortened id matches no agent or several — so a machine client needn't match on the message text |
687
687
 
688
688
  HTTP endpoints (same auth): `/usage`, `/live`, `/sessions`, `/recover`,
689
689
  `/diff`, `/channels` (its GET adds a **derived** `crons` field — never stored),
@@ -18,19 +18,27 @@ Then let it steer you:
18
18
  ("de mémoire, à faire — dis-moi si c'est déjà réglé"), don't assert;
19
19
  - rows printed under **"related rows — they may NOT answer your question"** are
20
20
  leads, not an answer: you are still in the UNKNOWN case above;
21
- - a **stale** record (days old) → confirm before acting.
21
+ - a **stale** record (days old) → confirm before acting; the age shown is when
22
+ the claim was last CONFIRMED, not when the text was last edited;
23
+ - a row tagged **`· fact`** has no lifecycle — `current` or `stale`, never
24
+ "done": don't read its status as a position in open → resolved, and don't
25
+ close it because surrounding work finished. A **`· decision`** stands until
26
+ something supersedes it.
22
27
 
23
28
  **You are also pushed the changes.** Ahead of each turn you are given — a user
24
29
  message, or a scheduled/automated run — you may receive a
25
- `⟦ledger · N updates since your last message⟧` block listing what sibling agents
26
- resolved or decided since you last heard — each line `• [id] entity — status`.
27
- Treat it as current status (don't re-raise what it shows resolved). It is the
28
- push half; `check` is still there for older or specific items the block didn't
29
- carry.
30
+ `⟦ledger · N updates⟧` block listing what sibling agents resolved or decided
31
+ since you last heard — `• [id] entity — status ↳ what happened`, all on one
32
+ line. Treat it as current status
33
+ (don't re-raise what it shows resolved). It is the push half; `check` is still
34
+ there for older or specific items the block didn't carry.
30
35
 
31
36
  When you **resolve, decide, or change** something notable, record it so the next
32
37
  agent doesn't redo it:
33
- `node ~/.claude/skills/shadok-ledger/ledger.mjs record --entity "<name>" --status <resolved|open|in-progress|decided> --note "<line>" --source "<PR#/who>"`.
38
+ `node ~/.claude/skills/shadok-ledger/ledger.mjs record --entity "<name>" --status <resolved|open|in-progress> --note "<line>" --source "<PR#/who>"`.
39
+ Open the note with the sentence that says WHAT happened — it is what siblings get
40
+ pushed. For something with no lifecycle, pass `--kind fact` or `--kind decision`
41
+ instead of a status; to say you re-checked a row and nothing moved, `--verified`.
34
42
  To update an item you saw in the block, quote its handle instead of retyping the
35
43
  name: `… record --id <id> --status resolved --note "<line>"`.
36
44
 
@@ -37,7 +37,14 @@ you nothing.
37
37
  the search found no row that answers you, only rows sharing some words. You
38
38
  are still in the UNKNOWN case above. Read them as leads (they may point at the
39
39
  right topic under another name), never as a status to assert.
40
- - a **stale** row (many days old) → hedge and confirm before acting.
40
+ - a **stale** row (many days old) → hedge and confirm before acting. The age
41
+ shown is when the row's claim was last **confirmed**, not when its text was
42
+ last edited.
43
+ - a row tagged **`· fact`** has no lifecycle: it is `current` or `stale`, never
44
+ "done". Do not read its status as a position in open → resolved, and do not
45
+ close it because the work around it finished — it stays true.
46
+ - a row tagged **`· decision`** is a standing decision, not a phase of a task.
47
+ It holds until something supersedes it.
41
48
 
42
49
  This fires on status-dependent claims (a bug being open, a PR unmerged, a task
43
50
  undone, a campaign live). A **durable lesson/constraint** ("don't buy the
@@ -49,13 +56,46 @@ Record it so the next agent doesn't redo it:
49
56
 
50
57
  ```
51
58
  node ~/.claude/skills/shadok-ledger/ledger.mjs record \
52
- --entity "<name>" --status <resolved|open|in-progress|decided> \
59
+ --entity "<name>" --status <resolved|open|in-progress> \
53
60
  --note "<one line>" --source "<PR#, session, who>"
54
61
  ```
55
62
 
56
63
  Re-recording the same entity **supersedes** its row (no duplicates). Log facts —
57
64
  resolutions, decisions, state changes, launched actions — never chatter.
58
65
 
66
+ **Open the note with the one sentence that says what happened.** Its first
67
+ sentence is what siblings are shown in the `⟦ledger⟧` block pushed ahead of their
68
+ messages — the entity name alone cannot tell them what changed about it. Put the
69
+ consequence first, details after.
70
+
71
+ ## Is it a task, a fact, or a decision?
72
+
73
+ A **task** has a lifecycle, so a status is the right thing to carry and closing
74
+ it is normal. That is the default and needs no flag. The other two do:
75
+
76
+ ```
77
+ … record --entity "nightly import window" --kind fact \
78
+ --note "Runs 03:00-03:40 Europe/Paris, after the extraction job."
79
+ … record --entity "ledger stays a state table" --kind decision \
80
+ --note "Supersede, not append, so size is bounded by live topics."
81
+ ```
82
+
83
+ `--kind` replaces `--status` for these two (they get `current` / `decided`), because
84
+ neither has phases to report. This matters: a **fact** marked `resolved` stops
85
+ being read by anything that filters on open work, while remaining perfectly true
86
+ — which is how a job finished on the 9th was still believed pending on the 12th.
87
+
88
+ When you re-check a row and nothing has changed, say so instead of rewriting it:
89
+
90
+ ```
91
+ … record --id <id> --verified
92
+ ```
93
+
94
+ That refreshes its freshness only. It deliberately does **not** enter anyone's
95
+ pushed block — "I looked, nothing moved" is not news. Conversely, editing a note
96
+ does **not** refresh freshness: only a status (or `--verified`) counts as having
97
+ looked.
98
+
59
99
  Every row has a short **id** (shown as `[id]` in `check`/`list` and in the ledger
60
100
  block pushed ahead of your messages). To update a row you already saw, quote its
61
101
  id instead of retyping the name — no risk of a typo forking a second row:
@@ -0,0 +1,34 @@
1
+ // Types for the skill's pure core, so the SERVER can import the one source of
2
+ // the ledger's logic instead of growing a second copy of it (CLAUDE.md: this
3
+ // file is the single source, no duplication to drift). The core itself stays
4
+ // plain .mjs — it is copied verbatim into ~/.claude/skills/ at every boot and
5
+ // must run with no build step of its own.
6
+ export interface LedgerCoreRow {
7
+ id?: string;
8
+ entity: string;
9
+ status: string;
10
+ kind?: string;
11
+ note?: string;
12
+ source?: string;
13
+ updatedAt?: number;
14
+ verifiedAt?: number;
15
+ }
16
+ export type LedgerKind = "task" | "fact" | "decision";
17
+ export const KINDS: LedgerKind[];
18
+ export function normEntity(s: unknown): string;
19
+ export function normKind(k: unknown): LedgerKind | null;
20
+ export function rowKind(entry: unknown): LedgerKind;
21
+ export function resolveId<T extends LedgerCoreRow>(entries: T[], idOrPrefix: unknown): T | null;
22
+ export function upsertEntry<T extends LedgerCoreRow>(
23
+ entries: T[],
24
+ patch: Partial<LedgerCoreRow> & { verified?: boolean },
25
+ now: number,
26
+ newId?: string,
27
+ ): T[];
28
+ export function tokenize(s: unknown): string[];
29
+ export function searchEntries<T extends LedgerCoreRow>(
30
+ entries: T[],
31
+ query: string,
32
+ opts?: { strong?: number; weak?: number },
33
+ ): { strong: T[]; weak: T[] };
34
+ export function ageDays(entry: { updatedAt?: number; verifiedAt?: number }, now: number): number;
@@ -26,6 +26,52 @@ export function resolveId(entries, idOrPrefix) {
26
26
  return pre.length === 1 ? pre[0] : null;
27
27
  }
28
28
 
29
+ /* --------------------------------------------------------------------- *
30
+ * A row's KIND: a task, a fact, or a decision.
31
+ *
32
+ * The table used to treat all three identically, and they are not the same
33
+ * object. A TASK has a lifecycle, so a status is the right thing to carry and
34
+ * closing it is normal. A FACT has no lifecycle — only a date on which someone
35
+ * last confirmed it — so closing it makes it DISAPPEAR WHILE IT STAYS TRUE,
36
+ * which is how a finished job was still believed pending three days later. And
37
+ * `decided` was never a phase of the open → in-progress → resolved lifecycle it
38
+ * sat next to: it is a kind wearing a status's clothes.
39
+ *
40
+ * Design: docs/superpowers/specs/2026-10-13-ledger-kind-and-headline.md
41
+ * --------------------------------------------------------------------- */
42
+
43
+ export const KINDS = ["task", "fact", "decision"];
44
+
45
+ /** The status a kind with NO lifecycle gets when none is given, so an agent is
46
+ * never pushed into inventing a word for a thing that has no phases. Keeping
47
+ * `status` always present is what leaves every existing reader — the pushed
48
+ * delta, the GUI viewer, a consumer's recap filter — working untouched. */
49
+ const KIND_STATUS = { fact: "current", decision: "decided" };
50
+
51
+ /**
52
+ * Validate a `--kind`: one of KINDS, or null when absent. An unknown one THROWS
53
+ * rather than being stored — a typo that silently became a fourth kind would be
54
+ * invisible for exactly as long as nobody went looking.
55
+ */
56
+ export function normKind(k) {
57
+ const s = String(k ?? "").trim().toLowerCase();
58
+ if (!s) return null;
59
+ if (!KINDS.includes(s)) throw new Error(`unknown kind "${k}" — use one of: ${KINDS.join(", ")}`);
60
+ return s;
61
+ }
62
+
63
+ /**
64
+ * What kind a row IS — read, never written back. An absent `kind` reads as
65
+ * `decision` when the status is `decided` (that is what the word already meant)
66
+ * and as `task` otherwise, so the rows recorded before this existed keep their
67
+ * bytes and still render correctly. Assert only what you saw.
68
+ */
69
+ export function rowKind(entry) {
70
+ const k = String(entry?.kind ?? "").trim().toLowerCase();
71
+ if (KINDS.includes(k)) return k;
72
+ return normEntity(entry?.status) === "decided" ? "decision" : "task";
73
+ }
74
+
29
75
  /**
30
76
  * Upsert a row, two ways:
31
77
  * - `patch.id` present → UPDATE that exact row in place (resolved via resolveId),
@@ -35,20 +81,54 @@ export function resolveId(entries, idOrPrefix) {
35
81
  * its id (the handle is durable across every write), or create a new row with
36
82
  * `newId`.
37
83
  * `now` (epoch ms) and `newId` are injected so the core stays pure/testable.
84
+ *
85
+ * Two clocks, because an EDIT is not an OBSERVATION. `updatedAt` is when the row
86
+ * was last written; `verifiedAt` is when its claim was last confirmed, and it is
87
+ * what the staleness hedge reads. Rewriting a note used to rejuvenate a row
88
+ * nobody had re-checked in a month, which silently switched that hedge off:
89
+ *
90
+ * create ................................ both move
91
+ * --status given (even the same value) .. both move — re-asserting a status
92
+ * IS confirming it
93
+ * --note / --source / --entity only ..... updatedAt moves, verifiedAt does NOT
94
+ * --verified alone ...................... verifiedAt moves, updatedAt does NOT
95
+ *
96
+ * That last line is deliberate: a row whose `updatedAt` does not move stays out
97
+ * of every sibling's pushed delta, and "I re-checked, nothing changed" is not
98
+ * news — pushing it to every agent is the noise a state table exists to avoid.
99
+ * A row that predates `verifiedAt` inherits its old `updatedAt` as the moment it
100
+ * was last observed, which is the truth and makes the migration lazy, per row.
38
101
  */
39
102
  export function upsertEntry(entries, patch, now, newId) {
103
+ const kind = normKind(patch.kind); // refuses an unknown kind before anything is written
104
+ const statusGiven = patch.status != null && String(patch.status).trim() !== "";
105
+
40
106
  if (patch.id != null && String(patch.id).trim()) {
41
107
  const cur = resolveId(entries, patch.id);
42
108
  if (!cur) throw new Error(`no ledger entry with id "${patch.id}"`);
109
+ // `kind` is a property of the ENTITY, not of this write: keep the stored one
110
+ // when none is given, like the id.
111
+ const effKind = kind ?? normKind(cur.kind);
112
+ // Promoting a row to a lifecycle-less kind supplies that kind's status, so
113
+ // `--id X --kind fact` does not leave a stale `resolved` on a fact.
114
+ const status = statusGiven
115
+ ? String(patch.status).trim()
116
+ : kind && kind !== rowKind(cur) && KIND_STATUS[kind]
117
+ ? KIND_STATUS[kind]
118
+ : cur.status;
119
+ const edited =
120
+ statusGiven || kind != null || patch.note != null || patch.source != null || patch.entity != null;
121
+ const observed = statusGiven || patch.verified === true || status !== cur.status;
43
122
  const row = {
44
123
  id: cur.id,
45
124
  entity:
46
125
  patch.entity != null && String(patch.entity).trim() ? String(patch.entity).trim() : cur.entity,
47
- status:
48
- patch.status != null && String(patch.status).trim() ? String(patch.status).trim() : cur.status,
126
+ status,
127
+ ...(effKind ? { kind: effKind } : {}),
49
128
  ...((patch.note ?? cur.note) ? { note: String(patch.note ?? cur.note).trim() } : {}),
50
129
  ...((patch.source ?? cur.source) ? { source: String(patch.source ?? cur.source).trim() } : {}),
51
- updatedAt: now,
130
+ updatedAt: edited ? now : (cur.updatedAt ?? now),
131
+ verifiedAt: observed ? now : (cur.verifiedAt ?? cur.updatedAt ?? now),
52
132
  };
53
133
  return [...entries.filter((e) => e.id !== cur.id), row];
54
134
  }
@@ -56,13 +136,20 @@ export function upsertEntry(entries, patch, now, newId) {
56
136
  const key = normEntity(patch.entity);
57
137
  if (!key) throw new Error("entity is required");
58
138
  const existing = entries.find((e) => normEntity(e.entity) === key);
139
+ const effKind = kind ?? normKind(existing?.kind);
140
+ const status = statusGiven
141
+ ? String(patch.status).trim()
142
+ : (effKind && KIND_STATUS[effKind]) || String(patch.status ?? "").trim();
143
+ const observed = statusGiven || patch.verified === true || status !== existing?.status;
59
144
  const row = {
60
145
  id: existing?.id ?? newId,
61
146
  entity: String(patch.entity).trim(),
62
- status: String(patch.status ?? "").trim(),
147
+ status,
148
+ ...(effKind ? { kind: effKind } : {}),
63
149
  ...(patch.note ? { note: String(patch.note).trim() } : {}),
64
150
  ...(patch.source ? { source: String(patch.source).trim() } : {}),
65
151
  updatedAt: now,
152
+ verifiedAt: observed ? now : (existing?.verifiedAt ?? existing?.updatedAt ?? now),
66
153
  };
67
154
  return [...entries.filter((e) => normEntity(e.entity) !== key), row];
68
155
  }
@@ -181,7 +268,12 @@ export function searchEntries(entries, query, opts = {}) {
181
268
  };
182
269
  }
183
270
 
184
- /** Whole days since a row was last touched — the freshness the reflex hedges on. */
271
+ /**
272
+ * Whole days since the row's claim was last CONFIRMED — the freshness the reflex
273
+ * hedges on. `verifiedAt` first: reading `updatedAt` meant any edit, down to a
274
+ * reworded note, reset the age of a row nobody had re-checked. Falls back to
275
+ * `updatedAt` for the rows recorded before the field existed.
276
+ */
185
277
  export function ageDays(entry, now) {
186
- return Math.floor((now - (entry.updatedAt ?? now)) / 86_400_000);
278
+ return Math.floor((now - (entry.verifiedAt ?? entry.updatedAt ?? now)) / 86_400_000);
187
279
  }
@@ -10,7 +10,7 @@ import fs from "node:fs";
10
10
  import os from "node:os";
11
11
  import path from "node:path";
12
12
  import crypto from "node:crypto";
13
- import { upsertEntry, searchEntries, ageDays, resolveId, normEntity } from "./ledger-core.mjs";
13
+ import { upsertEntry, searchEntries, ageDays, resolveId, normEntity, rowKind, KINDS } from "./ledger-core.mjs";
14
14
 
15
15
  const FILE =
16
16
  (process.env.SHADOK_LEDGER_FILE || "").trim() ||
@@ -42,11 +42,17 @@ function mintId(rows) {
42
42
  return crypto.randomBytes(4).toString("hex");
43
43
  }
44
44
 
45
+ /** Flags that take NO value, listed rather than guessed: inferring "the next arg
46
+ * starts with -- so this one is a boolean" would misread `--note "--foo"`. */
47
+ const BOOL_FLAGS = new Set(["verified"]);
48
+
45
49
  /** `--key value` pairs → object. Values may be quoted by the shell already. */
46
50
  function parseFlags(args) {
47
51
  const out = {};
48
52
  for (let i = 0; i < args.length; i++) {
49
- if (args[i].startsWith("--")) out[args[i].slice(2)] = args[++i] ?? "";
53
+ if (!args[i].startsWith("--")) continue;
54
+ const key = args[i].slice(2);
55
+ out[key] = BOOL_FLAGS.has(key) ? true : (args[++i] ?? "");
50
56
  }
51
57
  return out;
52
58
  }
@@ -54,8 +60,17 @@ function parseFlags(args) {
54
60
  function fmt(e, now) {
55
61
  const age = ageDays(e, now);
56
62
  const when = age <= 0 ? "today" : age === 1 ? "1d ago" : `${age}d ago`;
63
+ const kind = rowKind(e);
64
+ // Say "verified" wherever the two clocks have parted company — and always for
65
+ // a fact, whose whole state IS its freshness. A bare age next to a row last
66
+ // confirmed a month ago but reworded yesterday is the lie this removes.
67
+ const parted = e.verifiedAt && e.updatedAt && e.verifiedAt !== e.updatedAt;
68
+ const stamp = kind === "fact" || parted ? `verified ${when}` : when;
69
+ // `task` is the default and the overwhelming majority: tagging it would be
70
+ // noise on every line. The two that change how a status must be READ are named.
71
+ const tag = kind === "task" ? "" : ` · ${kind}`;
57
72
  const handle = e.id ? `[${e.id}] ` : "";
58
- const head = `• ${handle}${e.entity} — ${e.status} (${when}${e.source ? ` · ${e.source}` : ""})`;
73
+ const head = `• ${handle}${e.entity} — ${e.status}${tag} (${stamp}${e.source ? ` · ${e.source}` : ""})`;
59
74
  return e.note ? `${head}\n ${e.note}` : head;
60
75
  }
61
76
 
@@ -89,11 +104,18 @@ if (cmd === "check") {
89
104
  // Two shapes: create/supersede by --entity (+ --status), or update an existing
90
105
  // row by its --id handle (change any of status/note/source; entity optional).
91
106
  const byId = f.id != null && String(f.id).trim();
92
- const idHasNoFields = f.status == null && f.note == null && f.source == null && f.entity == null;
93
- if (byId ? idHasNoFields : !f.entity || !f.status) {
107
+ const idHasNoFields =
108
+ f.status == null && f.note == null && f.source == null && f.entity == null &&
109
+ f.kind == null && f.verified == null;
110
+ // A fact or a decision has no lifecycle, so `--kind` stands in for `--status`:
111
+ // requiring one would only invite an invented word.
112
+ const hasStatus = !!f.status || !!f.kind;
113
+ if (byId ? idHasNoFields : !f.entity || !hasStatus) {
94
114
  console.error(
95
115
  'usage: ledger record --entity "<name>" --status <resolved|open|in-progress|decided> [--note "<line>"] [--source "<ref>"]\n' +
96
- ' or: ledger record --id <handle> [--status <…>] [--note "<line>"] [--source "<ref>"]',
116
+ ` or: ledger record --entity "<name>" --kind <${KINDS.join("|")}> [--note "<line>"] [--source "<ref>"]\n` +
117
+ ' or: ledger record --id <handle> [--status <…>] [--kind <…>] [--note "<line>"] [--source "<ref>"]\n' +
118
+ ' or: ledger record --id <handle> --verified (still true/current — nothing else changed)',
97
119
  );
98
120
  process.exit(2);
99
121
  }
@@ -102,7 +124,15 @@ if (cmd === "check") {
102
124
  try {
103
125
  rows = upsertEntry(
104
126
  rows0,
105
- { id: f.id, entity: f.entity, status: f.status, note: f.note, source: f.source },
127
+ {
128
+ id: f.id,
129
+ entity: f.entity,
130
+ status: f.status,
131
+ kind: f.kind,
132
+ verified: f.verified === true,
133
+ note: f.note,
134
+ source: f.source,
135
+ },
106
136
  now,
107
137
  mintId(rows0),
108
138
  );
@@ -112,7 +142,8 @@ if (cmd === "check") {
112
142
  }
113
143
  save(rows);
114
144
  const row = byId ? resolveId(rows, f.id) : rows.find((r) => normEntity(r.entity) === normEntity(f.entity));
115
- console.log(`recorded: ${row.entity} — ${row.status} [${row.id}]`);
145
+ const k = rowKind(row);
146
+ console.log(`recorded: ${row.entity} — ${row.status}${k === "task" ? "" : ` · ${k}`} [${row.id}]`);
116
147
  } else if (cmd === "list") {
117
148
  const rows = searchEntries(load(), "").strong;
118
149
  console.log(rows.length ? rows.map((e) => fmt(e, now)).join("\n") : "(ledger empty)");
@@ -260,3 +260,27 @@ export declare function resumeTarget(channels: readonly Channel[], sessionId: st
260
260
  branch?: string;
261
261
  repo?: string;
262
262
  }, fallbackCwd: string): SessionTarget;
263
+ export type ResumeLookup = {
264
+ ok: true;
265
+ id: string;
266
+ } | {
267
+ ok: false;
268
+ error: "empty" | "not-found" | "ambiguous";
269
+ matches: number;
270
+ };
271
+ /**
272
+ * The full session id a `resume` names — or an explicit refusal.
273
+ *
274
+ * Ids are displayed 8 characters long everywhere (pilotctl, the tab menu,
275
+ * Telegram), so that is what comes back from whoever read one. Passed through
276
+ * verbatim, `claude --resume 113f3745` does not resume anything: it opens Claude
277
+ * Code's "Resume session" PICKER, a screen with no prompt, in a pane named after
278
+ * the truncated id — an agent that never becomes ready and that no channel
279
+ * points at. Same family as `resolveCronId` (invariant 17): a short handle is
280
+ * resolved to exactly one id, and an empty or ambiguous one is refused rather
281
+ * than settled at random.
282
+ *
283
+ * A complete id is returned as it is even when the registry does not know it:
284
+ * `/recover` resumes sessions whose channel is long gone.
285
+ */
286
+ export declare function resolveResumeId(known: string[], given: string): ResumeLookup;
package/dist/channels.js CHANGED
@@ -404,4 +404,33 @@ export function resumeTarget(channels, sessionId, sent, fallbackCwd) {
404
404
  repo: t.repo ?? sent.repo?.trim() ?? null,
405
405
  };
406
406
  }
407
+ const FULL_SESSION_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
408
+ /**
409
+ * The full session id a `resume` names — or an explicit refusal.
410
+ *
411
+ * Ids are displayed 8 characters long everywhere (pilotctl, the tab menu,
412
+ * Telegram), so that is what comes back from whoever read one. Passed through
413
+ * verbatim, `claude --resume 113f3745` does not resume anything: it opens Claude
414
+ * Code's "Resume session" PICKER, a screen with no prompt, in a pane named after
415
+ * the truncated id — an agent that never becomes ready and that no channel
416
+ * points at. Same family as `resolveCronId` (invariant 17): a short handle is
417
+ * resolved to exactly one id, and an empty or ambiguous one is refused rather
418
+ * than settled at random.
419
+ *
420
+ * A complete id is returned as it is even when the registry does not know it:
421
+ * `/recover` resumes sessions whose channel is long gone.
422
+ */
423
+ export function resolveResumeId(known, given) {
424
+ const n = (given ?? "").trim();
425
+ if (!n)
426
+ return { ok: false, error: "empty", matches: 0 };
427
+ if (known.includes(n) || FULL_SESSION_ID.test(n))
428
+ return { ok: true, id: n };
429
+ const hits = [...new Set(known.filter((id) => id.startsWith(n)))];
430
+ if (hits.length === 0)
431
+ return { ok: false, error: "not-found", matches: 0 };
432
+ if (hits.length > 1)
433
+ return { ok: false, error: "ambiguous", matches: hits.length };
434
+ return { ok: true, id: hits[0] };
435
+ }
407
436
  //# sourceMappingURL=channels.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"channels.js","sourceRoot":"","sources":["../src/channels.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAyD7B;;;;;;;;GAQG;AACH,MAAM,UAAU,UAAU,CAAC,CAAU;IACnC,OAAO,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;AAClC,CAAC;AAED;;;;;;8DAM8D;AAC9D,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,eAAe,CAAU,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CAAC;IACpF,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;AACnC,CAAC"}
package/dist/detect.d.ts CHANGED
@@ -137,40 +137,4 @@ export interface TypeOptions {
137
137
  /** How long to wait for the box to actually read empty after Ctrl-U. */
138
138
  clearMs?: number;
139
139
  }
140
- /**
141
- * Puts `text` in the input box, retrying until it is actually there. Returns
142
- * whether it landed; the caller decides what a failure means.
143
- *
144
- * The retry is what makes it robust — the TUI flushes stdin received before its
145
- * keyboard handler is ready — and the RECOVERY between attempts is where it used
146
- * to go wrong. A slow first paste (a freshly respawned pane, a loaded machine)
147
- * can still be in flight when the appearance check times out: the old code sent
148
- * Ctrl-U immediately, so it cleared an EMPTY box, the paste landed a moment
149
- * later, and the next attempt pasted on top of it — leaving the partial text
150
- * PLUS the full text in the box, which is how a prompt came through doubled.
151
- * Nothing about that is visible afterwards: the transcript just shows one
152
- * mangled message.
153
- *
154
- * So the recovery does the two things the fast path cannot: it WAITS for any
155
- * in-flight paste to land before clearing, and it CONFIRMS the box reads empty
156
- * before pasting again. A box that will not clear is left to the next attempt
157
- * rather than pasted into blindly.
158
- *
159
- * "Landed" means the box DIFFERS from what it showed just before the paste, not
160
- * that it is non-empty: an empty box is not always blank. Before the first
161
- * prompt of a session, Claude Code (seen on 2.1.285) fills it with an example —
162
- * `❯ Try "refactor <filepath>"` — which `inputText` reads like typed text, so
163
- * "non-empty" was true before anything was pasted, and a paste the TUI dropped
164
- * was followed by Enter on a box holding nothing. The example also comes back
165
- * after a Ctrl-U, so "cleared" likewise means "back to that resting state".
166
- * Comparing with the state read just before is still content-agnostic (a
167
- * collapsed "[Pasted text +N lines]" differs from it as well as the text would)
168
- * and needs no list of hint strings, which would rot with the next release. The
169
- * baseline is re-read on every attempt, after the recovery has run, so a retry
170
- * that pastes the same text again is compared with the box it pastes into.
171
- *
172
- * It lives here, next to `idleStep` and `moveToOption`, for the reason those do:
173
- * it was written twice (node-pty and tmux), and could only be exercised by
174
- * spawning a real process.
175
- */
176
140
  export declare function typeIntoBox(pilot: TypingPilot, text: string, { attempts, appearMs, settleMs, clearMs }?: TypeOptions): Promise<boolean>;
package/dist/detect.js CHANGED
@@ -246,6 +246,12 @@ export async function moveToOption(pilot, n) {
246
246
  * it was written twice (node-pty and tmux), and could only be exercised by
247
247
  * spawning a real process.
248
248
  */
249
+ /** Upper bound on Ctrl-U presses for one recovery: a prompt is a handful of
250
+ * lines, and a box that still is not clear after this many is not going to be. */
251
+ const MAX_CLEARS = 40;
252
+ /** How long one press is given to show. Above the tmux mirror's fast poll
253
+ * (`SCREEN_FAST_MS`), or a press that worked would read as one that did not. */
254
+ const CLEAR_STEP_MS = 400;
249
255
  export async function typeIntoBox(pilot, text, { attempts = 6, appearMs = 2_000, settleMs = 400, clearMs = 1_000 } = {}) {
250
256
  for (let attempt = 0; attempt < attempts; attempt++) {
251
257
  // Only "" and the resting state count as an empty box; anything else the
@@ -261,16 +267,30 @@ export async function typeIntoBox(pilot, text, { attempts = 6, appearMs = 2_000,
261
267
  }
262
268
  catch {
263
269
  await delay(settleMs); // let a paste that is still in flight land
264
- pilot.clearInput();
265
- try {
266
- await pilot.waitFor((s) => {
267
- const now = inputText(s);
268
- return now === "" || now === before;
269
- }, { timeoutMs: clearMs });
270
- }
271
- catch {
272
- pilot.clearInput(); // stubborn — clear once more, then try again
273
- await delay(settleMs);
270
+ const isClear = (s) => {
271
+ const now = inputText(s);
272
+ return now === "" || now === before;
273
+ };
274
+ // Ctrl-U clears ONE line, not the box (seen on 2.1.296): a two-line paste
275
+ // takes three presses — the last line, the newline, the first line. Two
276
+ // presses left the first line behind and the next attempt pasted after it,
277
+ // which is how a prompt arrived as its header twice and its text nowhere.
278
+ // So press until the box reads clear. Progress cannot be read off the box:
279
+ // `inputText` sees its FIRST line only, which stays put while the lines
280
+ // under it go. The whole screen is what moves, so a run of presses that
281
+ // leaves it untouched is a screen with nothing to clear — given up on, and
282
+ // left to the next attempt rather than pasted into blindly.
283
+ let stuck = 0;
284
+ for (let press = 0; press < MAX_CLEARS && stuck < 3; press++) {
285
+ const shown = pilot.screen();
286
+ pilot.clearInput();
287
+ try {
288
+ await pilot.waitFor(isClear, { timeoutMs: Math.min(clearMs, CLEAR_STEP_MS) });
289
+ break;
290
+ }
291
+ catch {
292
+ stuck = pilot.screen() === shown ? stuck + 1 : 0;
293
+ }
274
294
  }
275
295
  }
276
296
  }
@@ -1 +1 @@
1
- {"version":3,"file":"detect.js","sourceRoot":"","sources":["../src/detect.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;GAMG;AACH,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;AAEpD;;;;;;;GAOG;AACH,MAAM,cAAc,GAClB,wDAAwD,CAAC;AAE3D,uEAAuE;AACvE,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,OAAO,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACtE,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,QAAQ,CACtB,MAAc,EACd,UAAkB,EAClB,WAAmB,EACnB,GAAW,EACX,QAAgB;IAEhB,IAAI,eAAe,CAAC,MAAM,CAAC,IAAI,MAAM,KAAK,UAAU,EAAE,CAAC;QACrD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC;IAC7D,CAAC;IACD,4EAA4E;IAC5E,0CAA0C;IAC1C,MAAM,KAAK,GAAG,WAAW,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,WAAW,CAAC;IACpD,OAAO,EAAE,IAAI,EAAE,GAAG,GAAG,KAAK,IAAI,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;AAC3E,CAAC;AAED;;;;;;;GAOG;AACH,MAA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