Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix(mcp): remember keeps the shared expected_revision/force definitions; starter hides them by name (cold-import identity)
garrytan1a4dd2f8e820
diff --git a/src/core/operation-manifest.generated.ts b/src/core/operation-manifest.generated.tsindex 84be31b6f6..c191ad0514 100644--- a/src/core/operation-manifest.generated.ts+++ b/src/core/operation-manifest.generated.ts@@ -22,13 +22,11 @@ export const OPERATION_MANIFEST: OperationMeta[] = [},"expected_revision": {"type": "string",- "description": "Revision read; omit to create.",- "fullSurfaceOnly": true+ "description": "Revision read; omit to create."},"force": {"type": "boolean",- "description": "Ignore the revision.",- "fullSurfaceOnly": true+ "description": "Ignore the revision."},"request_id": {"type": "string",diff --git a/src/core/verbs.ts b/src/core/verbs.tsindex 8fcb0a7055..0a734a5c6c 100644--- a/src/core/verbs.ts+++ b/src/core/verbs.ts@@ -68,8 +68,6 @@ const remember: Operation = {description: 'Save facts with provenance; set `entity` (the subject) or recall misses it. Branch on `status`; write_pending: poll get_write_request.',params: {...AGENT_CONTENT_PARAMS,- expected_revision: { ...AGENT_CONTENT_PARAMS.expected_revision, fullSurfaceOnly: true },- force: { ...AGENT_CONTENT_PARAMS.force, fullSurfaceOnly: true },fact: { type: 'string', description: 'One claim.' },items: {type: 'array',diff --git a/src/mcp/surface.ts b/src/mcp/surface.tsindex 17f0ac6760..cacde3cf64 100644--- a/src/mcp/surface.ts+++ b/src/mcp/surface.ts@@ -32,7 +32,7 @@* an explicit `--surface` restart.*/-import type { OperationMeta } from '../core/ops/contract.ts';+import type { OperationMeta, ParamDef } from '../core/ops/contract.ts';import type { Notice } from '../core/agent-output.ts';import type { GBrainConfig } from '../core/config.ts';import type { BrainEngine } from '../core/engine.ts';@@ -223,10 +223,16 @@ export function filterOpsForSurface<T extends OperationMeta>(ops: T[], surface:return ops.filter(op => STARTER_OPS.has(op.name)).map(starterParams);}-/** Starter ops advertise every param except the full-surface-only ones. */+/** Shared params a starter op leaves off its schema; the op keeps the shared definition, so every surface validates the same object. */+const STARTER_HIDDEN_PARAMS: Readonly<Record<string, ReadonlySet<string>>> = { remember: new Set(['expected_revision', 'force']) };++/** Starter ops advertise every param except the full-surface-only ones and their STARTER_HIDDEN_PARAMS. */function starterParams<T extends OperationMeta>(op: T): T {- if (!Object.values(op.params).some(p => p.fullSurfaceOnly)) return op;- return { ...op, params: Object.fromEntries(Object.entries(op.params).filter(([, p]) => !p.fullSurfaceOnly)) };+ const hidden = STARTER_HIDDEN_PARAMS[op.name];+ const keep = ([name, p]: [string, ParamDef]) => !p.fullSurfaceOnly && !hidden?.has(name);+ const params = Object.entries(op.params);+ if (params.every(keep)) return op;+ return { ...op, params: Object.fromEntries(params.filter(keep)) };}/** The fail-closed allow-set handed to dispatchToolCall. */