greprag 5.47.0 → 5.49.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 (47) hide show
  1. package/dist/commands/assistant-reminder.d.ts +9 -0
  2. package/dist/commands/assistant-reminder.js +20 -0
  3. package/dist/commands/assistant-reminder.js.map +1 -0
  4. package/dist/commands/checkpoint-reminder.d.ts +14 -0
  5. package/dist/commands/checkpoint-reminder.js +50 -0
  6. package/dist/commands/checkpoint-reminder.js.map +1 -0
  7. package/dist/commands/crush.d.ts +9 -0
  8. package/dist/commands/crush.js +39 -0
  9. package/dist/commands/crush.js.map +1 -1
  10. package/dist/commands/frontdesk-reminder.d.ts +23 -0
  11. package/dist/commands/frontdesk-reminder.js +40 -0
  12. package/dist/commands/frontdesk-reminder.js.map +1 -0
  13. package/dist/commands/inbox-watch-supervisor.d.ts +25 -0
  14. package/dist/commands/inbox-watch-supervisor.js +112 -5
  15. package/dist/commands/inbox-watch-supervisor.js.map +1 -1
  16. package/dist/commands/init.js +47 -38
  17. package/dist/commands/init.js.map +1 -1
  18. package/dist/commands/memory-reflex.d.ts +115 -0
  19. package/dist/commands/memory-reflex.js +243 -0
  20. package/dist/commands/memory-reflex.js.map +1 -0
  21. package/dist/commands/opencode-relay.d.ts +19 -4
  22. package/dist/commands/opencode-relay.js +56 -5
  23. package/dist/commands/opencode-relay.js.map +1 -1
  24. package/dist/commands/reminder-registry.d.ts +6 -2
  25. package/dist/commands/reminder-registry.js +20 -3
  26. package/dist/commands/reminder-registry.js.map +1 -1
  27. package/dist/commands/reminder-types.d.ts +27 -0
  28. package/dist/commands/setup-reminder.d.ts +9 -0
  29. package/dist/commands/setup-reminder.js +20 -0
  30. package/dist/commands/setup-reminder.js.map +1 -0
  31. package/dist/commands/watcher-registry.js +4 -2
  32. package/dist/commands/watcher-registry.js.map +1 -1
  33. package/dist/hook.js +329 -109
  34. package/dist/hook.js.map +1 -1
  35. package/dist/index.js +4 -0
  36. package/dist/index.js.map +1 -1
  37. package/dist/opencode-plugin-crush.d.ts +88 -0
  38. package/dist/opencode-plugin-crush.js +193 -0
  39. package/dist/opencode-plugin-crush.js.map +1 -0
  40. package/dist/opencode-plugin.bundle.js +2132 -0
  41. package/dist/opencode-plugin.d.ts +6 -0
  42. package/dist/opencode-plugin.js +184 -51
  43. package/dist/opencode-plugin.js.map +1 -1
  44. package/dist/worktree-state.js +5 -5
  45. package/dist/worktree-state.js.map +1 -1
  46. package/package.json +3 -2
  47. package/scripts/bundle-opencode-plugin.mjs +54 -0
