hippo-memory 1.55.0 → 1.57.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 (77) hide show
  1. package/README.md +11 -0
  2. package/dist/api.d.ts +19 -9
  3. package/dist/api.js +112 -35
  4. package/dist/card-detail.d.ts +1 -1
  5. package/dist/card-detail.js +1 -1
  6. package/dist/cli/shared.d.ts +137 -0
  7. package/dist/cli/shared.js +830 -0
  8. package/dist/cli/sleep.d.ts +10 -0
  9. package/dist/cli/sleep.js +171 -0
  10. package/dist/cli.d.ts +0 -7
  11. package/dist/cli.js +313 -1806
  12. package/dist/config.d.ts +5 -0
  13. package/dist/config.js +21 -0
  14. package/dist/connectors/github/webhook.d.ts +19 -0
  15. package/dist/connectors/github/webhook.js +313 -0
  16. package/dist/connectors/slack/webhook.d.ts +22 -0
  17. package/dist/connectors/slack/webhook.js +203 -0
  18. package/dist/consolidate.js +3 -2
  19. package/dist/context-auto.d.ts +3 -0
  20. package/dist/context-auto.js +34 -0
  21. package/dist/customer-notes.js +2 -1
  22. package/dist/dashboard.js +2 -1
  23. package/dist/db.js +67 -1
  24. package/dist/decisions.js +2 -1
  25. package/dist/delivery-recorder.d.ts +127 -0
  26. package/dist/delivery-recorder.js +218 -0
  27. package/dist/eval-stats.d.ts +58 -0
  28. package/dist/eval-stats.js +111 -0
  29. package/dist/goals.d.ts +49 -25
  30. package/dist/goals.js +39 -22
  31. package/dist/graph-extract.js +1 -1
  32. package/dist/graph-recall.d.ts +1 -1
  33. package/dist/graph-recall.js +1 -1
  34. package/dist/graph.js +1 -1
  35. package/dist/hooks.d.ts +1 -3
  36. package/dist/hooks.js +2 -4
  37. package/dist/http-util.d.ts +31 -0
  38. package/dist/http-util.js +46 -0
  39. package/dist/incidents.js +2 -1
  40. package/dist/index.d.ts +5 -2
  41. package/dist/index.js +5 -2
  42. package/dist/mcp/server.js +173 -285
  43. package/dist/memory.d.ts +19 -0
  44. package/dist/memory.js +38 -0
  45. package/dist/policies.js +2 -1
  46. package/dist/predictions.js +2 -1
  47. package/dist/processes.js +2 -1
  48. package/dist/project-briefs.js +3 -1
  49. package/dist/prompt-recall.js +1 -1
  50. package/dist/recall-history.d.ts +5 -0
  51. package/dist/recall-history.js +9 -0
  52. package/dist/recall-pipeline.d.ts +101 -0
  53. package/dist/recall-pipeline.js +313 -0
  54. package/dist/recall-scope.d.ts +22 -0
  55. package/dist/recall-scope.js +27 -1
  56. package/dist/recall-trace.d.ts +69 -0
  57. package/dist/recall-trace.js +136 -0
  58. package/dist/search.d.ts +0 -20
  59. package/dist/search.js +2 -49
  60. package/dist/server.js +1901 -2384
  61. package/dist/skills.js +2 -1
  62. package/dist/store-cards.d.ts +53 -0
  63. package/dist/store-cards.js +512 -0
  64. package/dist/store.d.ts +2 -89
  65. package/dist/store.js +6 -562
  66. package/dist/tenant.d.ts +22 -0
  67. package/dist/tenant.js +26 -0
  68. package/dist/token-ledger.d.ts +2 -0
  69. package/dist/token-ledger.js +5 -0
  70. package/dist/tokenize.d.ts +2 -0
  71. package/dist/tokenize.js +8 -0
  72. package/dist/version.d.ts +1 -1
  73. package/dist/version.js +1 -1
  74. package/extensions/openclaw-plugin/openclaw.plugin.json +1 -1
  75. package/extensions/openclaw-plugin/package.json +1 -1
  76. package/openclaw.plugin.json +1 -1
  77. package/package.json +2 -1
package/dist/store.d.ts CHANGED
@@ -7,7 +7,6 @@
7
7
  import { MemoryEntry, Layer } from './memory.js';
8
8
  import { openHippoDb, getHippoDbPath, type DatabaseSyncLike } from './db.js';
9
9
  import { SessionHandoff, HandoffEvidence, HandoffOutcome } from './handoff.js';
10
- import { Card, CardStatus, CardRun, CardComment } from './card.js';
11
10
  import { type ResolveProjectIdentityOpts } from './project-identity.js';
