aegisone 1.0.21 → 1.0.23

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 (226) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +1 -1
  3. package/SOURCE-OFFER.txt +9 -0
  4. package/bin/aegis.js +1 -322
  5. package/package.json +4 -2
  6. package/scripts/bump.mjs +1 -211
  7. package/scripts/bundle.js +1 -129
  8. package/scripts/predist.mjs +1 -939
  9. package/src/child.js +1 -285
  10. package/src/dispatch.js +1 -269
  11. package/src/doctor.js +1 -639
  12. package/src/host.js +1 -111
  13. package/src/permissions.js +1 -369
  14. package/src/probes.js +1 -159
  15. package/src/release.js +1 -409
  16. package/vendor/cli/bin/aegiscode.js +2 -914
  17. package/vendor/cli/package.json +3 -2
  18. package/vendor/cli/scripts/check.mjs +1 -52
  19. package/vendor/cli/scripts/demo.mjs +1 -94
  20. package/vendor/cli/scripts/predist.mjs +1 -75
  21. package/vendor/cli/scripts/runtests.mjs +1 -56
  22. package/vendor/cli/scripts/seal-gate.mjs +1 -74
  23. package/vendor/cli/src/agents.js +1 -139
  24. package/vendor/cli/src/app.js +1 -2932
  25. package/vendor/cli/src/art.js +1 -289
  26. package/vendor/cli/src/autonomous.js +1 -515
  27. package/vendor/cli/src/caps.js +1 -879
  28. package/vendor/cli/src/chatflow.js +1 -3008
  29. package/vendor/cli/src/checkpoint.js +1 -90
  30. package/vendor/cli/src/clipboard.js +1 -424
  31. package/vendor/cli/src/cloudsync.js +1 -528
  32. package/vendor/cli/src/commands.js +1 -3987
  33. package/vendor/cli/src/config.js +1 -581
  34. package/vendor/cli/src/connect.js +1 -349
  35. package/vendor/cli/src/credentials.js +1 -33
  36. package/vendor/cli/src/deps.js +1 -232
  37. package/vendor/cli/src/devrun.js +1 -187
  38. package/vendor/cli/src/diff.js +1 -333
  39. package/vendor/cli/src/diffview.js +1 -296
  40. package/vendor/cli/src/engine.js +1 -297
  41. package/vendor/cli/src/entitlement.js +1 -355
  42. package/vendor/cli/src/events.js +1 -707
  43. package/vendor/cli/src/export.js +1 -67
  44. package/vendor/cli/src/fingerprint.js +1 -592
  45. package/vendor/cli/src/format.js +1 -259
  46. package/vendor/cli/src/fuzzy.js +1 -119
  47. package/vendor/cli/src/gate.js +1 -55
  48. package/vendor/cli/src/history.js +1 -401
  49. package/vendor/cli/src/init.js +1 -175
  50. package/vendor/cli/src/input.js +1 -139
  51. package/vendor/cli/src/keys.js +1 -183
  52. package/vendor/cli/src/limits.js +1 -190
  53. package/vendor/cli/src/markdown.js +1 -306
  54. package/vendor/cli/src/mcp.js +1 -694
  55. package/vendor/cli/src/models.js +1 -487
  56. package/vendor/cli/src/naming.js +1 -229
  57. package/vendor/cli/src/overlays.js +1 -461
  58. package/vendor/cli/src/panels.js +1 -1418
  59. package/vendor/cli/src/permissions.js +1 -290
  60. package/vendor/cli/src/ping.js +1 -226
  61. package/vendor/cli/src/presence.js +1 -238
  62. package/vendor/cli/src/provenance.js +2 -182
  63. package/vendor/cli/src/render.js +1 -515
  64. package/vendor/cli/src/screen.js +1 -518
  65. package/vendor/cli/src/screens.js +1 -896
  66. package/vendor/cli/src/secret.js +1 -59
  67. package/vendor/cli/src/securefs.js +1 -359
  68. package/vendor/cli/src/settings.js +1 -155
  69. package/vendor/cli/src/shared.js +1 -52
  70. package/vendor/cli/src/sharedpaths.js +1 -53
  71. package/vendor/cli/src/signup.js +1 -156
  72. package/vendor/cli/src/summarize.js +1 -95
  73. package/vendor/cli/src/sysdiag.js +1 -585
  74. package/vendor/cli/src/system.js +1 -40
  75. package/vendor/cli/src/theme.js +1 -570
  76. package/vendor/cli/src/title.js +1 -220
  77. package/vendor/cli/src/todos.js +1 -115
  78. package/vendor/cli/src/tokens.js +1 -263
  79. package/vendor/cli/src/topup.js +1 -210
  80. package/vendor/cli/src/update.js +1 -181
  81. package/vendor/cli/vendor/client/aegis.js +1 -2054
  82. package/vendor/cli/vendor/client/attest.js +1 -442
  83. package/vendor/cli/vendor/client/authorship-key.js +1 -410
  84. package/vendor/cli/vendor/client/auto-provision.js +1 -134
  85. package/vendor/cli/vendor/client/brain-catalog.js +1 -268
  86. package/vendor/cli/vendor/client/byok-catalog.js +1 -230
  87. package/vendor/cli/vendor/client/credentials.js +1 -494
  88. package/vendor/cli/vendor/client/device-fingerprint.js +1 -141
  89. package/vendor/cli/vendor/client/drive-connect.js +1 -85
  90. package/vendor/cli/vendor/client/drive-upload.js +1 -174
  91. package/vendor/cli/vendor/client/env-file.js +1 -1273
  92. package/vendor/cli/vendor/client/fingerprint.js +1 -1064
  93. package/vendor/cli/vendor/client/foreign-memory.js +1 -669
  94. package/vendor/cli/vendor/client/google-signin.js +1 -125
  95. package/vendor/cli/vendor/client/hooks.js +1 -430
  96. package/vendor/cli/vendor/client/model-discovery.js +1 -330
  97. package/vendor/cli/vendor/client/platform.js +1 -937
  98. package/vendor/cli/vendor/client/prefs.js +1 -351
  99. package/vendor/cli/vendor/client/presence-constants.js +1 -107
  100. package/vendor/cli/vendor/client/presence.js +1 -438
  101. package/vendor/cli/vendor/client/record-vault.js +3 -1055
  102. package/vendor/cli/vendor/client/session-store.js +1 -548
  103. package/vendor/cli/vendor/client/topup.js +1 -297
  104. package/vendor/cli/vendor/client/touch.js +1 -458
  105. package/vendor/cli/vendor/client/update.js +1 -704
  106. package/vendor/cli/vendor/client/user-models.js +1 -381
  107. package/vendor/cli/vendor/desktop/lib/local/agents.js +1 -105
  108. package/vendor/cli/vendor/desktop/lib/local/autonomous.js +1 -1045
  109. package/vendor/cli/vendor/desktop/lib/local/claude-pro.js +1 -993
  110. package/vendor/cli/vendor/desktop/lib/local/context.js +1 -95
  111. package/vendor/cli/vendor/desktop/lib/local/engine.js +1 -3228
  112. package/vendor/cli/vendor/desktop/lib/local/entitlement.js +1 -654
  113. package/vendor/cli/vendor/desktop/lib/local/git-scope.js +1 -228
  114. package/vendor/cli/vendor/desktop/lib/local/local.js +1 -2135
  115. package/vendor/cli/vendor/desktop/lib/local/prompt.js +1 -275
  116. package/vendor/cli/vendor/desktop/lib/local/queue.js +1 -560
  117. package/vendor/cli/vendor/desktop/lib/local/session-rounds.js +1 -208
  118. package/vendor/cli/vendor/desktop/lib/local/shell.js +1 -680
  119. package/vendor/cli/vendor/desktop/lib/local/tools.js +1 -1238
  120. package/vendor/cli/vendor/desktop/lib/local/turn-guard.js +1 -300
  121. package/vendor/cli/vendor/desktop/lib/local/worktree-lock.js +1 -235
  122. package/vendor/cli/vendor/desktop/lib/settings.js +1 -890
  123. package/vendor/cli/vendor/desktop/renderer/usage.js +1 -1239
  124. package/vendor/cli/vendor/hosts/install.js +1 -638
  125. package/vendor/cli/vendor/hosts/openai-shim.js +1 -515
  126. package/vendor/cli/vendor/hosts/spec.js +1 -164
  127. package/vendor/cli/vendor/hosts/targets.js +1 -346
  128. package/vendor/cli/vendor/mcp/server.js +1 -221
  129. package/vendor/cli/vendor/mcp/tools.js +1 -408
  130. package/vendor/cli/vendor/one/src/child.js +1 -285
  131. package/vendor/cli/vendor/one/src/permissions.js +1 -369
  132. package/vendor/desktop/bin/aegis.js +1 -32
  133. package/vendor/desktop/lib/account-key.js +1 -56
  134. package/vendor/desktop/lib/auto.js +1 -430
  135. package/vendor/desktop/lib/avatar/companion.js +1 -698
  136. package/vendor/desktop/lib/avatar/cosmetics.js +1 -532
  137. package/vendor/desktop/lib/avatar/events.js +1 -344
  138. package/vendor/desktop/lib/avatar/holder-turn.js +1 -350
  139. package/vendor/desktop/lib/avatar/holders.js +1 -612
  140. package/vendor/desktop/lib/avatar/identity.js +1 -641
  141. package/vendor/desktop/lib/avatar/level.js +1 -368
  142. package/vendor/desktop/lib/avatar/mirror.js +1 -524
  143. package/vendor/desktop/lib/avatar/persona.js +1 -388
  144. package/vendor/desktop/lib/avatar/profile.js +1 -977
  145. package/vendor/desktop/lib/avatar/register.js +1 -307
  146. package/vendor/desktop/lib/avatar/store.js +1 -472
  147. package/vendor/desktop/lib/avatar/tiers.js +1 -38
  148. package/vendor/desktop/lib/avatar/transfer.js +1 -415
  149. package/vendor/desktop/lib/avatar/turn.js +1 -216
  150. package/vendor/desktop/lib/avatar/voice.js +1 -328
  151. package/vendor/desktop/lib/avatar/xp.js +1 -404
  152. package/vendor/desktop/lib/deep-link.js +1 -120
  153. package/vendor/desktop/lib/fingerprint.js +2 -347
  154. package/vendor/desktop/lib/google-connect.js +1 -169
  155. package/vendor/desktop/lib/local/agents.js +1 -105
  156. package/vendor/desktop/lib/local/autonomous.js +1 -1045
  157. package/vendor/desktop/lib/local/claude-pro.js +1 -993
  158. package/vendor/desktop/lib/local/context.js +1 -95
  159. package/vendor/desktop/lib/local/engine.js +1 -3228
  160. package/vendor/desktop/lib/local/entitlement.js +1 -654
  161. package/vendor/desktop/lib/local/git-scope.js +1 -228
  162. package/vendor/desktop/lib/local/local.js +1 -2135
  163. package/vendor/desktop/lib/local/prompt.js +1 -275
  164. package/vendor/desktop/lib/local/queue.js +1 -560
  165. package/vendor/desktop/lib/local/session-rounds.js +1 -208
  166. package/vendor/desktop/lib/local/shell.js +1 -680
  167. package/vendor/desktop/lib/local/telemetry.js +1 -470
  168. package/vendor/desktop/lib/local/tools.js +1 -1238
  169. package/vendor/desktop/lib/local/turn-guard.js +1 -300
  170. package/vendor/desktop/lib/local/worktree-lock.js +1 -235
  171. package/vendor/desktop/lib/provider-key-mirror.js +1 -252
  172. package/vendor/desktop/lib/quick-launcher.js +1 -84
  173. package/vendor/desktop/lib/settings.js +1 -890
  174. package/vendor/desktop/lib/sync/memory-queue.js +1 -60
  175. package/vendor/desktop/lib/sync/persist-gate.js +1 -148
  176. package/vendor/desktop/lib/sync/sessions.js +1 -106
  177. package/vendor/desktop/lib/window-state.js +1 -66
  178. package/vendor/desktop/main.js +1 -4390
  179. package/vendor/desktop/package.json +3 -5
  180. package/vendor/desktop/preload.js +1 -628
  181. package/vendor/desktop/renderer/app.js +1 -6560
  182. package/vendor/desktop/renderer/avatar/assemble.js +1 -335
  183. package/vendor/desktop/renderer/avatar/avatar.js +1 -380
  184. package/vendor/desktop/renderer/avatar/cards.js +1 -141
  185. package/vendor/desktop/renderer/avatar/hud.js +1 -206
  186. package/vendor/desktop/renderer/avatar/machine.js +1 -213
  187. package/vendor/desktop/renderer/avatar/pane.js +1 -439
  188. package/vendor/desktop/renderer/avatar/parts.js +1 -437
  189. package/vendor/desktop/renderer/budget.js +1 -168
  190. package/vendor/desktop/renderer/companion.js +1 -223
  191. package/vendor/desktop/renderer/diff.js +1 -359
  192. package/vendor/desktop/renderer/diffview.js +1 -336
  193. package/vendor/desktop/renderer/fingerprint.js +3 -720
  194. package/vendor/desktop/renderer/markdown.js +1 -168
  195. package/vendor/desktop/renderer/provider-toolbar.js +1 -134
  196. package/vendor/desktop/renderer/providers.js +1 -259
  197. package/vendor/desktop/renderer/quick.js +1 -191
  198. package/vendor/desktop/renderer/stream-policy.js +1 -306
  199. package/vendor/desktop/renderer/transcript-view.js +1 -323
  200. package/vendor/desktop/renderer/usage.js +1 -1239
  201. package/vendor/desktop/vendor/aegis.js +1 -2054
  202. package/vendor/desktop/vendor/attest.js +1 -442
  203. package/vendor/desktop/vendor/authorship-key.js +1 -410
  204. package/vendor/desktop/vendor/auto-provision.js +1 -134
  205. package/vendor/desktop/vendor/brain-catalog.js +1 -268
  206. package/vendor/desktop/vendor/byok-catalog.js +1 -230
  207. package/vendor/desktop/vendor/credentials.js +1 -494
  208. package/vendor/desktop/vendor/device-fingerprint.js +1 -141
  209. package/vendor/desktop/vendor/drive-connect.js +1 -85
  210. package/vendor/desktop/vendor/drive-upload.js +1 -174
  211. package/vendor/desktop/vendor/env-file.js +1 -1273
  212. package/vendor/desktop/vendor/fingerprint.js +1 -1064
  213. package/vendor/desktop/vendor/foreign-memory.js +1 -669
  214. package/vendor/desktop/vendor/google-signin.js +1 -125
  215. package/vendor/desktop/vendor/hooks.js +1 -430
  216. package/vendor/desktop/vendor/model-discovery.js +1 -330
  217. package/vendor/desktop/vendor/platform.js +1 -937
  218. package/vendor/desktop/vendor/prefs.js +1 -351
  219. package/vendor/desktop/vendor/presence-constants.js +1 -107
  220. package/vendor/desktop/vendor/presence.js +1 -438
  221. package/vendor/desktop/vendor/record-vault.js +3 -1055
  222. package/vendor/desktop/vendor/session-store.js +1 -548
  223. package/vendor/desktop/vendor/topup.js +1 -297
  224. package/vendor/desktop/vendor/touch.js +1 -458
  225. package/vendor/desktop/vendor/update.js +1 -704
  226. package/vendor/desktop/vendor/user-models.js +1 -381
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "aegiscode",
3
3
  "productName": "AEGIS Code",
