aegisone 1.0.10 → 1.0.17
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 +2 -2
- package/package.json +1 -1
- package/scripts/predist.mjs +19 -0
- package/src/child.js +121 -2
- package/vendor/cli/package.json +3 -2
- package/vendor/cli/src/app.js +208 -16
- package/vendor/cli/src/chatflow.js +209 -40
- package/vendor/cli/src/commands.js +254 -11
- package/vendor/cli/src/deps.js +29 -2
- package/vendor/cli/src/engine.js +8 -1
- package/vendor/cli/src/models.js +78 -3
- package/vendor/cli/src/overlays.js +20 -7
- package/vendor/cli/src/render.js +9 -1
- package/vendor/cli/src/topup.js +1 -1
- package/vendor/cli/vendor/client/aegis.js +125 -5
- package/vendor/cli/vendor/client/auto-provision.js +89 -17
- package/vendor/cli/vendor/client/credentials.js +8 -2
- package/vendor/cli/vendor/client/device-fingerprint.js +1 -8
- package/vendor/cli/vendor/client/env-file.js +262 -8
- package/vendor/cli/vendor/client/user-models.js +1 -1
- package/vendor/cli/vendor/desktop/lib/local/claude-pro.js +872 -0
- package/vendor/cli/vendor/desktop/lib/local/engine.js +444 -16
- package/vendor/cli/vendor/desktop/renderer/usage.js +25 -6
- package/vendor/cli/vendor/mcp/server.js +1 -1
- package/vendor/cli/vendor/one/src/child.js +287 -0
- package/vendor/cli/vendor/one/src/permissions.js +371 -0
- package/vendor/desktop/lib/account-key.js +60 -0
- package/vendor/desktop/lib/local/claude-pro.js +872 -0
- package/vendor/desktop/lib/local/engine.js +444 -16
- package/vendor/desktop/lib/provider-key-mirror.js +114 -1
- package/vendor/desktop/main.js +167 -34
- package/vendor/desktop/package.json +4 -3
- package/vendor/desktop/preload.js +8 -0
- package/vendor/desktop/renderer/app.js +114 -5
- package/vendor/desktop/renderer/index.html +12 -7
- package/vendor/desktop/renderer/usage.js +25 -6
- package/vendor/desktop/vendor/aegis.js +125 -5
- package/vendor/desktop/vendor/auto-provision.js +89 -17
- package/vendor/desktop/vendor/credentials.js +8 -2
- package/vendor/desktop/vendor/device-fingerprint.js +1 -8
- package/vendor/desktop/vendor/env-file.js +262 -8
- package/vendor/desktop/vendor/user-models.js +1 -1
|
@@ -54,6 +54,9 @@ const { LineEditor } = require('./input.js');
|
|
|
54
54
|
const { renderMarkdown } = require('./markdown.js');
|
|
55
55
|
const overlays = require('./overlays.js');
|
|
56
56
|
const models = require('./models.js');
|
|
57
|
+
const { resolveShared } = require('./sharedpaths.js');
|
|
58
|
+
const { validateApiKey } = require(resolveShared(require('node:path').join('client', 'credentials.js')));
|
|
59
|
+
const claudePro = require(resolveShared(require('node:path').join('desktop', 'lib', 'local', 'claude-pro.js')));
|
|
57
60
|
const fuzzy = require('./fuzzy.js');
|
|
58
61
|
const { fmtTokens, fmtEur, fmtElapsed, fmtUsageSplit, displayTokens, pathName, feeBillable } = require('./format.js');
|
|
59
62
|
const { editPreview } = require('./diff.js');
|
|
@@ -254,6 +257,61 @@ function historyPairs(rows) {
|
|
|
254
257
|
.map((m) => ({ role: m.role, content: m.text }));
|
|
255
258
|
}
|
|
256
259
|
|
|
260
|
+
// A byok "anthropic:<model>" id's model half → the PRO_MODELS alias it reads
|
|
261
|
+
// closest to. 'default' when nothing matches, which is every dated/snapshot
|
|
262
|
+
// id (`claude-sonnet-4-20250514`) as much as a name this table has not been
|
|
263
|
+
// taught — the subscription's own default is a safer landing than guessing
|
|
264
|
+
// wrong.
|
|
265
|
+
const PRO_ALIAS_KEYWORDS = Object.freeze(['opus', 'haiku', 'sonnet']);
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* A picked "anthropic:<model>" byok row this machine has no console key for,
|
|
269
|
+
* but IS already signed into Claude Code Pro/Max for, is better served by the
|
|
270
|
+
* subscription it already pays for than by a prompt for a second credential
|
|
271
|
+
* it does not have — `engine.js`'s own refusal message for this exact state
|
|
272
|
+
* already says so ("Use the subscription instead: /class pro"); this is that
|
|
273
|
+
* suggestion applied at pick time instead of left for the user to notice in
|
|
274
|
+
* an error and type a second command.
|
|
275
|
+
*
|
|
276
|
+
* A row with a real console key already stored takes that key, unchanged —
|
|
277
|
+
* the override only fires when `modelKeyPlan` would otherwise have to ask for
|
|
278
|
+
* one. Pure and unit-testable: every fact it needs (whether a key is already
|
|
279
|
+
* stored, whether the subscription is signed in, the PRO_MODELS table) is
|
|
280
|
+
* injected rather than read from a live host/environment.
|
|
281
|
+
*
|
|
282
|
+
* @param {object} chosen a picker row ({id, cls, ...})
|
|
283
|
+
* @param {object} o
|
|
284
|
+
* @param {boolean} o.hasStored the byok provider store already holds an
|
|
285
|
+
* anthropic key (desktop Provider settings / `/byok-key anthropic`)
|
|
286
|
+
* @param {boolean} o.proLoggedIn this machine is signed into Claude Code Pro
|
|
287
|
+
* @param {Array<{id:string,label:string,note:string}>} o.proModels
|
|
288
|
+
* `claudePro.PRO_MODELS`, injected rather than required here
|
|
289
|
+
* @returns {{row:object, message:string|null}} the row to actually pin (the
|
|
290
|
+
* original, unchanged, when the override does not apply) and a note to
|
|
291
|
+
* surface when it does
|
|
292
|
+
*/
|
|
293
|
+
function overrideAnthropicByokWithPro(chosen, o = {}) {
|
|
294
|
+
if (!chosen || chosen.cls !== 'byok') return { row: chosen, message: null };
|
|
295
|
+
const id = String(chosen.id || '');
|
|
296
|
+
const colon = id.indexOf(':');
|
|
297
|
+
if (colon < 0 || id.slice(0, colon).trim().toLowerCase() !== 'anthropic') {
|
|
298
|
+
return { row: chosen, message: null };
|
|
299
|
+
}
|
|
300
|
+
if (!o.needsKey) return { row: chosen, message: null }; // a real console key is already usable
|
|
301
|
+
if (!o.proLoggedIn) return { row: chosen, message: null }; // no subscription either — the normal prompt stands
|
|
302
|
+
const modelPart = id.slice(colon + 1).toLowerCase();
|
|
303
|
+
const proModels = Array.isArray(o.proModels) && o.proModels.length ? o.proModels : [{ id: 'default', label: 'Default', note: '' }];
|
|
304
|
+
const aliasId = PRO_ALIAS_KEYWORDS.find((kw) => modelPart.includes(kw)) || 'default';
|
|
305
|
+
const row = proModels.find((m) => m.id === aliasId) || proModels[0];
|
|
306
|
+
return {
|
|
307
|
+
row: { id: row.id, label: row.label, note: row.note, cls: 'pro' },
|
|
308
|
+
message:
|
|
309
|
+
`${id} has no Anthropic console key on this machine, but Claude Code Pro is signed in — ` +
|
|
310
|
+
`using the subscription instead (claude --model ${row.id}). Add a real console key any ` +
|
|
311
|
+
`time with /byok-key anthropic <key> to run this row directly.`,
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
|
|
257
315
|
/**
|
|
258
316
|
* Palette ranking query for a typed command line: "/memory tiers" must keep
|
|
259
317
|
* ranking on "memory" so the command stays listed while the user finishes the
|
|
@@ -328,7 +386,7 @@ function spinnerLine(state, ctx) {
|
|
|
328
386
|
// from the spinner while the model was working.
|
|
329
387
|
const tail = ctx && ctx.thinking
|
|
330
388
|
? span(t.gray, ` (${secs}s · thinking)`)
|
|
331
|
-
: span(t.gray, ` (${secs}s · ↓${fmtTokens(state.streamed || 0)} tokens)`);
|
|
389
|
+
: span(t.gray, ` (${secs}s · ↓${state.streamedFloor ? '≥' : ''}${fmtTokens(state.streamed || 0)} tokens)`);
|
|
332
390
|
const glyph = GLYPH.spin[(state.frame || 0) % GLYPH.spin.length];
|
|
333
391
|
return [span(t.coral, glyph), ...tinted, span(t.white, '… '), tail];
|
|
334
392
|
}
|
|
@@ -353,6 +411,8 @@ function statusLine(state, cols, ctx) {
|
|
|
353
411
|
left = [span(t.gray, ` ${GLYPH.bullet} esc to interrupt`)];
|
|
354
412
|
} else if (state.streamJob) {
|
|
355
413
|
left = [span(t.gray, `${GLYPH.bullet} esc to stop`)];
|
|
414
|
+
} else if (state.keyNotice) {
|
|
415
|
+
left = [span(t.gray, ` ${GLYPH.bullet} no AEGIS key: ${state.keyNotice} ${GLYPH.bullet} /key register to retry`)];
|
|
356
416
|
} else if (state.yolo) {
|
|
357
417
|
left = [span(t.gray, `${GLYPH.bullet} automode on ${GLYPH.bullet} ${autoContinueLimit()} rounds then it asks ${GLYPH.bullet} ? for shortcuts ${GLYPH.bullet} ${GLYPH.rightarrow} for manual mode`)];
|
|
358
418
|
} else {
|
|
@@ -1129,7 +1189,8 @@ async function runSession(host) {
|
|
|
1129
1189
|
// Both spinner renderers label this field `tokens`, so handing them
|
|
1130
1190
|
// cells printed the character count as a token count and the live
|
|
1131
1191
|
// figure read ~4x high.
|
|
1132
|
-
streamed: estimateTokensFromCells(streamedCells()),
|
|
1192
|
+
streamed: estimateTokensFromCells(streamedCells()) + thinkingTokens,
|
|
1193
|
+
streamedFloor: thinkingTokens > 0,
|
|
1133
1194
|
},
|
|
1134
1195
|
ctx
|
|
1135
1196
|
)
|
|
@@ -1150,7 +1211,7 @@ async function runSession(host) {
|
|
|
1150
1211
|
);
|
|
1151
1212
|
lines.push(inp.line);
|
|
1152
1213
|
lines.push(separatorLine(cols, ctx));
|
|
1153
|
-
lines.push(statusLine({ working, inputPrompt, streamJob, yolo: host.isYolo && host.isYolo() }, cols, ctx));
|
|
1214
|
+
lines.push(statusLine({ working, inputPrompt, streamJob, yolo: host.isYolo && host.isYolo(), keyNotice: host.keyNotice && host.keyNotice() }, cols, ctx));
|
|
1154
1215
|
return { lines, inputCol: inp.cursorCol, rows, inputRow: rows - 2 };
|
|
1155
1216
|
};
|
|
1156
1217
|
|
|
@@ -1276,6 +1337,12 @@ async function runSession(host) {
|
|
|
1276
1337
|
// reset per turn and never reaches the accounting row, which is built from
|
|
1277
1338
|
// what the provider measured.
|
|
1278
1339
|
let streamedChars = 0;
|
|
1340
|
+
// Thinking tokens the PROVIDER measured, added verbatim. `streamedChars` is a
|
|
1341
|
+
// display width that becomes tokens at 4:1, which cannot express this: a
|
|
1342
|
+
// subscription turn sends `thinking_delta.thinking` as the empty string and
|
|
1343
|
+
// reports progress in `estimated_tokens` instead, so the char counter stayed
|
|
1344
|
+
// at 0 for the entire thinking phase while thousands of tokens were billed.
|
|
1345
|
+
let thinkingTokens = 0;
|
|
1279
1346
|
const streamedCells = () => streamedChars;
|
|
1280
1347
|
// ── the turn ──
|
|
1281
1348
|
|
|
@@ -1385,6 +1452,7 @@ async function runSession(host) {
|
|
|
1385
1452
|
spinnerFrame = 0;
|
|
1386
1453
|
startedAt = Date.now();
|
|
1387
1454
|
streamedChars = 0;
|
|
1455
|
+
thinkingTokens = 0;
|
|
1388
1456
|
toolSeq = 0;
|
|
1389
1457
|
turnTools = [];
|
|
1390
1458
|
verb = VERBS[turnCount % VERBS.length];
|
|
@@ -1426,6 +1494,12 @@ async function runSession(host) {
|
|
|
1426
1494
|
// nothing needs a different explanation from one that produced nothing at
|
|
1427
1495
|
// all.
|
|
1428
1496
|
reasoning: (delta) => { sawReasoning = true; streamedChars += w(delta); },
|
|
1497
|
+
// Provider-measured thinking progress, in tokens. Separate from
|
|
1498
|
+
// `reasoning` above because that one is TEXT (accumulated as display
|
|
1499
|
+
// width, converted at 4:1) and this is already a token count. On a
|
|
1500
|
+
// subscription turn this is the only live signal that arrives during the
|
|
1501
|
+
// thinking phase — the text channel sends empty strings throughout.
|
|
1502
|
+
thinkingTokens: (n) => { sawReasoning = true; thinkingTokens += n; scheduleRender(); },
|
|
1429
1503
|
tool: (tool) => {
|
|
1430
1504
|
// One entry per tool call, not one per frame. The engine opens a `run`
|
|
1431
1505
|
// frame before the tool executes and closes it with a `done` frame
|
|
@@ -1935,7 +2009,7 @@ async function runSession(host) {
|
|
|
1935
2009
|
).length;
|
|
1936
2010
|
}
|
|
1937
2011
|
if (overlay.type === 'model' || overlay.type === 'resume') return (overlay.items || []).length;
|
|
1938
|
-
if (overlay.type === 'effort') return
|
|
2012
|
+
if (overlay.type === 'effort') return overlays.EFFORT_VALUES.length;
|
|
1939
2013
|
return 0;
|
|
1940
2014
|
};
|
|
1941
2015
|
|
|
@@ -1992,10 +2066,15 @@ async function runSession(host) {
|
|
|
1992
2066
|
return;
|
|
1993
2067
|
}
|
|
1994
2068
|
for (const step of queue) {
|
|
1995
|
-
// Pooled rows bill the account; a vendor step names its provider
|
|
1996
|
-
//
|
|
1997
|
-
//
|
|
1998
|
-
|
|
2069
|
+
// Pooled rows bill the account; a vendor step names its provider; the
|
|
2070
|
+
// Claude Code Pro step has neither — it is the subscription's own OAuth
|
|
2071
|
+
// token, minted with `claude setup-token` (or lifted from wherever it is
|
|
2072
|
+
// already set aside). The label says WHICH key is wanted, because two
|
|
2073
|
+
// prompts in a row for the same row must not read as the same question
|
|
2074
|
+
// asked twice.
|
|
2075
|
+
const label = step.role === 'account' ? 'AEGIS account key'
|
|
2076
|
+
: step.role === 'claude-pro' ? 'Claude Code OAuth token (`claude setup-token` mints one)'
|
|
2077
|
+
: `${step.provider} key`;
|
|
1999
2078
|
const key = String(
|
|
2000
2079
|
(await c.readSecret(`${label} → ${step.env} (kept off screen, Enter to skip): `)) || ''
|
|
2001
2080
|
).trim();
|
|
@@ -2006,15 +2085,38 @@ async function runSession(host) {
|
|
|
2006
2085
|
note(`no key given — ${step.env} is still unset, so ${chosen.id} will fail until it is.`);
|
|
2007
2086
|
continue;
|
|
2008
2087
|
}
|
|
2088
|
+
// Shape check before it ever touches disk: this is the same structural
|
|
2089
|
+
// check the account-key login flow has always had (empty / whitespace /
|
|
2090
|
+
// under 16 chars), now applied here too. Without it a truncated paste
|
|
2091
|
+
// (a 2-char clipboard miss, once landed as a literal ANTHROPIC_API_KEY)
|
|
2092
|
+
// writes straight to .env, reads as "configured" to every status check
|
|
2093
|
+
// that only asks `inFile`, and the row fails upstream on every real turn
|
|
2094
|
+
// with an opaque provider error — "key needed" never shows again because
|
|
2095
|
+
// the picker believes it already has one.
|
|
2096
|
+
const shapeLabel = step.role === 'account' ? 'AEGIS'
|
|
2097
|
+
: step.role === 'claude-pro' ? 'Claude Code OAuth'
|
|
2098
|
+
: step.provider || 'that provider';
|
|
2099
|
+
const shape = validateApiKey(key, { label: shapeLabel });
|
|
2100
|
+
if (!shape.ok) {
|
|
2101
|
+
note(`not saved — ${shape.message}. ${step.env} is still unset.`);
|
|
2102
|
+
continue;
|
|
2103
|
+
}
|
|
2009
2104
|
// `env: step.env` is what makes a per-step store possible at all: the row
|
|
2010
2105
|
// alone cannot say which of its two keys this value is for.
|
|
2011
|
-
const res = models.storeModelKey(chosen, key, { env: step.env });
|
|
2106
|
+
const res = models.storeModelKey(chosen, shape.key, { env: step.env });
|
|
2012
2107
|
if (!res.ok) {
|
|
2013
2108
|
note(`could not save the key: ${res.error || 'unknown error'}`);
|
|
2014
2109
|
continue;
|
|
2015
2110
|
}
|
|
2111
|
+
// A foreign secret (CLAUDE_CODE_OAUTH_TOKEN) lands in secrets.env, which
|
|
2112
|
+
// is read explicitly by the one transport that needs it — not loaded
|
|
2113
|
+
// ambiently at start-up the way `.env` is — so it gets its own wording
|
|
2114
|
+
// rather than the "both hosts read that file" line, which is true of
|
|
2115
|
+
// `.env` and would overstate what secrets.env actually does.
|
|
2016
2116
|
note(res.changed
|
|
2017
|
-
?
|
|
2117
|
+
? res.foreign
|
|
2118
|
+
? `${step.env} saved to ${res.file} (0600) — read only by the Claude Code Pro transport, never exported.`
|
|
2119
|
+
: `${step.env} saved to ${res.file} (0600) — both hosts read that file; nothing to export.`
|
|
2018
2120
|
: `${step.env} was already set in ${res.file}.`);
|
|
2019
2121
|
}
|
|
2020
2122
|
};
|
|
@@ -2030,13 +2132,57 @@ async function runSession(host) {
|
|
|
2030
2132
|
*/
|
|
2031
2133
|
const applyModelRow = async (chosen) => {
|
|
2032
2134
|
if (!chosen) return;
|
|
2033
|
-
|
|
2135
|
+
{
|
|
2136
|
+
// Swap an anthropic byok row for the equivalent Claude Code Pro alias
|
|
2137
|
+
// when this machine is signed into the subscription and holds no real
|
|
2138
|
+
// console key — see `overrideAnthropicByokWithPro` (module scope, pure)
|
|
2139
|
+
// for the full reasoning.
|
|
2140
|
+
const plan = models.modelKeyPlan(chosen, {
|
|
2141
|
+
hasStored: host.hasProviderKey ? !!host.hasProviderKey('anthropic') : false,
|
|
2142
|
+
});
|
|
2143
|
+
const { row, message } = overrideAnthropicByokWithPro(chosen, {
|
|
2144
|
+
needsKey: !!(plan && plan.needed),
|
|
2145
|
+
proLoggedIn: models.claudeProLoggedIn(),
|
|
2146
|
+
proModels: claudePro.PRO_MODELS,
|
|
2147
|
+
});
|
|
2148
|
+
chosen = row;
|
|
2149
|
+
if (message) note(message);
|
|
2150
|
+
}
|
|
2151
|
+
// A row that belongs to another class moves the session to that class
|
|
2152
|
+
// BEFORE the pin is stored, for the same reason byok's row does (and it is
|
|
2153
|
+
// the same one-line rule, not a second copy of it): a pro alias pinned while
|
|
2154
|
+
// the session sits on aegis would be sent to the pool as an AEGIS id, and
|
|
2155
|
+
// an AEGIS id pinned under pro would be handed to `claude --model`. Both
|
|
2156
|
+
// fail on the next turn, with a message about a model rather than the class.
|
|
2157
|
+
if (chosen.cls && chosen.cls !== 'aegis' && ctx.modelClass !== chosen.cls) {
|
|
2158
|
+
await dispatch(`/class ${chosen.cls}`);
|
|
2159
|
+
}
|
|
2034
2160
|
ctx.model = chosen.id;
|
|
2035
2161
|
host.updateConfig({ model: chosen.id, currentModelId: chosen.id, modelClass: ctx.modelClass });
|
|
2036
|
-
note(`model: ${chosen.id}${chosen.cls === 'byok' ? ' (byok)' : ''}`);
|
|
2162
|
+
note(`model: ${chosen.id}${chosen.cls === 'byok' ? ' (byok)' : chosen.cls === 'pro' ? ' (Claude Code Pro)' : ''}`);
|
|
2037
2163
|
await collectKeyFor(chosen);
|
|
2038
2164
|
};
|
|
2039
2165
|
|
|
2166
|
+
/**
|
|
2167
|
+
* Pin an effort rung — the ONE path a rung is applied through, shared by
|
|
2168
|
+
* Enter, shift+enter and the shift+arrow chords.
|
|
2169
|
+
*
|
|
2170
|
+
* It resolves the row through the picker's OWN table (overlays.EFFORT_VALUES),
|
|
2171
|
+
* which is the point: this used to re-declare ['low','medium','high'] at each
|
|
2172
|
+
* commit site while the picker drew its own list, so the row a user picked and
|
|
2173
|
+
* the value the session stored came from two different lists. A rung the
|
|
2174
|
+
* picker does not draw can no longer be stored, and a row it does draw can no
|
|
2175
|
+
* longer store a different value than the one it painted.
|
|
2176
|
+
*/
|
|
2177
|
+
const applyEffortRow = (sel) => {
|
|
2178
|
+
const chosen = overlays.EFFORT_VALUES[sel || 0];
|
|
2179
|
+
overlay = null;
|
|
2180
|
+
ctx.effort = chosen || 'high';
|
|
2181
|
+
host.updateConfig({ effort: ctx.effort });
|
|
2182
|
+
note(`effort: ${ctx.effort}`);
|
|
2183
|
+
render();
|
|
2184
|
+
};
|
|
2185
|
+
|
|
2040
2186
|
const handleOverlayKey = async (key) => {
|
|
2041
2187
|
const type = overlay.type;
|
|
2042
2188
|
if (key.name === KEY.ESC || key.name === KEY.CTRL_C) {
|
|
@@ -2062,6 +2208,22 @@ async function runSession(host) {
|
|
|
2062
2208
|
}
|
|
2063
2209
|
return;
|
|
2064
2210
|
}
|
|
2211
|
+
if (key.name === KEY.TAB && (type === 'model' || type === 'effort')) {
|
|
2212
|
+
// Reference parity (aegiscodex-dev/src/main.js's model overlay cycles on
|
|
2213
|
+
// Tab). It is also the one way to walk either picker that survives a link
|
|
2214
|
+
// where arrow escapes are eaten, since Tab is a single control byte.
|
|
2215
|
+
// Both lists are addressed the one way each of them can be: the catalogue
|
|
2216
|
+
// lives in `overlay.items`, while the rungs are the picker's own table —
|
|
2217
|
+
// the same table Enter and shift+enter resolve through.
|
|
2218
|
+
const n = type === 'model'
|
|
2219
|
+
? (overlay.items || []).length
|
|
2220
|
+
: overlays.EFFORT_VALUES.length;
|
|
2221
|
+
if (n) {
|
|
2222
|
+
overlay.sel = ((overlay.sel || 0) + 1) % n;
|
|
2223
|
+
render();
|
|
2224
|
+
}
|
|
2225
|
+
return;
|
|
2226
|
+
}
|
|
2065
2227
|
if (key.name === KEY.ENTER) {
|
|
2066
2228
|
if (type === 'palette') {
|
|
2067
2229
|
// Rank with the same function the palette rendered with, so the row
|
|
@@ -2087,13 +2249,8 @@ async function runSession(host) {
|
|
|
2087
2249
|
// The picker's own order, not a second copy of the level names: this
|
|
2088
2250
|
// used to re-declare ['low','medium','high'] here while the picker drew
|
|
2089
2251
|
// its own table, so the row a user picked and the value it stored were
|
|
2090
|
-
// resolved through different lists.
|
|
2091
|
-
|
|
2092
|
-
overlay = null;
|
|
2093
|
-
ctx.effort = chosen || 'high';
|
|
2094
|
-
host.updateConfig({ effort: ctx.effort });
|
|
2095
|
-
note(`effort: ${ctx.effort}`);
|
|
2096
|
-
render();
|
|
2252
|
+
// resolved through different lists. (See applyEffortRow.)
|
|
2253
|
+
applyEffortRow(overlay.sel || 0);
|
|
2097
2254
|
return;
|
|
2098
2255
|
}
|
|
2099
2256
|
if (type === 'resume') {
|
|
@@ -2127,12 +2284,7 @@ async function runSession(host) {
|
|
|
2127
2284
|
return;
|
|
2128
2285
|
}
|
|
2129
2286
|
if (type === 'effort') {
|
|
2130
|
-
|
|
2131
|
-
overlay = null;
|
|
2132
|
-
ctx.effort = chosen || 'high';
|
|
2133
|
-
host.updateConfig({ effort: ctx.effort });
|
|
2134
|
-
note(`effort: ${ctx.effort}`);
|
|
2135
|
-
render();
|
|
2287
|
+
applyEffortRow(overlay.sel || 0);
|
|
2136
2288
|
return;
|
|
2137
2289
|
}
|
|
2138
2290
|
render();
|
|
@@ -2160,24 +2312,24 @@ async function runSession(host) {
|
|
|
2160
2312
|
return;
|
|
2161
2313
|
}
|
|
2162
2314
|
if (type === 'effort') {
|
|
2163
|
-
|
|
2164
|
-
overlay = null;
|
|
2165
|
-
ctx.effort = chosen || 'high';
|
|
2166
|
-
host.updateConfig({ effort: ctx.effort });
|
|
2167
|
-
note(`effort: ${ctx.effort}`);
|
|
2168
|
-
render();
|
|
2315
|
+
applyEffortRow(overlay.sel || 0);
|
|
2169
2316
|
return;
|
|
2170
2317
|
}
|
|
2171
2318
|
return;
|
|
2172
2319
|
}
|
|
2173
|
-
if (key.name === KEY.UP) {
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2320
|
+
if (key.name === KEY.UP || key.name === KEY.DOWN) {
|
|
2321
|
+
// NAVIGATION ONLY — this is the reference's binding and it has to stay
|
|
2322
|
+
// that way. A plain arrow that applies the row it lands on cannot browse:
|
|
2323
|
+
// the overlay closes on the first press, the model is already changed,
|
|
2324
|
+
// and the other fifteen rows are unreachable. The reference moves the
|
|
2325
|
+
// highlight here and commits on Enter (aegiscodex-dev/src/main.js
|
|
2326
|
+
// navList + the KEY.ENTER branch of its model overlay); the one-keystroke
|
|
2327
|
+
// commit belongs to the shift chords below, which are additive and
|
|
2328
|
+
// explicit, not to the arrow every picker in the app uses to point.
|
|
2329
|
+
// Bounds come from the list being drawn, exactly as navList does it.
|
|
2330
|
+
const n = (overlay.items || []).length || overlayRowCount();
|
|
2331
|
+
const step = key.name === KEY.UP ? -1 : 1;
|
|
2332
|
+
overlay.sel = Math.min(Math.max(0, n - 1), Math.max(0, (overlay.sel || 0) + step));
|
|
2181
2333
|
render();
|
|
2182
2334
|
return;
|
|
2183
2335
|
}
|
|
@@ -2188,6 +2340,16 @@ async function runSession(host) {
|
|
|
2188
2340
|
render();
|
|
2189
2341
|
return;
|
|
2190
2342
|
}
|
|
2343
|
+
// There is deliberately NO shift+w / shift+s chord here. It existed (it
|
|
2344
|
+
// arrived as the bare chars 'W'/'S' — a real signal that survives links
|
|
2345
|
+
// which eat CSI arrow escapes) and it was removed on request: one
|
|
2346
|
+
// navigation binding is all these pickers need, and Tab already is that
|
|
2347
|
+
// binding — a single control byte, so it survives the same transports the
|
|
2348
|
+
// letter chord was there for, without a second way to move that then has
|
|
2349
|
+
// to be kept in step with the first. Tab cycles (above), Enter pins,
|
|
2350
|
+
// shift+↑/↓ pins as it moves for terminals that send CSI modifier 2, and
|
|
2351
|
+
// a plain uppercase letter in a picker now does nothing at all — it falls
|
|
2352
|
+
// through to the row-number branch below, which correctly ignores it.
|
|
2191
2353
|
if (type === 'model') {
|
|
2192
2354
|
const idx = parseInt(key.ch, 10);
|
|
2193
2355
|
const items = overlay.items || [];
|
|
@@ -2198,8 +2360,14 @@ async function runSession(host) {
|
|
|
2198
2360
|
return;
|
|
2199
2361
|
}
|
|
2200
2362
|
if (type === 'effort' || type === 'resume') {
|
|
2363
|
+
// Bounded by the same row count every other mover is bounded by. A row
|
|
2364
|
+
// number past the end used to be accepted unseen (`sel = idx - 1` with
|
|
2365
|
+
// no upper clamp), so '9' in /effort parked the highlight off the list
|
|
2366
|
+
// and Enter then stored the 'high' fallback for a row that was never
|
|
2367
|
+
// drawn — silently, since nothing was highlighted to contradict it.
|
|
2201
2368
|
const idx = parseInt(key.ch, 10);
|
|
2202
|
-
|
|
2369
|
+
const n = overlayRowCount();
|
|
2370
|
+
if (Number.isFinite(idx) && idx >= 1 && idx <= n) {
|
|
2203
2371
|
overlay.sel = idx - 1;
|
|
2204
2372
|
render();
|
|
2205
2373
|
}
|
|
@@ -2685,6 +2853,7 @@ module.exports = {
|
|
|
2685
2853
|
summarizeTurnTools,
|
|
2686
2854
|
finalizeTurnText,
|
|
2687
2855
|
historyPairs,
|
|
2856
|
+
overrideAnthropicByokWithPro,
|
|
2688
2857
|
paletteQuery,
|
|
2689
2858
|
headerLine,
|
|
2690
2859
|
separatorLine,
|