aegiscode 6.8.35 → 6.8.37

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 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 `●` and
641
- trailing a live cursor while it grows.
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
- --yolo skip tool-approval prompts (exec/writeFile/editFile
90
- run without asking) — same as the in-session /yolo
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
- confirmMode: !opts.yolo,
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.35",
4
+ "version": "6.8.37",
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 /yolo take effect on the very next tool
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
- // `/yolo` and `/confirm` write the store, so a captured flag made both
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 `/yolo` were two
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
- // `null` = "auto": send no effort, so the server sizes the turn from the
243
- // ask. This is the *budget* control on the pooled class (aegis1 sizes the
244
- // token ladder from it), which is why it is not defaulted to a rung here —
245
- // pinning one would make every turn cost what that rung grants.
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
- streamed: chars,
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,11 +933,18 @@ 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
  };
911
940
 
941
+ // The round-horizon ask's own no-one-to-answer fallback. Unreachable in
942
+ // practice — `roundsAsk` below is only sent `true` when `p.rounds` exists,
943
+ // so the engine never raises the ask without a prompter — but kept so a
944
+ // future caller that forgets the guard fails safe (stop) instead of
945
+ // hanging the tool loop on an unanswerable promise.
946
+ const denyRoundsNoPrompter = () => Promise.resolve(false);
947
+
912
948
  // Vocabulary bridging lives at module scope (see normalizeDecision) so the
913
949
  // same function the tests import is the one the live path calls.
914
950
  const onDelta = (chunk) => {
@@ -941,6 +977,14 @@ function createApp(options = {}) {
941
977
  .catch(() => 'deny')
942
978
  .then((decision) => engine.respondApproval(info.id, normalizeDecision(decision)));
943
979
  }
980
+ if (chunk.rounds) {
981
+ const info = chunk.rounds;
982
+ if (live) live.clear();
983
+ const decide = p.rounds || denyRoundsNoPrompter;
984
+ Promise.resolve(decide(info))
985
+ .catch(() => false)
986
+ .then((decision) => engine.respondRoundsAsk(info.id, decision === true));
987
+ }
944
988
  };
945
989
 
