agent-recall-core 3.4.40 → 3.4.42

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 (72) hide show
  1. package/dist/helpers/auto-name.d.ts +2 -1
  2. package/dist/helpers/auto-name.d.ts.map +1 -1
  3. package/dist/helpers/auto-name.js +45 -6
  4. package/dist/helpers/auto-name.js.map +1 -1
  5. package/dist/helpers/journal-sig-theme.d.ts +18 -0
  6. package/dist/helpers/journal-sig-theme.d.ts.map +1 -1
  7. package/dist/helpers/journal-sig-theme.js +6 -1
  8. package/dist/helpers/journal-sig-theme.js.map +1 -1
  9. package/dist/index.d.ts +11 -0
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +12 -0
  12. package/dist/index.js.map +1 -1
  13. package/dist/storage/extraction.d.ts +136 -0
  14. package/dist/storage/extraction.d.ts.map +1 -0
  15. package/dist/storage/extraction.js +368 -0
  16. package/dist/storage/extraction.js.map +1 -0
  17. package/dist/storage/fs-utils.d.ts +21 -0
  18. package/dist/storage/fs-utils.d.ts.map +1 -1
  19. package/dist/storage/fs-utils.js +86 -0
  20. package/dist/storage/fs-utils.js.map +1 -1
  21. package/dist/storage/hook-health.d.ts +50 -0
  22. package/dist/storage/hook-health.d.ts.map +1 -0
  23. package/dist/storage/hook-health.js +183 -0
  24. package/dist/storage/hook-health.js.map +1 -0
  25. package/dist/storage/paths.d.ts +23 -4
  26. package/dist/storage/paths.d.ts.map +1 -1
  27. package/dist/storage/paths.js +26 -9
  28. package/dist/storage/paths.js.map +1 -1
  29. package/dist/storage/recency-index.d.ts +79 -0
  30. package/dist/storage/recency-index.d.ts.map +1 -0
  31. package/dist/storage/recency-index.js +204 -0
  32. package/dist/storage/recency-index.js.map +1 -0
  33. package/dist/storage/session-card.d.ts +74 -0
  34. package/dist/storage/session-card.d.ts.map +1 -0
  35. package/dist/storage/session-card.js +219 -0
  36. package/dist/storage/session-card.js.map +1 -0
  37. package/dist/storage/working-memory.d.ts +193 -0
  38. package/dist/storage/working-memory.d.ts.map +1 -0
  39. package/dist/storage/working-memory.js +328 -0
  40. package/dist/storage/working-memory.js.map +1 -0
  41. package/dist/supabase/recall-backend.d.ts +1 -1
  42. package/dist/supabase/recall-backend.d.ts.map +1 -1
  43. package/dist/supabase/recall-backend.js.map +1 -1
  44. package/dist/supabase/sync.d.ts.map +1 -1
  45. package/dist/supabase/sync.js +13 -2
  46. package/dist/supabase/sync.js.map +1 -1
  47. package/dist/tools-logic/drill-down.d.ts +9 -2
  48. package/dist/tools-logic/drill-down.d.ts.map +1 -1
  49. package/dist/tools-logic/drill-down.js +32 -1
  50. package/dist/tools-logic/drill-down.js.map +1 -1
  51. package/dist/tools-logic/journal-search.d.ts.map +1 -1
  52. package/dist/tools-logic/journal-search.js +7 -1
  53. package/dist/tools-logic/journal-search.js.map +1 -1
  54. package/dist/tools-logic/resurrect.d.ts +113 -0
  55. package/dist/tools-logic/resurrect.d.ts.map +1 -0
  56. package/dist/tools-logic/resurrect.js +602 -0
  57. package/dist/tools-logic/resurrect.js.map +1 -0
  58. package/dist/tools-logic/session-start-lite.d.ts +6 -0
  59. package/dist/tools-logic/session-start-lite.d.ts.map +1 -1
  60. package/dist/tools-logic/session-start-lite.js +15 -0
  61. package/dist/tools-logic/session-start-lite.js.map +1 -1
  62. package/dist/tools-logic/session-start.d.ts +29 -0
  63. package/dist/tools-logic/session-start.d.ts.map +1 -1
  64. package/dist/tools-logic/session-start.js +97 -2
  65. package/dist/tools-logic/session-start.js.map +1 -1
  66. package/dist/tools-logic/smart-recall.d.ts +9 -4
  67. package/dist/tools-logic/smart-recall.d.ts.map +1 -1
  68. package/dist/tools-logic/smart-recall.js +170 -4
  69. package/dist/tools-logic/smart-recall.js.map +1 -1
  70. package/dist/types.d.ts +1 -1
  71. package/dist/types.js +1 -1
  72. package/package.json +1 -1
