Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

test: operator-pinned fixtures say so; opencode door expects the verbs listing; serve --advertise help names real commands

garrytan3b278cc36f89
diff --git a/src/cli/help/serve.ts b/src/cli/help/serve.ts
index 672f87c15e..0c55326d9b 100644
--- a/src/cli/help/serve.ts
+++ b/src/cli/help/serve.ts
@@ -10,7 +10,7 @@ export const help: CliHelpSpec = {
flags: [
{ name: '--http', type: 'boolean', desc: 'Serve over HTTP with OAuth 2.1, the admin dashboard and per-token scopes.' },
{ name: '--surface', type: 'enum', values: ['verbs', 'starter', 'full'], desc: 'Tool surface: the 7 memory verbs, the daily-driver ops, or every operation. stdio: env GBRAIN_SURFACE > --surface > config mcp_surface > full; --http ignores GBRAIN_SURFACE.' },
- { name: '--advertise', type: 'enum', values: ['verbs', 'starter', 'full'], desc: 'The tools tools/list shows, narrower than --surface; every tool --surface allows stays callable and request_tools (always listed) describes the rest. Overrides config mcp.advertised_surface. Registrations gbrain writes pass --advertise verbs.' },
+ { name: '--advertise', type: 'enum', values: ['verbs', 'starter', 'full'], desc: 'The tools tools/list shows, narrower than --surface; every tool --surface allows stays callable and request_tools (always listed) describes the rest. Overrides config mcp.advertised_surface. New stdio registrations from gbrain setup and gbrain bootstrap hooks pass --advertise verbs.' },
{ name: '--access', type: 'enum', values: ['full', 'read-only'], desc: 'stdio only: read-only exposes read-scoped, non-mutating operations.' },
{ name: '--source-guard', type: 'boolean', desc: 'stdio only: refuse writes unless the source binding is deliberate or unambiguous.' },
{ name: '--stdio-idle-timeout', type: 'number', desc: 'stdio only: exit after this many idle seconds (0 = never).' },
diff --git a/test/bootstrap-opencode-door.serial.test.ts b/test/bootstrap-opencode-door.serial.test.ts
index ad6a52e21d..21cf4fbedd 100644
--- a/test/bootstrap-opencode-door.serial.test.ts
+++ b/test/bootstrap-opencode-door.serial.test.ts
@@ -188,7 +188,7 @@ describe('opencode workspace lane — default scope is USER-GLOBAL', () => {
};
expect(entry.type).toBe('local');
expect(entry.command[0]).toBe(FAKE_BIN); // user scope: absolute path
- expect(entry.command.slice(1)).toEqual(['serve', '--surface', 'full']);
+ expect(entry.command.slice(1)).toEqual(['serve', '--surface', 'full', '--advertise', 'verbs']);
expect(entry.environment.GBRAIN_SOURCE).toBeDefined();
expect(entry.enabled).toBe(true);
@@ -322,7 +322,7 @@ describe('opencode workspace lane — explicit project opt-in', () => {
const cfgPath = join(ws, 'opencode.json');
const parsed = parseOpencodeConfig(readFileSync(cfgPath, 'utf8'), cfgPath);
const entry = (parsed.mcp as Record<string, unknown>).gbrain as { command: string[] };
- expect(entry.command).toEqual(['gbrain', 'serve', '--surface', 'full']); // committed-candidate file: PATH-resolved, never absolute
+ expect(entry.command).toEqual(['gbrain', 'serve', '--surface', 'full', '--advertise', 'verbs']); // committed-candidate file: PATH-resolved, never absolute
expect(r.out).toContain('project (explicit opt-in)');
expect(r.err).toContain('SHARING WARNING');
expect(r.err).toContain('"enabled": false');
diff --git a/test/doctor-grant-new-ops.test.ts b/test/doctor-grant-new-ops.test.ts
index a1fa6a7ba5..c7a3aa0f87 100644
--- a/test/doctor-grant-new-ops.test.ts
+++ b/test/doctor-grant-new-ops.test.ts
@@ -43,7 +43,7 @@ const writerProfile = () => resolveGrantProfile({ profile: 'memory-writer', sour
async function legacyWriter(name: string): Promise<string> {
const profile = writerProfile();
const created = await provider.registerClientManual(name, ['client_credentials'], 'read write', [], 'default', undefined, undefined, undefined,
- { ...profile, surface: 'starter', allowedOperations: profile.allowedOperations!.filter(op => op !== 'put_pages') });
+ { ...profile, surface: 'starter', surfaceSetBy: 'operator', allowedOperations: profile.allowedOperations!.filter(op => op !== 'put_pages') });
await engine.executeRaw("UPDATE oauth_grant_audit SET after_grant = after_grant - 'catalogProvenance' WHERE client_id = $1", [created.clientId]);
return created.clientId;
}
diff --git a/test/e2e/client-grants.test.ts b/test/e2e/client-grants.test.ts
index 80f817cb9b..59fde9f848 100644
--- a/test/e2e/client-grants.test.ts
+++ b/test/e2e/client-grants.test.ts
@@ -180,7 +180,7 @@ suite('client capability grants — Postgres and admin HTTP', () => {
test('D4: an operator-pinned old client is reported, not widened, and still refused', async () => {
const old = await new GBrainOAuthProvider({ sql: sqlQueryForEngine(engine) }).registerClientManual('d4-old-' + randomUUID(), ['client_credentials'], 'read write', [], 'default', undefined, undefined, undefined,
- { ...resolveGrantProfile({ profile: 'memory-writer', sourceId: 'default' }), surface: 'starter' });
+ { ...resolveGrantProfile({ profile: 'memory-writer', sourceId: 'default' }), surface: 'starter', surfaceSetBy: 'operator' });
clients.push(old.clientId);
const before = await readClientGrant(engine, old.clientId);
const token = await clientToken(old.clientId, old.clientSecret!);