hippo-memory 1.52.8 → 1.53.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 (122) hide show
  1. package/README.md +185 -101
  2. package/dist/agent-memories/apply.d.ts +47 -0
  3. package/dist/agent-memories/apply.js +253 -0
  4. package/dist/agent-memories/claude-code.d.ts +11 -0
  5. package/dist/agent-memories/claude-code.js +113 -0
  6. package/dist/agent-memories/codex.d.ts +3 -0
  7. package/dist/agent-memories/codex.js +47 -0
  8. package/dist/agent-memories/copilot.d.ts +3 -0
  9. package/dist/agent-memories/copilot.js +125 -0
  10. package/dist/agent-memories/files.d.ts +37 -0
  11. package/dist/agent-memories/files.js +77 -0
  12. package/dist/agent-memories/folder-store.d.ts +17 -0
  13. package/dist/agent-memories/folder-store.js +44 -0
  14. package/dist/agent-memories/gemini.d.ts +3 -0
  15. package/dist/agent-memories/gemini.js +103 -0
  16. package/dist/agent-memories/git.d.ts +8 -0
  17. package/dist/agent-memories/git.js +11 -0
  18. package/dist/agent-memories/keys.d.ts +9 -0
  19. package/dist/agent-memories/keys.js +20 -0
  20. package/dist/agent-memories/legacy.d.ts +17 -0
  21. package/dist/agent-memories/legacy.js +45 -0
  22. package/dist/agent-memories/markdown.d.ts +13 -0
  23. package/dist/agent-memories/markdown.js +123 -0
  24. package/dist/agent-memories/openclaw.d.ts +3 -0
  25. package/dist/agent-memories/openclaw.js +42 -0
  26. package/dist/agent-memories/plan.d.ts +78 -0
  27. package/dist/agent-memories/plan.js +123 -0
  28. package/dist/agent-memories/qwen-code.d.ts +5 -0
  29. package/dist/agent-memories/qwen-code.js +50 -0
  30. package/dist/agent-memories/report.d.ts +52 -0
  31. package/dist/agent-memories/report.js +88 -0
  32. package/dist/agent-memories/source.d.ts +16 -0
  33. package/dist/agent-memories/source.js +32 -0
  34. package/dist/agent-memories/sync.d.ts +33 -0
  35. package/dist/agent-memories/sync.js +336 -0
  36. package/dist/agent-memories/tools.d.ts +33 -0
  37. package/dist/agent-memories/tools.js +19 -0
  38. package/dist/agent-memories/types.d.ts +42 -0
  39. package/dist/agent-memories/types.js +2 -0
  40. package/dist/api.d.ts +53 -20
  41. package/dist/api.js +141 -97
  42. package/dist/audit.d.ts +2 -1
  43. package/dist/audit.js +68 -2
  44. package/dist/capture.d.ts +48 -22
  45. package/dist/capture.js +186 -161
  46. package/dist/cli.d.ts +0 -2
  47. package/dist/cli.js +750 -797
  48. package/dist/codex-patch.d.ts +12 -0
  49. package/dist/codex-patch.js +71 -0
  50. package/dist/compaction-items.d.ts +18 -0
  51. package/dist/compaction-items.js +60 -0
  52. package/dist/compaction-record.d.ts +94 -0
  53. package/dist/compaction-record.js +546 -0
  54. package/dist/config.d.ts +4 -1
  55. package/dist/config.js +13 -4
  56. package/dist/connectors/slack/types.d.ts +0 -1
  57. package/dist/consolidate.js +87 -34
  58. package/dist/context-render.d.ts +36 -0
  59. package/dist/context-render.js +154 -0
  60. package/dist/dag.js +3 -2
  61. package/dist/db.d.ts +5 -1
  62. package/dist/db.js +46 -14
  63. package/dist/dedupe.d.ts +6 -6
  64. package/dist/dedupe.js +10 -9
  65. package/dist/doctor.d.ts +1 -1
  66. package/dist/doctor.js +69 -4
  67. package/dist/dormant.d.ts +9 -3
  68. package/dist/dormant.js +26 -2
  69. package/dist/embedding-provider.d.ts +2 -1
  70. package/dist/embedding-provider.js +2 -1
  71. package/dist/embeddings.js +23 -3
  72. package/dist/extract.js +5 -1
  73. package/dist/forward-claim-detector.d.ts +1 -1
  74. package/dist/forward-claim-detector.js +1 -1
  75. package/dist/gated-write.d.ts +9 -0
  76. package/dist/gated-write.js +24 -0
  77. package/dist/graph-recall.d.ts +3 -1
  78. package/dist/graph-recall.js +5 -3
  79. package/dist/hooks.d.ts +18 -2
  80. package/dist/hooks.js +128 -32
  81. package/dist/importers.js +5 -12
  82. package/dist/judgment.d.ts +30 -0
  83. package/dist/judgment.js +122 -0
  84. package/dist/mcp/server.js +171 -210
  85. package/dist/memory.d.ts +19 -2
  86. package/dist/memory.js +35 -3
  87. package/dist/merged-row.d.ts +6 -0
  88. package/dist/merged-row.js +35 -0
  89. package/dist/multihop.d.ts +2 -1
  90. package/dist/multihop.js +7 -4
  91. package/dist/physics-state.d.ts +0 -4
  92. package/dist/physics-state.js +0 -6
  93. package/dist/predictions.d.ts +2 -17
  94. package/dist/predictions.js +2 -15
  95. package/dist/reject-flow.d.ts +7 -5
  96. package/dist/reject-flow.js +41 -12
  97. package/dist/salience.js +12 -5
  98. package/dist/same-text.d.ts +17 -0
  99. package/dist/same-text.js +38 -0
  100. package/dist/scheduler.d.ts +4 -0
  101. package/dist/scheduler.js +8 -0
  102. package/dist/search.d.ts +7 -0
  103. package/dist/search.js +16 -32
  104. package/dist/secret-detect.d.ts +2 -0
  105. package/dist/secret-detect.js +6 -0
  106. package/dist/server-detect.js +9 -33
  107. package/dist/server.js +6 -62
  108. package/dist/session-digest.d.ts +79 -0
  109. package/dist/session-digest.js +528 -0
  110. package/dist/shared.d.ts +10 -2
  111. package/dist/shared.js +44 -36
  112. package/dist/store.d.ts +9 -2
  113. package/dist/store.js +25 -2
  114. package/dist/token-ledger.d.ts +46 -8
  115. package/dist/token-ledger.js +140 -21
  116. package/dist/version.d.ts +1 -1
  117. package/dist/version.js +1 -1
  118. package/extensions/openclaw-plugin/README.md +4 -4
  119. package/extensions/openclaw-plugin/openclaw.plugin.json +2 -2
  120. package/extensions/openclaw-plugin/package.json +1 -1
  121. package/openclaw.plugin.json +2 -2
  122. package/package.json +2 -2