@@ -0,0 +1,9 @@
1
+ /** assistant-doctrine — the flagged-assistant-project doctrine auto-load as a
2
+ * reminder-interrupt module (docs/reminder-interrupt.md §Registry spec). announce-ONLY
3
+ * + pass-through: the doctrine text is PRECOMPUTED by the hook (buildAssistantDoctrineContext
4
+ * reads doctrine files — I/O that belongs in the hook). Fires ONLY for the assistant
5
+ * project — env.assistantDoctrine is null everywhere else, so a normal project sees
6
+ * nothing. adr: adr/assistant-role.md */
7
+ import { ReminderEnv, Detection, ReminderModule } from './reminder-types';
8
+ export declare function assistantDetect(env: ReminderEnv): Detection;
9
+ export declare const assistantDoctrineModule: ReminderModule;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ /** assistant-doctrine — the flagged-assistant-project doctrine auto-load as a
3
+ * reminder-interrupt module (docs/reminder-interrupt.md §Registry spec). announce-ONLY
4
+ * + pass-through: the doctrine text is PRECOMPUTED by the hook (buildAssistantDoctrineContext
5
+ * reads doctrine files — I/O that belongs in the hook). Fires ONLY for the assistant
6
+ * project — env.assistantDoctrine is null everywhere else, so a normal project sees
7
+ * nothing. adr: adr/assistant-role.md */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.assistantDoctrineModule = void 0;
10
+ exports.assistantDetect = assistantDetect;
11
+ function assistantDetect(env) {
12
+ return env.assistantDoctrine ? { tier: 'ambient' } : { tier: 'silent' };
13
+ }
14
+ exports.assistantDoctrineModule = {
15
+ id: 'assistant-doctrine',
16
+ detect: assistantDetect,
17
+ announce: (env) => env.assistantDoctrine ?? null,
18
+ reminder: () => null,
19
+ };
20
+ //# sourceMappingURL=assistant-reminder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assistant-reminder.js","sourceRoot":"","sources":["../../src/commands/assistant-reminder.ts"],"names":[],"mappings":";AAAA;;;;;0CAK0C;;;AAI1C,0CAEC;AAFD,SAAgB,eAAe,CAAC,GAAgB;IAC9C,OAAO,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AAC1E,CAAC;AAEY,QAAA,uBAAuB,GAAmB;IACrD,EAAE,EAAE,oBAAoB;IACxB,MAAM,EAAE,eAAe;IACvB,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,iBAAiB,IAAI,IAAI;IAChD,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI;CACrB,CAAC"}
@@ -0,0 +1,14 @@
1
+ /** checkpoint — the open-checkpoints SessionStart landmark as a reminder-interrupt
2
+ * module (docs/reminder-interrupt.md §Registry spec). announce-ONLY: checkpoints are
3
+ * operator-triggered landmarks surfaced once at session start, never per-turn traffic
4
+ * (reminder → null). `detect` gates on the hook-supplied list so the announce auto-
5
+ * silences when nothing is open. The PURE render (list → hint block) lives here — the
6
+ * hook owns only the fetch (I/O), keeping the module unit-testable. */
7
+ import { ReminderEnv, Detection, ReminderModule, OpenCheckpointSlim } from './reminder-types';
8
+ /** Format the open-checkpoints hint block: 3-most-recent rows + a single overflow line
9
+ * when there are more. Returns null on zero (the announce is then skipped). */
10
+ export declare function renderCheckpointHint(open: OpenCheckpointSlim[], projectName: string): string | null;
11
+ /** Open checkpoints present → ambient announce; none (or per-turn, where the list is
12
+ * absent) → silent. */
13
+ export declare function checkpointDetect(env: ReminderEnv): Detection;
14
+ export declare const checkpointModule: ReminderModule;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ /** checkpoint — the open-checkpoints SessionStart landmark as a reminder-interrupt
3
+ * module (docs/reminder-interrupt.md §Registry spec). announce-ONLY: checkpoints are
4
+ * operator-triggered landmarks surfaced once at session start, never per-turn traffic
5
+ * (reminder → null). `detect` gates on the hook-supplied list so the announce auto-
6
+ * silences when nothing is open. The PURE render (list → hint block) lives here — the
7
+ * hook owns only the fetch (I/O), keeping the module unit-testable. */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.checkpointModule = void 0;
10
+ exports.renderCheckpointHint = renderCheckpointHint;
11
+ exports.checkpointDetect = checkpointDetect;
12
+ /** Render a YYYY-MM-DD date in UTC for the session-start hint. */
13
+ function fmtCheckpointDate(iso) {
14
+ return iso.slice(0, 10);
15
+ }
16
+ /** Format the open-checkpoints hint block: 3-most-recent rows + a single overflow line
17
+ * when there are more. Returns null on zero (the announce is then skipped). */
18
+ function renderCheckpointHint(open, projectName) {
19
+ if (open.length === 0)
20
+ return null;
21
+ // Server returns DESC by created_at; take the 3 most recent.
22
+ const top = open.slice(0, 3);
23
+ const overflow = open.length - top.length;
24
+ const lines = [];
25
+ lines.push(`[${open.length} checkpoint${open.length === 1 ? '' : 's'} open in ${projectName}:`);
26
+ for (const cp of top) {
27
+ lines.push(` · ${cp.nodeId} ${cp.title} (since ${fmtCheckpointDate(cp.createdAt)})`);
28
+ }
29
+ if (overflow > 0) {
30
+ lines.push(` · ${overflow} more — greprag checkpoint list]`);
31
+ }
32
+ else {
33
+ lines.push(` View one: greprag checkpoint show <id>]`);
34
+ }
35
+ return lines.join('\n');
36
+ }
37
+ /** Open checkpoints present → ambient announce; none (or per-turn, where the list is
38
+ * absent) → silent. */
39
+ function checkpointDetect(env) {
40
+ return (env.openCheckpoints && env.openCheckpoints.length > 0)
41
+ ? { tier: 'ambient' }
42
+ : { tier: 'silent' };
43
+ }
44
+ exports.checkpointModule = {
45
+ id: 'checkpoint',
46
+ detect: checkpointDetect,
47
+ announce: (env) => renderCheckpointHint(env.openCheckpoints ?? [], env.projectName ?? ''),
48
+ reminder: () => null,
49
+ };
50
+ //# sourceMappingURL=checkpoint-reminder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkpoint-reminder.js","sourceRoot":"","sources":["../../src/commands/checkpoint-reminder.ts"],"names":[],"mappings":";AAAA;;;;;wEAKwE;;;AAWxE,oDAgBC;AAID,4CAIC;AA/BD,kEAAkE;AAClE,SAAS,iBAAiB,CAAC,GAAW;IACpC,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAC1B,CAAC;AAED;gFACgF;AAChF,SAAgB,oBAAoB,CAAC,IAA0B,EAAE,WAAmB;IAClF,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACnC,6DAA6D;IAC7D,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC7B,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;IAC1C,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,cAAc,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,YAAY,WAAW,GAAG,CAAC,CAAC;IAChG,KAAK,MAAM,EAAE,IAAI,GAAG,EAAE,CAAC;QACrB,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,MAAM,KAAK,EAAE,CAAC,KAAK,WAAW,iBAAiB,CAAC,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IACzF,CAAC;IACD,IAAI,QAAQ,GAAG,CAAC,EAAE,CAAC;QACjB,KAAK,CAAC,IAAI,CAAC,OAAO,QAAQ,kCAAkC,CAAC,CAAC;IAChE,CAAC;SAAM,CAAC;QACN,KAAK,CAAC,IAAI,CAAC,0CAA0C,CAAC,CAAC;IACzD,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED;wBACwB;AACxB,SAAgB,gBAAgB,CAAC,GAAgB;IAC/C,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,GAAG,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC;QAC5D,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE;QACrB,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AACzB,CAAC;AAEY,QAAA,gBAAgB,GAAmB;IAC9C,EAAE,EAAE,YAAY;IAChB,MAAM,EAAE,gBAAgB;IACxB,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,oBAAoB,CAAC,GAAG,CAAC,eAAe,IAAI,EAAE,EAAE,GAAG,CAAC,WAAW,IAAI,EAAE,CAAC;IACzF,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI;CACrB,CAAC"}
@@ -20,5 +20,14 @@
20
20
  export declare const CRUSH_HELP = "greprag crush \u2014 compress tool output before it reaches the model.\n\nUsage:\n <command> | greprag crush --type <log|search|json> [--ccr] [--query \"words\"] [--stats]\n greprag crush stats\n greprag retrieve <hash>\n\nReads stdin, writes the crushed version to stdout.\n\nFlags:\n --type <log|search|json> What the input is:\n log build/test output (pytest, npm, cargo, jest, make)\n search grep/ripgrep output (file:line:content)\n json JSON containing large arrays\n --ccr Stash the ORIGINAL in the local CCR store and append\n a trailing <<ccr:HASH>> marker. Recover the full\n output later with: greprag retrieve <hash>\n --query \"words\" Relevance hint \u2014 matches containing these words\n score higher and survive compression (search/json).\n --stats Append { ts, type, bytesIn, bytesOut } to the local\n stats log (~/.greprag/crush-stats.jsonl; override\n GREPRAG_CRUSH_STATS). Read it back with:\n greprag crush stats\n\nContract (safe inside pipes):\n - ALWAYS exits 0; on any internal error stdin passes through verbatim.\n - If compression wouldn't save tokens, the input passes through unchanged.\n - Small inputs (log/search < 500B, json < 1KB) pass through untouched.\n\nCCR store: ~/.greprag/ccr.db (override with GREPRAG_CCR_DB).\n\nExamples:\n npm test 2>&1 | greprag crush --type log --ccr\n rg -n \"handleSms\" | greprag crush --type search --query \"handleSms tenant\"\n curl -s api/items | greprag crush --type json";
