koneck 2.52.0 → 2.54.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 (52) hide show
  1. package/dist/chat.d.ts.map +1 -1
  2. package/dist/chat.js +21 -2
  3. package/dist/chat.js.map +1 -1
  4. package/dist/config-store.d.ts +6 -0
  5. package/dist/config-store.d.ts.map +1 -1
  6. package/dist/config-store.js +2 -1
  7. package/dist/config-store.js.map +1 -1
  8. package/dist/engine.d.ts +9 -0
  9. package/dist/engine.d.ts.map +1 -1
  10. package/dist/engine.js +142 -2
  11. package/dist/engine.js.map +1 -1
  12. package/dist/failover.d.ts +95 -0
  13. package/dist/failover.d.ts.map +1 -0
  14. package/dist/failover.js +191 -0
  15. package/dist/failover.js.map +1 -0
  16. package/dist/ink-chat.d.ts.map +1 -1
  17. package/dist/ink-chat.js +58 -2
  18. package/dist/ink-chat.js.map +1 -1
  19. package/dist/pace.d.ts +52 -0
  20. package/dist/pace.d.ts.map +1 -0
  21. package/dist/pace.js +88 -0
  22. package/dist/pace.js.map +1 -0
  23. package/dist/providers.d.ts.map +1 -1
  24. package/dist/providers.js +17 -8
  25. package/dist/providers.js.map +1 -1
  26. package/dist/tui.d.ts +8 -0
  27. package/dist/tui.d.ts.map +1 -1
  28. package/dist/tui.js +12 -0
  29. package/dist/tui.js.map +1 -1
  30. package/dist/types.d.ts +27 -0
  31. package/dist/types.d.ts.map +1 -1
  32. package/dist/web/api.d.ts +1 -1
  33. package/dist/web/api.d.ts.map +1 -1
  34. package/dist/web/api.js +45 -1
  35. package/dist/web/api.js.map +1 -1
  36. package/dist/web/changes.d.ts.map +1 -1
  37. package/dist/web/changes.js +21 -2
  38. package/dist/web/changes.js.map +1 -1
  39. package/dist/web/sessions.d.ts +16 -1
  40. package/dist/web/sessions.d.ts.map +1 -1
  41. package/dist/web/sessions.js +57 -4
  42. package/dist/web/sessions.js.map +1 -1
  43. package/dist/web/ui-client.d.ts.map +1 -1
  44. package/dist/web/ui-client.js +117 -6
  45. package/dist/web/ui-client.js.map +1 -1
  46. package/dist/web/ui-css.d.ts.map +1 -1
  47. package/dist/web/ui-css.js +29 -0
  48. package/dist/web/ui-css.js.map +1 -1
  49. package/dist/web/ui.d.ts.map +1 -1
  50. package/dist/web/ui.js +42 -0
  51. package/dist/web/ui.js.map +1 -1
  52. package/package.json +1 -1