package/dist/capture.d.ts CHANGED
@@ -14,6 +14,7 @@ export interface ExtractedItem {
14
14
  category: string;
15
15
  tags: string[];
16
16
  }
17
+ export declare function splitSentences(text: string): string[];
17
18
  /**
18
19
  * Main extraction function. Scans text for actionable items using heuristics.
19
20
  */
@@ -28,6 +29,7 @@ export interface CaptureOptions {
28
29
  * `stdinTimedOut` marks an empty read "unknown", not "no payload". */
29
30
  stdinText?: string;
30
31
  stdinTimedOut?: boolean;
32
+ sessionTurns?: readonly SessionTurn[];
31
33
  /**
32
34
  * Tee stdout/stderr to this log file while capture runs. Mirrors the
33
35
  * pattern used by `hippo sleep --log-file` so the SessionEnd hook output
@@ -45,7 +47,41 @@ export interface CaptureOptions {
45
47
  * behaviour. Ignored when `global: true` (global captures are host-wide).
46
48
  */
47
49
  tenantId?: string;
50
+ originProject?: string;
48
51
  }
52
+ /**
53
+ * Runtime shape guards used throughout this file wherever a value arrives
54
+ * unparsed (JSONL transcript records, stdout/stderr write() chunks). Generic
55
+ * over the input so the parameter is never annotated `unknown` directly — TS
56
+ * infers it from the call site — while the check itself avoids `typeof` by
57
+ * testing identity against the coercion (`String(x) === x`) /
58
+ * prototype-chain (`instanceof Object`) instead. Behaviourally equivalent to
59
+ * `typeof x === 'string'` / a truthy `typeof x === 'object'` check for
60
+ * anything `JSON.parse` can produce (the only divergence is boxed
61
+ * primitives, which JSON.parse never yields).
62
+ */
63
+ export declare function isStringValue<T>(value: T): value is T & string;
64
+ export declare function isObjectLike<T>(value: T): value is T & object;
65
+ /** Message for a caught value of unknown shape. `cause` names the sanctioned unknown-input case (error-cause enrichment). */
66
+ export declare function errorMessage(cause: unknown): string;
67
+ /** Transcript-line flags isNonHumanUserLine reads (any may be absent); `promptSource: 'system'` marks Claude Code's own notices. */
68
+ interface TranscriptLineFlags {
69
+ type?: unknown;
70
+ isMeta?: unknown;
71
+ isSidechain?: unknown;
72
+ isCompactSummary?: unknown;
73
+ promptSource?: unknown;
74
+ }
75
+ export interface SessionTurn {
76
+ role: 'user' | 'assistant';
77
+ text: string;
78
+ }
79
+ export interface TranscriptRecord extends TranscriptLineFlags {
80
+ message?: unknown;
81
+ payload?: unknown;
82
+ cwd?: unknown;
83
+ }
84
+ export declare function collectSessionTurns(jsonl: string, visit?: (record: TranscriptRecord) => void): SessionTurn[];
49
85
  export declare function summariseTranscript(jsonl: string): string;
