@zergai/ztc 0.14.0-beta.1 → 0.15.0-beta.1
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.
- package/README.md +175 -39
- package/bin/zmux-darwin-arm64 +0 -0
- package/bin/ztc-audio-darwin-arm64 +0 -0
- package/bin/ztc-capture-darwin-arm64 +0 -0
- package/bin/ztc-tui-darwin-arm64 +0 -0
- package/bin/zterm-darwin-arm64 +0 -0
- package/dist/App.js +17 -0
- package/dist/agent/agent.js +1 -5
- package/dist/agent/backends/account_events.d.ts +4 -4
- package/dist/agent/backends/account_events.js +4 -4
- package/dist/agent/backends/account_login.d.ts +1 -1
- package/dist/agent/backends/account_login.js +1 -1
- package/dist/agent/backends/account_pool.d.ts +11 -54
- package/dist/agent/backends/account_pool.js +12 -134
- package/dist/agent/backends/anthropic.js +18 -4
- package/dist/agent/backends/codex_app_server.d.ts +3 -4
- package/dist/agent/backends/codex_app_server.js +4 -5
- package/dist/agent/backends/codex_auth.d.ts +1 -0
- package/dist/agent/backends/codex_auth.js +6 -4
- package/dist/agent/backends/failover.d.ts +1 -1
- package/dist/agent/backends/failover.js +9 -9
- package/dist/agent/backends/index.d.ts +3 -24
- package/dist/agent/backends/index.js +8 -56
- package/dist/agent/backends/kimi_code_auth.d.ts +1 -1
- package/dist/agent/backends/kimi_code_auth.js +2 -2
- package/dist/agent/backends/provider_ids.d.ts +5 -0
- package/dist/agent/backends/provider_ids.js +6 -1
- package/dist/agent/backends/rate_limit.d.ts +7 -16
- package/dist/agent/backends/rate_limit.js +7 -29
- package/dist/agent/backends/types.d.ts +0 -5
- package/dist/agent/commands/accounts.d.ts +6 -2
- package/dist/agent/commands/accounts.js +97 -70
- package/dist/agent/commands/compact.js +4 -2
- package/dist/agent/commands/config.js +27 -13
- package/dist/agent/commands/connect.js +79 -3
- package/dist/agent/commands/credential_status.d.ts +2 -0
- package/dist/agent/commands/credential_status.js +5 -1
- package/dist/agent/commands/dictation.js +34 -14
- package/dist/agent/commands/direct_credential_prompt.js +7 -1
- package/dist/agent/commands/model.js +8 -0
- package/dist/agent/commands/models.js +5 -6
- package/dist/agent/commands/provider_choices.js +5 -5
- package/dist/agent/commands/provider_model_defaults.d.ts +3 -4
- package/dist/agent/commands/provider_model_defaults.js +4 -16
- package/dist/agent/commands/provider_selection.d.ts +4 -3
- package/dist/agent/commands/provider_selection.js +15 -7
- package/dist/agent/commands/settings.js +36 -50
- package/dist/agent/commands/sim.js +9 -0
- package/dist/agent/commands/subs.js +3 -2
- package/dist/agent/commands/types.d.ts +26 -6
- package/dist/agent/factory.js +17 -52
- package/dist/agent/subagent.js +4 -11
- package/dist/agent/tools/adaptation.js +10 -1
- package/dist/agent/tools/pane.js +25 -2
- package/dist/agent/tools/sim.js +12 -3
- package/dist/agent/tools/supervision.js +4 -0
- package/dist/app/agent_runner.js +9 -2
- package/dist/app/launch_notices.d.ts +44 -0
- package/dist/app/launch_notices.js +41 -0
- package/dist/app/retired_route_gate.d.ts +44 -0
- package/dist/app/retired_route_gate.js +73 -0
- package/dist/app/session_manager.js +2 -1
- package/dist/app/task_scope_router.js +1 -13
- package/dist/cli_main.js +39 -6
- package/dist/cli_ratatui.d.ts +28 -2
- package/dist/cli_ratatui.js +178 -40
- package/dist/components/InputArea.js +27 -10
- package/dist/config/anthropic_models.d.ts +18 -0
- package/dist/config/anthropic_models.js +22 -0
- package/dist/config/defaults.d.ts +0 -1
- package/dist/config/defaults.js +9 -10
- package/dist/config/permissions.js +4 -2
- package/dist/config/repo_config.js +8 -0
- package/dist/config/resolved.d.ts +1 -1
- package/dist/config/retired_ids.d.ts +33 -0
- package/dist/config/retired_ids.js +39 -0
- package/dist/config/retired_routes.d.ts +192 -0
- package/dist/config/retired_routes.js +609 -0
- package/dist/config/types.d.ts +61 -31
- package/dist/config.d.ts +269 -23
- package/dist/config.js +727 -106
- package/dist/evolution/mutation.js +4 -1
- package/dist/headless.js +46 -4
- package/dist/headless_cli.js +23 -6
- package/dist/headless_cli_args.d.ts +3 -1
- package/dist/headless_cli_args.js +7 -0
- package/dist/hosted/session_settings.js +11 -2
- package/dist/library.js +4 -0
- package/dist/onboarding/first_run.js +5 -2
- package/dist/onboarding/setup.js +2 -1
- package/dist/onboarding/setup_agent_health.js +5 -5
- package/dist/optimize/llm.js +4 -1
- package/dist/panes/agent_cli.d.ts +1 -1
- package/dist/panes/agent_cli.js +5 -2
- package/dist/panes/agent_panes.js +12 -4
- package/dist/panes/agent_profiles.d.ts +25 -5
- package/dist/panes/agent_profiles.js +35 -10
- package/dist/panes/model_catalog.d.ts +1 -1
- package/dist/panes/model_catalog.js +3 -24
- package/dist/panes/pane_registry.js +9 -3
- package/dist/panes/ztc_launch.js +28 -6
- package/dist/simulation/inference.d.ts +38 -4
- package/dist/simulation/inference.js +264 -24
- package/dist/simulation/living/context.d.ts +1 -1
- package/dist/simulation/living/open-world.d.ts +1 -1
- package/dist/simulation/living/types.d.ts +4 -4
- package/dist/simulation/llm.js +14 -4
- package/dist/simulation/memory/embedding.d.ts +6 -0
- package/dist/simulation/memory/embedding.js +35 -8
- package/dist/utils/compaction.js +0 -1
- package/dist/utils/context.js +2 -7
- package/dist/utils/dictation.d.ts +43 -8
- package/dist/utils/dictation.js +333 -138
- package/dist/utils/idle_compaction.js +1 -1
- package/dist/utils/models.js +0 -24
- package/dist/utils/subprocess_env.d.ts +14 -3
- package/dist/utils/subprocess_env.js +16 -3
- package/dist/web/accounts_mirror.d.ts +23 -57
- package/dist/web/accounts_mirror.js +52 -171
- package/dist/web/mirror_stream.d.ts +14 -3
- package/dist/web/mirror_stream.js +16 -12
- package/dist/zlicky/vision_locator.js +7 -2
- package/dist/zlm-embed.mjs +1398 -1488
- package/package.json +12 -10
- package/dist/agent/backends/account_rotation.d.ts +0 -138
- package/dist/agent/backends/account_rotation.js +0 -323
- package/dist/agent/backends/account_state.d.ts +0 -59
- package/dist/agent/backends/account_state.js +0 -139
- package/dist/agent/backends/claude_cli.d.ts +0 -85
- package/dist/agent/backends/claude_cli.js +0 -658
- package/dist/agent/backends/claude_code_auth.d.ts +0 -48
- package/dist/agent/backends/claude_code_auth.js +0 -171
- package/dist/agent/backends/rotation_factory.d.ts +0 -26
- package/dist/agent/backends/rotation_factory.js +0 -55
package/dist/cli_ratatui.js
CHANGED
|
@@ -12,7 +12,8 @@ import { MOTSI_PANE_ENV, remoteViewMotsi, throughMotsi } from './panes/motsi.js'
|
|
|
12
12
|
import { IntakeNotifications } from './intake/notifications.js';
|
|
13
13
|
import { projectGoal } from './goal_contract.js';
|
|
14
14
|
import { isToolResultMessage } from './utils/tool_result_message.js';
|
|
15
|
-
import { layoutRestoreNotice } from './app/launch_notices.js';
|
|
15
|
+
import { claimLaunchNotices, initialPromptStep, layoutRestoreNotice } from './app/launch_notices.js';
|
|
16
|
+
import { isRetiredModel, isRetiredProvider, retiredModelMessage, retiredProviderMessage, ROUTE_AWAITS_A_CHOICE, RouteAwaitingChoiceError, } from './config/retired_routes.js';
|
|
16
17
|
import { formatTaskHandoffNotice, projectTaskHandoff } from './session_handoff_contract.js';
|
|
17
18
|
/**
|
|
18
19
|
* RatatuiApp — the interactive TUI application class.
|
|
@@ -162,6 +163,7 @@ export { childPaneEventDisposition } from './app/child_pane_events.js';
|
|
|
162
163
|
import { createRecapController } from './app/recap.js';
|
|
163
164
|
import { clearStaleTodosOnBoot, normalizeTodoItems } from './app/todo_state.js';
|
|
164
165
|
import { writePaneResponseSync } from './utils/pane_response.js';
|
|
166
|
+
import { launchedByAnotherZtc } from './utils/subprocess_env.js';
|
|
165
167
|
import { registerInstance, deregisterInstance, loadInstances, updateInstance, heartbeatInstance, reapStoppedInstances, INSTANCE_HEARTBEAT_MS, } from './instance_registry.js';
|
|
166
168
|
import { loadPreviewsForInstances } from './navigator_preview.js';
|
|
167
169
|
import { FormWidget, SelectWidget, selectOptionSummary, TextInputWidget, QuestionnaireWidget, PromptViewerWidget, LogViewWidget } from './ui/widgets/index.js';
|
|
@@ -665,6 +667,8 @@ export class RatatuiApp {
|
|
|
665
667
|
/** Session id awaiting a second Enter while the agent is mid-turn. */
|
|
666
668
|
resumeConfirmEntryId = null;
|
|
667
669
|
resumeConfirmTimer = null;
|
|
670
|
+
/** The picker closed because the session picked in it relaunches ZTC (see resumeSessionFromPanel). */
|
|
671
|
+
relaunchingFromPicker = false;
|
|
668
672
|
// Widget instances (initialized in constructor after widgetHost is created)
|
|
669
673
|
formWidget;
|
|
670
674
|
selectWidget;
|
|
@@ -815,6 +819,11 @@ export class RatatuiApp {
|
|
|
815
819
|
* leak to new child panes (which should use configStore.getModel()). */
|
|
816
820
|
overseerModelOverride = null;
|
|
817
821
|
paneMode = false;
|
|
822
|
+
/**
|
|
823
|
+
* Another ZTC launched this one into one of its panes (ZTC_PARENT_PID or ZTC_COLONY_CHILD, see launchedByAnotherZtc):
|
|
824
|
+
* a --pane child or a colony cell, whose terminal is a PTY the overseer's write_terminal_pane types into too.
|
|
825
|
+
*/
|
|
826
|
+
inAnotherZtcPane = launchedByAnotherZtc();
|
|
818
827
|
/** Turns completed in this session, which pace Zerg Router login tips. */
|
|
819
828
|
routerTipTurns = 0;
|
|
820
829
|
computerUseMode = false;
|
|
@@ -1496,10 +1505,10 @@ export class RatatuiApp {
|
|
|
1496
1505
|
return typeLineIntoPane(this.tui, paneId, formatAgentPaneMessage(msg));
|
|
1497
1506
|
});
|
|
1498
1507
|
}
|
|
1499
|
-
// Handle input from browser mirror (single-pane mode fallback)
|
|
1500
|
-
this.mirrorServer.onInput((input) => {
|
|
1501
|
-
debugLog(`[Mirror] Received input from
|
|
1502
|
-
this.submitPersonInput(input);
|
|
1508
|
+
// Handle input from browser mirror (single-pane mode fallback), and what /broadcast delivers
|
|
1509
|
+
this.mirrorServer.onInput((input, via) => {
|
|
1510
|
+
debugLog(`[Mirror] Received input from ${via}: length=${input.text.length}`);
|
|
1511
|
+
this.submitPersonInput(input, via);
|
|
1503
1512
|
});
|
|
1504
1513
|
this.mirrorServer.onCancel((paneId) => {
|
|
1505
1514
|
debugLog(`[Mirror] Cancel requested from browser: pane=${paneId}`);
|
|
@@ -1854,8 +1863,7 @@ export class RatatuiApp {
|
|
|
1854
1863
|
const model = this.overseerModelOverride?.model || configStore.getModel();
|
|
1855
1864
|
const bound = (text) => new TextDecoder('utf-8', { ignoreBOM: true })
|
|
1856
1865
|
.decode(Buffer.from(text.replace(/[\u0000-\u001f\u007f-\u009f]/g, ' ')).subarray(0, 256), { stream: true });
|
|
1857
|
-
const family = (name) => name.startsWith('
|
|
1858
|
-
: name.startsWith('codex_') ? 'codex' : name;
|
|
1866
|
+
const family = (name) => name.startsWith('codex_') ? 'codex' : name;
|
|
1859
1867
|
const accounts = (this.runtimeAccounts?.accounts ?? []).filter(account => family(account.provider) === family(provider)
|
|
1860
1868
|
&& Buffer.byteLength(account.id) <= 256 && !/[\u0000-\u001f\u007f-\u009f]/.test(account.id)).slice(0, 64);
|
|
1861
1869
|
const serving = canonicalAccountProvider(provider);
|
|
@@ -1869,8 +1877,9 @@ export class RatatuiApp {
|
|
|
1869
1877
|
observed_at: this.runtimeProjectionObservedAt,
|
|
1870
1878
|
accounts: accounts.map(account => ({ id: account.id, label: bound(account.label), provider: account.provider,
|
|
1871
1879
|
selected: account.id === selectedId, usable: account.usable,
|
|
1872
|
-
status: account.
|
|
1873
|
-
|
|
1880
|
+
status: account.usable ? 'Available' : 'Credentials unavailable',
|
|
1881
|
+
// Accounts no longer cool down: they switch only when the user chooses one.
|
|
1882
|
+
cooldown_until: null,
|
|
1874
1883
|
quota_summary: account.codexStatus ? bound(`Account-wide quota (${account.codexStatus.state}): `
|
|
1875
1884
|
+ (account.codexStatus.windows.map(window => `${window.name}: ${window.remainingPercent}% remaining${window.remainingPercent <= 10 ? ' — near limit' : ''}`).join('; ') || 'unknown')
|
|
1876
1885
|
+ (account.codexStatus.observedAt ? `; observed ${new Date(account.codexStatus.observedAt).toISOString()}` : '; observation time unknown')) : null,
|
|
@@ -2381,6 +2390,8 @@ export class RatatuiApp {
|
|
|
2381
2390
|
configStore.resolveLLMBackendConfig({ cwd: this.shellCwd || process.cwd() });
|
|
2382
2391
|
}
|
|
2383
2392
|
catch (error) {
|
|
2393
|
+
if (error instanceof RouteAwaitingChoiceError)
|
|
2394
|
+
notice = ROUTE_AWAITS_A_CHOICE;
|
|
2384
2395
|
if (error instanceof RouterConfigurationError && error.needsSignIn) {
|
|
2385
2396
|
notice = `This profile needs a Router sign-in. Use /auth login --url ${configStore.get().zergProxyUrl ?? DEFAULT_ROUTER_ORIGIN} to sign in for this profile; your session and conversation are retained.`;
|
|
2386
2397
|
}
|
|
@@ -2439,7 +2450,8 @@ export class RatatuiApp {
|
|
|
2439
2450
|
addMessage,
|
|
2440
2451
|
...(!this.paneMode && this.muxMode ? { workspaceLayouts: this.createWorkspaceLayoutOwner() } : {}),
|
|
2441
2452
|
// Absent means the user typed the command. Only the agent-facing dispatch
|
|
2442
|
-
// path below
|
|
2453
|
+
// path below and input handleSubmit doesn't mark as the person's own
|
|
2454
|
+
// ('relayed') opt in, so every other renderer path keeps full authority.
|
|
2443
2455
|
...(commandOrigin ? { commandOrigin } : {}),
|
|
2444
2456
|
clearMessages: () => this.clearTranscript(),
|
|
2445
2457
|
// /clear must leave no ghosts: drop the todo list, the queued-input backlog,
|
|
@@ -3337,9 +3349,9 @@ export class RatatuiApp {
|
|
|
3337
3349
|
this.mirrorServer.onMuxCommand((command) => this.handleMirrorMuxCommand(command));
|
|
3338
3350
|
this.mirrorServer.onPaneViewport((paneId, ansi) => this.handleMirrorPaneViewportRead(paneId, ansi));
|
|
3339
3351
|
}
|
|
3340
|
-
this.mirrorServer.onInput((input) => {
|
|
3341
|
-
debugLog(`[Mirror] Received input from
|
|
3342
|
-
this.submitPersonInput(input);
|
|
3352
|
+
this.mirrorServer.onInput((input, via) => {
|
|
3353
|
+
debugLog(`[Mirror] Received input from ${via}: length=${input.text.length}`);
|
|
3354
|
+
this.submitPersonInput(input, via);
|
|
3343
3355
|
});
|
|
3344
3356
|
this.mirrorServer.onCancel((paneId) => {
|
|
3345
3357
|
debugLog(`[Mirror] Cancel requested from browser: pane=${paneId}`);
|
|
@@ -3639,6 +3651,9 @@ export class RatatuiApp {
|
|
|
3639
3651
|
const result = await dictation.legacy.stopRecordingAndTranscribe();
|
|
3640
3652
|
this.dictationState = 'idle';
|
|
3641
3653
|
this.controller.setTranscribing(false);
|
|
3654
|
+
// The first recording this session sends to OpenAI's Whisper API says so in the transcript, once.
|
|
3655
|
+
if (result.notice)
|
|
3656
|
+
this.addSystemMessage(result.notice);
|
|
3642
3657
|
if (result.text) {
|
|
3643
3658
|
const filtered = dictation.filter.maybeFilterFillers(result.text);
|
|
3644
3659
|
if (filtered.trim()) {
|
|
@@ -3655,10 +3670,11 @@ export class RatatuiApp {
|
|
|
3655
3670
|
}
|
|
3656
3671
|
return;
|
|
3657
3672
|
}
|
|
3658
|
-
// Start recording
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3673
|
+
// Start recording: native dictation, else a recorder and an engine on this computer, or OpenAI's Whisper API
|
|
3674
|
+
// when the person chose it in /dictation (utils/dictation.ts). Without either, say how to get one.
|
|
3675
|
+
const unavailable = this.useNativeDictation ? undefined : dictation.legacy.getDictationUnavailableReason();
|
|
3676
|
+
if (unavailable) {
|
|
3677
|
+
this.controller.setToast(unavailable);
|
|
3662
3678
|
return;
|
|
3663
3679
|
}
|
|
3664
3680
|
if (this.useNativeDictation) {
|
|
@@ -4328,7 +4344,8 @@ export class RatatuiApp {
|
|
|
4328
4344
|
// Restore messages before the first frame so a resumed session never opens
|
|
4329
4345
|
// on a blank screen. Startup mode and project/session inspection happen
|
|
4330
4346
|
// only after that frame has reached the renderer.
|
|
4331
|
-
const credentialsReady = configStore.hasApiKey() || configStore.isAuthenticated()
|
|
4347
|
+
const credentialsReady = (configStore.hasApiKey() || configStore.isAuthenticated())
|
|
4348
|
+
&& this.resolveSendRoute().awaitingChoice === undefined;
|
|
4332
4349
|
const cwd = this.shellCwd;
|
|
4333
4350
|
if (this.resumedSession && this.resumedSession.messages.length > 0) {
|
|
4334
4351
|
// Historical records already own their IDs and timestamps. Normal append
|
|
@@ -4523,6 +4540,23 @@ export class RatatuiApp {
|
|
|
4523
4540
|
// The launch choice comes first: a task handoff waits until its flow has
|
|
4524
4541
|
// ended (see showLaunchConnectPrompt). Other saved work in this project is
|
|
4525
4542
|
// only the readout's Recent line, which points to /resume.
|
|
4543
|
+
// One-time notices (where a retired Claude Code route went, what this launch
|
|
4544
|
+
// ignored) come first and are never held: they explain the launch choice
|
|
4545
|
+
// that may follow. Colony cells, headless mirrors and hosted runs leave the
|
|
4546
|
+
// saved ones for the interactive launch; a child pane shows only what it
|
|
4547
|
+
// ignored itself.
|
|
4548
|
+
// A notice about the route also decides what happens to an initial prompt
|
|
4549
|
+
// (`ztc "..."`): it waits in the composer, or until the user has chosen how
|
|
4550
|
+
// to connect, so it never runs on a route the user has not seen.
|
|
4551
|
+
const topLevelLaunch = !this.paneMode && !this.headlessMirror && !this.isHostedRuntime() && !process.env.ZTC_COLONY_CHILD;
|
|
4552
|
+
const launchNotices = await claimLaunchNotices(configStore, { interactive: topLevelLaunch, pane: this.paneMode })
|
|
4553
|
+
.catch(error => { debugLog(`[start] One-time notices unavailable: ${String(error)}`); return []; });
|
|
4554
|
+
for (const notice of launchNotices) {
|
|
4555
|
+
this.controller.addMessage(createFirstRunLaunchMessage(notice.text));
|
|
4556
|
+
this.mirror?.publishMessage('system', notice.text);
|
|
4557
|
+
}
|
|
4558
|
+
this.initialPromptStep = topLevelLaunch ? initialPromptStep(launchNotices) : null;
|
|
4559
|
+
this.assertStartupActive();
|
|
4526
4560
|
if (this.launchConnectPromptWanted() && !this.composerHasDraft())
|
|
4527
4561
|
this.heldLaunchNotices = [];
|
|
4528
4562
|
// A refusal an unattended run recorded holds this session's background work; the person's messages still try.
|
|
@@ -4981,15 +5015,27 @@ export class RatatuiApp {
|
|
|
4981
5015
|
}
|
|
4982
5016
|
else if (this.initialPrompt && this.initialPrompt.trim()) {
|
|
4983
5017
|
const prompt = this.initialPrompt;
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
}
|
|
5018
|
+
if (this.initialPromptStep) {
|
|
5019
|
+
this.holdInitialPrompt(prompt);
|
|
5020
|
+
}
|
|
5021
|
+
else {
|
|
5022
|
+
setTimeout(() => {
|
|
5023
|
+
void this.submitPersonInput(prompt);
|
|
5024
|
+
}, 0);
|
|
5025
|
+
}
|
|
4987
5026
|
}
|
|
4988
5027
|
// `ztc resume` with no target opens the picker instead of silently taking
|
|
4989
5028
|
// the most recent session. Runs after the first frame so the page paints on
|
|
4990
5029
|
// top of a live UI; the initial prompt path above is skipped for the picker.
|
|
5030
|
+
// While the profile waits for a route choice, closing the picker (Escape,
|
|
5031
|
+
// or picking this session) asks how to connect, as other launches do; a
|
|
5032
|
+
// session picked there relaunches as `ztc --resume <id>`, which asks itself.
|
|
4991
5033
|
if (this.resumePicker && !this.initialPrompt) {
|
|
4992
|
-
void this.openResumePanel()
|
|
5034
|
+
void this.openResumePanel({ onClose: () => {
|
|
5035
|
+
if (!this.exiting && !this.relaunchingFromPicker && this.personAtLaunch() && !this.composerHasDraft()
|
|
5036
|
+
&& this.resolveSendRoute().awaitingChoice !== undefined)
|
|
5037
|
+
this.showLaunchConnectPrompt();
|
|
5038
|
+
} });
|
|
4993
5039
|
}
|
|
4994
5040
|
// Keep the process alive until exit() is called
|
|
4995
5041
|
debugLog('[start] Returning blocking promise');
|
|
@@ -5299,6 +5345,8 @@ export class RatatuiApp {
|
|
|
5299
5345
|
}
|
|
5300
5346
|
applyHostedConfig(settings) {
|
|
5301
5347
|
const patch = hostedSettingsConfigPatch(settings);
|
|
5348
|
+
// The thread's settings are the host's, not a route the person chose in this session.
|
|
5349
|
+
configStore.markHostedSession();
|
|
5302
5350
|
configStore.setConfigScope('session');
|
|
5303
5351
|
configStore.set('provider', settings.provider);
|
|
5304
5352
|
configStore.set('model', settings.model);
|
|
@@ -8460,8 +8508,10 @@ export class RatatuiApp {
|
|
|
8460
8508
|
}));
|
|
8461
8509
|
}
|
|
8462
8510
|
// Normal input. Only the person in the browser mirror speaks as "User"; another pane or the coordinator is not
|
|
8463
|
-
// the person, so its message never takes their attempt past a Zerg Router refusal.
|
|
8464
|
-
|
|
8511
|
+
// the person, so its message never takes their attempt past a Zerg Router refusal. What /broadcast delivers on
|
|
8512
|
+
// the bus speaks as User too, and keeps that attempt as before, but it is /broadcast's (see handleSubmit's via).
|
|
8513
|
+
const fromBrowser = msg.from.id === BROWSER_BUS_MEMBER_ID;
|
|
8514
|
+
this.handleSubmit({ text: msg.text, attachments: msg.attachments || [] }, undefined, undefined, false, false, fromBrowser, msg.via === 'broadcast' ? 'broadcast' : fromBrowser ? 'browser' : 'terminal');
|
|
8465
8515
|
}
|
|
8466
8516
|
else if (msg.type === 'ztc_message') {
|
|
8467
8517
|
// Intercept structured control commands from parent (model hot-swap, widget answers).
|
|
@@ -8607,17 +8657,22 @@ export class RatatuiApp {
|
|
|
8607
8657
|
/**
|
|
8608
8658
|
* Submit what the person entered themselves (typed, dictated, sent from the browser mirror, or given on the command
|
|
8609
8659
|
* line). It gets one real attempt even while a Zerg Router refusal holds the route, since they may have just raised
|
|
8610
|
-
* the limit.
|
|
8660
|
+
* the limit. What the mirror's /broadcast delivers comes here too and keeps that attempt, as it always has. `via`:
|
|
8661
|
+
* where it was entered, this ZTC's terminal (its keys, dictation, the command line), the browser mirror or
|
|
8662
|
+
* /broadcast (see handleSubmit's `via`).
|
|
8611
8663
|
*/
|
|
8612
|
-
submitPersonInput(rawInput) {
|
|
8613
|
-
return this.handleSubmit(rawInput, undefined, undefined, false, false, true);
|
|
8664
|
+
submitPersonInput(rawInput, via = 'terminal') {
|
|
8665
|
+
return this.handleSubmit(rawInput, undefined, undefined, false, false, true, via);
|
|
8614
8666
|
}
|
|
8615
8667
|
/**
|
|
8616
8668
|
* `person`: the person entered this input themselves (see submitPersonInput). A /loop tick, a goal continuation,
|
|
8617
8669
|
* another pane's or the coordinator's message, a pane's initial task and a queued entry never are, so none of them
|
|
8618
|
-
* passes a Zerg Router refusal the process holds.
|
|
8670
|
+
* passes a Zerg Router refusal the process holds. `via`: where the person entered it, this ZTC's terminal or the
|
|
8671
|
+
* browser mirror, or else the mirror's /broadcast, which only colony's AgentBridge posts to (the overseer's
|
|
8672
|
+
* send_to_worktree tool and the colony dashboard's send). In a ZTC another ZTC launched into one of its panes, what
|
|
8673
|
+
* the terminal gives it isn't only the person's, and what /broadcast gives any ZTC never is (see the origin below).
|
|
8619
8674
|
*/
|
|
8620
|
-
async handleSubmit(rawInput, queuedEntryId, queuedAdmission, literalInput = false, credentialPrompted = false, person = false) {
|
|
8675
|
+
async handleSubmit(rawInput, queuedEntryId, queuedAdmission, literalInput = false, credentialPrompted = false, person = false, via = 'terminal') {
|
|
8621
8676
|
if (this.exiting)
|
|
8622
8677
|
return;
|
|
8623
8678
|
const input = parseStructuredSubmitInput(rawInput);
|
|
@@ -8717,18 +8772,32 @@ export class RatatuiApp {
|
|
|
8717
8772
|
this.controller.removeQueueEntry(queuedEntryId);
|
|
8718
8773
|
this.reconcileQueueEdit();
|
|
8719
8774
|
}
|
|
8775
|
+
// A command the person didn't enter themselves (another pane's or the coordinator's message, a pane's stdin,
|
|
8776
|
+
// a /loop tick, a queued entry) runs as relayed input: choices only the person makes refuse it. So does what a
|
|
8777
|
+
// ZTC that another ZTC launched into one of its panes reads from its terminal, whatever its flags: a ZTC pane's
|
|
8778
|
+
// ztc-tui, or a colony cell's own zmux, reads a PTY that the overseer's write_terminal_pane and other panes type
|
|
8779
|
+
// into too, so the person's typing there can't be told from theirs. A colony cell's own browser mirror is still
|
|
8780
|
+
// the person; everything a --pane child reads is relayed, its browser messages included. What a mirror's /broadcast
|
|
8781
|
+
// delivers is relayed in every ZTC, cell or not: only colony's send_to_worktree tool and its dashboard post there.
|
|
8782
|
+
const relayedHere = this.paneMode || via === 'broadcast' || (this.inAnotherZtcPane && via !== 'browser');
|
|
8783
|
+
const origin = person && !relayedHere ? undefined : 'relayed';
|
|
8720
8784
|
if (route.type === 'shell') {
|
|
8721
8785
|
this.mirror?.publishMessage('user', text);
|
|
8722
|
-
await this.handleCommand('shell', [route.command], false);
|
|
8786
|
+
await this.handleCommand('shell', [route.command], false, origin);
|
|
8723
8787
|
return;
|
|
8724
8788
|
}
|
|
8725
8789
|
if (route.type === 'command') {
|
|
8726
8790
|
this.mirror?.publishMessage('user', redactCredentialCommand(text));
|
|
8727
|
-
await this.handleCommand(route.cmd, route.args, false);
|
|
8791
|
+
await this.handleCommand(route.cmd, route.args, false, origin);
|
|
8728
8792
|
return;
|
|
8729
8793
|
}
|
|
8730
8794
|
// Regular message - send to agent once the route it would use can reach a model.
|
|
8731
8795
|
const sendRoute = this.resolveSendRoute();
|
|
8796
|
+
if (sendRoute.awaitingChoice !== undefined) {
|
|
8797
|
+
this.restoreBusyDraft(input);
|
|
8798
|
+
this.addSystemMessage(`Message not sent. ${ROUTE_AWAITS_A_CHOICE} Then press Enter to send it.`);
|
|
8799
|
+
return;
|
|
8800
|
+
}
|
|
8732
8801
|
if (!sendRoute.ready) {
|
|
8733
8802
|
if (!credentialPrompted && sendRoute.route
|
|
8734
8803
|
&& this.askForSendCredential(sendRoute.route, input, queuedEntryId, literalInput, person))
|
|
@@ -8826,7 +8895,11 @@ export class RatatuiApp {
|
|
|
8826
8895
|
try {
|
|
8827
8896
|
route = configStore.resolveLLMBackendConfig({ cwd: this.shellCwd || process.cwd(), ...(this.overseerModelOverride ?? {}) });
|
|
8828
8897
|
}
|
|
8829
|
-
catch {
|
|
8898
|
+
catch (error) {
|
|
8899
|
+
// A profile waiting for a route choice has no route, whatever a key or a
|
|
8900
|
+
// login elsewhere could reach (see ConfigStore.routeAwaitingChoice).
|
|
8901
|
+
if (error instanceof RouteAwaitingChoiceError)
|
|
8902
|
+
return { ready: false, awaitingChoice: error.notice };
|
|
8830
8903
|
return { ready: configStore.hasApiKey() || configStore.isAuthenticated() };
|
|
8831
8904
|
}
|
|
8832
8905
|
const platformFallback = route.provider !== 'modal' && route.authMode !== 'direct' && configStore.isAuthenticated();
|
|
@@ -8875,19 +8948,64 @@ export class RatatuiApp {
|
|
|
8875
8948
|
* The launch readout leaves the ways to connect to the prompt when it asks.
|
|
8876
8949
|
*/
|
|
8877
8950
|
launchConnectPromptWanted() {
|
|
8878
|
-
|
|
8951
|
+
const personAtLaunch = this.personAtLaunch();
|
|
8952
|
+
// While a move off a retired route leaves the profile waiting for a route
|
|
8953
|
+
// choice, route resolution has no route for this launch, and it asks first
|
|
8954
|
+
// whatever it brought: an initial prompt waits until the choice is made
|
|
8955
|
+
// (the notice the launch shows says to connect; see claimLaunchNotices).
|
|
8956
|
+
// The session picker asks once it closes (see start).
|
|
8957
|
+
if (this.resolveSendRoute().awaitingChoice !== undefined)
|
|
8958
|
+
return personAtLaunch && !this.resumePicker;
|
|
8959
|
+
return personAtLaunch
|
|
8879
8960
|
&& !configStore.isAuthenticated()
|
|
8880
8961
|
&& askHowToConnectAtLaunch(configStore.get(), configStore.getAuthMode(), configStore.getRouterSessionStatus(), this.resolveSendRoute().ready)
|
|
8881
|
-
&& !this.paneMode && !this.headlessMirror && !this.isHostedRuntime() && !process.env.ZTC_COLONY_CHILD
|
|
8882
8962
|
&& !this.resumedSession && !this.initialPrompt?.trim() && !this.resumePicker;
|
|
8883
8963
|
}
|
|
8964
|
+
/** A person launched this top-level ZTC in a terminal or the desktop app: one the launch may ask how to connect. */
|
|
8965
|
+
personAtLaunch() {
|
|
8966
|
+
return canAskAtLaunch({ terminal: Boolean(process.stdin.isTTY), desktop: this.desktopMode })
|
|
8967
|
+
&& !this.paneMode && !this.headlessMirror && !this.isHostedRuntime() && !process.env.ZTC_COLONY_CHILD;
|
|
8968
|
+
}
|
|
8884
8969
|
showLaunchConnectPrompt() {
|
|
8885
8970
|
const ctx = this.buildCommandContext(message => {
|
|
8886
8971
|
this.controller.addMessage(message);
|
|
8887
8972
|
if (message.role === 'system')
|
|
8888
8973
|
this.mirror?.publishMessage('system', message.content);
|
|
8889
8974
|
});
|
|
8890
|
-
showConnectPrompt(ctx, { launch: true, onFinished: () => {
|
|
8975
|
+
showConnectPrompt(ctx, { launch: true, onFinished: () => {
|
|
8976
|
+
this.releaseLaunchNotices();
|
|
8977
|
+
this.releaseHeldInitialPrompt();
|
|
8978
|
+
this.render();
|
|
8979
|
+
} });
|
|
8980
|
+
}
|
|
8981
|
+
/** What the launch does with an initial prompt after a notice about the route; null runs it at once. */
|
|
8982
|
+
initialPromptStep = null;
|
|
8983
|
+
/** An initial prompt waiting for the launch's connect choice to end. */
|
|
8984
|
+
heldInitialPrompt = null;
|
|
8985
|
+
/** Keep an initial prompt for the user to send: in the composer now, or once the open launch choice ends. */
|
|
8986
|
+
holdInitialPrompt(prompt) {
|
|
8987
|
+
if (this.routingInteractionOccupied()) {
|
|
8988
|
+
this.heldInitialPrompt = prompt;
|
|
8989
|
+
return;
|
|
8990
|
+
}
|
|
8991
|
+
this.placeHeldInitialPrompt(prompt);
|
|
8992
|
+
}
|
|
8993
|
+
releaseHeldInitialPrompt() {
|
|
8994
|
+
const prompt = this.heldInitialPrompt;
|
|
8995
|
+
this.heldInitialPrompt = null;
|
|
8996
|
+
if (prompt)
|
|
8997
|
+
this.placeHeldInitialPrompt(prompt);
|
|
8998
|
+
}
|
|
8999
|
+
placeHeldInitialPrompt(prompt) {
|
|
9000
|
+
if (this.exiting)
|
|
9001
|
+
return;
|
|
9002
|
+
this.restoreComposerAfterRewind(prompt, []);
|
|
9003
|
+
const provider = this.overseerModelOverride?.provider || configStore.getProvider();
|
|
9004
|
+
const model = this.overseerModelOverride?.model || configStore.getModel();
|
|
9005
|
+
const note = `Your prompt is in the composer: press Enter to send it on ${provider}/${model}.`;
|
|
9006
|
+
this.controller.addMessage(createFirstRunLaunchMessage(note));
|
|
9007
|
+
this.mirror?.publishMessage('system', note);
|
|
9008
|
+
this.render();
|
|
8891
9009
|
}
|
|
8892
9010
|
/** Launch notices held until the launch connect flow ends; null when none are held. */
|
|
8893
9011
|
heldLaunchNotices = null;
|
|
@@ -10758,7 +10876,7 @@ export class RatatuiApp {
|
|
|
10758
10876
|
maybeTriggerRecap(endOfTurnTokens) {
|
|
10759
10877
|
if (configStore.get().recapsEnabled === false)
|
|
10760
10878
|
return;
|
|
10761
|
-
const apiKey = configStore.
|
|
10879
|
+
const apiKey = configStore.getRequestApiKey() ?? '';
|
|
10762
10880
|
if (!apiKey)
|
|
10763
10881
|
return;
|
|
10764
10882
|
const state = this.controller.getState();
|
|
@@ -11342,7 +11460,11 @@ export class RatatuiApp {
|
|
|
11342
11460
|
const index = this.controller.getQueue().findIndex(entry => entry.id === session.entryId);
|
|
11343
11461
|
return index >= 0 ? index : null;
|
|
11344
11462
|
}
|
|
11345
|
-
|
|
11463
|
+
/**
|
|
11464
|
+
* `origin`: 'relayed' for a command the person didn't enter themselves, or one a ZTC another ZTC launched into one of
|
|
11465
|
+
* its panes reads from its terminal (see handleSubmit).
|
|
11466
|
+
*/
|
|
11467
|
+
async handleCommand(cmd, cmdArgs, publishUserMessage = true, origin) {
|
|
11346
11468
|
const cmdText = `/${cmd}${cmdArgs.length ? ' ' + cmdArgs.join(' ') : ''}`;
|
|
11347
11469
|
if (publishUserMessage) {
|
|
11348
11470
|
this.mirror?.publishMessage('user', redactCredentialCommand(cmdText));
|
|
@@ -11461,7 +11583,7 @@ export class RatatuiApp {
|
|
|
11461
11583
|
if (msg.role === 'system') {
|
|
11462
11584
|
this.mirror?.publishMessage('system', msg.content);
|
|
11463
11585
|
}
|
|
11464
|
-
});
|
|
11586
|
+
}, origin);
|
|
11465
11587
|
// Find and execute command — global first, then mode fallback for YAML-only commands.
|
|
11466
11588
|
// Global commands are preferred because some (like /execute in plan mode) have richer
|
|
11467
11589
|
// behavior (approval widgets, etc.) that mode handlers don't replicate.
|
|
@@ -11546,9 +11668,16 @@ export class RatatuiApp {
|
|
|
11546
11668
|
return next;
|
|
11547
11669
|
}
|
|
11548
11670
|
hotSwapModel(provider, model) {
|
|
11671
|
+
// A stale selection of a retired Claude Code route (an older parent, a
|
|
11672
|
+
// saved pane) keeps the current model, and says why in its own words.
|
|
11673
|
+
if (isRetiredProvider(provider) || isRetiredModel(model)) {
|
|
11674
|
+
const current = `${this.overseerModelOverride?.provider || configStore.getProvider()}/${this.overseerModelOverride?.model || configStore.getModel()}`;
|
|
11675
|
+
this.addSystemMessage(isRetiredProvider(provider) ? retiredProviderMessage(provider, current) : retiredModelMessage(model));
|
|
11676
|
+
return;
|
|
11677
|
+
}
|
|
11549
11678
|
// Snapshot the live selection so a failed rebuild rolls back cleanly. The
|
|
11550
11679
|
// rebuild returns null when the target provider isn't set up (kimi_code /
|
|
11551
|
-
//
|
|
11680
|
+
// codex_* before login). Swapping that null in would kill the
|
|
11552
11681
|
// in-flight turn while callers still report "✓ updated" — so on a null
|
|
11553
11682
|
// rebuild we keep the working agent AND restore the recorded model.
|
|
11554
11683
|
const isOverseer = this.muxMode && !this.paneMode;
|
|
@@ -11571,12 +11700,14 @@ export class RatatuiApp {
|
|
|
11571
11700
|
}
|
|
11572
11701
|
}
|
|
11573
11702
|
let rebuilt = null;
|
|
11703
|
+
let awaitingChoice = false;
|
|
11574
11704
|
try {
|
|
11575
11705
|
rebuilt = this.createAgent();
|
|
11576
11706
|
}
|
|
11577
|
-
catch {
|
|
11707
|
+
catch (error) {
|
|
11578
11708
|
// A throwing configuration/backend constructor needs the same rollback
|
|
11579
11709
|
// as a missing credential. Never leak a control envelope into chat.
|
|
11710
|
+
awaitingChoice = error instanceof RouteAwaitingChoiceError;
|
|
11580
11711
|
}
|
|
11581
11712
|
if (!rebuilt) {
|
|
11582
11713
|
// Roll back the half-applied selection and keep the working agent live —
|
|
@@ -11589,6 +11720,11 @@ export class RatatuiApp {
|
|
|
11589
11720
|
configStore.setCliOverride('model', prevModel);
|
|
11590
11721
|
}
|
|
11591
11722
|
const who = (provider && provider.trim()) || prevProvider || 'that provider';
|
|
11723
|
+
if (awaitingChoice) {
|
|
11724
|
+
// A profile waiting for a route choice has none for a pane's model either (see ConfigStore.routeAwaitingChoice).
|
|
11725
|
+
this.addSystemMessage(`⚠ ${ROUTE_AWAITS_A_CHOICE} Keeping the current model.`);
|
|
11726
|
+
return;
|
|
11727
|
+
}
|
|
11592
11728
|
const fix = isRouterOnlyProvider(who) ? 'log in with /auth login'
|
|
11593
11729
|
: isLocalSubscription(who) ? 'sign in through /accounts' : `add a key with /config key ${who}`;
|
|
11594
11730
|
// A caller may have saved the choice first; rolling back cannot undo that.
|
|
@@ -13963,6 +14099,7 @@ export class RatatuiApp {
|
|
|
13963
14099
|
initialFilter: options.initialFilter,
|
|
13964
14100
|
initialView: options.initialView,
|
|
13965
14101
|
onResume: (entry) => this.resumeSessionFromPanel(entry),
|
|
14102
|
+
onClose: options.onClose,
|
|
13966
14103
|
onRefresh: () => this.collectResumeEntries(cwd),
|
|
13967
14104
|
loadPreview: (entry) => loadSessionTranscript(entry.path),
|
|
13968
14105
|
});
|
|
@@ -14178,6 +14315,7 @@ export class RatatuiApp {
|
|
|
14178
14315
|
// instance that was holding it (SIGCONT + SIGTERM), so the old owner cannot
|
|
14179
14316
|
// wake up later and overwrite the transcript we are about to write.
|
|
14180
14317
|
this.instanceRegistry.reapStopped();
|
|
14318
|
+
this.relaunchingFromPicker = true;
|
|
14181
14319
|
this.resumePanelWidget.cancel();
|
|
14182
14320
|
await this.relaunchTui({
|
|
14183
14321
|
sessionId: entry.id,
|
|
@@ -10,13 +10,14 @@ import chalk from 'chalk';
|
|
|
10
10
|
import { renderImagePreview } from '../utils/image_preview.js';
|
|
11
11
|
import { completePath } from '../utils/path_complete.js';
|
|
12
12
|
import { formatCommandCompletionPreview } from '../agent/commands/index.js';
|
|
13
|
-
import { isRecording as isLegacyRecording, startRecording as startLegacyRecording, stopRecordingAndTranscribe as stopLegacyRecording,
|
|
13
|
+
import { isRecording as isLegacyRecording, startRecording as startLegacyRecording, stopRecordingAndTranscribe as stopLegacyRecording, getDictationUnavailableReason } from '../utils/dictation.js';
|
|
14
14
|
import { isNativeDictationAvailable, isNativeRecording, startNativeRecording, stopNativeRecording } from '../utils/dictation_native.js';
|
|
15
15
|
import { maybeFilterFillers } from '../utils/dictation_filter.js';
|
|
16
16
|
// Use native dictation if available, otherwise fall back to legacy
|
|
17
17
|
const useNative = isNativeDictationAvailable();
|
|
18
18
|
const isRecording = () => useNative ? isNativeRecording() : isLegacyRecording();
|
|
19
|
-
|
|
19
|
+
/** Why Ctrl+R can't dictate, with how to get there (see utils/dictation.ts); undefined when it can. */
|
|
20
|
+
const dictationUnavailable = () => useNative ? undefined : getDictationUnavailableReason();
|
|
20
21
|
import { createEmptyState, historyUp, historyDown, recordInputHistory, killInputDraft, yankInputKill, getInputShortcutHint, insertText, insertBadge, expandPasteBadge, backspace, deleteForward, moveLeft, moveRight, moveWordLeft, moveWordRight, getPlainText, serializeSegments, PASTE_BADGE_THRESHOLD } from '../ui/core/input_segments.js';
|
|
21
22
|
// Helper to check for Ctrl key combinations
|
|
22
23
|
// Handles multiple formats:
|
|
@@ -596,6 +597,9 @@ export const InputArea = ({ onSubmit, onCancelRun, isRunning = false, onQueue, o
|
|
|
596
597
|
else {
|
|
597
598
|
stopLegacyRecording()
|
|
598
599
|
.then((result) => {
|
|
600
|
+
// The first recording this session sends to OpenAI's Whisper API says so, once.
|
|
601
|
+
if (result.notice)
|
|
602
|
+
onToast?.(result.notice);
|
|
599
603
|
if (result.text && result.text.trim()) {
|
|
600
604
|
// Filter filler words and submit the transcribed text
|
|
601
605
|
onSubmit(maybeFilterFillers(result.text.trim()));
|
|
@@ -615,8 +619,9 @@ export const InputArea = ({ onSubmit, onCancelRun, isRunning = false, onQueue, o
|
|
|
615
619
|
}
|
|
616
620
|
else {
|
|
617
621
|
// Start recording
|
|
618
|
-
|
|
619
|
-
|
|
622
|
+
const unavailable = dictationUnavailable();
|
|
623
|
+
if (unavailable) {
|
|
624
|
+
onToast?.(unavailable);
|
|
620
625
|
return;
|
|
621
626
|
}
|
|
622
627
|
try {
|
|
@@ -963,6 +968,9 @@ export const InputArea = ({ onSubmit, onCancelRun, isRunning = false, onQueue, o
|
|
|
963
968
|
else {
|
|
964
969
|
stopLegacyRecording()
|
|
965
970
|
.then((result) => {
|
|
971
|
+
// The first recording this session sends to OpenAI's Whisper API says so, once.
|
|
972
|
+
if (result.notice)
|
|
973
|
+
onToast?.(result.notice);
|
|
966
974
|
if (result.text && result.text.trim()) {
|
|
967
975
|
// Filter filler words and submit the transcribed text
|
|
968
976
|
onSubmit(maybeFilterFillers(result.text.trim()));
|
|
@@ -982,8 +990,9 @@ export const InputArea = ({ onSubmit, onCancelRun, isRunning = false, onQueue, o
|
|
|
982
990
|
}
|
|
983
991
|
else {
|
|
984
992
|
// Start recording
|
|
985
|
-
|
|
986
|
-
|
|
993
|
+
const unavailable = dictationUnavailable();
|
|
994
|
+
if (unavailable) {
|
|
995
|
+
onToast?.(unavailable);
|
|
987
996
|
return;
|
|
988
997
|
}
|
|
989
998
|
try {
|
|
@@ -1178,6 +1187,9 @@ export const InputArea = ({ onSubmit, onCancelRun, isRunning = false, onQueue, o
|
|
|
1178
1187
|
else {
|
|
1179
1188
|
stopLegacyRecording()
|
|
1180
1189
|
.then((result) => {
|
|
1190
|
+
// The first recording this session sends to OpenAI's Whisper API says so, once.
|
|
1191
|
+
if (result.notice)
|
|
1192
|
+
onToast?.(result.notice);
|
|
1181
1193
|
if (result.text && result.text.trim()) {
|
|
1182
1194
|
// Filter filler words and submit the transcribed text
|
|
1183
1195
|
onSubmit(maybeFilterFillers(result.text.trim()));
|
|
@@ -1198,8 +1210,9 @@ export const InputArea = ({ onSubmit, onCancelRun, isRunning = false, onQueue, o
|
|
|
1198
1210
|
}
|
|
1199
1211
|
}
|
|
1200
1212
|
else {
|
|
1201
|
-
|
|
1202
|
-
|
|
1213
|
+
const unavailable = dictationUnavailable();
|
|
1214
|
+
if (unavailable) {
|
|
1215
|
+
onToast?.(unavailable);
|
|
1203
1216
|
return;
|
|
1204
1217
|
}
|
|
1205
1218
|
try {
|
|
@@ -1481,6 +1494,9 @@ export const InputArea = ({ onSubmit, onCancelRun, isRunning = false, onQueue, o
|
|
|
1481
1494
|
else {
|
|
1482
1495
|
stopLegacyRecording()
|
|
1483
1496
|
.then((result) => {
|
|
1497
|
+
// The first recording this session sends to OpenAI's Whisper API says so, once.
|
|
1498
|
+
if (result.notice)
|
|
1499
|
+
onToast?.(result.notice);
|
|
1484
1500
|
if (result.text && result.text.trim()) {
|
|
1485
1501
|
// Filter filler words and submit the transcribed text
|
|
1486
1502
|
onSubmit(maybeFilterFillers(result.text.trim()));
|
|
@@ -1501,8 +1517,9 @@ export const InputArea = ({ onSubmit, onCancelRun, isRunning = false, onQueue, o
|
|
|
1501
1517
|
}
|
|
1502
1518
|
}
|
|
1503
1519
|
else {
|
|
1504
|
-
|
|
1505
|
-
|
|
1520
|
+
const unavailable = dictationUnavailable();
|
|
1521
|
+
if (unavailable) {
|
|
1522
|
+
onToast?.(unavailable);
|
|
1506
1523
|
return;
|
|
1507
1524
|
}
|
|
1508
1525
|
try {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ZTC's Anthropic model catalog: the Claude models the Messages API serves,
|
|
3
|
+
* newest first. The bare family names (`opus`, `sonnet`, `haiku`) are aliases
|
|
4
|
+
* of the newest model of each family, so moving an alias to a new release is
|
|
5
|
+
* the one edit that updates every place that picks "the current Sonnet".
|
|
6
|
+
*
|
|
7
|
+
* A leaf module with no imports, so configuration code can read it without
|
|
8
|
+
* loading the pane catalog.
|
|
9
|
+
*/
|
|
10
|
+
export type ClaudeFamily = 'opus' | 'sonnet' | 'haiku';
|
|
11
|
+
export interface AnthropicCatalogModel {
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
aliases: readonly string[];
|
|
15
|
+
}
|
|
16
|
+
export declare const ANTHROPIC_CATALOG_MODELS: readonly AnthropicCatalogModel[];
|
|
17
|
+
/** The newest catalog model of a Claude family, by its Messages API id. */
|
|
18
|
+
export declare function newestClaudeModel(family: ClaudeFamily): string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ZTC's Anthropic model catalog: the Claude models the Messages API serves,
|
|
3
|
+
* newest first. The bare family names (`opus`, `sonnet`, `haiku`) are aliases
|
|
4
|
+
* of the newest model of each family, so moving an alias to a new release is
|
|
5
|
+
* the one edit that updates every place that picks "the current Sonnet".
|
|
6
|
+
*
|
|
7
|
+
* A leaf module with no imports, so configuration code can read it without
|
|
8
|
+
* loading the pane catalog.
|
|
9
|
+
*/
|
|
10
|
+
export const ANTHROPIC_CATALOG_MODELS = [
|
|
11
|
+
{ id: 'claude-opus-5', name: 'Opus 5', aliases: ['opus-5', 'opus 5', 'opus'] },
|
|
12
|
+
{ id: 'claude-opus-4-8', name: 'Opus 4.8', aliases: ['opus-4.8', 'opus 4.8'] },
|
|
13
|
+
{ id: 'claude-sonnet-4-6', name: 'Sonnet 4.6', aliases: ['sonnet-4.6', 'sonnet 4.6', 'sonnet'] },
|
|
14
|
+
{ id: 'claude-haiku-4-5-20251001', name: 'Haiku 4.5', aliases: ['claude-haiku-4-5', 'haiku-4.5', 'haiku 4.5', 'haiku'] },
|
|
15
|
+
];
|
|
16
|
+
/** The newest catalog model of a Claude family, by its Messages API id. */
|
|
17
|
+
export function newestClaudeModel(family) {
|
|
18
|
+
const model = ANTHROPIC_CATALOG_MODELS.find(entry => entry.aliases.includes(family));
|
|
19
|
+
if (!model)
|
|
20
|
+
throw new Error(`The Anthropic catalog has no ${family} model.`);
|
|
21
|
+
return model.id;
|
|
22
|
+
}
|
|
@@ -3,7 +3,6 @@ import type { CodexReasoningEffort, ZTCConfig } from './types.js';
|
|
|
3
3
|
export declare const DEFAULT_OPENAI_MODEL = "gpt-5.4-nano";
|
|
4
4
|
export declare const DEFAULT_CODEX_MODEL = "gpt-5.6-sol";
|
|
5
5
|
export declare const DEFAULT_ANTHROPIC_MODEL = "claude-opus-5";
|
|
6
|
-
export declare const DEFAULT_CLAUDE_CODE_MODEL = "sonnet";
|
|
7
6
|
export declare const DEFAULT_GEMINI_MODEL = "gemini-3.6-flash";
|
|
8
7
|
export declare const DEFAULT_KIMI_MODEL = "kimi-k3";
|
|
9
8
|
export declare const DEFAULT_KIMI_CODE_MODEL = "k3";
|