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,464 +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
- * Overlay renderers — the "/" command palette, the alt+p model picker, the
10
- * /effort picker and the /resume session list. Ported from
11
- * the upstream engine reference (which mirrors live captures of Claude Code
12
- * 2.1.228: a gray `─` rule, a lavender `❯` cursor, a blue selected row, a
13
- * `⎿ Usage: /x hint` hook under the focused command and a `·`-separated footer).
14
- *
15
- * Every renderer here is PURE. It receives the data it draws — a command list, a
16
- * model list, an item list, a selection index, a width and a height — and
17
- * returns an array of span lines (`{ t, s, w }`, see screen.js). It imports no
18
- * registry, no session state and no key handling; the session loop owns those.
19
- * The palette's command list is the array the concurrent workstream owns:
20
- * `{ name, aliases?, help|desc, args?, category?, hint?, tool?|local?|unavailable? }`.
21
- *
22
- * Filtering reuses `./fuzzy.js` (fuzzyRankWithAliases + fuzzyMatchPositions).
23
- * The require is guarded: if that module is absent the palette falls back to a
24
- * substring filter so this file still loads and `node --check` still passes.
25
- */
26
-
27
- const { span, padLine } = require('./screen.js');
28
- const { C, BOLD, BOLD_OFF, GLYPH } = require('./theme.js');
29
-
30
- // ── fuzzy.js (guarded require — a concurrent workstream owns it) ─────────────
31
- let fuzzy = null;
32
- try {
33
- // eslint-disable-next-line global-require
34
- fuzzy = require('./fuzzy.js');
35
- } catch {
36
- fuzzy = null;
37
- }
38
-
39
- /** Rank palette commands by query (aliases count, like the reference). */
40
- function rankCommands(query, commands) {
41
- if (fuzzy && typeof fuzzy.fuzzyRankWithAliases === 'function') {
42
- return fuzzy.fuzzyRankWithAliases(query, commands, (c) => c.name, (c) => c.aliases || []);
43
- }
44
- // Fallback: plain case-insensitive substring across name + aliases.
45
- const q = String(query || '').toLowerCase();
46
- if (!q) return commands;
47
- return commands.filter((c) =>
48
- `${c.name} ${(c.aliases || []).join(' ')}`.toLowerCase().includes(q)
49
- );
50
- }
51
-
52
- /** The short description a registry entry carries (help or desc). */
53
- const descOf = (c) => c.help != null ? c.help : (c.desc != null ? c.desc : '');
54
- /** The usage hint shown on the selected row's `⎿` hook (hint, else args). */
55
- const hintOf = (c) => (c.hint != null ? c.hint : (c.args != null ? c.args : ''));
56
-
57
- /** Pad (and, if needed, truncate) every line to `width` cells so an overlay can
58
- * never paint wider than the terminal. */
59
- function fit(lines, width) {
60
- return lines.map((l) => padLine(l, width));
61
- }
62
-
63
- /** A full-width blank row. */
64
- const blank = (width) => [span('', ' '.repeat(Math.max(0, width)))];
65
-
66
- // Split a command name into spans that bold the
67
- // characters which matched the query; the selected row reads blue.
68
- function boldMatched(query, name, colour) {
69
- const pos = fuzzy && typeof fuzzy.fuzzyMatchPositions === 'function'
70
- ? fuzzy.fuzzyMatchPositions(query, name)
71
- : [];
72
- if (!pos || !pos.length) return [span(colour, name)];
73
- const segs = [];
74
- let last = 0;
75
- for (const p of pos) {
76
- if (p > last) segs.push(span(colour, name.slice(last, p)));
77
- segs.push(span(colour + BOLD, name[p]));
78
- last = p + 1;
79
- }
80
- if (last < name.length) segs.push(span(colour, name.slice(last)));
81
- return segs;
82
- }
83
-
84
- // ── Palette overlay (/) ──────────────────────────────────────────────────────
85
-
86
- /**
87
- * @param {Array|{commands:Array, query?:string, sel?:number}} commands
88
- * the registry command list (or a state object carrying it as `.commands`)
89
- * @param {{query?:string, sel?:number}} [state]
90
- * @param {number} [width]
91
- * @param {number} [height]
92
- */
93
- function renderPalette(commands, state = {}, width = 80, height = 24) {
94
- // Accept either `renderPalette(list, {query, sel}, w, h)` or the reference's
95
- // `renderPalette({commands, query, sel}, w, h)`.
96
- if (!Array.isArray(commands) && commands && typeof commands === 'object') {
97
- state = commands;
98
- commands = Array.isArray(commands.commands) ? commands.commands : [];
99
- }
100
- const list = rankCommands(state.query || '', commands || []);
101
- const sel = Number.isInteger(state.sel) ? state.sel : 0;
102
- const total = list.length;
103
- const per = Math.max(1, Math.min(12, height - 8));
104
- const start = Math.max(0, Math.min(sel - Math.floor(per / 2), Math.max(0, total - per)));
105
- const visible = list.slice(start, start + per);
106
-
107
- const lines = [];
108
- lines.push(blank(width));
109
- lines.push([span(C.gray, ' ' + '─'.repeat(Math.max(10, width - 4)))]);
110
- for (let i = 0; i < visible.length; i++) {
111
- const c = visible[i];
112
- const idx = start + i;
113
- const active = idx === sel;
114
- const left = active ? span(C.lavender, GLYPH.cursor) : span('', ' ');
115
- const row = active ? C.blue : C.white;
116
- const name = [span(row, '/'), ...boldMatched(state.query || '', c.name, row)];
117
- const pad = ' '.repeat(Math.max(1, 22 - [...c.name].length));
118
- lines.push([
119
- span('', ' '),
120
- left,
121
- span('', ' '),
122
- ...name,
123
- span(c.unavailable ? C.dim : C.gray, pad + descOf(c)),
124
- ]);
125
- if (active && hintOf(c)) {
126
- lines.push([span('', ' '), span(C.gray, `${GLYPH.hook} Usage: /${c.name} ${hintOf(c)}`)]);
127
- }
128
- }
129
- while (lines.length < 4 + per * 2) lines.push(blank(width));
130
- lines.push([span(C.gray, ' ' + '─'.repeat(Math.max(10, width - 4)))]);
131
- lines.push([
132
- span(
133
- C.gray,
134
- ` type to filter ${GLYPH.bullet} shift+enter runs the top row ${GLYPH.bullet} enter runs ${GLYPH.bullet} esc closes`
135
- ),
136
- ]);
137
- return fit(lines, width);
138
- }
139
-
140
- // ── Model picker overlay (alt+p) ─────────────────────────────────────────────
141
-
142
- // The one hint line the two setting-writing pickers (/model and /effort) share.
143
- //
144
- // It is ONE string reused, not a line typed twice, because a hint that
145
- // advertises a binding the other picker does not have is how /effort ended up
146
- // with no chord at all while /model had three: nothing forced the two to say
147
- // the same thing, so they didn't. Both handlers consume these bindings now
148
- // (chatflow.js handleOverlayKey), and both paint this sentence.
149
- //
150
- // Length is load-bearing: padLine() truncates at the terminal width with no
151
- // ellipsis, and a longer wording loses its second half at 80 columns — exactly
152
- // the half naming the chords — so the clause explaining the pin-as-you-move
153
- // chord gets cut to "…pins" and the sentence is worse than useless. The
154
- // removed shift+w/s chord was dropped from this string for the same reason it
155
- // was dropped from the handler: Tab is the single arrow-free binding. Keep the
156
- // whole line under 78 cells, plus the leading space.
157
- const PICKER_HINT = `↑↓ or tab move ${GLYPH.bullet} enter pins ${GLYPH.bullet} shift+↑↓ pins at once ${GLYPH.bullet} esc cancels`;
158
-
159
- /**
160
- * @param {Array} models entries ({id, label?, name?, note?, model?})
161
- * @param {number} sel selected index
162
- * @param {number} width
163
- * @param {number} height
164
- * @param {string|null} current the currently-pinned model id
165
- * @param {string} [cls] which class the next turn runs on ('aegis' | 'byok').
166
- * The rows are already class-scoped by the caller (app.js listModelsFor), but
167
- * the copy must be too: "manage the list with /model add|remove" is true of
168
- * the pooled catalog and meaningless on BYOK, where the list is not a stored
169
- * list at all but a function of which provider keys this machine holds — so
170
- * the subtitle names the command that actually changes it.
171
- * @param {(cls: string) => string} [classLabel] the caller's label table
172
- * (engine.js CLASS_LABELS, via app.js) so the class is named one way in every
173
- * surface rather than re-spelled here.
174
- */
175
- function renderModelPicker(models, sel = 0, width = 80, height = 24, current = null, cls = null, classLabel = null) {
176
- const lines = [];
177
- const label = typeof classLabel === 'function' && cls ? classLabel(cls) : null;
178
- lines.push(blank(width));
179
- lines.push([
180
- span('', ' '), span(C.white + BOLD, 'Select model'), span(BOLD_OFF, ''),
181
- ...(label ? [span(C.gray, ` — running on ${label}`)] : []),
182
- ]);
183
- lines.push([span('', ' '), span(C.gray, 'Switch between models. Your pick becomes the default for new sessions.')]);
184
- lines.push([
185
- span('', ' '),
186
- // The list mixes both classes: Nexus runs pooled (your AEGIS account
187
- // pays); every other row relays through your own provider key, and
188
- // picking one prompts for that key right here if this machine has none
189
- // saved yet — no need to run /byok-key first.
190
- span(C.gray, 'Nexus is pooled; any other row prompts for its provider key on pick.'),
191
- ]);
192
- lines.push(blank(width));
193
- // The list is the FULL catalog now (models.js pickerEntries), which is more
194
- // rows than any terminal has: ~40 ids against the 16 a 24-row window has left
195
- // once the title, subtitle and hint are paid for. Without a window the
196
- // selected row walked off the bottom of the frame while `sel` kept moving, so
197
- // arrow-DOWN looked broken — the row WAS selected, just never painted.
198
- //
199
- // The window keeps the selection as close to the middle as it can, clamped so
200
- // it never runs past either end, and states the number of hidden rows on the
201
- // side they are hidden. Row format and widths are unchanged: this is the same
202
- // line the un-windowed loop drew, over a slice of the list.
203
- const rows = Math.max(1, (height || 24) - 8);
204
- const count = models.length;
205
- const start = count > rows ? Math.min(Math.max(0, sel - Math.floor(rows / 2)), count - rows) : 0;
206
- const end = Math.min(count, start + rows);
207
- if (start > 0) lines.push([span('', ' '), span(C.gray, `↑ ${start} more above`)]);
208
- for (let i = start; i < end; i++) {
209
- const m = models[i] || {};
210
- const label = m.label || m.name || m.id || '';
211
- const active = i === sel;
212
- const cur = current != null && m.id === current;
213
- const left = active ? span(C.lavender, GLYPH.cursor) : span('', ' ');
214
- const num = span(C.gray, `${i + 1}.`);
215
- const nameSpan = active ? span(C.lavender, label) : span(C.white, label);
216
- const mark = cur ? span(C.green, ' ' + GLYPH.check) : span('', '');
217
- const pad = ' '.repeat(Math.max(1, 22 - [...label].length));
218
- // A byok row not yet configured on this machine gets a visible flag ahead
219
- // of its note, so "needs a key" is legible without reading the whole line.
220
- const flag = m.cls === 'byok' && !m.configured ? '[key needed] ' : '';
221
- lines.push([
222
- span('', ' '),
223
- left,
224
- span('', ' '),
225
- num,
226
- span('', ' '),
227
- nameSpan,
228
- mark,
229
- span(C.gray, pad + flag + (m.note || m.model || '')),
230
- ]);
231
- }
232
- if (end < count) lines.push([span('', ' '), span(C.gray, `↓ ${count - end} more below`)]);
233
- lines.push(blank(width));
234
- lines.push([span('', ' '), span(C.gray, PICKER_HINT)]);
235
- return fit(lines, width);
236
- }
237
-
238
- // ── Effort picker overlay (/effort) ──────────────────────────────────────────
239
-
240
- // The three rungs, in the order the picker draws them. `High` is the default
241
- // (config.js seeds `effort: 'high'`, and engine.js/desktop/renderer both resolve
242
- // an unknown rung to high), so the list is exactly the levels that can be in
243
- // force — there is no fourth "auto" row any more. "auto" was not a level: it
244
- // meant "send no rung", and because it was the default, a fresh install sent no
245
- // effort at all and the knob did nothing until it was set by hand.
246
- const EFFORT_LEVELS = [
247
- { label: 'Low', note: 'Fastest, cheapest budget' },
248
- { label: 'Medium', note: 'Balanced' },
249
- { label: 'High', note: 'Highest budget, slowest (default)' },
250
- { label: 'Max', note: 'Deepest reasoning where the model defines it; same budget as high' },
251
- ];
252
-
253
- // The picker's order reduced to the values a selection means, so the row a user
254
- // picks and the value the session stores can never come from two different
255
- // lists (commands.js validates against this, chatflow.js resolves the overlay
256
- // through it).
257
- const EFFORT_VALUES = EFFORT_LEVELS.map((lv) => (lv.value === undefined ? lv.label.toLowerCase() : lv.value));
258
-
259
- /**
260
- * @param {number} sel selected index
261
- * @param {number} width
262
- * @param {string|null} current the currently-selected effort level (null = the
263
- * high default, which is what the engine applies)
264
- * @param {Array} [levels] override the level table
265
- */
266
- function renderEffortPicker(sel = 0, width = 80, current = null, levels = EFFORT_LEVELS) {
267
- const lines = [];
268
- lines.push(blank(width));
269
- lines.push([span('', ' '), span(C.white + BOLD, 'Select effort'), span(BOLD_OFF, '')]);
270
- lines.push([span('', ' '), span(C.gray, 'Sets the token budget the pool sizes each turn from.')]);
271
- lines.push(blank(width));
272
- for (let i = 0; i < levels.length; i++) {
273
- const lv = levels[i];
274
- const active = i === sel;
275
- // `current == null` means no rung is stored, which is the high default the
276
- // engine resolves — so the check mark lands on High rather than on nothing.
277
- const cur = String(current || 'high').toLowerCase() === String(lv.label).toLowerCase();
278
- const left = active ? span(C.lavender, GLYPH.cursor) : span('', ' ');
279
- const nameSpan = active ? span(C.lavender, lv.label) : span(C.white, lv.label);
280
- const mark = cur ? span(C.green, ' ' + GLYPH.check) : span('', '');
281
- const pad = ' '.repeat(Math.max(1, 12 - [...lv.label].length));
282
- lines.push([span('', ' '), left, span('', ' '), nameSpan, mark, span(C.gray, pad + lv.note)]);
283
- }
284
- lines.push(blank(width));
285
- lines.push([span('', ' '), span(C.gray, PICKER_HINT)]);
286
- return fit(lines, width);
287
- }
288
-
289
- // ── Class picker overlay (/class) ────────────────────────────────────────────
290
-
291
- /**
292
- * @param {Array} classes entries ({class, configured?})
293
- * @param {number} sel selected index
294
- * @param {number} width
295
- * @param {string|null} current the live class id
296
- * @param {(cls: string) => string} [classLabel] the caller's label table, so
297
- * the class is named one way in every surface rather than re-spelled here.
298
- */
299
- function renderClassPicker(classes, sel = 0, width = 80, current = null, classLabel = null) {
300
- const list = Array.isArray(classes) ? classes : [];
301
- const label = (id) => (typeof classLabel === 'function' ? classLabel(id) : id) || id;
302
- const lines = [];
303
- lines.push(blank(width));
304
- lines.push([span('', ' '), span(C.white + BOLD, 'Select class'), span(BOLD_OFF, '')]);
305
- lines.push([span('', ' '), span(C.gray, 'Which route the next turn takes — who pays, and with which credential.')]);
306
- lines.push(blank(width));
307
- for (let i = 0; i < list.length; i++) {
308
- const k = list[i] || {};
309
- const id = k.class;
310
- const active = i === sel;
311
- const cur = current != null && id === current;
312
- const left = active ? span(C.lavender, GLYPH.cursor) : span('', ' ');
313
- const name = label(id);
314
- const nameSpan = active ? span(C.lavender, name) : span(C.white, name);
315
- const mark = cur ? span(C.green, ' ' + GLYPH.check) : span('', '');
316
- const pad = ' '.repeat(Math.max(1, 14 - [...name].length));
317
- // Same distinction /class's static panel used to draw: who pays, and with
318
- // which credential, so the picker says exactly what the printed table did.
319
- const note =
320
- id === 'byok'
321
- ? k.configured
322
- ? 'your key, relayed by AEGIS — billed a handling fee'
323
- : 'needs a provider key: /byok-key <provider>'
324
- : 'the pool — your AEGIS account key pays for it';
325
- lines.push([span('', ' '), left, span('', ' '), nameSpan, mark, span(C.gray, pad + note)]);
326
- }
327
- lines.push(blank(width));
328
- lines.push([span('', ' '), span(C.gray, PICKER_HINT)]);
329
- return fit(lines, width);
330
- }
331
-
332
- // ── Resume-list overlay (/resume) ────────────────────────────────────────────
333
-
334
- /**
335
- * @param {Array} items entries ({own?, summary?, cwd?, time?})
336
- * @param {number} sel selected index
337
- * @param {number} width
338
- * @param {number} height
339
- */
340
- function renderResumeList(items, sel = 0, width = 80, height = 24) {
341
- const list = Array.isArray(items) ? items : [];
342
- const lines = [];
343
- lines.push(blank(width));
344
- lines.push([span('', ' '), span(C.gray, '─'.repeat(Math.max(10, width - 4)))]);
345
- lines.push([
346
- span('', ' '),
347
- span(C.white + BOLD, 'Resume session'),
348
- span(C.gray, ` (${sel + 1} of ${Math.max(1, list.length)})`),
349
- span(BOLD_OFF, ''),
350
- ]);
351
- // search box
352
- const boxW = Math.max(10, width - 4);
353
- lines.push([span('', ' '), span(C.gray, '╭' + '─'.repeat(Math.max(0, boxW - 2)) + '╮')]);
354
- lines.push([
355
- span('', ' '),
356
- span(C.gray, '│'),
357
- span(C.white, '⌕ Search…'),
358
- span('', ' '.repeat(Math.max(0, boxW - 9))),
359
- span(C.gray, '│'),
360
- ]);
361
- lines.push([span('', ' '), span(C.gray, '╰' + '─'.repeat(Math.max(0, boxW - 2)) + '╯')]);
362
- lines.push(blank(width));
363
- const per = Math.max(2, Math.min(6, height - 16));
364
- const start = Math.max(0, Math.min(sel - Math.floor(per / 2), Math.max(0, list.length - per)));
365
- const visible = list.slice(start, start + per);
366
- for (let i = 0; i < visible.length; i++) {
367
- const it = visible[i] || {};
368
- const idx = start + i;
369
- const active = idx === sel;
370
- const left = active ? span(C.lavender, GLYPH.cursor) : span('', ' ');
371
- const tag = it.own ? span(C.green, GLYPH.star + ' ') : span(C.gray, GLYPH.bullet + ' ');
372
- const title = active
373
- ? span(C.white + BOLD, it.summary || '(untitled)')
374
- : span(C.white, it.summary || '(untitled)');
375
- lines.push([span('', ' '), left, span('', ' '), tag, title]);
376
- lines.push([span('', ' '), span(C.gray, `${it.cwd || '~'} ${GLYPH.bullet} ${ago(it.time)}`)]);
377
- }
378
- while (lines.length < 6 + per * 2) lines.push(blank(width));
379
- lines.push([span('', ' '), span(C.gray, '─'.repeat(Math.max(10, width - 4)))]);
380
- lines.push([
381
- span('', ' '),
382
- span(
383
- C.gray,
384
- `Ctrl+A all projects ${GLYPH.bullet} Space to preview ${GLYPH.bullet} Type to search ${GLYPH.bullet} Esc to cancel`
385
- ),
386
- ]);
387
- return fit(lines, width);
388
- }
389
-
390
- function ago(ts) {
391
- if (!ts) return '';
392
- const ms = Date.now() - new Date(String(ts)).getTime();
393
- if (!(ms >= 0) || Number.isNaN(ms)) return '';
394
- if (ms < 60_000) return `${Math.max(1, Math.round(ms / 1000))}s ago`;
395
- if (ms < 3_600_000) return `${Math.round(ms / 60_000)}m ago`;
396
- if (ms < 86_400_000) return `${Math.round(ms / 3_600_000)}h ago`;
397
- return `${Math.round(ms / 86_400_000)}d ago`;
398
- }
399
-
400
- // ── BYOK provider picker overlay (/byok-set, /byok-key with no argument) ────
401
-
402
- /**
403
- * The picker `/byok-set <provider>` draws when no provider was typed.
404
- *
405
- * The provider id was the one thing this flow asked the user to RECALL: `/byok`
406
- * listed ~20 ids, and storing a key meant reading one off that list and typing
407
- * it back — retyped wrong, it either matched nothing ("unknown provider") or,
408
- * worse, matched an alias of another vendor. The rows are the catalog's own,
409
- * so the id Enter sends is the id the relay will be asked for.
410
- *
411
- * @param {Array} providers catalog rows ({id, label?, configured?, masked?})
412
- * @param {number} sel selected index
413
- * @param {number} width
414
- * @param {string|null} [current] the provider already set on this machine, if
415
- * any (marked, not selected — "set" is shown per row anyway)
416
- * @param {string} [hint] the footer line; differs between `/byok-set` (the
417
- * account-side store) and `/byok-key` (this machine's store)
418
- */
419
- function renderProviderPicker(providers, sel = 0, width = 80, current = null, hint = null) {
420
- const list = Array.isArray(providers) ? providers : [];
421
- const lines = [];
422
- lines.push(blank(width));
423
- lines.push([span('', ' '), span(C.white + BOLD, 'Select provider'), span(BOLD_OFF, '')]);
424
- lines.push([span('', ' '), span(C.gray, 'Which vendor the key you are about to paste belongs to.')]);
425
- lines.push(blank(width));
426
- for (let i = 0; i < list.length; i++) {
427
- const p = list[i] || {};
428
- const id = String(p.id || '');
429
- if (!id) continue;
430
- const active = i === sel;
431
- const cur = current != null && id === current;
432
- const left = active ? span(C.lavender, GLYPH.cursor) : span('', ' ');
433
- const nameSpan = active ? span(C.lavender, id) : span(C.white, id);
434
- const mark = cur ? span(C.green, ' ' + GLYPH.check) : span('', '');
435
- const name = String(p.label || '');
436
- const pad = ' '.repeat(Math.max(1, 16 - [...id].length));
437
- const state = p.configured
438
- ? span(C.green, `set${p.masked ? ` (${p.masked})` : ''}`)
439
- : span(C.gray, 'not set');
440
- lines.push([
441
- span('', ' '), left, span('', ' '), nameSpan, mark,
442
- span(C.gray, pad + (name ? `${name} · ` : '')), state,
443
- ]);
444
- }
445
- lines.push(blank(width));
446
- lines.push([
447
- span('', ' '),
448
- span(C.gray, hint || `↑↓ or tab move ${GLYPH.bullet} enter picks ${GLYPH.bullet} esc cancels`),
449
- ]);
450
- return fit(lines, width);
451
- }
452
-
453
- module.exports = {
454
- boldMatched,
455
- renderPalette,
456
- renderModelPicker,
457
- renderEffortPicker,
458
- renderClassPicker,
459
- renderProviderPicker,
460
- renderResumeList,
461
- EFFORT_LEVELS,
462
- EFFORT_VALUES,
463
- PICKER_HINT,
464
- };
3
+ "use strict";const{span:span,padLine:padLine}=require("./screen.js"),{C:C,BOLD:BOLD,BOLD_OFF:BOLD_OFF,GLYPH:GLYPH}=require("./theme.js");let fuzzy=null;try{fuzzy=require("./fuzzy.js")}catch{fuzzy=null}function rankCommands(e,a){if(fuzzy&&"function"==typeof fuzzy.fuzzyRankWithAliases)return fuzzy.fuzzyRankWithAliases(e,a,(e=>e.name),(e=>e.aliases||[]));const n=String(e||"").toLowerCase();return n?a.filter((e=>`${e.name} ${(e.aliases||[]).join(" ")}`.toLowerCase().includes(n))):a}const descOf=e=>null!=e.help?e.help:null!=e.desc?e.desc:"",hintOf=e=>null!=e.hint?e.hint:null!=e.args?e.args:"";function fit(e,a){return e.map((e=>padLine(e,a)))}const blank=e=>[span(""," ".repeat(Math.max(0,e)))];function boldMatched(e,a,n){const s=fuzzy&&"function"==typeof fuzzy.fuzzyMatchPositions?fuzzy.fuzzyMatchPositions(e,a):[];if(!s||!s.length)return[span(n,a)];const t=[];let r=0;for(const e of s)e>r&&t.push(span(n,a.slice(r,e))),t.push(span(n+BOLD,a[e])),r=e+1;return r<a.length&&t.push(span(n,a.slice(r))),t}function renderPalette(e,a={},n=80,s=24){!Array.isArray(e)&&e&&"object"==typeof e&&(a=e,e=Array.isArray(e.commands)?e.commands:[]);const t=rankCommands(a.query||"",e||[]),r=Number.isInteger(a.sel)?a.sel:0,p=t.length,l=Math.max(1,Math.min(12,s-8)),o=Math.max(0,Math.min(r-Math.floor(l/2),Math.max(0,p-l))),u=t.slice(o,o+l),h=[];h.push(blank(n)),h.push([span(C.gray," "+"─".repeat(Math.max(10,n-4)))]);for(let e=0;e<u.length;e++){const n=u[e],s=o+e===r,t=s?span(C.lavender,GLYPH.cursor):span(""," "),p=s?C.blue:C.white,l=[span(p,"/"),...boldMatched(a.query||"",n.name,p)],i=" ".repeat(Math.max(1,22-[...n.name].length));h.push([span(""," "),t,span(""," "),...l,span(n.unavailable?C.dim:C.gray,i+descOf(n))]),s&&hintOf(n)&&h.push([span(""," "),span(C.gray,`${GLYPH.hook} Usage: /${n.name} ${hintOf(n)}`)])}for(;h.length<4+2*l;)h.push(blank(n));return h.push([span(C.gray," "+"─".repeat(Math.max(10,n-4)))]),h.push([span(C.gray,` type to filter ${GLYPH.bullet} shift+enter runs the top row ${GLYPH.bullet} enter runs ${GLYPH.bullet} esc closes`)]),fit(h,n)}const PICKER_HINT=`↑↓ or tab move ${GLYPH.bullet} enter pins ${GLYPH.bullet} shift+↑↓ pins at once ${GLYPH.bullet} esc cancels`;function renderModelPicker(e,a=0,n=80,s=24,t=null,r=null,p=null){const l=[],o="function"==typeof p&&r?p(r):null;l.push(blank(n)),l.push([span(""," "),span(C.white+BOLD,"Select model"),span(BOLD_OFF,""),...o?[span(C.gray,` — running on ${o}`)]:[]]),l.push([span(""," "),span(C.gray,"Switch between models. Your pick becomes the default for new sessions.")]),l.push([span(""," "),span(C.gray,"Nexus is pooled; any other row prompts for its provider key on pick.")]),l.push(blank(n));const u=Math.max(1,(s||24)-8),h=e.length,i=h>u?Math.min(Math.max(0,a-Math.floor(u/2)),h-u):0,c=Math.min(h,i+u);i>0&&l.push([span(""," "),span(C.gray,`↑ ${i} more above`)]);for(let n=i;n<c;n++){const s=e[n]||{},r=s.label||s.name||s.id||"",p=n===a,o=null!=t&&s.id===t,u=p?span(C.lavender,GLYPH.cursor):span(""," "),h=span(C.gray,`${n+1}.`),i=span(p?C.lavender:C.white,r),c=o?span(C.green," "+GLYPH.check):span("",""),d=" ".repeat(Math.max(1,22-[...r].length)),g="byok"!==s.cls||s.configured?"":"[key needed] ";l.push([span(""," "),u,span(""," "),h,span(""," "),i,c,span(C.gray,d+g+(s.note||s.model||""))])}return c<h&&l.push([span(""," "),span(C.gray,`↓ ${h-c} more below`)]),l.push(blank(n)),l.push([span(""," "),span(C.gray,PICKER_HINT)]),fit(l,n)}const EFFORT_LEVELS=[{label:"Low",note:"Fastest, cheapest budget"},{label:"Medium",note:"Balanced"},{label:"High",note:"Highest budget, slowest (default)"},{label:"Max",note:"Deepest reasoning where the model defines it; same budget as high"}],EFFORT_VALUES=EFFORT_LEVELS.map((e=>void 0===e.value?e.label.toLowerCase():e.value));function renderEffortPicker(e=0,a=80,n=null,s=EFFORT_LEVELS){const t=[];t.push(blank(a)),t.push([span(""," "),span(C.white+BOLD,"Select effort"),span(BOLD_OFF,"")]),t.push([span(""," "),span(C.gray,"Sets the token budget the pool sizes each turn from.")]),t.push(blank(a));for(let a=0;a<s.length;a++){const r=s[a],p=a===e,l=String(n||"high").toLowerCase()===String(r.label).toLowerCase(),o=p?span(C.lavender,GLYPH.cursor):span(""," "),u=span(p?C.lavender:C.white,r.label),h=l?span(C.green," "+GLYPH.check):span("",""),i=" ".repeat(Math.max(1,12-[...r.label].length));t.push([span(""," "),o,span(""," "),u,h,span(C.gray,i+r.note)])}return t.push(blank(a)),t.push([span(""," "),span(C.gray,PICKER_HINT)]),fit(t,a)}function renderClassPicker(e,a=0,n=80,s=null,t=null){const r=Array.isArray(e)?e:[],p=e=>("function"==typeof t?t(e):e)||e,l=[];l.push(blank(n)),l.push([span(""," "),span(C.white+BOLD,"Select class"),span(BOLD_OFF,"")]),l.push([span(""," "),span(C.gray,"Which route the next turn takes — who pays, and with which credential.")]),l.push(blank(n));for(let e=0;e<r.length;e++){const n=r[e]||{},t=n.class,o=e===a,u=null!=s&&t===s,h=o?span(C.lavender,GLYPH.cursor):span(""," "),i=p(t),c=span(o?C.lavender:C.white,i),d=u?span(C.green," "+GLYPH.check):span("",""),g=" ".repeat(Math.max(1,14-[...i].length)),f="byok"===t?n.configured?"your key, relayed by AEGIS — billed a handling fee":"needs a provider key: /byok-key <provider>":"the pool — your AEGIS account key pays for it";l.push([span(""," "),h,span(""," "),c,d,span(C.gray,g+f)])}return l.push(blank(n)),l.push([span(""," "),span(C.gray,PICKER_HINT)]),fit(l,n)}function renderResumeList(e,a=0,n=80,s=24){const t=Array.isArray(e)?e:[],r=[];r.push(blank(n)),r.push([span(""," "),span(C.gray,"─".repeat(Math.max(10,n-4)))]),r.push([span(""," "),span(C.white+BOLD,"Resume session"),span(C.gray,` (${a+1} of ${Math.max(1,t.length)})`),span(BOLD_OFF,"")]);const p=Math.max(10,n-4);r.push([span(""," "),span(C.gray,"╭"+"─".repeat(Math.max(0,p-2))+"╮")]),r.push([span(""," "),span(C.gray,"│"),span(C.white,"⌕ Search…"),span(""," ".repeat(Math.max(0,p-9))),span(C.gray,"│")]),r.push([span(""," "),span(C.gray,"╰"+"─".repeat(Math.max(0,p-2))+"╯")]),r.push(blank(n));const l=Math.max(2,Math.min(6,s-16)),o=Math.max(0,Math.min(a-Math.floor(l/2),Math.max(0,t.length-l))),u=t.slice(o,o+l);for(let e=0;e<u.length;e++){const n=u[e]||{},s=o+e===a,t=s?span(C.lavender,GLYPH.cursor):span(""," "),p=n.own?span(C.green,GLYPH.star+" "):span(C.gray,GLYPH.bullet+" "),l=span(s?C.white+BOLD:C.white,n.summary||"(untitled)");r.push([span(""," "),t,span(""," "),p,l]),r.push([span(""," "),span(C.gray,`${n.cwd||"~"} ${GLYPH.bullet} ${ago(n.time)}`)])}for(;r.length<6+2*l;)r.push(blank(n));return r.push([span(""," "),span(C.gray,"─".repeat(Math.max(10,n-4)))]),r.push([span(""," "),span(C.gray,`Ctrl+A all projects ${GLYPH.bullet} Space to preview ${GLYPH.bullet} Type to search ${GLYPH.bullet} Esc to cancel`)]),fit(r,n)}function ago(e){if(!e)return"";const a=Date.now()-new Date(String(e)).getTime();return a>=0&&!Number.isNaN(a)?a<6e4?`${Math.max(1,Math.round(a/1e3))}s ago`:a<36e5?`${Math.round(a/6e4)}m ago`:a<864e5?`${Math.round(a/36e5)}h ago`:`${Math.round(a/864e5)}d ago`:""}function renderProviderPicker(e,a=0,n=80,s=null,t=null){const r=Array.isArray(e)?e:[],p=[];p.push(blank(n)),p.push([span(""," "),span(C.white+BOLD,"Select provider"),span(BOLD_OFF,"")]),p.push([span(""," "),span(C.gray,"Which vendor the key you are about to paste belongs to.")]),p.push(blank(n));for(let e=0;e<r.length;e++){const n=r[e]||{},t=String(n.id||"");if(!t)continue;const l=e===a,o=null!=s&&t===s,u=l?span(C.lavender,GLYPH.cursor):span(""," "),h=span(l?C.lavender:C.white,t),i=o?span(C.green," "+GLYPH.check):span("",""),c=String(n.label||""),d=" ".repeat(Math.max(1,16-[...t].length)),g=n.configured?span(C.green,"set"+(n.masked?` (${n.masked})`:"")):span(C.gray,"not set");p.push([span(""," "),u,span(""," "),h,i,span(C.gray,d+(c?`${c} · `:"")),g])}return p.push(blank(n)),p.push([span(""," "),span(C.gray,t||`↑↓ or tab move ${GLYPH.bullet} enter picks ${GLYPH.bullet} esc cancels`)]),fit(p,n)}module.exports={boldMatched:boldMatched,renderPalette:renderPalette,renderModelPicker:renderModelPicker,renderEffortPicker:renderEffortPicker,renderClassPicker:renderClassPicker,renderProviderPicker:renderProviderPicker,renderResumeList:renderResumeList,EFFORT_LEVELS:EFFORT_LEVELS,EFFORT_VALUES:EFFORT_VALUES,PICKER_HINT:PICKER_HINT};