Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
chore(scanner): post-upgrade re-embed prompt reads through interaction.readLine; takes-bootstrap stops inviting a bare --yes (C8)
garrytan718d73a11041
diff --git a/scripts/agent-contract-baselines/interactive-io.tsv b/scripts/agent-contract-baselines/interactive-io.tsvindex fa02c3e56d..e0f98c8bed 100644--- a/scripts/agent-contract-baselines/interactive-io.tsv+++ b/scripts/agent-contract-baselines/interactive-io.tsv@@ -4,5 +4,4 @@ src/commands/init.ts 4src/commands/jobs-watch.ts 2src/commands/upgrade.ts 1src/commands/watch.ts 1-src/core/post-upgrade-reembed.ts 1src/mcp/server.ts 2diff --git a/scripts/agent-contract-baselines/yes-rerun-string.tsv b/scripts/agent-contract-baselines/yes-rerun-string.tsvindex 247b5f63df..75c3531f97 100644--- a/scripts/agent-contract-baselines/yes-rerun-string.tsv+++ b/scripts/agent-contract-baselines/yes-rerun-string.tsv@@ -6,7 +6,6 @@ src/commands/db-repair.ts 1src/commands/doctor/checks/memory-writeback.ts 2src/commands/mcp-expose.ts 3src/commands/migrations/v0_11_0.ts 1-src/commands/takes.ts 1src/core/page-state/credential-reseal.ts 1src/core/schema-migrations/v039-multimodal-dual-column-v0-27-1.ts 2src/core/schema-migrations/v045-facts-hot-memory-v0-31.ts 1diff --git a/src/commands/takes.ts b/src/commands/takes.tsindex b6f6248620..b9e7970b8f 100644--- a/src/commands/takes.ts+++ b/src/commands/takes.ts@@ -545,7 +545,7 @@ async function cmdExtract(engine: BrainEngine, rest: string[]): Promise<void> {const bootstrapEnabled = bootstrapEnabledCfg === 'true' || bootstrapEnabledCfg === '1';if (!bootstrapEnabled) {process.stderr.write(- `takes-bootstrap is opt-in. Enable with:\n gbrain config set takes.bootstrap_enabled true\nThen re-run with --yes.\n`,+ `takes-bootstrap is opt-in. Enable with:\n gbrain config set takes.bootstrap_enabled true\nThen run it again with the user's approval (--yes).\n`,);process.exit(2);}diff --git a/src/core/post-upgrade-reembed.ts b/src/core/post-upgrade-reembed.tsindex 8fe59c5590..82d9992636 100644--- a/src/core/post-upgrade-reembed.ts+++ b/src/core/post-upgrade-reembed.ts@@ -112,18 +112,11 @@ export interface PromptResult {export const REEMBED_DEFERRED_HINT = '[chunker-bump] Not re-embedding without your consent. When ready: `gbrain reindex --markdown` '+ '(re-embeds), or `gbrain repair safe-chunks --apply --no-embed` to re-chunk without provider calls, then `gbrain embed --stale`.';+/** interaction.readLine: EOF, a 5-minute silence or no human at the terminal read as "no". */async function askYesNo(question: string): Promise<boolean> {- const { createInterface } = await import('readline');- return new Promise<boolean>(resolveAnswer => {- const rl = createInterface({ input: process.stdin, output: process.stderr });- let answered = false;- rl.question(question, answer => {- answered = true;- resolveAnswer(/^y(es)?$/i.test(answer.trim()));- rl.close();- });- rl.on('close', () => { if (!answered) resolveAnswer(false); });- });+ const { readLine } = await import('./interaction.ts');+ const read = await readLine({ prompt: question });+ return read.kind === 'line' && /^y(es)?$/i.test(read.text);}/**@@ -162,7 +155,7 @@ export async function runPostUpgradeReembedPrompt(writeFn(formatReembedPrompt(estimate));- const isTTY = typeof opts.isTTY === 'boolean' ? opts.isTTY : Boolean(process.stdin.isTTY);+ const isTTY = typeof opts.isTTY === 'boolean' ? opts.isTTY : (await import('./interaction.ts')).isInteractive();if (!isTTY) {writeFn(REEMBED_DEFERRED_HINT);return { proceeded: false, reason: 'consent_required', estimate };