50
86
  /**
51
87
  * Resolve a transcript path for `--last-session`.
@@ -53,11 +89,13 @@ export declare function summariseTranscript(jsonl: string): string;
53
89
  * Priority, where the first source present is the only one tried:
54
90
  * 1. Explicit `transcriptPath` option (from `--transcript <path>`)
55
91
  * 2. Stdin JSON payload (Claude Code / OpenCode SessionEnd hook shape)
56
- * 3. Most recent `.jsonl` under `~/.claude/projects/<any>/`, only on a proven manual run (no path, no stdin text, no timed-out read), because this scan spans every project on the box
92
+ * 3. Most recent `.jsonl` under `~/.claude/projects/<any>/`, only when the caller passes `mayScan` (only the caller knows it is not a hook) and there is no path and no stdin text, because this scan spans every project on the box
57
93
  *
58
94
  * Returns null when nothing resolves, a named transcript or payload whose file is missing included. Never throws.
59
95
  */
60
- export declare function resolveLastSessionTranscript(explicit: string | undefined, stdinText: string | undefined, stdinTimedOut?: boolean): string | null;
96
+ export declare function resolveLastSessionTranscript(explicit: string | undefined, stdinText: string | undefined, opts: {
97
+ mayScan: boolean;
98
+ }): string | null;
61
99
  export declare function cmdCapture(hippoRoot: string, options: CaptureOptions): void;
62
100
  /** Never read the whole transcript — PreCompact fires exactly when it's largest. */
63
101
  export declare const PRE_COMPACT_TAIL_BYTES: number;
@@ -104,19 +142,6 @@ export declare function readTranscriptTail(transcriptPath: string, capBytes?: nu
104
142
  * guard, not per-file copies.
105
143
  */
106
144
  export declare function sanitizeLogMessage(message: string): string;
107
- /** What one pre-compact run saved, reported to the user after compaction. */
108
- export interface PreCompactReport {
109
- snapshotSaved: boolean;
110
- /** Claude Code session the run belonged to, when the payload named one. */
111
- sessionId: string | null;
112
- }
113
- /** Line shown after compaction, or null when nothing was saved (Claude Code's own generic message is the fallback). */
114
- export declare function preCompactMessage(report: Pick<PreCompactReport, 'snapshotSaved'>): string | null;
115
- /**
116
- * Where pre-compact leaves its report for `hippo post-compact`: next to the
117
- * pre-compact log, so both hooks find it from the same `--log-file`.
118
- */
119
- export declare function preCompactReportPath(logFile: string): string;
120
145
  /** A session's task, summary and next step from its transcript tail, secrets scrubbed and capped, '' where none; null with a logged reason when nothing is derivable. */
121
146
  export declare function transcriptWorkingState(transcriptPath: string, log: (message: string) => void): Pick<TaskSnapshot, 'task' | 'summary' | 'next_step'> | null;
122
147
  export interface PreCompactOptions {
@@ -132,11 +157,12 @@ export interface PreCompactOptions {
132
157
  * could turn a caught-and-logged failure back into a non-zero exit.
133
158
  */
134
159
  export declare function cmdPreCompact(hippoRoot: string, options: PreCompactOptions): Promise<void>;
135
- /**
136
- * The message for the PostCompact hook, from the report pre-compact left,
137
- * or null when there is nothing to say. Consumes the report, so the message
138
- * shows once. A report from another session, or an old one, is dropped.
139
- * Never throws.
140
- */
141
- export declare function postCompactMessage(stdinText: string | undefined, logFile?: string, now?: Date): string | null;
160
+ export interface PostCompactOptions {
161
+ stdinText?: string;
162
+ logFile?: string;
163
+ afterSave?: (transcriptPath: string, originProject: string, log: (message: string) => void) => void;
164
+ }
165
+ /** PostCompact entry point: saves the summary and its items, replays earlier leftovers, returns the one line to show. Never throws, so the hook exits 0. */
166
+ export declare function cmdPostCompact(hippoRoot: string, options: PostCompactOptions): string | null;
167
+ export {};
142
168
  //# sourceMappingURL=capture.d.ts.map