21
21
  /** greprag crush — exit 0 always; on any failure stdin passes through. */
22
22
  export declare function runCrush(args: string[]): Promise<void>;
23
+ /** greprag ccr put --type <log|search|json> — internal: persist a raw original
24
+ * into the local CCR store (~/.greprag/ccr.db) and print its 16-hex marker
25
+ * hash. The opencode inline crusher (a Bun plugin sidecar) cannot load sql.js
26
+ * to write the store in-process, so it crushes IN-PROCESS and fires
27
+ * `greprag ccr put` to stash the byte-exact original; a later
28
+ * `greprag retrieve <hash>` recovers it. Reuses CcrStore.put, so the hash is
29
+ * sha256(original)[:16] — the SAME value the plugin computes for the marker.
30
+ * Exit 0 always; empty stdin is a no-op. */
31
+ export declare function runCcr(args: string[]): Promise<void>;
23
32
  /** greprag retrieve <hash> — print a CCR-stored original to stdout. */
24
33
  export declare function runRetrieve(args: string[]): Promise<void>;
@@ -22,6 +22,7 @@
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.CRUSH_HELP = void 0;
24
24
  exports.runCrush = runCrush;
25
+ exports.runCcr = runCcr;
25
26
  exports.runRetrieve = runRetrieve;
26
27
  const crush_1 = require("../crush");
27
28
  const ccr_store_1 = require("../ccr-store");
@@ -157,6 +158,44 @@ async function runCrush(args) {
157
158
  emit(original);
158
159
  }
159
160
  }
161
+ /** greprag ccr put --type <log|search|json> — internal: persist a raw original
162
+ * into the local CCR store (~/.greprag/ccr.db) and print its 16-hex marker
163
+ * hash. The opencode inline crusher (a Bun plugin sidecar) cannot load sql.js
164
+ * to write the store in-process, so it crushes IN-PROCESS and fires
165
+ * `greprag ccr put` to stash the byte-exact original; a later
166
+ * `greprag retrieve <hash>` recovers it. Reuses CcrStore.put, so the hash is
167
+ * sha256(original)[:16] — the SAME value the plugin computes for the marker.
168
+ * Exit 0 always; empty stdin is a no-op. */
169
+ async function runCcr(args) {
170
+ const sub = args[0];
171
+ if (sub !== 'put' || args.includes('--help') || args.includes('-h')) {
172
+ console.log('greprag ccr put --type <log|search|json>\n' +
173
+ ' Read stdin, stash it byte-exact in the CCR store, print the 16-hex hash.\n' +
174
+ ' Recover later with: greprag retrieve <hash>');
175
+ if (sub !== 'put')
176
+ process.exitCode = 1;
177
+ return;
178
+ }
179
+ const typeIdx = args.indexOf('--type');
180
+ const sourceType = typeIdx >= 0 ? args[typeIdx + 1] : undefined;
181
+ const original = await readStdin();
182
+ if (!original)
183
+ return; // nothing to stash
184
+ try {
185
+ const store = await ccr_store_1.CcrStore.open();
186
+ try {
187
+ const hash = store.put(original, sourceType);
188
+ process.stdout.write(hash + '\n');
189
+ }
190
+ finally {
191
+ store.close();
192
+ }
193
+ }
194
+ catch (err) {
195
+ // Best-effort persistence — never throw out of a fire-and-forget caller.
196
+ console.error(`[greprag ccr put] ${err instanceof Error ? err.message : String(err)}`);
197
+ }
198
+ }
160
199
  /** greprag retrieve <hash> — print a CCR-stored original to stdout. */
