aegisone 1.0.23 → 1.0.25

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 (71) hide show
  1. package/README.md +2 -2
  2. package/package.json +1 -4
  3. package/scripts/predist.mjs +1 -1
  4. package/src/permissions.js +1 -1
  5. package/vendor/cli/bin/aegiscode.js +915 -2
  6. package/vendor/cli/package.json +1 -6
  7. package/vendor/cli/src/app.js +1 -1
  8. package/vendor/cli/src/autonomous.js +515 -1
  9. package/vendor/cli/src/caps.js +879 -1
  10. package/vendor/cli/src/chatflow.js +1 -1
  11. package/vendor/cli/src/commands.js +1 -1
  12. package/vendor/cli/src/engine.js +1 -1
  13. package/vendor/cli/src/gate.js +55 -1
  14. package/vendor/cli/src/history.js +1 -1
  15. package/vendor/cli/src/limits.js +190 -1
  16. package/vendor/cli/src/mcp.js +694 -1
  17. package/vendor/cli/src/models.js +1 -1
  18. package/vendor/cli/src/overlays.js +1 -1
  19. package/vendor/cli/src/permissions.js +290 -1
  20. package/vendor/cli/src/provenance.js +182 -2
  21. package/vendor/cli/src/provenance.lock.json +2 -2
  22. package/vendor/cli/vendor/client/aegis.js +1 -1
  23. package/vendor/cli/vendor/client/attest.js +1 -1
  24. package/vendor/cli/vendor/client/byok-catalog.js +1 -1
  25. package/vendor/cli/vendor/client/catalog-client.js +3 -0
  26. package/vendor/cli/vendor/client/conversation-export.js +3 -0
  27. package/vendor/cli/vendor/client/drive-upload.js +1 -1
  28. package/vendor/cli/vendor/client/session-store.js +1 -1
  29. package/vendor/cli/vendor/desktop/lib/local/attachments.js +3 -0
  30. package/vendor/cli/vendor/desktop/lib/local/claude-pro.js +1 -1
  31. package/vendor/cli/vendor/desktop/lib/local/context.js +1 -1
  32. package/vendor/cli/vendor/desktop/lib/local/engine.js +1 -1
  33. package/vendor/cli/vendor/desktop/lib/local/exec-plan.js +3 -0
  34. package/vendor/cli/vendor/desktop/lib/local/local.js +1 -1
  35. package/vendor/cli/vendor/desktop/lib/local/prompt.js +1 -1
  36. package/vendor/cli/vendor/desktop/lib/local/session-rounds.js +1 -1
  37. package/vendor/cli/vendor/desktop/lib/local/shell.js +1 -1
  38. package/vendor/cli/vendor/desktop/lib/local/spill.js +3 -0
  39. package/vendor/cli/vendor/desktop/lib/local/tools.js +1 -1
  40. package/vendor/cli/vendor/one/src/permissions.js +1 -1
  41. package/vendor/desktop/lib/auto.js +1 -1
  42. package/vendor/desktop/lib/google-connect.js +1 -1
  43. package/vendor/desktop/lib/local/attachments.js +3 -0
  44. package/vendor/desktop/lib/local/claude-pro.js +1 -1
  45. package/vendor/desktop/lib/local/context.js +1 -1
  46. package/vendor/desktop/lib/local/engine.js +1 -1
  47. package/vendor/desktop/lib/local/exec-plan.js +3 -0
  48. package/vendor/desktop/lib/local/local.js +1 -1
  49. package/vendor/desktop/lib/local/prompt.js +1 -1
  50. package/vendor/desktop/lib/local/session-rounds.js +1 -1
  51. package/vendor/desktop/lib/local/shell.js +1 -1
  52. package/vendor/desktop/lib/local/spill.js +3 -0
  53. package/vendor/desktop/lib/local/tools.js +1 -1
  54. package/vendor/desktop/main.js +1 -1
  55. package/vendor/desktop/package.json +3 -5
  56. package/vendor/desktop/preload.js +1 -1
  57. package/vendor/desktop/renderer/app.js +1 -1
  58. package/vendor/desktop/renderer/budget.js +1 -1
  59. package/vendor/desktop/renderer/fingerprint.js +2 -2
  60. package/vendor/desktop/renderer/index.html +44 -4
  61. package/vendor/desktop/renderer/quick.html +4 -1
  62. package/vendor/desktop/renderer/quick.js +1 -1
  63. package/vendor/desktop/renderer/stream-policy.js +1 -1
  64. package/vendor/desktop/renderer/style.css +124 -0
  65. package/vendor/desktop/vendor/aegis.js +1 -1
  66. package/vendor/desktop/vendor/attest.js +1 -1
  67. package/vendor/desktop/vendor/byok-catalog.js +1 -1
  68. package/vendor/desktop/vendor/catalog-client.js +3 -0
  69. package/vendor/desktop/vendor/conversation-export.js +3 -0
  70. package/vendor/desktop/vendor/drive-upload.js +1 -1
  71. package/vendor/desktop/vendor/session-store.js +1 -1
