aegisone 1.0.5 → 1.0.8
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/bin/aegis.js +28 -3
- package/package.json +1 -1
- package/scripts/predist.mjs +230 -0
- package/src/permissions.js +134 -7
- package/src/release.js +14 -5
- package/vendor/cli/README.md +42 -3
- package/vendor/cli/bin/aegiscode.js +15 -3
- package/vendor/cli/package.json +1 -1
- package/vendor/cli/src/app.js +167 -37
- package/vendor/cli/src/chatflow.js +285 -39
- package/vendor/cli/src/commands.js +251 -30
- package/vendor/cli/src/config.js +41 -11
- package/vendor/cli/src/engine.js +33 -4
- package/vendor/cli/src/entitlement.js +30 -1
- package/vendor/cli/src/format.js +175 -3
- package/vendor/cli/src/overlays.js +13 -9
- package/vendor/cli/src/panels.js +19 -6
- package/vendor/cli/src/render.js +49 -14
- package/vendor/cli/src/screen.js +12 -1
- package/vendor/cli/src/screens.js +118 -25
- package/vendor/cli/src/todos.js +7 -4
- package/vendor/cli/src/tokens.js +31 -1
- package/vendor/cli/vendor/client/aegis.js +22 -0
- package/vendor/cli/vendor/client/byok-catalog.js +43 -8
- package/vendor/cli/vendor/client/user-models.js +378 -0
- package/vendor/cli/vendor/desktop/lib/local/autonomous.js +81 -0
- package/vendor/cli/vendor/desktop/lib/local/engine.js +447 -14
- package/vendor/cli/vendor/desktop/renderer/usage.js +274 -21
- package/vendor/cli/vendor/mcp/tools.js +1 -1
- package/vendor/desktop/README.md +11 -0
- package/vendor/desktop/lib/deep-link.js +35 -1
- package/vendor/desktop/lib/local/autonomous.js +81 -0
- package/vendor/desktop/lib/local/engine.js +447 -14
- package/vendor/desktop/main.js +271 -6
- package/vendor/desktop/package.json +1 -1
- package/vendor/desktop/preload.js +18 -0
- package/vendor/desktop/renderer/app.js +631 -43
- package/vendor/desktop/renderer/index.html +4 -5
- package/vendor/desktop/renderer/stream-policy.js +24 -2
- package/vendor/desktop/renderer/style.css +81 -7
- package/vendor/desktop/renderer/usage.js +274 -21
- package/vendor/desktop/vendor/aegis.js +22 -0
- package/vendor/desktop/vendor/byok-catalog.js +43 -8
- package/vendor/desktop/vendor/user-models.js +378 -0
|
@@ -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/vendor/cli/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aegiscode",
|
|
3
3
|
"productName": "AEGIS Code",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "7.0.0",
|
|
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/vendor/cli/src/app.js
CHANGED
|
@@ -21,11 +21,15 @@
|
|
|
21
21
|
const readline = require('node:readline');
|
|
22
22
|
const os = require('node:os');
|
|
23
23
|
const { randomUUID } = require('node:crypto');
|
|
24
|
-
const { createTools, createClient, usageTokens, usageBuckets, buildSystemPrompt, autoProvisionApiKey, hostEnv } = require('./deps.js');
|
|
25
|
-
const { createEngine, HOST_CLASSES, DEFAULT_CLASS, byokNamespace } = require('./engine.js');
|
|
24
|
+
const { createTools, createClient, usageTokens, usageBuckets, buildSystemPrompt, autoProvisionApiKey, hostEnv, autonomous } = require('./deps.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,12 +168,38 @@ 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;
|
|
177
|
+
// ── Auto mode's session start state ────────────────────────────────────────
|
|
178
|
+
// The upstream engine (aegiscodex-dev src/autonomous.js) starts an attended
|
|
179
|
+
// session in auto mode unless AEGIS_AUTO_ROUNDS=0 (false/off/no), and the
|
|
180
|
+
// `←`/`→` chord toggles it freely from there: the env var is a STARTING
|
|
181
|
+
// POINT, not a veto. Same contract here, held in a local rather than
|
|
182
|
+
// re-derived per call, because the two are not the same statement:
|
|
183
|
+
//
|
|
184
|
+
// · re-deriving the env var on every read (a `!autoRoundsDefault(env)`
|
|
185
|
+
// guard inside isYolo) makes the opt-out absolute — `/automode on`,
|
|
186
|
+
// the `→` chord and the window's switch all become no-ops that still
|
|
187
|
+
// write the shared posture OFF, so the CLI chip reads "manual mode on"
|
|
188
|
+
// while the desktop's approvals are off. That is the three-surfaces
|
|
189
|
+
// drift (command, store, engine) this file exists to prevent,
|
|
190
|
+
// reintroduced by an environment variable.
|
|
191
|
+
// · a session flag honours the operator's "start me in manual" without
|
|
192
|
+
// disarming the toggle.
|
|
193
|
+
//
|
|
194
|
+
// `/automode on|off` moves it (commands.js writes `setAutoRounds`), so the
|
|
195
|
+
// chord stays live in both directions and the posture keeps exactly one home.
|
|
196
|
+
let autoRoundsSession = (() => {
|
|
197
|
+
try {
|
|
198
|
+
return autonomous.autoRoundsDefault(process.env);
|
|
199
|
+
} catch {
|
|
200
|
+
return true;
|
|
201
|
+
}
|
|
202
|
+
})();
|
|
162
203
|
const engine =
|
|
163
204
|
options.engine ||
|
|
164
205
|
createEngine({
|
|
@@ -203,7 +244,7 @@ function createApp(options = {}) {
|
|
|
203
244
|
// ON8 / D8 rule 1: the posture is read from the SHARED store first
|
|
204
245
|
// (config.js confirmPosture), which is the same store the desktop's
|
|
205
246
|
// "confirm before running tools" switch writes. Before this, the shell
|
|
206
|
-
// read only its own rule file, so the switch and `/
|
|
247
|
+
// read only its own rule file, so the switch and `/automode` were two
|
|
207
248
|
// postures for one question — the drift D8 names. The rule file is
|
|
208
249
|
// still the answer for an install that never touched the switch, so
|
|
209
250
|
// nothing changes for it.
|
|
@@ -239,10 +280,12 @@ function createApp(options = {}) {
|
|
|
239
280
|
// the one class an account key alone can run — BYOK additionally needs a
|
|
240
281
|
// provider key, so defaulting to it would break a fresh install.
|
|
241
282
|
modelClass: DEFAULT_CLASS,
|
|
242
|
-
//
|
|
243
|
-
//
|
|
244
|
-
//
|
|
245
|
-
//
|
|
283
|
+
// The budget rung the next turn travels with. `null` here means "nothing
|
|
284
|
+
// restored yet", not "auto": the rung actually sent is resolved by
|
|
285
|
+
// effortRung() at the request, which floors to 'high' — the same default
|
|
286
|
+
// the config file seeds and the desktop select offers. Retiring "auto" is
|
|
287
|
+
// the point: it was the default, so the default turn sent no effort at all
|
|
288
|
+
// and low/medium/high only moved the status line.
|
|
246
289
|
effort: null,
|
|
247
290
|
thinking: false,
|
|
248
291
|
// Deep recall (`aegis_recall_deep`) — the metered tier of the read: brain
|
|
@@ -826,7 +869,19 @@ function createApp(options = {}) {
|
|
|
826
869
|
tick: tick++,
|
|
827
870
|
verb,
|
|
828
871
|
elapsedMs: Date.now() - started,
|
|
829
|
-
|
|
872
|
+
// `chars` accumulates `w(chunk.delta)` — a display width, not a token
|
|
873
|
+
// count — and render.js prints this field as `↓N tokens`. Converted at
|
|
874
|
+
// the producer so both spinner renderers receive the same unit.
|
|
875
|
+
//
|
|
876
|
+
// `+ reasoning` because the live figure is the turn's BILLED output:
|
|
877
|
+
// the answer plus the thinking trace it is charged for, which is what
|
|
878
|
+
// the desktop's bubble sums (`desktop/renderer/app.js`: reply +
|
|
879
|
+
// reasoning cells at this same ratio). Reasoning is accumulated in its
|
|
880
|
+
// own variable above so the "reasoned but wrote nothing" case stays
|
|
881
|
+
// distinguishable — but leaving it out of the figure here stalled the
|
|
882
|
+
// spinner on `↓0 tokens` for the whole thinking phase of every turn,
|
|
883
|
+
// which is the row that exists to show the turn is moving.
|
|
884
|
+
streamed: estimateTokensFromCells(chars + reasoning),
|
|
830
885
|
}),
|
|
831
886
|
]);
|
|
832
887
|
};
|
|
@@ -904,11 +959,18 @@ function createApp(options = {}) {
|
|
|
904
959
|
const denyNoPrompter = (info) => {
|
|
905
960
|
err.write(
|
|
906
961
|
`aegiscode: ${info.tool} needs confirmation but this run has no prompt for it — denied ` +
|
|
907
|
-
'(pass --yolo to auto-approve mutating tools).\n'
|
|
962
|
+
'(pass --automode (alias --yolo) to auto-approve mutating tools).\n'
|
|
908
963
|
);
|
|
909
964
|
return Promise.resolve('deny');
|
|
910
965
|
};
|
|
911
966
|
|
|
967
|
+
// The round-horizon ask's own no-one-to-answer fallback. Unreachable in
|
|
968
|
+
// practice — `roundsAsk` below is only sent `true` when `p.rounds` exists,
|
|
969
|
+
// so the engine never raises the ask without a prompter — but kept so a
|
|
970
|
+
// future caller that forgets the guard fails safe (stop) instead of
|
|
971
|
+
// hanging the tool loop on an unanswerable promise.
|
|
972
|
+
const denyRoundsNoPrompter = () => Promise.resolve(false);
|
|
973
|
+
|
|
912
974
|
// Vocabulary bridging lives at module scope (see normalizeDecision) so the
|
|
913
975
|
// same function the tests import is the one the live path calls.
|
|
914
976
|
const onDelta = (chunk) => {
|
|
@@ -941,6 +1003,14 @@ function createApp(options = {}) {
|
|
|
941
1003
|
.catch(() => 'deny')
|
|
942
1004
|
.then((decision) => engine.respondApproval(info.id, normalizeDecision(decision)));
|
|
943
1005
|
}
|
|
1006
|
+
if (chunk.rounds) {
|
|
1007
|
+
const info = chunk.rounds;
|
|
1008
|
+
if (live) live.clear();
|
|
1009
|
+
const decide = p.rounds || denyRoundsNoPrompter;
|
|
1010
|
+
Promise.resolve(decide(info))
|
|
1011
|
+
.catch(() => false)
|
|
1012
|
+
.then((decision) => engine.respondRoundsAsk(info.id, decision === true));
|
|
1013
|
+
}
|
|
944
1014
|
};
|
|
945
1015
|
|
|
946
1016
|
try {
|
|
@@ -956,14 +1026,16 @@ function createApp(options = {}) {
|
|
|
956
1026
|
// to use them.
|
|
957
1027
|
system: opts.system || defaultSystemPrompt(),
|
|
958
1028
|
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
|
-
|
|
1029
|
+
// `effort` is the budget rung, and it travels on EVERY turn for every
|
|
1030
|
+
// model — this host only ever runs the 'aegis' class, whose calls are
|
|
1031
|
+
// sized server-side from it (aegis1 services/pool_brain.py), and BYOK
|
|
1032
|
+
// turns translate it per vendor in cli/src/engine.js. A stored `null`
|
|
1033
|
+
// or a value this build no longer offers resolves to `high` — the
|
|
1034
|
+
// same rung the desktop and the engine apply — instead of being
|
|
1035
|
+
// omitted, because omitting it was the defect: `auto` was the
|
|
1036
|
+
// default, so nothing reached the wire and the levels changed the
|
|
1037
|
+
// status line and nothing else.
|
|
1038
|
+
effort: effortRung(commandCtx.effort),
|
|
967
1039
|
// The deep-recall opt-in travels only when this session turned it on
|
|
968
1040
|
// (`/memory-deep on`). Sent as a literal `true` or not at all: the
|
|
969
1041
|
// engine treats anything but `true` as off, and an omitted field is
|
|
@@ -973,6 +1045,11 @@ function createApp(options = {}) {
|
|
|
973
1045
|
// `--no-stream` and piped runs get a single body rather than SSE.
|
|
974
1046
|
stream: commandCtx.stream !== false,
|
|
975
1047
|
sessionId,
|
|
1048
|
+
// Opt-in to the round-horizon dialog (see engine.js requestRoundsAsk)
|
|
1049
|
+
// only when there is actually a `rounds` prompter to answer it — a
|
|
1050
|
+
// one-shot `-p` run or any other caller with no presenter keeps the
|
|
1051
|
+
// engine's old stop-and-record-session behaviour untouched.
|
|
1052
|
+
roundsAsk: Boolean(p.rounds),
|
|
976
1053
|
},
|
|
977
1054
|
onDelta
|
|
978
1055
|
);
|
|
@@ -1080,13 +1157,19 @@ function createApp(options = {}) {
|
|
|
1080
1157
|
meta: {
|
|
1081
1158
|
model: res.model,
|
|
1082
1159
|
tokens,
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1160
|
+
// Folded through the SHARED normaliser, for the same reason recordTurn
|
|
1161
|
+
// is (see its comment): the providers do not merely spell these fields
|
|
1162
|
+
// differently, they MEASURE them differently. Anthropic's `input_tokens`
|
|
1163
|
+
// EXCLUDES `cache_read_input_tokens`; OpenAI's and DeepSeek's
|
|
1164
|
+
// `prompt_tokens` INCLUDES `prompt_cache_hit_tokens`. Reading the raw
|
|
1165
|
+
// field here therefore printed the WHOLE prompt as fresh input on a
|
|
1166
|
+
// cached turn — the cache-hit half restated at miss price, in the one
|
|
1167
|
+
// row a user reads immediately after every turn. That is precisely the
|
|
1168
|
+
// "the CLI's live tally disagrees with its own ledger about the same
|
|
1169
|
+
// turn" defect recordTurn's comment names; this call site was the one
|
|
1170
|
+
// it did not cover, and it is why the CLI's per-turn token readout ran
|
|
1171
|
+
// far above the engine's for the same turn on the same model.
|
|
1172
|
+
usage: res.usage == null ? null : usageBuckets(res.usage),
|
|
1090
1173
|
// What this call settled at, from the ledger row it produced — the
|
|
1091
1174
|
// number that has to agree with the token count beside it.
|
|
1092
1175
|
eur: settledCost,
|
|
@@ -1333,6 +1416,16 @@ function createApp(options = {}) {
|
|
|
1333
1416
|
render: () => {},
|
|
1334
1417
|
openOverlay: (o) => openOverlay(o),
|
|
1335
1418
|
closeOverlay: () => {},
|
|
1419
|
+
// Auto mode's session switch, written by `/automode on|off` (commands.js)
|
|
1420
|
+
// and read by makeHost's isYolo. It lives on the context for the same
|
|
1421
|
+
// reason `switchClass` does: the command must move the fact the status
|
|
1422
|
+
// line, the round-budget allowance and the approval gate all read, or the
|
|
1423
|
+
// command is cosmetic. See the session flag's comment near createApp's
|
|
1424
|
+
// gate wiring for why AEGIS_AUTO_ROUNDS=0 is a starting point and not a
|
|
1425
|
+
// veto.
|
|
1426
|
+
setAutoRounds: (v) => {
|
|
1427
|
+
autoRoundsSession = Boolean(v);
|
|
1428
|
+
},
|
|
1336
1429
|
askInput: () => Promise.resolve(null),
|
|
1337
1430
|
withWorking: (fn) => withWorking(fn),
|
|
1338
1431
|
runPrompt: (text) => runPrompt(text),
|
|
@@ -1355,6 +1448,11 @@ function createApp(options = {}) {
|
|
|
1355
1448
|
// The class surface: /class switches, /models lists for whichever class
|
|
1356
1449
|
// is live (the frozen state carries the current one as c.ctx.modelClass).
|
|
1357
1450
|
listModelsFor: (cls) => listModelsFor(cls),
|
|
1451
|
+
// Re-read the byok rows NOW, past the 5-minute cache. `/model-add` writes
|
|
1452
|
+
// the user-model file and then asks for this, because a picker that
|
|
1453
|
+
// answers from a cache older than the file it just wrote would report the
|
|
1454
|
+
// model it was told to add as missing — for five minutes.
|
|
1455
|
+
refreshByokModels: () => loadByokModels({ force: true }),
|
|
1358
1456
|
switchClass: (cls) => switchClass(cls),
|
|
1359
1457
|
classLabel: (cls) => classLabelOf(cls),
|
|
1360
1458
|
classes: () => (typeof engine.listClasses === 'function' ? engine.listClasses() : []),
|
|
@@ -1595,7 +1693,7 @@ function createApp(options = {}) {
|
|
|
1595
1693
|
out.write(
|
|
1596
1694
|
t.dim + GLYPH.hook + ' ' + t.blue + (res.model || 'aegis') + RESET +
|
|
1597
1695
|
t.dim + ' ' + GLYPH.bullet + ' ' + RESET +
|
|
1598
|
-
t.white + `${fmtTokens(tokens)}
|
|
1696
|
+
t.white + `${fmtTokens(tokens)} tokens` + RESET + '\n'
|
|
1599
1697
|
);
|
|
1600
1698
|
}
|
|
1601
1699
|
}
|
|
@@ -1797,12 +1895,30 @@ function createApp(options = {}) {
|
|
|
1797
1895
|
}
|
|
1798
1896
|
|
|
1799
1897
|
/** One line of session accounting, for ctrl+t and the meta row. */ function tokenSummary() {
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1898
|
+
// Output only, the same rule as the meta row this lands in (see format.js's
|
|
1899
|
+
// `fmtUsageSplit`): the input half is the prompt restated and the one figure
|
|
1900
|
+
// a reader cannot act on. A session that recorded no output figure at all
|
|
1901
|
+
// falls back to its total, because stating what was measured beats stating
|
|
1902
|
+
// nothing — and `0 tokens` is refused for the reason `fmtRoll` refuses
|
|
1903
|
+
// `0 tokens`: it states a figure the provider never reported. The label is
|
|
1904
|
+
// `tokens`, the word `fmtUsageSplit` puts on the same figure in the meta row
|
|
1905
|
+
// this shares a slot with: `in`/`out` is a status-line shorthand of this
|
|
1906
|
+
// CLI's own invention, and a reader who has to be told it reads `out` as
|
|
1907
|
+
// something dropped.
|
|
1908
|
+
const produced = session.outputTokens > 0
|
|
1909
|
+
? `${fmtTokens(session.outputTokens)} tokens`
|
|
1910
|
+
: `${fmtTokens(session.tokens)} tokens`;
|
|
1911
|
+
// Tokens and calls always; money only on a tier AEGIS PROVES a fee is owed
|
|
1912
|
+
// to. Same rule as the meta row and the desktop's topbar roll
|
|
1913
|
+
// (`feeBillable`) — on Unlimited or a welcome trial there is no per-turn
|
|
1914
|
+
// charge and no bank draw, so a `€0.0031` and a `balance` figure here would
|
|
1915
|
+
// be two prices for a session that has none.
|
|
1916
|
+
const parts = [produced, `${session.calls} call${session.calls === 1 ? '' : 's'}`];
|
|
1917
|
+
if (feeBillable()) {
|
|
1918
|
+
parts.push(fmtEur(session.cost));
|
|
1919
|
+
if (session.balance != null) parts.push(`balance ${fmtEur(session.balance)}`);
|
|
1920
|
+
}
|
|
1921
|
+
return parts.join(' · ');
|
|
1806
1922
|
}
|
|
1807
1923
|
|
|
1808
1924
|
/** Load a stored session back into the live transcript. */
|
|
@@ -1878,6 +1994,12 @@ function createApp(options = {}) {
|
|
|
1878
1994
|
},
|
|
1879
1995
|
wantsExit: () => wantExit,
|
|
1880
1996
|
isYolo: () => {
|
|
1997
|
+
// Both halves, in the order the desktop host reads them
|
|
1998
|
+
// (main.js autoRoundsOn): "this session runs auto mode" AND "the
|
|
1999
|
+
// stored posture says don't ask". The first is the session flag above
|
|
2000
|
+
// — `AEGIS_AUTO_ROUNDS=0` starts manual, and `/automode on` (or the
|
|
2001
|
+
// `→` chord, which dispatches exactly that) turns it back on.
|
|
2002
|
+
if (!autoRoundsSession) return false;
|
|
1881
2003
|
try {
|
|
1882
2004
|
// The posture, not the rule file: since ON8 the window's switch is the
|
|
1883
2005
|
// same fact, so a switch turned off there lights this chip too.
|
|
@@ -1886,6 +2008,12 @@ function createApp(options = {}) {
|
|
|
1886
2008
|
return false;
|
|
1887
2009
|
}
|
|
1888
2010
|
},
|
|
2011
|
+
// `/automode on|off` moves the session flag the predicate above reads, so
|
|
2012
|
+
// the command and the chip can never disagree — and an env opt-out is
|
|
2013
|
+
// escapable at the prompt instead of for the life of the process.
|
|
2014
|
+
setAutoRounds: (v) => {
|
|
2015
|
+
autoRoundsSession = Boolean(v);
|
|
2016
|
+
},
|
|
1889
2017
|
};
|
|
1890
2018
|
}
|
|
1891
2019
|
|
|
@@ -1951,9 +2079,11 @@ function createApp(options = {}) {
|
|
|
1951
2079
|
// pin check right after this reads whichever class won.
|
|
1952
2080
|
if (HOST_CLASSES.includes(cfg.modelClass)) commandCtx.modelClass = cfg.modelClass;
|
|
1953
2081
|
if (!opts.model && cfg.model) commandCtx.model = cfg.model;
|
|
1954
|
-
//
|
|
1955
|
-
//
|
|
1956
|
-
|
|
2082
|
+
// Restored through effortRung(), so a config written by an older build is
|
|
2083
|
+
// never a value this one does not send: `null`, `''` and the retired
|
|
2084
|
+
// `'auto'` all come back as 'high' — the same rung the request would have
|
|
2085
|
+
// carried had the key been missing from the file entirely.
|
|
2086
|
+
commandCtx.effort = effortRung(cfg.effort);
|
|
1957
2087
|
if (typeof cfg.vim === 'boolean') commandCtx.vim = cfg.vim;
|
|
1958
2088
|
if (cfg.lastRecap) commandCtx.lastRecap = cfg.lastRecap;
|
|
1959
2089
|
// THEME_TABLE lives in theme.js, not screens.js: reading it off the screens
|