@@ -0,0 +1,95 @@
1
+ /**
2
+ * What to do when the model you are on stops being usable.
3
+ *
4
+ * Three things end a run that did not have to end: the credit for a model runs out, a gateway's
5
+ * upstream starts failing, or a rate limit closes the door for a while. In every one of them there
6
+ * is usually another model on the same provider, or another provider entirely, that would have
7
+ * finished the work. KONECK stopped and reported the error, which is correct behaviour and a poor
8
+ * outcome — the user comes back to a dead run and does by hand what could have been done in a
9
+ * second.
10
+ *
11
+ * So this is a policy, and deliberately a policy rather than a cleverness. Switching model
12
+ * mid-task changes the thing doing the work: a different model may write in a different style,
13
+ * cost a different amount, or be worse. That is a decision about someone else's money and someone
14
+ * else's code, so the default is to ask, and everything about it is stated rather than inferred:
15
+ *
16
+ * - `on` which failures count. Out of credit is not the same as a bad gateway.
17
+ * - `scope` another model on this provider, another provider, or both.
18
+ * - `decide` ask, or go ahead and say so afterwards.
19
+ * - `order` the sequence given, or shuffled — a fixed order concentrates load on whatever is
20
+ * first, which is exactly what you do not want when the first one just failed.
21
+ * - `models` the candidates, in the order they should be tried.
22
+ * - `discover` when the list is empty, ask the provider what it serves rather than guessing.
23
+ *
24
+ * Nothing here is on by default. A tool that silently moves your work to a different model is not
25
+ * a tool that respects the user.
26
+ */
27
+ /** Why a switch is being considered. Each is a different question, so each is separately opt-in. */
28
+ export type FailoverTrigger =
29
+ /** The account or key has no credit left for this model. */
30
+ 'exhausted'
31
+ /** The provider says this model is failing, unavailable, or its upstream is down. */
32
+ | 'failing'
33
+ /** Rate limited: it would work later, and later may be too late. */
34
+ | 'limited'
35
+ /** The conversation no longer fits this model's context window. */
36
+ | 'too-long';
37
+ export declare const TRIGGERS: readonly FailoverTrigger[];
38
+ export declare const TRIGGER_BLURB: Record<FailoverTrigger, string>;
39
+ export type FailoverScope = 'model' | 'provider' | 'both';
40
+ export type FailoverDecision = 'ask' | 'auto';
41
+ export type FailoverOrder = 'sequence' | 'random';
42
+ /** One place to move to. A bare model name means the provider stays as it is. */
43
+ export interface Candidate {
44
+ provider?: string;
45
+ model: string;
46
+ }
47
+ export interface FailoverPolicy {
48
+ enabled: boolean;
49
+ on: readonly FailoverTrigger[];
50
+ scope: FailoverScope;
51
+ decide: FailoverDecision;
52
+ order: FailoverOrder;
53
+ /** Candidates in the order they should be tried. Empty means fall back on discovery. */
54
+ models: readonly Candidate[];
55
+ /** Ask the provider what it serves when no candidates were given. */
56
+ discover: boolean;
57
+ /** How many switches one run may make, so a bad afternoon cannot walk the whole catalogue. */
58
+ limit: number;
59
+ }
60
+ /** Off, and explicit about it. */
61
+ export declare const FAILOVER_OFF: FailoverPolicy;
62
+ /**
63
+ * A candidate from a string.
64
+ *
65
+ * `provider/model` names both; anything else is a model on whichever provider is current. Model ids
66
+ * contain slashes of their own — `anthropic/claude-sonnet-4.5` is one model, not a provider and a
67
+ * model — so a prefix only counts when it is a provider that actually exists.
68
+ */
69
+ export declare function candidateFrom(text: string, knownProvider: (name: string) => boolean): Candidate;
70
+ /** A policy from whatever a config file holds, with every field defaulted rather than assumed. */
71
+ export declare function policyFrom(raw: unknown, knownProvider?: (name: string) => boolean): FailoverPolicy;
72
+ /**
73
+ * Which trigger a failure is, if it is one at all.
74
+ *
75
+ * Read from what the provider said rather than from a status code alone, because the codes are
76
+ * shared: a 400 is a context overflow and a malformed request and an unsupported parameter, and
77
+ * treating all of them as "move to another model" would move away from a model that was fine.
78
+ */
79
+ export declare function triggerFor(err: unknown): FailoverTrigger | null;
80
+ /**
81
+ * The next place to try, or null when there is nowhere left.
82
+ *
83
+ * `tried` is every candidate already used this run, including the one started on — otherwise a
84
+ * shuffled order returns to a model that has just failed, and a fixed order can loop on it
85
+ * forever. Candidates outside the scope are filtered here rather than at the edges, so a policy
86
+ * that says "models only" cannot move provider by way of a candidate that named one.
87
+ */
88
+ export declare function pickNext(policy: FailoverPolicy, current: Candidate, tried: readonly string[], discovered?: readonly Candidate[], random?: () => number): Candidate | null;
89
+ /** The name a candidate is remembered under, so "already tried" survives a missing provider. */
90
+ export declare function keyOf(c: Candidate): string;
91
+ /** What to tell the user, in one line, whichever surface is asking. */
92
+ export declare function describeSwitch(from: Candidate, to: Candidate, trigger: FailoverTrigger): string;
93
+ /** The same thing as a question, for a policy that asks first. */
94
+ export declare function askSwitch(from: Candidate, to: Candidate, trigger: FailoverTrigger): string;
95
+ //# sourceMappingURL=failover.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"failover.d.ts","sourceRoot":"","sources":["../src/failover.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,oGAAoG;AACpG,MAAM,MAAM,eAAe;AACzB,4DAA4D;AAC1D,WAAW;AACb,qFAAqF;GACnF,SAAS;AACX,oEAAoE;GAClE,SAAS;AACX,mEAAmE;GACjE,UAAU,CAAC;AAEf,eAAO,MAAM,QAAQ,EAAE,SAAS,eAAe,EAAoD,CAAC;AAEpG,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,eAAe,EAAE,MAAM,CAKzD,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,UAAU,GAAG,MAAM,CAAC;AAC1D,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,MAAM,CAAC;AAC9C,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,QAAQ,CAAC;AAElD,iFAAiF;AACjF,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,EAAE,EAAE,SAAS,eAAe,EAAE,CAAC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,191 @@
1
+ /**
2
+ * What to do when the model you are on stops being usable.
3
+ *
4
+ * Three things end a run that did not have to end: the credit for a model runs out, a gateway's
5
+ * upstream starts failing, or a rate limit closes the door for a while. In every one of them there
6
+ * is usually another model on the same provider, or another provider entirely, that would have
7
+ * finished the work. KONECK stopped and reported the error, which is correct behaviour and a poor
8
+ * outcome — the user comes back to a dead run and does by hand what could have been done in a
9
+ * second.
10
+ *
11
+ * So this is a policy, and deliberately a policy rather than a cleverness. Switching model
12
+ * mid-task changes the thing doing the work: a different model may write in a different style,
13
+ * cost a different amount, or be worse. That is a decision about someone else's money and someone
14
+ * else's code, so the default is to ask, and everything about it is stated rather than inferred:
15
+ *
16
+ * - `on` which failures count. Out of credit is not the same as a bad gateway.
17
+ * - `scope` another model on this provider, another provider, or both.
18
+ * - `decide` ask, or go ahead and say so afterwards.
19
+ * - `order` the sequence given, or shuffled — a fixed order concentrates load on whatever is
20
+ * first, which is exactly what you do not want when the first one just failed.
21
+ * - `models` the candidates, in the order they should be tried.
22
+ * - `discover` when the list is empty, ask the provider what it serves rather than guessing.
23
+ *
24
+ * Nothing here is on by default. A tool that silently moves your work to a different model is not
25
+ * a tool that respects the user.
26
+ */
27
+ export const TRIGGERS = ['exhausted', 'failing', 'limited', 'too-long'];
28
+ export const TRIGGER_BLURB = {
29
+ exhausted: 'Out of credit or quota on this model.',
30
+ failing: 'The provider says this model is unavailable or its upstream is failing.',
31
+ limited: 'Rate limited — it would work later, and later may be too late.',
32
+ 'too-long': 'The conversation no longer fits this model’s context window.',
33
+ };
34
+ /** Off, and explicit about it. */
35
+ export const FAILOVER_OFF = {
36
+ enabled: false,
37
+ on: ['exhausted', 'failing'],
38
+ scope: 'model',
39
+ decide: 'ask',
40
+ order: 'sequence',
41
+ models: [],
42
+ discover: true,
43
+ limit: 3,
44
+ };
45
+ /**
46
+ * A candidate from a string.
47
+ *
48
+ * `provider/model` names both; anything else is a model on whichever provider is current. Model ids
49
+ * contain slashes of their own — `anthropic/claude-sonnet-4.5` is one model, not a provider and a
50
+ * model — so a prefix only counts when it is a provider that actually exists.
51
+ */
52
+ export function candidateFrom(text, knownProvider) {
53
+ const trimmed = String(text ?? '').trim();
54
+ const cut = trimmed.indexOf('/');
55
+ if (cut > 0) {
56
+ const head = trimmed.slice(0, cut);
57
+ if (knownProvider(head))
58
+ return { provider: head, model: trimmed.slice(cut + 1) };
59
+ }
60
+ return { model: trimmed };
61
+ }
62
+ /** A policy from whatever a config file holds, with every field defaulted rather than assumed. */
63
+ export function policyFrom(raw, knownProvider = () => false) {
64
+ const held = (raw ?? {});
65
+ const on = Array.isArray(held['on'])
66
+ ? held['on']
67
+ .map(v => String(v).trim().toLowerCase())
68
+ .filter((v) => TRIGGERS.includes(v))
69
+ : FAILOVER_OFF.on;
70
+ const scopeAsked = ['model', 'provider', 'both'].includes(String(held['scope']))
71
+ ? held['scope'] : FAILOVER_OFF.scope;
72
+ /*
73
+ * A prefix is only a provider when moving provider is on the table.
74
+ *
75
+ * `anthropic/claude-sonnet-4.5` is genuinely ambiguous: it is a provider and a model, and it is
76
+ * also one model id on OpenRouter. Nothing in the string settles it — but the scope does. Somebody
77
+ * who has said "another model, same provider" has already said they mean model ids, so splitting
78
+ * their list on the first slash would send the run to a provider they excluded on purpose.
79
+ */
80
+ const splitProviders = scopeAsked !== 'model';
81
+ const models = Array.isArray(held['models'])
82
+ ? held['models']
83
+ .map(entry => typeof entry === 'string'
84
+ ? candidateFrom(entry, splitProviders ? knownProvider : () => false)
85
+ : { provider: typeof entry?.provider === 'string'
86
+ ? entry.provider : undefined,
87
+ model: String(entry?.model ?? '').trim() })
88
+ .filter(c => c.model !== '')
89
+ : [];
90
+ const decide = String(held['decide']) === 'auto' ? 'auto' : 'ask';
91
+ const order = String(held['order']) === 'random' ? 'random' : 'sequence';
92
+ const limit = Number.isFinite(Number(held['limit'])) && Number(held['limit']) > 0
93
+ ? Math.min(Math.floor(Number(held['limit'])), 20) : FAILOVER_OFF.limit;
94
+ return {
95
+ enabled: held['enabled'] === true,
96
+ on: on.length > 0 ? on : FAILOVER_OFF.on,
97
+ scope: scopeAsked,
98
+ decide,
99
+ order,
100
+ models,
101
+ discover: held['discover'] !== false,
102
+ limit,
103
+ };
104
+ }
105
+ /**
106
+ * Which trigger a failure is, if it is one at all.
107
+ *
108
+ * Read from what the provider said rather than from a status code alone, because the codes are
109
+ * shared: a 400 is a context overflow and a malformed request and an unsupported parameter, and
110
+ * treating all of them as "move to another model" would move away from a model that was fine.
111
+ */
112
+ export function triggerFor(err) {
113
+ const holder = err;
114
+ const text = [
115
+ typeof holder?.message === 'string' ? holder.message : '',
116
+ typeof holder?.error?.message === 'string' ? holder.error.message : '',
117
+ typeof holder?.error?.code === 'string' ? holder.error.code : '',
118
+ ].join(' ').toLowerCase();
119
+ const status = typeof holder?.status === 'number' ? holder.status : undefined;
120
+ if (/insufficient_quota|out of credit|no credit|credit balance|billing|payment required|quota exceeded/
121
+ .test(text))
122
+ return 'exhausted';
123
+ if (status === 402)
124
+ return 'exhausted';
125
+ if (/context length|context window|too many tokens|maximum context|prompt is too long/
126
+ .test(text))
127
+ return 'too-long';
128
+ if (/rate limit|too many requests|slow down|try again in/.test(text))
129
+ return 'limited';
130
+ if (status === 429)
131
+ return 'limited';
132
+ if (/failing upstream|no active credentials for provider|upstream error|bad_gateway|model_not_found|no endpoints|unavailable|overloaded|service unavailable/
133
+ .test(text))
134
+ return 'failing';
135
+ if (status === 502 || status === 503)
136
+ return 'failing';
137
+ return null;
138
+ }
139
+ /**
140
+ * The next place to try, or null when there is nowhere left.
141
+ *
142
+ * `tried` is every candidate already used this run, including the one started on — otherwise a
143
+ * shuffled order returns to a model that has just failed, and a fixed order can loop on it
144
+ * forever. Candidates outside the scope are filtered here rather than at the edges, so a policy
145
+ * that says "models only" cannot move provider by way of a candidate that named one.
146
+ */
147
+ export function pickNext(policy, current, tried, discovered = [], random = Math.random) {
148
+ if (!policy.enabled)
149
+ return null;
150
+ const pool = policy.models.length > 0
151
+ ? policy.models
152
+ : (policy.discover ? discovered : []);
153
+ const allowed = pool.filter(c => {
154
+ const movesProvider = !!c.provider
155
+ && c.provider.toLowerCase() !== (current.provider ?? '').toLowerCase();
156
+ if (movesProvider && policy.scope === 'model')
157
+ return false;
158
+ if (!movesProvider && policy.scope === 'provider')
159
+ return false;
160
+ return true;
161
+ });
162
+ const seen = new Set(tried.map(k => k.toLowerCase()));
163
+ const fresh = allowed.filter(c => !seen.has(keyOf({
164
+ provider: c.provider ?? current.provider, model: c.model,
165
+ }).toLowerCase()));
166
+ if (fresh.length === 0)
167
+ return null;
168
+ if (policy.order === 'sequence')
169
+ return fresh[0] ?? null;
170
+ // Shuffled, so a failure does not send every session to the same second choice.
171
+ return fresh[Math.min(fresh.length - 1, Math.floor(random() * fresh.length))] ?? null;
172
+ }
173
+ /** The name a candidate is remembered under, so "already tried" survives a missing provider. */
174
+ export function keyOf(c) {
175
+ return `${c.provider ?? ''}/${c.model}`;
176
+ }
177
+ /** What to tell the user, in one line, whichever surface is asking. */
178
+ export function describeSwitch(from, to, trigger) {
179
+ const where = to.provider && to.provider !== from.provider
180
+ ? `${to.model} on ${to.provider}`
181
+ : to.model;
182
+ return `${TRIGGER_BLURB[trigger]} Moving from ${from.model} to ${where}.`;
183
+ }
184
+ /** The same thing as a question, for a policy that asks first. */
185
+ export function askSwitch(from, to, trigger) {
186
+ const where = to.provider && to.provider !== from.provider
187
+ ? `${to.model} on ${to.provider}`
188
+ : to.model;
189
+ return `${TRIGGER_BLURB[trigger]} Continue on ${where} instead of ${from.model}?`;
190
+ }
191
+ //# sourceMappingURL=failover.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"failover.js","sourceRoot":"","sources":["../src/failover.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAaH,MAAM,CAAC,MAAM,QAAQ,GAA+B,CAAC,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;AAEpG,MAAM,CA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AM,CAAA;CAAE,CAAC;AAElE,sGAAsG;AACtG,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,EACb,mBAAmB,EAAE,MAAM,EAC3B,eAAe,CAAC,EAAE,MAAM,EACxB,QAAQ,CAAC,EAAE,iBAAiB,GAAG,IAAI,GAClC,MAAM,CAcR;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,SAAK,GAAG,OAAO,CAMnE;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEzD;AA0ED;;;;;GAKG;AACH;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAU3D;AAED,wBAAgB,gBAAgB,CAC9B,MAAM,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAmB,EAC7E,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,OAAO,CAQT;AA41ID,wBAAsB,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBvE"}
package/dist/ink-chat.js CHANGED
@@ -11,6 +11,8 @@ import { PROVIDERS, resolveProvider, getApiKey, addUserProvider, userProvidersPa
11
11
  import { normaliseEndpoint, withEndpoint, savedEndpoints, shortSource, resolveModelChoice, withModel } from './endpoints.js';
12
12
  import { loadProjectConfig, loadGlobalConfig, saveGlobalConfig, withoutStoredApiKey } from './config.js';
13
13
  import { rememberKey, forgetAllKeys } from './credentials.js';
14
+ import { paceFrom } from './pace.js';
15
+ import { policyFrom, FAILOVER_OFF } from './failover.js';
14
16
  import { listCheckpoints, revertCheckpoint, previewCheckpoint, snapshotTree, filesTouchedBy, createWorkspaceCheckpoint, checkpointScope } from './checkpoint.js';
15
17
  import { fileDiff, diffSummary } from './diff-view.js';
16
18
  import { untrackedPatches } from './git-diff.js';
@@ -1309,7 +1311,7 @@ function App({ config: initialConfig, clearFrame }) {
1309
1311
  },
1310
1312
  };