946
990
  try {
@@ -956,14 +1000,16 @@ function createApp(options = {}) {
956
1000
  // to use them.
957
1001
  system: opts.system || defaultSystemPrompt(),
958
1002
  maxTokens: opts.maxTokens,
959
- // `effort` is the pooled budget control, and it travels on every turn
960
- // — this host only ever runs the 'aegis' class, whose calls are sized
961
- // server-side from it (aegis1 services/pool_brain.py). It used to be
962
- // held in the session state and rendered in the status line without
963
- // ever reaching the wire, so /effort changed the display and nothing
964
- // about what the turn cost. `null` (auto) is omitted so the server
965
- // infers the rung from the ask.
966
- effort: commandCtx.effort || undefined,
1003
+ // `effort` is the budget rung, and it travels on EVERY turn for every
1004
+ // model — this host only ever runs the 'aegis' class, whose calls are
1005
+ // sized server-side from it (aegis1 services/pool_brain.py), and BYOK
1006
+ // turns translate it per vendor in cli/src/engine.js. A stored `null`
1007
+ // or a value this build no longer offers resolves to `high` — the
1008
+ // same rung the desktop and the engine apply — instead of being
1009
+ // omitted, because omitting it was the defect: `auto` was the
1010
+ // default, so nothing reached the wire and the levels changed the
1011
+ // status line and nothing else.
1012
+ effort: effortRung(commandCtx.effort),
967
1013
  // The deep-recall opt-in travels only when this session turned it on
968
1014
  // (`/memory-deep on`). Sent as a literal `true` or not at all: the
969
1015
  // engine treats anything but `true` as off, and an omitted field is
@@ -973,6 +1019,11 @@ function createApp(options = {}) {
973
1019
  // `--no-stream` and piped runs get a single body rather than SSE.
974
1020
  stream: commandCtx.stream !== false,
975
1021
  sessionId,
1022
+ // Opt-in to the round-horizon dialog (see engine.js requestRoundsAsk)
1023
+ // only when there is actually a `rounds` prompter to answer it — a
1024
+ // one-shot `-p` run or any other caller with no presenter keeps the
1025
+ // engine's old stop-and-record-session behaviour untouched.
1026
+ roundsAsk: Boolean(p.rounds),
976
1027
  },
977
1028
  onDelta
978
1029
  );
@@ -1080,13 +1131,19 @@ function createApp(options = {}) {
1080
1131
  meta: {
1081
1132
  model: res.model,
1082
1133
  tokens,
1083
- usage:
1084
- res.usage == null
1085
- ? null
1086
- : {
1087
- input: res.usage.input_tokens ?? res.usage.prompt_tokens,
1088
- output: res.usage.output_tokens ?? res.usage.completion_tokens,
1089
- },
1134
+ // Folded through the SHARED normaliser, for the same reason recordTurn
1135
+ // is (see its comment): the providers do not merely spell these fields
1136
+ // differently, they MEASURE them differently. Anthropic's `input_tokens`
1137
+ // EXCLUDES `cache_read_input_tokens`; OpenAI's and DeepSeek's
1138
+ // `prompt_tokens` INCLUDES `prompt_cache_hit_tokens`. Reading the raw
1139
+ // field here therefore printed the WHOLE prompt as fresh input on a
1140
+ // cached turn — the cache-hit half restated at miss price, in the one
1141
+ // row a user reads immediately after every turn. That is precisely the
1142
+ // "the CLI's live tally disagrees with its own ledger about the same
1143
+ // turn" defect recordTurn's comment names; this call site was the one
1144
+ // it did not cover, and it is why the CLI's per-turn token readout ran
1145
+ // far above the engine's for the same turn on the same model.
1146
+ usage: res.usage == null ? null : usageBuckets(res.usage),
1090
1147
  // What this call settled at, from the ledger row it produced — the
1091
1148
  // number that has to agree with the token count beside it.
1092
1149
  eur: settledCost,
@@ -1595,7 +1652,7 @@ function createApp(options = {}) {
1595
1652
  out.write(
1596
1653
  t.dim + GLYPH.hook + ' ' + t.blue + (res.model || 'aegis') + RESET +
1597
1654
  t.dim + ' ' + GLYPH.bullet + ' ' + RESET +
1598
- t.white + `${fmtTokens(tokens)} tok` + RESET + '\n'
1655
+ t.white + `${fmtTokens(tokens)} tokens` + RESET + '\n'
1599
1656
  );
1600
1657
  }
1601
1658
  }
@@ -1797,12 +1854,30 @@ function createApp(options = {}) {
1797
1854
  }
1798
1855
 
1799
1856
  /** One line of session accounting, for ctrl+t and the meta row. */ function tokenSummary() {
1800
- return (
1801
- `${fmtTokens(session.tokens)} tok ` +
1802
- `(${fmtTokens(session.inputTokens)} in / ${fmtTokens(session.outputTokens)} out) · ` +
1803
- `${session.calls} call${session.calls === 1 ? '' : 's'} · ${fmtEur(session.cost)}` +
1804
- (session.balance == null ? '' : ` · balance ${fmtEur(session.balance)}`)
1805
- );
1857
+ // Output only, the same rule as the meta row this lands in (see format.js's
1858
+ // `fmtUsageSplit`): the input half is the prompt restated and the one figure
1859
+ // a reader cannot act on. A session that recorded no output figure at all
1860
+ // falls back to its total, because stating what was measured beats stating
1861
+ // nothing — and `0 tokens` is refused for the reason `fmtRoll` refuses
1862
+ // `0 tokens`: it states a figure the provider never reported. The label is
1863
+ // `tokens`, the word `fmtUsageSplit` puts on the same figure in the meta row
1864
+ // this shares a slot with: `in`/`out` is a status-line shorthand of this
1865
+ // CLI's own invention, and a reader who has to be told it reads `out` as
1866
+ // something dropped.
1867
+ const produced = session.outputTokens > 0
1868
+ ? `${fmtTokens(session.outputTokens)} tokens`
1869
+ : `${fmtTokens(session.tokens)} tokens`;
1870
+ // Tokens and calls always; money only on a tier AEGIS PROVES a fee is owed
1871
+ // to. Same rule as the meta row and the desktop's topbar roll
1872
+ // (`feeBillable`) — on Unlimited or a welcome trial there is no per-turn
1873
+ // charge and no bank draw, so a `€0.0031` and a `balance` figure here would
1874
+ // be two prices for a session that has none.
1875
+ const parts = [produced, `${session.calls} call${session.calls === 1 ? '' : 's'}`];
1876
+ if (feeBillable()) {
1877
+ parts.push(fmtEur(session.cost));
1878
+ if (session.balance != null) parts.push(`balance ${fmtEur(session.balance)}`);
1879
+ }
1880
+ return parts.join(' · ');
1806
1881
  }
1807
1882
 
1808
1883
  /** Load a stored session back into the live transcript. */
@@ -1951,9 +2026,11 @@ function createApp(options = {}) {
1951
2026
  // pin check right after this reads whichever class won.
1952
2027
  if (HOST_CLASSES.includes(cfg.modelClass)) commandCtx.modelClass = cfg.modelClass;
1953
2028
  if (!opts.model && cfg.model) commandCtx.model = cfg.model;
1954
- // `null` in the config is "auto" and is deliberately not assigned over the
1955
- // default — there is nothing to restore, because nothing is pinned.
1956
- if (cfg.effort) commandCtx.effort = cfg.effort;
2029
+ // Restored through effortRung(), so a config written by an older build is
2030
+ // never a value this one does not send: `null`, `''` and the retired
2031
+ // `'auto'` all come back as 'high' — the same rung the request would have
2032
+ // carried had the key been missing from the file entirely.
2033
+ commandCtx.effort = effortRung(cfg.effort);
1957
2034
  if (typeof cfg.vim === 'boolean') commandCtx.vim = cfg.vim;
1958
2035
  if (cfg.lastRecap) commandCtx.lastRecap = cfg.lastRecap;
1959
2036
  // THEME_TABLE lives in theme.js, not screens.js: reading it off the screens