161
200
  async function runRetrieve(args) {
162
201
  const arg = args.find((a) => !a.startsWith('--'));
@@ -1 +1 @@
1
- {"version":3,"file":"crush.js","sourceRoot":"","sources":["../../src/commands/crush.ts"],"names":[],"mappings":";AAAA,2BAA2B;AAC3B;;;;;;;;;;;;;;;;;;GAkBG;;;AAyFH,4BAyDC;AAGD,kCAmBC;AAtKD,oCAAyF;AACzF,4CAAmD;AACnD,+CAAgD;AAEnC,QAAA,UAAU,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gDAkCsB,CAAC;AAEjD,kEAAkE;AAClE,MAAM,SAAS,GAA2B,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AAEhF,SAAS,SAAS;IAChB,OAAO,I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AAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3D,OAAO,CAAC,GAAG,CAAC,kBAAU,CAAC,CAAC;QACxB,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;YAAE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACnF,OAAO;IACT,CAAC;IACD,MAAM,KAAK,GAAG,MAAM,oBAAQ,CAAC,IAAI,EAAE,CAAC;IACpC,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC/B,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;YACrB,OAAO,CAAC,KAAK,CAAC,wCAAwC,GAAG,GAAG,CAAC,CAAC;YAC9D,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;YACrB,OAAO;QACT,CAAC;QACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;YAAS,CAAC;QACT,KAAK,CAAC,KAAK,EAAE,CAAC;IAChB,CAAC;AACH,CAAC"}
@@ -0,0 +1,23 @@
1
+ /** front-desk — the shared tenant front-desk mailbox as a reminder-interrupt module
2
+ * (docs/reminder-interrupt.md §Registry spec). The module that uses BOTH halves of the
3
+ * pair: a SessionStart `announce` (discreet count of cold opens + inbound email waiting
4
+ * at the shared desk) AND a per-turn `reminder` (envelope-only "you've got mail from X"
5
+ * notice). This is the "announce + reminder often utilize each other" case the registry
6
+ * was consolidated for — one module, one mailbox, two surfaces.
7
+ *
8
+ * PURE: the hook owns the count fetch (frontDeskUnread) AND the notice's network + per-
9
+ * machine dedup (frontDeskNotice), passing both via env; the module only formats the
10
+ * count and routes the precomputed notice.
11
+ *
12
+ * Privacy — front-desk is the SHARED tenant mailbox (cold opens + inbound email addressed
13
+ * to nobody's session), so its count leaks nothing private. This is NOT the v5.6.1
14
+ * project-wide eavesdrop vector that betrayed a sibling session's session-targeted DMs.
15
+ * adr: adr/address-grammar.md (2026-06-10), docs/front-desk-switchboard.md §5 */
16
+ import { ReminderEnv, Detection, ReminderModule } from './reminder-types';
17
+ /** SessionStart count hint — the discreet door (count + how to read), never content.
18
+ * Null at zero so the announce is skipped. */
19
+ export declare function buildFrontDeskAnnounce(unread: number): string | null;
20
+ /** Either surface has something → ambient (soft, never a forced-decision directive); else
21
+ * silent. SessionStart sets frontDeskUnread; per-turn sets frontDeskNotice. */
22
+ export declare function frontDeskDetect(env: ReminderEnv): Detection;
23
+ export declare const frontDeskModule: ReminderModule;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ /** front-desk — the shared tenant front-desk mailbox as a reminder-interrupt module
3
+ * (docs/reminder-interrupt.md §Registry spec). The module that uses BOTH halves of the
4
+ * pair: a SessionStart `announce` (discreet count of cold opens + inbound email waiting
5
+ * at the shared desk) AND a per-turn `reminder` (envelope-only "you've got mail from X"
6
+ * notice). This is the "announce + reminder often utilize each other" case the registry
7
+ * was consolidated for — one module, one mailbox, two surfaces.
8
+ *
9
+ * PURE: the hook owns the count fetch (frontDeskUnread) AND the notice's network + per-
10
+ * machine dedup (frontDeskNotice), passing both via env; the module only formats the
11
+ * count and routes the precomputed notice.
12
+ *
13
+ * Privacy — front-desk is the SHARED tenant mailbox (cold opens + inbound email addressed
14
+ * to nobody's session), so its count leaks nothing private. This is NOT the v5.6.1
15
+ * project-wide eavesdrop vector that betrayed a sibling session's session-targeted DMs.
16
+ * adr: adr/address-grammar.md (2026-06-10), docs/front-desk-switchboard.md §5 */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.frontDeskModule = void 0;
19
+ exports.buildFrontDeskAnnounce = buildFrontDeskAnnounce;
20
+ exports.frontDeskDetect = frontDeskDetect;
21
+ /** SessionStart count hint — the discreet door (count + how to read), never content.
22
+ * Null at zero so the announce is skipped. */
23
+ function buildFrontDeskAnnounce(unread) {
24
+ if (!unread || unread <= 0)
25
+ return null;
26
+ return `[📬 ${unread} message${unread === 1 ? '' : 's'} at the front desk — \`greprag inbox --front-desk\` to read]`;
27
+ }
28
+ /** Either surface has something → ambient (soft, never a forced-decision directive); else
29
+ * silent. SessionStart sets frontDeskUnread; per-turn sets frontDeskNotice. */
30
+ function frontDeskDetect(env) {
31
+ const unread = env.frontDeskUnread ?? 0;
32
+ return (unread > 0 || env.frontDeskNotice) ? { tier: 'ambient' } : { tier: 'silent' };
33
+ }
34
+ exports.frontDeskModule = {
35
+ id: 'front-desk',
36
+ detect: frontDeskDetect,
37
+ announce: (env) => buildFrontDeskAnnounce(env.frontDeskUnread ?? 0),
38
+ reminder: (_d, env) => env.frontDeskNotice ?? null,
39
+ };
40
+ //# sourceMappingURL=frontdesk-reminder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frontdesk-reminder.js","sourceRoot":"","sources":["../../src/commands/frontdesk-reminder.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAMlF,wDAGC;AAID,0CAGC;AAZD;+CAC+C;AAC/C,SAAgB,sBAAsB,CAAC,MAAc;IACnD,IAAI,CAAC,MAAM,IAAI,MAAM,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACxC,OAAO,OAAO,MAAM,WAAW,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,8DAA8D,CAAC;AACvH,CAAC;AAED;gFACgF;AAChF,SAAgB,eAAe,CAAC,GAAgB;IAC9C,MAAM,MAAM,GAAG,GAAG,CAAC,eAAe,IAAI,CAAC,CAAC;IACxC,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AACxF,CAAC;AAEY,QAAA,eAAe,GAAmB;IAC7C,EAAE,EAAE,YAAY;IAChB,MAAM,EAAE,eAAe;IACvB,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,sBAAsB,CAAC,GAAG,CAAC,eAAe,IAAI,CAAC,CAAC;IACnE,QAAQ,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,eAAe,IAAI,IAAI;CACnD,CAAC"}
@@ -35,7 +35,32 @@ export declare const FATAL_EXIT_CODE = 64;
35
35
  * so it respawns; SIGINT/SIGTERM skip these and return via the
36
36
  * normal abort path. */
37
37
  export declare function installLastResortHandlers(): void;
38
+ type ChildExit = {
39
+ code: number | null;
40
+ signal: NodeJS.Signals | null;
41
+ err: Error | null;
42
+ };
43
+ /** Human-readable cause for a child death + whether it was an OS-level native
44
+ * crash. Turns "exit 3221226091" into "native crash 0xC000026B (DLL init failed —
45
+ * out of commit memory / window station gone)" so both the respawn log and the
46
+ * stand-down diagnostic are actionable instead of opaque digits. */
47
+ export declare function describeChildExit(exit: ChildExit): {
48
+ reason: string;
49
+ native: boolean;
50
+ };
51
+ /** Pure crash-loop decision (testable, mirrors capSurplusVerdict/gcVerdict).
52
+ * Given how long the just-exited child lived (`liveMs`) and the running
53
+ * fast-death `streak`, return the updated streak and whether the supervisor
54
+ * should STAND DOWN instead of respawning. A child that lived at least
55
+ * `lifetimeMs` did real work → streak resets to 0. Otherwise the streak grows
56
+ * and trips once it reaches `maxDeaths`. This is the whole breaker rule — no
57
+ * process state, just a count + a lifetime floor. */
58
+ export declare function crashLoopVerdict(liveMs: number, streak: number, lifetimeMs: number, maxDeaths: number): {
59
+ streak: number;
60
+ standDown: boolean;
61
+ };
38
62
  /** Parent supervisor. Spawns the watch loop as a Node child, forwards
39
63
  * stdio so Monitor sees each printed line as a notification verbatim,
40
64
  * and respawns on any non-clean exit. */
41
65
  export declare function runSupervisor(): Promise<void>;
66
+ export {};
@@ -29,6 +29,8 @@
29
29
  Object.defineProperty(exports, "__esModule", { value: true });
30
30
  exports.FATAL_EXIT_CODE = exports.SUPERVISE_ENV = void 0;
31
31
  exports.installLastResortHandlers = installLastResortHandlers;
32
+ exports.describeChildExit = describeChildExit;
33
+ exports.crashLoopVerdict = crashLoopVerdict;
32
34
  exports.runSupervisor = runSupervisor;
33
35
  const child_process_1 = require("child_process");
34
36
  const inbox_watch_1 = require("./inbox-watch");
@@ -67,6 +69,29 @@ const SUPERVISOR_BACKOFF_FACTOR = 2;
67
69
  // 60s of uninterrupted child life resets the backoff so a long-lived
68
70
  // child that finally dies retries fast, not slowly.
69
71
  const SUPERVISOR_HEALTHY_RESET_MS = 60_000;
72
+ // ---- Crash-loop circuit breaker ------------------------------------------
73
+ // A child that dies almost immediately, over and over, is NOT a transient
74
+ // network blip (the inner SSE loop absorbs those without ever exiting) — it is a
75
+ // child that CANNOT STAY UP. The two field-observed shapes:
76
+ // * an OS-level native death BEFORE any JS runs — e.g. exit 0xC000026B
77
+ // (STATUS_DLL_INIT_FAILED): the loader could not commit memory to map node's
78
+ // DLLs. This appears when the system is out of *commit charge* (RAM + a
79
+ // hard-capped page file), even with physical RAM free. Nothing the child can
80
+ // catch — it never reaches main(). See docs/session-heap-ceiling.md.
81
+ // * a JS throw before the SSE connects — handled into a fast exit 2 by the
82
+ // last-resort handlers, but still a child that never does useful work.
83
+ // Respawning either forever (the pre-fix behaviour — backoff merely capped at
84
+ // 30s, loop never terminating) achieves nothing, churns the very commit charge
85
+ // that is exhausted, floods Monitor with respawn notifications (which grows the
86
+ // consuming session's heap — the same exhaustion, fed), and buries the real
87
+ // cause under an endless "child died — respawning" wall. So: count consecutive
88
+ // FAST abnormal deaths; after CRASH_LOOP_MAX of them, STAND DOWN loudly and let
89
+ // the next-turn arm reminder re-arm once the machine recovers. A child that
90
+ // lives at least CRASH_LOOP_LIFETIME_MS did real work and clears the counter.
91
+ // This is the root-cause repair of "a respawn-on-crash supervisor masking a
92
+ // crashing child." adr: adr/monitor-resilience.md
93
+ const CRASH_LOOP_LIFETIME_MS = 10_000;
94
+ const CRASH_LOOP_MAX = 5;
70
95
  // Exit code the child uses for "fatal, do not respawn" conditions —
71
96
  // 4xx HTTP responses, missing API key, missing anchor. Anything else
72
97
  // (signal, code 1, code 2, exception) is a crash and gets respawned.
@@ -116,6 +141,66 @@ function ownerPidFromArgv(argv) {
116
141
  }
117
142
  return undefined;
118
143
  }
