Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
P8: new-install surface defaults in an import-free module (breaks a readiness import cycle); map the P8 Postgres E2E
garrytanef0de865751f
diff --git a/scripts/e2e-test-map.ts b/scripts/e2e-test-map.tsindex 722f3dd6f3..134df3b849 100644--- a/scripts/e2e-test-map.ts+++ b/scripts/e2e-test-map.ts@@ -83,7 +83,9 @@ export const E2E_TEST_MAP: Record<string, string[]> = {// Fix wave 5: managed writeSingleFact keeps an absent entity's fallback slug (attribute_fallback).// #5888 capture-lane dedup + hot-memory collapse, managed coordinator arm on Postgres."src/core/facts/capture-dedup.ts": ["test/e2e/capture-dedup-postgres.test.ts"],- "src/core/facts/single-prepare.ts": ["test/e2e/capture-dedup-postgres.test.ts"],+ "src/core/facts/single-prepare.ts": ["test/e2e/capture-dedup-postgres.test.ts", "test/e2e/p8-memory-writes-postgres.test.ts"],+ // P8: review accept claims and remember.replaces refusals under the target row lock on Postgres.+ "src/core/facts/proposal-review.ts": ["test/e2e/p8-memory-writes-postgres.test.ts"],"src/core/facts/write-single.ts": ["test/e2e/managed-write-single-attribution-postgres.test.ts", "test/e2e/managed-facts-writers.test.ts", "test/e2e/fix-wave-5-integration.test.ts"],"src/core/facts/managed-fact-write.ts": ["test/e2e/managed-write-single-attribution-postgres.test.ts", "test/e2e/managed-facts-writers.test.ts"],// Fix wave 5 (#5409): read-only mirror sources.@@ -109,7 +111,7 @@ export const E2E_TEST_MAP: Record<string, string[]> = {"src/commands/export.ts": ["test/e2e/export-snapshot-postgres.test.ts", "test/e2e/memory-safety-wave-postgres.test.ts"],"src/core/export-*.ts": ["test/e2e/export-snapshot-postgres.test.ts", "test/e2e/memory-safety-wave-postgres.test.ts"],// System One decide storage, egress page query and decide_health on Postgres/PgBouncer.- "src/core/ai/decide/**": ["test/e2e/decide-store-postgres.test.ts"],+ "src/core/ai/decide/**": ["test/e2e/decide-store-postgres.test.ts", "test/e2e/p8-memory-writes-postgres.test.ts"],// #5836 facts relink: write-target routing (file, page body, unbound refusal, managed) on Postgres."src/core/facts/relink*.ts": ["test/e2e/facts-relink-routing.test.ts"],"src/core/persistence/fact-write-target.ts": ["test/e2e/facts-relink-routing.test.ts"],diff --git a/src/commands/init.ts b/src/commands/init.tsindex 92e4b184c2..120c3cea48 100644--- a/src/commands/init.ts+++ b/src/commands/init.ts@@ -18,7 +18,7 @@ import type { BrainEngine } from '../core/engine.ts';import { readPrimaryEmbeddingStores, readStoredEmbeddingIdentity } from '../core/stored-embedding-identity.ts';import { deferInitJsonError, flushInitJsonResult, initJsonError, setInitJsonResult, writeDeferredInitJsonError } from './init-json.ts';import { deferredEmbeddingHint, firstRunBundle, firstRunJson, harnessRegistrationCommand } from './init-first-run.ts';-import { newInstallAdvertisedSurface } from '../mcp/surface.ts';+import { newInstallAdvertisedSurface } from '../mcp/new-install-surface.ts';import { writeCliNotices } from '../core/interop-notices.ts';import { exitCodeForCode } from '../core/error-catalogue.ts';import { promptLineStderr } from '../core/interaction.ts';diff --git a/src/core/readiness.ts b/src/core/readiness.tsindex 0f99440fdc..ada9fa8f23 100644--- a/src/core/readiness.ts+++ b/src/core/readiness.ts@@ -41,7 +41,7 @@ import { validateMountId } from './brain-registry.ts';import { agentProcessMarker } from './interaction.ts';import { resolveGbrainBin } from './gbrain-bin.ts';import { resolveWritebackConfigFromFile } from './facts/writeback-config.ts';-import { newInstallServeSurface } from '../mcp/surface.ts';+import { newInstallServeSurface } from '../mcp/new-install-surface.ts';export type ReadinessState = 'ok' | 'disabled_by_choice' | 'not_applicable' | 'missing' | 'degraded' | 'unknown';export type CapabilityId =diff --git a/src/mcp/new-install-surface.ts b/src/mcp/new-install-surface.tsnew file mode 100644index 0000000000..69ad104aba--- /dev/null+++ b/src/mcp/new-install-surface.ts@@ -0,0 +1,27 @@+/**+ * New-install MCP surface defaults, kept import-free so first-run and+ * readiness code can read them without loading the operation catalog.+ */+type Surface = 'verbs' | 'starter' | 'full';++/**+ * The surface fresh installs list to agents (`gbrain init` writes it to+ * `mcp.advertised_surface`). The held-out agent benchmark chooses between+ * 'verbs' and 'starter'; until it does, fresh installs list everything.+ */+export const NEW_INSTALL_ADVERTISED_SURFACE: Surface = 'full';++/**+ * The `serve --surface` a readiness/quickstart registration writes. Once the+ * benchmark picks an advertised surface, registrations call everything+ * (`full`) and init's advertised surface narrows the list; until then they+ * keep the seven verbs.+ */+export function newInstallServeSurface(): Surface {+ return NEW_INSTALL_ADVERTISED_SURFACE === 'full' ? 'verbs' : 'full';+}++/** What a fresh `gbrain init` writes into `mcp`: the advertised surface, unless it is 'full'. */+export function newInstallAdvertisedSurface(): { advertised_surface?: 'verbs' | 'starter' } {+ return NEW_INSTALL_ADVERTISED_SURFACE === 'full' ? {} : { advertised_surface: NEW_INSTALL_ADVERTISED_SURFACE };+}diff --git a/src/mcp/surface.ts b/src/mcp/surface.tsindex 745d123a9d..2dcb2974e6 100644--- a/src/mcp/surface.ts+++ b/src/mcp/surface.ts@@ -36,6 +36,7 @@ import type { BrainEngine } from '../core/engine.ts';import { VERB_NAMES } from '../core/verbs.ts';import { opError } from '../core/ops/contract.ts';import { BRAIN_TOOL_ALLOWLIST } from '../core/minions/tools/brain-allowlist.ts';+export { NEW_INSTALL_ADVERTISED_SURFACE, newInstallAdvertisedSurface, newInstallServeSurface } from './new-install-surface.ts';export type McpSurface = 'verbs' | 'starter' | 'full';@@ -286,12 +287,6 @@ export async function resolveDefaultClientSurface(return isMcpSurface(fileVal) ? fileVal : null;}-/**- * The surface fresh installs list to agents (`gbrain init` writes it to- * `mcp.advertised_surface`). The held-out agent benchmark chooses between- * 'verbs' and 'starter'; until it does, fresh installs list everything.- */-export const NEW_INSTALL_ADVERTISED_SURFACE: McpSurface = 'full';/*** `mcp.advertised_surface`: which tools `tools/list` shows. The callable set@@ -343,20 +338,6 @@ export function stdioToolListing(advertised: () => Promise<McpSurface | null>, c};}-/**- * The `serve --surface` a readiness/quickstart registration writes. Once the- * benchmark picks an advertised surface, registrations call everything- * (`full`) and init's advertised surface narrows the list; until then they- * keep the seven verbs.- */-export function newInstallServeSurface(): McpSurface {- return NEW_INSTALL_ADVERTISED_SURFACE === 'full' ? 'verbs' : 'full';-}--/** What a fresh `gbrain init` writes into `mcp`: the advertised surface, unless it is 'full'. */-export function newInstallAdvertisedSurface(): { advertised_surface?: 'verbs' | 'starter' } {- return NEW_INSTALL_ADVERTISED_SURFACE === 'full' ? {} : { advertised_surface: NEW_INSTALL_ADVERTISED_SURFACE };-}/*** D2 CEILING resolution — the per-request effective surface on the OAuth