1311
1313
  const activeSession = useState(() => ({
1312
- p: createAgentSession({ ...initialConfig, silent: true, ...sessionOpts }),
1314
+ p: createAgentSession({ ...initialConfig, pace: paceFrom(initialConfig.pace ?? savedEffort(undefined), 'medium'), ...failoverHooks(), silent: true, ...sessionOpts }),
1313
1315
  }))[0];
1314
1316
  const [rows, setRows] = useState([{ role: 'header' }]);
1315
1317
  const [draft, setDraft] = useState('');
@@ -1540,6 +1542,51 @@ function App({ config: initialConfig, clearFrame }) {
1540
1542
  showNextAsk();
1541
1543
  }
1542
1544
  const [effort, setEffort] = useState('medium');
1545
+ /*
1546
+ * The pace, told to the running session rather than only to the footer.
1547
+ *
1548
+ * It used to travel as words in the prompt — a `[effort ...]` prefix — which a reasoning model
1549
+ * does not act on, so every call reasoned at the provider's default and a shell command cost a
1550
+ * full deliberation. It now goes on the wire as `reasoning_effort`, and it has to reach the
1551
+ * session that is already running: rebuilding would throw the conversation away, and waiting for
1552
+ * the next session is not what somebody who just chose "low" because they are waiting means.
1553
+ */
1554
+ /**
1555
+ * What a session is given so it can move to another model, and say so.
1556
+ *
1557
+ * The question goes through addSystem and the same confirm the tool prompts use, so there is one
1558
+ * place where a decision is made rather than a second kind of prompt to learn.
1559
+ */
1560
+ const failoverHooks = () => ({
1561
+ failover: failoverRef.current,
1562
+ confirmFailover: async (question) => new Promise(resolve => {
1563
+ /*
1564
+ * Through the same queue the tool prompts use.
1565
+ *
1566
+ * Not a second kind of prompt to learn, and not a raw terminal confirm — inquirer writing
1567
+ * over an Ink render is how a UI ends up with two cursors. The queue also means a question
1568
+ * cannot be overwritten by another arriving at the same moment, which is what made an earlier
1569
+ * prompt's promise never settle.
1570
+ */
1571
+ const isCurrent = askQueueRef.current.add({
1572
+ tool: 'continue on another model', args: question, prefix: '', resolve,
1573
+ });
1574
+ if (isCurrent)
1575
+ showNextAsk();
1576
+ }),
1577
+ onFailover: (message) => addSystem(message),
1578
+ });
1579
+ const effortRef = useRef('medium');
1580
+ useEffect(() => {
1581
+ effortRef.current = effort;
1582
+ void (async () => {
1583
+ try {
1584
+ const live = await activeSession.p;
1585
+ live.setPace?.(paceFrom(effort, 'medium'));
1586
+ }
1587
+ catch { /* no session yet, and the next one is built with this pace */ }
1588
+ })();
1589
+ }, [effort]);
1543
1590
  const [showAnalytics, setShowAnalytics] = useState(false);
