hippo-memory 3.3.2 → 3.3.3

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.
@@ -2,7 +2,7 @@
2
2
  * Single source of truth for the package version, written by scripts/sync-version.mjs; never
3
3
  * edit by hand. Read by the db rollback guard, /health, MCP. A constant, not a runtime
4
4
  * package.json read: the published bundle may lack package.json on a path ESM can resolve. */
5
- export declare const PACKAGE_VERSION = "3.3.2";
5
+ export declare const PACKAGE_VERSION = "3.3.3";
6
6
  /** The floor a store takes on its first expiring key: the first release with schema v53, set by
7
7
  * hand in that release; scripts/checks/check-expiring-keys-floor.mjs gates it. */
8
8
  export declare const EXPIRING_KEYS_MIN_BINARY = "1.64.0";
@@ -2,7 +2,7 @@
2
2
  * Single source of truth for the package version, written by scripts/sync-version.mjs; never
3
3
  * edit by hand. Read by the db rollback guard, /health, MCP. A constant, not a runtime
4
4
  * package.json read: the published bundle may lack package.json on a path ESM can resolve. */
5
- export const PACKAGE_VERSION = '3.3.2';
5
+ export const PACKAGE_VERSION = '3.3.3';
6
6
  /** The floor a store takes on its first expiring key: the first release with schema v53, set by
7
7
  * hand in that release; scripts/checks/check-expiring-keys-floor.mjs gates it. */
8
8
  export const EXPIRING_KEYS_MIN_BINARY = '1.64.0';
@@ -5,6 +5,8 @@ export declare const HEALED_TABLES: readonly ["task_snapshots", "session_events"
5
5
  /** The indexes the chain puts on those tables and the two request indexes, by name: the open's
6
6
  * probe counts them, and a missing one is made again from the chain. */
7
7
  export declare const HEALED_INDEXES: readonly ["idx_task_snapshots_status_updated", "idx_task_snapshots_tenant_status", "idx_task_snapshots_tenant_scope", "idx_task_snapshots_owner", "idx_session_events_session_created", "idx_session_events_task_created", "idx_session_events_tenant_session", "idx_session_handoffs_session", "idx_session_handoffs_tenant_session", "idx_session_handoffs_tenant_outcome", "idx_session_handoffs_tenant_card", "idx_session_handoffs_owner", "idx_cards_tenant_status", "idx_card_deps_tenant_child", "idx_card_deps_tenant_parent", "idx_card_runs_tenant_card", "idx_card_comments_tenant_card", "idx_memory_quarantine_status", "idx_compactions_request", "idx_failure_log_request"];
8
+ /** The healed tables this store lacks; a read only, so an open can skip the write lock when none. */
9
+ export declare function missingHealedTables(db: DatabaseSyncLike): Set<string>;
8
10
  export declare function ensureContinuityTables(db: DatabaseSyncLike): void;
9
11
  export declare function ensureContinuityIndexes(db: DatabaseSyncLike): void;
10
12
  //# sourceMappingURL=continuity-tables.d.ts.map
@@ -44,11 +44,14 @@ export const HEALED_INDEXES = [
44
44
  // can log the step.
45
45
  const REQUEST_TABLES = ['compactions', 'failure_log'];
46
46
  let chainObjects;
47
+ /** The healed tables this store lacks; a read only, so an open can skip the write lock when none. */
48
+ export function missingHealedTables(db) {
49
+ return new Set(HEALED_TABLES.filter((table) => !tableExists(db, table)));
50
+ }
47
51
  // Before the loop on stamped stores: the chain never re-runs a stamped migration, and v4/v16/v22
48
- // ALTER or read these tables. IF NOT EXISTS because this runs outside the migration lock, where two
49
- // processes may heal one store.
52
+ // ALTER or read these tables. Call it under the write lock, so its check and its CREATE see one state.
50
53
  export function ensureContinuityTables(db) {
51
- const missing = new Set(HEALED_TABLES.filter((table) => !tableExists(db, table)));
54
+ const missing = missingHealedTables(db);
52
55
  if (missing.size === 0)
53
56
  return;
54
57
  chainObjects ??= objectsFromChain();
@@ -4,7 +4,7 @@ import { importLegacyEmbeddingIndex } from './vector-store.js';
4
4
  import { execWithBusyRetry, withWriteScope } from './busy.js';
5
5
  import { tableExists } from './tables.js';
6
6
  import { ensureMetaTable, getMeta, getSchemaVersion, setMeta, setSchemaVersion, META_KEY, } from './meta.js';
7
- import { ensureContinuityIndexes, ensureContinuityTables } from './continuity-tables.js';
7
+ import { ensureContinuityIndexes, ensureContinuityTables, missingHealedTables, } from './continuity-tables.js';
8
8
  import { MEMORIES_FTS_DDL, ensureTrigramIndex, isFtsMissing, rebuildTrigramIndex, } from './fts-index.js';
9
9
  import { REQUIRED_SCHEMA_OBJECTS } from './required-objects.js';
10
10
  import { CURRENT_SCHEMA_VERSION, MIGRATIONS } from './migrations/index.js';
@@ -125,8 +125,12 @@ function migrateAndHeal(db, hippoRoot, busyWaitMs) {
125
125
  // understand.
126
126
  assertBinaryCompatible(db);
127
127
  let currentVersion = getSchemaVersion(db);
128
- if (currentVersion > 0)
129
- ensureContinuityTables(db);
128
+ // Under the lock: another process's migration can make an old-shape table between the check and
129
+ // the CREATE, and the chain's index on a newer column then fails. A store with none missing takes
130
+ // no lock, since some stores stay on this path for good.
131
+ if (currentVersion > 0 && missingHealedTables(db).size > 0) {
132
+ withWriteScope(db, 'heal_tables', () => ensureContinuityTables(db), { busyWaitMs });
133
+ }
130
134
  for (const migration of MIGRATIONS) {
131
135
  if (migration.version <= currentVersion)
132
136
  continue;
@@ -2,7 +2,7 @@
2
2
  "id": "hippo-memory",
3
3
  "name": "Hippo Memory",
4
4
  "description": "Make your agent's memory work like a brain. Hippo is long-term memory for coding agents.",
5
- "version": "3.3.2",
5
+ "version": "3.3.3",
6
6
 
7
7
  "configSchema": {
8
8
  "type": "object",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hippo-memory",
3
- "version": "3.3.2",
3
+ "version": "3.3.3",
4
4
  "type": "module",
5
5
  "description": "Make your agent's memory work like a brain. Hippo is long-term memory for coding agents.",
6
6
  "main": "index.ts",
@@ -2,7 +2,7 @@
2
2
  "id": "hippo-memory",
3
3
  "name": "Hippo Memory",
4
4
  "description": "Make your agent's memory work like a brain. Hippo is long-term memory for coding agents.",
5
- "version": "3.3.2",
5
+ "version": "3.3.3",
6
6
  "configSchema": {
7
7
  "type": "object",
8
8
  "additionalProperties": false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hippo-memory",
3
- "version": "3.3.2",
3
+ "version": "3.3.3",
4
4
  "description": "Make your agent's memory work like a brain. Hippo is long-term memory for coding agents.",
5
5
  "mcpName": "io.github.kitfunso/hippo-memory",
6
6
  "type": "module",