aegiscode 6.8.0 → 6.8.1

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
@@ -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 `aegiscodex-dev`'s:
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 `aegiscodex-dev` does. The registry is that client's, ported
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 `aegiscodex-dev`'s loop, ported rather than approximated: an
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 `aegiscodex-dev` on purpose.** The gold/coral/lavender palette,
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 `aegiscodex-dev`
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 `aegiscodex-dev`'s, ported.** Names, aliases,
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.0",
4
+ "version": "6.8.1",
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
@@ -79,6 +79,28 @@ const WHATS_NEW = [
79
79
  ' /release-notes for more',
80
80
  ];
81
81
 
82
+ /**
83
+ * The connect block — the two ways to power this client, plus the one-line
84
+ * answer to "why would I want the app". Shown under the boxes on the welcome
85
+ * screen, in place of the desktop host's welcome panel (BYOK + AEGIS Cloud).
86
+ *
87
+ * It is two plain rows and not a third box, and the reason is the same row
88
+ * budget `WHATS_NEW` is held to: at 80×24 the rule, mark, title, tagline and
89
+ * the Tips/What's-new pair already come to 21 of the 23 usable rows, so a
90
+ * boxed third panel (three rows minimum, two of them rules) would push the
91
+ * footer hint off the bottom of the commonest terminal there is. Two rows fit
92
+ * exactly, one route each, and the desktop line shares the second.
93
+ *
94
+ * Both commands named here are real registry entries — `/byok-key` saves a
95
+ * provider key, `/key` saves the AEGIS account key — and the URL is the same
96
+ * `aegiscloud.org` the key screen and `/cloud` panels already point at. Nothing
97
+ * here is a URL or a command that only exists in this comment.
98
+ */
99
+ const CONNECT = [
100
+ 'Your key, your bill: /byok-key <provider> — or AEGIS Cloud, /key',
101
+ 'AEGIS Desktop: same engine in a window, on your machine — aegiscloud.org',
102
+ ];
103
+
82
104
  /** Centre a plain string, returning one span line. Clip first, or a string
83
105
  * wider than the terminal produces a row that wraps and shears the frame. */
84
106
  function centered(text, cols, style) {
@@ -312,6 +334,13 @@ function welcomeLines(ctx, cols, rows, firstRun = true) {
312
334
 
313
335
  lines.push(...boxes(t, cols, rows - lines.length - 4));
314
336
  lines.push([span('', '')]);
337
+ // The connect block, before the footer hint and only while the machine
338
+ // holds no account key. `wrapped` splits rather than clips, so a narrow
339
+ // terminal gets four short rows instead of two sheared ones; the height
340
+ // budget is unaffected at 80×24, where each line still fits on one row.
341
+ if (connectNeeded()) {
342
+ for (const text of CONNECT) lines.push(...wrapped(text, cols, t.white, 1));
343
+ }
315
344
  lines.push([span(t.gray, GLYPH.hint), span(t.white, ' Try "write a test for <filepath>"')]);
316
345
  while (lines.length < rows - 1) lines.push([span('', '')]);
317
346
  return lines;
@@ -413,6 +442,26 @@ function make(style, text) {
413
442
  return sp;
414
443
  }
415
444
 
445
+ /**
446
+ * Whether the welcome screen should still pitch the two connect routes.
447
+ *
448
+ * Once an AEGIS account key is on this machine the user has already taken one
449
+ * of them, and two rows repeating what they just did is nagging, not
450
+ * onboarding — the same rule the desktop host applies to its welcome panel.
451
+ *
452
+ * A read that fails (no credentials file, an unreadable one) resolves to
453
+ * "show it": the block is exactly what a user with no key needs, and a
454
+ * failed status read must never be the reason a new install is told nothing
455
+ * about how to start.
456
+ */
457
+ function connectNeeded() {
458
+ try {
459
+ return !credentials.keyStatus().configured;
460
+ } catch {
461
+ return true;
462
+ }
463
+ }
464
+
416
465
  /**
417
466
  * The welcome screen. Enter or Esc continues into the session; ctrl+c/d is the
418
467
  * user asking to leave, which is returned to the caller as `{ exit: true }`
@@ -637,6 +686,8 @@ module.exports = {
637
686
  PRODUCT,
638
687
  TIPS,
639
688
  WHATS_NEW,
689
+ CONNECT,
690
+ connectNeeded,
640
691
  trustLines,
641
692
  themePickerLines,
642
693
  keyLines,
@@ -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
- const base = Number(requestedMs) > 0 ? Number(requestedMs) : SSE_IDLE_TIMEOUT_MS;
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
- return header && String(header).trim() ? Math.max(base, BRAIN_IDLE_TIMEOUT_MS) : base;
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 };