1544
1591
  const [updatePane, setUpdatePane] = useState(null);
1545
1592
  const [updating, setUpdating] = useState('idle');
@@ -1581,12 +1628,21 @@ function App({ config: initialConfig, clearFrame }) {
1581
1628
  const [termRows, setTermRows] = useState(() => process.stdout.rows || 24);
1582
1629
  /** Optional user cap on the UI width. Undefined means fill the terminal. */
1583
1630
  const [configMaxWidth, setConfigMaxWidth] = useState(undefined);
1631
+ /*
1632
+ * The failover policy, from the same config file the browser writes.
1633
+ *
1634
+ * One policy per machine rather than one per surface: somebody who decides "move on
1635
+ * automatically" means it wherever they are working, and a setting that has to be made twice is
1636
+ * a setting that will disagree with itself.
1637
+ */
1638
+ const failoverRef = useRef(FAILOVER_OFF);
1584
1639
  useEffect(() => {
1585
1640
  void loadKoneckConfig().then(c => {
1586
1641
  setConfigMaxWidth(typeof c.maxWidth === 'number' && c.maxWidth >= 40 ? c.maxWidth : undefined);
1587
1642
  const configuredEffort = savedEffort(c.effort);
1588
1643
  if (configuredEffort)
1589
1644
  setEffort(configuredEffort);
1645
+ failoverRef.current = policyFrom(c.failover, name => PROVIDERS[name] !== undefined);
1590
1646
  });
1591
1647
  }, []);
1592
1648
  /**
@@ -1887,7 +1943,7 @@ function App({ config: initialConfig, clearFrame }) {
1887
1943
  const c = newCfg ?? cfg;
1888
1944
  cfgRef.current = c;
1889
1945
  setDetectedContext(null);
1890
- activeSession.p = createAgentSession({ ...c, silent: true, ...sessionOpts });
1946
+ activeSession.p = createAgentSession({ ...c, pace: paceFrom(effortRef.current, 'medium'), ...failoverHooks(), silent: true, ...sessionOpts });
1891
1947
  if (newCfg)
1892
1948
  setCfg(newCfg);
1893
1949
  }