aegiscode 7.0.26 → 7.0.28

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.
Files changed (118) hide show
  1. package/SOURCE-OFFER.txt +9 -0
  2. package/package.json +4 -7
  3. package/scripts/check.mjs +1 -52
  4. package/scripts/demo.mjs +1 -94
  5. package/scripts/predist.mjs +1 -75
  6. package/scripts/runtests.mjs +1 -56
  7. package/scripts/seal-gate.mjs +1 -74
  8. package/src/agents.js +1 -139
  9. package/src/app.js +1 -2957
  10. package/src/art.js +1 -289
  11. package/src/chatflow.js +1 -3023
  12. package/src/checkpoint.js +1 -90
  13. package/src/clipboard.js +1 -424
  14. package/src/cloudsync.js +1 -528
  15. package/src/commands.js +1 -4089
  16. package/src/config.js +1 -581
  17. package/src/connect.js +1 -349
  18. package/src/credentials.js +1 -33
  19. package/src/deps.js +1 -232
  20. package/src/devrun.js +1 -187
  21. package/src/diff.js +1 -333
  22. package/src/diffview.js +1 -296
  23. package/src/engine.js +1 -297
  24. package/src/entitlement.js +1 -355
  25. package/src/events.js +1 -707
  26. package/src/export.js +1 -67
  27. package/src/filepreview.js +1 -153
  28. package/src/fingerprint.js +1 -592
  29. package/src/format.js +1 -259
  30. package/src/fuzzy.js +1 -119
  31. package/src/history.js +1 -423
  32. package/src/init.js +1 -175
  33. package/src/input.js +1 -139
  34. package/src/keys.js +1 -183
  35. package/src/markdown.js +1 -306
  36. package/src/models.js +1 -507
  37. package/src/naming.js +1 -57
  38. package/src/overlays.js +1 -462
  39. package/src/panels.js +1 -1418
  40. package/src/ping.js +1 -226
  41. package/src/presence.js +1 -238
  42. package/src/render.js +1 -516
  43. package/src/screen.js +1 -518
  44. package/src/screens.js +1 -896
  45. package/src/secret.js +1 -59
  46. package/src/securefs.js +1 -359
  47. package/src/settings.js +1 -155
  48. package/src/shared.js +1 -52
  49. package/src/sharedpaths.js +1 -53
  50. package/src/signup.js +1 -156
  51. package/src/summarize.js +1 -95
  52. package/src/sysdiag.js +1 -585
  53. package/src/system.js +1 -40
  54. package/src/theme.js +1 -570
  55. package/src/title.js +1 -220
  56. package/src/todos.js +1 -115
  57. package/src/tokens.js +1 -263
  58. package/src/topup.js +1 -210
  59. package/src/update.js +1 -191
  60. package/vendor/client/aegis.js +1 -2441
  61. package/vendor/client/attest.js +1 -518
  62. package/vendor/client/authorship-key.js +1 -410
  63. package/vendor/client/auto-provision.js +1 -134
  64. package/vendor/client/brain-catalog.js +1 -268
  65. package/vendor/client/byok-catalog.js +1 -199
  66. package/vendor/client/catalog-client.js +1 -487
  67. package/vendor/client/conversation-export.js +1 -177
  68. package/vendor/client/credentials.js +1 -494
  69. package/vendor/client/device-fingerprint.js +1 -141
  70. package/vendor/client/drive-connect.js +1 -110
  71. package/vendor/client/drive-upload.js +1 -234
  72. package/vendor/client/env-file.js +1 -1273
  73. package/vendor/client/fingerprint.js +1 -1064
  74. package/vendor/client/foreign-memory.js +1 -669
  75. package/vendor/client/google-signin.js +1 -133
  76. package/vendor/client/hooks.js +1 -430
  77. package/vendor/client/model-discovery.js +1 -373
  78. package/vendor/client/naming.js +1 -283
  79. package/vendor/client/platform.js +1 -937
  80. package/vendor/client/prefs.js +1 -351
  81. package/vendor/client/presence-constants.js +1 -107
  82. package/vendor/client/presence.js +1 -438
  83. package/vendor/client/record-vault.js +3 -1055
  84. package/vendor/client/session-store.js +1 -575
  85. package/vendor/client/topup.js +1 -297
  86. package/vendor/client/touch.js +1 -458
  87. package/vendor/client/update.js +1 -763
  88. package/vendor/client/user-models.js +1 -381
  89. package/vendor/desktop/lib/local/agents.js +1 -105
  90. package/vendor/desktop/lib/local/attachments.js +1 -276
  91. package/vendor/desktop/lib/local/autonomous.js +1 -1045
  92. package/vendor/desktop/lib/local/claude-pro.js +1 -1028
  93. package/vendor/desktop/lib/local/context.js +1 -125
  94. package/vendor/desktop/lib/local/engine.js +1 -3666
  95. package/vendor/desktop/lib/local/entitlement.js +1 -660
  96. package/vendor/desktop/lib/local/exec-plan.js +1 -269
  97. package/vendor/desktop/lib/local/git-scope.js +1 -228
  98. package/vendor/desktop/lib/local/integrity.js +1 -163
  99. package/vendor/desktop/lib/local/local.js +1 -2145
  100. package/vendor/desktop/lib/local/prompt.js +1 -280
  101. package/vendor/desktop/lib/local/queue.js +1 -560
  102. package/vendor/desktop/lib/local/session-rounds.js +1 -238
  103. package/vendor/desktop/lib/local/shell.js +1 -712
  104. package/vendor/desktop/lib/local/spill.js +1 -75
  105. package/vendor/desktop/lib/local/tools.js +1 -1328
  106. package/vendor/desktop/lib/local/turn-guard.js +1 -300
  107. package/vendor/desktop/lib/local/worktree-lock.js +1 -235
  108. package/vendor/desktop/lib/settings.js +1 -890
  109. package/vendor/desktop/main.js +1 -4890
  110. package/vendor/desktop/renderer/usage.js +1 -1239
  111. package/vendor/hosts/install.js +1 -638
  112. package/vendor/hosts/openai-shim.js +1 -515
  113. package/vendor/hosts/spec.js +1 -164
  114. package/vendor/hosts/targets.js +1 -346
  115. package/vendor/mcp/server.js +1 -221
  116. package/vendor/mcp/tools.js +1 -408
  117. package/vendor/one/src/child.js +1 -285
  118. package/vendor/one/src/permissions.js +1 -383
