aegisone 1.0.6 → 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 +1 -1
- package/package.json +1 -1
- package/scripts/predist.mjs +2 -0
- package/src/release.js +14 -5
- package/vendor/cli/README.md +39 -1
- package/vendor/cli/package.json +1 -1
- package/vendor/cli/src/app.js +74 -1
- package/vendor/cli/src/chatflow.js +141 -1
- package/vendor/cli/src/commands.js +172 -1
- package/vendor/cli/src/engine.js +4 -2
- package/vendor/cli/src/screens.js +118 -25
- 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 +68 -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 +259 -6
- package/vendor/desktop/package.json +1 -1
- package/vendor/desktop/preload.js +18 -0
- package/vendor/desktop/renderer/app.js +395 -12
- package/vendor/desktop/renderer/index.html +2 -2
- package/vendor/desktop/renderer/style.css +32 -0
- package/vendor/desktop/renderer/usage.js +68 -1
- 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
package/vendor/cli/src/engine.js
CHANGED
|
@@ -71,8 +71,9 @@ const CLASS_LABELS = Object.freeze({
|
|
|
71
71
|
* (and by app.js, so one store serves both the engine and the commands);
|
|
72
72
|
* otherwise created against the CLI's data dir.
|
|
73
73
|
* @returns {{chat: Function, cancel: Function, respondApproval: Function,
|
|
74
|
-
*
|
|
75
|
-
* classLabel: Function, getClass: Function, setClass: Function,
|
|
74
|
+
* respondRoundsAsk: Function, clearSessionApprovals: Function, listClasses: Function,
|
|
75
|
+
* listModels: Function, classLabel: Function, getClass: Function, setClass: Function,
|
|
76
|
+
* settings: object}}
|
|
76
77
|
*/
|
|
77
78
|
function createEngine({ client, getConfirmMode, getClass, settings: injectedSettings } = {}) {
|
|
78
79
|
const settings = injectedSettings || createSettingsStore({ dir: credentials.aegisHome() });
|
|
@@ -114,6 +115,7 @@ function createEngine({ client, getConfirmMode, getClass, settings: injectedSett
|
|
|
114
115
|
chat,
|
|
115
116
|
cancel: local.cancel,
|
|
116
117
|
respondApproval: local.respondApproval,
|
|
118
|
+
respondRoundsAsk: local.respondRoundsAsk,
|
|
117
119
|
clearSessionApprovals: local.clearSessionApprovals,
|
|
118
120
|
// The engine's own class table, narrowed to the ones this host runs — so a
|
|
119
121
|
// UI built from listClasses() can never offer a class that would throw.
|
|
@@ -91,7 +91,15 @@ const WHATS_NEW = [
|
|
|
91
91
|
* the Tips/What's-new pair already come to 21 of the 23 usable rows, so a
|
|
92
92
|
* boxed third panel (three rows minimum, two of them rules) would push the
|
|
93
93
|
* footer hint off the bottom of the commonest terminal there is. Two rows fit
|
|
94
|
-
* exactly
|
|
94
|
+
* exactly: one route row, and the desktop line under it.
|
|
95
|
+
*
|
|
96
|
+
* WHICH route row is the part that matters, and it is composed by
|
|
97
|
+
* `connectRows()` below rather than being a constant, because the two routes
|
|
98
|
+
* have separate gates. They used to share a single one that short-circuited on
|
|
99
|
+
* the account key, so the `/byok-key` row disappeared the moment a user
|
|
100
|
+
* redeemed an AEGIS key — see `byokRouteNeeded()`. Holding the block to two
|
|
101
|
+
* rows is why the both-owed case merges the routes into one row again: at
|
|
102
|
+
* 80×24 a third row is the footer hint.
|
|
95
103
|
*
|
|
96
104
|
* Both commands named here are real registry entries — `/byok-key` saves a
|
|
97
105
|
* provider key, `/key` saves the AEGIS account key — and the URL is the shared
|
|
@@ -100,20 +108,65 @@ const WHATS_NEW = [
|
|
|
100
108
|
* which the bare `aegiscloud.org` this row used to print did not. Nothing here
|
|
101
109
|
* is a URL or a command that only exists in this comment.
|
|
102
110
|
*/
|
|
103
|
-
const
|
|
111
|
+
const CONNECT_BYOK = [
|
|
112
|
+
'Your own provider key: /byok-key <provider> — works with your AEGIS key',
|
|
113
|
+
];
|
|
114
|
+
|
|
115
|
+
// The AEGIS Cloud route. The URL in the desktop row below is the shared signup
|
|
116
|
+
// deep link from signup.js, not a hand-written one: it lands on the register
|
|
117
|
+
// panel with the key page queued behind it and the channel attached, which the
|
|
118
|
+
// bare `aegiscloud.org` that row used to print did not.
|
|
119
|
+
//
|
|
120
|
+
// The scheme-less form, and this is the only link in the CLI that uses it. The
|
|
121
|
+
// row's copy spends 45 of the 75 cells `wrapped()` allows at 80 columns
|
|
122
|
+
// (cols - 4 - indent), so `https://aegiscloud.org/key?s=cli` makes the row 77
|
|
123
|
+
// and wraps — a line the 80x24 screen does not have, because the connect
|
|
124
|
+
// block sits on row 21 of 23 and the row it pushes out is the footer hint.
|
|
125
|
+
// `s=cli` is the parameter that files the signup, so it is the scheme that
|
|
126
|
+
// goes, not the channel: see signup.js `signupDisplayUrl()`. Editing this copy
|
|
127
|
+
// means re-measuring; test/cli-onboarding.test.mjs fails on the row count if
|
|
128
|
+
// the row grows past the budget, and names the row that caused it.
|
|
129
|
+
const CONNECT_CLOUD = [
|
|
130
|
+
'AEGIS Cloud, one account key: /key — no provider signup',
|
|
131
|
+
];
|
|
132
|
+
|
|
133
|
+
// Both routes still owed (a fresh install): one row naming both, the original
|
|
134
|
+
// copy. Two rows is the whole budget, so this is not a third line — see the
|
|
135
|
+
// block comment above.
|
|
136
|
+
const CONNECT_BOTH = [
|
|
104
137
|
'Your key, your bill: /byok-key <provider> — or AEGIS Cloud, /key',
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
// and wraps — a line the 80x24 screen does not have, because the connect
|
|
109
|
-
// block sits on row 21 of 23 and the row it pushes out is the footer hint.
|
|
110
|
-
// `s=cli` is the parameter that files the signup, so it is the scheme that
|
|
111
|
-
// goes, not the channel: see signup.js `signupDisplayUrl()`. Editing this copy
|
|
112
|
-
// means re-measuring; test/cli-onboarding.test.mjs fails on the row count if
|
|
113
|
-
// the row grows past the budget, and names the row that caused it.
|
|
138
|
+
];
|
|
139
|
+
|
|
140
|
+
const CONNECT_DESKTOP = [
|
|
114
141
|
`AEGIS Desktop: same engine on your machine — ${signupDisplayUrl()}`,
|
|
115
142
|
];
|
|
116
143
|
|
|
144
|
+
/**
|
|
145
|
+
* The connect rows to draw, in order, for the machine as it stands now.
|
|
146
|
+
*
|
|
147
|
+
* `[]` means nothing to say — both routes are configured — and the caller then
|
|
148
|
+
* draws no block at all. Otherwise: one route row (both-owed merges into a
|
|
149
|
+
* single row, the 80×24 budget above, and the desktop pointer always shares
|
|
150
|
+
* the block with it).
|
|
151
|
+
*
|
|
152
|
+
* The gates are independent on purpose. An AEGIS key does not cancel the
|
|
153
|
+
* `/byok-key` row and a provider route does not cancel the `/key` row: the two
|
|
154
|
+
* are not alternatives, they are two ways in, and the row a user has already
|
|
155
|
+
* taken is the only one that may be dropped.
|
|
156
|
+
*/
|
|
157
|
+
function connectRows() {
|
|
158
|
+
const rows = [];
|
|
159
|
+
const byok = byokRouteNeeded();
|
|
160
|
+
const cloud = cloudRouteNeeded();
|
|
161
|
+
if (byok && cloud) rows.push(...CONNECT_BOTH);
|
|
162
|
+
else if (byok) rows.push(...CONNECT_BYOK);
|
|
163
|
+
else if (cloud) rows.push(...CONNECT_CLOUD);
|
|
164
|
+
// The desktop pointer is not a route, so it is not gated on one: whenever the
|
|
165
|
+
// block is drawn at all, the "why would I want the app" answer is in it.
|
|
166
|
+
if (rows.length) rows.push(...CONNECT_DESKTOP);
|
|
167
|
+
return rows;
|
|
168
|
+
}
|
|
169
|
+
|
|
117
170
|
/** Centre a plain string, returning one span line. Clip first, or a string
|
|
118
171
|
* wider than the terminal produces a row that wraps and shears the frame. */
|
|
119
172
|
function centered(text, cols, style) {
|
|
@@ -354,13 +407,14 @@ function welcomeLines(ctx, cols, rows, firstRun = true) {
|
|
|
354
407
|
|
|
355
408
|
lines.push(...boxes(t, cols, rows - lines.length - 4));
|
|
356
409
|
lines.push([span('', '')]);
|
|
357
|
-
// The connect block, before the footer hint
|
|
358
|
-
//
|
|
359
|
-
//
|
|
360
|
-
//
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
410
|
+
// The connect block, before the footer hint. The rows are composed by
|
|
411
|
+
// `connectRows()` — the two routes gate SEPARATELY, so an AEGIS-key holder
|
|
412
|
+
// with no provider route of their own is still told `/byok-key` exists,
|
|
413
|
+
// which is the whole point: holding an account key is not a reason to hide
|
|
414
|
+
// the bring-your-own-key route. `wrapped` splits rather than clips, so a
|
|
415
|
+
// narrow terminal gets short rows instead of sheared ones; the height budget
|
|
416
|
+
// is unaffected at 80×24, where each row still fits on one line.
|
|
417
|
+
for (const text of connectRows()) lines.push(...wrapped(text, cols, t.white, 1));
|
|
364
418
|
lines.push([span(t.gray, GLYPH.hint), span(t.white, ' Try "write a test for <filepath>"')]);
|
|
365
419
|
while (lines.length < rows - 1) lines.push([span('', '')]);
|
|
366
420
|
return lines;
|
|
@@ -492,12 +546,14 @@ function providerRouteConfigured() {
|
|
|
492
546
|
}
|
|
493
547
|
|
|
494
548
|
/**
|
|
495
|
-
* Whether the
|
|
549
|
+
* Whether ANY part of the connect block is still owed to this machine.
|
|
496
550
|
*
|
|
497
|
-
*
|
|
498
|
-
*
|
|
499
|
-
*
|
|
500
|
-
*
|
|
551
|
+
* It is the OR of the two route gates, and it is deliberately not the thing
|
|
552
|
+
* `welcomeLines` branches on any more: the rows are composed one at a time by
|
|
553
|
+
* `connectRows()`, so a machine that holds an AEGIS account key and no
|
|
554
|
+
* provider route still gets the `/byok-key` row. This helper is the coarse
|
|
555
|
+
* question ("is there anything left to say") — a caller that wants the rows
|
|
556
|
+
* should ask `connectRows()` instead.
|
|
501
557
|
*
|
|
502
558
|
* A read that fails (no credentials file, an unreadable one) resolves to
|
|
503
559
|
* "show it": the block is exactly what a user with no key needs, and a
|
|
@@ -506,7 +562,38 @@ function providerRouteConfigured() {
|
|
|
506
562
|
*/
|
|
507
563
|
function connectNeeded() {
|
|
508
564
|
try {
|
|
509
|
-
|
|
565
|
+
return byokRouteNeeded() || cloudRouteNeeded();
|
|
566
|
+
} catch {
|
|
567
|
+
return true;
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
/**
|
|
572
|
+
* The two halves of the connect block, gated SEPARATELY — this is the fix.
|
|
573
|
+
*
|
|
574
|
+
* They used to share one gate that short-circuited on the account key, so a
|
|
575
|
+
* user who redeemed an AEGIS key was never told BYOK exists at all: the row
|
|
576
|
+
* naming `/byok-key` was retired at the exact moment they had an account and
|
|
577
|
+
* were most likely to want a provider route of their own (unlimited/no relay
|
|
578
|
+
* billing, a model the pool does not carry). An account key and a provider
|
|
579
|
+
* route are not alternatives — `/byok-key` works alongside one — so the BYOK
|
|
580
|
+
* row is now gated on the BYOK route alone and an AEGIS-key holder still
|
|
581
|
+
* reads it. The Cloud row keeps the old account-key gate, because that is the
|
|
582
|
+
* thing it pitches.
|
|
583
|
+
*
|
|
584
|
+
* Both reads fail toward SHOWING the row: a failed status read must never be
|
|
585
|
+
* the reason a new install is told nothing about how to start.
|
|
586
|
+
*/
|
|
587
|
+
function byokRouteNeeded() {
|
|
588
|
+
try {
|
|
589
|
+
return !providerRouteConfigured();
|
|
590
|
+
} catch {
|
|
591
|
+
return true;
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
function cloudRouteNeeded() {
|
|
596
|
+
try {
|
|
510
597
|
return !credentials.keyStatus().configured;
|
|
511
598
|
} catch {
|
|
512
599
|
return true;
|
|
@@ -754,8 +841,14 @@ module.exports = {
|
|
|
754
841
|
PRODUCT,
|
|
755
842
|
TIPS,
|
|
756
843
|
WHATS_NEW,
|
|
757
|
-
|
|
844
|
+
CONNECT_BYOK,
|
|
845
|
+
CONNECT_CLOUD,
|
|
846
|
+
CONNECT_BOTH,
|
|
847
|
+
CONNECT_DESKTOP,
|
|
848
|
+
connectRows,
|
|
758
849
|
connectNeeded,
|
|
850
|
+
byokRouteNeeded,
|
|
851
|
+
cloudRouteNeeded,
|
|
759
852
|
providerRouteConfigured,
|
|
760
853
|
trustLines,
|
|
761
854
|
themePickerLines,
|
|
@@ -1440,7 +1440,29 @@ function createClient(opts = {}) {
|
|
|
1440
1440
|
.sort((a, b) => a[0] - b[0])
|
|
1441
1441
|
.map(([idx, c]) => ({ ...c, id: c.id || `call_${idx}` }));
|
|
1442
1442
|
|
|
1443
|
+
// The hidden chain-of-thought belongs on the RESULT, not only on the live
|
|
1444
|
+
// stream. `reasoningText` above is accumulated and forwarded to the caller's
|
|
1445
|
+
// `onReasoning`/`onStream` so the thinking can be shown while it happens —
|
|
1446
|
+
// but the resolved result carried only `content`, so every down-stream
|
|
1447
|
+
// diagnosis of "the model spent the whole budget thinking and never wrote a
|
|
1448
|
+
// word" read an empty reasoning channel on THIS lane and concluded there had
|
|
1449
|
+
// been no thinking at all.
|
|
1450
|
+
//
|
|
1451
|
+
// That is not a cosmetic loss. desktop/lib/local/engine.js decides its
|
|
1452
|
+
// reasoning-only recovery from exactly this field (`reasonedButSilent` →
|
|
1453
|
+
// `reasoningTextOf(res)`), so on byok the gate was dead code: DeepSeek
|
|
1454
|
+
// returns `finish_reason: 'stop'` with empty content and a full
|
|
1455
|
+
// `reasoning_content`, which matched neither `isTruncated` (the reason says
|
|
1456
|
+
// 'stop', not 'length') nor the reasoning retry (nothing to detect), and the
|
|
1457
|
+
// turn fell straight through to emptyTurnError — the "backend error: the
|
|
1458
|
+
// model returned no answer … max_tokens 16384" the user sees. Measured live
|
|
1459
|
+
// on byok/deepseek-v4-flash 2026-10-11.
|
|
1460
|
+
//
|
|
1461
|
+
// Kept out of `content` on purpose: deliberation is not an answer, and
|
|
1462
|
+
// folding it in would make a no-answer turn look answered to every caller's
|
|
1463
|
+
// empty-check (see the note at the `reasoningText` accumulation above).
|
|
1443
1464
|
const message = { content: cleanText };
|
|
1465
|
+
if (reasoningText) message.reasoning_content = reasoningText;
|
|
1444
1466
|
if (toolCalls.length) message.tool_calls = toolCalls;
|
|
1445
1467
|
const result = {
|
|
1446
1468
|
model: resultModel,
|
|
@@ -95,14 +95,49 @@ const BYOK_MODEL_ADDITIONS = Object.freeze({
|
|
|
95
95
|
// catalog.py) pins exactly one default_model, `claude-sonnet-5`, and
|
|
96
96
|
// `anthropic-haiku` pins `claude-haiku-4-5` as its own provider row — so
|
|
97
97
|
// between them an Anthropic BYOK key could pin Sonnet or Haiku but never
|
|
98
|
-
// Opus or Fable, the other two members of the
|
|
99
|
-
//
|
|
100
|
-
//
|
|
101
|
-
//
|
|
102
|
-
//
|
|
103
|
-
//
|
|
104
|
-
//
|
|
105
|
-
|
|
98
|
+
// Opus or Fable, the other two members of the Claude 5 lineup the vendor
|
|
99
|
+
// already serves. Listed under the `anthropic` provider id because that is
|
|
100
|
+
// the row the server advertises a configured Anthropic key against — the
|
|
101
|
+
// relay forwards whichever of these names the caller actually pins.
|
|
102
|
+
//
|
|
103
|
+
// Verified live 2026-10-11 against `GET https://api.anthropic.com/v1/models`
|
|
104
|
+
// (14 ids, `has_more: false`), which is where every id below is copied from
|
|
105
|
+
// rather than from memory:
|
|
106
|
+
//
|
|
107
|
+
// claude-haiku-5-5, claude-sonnet-5-5, claude-opus-5-5, claude-fable-5-1,
|
|
108
|
+
// claude-opus-5, claude-sonnet-5, claude-fable-5, claude-opus-4-8,
|
|
109
|
+
// claude-opus-4-7, claude-sonnet-4-6, claude-opus-4-6,
|
|
110
|
+
// claude-opus-4-5-20251101, claude-haiku-4-5-20251001,
|
|
111
|
+
// claude-sonnet-4-5-20250929
|
|
112
|
+
//
|
|
113
|
+
// The server's two defaults cover `claude-sonnet-5` and `claude-haiku-4-5`;
|
|
114
|
+
// the five below are the CURRENT members of the lineup it does not name —
|
|
115
|
+
// the 5.5 generation (Haiku, Sonnet, Opus) plus Fable 5.1, and the older
|
|
116
|
+
// Opus 5 / Fable 5 that were already listed. Every one has a priced rate row
|
|
117
|
+
// (desktop/renderer/usage.js, the Claude 5 block), so the picker was missing
|
|
118
|
+
// the ability to OFFER them, not a rate.
|
|
119
|
+
//
|
|
120
|
+
// What is deliberately NOT here, and why it matters more than what is:
|
|
121
|
+
// `claude-opus-4-1` (and its dated form `claude-opus-4-1-20250805`) is
|
|
122
|
+
// RETIRED upstream. Probed live 2026-10-11, `POST /v1/messages` with that
|
|
123
|
+
// model answers HTTP 404 `not_found_error` — the same probe answers
|
|
124
|
+
// `rate_limit_error` (i.e. the model resolved) for every id listed above,
|
|
125
|
+
// which is what makes 404 mean "no such model" rather than "no credit".
|
|
126
|
+
// The engine's own MODELS table still carries a legacy `claude-opus-4-1`
|
|
127
|
+
// row for saved configs, and that is fine — it is a local label that
|
|
128
|
+
// RESOLVES; a client-side catalog addition is a promise the picker will pin
|
|
129
|
+
// and the relay will forward, and this module's whole reason for existing is
|
|
130
|
+
// that a fabricated id "would pin, look accepted, and 404 on the first
|
|
131
|
+
// turn". So Opus 4.1 stays out of the offered list until Anthropic serves
|
|
132
|
+
// it again.
|
|
133
|
+
anthropic: Object.freeze([
|
|
134
|
+
'claude-opus-5',
|
|
135
|
+
'claude-fable-5',
|
|
136
|
+
'claude-opus-5-5',
|
|
137
|
+
'claude-sonnet-5-5',
|
|
138
|
+
'claude-haiku-5-5',
|
|
139
|
+
'claude-fable-5-1',
|
|
140
|
+
]),
|
|
106
141
|
// xAI's `grok` descriptor still pins `grok-4.5` as default_model — current
|
|
107
142
|
// when that descriptor was written, but xAI has since shipped grok-4.6 and
|
|
108
143
|
// grok-4.7 (flagship, Sept 2026) on the same `grok-4.5`-shaped id
|