4
- "version": "7.0.13",
4
+ "version": "7.0.15",
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,7 +18,8 @@
18
18
  "src",
19
19
  "scripts",
20
20
  "vendor",
21
- "README.md"
21
+ "README.md",
22
+ "SOURCE-OFFER.txt"
22
23
  ],
23
24
  "engines": {
24
25
  "node": ">=22.0.0"
@@ -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 i}from"node:url";const c=t(i(import.meta.url)),n=r(c,".."),a=o(n,"src"),p=[o(n,"bin","aegiscode.js"),...s(a).filter((s=>s.endsWith(".js"))).sort().map((s=>o(a,s))),o(c,"predist.mjs")];0===p.length&&(process.stderr.write("check: no files to check\n"),process.exit(1));const d=[];for(const s of p){const t=e(process.execPath,["--check",s],{stdio:"inherit"});0!==t.status&&d.push({file:s,status:t.status})}if(d.length){process.stderr.write(`\ncheck failed (${d.length}):\n`);for(const{file:s,status:e}of d)process.stderr.write(` ✗ ${s} (exit ${e})\n`);process.exit(1)}process.stdout.write(`check ok: ${p.length} files\n`);
@@ -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 t,pathToFileURL as r}from"node:url";import{sealGate as s}from"./seal-gate.mjs";const a=e.dirname(t(import.meta.url)),i=e.join(a,"..","..","one","scripts","predist.mjs");async function o(e){const t=(Array.isArray(e)?e:process.argv.slice(2)).includes("--quiet")?["--quiet"]:[],a=s();if(!a.ok&&!process.env.AEGIS_ALLOW_UNSEALED)return process.stderr.write(`${a.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(a.ok?`${a.line}\n`:`${a.line}\ncut: AEGIS_ALLOW_UNSEALED is set — staging anyway; this artifact will not match the published manifest.\n`);try{o=await import(r(i).href)}catch(e){return process.stderr.write(`predist: the shared stager is not reachable at ${i}.\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",...t])}process.argv[1]&&e.resolve(process.argv[1])===t(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 s}from"node:fs";import{spawnSync as t}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"),a=s(i).filter((s=>/^cli-.*\.test\.mjs$/.test(s))).sort();0===a.length&&(process.stderr.write(`no cli-*.test.mjs found in ${i}\n`),process.exit(1));const c=[],p=[];for(const s of a){const e=o(i,s);process.stdout.write(`\n── ${s} ${"─".repeat(Math.max(0,60-s.length))}\n`);const r=t(process.execPath,[e],{stdio:"inherit"});0===r.status?p.push(s):c.push({f:s,status:r.status,signal:r.signal})}if(process.stdout.write(`\n${"═".repeat(64)}\n`),process.stdout.write(`cli suite: ${p.length}/${a.length} files passed\n`),c.length){process.stdout.write(`\nFAILED (${c.length}):\n`);for(const{f:s,status:t,signal:e}of c)process.stdout.write(` ✗ ${s}${e?` (signal ${e})`:` (exit ${t})`}\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,".."),s=t(import.meta.url);function n(){let t,o;try{t=s(e.join(i,"src","limits.js")),o=s(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 n=o.selfCheck();return n.ok?{ok:!0,line:`cut: ${n.checked} sealed units verified — this tree is the published one.`}:{ok:!1,line:`cut: ${n.problems.join("; ")}`}}export{n as sealGate};
@@ -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};