aegisone 1.0.21 → 1.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (226) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +1 -1
  3. package/SOURCE-OFFER.txt +9 -0
  4. package/bin/aegis.js +1 -322
  5. package/package.json +4 -2
  6. package/scripts/bump.mjs +1 -211
  7. package/scripts/bundle.js +1 -129
  8. package/scripts/predist.mjs +1 -939
  9. package/src/child.js +1 -285
  10. package/src/dispatch.js +1 -269
  11. package/src/doctor.js +1 -639
  12. package/src/host.js +1 -111
  13. package/src/permissions.js +1 -369
  14. package/src/probes.js +1 -159
  15. package/src/release.js +1 -409
  16. package/vendor/cli/bin/aegiscode.js +2 -914
  17. package/vendor/cli/package.json +3 -2
  18. package/vendor/cli/scripts/check.mjs +1 -52
  19. package/vendor/cli/scripts/demo.mjs +1 -94
  20. package/vendor/cli/scripts/predist.mjs +1 -75
  21. package/vendor/cli/scripts/runtests.mjs +1 -56
  22. package/vendor/cli/scripts/seal-gate.mjs +1 -74
  23. package/vendor/cli/src/agents.js +1 -139
  24. package/vendor/cli/src/app.js +1 -2932
  25. package/vendor/cli/src/art.js +1 -289
  26. package/vendor/cli/src/autonomous.js +1 -515
  27. package/vendor/cli/src/caps.js +1 -879
  28. package/vendor/cli/src/chatflow.js +1 -3008
  29. package/vendor/cli/src/checkpoint.js +1 -90
  30. package/vendor/cli/src/clipboard.js +1 -424
  31. package/vendor/cli/src/cloudsync.js +1 -528
  32. package/vendor/cli/src/commands.js +1 -3987
  33. package/vendor/cli/src/config.js +1 -581
  34. package/vendor/cli/src/connect.js +1 -349
  35. package/vendor/cli/src/credentials.js +1 -33
  36. package/vendor/cli/src/deps.js +1 -232
  37. package/vendor/cli/src/devrun.js +1 -187
  38. package/vendor/cli/src/diff.js +1 -333
  39. package/vendor/cli/src/diffview.js +1 -296
  40. package/vendor/cli/src/engine.js +1 -297
  41. package/vendor/cli/src/entitlement.js +1 -355
  42. package/vendor/cli/src/events.js +1 -707
  43. package/vendor/cli/src/export.js +1 -67
  44. package/vendor/cli/src/fingerprint.js +1 -592
  45. package/vendor/cli/src/format.js +1 -259
  46. package/vendor/cli/src/fuzzy.js +1 -119
  47. package/vendor/cli/src/gate.js +1 -55
  48. package/vendor/cli/src/history.js +1 -401
  49. package/vendor/cli/src/init.js +1 -175
  50. package/vendor/cli/src/input.js +1 -139
  51. package/vendor/cli/src/keys.js +1 -183
  52. package/vendor/cli/src/limits.js +1 -190
  53. package/vendor/cli/src/markdown.js +1 -306
  54. package/vendor/cli/src/mcp.js +1 -694
  55. package/vendor/cli/src/models.js +1 -487
  56. package/vendor/cli/src/naming.js +1 -229
  57. package/vendor/cli/src/overlays.js +1 -461
  58. package/vendor/cli/src/panels.js +1 -1418
  59. package/vendor/cli/src/permissions.js +1 -290
  60. package/vendor/cli/src/ping.js +1 -226
  61. package/vendor/cli/src/presence.js +1 -238
  62. package/vendor/cli/src/provenance.js +2 -182
  63. package/vendor/cli/src/render.js +1 -515
  64. package/vendor/cli/src/screen.js +1 -518
  65. package/vendor/cli/src/screens.js +1 -896
  66. package/vendor/cli/src/secret.js +1 -59
  67. package/vendor/cli/src/securefs.js +1 -359
  68. package/vendor/cli/src/settings.js +1 -155
  69. package/vendor/cli/src/shared.js +1 -52
  70. package/vendor/cli/src/sharedpaths.js +1 -53
  71. package/vendor/cli/src/signup.js +1 -156
  72. package/vendor/cli/src/summarize.js +1 -95
  73. package/vendor/cli/src/sysdiag.js +1 -585
  74. package/vendor/cli/src/system.js +1 -40
  75. package/vendor/cli/src/theme.js +1 -570
  76. package/vendor/cli/src/title.js +1 -220
  77. package/vendor/cli/src/todos.js +1 -115
  78. package/vendor/cli/src/tokens.js +1 -263
  79. package/vendor/cli/src/topup.js +1 -210
  80. package/vendor/cli/src/update.js +1 -181
  81. package/vendor/cli/vendor/client/aegis.js +1 -2054
  82. package/vendor/cli/vendor/client/attest.js +1 -442
  83. package/vendor/cli/vendor/client/authorship-key.js +1 -410
  84. package/vendor/cli/vendor/client/auto-provision.js +1 -134
  85. package/vendor/cli/vendor/client/brain-catalog.js +1 -268
  86. package/vendor/cli/vendor/client/byok-catalog.js +1 -230
  87. package/vendor/cli/vendor/client/credentials.js +1 -494
  88. package/vendor/cli/vendor/client/device-fingerprint.js +1 -141
  89. package/vendor/cli/vendor/client/drive-connect.js +1 -85
  90. package/vendor/cli/vendor/client/drive-upload.js +1 -174
  91. package/vendor/cli/vendor/client/env-file.js +1 -1273
  92. package/vendor/cli/vendor/client/fingerprint.js +1 -1064
  93. package/vendor/cli/vendor/client/foreign-memory.js +1 -669
  94. package/vendor/cli/vendor/client/google-signin.js +1 -125
  95. package/vendor/cli/vendor/client/hooks.js +1 -430
  96. package/vendor/cli/vendor/client/model-discovery.js +1 -330
  97. package/vendor/cli/vendor/client/platform.js +1 -937
  98. package/vendor/cli/vendor/client/prefs.js +1 -351
  99. package/vendor/cli/vendor/client/presence-constants.js +1 -107
  100. package/vendor/cli/vendor/client/presence.js +1 -438
  101. package/vendor/cli/vendor/client/record-vault.js +3 -1055
  102. package/vendor/cli/vendor/client/session-store.js +1 -548
  103. package/vendor/cli/vendor/client/topup.js +1 -297
  104. package/vendor/cli/vendor/client/touch.js +1 -458
  105. package/vendor/cli/vendor/client/update.js +1 -704
  106. package/vendor/cli/vendor/client/user-models.js +1 -381
  107. package/vendor/cli/vendor/desktop/lib/local/agents.js +1 -105
  108. package/vendor/cli/vendor/desktop/lib/local/autonomous.js +1 -1045
  109. package/vendor/cli/vendor/desktop/lib/local/claude-pro.js +1 -993
  110. package/vendor/cli/vendor/desktop/lib/local/context.js +1 -95
  111. package/vendor/cli/vendor/desktop/lib/local/engine.js +1 -3228
  112. package/vendor/cli/vendor/desktop/lib/local/entitlement.js +1 -654
  113. package/vendor/cli/vendor/desktop/lib/local/git-scope.js +1 -228
  114. package/vendor/cli/vendor/desktop/lib/local/local.js +1 -2135
  115. package/vendor/cli/vendor/desktop/lib/local/prompt.js +1 -275
  116. package/vendor/cli/vendor/desktop/lib/local/queue.js +1 -560
  117. package/vendor/cli/vendor/desktop/lib/local/session-rounds.js +1 -208
  118. package/vendor/cli/vendor/desktop/lib/local/shell.js +1 -680
  119. package/vendor/cli/vendor/desktop/lib/local/tools.js +1 -1238
  120. package/vendor/cli/vendor/desktop/lib/local/turn-guard.js +1 -300
  121. package/vendor/cli/vendor/desktop/lib/local/worktree-lock.js +1 -235
  122. package/vendor/cli/vendor/desktop/lib/settings.js +1 -890
  123. package/vendor/cli/vendor/desktop/renderer/usage.js +1 -1239
  124. package/vendor/cli/vendor/hosts/install.js +1 -638
  125. package/vendor/cli/vendor/hosts/openai-shim.js +1 -515
  126. package/vendor/cli/vendor/hosts/spec.js +1 -164
  127. package/vendor/cli/vendor/hosts/targets.js +1 -346
  128. package/vendor/cli/vendor/mcp/server.js +1 -221
  129. package/vendor/cli/vendor/mcp/tools.js +1 -408
  130. package/vendor/cli/vendor/one/src/child.js +1 -285
  131. package/vendor/cli/vendor/one/src/permissions.js +1 -369
  132. package/vendor/desktop/bin/aegis.js +1 -32
  133. package/vendor/desktop/lib/account-key.js +1 -56
  134. package/vendor/desktop/lib/auto.js +1 -430
  135. package/vendor/desktop/lib/avatar/companion.js +1 -698
  136. package/vendor/desktop/lib/avatar/cosmetics.js +1 -532
  137. package/vendor/desktop/lib/avatar/events.js +1 -344
  138. package/vendor/desktop/lib/avatar/holder-turn.js +1 -350
  139. package/vendor/desktop/lib/avatar/holders.js +1 -612
  140. package/vendor/desktop/lib/avatar/identity.js +1 -641
  141. package/vendor/desktop/lib/avatar/level.js +1 -368
  142. package/vendor/desktop/lib/avatar/mirror.js +1 -524
  143. package/vendor/desktop/lib/avatar/persona.js +1 -388
  144. package/vendor/desktop/lib/avatar/profile.js +1 -977
  145. package/vendor/desktop/lib/avatar/register.js +1 -307
  146. package/vendor/desktop/lib/avatar/store.js +1 -472
  147. package/vendor/desktop/lib/avatar/tiers.js +1 -38
  148. package/vendor/desktop/lib/avatar/transfer.js +1 -415
  149. package/vendor/desktop/lib/avatar/turn.js +1 -216
  150. package/vendor/desktop/lib/avatar/voice.js +1 -328
  151. package/vendor/desktop/lib/avatar/xp.js +1 -404
  152. package/vendor/desktop/lib/deep-link.js +1 -120
  153. package/vendor/desktop/lib/fingerprint.js +2 -347
  154. package/vendor/desktop/lib/google-connect.js +1 -169
  155. package/vendor/desktop/lib/local/agents.js +1 -105
  156. package/vendor/desktop/lib/local/autonomous.js +1 -1045
  157. package/vendor/desktop/lib/local/claude-pro.js +1 -993
  158. package/vendor/desktop/lib/local/context.js +1 -95
  159. package/vendor/desktop/lib/local/engine.js +1 -3228
  160. package/vendor/desktop/lib/local/entitlement.js +1 -654
  161. package/vendor/desktop/lib/local/git-scope.js +1 -228
  162. package/vendor/desktop/lib/local/local.js +1 -2135
  163. package/vendor/desktop/lib/local/prompt.js +1 -275
  164. package/vendor/desktop/lib/local/queue.js +1 -560
  165. package/vendor/desktop/lib/local/session-rounds.js +1 -208
  166. package/vendor/desktop/lib/local/shell.js +1 -680
  167. package/vendor/desktop/lib/local/telemetry.js +1 -470
  168. package/vendor/desktop/lib/local/tools.js +1 -1238
  169. package/vendor/desktop/lib/local/turn-guard.js +1 -300
  170. package/vendor/desktop/lib/local/worktree-lock.js +1 -235
  171. package/vendor/desktop/lib/provider-key-mirror.js +1 -252
  172. package/vendor/desktop/lib/quick-launcher.js +1 -84
  173. package/vendor/desktop/lib/settings.js +1 -890
  174. package/vendor/desktop/lib/sync/memory-queue.js +1 -60
  175. package/vendor/desktop/lib/sync/persist-gate.js +1 -148
  176. package/vendor/desktop/lib/sync/sessions.js +1 -106
  177. package/vendor/desktop/lib/window-state.js +1 -66
  178. package/vendor/desktop/main.js +1 -4390
  179. package/vendor/desktop/package.json +3 -5
  180. package/vendor/desktop/preload.js +1 -628
  181. package/vendor/desktop/renderer/app.js +1 -6560
  182. package/vendor/desktop/renderer/avatar/assemble.js +1 -335
  183. package/vendor/desktop/renderer/avatar/avatar.js +1 -380
  184. package/vendor/desktop/renderer/avatar/cards.js +1 -141
  185. package/vendor/desktop/renderer/avatar/hud.js +1 -206
  186. package/vendor/desktop/renderer/avatar/machine.js +1 -213
  187. package/vendor/desktop/renderer/avatar/pane.js +1 -439
  188. package/vendor/desktop/renderer/avatar/parts.js +1 -437
  189. package/vendor/desktop/renderer/budget.js +1 -168
  190. package/vendor/desktop/renderer/companion.js +1 -223
  191. package/vendor/desktop/renderer/diff.js +1 -359
  192. package/vendor/desktop/renderer/diffview.js +1 -336
  193. package/vendor/desktop/renderer/fingerprint.js +3 -720
  194. package/vendor/desktop/renderer/markdown.js +1 -168
  195. package/vendor/desktop/renderer/provider-toolbar.js +1 -134
  196. package/vendor/desktop/renderer/providers.js +1 -259
  197. package/vendor/desktop/renderer/quick.js +1 -191
  198. package/vendor/desktop/renderer/stream-policy.js +1 -306
  199. package/vendor/desktop/renderer/transcript-view.js +1 -323
  200. package/vendor/desktop/renderer/usage.js +1 -1239
  201. package/vendor/desktop/vendor/aegis.js +1 -2054
  202. package/vendor/desktop/vendor/attest.js +1 -442
  203. package/vendor/desktop/vendor/authorship-key.js +1 -410
  204. package/vendor/desktop/vendor/auto-provision.js +1 -134
  205. package/vendor/desktop/vendor/brain-catalog.js +1 -268
  206. package/vendor/desktop/vendor/byok-catalog.js +1 -230
  207. package/vendor/desktop/vendor/credentials.js +1 -494
  208. package/vendor/desktop/vendor/device-fingerprint.js +1 -141
  209. package/vendor/desktop/vendor/drive-connect.js +1 -85
  210. package/vendor/desktop/vendor/drive-upload.js +1 -174
  211. package/vendor/desktop/vendor/env-file.js +1 -1273
  212. package/vendor/desktop/vendor/fingerprint.js +1 -1064
  213. package/vendor/desktop/vendor/foreign-memory.js +1 -669
  214. package/vendor/desktop/vendor/google-signin.js +1 -125
  215. package/vendor/desktop/vendor/hooks.js +1 -430
  216. package/vendor/desktop/vendor/model-discovery.js +1 -330
  217. package/vendor/desktop/vendor/platform.js +1 -937
  218. package/vendor/desktop/vendor/prefs.js +1 -351
  219. package/vendor/desktop/vendor/presence-constants.js +1 -107
  220. package/vendor/desktop/vendor/presence.js +1 -438
  221. package/vendor/desktop/vendor/record-vault.js +3 -1055
  222. package/vendor/desktop/vendor/session-store.js +1 -548
  223. package/vendor/desktop/vendor/topup.js +1 -297
  224. package/vendor/desktop/vendor/touch.js +1 -458
  225. package/vendor/desktop/vendor/update.js +1 -704
  226. package/vendor/desktop/vendor/user-models.js +1 -381
