aegisone 1.0.34 → 1.0.35

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 -5
  6. package/scripts/bump.mjs +1 -211
  7. package/scripts/bundle.js +1 -129
  8. package/scripts/predist.mjs +1 -976
  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 -383
  14. package/src/probes.js +1 -159
  15. package/src/release.js +1 -409
  16. package/vendor/cli/package.json +3 -7
  17. package/vendor/cli/scripts/check.mjs +1 -52
  18. package/vendor/cli/scripts/demo.mjs +1 -94
  19. package/vendor/cli/scripts/predist.mjs +1 -75
  20. package/vendor/cli/scripts/runtests.mjs +1 -56
  21. package/vendor/cli/scripts/seal-gate.mjs +1 -74
  22. package/vendor/cli/src/agents.js +1 -139
  23. package/vendor/cli/src/app.js +1 -2957
  24. package/vendor/cli/src/art.js +1 -289
  25. package/vendor/cli/src/chatflow.js +1 -3023
  26. package/vendor/cli/src/checkpoint.js +1 -90
  27. package/vendor/cli/src/clipboard.js +1 -424
  28. package/vendor/cli/src/cloudsync.js +1 -528
  29. package/vendor/cli/src/commands.js +1 -4089
  30. package/vendor/cli/src/config.js +1 -581
  31. package/vendor/cli/src/connect.js +1 -349
  32. package/vendor/cli/src/credentials.js +1 -33
  33. package/vendor/cli/src/deps.js +1 -232
  34. package/vendor/cli/src/devrun.js +1 -187
  35. package/vendor/cli/src/diff.js +1 -333
  36. package/vendor/cli/src/diffview.js +1 -296
  37. package/vendor/cli/src/engine.js +1 -297
  38. package/vendor/cli/src/entitlement.js +1 -355
  39. package/vendor/cli/src/events.js +1 -707
  40. package/vendor/cli/src/export.js +1 -67
  41. package/vendor/cli/src/filepreview.js +1 -153
  42. package/vendor/cli/src/fingerprint.js +1 -592
  43. package/vendor/cli/src/format.js +1 -259
  44. package/vendor/cli/src/fuzzy.js +1 -119
  45. package/vendor/cli/src/history.js +1 -423
  46. package/vendor/cli/src/init.js +1 -175
  47. package/vendor/cli/src/input.js +1 -139
  48. package/vendor/cli/src/keys.js +1 -183
  49. package/vendor/cli/src/markdown.js +1 -306
  50. package/vendor/cli/src/models.js +1 -507
  51. package/vendor/cli/src/naming.js +1 -57
  52. package/vendor/cli/src/overlays.js +1 -462
  53. package/vendor/cli/src/panels.js +1 -1418
  54. package/vendor/cli/src/ping.js +1 -226
  55. package/vendor/cli/src/presence.js +1 -238
  56. package/vendor/cli/src/render.js +1 -516
  57. package/vendor/cli/src/screen.js +1 -518
  58. package/vendor/cli/src/screens.js +1 -896
  59. package/vendor/cli/src/secret.js +1 -59
  60. package/vendor/cli/src/securefs.js +1 -359
  61. package/vendor/cli/src/settings.js +1 -155
  62. package/vendor/cli/src/shared.js +1 -52
  63. package/vendor/cli/src/sharedpaths.js +1 -53
  64. package/vendor/cli/src/signup.js +1 -156
  65. package/vendor/cli/src/summarize.js +1 -95
  66. package/vendor/cli/src/sysdiag.js +1 -585
  67. package/vendor/cli/src/system.js +1 -40
  68. package/vendor/cli/src/theme.js +1 -570
  69. package/vendor/cli/src/title.js +1 -220
  70. package/vendor/cli/src/todos.js +1 -115
  71. package/vendor/cli/src/tokens.js +1 -263
  72. package/vendor/cli/src/topup.js +1 -210
  73. package/vendor/cli/src/update.js +1 -191
  74. package/vendor/cli/vendor/client/aegis.js +1 -2441
  75. package/vendor/cli/vendor/client/attest.js +1 -518
  76. package/vendor/cli/vendor/client/authorship-key.js +1 -410
  77. package/vendor/cli/vendor/client/auto-provision.js +1 -134
  78. package/vendor/cli/vendor/client/brain-catalog.js +1 -268
  79. package/vendor/cli/vendor/client/byok-catalog.js +1 -199
  80. package/vendor/cli/vendor/client/catalog-client.js +1 -487
  81. package/vendor/cli/vendor/client/conversation-export.js +1 -177
  82. package/vendor/cli/vendor/client/credentials.js +1 -494
  83. package/vendor/cli/vendor/client/device-fingerprint.js +1 -141
  84. package/vendor/cli/vendor/client/drive-connect.js +1 -110
  85. package/vendor/cli/vendor/client/drive-upload.js +1 -234
  86. package/vendor/cli/vendor/client/env-file.js +1 -1273
  87. package/vendor/cli/vendor/client/fingerprint.js +1 -1064
  88. package/vendor/cli/vendor/client/foreign-memory.js +1 -669
  89. package/vendor/cli/vendor/client/google-signin.js +1 -133
  90. package/vendor/cli/vendor/client/hooks.js +1 -430
  91. package/vendor/cli/vendor/client/model-discovery.js +1 -373
  92. package/vendor/cli/vendor/client/naming.js +1 -283
  93. package/vendor/cli/vendor/client/platform.js +1 -937
  94. package/vendor/cli/vendor/client/prefs.js +1 -351
  95. package/vendor/cli/vendor/client/presence-constants.js +1 -107
  96. package/vendor/cli/vendor/client/presence.js +1 -438
  97. package/vendor/cli/vendor/client/record-vault.js +3 -1055
  98. package/vendor/cli/vendor/client/session-store.js +1 -575
  99. package/vendor/cli/vendor/client/topup.js +1 -297
  100. package/vendor/cli/vendor/client/touch.js +1 -458
  101. package/vendor/cli/vendor/client/update.js +1 -763
  102. package/vendor/cli/vendor/client/user-models.js +1 -381
  103. package/vendor/cli/vendor/desktop/lib/local/agents.js +1 -105
  104. package/vendor/cli/vendor/desktop/lib/local/attachments.js +1 -276
  105. package/vendor/cli/vendor/desktop/lib/local/autonomous.js +1 -1045
  106. package/vendor/cli/vendor/desktop/lib/local/claude-pro.js +1 -1028
  107. package/vendor/cli/vendor/desktop/lib/local/context.js +1 -125
  108. package/vendor/cli/vendor/desktop/lib/local/engine.js +1 -3666
  109. package/vendor/cli/vendor/desktop/lib/local/entitlement.js +1 -660
  110. package/vendor/cli/vendor/desktop/lib/local/git-scope.js +1 -228
  111. package/vendor/cli/vendor/desktop/lib/local/local.js +1 -2145
  112. package/vendor/cli/vendor/desktop/lib/local/prompt.js +1 -280
  113. package/vendor/cli/vendor/desktop/lib/local/queue.js +1 -560
  114. package/vendor/cli/vendor/desktop/lib/local/session-rounds.js +1 -238
  115. package/vendor/cli/vendor/desktop/lib/local/spill.js +1 -75
  116. package/vendor/cli/vendor/desktop/lib/local/turn-guard.js +1 -300
  117. package/vendor/cli/vendor/desktop/lib/local/worktree-lock.js +1 -235
  118. package/vendor/cli/vendor/desktop/lib/settings.js +1 -890
  119. package/vendor/cli/vendor/desktop/renderer/usage.js +1 -1239
  120. package/vendor/cli/vendor/hosts/install.js +1 -638
  121. package/vendor/cli/vendor/hosts/openai-shim.js +1 -515
  122. package/vendor/cli/vendor/hosts/spec.js +1 -164
  123. package/vendor/cli/vendor/hosts/targets.js +1 -346
  124. package/vendor/cli/vendor/mcp/server.js +1 -221
  125. package/vendor/cli/vendor/mcp/tools.js +1 -408
  126. package/vendor/cli/vendor/one/src/child.js +1 -285
  127. package/vendor/cli/vendor/one/src/permissions.js +1 -383
  128. package/vendor/desktop/bin/aegis.js +1 -32
  129. package/vendor/desktop/lib/account-key.js +1 -56
  130. package/vendor/desktop/lib/auto.js +1 -461
  131. package/vendor/desktop/lib/avatar/companion.js +1 -698
  132. package/vendor/desktop/lib/avatar/cosmetics.js +1 -532
  133. package/vendor/desktop/lib/avatar/events.js +1 -344
  134. package/vendor/desktop/lib/avatar/holder-turn.js +1 -350
  135. package/vendor/desktop/lib/avatar/holders.js +1 -612
  136. package/vendor/desktop/lib/avatar/identity.js +1 -641
  137. package/vendor/desktop/lib/avatar/level.js +1 -368
  138. package/vendor/desktop/lib/avatar/mirror.js +1 -524
  139. package/vendor/desktop/lib/avatar/persona.js +1 -388
  140. package/vendor/desktop/lib/avatar/profile.js +1 -977
  141. package/vendor/desktop/lib/avatar/register.js +1 -307
  142. package/vendor/desktop/lib/avatar/store.js +1 -472
  143. package/vendor/desktop/lib/avatar/tiers.js +1 -38
  144. package/vendor/desktop/lib/avatar/transfer.js +1 -415
  145. package/vendor/desktop/lib/avatar/turn.js +1 -216
  146. package/vendor/desktop/lib/avatar/voice.js +1 -328
  147. package/vendor/desktop/lib/avatar/xp.js +1 -404
  148. package/vendor/desktop/lib/deep-link.js +1 -120
  149. package/vendor/desktop/lib/fingerprint.js +2 -347
  150. package/vendor/desktop/lib/google-connect.js +1 -323
  151. package/vendor/desktop/lib/local/agents.js +1 -105
  152. package/vendor/desktop/lib/local/attachments.js +1 -276
  153. package/vendor/desktop/lib/local/autonomous.js +1 -1045
  154. package/vendor/desktop/lib/local/claude-pro.js +1 -1028
  155. package/vendor/desktop/lib/local/context.js +1 -125
  156. package/vendor/desktop/lib/local/engine.js +1 -3666
  157. package/vendor/desktop/lib/local/entitlement.js +1 -660
  158. package/vendor/desktop/lib/local/git-scope.js +1 -228
  159. package/vendor/desktop/lib/local/local.js +1 -2145
  160. package/vendor/desktop/lib/local/prompt.js +1 -280
  161. package/vendor/desktop/lib/local/queue.js +1 -560
  162. package/vendor/desktop/lib/local/session-rounds.js +1 -238
  163. package/vendor/desktop/lib/local/spill.js +1 -75
  164. package/vendor/desktop/lib/local/telemetry.js +1 -470
  165. package/vendor/desktop/lib/local/turn-guard.js +1 -300
  166. package/vendor/desktop/lib/local/worktree-lock.js +1 -235
  167. package/vendor/desktop/lib/provider-key-mirror.js +1 -252
  168. package/vendor/desktop/lib/quick-launcher.js +1 -84
  169. package/vendor/desktop/lib/settings.js +1 -890
  170. package/vendor/desktop/lib/sync/memory-queue.js +1 -60
  171. package/vendor/desktop/lib/sync/persist-gate.js +1 -148
  172. package/vendor/desktop/lib/sync/sessions.js +1 -106
  173. package/vendor/desktop/lib/window-state.js +1 -66
  174. package/vendor/desktop/package.json +2 -4
  175. package/vendor/desktop/preload.js +1 -679
  176. package/vendor/desktop/renderer/app.js +1 -7250
  177. package/vendor/desktop/renderer/avatar/assemble.js +1 -335
  178. package/vendor/desktop/renderer/avatar/avatar.js +1 -380
  179. package/vendor/desktop/renderer/avatar/cards.js +1 -141
  180. package/vendor/desktop/renderer/avatar/hud.js +1 -206
  181. package/vendor/desktop/renderer/avatar/machine.js +1 -213
  182. package/vendor/desktop/renderer/avatar/pane.js +1 -439
  183. package/vendor/desktop/renderer/avatar/parts.js +1 -437
  184. package/vendor/desktop/renderer/budget.js +1 -172
  185. package/vendor/desktop/renderer/companion.js +1 -223
  186. package/vendor/desktop/renderer/diff.js +1 -359
  187. package/vendor/desktop/renderer/diffview.js +1 -336
  188. package/vendor/desktop/renderer/filepreview.js +1 -211
  189. package/vendor/desktop/renderer/fingerprint.js +3 -789
  190. package/vendor/desktop/renderer/markdown.js +1 -168
  191. package/vendor/desktop/renderer/provider-mark.js +1 -311
  192. package/vendor/desktop/renderer/provider-toolbar.js +1 -134
  193. package/vendor/desktop/renderer/providers.js +1 -259
  194. package/vendor/desktop/renderer/quick.js +1 -285
  195. package/vendor/desktop/renderer/stream-policy.js +1 -387
  196. package/vendor/desktop/renderer/transcript-view.js +1 -323
  197. package/vendor/desktop/renderer/usage.js +1 -1239
  198. package/vendor/desktop/vendor/aegis.js +1 -2441
  199. package/vendor/desktop/vendor/attest.js +1 -518
  200. package/vendor/desktop/vendor/authorship-key.js +1 -410
  201. package/vendor/desktop/vendor/auto-provision.js +1 -134
  202. package/vendor/desktop/vendor/brain-catalog.js +1 -268
  203. package/vendor/desktop/vendor/byok-catalog.js +1 -199
  204. package/vendor/desktop/vendor/catalog-client.js +1 -487
  205. package/vendor/desktop/vendor/conversation-export.js +1 -177
  206. package/vendor/desktop/vendor/credentials.js +1 -494
  207. package/vendor/desktop/vendor/device-fingerprint.js +1 -141
  208. package/vendor/desktop/vendor/drive-connect.js +1 -110
  209. package/vendor/desktop/vendor/drive-upload.js +1 -234
  210. package/vendor/desktop/vendor/env-file.js +1 -1273
  211. package/vendor/desktop/vendor/fingerprint.js +1 -1064
  212. package/vendor/desktop/vendor/foreign-memory.js +1 -669
  213. package/vendor/desktop/vendor/google-signin.js +1 -133
  214. package/vendor/desktop/vendor/hooks.js +1 -430
  215. package/vendor/desktop/vendor/model-discovery.js +1 -373
  216. package/vendor/desktop/vendor/naming.js +1 -283
  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 -575
  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 -763
  226. package/vendor/desktop/vendor/user-models.js +1 -381