@@ -0,0 +1,9 @@
1
+ AEGIS Code (aegiscode) — obfuscated build.
2
+
3
+ This build is obfuscated (minified and mangled) object code of an
4
+ AGPL-3.0-or-later program. The corresponding source is:
5
+ https://github.com/aegisinfo/aegiscode-plugin
6
+ at the commit this tree was built from; see LICENSE for the full terms.
7
+
8
+ Obfuscation does not alter the licence. If you received this artifact you
9
+ are entitled to the source above.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "aegiscode",
3
3
  "productName": "AEGIS Code",
4
- "version": "7.0.26",
4
+ "version": "7.0.28",
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",
@@ -18,19 +18,16 @@
18
18
  "src",
19
19
  "scripts",
20
20
  "vendor",
21
- "README.md"
21
+ "README.md",
22
+ "SOURCE-OFFER.txt",
23
+ "LICENSE"
22
24
  ],
23
25
  "engines": {
24
26
  "node": ">=22.0.0"
25
27
  },
26
28
  "scripts": {
27
29
  "start": "node bin/aegiscode.js",
28
- "predist": "node scripts/predist.mjs",
29
- "prepack": "node scripts/predist.mjs --quiet",
30
- "prepublishOnly": "npm run predist",
31
- "precheck": "node scripts/predist.mjs",
32
30
  "check": "node scripts/check.mjs",
33
- "pretest": "node scripts/predist.mjs",
34
31
  "test": "node scripts/runtests.mjs"
35
32
  },
