Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix(chronicle): keep flag literals out of modules the flag registry scans (#5876)
garrytan2748d1ab92ea
diff --git a/src/core/chronicle/reasons.ts b/src/core/chronicle/reasons.tsindex 7e29feb252..9e5ca04621 100644--- a/src/core/chronicle/reasons.ts+++ b/src/core/chronicle/reasons.ts@@ -1,6 +1,7 @@// Life Chronicle (#5876): the one reason table for automatic event extraction, and the// `chronicle_backstop` write-receipt field built from it. Docs (docs/guides/life-chronicle.md)// and tests render from CHRONICLE_REASONS; nothing else spells these codes out.+import { pricingSetCommand } from '../budget/no-pricing.ts';/*** Local equivalent of the agent-operator `Action` (GBRA-42 `src/core/agent-output.ts`), same field@@ -104,8 +105,8 @@ export const CHRONICLE_REASONS = {why: 'Ask the user to configure a chat provider key on the brain host (see docs/ai-providers/); pending pages run on the next cycle.' }) },no_pricing: { stage: 'execution',meaning: (ctx) => `chronicle.job_budget_usd was set explicitly, and gbrain has no price for ${ctx.model ?? 'the chat model'}, so the cap cannot be enforced.`,- fix: (ctx) => ({ argv: ['gbrain', 'pricing', 'set', ctx.model ?? '<model>', '--input', '<usd-per-1M-input-tokens>',- '--output', '<usd-per-1M-output-tokens>', '--source', '<pricing-page-url>'], consent: [], actor: 'agent', requires_exclusive: false,+ fix: (ctx) => ({ argv: ['gbrain', 'pricing', 'set', ctx.model ?? '<model>', ...pricingSetCommand('model', 'chat').split(' ').slice(4)],+ consent: [], actor: 'agent', requires_exclusive: false,why: 'Look up the model\'s current price and register it on the brain host; extraction retries on the next cycle.',inputs: [{ name: 'usd-per-1M-input-tokens', how: 'the provider pricing page' },{ name: 'usd-per-1M-output-tokens', how: 'the provider pricing page' },diff --git a/src/core/chronicle/upgrade-notice.ts b/src/core/chronicle/upgrade-notice.tsindex 3a195a39f4..fc3f084075 100644--- a/src/core/chronicle/upgrade-notice.ts+++ b/src/core/chronicle/upgrade-notice.ts@@ -7,7 +7,7 @@ import {AUTO_CHRONICLE_KEEP_ARGV, AUTO_CHRONICLE_OPT_OUT_ARGV, CHRONICLE_NOTICE_SHOWN_KEY, autoChronicleNeedsAcknowledgement,chronicleSettings,} from './config.ts';-import { chronicleBackfillArgv } from './reasons.ts';+import { CHRONICLE_RUN_NOW_ARGV, chronicleBackfillArgv } from './reasons.ts';export interface ChronicleProviderView {/** Configured chat model id, or null when it cannot be resolved. */@@ -38,9 +38,8 @@ export async function autoChronicleUpgradeNotice(engine: BrainEngine, view?: Chrconst provider = view ?? await providerView(engine);const ceiling = settings.dailyLimit * settings.jobBudgetUsd;const since = new Date(Date.now() - 30 * 86_400_000).toISOString().slice(0, 10);- const runs = engine.kind === 'pglite'- ? 'On this PGLite brain, pending pages run inside the autopilot cycle; `gbrain dream --phase chronicle` runs them now.'- : 'On this Postgres brain, pending pages run in the autopilot cycle; `gbrain dream --phase chronicle` runs them now.';+ const runs = `On this ${engine.kind === 'pglite' ? 'PGLite' : 'Postgres'} brain, pending pages run in the autopilot cycle; ` ++ `\`${CHRONICLE_RUN_NOW_ARGV.join(' ')}\` runs them now.`;const cost = provider.priced? `Worst case: ${settings.dailyLimit} calls/day x $${settings.jobBudgetUsd.toFixed(2)} per-page cap = $${ceiling.toFixed(2)}/day with ${provider.model}. ` +'The cap is per page, not a daily budget; typical pages cost far less.'