package/src/release.js CHANGED
@@ -1,411 +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
- * AEGISONE — one product version, two derived face versions (plan D4).
10
- *
11
- * The rule this file exists to enforce: **the product version is written down
12
- * once, and every other version in the tree is computed from it.** Before ON3,
13
- * a release was three hand-typed numbers in one commit (`chore(release):
14
- * aegis-desktop 0.8.28, aegiscode 6.8.30`) held together by discipline, not by
15
- * anything that could fail. This module is the arithmetic; `one/scripts/bump.mjs`
16
- * is the only writer; `test/one-version.test.mjs` is the assertion that the
17
- * manifests in the tree still equal what this file computes for the product
18
- * version they carry.
19
- *
20
- * Two rules from D4 that constrain the derivation, both user-visible:
21
- *
22
- * 1. **The face LINES do not move.** `aegiscode` stays on `6.8.x` and
23
- * `aegis-desktop` stays on `0.8.x`, because installed apps and their
24
- * auto-update channels are pinned to those lines. The product version
25
- * `1.0.0` therefore cannot simply BE the face version.
26
- * 2. **No face may move backwards, and no product release may be reordered.**
27
- * Each face's patch counter is anchored at its published version for the
28
- * product's first release (`6.8.30` / `0.8.28` at product `1.0.0` — the
29
- * versions the last hand-typed release commit shipped) and advances by the
30
- * *flattened product counter*, one product patch == one face patch, one
31
- * product minor == 100 face patches, one product major == 10000. So the
32
- * face numbers stay recognisable AND the mapping is total and monotonic:
33
- * two different product versions can never produce the same face version,
34
- * and a bump can never publish a lower version than the registry has.
35
- *
36
- * Everything here is pure: it takes versions and file CONTENTS and returns
37
- * values and new contents. No fs, no process, no clock — `bump.mjs` owns the
38
- * IO, so the whole bump can be asserted without touching a file.
39
- *
40
- * Standing rule for `one/` (Phase 30.1): nothing at module scope touches the
41
- * process, and nothing here branches on an OS. This file reads neither.
42
- */
43
-
44
- /**
45
- * The face packages, their unchanged lines, and their published anchor.
46
- *
47
- * `line` is the `major.minor` that must not move (D4 rule 1). `anchor` is the
48
- * patch each face had published at `ANCHOR_PRODUCT` — the calibration point for
49
- * the whole derivation.
50
- *
51
- * Re-anchored at product `1.0.8`: `aegiscode` graduates from the `6.8.x` line
52
- * to `7.0.x` and `aegis-desktop` from `0.8.x` to `1.0.x`, both starting at
53
- * patch 0 — a deliberate one-time line move, not a normal release. Nothing
54
- * before this point is derivable under the new anchor (an older product
55
- * version would compute a negative patch and `deriveFaceVersion` refuses it as
56
- * "backwards"), which is correct: the old `6.8.x`/`0.8.x` history stays real,
57
- * it is just not reachable through this formula anymore. A product version
58
- * `>= 1.0.8` is unaffected either way, because the derivation only ever looks
59
- * at the DELTA from the anchor, never at history before it.
60
- */
61
- const FACE_LINES = Object.freeze([
62
- Object.freeze({ dir: 'cli', package: 'aegiscode', line: Object.freeze([7, 0]), anchor: 0 }),
63
- Object.freeze({ dir: 'desktop', package: 'aegis-desktop', line: Object.freeze([1, 0]), anchor: 0 })
64
- ]);
65
-
66
- /** The product version the two anchors above were measured at. */
67
- const ANCHOR_PRODUCT = '1.0.8';
68
-
69
- /** One product minor reserves 100 face patches; one major reserves 10000. */
70
- const MINOR_STRIDE = 100;
71
- const MAJOR_STRIDE = 10000;
72
-
73
- const VERSION_RE = /^(\d+)\.(\d+)\.(\d+)$/;
74
-
75
- /**
76
- * Parse a strict `X.Y.Z` version.
77
- *
78
- * A prerelease is REFUSED rather than carried: the face versions below have no
79
- * honest spelling for one (`6.8.30-rc.1` would have to be invented per face and
80
- * would land on the updater feeds of every installed app), so a prerelease
81
- * product version fails here, loudly, instead of shipping a guess.
82
- *
83
- * @param {string} value
84
- * @returns {{major: number, minor: number, patch: number, text: string}}
85
- */
86
- function parseVersion(value) {
87
- const text = String(value == null ? '' : value).trim();
88
- const m = VERSION_RE.exec(text);
89
- if (!m) {
90
- throw new Error(
91
- `${JSON.stringify(String(value))} is not a strict MAJOR.MINOR.PATCH version ` +
92
- '(prereleases and ranges are refused on purpose — see release.js)'
93
- );
94
- }
95
- const parts = { major: Number(m[1]), minor: Number(m[2]), patch: Number(m[3]), text };
96
- // The flattening below is total only while minor and patch stay under their
97
- // stride. Refusing the version is the fail-closed answer; silently colliding
98
- // two releases onto one face version is not.
99
- if (parts.minor >= MINOR_STRIDE || parts.patch >= MINOR_STRIDE) {
100
- throw new Error(
101
- `${text}: minor and patch must stay under ${MINOR_STRIDE} for the face derivation to stay injective`
102
- );
103
- }
104
- return parts;
105
- }
106
-
107
- /** Does this look like a version at all? Never throws. */
108
- function isVersion(value) {
109
- return VERSION_RE.test(String(value == null ? '' : value).trim());
110
- }
111
-
112
- /**
113
- * The product counter: a single strictly increasing integer for a version.
114
- *
115
- * `1.0.0` -> 10000, `1.0.1` -> 10001, `1.1.0` -> 10100, `2.0.0` -> 20000.
116
- */
117
- function releaseCounter(value) {
118
- const v = typeof value === 'string' ? parseVersion(value) : value;
119
- return v.major * MAJOR_STRIDE + v.minor * MINOR_STRIDE + v.patch;
120
- }
121
-
122
- const ANCHOR_COUNTER = releaseCounter(ANCHOR_PRODUCT);
123
-
124
- /**
125
- * The version a face must carry for a given product version.
126
- *
127
- * @param {string} productVersion
128
- * @param {{dir: string, package: string, line: number[], anchor: number}} face
129
- * @returns {string} e.g. `6.8.30` for `aegiscode` at product `1.0.0`
130
- */
131
- function deriveFaceVersion(productVersion, face) {
132
- const delta = releaseCounter(productVersion) - ANCHOR_COUNTER;
133
- const patch = face.anchor + delta;
134
- if (patch < face.anchor) {
135
- throw new Error(
136
- `product ${productVersion} would move ${face.package} backwards ` +
137
- `(${face.line.join('.')}.${patch} < published ${face.line.join('.')}.${face.anchor})`
138
- );
139
- }
140
- if (!Number.isSafeInteger(patch)) {
141
- throw new Error(`product ${productVersion} overflows the ${face.package} patch counter`);
142
- }
143
- return `${face.line[0]}.${face.line[1]}.${patch}`;
144
- }
145
-
146
- /**
147
- * Every face version for a product version, keyed by npm package name.
148
- *
149
- * @param {string} productVersion
150
- * @returns {Object<string, {package: string, dir: string, version: string}>}
151
- */
152
- function deriveFaceVersions(productVersion) {
153
- const out = {};
154
- for (const face of FACE_LINES) {
155
- out[face.package] = Object.freeze({
156
- package: face.package,
157
- dir: face.dir,
158
- version: deriveFaceVersion(productVersion, face)
159
- });
160
- }
161
- return out;
162
- }
163
-
164
- /** The tag a product version ships as. */
165
- function tagFor(productVersion) {
166
- return 'v' + parseVersion(productVersion).text;
167
- }
168
-
169
- /**
170
- * Read a version out of a tag or a GitHub ref.
171
- *
172
- * Accepts `v1.0.1` and `refs/tags/v1.0.1`; refuses `1.0.1` and `v1.0` — a
173
- * release that cannot name its tag is a release that cannot be verified.
174
- */
175
- function parseTag(tag) {
176
- const raw = String(tag == null ? '' : tag).trim();
177
- const stripped = raw.startsWith('refs/tags/') ? raw.slice('refs/tags/'.length) : raw;
178
- if (!stripped.startsWith('v')) {
179
- throw new Error(`${JSON.stringify(raw)} is not a release tag — expected vMAJOR.MINOR.PATCH`);
180
- }
181
- return parseVersion(stripped.slice(1)).text;
182
- }
183
-
184
- /**
185
- * The next product version.
186
- *
187
- * @param {string} current
188
- * @param {string} kind `major` | `minor` | `patch` | an explicit `X.Y.Z`
189
- * @returns {string}
190
- */
191
- function nextVersion(current, kind) {
192
- const from = parseVersion(current);
193
- const word = String(kind == null ? '' : kind).trim();
194
- if (word === 'major') return `${from.major + 1}.0.0`;
195
- if (word === 'minor') return `${from.major}.${from.minor + 1}.0`;
196
- if (word === 'patch') return `${from.major}.${from.minor}.${from.patch + 1}`;
197
- const next = parseVersion(word).text;
198
- if (releaseCounter(next) <= releaseCounter(from)) {
199
- throw new Error(`${next} is not newer than ${from.text} — a released version is never rewritten`);
200
- }
201
- return next;
202
- }
203
-
204
- // ---------------------------------------------------------------------------
205
- // The version request (`aegis --version`, `aegis --version --verbose`)
206
- // ---------------------------------------------------------------------------
207
-
208
- /**
209
- * Is this argv asking for the product version?
210
- *
211
- * Deliberately narrow: the ONLY accepted shapes are `--version` (or `-v`), with
212
- * an optional `--verbose`. Anything else — a prompt, `-p`, a verb — returns
213
- * null and takes the ordinary dispatch path, because `aegis --version` must not
214
- * be able to swallow an argument somebody meant.
215
- *
216
- * @param {string[]} argv
217
- * @returns {{verbose: boolean}|null}
218
- */
219
- function versionRequest(argv) {
220
- const args = (Array.isArray(argv) ? argv : []).map(String);
221
- if (args.length === 0) return null;
222
- const allowed = new Set(['--version', '-v', '--verbose']);
223
- if (args.some((a) => !allowed.has(a))) return null;
224
- if (!args.includes('--version') && !args.includes('-v')) return null;
225
- return { verbose: args.includes('--verbose') };
226
- }
227
-
228
- /**
229
- * Render the version report.
230
- *
231
- * The first line is the bare product version, matching the terminal face's own
232
- * `--version` (cli/bin/aegiscode.js writes `pkg.version` and nothing else), so
233
- * `aegis --version` and `aegiscode --version` agree on line one and scripts
234
- * that parse either keep working. `--verbose` adds one line per face; a face
235
- * whose manifest is not beside the product is reported as unknown rather than
236
- * guessed from the derivation, because this command reports facts.
237
- *
238
- * @param {{product: {name: string, version: string},
239
- * faces?: Array<{package: string, version: string|null}>}} input
240
- * @returns {string}
241
- */
242
- function renderVersion(input) {
243
- const src = input || {};
244
- const product = src.product || {};
245
- const lines = [parseVersion(product.version).text];
246
- for (const face of src.faces || []) {
247
- lines.push(
248
- face && face.version
249
- ? `${face.package} ${face.version}`
250
- : `${face && face.package} unknown (no manifest beside this package)`
251
- );
252
- }
253
- return lines.join('\n') + '\n';
254
- }
255
-
256
- // ---------------------------------------------------------------------------
257
- // The bump plan: pure content in, new content out
258
- // ---------------------------------------------------------------------------
259
-
260
- /** The README line the product version is written on. */
261
- const README_VERSION_RE = /^(Product version: \*\*)(\d+\.\d+\.\d+)(\*\*.*)$/m;
262
-
263
- /**
264
- * Replace the `version` field of a package.json string, preserving everything
265
- * else byte for byte (2-space indent, key order, trailing newline).
266
- *
267
- * @param {string} content
268
- * @param {string} version
269
- * @returns {string}
270
- */
271
- function setManifestVersion(content, version) {
272
- const parsed = JSON.parse(content);
273
- if (typeof parsed.version !== 'string' || !isVersion(parsed.version)) {
274
- throw new Error('that package.json has no usable `version` field');
275
- }
276
- parsed.version = parseVersion(version).text;
277
- return JSON.stringify(parsed, null, 2) + '\n';
278
- }
279
-
280
- /** Replace the README's version line, or fail loudly if it is not there. */
281
- function setReadmeVersion(content, version) {
282
- if (!README_VERSION_RE.test(content)) {
283
- throw new Error(
284
- 'the product README has no "Product version: **X.Y.Z**" line for the bump to maintain'
285
- );
286
- }
287
- return content.replace(README_VERSION_RE, (_, head, _old, tail) => head + parseVersion(version).text + tail);
288
- }
289
-
290
- /**
291
- * The whole bump, computed from file contents.
292
- *
293
- * Each document names its OWN target version. That is not a convenience: the
294
- * product manifest and the README take the product version, and each face takes
295
- * the version `deriveFaceVersions` computes for it — one version is the source
296
- * of truth, and a plan that writes the product number into a face manifest is
297
- * the exact bug the first dry run of this function caught (the faces went to
298
- * `1.0.1`; the derivation says `6.8.31` / `0.8.29`).
299
- *
300
- * @param {{version: string, documents: Array<{file: string, kind: string,
301
- * content: string, version?: string}>}} input
302
- * `kind` is `json` (a package.json) or `readme` (the product README);
303
- * `version` defaults to the product version.
304
- * @returns {Array<{file: string, kind: string, from: string|null, to: string,
305
- * before: string, content: string, unchanged: boolean}>}
306
- */
307
- function planBump(input) {
308
- const src = input || {};
309
- const product = parseVersion(src.version).text;
310
- return (src.documents || []).map((doc) => {
311
- const version = parseVersion(doc.version || product).text;
312
- const before = doc.content;
313
- let after;
314
- if (doc.kind === 'json') {
315
- const current = JSON.parse(before).version;
316
- if (current === version) {
317
- return { file: doc.file, kind: doc.kind, from: current, to: version, before, content: before, unchanged: true };
318
- }
319
- after = setManifestVersion(before, version);
320
- return { file: doc.file, kind: doc.kind, from: current, to: version, before, content: after, unchanged: false };
321
- }
322
- if (doc.kind === 'readme') {
323
- const m = README_VERSION_RE.exec(before);
324
- if (!m) throw new Error(`${doc.file} has no version line for the bump to maintain`);
325
- const current = m[2];
326
- if (current === version) {
327
- return { file: doc.file, kind: doc.kind, from: current, to: version, before, content: before, unchanged: true };
328
- }
329
- return {
330
- file: doc.file,
331
- kind: doc.kind,
332
- from: current,
333
- to: version,
334
- before,
335
- content: setReadmeVersion(before, version),
336
- unchanged: false
337
- };
338
- }
339
- throw new Error(`${doc.file}: unknown document kind ${JSON.stringify(doc.kind)}`);
340
- });
341
- }
342
-
343
- /**
344
- * A unified diff of two texts, for `bump --dry-run`.
345
- *
346
- * One hunk per contiguous block of changed lines, with three lines of context —
347
- * enough for a version bump, and small enough to read: the dry run exists to be
348
- * pasted into a release review, not to be a diff engine.
349
- *
350
- * @param {string} before
351
- * @param {string} after
352
- * @param {string} file
353
- * @returns {string} empty string when nothing changed
354
- */
355
- function unifiedDiff(before, after, file) {
356
- if (before === after) return '';
357
- const a = before.split('\n');
358
- const b = after.split('\n');
359
- let head = 0;
360
- while (head < a.length && head < b.length && a[head] === b[head]) head++;
361
- let tail = 0;
362
- while (
363
- tail < a.length - head &&
364
- tail < b.length - head &&
365
- a[a.length - 1 - tail] === b[b.length - 1 - tail]
366
- ) {
367
- tail++;
368
- }
369
- const aChanged = a.slice(head, a.length - tail);
370
- const bChanged = b.slice(head, b.length - tail);
371
- const context = 3;
372
- const start = Math.max(0, head - context);
373
- const aEnd = Math.min(a.length, a.length - tail + context);
374
- const bEnd = Math.min(b.length, b.length - tail + context);
375
- const aHunk = a.slice(start, aEnd);
376
- const bHunk = b.slice(start, bEnd);
377
- const aSpan = aEnd - start;
378
- const bSpan = bEnd - start;
379
- const out = [`--- a/${file}`, `+++ b/${file}`, `@@ -${start + 1},${aSpan} +${start + 1},${bSpan} @@`];
380
- // Changed lines are emitted as a removal block then an addition block: a
381
- // version bump rewrites lines, and a reviewer reading the dry run wants the
382
- // before and the after plain, not interleaved.
383
- for (const line of aHunk.slice(0, head - start)) out.push(' ' + line);
384
- for (const line of aChanged) out.push('-' + line);
385
- for (const line of bChanged) out.push('+' + line);
386
- const trailing = aHunk.slice(head - start + aChanged.length);
387
- for (const line of trailing) out.push(' ' + line);
388
- return out.join('\n') + '\n';
389
- }
390
-
391
- module.exports = {
392
- FACE_LINES,
393
- ANCHOR_PRODUCT,
394
- MINOR_STRIDE,
395
- MAJOR_STRIDE,
396
- parseVersion,
397
- isVersion,
398
- releaseCounter,
399
- deriveFaceVersion,
400
- deriveFaceVersions,
401
- tagFor,
402
- parseTag,
403
- nextVersion,
404
- versionRequest,
405
- renderVersion,
406
- planBump,
407
- setManifestVersion,
408
- setReadmeVersion,
409
- unifiedDiff,
410
- README_VERSION_RE
411
- };
3
+ "use strict";const FACE_LINES=Object.freeze([Object.freeze({dir:"cli",package:"aegiscode",line:Object.freeze([7,0]),anchor:0}),Object.freeze({dir:"desktop",package:"aegis-desktop",line:Object.freeze([1,0]),anchor:0})]),ANCHOR_PRODUCT="1.0.8",MINOR_STRIDE=100,MAJOR_STRIDE=1e4,VERSION_RE=/^(\d+)\.(\d+)\.(\d+)$/;function parseVersion(e){const n=String(null==e?"":e).trim(),r=VERSION_RE.exec(n);if(!r)throw new Error(`${JSON.stringify(String(e))} is not a strict MAJOR.MINOR.PATCH version (prereleases and ranges are refused on purpose — see release.js)`);const t={major:Number(r[1]),minor:Number(r[2]),patch:Number(r[3]),text:n};if(t.minor>=MINOR_STRIDE||t.patch>=MINOR_STRIDE)throw new Error(`${n}: minor and patch must stay under ${MINOR_STRIDE} for the face derivation to stay injective`);return t}function isVersion(e){return VERSION_RE.test(String(null==e?"":e).trim())}function releaseCounter(e){const n="string"==typeof e?parseVersion(e):e;return n.major*MAJOR_STRIDE+n.minor*MINOR_STRIDE+n.patch}const ANCHOR_COUNTER=releaseCounter("1.0.8");function deriveFaceVersion(e,n){const r=releaseCounter(e)-ANCHOR_COUNTER,t=n.anchor+r;if(t<n.anchor)throw new Error(`product ${e} would move ${n.package} backwards (${n.line.join(".")}.${t} < published ${n.line.join(".")}.${n.anchor})`);if(!Number.isSafeInteger(t))throw new Error(`product ${e} overflows the ${n.package} patch counter`);return`${n.line[0]}.${n.line[1]}.${t}`}function deriveFaceVersions(e){const n={};for(const r of FACE_LINES)n[r.package]=Object.freeze({package:r.package,dir:r.dir,version:deriveFaceVersion(e,r)});return n}function tagFor(e){return"v"+parseVersion(e).text}function parseTag(e){const n=String(null==e?"":e).trim(),r=n.startsWith("refs/tags/")?n.slice(10):n;if(!r.startsWith("v"))throw new Error(`${JSON.stringify(n)} is not a release tag — expected vMAJOR.MINOR.PATCH`);return parseVersion(r.slice(1)).text}function nextVersion(e,n){const r=parseVersion(e),t=String(null==n?"":n).trim();if("major"===t)return`${r.major+1}.0.0`;if("minor"===t)return`${r.major}.${r.minor+1}.0`;if("patch"===t)return`${r.major}.${r.minor}.${r.patch+1}`;const o=parseVersion(t).text;if(releaseCounter(o)<=releaseCounter(r))throw new Error(`${o} is not newer than ${r.text} — a released version is never rewritten`);return o}function versionRequest(e){const n=(Array.isArray(e)?e:[]).map(String);if(0===n.length)return null;const r=new Set(["--version","-v","--verbose"]);return n.some((e=>!r.has(e)))?null:n.includes("--version")||n.includes("-v")?{verbose:n.includes("--verbose")}:null}function renderVersion(e){const n=e||{},r=[parseVersion((n.product||{}).version).text];for(const e of n.faces||[])r.push(e&&e.version?`${e.package} ${e.version}`:`${e&&e.package} unknown (no manifest beside this package)`);return r.join("\n")+"\n"}const README_VERSION_RE=/^(Product version: \*\*)(\d+\.\d+\.\d+)(\*\*.*)$/m;function setManifestVersion(e,n){const r=JSON.parse(e);if("string"!=typeof r.version||!isVersion(r.version))throw new Error("that package.json has no usable `version` field");return r.version=parseVersion(n).text,JSON.stringify(r,null,2)+"\n"}function setReadmeVersion(e,n){if(!README_VERSION_RE.test(e))throw new Error('the product README has no "Product version: **X.Y.Z**" line for the bump to maintain');return e.replace(README_VERSION_RE,((e,r,t,o)=>r+parseVersion(n).text+o))}function planBump(e){const n=e||{},r=parseVersion(n.version).text;return(n.documents||[]).map((e=>{const n=parseVersion(e.version||r).text,t=e.content;let o;if("json"===e.kind){const r=JSON.parse(t).version;return r===n?{file:e.file,kind:e.kind,from:r,to:n,before:t,content:t,unchanged:!0}:(o=setManifestVersion(t,n),{file:e.file,kind:e.kind,from:r,to:n,before:t,content:o,unchanged:!1})}if("readme"===e.kind){const r=README_VERSION_RE.exec(t);if(!r)throw new Error(`${e.file} has no version line for the bump to maintain`);const o=r[2];return o===n?{file:e.file,kind:e.kind,from:o,to:n,before:t,content:t,unchanged:!0}:{file:e.file,kind:e.kind,from:o,to:n,before:t,content:setReadmeVersion(t,n),unchanged:!1}}throw new Error(`${e.file}: unknown document kind ${JSON.stringify(e.kind)}`)}))}function unifiedDiff(e,n,r){if(e===n)return"";const t=e.split("\n"),o=n.split("\n");let i=0;for(;i<t.length&&i<o.length&&t[i]===o[i];)i++;let s=0;for(;s<t.length-i&&s<o.length-i&&t[t.length-1-s]===o[o.length-1-s];)s++;const a=t.slice(i,t.length-s),c=o.slice(i,o.length-s),f=Math.max(0,i-3),u=Math.min(t.length,t.length-s+3),l=Math.min(o.length,o.length-s+3),d=t.slice(f,u),p=(o.slice(f,l),[`--- a/${r}`,`+++ b/${r}`,`@@ -${f+1},${u-f} +${f+1},${l-f} @@`]);for(const e of d.slice(0,i-f))p.push(" "+e);for(const e of a)p.push("-"+e);for(const e of c)p.push("+"+e);const R=d.slice(i-f+a.length);for(const e of R)p.push(" "+e);return p.join("\n")+"\n"}module.exports={FACE_LINES:FACE_LINES,ANCHOR_PRODUCT:"1.0.8",MINOR_STRIDE:MINOR_STRIDE,MAJOR_STRIDE:MAJOR_STRIDE,parseVersion:parseVersion,isVersion:isVersion,releaseCounter:releaseCounter,deriveFaceVersion:deriveFaceVersion,deriveFaceVersions:deriveFaceVersions,tagFor:tagFor,parseTag:parseTag,nextVersion:nextVersion,versionRequest:versionRequest,renderVersion:renderVersion,planBump:planBump,setManifestVersion:setManifestVersion,setReadmeVersion:setReadmeVersion,unifiedDiff:unifiedDiff,README_VERSION_RE:README_VERSION_RE};
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "aegiscode",
3
3
  "productName": "AEGIS Code",
4
- "version": "7.0.28",
4
+ "version": "7.0.26",
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,15 @@
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"
25
26
  },
26
27
  "scripts": {
27
28
  "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
29
  "check": "node scripts/check.mjs",
33
- "pretest": "node scripts/predist.mjs",
34
30
  "test": "node scripts/runtests.mjs"
35
31
  },
36
32
  "keywords": [
@@ -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`));