@blockrun/franklin 3.32.1 → 3.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/README.md +23 -2
  2. package/dist/agent/approvals.d.ts +47 -0
  3. package/dist/agent/approvals.js +66 -0
  4. package/dist/agent/commands.js +230 -7
  5. package/dist/agent/compact.js +1 -1
  6. package/dist/agent/context.js +1 -1
  7. package/dist/agent/input-queue.d.ts +26 -0
  8. package/dist/agent/input-queue.js +65 -0
  9. package/dist/agent/loop.js +198 -5
  10. package/dist/agent/optimize.js +1 -1
  11. package/dist/agent/streaming-executor.d.ts +4 -0
  12. package/dist/agent/streaming-executor.js +52 -0
  13. package/dist/agent/tokens.js +2 -0
  14. package/dist/agent/tool-guard.d.ts +7 -0
  15. package/dist/agent/tool-guard.js +21 -0
  16. package/dist/agent/types.d.ts +26 -0
  17. package/dist/audit/approvals.d.ts +20 -0
  18. package/dist/audit/approvals.js +21 -0
  19. package/dist/commands/init.js +1 -1
  20. package/dist/commands/models.d.ts +11 -0
  21. package/dist/commands/models.js +157 -37
  22. package/dist/commands/start.d.ts +10 -1
  23. package/dist/commands/start.js +53 -1
  24. package/dist/events/types.d.ts +38 -1
  25. package/dist/gateway-models.d.ts +14 -2
  26. package/dist/gateway-models.js +8 -0
  27. package/dist/goal/engine.d.ts +39 -0
  28. package/dist/goal/engine.js +182 -0
  29. package/dist/goal/prompts.d.ts +16 -0
  30. package/dist/goal/prompts.js +206 -0
  31. package/dist/goal/runtime.d.ts +20 -0
  32. package/dist/goal/runtime.js +110 -0
  33. package/dist/goal/store.d.ts +22 -0
  34. package/dist/goal/store.js +79 -0
  35. package/dist/goal/types.d.ts +63 -0
  36. package/dist/goal/types.js +26 -0
  37. package/dist/hooks/loader.d.ts +19 -0
  38. package/dist/hooks/loader.js +115 -0
  39. package/dist/hooks/runner.d.ts +31 -0
  40. package/dist/hooks/runner.js +147 -0
  41. package/dist/hooks/types.d.ts +64 -0
  42. package/dist/hooks/types.js +35 -0
  43. package/dist/index.js +5 -1
  44. package/dist/learnings/extractor.js +1 -1
  45. package/dist/memory/capture.d.ts +40 -0
  46. package/dist/memory/capture.js +95 -0
  47. package/dist/memory/dream.d.ts +24 -0
  48. package/dist/memory/dream.js +147 -0
  49. package/dist/memory/indexer.d.ts +29 -0
  50. package/dist/memory/indexer.js +144 -0
  51. package/dist/memory/store.d.ts +50 -0
  52. package/dist/memory/store.js +163 -0
  53. package/dist/monitors/registry.d.ts +42 -0
  54. package/dist/monitors/registry.js +104 -0
  55. package/dist/panel/html.js +299 -0
  56. package/dist/panel/server.js +41 -0
  57. package/dist/pricing.js +4 -1
  58. package/dist/router/index.js +15 -9
  59. package/dist/router/vision.js +5 -4
  60. package/dist/scheduler/service.d.ts +24 -0
  61. package/dist/scheduler/service.js +44 -0
  62. package/dist/scheduler/store.d.ts +26 -0
  63. package/dist/scheduler/store.js +116 -0
  64. package/dist/scheduler/types.d.ts +36 -0
  65. package/dist/scheduler/types.js +31 -0
  66. package/dist/serve/agent-host.d.ts +63 -0
  67. package/dist/serve/agent-host.js +270 -0
  68. package/dist/serve/server.js +131 -2
  69. package/dist/session/live-registry.d.ts +32 -0
  70. package/dist/session/live-registry.js +83 -0
  71. package/dist/session/search.d.ts +6 -0
  72. package/dist/session/search.js +3 -3
  73. package/dist/session/storage.d.ts +6 -0
  74. package/dist/session/storage.js +6 -0
  75. package/dist/tools/goal.d.ts +7 -0
  76. package/dist/tools/goal.js +29 -0
  77. package/dist/tools/index.js +11 -0
  78. package/dist/tools/memory.js +14 -4
  79. package/dist/tools/moa.js +1 -1
  80. package/dist/tools/monitor.d.ts +11 -0
  81. package/dist/tools/monitor.js +96 -0
  82. package/dist/tools/scheduler.d.ts +12 -0
  83. package/dist/tools/scheduler.js +79 -0
  84. package/dist/tools/spend-tools.d.ts +33 -0
  85. package/dist/tools/spend-tools.js +114 -0
  86. package/dist/tools/tool-categories.js +7 -0
  87. package/dist/tools/trade-plan.d.ts +11 -0
  88. package/dist/tools/trade-plan.js +137 -0
  89. package/dist/tools/trading-execute.js +24 -0
  90. package/dist/trading/trade-plan.d.ts +75 -0
  91. package/dist/trading/trade-plan.js +290 -0
  92. package/dist/ui/app.js +54 -9
  93. package/dist/ui/model-picker.d.ts +40 -0
  94. package/dist/ui/model-picker.js +135 -25
  95. package/package.json +2 -2
  96. package/dist/agent/media-router.d.ts +0 -98
  97. package/dist/agent/media-router.js +0 -328