144
+ /** True iff `code` is a Windows native (NTSTATUS) crash, NOT a normal JS-level
145
+ * exit. The error-severity NTSTATUS range (>= 0xC0000000 — access violation, DLL
146
+ * init failed, stack overflow…) and the 0x4001000x debug-terminate family
147
+ * (external TerminateProcess / console kill) both mean the process died BELOW the
148
+ * JS runtime. The child's try/catch and last-resort handlers cannot turn these
149
+ * into a clean exit — they fire only once main() is running; a loader failure or
150
+ * an uncatchable TerminateProcess never gets there. That is precisely why the
151
+ * meaningful repair lives here in the supervisor, not in the child. */
152
+ function isNativeCrashCode(code) {
153
+ if (code === null)
154
+ return false;
155
+ const u = code >>> 0;
156
+ return u >= 0xc0000000 || (u & 0xffff0000) === 0x40010000;
157
+ }
158
+ /** Human-readable cause for a child death + whether it was an OS-level native
159
+ * crash. Turns "exit 3221226091" into "native crash 0xC000026B (DLL init failed —
160
+ * out of commit memory / window station gone)" so both the respawn log and the
161
+ * stand-down diagnostic are actionable instead of opaque digits. */
162
+ function describeChildExit(exit) {
163
+ if (exit.err)
164
+ return { reason: `spawn error: ${exit.err.message}`, native: false };
165
+ if (exit.signal)
166
+ return { reason: `signal ${exit.signal}`, native: false };
167
+ const code = exit.code;
168
+ if (code === null)
169
+ return { reason: 'unknown exit', native: false };
170
+ if (!isNativeCrashCode(code)) {
171
+ // 129..255 is the signal-as-exit-code convention Node uses on Windows when a
172
+ // kill arrives as a code rather than a signal (e.g. 143 = 128 + SIGTERM).
173
+ if (code > 128 && code < 256) {
174
+ return { reason: `killed (exit ${code} = signal ${code - 128})`, native: false };
175
+ }
176
+ return { reason: `exit ${code}`, native: false };
177
+ }
178
+ const u = code >>> 0;
179
+ const hex = '0x' + u.toString(16).toUpperCase().padStart(8, '0');
180
+ const KNOWN = {
181
+ 0xc000026b: 'DLL init failed — out of commit memory / window station gone',
182
+ 0xc0000005: 'access violation',
183
+ 0xc00000fd: 'stack overflow',
184
+ 0xc000013a: 'Ctrl-C / console close',
185
+ 0x40010004: 'terminated (external TerminateProcess / OS kill)',
186
+ 0x40010005: 'Ctrl-C (debugger)',
187
+ };
188
+ const note = KNOWN[u] ? ` (${KNOWN[u]})` : '';
189
+ return { reason: `native crash ${hex}${note}`, native: true };
190
+ }
191
+ /** Pure crash-loop decision (testable, mirrors capSurplusVerdict/gcVerdict).
192
+ * Given how long the just-exited child lived (`liveMs`) and the running
193
+ * fast-death `streak`, return the updated streak and whether the supervisor
194
+ * should STAND DOWN instead of respawning. A child that lived at least
195
+ * `lifetimeMs` did real work → streak resets to 0. Otherwise the streak grows
196
+ * and trips once it reaches `maxDeaths`. This is the whole breaker rule — no
197
+ * process state, just a count + a lifetime floor. */
198
+ function crashLoopVerdict(liveMs, streak, lifetimeMs, maxDeaths) {
199
+ if (liveMs >= lifetimeMs)
200
+ return { streak: 0, standDown: false };
201
+ const next = streak + 1;
202
+ return { streak: next, standDown: next >= maxDeaths };
203
+ }
119
204
  /** Fire one short, best-effort liveness request. Never throws; never blocks
120
205
  * longer than `timeoutMs` (so a dead network can't hang the heartbeat or stall
121
206
  * exit). adr: docs/registry-freshness-design.md */