@@ -1,3 +1,192 @@
1
1
  // SPDX-License-Identifier: AGPL-3.0-or-later
2
2
  // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
3
- "use strict";const{createHash:createHash}=require("node:crypto"),{existsSync:existsSync,readFileSync:readFileSync}=require("node:fs"),path=require("node:path"),PACKAGE_ROOT=path.join(__dirname,".."),SALT="aegiscode-interlock-v1",PAD="aegis-interlock-pad-v1",sha256=e=>createHash("sha256").update(e).digest("hex"),PAD_HEX=sha256(PAD);function unmask(e){let t="";for(let r=0;r<e.length;r++){const n=parseInt(e[r],16),i=parseInt(PAD_HEX[r%PAD_HEX.length],16);if(Number.isNaN(n)||Number.isNaN(i))return null;t+=(n^i).toString(16)}return t}const UNITS=Object.freeze([{id:"p1",rel:Buffer.from("YmluL2FlZ2lzY29kZS5qcw==","base64").toString("utf8")},{id:"p2",rel:Buffer.from("c3JjL3Byb3ZlbmFuY2UuanM=","base64").toString("utf8")},{id:"p3",rel:Buffer.from("c3JjL2dhdGUuanM=","base64").toString("utf8")},{id:"p4",rel:Buffer.from("c3JjL3Blcm1pc3Npb25zLmpz","base64").toString("utf8")},{id:"p5",rel:Buffer.from("c3JjL2NhcHMuanM=","base64").toString("utf8")},{id:"p6",rel:Buffer.from("c3JjL2F1dG9ub21vdXMuanM=","base64").toString("utf8")},{id:"p8",rel:Buffer.from("c3JjL21jcC5qcw==","base64").toString("utf8")}]),SEALED="5125d89e9e3488b276cecb70e0107daa55c1c96424641b985fc7321c63518884",PRIVILEGED=Object.freeze(["gate","provenance","mcp"]);function check(){const e=[];for(const t of UNITS){const r=path.join(PACKAGE_ROOT,t.rel);if(!existsSync(r))return{tripped:!0,code:"p1",units:UNITS.length};try{e.push(sha256(readFileSync(r)))}catch{return{tripped:!0,code:"p1",units:UNITS.length}}}const t=sha256(`${SALT}\n${e.join("\n")}`),r="string"==typeof SEALED?SEALED.trim():"";return 64!==r.length?{tripped:!0,code:"p2",units:UNITS.length}:unmask(r)!==t?{tripped:!0,code:"p3",units:UNITS.length}:{tripped:!1,code:null,units:UNITS.length}}function line(e){return e&&e.tripped?`aegiscode: reduced mode (${e.code}) — this build is not the one that was published.\n`:null}let ARMED=null;function armed(){if(null!==ARMED)return ARMED;let e;try{e=check()}catch{e={tripped:!0,code:"p2",units:UNITS.length}}if(ARMED=Boolean(e.tripped),ARMED){process.env.AEGIS_REDUCED_MODE="1";const t=line(e);t&&process.stderr.write(t)}return ARMED}function isPrivileged(e){return PRIVILEGED.includes(e)}function refuse(){return 1}function sealOf(e){const t=e.map((e=>sha256(readFileSync(e))));return sha256(`${SALT}\n${t.join("\n")}`)}module.exports={UNITS:UNITS,PRIVILEGED:PRIVILEGED,SALT:SALT,PAD:PAD,check:check,armed:armed,line:line,isPrivileged:isPrivileged,refuse:refuse,sealOf:sealOf,mask:e=>unmask(e)};
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
+ * limits — the second gate. This is the one that does not explain itself.
10
+ *
11
+ * `src/provenance.js` is the gate that speaks: it compares this install to a
12
+ * manifest and tells you, by name, when the two disagree. Anyone assembling a
13
+ * modified build reads that output once and knows exactly which file to edit
14
+ * next. Speaking is the defect.
15
+ *
16
+ * This module is the same question asked with nothing to read. It derives a
17
+ * single digest from the safety files *as one closed set* — changing any one of
18
+ * them changes the whole — and compares that to a value sealed into this file.
19
+ * When it does not match:
20
+ *
21
+ * - it prints one bland line naming no file, no category and no remedy, and
22
+ * - it refuses the privileged subcommands outright (`gate`, `provenance`,
23
+ * `mcp`), so the gate's own key management is unavailable to the build that
24
+ * failed the check, and
25
+ * - it marks the process `AEGIS_REDUCED_MODE=1` for modules that opt in.
26
+ *
27
+ * Nothing in the package maps ids back to paths. The paths here are base64 and
28
+ * the sealed digest is XORed with a derived pad. That is obfuscation, not
29
+ * cryptography, and this file does not pretend otherwise: whoever holds the
30
+ * bytes can read it. The cost being raised is the cost of *noticing* — there is
31
+ * no runtime switch to disable it, no manifest telling you what is covered, and
32
+ * no self-describing failure to imitate. The map lives only in
33
+ * `tools/provenance.mjs`, which is a development tool and is not what ships.
34
+ *
35
+ * ## Why `armed()` exists, and why it is called from four files
36
+ *
37
+ * A check that is invoked from exactly one place is removed by deleting one
38
+ * line, and the entry point that invoked it is the file a manipulator is
39
+ * already editing. So the question is not asked only from `bin/aegiscode.js`:
40
+ * every module that OWNS one of the privileges this set protects asks it for
41
+ * itself — `gate.js` before it loads the gate, `mcp.js` before it touches a
42
+ * host's configuration, `autonomous.js` before it runs a queue with nobody
43
+ * watching, `permissions.js` before it resolves a skip. Deleting the call from
44
+ * the entry point stops the earliest refusal and leaves four behind, each of
45
+ * which lives in a file the digest above covers — so silencing them is not one
46
+ * edit but five, across five files, any one of which the other four notice.
47
+ *
48
+ * That is a real cost imposed on a careless patch and no obstacle at all to a
49
+ * deliberate one, and the difference is stated here rather than implied.
50
+ *
51
+ * A tree that is mid-edit trips this on purpose. Re-sealing is deliberate and
52
+ * manual: `node tools/provenance.mjs seal --write`. There is no environment
53
+ * variable that turns this off, because a gate with a documented off switch is
54
+ * a gate the manipulator reads about in the same file as the gate.
55
+ */
56
+
57
+ const { createHash } = require('node:crypto');
58
+ const { existsSync, readFileSync } = require('node:fs');
59
+ const path = require('node:path');
60
+
61
+ const PACKAGE_ROOT = path.join(__dirname, '..');
62
+
63
+ /** Domain separator, so this digest cannot be confused with the manifest's. */
64
+ const SALT = 'aegiscode-interlock-v1';
65
+ /** Pad derivation, so the sealed value is not a plain digest of the set. */
66
+ const PAD = 'aegis-interlock-pad-v1';
67
+
68
+ const sha256 = (data) => createHash('sha256').update(data).digest('hex');
69
+ const PAD_HEX = sha256(PAD);
70
+
71
+ /** Nibble-wise XOR against the derived pad; self-inverse. */
72
+ function unmask(sealed) {
73
+ let out = '';
74
+ for (let i = 0; i < sealed.length; i++) {
75
+ const a = parseInt(sealed[i], 16);
76
+ const b = parseInt(PAD_HEX[i % PAD_HEX.length], 16);
77
+ if (Number.isNaN(a) || Number.isNaN(b)) return null;
78
+ out += (a ^ b).toString(16);
79
+ }
80
+ return out;
81
+ }
82
+
83
+ /**
84
+ * The sealed set, base64 so a `cat` of this file is not a table of contents.
85
+ * Order is part of the digest: reordering is as detectable as editing.
86
+ * This file is deliberately NOT in its own set — the seal lives here, so
87
+ * including it would make the digest self-referential and unstable. It is
88
+ * covered by the published manifest instead (see src/provenance.js).
89
+ */
90
+ const UNITS = Object.freeze([
91
+ { id: 'p1', rel: Buffer.from('YmluL2FlZ2lzY29kZS5qcw==', 'base64').toString('utf8') },
92
+ { id: 'p2', rel: Buffer.from('c3JjL3Byb3ZlbmFuY2UuanM=', 'base64').toString('utf8') },
93
+ { id: 'p3', rel: Buffer.from('c3JjL2dhdGUuanM=', 'base64').toString('utf8') },
94
+ { id: 'p4', rel: Buffer.from('c3JjL3Blcm1pc3Npb25zLmpz', 'base64').toString('utf8') },
95
+ { id: 'p5', rel: Buffer.from('c3JjL2NhcHMuanM=', 'base64').toString('utf8') },
96
+ { id: 'p6', rel: Buffer.from('c3JjL2F1dG9ub21vdXMuanM=', 'base64').toString('utf8') },
97
+ { id: 'p8', rel: Buffer.from('c3JjL21jcC5qcw==', 'base64').toString('utf8') },
98
+ ]);
99
+
100
+ /**
101
+ * The masked digest of the sealed set. Rewritten ONLY by
102
+ * `node tools/provenance.mjs seal --write`, never by hand.
103
+ */
104
+ const SEALED = 'fb13ddc9265efccef276c50f41117d00560dbc3f2ad7edc32c5daf1e59266b0f';
105
+
106
+ /** Subcommands that a build failing this check does not get to run. */
107
+ const PRIVILEGED = Object.freeze(['gate', 'provenance', 'mcp']);
108
+
109
+ /**
110
+ * Ask the question. Never throws — a check that can break the program it is
111
+ * checking is a check an attacker would rather have present.
112
+ *
113
+ * @returns {{ tripped: boolean, code: string|null, units: number }}
114
+ */
115
+ function check() {
116
+ const parts = [];
117
+ for (const unit of UNITS) {
118
+ const abs = path.join(PACKAGE_ROOT, unit.rel);
119
+ if (!existsSync(abs)) return { tripped: true, code: 'p1', units: UNITS.length };
120
+ try {
121
+ parts.push(sha256(readFileSync(abs)));
122
+ } catch {
123
+ return { tripped: true, code: 'p1', units: UNITS.length };
124
+ }
125
+ }
126
+ const combined = sha256(`${SALT}\n${parts.join('\n')}`);
127
+ const sealed = typeof SEALED === 'string' ? SEALED.trim() : '';
128
+ if (sealed.length !== 64) return { tripped: true, code: 'p2', units: UNITS.length };
129
+ const expected = unmask(sealed);
130
+ if (expected !== combined) return { tripped: true, code: 'p3', units: UNITS.length };
131
+ return { tripped: false, code: null, units: UNITS.length };
132
+ }
133
+
134
+ /** The only sentence a failing build says about itself. Blunt, not a manual. */
135
+ function line(state) {
136
+ if (!state || !state.tripped) return null;
137
+ return `aegiscode: reduced mode (${state.code}) — this build is not the one that was published.\n`;
138
+ }
139
+
140
+ /**
141
+ * Ask once, remember the answer, and print the one bland line on the way.
142
+ *
143
+ * This is the entry point the modules that OWN a privilege call for themselves
144
+ * (see the header): `gate.js`, `mcp.js`, `autonomous.js`, `permissions.js`. It
145
+ * exists so the question is asked at each privilege rather than only once, at
146
+ * the top, in the file a manipulator is already editing.
147
+ *
148
+ * The answer is memoised for one process, and only so that four callers produce
149
+ * one sentence instead of four. It is NOT a cache an attacker can prime: the
150
+ * first caller computes it from the bytes on disk, and every later caller gets
151
+ * that verdict.
152
+ *
153
+ * It cannot throw — a gate that can break the program it guards is a gate an
154
+ * attacker would rather have present (see `check`).
155
+ *
156
+ * @returns {boolean} true when this build is not the published one.
157
+ */
158
+ let ARMED = null;
159
+ function armed() {
160
+ if (ARMED !== null) return ARMED;
161
+ let state;
162
+ try {
163
+ state = check();
164
+ } catch {
165
+ state = { tripped: true, code: 'p2', units: UNITS.length };
166
+ }
167
+ ARMED = Boolean(state.tripped);
168
+ if (ARMED) {
169
+ // The mark is the mechanism; the line is only its announcement.
170
+ process.env.AEGIS_REDUCED_MODE = '1';
171
+ const said = line(state);
172
+ if (said) process.stderr.write(said);
173
+ }
174
+ return ARMED;
175
+ }
176
+
177
+ function isPrivileged(command) {
178
+ return PRIVILEGED.includes(command);
179
+ }
180
+
181
+ /** A refused subcommand exits non-zero and says nothing further. */
182
+ function refuse() {
183
+ return 1;
184
+ }
185
+
186
+ /** The seal writer's half of the contract; the tool owns the mapping. */
187
+ function sealOf(files) {
188
+ const parts = files.map((abs) => sha256(readFileSync(abs)));
189
+ return sha256(`${SALT}\n${parts.join('\n')}`);
190
+ }
191
+
192
+ module.exports = { UNITS, PRIVILEGED, SALT, PAD, check, armed, line, isPrivileged, refuse, sealOf, mask: (hex) => unmask(hex) };