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
@@ -1,291 +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
- const { caps, detect, cells, padCells } = require('./caps.js');
9
-
10
- /**
11
- * Resolve a stencil target — nothing at all, a `process.platform` name, or a
12
- * whole caps object — to the capabilities that decide the pass.
13
- *
14
- * A platform *name* is still accepted because it is the shape a test wants when
15
- * it is asking "what would the mark look like on that host?"; it is resolved
16
- * through the same `detect()` the live process uses, so a platform string is a
17
- * convenience alias for a capability probe, never a second decision path. Under
18
- * the uniform policy `detect()` ignores the platform it is handed, so
19
- * `capsOf('win32')` and `capsOf('linux')` return the same axes — which is the
20
- * point, and is asserted by `test/cli-terminal-caps.test.mjs`.
21
- */
22
- function capsOf(target) {
23
- if (!target) return caps();
24
- if (typeof target === 'string') return detect(process.env, process.stdout, target);
25
- return target;
26
- }
27
-
28
- /**
29
- * Welcome art — the ÆGIS wordmark, adopted verbatim from `aegiscodex-`.
30
- *
31
- * This is the mark the rest of the family already draws: the wordmark block in
32
- * `aegiscodex-/src/ui/components/layout/WelcomeMessage.tsx`, which is kept in
33
- * sync with `aegiscodex-/assets/demo.svg`, the canonical rendering. The CLI now
34
- * shows the same welcome screen as the desktop host instead of its own art.
35
- *
36
- * It REPLACES the earlier Claude-binary composition (feather plume, top hat,
37
- * ▐▛███▜▌ face, crescent moon, diving whale). That mark was three blocks joined
38
- * side by side, which is why this file carried a stacking path, a `✦` star pass
39
- * and a two-ink split; a single 13-cell block needs none of them, so the banner
40
- * draws it in one ink — gold — exactly as `theme.colors.primary` inks it in the
41
- * desktop, and the wide/narrow branch in both consumers now always takes the
42
- * wide path.
43
- *
44
- * Every row is the same display width with no trailing blank, so `center()` and
45
- * `padCells()` stay exact. `test/cli-conformance.test.mjs` pins these rows to
46
- * the literals they were lifted from, so the mark cannot drift from aegiscodex-.
47
- *
48
- * Which stencil pass is applied is decided by the terminal's capabilities, not
49
- * by `process.platform` — see the portability section below and `caps.js`.
50
- */
51
-
52
- // The ÆGIS wordmark: 3 rows × 13 cells, uniform. Row 1 is the cap line, row 2
53
- // carries the Æ crossbar (╦) and the G/S shoulders, row 3 the baseline.
54
- //
55
- // Deliberately not named after the old spaced `'A E G I S'` string: that
56
- // export was removed and `cli-conformance.test.mjs` fails the build if its name
57
- // reappears in this file's exports. The guard is about that string, not this
58
- // block, so the block takes a name of its own rather than the guard being
59
- // loosened to accommodate it.
60
- const WELCOME_MARK = [
61
- '╔═╗╔═╗╔═╗╦╔═╗',
62
- '╠═╣║╣ ║ ╦║╚═╗',
63
- '╩ ╩╚═╝╚═╝╩╚═╝',
64
- ];
65
-
66
- /** The welcome mark: the wordmark, with nothing drawn beside it. */
67
- const WELCOME_ART = WELCOME_MARK;
68
-
69
- /**
70
- * There is no stacked variant any more: the mark is 13 cells, so it fits any
71
- * terminal that can draw the banner's own frame. Kept as an alias rather than
72
- * deleted because `welcomeArtFor()` and the capability matrix enumerate both
73
- * names, and a second constant that happens to equal the first is cheaper than
74
- * a branch in two consumers.
75
- */
76
- const WELCOME_ART_STACKED = WELCOME_MARK;
77
-
78
- /** Welcome copy, in aegiscode-dev's frame: coral title over the mark. */
79
- const WELCOME_TITLE = 'Welcome to AEGIS Code';
80
- const WELCOME_BACK = 'Welcome back!';
81
- // One owner for the tagline: `render.js` joins it into the banner's version
82
- // line and `screens.js` centres it on the welcome screen. It used to be written
83
- // out twice — once here, once inline in `screens.js` — so a copy change landed
84
- // in one place and left the other stale.
85
- const TAGLINE = 'Your intent, AI automated.';
86
- // For terminals too narrow for the full line. `centered()` clips rather than
87
- // wraps, and a truncated tagline reads as a rendering fault, so this is a real
88
- // fallback and not a stylistic variant.
89
- const TAGLINE_SHORT = 'Your intent, automated.';
90
-
91
- // ── Terminal portability ─────────────────────────────────────────────────────
92
- // The wordmark is drawn with U+2550 box-drawing runes, which are single-width on
93
- // essentially every terminal in use. Each pass swaps offending code points 1:1
94
- // (same character count per row) so the width maths stays exact and the mark
95
- // keeps its shape.
96
- //
97
- // A pass is applied when the user ASKS for one — `AEGIS_ART=ascii` for a font
98
- // with no box-drawing or block range, `AEGIS_STAR=narrow` for a font that
99
- // renders ✦ through a two-cell emoji fallback. It is never triggered by the
100
- // host: `process.platform`, `TERM`, `TERM_PROGRAM`, `WT_SESSION` and the
101
- // locale's character set are probed and reported by `caps.js` and then
102
- // deliberately ignored, because a font that lacks the runes is something only
103
- // the person looking at the screen can settle. Previously PowerShell outside
104
- // Windows Terminal, Terminal.app and any `LANG=C` shell each silently got a
105
- // different mark from the same build.
106
- //
107
- // The passes still compose rather than being picked one-of-three, because the
108
- // two overrides are independent: `AEGIS_STAR=narrow` alone gives a native block
109
- // palette with a single-column star, which no single flat table could express.
110
- //
111
- // This table is the ONE stencil source of truth for the product. `theme.js`
112
- // resolves `GLYPH.star` through `stencilGlyph(STAR, caps)` rather than carrying
113
- // its own `'✦' → '*'` rule, and `render.js` builds the mark's tint map by
114
- // stencilling its runes — both had a private copy of the same decision, which
115
- // is how a stencil edit here could leave the star wide on one host and the mark
116
- // untinted on another. `test/cli-terminal-caps.test.mjs` pins all of it.
117
- const STAR = '✦';
118
-
119
- /** The quartile/quadrant face edges. The wordmark no longer draws them, but the
120
- * `face` capability still resolves through this list, so the pass stays. */
121
- const EDGE_RUNES = ['▐', '▛', '▜', '▌', '▝', '▘'];
122
-
123
- /**
124
- * The box-drawing runes the wordmark is made of. A legacy console has none of
125
- * them, and without a mapping the mark would be drawn in a font that has no
126
- * glyphs for it — boxes of tofu where the product name should be.
127
- *
128
- * Every corner, tee and cross becomes `+` (the classic ASCII box) and the two
129
- * straight strokes keep their meaning as `-` and `|`, so the stencilled mark is
130
- * still legible as ÆGIS rather than as a row of plusses. Ten runes, ten 1:1
131
- * swaps: the mark stays 13 cells wide and 3 rows tall on every terminal.
132
- */
133
- const BOX_RUNES = ['╔', '╗', '╚', '╝', '╠', '╣', '╦', '╩', '║', '═'];
134
- const BOX_STENCIL = new Map([
135
- ...['╔', '╗', '╚', '╝', '╠', '╣', '╦', '╩'].map((c) => [c, '+']),
136
- ['═', '-'],
137
- ['║', '|'],
138
- ]);
139
-
140
- /** Full ASCII pass: the wordmark's box runes, the block palette, the face
141
- * edges, the star, the mid-dot. */
142
- const ASCII_STENCIL = new Map([
143
- ...BOX_STENCIL,
144
- ['█', '#'],
145
- ['▓', '@'],
146
- ['▒', '='],
147
- ['░', '.'],
148
- ...EDGE_RUNES.map((c) => [c, '#']),
149
- [STAR, '*'],
150
- ['·', '.'],
151
- ]);
152
-
153
- /** Unicode pass for fonts that carry █▓▒░ but not the face edges (Apple, old Consolas). */
154
- const EDGE_STENCIL = new Map(EDGE_RUNES.map((c) => [c, '#']));
155
-
156
- /** ✦ alone: a font that falls back to a *two-cell* emoji glyph for it. */
157
- const STAR_STENCIL = new Map([[STAR, '*']]);
158
-
159
- /**
160
- * The named passes. They compose rather than being picked one-of-three:
161
- * `AEGIS_STAR=narrow` takes `star` only — a native block palette with a
162
- * single-column star — and `AEGIS_ART=ascii` takes the full pass.
163
- */
164
- const STENCILS = { ascii: ASCII_STENCIL, edges: EDGE_STENCIL, star: STAR_STENCIL };
165
-
166
- /**
167
- * The capability classes this mark has a pass for, and the one that needs none.
168
- * Kept as a name list so a caller (and the test) can enumerate the matrix
169
- * without restating the pass table.
170
- */
171
- const PASSES = ['native', 'star', 'edges', 'ascii'];
172
-
173
-
174
- /**
175
- * The stencil for a terminal, or `null` when its runes need no pass.
176
- *
177
- * `glyphs: 'ascii'` is the full pass and subsumes the others — a terminal with
178
- * no block glyphs certainly has no quartile edges and no ✦ either, so it must
179
- * not be handed a partial map that leaves ░▒▓◧ on screen.
180
- *
181
- * @param {string|object|null} [target] a caps object, a `process.platform` name,
182
- * or nothing for the live process's resolved capabilities.
183
- * @returns {Map<string,string>|null}
184
- */
185
- function stencilFor(target = null) {
186
- const c = capsOf(target);
187
- if (c.glyphs === 'ascii') return ASCII_STENCIL;
188
- const pass = new Map();
189
- if (c.face === 'edges') for (const [k, v] of EDGE_STENCIL) pass.set(k, v);
190
- if (c.star === 'narrow') for (const [k, v] of STAR_STENCIL) pass.set(k, v);
191
- return pass.size ? pass : null;
192
- }
193
-
194
- /**
195
- * One rune as the terminal renders it — the identity when it is native.
196
- * Exported so `theme.js`'s glyph table and `render.js`'s tint map are derived
197
- * from the stencil instead of restating it.
198
- * @param {string} ch
199
- * @param {string|object} [target] a caps object, a platform name, or nothing
200
- */
201
- function stencilGlyph(ch, target = null) {
202
- const s = stencilFor(target);
203
- return (s && s.get(ch)) || ch;
204
- }
205
-
206
- /** One pass over an art block, for an explicit target (caps object or platform). */
207
- function portabilityFor(rows, target = null) {
208
- const s = stencilFor(target);
209
- if (!s) return rows;
210
- return rows.map((r) => [...r].map((ch) => s.get(ch) ?? ch).join(''));
211
- }
212
-
213
- /**
214
- * The mark as the terminal running this process will render it.
215
- *
216
- * Deliberately NOT memoised: `aegiscode --ascii` and `/terminal ascii` re-resolve
217
- * the capabilities mid-session, and a cached mark would keep drawing the
218
- * previous terminal's runes until the process restarted.
219
- */
220
- function portability(rows) {
221
- return portabilityFor(rows, null);
222
- }
223
-
224
- /** The welcome mark, as this terminal will render it. */
225
- function welcomeArtFor() {
226
- return portability(WELCOME_ART);
227
- }
228
-
229
- /**
230
- * The mark, ready for the banner: one row per output row, each as a
231
- * `[left, right]` pair so the two consumers' ink split keeps working.
232
- *
233
- * The right half is always empty now. The pair shape is kept because
234
- * `render.js`'s `artRow()` is built around it — `left` is painted gold, `right`
235
- * per-shade — and collapsing it would mean a second, cosmetic signature for the
236
- * same data. A future two-tone mark drops straight back into the right slot.
237
- *
238
- * The width argument the consumers used to pass is gone with the wide/narrow
239
- * split: 13 cells fits everywhere the banner itself fits, so there is nothing
240
- * left for the terminal's column count to decide.
241
- *
242
- * @returns {{rows: Array<[string,string]>, width: number, gutter: number}}
243
- */
244
- function welcomeArtParts() {
245
- const rows = portability(WELCOME_MARK);
246
- return {
247
- rows: rows.map((r) => [r, '']),
248
- width: Math.max(...rows.map(cells)),
249
- gutter: 0,
250
- };
251
- }
252
-
253
- /** Centre every row of an art block inside `width` (left pad + right fill). */
254
- function center(rows, width) {
255
- return rows.map((r) => {
256
- const pad = Math.max(0, Math.floor((width - cells(r)) / 2));
257
- return ' '.repeat(pad) + padCells(r, width - pad);
258
- });
259
- }
260
-
261
- /** Centre each row against the block's own max width (no trailing fill). */
262
- function padBoth(rows, width) {
263
- const w = Math.max(...rows.map(cells));
264
- return rows.map((r) => {
265
- const pad = Math.floor((width - w) / 2);
266
- return ' '.repeat(Math.max(0, pad)) + r;
267
- });
268
- }
269
-
270
- module.exports = {
271
- WELCOME_MARK,
272
- WELCOME_ART,
273
- WELCOME_ART_STACKED,
274
- WELCOME_TITLE,
275
- WELCOME_BACK,
276
- TAGLINE,
277
- TAGLINE_SHORT,
278
- STAR,
279
- EDGE_RUNES,
280
- BOX_RUNES,
281
- PASSES,
282
- STENCILS,
283
- stencilFor,
284
- stencilGlyph,
285
- portability,
286
- portabilityFor,
287
- welcomeArtFor,
288
- welcomeArtParts,
289
- center,
290
- padBoth,
291
- };
3
+ "use strict";const{caps:caps,detect:detect,cells:cells,padCells:padCells}=require("./caps.js");function capsOf(t){return t?"string"==typeof t?detect(process.env,process.stdout,t):t:caps()}const WELCOME_MARK=["╔═╗╔═╗╔═╗╦╔═╗","╠═╣║╣ ║ ╦║╚═╗","╩ ╩╚═╝╚═╝╩╚═╝"],WELCOME_ART=WELCOME_MARK,WELCOME_ART_STACKED=WELCOME_MARK,WELCOME_TITLE="Welcome to AEGIS Code",WELCOME_BACK="Welcome back!",TAGLINE="Your intent, AI automated.",TAGLINE_SHORT="Your intent, automated.",STAR="✦",EDGE_RUNES=["▐","▛","▜","▌","▝","▘"],BOX_RUNES=["╔","╗","╚","╝","╠","╣","╦","╩","║","═"],BOX_STENCIL=new Map([...["╔","╗","╚","╝","╠","╣","╦","╩"].map((t=>[t,"+"])),["═","-"],["║","|"]]),ASCII_STENCIL=new Map([...BOX_STENCIL,["█","#"],["▓","@"],["▒","="],["░","."],...EDGE_RUNES.map((t=>[t,"#"])),["✦","*"],["·","."]]),EDGE_STENCIL=new Map(EDGE_RUNES.map((t=>[t,"#"]))),STAR_STENCIL=new Map([["✦","*"]]),STENCILS={ascii:ASCII_STENCIL,edges:EDGE_STENCIL,star:STAR_STENCIL},PASSES=["native","star","edges","ascii"];function stencilFor(t=null){const e=capsOf(t);if("ascii"===e.glyphs)return ASCII_STENCIL;const E=new Map;if("edges"===e.face)for(const[t,e]of EDGE_STENCIL)E.set(t,e);if("narrow"===e.star)for(const[t,e]of STAR_STENCIL)E.set(t,e);return E.size?E:null}function stencilGlyph(t,e=null){const E=stencilFor(e);return E&&E.get(t)||t}function portabilityFor(t,e=null){const E=stencilFor(e);return E?t.map((t=>[...t].map((t=>E.get(t)??t)).join(""))):t}function portability(t){return portabilityFor(t,null)}function welcomeArtFor(){return portability(WELCOME_ART)}function welcomeArtParts(){const t=portability(WELCOME_MARK);return{rows:t.map((t=>[t,""])),width:Math.max(...t.map(cells)),gutter:0}}function center(t,e){return t.map((t=>{const E=Math.max(0,Math.floor((e-cells(t))/2));return" ".repeat(E)+padCells(t,e-E)}))}function padBoth(t,e){const E=Math.max(...t.map(cells));return t.map((t=>{const r=Math.floor((e-E)/2);return" ".repeat(Math.max(0,r))+t}))}module.exports={WELCOME_MARK:WELCOME_MARK,WELCOME_ART:WELCOME_ART,WELCOME_ART_STACKED:WELCOME_ART_STACKED,WELCOME_TITLE:WELCOME_TITLE,WELCOME_BACK:WELCOME_BACK,TAGLINE:TAGLINE,TAGLINE_SHORT:TAGLINE_SHORT,STAR:"✦",EDGE_RUNES:EDGE_RUNES,BOX_RUNES:BOX_RUNES,PASSES:PASSES,STENCILS:STENCILS,stencilFor:stencilFor,stencilGlyph:stencilGlyph,portability:portability,portabilityFor:portabilityFor,welcomeArtFor:welcomeArtFor,welcomeArtParts:welcomeArtParts,center:center,padBoth:padBoth};