@dirgha/code 1.13.2 → 1.15.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 (32) hide show
  1. package/dist/cli/flags.js +15 -14
  2. package/dist/cli/flags.js.map +1 -1
  3. package/dist/cli/main.js +229 -152
  4. package/dist/cli/main.js.map +1 -1
  5. package/dist/cli/subcommands/ask.d.ts +1 -1
  6. package/dist/cli/subcommands/ask.js +53 -28
  7. package/dist/cli/subcommands/ask.js.map +1 -1
  8. package/dist/cli/subcommands/verify.d.ts +1 -1
  9. package/dist/cli/subcommands/verify.js +90 -37
  10. package/dist/cli/subcommands/verify.js.map +1 -1
  11. package/dist/tui/ink/App.d.ts +10 -10
  12. package/dist/tui/ink/App.js +359 -237
  13. package/dist/tui/ink/App.js.map +1 -1
  14. package/dist/tui/ink/components/DenseToolMessage.d.ts +3 -2
  15. package/dist/tui/ink/components/DenseToolMessage.js +50 -30
  16. package/dist/tui/ink/components/DenseToolMessage.js.map +1 -1
  17. package/dist/tui/ink/components/InputBox.d.ts +4 -2
  18. package/dist/tui/ink/components/InputBox.js +66 -31
  19. package/dist/tui/ink/components/InputBox.js.map +1 -1
  20. package/dist/tui/ink/components/ThinkingBlock.d.ts +4 -5
  21. package/dist/tui/ink/components/ThinkingBlock.js +17 -3
  22. package/dist/tui/ink/components/ThinkingBlock.js.map +1 -1
  23. package/dist/tui/ink/components/ToolBox.d.ts +2 -2
  24. package/dist/tui/ink/components/ToolBox.js +49 -26
  25. package/dist/tui/ink/components/ToolBox.js.map +1 -1
  26. package/dist/tui/ink/components/ToolGroup.d.ts +2 -2
  27. package/dist/tui/ink/components/ToolGroup.js +44 -36
  28. package/dist/tui/ink/components/ToolGroup.js.map +1 -1
  29. package/dist/tui/ink/use-event-projection.d.ts +9 -9
  30. package/dist/tui/ink/use-event-projection.js +83 -37
  31. package/dist/tui/ink/use-event-projection.js.map +1 -1
  32. package/package.json +1 -1
@@ -14,58 +14,58 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
14
  * overlay state lives in `use-overlays.ts`. This component stays
15
15
  * focused on layout and lifecycle.
16
16
  */
17
- import * as React from 'react';
18
- import { Box, Static, Text, useApp, useInput } from 'ink';
19
- import { randomUUID } from 'node:crypto';
20
- import { appendAudit } from '../../audit/writer.js';
21
- import { maybeCompact } from '../../context/compaction.js';
22
- import { contextWindowFor } from '../../intelligence/prices.js';
23
- import { buildAgentHooksFromConfig } from '../../hooks/config-bridge.js';
24
- import { loadProjectPrimer, composeSystemPrompt } from '../../context/primer.js';
25
- import { probeGitState, renderGitState } from '../../context/git-state.js';
26
- import { loadSoul } from '../../context/soul.js';
27
- import { modePreamble } from '../../context/mode.js';
28
- import { runAgentLoop } from '../../kernel/agent-loop.js';
29
- import { createErrorClassifier } from '../../intelligence/error-classifier.js';
30
- import { createToolExecutor } from '../../tools/exec.js';
31
- import { createInkApprovalBus } from './ink-approval-bus.js';
32
- import { ApprovalPrompt } from './components/ApprovalPrompt.js';
33
- import { PRICES } from '../../intelligence/prices.js';
34
- import { Logo } from './components/Logo.js';
35
- import { StatusBar } from './components/StatusBar.js';
36
- import { StreamingText } from './components/StreamingText.js';
37
- import { ThinkingBlock } from './components/ThinkingBlock.js';
38
- import { ToolBox } from './components/ToolBox.js';
39
- import { ToolGroup } from './components/ToolGroup.js';
40
- import { InputBox } from './components/InputBox.js';
41
- import { PromptQueueIndicator } from './components/PromptQueueIndicator.js';
42
- import { ModelPicker } from './components/ModelPicker.js';
43
- import { ModelSwitchPrompt } from './components/ModelSwitchPrompt.js';
44
- import { ProviderPicker } from './components/ProviderPicker.js';
45
- import { HelpOverlay } from './components/HelpOverlay.js';
46
- import { KeySetOverlay } from './components/KeySetOverlay.js';
47
- import { saveKey } from '../../auth/keystore.js';
48
- import { AtFileComplete } from './components/AtFileComplete.js';
49
- import { SlashComplete } from './components/SlashComplete.js';
50
- import { ThemePicker } from './components/ThemePicker.js';
51
- import { ThemeProvider } from './theme-context.js';
52
- import { writeFile, mkdir, readFile } from 'node:fs/promises';
53
- import { homedir } from 'node:os';
54
- import { join as pathJoin } from 'node:path';
55
- import { useEventProjection } from './use-event-projection.js';
56
- import { useOverlays } from './use-overlays.js';
57
- import { createRequire } from 'node:module';
17
+ import * as React from "react";
18
+ import { Box, Static, Text, useApp, useInput } from "ink";
19
+ import { randomUUID } from "node:crypto";
20
+ import { appendAudit } from "../../audit/writer.js";
21
+ import { maybeCompact } from "../../context/compaction.js";
22
+ import { contextWindowFor } from "../../intelligence/prices.js";
23
+ import { buildAgentHooksFromConfig } from "../../hooks/config-bridge.js";
24
+ import { loadProjectPrimer, composeSystemPrompt, } from "../../context/primer.js";
25
+ import { probeGitState, renderGitState } from "../../context/git-state.js";
26
+ import { loadSoul } from "../../context/soul.js";
27
+ import { modePreamble } from "../../context/mode.js";
28
+ import { runAgentLoop } from "../../kernel/agent-loop.js";
29
+ import { createErrorClassifier } from "../../intelligence/error-classifier.js";
30
+ import { createToolExecutor } from "../../tools/exec.js";
31
+ import { createInkApprovalBus, } from "./ink-approval-bus.js";
32
+ import { ApprovalPrompt, } from "./components/ApprovalPrompt.js";
33
+ import { PRICES } from "../../intelligence/prices.js";
34
+ import { Logo } from "./components/Logo.js";
35
+ import { StatusBar } from "./components/StatusBar.js";
36
+ import { StreamingText } from "./components/StreamingText.js";
37
+ import { ThinkingBlock } from "./components/ThinkingBlock.js";
38
+ import { ToolBox } from "./components/ToolBox.js";
39
+ import { ToolGroup } from "./components/ToolGroup.js";
40
+ import { InputBox } from "./components/InputBox.js";
41
+ import { PromptQueueIndicator } from "./components/PromptQueueIndicator.js";
42
+ import { ModelPicker } from "./components/ModelPicker.js";
43
+ import { ModelSwitchPrompt } from "./components/ModelSwitchPrompt.js";
44
+ import { ProviderPicker, } from "./components/ProviderPicker.js";
45
+ import { HelpOverlay, } from "./components/HelpOverlay.js";
46
+ import { KeySetOverlay } from "./components/KeySetOverlay.js";
47
+ import { saveKey } from "../../auth/keystore.js";
48
+ import { AtFileComplete } from "./components/AtFileComplete.js";
49
+ import { SlashComplete } from "./components/SlashComplete.js";
50
+ import { ThemePicker } from "./components/ThemePicker.js";
51
+ import { ThemeProvider } from "./theme-context.js";
52
+ import { writeFile, mkdir, readFile } from "node:fs/promises";
53
+ import { homedir } from "node:os";
54
+ import { join as pathJoin } from "node:path";
55
+ import { useEventProjection, } from "./use-event-projection.js";
56
+ import { useOverlays } from "./use-overlays.js";
57
+ import { createRequire } from "node:module";
58
58
  // Pulled from the installed package.json so the TUI title matches the