36
33
  "keywords": [
package/scripts/check.mjs CHANGED
@@ -1,55 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
  // SPDX-License-Identifier: AGPL-3.0-or-later
3
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.
7
- /**
8
- * Syntax-check every file `node --check` should gate on, and report all of
9
- * them. Replaces the POSIX loop
10
- *
11
- * for f in src/*.js; do node --check "$f" || exit 1; done
12
- *
13
- * which npm runs through ComSpec on Windows, where `for…do…done` is not shell
14
- * syntax. A Node walker keeps `npm run check` identical on every OS, and — like
15
- * `runtests.mjs` — collects failures instead of stopping at the first one, so
16
- * one broken file cannot hide every file after it.
17
- */
18
- import { readdirSync } from 'node:fs';
19
- import { spawnSync } from 'node:child_process';
20
- import { dirname, join, resolve } from 'node:path';
21
- import { fileURLToPath } from 'node:url';
22
-
23
- const here = dirname(fileURLToPath(import.meta.url));
24
- const cliRoot = resolve(here, '..');
25
- const srcDir = join(cliRoot, 'src');
26
-
27
- const targets = [
28
- join(cliRoot, 'bin', 'aegiscode.js'),
29
- ...readdirSync(srcDir)
30
- .filter((f) => f.endsWith('.js'))
31
- .sort()
32
- .map((f) => join(srcDir, f)),
33
- join(here, 'predist.mjs'),
34
- ];
35
-
36
- if (targets.length === 0) {
37
- process.stderr.write('check: no files to check\n');
38
- process.exit(1);
39
- }
40
-
41
- const failed = [];
42
- for (const file of targets) {
43
- const res = spawnSync(process.execPath, ['--check', file], { stdio: 'inherit' });
44
- if (res.status !== 0) failed.push({ file, status: res.status });
45
- }
46
-
47
- if (failed.length) {
48
- process.stderr.write(`\ncheck failed (${failed.length}):\n`);
49
- for (const { file, status } of failed) {
50
- process.stderr.write(` \u2717 ${file} (exit ${status})\n`);
51
- }
52
- process.exit(1);
53
- }
54
-
55
- process.stdout.write(`check ok: ${targets.length} files\n`);
4
+ import{readdirSync as s}from"node:fs";import{spawnSync as e}from"node:child_process";import{dirname as t,join as o,resolve as r}from"node:path";import{fileURLToPath as c}from"node:url";const i=t(c(import.meta.url)),n=r(i,".."),p=o(n,"src"),f=[o(n,"bin","aegiscode.js"),...s(p).filter((s=>s.endsWith(".js"))).sort().map((s=>o(p,s))),o(i,"predist.mjs")];0===f.length&&(process.stderr.write("check: no files to check\n"),process.exit(1));const h=[];for(const s of f){const t=e(process.execPath,["--check",s],{stdio:"inherit"});0!==t.status&&h.push({file:s,status:t.status})}if(h.length){process.stderr.write(`\ncheck failed (${h.length}):\n`);for(const{file:s,status:e}of h)process.stderr.write(` ✗ ${s} (exit ${e})\n`);process.exit(1)}process.stdout.write(`check ok: ${f.length} files\n`);
package/scripts/demo.mjs CHANGED
@@ -1,97 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
  // SPDX-License-Identifier: AGPL-3.0-or-later
3
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.
7
- /**
8
- * Renders a canned session to stdout — banner, a prompt, a streamed answer with
9
- * markdown, the accounting line, and the status bar.
10
- *
11
- * No network and no key: this exists so the look can be reviewed (and pasted
12
- * into docs) without a live account, and so a regression in the layout is
13
- * visible to a human, not only to the width assertions in test/cli-render.
14
- *
15
- * node cli/scripts/demo.mjs [--light] [--width 84] [--plain]
16
- */
17
-
18
- import { createRequire } from 'node:module';
19
- import path from 'node:path';
20
- import { fileURLToPath } from 'node:url';
21
-
22
- const require = createRequire(import.meta.url);
23
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
24
- const src = path.join(__dirname, '..', 'src');
25
-
26
- const render = require(path.join(src, 'render.js'));
27
- const { stripAnsi } = require(path.join(src, 'screen.js'));
28
- const art = require(path.join(src, 'art.js'));
29
- // Read the version rather than hardcoding it — a demo that reports a stale
30
- // version is the kind of drift nobody notices until it is in the docs.
31
- const { version } = require(path.join(__dirname, '..', 'package.json'));
32
-
33
- const argv = process.argv.slice(2);
34
- const flag = (name, fallback) => {
35
- const i = argv.indexOf(name);
36
- return i === -1 ? fallback : argv[i + 1];
37
- };
38
- const width = Number(flag('--width', 0)) || Math.min(96, Math.max(48, process.stdout.columns || 84));
39
- const ctx = { light: argv.includes('--light') };
40
- const plain = argv.includes('--plain');
41
-
42
- const out = [];
43
- const push = (lines) => out.push(...(Array.isArray(lines) ? lines : [lines]));
44
-
45
- push(
46
- render.renderBanner(ctx, {
47
- width,
48
- version,
49
- model: 'nexus-brain',
50
- base: 'https://aegiscloud.org',
51
- key: 'aegis_••••4f2a',
52
- stream: true,
53
- })
54
- );
55
- push('');
56
- push(render.renderTurn(ctx, { role: 'user', text: 'summarise what changed in the token accounting' }, width));
57
- push(
58
- render.renderTurn(
59
- ctx,
60
- {
61
- role: 'assistant',
62
- text: [
63
- 'Three things changed, and one of them was costing you money:',
64
- '',
65
- '- the pool **merges** worker usage instead of overwriting it',
66
- '- cache reads and writes are billed, not ignored',
67
- '- a zero-token call no longer refunds its reservation',
68
- '',
69
- '```',
70
- 'merge_usage({input_tokens: 1250}, {output_tokens: 312})',
71
- '=> 1562 total',
72
- '```',
73
- '',
74
- 'Use `/balance` to see tokens beside € on every row.',
75
- ].join('\n'),
76
- meta: {
77
- model: 'nexus-brain',
78
- tokens: 1562,
79
- usage: { input: 1250, output: 312 },
80
- eur: 0.0007,
81
- ms: 4200,
82
- calls: 4,
83
- },
84
- },
85
- width
86
- )
87
- );
88
- push('');
89
- push(render.renderWorking(ctx, { tick: 3, verb: 'Consulting', elapsedMs: 2100 }));
90
- push(render.renderStatus(ctx, { model: 'nexus-brain', tokens: 1562, spend: 0.0007, mode: 'stream' }, width));
91
-
92
- process.stdout.write((plain ? out.map(stripAnsi) : out).join('\n') + '\n\n');
93
- if (!plain) {
94
- process.stdout.write(
95
- stripAnsi(`${art.WELCOME_TITLE} — ${out.length} lines rendered at ${width} cols${ctx.light ? ' (light)' : ''}\n`)
96
- );
97
- }
4
+ import{createRequire as e}from"node:module";import n from"node:path";import{fileURLToPath as r}from"node:url";const t=e(import.meta.url),s=n.dirname(r(import.meta.url)),o=n.join(s,"..","src"),i=t(n.join(o,"render.js")),{stripAnsi:a}=t(n.join(o,"screen.js")),d=t(n.join(o,"art.js")),{version:u}=t(n.join(s,"..","package.json")),l=process.argv.slice(2),m=Number(((e,n)=>{const r=l.indexOf("--width");return-1===r?0:l[r+1]})())||Math.min(96,Math.max(48,process.stdout.columns||84)),c={light:l.includes("--light")},g=l.includes("--plain"),p=[],h=e=>p.push(...Array.isArray(e)?e:[e]);h(i.renderBanner(c,{width:m,version:u,model:"nexus-brain",base:"https://aegiscloud.org",key:"aegis_••••4f2a",stream:!0})),h(""),h(i.renderTurn(c,{role:"user",text:"summarise what changed in the token accounting"},m)),h(i.renderTurn(c,{role:"assistant",text:["Three things changed, and one of them was costing you money:","","- the pool **merges** worker usage instead of overwriting it","- cache reads and writes are billed, not ignored","- a zero-token call no longer refunds its reservation","","```","merge_usage({input_tokens: 1250}, {output_tokens: 312})","=> 1562 total","```","","Use `/balance` to see tokens beside € on every row."].join("\n"),meta:{model:"nexus-brain",tokens:1562,usage:{input:1250,output:312},eur:7e-4,ms:4200,calls:4}},m)),h(""),h(i.renderWorking(c,{tick:3,verb:"Consulting",elapsedMs:2100})),h(i.renderStatus(c,{model:"nexus-brain",tokens:1562,spend:7e-4,mode:"stream"},m)),process.stdout.write((g?p.map(a):p).join("\n")+"\n\n"),g||process.stdout.write(a(`${d.WELCOME_TITLE} — ${p.length} lines rendered at ${m} cols${c.light?" (light)":""}\n`));
@@ -1,78 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
  // SPDX-License-Identifier: AGPL-3.0-or-later
3
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.
7
- /**
8
- * Pre-publish staging for the `aegiscode` package — a THIN WRAPPER.
9
- *
10
- * The manifest (and both shape emitters, and both proofs) moved to
11
- * `one/scripts/predist.mjs` in AEGISONE's phase ON2 (plan D6): one manifest,
12
- * two shapes. This file used to hold its own list of forty repo-relative
13
- * modules, kept in sync with `desktop/scripts/predist.mjs` by discipline alone.
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).
16
- *
17
- * Everything the CLI needs is unchanged as seen from outside: `npm run predist`,
18
- * `prepublishOnly`, `precheck` and `pretest` still run this file, it still
19
- * stages `cli/vendor/` in the repo's relative shape, and it still prints the
20
- * same proof lines (the staged registry loads standalone, the editor layer
21
- * resolves the STAGED server, the staged gate module loads).
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
- *
28
- * If the shared stager is not reachable the file is missing — this directory is
29
- * inside the published tarball, where `one/` is not shipped, and running predist
30
- * there is meaningless anyway (the vendor tree it would build is already in the
31
- * package). Say that plainly instead of failing with a MODULE_NOT_FOUND.
32
- */
33
- import path from 'node:path';
34
- import { fileURLToPath, pathToFileURL } from 'node:url';
35
- import { sealGate } from './seal-gate.mjs';
36
-
37
- const HERE = path.dirname(fileURLToPath(import.meta.url));
38
- const SHARED = path.join(HERE, '..', '..', 'one', 'scripts', 'predist.mjs');
39
-
40
- async function main(argv) {
41
- // `--quiet` is forwarded, not swallowed: `prepack` passes it so these
42
- // progress lines do not corrupt `npm pack --json`; publishing keeps them.
43
- const args = Array.isArray(argv) ? argv : process.argv.slice(2), quiet = args.includes('--quiet') ? ['--quiet'] : [];
44
- const gate = sealGate();
45
- if (!gate.ok && !process.env.AEGIS_ALLOW_UNSEALED) {
46
- process.stderr.write(
47
- `${gate.line}\n` +
48
- `cut: refusing to stage a package from it. Reseal the tree deliberately, or set ` +
49
- `AEGIS_ALLOW_UNSEALED=1 to stage a build that is known not to be the published one.\n`
50
- );
51
- return 1;
52
- }
53
- process.stderr.write(
54
- gate.ok
55
- ? `${gate.line}\n`
56
- : `${gate.line}\ncut: AEGIS_ALLOW_UNSEALED is set — staging anyway; this artifact will ` +
57
- `not match the published manifest.\n`
58
- );
59
- let shared;
60
- try {
61
- shared = await import(pathToFileURL(SHARED).href);
62
- } catch (error) {
63
- process.stderr.write(
64
- `predist: the shared stager is not reachable at ${SHARED}.\n` +
65
- `predist: it lives in the repo (one/scripts/predist.mjs) and is not shipped ` +
66
- `inside the aegiscode tarball — a built package already carries its vendor tree.\n` +
67
- `${(error && error.message) || error}\n`
68
- );
69
- return 1;
70
- }
71
- return shared.main(['--mirror-only', ...quiet]);
72
- }
73
-
74
- if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
75
- process.exitCode = await main(process.argv.slice(2));
76
- }
77
-
78
- export { main, sealGate };
4
+ import e from"node:path";import{fileURLToPath as r,pathToFileURL as t}from"node:url";import{sealGate as s}from"./seal-gate.mjs";const i=e.dirname(r(import.meta.url)),a=e.join(i,"..","..","one","scripts","predist.mjs");async function o(e){const r=(Array.isArray(e)?e:process.argv.slice(2)).includes("--quiet")?["--quiet"]:[],i=s();if(!i.ok&&!process.env.AEGIS_ALLOW_UNSEALED)return process.stderr.write(`${i.line}\ncut: refusing to stage a package from it. Reseal the tree deliberately, or set AEGIS_ALLOW_UNSEALED=1 to stage a build that is known not to be the published one.\n`),1;let o;process.stderr.write(i.ok?`${i.line}\n`:`${i.line}\ncut: AEGIS_ALLOW_UNSEALED is set — staging anyway; this artifact will not match the published manifest.\n`);try{o=await import(t(a).href)}catch(e){return process.stderr.write(`predist: the shared stager is not reachable at ${a}.\npredist: it lives in the repo (one/scripts/predist.mjs) and is not shipped inside the aegiscode tarball — a built package already carries its vendor tree.\n${e&&e.message||e}\n`),1}return o.main(["--mirror-only",...r])}process.argv[1]&&e.resolve(process.argv[1])===r(import.meta.url)&&(process.exitCode=await o(process.argv.slice(2)));export{o as main,s as sealGate};
@@ -1,59 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
  // SPDX-License-Identifier: AGPL-3.0-or-later
