aegiscode 7.0.0 → 7.0.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/bin/aegiscode.js +137 -0
- package/package.json +1 -1
- package/scripts/check.mjs +5 -0
- package/scripts/demo.mjs +5 -0
- package/scripts/predist.mjs +29 -2
- package/scripts/runtests.mjs +5 -0
- package/scripts/seal-gate.mjs +76 -0
- package/src/agents.js +5 -0
- package/src/app.js +5 -0
- package/src/art.js +5 -0
- package/src/autonomous.js +23 -0
- package/src/caps.js +5 -0
- package/src/chatflow.js +104 -31
- package/src/checkpoint.js +5 -0
- package/src/clipboard.js +5 -0
- package/src/cloudsync.js +5 -0
- package/src/commands.js +326 -14
- package/src/config.js +5 -0
- package/src/credentials.js +5 -0
- package/src/deps.js +5 -0
- package/src/devrun.js +5 -0
- package/src/diff.js +5 -0
- package/src/diffview.js +5 -0
- package/src/engine.js +5 -0
- package/src/entitlement.js +5 -0
- package/src/events.js +15 -0
- package/src/export.js +5 -0
- package/src/fingerprint.js +5 -0
- package/src/format.js +5 -0
- package/src/fuzzy.js +5 -0
- package/src/gate.js +12 -0
- package/src/history.js +5 -0
- package/src/init.js +5 -0
- package/src/input.js +5 -0
- package/src/keys.js +29 -2
- package/src/limits.js +192 -0
- package/src/markdown.js +5 -0
- package/src/mcp.js +13 -0
- package/src/models.js +5 -0
- package/src/naming.js +5 -0
- package/src/overlays.js +7 -2
- package/src/panels.js +5 -0
- package/src/permissions.js +56 -1
- package/src/ping.js +5 -0
- package/src/presence.js +5 -0
- package/src/provenance.js +238 -0
- package/src/provenance.lock.json +36 -0
- package/src/render.js +5 -0
- package/src/screen.js +5 -0
- package/src/screens.js +48 -37
- package/src/secret.js +5 -0
- package/src/securefs.js +5 -0
- package/src/settings.js +5 -0
- package/src/shared.js +5 -0
- package/src/sharedpaths.js +5 -0
- package/src/signup.js +5 -0
- package/src/summarize.js +5 -0
- package/src/sysdiag.js +582 -0
- package/src/system.js +5 -0
- package/src/theme.js +5 -0
- package/src/title.js +5 -0
- package/src/todos.js +5 -0
- package/src/tokens.js +5 -0
- package/src/topup.js +5 -0
- package/src/update.js +5 -0
- package/vendor/client/aegis.js +5 -0
- package/vendor/client/attest.js +5 -0
- package/vendor/client/authorship-key.js +5 -0
- package/vendor/client/auto-provision.js +5 -0
- package/vendor/client/brain-catalog.js +5 -0
- package/vendor/client/byok-catalog.js +5 -0
- package/vendor/client/credentials.js +5 -0
- package/vendor/client/device-fingerprint.js +5 -0
- package/vendor/client/env-file.js +5 -0
- package/vendor/client/fingerprint.js +5 -0
- package/vendor/client/foreign-memory.js +5 -0
- package/vendor/client/hooks.js +5 -0
- package/vendor/client/model-discovery.js +332 -0
- package/vendor/client/platform.js +5 -0
- package/vendor/client/prefs.js +5 -0
- package/vendor/client/presence-constants.js +5 -0
- package/vendor/client/presence.js +5 -0
- package/vendor/client/record-vault.js +5 -0
- package/vendor/client/session-store.js +5 -0
- package/vendor/client/topup.js +5 -0
- package/vendor/client/touch.js +5 -0
- package/vendor/client/update.js +5 -0
- package/vendor/client/user-models.js +5 -0
- package/vendor/desktop/lib/local/aegis-seal.mjs +5 -0
- package/vendor/desktop/lib/local/agents.js +5 -0
- package/vendor/desktop/lib/local/autonomous.js +5 -0
- package/vendor/desktop/lib/local/context.js +5 -0
- package/vendor/desktop/lib/local/covenant.js +5 -0
- package/vendor/desktop/lib/local/engine.js +129 -0
- package/vendor/desktop/lib/local/entitlement.js +5 -0
- package/vendor/desktop/lib/local/git-scope.js +5 -0
- package/vendor/desktop/lib/local/local.js +5 -0
- package/vendor/desktop/lib/local/prompt.js +5 -0
- package/vendor/desktop/lib/local/queue.js +5 -0
- package/vendor/desktop/lib/local/session-rounds.js +5 -0
- package/vendor/desktop/lib/local/shell.js +88 -9
- package/vendor/desktop/lib/local/tools.js +13 -6
- package/vendor/desktop/lib/local/turn-guard.js +5 -0
- package/vendor/desktop/lib/local/worktree-lock.js +5 -0
- package/vendor/desktop/lib/settings.js +5 -0
- package/vendor/desktop/renderer/usage.js +5 -0
- package/vendor/mcp/server.js +5 -0
- package/vendor/mcp/tools.js +5 -0
- package/vendor/tools/agent-gate.mjs +23 -0
package/bin/aegiscode.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
3
|
+
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
4
|
+
// AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
|
|
5
|
+
// Conveying a modified copy, or running one as a network service, owes the
|
|
6
|
+
// corresponding source under this licence (§5/§13) — see LICENSING.md.
|
|
2
7
|
'use strict';
|
|
3
8
|
|
|
4
9
|
/**
|
|
@@ -76,6 +81,12 @@ Code protection (the agent-key gate on aegiscodex-dev / aegiscode-plugin):
|
|
|
76
81
|
aegiscode gate lock-status the server-side half of the lock
|
|
77
82
|
aegiscode gate help all subcommands and their flags
|
|
78
83
|
|
|
84
|
+
Provenance (this binary, and whether it is still the published one):
|
|
85
|
+
aegiscode provenance licence, source, and a self-check of
|
|
86
|
+
this build against the published seal
|
|
87
|
+
(--json for scripts; exit 1 if a
|
|
88
|
+
sealed unit has moved)
|
|
89
|
+
|
|
79
90
|
Options:
|
|
80
91
|
-m, --model <id> pin a model id (see /models; default: server choice)
|
|
81
92
|
--base <url> API base (default $AEGIS_API_BASE or aegiscloud.org)
|
|
@@ -191,6 +202,13 @@ function parseArgs(argv) {
|
|
|
191
202
|
opts.commandArg = sub;
|
|
192
203
|
opts.commandArgv = argv.slice(argv[1] && !argv[1].startsWith('-') ? 2 : 1);
|
|
193
204
|
argv = [];
|
|
205
|
+
} else if (head === 'provenance') {
|
|
206
|
+
// Same position-0 rule and the same reason as `gate`: it is a one-shot
|
|
207
|
+
// question about THIS BINARY, not a prompt that happens to start with the
|
|
208
|
+
// word. Unlike `gate` the tail needs no passthrough — the only flag it
|
|
209
|
+
// takes is `--json`, which this parser already owns.
|
|
210
|
+
opts.command = 'provenance';
|
|
211
|
+
argv = argv.slice(1);
|
|
194
212
|
} else if (head === 'topup') {
|
|
195
213
|
// Same position-0 rule and the same reason as `gate`: the one argument is
|
|
196
214
|
// the amount (`aegiscode topup 20`), never a prompt whose text happens to
|
|
@@ -291,6 +309,53 @@ function parseArgs(argv) {
|
|
|
291
309
|
return opts;
|
|
292
310
|
}
|
|
293
311
|
|
|
312
|
+
/**
|
|
313
|
+
* `aegiscode provenance` — what this binary is, and whether its safety files are
|
|
314
|
+
* the ones that were published.
|
|
315
|
+
*
|
|
316
|
+
* The use case is a user (or an auditor, or a script) holding an install they
|
|
317
|
+
* did not build: `npm i -g aegiscode`, a tarball mailed to them, a rebuilt fork.
|
|
318
|
+
* It answers with the licence, the copyright holder, the source URL, and the
|
|
319
|
+
* result of the startup self-check against `src/provenance.lock.json`.
|
|
320
|
+
*
|
|
321
|
+
* Exit codes: 0 = identity intact and safety files verified; 1 = a safety file
|
|
322
|
+
* has moved, or the manifest is missing and the install therefore cannot be
|
|
323
|
+
* verified at all (absence is a failure — see src/provenance.js for why the
|
|
324
|
+
* cheap attack must be the loud one). A fork that has deliberately rebuilt is
|
|
325
|
+
* expected to regenerate the manifest and exit 0 naming itself; one that has
|
|
326
|
+
* not now says so instead of staying silent.
|
|
327
|
+
*/
|
|
328
|
+
function runProvenance(opts = {}) {
|
|
329
|
+
const pkg = require(path.join(__dirname, '..', 'package.json'));
|
|
330
|
+
const provenance = require('../src/provenance.js');
|
|
331
|
+
const described = provenance.describe({ version: pkg.version });
|
|
332
|
+
if (opts.json) {
|
|
333
|
+
process.stdout.write(
|
|
334
|
+
JSON.stringify(
|
|
335
|
+
{
|
|
336
|
+
product: provenance.IDENTITY.product,
|
|
337
|
+
bin: provenance.IDENTITY.bin,
|
|
338
|
+
version: pkg.version,
|
|
339
|
+
license: provenance.IDENTITY.license,
|
|
340
|
+
source: provenance.IDENTITY.source,
|
|
341
|
+
homepage: provenance.IDENTITY.homepage,
|
|
342
|
+
copyright: provenance.IDENTITY.copyright,
|
|
343
|
+
safety: {
|
|
344
|
+
ok: described.report.ok,
|
|
345
|
+
checked: described.report.checked,
|
|
346
|
+
problems: described.report.problems,
|
|
347
|
+
},
|
|
348
|
+
},
|
|
349
|
+
null,
|
|
350
|
+
2
|
|
351
|
+
) + '\n'
|
|
352
|
+
);
|
|
353
|
+
return described.ok ? 0 : 1;
|
|
354
|
+
}
|
|
355
|
+
process.stdout.write(described.text);
|
|
356
|
+
return described.ok ? 0 : 1;
|
|
357
|
+
}
|
|
358
|
+
|
|
294
359
|
/**
|
|
295
360
|
* Account subcommands: the in-band way to give this host a key.
|
|
296
361
|
*
|
|
@@ -450,6 +515,42 @@ async function main(argv = process.argv.slice(2)) {
|
|
|
450
515
|
return 0;
|
|
451
516
|
}
|
|
452
517
|
|
|
518
|
+
// ── interlock (see src/limits.js) ────────────────────────────────────────
|
|
519
|
+
//
|
|
520
|
+
// The second gate, and it runs before every subcommand dispatch below — gate,
|
|
521
|
+
// mcp, autonomous, provenance, the session — because a check that ran after
|
|
522
|
+
// the dispatch it is supposed to stop is a check that reports instead of
|
|
523
|
+
// gating.
|
|
524
|
+
//
|
|
525
|
+
// It asks whether the safety files are still the sealed set *as a whole*, and
|
|
526
|
+
// when they are not it says exactly one bland thing — naming no file, no cause
|
|
527
|
+
// and no remedy — and refuses the privileged subcommands (`gate`,
|
|
528
|
+
// `provenance`, `mcp`), so the build that failed the check cannot use the
|
|
529
|
+
// gate's own key management or report on itself. Sessions still start, marked
|
|
530
|
+
// `AEGIS_REDUCED_MODE=1` for modules that opt-in.
|
|
531
|
+
//
|
|
532
|
+
// Deliberately NOT switchable by environment variable: a gate with a
|
|
533
|
+
// documented off switch is a gate the manipulator reads about in the same file
|
|
534
|
+
// as the gate. Re-sealing is a manual act —
|
|
535
|
+
// `node tools/provenance.mjs lock --write` — and a tree that is mid-edit trips
|
|
536
|
+
// this on purpose.
|
|
537
|
+
//
|
|
538
|
+
// This call site is the EARLIEST refusal, not the only one. `armed()` is
|
|
539
|
+
// asked again, independently, by each module that owns one of these
|
|
540
|
+
// privileges — src/gate.js, src/mcp.js, src/autonomous.js,
|
|
541
|
+
// src/permissions.js — because a check invoked from exactly one place is
|
|
542
|
+
// removed by deleting one line, and this is the file a manipulator is already
|
|
543
|
+
// editing. Deleting the block below leaves four refusals behind, in four files
|
|
544
|
+
// the sealed set covers.
|
|
545
|
+
let interlockFired = false;
|
|
546
|
+
try {
|
|
547
|
+
const limits = require('../src/limits.js');
|
|
548
|
+
interlockFired = limits.armed();
|
|
549
|
+
if (interlockFired && limits.isPrivileged(opts.command)) return limits.refuse();
|
|
550
|
+
} catch {
|
|
551
|
+
/* a gate must never be the reason the program fails to start */
|
|
552
|
+
}
|
|
553
|
+
|
|
453
554
|
// ── the shared env file, before any credential is resolved ───────────────
|
|
454
555
|
//
|
|
455
556
|
// `~/.aegiscode/.env` read into process.env once. This is what makes key
|
|
@@ -618,8 +719,44 @@ async function main(argv = process.argv.slice(2)) {
|
|
|
618
719
|
});
|
|
619
720
|
}
|
|
620
721
|
|
|
722
|
+
// What this binary is, and whether its safety files are the published ones.
|
|
723
|
+
// Dispatched before a session is built, like `gate`/`fingerprint`: it is a
|
|
724
|
+
// question about this install, it must work with no terminal at all (an audit
|
|
725
|
+
// script), and it must not depend on a credential being configured. It is NOT
|
|
726
|
+
// part of the startup path — the runtime self-check that warns on stderr is in
|
|
727
|
+
// src/provenance.js and runs below, for sessions.
|
|
728
|
+
//
|
|
729
|
+
// The interlock below runs first and can make `provenance` unavailable, which
|
|
730
|
+
// is not an oversight: a build that fails the silent gate does not get to
|
|
731
|
+
// report on itself.
|
|
732
|
+
if (opts.command === 'provenance' && !interlockFired) {
|
|
733
|
+
return runProvenance({ json: opts.json });
|
|
734
|
+
}
|
|
735
|
+
|
|
621
736
|
const { createApp } = require('../src/app.js');
|
|
622
737
|
|
|
738
|
+
// ── provenance self-check (one stderr line, never fatal) ─────────────────
|
|
739
|
+
//
|
|
740
|
+
// A build whose gate, permission evaluator, approval classes or runner were
|
|
741
|
+
// edited announces it, once, before the session starts — instead of importing
|
|
742
|
+
// the neutered file and saying nothing. Never throws and never blocks: a
|
|
743
|
+
// diagnostic that can stop the program it reports on is worse than none (see
|
|
744
|
+
// src/provenance.js, which also records why a MISSING manifest is a failure
|
|
745
|
+
// rather than a pass). A development tree silences it with
|
|
746
|
+
// AEGIS_NO_PROVENANCE_CHECK=1 — and the silence is printed at the time, so it
|
|
747
|
+
// is a fact on the record rather than a quiet default.
|
|
748
|
+
//
|
|
749
|
+
// Skipped when the interlock has already fired: that path emits exactly one
|
|
750
|
+
// bland line, and following it with a more descriptive one would hand back
|
|
751
|
+
// everything the bland line withheld.
|
|
752
|
+
if (!interlockFired) try {
|
|
753
|
+
const provenance = require('../src/provenance.js');
|
|
754
|
+
const line = provenance.warning(provenance.selfCheck());
|
|
755
|
+
if (line) process.stderr.write(line);
|
|
756
|
+
} catch {
|
|
757
|
+
/* a diagnostic must never be the reason a session fails to start */
|
|
758
|
+
}
|
|
759
|
+
|
|
623
760
|
// ── presence beacon (aegis1 /api/v1/heartbeat) ───────────────────────────
|
|
624
761
|
//
|
|
625
762
|
// "Who is running aegiscode right now" — the admin panel's presence card.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aegiscode",
|
|
3
3
|
"productName": "AEGIS Code",
|
|
4
|
-
"version": "7.0.
|
|
4
|
+
"version": "7.0.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/scripts/check.mjs
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
3
|
+
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
4
|
+
// AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
|
|
5
|
+
// Conveying a modified copy, or running one as a network service, owes the
|
|
6
|
+
// corresponding source under this licence (§5/§13) — see LICENSING.md.
|
|
2
7
|
/**
|
|
3
8
|
* Syntax-check every file `node --check` should gate on, and report all of
|
|
4
9
|
* them. Replaces the POSIX loop
|
package/scripts/demo.mjs
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
3
|
+
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
4
|
+
// AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
|
|
5
|
+
// Conveying a modified copy, or running one as a network service, owes the
|
|
6
|
+
// corresponding source under this licence (§5/§13) — see LICENSING.md.
|
|
2
7
|
/**
|
|
3
8
|
* Renders a canned session to stdout — banner, a prompt, a streamed answer with
|
|
4
9
|
* markdown, the accounting line, and the status bar.
|
package/scripts/predist.mjs
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
3
|
+
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
4
|
+
// AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
|
|
5
|
+
// Conveying a modified copy, or running one as a network service, owes the
|
|
6
|
+
// corresponding source under this licence (§5/§13) — see LICENSING.md.
|
|
2
7
|
/**
|
|
3
8
|
* Pre-publish staging for the `aegiscode` package — a THIN WRAPPER.
|
|
4
9
|
*
|
|
@@ -6,7 +11,8 @@
|
|
|
6
11
|
* `one/scripts/predist.mjs` in AEGISONE's phase ON2 (plan D6): one manifest,
|
|
7
12
|
* two shapes. This file used to hold its own list of forty repo-relative
|
|
8
13
|
* modules, kept in sync with `desktop/scripts/predist.mjs` by discipline alone.
|
|
9
|
-
* It now holds no list at all
|
|
14
|
+
* It now holds no list at all, and its length is a test
|
|
15
|
+
* (`test/one-vendor.test.mjs`: wrappers stay under eighty lines).
|
|
10
16
|
*
|
|
11
17
|
* Everything the CLI needs is unchanged as seen from outside: `npm run predist`,
|
|
12
18
|
* `prepublishOnly`, `precheck` and `pretest` still run this file, it still
|
|
@@ -14,6 +20,11 @@
|
|
|
14
20
|
* same proof lines (the staged registry loads standalone, the editor layer
|
|
15
21
|
* resolves the STAGED server, the staged gate module loads).
|
|
16
22
|
*
|
|
23
|
+
* It also REFUSES to stage from a tree whose safety files are not the sealed
|
|
24
|
+
* ones — the publish gate, which lives beside this file (`./seal-gate.mjs`)
|
|
25
|
+
* because a gate is not a manifest and this file has a line budget. That is the
|
|
26
|
+
* one moment the question can be asked from outside the artifact.
|
|
27
|
+
*
|
|
17
28
|
* If the shared stager is not reachable the file is missing — this directory is
|
|
18
29
|
* inside the published tarball, where `one/` is not shipped, and running predist
|
|
19
30
|
* there is meaningless anyway (the vendor tree it would build is already in the
|
|
@@ -21,11 +32,27 @@
|
|
|
21
32
|
*/
|
|
22
33
|
import path from 'node:path';
|
|
23
34
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
35
|
+
import { sealGate } from './seal-gate.mjs';
|
|
24
36
|
|
|
25
37
|
const HERE = path.dirname(fileURLToPath(import.meta.url));
|
|
26
38
|
const SHARED = path.join(HERE, '..', '..', 'one', 'scripts', 'predist.mjs');
|
|
27
39
|
|
|
28
40
|
async function main() {
|
|
41
|
+
const gate = sealGate();
|
|
42
|
+
if (!gate.ok && !process.env.AEGIS_ALLOW_UNSEALED) {
|
|
43
|
+
process.stderr.write(
|
|
44
|
+
`${gate.line}\n` +
|
|
45
|
+
`cut: refusing to stage a package from it. Reseal the tree deliberately, or set ` +
|
|
46
|
+
`AEGIS_ALLOW_UNSEALED=1 to stage a build that is known not to be the published one.\n`
|
|
47
|
+
);
|
|
48
|
+
return 1;
|
|
49
|
+
}
|
|
50
|
+
process.stderr.write(
|
|
51
|
+
gate.ok
|
|
52
|
+
? `${gate.line}\n`
|
|
53
|
+
: `${gate.line}\ncut: AEGIS_ALLOW_UNSEALED is set — staging anyway; this artifact will ` +
|
|
54
|
+
`not match the published manifest.\n`
|
|
55
|
+
);
|
|
29
56
|
let shared;
|
|
30
57
|
try {
|
|
31
58
|
shared = await import(pathToFileURL(SHARED).href);
|
|
@@ -45,4 +72,4 @@ if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.me
|
|
|
45
72
|
process.exitCode = await main();
|
|
46
73
|
}
|
|
47
74
|
|
|
48
|
-
export { main };
|
|
75
|
+
export { main, sealGate };
|
package/scripts/runtests.mjs
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
3
|
+
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
4
|
+
// AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
|
|
5
|
+
// Conveying a modified copy, or running one as a network service, owes the
|
|
6
|
+
// corresponding source under this licence (§5/§13) — see LICENSING.md.
|
|
2
7
|
/**
|
|
3
8
|
* Run every `test/cli-*.test.mjs` and report all of them.
|
|
4
9
|
*
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
+
// AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
|
|
4
|
+
// Conveying a modified copy, or running one as a network service, owes the
|
|
5
|
+
// corresponding source under this licence (§5/§13) — see LICENSING.md.
|
|
6
|
+
/**
|
|
7
|
+
* The publish gate — the half of the provenance story that is a control rather
|
|
8
|
+
* than a deterrent.
|
|
9
|
+
*
|
|
10
|
+
* `cli/src/limits.js` and `cli/src/provenance.js` live INSIDE the package they
|
|
11
|
+
* guard, so whoever edits the safety files can also delete the lines that would
|
|
12
|
+
* have noticed. That is not fixable from within the package, and pretending
|
|
13
|
+
* otherwise is the mistake both gates already refuse to make in their own
|
|
14
|
+
* headers. Staging a tarball is the one moment the question can be asked from
|
|
15
|
+
* OUTSIDE the artifact — on the maintainer's machine, before the bytes are
|
|
16
|
+
* copied — which makes this the only point at which a modified tree is STOPPED
|
|
17
|
+
* instead of merely reported on.
|
|
18
|
+
*
|
|
19
|
+
* Both gates are asked, and separately on purpose: the interlock's set covers
|
|
20
|
+
* `src/limits.js` itself while the manifest does not, and the manifest covers
|
|
21
|
+
* the entry point while the interlock lists a different set. A tree has to
|
|
22
|
+
* satisfy both to be staged.
|
|
23
|
+
*
|
|
24
|
+
* It lives in its own file rather than inline in `predist.mjs` because that
|
|
25
|
+
* file is a THIN WRAPPER by contract — `test/one-vendor.test.mjs` fails it
|
|
26
|
+
* above eighty lines, and the manifest it used to hold is exactly the
|
|
27
|
+
* duplication that rule exists to prevent. A gate is not a manifest, but the
|
|
28
|
+
* rule is a line count, and the honest way to satisfy it is to move the gate
|
|
29
|
+
* out rather than to raise the limit for it.
|
|
30
|
+
*
|
|
31
|
+
* Importing this file stages nothing.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
import path from 'node:path';
|
|
35
|
+
import { createRequire } from 'node:module';
|
|
36
|
+
import { fileURLToPath } from 'node:url';
|
|
37
|
+
|
|
38
|
+
const HERE = path.dirname(fileURLToPath(import.meta.url));
|
|
39
|
+
const CLI_ROOT = path.join(HERE, '..');
|
|
40
|
+
const require = createRequire(import.meta.url);
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Ask both gates about the tree that is about to be staged.
|
|
44
|
+
*
|
|
45
|
+
* @returns {{ ok: boolean, line: string }} `line` is what the maintainer reads;
|
|
46
|
+
* it may name files, because a maintainer is who it is talking to. The RUNTIME
|
|
47
|
+
* reports are the ones that must not (see cli/src/provenance.js).
|
|
48
|
+
*/
|
|
49
|
+
function sealGate() {
|
|
50
|
+
let limits;
|
|
51
|
+
let provenance;
|
|
52
|
+
try {
|
|
53
|
+
limits = require(path.join(CLI_ROOT, 'src', 'limits.js'));
|
|
54
|
+
provenance = require(path.join(CLI_ROOT, 'src', 'provenance.js'));
|
|
55
|
+
} catch (error) {
|
|
56
|
+
return {
|
|
57
|
+
ok: false,
|
|
58
|
+
line: `cut: the safety modules are unreadable (${(error && error.message) || error}).`,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
const interlock = limits.check();
|
|
62
|
+
if (interlock.tripped) {
|
|
63
|
+
return {
|
|
64
|
+
ok: false,
|
|
65
|
+
line: `cut: the sealed set has moved (${interlock.code}) — this tree is not the published one.`,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
const report = provenance.selfCheck();
|
|
69
|
+
if (!report.ok) return { ok: false, line: `cut: ${report.problems.join('; ')}` };
|
|
70
|
+
return {
|
|
71
|
+
ok: true,
|
|
72
|
+
line: `cut: ${report.checked} sealed units verified — this tree is the published one.`,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export { sealGate };
|
package/src/agents.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
+
// AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
|
|
4
|
+
// Conveying a modified copy, or running one as a network service, owes the
|
|
5
|
+
// corresponding source under this licence (§5/§13) — see LICENSING.md.
|
|
1
6
|
'use strict';
|
|
2
7
|
|
|
3
8
|
/**
|
package/src/app.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
+
// AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
|
|
4
|
+
// Conveying a modified copy, or running one as a network service, owes the
|
|
5
|
+
// corresponding source under this licence (§5/§13) — see LICENSING.md.
|
|
1
6
|
'use strict';
|
|
2
7
|
|
|
3
8
|
/**
|
package/src/art.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
+
// AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
|
|
4
|
+
// Conveying a modified copy, or running one as a network service, owes the
|
|
5
|
+
// corresponding source under this licence (§5/§13) — see LICENSING.md.
|
|
1
6
|
'use strict';
|
|
2
7
|
|
|
3
8
|
const { caps, detect, cells, padCells } = require('./caps.js');
|
package/src/autonomous.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
+
// AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
|
|
4
|
+
// Conveying a modified copy, or running one as a network service, owes the
|
|
5
|
+
// corresponding source under this licence (§5/§13) — see LICENSING.md.
|
|
1
6
|
'use strict';
|
|
2
7
|
|
|
3
8
|
/**
|
|
@@ -30,11 +35,20 @@ const path = require('node:path');
|
|
|
30
35
|
const { queue, autonomous } = require('./deps.js');
|
|
31
36
|
const { createEngine } = require('./engine.js');
|
|
32
37
|
const { fmtElapsed } = require('./format.js');
|
|
38
|
+
const limits = require('./limits.js');
|
|
33
39
|
|
|
34
40
|
const SUBCOMMANDS = new Set([
|
|
35
41
|
'add', 'list', 'run', 'proceed', 'reconcile', 'clear', 'retry', 'help',
|
|
36
42
|
]);
|
|
37
43
|
|
|
44
|
+
/**
|
|
45
|
+
* The verbs that RUN something. `add`, `list` and `clear` decide nothing and
|
|
46
|
+
* stay available on a build that failed the interlock; these four act — `retry`
|
|
47
|
+
* re-arms a failed task, `reconcile` can chain straight into a drain, and
|
|
48
|
+
* `run`/`proceed` are the drain. See the guard in `runQueueCommand`.
|
|
49
|
+
*/
|
|
50
|
+
const EXECUTES = new Set(['run', 'proceed', 'retry', 'reconcile']);
|
|
51
|
+
|
|
38
52
|
/**
|
|
39
53
|
* Parse the subcommand's own argv. Deliberately its own tiny parser rather than
|
|
40
54
|
* bin/aegiscode.js's: the top-level parser owns the one-shot/session flags, and
|
|
@@ -228,6 +242,15 @@ async function runQueueCommand(command, argv, io = {}) {
|
|
|
228
242
|
return command === 'help' ? 0 : 2;
|
|
229
243
|
}
|
|
230
244
|
|
|
245
|
+
// The interlock, asked here as well as at the entry point, and it is asked
|
|
246
|
+
// about the verbs that EXECUTE. This is the one surface where a machine acts
|
|
247
|
+
// with nobody answering: no prompt, no human to refuse a tool call, stdin on
|
|
248
|
+
// /dev/null under a timer. A build that is not the published one does not get
|
|
249
|
+
// to run a queue through it — it may still read `list` and append with `add`,
|
|
250
|
+
// because those decide nothing, but `run`/`proceed`/`retry` and installing the
|
|
251
|
+
// timer that repeats them are refused. See src/limits.js.
|
|
252
|
+
if (EXECUTES.has(command) && limits.armed()) return limits.refuse();
|
|
253
|
+
|
|
231
254
|
const cwd = args.flags.cwd ? path.resolve(String(args.flags.cwd)) : process.cwd();
|
|
232
255
|
|
|
233
256
|
if (command === 'add') {
|
package/src/caps.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
+
// AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
|
|
4
|
+
// Conveying a modified copy, or running one as a network service, owes the
|
|
5
|
+
// corresponding source under this licence (§5/§13) — see LICENSING.md.
|
|
1
6
|
'use strict';
|
|
2
7
|
|
|
3
8
|
/**
|
package/src/chatflow.js
CHANGED
|
@@ -372,6 +372,10 @@ function shortcutsGrid(cols, ctx) {
|
|
|
372
372
|
cell('/', 'for commands', '?', 'for shortcuts'),
|
|
373
373
|
cell('ctrl + c', 'to quit', 'ctrl + o', 'for permissions'),
|
|
374
374
|
cell('alt + p', 'to switch model', 'alt + t', 'to toggle thinking'),
|
|
375
|
+
// The shift chords the two pickers commit with. They are on the sheet for
|
|
376
|
+
// the same reason every other row is: `handleOverlayKey` handles them now,
|
|
377
|
+
// and a key a user cannot read about is a key that does not exist.
|
|
378
|
+
cell('shift + ↑/↓', 'pins as it moves', 'shift + enter', 'runs the row'),
|
|
375
379
|
cell('esc', 'to interrupt a turn', 'ctrl + l', 'to clear the screen'),
|
|
376
380
|
cell('ctrl + t', 'to show tokens', 'ctrl + r', 'to resume a session'),
|
|
377
381
|
cell('↑ / ↓', 'for history', 'tab', 'to complete a command'),
|
|
@@ -901,6 +905,18 @@ async function runSession(host) {
|
|
|
901
905
|
const lineCache = new WeakMap();
|
|
902
906
|
|
|
903
907
|
let overlay = null;
|
|
908
|
+
|
|
909
|
+
/**
|
|
910
|
+
* The palette's rows: the ONE ranking the frame draws and the key handlers
|
|
911
|
+
* act on. Tab and Enter each wrote this expression out in full, which is two
|
|
912
|
+
* chances for the row that is completed or run to be a different row than the
|
|
913
|
+
* one highlighted. A function declaration so `render`'s closure can call it
|
|
914
|
+
* whatever order the definitions are initialised in.
|
|
915
|
+
*/
|
|
916
|
+
function paletteRows(query) {
|
|
917
|
+
const q = paletteQuery(query == null ? (overlay && overlay.query) || '' : query);
|
|
918
|
+
return fuzzy.fuzzyRankWithAliases(q, host.visibleCommands(), (c) => c.name, (c) => c.aliases || []);
|
|
919
|
+
}
|
|
904
920
|
// Automode's running tally of silent "continue" answers to the round-budget
|
|
905
921
|
// dialog (see autoContinuePlan above). Cleared whenever the human is
|
|
906
922
|
// actually asked (autoContinuePlan resets it once the allowance is spent),
|
|
@@ -1998,6 +2014,24 @@ async function runSession(host) {
|
|
|
1998
2014
|
}
|
|
1999
2015
|
};
|
|
2000
2016
|
|
|
2017
|
+
/**
|
|
2018
|
+
* Pin a model row — the ONE path a row is applied through, shared by Enter,
|
|
2019
|
+
* shift+enter and the shift+arrow chord. Written out once because applying a
|
|
2020
|
+
* model is not just a config write: it may have to move the class first and
|
|
2021
|
+
* it may have to collect the provider key the row needs. A second apply path
|
|
2022
|
+
* would eventually skip one of those (the reference's own picker pinned the
|
|
2023
|
+
* id and left the class behind), and the user would be running on a model
|
|
2024
|
+
* whose key this machine does not hold.
|
|
2025
|
+
*/
|
|
2026
|
+
const applyModelRow = async (chosen) => {
|
|
2027
|
+
if (!chosen) return;
|
|
2028
|
+
if (chosen.cls === 'byok' && ctx.modelClass !== 'byok') await dispatch('/class byok');
|
|
2029
|
+
ctx.model = chosen.id;
|
|
2030
|
+
host.updateConfig({ model: chosen.id, currentModelId: chosen.id, modelClass: ctx.modelClass });
|
|
2031
|
+
note(`model: ${chosen.id}${chosen.cls === 'byok' ? ' (byok)' : ''}`);
|
|
2032
|
+
await collectKeyFor(chosen);
|
|
2033
|
+
};
|
|
2034
|
+
|
|
2001
2035
|
const handleOverlayKey = async (key) => {
|
|
2002
2036
|
const type = overlay.type;
|
|
2003
2037
|
if (key.name === KEY.ESC || key.name === KEY.CTRL_C) {
|
|
@@ -2011,16 +2045,11 @@ async function runSession(host) {
|
|
|
2011
2045
|
return;
|
|
2012
2046
|
}
|
|
2013
2047
|
if (key.name === KEY.TAB && type === 'palette') {
|
|
2014
|
-
// Tab completes the query to the highlighted command
|
|
2015
|
-
// same
|
|
2016
|
-
// row
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
host.visibleCommands(),
|
|
2020
|
-
(c) => c.name,
|
|
2021
|
-
(c) => c.aliases || []
|
|
2022
|
-
);
|
|
2023
|
-
const chosen = list[overlay.sel || 0];
|
|
2048
|
+
// Tab completes the query to the highlighted command. The ranking is
|
|
2049
|
+
// `paletteRows()`, the same list the frame drew and Enter runs, so the
|
|
2050
|
+
// row completed is the row highlighted. Nothing highlighted (no matches)
|
|
2051
|
+
// → do nothing.
|
|
2052
|
+
const chosen = paletteRows()[overlay.sel || 0];
|
|
2024
2053
|
if (chosen) {
|
|
2025
2054
|
overlay.query = chosen.name;
|
|
2026
2055
|
overlay.sel = 0;
|
|
@@ -2032,13 +2061,7 @@ async function runSession(host) {
|
|
|
2032
2061
|
if (type === 'palette') {
|
|
2033
2062
|
// Rank with the same function the palette rendered with, so the row
|
|
2034
2063
|
// highlighted is the row Enter runs.
|
|
2035
|
-
const
|
|
2036
|
-
paletteQuery(overlay.query),
|
|
2037
|
-
host.visibleCommands(),
|
|
2038
|
-
(c) => c.name,
|
|
2039
|
-
(c) => c.aliases || []
|
|
2040
|
-
);
|
|
2041
|
-
const chosen = list[overlay.sel || 0];
|
|
2064
|
+
const chosen = paletteRows()[overlay.sel || 0];
|
|
2042
2065
|
const arg = String(overlay.query || '').trim().split(/\s+/).slice(1).join(' ');
|
|
2043
2066
|
overlay = null;
|
|
2044
2067
|
render();
|
|
@@ -2051,20 +2074,7 @@ async function runSession(host) {
|
|
|
2051
2074
|
const chosen = (overlay.items || [])[overlay.sel || 0];
|
|
2052
2075
|
overlay = null;
|
|
2053
2076
|
render();
|
|
2054
|
-
|
|
2055
|
-
// A direct-provider (byok) row needs the class the id actually
|
|
2056
|
-
// belongs to before the pin can route anywhere.
|
|
2057
|
-
if (chosen.cls === 'byok' && ctx.modelClass !== 'byok') await dispatch('/class byok');
|
|
2058
|
-
ctx.model = chosen.id;
|
|
2059
|
-
host.updateConfig({ model: chosen.id, currentModelId: chosen.id, modelClass: ctx.modelClass });
|
|
2060
|
-
note(`model: ${chosen.id}${chosen.cls === 'byok' ? ' (byok)' : ''}`);
|
|
2061
|
-
// Then the key, if this row needs one this machine does not have —
|
|
2062
|
-
// collected here rather than as a warning to run some command
|
|
2063
|
-
// afterward. See collectKeyFor: the decision comes from the shared
|
|
2064
|
-
// env-file module, so the variable a key is written to is the same
|
|
2065
|
-
// one the desktop reads, instead of each host keeping a private copy.
|
|
2066
|
-
await collectKeyFor(chosen);
|
|
2067
|
-
}
|
|
2077
|
+
await applyModelRow(chosen);
|
|
2068
2078
|
render();
|
|
2069
2079
|
return;
|
|
2070
2080
|
}
|
|
@@ -2092,6 +2102,69 @@ async function runSession(host) {
|
|
|
2092
2102
|
render();
|
|
2093
2103
|
return;
|
|
2094
2104
|
}
|
|
2105
|
+
if (key.name === KEY.SHIFT_UP || key.name === KEY.SHIFT_DOWN) {
|
|
2106
|
+
// Shift is the one-keystroke commit in the two pickers that write a
|
|
2107
|
+
// setting: it moves the highlight one row in the pressed direction and
|
|
2108
|
+
// applies THAT row immediately, so changing the model is a single key
|
|
2109
|
+
// instead of point-then-Enter. It routes into the same apply paths Enter
|
|
2110
|
+
// uses, so the chord cannot pin a model Enter would refuse to pin, skip
|
|
2111
|
+
// the provider-key prompt a byok row needs, or store an effort level the
|
|
2112
|
+
// picker's own table does not contain.
|
|
2113
|
+
const step = key.name === KEY.SHIFT_UP ? -1 : 1;
|
|
2114
|
+
const max = Math.max(0, overlayRowCount() - 1);
|
|
2115
|
+
overlay.sel = Math.min(max, Math.max(0, (overlay.sel || 0) + step));
|
|
2116
|
+
if (type === 'model') {
|
|
2117
|
+
const chosen = (overlay.items || [])[overlay.sel || 0];
|
|
2118
|
+
overlay = null;
|
|
2119
|
+
render();
|
|
2120
|
+
await applyModelRow(chosen);
|
|
2121
|
+
render();
|
|
2122
|
+
return;
|
|
2123
|
+
}
|
|
2124
|
+
if (type === 'effort') {
|
|
2125
|
+
const chosen = overlays.EFFORT_VALUES[overlay.sel || 0];
|
|
2126
|
+
overlay = null;
|
|
2127
|
+
ctx.effort = chosen || 'high';
|
|
2128
|
+
host.updateConfig({ effort: ctx.effort });
|
|
2129
|
+
note(`effort: ${ctx.effort}`);
|
|
2130
|
+
render();
|
|
2131
|
+
return;
|
|
2132
|
+
}
|
|
2133
|
+
render();
|
|
2134
|
+
return;
|
|
2135
|
+
}
|
|
2136
|
+
if (key.name === KEY.SHIFT_ENTER) {
|
|
2137
|
+
// The same commit as Enter, in the spelling terminals that have no other
|
|
2138
|
+
// way to send it: on the palette it runs the highlighted command without
|
|
2139
|
+
// the user reaching for the Enter key proper, and in a picker it applies
|
|
2140
|
+
// the highlighted row. Both read the same sel/items every other path
|
|
2141
|
+
// reads, so the chord cannot run a different row than the frame drew.
|
|
2142
|
+
if (type === 'palette') {
|
|
2143
|
+
const chosen = paletteRows()[overlay.sel || 0];
|
|
2144
|
+
overlay = null;
|
|
2145
|
+
render();
|
|
2146
|
+
if (chosen) await dispatch(`/${chosen.name}`);
|
|
2147
|
+
return;
|
|
2148
|
+
}
|
|
2149
|
+
if (type === 'model') {
|
|
2150
|
+
const chosen = (overlay.items || [])[overlay.sel || 0];
|
|
2151
|
+
overlay = null;
|
|
2152
|
+
render();
|
|
2153
|
+
await applyModelRow(chosen);
|
|
2154
|
+
render();
|
|
2155
|
+
return;
|
|
2156
|
+
}
|
|
2157
|
+
if (type === 'effort') {
|
|
2158
|
+
const chosen = overlays.EFFORT_VALUES[overlay.sel || 0];
|
|
2159
|
+
overlay = null;
|
|
2160
|
+
ctx.effort = chosen || 'high';
|
|
2161
|
+
host.updateConfig({ effort: ctx.effort });
|
|
2162
|
+
note(`effort: ${ctx.effort}`);
|
|
2163
|
+
render();
|
|
2164
|
+
return;
|
|
2165
|
+
}
|
|
2166
|
+
return;
|
|
2167
|
+
}
|
|
2095
2168
|
if (key.name === KEY.UP) {
|
|
2096
2169
|
overlay.sel = Math.max(0, (overlay.sel || 0) - 1);
|
|
2097
2170
|
render();
|
package/src/checkpoint.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
+
// AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
|
|
4
|
+
// Conveying a modified copy, or running one as a network service, owes the
|
|
5
|
+
// corresponding source under this licence (§5/§13) — see LICENSING.md.
|
|
1
6
|
'use strict';
|
|
2
7
|
|
|
3
8
|
/**
|
package/src/clipboard.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
+
// AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
|
|
4
|
+
// Conveying a modified copy, or running one as a network service, owes the
|
|
5
|
+
// corresponding source under this licence (§5/§13) — see LICENSING.md.
|
|
1
6
|
'use strict';
|
|
2
7
|
|
|
3
8
|
/**
|
package/src/cloudsync.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
+
// AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
|
|
4
|
+
// Conveying a modified copy, or running one as a network service, owes the
|
|
5
|
+
// corresponding source under this licence (§5/§13) — see LICENSING.md.
|
|
1
6
|
'use strict';
|
|
2
7
|
|
|
3
8
|
/**
|