aegiscode 7.0.9 → 7.0.11
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 +3 -3
- package/package.json +2 -2
- package/src/app.js +160 -14
- package/src/autonomous.js +30 -4
- package/src/chatflow.js +132 -4
- package/src/commands.js +223 -64
- package/src/config.js +14 -0
- package/src/deps.js +97 -1
- package/src/engine.js +109 -7
- package/src/limits.js +1 -1
- package/src/overlays.js +98 -0
- package/src/provenance.lock.json +2 -2
- package/vendor/desktop/lib/local/autonomous.js +48 -8
package/src/limits.js
CHANGED
|
@@ -101,7 +101,7 @@ const UNITS = Object.freeze([
|
|
|
101
101
|
* The masked digest of the sealed set. Rewritten ONLY by
|
|
102
102
|
* `node tools/provenance.mjs seal --write`, never by hand.
|
|
103
103
|
*/
|
|
104
|
-
const SEALED = '
|
|
104
|
+
const SEALED = '4affd4840744736343e06c20f92b51d4e16cd061faa9539e46d9965b06dda04b';
|
|
105
105
|
|
|
106
106
|
/** Subcommands that a build failing this check does not get to run. */
|
|
107
107
|
const PRIVILEGED = Object.freeze(['gate', 'provenance', 'mcp']);
|
package/src/overlays.js
CHANGED
|
@@ -285,6 +285,49 @@ function renderEffortPicker(sel = 0, width = 80, current = null, levels = EFFORT
|
|
|
285
285
|
return fit(lines, width);
|
|
286
286
|
}
|
|
287
287
|
|
|
288
|
+
// ── Class picker overlay (/class) ────────────────────────────────────────────
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* @param {Array} classes entries ({class, configured?})
|
|
292
|
+
* @param {number} sel selected index
|
|
293
|
+
* @param {number} width
|
|
294
|
+
* @param {string|null} current the live class id
|
|
295
|
+
* @param {(cls: string) => string} [classLabel] the caller's label table, so
|
|
296
|
+
* the class is named one way in every surface rather than re-spelled here.
|
|
297
|
+
*/
|
|
298
|
+
function renderClassPicker(classes, sel = 0, width = 80, current = null, classLabel = null) {
|
|
299
|
+
const list = Array.isArray(classes) ? classes : [];
|
|
300
|
+
const label = (id) => (typeof classLabel === 'function' ? classLabel(id) : id) || id;
|
|
301
|
+
const lines = [];
|
|
302
|
+
lines.push(blank(width));
|
|
303
|
+
lines.push([span('', ' '), span(C.white + BOLD, 'Select class'), span(BOLD_OFF, '')]);
|
|
304
|
+
lines.push([span('', ' '), span(C.gray, 'Which route the next turn takes — who pays, and with which credential.')]);
|
|
305
|
+
lines.push(blank(width));
|
|
306
|
+
for (let i = 0; i < list.length; i++) {
|
|
307
|
+
const k = list[i] || {};
|
|
308
|
+
const id = k.class;
|
|
309
|
+
const active = i === sel;
|
|
310
|
+
const cur = current != null && id === current;
|
|
311
|
+
const left = active ? span(C.lavender, GLYPH.cursor) : span('', ' ');
|
|
312
|
+
const name = label(id);
|
|
313
|
+
const nameSpan = active ? span(C.lavender, name) : span(C.white, name);
|
|
314
|
+
const mark = cur ? span(C.green, ' ' + GLYPH.check) : span('', '');
|
|
315
|
+
const pad = ' '.repeat(Math.max(1, 14 - [...name].length));
|
|
316
|
+
// Same distinction /class's static panel used to draw: who pays, and with
|
|
317
|
+
// which credential, so the picker says exactly what the printed table did.
|
|
318
|
+
const note =
|
|
319
|
+
id === 'byok'
|
|
320
|
+
? k.configured
|
|
321
|
+
? 'your key, relayed by AEGIS — billed a handling fee'
|
|
322
|
+
: 'needs a provider key: /byok-key <provider>'
|
|
323
|
+
: 'the pool — your AEGIS account key pays for it';
|
|
324
|
+
lines.push([span('', ' '), left, span('', ' '), nameSpan, mark, span(C.gray, pad + note)]);
|
|
325
|
+
}
|
|
326
|
+
lines.push(blank(width));
|
|
327
|
+
lines.push([span('', ' '), span(C.gray, PICKER_HINT)]);
|
|
328
|
+
return fit(lines, width);
|
|
329
|
+
}
|
|
330
|
+
|
|
288
331
|
// ── Resume-list overlay (/resume) ────────────────────────────────────────────
|
|
289
332
|
|
|
290
333
|
/**
|
|
@@ -353,11 +396,66 @@ function ago(ts) {
|
|
|
353
396
|
return `${Math.round(ms / 86_400_000)}d ago`;
|
|
354
397
|
}
|
|
355
398
|
|
|
399
|
+
// ── BYOK provider picker overlay (/byok-set, /byok-key with no argument) ────
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* The picker `/byok-set <provider>` draws when no provider was typed.
|
|
403
|
+
*
|
|
404
|
+
* The provider id was the one thing this flow asked the user to RECALL: `/byok`
|
|
405
|
+
* listed ~20 ids, and storing a key meant reading one off that list and typing
|
|
406
|
+
* it back — retyped wrong, it either matched nothing ("unknown provider") or,
|
|
407
|
+
* worse, matched an alias of another vendor. The rows are the catalog's own,
|
|
408
|
+
* so the id Enter sends is the id the relay will be asked for.
|
|
409
|
+
*
|
|
410
|
+
* @param {Array} providers catalog rows ({id, label?, configured?, masked?})
|
|
411
|
+
* @param {number} sel selected index
|
|
412
|
+
* @param {number} width
|
|
413
|
+
* @param {string|null} [current] the provider already set on this machine, if
|
|
414
|
+
* any (marked, not selected — "set" is shown per row anyway)
|
|
415
|
+
* @param {string} [hint] the footer line; differs between `/byok-set` (the
|
|
416
|
+
* account-side store) and `/byok-key` (this machine's store)
|
|
417
|
+
*/
|
|
418
|
+
function renderProviderPicker(providers, sel = 0, width = 80, current = null, hint = null) {
|
|
419
|
+
const list = Array.isArray(providers) ? providers : [];
|
|
420
|
+
const lines = [];
|
|
421
|
+
lines.push(blank(width));
|
|
422
|
+
lines.push([span('', ' '), span(C.white + BOLD, 'Select provider'), span(BOLD_OFF, '')]);
|
|
423
|
+
lines.push([span('', ' '), span(C.gray, 'Which vendor the key you are about to paste belongs to.')]);
|
|
424
|
+
lines.push(blank(width));
|
|
425
|
+
for (let i = 0; i < list.length; i++) {
|
|
426
|
+
const p = list[i] || {};
|
|
427
|
+
const id = String(p.id || '');
|
|
428
|
+
if (!id) continue;
|
|
429
|
+
const active = i === sel;
|
|
430
|
+
const cur = current != null && id === current;
|
|
431
|
+
const left = active ? span(C.lavender, GLYPH.cursor) : span('', ' ');
|
|
432
|
+
const nameSpan = active ? span(C.lavender, id) : span(C.white, id);
|
|
433
|
+
const mark = cur ? span(C.green, ' ' + GLYPH.check) : span('', '');
|
|
434
|
+
const name = String(p.label || '');
|
|
435
|
+
const pad = ' '.repeat(Math.max(1, 16 - [...id].length));
|
|
436
|
+
const state = p.configured
|
|
437
|
+
? span(C.green, `set${p.masked ? ` (${p.masked})` : ''}`)
|
|
438
|
+
: span(C.gray, 'not set');
|
|
439
|
+
lines.push([
|
|
440
|
+
span('', ' '), left, span('', ' '), nameSpan, mark,
|
|
441
|
+
span(C.gray, pad + (name ? `${name} · ` : '')), state,
|
|
442
|
+
]);
|
|
443
|
+
}
|
|
444
|
+
lines.push(blank(width));
|
|
445
|
+
lines.push([
|
|
446
|
+
span('', ' '),
|
|
447
|
+
span(C.gray, hint || `↑↓ or tab move ${GLYPH.bullet} enter picks ${GLYPH.bullet} esc cancels`),
|
|
448
|
+
]);
|
|
449
|
+
return fit(lines, width);
|
|
450
|
+
}
|
|
451
|
+
|
|
356
452
|
module.exports = {
|
|
357
453
|
boldMatched,
|
|
358
454
|
renderPalette,
|
|
359
455
|
renderModelPicker,
|
|
360
456
|
renderEffortPicker,
|
|
457
|
+
renderClassPicker,
|
|
458
|
+
renderProviderPicker,
|
|
361
459
|
renderResumeList,
|
|
362
460
|
EFFORT_LEVELS,
|
|
363
461
|
EFFORT_VALUES,
|
package/src/provenance.lock.json
CHANGED
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"p3": "ff962ac8dbf42cecb2477e2f77bf5ec61f88aa1751b0d4e506bf030fbc5fc6c6",
|
|
30
30
|
"p4": "2e8385c3a653a2af324050b4b92aeb9d142fc6765c91a13ccc928c5d4a2dbedb",
|
|
31
31
|
"p5": "408d67f78f31f6d637a26d2852e0c809a260544e613afdc64b731401c0ba3801",
|
|
32
|
-
"p6": "
|
|
33
|
-
"p7": "
|
|
32
|
+
"p6": "22bcd0b5dc1afad8d870652fbf1fd25bd0a547be9d8700161449cafa35bab6eb",
|
|
33
|
+
"p7": "1ff7c8ddf9f2f2f15d60a9c40ab5ab777bfa4e0e69e5876f65073535ce6790f2",
|
|
34
34
|
"p8": "3cc054d06715e065fe635b37b7d1bb98bf7989d64453a572ddbb77cec5b830e7"
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -209,8 +209,15 @@ const DEFAULT_MODEL = 'nexus-brain';
|
|
|
209
209
|
* depends on what the user's own daemon happens to have. Both REQUIRE an
|
|
210
210
|
* explicit model, refused by name instead of silently resolving to
|
|
211
211
|
* something nobody chose.
|
|
212
|
+
* - 'pro' DOES have a default, but not one this app chooses: a blank model
|
|
213
|
+
* means "the `claude` CLI picks for the subscription", which is what
|
|
214
|
+
* `--model` omitted says (engine.js sends no flag for `default`). Once a
|
|
215
|
+
* model IS stated it must be one of claude-pro.js's PRO_MODELS aliases —
|
|
216
|
+
* the same list the model picker offers — because the child accepts only
|
|
217
|
+
* those four spellings, and a `provider:model` id copied from a byok task
|
|
218
|
+
* would otherwise be handed to `claude --model` and fail there.
|
|
212
219
|
*/
|
|
213
|
-
const MODEL_CLASSES = Object.freeze(['aegis', 'byok', 'local']);
|
|
220
|
+
const MODEL_CLASSES = Object.freeze(['aegis', 'byok', 'local', 'pro']);
|
|
214
221
|
|
|
215
222
|
const AEGIS_MODEL_RE = /^(?:nexus|aegis)-brain(?:-(?:smart|neo))?$/;
|
|
216
223
|
const AEGIS_MODEL_IDS = Object.freeze(['nexus-brain', 'aegis-brain']);
|
|
@@ -270,6 +277,34 @@ function modelRefusal(id, cls) {
|
|
|
270
277
|
}
|
|
271
278
|
return '';
|
|
272
279
|
}
|
|
280
|
+
if (normalized === 'pro') {
|
|
281
|
+
// The subscription route. A blank model is legal and meaningful: engine.js
|
|
282
|
+
// sends no `--model` at all for 'default', so the child resolves the pick
|
|
283
|
+
// itself. Anything STATED must be a PRO_MODELS alias, because those four
|
|
284
|
+
// spellings are exactly what `claude --model` accepts — a byok-style
|
|
285
|
+
// "provider:model" copied between tasks would be handed to the child and
|
|
286
|
+
// fail there, three stages into a drain, with the queue's own file naming
|
|
287
|
+
// something the queue never validated.
|
|
288
|
+
if (!stated) return '';
|
|
289
|
+
// Required lazily: claude-pro.js is a heavy sibling (child spawn, session
|
|
290
|
+
// files) and this module is loaded by queue.js at every CLI start. The
|
|
291
|
+
// require is a plain sibling path with no back-require, so there is no
|
|
292
|
+
// cycle to guard — this is about load cost, not correctness.
|
|
293
|
+
let aliases;
|
|
294
|
+
try {
|
|
295
|
+
aliases = require('./claude-pro.js').PRO_MODELS;
|
|
296
|
+
} catch {
|
|
297
|
+
// If the alias list cannot be read we cannot validate a stated model, and
|
|
298
|
+
// accepting it unvalidated is the exact failure this arm exists to stop.
|
|
299
|
+
return `a pro task's model cannot be checked right now — queue it with no --model to let the claude CLI pick`;
|
|
300
|
+
}
|
|
301
|
+
const ids = (Array.isArray(aliases) ? aliases : []).map((m) => String(m && m.id).trim());
|
|
302
|
+
if (ids.includes(stated.toLowerCase())) return '';
|
|
303
|
+
return (
|
|
304
|
+
`the autonomous queue's Pro class runs the subscription through the claude CLI, ` +
|
|
305
|
+
`which accepts only its own model aliases (${ids.join('/')}); "${stated}" is not one`
|
|
306
|
+
);
|
|
307
|
+
}
|
|
273
308
|
// normalized === 'local'
|
|
274
309
|
if (!stated) return 'a local task needs a model — the tag of whatever is pulled into the local daemon';
|
|
275
310
|
return '';
|
|
@@ -594,13 +629,18 @@ function createQueueWorker({
|
|
|
594
629
|
*/
|
|
595
630
|
async function runTask(item, { carry = '', commit } = {}) {
|
|
596
631
|
const cwd = item.cwd || process.cwd();
|
|
597
|
-
//
|
|
598
|
-
// item whose model
|
|
599
|
-
// `--model` the CLI accepted before this rule existed,
|
|
600
|
-
// older build) would otherwise go out
|
|
601
|
-
//
|
|
602
|
-
// spelling, an opaque server error otherwise
|
|
603
|
-
//
|
|
632
|
+
// The task's own (model, class) pair checked BEFORE the turn, not at the
|
|
633
|
+
// server. An item whose model does not belong to its class (a hand-edited
|
|
634
|
+
// queue file, a `--model` the CLI accepted before this rule existed,
|
|
635
|
+
// another host's older build) would otherwise go out under a transport
|
|
636
|
+
// that does not serve it: billed work if it happens to be a per-provider
|
|
637
|
+
// spelling, an opaque server error otherwise, and for 'pro' a `claude
|
|
638
|
+
// --model` that the child rejects. Failing here names the model and the
|
|
639
|
+
// spellings that class accepts, and costs nothing.
|
|
640
|
+
//
|
|
641
|
+
// "Aegis Cloud or nothing" was this comment's old claim, and it stopped
|
|
642
|
+
// being true when byok/local were added (9eeef09) — modelRefusal is what
|
|
643
|
+
// actually enforces the rule now, per class, and it runs for all four.
|
|
604
644
|
const cls = normalizeClass(item.class);
|
|
605
645
|
const refusal = modelRefusal(item.model, cls);
|
|
606
646
|
if (refusal) {
|