3
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.
7
- /**
8
- * Run every `test/cli-*.test.mjs` and report all of them.
9
- *
10
- * This replaces `for f in …; do node "$f" || exit 1; done`. That loop stops at
11
- * the first failure, and since the files run in glob (alphabetical) order, one
12
- * broken file silently hides every file after it — `cli-click` sorts 5th of 28,
13
- * so a single failure there meant 23 test files had not run at all while the
14
- * command still looked like "the suite".
15
- *
16
- * Failures are collected, each file's own output is streamed through, and the
17
- * summary names what failed. Exit is non-zero if anything failed, so CI and
18
- * `npm test` still gate on it.
19
- */
20
- import { readdirSync } from 'node:fs';
21
- import { spawnSync } from 'node:child_process';
22
- import { dirname, join, resolve } from 'node:path';
23
- import { fileURLToPath } from 'node:url';
24
-
25
- const here = dirname(fileURLToPath(import.meta.url));
26
- const testDir = resolve(here, '..', '..', 'test');
27
-
28
- const files = readdirSync(testDir)
29
- .filter((f) => /^cli-.*\.test\.mjs$/.test(f))
30
- .sort();
31
-
32
- if (files.length === 0) {
33
- process.stderr.write(`no cli-*.test.mjs found in ${testDir}\n`);
34
- process.exit(1);
35
- }
36
-
37
- const failed = [];
38
- const passed = [];
39
-
40
- for (const f of files) {
41
- const full = join(testDir, f);
42
- process.stdout.write(`\n── ${f} ${'─'.repeat(Math.max(0, 60 - f.length))}\n`);
43
- const res = spawnSync(process.execPath, [full], { stdio: 'inherit' });
44
- if (res.status === 0) {
45
- passed.push(f);
46
- } else {
47
- failed.push({ f, status: res.status, signal: res.signal });
48
- }
49
- }
50
-
51
- process.stdout.write(`\n${'═'.repeat(64)}\n`);
52
- process.stdout.write(`cli suite: ${passed.length}/${files.length} files passed\n`);
53
- if (failed.length) {
54
- process.stdout.write(`\nFAILED (${failed.length}):\n`);
55
- for (const { f, status, signal } of failed) {
56
- process.stdout.write(` ✗ ${f}${signal ? ` (signal ${signal})` : ` (exit ${status})`}\n`);
57
- }
58
- process.exit(1);
59
- }
4
+ import{readdirSync as t}from"node:fs";import{spawnSync as s}from"node:child_process";import{dirname as e,join as o,resolve as r}from"node:path";import{fileURLToPath as n}from"node:url";const i=r(e(n(import.meta.url)),"..","..","test"),c=t(i).filter((t=>/^cli-.*\.test\.mjs$/.test(t))).sort();0===c.length&&(process.stderr.write(`no cli-*.test.mjs found in ${i}\n`),process.exit(1));const p=[],l=[];for(const t of c){const e=o(i,t);process.stdout.write(`\n── ${t} ${"─".repeat(Math.max(0,60-t.length))}\n`);const r=s(process.execPath,[e],{stdio:"inherit"});0===r.status?l.push(t):p.push({f:t,status:r.status,signal:r.signal})}if(process.stdout.write(`\n${"═".repeat(64)}\n`),process.stdout.write(`cli suite: ${l.length}/${c.length} files passed\n`),p.length){process.stdout.write(`\nFAILED (${p.length}):\n`);for(const{f:t,status:s,signal:e}of p)process.stdout.write(` ✗ ${t}${e?` (signal ${e})`:` (exit ${s})`}\n`);process.exit(1)}
@@ -1,76 +1,3 @@
1
1
  // SPDX-License-Identifier: AGPL-3.0-or-later
