Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
Merge remote-tracking branch 'origin/master' into capy/mpw-integration
garrytan8d0366265bcb
diff --cc src/core/schema-migrations/latest.generated.tsindex 75df055594,4f44c97ebc..290290a9b6--- a/src/core/schema-migrations/latest.generated.ts+++ b/src/core/schema-migrations/latest.generated.ts@@@ -4,4 -4,4 +4,4 @@@// The highest schema migration version (migrate.ts LATEST_VERSION), importable without// loading the migrations themselves.- export const LATEST_SCHEMA_VERSION = 223;-export const LATEST_SCHEMA_VERSION = 224;++export const LATEST_SCHEMA_VERSION = 225;diff --cc src/core/schema-migrations/registry.generated.tsindex 31888fe525,a0fd041e3d..2756720932--- a/src/core/schema-migrations/registry.generated.ts+++ b/src/core/schema-migrations/registry.generated.ts@@@ -223,7 -223,8 +223,9 @@@ import { v219 } from './v219-pages-recoimport { v220 } from './v220-persistence-request-preparation-attempts.ts';import { v221 } from './v221-chunk-embedding-pending-since.ts';import { v222 } from './v222-persistence-consumers.ts';- import { v223 } from './v223-pinned-questions.ts';+ import { v223 } from './v223-persistence-serve-loop-indexes.ts';+ import { v224 } from './v224-page-retrievals.ts';++import { v225 } from './v225-pinned-questions.ts';// Array order is historical (see HISTORICAL_ARRAY_ORDER in the generator); the// runner sorts by version before applying.@@@ -446,4 -447,5 +448,6 @@@ export const MIGRATIONS: Migration[] =v221,v222,v223,+ v224,++ v225,];diff --cc src/core/schema-migrations/v225-pinned-questions.tsindex 28a0b1d344,0000000000..41d53ec650mode 100644,000000..100644--- a/src/core/schema-migrations/v225-pinned-questions.ts+++ b/src/core/schema-migrations/v225-pinned-questions.ts@@@ -1,15 -1,0 +1,15 @@@+import type { Migration } from './types.ts';+import { PINNED_QUESTIONS_SCHEMA_SQL } from '../questions/schema.ts';+import { migrateAutoThinkToPins } from '../questions/auto-think-migration.ts';++// Pinned questions (C4): the pinned_questions and question_evidence tables+// (DDL in src/core/questions/schema.ts), then the dream.auto_think config+// keys become pins. The handler reads config only: no provider call, no page+// write, and a second run changes nothing.- export const v223: Migration = {- version: 223,++export const v225: Migration = {++ version: 225,+ name: 'pinned_questions',+ idempotent: true,+ sql: PINNED_QUESTIONS_SCHEMA_SQL,+ handler: async (engine) => { await migrateAutoThinkToPins(engine); },+};diff --cc test/fixtures/goldens/doctor/content-pglite-human.jsonindex 96860b1478,224c95ccef..1e178f6b80--- a/test/fixtures/goldens/doctor/content-pglite-human.json+++ b/test/fixtures/goldens/doctor/content-pglite-human.json@@@ -64,7 -64,7 +64,7 @@@" [OK] pglite_scale: PGLite at 5 pages — comfortable below the 1000-page threshold"," [OK] rls: Skipped (PGLite — no PostgREST exposure, RLS not applicable)"," [OK] schema_version: Version <latest> (latest: <latest>)",- " [OK] schema_columns: 1045 column(s) verified against live schema",- " [OK] schema_columns: 1003 column(s) verified against live schema",++ " [OK] schema_columns: 1047 column(s) verified against live schema"," [OK] rls_event_trigger: Skipped (PGLite — no event trigger support)"," [INFO] embeddings: Not applicable: embeddings are disabled on this brain (keyword search keeps working)."," [INFO] embedding_provider: Not probed: embeddings are disabled on this brain by choice (keyword search keeps working).",diff --cc test/fixtures/goldens/doctor/content-pglite-json.jsonindex b8079ab4f8,c6faaad2db..5acc8cd7d8--- a/test/fixtures/goldens/doctor/content-pglite-json.json+++ b/test/fixtures/goldens/doctor/content-pglite-json.json@@@ -535,7 -535,7 +535,7 @@@},{"category": "meta",- "message": "1045 column(s) verified against live schema",- "message": "1003 column(s) verified against live schema",++ "message": "1047 column(s) verified against live schema","name": "schema_columns","status": "ok"},diff --cc test/fixtures/goldens/doctor/json-pglite-degraded.jsonindex 5e3f86c17d,4d175d161e..c1cefdbee4--- a/test/fixtures/goldens/doctor/json-pglite-degraded.json+++ b/test/fixtures/goldens/doctor/json-pglite-degraded.json@@@ -518,7 -518,7 +518,7 @@@},{"category": "meta",- "message": "1045 column(s) verified against live schema",- "message": "1003 column(s) verified against live schema",++ "message": "1047 column(s) verified against live schema","name": "schema_columns","status": "ok"},diff --cc test/fixtures/goldens/doctor/json-pglite-fresh.jsonindex 24d748d11c,61300c5796..5b46b9b700--- a/test/fixtures/goldens/doctor/json-pglite-fresh.json+++ b/test/fixtures/goldens/doctor/json-pglite-fresh.json@@@ -521,7 -521,7 +521,7 @@@},{"category": "meta",- "message": "1045 column(s) verified against live schema",- "message": "1003 column(s) verified against live schema",++ "message": "1047 column(s) verified against live schema","name": "schema_columns","status": "ok"},diff --cc test/fixtures/goldens/doctor/json-postgres-fresh.jsonindex cfe7231622,46d2c97e55..6ff627049a--- a/test/fixtures/goldens/doctor/json-postgres-fresh.json+++ b/test/fixtures/goldens/doctor/json-postgres-fresh.json@@@ -502,7 -502,7 +502,7 @@@},{"category": "ops",- "message": "RLS enabled on 123/123 public tables",- "message": "RLS enabled on 122/122 public tables",++ "message": "RLS enabled on 124/124 public tables","name": "rls","status": "ok"},@@@ -514,7 -514,7 +514,7 @@@},{"category": "meta",- "message": "1051 column(s) verified against live schema",- "message": "1009 column(s) verified against live schema",++ "message": "1053 column(s) verified against live schema","name": "schema_columns","status": "ok"},diff --cc test/fixtures/goldens/migrations/records.jsonindex 13baa3c770,6cb1a743b5..f45d43916a--- a/test/fixtures/goldens/migrations/records.json+++ b/test/fixtures/goldens/migrations/records.json@@@ -1,6 -1,6 +1,6 @@@{"golden": {- "count": 218,- "count": 219,++ "count": 220,"gaps": [17,18,@@@ -38,7 -39,7 +40,7 @@@"sqlQueryForEngine": "71fb1ccec1b22cdc1662876dbd8c17ed81e9ab83485c6965cdf5caa4fc4a4ab5","verifyProjectionStatistics": "59d9ccfea1c53384d8607874a51209a9c2dfd51b2b85a2cb6269fa4120faf1f3"},- "latest": 223,- "latest": 224,++ "latest": 225,"records": [{"handler": {@@@ -3306,24 -3307,46 +3308,65 @@@"verify": "absent","version": 222},+ {+ "handler": {+ "form": "arrow",+ "helpers": [+ "PERSISTENCE_COMPACTABLE_INDEX",+ "PERSISTENCE_SYNC_WATERMARK_INDEX",+ "buildIndexOnline",+ "dropInvalidConcurrentIndex",+ "migrationNotice",+ "quietMigrationNotices"+ ],+ "sha256": "f7130a17b685dfd2443826ec7959856c9195334273870f1233a8fb1547c1e5b2"+ },+ "idempotent": true,+ "name": "persistence_serve_loop_indexes",+ "sql": {+ "length": 0,+ "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"+ },+ "sqlFor": "absent",+ "transaction": "absent",+ "verify": "absent",+ "version": 223+ },+ {+ "handler": {+ "form": "arrow",+ "helpers": [],+ "sha256": "7aeee57a0203b07ab0548523ddcfbe459f0e49f2a17d7df32647a965c7787453"+ },+ "idempotent": true,+ "name": "page_retrievals",+ "sql": {+ "length": 939,+ "sha256": "ad15e7b001f794e4ef42aa5936e3797588bd1e3f2d296579e92705a672a42d3a"+ },+ "sqlFor": "absent",+ "transaction": "absent",+ "verify": "absent",+ "version": 224++ },+ {+ "handler": {+ "form": "arrow",+ "helpers": [+ "migrateAutoThinkToPins"+ ],+ "sha256": "6538d483dacf5b76e4eb837603082e0c8611c613f6c534007fa2f2b197e1e1ed"+ },+ "idempotent": true,+ "name": "pinned_questions",+ "sql": {+ "length": 2746,+ "sha256": "07ff5ebf8abd16f5edf1bb76318ef541e7a74a3c275a78dac04acb103858e93b"+ },+ "sqlFor": "absent",+ "transaction": "absent",+ "verify": "absent",- "version": 223++ "version": 225}],"versions": [@@@ -3544,7 -3567,8 +3587,9 @@@220,221,222,- 223+ 223,- 224++ 224,++ 225]},"normalizer": "migrations-record-v1"diff --cc test/graduation-inventory.test.tsindex 0e8e4f139d,a0d7180473..40d483addf--- a/test/graduation-inventory.test.ts+++ b/test/graduation-inventory.test.ts@@@ -60,7 -60,7 +60,7 @@@ describe('graduation inventory', () =>expect(new Set(names).size).toBe(names.length);const counts: Record<string, number> = {};for (const e of GRADUATION_INVENTORY.entries) counts[e.class] = (counts[e.class] ?? 0) + 1;- expect(counts).toEqual({ carry: 112, rebind: 2, rebuild: 2, discard: 7, schema_owned: 3 });- expect(counts).toEqual({ carry: 111, rebind: 2, rebuild: 2, discard: 7, schema_owned: 3 });++ expect(counts).toEqual({ carry: 113, rebind: 2, rebuild: 2, discard: 7, schema_owned: 3 });for (const e of GRADUATION_INVENTORY.entries) {expect({ relation: e.relation, reason: e.reason.length > 5, present: e.engines.pglite || e.engines.postgres }).toEqual({ relation: e.relation, reason: true, present: true });