@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
|
@@ -38,6 +38,8 @@ export interface ConfigController {
|
|
|
38
38
|
switchProfile?: (name: string, activate: () => void | Promise<void>) => Promise<void>;
|
|
39
39
|
hasApiKey: () => boolean;
|
|
40
40
|
getApiKey: (provider?: string) => string | undefined;
|
|
41
|
+
/** The key a request may carry: none while route resolution has no route for it (see ConfigStore.getRequestApiKey). */
|
|
42
|
+
getRequestApiKey?: (provider?: string) => string | undefined;
|
|
41
43
|
hasDirectCredential?: (provider: string) => boolean;
|
|
42
44
|
setApiKey: (key: string, provider?: string) => void;
|
|
43
45
|
/** Read a provider's key from the named environment variable; only the name is saved. */
|
|
@@ -73,6 +75,8 @@ export interface ConfigController {
|
|
|
73
75
|
getPromptCacheTtlMs?: () => number | undefined;
|
|
74
76
|
setPromptCacheTtlMs?: (ms: number | undefined) => void;
|
|
75
77
|
getModel?: () => string;
|
|
78
|
+
/** The model an environment variable (ZTC_MODEL, LLM_MODEL) pins for this process, if any. */
|
|
79
|
+
getEnvironmentModel?: () => string | undefined;
|
|
76
80
|
setModelEffort: (model: string, level: CodexReasoningEffort | null) => void;
|
|
77
81
|
/** Effort chosen by a startup `--effort` for this process only. */
|
|
78
82
|
getReasoningWireSurface?: (provider?: string, model?: string) => ReasoningWireSurface;
|
|
@@ -98,6 +102,8 @@ export interface ConfigController {
|
|
|
98
102
|
apiKeyOverride?: string;
|
|
99
103
|
compatBaseUrlOverride?: string;
|
|
100
104
|
config?: ZTCConfig;
|
|
105
|
+
/** Resolve the route as it will be once this choice is saved (see ConfigStore.resolveLLMBackendConfig). */
|
|
106
|
+
asChosen?: boolean;
|
|
101
107
|
}) => ResolvedLLMConfig;
|
|
102
108
|
}
|
|
103
109
|
export interface EmulationController {
|
|
@@ -357,13 +363,27 @@ export interface CommandContext {
|
|
|
357
363
|
/** Retained, validated checkpoint only; it does not establish live task ownership. */
|
|
358
364
|
getTaskHandoff?: () => TaskHandoffProjection | null;
|
|
359
365
|
/**
|
|
360
|
-
* Who invoked the command: the user typing it,
|
|
361
|
-
* `ztc_command` tool
|
|
362
|
-
*
|
|
363
|
-
*
|
|
364
|
-
*
|
|
366
|
+
* Who invoked the command: the user typing it, the agent through the
|
|
367
|
+
* `ztc_command` tool, or input relayed into this session (`relayed`): a
|
|
368
|
+
* message from another pane, the coordinator or another ZTC on the bus, a
|
|
369
|
+
* prompt on a pane's stdin (what a parent pane or the overseer's
|
|
370
|
+
* write_terminal_pane sends), a /loop tick, a goal continuation, a queued
|
|
371
|
+
* entry, and what a ZTC that another ZTC launched into one of its panes (a
|
|
372
|
+
* ZTC pane, a colony cell: ZTC_PARENT_PID or ZTC_COLONY_CHILD) reads from
|
|
373
|
+
* its terminal, since the overseer's write_terminal_pane types into the same
|
|
374
|
+
* PTY as the person; and what a mirror's /broadcast delivers, which only
|
|
375
|
+
* colony's AgentBridge posts (send_to_worktree, the colony dashboard). That
|
|
376
|
+
* is input the TUI's handleSubmit and the headless runner do not mark as the
|
|
377
|
+
* person's own: only the person typing in ZTC's main session, a ztc they
|
|
378
|
+
* run, or the browser mirror is.
|
|
379
|
+
* Absent means user — every renderer therefore keeps the user's full
|
|
380
|
+
* authority with no change, and only the agent-facing dispatch path and the
|
|
381
|
+
* relaying paths have to opt in. Commands that can clear their own safety
|
|
382
|
+
* state (currently `/goal resume|clear|set`) read this to refuse the agent;
|
|
383
|
+
* a choice only the person makes (`/dictation local|macos|openai` and the
|
|
384
|
+
* Dictation provider setting) refuses relayed input too.
|
|
365
385
|
*/
|
|
366
|
-
commandOrigin?: 'user' | 'agent';
|
|
386
|
+
commandOrigin?: 'user' | 'agent' | 'relayed';
|
|
367
387
|
addMessage: (msg: Omit<Message, 'id' | 'timestamp'>) => void;
|
|
368
388
|
clearMessages: () => void;
|
|
369
389
|
/** Replace retained canonical records without assigning new authored identities or clearing pending input. */
|
package/dist/agent/factory.js
CHANGED
|
@@ -2,11 +2,10 @@ import { readRouterCatalog } from '../utils/router_catalog.js';
|
|
|
2
2
|
import { Agent } from './agent.js';
|
|
3
3
|
import { ZergAPIBackend, ZRouterStreamBackend, createBackendForProvider, createNativeAnthropicMessagesRouterBackend } from './backends/index.js';
|
|
4
4
|
import { CODEX_AUTH_SENTINEL } from './backends/codex_auth.js';
|
|
5
|
-
import { CLAUDE_CODE_AUTH_SENTINEL } from './backends/claude_cli.js';
|
|
6
5
|
import { KIMI_CODE_AUTH_SENTINEL } from './backends/kimi_code_auth.js';
|
|
7
|
-
import { CODEX_APP_SERVER_SENTINEL, isCodexAppServerProvider, isCodexLegacyProvider, normalizeProviderId } from './backends/provider_ids.js';
|
|
8
|
-
import { accountBackendOptions, resolveActiveAccount, isAccountProvider, canonicalAccountProvider, sourceDir
|
|
9
|
-
import {
|
|
6
|
+
import { CODEX_APP_SERVER_SENTINEL, isCodexAppServerProvider, isCodexLegacyProvider, isLocalSubscriptionProvider, normalizeProviderId } from './backends/provider_ids.js';
|
|
7
|
+
import { accountBackendOptions, resolveActiveAccount, isAccountProvider, canonicalAccountProvider, sourceDir } from './backends/account_pool.js';
|
|
8
|
+
import { assertProviderNotRetired } from '../config/retired_routes.js';
|
|
10
9
|
import { getEmulationProfile, buildRuntimeContext } from '../emulation/catalog.js';
|
|
11
10
|
import { getEmulationMappingAddendum, emulationUsesPaneTools } from '../emulation/mappings.js';
|
|
12
11
|
import { buildEmulationCompatibilityTools, getEmulationToolMapping } from '../emulation/tool_adapters.js';
|
|
@@ -93,13 +92,6 @@ function resolveNoFollowLeaf(p) {
|
|
|
93
92
|
return absolute;
|
|
94
93
|
}
|
|
95
94
|
}
|
|
96
|
-
const HOST_BEARER_PROVIDER_DENYLIST = new Set([
|
|
97
|
-
'claude_code',
|
|
98
|
-
'claude_code_direct',
|
|
99
|
-
'codex_app_server',
|
|
100
|
-
'codex_legacy',
|
|
101
|
-
'kimi_code',
|
|
102
|
-
]);
|
|
103
95
|
function hostTransportHeaders(headers) {
|
|
104
96
|
if (!headers)
|
|
105
97
|
return undefined;
|
|
@@ -124,7 +116,8 @@ function resolveHostAgentBackend(options, provider, model) {
|
|
|
124
116
|
if (!conversationId) {
|
|
125
117
|
throw new Error(`Host runtime '${registration.id}' requires a conversation id`);
|
|
126
118
|
}
|
|
127
|
-
|
|
119
|
+
// Local subscription logins never hand a bearer credential to a host broker.
|
|
120
|
+
if (isLocalSubscriptionProvider(provider)) {
|
|
128
121
|
throw new Error(`Host runtime '${registration.id}' cannot broker bearer credentials for local-auth provider '${provider}'`);
|
|
129
122
|
}
|
|
130
123
|
let activeTurn;
|
|
@@ -176,6 +169,13 @@ export function resolveAgentBackendFromConfig(options) {
|
|
|
176
169
|
? resolveRepoModelOverride(options.cwd)
|
|
177
170
|
: null;
|
|
178
171
|
const rawProvider = repoOverride?.provider ?? options.provider ?? options.config.provider ?? inferDefaultProvider();
|
|
172
|
+
// A backstop behind the settings move and the read-time guards: a retired
|
|
173
|
+
// Claude Code route never becomes a backend, and the error says what to use.
|
|
174
|
+
assertProviderNotRetired(rawProvider);
|
|
175
|
+
// Route resolution comes before every way a backend is built (a hosted
|
|
176
|
+
// Router, a host broker, an account, a key, a platform login): a profile
|
|
177
|
+
// waiting for a route choice has none but one this run's own --provider chose.
|
|
178
|
+
configStore.assertRouteChosen(rawProvider);
|
|
179
179
|
const provider = normalizeProviderId(rawProvider);
|
|
180
180
|
// Admit the resolved repo/provider choice before any provider resources exist.
|
|
181
181
|
admitPermissionProvider(resolvePermissionProfile(options.config), projectPermissionPolicy(options.config), provider);
|
|
@@ -201,13 +201,13 @@ export function resolveAgentBackendFromConfig(options) {
|
|
|
201
201
|
let backend;
|
|
202
202
|
let apiKey;
|
|
203
203
|
// Account pool: the active account for this provider (empty when no pool is
|
|
204
|
-
// configured, preserving today's ambient ~/.
|
|
204
|
+
// configured, preserving today's ambient ~/.codex / ~/.kimi-code behavior).
|
|
205
205
|
const accountOpts = accountBackendOptions(options.config, provider);
|
|
206
206
|
// Observability: make WHICH account (or the ambient fallback) is serving this
|
|
207
207
|
// provider visible at build/reload time — the answer to "is the pool actually
|
|
208
208
|
// being used, or just the badge?". One concise line per agent construction.
|
|
209
209
|
// Per the product decision: with no pooled account we still go ambient
|
|
210
|
-
// (~/.
|
|
210
|
+
// (~/.codex / ~/.kimi-code), but WARN so it's never a silent surprise.
|
|
211
211
|
// Routed through runtimeDiag (dedup'd): raw console writes from here
|
|
212
212
|
// interleave with the interactive renderer's frames and shred the chat UI.
|
|
213
213
|
const canonicalProvider = canonicalAccountProvider(provider);
|
|
@@ -215,25 +215,13 @@ export function resolveAgentBackendFromConfig(options) {
|
|
|
215
215
|
const active = resolveActiveAccount(options.config, provider);
|
|
216
216
|
if (active) {
|
|
217
217
|
runtimeDiagOnce('info', `[ztc] account: ${provider} → "${active.id}" (${active.label}) [${sourceDir(active.source)}]`);
|
|
218
|
-
// If this account is backed only by the shared macOS keychain (no isolated
|
|
219
|
-
// per-account creds), switching/rotating between claude accounts is a no-op
|
|
220
|
-
// until each logs in per-account — surface that rather than silently.
|
|
221
|
-
warnSharedKeychainAccount(active);
|
|
222
218
|
}
|
|
223
219
|
else {
|
|
224
|
-
const ambientDir = canonicalProvider.startsWith('codex')
|
|
225
|
-
? '~/.codex'
|
|
226
|
-
: canonicalProvider === 'kimi_code'
|
|
227
|
-
? '~/.kimi-code'
|
|
228
|
-
: '~/.claude';
|
|
220
|
+
const ambientDir = canonicalProvider.startsWith('codex') ? '~/.codex' : '~/.kimi-code';
|
|
229
221
|
runtimeDiagOnce('warn', `[ztc] account: ${provider} → no pooled account active; using ambient ${ambientDir} credentials. `
|
|
230
222
|
+ `Add or select one in /accounts to pin this to a subscription.`);
|
|
231
223
|
}
|
|
232
224
|
}
|
|
233
|
-
// Auto-rotate: when rotation.enabled, the main agent draws from the pool and
|
|
234
|
-
// fails over on a 429. Empty object when disabled (preserves single-account
|
|
235
|
-
// behavior). Subagents handle inheritance separately (subagent factory).
|
|
236
|
-
const rotationOpts = buildAccountRotation(options.config) ?? {};
|
|
237
225
|
// Priority order:
|
|
238
226
|
// 1. Proxy mode (zergProxyUrl + auth token) → standard backend with proxy base URL
|
|
239
227
|
// 2. Direct API key → standard backend with real API
|
|
@@ -298,7 +286,6 @@ export function resolveAgentBackendFromConfig(options) {
|
|
|
298
286
|
// runs in-process (see applyPlanWriteGuard), not through this sandbox.
|
|
299
287
|
codexAppServerSandbox: options.mode === 'plan' ? 'read-only' : llm.codexAppServerSandbox,
|
|
300
288
|
...accountOpts,
|
|
301
|
-
...rotationOpts,
|
|
302
289
|
});
|
|
303
290
|
}
|
|
304
291
|
catch (e) {
|
|
@@ -309,7 +296,7 @@ export function resolveAgentBackendFromConfig(options) {
|
|
|
309
296
|
}
|
|
310
297
|
else if (isCodexLegacyProvider(provider)) {
|
|
311
298
|
try {
|
|
312
|
-
backend = createBackendForProvider(provider, { apiKey: '', ...accountOpts
|
|
299
|
+
backend = createBackendForProvider(provider, { apiKey: '', ...accountOpts });
|
|
313
300
|
}
|
|
314
301
|
catch (e) {
|
|
315
302
|
runtimeDiag('error', `[ztc] codex_legacy auth not available: ${e.message}`);
|
|
@@ -317,32 +304,10 @@ export function resolveAgentBackendFromConfig(options) {
|
|
|
317
304
|
}
|
|
318
305
|
apiKey = CODEX_AUTH_SENTINEL;
|
|
319
306
|
}
|
|
320
|
-
else if (provider === 'claude_code' || provider === 'claude-code') {
|
|
321
|
-
try {
|
|
322
|
-
backend = createBackendForProvider(provider, { apiKey: '', apiEndpoint: options.apiEndpoint, ...accountOpts, ...rotationOpts });
|
|
323
|
-
}
|
|
324
|
-
catch (e) {
|
|
325
|
-
runtimeDiag('error', `[ztc] Claude Code auth not available: ${e.message}`);
|
|
326
|
-
return null;
|
|
327
|
-
}
|
|
328
|
-
apiKey = CLAUDE_CODE_AUTH_SENTINEL;
|
|
329
|
-
}
|
|
330
|
-
else if (provider === 'claude_code_direct' || provider === 'claude-code-direct') {
|
|
331
|
-
// De-orphaned: the OAuth-direct Claude path is now reachable from config so
|
|
332
|
-
// a pooled account (claude_creds_file) can drive it.
|
|
333
|
-
try {
|
|
334
|
-
backend = createBackendForProvider(provider, { apiKey: '', apiEndpoint: options.apiEndpoint, ...accountOpts, ...rotationOpts });
|
|
335
|
-
}
|
|
336
|
-
catch (e) {
|
|
337
|
-
runtimeDiag('error', `[ztc] Claude Code direct auth not available: ${e.message}`);
|
|
338
|
-
return null;
|
|
339
|
-
}
|
|
340
|
-
apiKey = CLAUDE_CODE_AUTH_SENTINEL;
|
|
341
|
-
}
|
|
342
307
|
else if (provider === 'kimi_code' || provider === 'kimi-code') {
|
|
343
308
|
// Kimi subscription via the Kimi Code OAuth credentials (device-flow login).
|
|
344
309
|
try {
|
|
345
|
-
backend = createBackendForProvider(provider, { apiKey: '', apiEndpoint: options.apiEndpoint, ...accountOpts
|
|
310
|
+
backend = createBackendForProvider(provider, { apiKey: '', apiEndpoint: options.apiEndpoint, ...accountOpts });
|
|
346
311
|
}
|
|
347
312
|
catch (e) {
|
|
348
313
|
runtimeDiag('error', `[ztc] Kimi Code auth not available: ${e.message}`);
|
package/dist/agent/subagent.js
CHANGED
|
@@ -16,8 +16,7 @@ import { getSessionPathForCwd, saveSessionToFile } from '../session.js';
|
|
|
16
16
|
import { getDefaultModel } from '../utils/models.js';
|
|
17
17
|
import { debugLog } from '../utils/debug_log.js';
|
|
18
18
|
import { createBackendForProvider } from './backends/index.js';
|
|
19
|
-
import { accountBackendOptions
|
|
20
|
-
import { buildAccountRotation, subagentShouldRotate } from './backends/rotation_factory.js';
|
|
19
|
+
import { accountBackendOptions } from './backends/account_pool.js';
|
|
21
20
|
import { describeExecutionContext, resolveExecutionSettings } from './runtime/execution_context.js';
|
|
22
21
|
import { createRecoveryGuard } from './runtime/recovery.js';
|
|
23
22
|
import { listCommandJobs, shutdownCommandJobs } from './runtime/command_jobs.js';
|
|
@@ -154,11 +153,8 @@ function getSubAgentModel(provider, preferredModel) {
|
|
|
154
153
|
/**
|
|
155
154
|
* Create a backend for the sub-agent (delegates to shared factory).
|
|
156
155
|
*
|
|
157
|
-
* Account pool: subagents resolve the active pooled account
|
|
158
|
-
* same credentials as the parent, not ambient ~/.
|
|
159
|
-
* subagentInheritance toggle decides rotation: 'inherit' (default) reuses the
|
|
160
|
-
* parent's active account with no independent failover; 'pool' lets the subagent
|
|
161
|
-
* rotate on its own 429s.
|
|
156
|
+
* Account pool: subagents resolve the active pooled account, so they run on the
|
|
157
|
+
* same credentials as the parent, not the ambient ~/.codex / ~/.kimi-code.
|
|
162
158
|
*/
|
|
163
159
|
function createBackend(provider, apiKey) {
|
|
164
160
|
const config = configStore.get();
|
|
@@ -169,10 +165,7 @@ function createBackend(provider, apiKey) {
|
|
|
169
165
|
catalog: readRouterCatalog({ origin: resolved.proxyUrl, token: resolved.authToken, workspaceId: configStore.getRouterCatalogConnection()?.workspaceId }) });
|
|
170
166
|
}
|
|
171
167
|
const accountOpts = accountBackendOptions(config, provider);
|
|
172
|
-
|
|
173
|
-
? buildAccountRotation(config) ?? {}
|
|
174
|
-
: {};
|
|
175
|
-
return createBackendForProvider(provider, { apiKey, ...accountOpts, ...rotationOpts });
|
|
168
|
+
return createBackendForProvider(provider, { apiKey, ...accountOpts });
|
|
176
169
|
}
|
|
177
170
|
export class SubAgent {
|
|
178
171
|
config;
|
|
@@ -3,6 +3,7 @@ import { createInterface } from 'readline';
|
|
|
3
3
|
import { resolve, dirname } from 'path';
|
|
4
4
|
import { existsSync, createWriteStream, mkdirSync } from 'fs';
|
|
5
5
|
import { configStore } from '../../config.js';
|
|
6
|
+
import { PROVIDER_API_KEY_ENV } from '../../config/provider_api_key_env.js';
|
|
6
7
|
// --- Module-level subprocess state (following delegate.ts pattern) ---
|
|
7
8
|
let activeProcess = null;
|
|
8
9
|
let progressEvents = [];
|
|
@@ -201,7 +202,15 @@ export const adaptationRunTool = {
|
|
|
201
202
|
// The runner checks ANTHROPIC_API_KEY / OPENAI_API_KEY env vars to auto-detect the backend.
|
|
202
203
|
const spawnEnv = { ...process.env };
|
|
203
204
|
const provider = configStore.getProvider();
|
|
204
|
-
const apiKey = configStore.
|
|
205
|
+
const apiKey = configStore.getRequestApiKey();
|
|
206
|
+
// A profile waiting for a route choice sends only the key its route sends
|
|
207
|
+
// (none through Zerg Router), so the pipeline doesn't inherit a provider
|
|
208
|
+
// key from the environment that nobody chose for it.
|
|
209
|
+
if (configStore.retiredRouteAwaitingChoice() !== undefined) {
|
|
210
|
+
for (const names of Object.values(PROVIDER_API_KEY_ENV))
|
|
211
|
+
for (const name of names)
|
|
212
|
+
delete spawnEnv[name];
|
|
213
|
+
}
|
|
205
214
|
if (apiKey) {
|
|
206
215
|
const envVarName = provider === 'openai' ? 'OPENAI_API_KEY'
|
|
207
216
|
: provider === 'anthropic' || provider === 'claude' ? 'ANTHROPIC_API_KEY'
|
package/dist/agent/tools/pane.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { configStore } from '../../config.js';
|
|
2
|
+
import { isRetiredModel, isRetiredProvider, retiredProviderMessage, ROUTE_AWAITS_A_CHOICE } from '../../config/retired_routes.js';
|
|
2
3
|
/**
|
|
3
4
|
* Terminal pane management tools for zmux mode.
|
|
4
5
|
*
|
|
@@ -444,7 +445,6 @@ export function childZtcPaneEnv() {
|
|
|
444
445
|
if (process.env.ZTC_NAVIGATOR_GROUP) {
|
|
445
446
|
env.ZTC_NAVIGATOR_GROUP = process.env.ZTC_NAVIGATOR_GROUP;
|
|
446
447
|
}
|
|
447
|
-
copyEnvIfPresent(env, 'CLAUDE_CODE_OAUTH_TOKEN');
|
|
448
448
|
copyEnvIfPresent(env, 'CODEX_HOME');
|
|
449
449
|
copyEnvIfPresent(env, 'PATH');
|
|
450
450
|
return env;
|
|
@@ -486,6 +486,15 @@ export function buildChildZtcPaneLaunch(extraArgs = [], childSessionId = generat
|
|
|
486
486
|
i++;
|
|
487
487
|
}
|
|
488
488
|
}
|
|
489
|
+
// A retired Claude Code route is dropped with the model given with it, so the
|
|
490
|
+
// child starts on this session's own route instead of being refused at launch.
|
|
491
|
+
if (isRetiredProvider(provider)) {
|
|
492
|
+
provider = undefined;
|
|
493
|
+
model = undefined;
|
|
494
|
+
}
|
|
495
|
+
else if (isRetiredModel(model)) {
|
|
496
|
+
model = undefined;
|
|
497
|
+
}
|
|
489
498
|
const resolved = model ? resolveModelAndProvider(model, provider, configStore.getResolvedAuthMode()) : { model: undefined, provider };
|
|
490
499
|
const knownProvider = isPaneProvider(resolved.provider, configStore.getResolvedAuthMode()) ? resolved.provider : undefined;
|
|
491
500
|
const fallbackArgs = [];
|
|
@@ -692,7 +701,7 @@ export const createZtcPaneTool = {
|
|
|
692
701
|
},
|
|
693
702
|
provider: {
|
|
694
703
|
type: 'string',
|
|
695
|
-
description: 'LLM provider for this pane (e.g., "anthropic", "
|
|
704
|
+
description: 'LLM provider for this pane (e.g., "anthropic", "openai", "deepseek", "gemini"). Defaults to system config. For Claude Code itself, open a Claude Code pane instead.',
|
|
696
705
|
},
|
|
697
706
|
model: {
|
|
698
707
|
type: 'string',
|
|
@@ -726,6 +735,9 @@ export const createZtcPaneTool = {
|
|
|
726
735
|
// Per-pane model/provider override with fuzzy matching + provider inference
|
|
727
736
|
let provider = args.provider ? String(args.provider) : undefined;
|
|
728
737
|
let model = args.model ? String(args.model) : undefined;
|
|
738
|
+
if (isRetiredProvider(provider) || isRetiredModel(model)) {
|
|
739
|
+
return `Error: ${retiredProviderMessage(provider ?? model ?? 'claude_code')} Leave provider unset to use this session's model.`;
|
|
740
|
+
}
|
|
729
741
|
if (model) {
|
|
730
742
|
const resolved = resolveModelAndProvider(model, provider, configStore.getResolvedAuthMode());
|
|
731
743
|
model = resolved.model;
|
|
@@ -734,6 +746,9 @@ export const createZtcPaneTool = {
|
|
|
734
746
|
// Validate API key exists for requested provider
|
|
735
747
|
if (provider) {
|
|
736
748
|
const { configStore } = await import('../../config.js');
|
|
749
|
+
// A child on a provider this run's own --provider didn't choose would choose it for a waiting profile.
|
|
750
|
+
if (configStore.routeAwaitingChoice(provider) !== undefined)
|
|
751
|
+
return `Error: ${ROUTE_AWAITS_A_CHOICE}`;
|
|
737
752
|
const key = configStore.getApiKey(provider);
|
|
738
753
|
if (!key) {
|
|
739
754
|
return `Error: No API key configured for provider "${provider}". Set it with /config key ${provider} <key> or the appropriate environment variable.`;
|
|
@@ -964,6 +979,14 @@ For raw keystrokes set submit=false; input bytes are preserved and Enter is \\r
|
|
|
964
979
|
if (!Number.isSafeInteger(paneId) || paneId < 0) {
|
|
965
980
|
throw new Error('pane_id must be a non-negative integer.');
|
|
966
981
|
}
|
|
982
|
+
// Pane 0 is ZTC's main session, the overseer, whose input is the person's alone: zmux and the desktop app's zterm
|
|
983
|
+
// refuse terminal input for it (zterm before this release handed it over as typing, which would make an agent's
|
|
984
|
+
// line the person's own: choosing where dictation transcribes, say). The tool says so itself, whichever renderer
|
|
985
|
+
// runs. Panes reach the main session with send_message.
|
|
986
|
+
if (paneId === 0) {
|
|
987
|
+
throw new Error('Pane 0 is ZTC\'s main session, where only the person types, so write_terminal_pane can\'t write to it. '
|
|
988
|
+
+ 'To reach it from a pane, use send_message.');
|
|
989
|
+
}
|
|
967
990
|
let input = String(args.input || '');
|
|
968
991
|
if (!input) {
|
|
969
992
|
throw new Error('input is required.');
|
package/dist/agent/tools/sim.js
CHANGED
|
@@ -17,10 +17,11 @@ let findStaleNumericReferences;
|
|
|
17
17
|
let liveNumericReferences;
|
|
18
18
|
let formatStaleNumericReferenceSummary;
|
|
19
19
|
let parseCommaSeparated;
|
|
20
|
+
let loadedWorldRouteNotice;
|
|
20
21
|
let _simLoaded = null;
|
|
21
22
|
function ensureSimLoaded() {
|
|
22
23
|
_simLoaded ??= (async () => {
|
|
23
|
-
const [core, memBackend, memTree, memText, numericPolicy, staleGuard, worldUtils] = await Promise.all([
|
|
24
|
+
const [core, memBackend, memTree, memText, numericPolicy, staleGuard, worldUtils, inference] = await Promise.all([
|
|
24
25
|
import('../../simulation/core.js'),
|
|
25
26
|
import('../../simulation/memory/backend.js'),
|
|
26
27
|
import('../../simulation/memory/filesystem_file_tree.js'),
|
|
@@ -28,6 +29,7 @@ function ensureSimLoaded() {
|
|
|
28
29
|
import('../../simulation/orchestration/live_numeric_policy.js'),
|
|
29
30
|
import('../../simulation/orchestration/stale_numeric_action_guard.js'),
|
|
30
31
|
import('../../simulation/world/utils.js'),
|
|
32
|
+
import('../../simulation/inference.js'),
|
|
31
33
|
]);
|
|
32
34
|
({ SimState, getSimState, setSimState, DEFAULT_SIM_CONFIG } = core);
|
|
33
35
|
({ memoryPrivacyLabel } = memBackend);
|
|
@@ -36,12 +38,19 @@ function ensureSimLoaded() {
|
|
|
36
38
|
({ findStaleNumericReferences, liveNumericReferences } = numericPolicy);
|
|
37
39
|
({ formatStaleNumericReferenceSummary } = staleGuard);
|
|
38
40
|
({ parseCommaSeparated } = worldUtils);
|
|
41
|
+
({ loadedWorldRouteNotice } = inference);
|
|
39
42
|
})();
|
|
40
43
|
return _simLoaded;
|
|
41
44
|
}
|
|
42
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* What the world just started or loaded tells the person, in the tool's
|
|
47
|
+
* result: that it names a retired Claude Code route and runs on ZTC's
|
|
48
|
+
* configured route instead, and its own notices, such as that its memory runs
|
|
49
|
+
* without embeddings.
|
|
50
|
+
*/
|
|
43
51
|
function worldNotices(state) {
|
|
44
|
-
const
|
|
52
|
+
const retired = loadedWorldRouteNotice();
|
|
53
|
+
const notices = [...(retired ? [retired] : []), ...state.getNotices()];
|
|
45
54
|
return notices.length > 0 ? { notices } : {};
|
|
46
55
|
}
|
|
47
56
|
// ── sim_init ──
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { request } from 'http';
|
|
2
2
|
import { configStore } from '../../config.js';
|
|
3
|
+
import { ROUTE_AWAITS_A_CHOICE } from '../../config/retired_routes.js';
|
|
3
4
|
import { generateSessionId } from '../../session.js';
|
|
4
5
|
import { getBusTransport } from './bus_message.js';
|
|
5
6
|
import { buildChildZtcPaneLaunch, getMuxTransport, paneLimitReached, resolveModelAndProvider, } from './pane.js';
|
|
@@ -211,6 +212,9 @@ export const createSupervisedZtcPaneTool = {
|
|
|
211
212
|
model = resolved.model;
|
|
212
213
|
}
|
|
213
214
|
if (provider) {
|
|
215
|
+
// A child on a provider this run's own --provider didn't choose would choose it for a waiting profile.
|
|
216
|
+
if (configStore.routeAwaitingChoice(provider) !== undefined)
|
|
217
|
+
return `Error: ${ROUTE_AWAITS_A_CHOICE}`;
|
|
214
218
|
const apiKey = configStore.getApiKey(provider);
|
|
215
219
|
if (!apiKey) {
|
|
216
220
|
return `Error: No API key configured for provider "${provider}".`;
|
package/dist/app/agent_runner.js
CHANGED
|
@@ -10,6 +10,7 @@ import { AgentError } from '../agent/index.js';
|
|
|
10
10
|
import { createAgentFromConfig, resolveAgentBackendFromConfig } from '../agent/factory.js';
|
|
11
11
|
import { configStore } from '../config.js';
|
|
12
12
|
import { RouterConfigurationError } from '../router_auth.js';
|
|
13
|
+
import { RouteAwaitingChoiceError } from '../config/retired_routes.js';
|
|
13
14
|
import { setBackgroundRegistry, getBackgroundRegistry, clearBackgroundRegistry } from '../agent/tools/index.js';
|
|
14
15
|
import { BackgroundTaskRegistry } from '../agent/background_registry.js';
|
|
15
16
|
import { InProcessWorkerExecutor, setWorkerExecutor, clearWorkerExecutor } from '../worker/index.js';
|
|
@@ -81,7 +82,10 @@ export function createAgentWithConfig(overrides = {}) {
|
|
|
81
82
|
});
|
|
82
83
|
}
|
|
83
84
|
catch (error) {
|
|
84
|
-
|
|
85
|
+
// A Router sign-in still to come, or a profile still waiting for a route
|
|
86
|
+
// choice, leaves startup without an agent until there is a route.
|
|
87
|
+
const unavailable = (error instanceof RouterConfigurationError && error.needsSignIn) || error instanceof RouteAwaitingChoiceError;
|
|
88
|
+
if (!allowUnavailableRouterAuth || !unavailable)
|
|
85
89
|
throw error;
|
|
86
90
|
resolvedBackend = null;
|
|
87
91
|
deferredRouterAuth = true;
|
|
@@ -90,7 +94,10 @@ export function createAgentWithConfig(overrides = {}) {
|
|
|
90
94
|
if (resolvedBackend) {
|
|
91
95
|
admitPermissionProvider(permissionProfile, projectPermissionPolicy(config), resolvedBackend.provider);
|
|
92
96
|
// Workers run on their own model pool when configured, otherwise on the lead's model.
|
|
93
|
-
|
|
97
|
+
// A profile waiting for a route choice has no route but the one this
|
|
98
|
+
// run's own --provider chose (see ConfigStore.routeAwaitingChoice), so its
|
|
99
|
+
// workers run on that one, never on the pool's routes.
|
|
100
|
+
const workerModels = config.workers?.models.length && configStore.retiredRouteAwaitingChoice() === undefined ? createWorkerModels(config.workers, { connection: configStore.getRouterCatalogConnection(), conversationId: overrides.sessionId,
|
|
94
101
|
openRouterPreferences: () => configStore.get().openRouter }) : null;
|
|
95
102
|
const executor = new InProcessWorkerExecutor({
|
|
96
103
|
provider: workerModels ? 'openai_compatible' : resolvedBackend.provider,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { NoticeLaunchStep } from '../config/types.js';
|
|
1
2
|
export interface LayoutRestoreResult {
|
|
2
3
|
restoredPanes: number;
|
|
3
4
|
skippedPanes: number;
|
|
@@ -8,3 +9,46 @@ export interface LayoutRestoreResult {
|
|
|
8
9
|
* to restore, otherwise how many panes came back and how to start them.
|
|
9
10
|
*/
|
|
10
11
|
export declare function layoutRestoreNotice(result: LayoutRestoreResult): string | null;
|
|
12
|
+
/** Where one-time notices come from: the profile's saved ones and this process's own. */
|
|
13
|
+
export interface LaunchNoticeSource {
|
|
14
|
+
takePendingNotices(): Promise<Array<{
|
|
15
|
+
text: string;
|
|
16
|
+
launch?: NoticeLaunchStep;
|
|
17
|
+
}>>;
|
|
18
|
+
takeRetiredRouteWarnings(): string[];
|
|
19
|
+
/** The move's notice while route resolution has no route for this run (see ConfigStore.routeAwaitingChoice). */
|
|
20
|
+
routeAwaitingChoice(): string | undefined;
|
|
21
|
+
/** One line while the profile waits and this run's own --provider chose its route (see ConfigStore.launchRouteNotice). */
|
|
22
|
+
launchRouteNotice(): string | undefined;
|
|
23
|
+
}
|
|
24
|
+
/** A one-time notice, and what the launch does before running an initial prompt (`ztc "..."`). */
|
|
25
|
+
export interface LaunchNotice {
|
|
26
|
+
text: string;
|
|
27
|
+
/**
|
|
28
|
+
* `hold`: the prompt waits in the composer until the user sends it, because
|
|
29
|
+
* the notice says the route changed. `connect`: the launch asks how to
|
|
30
|
+
* connect first, because the notice says no route is set up.
|
|
31
|
+
*/
|
|
32
|
+
before?: NoticeLaunchStep;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The one-time notices this launch shows: notices a settings move saved (such
|
|
36
|
+
* as where a retired Claude Code route went) and what this process ignored
|
|
37
|
+
* (a retired --provider, ZTC_PROVIDER or resumed session). Only an interactive
|
|
38
|
+
* top-level launch takes the saved ones, and taking them removes them, so they
|
|
39
|
+
* show once. While the move leaves the profile waiting for a route choice and
|
|
40
|
+
* route resolution has no route for this run, every such launch shows the
|
|
41
|
+
* move's notice again and asks how to connect first. A launch whose own
|
|
42
|
+
* --provider chose its route asks nothing: the first one after the move shows
|
|
43
|
+
* the move's notice and holds an initial prompt, and later ones show one line
|
|
44
|
+
* naming the route the run uses and that the profile still waits, holding
|
|
45
|
+
* nothing. A visible child pane shows only what it ignored itself; a colony
|
|
46
|
+
* cell, a headless or hosted run shows nothing here (headless runs print what
|
|
47
|
+
* they ignore, or refuse it: see app/retired_route_gate.ts).
|
|
48
|
+
*/
|
|
49
|
+
export declare function claimLaunchNotices(store: LaunchNoticeSource, launch: {
|
|
50
|
+
interactive: boolean;
|
|
51
|
+
pane?: boolean;
|
|
52
|
+
}): Promise<LaunchNotice[]>;
|
|
53
|
+
/** What the launch does before an initial prompt, given the notices it showed: asking to connect outranks holding. */
|
|
54
|
+
export declare function initialPromptStep(notices: readonly LaunchNotice[]): NoticeLaunchStep | null;
|
|
@@ -18,3 +18,44 @@ export function layoutRestoreNotice(result) {
|
|
|
18
18
|
return `No saved panes could be restored${skippedNote}.`;
|
|
19
19
|
return `Restored ${restored} saved panes${skippedNote}. They start stopped: /layout run <pane-id> starts one, /layout resume <pane-id> resumes its agent.`;
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* The one-time notices this launch shows: notices a settings move saved (such
|
|
23
|
+
* as where a retired Claude Code route went) and what this process ignored
|
|
24
|
+
* (a retired --provider, ZTC_PROVIDER or resumed session). Only an interactive
|
|
25
|
+
* top-level launch takes the saved ones, and taking them removes them, so they
|
|
26
|
+
* show once. While the move leaves the profile waiting for a route choice and
|
|
27
|
+
* route resolution has no route for this run, every such launch shows the
|
|
28
|
+
* move's notice again and asks how to connect first. A launch whose own
|
|
29
|
+
* --provider chose its route asks nothing: the first one after the move shows
|
|
30
|
+
* the move's notice and holds an initial prompt, and later ones show one line
|
|
31
|
+
* naming the route the run uses and that the profile still waits, holding
|
|
32
|
+
* nothing. A visible child pane shows only what it ignored itself; a colony
|
|
33
|
+
* cell, a headless or hosted run shows nothing here (headless runs print what
|
|
34
|
+
* they ignore, or refuse it: see app/retired_route_gate.ts).
|
|
35
|
+
*/
|
|
36
|
+
export async function claimLaunchNotices(store, launch) {
|
|
37
|
+
const ignored = () => store.takeRetiredRouteWarnings().map(text => ({ text, before: 'hold' }));
|
|
38
|
+
if (launch.pane)
|
|
39
|
+
return ignored();
|
|
40
|
+
if (!launch.interactive)
|
|
41
|
+
return [];
|
|
42
|
+
const waiting = store.routeAwaitingChoice();
|
|
43
|
+
// A saved notice asks how to connect while this run has no route. One that
|
|
44
|
+
// has a route (its own --provider chose it) holds the prompt instead.
|
|
45
|
+
const pending = await store.takePendingNotices();
|
|
46
|
+
const saved = pending.map(({ text, launch: step }) => {
|
|
47
|
+
const before = step === 'connect' && waiting === undefined ? 'hold' : step;
|
|
48
|
+
return { text, ...(before ? { before } : {}) };
|
|
49
|
+
});
|
|
50
|
+
const again = waiting !== undefined && !saved.some(notice => notice.before === 'connect')
|
|
51
|
+
? [{ text: waiting, before: 'connect' }] : [];
|
|
52
|
+
// A later launch with a route of its own says which, in one line that holds nothing back.
|
|
53
|
+
const line = waiting === undefined && !pending.some(notice => notice.launch === 'connect') ? store.launchRouteNotice() : undefined;
|
|
54
|
+
return [...saved, ...again, ...(line ? [{ text: line }] : []), ...ignored()];
|
|
55
|
+
}
|
|
56
|
+
/** What the launch does before an initial prompt, given the notices it showed: asking to connect outranks holding. */
|
|
57
|
+
export function initialPromptStep(notices) {
|
|
58
|
+
if (notices.some(notice => notice.before === 'connect'))
|
|
59
|
+
return 'connect';
|
|
60
|
+
return notices.some(notice => notice.before === 'hold') ? 'hold' : null;
|
|
61
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runs nobody watches (`--headless`, `-p`, `--json`, `--json-stream` and the
|
|
3
|
+
* zerg-ztc-headless entry) never misread a retired Claude Code route. One that
|
|
4
|
+
* explicitly asks for it, by a launch flag or an environment variable, whose
|
|
5
|
+
* profile the move left with no route set up in ZTC, or whose profile is still
|
|
6
|
+
* saved on a retired provider (its move could not run), exits with status 2
|
|
7
|
+
* and says why before any model request, so a script can't keep running on a
|
|
8
|
+
* route it never asked for. While the profile waits for a route choice, route
|
|
9
|
+
* resolution has no route but one the run's own --provider chose
|
|
10
|
+
* (ConfigStore.routeAwaitingChoice): such a run starts only when that route
|
|
11
|
+
* reaches a model. The advice a refusal gives works when
|
|
12
|
+
* a script follows it. A retired variable that the launch flags outrank asks
|
|
13
|
+
* for nothing: the run uses its flags and says what it ignored. A run that
|
|
14
|
+
* starts on a profile still waiting for a route choice says the move's notice
|
|
15
|
+
* first. Interactive launches ignore the request with a notice instead (see
|
|
16
|
+
* launch_notices.ts); resumed sessions and restored panes continue on the
|
|
17
|
+
* configured route.
|
|
18
|
+
*/
|
|
19
|
+
import { type RetiredRouteRequest } from '../config/retired_routes.js';
|
|
20
|
+
import type { ResolvedLLMConfig } from '../config/resolved.js';
|
|
21
|
+
/** The exit status of a run refused for a retired route. */
|
|
22
|
+
export declare const RETIRED_ROUTE_EXIT_CODE = 2;
|
|
23
|
+
export interface RetiredRouteGateStore {
|
|
24
|
+
explicitRetiredRouteRequests(): RetiredRouteRequest[];
|
|
25
|
+
retiredRouteAwaitingChoice(): string | undefined;
|
|
26
|
+
/** The route this run resolves; none (it throws) for a waiting profile but one its own --provider chose. */
|
|
27
|
+
resolveLLMBackendConfig(): ResolvedLLMConfig;
|
|
28
|
+
/** The provider this run would use, every launch override applied. */
|
|
29
|
+
getProvider(): string;
|
|
30
|
+
}
|
|
31
|
+
/** Why this run must not start, or null when it may. Call it once every launch override is applied. */
|
|
32
|
+
export declare function retiredRouteRefusalFor(store: RetiredRouteGateStore): Promise<string | null>;
|
|
33
|
+
/**
|
|
34
|
+
* Say once, on stderr, what a run that starts anyway should know: the move's
|
|
35
|
+
* notice, while the profile still waits for a route choice (the run's own
|
|
36
|
+
* flags chose one for it), then each retired variable the launch flags
|
|
37
|
+
* outrank, with the route that runs instead.
|
|
38
|
+
*/
|
|
39
|
+
export declare function sayRetiredRouteNotices(store: {
|
|
40
|
+
retiredRouteAwaitingChoice(): string | undefined;
|
|
41
|
+
takeRetiredRouteWarnings(): string[];
|
|
42
|
+
}): void;
|
|
43
|
+
/** Say why on stderr (and as a JSON error event when the run speaks JSON), then exit with status 2. */
|
|
44
|
+
export declare function refuseRetiredRoute(message: string, json: boolean): Promise<never>;
|