@@ -1,463 +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
- ];
251
-
252
- // The picker's order reduced to the values a selection means, so the row a user
253
- // picks and the value the session stores can never come from two different
254
- // lists (commands.js validates against this, chatflow.js resolves the overlay
255
- // through it).
256
- const EFFORT_VALUES = EFFORT_LEVELS.map((lv) => (lv.value === undefined ? lv.label.toLowerCase() : lv.value));
257
-
258
- /**
259
- * @param {number} sel selected index
260
- * @param {number} width
261
- * @param {string|null} current the currently-selected effort level (null = the
262
- * high default, which is what the engine applies)
263
- * @param {Array} [levels] override the level table
264
- */
265
- function renderEffortPicker(sel = 0, width = 80, current = null, levels = EFFORT_LEVELS) {
266
- const lines = [];
267
- lines.push(blank(width));
268
- lines.push([span('', ' '), span(C.white + BOLD, 'Select effort'), span(BOLD_OFF, '')]);
269
- lines.push([span('', ' '), span(C.gray, 'Sets the token budget the pool sizes each turn from.')]);
270
- lines.push(blank(width));
271
- for (let i = 0; i < levels.length; i++) {
272
- const lv = levels[i];
273
- const active = i === sel;
274
- // `current == null` means no rung is stored, which is the high default the
275
- // engine resolves — so the check mark lands on High rather than on nothing.
276
- const cur = String(current || 'high').toLowerCase() === String(lv.label).toLowerCase();
277
- const left = active ? span(C.lavender, GLYPH.cursor) : span('', ' ');
278
- const nameSpan = active ? span(C.lavender, lv.label) : span(C.white, lv.label);
279
- const mark = cur ? span(C.green, ' ' + GLYPH.check) : span('', '');
280
- const pad = ' '.repeat(Math.max(1, 12 - [...lv.label].length));
281
- lines.push([span('', ' '), left, span('', ' '), nameSpan, mark, span(C.gray, pad + lv.note)]);
282
- }
283
- lines.push(blank(width));
284
- lines.push([span('', ' '), span(C.gray, PICKER_HINT)]);
285
- return fit(lines, width);
286
- }
287
-
288
- // ── Class picker overlay (/class) ────────────────────────────────────────────
289
-
290
- /**
291
- * @param {Array} classes entries ({class, configured?})
292
- * @param {number} sel selected index
293
- * @param {number} width
294
- * @param {string|null} current the live class id
295
- * @param {(cls: string) => string} [classLabel] the caller's label table, so
296
- * the class is named one way in every surface rather than re-spelled here.
297
- */
298
- function renderClassPicker(classes, sel = 0, width = 80, current = null, classLabel = null) {
299
- const list = Array.isArray(classes) ? classes : [];
300
- const label = (id) => (typeof classLabel === 'function' ? classLabel(id) : id) || id;
301
- const lines = [];
302
- lines.push(blank(width));
303
- lines.push([span('', ' '), span(C.white + BOLD, 'Select class'), span(BOLD_OFF, '')]);
304
- lines.push([span('', ' '), span(C.gray, 'Which route the next turn takes — who pays, and with which credential.')]);
305
- lines.push(blank(width));
306
- for (let i = 0; i < list.length; i++) {
307
- const k = list[i] || {};
308
- const id = k.class;
309
- const active = i === sel;
310
- const cur = current != null && id === current;
311
- const left = active ? span(C.lavender, GLYPH.cursor) : span('', ' ');
312
- const name = label(id);
313
- const nameSpan = active ? span(C.lavender, name) : span(C.white, name);
314
- const mark = cur ? span(C.green, ' ' + GLYPH.check) : span('', '');
315
- const pad = ' '.repeat(Math.max(1, 14 - [...name].length));
316
- // Same distinction /class's static panel used to draw: who pays, and with
317
- // which credential, so the picker says exactly what the printed table did.
318
- const note =
319
- id === 'byok'
320
- ? k.configured
321
- ? 'your key, relayed by AEGIS — billed a handling fee'
322
- : 'needs a provider key: /byok-key <provider>'
323
- : 'the pool — your AEGIS account key pays for it';
324
- lines.push([span('', ' '), left, span('', ' '), nameSpan, mark, span(C.gray, pad + note)]);
325
- }
326
- lines.push(blank(width));
327
- lines.push([span('', ' '), span(C.gray, PICKER_HINT)]);
328
- return fit(lines, width);
329
- }
330
-
331
- // ── Resume-list overlay (/resume) ────────────────────────────────────────────
332
-
333
- /**
334
- * @param {Array} items entries ({own?, summary?, cwd?, time?})
335
- * @param {number} sel selected index
336
- * @param {number} width
337
- * @param {number} height
338
- */
339
- function renderResumeList(items, sel = 0, width = 80, height = 24) {
340
- const list = Array.isArray(items) ? items : [];
341
- const lines = [];
342
- lines.push(blank(width));
343
- lines.push([span('', ' '), span(C.gray, '─'.repeat(Math.max(10, width - 4)))]);
344
- lines.push([
345
- span('', ' '),
346
- span(C.white + BOLD, 'Resume session'),
347
- span(C.gray, ` (${sel + 1} of ${Math.max(1, list.length)})`),
348
- span(BOLD_OFF, ''),
349
- ]);
350
- // search box
351
- const boxW = Math.max(10, width - 4);
352
- lines.push([span('', ' '), span(C.gray, '╭' + '─'.repeat(Math.max(0, boxW - 2)) + '╮')]);
353
- lines.push([
354
- span('', ' '),
355
- span(C.gray, '│'),
356
- span(C.white, '⌕ Search…'),
357
- span('', ' '.repeat(Math.max(0, boxW - 9))),
358
- span(C.gray, '│'),
359
- ]);
360
- lines.push([span('', ' '), span(C.gray, '╰' + '─'.repeat(Math.max(0, boxW - 2)) + '╯')]);
361
- lines.push(blank(width));
362
- const per = Math.max(2, Math.min(6, height - 16));
363
- const start = Math.max(0, Math.min(sel - Math.floor(per / 2), Math.max(0, list.length - per)));
364
- const visible = list.slice(start, start + per);
365
- for (let i = 0; i < visible.length; i++) {
366
- const it = visible[i] || {};
367
- const idx = start + i;
368
- const active = idx === sel;
369
- const left = active ? span(C.lavender, GLYPH.cursor) : span('', ' ');
370
- const tag = it.own ? span(C.green, GLYPH.star + ' ') : span(C.gray, GLYPH.bullet + ' ');
371
- const title = active
372
- ? span(C.white + BOLD, it.summary || '(untitled)')
373
- : span(C.white, it.summary || '(untitled)');
374
- lines.push([span('', ' '), left, span('', ' '), tag, title]);
375
- lines.push([span('', ' '), span(C.gray, `${it.cwd || '~'} ${GLYPH.bullet} ${ago(it.time)}`)]);
376
- }
377
- while (lines.length < 6 + per * 2) lines.push(blank(width));
378
- lines.push([span('', ' '), span(C.gray, '─'.repeat(Math.max(10, width - 4)))]);
379
- lines.push([
380
- span('', ' '),
381
- span(
382
- C.gray,
383
- `Ctrl+A all projects ${GLYPH.bullet} Space to preview ${GLYPH.bullet} Type to search ${GLYPH.bullet} Esc to cancel`
384
- ),
385
- ]);
386
- return fit(lines, width);
387
- }
388
-
389
- function ago(ts) {
390
- if (!ts) return '';
391
- const ms = Date.now() - new Date(String(ts)).getTime();
392
- if (!(ms >= 0) || Number.isNaN(ms)) return '';
393
- if (ms < 60_000) return `${Math.max(1, Math.round(ms / 1000))}s ago`;
394
- if (ms < 3_600_000) return `${Math.round(ms / 60_000)}m ago`;
395
- if (ms < 86_400_000) return `${Math.round(ms / 3_600_000)}h ago`;
396
- return `${Math.round(ms / 86_400_000)}d ago`;
397
- }
398
-
399
- // ── BYOK provider picker overlay (/byok-set, /byok-key with no argument) ────
400
-
401
- /**
402
- * The picker `/byok-set <provider>` draws when no provider was typed.
403
- *
404
- * The provider id was the one thing this flow asked the user to RECALL: `/byok`
405
- * listed ~20 ids, and storing a key meant reading one off that list and typing
406
- * it back — retyped wrong, it either matched nothing ("unknown provider") or,
407
- * worse, matched an alias of another vendor. The rows are the catalog's own,
408
- * so the id Enter sends is the id the relay will be asked for.
409
- *
410
- * @param {Array} providers catalog rows ({id, label?, configured?, masked?})
411
- * @param {number} sel selected index
412
- * @param {number} width
413
- * @param {string|null} [current] the provider already set on this machine, if
414
- * any (marked, not selected — "set" is shown per row anyway)
415
- * @param {string} [hint] the footer line; differs between `/byok-set` (the
416
- * account-side store) and `/byok-key` (this machine's store)
417
- */
418
- function renderProviderPicker(providers, sel = 0, width = 80, current = null, hint = null) {
419
- const list = Array.isArray(providers) ? providers : [];
420
- const lines = [];
421
- lines.push(blank(width));
422
- lines.push([span('', ' '), span(C.white + BOLD, 'Select provider'), span(BOLD_OFF, '')]);
423
- lines.push([span('', ' '), span(C.gray, 'Which vendor the key you are about to paste belongs to.')]);
424
- lines.push(blank(width));
425
- for (let i = 0; i < list.length; i++) {
426
- const p = list[i] || {};
427
- const id = String(p.id || '');
428
- if (!id) continue;
429
- const active = i === sel;
430
- const cur = current != null && id === current;
431
- const left = active ? span(C.lavender, GLYPH.cursor) : span('', ' ');
432
- const nameSpan = active ? span(C.lavender, id) : span(C.white, id);
433
- const mark = cur ? span(C.green, ' ' + GLYPH.check) : span('', '');
434
- const name = String(p.label || '');
435
- const pad = ' '.repeat(Math.max(1, 16 - [...id].length));
436
- const state = p.configured
437
- ? span(C.green, `set${p.masked ? ` (${p.masked})` : ''}`)
438
- : span(C.gray, 'not set');
439
- lines.push([
440
- span('', ' '), left, span('', ' '), nameSpan, mark,
441
- span(C.gray, pad + (name ? `${name} · ` : '')), state,
442
- ]);
443
- }
444
- lines.push(blank(width));
445
- lines.push([
446
- span('', ' '),
447
- span(C.gray, hint || `↑↓ or tab move ${GLYPH.bullet} enter picks ${GLYPH.bullet} esc cancels`),
448
- ]);
449
- return fit(lines, width);
450
- }
451
-
452
- module.exports = {
453
- boldMatched,
454
- renderPalette,
455
- renderModelPicker,
456
- renderEffortPicker,
457
- renderClassPicker,
458
- renderProviderPicker,
459
- renderResumeList,
460
- EFFORT_LEVELS,
461
- EFFORT_VALUES,
462
- PICKER_HINT,
463
- };
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)"}],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)),y="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+y)])}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};