2
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 };
3
+ import e from"node:path";import{createRequire as t}from"node:module";import{fileURLToPath as o}from"node:url";const r=e.dirname(o(import.meta.url)),i=e.join(r,".."),n=t(import.meta.url);function s(){let t,o;try{t=n(e.join(i,"src","limits.js")),o=n(e.join(i,"src","provenance.js"))}catch(e){return{ok:!1,line:`cut: the safety modules are unreadable (${e&&e.message||e}).`}}const r=t.check();if(r.tripped)return{ok:!1,line:`cut: the sealed set has moved (${r.code}) — this tree is not the published one.`};const s=o.selfCheck();return s.ok?{ok:!0,line:`cut: ${s.checked} sealed units verified — this tree is the published one.`}:{ok:!1,line:`cut: ${s.problems.join("; ")}`}}export{s as sealGate};
package/src/agents.js CHANGED
@@ -1,141 +1,3 @@
1
1
  // SPDX-License-Identifier: AGPL-3.0-or-later
2
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
- 'use strict';
7
-
8
- /**
9
- * Sub-agent prompt presets — ported verbatim from the upstream engine reference
10
- * (which in turn came from the reference's slash-commands builtinCommands.ts
11
- * buildMultiAgents() and the research-council member prompts). This build has
12
- * no parallel-agent runtime, so the presets are prompt composition:
13
- * /agents <role> <task> and /research <question> build the same specialist
14
- * prompts the reference hands to real sub-agents and run them through the
15
- * normal chat flow (c.runPrompt).
16
- */
17
-
18
- /** Role → system prompt, verbatim from the reference's buildMultiAgents. */
19
- const AGENT_PRESETS = {
20
- synthesizer: `You are a senior technical lead. Given analysis from multiple specialist agents, synthesize their findings into a clear, actionable summary.
21
- Structure your response as: key findings, recommended approach, top action items.
22
- Be direct, concrete, and avoid repeating everything the agents said.
23
- Focus on delivering a decision-ready synthesis.`,
24
-
25
- architect: `You are a System Architect. Design the new application architecture.
26
- Define: project structure, tech stack, directory layout, key modules, data flow, API design.
27
- Consider: scalability, maintainability, testing strategy, deployment.
28
- Output a concrete file tree and architecture decisions log. Be specific.`,
29
-
30
- scaffolder: `You are a Project Scaffolder. Build the complete application from scratch.
31
-
32
- YOUR JOB IS TO CREATE ALL PROJECT FILES - not just describe them.
33
-
34
- Use Write to create: package.json, tsconfig.json, source files, configs, tests.
35
- Generate COMPLETE, WORKING code - not stubs or placeholders.
36
- Set up build scripts, lint config, and any necessary tooling.
37
-
38
- After creating files, use Bash to run: npm/pnpm install, then build/compile.
39
- Fix any errors until the project builds successfully.
40
-
41
- Be thorough - a real, runnable project is the goal.`,
42
-
43
- planner: `You are a Refactoring Planner. Given the analyzer findings, create a step-by-step plan.
44
- Each step: file path, what to change, why, risk level (LOW/MEDIUM/HIGH).
45
- Include before/after snippets. Order by impact. Be concrete.`,
46
-
47
- implementer: `You are an Implementation Engineer. Execute the refactoring plan.
48
- Use Edit and Write to make actual code changes.
49
- After each change, use Read to verify correctness. Keep existing code style.
50
- Run build commands to ensure nothing is broken.`,
51
-
52
- reviewer: `You are a Code Reviewer. Review the approach and code.
53
- Check: logic errors, type safety, error handling, performance, security.
54
- Be critical but constructive. Report specific issues with file paths.`,
55
-
56
- debugger: `You are a Debugging Specialist. Analyze potential issues and edge cases.
57
- Identify: failure modes, error handling gaps, testing considerations.
58
- Think about what could go wrong and how to prevent it.`,
59
-
60
- scanner: `You are a Security Vulnerability Scanner.
61
- Scan for: hardcoded API keys/secrets, SQL injection, XSS, unsafe eval/exec, path traversal.
62
- Use Grep with targeted patterns. Report every finding with: file path, severity (CRITICAL/HIGH/MEDIUM/LOW), line number.`,
63
-
64
- analyzer: `You are a Code Analyzer. Find refactoring opportunities.
65
- Look for: duplicated code, long functions (>20 lines), complex conditionals, unused imports,
66
- circular dependencies, inconsistent patterns. Report with file paths and line numbers.`,
67
- };
68
-
69
- /** Human-readable role label for a preset id (falls back to the id). */
70
- function agentRoleLabel(role) {
71
- const labels = {
72
- synthesizer: 'Technical Lead', architect: 'System Architect',
73
- scaffolder: 'Project Scaffolder', planner: 'Refactoring Planner',
74
- implementer: 'Implementation Engineer', reviewer: 'Code Reviewer',
75
- debugger: 'Debugging Specialist', scanner: 'Vulnerability Scanner',
76
- analyzer: 'Code Analyzer',
77
- };
78
- return labels[role] || role;
79
- }
80
-
81
- /** Compose a sub-agent prompt: the role's system prompt + the task. */
82
- function composeAgentPrompt(role, task) {
83
- return `${AGENT_PRESETS[role]}\n\nTask: ${task}\n\nRespond directly — no preamble.`;
84
- }
85
-
86
- /** Every preset id, in palette order. */
87
- function agentRoles() {
88
- return Object.keys(AGENT_PRESETS);
89
- }
90
-
91
- /**
92
- * The research-council prompt (Analyst/Architect/Ethicist/Pragmatist),
93
- * ported from the reference's /research command. Includes the workspace
94
- * context note so the model can read real files.
95
- */
96
- function composeResearchPrompt(question, workspaceRoot = process.cwd()) {
97
- return [
98
- `Research the following question from four perspectives, then synthesize:`,
99
- ``,
100
- `Question: ${question}`,
101
- ``,
102
- `You are a research council with these members:`,
103
- `- Analyst: reasons from data, statistics, and empirical evidence; values measurable outcomes.`,
104
- `- Architect: evaluates designs, tradeoffs, and architectural decisions; focuses on scalability, maintainability, and system coherence.`,
105
- `- Ethicist: evaluates safety, fairness, privacy, and societal impact; raises concerns others miss.`,
106
- `- Pragmatist: evaluates practicality, implementation effort, and real-world constraints; balances idealism with what works in production.`,
107
- ``,
108
- `Workspace: ${workspaceRoot} — read files with Read, search with Grep, browse with Glob, and check recent git changes with Git to ground your analysis in the real codebase.`,
109
- ``,
110
- `Format: one reasoned section per perspective, then a Synthesis with a clear recommendation. Always state VOTE: approve, reject, or abstain and REASONING with clear justification.`,
111
- ].join('\n');
112
- }
113
-
114
- /**
115
- * A structured debate prompt for the current model (the reference runs a
116
- * real multi-model DiscussionRoom; this build simulates the debate on the
117
- * one configured backend, which the note makes explicit).
118
- */
119
- function composeDebatePrompt(topic, modelId = '') {
120
- return [
121
- `Hold a structured debate on: ${topic}`,
122
- ``,
123
- `Present two opposing positions fairly (with the strongest argument FOR and AGAINST), then act as moderator:`,
124
- `1. Opening statements for each side.`,
125
- `2. Rebuttals — each side attacks the other's weakest claim.`,
126
- `3. Cross-examination questions and answers.`,
127
- `4. Closing statements.`,
128
- `5. A moderator verdict summarizing where each side won and a final recommendation.`,
129
- ``,
130
- `Be rigorous and balanced — steelman both sides before judging.${modelId ? ` (Simulated on ${modelId} — the reference runs a multi-model discussion.)` : ''}`,
131
- ].join('\n');
132
- }
133
-
134
- module.exports = {
135
- AGENT_PRESETS,
136
- agentRoleLabel,
137
- composeAgentPrompt,
138
- agentRoles,
139
- composeResearchPrompt,
140
- composeDebatePrompt,
141
- };
3
+ "use strict";const AGENT_PRESETS={synthesizer:"You are a senior technical lead. Given analysis from multiple specialist agents, synthesize their findings into a clear, actionable summary.\nStructure your response as: key findings, recommended approach, top action items.\nBe direct, concrete, and avoid repeating everything the agents said.\nFocus on delivering a decision-ready synthesis.",architect:"You are a System Architect. Design the new application architecture.\nDefine: project structure, tech stack, directory layout, key modules, data flow, API design.\nConsider: scalability, maintainability, testing strategy, deployment.\nOutput a concrete file tree and architecture decisions log. Be specific.",scaffolder:"You are a Project Scaffolder. Build the complete application from scratch.\n\nYOUR JOB IS TO CREATE ALL PROJECT FILES - not just describe them.\n\nUse Write to create: package.json, tsconfig.json, source files, configs, tests.\nGenerate COMPLETE, WORKING code - not stubs or placeholders.\nSet up build scripts, lint config, and any necessary tooling.\n\nAfter creating files, use Bash to run: npm/pnpm install, then build/compile.\nFix any errors until the project builds successfully.\n\nBe thorough - a real, runnable project is the goal.",planner:"You are a Refactoring Planner. Given the analyzer findings, create a step-by-step plan.\nEach step: file path, what to change, why, risk level (LOW/MEDIUM/HIGH).\nInclude before/after snippets. Order by impact. Be concrete.",implementer:"You are an Implementation Engineer. Execute the refactoring plan.\nUse Edit and Write to make actual code changes.\nAfter each change, use Read to verify correctness. Keep existing code style.\nRun build commands to ensure nothing is broken.",reviewer:"You are a Code Reviewer. Review the approach and code.\nCheck: logic errors, type safety, error handling, performance, security.\nBe critical but constructive. Report specific issues with file paths.",debugger:"You are a Debugging Specialist. Analyze potential issues and edge cases.\nIdentify: failure modes, error handling gaps, testing considerations.\nThink about what could go wrong and how to prevent it.",scanner:"You are a Security Vulnerability Scanner.\nScan for: hardcoded API keys/secrets, SQL injection, XSS, unsafe eval/exec, path traversal.\nUse Grep with targeted patterns. Report every finding with: file path, severity (CRITICAL/HIGH/MEDIUM/LOW), line number.",analyzer:"You are a Code Analyzer. Find refactoring opportunities.\nLook for: duplicated code, long functions (>20 lines), complex conditionals, unused imports,\ncircular dependencies, inconsistent patterns. Report with file paths and line numbers."};function agentRoleLabel(e){return{synthesizer:"Technical Lead",architect:"System Architect",scaffolder:"Project Scaffolder",planner:"Refactoring Planner",implementer:"Implementation Engineer",reviewer:"Code Reviewer",debugger:"Debugging Specialist",scanner:"Vulnerability Scanner",analyzer:"Code Analyzer"}[e]||e}function composeAgentPrompt(e,t){return`${AGENT_PRESETS[e]}\n\nTask: ${t}\n\nRespond directly — no preamble.`}function agentRoles(){return Object.keys(AGENT_PRESETS)}function composeResearchPrompt(e,t=process.cwd()){return["Research the following question from four perspectives, then synthesize:","",`Question: ${e}`,"","You are a research council with these members:","- Analyst: reasons from data, statistics, and empirical evidence; values measurable outcomes.","- Architect: evaluates designs, tradeoffs, and architectural decisions; focuses on scalability, maintainability, and system coherence.","- Ethicist: evaluates safety, fairness, privacy, and societal impact; raises concerns others miss.","- Pragmatist: evaluates practicality, implementation effort, and real-world constraints; balances idealism with what works in production.","",`Workspace: ${t} — read files with Read, search with Grep, browse with Glob, and check recent git changes with Git to ground your analysis in the real codebase.`,"","Format: one reasoned section per perspective, then a Synthesis with a clear recommendation. Always state VOTE: approve, reject, or abstain and REASONING with clear justification."].join("\n")}function composeDebatePrompt(e,t=""){return[`Hold a structured debate on: ${e}`,"","Present two opposing positions fairly (with the strongest argument FOR and AGAINST), then act as moderator:","1. Opening statements for each side.","2. Rebuttals — each side attacks the other's weakest claim.","3. Cross-examination questions and answers.","4. Closing statements.","5. A moderator verdict summarizing where each side won and a final recommendation.","","Be rigorous and balanced — steelman both sides before judging."+(t?` (Simulated on ${t} — the reference runs a multi-model discussion.)`:"")].join("\n")}module.exports={AGENT_PRESETS:AGENT_PRESETS,agentRoleLabel:agentRoleLabel,composeAgentPrompt:composeAgentPrompt,agentRoles:agentRoles,composeResearchPrompt:composeResearchPrompt,composeDebatePrompt:composeDebatePrompt};