12
11
  import { RejectedValueError } from './rejection.js';
13
12
  import { type DormantMove } from './dormant.js';
@@ -83,28 +82,6 @@ export interface SessionEvent {
83
82
  * this for `RecallResult.windowSize` reporting so the two cannot drift.
84
83
  */
85
84
  export declare const DEFAULT_SEARCH_CANDIDATE_LIMIT = 200;
86
- /**
87
- * v1.7.2 — literal scopes excluded from recall by default-deny when the
88
- * caller passes no `scope`. The SQL clause in `loadSearchRows` and the JS
89
- * helper `passesScopeFilterForRecall` (src/api.ts) both read from this
90
- * constant. Adding a deny scope is a one-place change.
91
- *
92
- * Regex-based denies (e.g. `<source>:private:*`) stay in
93
- * `passesScopeFilterForRecall` as a separate JS step — they don't translate
94
- * cleanly to SQL.
95
- *
96
- * Invariant: never empty. An empty array would silently allow quarantine
97
- * scopes through both paths (SQL clause omitted, JS check vacuous). The
98
- * module-load assertion below pins this loudly.
99
- */
100
- export declare const RECALL_DEFAULT_DENY_SCOPES: readonly ["unknown:legacy"];
101
- /**
102
- * @internal v1.7.3 — runtime guard against a future maintainer blanking a
103
- * load-bearing literal array. Extracted from the inline guard so the throw
104
- * path is directly testable. `as const` arrays widen via `readonly T[]` at
105
- * the call site so the empty case is reachable at runtime.
106
- */
107
- export declare function assertNonEmpty<T>(arr: readonly T[], name: string): void;
108
85
  /** Nearest ancestor store like git; the strict join is the fallback so `hippo init` still creates `<cwd>/.hippo`. */
109
86
  export declare function getHippoRoot(cwd?: string, opts?: ResolveProjectIdentityOpts): string;
110
87
  export declare function isInitialized(hippoRoot: string): boolean;
@@ -510,23 +487,6 @@ export declare function loadSessionDecayContext(hippoRoot: string): SessionDecay
510
487
  * Increment the sleep counter. Called after each consolidation run.
511
488
  */
512
489
  export declare function incrementSleepCount(hippoRoot: string): void;
513
- /**
514
- * Defensive runtime guard for tenant id arguments.
515
- *
516
- * The continuity helpers (saveActiveTaskSnapshot, listSessionEvents, etc.)
517
- * gained a required `tenantId` parameter in v0.41 / schema v22 to close a
518
- * cross-tenant data leak. TypeScript catches misbinding at compile time, but
519
- * JavaScript callers from older versions can silently pass a `sessionId`
520
- * where `tenantId` is now expected, e.g.
521
- * loadLatestHandoff(root, 'sess-abc') // WRONG: 'sess-abc' becomes the tenant
522
- * which would silently filter to a non-existent tenant and return null with
523
- * no error. This guard rejects the most common shape of that mistake (any
524
- * value beginning with the conventional `sess-` / `sess_` session prefix).
525
- *
526
- * False-positive cost: a tenant literally named `sess-...` will be rejected.
527
- * Acceptable tradeoff for catching the silent-leak class.
528
- */
529
- export declare function assertTenantId(fnName: string, value: JsonValue): asserts value is string;
530
490
  export declare function saveActiveTaskSnapshot(hippoRoot: string, tenantId: string, snapshot: {
531
491
  task: string;
532
492
  summary: string;
@@ -648,6 +608,8 @@ export declare function resolveConflict(hippoRoot: string, conflictId: number, k
648
608
  conflict: MemoryConflict;
649
609
  loserId: string;
650
610
  } | null;
611
+ /** Column list shared by every session_handoffs SELECT; store-cards.ts reuses it for the card handoff lookup. */
612
+ export declare const HANDOFF_COLUMNS = "id, session_id, repo_root, task_id, summary, next_action, artifacts_json, scope, created_at, constraints_json, evidence_json, outcome, target_runtime, card_id";
651
613
  /**
652
614
  * Save a session handoff record. Returns the persisted handoff.
653
615
  */
@@ -669,55 +631,6 @@ export declare function stampHandoffOutcome(hippoRoot: string, tenantId: string,
669
631
  * @param evidence best-effort git state; outcome comes from the newest session_complete event.
670
632
  * @returns null when neither source is the session's, a newer handoff covers the snapshot, or the session's latest handoff was not read off its transcript. */
671
633
  export declare function writeSessionEndHandoff(hippoRoot: string, tenantId: string, sessionId: string, evidence: HandoffEvidence | null, derived?: Pick<TaskSnapshot, 'task' | 'summary' | 'next_step'> | null): SessionHandoff | null;
672
- export declare function transitionCard(db: DatabaseSyncLike, tenantId: string, cardId: string, from: CardStatus[], to: CardStatus, extra?: {
673
- setSql?: string;
674
- whereSql?: string;
675
- params?: unknown[];
676
- }): number;
677
- /** Creates a card; status is ready with no deps or once every dependsOn id is done, else backlog. An unknown dependsOn id throws and commits nothing. A repeated dependsOn id is recorded once. */
678
- export declare function createCard(hippoRoot: string, tenantId: string, input: {
679
- title: string;
680
- repo?: string;
681
- contract?: string;
682
- budget?: number;
683
- dependsOn?: string[];
684
- }): Card;
685
- /** Returns the card row for id, or null if it does not exist under this tenant. */
686
- export declare function loadCard(hippoRoot: string, tenantId: string, id: string): Card | null;
687
- /** Lists cards for this tenant, optionally filtered to one status, newest-updated first. */
688
- export declare function listCards(hippoRoot: string, tenantId: string, opts?: {
689
- status?: CardStatus;
690
- }): Card[];
691
- /** Returns this card's parent and child ids from card_deps. */
692
- export declare function loadCardDeps(hippoRoot: string, tenantId: string, id: string): {
693
- parents: string[];
694
- children: string[];
695
- };
696
- /** Returns this card's run history, most recent first. */
697
- export declare function loadCardRuns(hippoRoot: string, tenantId: string, id: string): CardRun[];
698
- /** Returns this card's comments, most recent first. */
699
- export declare function loadCardComments(hippoRoot: string, tenantId: string, id: string): CardComment[];
700
- /** Read side of the card <-> handoff round trip: the newest handoff filed against this card. */
701
- export declare function loadLatestHandoffForCard(hippoRoot: string, tenantId: string, cardId: string): SessionHandoff | null;
702
- /** Atomic claim: WHERE status IN (ready, blocked) AND assignee_runtime IS NULL decides the race. Throws on an unknown card id; returns null for a card not ready/blocked or already claimed. Sets a CARD_LEASE_MS lease and returns the new run's id as runId. */
703
- export declare function claimCard(hippoRoot: string, tenantId: string, id: string, runtime: string, sessionId?: string): (Card & {
704
- runId: number;
705
- }) | null;
706
- /** Moves a running card's lease to CARD_LEASE_MS from now and records the heartbeat; updated_at is left alone. Throws on an unknown card id or a run id that is not a positive integer; returns null unless the card is running and runId is its live run. */
707
- export declare function heartbeatCard(hippoRoot: string, tenantId: string, id: string, runId: number): Card | null;
708
- /** Requires the card be running; closes the live run as blocked and files reason as a comment. Throws on an unknown card id; returns null for a card not running. When runId is given, returns null unless it is the card's live run. */
709
- export declare function blockCard(hippoRoot: string, tenantId: string, id: string, reason: string, runId?: number): Card | null;
710
- /** Requires the card be running; moves it to review, clearing its lease and heartbeat and keeping its live run. When runId is given, returns null unless it is the card's live run. Throws on an unknown card id; returns null for a card not running. */
711
- export declare function reviewCard(hippoRoot: string, tenantId: string, id: string, runId?: number): Card | null;
712
- /** Requires the card be in review; closes the live run with outcome. Outcome 'success' moves the card to done and, in the same transaction, promotes any child whose parents are now all done; 'failure' or 'partial' moves it to shelved and promotes nothing. Throws on an unknown card id; returns null for a card not in review. When runId is given, returns null unless it is the card's live run. */
713
- export declare function completeCard(hippoRoot: string, tenantId: string, id: string, outcome: HandoffOutcome, runId?: number): {
714
- card: Card;
715
- promotedChildren: string[];
716
- } | null;
717
- /** Returns to ready every running card of the tenant whose lease has expired or is missing: clears its assignee, closes its live run as 'reclaimed' and leaves its handoffs alone, all in one write transaction. Returns the reclaimed card ids in id order. */
718
- export declare function reclaimExpiredCards(hippoRoot: string, tenantId: string): string[];
719
- /** Appends a comment to cardId in any card status; throws if cardId is not a card of this tenant. */
720
- export declare function addCardComment(hippoRoot: string, tenantId: string, cardId: string, author: string, body: string): CardComment;
721
634
  /**
722
635
  * Load summaries flagged dirty for the given tenant. Sorted by latest_at
723
636
  * DESC (NULLS LAST) so E3's rebuild cap (HIPPO_DAG_REBUILD_CAP, default 20)