@causyne/agent 1.20.5 → 1.20.8

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.
@@ -5,11 +5,19 @@
5
5
 
6
6
  // @ts-expect-error untyped local TUI dialogs
7
7
  import { SelectLayer, InputLayer } from './dialogs.js';
8
+ // @ts-expect-error untyped local TUI theme
9
+ import { paint, bold, dim, GLYPHS } from './theme.js';
10
+ // @ts-expect-error untyped local TUI selectList
11
+ import { fuzzyFilter } from './selectList.js';
8
12
  import { loadConfig, saveConfig } from '../config.js';
9
- import { getAvailableProvidersOverview, type ProviderOverview } from '../dynamicCatalogue.js';
13
+ import {
14
+ getAvailableProvidersOverview,
15
+ resolveAvailableProvidersOverview,
16
+ type ProviderOverview
17
+ } from '../dynamicCatalogue.js';
10
18
 
11
19
  export interface ModelPickerItemValue {
12
- type: 'acp' | 'byok';
20
+ type: 'acp' | 'byok' | 'toggle';
13
21
  providerId: string;
14
22
  modelId: string;
15
23
  providerLabel: string;
@@ -18,6 +26,9 @@ export interface ModelPickerItemValue {
18
26
  isConfigured: boolean;
19
27
  envVar?: string | undefined;
20
28
  setupInstruction?: string | undefined;
29
+ isToggle?: boolean | undefined;
30
+ action?: 'expand' | 'collapse' | undefined;
31
+ peerKey?: string | undefined;
21
32
  }
22
33
 
23
34
  export interface ModelPickerItem {
@@ -47,6 +58,12 @@ export interface InteractiveModelPickerOptions {
47
58
  } | undefined;
48
59
  }
49
60
 
61
+ export interface BuildModelPickerOptions {
62
+ tab?: 'acp' | 'byok' | 'all' | undefined;
63
+ expandedPeers?: Set<string> | undefined;
64
+ maxAcpPerPeer?: number | undefined;
65
+ }
66
+
50
67
  async function showConfiguringAnimation(providerLabel: string): Promise<void> {
51
68
  if (!process.stdout.isTTY) return;
52
69
  const frames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
@@ -61,100 +78,341 @@ async function showConfiguringAnimation(providerLabel: string): Promise<void> {
61
78
 
62
79
  /**
63
80
  * Build items for SelectLayer categorized by ACP peers and BYOK providers.
81
+ *
82
+ * Supports tab filtering ('acp' | 'byok' | 'all') and smart pagination
83
+ * for ACP peers exceeding maxAcpPerPeer (default 10 models).
64
84
  */
65
85
  export function buildModelPickerItems(
66
86
  config: { provider?: string; model?: string; apiKey?: string; providerKeys?: Record<string, string> },
67
- overview: ProviderOverview
87
+ overview: ProviderOverview,
88
+ options: BuildModelPickerOptions = {}
68
89
  ): ModelPickerItem[] {
69
90
  const items: ModelPickerItem[] = [];
70
91
  const activeProvider = config.provider || '';
71
92
  const activeModel = config.model || '';
93
+ const tab = options.tab || 'all';
94
+ const expandedPeers = options.expandedPeers || new Set<string>();
95
+ const maxAcp = typeof options.maxAcpPerPeer === 'number' ? options.maxAcpPerPeer : (tab === 'all' ? Infinity : 10);
72
96
 
73
97
  // 1. ACP Peer Agents & Sovereign Local Engines
74
- for (const peer of overview.acp) {
75
- const isCurrentProvider = activeProvider === peer.providerKey;
76
- const catTitle = peer.installed
77
- ? `ACP · ${peer.label} (ready)`
78
- : `ACP · ${peer.label} (not installed)`;
79
-
80
- if (peer.installed && Array.isArray(peer.models) && peer.models.length > 0) {
81
- for (const m of peer.models) {
82
- const isCurrent = isCurrentProvider && activeModel === m;
98
+ if (tab === 'all' || tab === 'acp') {
99
+ for (const peer of overview.acp) {
100
+ const isCurrentProvider = activeProvider === peer.providerKey;
101
+ const catTitle = peer.installed
102
+ ? `ACP · ${peer.label} (ready)`
103
+ : `ACP · ${peer.label} (not installed)`;
104
+
105
+ if (peer.installed && Array.isArray(peer.models) && peer.models.length > 0) {
106
+ const isExpanded = expandedPeers.has(peer.providerKey) || peer.models.length <= maxAcp;
107
+ const visibleModels = isExpanded ? peer.models : peer.models.slice(0, maxAcp);
108
+
109
+ for (const m of visibleModels) {
110
+ const isCurrent = isCurrentProvider && activeModel === m;
111
+ items.push({
112
+ id: `${peer.providerKey}/${m}`,
113
+ label: m,
114
+ category: catTitle,
115
+ description: isCurrent ? '● active' : 'ready',
116
+ value: {
117
+ type: 'acp',
118
+ providerId: peer.providerKey,
119
+ modelId: m,
120
+ providerLabel: peer.label,
121
+ installed: true,
122
+ isCurrent,
123
+ isConfigured: true,
124
+ setupInstruction: peer.setupInstruction
125
+ }
126
+ });
127
+ }
128
+
129
+ // Toggle item: Load more / Load less for peers with > maxAcp models
130
+ if (peer.models.length > maxAcp) {
131
+ if (!isExpanded) {
132
+ const remaining = peer.models.length - maxAcp;
133
+ items.push({
134
+ id: `${peer.providerKey}:__load_more__`,
135
+ label: `▶ Load more (${remaining} more models)...`,
136
+ category: catTitle,
137
+ description: 'expand',
138
+ value: {
139
+ type: 'toggle',
140
+ providerId: peer.providerKey,
141
+ modelId: '__load_more__',
142
+ providerLabel: peer.label,
143
+ installed: true,
144
+ isCurrent: false,
145
+ isConfigured: true,
146
+ isToggle: true,
147
+ action: 'expand',
148
+ peerKey: peer.providerKey
149
+ }
150
+ });
151
+ } else {
152
+ items.push({
153
+ id: `${peer.providerKey}:__load_less__`,
154
+ label: `▲ Load less (show top ${maxAcp})...`,
155
+ category: catTitle,
156
+ description: 'collapse',
157
+ value: {
158
+ type: 'toggle',
159
+ providerId: peer.providerKey,
160
+ modelId: '__load_less__',
161
+ providerLabel: peer.label,
162
+ installed: true,
163
+ isCurrent: false,
164
+ isConfigured: true,
165
+ isToggle: true,
166
+ action: 'collapse',
167
+ peerKey: peer.providerKey
168
+ }
169
+ });
170
+ }
171
+ }
172
+ } else {
173
+ // Uninstalled ACP agent: show entry so user can see it's supported
83
174
  items.push({
84
- id: `${peer.providerKey}/${m}`,
85
- label: m,
175
+ id: `${peer.providerKey}:uninstalled`,
176
+ label: peer.label,
86
177
  category: catTitle,
87
- description: isCurrent ? '● active' : 'ready',
178
+ description: 'not installed — setup needed',
88
179
  value: {
89
180
  type: 'acp',
90
181
  providerId: peer.providerKey,
91
- modelId: m,
182
+ modelId: peer.models[0] || peer.id,
92
183
  providerLabel: peer.label,
93
- installed: true,
94
- isCurrent,
95
- isConfigured: true,
184
+ installed: false,
185
+ isCurrent: false,
186
+ isConfigured: false,
96
187
  setupInstruction: peer.setupInstruction
97
188
  }
98
189
  });
99
190
  }
100
- } else {
101
- // Uninstalled ACP agent: show entry so user can see it's supported
102
- items.push({
103
- id: `${peer.providerKey}:uninstalled`,
104
- label: peer.label,
105
- category: catTitle,
106
- description: 'not installed — setup needed',
107
- value: {
108
- type: 'acp',
109
- providerId: peer.providerKey,
110
- modelId: peer.models[0] || peer.id,
111
- providerLabel: peer.label,
112
- installed: false,
113
- isCurrent: false,
114
- isConfigured: false,
115
- setupInstruction: peer.setupInstruction
116
- }
117
- });
118
191
  }
119
192
  }
120
193
 
121
194
  // 2. BYOK Providers (Cloud & Local APIs)
122
- for (const p of overview.byok) {
123
- const isCurrentProvider = activeProvider === p.id || (p.id === 'qwen' && activeProvider === 'dashscope-byok');
124
- const catTitle = p.id === 'ollama'
125
- ? `BYOK · ${p.label}`
126
- : `BYOK · ${p.label} ${p.isConfigured ? '(configured)' : '(needs key)'}`;
127
-
128
- const models = Array.isArray(p.models) && p.models.length > 0 ? p.models : [p.defaultModel];
129
- for (const m of models) {
130
- const isCurrent = isCurrentProvider && activeModel === m;
131
- const desc = isCurrent ? '● active' : (p.id === 'ollama' ? 'local' : (p.isConfigured ? 'configured' : 'needs API key'));
132
- items.push({
133
- id: `${p.id}/${m}`,
134
- label: m,
135
- category: catTitle,
136
- description: desc,
137
- value: {
138
- type: 'byok',
139
- providerId: p.id,
140
- modelId: m,
141
- providerLabel: p.label,
142
- installed: true,
143
- isCurrent,
144
- isConfigured: p.isConfigured,
145
- envVar: p.envVar
146
- }
147
- });
195
+ if (tab === 'all' || tab === 'byok') {
196
+ for (const p of overview.byok) {
197
+ const isCurrentProvider = activeProvider === p.id || (p.id === 'qwen' && activeProvider === 'dashscope-byok');
198
+ const catTitle = p.id === 'ollama'
199
+ ? `BYOK · ${p.label}`
200
+ : `BYOK · ${p.label} ${p.isConfigured ? '(configured)' : '(needs key)'}`;
201
+
202
+ const models = Array.isArray(p.models) && p.models.length > 0 ? p.models : [p.defaultModel];
203
+ for (const m of models) {
204
+ const isCurrent = isCurrentProvider && activeModel === m;
205
+ const desc = isCurrent ? '● active' : (p.id === 'ollama' ? 'local' : (p.isConfigured ? 'configured' : 'needs API key'));
206
+ items.push({
207
+ id: `${p.id}/${m}`,
208
+ label: m,
209
+ category: catTitle,
210
+ description: desc,
211
+ value: {
212
+ type: 'byok',
213
+ providerId: p.id,
214
+ modelId: m,
215
+ providerLabel: p.label,
216
+ installed: true,
217
+ isCurrent,
218
+ isConfigured: p.isConfigured,
219
+ envVar: p.envVar
220
+ }
221
+ });
222
+ }
148
223
  }
149
224
  }
150
225
 
151
226
  return items;
152
227
  }
153
228
 
229
+ /**
230
+ * Sovereign Model Picker Layer with dual-tab support (| ACP | BYOK |)
231
+ * and interactive 10-model pagination.
232
+ */
233
+ export class ModelPickerLayer extends SelectLayer {
234
+ public activeTab: 'acp' | 'byok';
235
+ public config: Record<string, any>;
236
+ public overview: ProviderOverview;
237
+ public expandedPeers: Set<string>;
238
+ public promptHost: any;
239
+ public allItems: ModelPickerItem[];
240
+ public declare list: any;
241
+ public declare cursor: { x: number; y: number };
242
+ public declare settled: boolean;
243
+ public declare height: number;
244
+ public declare onPick: ((item: any) => any) | null;
245
+
246
+ constructor(options: {
247
+ config: Record<string, any>;
248
+ overview: ProviderOverview;
249
+ promptHost?: any;
250
+ onPick: (item: ModelPickerItem | null) => void;
251
+ }) {
252
+ const activeProvider = (options.config.provider || '').toLowerCase().trim();
253
+ const initialTab: 'acp' | 'byok' =
254
+ activeProvider === 'antigravity' ||
255
+ activeProvider === 'agy' ||
256
+ activeProvider === 'acp' ||
257
+ activeProvider.startsWith('acp/')
258
+ ? 'acp'
259
+ : 'byok';
260
+
261
+ const expandedPeers = new Set<string>();
262
+ const allItems = buildModelPickerItems(options.config, options.overview, { tab: 'all', maxAcpPerPeer: Infinity });
263
+
264
+ super({
265
+ title: 'Select Model',
266
+ placeholder: 'type to filter (e.g. gemini, sonnet, opencode)…',
267
+ emptyText: 'No models matched your search in this tab',
268
+ items: allItems,
269
+ width: 78,
270
+ height: 22,
271
+ footer: 'tab / ← → switch tab • enter select • esc close',
272
+ onPick: options.onPick
273
+ });
274
+
275
+ this.config = options.config;
276
+ this.overview = options.overview;
277
+ this.promptHost = options.promptHost;
278
+ this.activeTab = initialTab;
279
+ this.expandedPeers = expandedPeers;
280
+ this.allItems = allItems;
281
+
282
+ // Custom refilter ensuring list renders only activeTab while keeping allItems intact
283
+ const self = this;
284
+ this.list.refilter = function() {
285
+ const isSearching = Boolean(this.query && this.query.trim());
286
+ const tabItems = buildModelPickerItems(self.config, self.overview, {
287
+ tab: self.activeTab,
288
+ expandedPeers: self.expandedPeers,
289
+ maxAcpPerPeer: isSearching ? Infinity : 10
290
+ });
291
+ this.filtered = fuzzyFilter(tabItems, this.query);
292
+ this.selected = Math.min(this.selected || 0, Math.max(0, this.filtered.length - 1));
293
+ this.offset = 0;
294
+ return this;
295
+ };
296
+
297
+ // Initialize list with active tab items
298
+ this.list.refilter();
299
+ }
300
+
301
+ updateOverview(freshOverview: ProviderOverview): void {
302
+ this.overview = freshOverview;
303
+ this.allItems = buildModelPickerItems(this.config, this.overview, { tab: 'all', maxAcpPerPeer: Infinity });
304
+ this.list.all = this.allItems;
305
+ this.list.refilter();
306
+ if (this.promptHost && typeof this.promptHost.scheduleDraw === 'function') {
307
+ this.promptHost.scheduleDraw();
308
+ }
309
+ }
310
+
311
+ switchTab(tab: 'acp' | 'byok'): void {
312
+ if (this.activeTab === tab) return;
313
+ this.activeTab = tab;
314
+ this.list.refilter();
315
+ this.list.selected = 0;
316
+ this.list.offset = 0;
317
+ if (this.promptHost && typeof this.promptHost.scheduleDraw === 'function') {
318
+ this.promptHost.scheduleDraw();
319
+ }
320
+ }
321
+
322
+ togglePeerExpand(peerKey: string): void {
323
+ if (this.expandedPeers.has(peerKey)) {
324
+ this.expandedPeers.delete(peerKey);
325
+ } else {
326
+ this.expandedPeers.add(peerKey);
327
+ }
328
+ const currentId = this.list.current?.id;
329
+ this.list.refilter();
330
+ if (currentId && Array.isArray(this.list.filtered)) {
331
+ const idx = this.list.filtered.findIndex((entry: any) => entry?.item?.id === currentId || entry?.item?.value?.peerKey === peerKey);
332
+ if (idx >= 0) this.list.selected = idx;
333
+ }
334
+ if (this.promptHost && typeof this.promptHost.scheduleDraw === 'function') {
335
+ this.promptHost.scheduleDraw();
336
+ }
337
+ }
338
+
339
+ preferredHeight(): number {
340
+ const categories = new Set(this.list.filtered.map((entry: any) => entry.item?.category).filter(Boolean));
341
+ return 2 + 2 + this.list.filtered.length + categories.size + 2;
342
+ }
343
+
344
+ body(width: number, height: number): string[] {
345
+ const tabACP = this.activeTab === 'acp' ? paint('accent', bold('● ACP')) : dim('ACP');
346
+ const tabBYOK = this.activeTab === 'byok' ? paint('accent', bold('● BYOK')) : dim('BYOK');
347
+ const tabBar = ` | ${tabACP} | ${tabBYOK} | ${dim('(Tab / ← → switch tab)')}`;
348
+ const separator = paint('rule', GLYPHS.hLine.repeat(Math.max(4, width)));
349
+
350
+ const listHeight = Math.max(1, height - 2);
351
+ const { rows } = this.list.render(width, listHeight);
352
+
353
+ this.cursor = { x: this.list.cursorColumn(), y: 2 };
354
+ return [tabBar, separator, ...rows];
355
+ }
356
+
357
+ key(event: any): string | null {
358
+ if (!event) return null;
359
+
360
+ // 1. Tab switching via Tab, Left/Right arrows, or PgLeft/PgRight mappings
361
+ if (event.name === 'tab') {
362
+ this.switchTab(this.activeTab === 'acp' ? 'byok' : 'acp');
363
+ return 'handled';
364
+ }
365
+
366
+ if (event.name === 'left' && this.activeTab === 'byok') {
367
+ if (!this.list.query || event.alt || event.ctrl || event.meta) {
368
+ this.switchTab('acp');
369
+ return 'handled';
370
+ }
371
+ }
372
+ if (event.name === 'right' && this.activeTab === 'acp') {
373
+ if (!this.list.query || event.alt || event.ctrl || event.meta) {
374
+ this.switchTab('byok');
375
+ return 'handled';
376
+ }
377
+ }
378
+
379
+ if (event.name === '[' || (event.name === 'pageup' && (event.shift || event.alt || event.ctrl))) {
380
+ this.switchTab('acp');
381
+ return 'handled';
382
+ }
383
+ if (event.name === ']' || (event.name === 'pagedown' && (event.shift || event.alt || event.ctrl))) {
384
+ this.switchTab('byok');
385
+ return 'handled';
386
+ }
387
+
388
+ // 2. Delegate to SelectList for navigation / query typing
389
+ const visibleRows = this.list.lastItemRows || Math.max(1, this.height - 7);
390
+ const action = this.list.handleKey(event, visibleRows);
391
+
392
+ if (action === 'select') {
393
+ const item = this.list.current;
394
+ if (item?.value?.isToggle && item?.value?.peerKey) {
395
+ this.togglePeerExpand(item.value.peerKey);
396
+ return 'handled';
397
+ }
398
+
399
+ this.settled = true;
400
+ const result = this.onPick ? this.onPick(item) : null;
401
+ if (result === 'keep') this.settled = false;
402
+ return result === 'keep' ? 'handled' : 'close';
403
+ }
404
+
405
+ if (action === 'cancel') return 'close';
406
+ return action ? 'handled' : null;
407
+ }
408
+ }
409
+
154
410
  /**
155
411
  * Run interactive model picker in the provided TUI prompt.
156
412
  *
157
413
  * Automatically handles:
414
+ * - Dual-tab navigation (| ACP | BYOK |).
415
+ * - Smart 10-model pagination per ACP peer with in-place Load more / Load less.
158
416
  * - Direct selection of ACP models without prompting for an API key.
159
417
  * - Direct selection of configured BYOK models without prompting for an API key.
160
418
  * - InputLayer modal prompt for API key when selecting an unconfigured BYOK model,
@@ -172,19 +430,22 @@ export async function runInteractiveModelPicker(
172
430
 
173
431
  const config = store.loadConfig();
174
432
  const overview = getAvailableProvidersOverview(config);
175
- const items = buildModelPickerItems(config, overview);
176
433
 
177
434
  const picked = await new Promise<ModelPickerItem | null>((resolve) => {
178
- const layer = new SelectLayer({
179
- title: 'Select Model',
180
- placeholder: 'type to filter (e.g. gemini, sonnet, opencode)…',
181
- emptyText: 'No models matched your search',
182
- items,
183
- width: 76,
184
- height: 20,
435
+ const layer = new ModelPickerLayer({
436
+ config,
437
+ overview,
438
+ promptHost: prompt,
185
439
  onPick: resolve
186
440
  });
187
441
  prompt.openLayer(layer);
442
+
443
+ if (!process.env.NODE_TEST_CONTEXT) {
444
+ void resolveAvailableProvidersOverview(config).then((freshOverview) => {
445
+ if (layer.settled) return;
446
+ layer.updateOverview(freshOverview);
447
+ }).catch(() => {});
448
+ }
188
449
  });
189
450
 
190
451
  const notifyPrompt = (providerId: string, modelId: string) => {
@@ -196,7 +457,7 @@ export async function runInteractiveModelPicker(
196
457
  }
197
458
  };
198
459
 
199
- if (!picked || !picked.value) {
460
+ if (!picked || !picked.value || picked.value.isToggle) {
200
461
  return 'Cancelled. Model was not changed.';
201
462
  }
202
463
 
package/src/tui/prompt.js CHANGED
@@ -35,6 +35,13 @@ import { settleStageResize } from './resizeRecovery.js';
35
35
  import { sidebarVisible, sessionMainWidth } from './sessionSidebar.js';
36
36
  import { isStartupDialog, startupDialogView } from './homeView.js';
37
37
  import { handleMessageMouse, handleMessageActionMenuMouse, isMouseMotion } from './messageInteraction.js';
38
+ import {
39
+ resetTurnInterruptState,
40
+ shouldAcceptStatusUpdate,
41
+ triggerTurnInterrupt,
42
+ handlePromptCtrlC,
43
+ handlePromptEscape
44
+ } from './composerControls.js';
38
45
 
39
46
  const CTRL_C_WINDOW_MS = 2000;
40
47
 
@@ -154,6 +161,7 @@ export class ChatPrompt {
154
161
  this.completion = null;
155
162
  this.selected = 0;
156
163
  this.lastCtrlC = 0;
164
+ this.interruptedTurn = false;
157
165
  this.notice = '';
158
166
  this.redrawScheduled = false;
159
167
  this.resizeTimer = null;
@@ -281,6 +289,7 @@ export class ChatPrompt {
281
289
  if (this.surface) this.surface.sidebarStatus = renderer.status;
282
290
  renderer.quietStatus = true;
283
291
  renderer.onStatusChange = (message) => {
292
+ if (!shouldAcceptStatusUpdate(this)) return;
284
293
  this.statusMessage = message;
285
294
  this.scheduleDraw();
286
295
  };
@@ -604,7 +613,7 @@ export class ChatPrompt {
604
613
 
605
614
  setBusy(busy) {
606
615
  this.busy = busy;
607
- if (!busy) this.notice = '';
616
+ resetTurnInterruptState(this, busy);
608
617
  if (busy) this.startTick(); else this.stopTick();
609
618
  this.draw();
610
619
  }
@@ -924,36 +933,25 @@ export class ChatPrompt {
924
933
  }
925
934
 
926
935
  handleCtrlC() {
927
- const now = Date.now();
928
- if (!this.editor.isEmpty) {
929
- this.editor.clear();
930
- this.completion = null;
931
- return;
932
- }
933
- if (this.busy) { this.interrupt(); return; }
934
- if (now - this.lastCtrlC < CTRL_C_WINDOW_MS) return this.onExit();
935
- this.lastCtrlC = now;
936
- this.notice = 'press Ctrl+C again to exit';
936
+ handlePromptCtrlC(
937
+ this,
938
+ () => [`${paint('warn', GLYPHS.cross)} ${dim('interrupted')}`],
939
+ CTRL_C_WINDOW_MS
940
+ );
937
941
  }
938
942
 
939
943
  handleEscape() {
940
- if (this.completion) {
941
- this.completion = null;
942
- if (this.editor.getText().startsWith('/')) {
943
- this.editor.clear();
944
- }
945
- this.scheduleDraw();
946
- return;
947
- }
948
- if (this.busy) return this.interrupt();
949
- this.editor.clear();
944
+ handlePromptEscape(
945
+ this,
946
+ () => [`${paint('warn', GLYPHS.cross)} ${dim('interrupted')}`]
947
+ );
950
948
  }
951
949
 
952
950
  interrupt() {
953
- this.erase();
954
- this.commit('notice', () => [`${paint('warn', GLYPHS.cross)} ${dim('interrupted')}`]);
955
- this.notice = '';
956
- this.onInterrupt();
951
+ triggerTurnInterrupt(
952
+ this,
953
+ () => [`${paint('warn', GLYPHS.cross)} ${dim('interrupted')}`]
954
+ );
957
955
  }
958
956
 
959
957
  /** Show the last tool output in full, above the prompt. */
package/src/tui/text.d.ts CHANGED
@@ -2,4 +2,5 @@ export function safeDisplay(value: string): string;
2
2
  export function truncate(value: string, width: number, ellipsis?: string): string;
3
3
  export function padEnd(value: string, width: number): string;
4
4
  export function visibleWidth(value: string): number;
5
- export function wrap(value: string, width: number): string[];
5
+ export function wrap(value: string, width: number, options?: { hang?: number }): string[];
6
+ export function wrapBlock(value: string, width: number, options?: { hang?: number }): string[];