aegiscode 6.8.0 → 6.8.2
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 +16 -6
- package/package.json +1 -1
- package/src/screens.js +84 -0
- package/vendor/client/aegis.js +45 -2
package/README.md
CHANGED
|
@@ -180,7 +180,7 @@ The same axes are settable by environment for scripts and CI: `AEGIS_ART`,
|
|
|
180
180
|
## First run
|
|
181
181
|
|
|
182
182
|
A genuine first run walks the reference's onboarding before the session starts —
|
|
183
|
-
the order is
|
|
183
|
+
the order is the reference's:
|
|
184
184
|
|
|
185
185
|
```
|
|
186
186
|
────────────────────────────────────────────────────────────────────────────────
|
|
@@ -215,7 +215,7 @@ launch, and an explicit flag (`-m`, `--light`) always outranks the stored value.
|
|
|
215
215
|
## Commands
|
|
216
216
|
|
|
217
217
|
In a session, plain text is a prompt. `/help` lists commands, grouped by
|
|
218
|
-
category, the way
|
|
218
|
+
category, the way the reference does. The registry is that client's, ported
|
|
219
219
|
command for command — 75 entries across nine categories:
|
|
220
220
|
|
|
221
221
|
| Category | Commands |
|
|
@@ -251,6 +251,7 @@ Three layers, from broadest to narrowest. You only need the first one.
|
|
|
251
251
|
/class # show the picker
|
|
252
252
|
/class aegis # pooled AEGIS Cloud (the default)
|
|
253
253
|
/class byok # your own provider key, relayed by AEGIS
|
|
254
|
+
/class local # a model on your own machine or network (free)
|
|
254
255
|
```
|
|
255
256
|
|
|
256
257
|
A class is *whose credential pays and who talks to the vendor*, not a model.
|
|
@@ -262,6 +263,15 @@ restart.
|
|
|
262
263
|
|---|---|---|
|
|
263
264
|
| `aegis` *(default)* | the AEGIS pool — one id, `nexus-brain` (alias `aegis-brain`), auto-routed server-side across whichever providers are live | your AEGIS account balance |
|
|
264
265
|
| `byok` | your provider key, relayed via `POST /api/v1/byok/chat/completions` | your provider direct, **plus** a small AEGIS handling fee on your account |
|
|
266
|
+
| `local` | a model on your own machine or network — your Ollama daemon at `http://localhost:11434` by default, keyless; any OpenAI-compatible server on that box works | nobody — free; there is no vendor to bill |
|
|
267
|
+
|
|
268
|
+
`local` never leaves your own network: it dials a model on your machine or your
|
|
269
|
+
LAN, and is refused fail-closed if the endpoint is not local — the check runs
|
|
270
|
+
when the base URL is saved and again before a request is dialled
|
|
271
|
+
(`desktop/lib/local/local.js` → `remoteRefusal`). The generic *remote*
|
|
272
|
+
custom-endpoint lanes (an arbitrary remote OpenAI- or Anthropic-compatible URL)
|
|
273
|
+
do not exist here; any OpenAI-compatible server on that box — llama.cpp, LM
|
|
274
|
+
Studio, vLLM — works by pointing the base URL at it.
|
|
265
275
|
|
|
266
276
|
**2. The model id — what to pin.**
|
|
267
277
|
|
|
@@ -510,7 +520,7 @@ either runs or is a real handler that says honestly what it cannot do.
|
|
|
510
520
|
|
|
511
521
|
## The chatflow
|
|
512
522
|
|
|
513
|
-
The session is
|
|
523
|
+
The session is the reference's loop, ported rather than approximated: an
|
|
514
524
|
alternate-screen frame of header rule, transcript viewport, spinner/effort line,
|
|
515
525
|
input line and status line, driven by a raw key stream.
|
|
516
526
|
|
|
@@ -584,9 +594,9 @@ node cli/scripts/demo.mjs # from a source checkout
|
|
|
584
594
|
|
|
585
595
|
## Design notes
|
|
586
596
|
|
|
587
|
-
**It looks like
|
|
597
|
+
**It looks like the reference on purpose.** The gold/coral/lavender palette,
|
|
588
598
|
the `✦`-studded welcome mark (mascot, crescent moon and diving whale), the `❯`
|
|
589
|
-
prompt, the `⎿` hook rows and the `✻` spinner line are the
|
|
599
|
+
prompt, the `⎿` hook rows and the `✻` spinner line are the reference's
|
|
590
600
|
design system, adopted wholesale rather than approximated: the palette, glyphs,
|
|
591
601
|
welcome art, working verbs and command vocabulary all come from it, and
|
|
592
602
|
`test/cli-conformance.test.mjs` pins every RGB triple, glyph, spinner frame, verb
|
|
@@ -601,7 +611,7 @@ Anywhere else — a pipe, `-p`, CI — turns are written once to the scrollback
|
|
|
601
611
|
instead, so output stays selectable, searchable and pipeable. A tool you script
|
|
602
612
|
should not become un-scriptable because the interactive mode got nicer.
|
|
603
613
|
|
|
604
|
-
**The command registry is
|
|
614
|
+
**The command registry is the reference's, ported.** Names, aliases,
|
|
605
615
|
categories, the palette grouping and the handlers themselves come from it, with
|
|
606
616
|
`test/cli-commands.test.mjs` asserting the full name list so a silent drop
|
|
607
617
|
fails the build. Local capability that the reference has — a dev-server runner,
|
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.2",
|
|
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/screens.js
CHANGED
|
@@ -38,6 +38,7 @@ const render = require('./render.js');
|
|
|
38
38
|
const { updateConfig, configExists, loadConfig } = require('./config.js');
|
|
39
39
|
const { updateNotice, updateLine } = require('./update.js');
|
|
40
40
|
const credentials = require('./credentials.js');
|
|
41
|
+
const { createSettingsStore, isReservedNamespace } = require('./deps.js');
|
|
41
42
|
|
|
42
43
|
const VERSION = require('../package.json').version;
|
|
43
44
|
|
|
@@ -79,6 +80,28 @@ const WHATS_NEW = [
|
|
|
79
80
|
' /release-notes for more',
|
|
80
81
|
];
|
|
81
82
|
|
|
83
|
+
/**
|
|
84
|
+
* The connect block — the two ways to power this client, plus the one-line
|
|
85
|
+
* answer to "why would I want the app". Shown under the boxes on the welcome
|
|
86
|
+
* screen, in place of the desktop host's welcome panel (BYOK + AEGIS Cloud).
|
|
87
|
+
*
|
|
88
|
+
* It is two plain rows and not a third box, and the reason is the same row
|
|
89
|
+
* budget `WHATS_NEW` is held to: at 80×24 the rule, mark, title, tagline and
|
|
90
|
+
* the Tips/What's-new pair already come to 21 of the 23 usable rows, so a
|
|
91
|
+
* boxed third panel (three rows minimum, two of them rules) would push the
|
|
92
|
+
* footer hint off the bottom of the commonest terminal there is. Two rows fit
|
|
93
|
+
* exactly, one route each, and the desktop line shares the second.
|
|
94
|
+
*
|
|
95
|
+
* Both commands named here are real registry entries — `/byok-key` saves a
|
|
96
|
+
* provider key, `/key` saves the AEGIS account key — and the URL is the same
|
|
97
|
+
* `aegiscloud.org` the key screen and `/cloud` panels already point at. Nothing
|
|
98
|
+
* here is a URL or a command that only exists in this comment.
|
|
99
|
+
*/
|
|
100
|
+
const CONNECT = [
|
|
101
|
+
'Your key, your bill: /byok-key <provider> — or AEGIS Cloud, /key',
|
|
102
|
+
'AEGIS Desktop: same engine in a window, on your machine — aegiscloud.org',
|
|
103
|
+
];
|
|
104
|
+
|
|
82
105
|
/** Centre a plain string, returning one span line. Clip first, or a string
|
|
83
106
|
* wider than the terminal produces a row that wraps and shears the frame. */
|
|
84
107
|
function centered(text, cols, style) {
|
|
@@ -312,6 +335,13 @@ function welcomeLines(ctx, cols, rows, firstRun = true) {
|
|
|
312
335
|
|
|
313
336
|
lines.push(...boxes(t, cols, rows - lines.length - 4));
|
|
314
337
|
lines.push([span('', '')]);
|
|
338
|
+
// The connect block, before the footer hint and only while the machine
|
|
339
|
+
// holds no account key. `wrapped` splits rather than clips, so a narrow
|
|
340
|
+
// terminal gets four short rows instead of two sheared ones; the height
|
|
341
|
+
// budget is unaffected at 80×24, where each line still fits on one row.
|
|
342
|
+
if (connectNeeded()) {
|
|
343
|
+
for (const text of CONNECT) lines.push(...wrapped(text, cols, t.white, 1));
|
|
344
|
+
}
|
|
315
345
|
lines.push([span(t.gray, GLYPH.hint), span(t.white, ' Try "write a test for <filepath>"')]);
|
|
316
346
|
while (lines.length < rows - 1) lines.push([span('', '')]);
|
|
317
347
|
return lines;
|
|
@@ -413,6 +443,57 @@ function make(style, text) {
|
|
|
413
443
|
return sp;
|
|
414
444
|
}
|
|
415
445
|
|
|
446
|
+
/**
|
|
447
|
+
* Whether this machine holds a BYOK provider route of the user's own — the
|
|
448
|
+
* desktop host's `providerRouteConfigured()`, ported here because the CLI's
|
|
449
|
+
* `/byok-key <provider>` writes the exact same `byok:<provider>` row (see
|
|
450
|
+
* `engine.js`'s `byokNamespace`) into the exact same settings.json, and
|
|
451
|
+
* `connectNeeded()` below used to only ever check the AEGIS account key —
|
|
452
|
+
* so a CLI user who did BYOK and never touched the account key got the
|
|
453
|
+
* connect block re-pitched at them on every single launch.
|
|
454
|
+
*
|
|
455
|
+
* `settings.list()` goes through `get()`, which never puts a plaintext key on
|
|
456
|
+
* a row (only the `configured` boolean already derived from it) — that field
|
|
457
|
+
* is what a row counts on, not a `key` string that doesn't exist on it.
|
|
458
|
+
*
|
|
459
|
+
* Failure reads as "no configured route found", which keeps the block
|
|
460
|
+
* visible — same fail-toward-showing-it bias as the account-key read below.
|
|
461
|
+
*/
|
|
462
|
+
function providerRouteConfigured() {
|
|
463
|
+
try {
|
|
464
|
+
const store = createSettingsStore({ dir: credentials.aegisHome() });
|
|
465
|
+
return store.list().some((row) => {
|
|
466
|
+
if (!row || !row.provider || isReservedNamespace(row.provider)) return false;
|
|
467
|
+
const baseURL = typeof row.baseURL === 'string' ? row.baseURL.trim() : '';
|
|
468
|
+
return Boolean(row.configured || baseURL);
|
|
469
|
+
});
|
|
470
|
+
} catch {
|
|
471
|
+
return false;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
/**
|
|
476
|
+
* Whether the welcome screen should still pitch the two connect routes.
|
|
477
|
+
*
|
|
478
|
+
* Once an AEGIS account key is on this machine, or a BYOK provider route is
|
|
479
|
+
* configured, the user has already taken one of them, and two rows repeating
|
|
480
|
+
* what they just did is nagging, not onboarding — the same rule the desktop
|
|
481
|
+
* host applies to its welcome panel.
|
|
482
|
+
*
|
|
483
|
+
* A read that fails (no credentials file, an unreadable one) resolves to
|
|
484
|
+
* "show it": the block is exactly what a user with no key needs, and a
|
|
485
|
+
* failed status read must never be the reason a new install is told nothing
|
|
486
|
+
* about how to start.
|
|
487
|
+
*/
|
|
488
|
+
function connectNeeded() {
|
|
489
|
+
try {
|
|
490
|
+
if (providerRouteConfigured()) return false;
|
|
491
|
+
return !credentials.keyStatus().configured;
|
|
492
|
+
} catch {
|
|
493
|
+
return true;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
|
|
416
497
|
/**
|
|
417
498
|
* The welcome screen. Enter or Esc continues into the session; ctrl+c/d is the
|
|
418
499
|
* user asking to leave, which is returned to the caller as `{ exit: true }`
|
|
@@ -637,6 +718,9 @@ module.exports = {
|
|
|
637
718
|
PRODUCT,
|
|
638
719
|
TIPS,
|
|
639
720
|
WHATS_NEW,
|
|
721
|
+
CONNECT,
|
|
722
|
+
connectNeeded,
|
|
723
|
+
providerRouteConfigured,
|
|
640
724
|
trustLines,
|
|
641
725
|
themePickerLines,
|
|
642
726
|
keyLines,
|
package/vendor/client/aegis.js
CHANGED
|
@@ -46,6 +46,25 @@ function envVar(name) {
|
|
|
46
46
|
return v && !/^\$\{[A-Z_]+\}$/.test(v) ? v : '';
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
/**
|
|
50
|
+
* Read a positive millisecond count from the environment, or 0 for "unset".
|
|
51
|
+
*
|
|
52
|
+
* Used only for the two stream watchdogs below. Non-positive and unparseable
|
|
53
|
+
* values are IGNORED rather than honoured — deliberately not the rule the
|
|
54
|
+
* engine's host cooldown uses, where `AEGIS_HOST_COOLDOWN_MS=0` meaning "no
|
|
55
|
+
* cooldown" is a coherent thing to ask for. Here `0` would mean "the stream is
|
|
56
|
+
* dead before its first byte", which is a typo rather than a preference, and
|
|
57
|
+
* silently killing every turn is a far worse failure than ignoring a bad
|
|
58
|
+
* number. A test that genuinely wants a sub-second watchdog passes
|
|
59
|
+
* `idleTimeoutMs` per call (test/autonomous-mode.test.mjs does exactly that).
|
|
60
|
+
*/
|
|
61
|
+
function envIdleMs(name) {
|
|
62
|
+
const raw = envVar(name);
|
|
63
|
+
if (!raw) return 0;
|
|
64
|
+
const n = Number(raw);
|
|
65
|
+
return Number.isFinite(n) && n > 0 ? n : 0;
|
|
66
|
+
}
|
|
67
|
+
|
|
49
68
|
/**
|
|
50
69
|
* UUID v4 that works everywhere: Web Crypto first (browsers, Node ≥ 19),
|
|
51
70
|
* then Node's CJS crypto module (Node < 19), then a Math.random fallback for
|
|
@@ -895,9 +914,27 @@ const BRAIN_IDLE_TIMEOUT_MS = 15 * 60_000;
|
|
|
895
914
|
* that runs the fan-out, so a renamed brain id or a caller that forgot its
|
|
896
915
|
* flag cannot desynchronise the two. A response with no header (an older
|
|
897
916
|
* server, or a single-pass call) keeps the caller's budget or the 60s default.
|
|
917
|
+
*
|
|
918
|
+
* ── the two env knobs ───────────────────────────────────────────────────────
|
|
919
|
+
*
|
|
920
|
+
* `AEGIS_SSE_IDLE_TIMEOUT_MS` and `AEGIS_BRAIN_IDLE_TIMEOUT_MS` move those two
|
|
921
|
+
* *defaults* without a code edit: the CLI is a host, not a fork, so before this
|
|
922
|
+
* the only way to give a slow link more room — or to reproduce a stall against
|
|
923
|
+
* a fixed wedged server — was to patch the transport. Same escape hatch the
|
|
924
|
+
* engine gives its host cooldown (`AEGIS_HOST_COOLDOWN_MS`).
|
|
925
|
+
*
|
|
926
|
+
* Both are read at CALL time, not at module load, so a host that sets one after
|
|
927
|
+
* `require()` still gets it, and one that unsets it is back on the shipped
|
|
928
|
+
* default. A per-call `idleTimeoutMs` still outranks both: an explicit number
|
|
929
|
+
* from the caller is a decision about *this* request, while the env var is only
|
|
930
|
+
* a house default. See envIdleMs() for why a bad value is ignored rather than
|
|
931
|
+
* obeyed.
|
|
898
932
|
*/
|
|
899
933
|
function idleBudgetFor(res, requestedMs) {
|
|
900
|
-
|
|
934
|
+
// Caller override -> env knob -> shipped default.
|
|
935
|
+
const stated = Number(requestedMs);
|
|
936
|
+
const envDefault = envIdleMs('AEGIS_SSE_IDLE_TIMEOUT_MS');
|
|
937
|
+
const base = stated > 0 ? stated : envDefault > 0 ? envDefault : SSE_IDLE_TIMEOUT_MS;
|
|
901
938
|
let header = '';
|
|
902
939
|
try {
|
|
903
940
|
const get = res && res.headers && typeof res.headers.get === 'function' ? res.headers.get.bind(res.headers) : null;
|
|
@@ -905,7 +942,13 @@ function idleBudgetFor(res, requestedMs) {
|
|
|
905
942
|
} catch {
|
|
906
943
|
header = ''; // an exotic fetch shim without headers: keep the caller's budget
|
|
907
944
|
}
|
|
908
|
-
|
|
945
|
+
// The fan-out floor is tunable for the same reason the base is — and it has
|
|
946
|
+
// to stay a FLOOR: a server that announced workers=3 is still working, so a
|
|
947
|
+
// smaller base must not cut it off. Raise both if the server's own
|
|
948
|
+
// NEXUS_BRAIN_WORKER_TIMEOUT moves (test/autonomous-mode.test.mjs pins the
|
|
949
|
+
// 600s relationship between them).
|
|
950
|
+
const brainFloor = envIdleMs('AEGIS_BRAIN_IDLE_TIMEOUT_MS') || BRAIN_IDLE_TIMEOUT_MS;
|
|
951
|
+
return header && String(header).trim() ? Math.max(base, brainFloor) : base;
|
|
909
952
|
}
|
|
910
953
|
|
|
911
954
|
const api = { createClient, envVar, randomUUID, DEFAULT_API_BASE, CLIENT_VERSION, idleBudgetFor, SSE_IDLE_TIMEOUT_MS, BRAIN_IDLE_TIMEOUT_MS };
|