aegiscode 6.8.35 → 6.8.36
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 +4 -3
- package/bin/aegiscode.js +15 -3
- package/package.json +1 -1
- package/src/app.js +93 -36
- package/src/chatflow.js +145 -39
- package/src/commands.js +79 -29
- package/src/config.js +41 -11
- package/src/engine.js +29 -2
- package/src/entitlement.js +30 -1
- package/src/format.js +175 -3
- package/src/overlays.js +13 -9
- package/src/panels.js +19 -6
- package/src/render.js +49 -14
- package/src/screen.js +12 -1
- package/src/todos.js +7 -4
- package/src/tokens.js +31 -1
- package/vendor/desktop/renderer/usage.js +206 -20
- package/vendor/mcp/tools.js +1 -1
package/README.md
CHANGED
|
@@ -255,7 +255,7 @@ command for command — 87 entries across nine categories:
|
|
|
255
255
|
|---|---|
|
|
256
256
|
| Session & context | `/schedule` `/clear` `/compact` `/context` `/todos` `/config` `/exit` `/recap` `/resume` `/rewind` `/agents` `/status` `/teleport` `/version` `/new` `/skills` `/multiyolo` `/multi` `/research` `/debate` |
|
|
257
257
|
| Workspace | `/run` `/build` `/cd` `/init` `/clone` |
|
|
258
|
-
| Model & behavior | `/ping` `/effort` `/model` `/theme` `/terminal` `/vim` `/permissions` `/hooks` `/credentials` `/install-github-app` `/thinking` `/mcp` `/memory` `/memory-deep` `/confirm` `/yolo` `/router` `/class` `/models` |
|
|
258
|
+
| Model & behavior | `/ping` `/effort` `/model` `/theme` `/terminal` `/vim` `/permissions` `/hooks` `/credentials` `/install-github-app` `/thinking` `/mcp` `/memory` `/memory-deep` `/confirm` `/automode` *(alias `/yolo`)* `/router` `/class` `/models` |
|
|
259
259
|
| Data | `/copy` `/cost` `/export` `/tokens` `/sync` |
|
|
260
260
|
| Auth | `/login` `/logout` `/key` `/byok` `/byok-set` `/byok-rm` `/byok-key` `/byok-rm-key` |
|
|
261
261
|
| Support | `/help` `/doctor` `/upgrade` `/troubleshooting` `/feedback` `/bug` `/issue` `/onboarding` `/shell-completion` `/terminal-setup` `/pr-comments` `/prs` `/review` `/benchmark` `/billing` `/topup` `/cloud` `/gmail` `/release-notes` |
|
|
@@ -637,8 +637,9 @@ What the loop does, in the order a turn happens:
|
|
|
637
637
|
text is still what gets submitted).
|
|
638
638
|
- **The turn starts.** A random verb from the reference set shimmers in coral
|
|
639
639
|
beside the spinner, with elapsed time and a live token estimate.
|
|
640
|
-
- **The answer streams into a row**, markdown-rendered, opening with `●`
|
|
641
|
-
|
|
640
|
+
- **The answer streams into a row**, markdown-rendered, opening with `●` — one
|
|
641
|
+
marker, whatever the answer's length, so the glyph does not multiply when the
|
|
642
|
+
text wraps.
|
|
642
643
|
- **Tool calls become rows.** `● Running 1 shell command… · 3s` resolves to
|
|
643
644
|
`Ran 1 shell command` when the call returns — paired by tool-call id, so
|
|
644
645
|
parallel same-name calls and nested subagent rows stay separate, and the
|
package/bin/aegiscode.js
CHANGED
|
@@ -86,8 +86,9 @@ Options:
|
|
|
86
86
|
--max-tokens <n> output ceiling hint
|
|
87
87
|
--light light theme
|
|
88
88
|
--width <cols> force a render width (useful for piping/logs)
|
|
89
|
-
--
|
|
90
|
-
run without asking) — same as the in-session /
|
|
89
|
+
--automode skip tool-approval prompts (exec/writeFile/editFile
|
|
90
|
+
run without asking) — same as the in-session /automode
|
|
91
|
+
--yolo alias of --automode (the pre-rename spelling)
|
|
91
92
|
--ascii draw with the ASCII mark and glyph set (no Unicode).
|
|
92
93
|
Same as AEGIS_ART=ascii; /terminal ascii toggles it
|
|
93
94
|
mid-session.
|
|
@@ -248,6 +249,7 @@ function parseArgs(argv) {
|
|
|
248
249
|
case '--light':
|
|
249
250
|
opts.light = true;
|
|
250
251
|
break;
|
|
252
|
+
case '--automode':
|
|
251
253
|
case '--yolo':
|
|
252
254
|
opts.yolo = true;
|
|
253
255
|
break;
|
|
@@ -663,7 +665,17 @@ async function main(argv = process.argv.slice(2)) {
|
|
|
663
665
|
maxTokens: opts.maxTokens,
|
|
664
666
|
width: opts.width ? () => opts.width : undefined,
|
|
665
667
|
interactive: !prompt && Boolean(process.stdin.isTTY),
|
|
666
|
-
|
|
668
|
+
// ONLY a flag states an answer here. This line used to read `!opts.yolo`,
|
|
669
|
+
// which is a boolean on every launch — and `app.js`'s gate returns a pinned
|
|
670
|
+
// `options.confirmMode` the moment it is not `undefined`, so that one `true`
|
|
671
|
+
// short-circuited the store read the whole ON8 posture is built on: an
|
|
672
|
+
// automode the user had turned on (`/automode`, the window's switch, both of
|
|
673
|
+
// which persist) was overruled by the absence of a launch flag, and the CLI
|
|
674
|
+
// kept asking for exactly as long as the process lived. `undefined` hands
|
|
675
|
+
// the question to the one read — `resolveSkip()`, then `confirmPosture()` —
|
|
676
|
+
// which is where the flag/env and the shared store are resolved, live, on
|
|
677
|
+
// every tool round.
|
|
678
|
+
confirmMode: opts.yolo ? false : undefined,
|
|
667
679
|
continue: opts.continue,
|
|
668
680
|
});
|
|
669
681
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aegiscode",
|
|
3
3
|
"productName": "AEGIS Code",
|
|
4
|
-
"version": "6.8.
|
|
4
|
+
"version": "6.8.36",
|
|
5
5
|
"description": "aegiscode — the command-line version of AEGIS Desktop. The shared tool surface in your shell, over the same thin transport and tool registry as the MCP plugin and the desktop app. Ships transport + UI only; no brain.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "AEGIS Code",
|
package/src/app.js
CHANGED
|
@@ -22,10 +22,14 @@ const readline = require('node:readline');
|
|
|
22
22
|
const os = require('node:os');
|
|
23
23
|
const { randomUUID } = require('node:crypto');
|
|
24
24
|
const { createTools, createClient, usageTokens, usageBuckets, buildSystemPrompt, autoProvisionApiKey, hostEnv } = require('./deps.js');
|
|
25
|
-
const { createEngine, HOST_CLASSES, DEFAULT_CLASS, byokNamespace } = require('./engine.js');
|
|
25
|
+
const { createEngine, HOST_CLASSES, DEFAULT_CLASS, byokNamespace, effortRung } = require('./engine.js');
|
|
26
26
|
const { GLYPH, VERBS, themeOf, RESET, THEME_TABLE, AUTO_THEME_INDEX, themeIsLight, reconcileThemeIndex } = require('./theme.js');
|
|
27
27
|
const { probeTerminalBackground } = require('./caps.js');
|
|
28
28
|
const { LiveRegion, termWidth, w } = require('./screen.js');
|
|
29
|
+
// The live spinner tail is a token count, so the cell→token rule comes from the
|
|
30
|
+
// one module that owns it rather than a `/4` written inline at the call site
|
|
31
|
+
// (tokens.js explains why the count form has to sit beside the text form).
|
|
32
|
+
const { estimateTokensFromCells } = require('./tokens.js');
|
|
29
33
|
const { editPreview } = require('./diff.js');
|
|
30
34
|
const { defaultOpen } = require('./diffview.js');
|
|
31
35
|
const { parseLine, COMMANDS, visibleCommands } = require('./commands.js');
|
|
@@ -53,7 +57,18 @@ const screens = require('./screens.js');
|
|
|
53
57
|
const chatflow = require('./chatflow.js');
|
|
54
58
|
const overlays = require('./overlays.js');
|
|
55
59
|
const render = require('./render.js');
|
|
56
|
-
const { fmtTokens, fmtEur, maskKey } = require('./format.js');
|
|
60
|
+
const { fmtTokens, fmtEur, maskKey, feeBillable } = require('./format.js');
|
|
61
|
+
// The rule-5 skip resolver the gate below calls. It was CALLED and never
|
|
62
|
+
// imported: `const skip = resolveSkip({…})` at the top of the `getConfirmMode`
|
|
63
|
+
// callback threw a ReferenceError on every invocation, the surrounding `catch`
|
|
64
|
+
// swallowed it as "the store could not be read", and the whole skip arm was
|
|
65
|
+
// therefore dead in shipped code — `AEGISONE_SKIP_PERMISSIONS` (what the
|
|
66
|
+
// `aegis` bin forwards once it has resolved `--dangerously-skip-permissions`)
|
|
67
|
+
// and the CI/queue spelling both fell through to the store and were ignored,
|
|
68
|
+
// with nothing on screen to say a decision had been discarded. Imported here,
|
|
69
|
+
// beside the other module-level requires, so the two faces resolve a skip
|
|
70
|
+
// through the one function (D8 rule 1) instead of one of them not at all.
|
|
71
|
+
const { resolveSkip } = require('./permissions.js');
|
|
57
72
|
|
|
58
73
|
const VERSION = require('../package.json').version;
|
|
59
74
|
|
|
@@ -153,10 +168,10 @@ function createApp(options = {}) {
|
|
|
153
168
|
}
|
|
154
169
|
|
|
155
170
|
// Tool-approval gate (exec/writeFile/editFile confirm before running).
|
|
156
|
-
// Read per call, so /permissions and /
|
|
171
|
+
// Read per call, so /permissions and /automode take effect on the very next tool
|
|
157
172
|
// round rather than needing a restart. The mode is read LIVE from the
|
|
158
173
|
// permission store rather than from a boolean captured at construction:
|
|
159
|
-
// `/
|
|
174
|
+
// `/automode` and `/confirm` write the store, so a captured flag made both
|
|
160
175
|
// commands cosmetic — the panel changed while the engine kept asking.
|
|
161
176
|
let confirmMode = options.confirmMode !== false;
|
|
162
177
|
const engine =
|
|
@@ -203,7 +218,7 @@ function createApp(options = {}) {
|
|
|
203
218
|
// ON8 / D8 rule 1: the posture is read from the SHARED store first
|
|
204
219
|
// (config.js confirmPosture), which is the same store the desktop's
|
|
205
220
|
// "confirm before running tools" switch writes. Before this, the shell
|
|
206
|
-
// read only its own rule file, so the switch and `/
|
|
221
|
+
// read only its own rule file, so the switch and `/automode` were two
|
|
207
222
|
// postures for one question — the drift D8 names. The rule file is
|
|
208
223
|
// still the answer for an install that never touched the switch, so
|
|
209
224
|
// nothing changes for it.
|
|
@@ -239,10 +254,12 @@ function createApp(options = {}) {
|
|
|
239
254
|
// the one class an account key alone can run — BYOK additionally needs a
|
|
240
255
|
// provider key, so defaulting to it would break a fresh install.
|
|
241
256
|
modelClass: DEFAULT_CLASS,
|
|
242
|
-
//
|
|
243
|
-
//
|
|
244
|
-
//
|
|
245
|
-
//
|
|
257
|
+
// The budget rung the next turn travels with. `null` here means "nothing
|
|
258
|
+
// restored yet", not "auto": the rung actually sent is resolved by
|
|
259
|
+
// effortRung() at the request, which floors to 'high' — the same default
|
|
260
|
+
// the config file seeds and the desktop select offers. Retiring "auto" is
|
|
261
|
+
// the point: it was the default, so the default turn sent no effort at all
|
|
262
|
+
// and low/medium/high only moved the status line.
|
|
246
263
|
effort: null,
|
|
247
264
|
thinking: false,
|
|
248
265
|
// Deep recall (`aegis_recall_deep`) — the metered tier of the read: brain
|
|
@@ -826,7 +843,19 @@ function createApp(options = {}) {
|
|
|
826
843
|
tick: tick++,
|
|
827
844
|
verb,
|
|
828
845
|
elapsedMs: Date.now() - started,
|
|
829
|
-
|
|
846
|
+
// `chars` accumulates `w(chunk.delta)` — a display width, not a token
|
|
847
|
+
// count — and render.js prints this field as `↓N tokens`. Converted at
|
|
848
|
+
// the producer so both spinner renderers receive the same unit.
|
|
849
|
+
//
|
|
850
|
+
// `+ reasoning` because the live figure is the turn's BILLED output:
|
|
851
|
+
// the answer plus the thinking trace it is charged for, which is what
|
|
852
|
+
// the desktop's bubble sums (`desktop/renderer/app.js`: reply +
|
|
853
|
+
// reasoning cells at this same ratio). Reasoning is accumulated in its
|
|
854
|
+
// own variable above so the "reasoned but wrote nothing" case stays
|
|
855
|
+
// distinguishable — but leaving it out of the figure here stalled the
|
|
856
|
+
// spinner on `↓0 tokens` for the whole thinking phase of every turn,
|
|
857
|
+
// which is the row that exists to show the turn is moving.
|
|
858
|
+
streamed: estimateTokensFromCells(chars + reasoning),
|
|
830
859
|
}),
|
|
831
860
|
]);
|
|
832
861
|
};
|
|
@@ -904,7 +933,7 @@ function createApp(options = {}) {
|
|
|
904
933
|
const denyNoPrompter = (info) => {
|
|
905
934
|
err.write(
|
|
906
935
|
`aegiscode: ${info.tool} needs confirmation but this run has no prompt for it — denied ` +
|
|
907
|
-
'(pass --yolo to auto-approve mutating tools).\n'
|
|
936
|
+
'(pass --automode (alias --yolo) to auto-approve mutating tools).\n'
|
|
908
937
|
);
|
|
909
938
|
return Promise.resolve('deny');
|
|
910
939
|
};
|
|
@@ -956,14 +985,16 @@ function createApp(options = {}) {
|
|
|
956
985
|
// to use them.
|
|
957
986
|
system: opts.system || defaultSystemPrompt(),
|
|
958
987
|
maxTokens: opts.maxTokens,
|
|
959
|
-
// `effort` is the
|
|
960
|
-
// — this host only ever runs the 'aegis' class, whose calls are
|
|
961
|
-
// server-side from it (aegis1 services/pool_brain.py)
|
|
962
|
-
//
|
|
963
|
-
//
|
|
964
|
-
//
|
|
965
|
-
//
|
|
966
|
-
|
|
988
|
+
// `effort` is the budget rung, and it travels on EVERY turn for every
|
|
989
|
+
// model — this host only ever runs the 'aegis' class, whose calls are
|
|
990
|
+
// sized server-side from it (aegis1 services/pool_brain.py), and BYOK
|
|
991
|
+
// turns translate it per vendor in cli/src/engine.js. A stored `null`
|
|
992
|
+
// or a value this build no longer offers resolves to `high` — the
|
|
993
|
+
// same rung the desktop and the engine apply — instead of being
|
|
994
|
+
// omitted, because omitting it was the defect: `auto` was the
|
|
995
|
+
// default, so nothing reached the wire and the levels changed the
|
|
996
|
+
// status line and nothing else.
|
|
997
|
+
effort: effortRung(commandCtx.effort),
|
|
967
998
|
// The deep-recall opt-in travels only when this session turned it on
|
|
968
999
|
// (`/memory-deep on`). Sent as a literal `true` or not at all: the
|
|
969
1000
|
// engine treats anything but `true` as off, and an omitted field is
|
|
@@ -1080,13 +1111,19 @@ function createApp(options = {}) {
|
|
|
1080
1111
|
meta: {
|
|
1081
1112
|
model: res.model,
|
|
1082
1113
|
tokens,
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1114
|
+
// Folded through the SHARED normaliser, for the same reason recordTurn
|
|
1115
|
+
// is (see its comment): the providers do not merely spell these fields
|
|
1116
|
+
// differently, they MEASURE them differently. Anthropic's `input_tokens`
|
|
1117
|
+
// EXCLUDES `cache_read_input_tokens`; OpenAI's and DeepSeek's
|
|
1118
|
+
// `prompt_tokens` INCLUDES `prompt_cache_hit_tokens`. Reading the raw
|
|
1119
|
+
// field here therefore printed the WHOLE prompt as fresh input on a
|
|
1120
|
+
// cached turn — the cache-hit half restated at miss price, in the one
|
|
1121
|
+
// row a user reads immediately after every turn. That is precisely the
|
|
1122
|
+
// "the CLI's live tally disagrees with its own ledger about the same
|
|
1123
|
+
// turn" defect recordTurn's comment names; this call site was the one
|
|
1124
|
+
// it did not cover, and it is why the CLI's per-turn token readout ran
|
|
1125
|
+
// far above the engine's for the same turn on the same model.
|
|
1126
|
+
usage: res.usage == null ? null : usageBuckets(res.usage),
|
|
1090
1127
|
// What this call settled at, from the ledger row it produced — the
|
|
1091
1128
|
// number that has to agree with the token count beside it.
|
|
1092
1129
|
eur: settledCost,
|
|
@@ -1595,7 +1632,7 @@ function createApp(options = {}) {
|
|
|
1595
1632
|
out.write(
|
|
1596
1633
|
t.dim + GLYPH.hook + ' ' + t.blue + (res.model || 'aegis') + RESET +
|
|
1597
1634
|
t.dim + ' ' + GLYPH.bullet + ' ' + RESET +
|
|
1598
|
-
t.white + `${fmtTokens(tokens)}
|
|
1635
|
+
t.white + `${fmtTokens(tokens)} tokens` + RESET + '\n'
|
|
1599
1636
|
);
|
|
1600
1637
|
}
|
|
1601
1638
|
}
|
|
@@ -1797,12 +1834,30 @@ function createApp(options = {}) {
|
|
|
1797
1834
|
}
|
|
1798
1835
|
|
|
1799
1836
|
/** One line of session accounting, for ctrl+t and the meta row. */ function tokenSummary() {
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1837
|
+
// Output only, the same rule as the meta row this lands in (see format.js's
|
|
1838
|
+
// `fmtUsageSplit`): the input half is the prompt restated and the one figure
|
|
1839
|
+
// a reader cannot act on. A session that recorded no output figure at all
|
|
1840
|
+
// falls back to its total, because stating what was measured beats stating
|
|
1841
|
+
// nothing — and `0 tokens` is refused for the reason `fmtRoll` refuses
|
|
1842
|
+
// `0 tokens`: it states a figure the provider never reported. The label is
|
|
1843
|
+
// `tokens`, the word `fmtUsageSplit` puts on the same figure in the meta row
|
|
1844
|
+
// this shares a slot with: `in`/`out` is a status-line shorthand of this
|
|
1845
|
+
// CLI's own invention, and a reader who has to be told it reads `out` as
|
|
1846
|
+
// something dropped.
|
|
1847
|
+
const produced = session.outputTokens > 0
|
|
1848
|
+
? `${fmtTokens(session.outputTokens)} tokens`
|
|
1849
|
+
: `${fmtTokens(session.tokens)} tokens`;
|
|
1850
|
+
// Tokens and calls always; money only on a tier AEGIS PROVES a fee is owed
|
|
1851
|
+
// to. Same rule as the meta row and the desktop's topbar roll
|
|
1852
|
+
// (`feeBillable`) — on Unlimited or a welcome trial there is no per-turn
|
|
1853
|
+
// charge and no bank draw, so a `€0.0031` and a `balance` figure here would
|
|
1854
|
+
// be two prices for a session that has none.
|
|
1855
|
+
const parts = [produced, `${session.calls} call${session.calls === 1 ? '' : 's'}`];
|
|
1856
|
+
if (feeBillable()) {
|
|
1857
|
+
parts.push(fmtEur(session.cost));
|
|
1858
|
+
if (session.balance != null) parts.push(`balance ${fmtEur(session.balance)}`);
|
|
1859
|
+
}
|
|
1860
|
+
return parts.join(' · ');
|
|
1806
1861
|
}
|
|
1807
1862
|
|
|
1808
1863
|
/** Load a stored session back into the live transcript. */
|
|
@@ -1951,9 +2006,11 @@ function createApp(options = {}) {
|
|
|
1951
2006
|
// pin check right after this reads whichever class won.
|
|
1952
2007
|
if (HOST_CLASSES.includes(cfg.modelClass)) commandCtx.modelClass = cfg.modelClass;
|
|
1953
2008
|
if (!opts.model && cfg.model) commandCtx.model = cfg.model;
|
|
1954
|
-
//
|
|
1955
|
-
//
|
|
1956
|
-
|
|
2009
|
+
// Restored through effortRung(), so a config written by an older build is
|
|
2010
|
+
// never a value this one does not send: `null`, `''` and the retired
|
|
2011
|
+
// `'auto'` all come back as 'high' — the same rung the request would have
|
|
2012
|
+
// carried had the key been missing from the file entirely.
|
|
2013
|
+
commandCtx.effort = effortRung(cfg.effort);
|
|
1957
2014
|
if (typeof cfg.vim === 'boolean') commandCtx.vim = cfg.vim;
|
|
1958
2015
|
if (cfg.lastRecap) commandCtx.lastRecap = cfg.lastRecap;
|
|
1959
2016
|
// THEME_TABLE lives in theme.js, not screens.js: reading it off the screens
|
package/src/chatflow.js
CHANGED
|
@@ -44,13 +44,13 @@ const {
|
|
|
44
44
|
KEY, STREAM_END, attachKeyStream, nextKey, nextKeyTimeout, requeueKeys, resetKeyStream,
|
|
45
45
|
markSessionStart, isKeyStreamSuspended,
|
|
46
46
|
} = require('./events.js');
|
|
47
|
-
const { GLYPH, VERBS, DONE_VERBS, BOLD, BOLD_OFF, themeOf } = require('./theme.js');
|
|
47
|
+
const { GLYPH, VERBS, DONE_VERBS, BOLD, BOLD_OFF, themeOf, RGB } = require('./theme.js');
|
|
48
48
|
const { LineEditor } = require('./input.js');
|
|
49
49
|
const { renderMarkdown } = require('./markdown.js');
|
|
50
50
|
const overlays = require('./overlays.js');
|
|
51
51
|
const models = require('./models.js');
|
|
52
52
|
const fuzzy = require('./fuzzy.js');
|
|
53
|
-
const { fmtTokens, fmtEur, fmtElapsed, pathName } = require('./format.js');
|
|
53
|
+
const { fmtTokens, fmtEur, fmtElapsed, fmtUsageSplit, displayTokens, pathName, feeBillable } = require('./format.js');
|
|
54
54
|
const { editPreview } = require('./diff.js');
|
|
55
55
|
const { renderDiffBlock, defaultOpen } = require('./diffview.js');
|
|
56
56
|
const { copyToClipboard, describeCopy, readClipboardText, readClipboardImage } = require('./clipboard.js');
|
|
@@ -58,6 +58,14 @@ const { transcriptToMarkdown } = require('./export.js');
|
|
|
58
58
|
const fs = require('node:fs');
|
|
59
59
|
const path = require('node:path');
|
|
60
60
|
const { aegisDir, loadConfig } = require('./config.js');
|
|
61
|
+
const { effortRung } = require('./engine.js');
|
|
62
|
+
// The shared usage normaliser, reached through the CLI's own accounting module
|
|
63
|
+
// rather than by hand-rolling `input_tokens ?? prompt_tokens` at each render
|
|
64
|
+
// site (see the meta row's comment). tokens.js re-exports it, so chatflow does
|
|
65
|
+
// not have to resolve the desktop bundle itself — and deps.js, which already
|
|
66
|
+
// carries it, would pull the engine, the client and the tool registry into the
|
|
67
|
+
// renderer's require graph.
|
|
68
|
+
const { usageBuckets, estimateTokensFromCells } = require('./tokens.js');
|
|
61
69
|
// /ping — the terminal's half of the desktop's "reply ready" alert. Pure, so
|
|
62
70
|
// the loop only has to supply the stream and the elapsed time.
|
|
63
71
|
const { pingTurn } = require('./ping.js');
|
|
@@ -148,6 +156,22 @@ function resolveToolDone(transcript, t) {
|
|
|
148
156
|
return m;
|
|
149
157
|
}
|
|
150
158
|
|
|
159
|
+
/**
|
|
160
|
+
* Tool names whose `file_path` means the file was WRITTEN, not read.
|
|
161
|
+
*
|
|
162
|
+
* The summary used to collect `args.file_path || args.path || args.notebook_path`
|
|
163
|
+
* from every tool, so any read-only call that names a file counted as a change:
|
|
164
|
+
* a turn that only looked at the home folder (`Read`, `Grep`, `Glob`, `List`)
|
|
165
|
+
* ended with "N files changed" under an answer that wrote nothing. The reader
|
|
166
|
+
* is asked to trust that line, so it may only fire on a tool that can mutate a
|
|
167
|
+
* file. `editFile`/`writeFile` are this host's spellings; `Write`/`Edit`/
|
|
168
|
+
* `MultiEdit`/`NotebookEdit` are the engine's — `cli/src/diff.js` accepts both,
|
|
169
|
+
* and this list must stay in step with it.
|
|
170
|
+
*/
|
|
171
|
+
const MUTATING_FILES = new Set([
|
|
172
|
+
'Edit', 'Write', 'MultiEdit', 'NotebookEdit', 'editFile', 'writeFile',
|
|
173
|
+
]);
|
|
174
|
+
|
|
151
175
|
/**
|
|
152
176
|
* Fold one turn's tool events into the counts the end-of-turn summary prints.
|
|
153
177
|
*
|
|
@@ -171,7 +195,8 @@ function summarizeTurnTools(tools, { maxNames = 3 } = {}) {
|
|
|
171
195
|
if (tool.ok === false) failed += 1;
|
|
172
196
|
const args = tool.args;
|
|
173
197
|
if (!args || typeof args !== 'object') continue;
|
|
174
|
-
const
|
|
198
|
+
const writes = MUTATING_FILES.has(tool.name);
|
|
199
|
+
const file = writes ? args.file_path || args.path || args.notebook_path : null;
|
|
175
200
|
if (typeof file === 'string' && file && !files.includes(file)) files.push(file);
|
|
176
201
|
const cmd = args.command;
|
|
177
202
|
if (typeof cmd === 'string' && cmd.trim()) {
|
|
@@ -247,17 +272,38 @@ function headerLine(version, cols, ctx) {
|
|
|
247
272
|
|
|
248
273
|
const separatorLine = (cols, ctx) => [span(themeOf(ctx).dim, '─'.repeat(cols))];
|
|
249
274
|
|
|
250
|
-
/** The idle bottom-left line: which effort level the next turn runs at.
|
|
275
|
+
/** The idle bottom-left line: which effort level the next turn runs at.
|
|
276
|
+
* Always one of the three rungs — `high` when the session has no stored rung,
|
|
277
|
+
* which is the value the request will actually carry (see effortRung). */
|
|
251
278
|
function effortLine(ctx, cols) {
|
|
252
279
|
const t = themeOf(ctx);
|
|
253
|
-
const txt = `● ${ctx.effort
|
|
280
|
+
const txt = `● ${effortRung(ctx.effort)} · /effort`;
|
|
254
281
|
const pad = ' '.repeat(Math.max(0, cols - [...txt].length - 4));
|
|
255
282
|
return [span(t.gray, pad + txt)];
|
|
256
283
|
}
|
|
257
284
|
|
|
285
|
+
/**
|
|
286
|
+
* The non-peak colour of the shimmer that runs through the working verb,
|
|
287
|
+
* taken verbatim from the reference engine's spinner
|
|
288
|
+
* (`aegiscodex-dev/src/main.js`: `(i + frame) % 3 === 0 ? C.coral :
|
|
289
|
+
* RGB2(235, 159, 127)`).
|
|
290
|
+
*
|
|
291
|
+
* It is deliberately NOT a palette role, because the reference does not make it
|
|
292
|
+
* one either: `test/cli-conformance.test.mjs` pins this theme's roles to exactly
|
|
293
|
+
* the reference's set, so adding a `salmon` role would fail that guard for a
|
|
294
|
+
* colour the palette never owned.
|
|
295
|
+
*
|
|
296
|
+
* The previous value here was `gray`, and that is what made the live spinner
|
|
297
|
+
* read as washed out: two of every three shimmering characters were the same
|
|
298
|
+
* dim grey as finished output, so the one row that means "a turn is in flight"
|
|
299
|
+
* was painted in the colour of settled chrome. The tint is a warm salmon, one
|
|
300
|
+
* step lighter than `coral`, so the shimmer reads as motion at a glance.
|
|
301
|
+
*/
|
|
302
|
+
const SPINNER_TINT = RGB(235, 159, 127);
|
|
303
|
+
|
|
258
304
|
/**
|
|
259
305
|
* The working line: the `✻`-family spinner with a shimmering verb, the elapsed
|
|
260
|
-
* time and a token
|
|
306
|
+
* time and a token count — the reference's
|
|
261
307
|
* `✻ Tempering… (3s · ↓412 tokens)`.
|
|
262
308
|
*/
|
|
263
309
|
function spinnerLine(state, ctx) {
|
|
@@ -266,11 +312,18 @@ function spinnerLine(state, ctx) {
|
|
|
266
312
|
const shimmer = [...(state.verb || VERBS[0])];
|
|
267
313
|
const frame = Math.floor((state.frame || 0) / 2) % 3;
|
|
268
314
|
const tinted = shimmer.map((ch, i) =>
|
|
269
|
-
span((i + frame) % 3 === 0 ? t.coral :
|
|
315
|
+
span((i + frame) % 3 === 0 ? t.coral : SPINNER_TINT, ch)
|
|
270
316
|
);
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
317
|
+
// The tail is keyed on the thinking flag, NOT on whether anything has
|
|
318
|
+
// streamed yet. The reference branches the same way
|
|
319
|
+
// (`aegiscodex-dev/src/main.js`: `if (ctx.thinking) … else … ↓N tokens`).
|
|
320
|
+
// Gating on `state.streamed` instead meant every turn opened on
|
|
321
|
+
// `(0s · thinking)` — a tokenless tail that announced reasoning whether or not
|
|
322
|
+
// extended thinking was on — which is why the live token count was missing
|
|
323
|
+
// from the spinner while the model was working.
|
|
324
|
+
const tail = ctx && ctx.thinking
|
|
325
|
+
? span(t.gray, ` (${secs}s · thinking)`)
|
|
326
|
+
: span(t.gray, ` (${secs}s · ↓${fmtTokens(state.streamed || 0)} tokens)`);
|
|
274
327
|
const glyph = GLYPH.spin[(state.frame || 0) % GLYPH.spin.length];
|
|
275
328
|
return [span(t.coral, glyph), ...tinted, span(t.white, '… '), tail];
|
|
276
329
|
}
|
|
@@ -296,7 +349,7 @@ function statusLine(state, cols, ctx) {
|
|
|
296
349
|
} else if (state.streamJob) {
|
|
297
350
|
left = [span(t.gray, `${GLYPH.bullet} esc to stop`)];
|
|
298
351
|
} else if (state.yolo) {
|
|
299
|
-
left = [span(t.gray, `${GLYPH.bullet}
|
|
352
|
+
left = [span(t.gray, `${GLYPH.bullet} automode on ${GLYPH.bullet} ? for shortcuts ${GLYPH.bullet} ${GLYPH.rightarrow} for auto mode`)];
|
|
300
353
|
} else {
|
|
301
354
|
left = [span(t.gray, `${GLYPH.pause} manual mode on ${GLYPH.bullet} ? for shortcuts ${GLYPH.bullet} ${GLYPH.rightarrow} for auto mode`)];
|
|
302
355
|
}
|
|
@@ -394,11 +447,26 @@ function confirmLines(overlay, cols, ctx) {
|
|
|
394
447
|
function metaBits(m, t, { omitMs = false } = {}) {
|
|
395
448
|
const bits = [];
|
|
396
449
|
if (m.model) bits.push(span(t.blue, m.model));
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
450
|
+
// Same figure as the standalone meta row, from the one helper both call:
|
|
451
|
+
// OUTPUT only, in `white`, the token the total used to get. The
|
|
452
|
+
// input-inclusive total is not printed beside it — on a cached turn it is the
|
|
453
|
+
// prompt restated, and showing `156,189 tok` next to `5,014 tokens` is what made
|
|
454
|
+
// the row read as a runaway. When no output figure arrived the row states
|
|
455
|
+
// NOTHING rather than the total: `m.tokens` is input + output, so falling back
|
|
456
|
+
// to it put the input half back under an unlabelled figure — the leak the
|
|
457
|
+
// desktop closed in `displayTokens`, closed here the same way. A row with no
|
|
458
|
+
// measurable output is better empty than stating a total the reader cannot tell
|
|
459
|
+
// from the answer's size.
|
|
460
|
+
const parts = fmtUsageSplit(m);
|
|
461
|
+
if (parts) bits.push(span(t.white, parts.output));
|
|
462
|
+
else {
|
|
463
|
+
const produced = displayTokens(m);
|
|
464
|
+
if (produced != null) bits.push(span(t.white, `${fmtTokens(produced)} tokens`));
|
|
400
465
|
}
|
|
401
|
-
|
|
466
|
+
// No money on a tier AEGIS bills no fee to, nor from an unproven snapshot
|
|
467
|
+
// (`feeBillable`) — the desktop's rule, and the same one the standalone meta
|
|
468
|
+
// row uses, so the two renderers of this row cannot disagree about a fee.
|
|
469
|
+
if (m.eur != null && feeBillable()) bits.push(span(m.eur > 0 ? t.coral : t.green, fmtEur(m.eur)));
|
|
402
470
|
if (m.ms != null && !omitMs) bits.push(span(t.gray, fmtElapsed(m.ms)));
|
|
403
471
|
if (m.calls > 1) bits.push(span(t.gray, `${m.calls} calls`));
|
|
404
472
|
return bits;
|
|
@@ -448,10 +516,12 @@ function rowLines(msg, cols, ctx, now = Date.now()) {
|
|
|
448
516
|
const where = msg.cwd ? ` · ${shortDir(msg.cwd)}` : '';
|
|
449
517
|
if (msg.phase === 'run') {
|
|
450
518
|
const secs = msg.start ? Math.max(1, Math.round((now - msg.start) / 1000)) : 0;
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
519
|
+
// No leading `●` bullet on a running-command row: the label plus its
|
|
520
|
+
// elapsed seconds already say what is happening, and the bullet made a
|
|
521
|
+
// live turn read as a list of bullets. It also kept the running row one
|
|
522
|
+
// column right of the finished row it collapses into, so the transcript
|
|
523
|
+
// shifted sideways the moment the command completed.
|
|
524
|
+
out.push([span(t.gray, `${label}${GLYPH.ellipse} · ${secs}s${where}`)]);
|
|
455
525
|
} else {
|
|
456
526
|
out.push([span(t.gray, `${label}${where}`)]);
|
|
457
527
|
}
|
|
@@ -563,15 +633,16 @@ function rowLines(msg, cols, ctx, now = Date.now()) {
|
|
|
563
633
|
if (i === 0) line.unshift(span(t.white, GLYPH.block), span('', ' '));
|
|
564
634
|
out.push(line);
|
|
565
635
|
}
|
|
566
|
-
//
|
|
567
|
-
//
|
|
568
|
-
//
|
|
569
|
-
//
|
|
570
|
-
//
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
636
|
+
// No trailing cursor glyph. This used to append a second `●` to the last line
|
|
637
|
+
// of a still-growing answer whenever the message occupied more than one row,
|
|
638
|
+
// which made the glyph count a function of how the text WRAPPED: a one-line
|
|
639
|
+
// answer was `● Working`, a two-line answer was `● Working●`. Two dots where
|
|
640
|
+
// the reader expects one, and the asymmetry landed on exactly the long answers
|
|
641
|
+
// a person is most likely to read — the marker is the message's opening
|
|
642
|
+
// gutter, not a bracket. A streaming turn is already advertised by the working
|
|
643
|
+
// line below (`renderWorking`) and by the head marker being the same one the
|
|
644
|
+
// finished row keeps, so the tail glyph carried no information the reader did
|
|
645
|
+
// not already have.
|
|
575
646
|
return out;
|
|
576
647
|
}
|
|
577
648
|
|
|
@@ -962,7 +1033,17 @@ async function runSession(host) {
|
|
|
962
1033
|
if (working) {
|
|
963
1034
|
lines.push(
|
|
964
1035
|
spinnerLine(
|
|
965
|
-
{
|
|
1036
|
+
{
|
|
1037
|
+
verb,
|
|
1038
|
+
frame: spinnerFrame,
|
|
1039
|
+
elapsedMs: Date.now() - startedAt,
|
|
1040
|
+
// `streamedChars` is a display width — the accumulated `w(delta)` of
|
|
1041
|
+
// the stream — so it is converted to tokens HERE, at the producer.
|
|
1042
|
+
// Both spinner renderers label this field `tokens`, so handing them
|
|
1043
|
+
// cells printed the character count as a token count and the live
|
|
1044
|
+
// figure read ~4x high.
|
|
1045
|
+
streamed: estimateTokensFromCells(streamedCells()),
|
|
1046
|
+
},
|
|
966
1047
|
ctx
|
|
967
1048
|
)
|
|
968
1049
|
);
|
|
@@ -1099,6 +1180,12 @@ async function runSession(host) {
|
|
|
1099
1180
|
|
|
1100
1181
|
const note = (text) => push({ role: 'note', text }, { follow: false });
|
|
1101
1182
|
|
|
1183
|
+
// The live figure's input: the display width of what the turn has PRODUCED so
|
|
1184
|
+
// far — the answer's deltas AND the thinking trace's — because that is the
|
|
1185
|
+
// billed output and the quantity the desktop's bubble reports (see the
|
|
1186
|
+
// `reasoning` presenter below). It feeds the spinner and nothing else: it is
|
|
1187
|
+
// reset per turn and never reaches the accounting row, which is built from
|
|
1188
|
+
// what the provider measured.
|
|
1102
1189
|
let streamedChars = 0;
|
|
1103
1190
|
const streamedCells = () => streamedChars;
|
|
1104
1191
|
// ── the turn ──
|
|
@@ -1170,10 +1257,19 @@ async function runSession(host) {
|
|
|
1170
1257
|
streamedChars += w(delta);
|
|
1171
1258
|
scheduleRender();
|
|
1172
1259
|
},
|
|
1173
|
-
// Not rendered (deliberation is not an answer), but
|
|
1174
|
-
//
|
|
1175
|
-
//
|
|
1176
|
-
|
|
1260
|
+
// Not rendered (deliberation is not an answer), but counted and recorded.
|
|
1261
|
+
// Counted, because the live figure is the turn's BILLED output — the
|
|
1262
|
+
// answer plus the thinking trace it is charged for — which is the same
|
|
1263
|
+
// quantity the desktop's bubble reports (`desktop/renderer/app.js` sums
|
|
1264
|
+
// reply AND reasoning cells at this same 4:1 ratio). Consuming the delta
|
|
1265
|
+
// here without adding it left the counter at 0 for the whole thinking
|
|
1266
|
+
// phase, so the spinner read `↓0 tokens` while a reasoning model — the
|
|
1267
|
+
// default in this build — thought: the one row that means "a turn is in
|
|
1268
|
+
// flight" reported nothing happening.
|
|
1269
|
+
// Recorded separately, because a turn that reasoned and then produced
|
|
1270
|
+
// nothing needs a different explanation from one that produced nothing at
|
|
1271
|
+
// all.
|
|
1272
|
+
reasoning: (delta) => { sawReasoning = true; streamedChars += w(delta); },
|
|
1177
1273
|
tool: (tool) => {
|
|
1178
1274
|
// One entry per tool call, not one per frame. The engine opens a `run`
|
|
1179
1275
|
// frame before the tool executes and closes it with a `done` frame
|
|
@@ -1323,14 +1419,24 @@ async function runSession(host) {
|
|
|
1323
1419
|
}
|
|
1324
1420
|
const usage = result && result.usage;
|
|
1325
1421
|
const tokens = host.tokensFor ? host.tokensFor(usage) : null;
|
|
1422
|
+
// The in/out split on this row is the miss/hit split the ledger row,
|
|
1423
|
+
// /cost, /context and the desktop roll all carry — not the raw wire
|
|
1424
|
+
// fields. `usage.input_tokens ?? usage.prompt_tokens` is not a spelling
|
|
1425
|
+
// preference: Anthropic's `input_tokens` EXCLUDES cached reads while
|
|
1426
|
+
// OpenAI's and DeepSeek's `prompt_tokens` INCLUDES the hit, so reading
|
|
1427
|
+
// the raw field printed the entire prompt as fresh input on a cached
|
|
1428
|
+
// turn. On a resumed session that is most of the prompt, which is why
|
|
1429
|
+
// this row's token figure ran so far above the engine's for the same
|
|
1430
|
+
// turn. `usageBuckets` resolves both to the miss half.
|
|
1431
|
+
const buckets = usage ? usageBuckets(usage) : null;
|
|
1326
1432
|
push(
|
|
1327
1433
|
{
|
|
1328
1434
|
role: 'meta',
|
|
1329
1435
|
meta: {
|
|
1330
1436
|
model: result && result.model,
|
|
1331
1437
|
tokens,
|
|
1332
|
-
input:
|
|
1333
|
-
output:
|
|
1438
|
+
input: buckets ? buckets.input : null,
|
|
1439
|
+
output: buckets ? buckets.output : null,
|
|
1334
1440
|
eur: lastCost,
|
|
1335
1441
|
ms: result && result.ms,
|
|
1336
1442
|
calls: (result && result.calls) || 1,
|
|
@@ -1833,9 +1939,9 @@ async function runSession(host) {
|
|
|
1833
1939
|
// resolved through different lists.
|
|
1834
1940
|
const chosen = overlays.EFFORT_VALUES[overlay.sel || 0];
|
|
1835
1941
|
overlay = null;
|
|
1836
|
-
ctx.effort = chosen;
|
|
1837
|
-
host.updateConfig({ effort:
|
|
1838
|
-
note(`effort: ${
|
|
1942
|
+
ctx.effort = chosen || 'high';
|
|
1943
|
+
host.updateConfig({ effort: ctx.effort });
|
|
1944
|
+
note(`effort: ${ctx.effort}`);
|
|
1839
1945
|
render();
|
|
1840
1946
|
return;
|
|
1841
1947
|
}
|
|
@@ -2032,7 +2138,7 @@ async function runSession(host) {
|
|
|
2032
2138
|
// at column 0, so `editor.right()` was a no-op there: the binding costs no
|
|
2033
2139
|
// editing behaviour, and a line with text keeps plain cursor movement.
|
|
2034
2140
|
if (key.name === KEY.RIGHT && !editor.buf) {
|
|
2035
|
-
await dispatch(!(host.isYolo && host.isYolo()) ? '/
|
|
2141
|
+
await dispatch(!(host.isYolo && host.isYolo()) ? '/automode on' : '/automode off');
|
|
2036
2142
|
return;
|
|
2037
2143
|
}
|
|
2038
2144
|
if (key.name === KEY.RIGHT || key.name === KEY.CTRL_RIGHT) {
|