@@ -147,6 +232,10 @@ function deregisterUrl(apiUrl, session) {
147
232
  * and respawns on any non-clean exit. */
148
233
  async function runSupervisor() {
149
234
  let backoff = SUPERVISOR_BACKOFF_INITIAL_MS;
235
+ // Crash-loop breaker state: how many times in a row the child died FAST
236
+ // (lived < CRASH_LOOP_LIFETIME_MS). Reset whenever a child survives long
237
+ // enough to have done real work. See the constants block above.
238
+ let consecutiveFastDeaths = 0;
150
239
  let shutdownRequested = false;
151
240
  let currentChild = null;
152
241
  // Forward terminal-style signals to the child so Ctrl-C or TaskStop
@@ -299,11 +388,29 @@ async function runSupervisor() {
299
388
  }
300
389
  if (liveMs >= SUPERVISOR_HEALTHY_RESET_MS)
301
390
  backoff = SUPERVISOR_BACKOFF_INITIAL_MS;
302
- const reason = exit.err
303
- ? `spawn error: ${exit.err.message}`
304
- : exit.signal
305
- ? `signal ${exit.signal}`
306
- : `exit ${exit.code}`;
391
+ const { reason, native } = describeChildExit(exit);
392
+ // Crash-loop circuit breaker. A child that lived at least
393
+ // CRASH_LOOP_LIFETIME_MS did real work → streak resets and we respawn as
394
+ // normal. Otherwise it is failing to stay up; the streak grows, and once it
395
+ // reaches CRASH_LOOP_MAX we STAND DOWN instead of respawning into the same
396
+ // wall forever. This is the masking smell this fix removes: a child that
397
+ // cannot start (native loader crash) or throws at startup must surface, not
398
+ // be hidden behind an endless respawn.
399
+ const breaker = crashLoopVerdict(liveMs, consecutiveFastDeaths, CRASH_LOOP_LIFETIME_MS, CRASH_LOOP_MAX);
400
+ consecutiveFastDeaths = breaker.streak;
401
+ if (breaker.standDown) {
402
+ const hint = native
403
+ ? `the child is dying at the OS level (${reason}) before it can run — characteristic of system commit-charge / page-file exhaustion (NOT physical RAM; see docs/session-heap-ceiling.md). Standing down so we stop feeding the exhaustion; the next-turn arm reminder retries once the machine recovers.`
404
+ : `the child cannot stay up (${reason}). Run \`greprag inbox watch --no-supervise\` to see the underlying error. Standing down to avoid a respawn storm.`;
405
+ console.error(`${LOG_PREFIX} supervisor: child crash-looped ${consecutiveFastDeaths}× (each < ${(0, inbox_watch_1.fmtDuration)(CRASH_LOOP_LIFETIME_MS)}) — ${hint}`);
406
+ (0, watcher_registry_1.watcherAuditLog)(`crash-loop session=${session ?? 'tenant'} deaths=${consecutiveFastDeaths} last=${reason}`);
407
+ terminalReason = `crash-loop-standdown (${reason})`;
408
+ // Exit FATAL (64) so the bash relauncher BREAKs rather than relaunching us
409
+ // into the same storm one level up; re-arm on a later turn is the recovery
410
+ // path. adr: adr/monitor-resilience.md
411
+ process.exitCode = exports.FATAL_EXIT_CODE;
412
+ break;
413
+ }
307
414
  console.error(`${LOG_PREFIX} supervisor: child died (${reason}) after ${(0, inbox_watch_1.fmtDuration)(liveMs)} — respawning in ${(0, inbox_watch_1.fmtDuration)(backoff)}`);
308
415
  await sleepUntilOrShutdown(backoff, () => shutdownRequested);
309
416
  backoff = Math.min(backoff * SUPERVISOR_BACKOFF_FACTOR, SUPERVISOR_BACKOFF_MAX_MS);
@@ -1 +1 @@
1
- {"version":3,"file":"inbox-watch-supervisor.js","sourceRoot":"","sources":["../../src/commands/inbox-watch-supervisor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;qCA0BqC;;;AA0DrC,8DAWC;AA0DD,sCAoLC;AAjTD,iDAAoD;AACpD,+CAAgF;AAChF,yDAA8G;AAE9G,MAAM,UAAU,GAAG,uBAAuB,CAAC;AAE3C,6EAA6E;AAC7E,yCAAyC;AACzC,EAAE;AACF,gFAAgF;AAChF,+EAA+E;AAC/E,WAAW;AACX,4EAA4E;AAC5E,8EAA8E;AAC9E,iFAAiF;AACjF,oEAAoE;AACpE,4EAA4E;AAC5E,6EAA6E;AAC7E,+EAA+E;AAC/E,8EAA8E;AAC9E,6CAA6C;AAE7C,gFAAgF;AAChF,oBAAoB;AACpB,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AACpC,6EAA6E;AAC7E,MAAM,qBAAqB,GAAG,KAAK,CAAC;AACpC,MAAM,kBAAkB,GAAG,KAAK,CAAC;AAEjC,oEAAoE;AACpE,iEAAiE;AACjE,qCAAqC;AACxB,QAAA,aAAa,GAAG,qBAAqB,CAAC;AAEnD,2DAA2D;AAC3D,+DAA+D;AAC/D,MAAM,6BAA6B,GAAG,GAAG,CAAC;AAC1C,MAAM,yBAAyB,GAAG,MAAM,CAAC;AACzC,MAAM,yBAAyB,GAAG,CAAC,CAAC;AACpC,qEAAqE;AACrE,oDAAoD;AACpD,MAAM,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AAQ,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACzD,CAAC,CAAC;QACF,IAAI,EAAE,CAAC;IACT,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -429,60 +429,69 @@ async function runOpenCodeInit(opts) {
429
429
  catch {
430
430
  console.warn(' Inbox registration skipped (network)');
431
431
  }
432
- // Step 7: Install plugin to ~/.config/opencode/plugins/greprag-memory.js
433
- // adr: adr/opencode-monitor-relay.md (2026-06-06 (f))
434
- // The helpers file does NOT live in the opencode plugins dir — opencode
435
- // auto-loads every `.js` file in `~/.config/opencode/plugins/` as a
436
- // plugin, and the helpers file (a barrel of named function exports with
437
- // `__esModule: true` tsc marker) would trip the same `getLegacyPlugins`
438
- // shape check the main file used to. Helpers go to `~/.greprag/` and the
439
- // main plugin requires them by absolute path. Only the main file is
440
- // registered with opencode.
432
+ // Step 7: Install the opencode plugin as a SINGLE self-contained file.
433
+ // adr: adr/opencode-monitor-relay.md (2026-06-06 (f) + 2026-06-20 bundle entry)
434
+ // adr: adr/opencode-context-compressor.md (2026-06-20 bundle entry)
441
435
  //
442
- // The main plugin source uses `export = { id, server }` which tsc
443
- // compiles to `module.exports = { id, server }` with no `__esModule: true`
444
- // marker so the legacy plugin loader's `Object.values(mod)` sees
445
- // exactly one entry and registers the plugin. See ADR entry 2026-06-06
446
- // (f) for the full diagnosis.
436
+ // greprag-memory.js is an esbuild bundle (packages/cli/scripts/
437
+ // bundle-opencode-plugin.mjs) with helpers, proc (the windowsHide child_process
438
+ // wrapper), and the crush engine ALL inlined — zero sidecar requires. This
439
+ // kills the recurring "single-file plugin can't resolve its relative deps under
440
+ // opencode's Bun loader" trap: helpers → proc → crush were each required by
441
+ // absolute path from ~/.greprag/, and every new dep was a fresh chance to
442
+ // forget to deploy it (the ./proc and ./crush traps both shipped that way).
443
+ // opencode auto-loads every `.js` in ~/.config/opencode/plugins/ as a plugin,
444
+ // so ONLY this one bundled file goes there; nothing else is deployed.
445
+ //
446
+ // The bundle preserves the source's `export = { id, server }` as a clean
447
+ // `module.exports = { id, server }` with NO `__esModule` marker — exactly the
448
+ // shape opencode's `await import()` loader expects (mod.default === the V1
449
+ // plugin object). See ADR 2026-06-06 (f) for why the marker is fatal.
447
450
  const pluginDir = path.join(os.homedir(), '.config', 'opencode', 'plugins');
448
451
  const grepragHome = path.join(os.homedir(), '.greprag');
449
452
  const pluginMain = path.join(pluginDir, 'greprag-memory.js');
450
- const helpersDest = path.join(grepragHome, 'opencode-plugin-helpers.js');
451
- const pluginMainSrc = path.join(__dirname, '../opencode-plugin.js');
452
- const helpersSrc = path.join(__dirname, '../opencode-plugin-helpers.js');
453
+ const bundleSrc = path.join(__dirname, '../opencode-plugin.bundle.js');
453
454
  let pluginInstalled = false;
454
- if (fs.existsSync(pluginMainSrc)) {
455
+ if (fs.existsSync(bundleSrc)) {
455
456
  if (!fs.existsSync(pluginDir))
456
457
  fs.mkdirSync(pluginDir, { recursive: true });
457
- if (!fs.existsSync(grepragHome))
458
- fs.mkdirSync(grepragHome, { recursive: true });
459
- if (!fs.existsSync(helpersSrc)) {
460
- console.warn(` Helpers artifact missing: ${helpersSrc} run \`npm run build\` in packages/cli and retry`);
458
+ fs.copyFileSync(bundleSrc, pluginMain);
459
+ // Stale cleanup, best-effort:
460
+ // (1) Prior deploys (commit 5d1a384) installed the helpers INSIDE the
461
+ // plugins dir, where opencode auto-loads it and the loader's shape
462
+ // check throws "Plugin export is not a function".
463
+ // (2) The pre-bundle deploy (≤ v5.48) left helpers/proc/crush sidecars in
464
+ // ~/.greprag/; the self-contained bundle no longer reads them, so they
465
+ // are dead weight. Remove both classes of orphan.
466
+ const staleInPlugins = path.join(pluginDir, 'opencode-plugin-helpers.js');
467
+ if (fs.existsSync(staleInPlugins)) {
468
+ try {
469
+ fs.unlinkSync(staleInPlugins);
470
+ console.log(` Removed stale plugin: ${staleInPlugins}`);
471
+ }
472
+ catch { }
461
473
  }
462
- else {
463
- fs.copyFileSync(helpersSrc, helpersDest);
474
+ for (const orphan of ['opencode-plugin-helpers.js', 'opencode-plugin-proc.js', 'opencode-plugin-crush.js']) {
475
+ const p = path.join(grepragHome, orphan);
476
+ if (fs.existsSync(p)) {
477
+ try {
478
+ fs.unlinkSync(p);
479
+ }
480
+ catch { }
481
+ }
464
482
  }
465
- fs.copyFileSync(pluginMainSrc, pluginMain);
466
- // Stale cleanup: prior deploys (commit 5d1a384, 2026-06-06) installed
467
- // the helpers as `opencode-plugin-helpers.js` INSIDE the plugins dir.
468
- // opencode auto-loads every `.js` there as a plugin, and the helpers
469
- // file is a barrel of function exports with `__esModule: true` — it
470
- // trips the loader's shape check and logs "Plugin export is not a
471
- // function". It's stale now that the helpers live in ~/.greprag/.
472
- const staleHelpers = path.join(pluginDir, 'opencode-plugin-helpers.js');
473
- if (fs.existsSync(staleHelpers)) {
483
+ const orphanCrushDir = path.join(grepragHome, 'crush');
484
+ if (fs.existsSync(orphanCrushDir)) {
474
485
  try {
475
- fs.unlinkSync(staleHelpers);
476
- console.log(` Removed stale plugin: ${staleHelpers}`);
486
+ fs.rmSync(orphanCrushDir, { recursive: true, force: true });
477
487
  }
478
488
  catch { }
479
489
  }
480
- console.log(` Plugin installed: ${pluginMain}`);
481
- console.log(` Helpers installed: ${helpersDest}`);
490
+ console.log(` Plugin installed (self-contained bundle): ${pluginMain}`);
482
491
  pluginInstalled = true;
483
492
  }
484
493
  else {
485
- console.warn(' Plugin source not found (build issue) — run `npm run build` in packages/cli and retry');
494
+ console.warn(' Plugin bundle not found (build issue) — run `npm run build` in packages/cli and retry');
486
495
  }
487
496
  // Summary
488
497
  console.log('\n Setup complete!\n');