@@ -4,6 +4,7 @@
4
4
  */
5
5
  import readline from 'node:readline';
6
6
  import chalk from 'chalk';
7
+ import { getGatewayModels } from '../gateway-models.js';
7
8
  // ─── Model Shortcuts (same as proxy) ───────────────────────────────────────
8
9
  export const MODEL_SHORTCUTS = {
9
10
  // Routing profiles — Auto is the only profile surfaced in the picker.
@@ -29,8 +30,8 @@ export const MODEL_SHORTCUTS = {
29
30
  'opus-4.7': 'anthropic/claude-opus-4.7',
30
31
  'opus-4.6': 'anthropic/claude-opus-4.6',
31
32
  'opus-4.5': 'anthropic/claude-opus-4.5',
32
- haiku: 'anthropic/claude-haiku-4.5-20251001',
33
- 'haiku-4.5': 'anthropic/claude-haiku-4.5-20251001',
33
+ haiku: 'anthropic/claude-haiku-4.5',
34
+ 'haiku-4.5': 'anthropic/claude-haiku-4.5',
34
35
  // OpenAI
35
36
  // `gpt` / `gpt5` / `gpt-5` follow the gateway's flagship — currently 5.6 Sol.
36
37
  gpt: 'openai/gpt-5.6-sol',
@@ -64,9 +65,13 @@ export const MODEL_SHORTCUTS = {
64
65
  'gemini-3.5-flash': 'google/gemini-3.5-flash',
65
66
  'gemini-3': 'google/gemini-3.1-pro',
66
67
  'gemini-3.1': 'google/gemini-3.1-pro',
67
- // xAI — grok-4.3 is the public flagship since 2026-06-04 (grok-3 and the
68
- // fast families are hidden on the gateway; explicit IDs still resolve).
69
- grok: 'xai/grok-4.3',
68
+ // xAI — grok-4.5 is the public flagship since 2026-07-14; `grok` follows it
69
+ // per the bare-alias-tracks-flagship convention. 4.3 stays pinned: it's
70
+ // cheaper ($1.5/$4 vs $2.5/$9) and carries 1M context to 4.5's 500K, so it's
71
+ // the better pick for long-context work. (grok-3 and the fast families are
72
+ // hidden on the gateway; explicit IDs still resolve.)
73
+ grok: 'xai/grok-4.5',
74
+ 'grok-4.5': 'xai/grok-4.5',
70
75
  'grok-4.3': 'xai/grok-4.3',
71
76
  'grok-build': 'xai/grok-build-0.1',
72
77
  'grok-3': 'xai/grok-3',
@@ -98,7 +103,6 @@ export const MODEL_SHORTCUTS = {
98
103
  qwen3: 'nvidia/qwen3-next-80b-a3b-instruct',
99
104
  'qwen3-next': 'nvidia/qwen3-next-80b-a3b-instruct',
100
105
  'qwen3.5': 'nvidia/qwen3.5-122b-a10b',
101
- maverick: 'nvidia/llama-4-maverick',
102
106
  glm4: 'nvidia/qwen3-next-80b-a3b-instruct',
103
107
  'deepseek-free': 'nvidia/qwen3-next-80b-a3b-instruct',
104
108
  'qwen-coder': 'nvidia/qwen3-next-80b-a3b-instruct',
@@ -107,19 +111,24 @@ export const MODEL_SHORTCUTS = {
107
111
  'gpt-oss-small': 'nvidia/qwen3-next-80b-a3b-instruct',
108
112
  'mistral-small': 'nvidia/qwen3-next-80b-a3b-instruct',
109
113
  'mistral-nemotron': 'nvidia/mistral-nemotron',
110
- // llama shortcuts point at the still-live free maverick model (not the free
111
- // default — that's qwen3-next above). Kept as explicit aliases so the name
112
- // resolves for users who type it.
113
- llama: 'nvidia/llama-4-maverick',
114
- 'llama-4': 'nvidia/llama-4-maverick',
115
- 'llama-4-maverick': 'nvidia/llama-4-maverick',
114
+ // Maverick left the gateway catalog on/before 2026-07-14. The id still
115
+ // answers, but only because the free pool silently substitutes another model
116
+ // for it — so pointing users at it would be promising a model they don't get.
117
+ // Follow the established retired-free-id pattern instead: resolve to the
118
+ // current free default so muscle memory keeps working.
119
+ llama: 'nvidia/qwen3-next-80b-a3b-instruct',
120
+ 'llama-4': 'nvidia/qwen3-next-80b-a3b-instruct',
121
+ 'llama-4-maverick': 'nvidia/qwen3-next-80b-a3b-instruct',
122
+ maverick: 'nvidia/qwen3-next-80b-a3b-instruct',
116
123
  // Backward-compatibility aliases for models the gateway retired or exposes
117
124
  // unreliably on /v1/messages. Map to agent-tested free models so shortcuts
118
125
  // keep working without silent paid fallback or empty tool-use turns.
119
126
  // Map to the closest current free model so old session records + user
120
127
  // muscle memory keep working.
121
- nemotron: 'nvidia/llama-4-maverick',
122
- devstral: 'nvidia/llama-4-maverick',
128
+ // `nemotron` now resolves to the real Mistral Nemotron (in-catalog, and one
129
+ // of the few free ids that verifiably serves itself) rather than to Maverick.
130
+ nemotron: 'nvidia/mistral-nemotron',
131
+ devstral: 'nvidia/qwen3-next-80b-a3b-instruct',
123
132
  // Others
124
133
  minimax: 'minimax/minimax-m3',
125
134
  'm3': 'minimax/minimax-m3',
@@ -227,7 +236,7 @@ export const PICKER_CATEGORIES = [
227
236
  { id: 'openai/gpt-5.6-sol', shortcut: 'gpt', label: 'GPT-5.6 Sol', price: '$5/$30', highlight: true },
228
237
  { id: 'google/gemini-3.1-pro', shortcut: 'gemini-3', label: 'Gemini 3.1 Pro', price: '$2/$12' },
229
238
  { id: 'google/gemini-2.5-pro', shortcut: 'gemini', label: 'Gemini 2.5 Pro', price: '$1.25/$10' },
230
- { id: 'xai/grok-4.3', shortcut: 'grok', label: 'Grok 4.3', price: '$1.5/$4' },
239
+ { id: 'xai/grok-4.5', shortcut: 'grok', label: 'Grok 4.5', price: '$2.5/$9' },
231
240
  ],
232
241
  },
233
242
  {
@@ -249,7 +258,7 @@ export const PICKER_CATEGORIES = [
249
258
  {
250
259
  category: '💰 Budget',
251
260
  models: [
252
- { id: 'anthropic/claude-haiku-4.5-20251001', shortcut: 'haiku', label: 'Claude Haiku 4.5', price: '$1/$5' },
261
+ { id: 'anthropic/claude-haiku-4.5', shortcut: 'haiku', label: 'Claude Haiku 4.5', price: '$1/$5' },
253
262
  { id: 'openai/gpt-5-mini', shortcut: 'mini', label: 'GPT-5 Mini', price: '$0.25/$2' },
254
263
  { id: 'google/gemini-2.5-flash', shortcut: 'flash', label: 'Gemini 2.5 Flash', price: '$0.3/$2.5' },
255
264
  // Re-aliased to V4 Flash Chat upstream — context 1M, price 30% lower.
@@ -267,26 +276,124 @@ export const PICKER_CATEGORIES = [
267
276
  {
268
277
  category: '🆓 Free (no USDC needed)',
269
278
  models: [
270
- // Qwen3-Next 80B leads: cleanest free instruction-follower (no thinking
271
- // leak / markdown fences — verified live 2026-07-11) and the default the
272
- // `free` shortcut + free routing profile resolve to. Llama 4 Maverick is
273
- // the diverse-family secondary. (nvidia/deepseek-v4-flash removed
274
- // 2026-07-11: the gateway 410s on it.) Both are $0 — the free tier never
275
- // falls back to a paid model.
279
+ // Qwen3-Next 80B leads: it's what the `free` shortcut + free routing
280
+ // profile resolve to. Mistral Nemotron is the diverse-family secondary,
281
+ // promoted 2026-07-14 when nvidia/llama-4-maverick fell out of the
282
+ // gateway catalog. Both are $0 — the free tier never falls back to paid.
283
+ //
284
+ // Caveat worth knowing before editing this list: the NVIDIA free pool
285
+ // silently substitutes. Verified live 2026-07-14 — qwen3-next and
286
+ // mistral-large-3-675b both came back served by
287
+ // `nvidia/nemotron-3-super-120b-a12b-free`, so the free id you request
288
+ // is not necessarily the one you get. mistral-nemotron was picked as the
289
+ // secondary precisely because it does serve itself, consistently, and
290
+ // answers without leaking reasoning prose.
276
291
  { id: 'nvidia/qwen3-next-80b-a3b-instruct', shortcut: 'free', label: 'Qwen3-Next 80B', price: 'FREE', highlight: true },
277
- { id: 'nvidia/llama-4-maverick', shortcut: 'maverick', label: 'Llama 4 Maverick', price: 'FREE' },
292
+ { id: 'nvidia/mistral-nemotron', shortcut: 'nemotron', label: 'Mistral Nemotron', price: 'FREE' },
278
293
  ],
279
294
  },
280
295
  ];
281
296
  /** Flat list of all picker models (for index-based navigation). */
282
297
  export const PICKER_MODELS_FLAT = PICKER_CATEGORIES.flatMap(c => c.models);
283
- // Kept for backward compatibility with the readline pickModel() below.
284
- const PICKER_MODELS = PICKER_CATEGORIES;
298
+ // ─── Live hydration against the gateway catalog ────────────────────────────
299
+ /**
300
+ * Synthetic ids that are Franklin concepts, not gateway models (`blockrun/auto`
301
+ * is a routing profile resolved client-side). They never appear in the catalog,
302
+ * so they're exempt from the drop-if-absent rule below.
303
+ */
304
+ function isSyntheticId(id) {
305
+ return id.startsWith('blockrun/');
306
+ }
307
+ /** Render a gateway price object into the picker's display format. */
308
+ function formatPrice(m) {
309
+ const p = m.pricing;
310
+ switch (m.billing_mode) {
311
+ case 'free':
312
+ return 'FREE';
313
+ case 'paid':
314
+ return `$${p.input ?? 0}/$${p.output ?? 0}`;
315
+ case 'flat':
316
+ return `$${p.flat ?? 0} flat`;
317
+ default:
318
+ // Non-chat billing modes (per_image/per_second/…) shouldn't reach the
319
+ // picker, but don't invent a number if one does.
320
+ return '—';
321
+ }
322
+ }
323
+ /**
324
+ * The picker list, reconciled against the live gateway catalog.
325
+ *
326
+ * {@link PICKER_CATEGORIES} stays the editorial layer — which models are worth
327
+ * featuring, in what order, under which heading, with which shortcut. The
328
+ * gateway is the source of truth for everything factual: whether a model still
329
+ * exists, its display name, and its price. That split is deliberate: the
330
+ * gateway lists 57 chat models and the picker deliberately shows ~21 (see the
331
+ * v3.9.3 trim), so we can't just render the catalog.
332
+ *
333
+ * Reconciliation rules:
334
+ * - Curated row present in the catalog → refresh its label + price from the
335
+ * gateway, so a price change upstream can't leave a stale number on screen.
336
+ * - Curated row absent → drop it. This is the self-healing half: an id the
337
+ * gateway retired (the `claude-haiku-4.5-20251001` case) stops being
338
+ * offered without waiting on a Franklin release. Its MODEL_SHORTCUTS alias
339
+ * survives, matching the long-standing "hide the row, keep the shortcut"
340
+ * pattern.
341
+ * - Gateway unreachable → serve the static list verbatim (`live: false`).
342
+ * An offline picker showing a slightly stale list beats an empty one.
343
+ *
344
+ * Note the catalog hides some models that still resolve (grok-3 and the xAI
345
+ * fast family, for instance). Hidden-but-working ids are therefore dropped from
346
+ * the *visible* list while remaining reachable by typing the shortcut — which
347
+ * is the intended behavior, not a bug.
348
+ */
349
+ export async function getPickerCategories() {
350
+ try {
351
+ return reconcilePicker(await getGatewayModels());
352
+ }
353
+ catch {
354
+ return { categories: PICKER_CATEGORIES, moreCount: 0, live: false };
355
+ }
356
+ }
357
+ /**
358
+ * Pure reconciliation step behind {@link getPickerCategories} — exported so the
359
+ * rules can be tested against a synthetic catalog without touching the network.
360
+ */
361
+ export function reconcilePicker(catalog) {
362
+ const byId = new Map(catalog.map(m => [m.id, m]));
363
+ const categories = [];
364
+ const curated = new Set();
365
+ for (const cat of PICKER_CATEGORIES) {
366
+ const models = [];
367
+ for (const row of cat.models) {
368
+ curated.add(row.id);
369
+ if (isSyntheticId(row.id)) {
370
+ models.push(row);
371
+ continue;
372
+ }
373
+ const live = byId.get(row.id);
374
+ if (!live)
375
+ continue; // retired upstream — drop the row, keep the alias
376
+ // Price comes from the gateway (it's factual, it drifts, and it's the
377
+ // user's money). The label stays curated: gateway names are longer than
378
+ // the picker's tuned columns ("Qwen3-Next 80B Instruct (Free)" is 30
379
+ // chars against a 26-wide field) and carry redundant "(Free)" suffixes
380
+ // that the 🆓 heading already says.
381
+ models.push({ ...row, price: formatPrice(live) });
382
+ }
383
+ if (models.length > 0)
384
+ categories.push({ ...cat, models });
385
+ }
386
+ const moreCount = catalog.filter(m => m.categories?.includes('chat') && !curated.has(m.id)).length;
387
+ return { categories, moreCount, live: true };
388
+ }
285
389
  /**
286
390
  * Show interactive model picker. Returns the selected model ID.
287
391
  * Falls back to text input if terminal doesn't support raw mode.
288
392
  */
289
393
  export async function pickModel(currentModel) {
394
+ // Same gateway reconciliation the Ink picker gets — falls back to the static
395
+ // curation when the catalog is unreachable.
396
+ const { categories: PICKER_MODELS, moreCount } = await getPickerCategories();
290
397
  // Flatten for numbering
291
398
  const allModels = [];
292
399
  for (const cat of PICKER_MODELS) {
@@ -306,6 +413,9 @@ export async function pickModel(currentModel) {
306
413
  }
307
414
  console.error('');
308
415
  }
416
+ if (moreCount > 0) {
417
+ console.error(chalk.dim(` + ${moreCount} more on gateway — run \`franklin models\` to list them.\n`));
418
+ }
309
419
  console.error(chalk.dim(' Enter number, shortcut, or full model ID:'));
310
420
  // Read input
311
421
  const rl = readline.createInterface({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockrun/franklin",
3
- "version": "3.32.1",
3
+ "version": "3.34.0",
4
4
  "description": "Franklin Agent — The AI agent with a wallet. Spends USDC autonomously to get real work done. Pay per action, no subscriptions.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -31,7 +31,7 @@
31
31
  "build": "tsc && node scripts/copy-plugin-assets.mjs",
32
32
  "dev": "tsc --watch",
33
33
  "start": "node dist/index.js",
34
- "test": "npm run build && node --test --test-reporter=spec test/local.mjs test/skills.local.mjs test/repair.mjs test/model-resolver.mjs test/exa.local.mjs test/audit-batch.local.mjs test/polymarket.local.mjs test/market.local.mjs",
34
+ "test": "npm run build && node --test --test-concurrency=4 --test-reporter=spec test/local.mjs test/skills.local.mjs test/repair.mjs test/model-resolver.mjs test/exa.local.mjs test/audit-batch.local.mjs test/polymarket.local.mjs test/market.local.mjs test/hooks.local.mjs test/scheduler.local.mjs test/trade-plan.local.mjs test/goal.local.mjs test/memory.local.mjs test/agent-host.local.mjs",
35
35
  "test:e2e": "npm run build && node --test --test-reporter=spec test/e2e.mjs",
36
36
  "test:free-models": "npm run build && node --test --test-reporter=spec test/free-model-matrix.mjs",
37
37
  "test:all": "npm run test && npm run test:e2e",
@@ -1,98 +0,0 @@
1
- /**
2
- * Media router — one LLM call that picks which image/video model fits
3
- * the user's request, with alternatives and cost estimates, so the agent
4
- * can show a clean AskUser proposal before spending.
5
- *
6
- * Principle (matches turn-analyzer): harness orchestrates, free model
7
- * decides. No keyword-to-model mapping in TypeScript. Classifier reads
8
- * the prompt + the current gateway catalog (pulled dynamically), picks
9
- * one recommended model plus a cheaper + a premium alternative, and
10
- * explains the choice in one sentence.
11
- *
12
- * Cost estimates come from `gateway-models.ts` — always dynamic,
13
- * margin-adjusted.
14
- */
15
- import type { ModelClient } from './llm.js';
16
- export type MediaKind = 'image' | 'video';
17
- export type MediaStyle = 'photoreal' | 'illustration' | 'anime' | 'logo' | 'concept' | 'other';
18
- export type MediaPriority = 'cost' | 'quality' | 'balanced';
19
- export interface MediaChoice {
20
- model: string;
21
- estimatedCostUsd: number;
22
- rationale: string;
23
- }
24
- export interface MediaProposal {
25
- kind: MediaKind;
26
- quantity: number;
27
- durationSeconds?: number;
28
- maxDurationSeconds?: number;
29
- recommended: MediaChoice;
30
- cheaper?: MediaChoice;
31
- premium?: MediaChoice;
32
- intent: {
33
- style: MediaStyle;
34
- priority: MediaPriority;
35
- };
36
- /**
37
- * A fuller rewrite of the user's prompt, following the 5-slot template
38
- * (scene/subject/details/use-case/constraints). Null when the classifier
39
- * judged the input already well-specified, or when the env opt-out is set,
40
- * or when the rewrite was identical to the raw input. When non-null, the
41
- * AskUser layout surfaces it as "Refined:" with a "Use ORIGINAL" option.
42
- */
43
- refinedPrompt: string | null;
44
- refinementSummary: string;
45
- totalCostUsd: number;
46
- }
47
- export declare function clearMediaRouterCache(): void;
48
- /**
49
- * Normalize a refined prompt: trim, cap length, reject obvious junk.
50
- * Returns null when the value should be treated as absent (missing,
51
- * non-string, empty after trim).
52
- *
53
- * Exported for testability — invariants matter more here than elsewhere
54
- * because the output is user-visible and paid for.
55
- */
56
- export declare function validateRefined(raw: unknown, maxChars: number): string | null;
57
- /**
58
- * Whitespace-insensitive, case-insensitive identity check — if the
59
- * classifier's "refinement" is just the input with different spacing,
60
- * don't bother the user with a "Refined:" block.
61
- */
62
- export declare function isEffectivelyIdentical(a: string, b: string): boolean;
63
- export declare const REFINED_PROMPT_MAX_CHARS = 500;
64
- export declare const REFINEMENT_SUMMARY_LIMIT = 80;
65
- export interface AnalyzeMediaOpts {
66
- kind: MediaKind;
67
- prompt: string;
68
- client: ModelClient;
69
- quantity?: number;
70
- durationSeconds?: number;
71
- signal?: AbortSignal;
72
- /**
73
- * One-shot opt-out — caller stripped a `///` prefix from the user's input
74
- * and wants the proposal rendered without a Refined block or Use-original
75
- * option. The classifier still runs (for model selection), but the
76
- * refinement is discarded at parse time.
77
- */
78
- skipRefine?: boolean;
79
- }
80
- /**
81
- * Pick the best model + alternatives for this media request. Returns null
82
- * on any failure path (classifier timeout, parse error, empty catalog) so
83
- * the caller can fall back to its old hardcoded default rather than
84
- * blocking the user.
85
- */
86
- export declare function analyzeMediaRequest(opts: AnalyzeMediaOpts): Promise<MediaProposal | null>;
87
- /**
88
- * Render a proposal as the user-facing AskUser question. Layout matches
89
- * the spec from v3.8.31 planning: recommended first with • bullet,
90
- * alternatives below with ○ bullets, prices include the 5% margin note.
91
- */
92
- export declare function renderProposalForAskUser(p: MediaProposal, userPrompt: string): {
93
- question: string;
94
- options: Array<{
95
- id: string;
96
- label: string;
97
- }>;
98
- };