59
59
  // shipped binary version. Falls back to '0.0.0-dev' if the file isn't
60
60
  // reachable (e.g. an unusual deploy layout).
61
61
  const VERSION = (() => {
62
62
  try {
63
63
  const req = createRequire(import.meta.url);
64
- const pkg = req('../../../package.json');
65
- return typeof pkg.version === 'string' ? pkg.version : '0.0.0-dev';
64
+ const pkg = req("../../../package.json");
65
+ return typeof pkg.version === "string" ? pkg.version : "0.0.0-dev";
66
66
  }
67
67
  catch {
68
- return '0.0.0-dev';
68
+ return "0.0.0-dev";
69
69
  }
70
70
  })();
71
71
  export function App(props) {
@@ -74,7 +74,7 @@ export function App(props) {
74
74
  const historyRef = React.useRef(initialHistory(props));
75
75
  const abortRef = React.useRef(null);
76
76
  const [transcript, setTranscript] = React.useState([]);
77
- const [input, setInput] = React.useState('');
77
+ const [input, setInput] = React.useState("");
78
78
  const [busy, setBusy] = React.useState(false);
79
79
  // Prompt queue: while a turn is streaming the user can still type and
80
80
  // press Enter. Submissions land here instead of being dropped, then
@@ -87,14 +87,14 @@ export function App(props) {
87
87
  // Multi-step picker stage. Stage 1 = ProviderPicker (default when
88
88
  // overlays.active === 'models'); stage 2 = ModelPicker filtered to
89
89
  // the picked provider. Resets to 'provider' on every fresh open.
90
- const [pickerStage, setPickerStage] = React.useState('provider');
90
+ const [pickerStage, setPickerStage] = React.useState("provider");
91
91
  const [pickerProvider, setPickerProvider] = React.useState(null);
92
92
  // Pending model-switch prompt — set when the kernel emits an error
93
93
  // with a `failoverModel` hint. Cleared when the user answers
94
94
  // [y|n|p]. While set, an inline ModelSwitchPrompt renders below
95
95
  // the input box; submitting any other prompt also clears it.
96
96
  const [pendingFailover, setPendingFailover] = React.useState(null);
97
- const lastUserPromptRef = React.useRef('');
97
+ const lastUserPromptRef = React.useRef("");
98
98
  // Approval bus — single instance per App so subscriptions persist across
99
99
  // turns. Replaces the legacy `createTuiApprovalBus` that wrote prompts
100
100
  // direct to stdout (overdrawn by Ink) and read stdin raw (hung on
@@ -108,11 +108,11 @@ export function App(props) {
108
108
  const bus = approvalBusRef.current;
109
109
  if (!bus)
110
110
  return;
111
- return bus.subscribe(req => setPendingApproval(req));
111
+ return bus.subscribe((req) => setPendingApproval(req));
112
112
  }, []);
113
113
  // Mode state: SlashContext.setMode flips it live so /mode plan|act|verify|ask
114
114
  // takes effect on the next turn (system-prompt rebuild downstream picks it up).
115
- const [mode, setMode] = React.useState(props.config.mode ?? 'act');
115
+ const [mode, setMode] = React.useState(props.config.mode ?? "act");
116
116
  const projection = useEventProjection(props.events);
117
117
  const overlays = useOverlays();
118
118
  // Live counters for the in-progress turn — drive the StatusBar
@@ -122,22 +122,22 @@ export function App(props) {
122
122
  const [liveDurationMs, setLiveDurationMs] = React.useState(0);
123
123
  const turnStartRef = React.useRef(0);
124
124
  React.useEffect(() => {
125
- const unsub = props.events.subscribe(ev => {
126
- if (ev.type === 'agent_start') {
125
+ const unsub = props.events.subscribe((ev) => {
126
+ if (ev.type === "agent_start") {
127
127
  turnStartRef.current = Date.now();
128
128
  setLiveOutputTokens(0);
129
129
  setLiveDurationMs(0);
130
130
  }
131
- else if (ev.type === 'text_delta' || ev.type === 'thinking_delta') {
131
+ else if (ev.type === "text_delta" || ev.type === "thinking_delta") {
132
132
  // Approximate output-token count by char/4 — same heuristic
133
133
  // the rest of the codebase uses for streaming-side estimates.
134
134
  const delta = (ev.delta?.length ?? 0) / 4;
135
- setLiveOutputTokens(prev => prev + delta);
135
+ setLiveOutputTokens((prev) => prev + delta);
136
136
  }
137
- else if (ev.type === 'usage') {
137
+ else if (ev.type === "usage") {
138
138
  setLiveOutputTokens(ev.outputTokens ?? 0);
139
139
  }
140
- else if (ev.type === 'agent_end') {
140
+ else if (ev.type === "agent_end") {
141
141
  setLiveDurationMs(0);
142
142
  setLiveOutputTokens(0);
143
143
  }
@@ -151,7 +151,7 @@ export function App(props) {
151
151
  const t = setInterval(() => {
152
152
  if (turnStartRef.current > 0)
153
153
  setLiveDurationMs(Date.now() - turnStartRef.current);
154
- }, 250);
154
+ }, 1000);
155
155
  return () => clearInterval(t);
156
156
  }, [busy]);
157
157
  // Audit writer for the Ink TUI path. Mirrors the one-shot main.ts and
@@ -159,15 +159,33 @@ export function App(props) {
159
159
  // is empty for the most common surface (the interactive UI). Effect
160
160
  // re-installs only if events ref changes (it shouldn't).
161
161
  React.useEffect(() => {
162
- const unsub = props.events.subscribe(ev => {
163
- if (ev.type === 'tool_exec_end') {
164
- void appendAudit({ kind: 'tool', actor: sessionIdRef.current, summary: `${ev.id} ${ev.isError ? 'error' : 'done'} ${ev.durationMs}ms`, toolId: ev.id, isError: ev.isError, durationMs: ev.durationMs });
162
+ const unsub = props.events.subscribe((ev) => {
163
+ if (ev.type === "tool_exec_end") {
164
+ void appendAudit({
165
+ kind: "tool",
166
+ actor: sessionIdRef.current,
167
+ summary: `${ev.id} ${ev.isError ? "error" : "done"} ${ev.durationMs}ms`,
168
+ toolId: ev.id,
169
+ isError: ev.isError,
170
+ durationMs: ev.durationMs,
171
+ });
165
172
  }
166
- else if (ev.type === 'agent_end') {
167
- void appendAudit({ kind: 'turn-end', actor: sessionIdRef.current, summary: `model=${currentModel} stop=${ev.stopReason} in=${ev.usage.inputTokens} out=${ev.usage.outputTokens}`, model: currentModel, stopReason: ev.stopReason, usage: ev.usage });
173
+ else if (ev.type === "agent_end") {
174
+ void appendAudit({
175
+ kind: "turn-end",
176
+ actor: sessionIdRef.current,
177
+ summary: `model=${currentModel} stop=${ev.stopReason} in=${ev.usage.inputTokens} out=${ev.usage.outputTokens}`,
178
+ model: currentModel,
179
+ stopReason: ev.stopReason,
180
+ usage: ev.usage,
181
+ });
168
182
  }
169
- else if (ev.type === 'error') {
170
- void appendAudit({ kind: 'error', actor: sessionIdRef.current, summary: ev.message });
183
+ else if (ev.type === "error") {
184
+ void appendAudit({
185
+ kind: "error",
186
+ actor: sessionIdRef.current,
187
+ summary: ev.message,
188
+ });
171
189
  if (ev.failoverModel) {
172
190
  setPendingFailover({
173
191
  failedModel: currentModel,
@@ -190,47 +208,51 @@ export function App(props) {
190
208
  // typing. The drain-effect below submits queued prompts FIFO once
191
209
  // `busy` flips false.
192
210
  if (busy) {
193
- setPromptQueue(q => [...q, value]);
194
- setInput('');
211
+ setPromptQueue((q) => [...q, value]);
212
+ setInput("");
195
213
  return;
196
214
  }
197
- setInput('');
215
+ setInput("");
198
216
  // Remember the last user prompt so we can re-submit it after a
199
217
  // failover model swap (D2 — auto-prompt model switch on failure).
200
218
  lastUserPromptRef.current = value;
201
219
  // A new submission supersedes any pending failover prompt.
202
220
  setPendingFailover(null);
203
- if (value === '/exit' || value === '/quit') {
221
+ if (value === "/exit" || value === "/quit") {
204
222
  exit();
205
223
  return;
206
224
  }
207
- if (value === '/clear') {
225
+ if (value === "/clear") {
208
226
  historyRef.current = initialHistory(props);
209
227
  setTranscript([]);
210
228
  projection.clear();
211
229
  return;
212
230
  }
213
231
  // `/model` with no args opens the picker; `/model <id>` sets directly.
214
- if (value === '/model' || value === '/models') {
215
- overlays.openOverlay('models');
232
+ if (value === "/model" || value === "/models") {
233
+ overlays.openOverlay("models");
216
234
  return;
217
235
  }
218
- if (value.startsWith('/model ')) {
219
- const id = value.slice('/model '.length).trim();
220
- if (id !== '') {
236
+ if (value.startsWith("/model ")) {
237
+ const id = value.slice("/model ".length).trim();
238
+ if (id !== "") {
221
239
  setCurrentModel(id);
222
- const note = { kind: 'notice', id: randomUUID(), text: `Model set to ${id}` };
223
- setTranscript(prev => [...prev, note]);
240
+ const note = {
241
+ kind: "notice",
242
+ id: randomUUID(),
243
+ text: `Model set to ${id}`,
244
+ };
245
+ setTranscript((prev) => [...prev, note]);
224
246
  }
225
247
  return;
226
248
  }
227
- if (value === '/help' || value === '/?') {
228
- overlays.openOverlay('help');
249
+ if (value === "/help" || value === "/?") {
250
+ overlays.openOverlay("help");
229
251
  return;
230
252
  }
231
253
  // `/theme` with no args opens the picker; `/theme <name>` sets directly.
232
- if (value === '/theme' || value === '/themes') {
233
- overlays.openOverlay('theme');
254
+ if (value === "/theme" || value === "/themes") {
255
+ overlays.openOverlay("theme");
234
256
  return;
235
257
  }
236
258
  // Anything else starting with `/` goes through the SlashRegistry — that
@@ -241,13 +263,17 @@ export function App(props) {
241
263
  // contract. Without this dispatch, unrecognised slash commands fell
242
264
  // through to runTurn() and were sent to the LLM as user prompts —
243
265
  // surprising behaviour that S1/2026-04-27 fixes.
244
- if (value.startsWith('/')) {
266
+ if (value.startsWith("/")) {
245
267
  const ctx = {
246
- get model() { return currentModel; },
247
- get sessionId() { return sessionIdRef.current; },
268
+ get model() {
269
+ return currentModel;
270
+ },
271
+ get sessionId() {
272
+ return sessionIdRef.current;
273
+ },
248
274
  setModel: (m) => setCurrentModel(m),
249
- showHelp: () => '',
250
- compact: async () => '(compaction is automatic)',
275
+ showHelp: () => "",
276
+ compact: async () => "(compaction is automatic)",
251
277
  clear: () => {
252
278
  historyRef.current = initialHistory(props);
253
279
  setTranscript([]);
@@ -255,25 +281,36 @@ export function App(props) {
255
281
  },
256
282
  listSessions: async () => {
257
283
  const ids = await props.sessions.list();
258
- return ids.length === 0 ? '(no saved sessions)' : ids.map(id => `- ${id}`).join('\n');
284
+ return ids.length === 0
285
+ ? "(no saved sessions)"
286
+ : ids.map((id) => `- ${id}`).join("\n");
259
287
  },
260
288
  loadSession: async (id) => {
261
289
  const s = await props.sessions.open(id);
262
290
  return s ? `Loaded ${id}.` : `Session ${id} not found.`;
263
291
  },
264
- listSkills: async () => '(run `dirgha skills` for the full list)',
292
+ listSkills: async () => "(run `dirgha skills` for the full list)",
265
293
  showCost: () => `model=${currentModel}`,
266
- exit: (code = 0) => { exit(); process.exit(code); },
294
+ exit: (code = 0) => {
295
+ exit();
296
+ process.exit(code);
297
+ },
267
298
  getToken: () => null,
268
299
  setToken: () => undefined,
269
- apiBase: () => process.env['DIRGHA_API_BASE'] ?? process.env['DIRGHA_GATEWAY_URL'] ?? 'https://api.dirgha.ai',
270
- upgradeUrl: () => process.env['DIRGHA_UPGRADE_URL'] ?? 'https://dirgha.ai/billing/upgrade',
300
+ apiBase: () => process.env["DIRGHA_API_BASE"] ??
301
+ process.env["DIRGHA_GATEWAY_URL"] ??
302
+ "https://api.dirgha.ai",
303
+ upgradeUrl: () => process.env["DIRGHA_UPGRADE_URL"] ??
304
+ "https://dirgha.ai/billing/upgrade",
271
305
  status: (msg) => {
272
- setTranscript(prev => [...prev, { kind: 'notice', id: randomUUID(), text: msg }]);
306
+ setTranscript((prev) => [
307
+ ...prev,
308
+ { kind: "notice", id: randomUUID(), text: msg },
309
+ ]);
273
310
  },
274
311
  getMode: () => mode,
275
312
  setMode: (m) => setMode(m),
276
- getTheme: () => (props.config.theme ?? 'readable'),
313
+ getTheme: () => props.config.theme ?? "readable",
277
314
  setTheme: () => undefined,
278
315
  getSession: () => null,
279
316
  getSessionStore: () => props.sessions,
@@ -284,30 +321,43 @@ export function App(props) {
284
321
  try {
285
322
  const result = await props.slashRegistry.dispatch(value, ctx);
286
323
  if (result.handled) {
287
- const text = result.output ? String(result.output) : '(ok)';
288
- setTranscript(prev => [...prev, { kind: 'notice', id: randomUUID(), text }]);
324
+ const text = result.output ? String(result.output) : "(ok)";
325
+ setTranscript((prev) => [
326
+ ...prev,
327
+ { kind: "notice", id: randomUUID(), text },
328
+ ]);
289
329
  }
290
330
  else {
291
- setTranscript(prev => [...prev, {
292
- kind: 'notice',
331
+ setTranscript((prev) => [
332
+ ...prev,
333
+ {
334
+ kind: "notice",
293
335
  id: randomUUID(),
294
- text: `Unknown command: ${value.split(' ')[0]}. Type /help for the list.`,
295
- }]);
336
+ text: `Unknown command: ${value.split(" ")[0]}. Type /help for the list.`,
337
+ },
338
+ ]);
296
339
  }
297
340
  }
298
341
  catch (err) {
299
- setTranscript(prev => [...prev, {
300
- kind: 'notice',
342
+ setTranscript((prev) => [
343
+ ...prev,
344
+ {
345
+ kind: "notice",
301
346
  id: randomUUID(),
302
347
  text: `[slash error] ${err instanceof Error ? err.message : String(err)}`,
303
- }]);
348
+ },
349
+ ]);
304
350
  }
305
351
  })();
306
352
  return;
307
353
  }
308
- const userItem = { kind: 'user', id: randomUUID(), text: value };
309
- setTranscript(prev => [...prev, userItem]);
310
- historyRef.current.push({ role: 'user', content: value });
354
+ const userItem = {
355
+ kind: "user",
356
+ id: randomUUID(),
357
+ text: value,
358
+ };
359
+ setTranscript((prev) => [...prev, userItem]);
360
+ historyRef.current.push({ role: "user", content: value });
311
361
  void runTurn();
312
362
  }, [busy, exit, props, projection, overlays]);
313
363
  const runTurn = async () => {
@@ -354,16 +404,23 @@ export function App(props) {
354
404
  const msg = err instanceof Error ? err.message : String(err);
355
405
  const keyMatch = /^([A-Z][A-Z0-9_]+_API_KEY) is required/.exec(msg);
356
406
  if (keyMatch?.[1]) {
357
- setPendingKey({ keyName: keyMatch[1], retryInput: lastUserPromptRef.current });
407
+ setPendingKey({
408
+ keyName: keyMatch[1],
409
+ retryInput: lastUserPromptRef.current,
410
+ });
358
411
  }
359
412
  else {
360
- projection.appendLive({ kind: 'error', id: randomUUID(), message: msg });
413
+ projection.appendLive({
414
+ kind: "error",
415
+ id: randomUUID(),
416
+ message: msg,
417
+ });
361
418
  }
362
419
  }
363
420
  finally {
364
421
  const committed = projection.commitLive();
365
422
  if (committed.length > 0)
366
- setTranscript(prev => [...prev, ...committed]);
423
+ setTranscript((prev) => [...prev, ...committed]);
367
424
  setBusy(false);
368
425
  abortRef.current = null;
369
426
  }
@@ -393,27 +450,35 @@ export function App(props) {
393
450
  useInput((_ch, key) => {
394
451
  if (!key.escape)
395
452
  return;
396
- if (overlays.active !== null && overlays.active !== 'atfile') {
453
+ if (overlays.active !== null && overlays.active !== "atfile") {
397
454
  overlays.closeOverlay();
398
455
  return;
399
456
  }
400
457
  if (busy && abortRef.current !== null) {
401
458
  abortRef.current.abort();
402
- projection.appendLive({ kind: 'notice', id: randomUUID(), text: 'Cancelled.' });
459
+ projection.appendLive({
460
+ kind: "notice",
461
+ id: randomUUID(),
462
+ text: "Cancelled.",
463
+ });
403
464
  return;
404
465
  }
405
466
  if (input.length > 0)
406
- setInput('');
467
+ setInput("");
407
468
  });
408
469
  const handleModelPick = React.useCallback((id) => {
409
470
  overlays.closeOverlay();
410
471
  // Dedupe: a stale picker callback firing after the model is already
411
472
  // set should not spam the transcript with redundant notices.
412
- setCurrentModel(prev => {
473
+ setCurrentModel((prev) => {
413
474
  if (prev === id)
414
475
  return prev;
415
- const note = { kind: 'notice', id: randomUUID(), text: `Model set to ${id}` };
416
- setTranscript(t => [...t, note]);
476
+ const note = {
477
+ kind: "notice",
478
+ id: randomUUID(),
479
+ text: `Model set to ${id}`,
480
+ };
481
+ setTranscript((t) => [...t, note]);
417
482
  // 1.10.1 — Warn the user inline if the new model's provider has
418
483
  // no API key configured. Without this, the next ask silently
419
484
  // 401s and the user is left wondering why nothing happens.
@@ -428,7 +493,7 @@ export function App(props) {
428
493
  if (m?.[1]) {
429
494
  // Open inline key entry instead of a static hint — the user can
430
495
  // paste their key right here without leaving the REPL.
431
- setPendingKey({ keyName: m[1], retryInput: '' });
496
+ setPendingKey({ keyName: m[1], retryInput: "" });
432
497
  return prev; // Don't switch model until the key is saved
433
498
  }
434
499
  }
@@ -436,25 +501,39 @@ export function App(props) {
436
501
  });
437
502
  }, [overlays, props.providers]);
438
503
  const handleKeySetSave = React.useCallback((value) => {
439
- const keyName = pendingKey?.keyName ?? '';
504
+ const keyName = pendingKey?.keyName ?? "";
440
505
  void (async () => {
441
506
  try {
442
507
  await saveKey(keyName, value);
443
- const retryText = pendingKey?.retryInput ?? '';
508
+ const retryText = pendingKey?.retryInput ?? "";
444
509
  setPendingKey(null);
445
- setTranscript(prev => [...prev, { kind: 'notice', id: randomUUID(), text: `Saved ${keyName}. Model ready.` }]);
510
+ setTranscript((prev) => [
511
+ ...prev,
512
+ {
513
+ kind: "notice",
514
+ id: randomUUID(),
515
+ text: `Saved ${keyName}. Model ready.`,
516
+ },
517
+ ]);
446
518
  if (retryText) {
447
519
  setInput(retryText);
448
520
  }
449
521
  }
450
522
  catch (err) {
451
523
  setPendingKey(null);
452
- setTranscript(prev => [...prev, { kind: 'error', id: randomUUID(), message: `Failed to save key: ${err instanceof Error ? err.message : String(err)}` }]);
524
+ setTranscript((prev) => [
525
+ ...prev,
526
+ {
527
+ kind: "error",
528
+ id: randomUUID(),
529
+ message: `Failed to save key: ${err instanceof Error ? err.message : String(err)}`,
530
+ },
531
+ ]);
453
532
  }
454
533
  })();
455
534
  }, [pendingKey]);
456
535
  const handleAtPick = React.useCallback((path) => {
457
- setInput(current => overlays.spliceAtSelection(current, path));
536
+ setInput((current) => overlays.spliceAtSelection(current, path));
458
537
  overlays.setAtQuery(null);
459
538
  overlays.setActive(null);
460
539
  }, [overlays]);
@@ -463,9 +542,21 @@ export function App(props) {
463
542
  // a second Enter. Anything that DOES take args (model, theme, mode,
464
543
  // memory, session, ...) gets a trailing space and waits for the arg.
465
544
  const ARGLESS_SLASH = React.useMemo(() => new Set([
466
- 'help', 'exit', 'quit', 'clear', 'compact',
467
- 'models', 'theme', 'cost', 'status', 'history',
468
- 'login', 'logout', 'setup', 'upgrade', 'update',
545
+ "help",
546
+ "exit",
547
+ "quit",
548
+ "clear",
549
+ "compact",
550
+ "models",
551
+ "theme",
552
+ "cost",
553
+ "status",
554
+ "history",
555
+ "login",
556
+ "logout",
557
+ "setup",
558
+ "upgrade",
559
+ "update",
469
560
  ]), []);
470
561
  const handleSlashPick = React.useCallback((name) => {
471
562
  // Replace the leading /<typed> with /<picked>. For commands that
@@ -473,8 +564,8 @@ export function App(props) {
473
564
  // to type it. For argless commands (1.12.0 fix) we submit immediately
474
565
  // — without this, /models<Enter> required pressing Enter TWICE: once
475
566
  // to "pick" the autocomplete suggestion, again to submit.
476
- let spliced = '';
477
- setInput(current => {
567
+ let spliced = "";
568
+ setInput((current) => {
478
569
  spliced = overlays.spliceSlashSelection(current, name);
479
570
  if (spliced === `/${name}` && !ARGLESS_SLASH.has(name)) {
480
571
  return `${spliced} `; // ready for arg input
@@ -489,27 +580,35 @@ export function App(props) {
489
580
  setTimeout(() => handleSubmit(spliced || `/${name}`), 0);
490
581
  }
491
582
  }, [overlays, ARGLESS_SLASH, handleSubmit]);
492
- const inputFocus = overlays.active === null || overlays.active === 'atfile' || overlays.active === 'slash';
583
+ const inputFocus = overlays.active === null ||
584
+ overlays.active === "atfile" ||
585
+ overlays.active === "slash";
493
586
  // Active theme name — driven by local state so the picker can flip it
494
587
  // live. Initial value comes from config; subsequent changes are
495
588
  // persisted to ~/.dirgha/config.json so future sessions pick it up.
496
- const [themeName, setThemeName] = React.useState((props.config.theme ?? 'readable'));
589
+ const [themeName, setThemeName] = React.useState((props.config.theme ?? "readable"));
497
590
  const handleThemePick = React.useCallback((name) => {
498
591
  overlays.closeOverlay();
499
592
  setThemeName(name);
500
- const note = { kind: 'notice', id: randomUUID(), text: `Theme set to ${name}` };
501
- setTranscript(t => [...t, note]);
593
+ const note = {
594
+ kind: "notice",
595
+ id: randomUUID(),
596
+ text: `Theme set to ${name}`,
597
+ };
598
+ setTranscript((t) => [...t, note]);
502
599
  void (async () => {
503
600
  try {
504
- const dir = pathJoin(homedir(), '.dirgha');
601
+ const dir = pathJoin(homedir(), ".dirgha");
505
602
  await mkdir(dir, { recursive: true });
506
- const path = pathJoin(dir, 'config.json');
507
- const text = await readFile(path, 'utf8').catch(() => '');
603
+ const path = pathJoin(dir, "config.json");
604
+ const text = await readFile(path, "utf8").catch(() => "");
508
605
  const cfg = text ? JSON.parse(text) : {};
509
606
  cfg.theme = name;
510
- await writeFile(path, `${JSON.stringify(cfg, null, 2)}\n`, 'utf8');
607
+ await writeFile(path, `${JSON.stringify(cfg, null, 2)}\n`, "utf8");
608
+ }
609
+ catch {
610
+ /* best-effort persistence */
511
611
  }
512
- catch { /* best-effort persistence */ }
513
612
  })();
514
613
  }, [overlays]);
515
614
  // BISECT: Static moved out of the transcript render. Logo stays
@@ -518,7 +617,7 @@ export function App(props) {
518
617
  // streaming text appears now, the Static-around-transcript pattern
519
618
  // was suppressing the live region updates. If still not, the bug
520
619
  // is upstream in useEventProjection.
521
- return (_jsx(ThemeProvider, { activeTheme: themeName, children: _jsxs(Box, { flexDirection: "column", children: [_jsx(Static, { items: [{ key: 'logo' }], children: (_item) => _jsx(Logo, { version: VERSION }, "logo") }), _jsx(Box, { flexDirection: "column", children: renderTranscript([...transcript, ...projection.liveItems]) }), pendingApproval !== null && approvalBusRef.current && (_jsx(ApprovalPrompt, { request: pendingApproval, onResolve: (decision) => {
620
+ return (_jsx(ThemeProvider, { activeTheme: themeName, children: _jsxs(Box, { flexDirection: "column", children: [_jsx(Static, { items: [{ key: "logo" }], children: (_item) => _jsx(Logo, { version: VERSION }, "logo") }), _jsx(Box, { flexDirection: "column", children: renderTranscript([...transcript, ...projection.liveItems]) }), pendingApproval !== null && approvalBusRef.current && (_jsx(ApprovalPrompt, { request: pendingApproval, onResolve: (decision) => {
522
621
  approvalBusRef.current?.resolve(pendingApproval.id, decision);
523
622
  } })), pendingFailover !== null && (_jsx(ModelSwitchPrompt, { failedModel: pendingFailover.failedModel, failoverModel: pendingFailover.failoverModel, onAccept: (failover) => {
524
623
  const lastPrompt = pendingFailover.lastPrompt;
@@ -530,33 +629,54 @@ export function App(props) {
530
629
  }
531
630
  }, onReject: () => setPendingFailover(null), onPicker: () => {
532
631
  setPendingFailover(null);
533
- overlays.openOverlay('models');
534
- } })), _jsx(PromptQueueIndicator, { queued: promptQueue }), _jsx(InputBox, { value: input, onChange: setInput, onSubmit: handleSubmit, busy: busy, vimMode: props.config.vimMode === true, onAtQueryChange: overlays.setAtQuery, onSlashQueryChange: overlays.setSlashQuery, onRequestOverlay: overlays.openOverlay, inputFocus: inputFocus }), overlays.active === 'atfile' && overlays.atQuery !== null && (_jsx(AtFileComplete, { cwd: props.cwd, query: overlays.atQuery, onPick: handleAtPick, onCancel: () => { overlays.setAtQuery(null); overlays.setActive(null); } })), overlays.active === 'slash' && overlays.slashQuery !== null && (_jsx(SlashComplete, { commands: slashCommands, query: overlays.slashQuery, onPick: handleSlashPick, onCancel: () => { overlays.setSlashQuery(null); overlays.setActive(null); } })), overlays.active === 'models' && pickerStage === 'provider' && (() => {
535
- // Build provider entries — only include providers that actually have
536
- // models in our catalogue. Without this, the picker shows providers
537
- // with 0 models and the user lands on an empty model list.
538
- const providers = buildProviderEntries(models, currentModel);
539
- if (providers.length === 0) {
540
- // Fall through to flat ModelPicker if no providers (catalogue empty).
541
- return null;
542
- }
543
- return (_jsx(ProviderPicker, { providers: providers, onPick: (providerId) => {
544
- setPickerProvider(providerId);
545
- setPickerStage('model');
546
- }, onCancel: () => {
547
- setPickerStage('provider');
548
- setPickerProvider(null);
549
- overlays.closeOverlay();
550
- } }));
551
- })(), overlays.active === 'models' && pickerStage === 'model' && (_jsx(ModelPicker, { models: models.filter(m => m.provider === pickerProvider), current: currentModel, onPick: (id) => {
632
+ overlays.openOverlay("models");
633
+ } })), _jsx(PromptQueueIndicator, { queued: promptQueue }), _jsx(InputBox, { value: input, onChange: setInput, onSubmit: handleSubmit, busy: busy, vimMode: props.config.vimMode === true, onAtQueryChange: overlays.setAtQuery, onSlashQueryChange: overlays.setSlashQuery, onRequestOverlay: overlays.openOverlay, onRequestYoloToggle: () => {
634
+ const next = mode === "yolo" ? "act" : "yolo";
635
+ setMode(next);
636
+ setTranscript((prev) => [
637
+ ...prev,
638
+ {
639
+ kind: "notice",
640
+ id: randomUUID(),
641
+ text: next === "yolo"
642
+ ? "YOLO mode ON — every tool call is auto-approved. Ctrl+Y to exit."
643
+ : "YOLO mode OFF — back to standard confirmation.",
644
+ },
645
+ ]);
646
+ }, inputFocus: inputFocus }), overlays.active === "atfile" && overlays.atQuery !== null && (_jsx(AtFileComplete, { cwd: props.cwd, query: overlays.atQuery, onPick: handleAtPick, onCancel: () => {
647
+ overlays.setAtQuery(null);
648
+ overlays.setActive(null);
649
+ } })), overlays.active === "slash" && overlays.slashQuery !== null && (_jsx(SlashComplete, { commands: slashCommands, query: overlays.slashQuery, onPick: handleSlashPick, onCancel: () => {
650
+ overlays.setSlashQuery(null);
651
+ overlays.setActive(null);
652
+ } })), overlays.active === "models" &&
653
+ pickerStage === "provider" &&
654
+ (() => {
655
+ // Build provider entries — only include providers that actually have
656
+ // models in our catalogue. Without this, the picker shows providers
657
+ // with 0 models and the user lands on an empty model list.
658
+ const providers = buildProviderEntries(models, currentModel);
659
+ if (providers.length === 0) {
660
+ // Fall through to flat ModelPicker if no providers (catalogue empty).
661
+ return null;
662
+ }
663
+ return (_jsx(ProviderPicker, { providers: providers, onPick: (providerId) => {
664
+ setPickerProvider(providerId);
665
+ setPickerStage("model");
666
+ }, onCancel: () => {
667
+ setPickerStage("provider");
668
+ setPickerProvider(null);
669
+ overlays.closeOverlay();
670
+ } }));
671
+ })(), overlays.active === "models" && pickerStage === "model" && (_jsx(ModelPicker, { models: models.filter((m) => m.provider === pickerProvider), current: currentModel, onPick: (id) => {
552
672
  handleModelPick(id);
553
- setPickerStage('provider');
673
+ setPickerStage("provider");
554
674
  setPickerProvider(null);
555
675
  }, onCancel: () => {
556
676
  // Esc inside ModelPicker → back to ProviderPicker (NOT close).
557
- setPickerStage('provider');
677
+ setPickerStage("provider");
558
678
  setPickerProvider(null);
559
- } })), overlays.active === 'help' && (_jsx(HelpOverlay, { slashCommands: slashCommands, onClose: overlays.closeOverlay })), overlays.active === 'theme' && (_jsx(ThemePicker, { current: themeName, onPick: handleThemePick, onCancel: overlays.closeOverlay })), pendingKey && (_jsx(KeySetOverlay, { keyName: pendingKey.keyName, onSave: handleKeySetSave, onCancel: () => setPendingKey(null) })), _jsx(StatusBar, { model: currentModel, provider: providerIdForModel(currentModel), inputTokens: projection.totals.inputTokens, outputTokens: projection.totals.outputTokens, costUsd: projection.totals.costUsd, cwd: props.cwd, busy: busy, mode: props.config.mode ?? 'act', contextWindow: contextWindowFor(currentModel), liveOutputTokens: liveOutputTokens, liveDurationMs: liveDurationMs })] }) }));
679
+ } })), overlays.active === "help" && (_jsx(HelpOverlay, { slashCommands: slashCommands, onClose: overlays.closeOverlay })), overlays.active === "theme" && (_jsx(ThemePicker, { current: themeName, onPick: handleThemePick, onCancel: overlays.closeOverlay })), pendingKey && (_jsx(KeySetOverlay, { keyName: pendingKey.keyName, onSave: handleKeySetSave, onCancel: () => setPendingKey(null) })), _jsx(StatusBar, { model: currentModel, provider: providerIdForModel(currentModel), inputTokens: projection.totals.inputTokens, outputTokens: projection.totals.outputTokens, costUsd: projection.totals.costUsd, cwd: props.cwd, busy: busy, mode: mode, contextWindow: contextWindowFor(currentModel), liveOutputTokens: liveOutputTokens, liveDurationMs: liveDurationMs })] }) }));
560
680
  }
561
681
  /**
562
682
  * Walk the transcript and fold consecutive `tool` items into a single
@@ -576,7 +696,7 @@ function renderTranscript(items) {
576
696
  toolBuf = [];
577
697
  };
578
698
  for (const item of items) {
579
- if (item.kind === 'tool') {
699
+ if (item.kind === "tool") {
580
700
  toolBuf.push({
581
701
  id: item.id,
582
702
  name: item.name,
@@ -594,22 +714,22 @@ function renderTranscript(items) {
594
714
  flushTools();
595
715
  return out;
596
716
  }
597
- function TranscriptRow({ item }) {
717
+ function TranscriptRow({ item, }) {
598
718
  switch (item.kind) {
599
- case 'user':
719
+ case "user":
600
720
  return (_jsxs(Box, { gap: 2, marginBottom: 1, children: [_jsx(Text, { color: "magenta", children: "\u276F" }), _jsx(Text, { color: "white", children: item.text })] }));
601
- case 'text':
721
+ case "text":
602
722
  return _jsx(StreamingText, { content: item.content });
603
- case 'thinking':
723
+ case "thinking":
604
724
  return _jsx(ThinkingBlock, { content: item.content });
605
- case 'tool':
725
+ case "tool":
606
726
  // Should not be reached — tools are folded by renderTranscript() into
607
727
  // <ToolGroup>. Kept as a safety net so an unexpected tool item still
608
728
  // renders something rather than nothing.
609
729
  return (_jsx(ToolBox, { name: item.name, status: item.status, argSummary: item.argSummary, outputPreview: item.outputPreview, startedAt: item.startedAt, durationMs: item.durationMs }));
610
- case 'error':
730
+ case "error":
611
731
  return (_jsxs(Box, { gap: 1, marginBottom: 1, children: [_jsx(Text, { color: "red", bold: true, children: "\u2717" }), _jsx(Text, { color: "red", children: item.message })] }));
612
- case 'notice':
732
+ case "notice":
613
733
  return (_jsx(Box, { marginBottom: 1, children: _jsx(Text, { color: "yellow", children: item.text }) }));
614
734
  }
615
735
  }
@@ -623,89 +743,91 @@ function initialHistory(props) {
623
743
  const soul = loadSoul();
624
744
  const composedSystem = composeSystemPrompt({
625
745
  soul: soul.text,
626
- modePreamble: modePreamble(props.config.mode ?? 'act'),
746
+ modePreamble: modePreamble(props.config.mode ?? "act"),
627
747
  primer: primer.primer,
628
748
  gitState: renderGitState(probeGitState(props.cwd)),
629
749
  userSystem: props.systemPrompt,
630
750
  });
631
- base.unshift({ role: 'system', content: composedSystem });
751
+ base.unshift({ role: "system", content: composedSystem });
632
752
  return base;
633
753
  }
634
754
  function providerIdForModel(model) {
635
755
  // Light heuristic so StatusBar has a hint without importing dispatch.
636
756
  // Real routing still lives in providers/dispatch.ts at run time.
637
- if (model.includes('claude'))
638
- return 'anthropic';
639
- if (model.includes('gpt') || model.startsWith('o1') || model.startsWith('o3'))
640
- return 'openai';
641
- if (model.includes('gemini'))
642
- return 'gemini';
643
- if (model.includes('kimi') || model.includes('moonshot'))
644
- return 'nvidia';
645
- if (model.includes('llama') || model.includes('nvidia') || model.includes('minimax'))
646
- return 'nvidia';
647
- if (model.includes('fireworks'))
648
- return 'fireworks';
649
- if (model.includes('/'))
650
- return 'openrouter';
651
- return 'local';
757
+ if (model.includes("claude"))
758
+ return "anthropic";
759
+ if (model.includes("gpt") || model.startsWith("o1") || model.startsWith("o3"))
760
+ return "openai";
761
+ if (model.includes("gemini"))
762
+ return "gemini";
763
+ if (model.includes("kimi") || model.includes("moonshot"))
764
+ return "nvidia";
765
+ if (model.includes("llama") ||
766
+ model.includes("nvidia") ||
767
+ model.includes("minimax"))
768
+ return "nvidia";
769
+ if (model.includes("fireworks"))
770
+ return "fireworks";
771
+ if (model.includes("/"))
772
+ return "openrouter";
773
+ return "local";
652
774
  }
653
775
  const PROVIDER_BLURB = {
654
- anthropic: 'Claude — Opus, Sonnet, Haiku',
655
- openai: 'GPT family — gpt-5.5, o1/o3',
656
- gemini: 'Google — Gemini Pro, Flash',
657
- openrouter: 'Aggregator — 370+ models, free tier',
658
- nvidia: 'NIM — Kimi K2.5, DeepSeek V4, Qwen 3',
659
- ollama: 'Local Ollama models',
660
- llamacpp: 'Local llama.cpp models',
661
- fireworks: 'Hosted open models',
662
- deepseek: 'DeepSeek native — V3.2, reasoner',
663
- mistral: 'Mistral — Codestral, Magistral',
664
- cohere: 'Cohere — Command R / Command A',
665
- cerebras: 'Wafer-scale — Qwen3, Llama 4',
666
- together: 'Open-source hub — Llama, Qwen',
667
- perplexity: 'Sonar — search-grounded',
668
- xai: 'Grok 4 family — code + reasoning',
669
- groq: 'LPU — very low latency',
670
- zai: 'GLM-4.6 — long-context',
671
- local: 'Local models',
776
+ anthropic: "Claude — Opus, Sonnet, Haiku",
777
+ openai: "GPT family — gpt-5.5, o1/o3",
778
+ gemini: "Google — Gemini Pro, Flash",
779
+ openrouter: "Aggregator — 370+ models, free tier",
780
+ nvidia: "NIM — Kimi K2.5, DeepSeek V4, Qwen 3",
781
+ ollama: "Local Ollama models",
782
+ llamacpp: "Local llama.cpp models",
783
+ fireworks: "Hosted open models",
784
+ deepseek: "DeepSeek native — V3.2, reasoner",
785
+ mistral: "Mistral — Codestral, Magistral",
786
+ cohere: "Cohere — Command R / Command A",
787
+ cerebras: "Wafer-scale — Qwen3, Llama 4",
788
+ together: "Open-source hub — Llama, Qwen",
789
+ perplexity: "Sonar — search-grounded",
790
+ xai: "Grok 4 family — code + reasoning",
791
+ groq: "LPU — very low latency",
792
+ zai: "GLM-4.6 — long-context",
793
+ local: "Local models",
672
794
  };
673
795
  const PROVIDER_ENV = {
674
- anthropic: 'ANTHROPIC_API_KEY',
675
- openai: 'OPENAI_API_KEY',
676
- gemini: 'GEMINI_API_KEY',
677
- openrouter: 'OPENROUTER_API_KEY',
678
- nvidia: 'NVIDIA_API_KEY',
679
- fireworks: 'FIREWORKS_API_KEY',
680
- deepseek: 'DEEPSEEK_API_KEY',
681
- mistral: 'MISTRAL_API_KEY',
682
- cohere: 'COHERE_API_KEY',
683
- cerebras: 'CEREBRAS_API_KEY',
684
- together: 'TOGETHER_API_KEY',
685
- perplexity: 'PERPLEXITY_API_KEY',
686
- xai: 'XAI_API_KEY',
687
- groq: 'GROQ_API_KEY',
688
- zai: 'ZAI_API_KEY',
796
+ anthropic: "ANTHROPIC_API_KEY",
797
+ openai: "OPENAI_API_KEY",
798
+ gemini: "GEMINI_API_KEY",
799
+ openrouter: "OPENROUTER_API_KEY",
800
+ nvidia: "NVIDIA_API_KEY",
801
+ fireworks: "FIREWORKS_API_KEY",
802
+ deepseek: "DEEPSEEK_API_KEY",
803
+ mistral: "MISTRAL_API_KEY",
804
+ cohere: "COHERE_API_KEY",
805
+ cerebras: "CEREBRAS_API_KEY",
806
+ together: "TOGETHER_API_KEY",
807
+ perplexity: "PERPLEXITY_API_KEY",
808
+ xai: "XAI_API_KEY",
809
+ groq: "GROQ_API_KEY",
810
+ zai: "ZAI_API_KEY",
689
811
  };
690
812
  const PROVIDER_LABEL = {
691
- anthropic: 'Anthropic',
692
- openai: 'OpenAI',
693
- gemini: 'Google AI',
694
- openrouter: 'OpenRouter',
695
- nvidia: 'NVIDIA NIM',
696
- ollama: 'Ollama (local)',
697
- llamacpp: 'llama.cpp (local)',
698
- fireworks: 'Fireworks',
699
- deepseek: 'DeepSeek',
700
- mistral: 'Mistral',
701
- cohere: 'Cohere',
702
- cerebras: 'Cerebras',
703
- together: 'Together AI',
704
- perplexity: 'Perplexity',
705
- xai: 'xAI (Grok)',
706
- groq: 'Groq',
707
- zai: 'Z.AI / GLM',
708
- local: 'Local',
813
+ anthropic: "Anthropic",
814
+ openai: "OpenAI",
815
+ gemini: "Google AI",
816
+ openrouter: "OpenRouter",
817
+ nvidia: "NVIDIA NIM",
818
+ ollama: "Ollama (local)",
819
+ llamacpp: "llama.cpp (local)",
820
+ fireworks: "Fireworks",
821
+ deepseek: "DeepSeek",
822
+ mistral: "Mistral",
823
+ cohere: "Cohere",
824
+ cerebras: "Cerebras",
825
+ together: "Together AI",
826
+ perplexity: "Perplexity",
827
+ xai: "xAI (Grok)",
828
+ groq: "Groq",
829
+ zai: "Z.AI / GLM",
830
+ local: "Local",
709
831
  };
710
832
  /**
711
833
  * Group the flat model catalogue into per-provider entries for stage 1
@@ -718,7 +840,7 @@ function buildProviderEntries(models, currentModel) {
718
840
  list.push(m);
719
841
  buckets.set(m.provider, list);
720
842
  }
721
- const currentProvider = models.find(m => m.id === currentModel)?.provider;
843
+ const currentProvider = models.find((m) => m.id === currentModel)?.provider;
722
844
  const out = [];
723
845
  for (const [id, items] of buckets) {
724
846
  const env = PROVIDER_ENV[id];
@@ -737,7 +859,7 @@ function buildProviderEntries(models, currentModel) {
737
859
  return out;
738
860
  }
739
861
  function defaultModelCatalogue() {
740
- return PRICES.map(p => ({
862
+ return PRICES.map((p) => ({
741
863
  id: p.model,
742
864
  provider: p.provider,
743
865
  tier: tierFromPrice(p.inputPerM),
@@ -745,11 +867,11 @@ function defaultModelCatalogue() {
745
867
  }
746
868
  function tierFromPrice(inputPerM) {
747
869
  if (inputPerM === 0)
748
- return 'free';
870
+ return "free";
749
871
  if (inputPerM < 0.5)
750
- return 'basic';
872
+ return "basic";
751
873
  if (inputPerM < 5)
752
- return 'pro';
753
- return 'premium';
874
+ return "pro";
875
+ return "premium";
754
876
  }
755
877
  //# sourceMappingURL=App.js.map