@@ -0,0 +1,113 @@
1
+ /**
2
+ * resurrect.ts — F6, read-only cross-slug dead-session finder (continuity
3
+ * wave, 2026-07-31).
4
+ *
5
+ * WHY: this encodes the incident-recovery forensics from
6
+ * reports/2026-07-31-continuity-fixture.md as a function. A session that hit
7
+ * F4's gap (no `ar capture` that day → only journal/archive/raw/ + a no-op
8
+ * consolidation job) is otherwise unrecoverable except by hand-grepping raw
9
+ * dumps and cross-checking the palace/insight graph, exactly as that fixture
10
+ * had to do. `resurrect()` scans every project's raw archive + session cards
11
+ * + the cross-project recency index and ranks candidates by recency and
12
+ * (when a query is given) keyword match, so a "how much can you recall on
13
+ * X?" moment can be answered mechanically instead of by manual forensics.
14
+ *
15
+ * Sources (read-only — this module never writes to the store):
16
+ * - <root>/recent-sessions.jsonl (F2, optional — may not exist yet)
17
+ * - <root>/projects/<slug>/journal/archive/raw/*.md (lossless verbatim tier)
18
+ * - <root>/projects/<slug>/journal/*--card--*.md (F3 mechanical session card)
19
+ * - <root>/working-memory/*.jsonl (v3.4.42 working-memory wave — LIVE,
20
+ * not-yet-ended sessions; the FRESHEST possible source, since a file
21
+ * here means the session is still running, or crashed with no hook-end
22
+ * at all yet, RIGHT NOW)
23
+ * All four are merged by (slug, sid) — the SAME session recorded via
24
+ * multiple tiers becomes ONE ContinuityBrief with fields backfilled from
25
+ * whichever source has them, cards preferred over raw for title/goal since
26
+ * they are the higher-fidelity, already-distilled tier. A live WM entry's
27
+ * `provenance` carries the literal marker `[working-memory · live]` instead
28
+ * of a file path, so a caller can tell at a glance that a brief is backed by
29
+ * an in-progress session rather than a completed one.
30
+ *
31
+ * Precision note (fixture report §2): naive path/Linear-ID regexes over raw
32
+ * transcript text are exactly what misled the incident's own forensics —
33
+ * hook-injected boilerplate (folder-lint warnings, orchestrator briefs) can
34
+ * contain plausible-looking file paths and ticket IDs unrelated to the
35
+ * session's real content.
36
+ *
37
+ * fix2 (2026-07-31 — root-cause consolidation): artifact/Linear-ref/
38
+ * next-step extraction used to be a SEPARATE, lower-rigor reimplementation
39
+ * of the logic already fixed (M9's tool_result exclusion) in
40
+ * storage/session-card.ts — so that fix, and a markdown-heading exclusion,
41
+ * never reached this module's copies (verifier-report V3 + "additional
42
+ * findings" #3/#5). Extraction now lives in ONE place,
43
+ * `../storage/extraction.js`, consumed by BOTH this module and
44
+ * session-card.ts:
45
+ * - Source 2 (raw archive bodies) embeds near-verbatim JSONL transcript
46
+ * lines after a frontmatter block — exactly session-card.ts's rawHead/
47
+ * rawTail shape — so it is parsed via `parseJsonlLenient` and scanned
48
+ * with the SAME record-based, M9-protected extractors session-card.ts
49
+ * uses (`extractArtifactPathsFromRecords` / `extractLinearRefsFromRecords`).
50
+ * A tool_result-embedded ref genuinely cannot leak here anymore.
51
+ * - Source 3 (session-card markdown bodies) has no record structure to
52
+ * recover — it is the ALREADY-RENDERED OUTPUT of session-card.ts's own
53
+ * M9-protected extractors, so a raw tool_result JSON blob never appears
54
+ * in it to begin with; the text-level `extractArtifactPathsFromText` /
55
+ * `extractLinearRefsFromText` helpers are the right (and only sensible)
56
+ * tool there. This module still does NOT import session-card.ts's
57
+ * renderer itself (`buildSessionCard`/`writeSessionCard`) — cards are
58
+ * parsed generically via the documented on-disk shape (frontmatter keys
59
+ * `sid`/`date`/`slug`/`slug_confidence`/`source` per design §F3) so this
60
+ * stays buildable independent of W1's parallel work; only the shared
61
+ * extraction PRIMITIVES are imported, not the card build/write path.
62
+ *
63
+ * fix3 (2026-07-31 — round 2 of the same root-cause consolidation): fix2
64
+ * covered artifacts/Linear-refs/next-step-line-cosmetics; a real-store
65
+ * read-only acceptance run then found title/goalExcerpt AND the actual
66
+ * next-step VALUES for Source 2 were still derived by flat TEXT-level
67
+ * scanning of the raw JSONL body (a global `"text":"..."` regex for the
68
+ * goal; a per-line `NEXT_STEP_LINE_RE` grep over the whole raw body for
69
+ * next-steps) — the exact same class of bug fix2 fixed for artifacts/refs,
70
+ * just not yet extended to these two fields. Both now go through the SAME
71
+ * shared, record-based reduction session-card.ts uses for its own title
72
+ * fallback and finalAssistantText: `extractFirstUserTextFromRecords` (goal)
73
+ * and `extractLinesMatching` over `extractFinalRecordText(..., "assistant")`
74
+ * (next-steps) — see the Source 2 loop below for the full rationale and the
75
+ * "empty beats garbage" fallback rule this closes.
76
+ */
77
+ export interface ContinuityBrief {
78
+ slug: string;
79
+ sid: string;
80
+ /** YYYY-MM-DD, best available across sources; "unknown" if none parsed. */
81
+ date: string;
82
+ title: string;
83
+ goalExcerpt: string;
84
+ artifacts: string[];
85
+ linearRefs: string[];
86
+ nextSteps: string[];
87
+ /** Absolute source file paths (or the recency-index path) that contributed. */
88
+ provenance: string[];
89
+ /** Ranking score — exposed for debuggability/testing, not part of the spec shape. */
90
+ score: number;
91
+ }
92
+ export interface ResurrectInput {
93
+ /** Free-text query (any language). Omit/empty for pure-recency ranking. */
94
+ query?: string;
95
+ /** How many days back to scan. Default 14. */
96
+ days?: number;
97
+ /** Max briefs returned, sorted by score descending. Default 20. */
98
+ limit?: number;
99
+ }
100
+ /**
101
+ * Read-only cross-slug dead-session finder. Never throws: any per-file or
102
+ * per-project read failure is skipped, and an empty/missing store simply
103
+ * yields an empty array (never a crash — Worker Done-Definition error path).
104
+ */
105
+ export declare function resurrect(input?: ResurrectInput): ContinuityBrief[];
106
+ /**
107
+ * Markdown renderer for a list of ContinuityBriefs (CLI command wiring for
108
+ * `ar resurrect` is Wave-2's job — this is just the render function it will
109
+ * call). Never returns an empty string: an empty result set still renders a
110
+ * one-line "nothing found" message so a caller always has something to print.
111
+ */
112
+ export declare function renderResurrectMarkdown(briefs: ContinuityBrief[]): string;
113
+ //# sourceMappingURL=resurrect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resurrect.d.ts","sourceRoot":"","sources":["../../src/tools-logic/resurrect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2EG;AA0BH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,2EAA2E;IAC3E,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,+EAA+E;IAC/E,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,qFAAqF;IACrF,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,cAAc;IAC7B,2EAA2E;IAC3E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mEAAmE;IACnE,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AA+QD;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,GAAE,cAAmB,GAAG,eAAe,EAAE,CAwPvE;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,CA0BzE"}