Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
Merge the collector (polish, v0.60.38.0, 78f7d974) into capy/aow-lane-h
garrytan559dfab3de2b
diff --cc src/commands/init-first-run.tsindex 49b912f349,1158ce7e33..988b4e65c7--- a/src/commands/init-first-run.ts+++ b/src/commands/init-first-run.ts@@@ -5,16 -5,20 +5,20 @@@* non-blocking (exit 0); the agent relays the message and applies the chosen* options' argv.*- * Ownership: Lane G5 owns the bundle's content (adding `writeback` and- * `skills_scaffold`, the `user_message` wording, the harness smoke follow-up);- * Lane D ships this seam and the decisions it can build today:- * `search_mode` (the picker's recommendation and cost matrix) and- * `harness_wiring` (the A7 readiness fix). Extend `buildInitFirstRunNotices`- * rather than adding a second notice.+ * Decisions: `search_mode` (the picker's recommendation and cost matrix),+ * `writeback` (recommended `salient`, offered on a personal brain whose+ * operator has not answered), `harness_wiring` (the A7 readiness fix) and the+ * optional `skills_scaffold` (recommended skills missing from the detected+ * agent workspace; default skip). Human output renders the same bundle+ * (`[AGENT]` block without a terminal, `Note` lines on one); it replaces+ * init's separate writeback ask and skills pointer. Extend+ * `buildInitFirstRunNotices` rather than adding a second notice.*/- import { shellQuote, type Decision, type Notice } from '../core/agent-output.ts';- import type { GBrainConfig } from '../core/config.ts';- import { configReadiness, embeddingEnablement } from '../core/readiness.ts';+ import { cliRenderContext, renderNotice, shellQuote, type Decision, type Notice } from '../core/agent-output.ts';+ import { loadConfig, type GBrainConfig } from '../core/config.ts';+ import type { BrainEngine } from '../core/engine.ts';+ import { resolveGbrainBin } from '../core/gbrain-bin.ts';-import { configReadiness, harnessWiringEntry } from '../core/readiness.ts';++import { configReadiness, embeddingEnablement, harnessWiringEntry } from '../core/readiness.ts';import type { SearchMode } from '../core/search/mode.ts';export interface InitFirstRunInputs {@@@ -73,13 -113,29 +113,40 @@@ export function buildInitFirstRunNotice}];}+/**+ * The deferred-setup line init prints for `--no-embedding`: the same enable+ * command readiness gives doctor, embed and MCP (A7 `embeddingEnablement`:+ * resolved datastore, a provider that fits, pages and facts kept).+ */+export function deferredEmbeddingHint(cfg: GBrainConfig): string {+ const enable = embeddingEnablement(cfg);+ const step = enable.argv ? shellQuote(enable.argv) : 'gbrain doctor --only embeddings --json';+ return ` --no-embedding: deferred setup — enable later with \`${step}\` (\`config set embedding_model\` is refused by design)`;+}+++ /** init's bundle for this brain: reads the writeback gate and the agent workspace's missing skills. */+ export async function firstRunBundle(engine: BrainEngine, searchMode: { mode: SearchMode; reason: string } | undefined): Promise<Notice[]> {+ const { writebackAskApplies } = await import('../core/onboard/writeback-nudge.ts');+ const { initSkillsScaffold } = await import('../core/skillpack/post-install-advisory.ts');+ return buildInitFirstRunNotices({ searchMode, config: loadConfig(), writeback: await writebackAskApplies(engine), skillsScaffold: initSkillsScaffold() });+ }++ /** D2/G5: the bundle rendered into init's --json document (`notices`, empty → omitted). */+ export function firstRunJson(bundle: Notice[]): { notices?: unknown[]; contract_version: 1 } {+ const notices = bundle.map(n => renderNotice(n, cliRenderContext()));+ return { ...(notices.length ? { notices } : {}), contract_version: 1 };+ }++ /**+ * The harness registration line for init's quickstart: the readiness+ * `harness_wiring` fix (absolute binary, `--surface verbs`) for the detected+ * harness, else the Claude Code registration built the same way. Null when+ * the gbrain binary has no absolute path (never registered bare).+ */+ export function harnessRegistrationCommand(): string | null {+ const cfg = loadConfig();+ const detected = cfg ? configReadiness(cfg, { transport: 'cli' }).entries.find(e => e.capability === 'harness_wiring')?.fix : undefined;+ if (detected?.argv) return shellQuote(detected.argv);+ const claude = harnessWiringEntry({ transport: 'cli', harnesses: ['claude-code'], lockOwner: null, gbrainBin: resolveGbrainBin() }).fix;+ return claude?.argv ? shellQuote(claude.argv) : null;+ }diff --cc src/commands/init.tsindex 38a9517a20,eb300b7698..d5450e8916--- a/src/commands/init.ts+++ b/src/commands/init.ts@@@ -17,8 -17,8 +17,8 @@@ import { resolveSourceId } from '../corimport 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 { buildInitFirstRunNotices, deferredEmbeddingHint } from './init-first-run.ts';- import { renderNotice, cliRenderContext } from '../core/agent-output.ts';-import { firstRunBundle, firstRunJson, harnessRegistrationCommand } from './init-first-run.ts';++import { deferredEmbeddingHint, firstRunBundle, firstRunJson, harnessRegistrationCommand } from './init-first-run.ts';+ import { writeCliNotices } from '../core/interop-notices.ts';import { exitCodeForCode } from '../core/error-catalogue.ts';import { promptLineStderr } from '../core/interaction.ts';import type { SearchMode as SearchModeName } from '../core/search/mode.ts';