@stateset/sandbox-cli 3.3.1 → 3.4.0

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 (54) hide show
  1. package/CHANGELOG.md +88 -0
  2. package/README.md +351 -1
  3. package/dist/client.d.ts +29 -1
  4. package/dist/client.d.ts.map +1 -1
  5. package/dist/client.js +10 -0
  6. package/dist/client.js.map +1 -1
  7. package/dist/commands/run.d.ts.map +1 -1
  8. package/dist/commands/run.js +48 -15
  9. package/dist/commands/run.js.map +1 -1
  10. package/dist/commands/sandbox.d.ts.map +1 -1
  11. package/dist/commands/sandbox.js +62 -16
  12. package/dist/commands/sandbox.js.map +1 -1
  13. package/dist/commands/swarm.d.ts +12 -0
  14. package/dist/commands/swarm.d.ts.map +1 -0
  15. package/dist/commands/swarm.js +288 -0
  16. package/dist/commands/swarm.js.map +1 -0
  17. package/dist/commands/terminal.d.ts +3 -1
  18. package/dist/commands/terminal.d.ts.map +1 -1
  19. package/dist/commands/terminal.js +58 -1
  20. package/dist/commands/terminal.js.map +1 -1
  21. package/dist/commands/workbench.d.ts +138 -0
  22. package/dist/commands/workbench.d.ts.map +1 -0
  23. package/dist/commands/workbench.js +531 -0
  24. package/dist/commands/workbench.js.map +1 -0
  25. package/dist/index.js +5 -1
  26. package/dist/index.js.map +1 -1
  27. package/dist/utils/swarm-plan.d.ts +69 -0
  28. package/dist/utils/swarm-plan.d.ts.map +1 -0
  29. package/dist/utils/swarm-plan.js +321 -0
  30. package/dist/utils/swarm-plan.js.map +1 -0
  31. package/dist/utils/template-create.d.ts +36 -0
  32. package/dist/utils/template-create.d.ts.map +1 -0
  33. package/dist/utils/template-create.js +116 -0
  34. package/dist/utils/template-create.js.map +1 -0
  35. package/dist/workbench/actions.d.ts +1 -1
  36. package/dist/workbench/actions.d.ts.map +1 -1
  37. package/dist/workbench/actions.js +1 -0
  38. package/dist/workbench/actions.js.map +1 -1
  39. package/dist/workbench/agents.d.ts +96 -0
  40. package/dist/workbench/agents.d.ts.map +1 -0
  41. package/dist/workbench/agents.js +370 -0
  42. package/dist/workbench/agents.js.map +1 -0
  43. package/dist/workbench/commands.d.ts.map +1 -1
  44. package/dist/workbench/commands.js +7 -1
  45. package/dist/workbench/commands.js.map +1 -1
  46. package/dist/workbench/model.d.ts +5 -1
  47. package/dist/workbench/model.d.ts.map +1 -1
  48. package/dist/workbench/model.js +15 -2
  49. package/dist/workbench/model.js.map +1 -1
  50. package/dist/workbench/terminal.d.ts +1 -1
  51. package/dist/workbench/terminal.d.ts.map +1 -1
  52. package/dist/workbench/terminal.js +108 -78
  53. package/dist/workbench/terminal.js.map +1 -1
  54. package/package.json +2 -2
@@ -10,6 +10,7 @@ import { COMMAND_LIMIT, commandReceipt } from './execution.js';
10
10
  import { creationDraft, creationLines, creationRequest, creationTextFields, creationFieldLimit, resourceClasses, inferenceProviders } from './creation.js';
11
11
  import { overviewLines, shortId, timeLeft } from './overview.js';
12
12
  import { filterActions, workbenchActions } from './actions.js';
13
+ import { agentCell, agentColumns, agentDetailLines, agentLines, agentSummary } from './agents.js';
13
14
  import { connectionLines, snapshotStale } from './connection.js';
14
15
  import { randomUUID } from 'node:crypto';
15
16
  import { workerLines, workerRow } from './workers.js';
@@ -56,12 +57,16 @@ const help = [
56
57
  'Agent chat: b opens saved bundles offline; f opens task files; Esc returns to chat.',
57
58
  'j/k or Up/Down: select a sandbox',
58
59
  'PageUp/PageDown: move one page; Home/End: first/last',
59
- '/: search IDs, statuses and creating Herdr panes',
60
+ '/: search IDs, statuses, agent names and creating Herdr panes',
60
61
  'Enter: apply search or open selected sandbox details',
61
62
  'Esc: cancel search, clear filter or return to the list',
62
63
  '?: open this help; r: refresh shared state',
63
64
  'a: open session activity for all sandboxes',
64
65
  'o: overview of statuses, running allocations and upcoming expiries',
66
+ 'v: agents recorded under --agents directories, by fleet, with phase, branch and pull request',
67
+ 'Workbenches of the current repository (stateset workbench up) are recorded without --agents.',
68
+ 'AGENT and PHASE columns come from those records; Enter adds task, objective, cost and errors.',
69
+ '* marks likely duplicates: agents still working under matching names; details name the pair.',
65
70
  't: cycle list sort: ID, expiry, status, newest; selection stays pinned',
66
71
  'TIME LEFT: ! warns at 2 minutes; due awaits backend status.',
67
72
  'b: buy prepaid credits through your browser and Stripe',
@@ -87,6 +92,12 @@ const help = [
87
92
  function pageSize(height) {
88
93
  return Math.max(1, Math.min(200, height) - 8);
89
94
  }
95
+ /** The list and the agents screen keep one row for the note about skipped agent records. */
96
+ function noteRows(model, view, height) {
97
+ return model.agents.note && height >= 10 && (!view.screen || view.screen === 'list' || view.screen === 'agents') ? 1 : 0;
98
+ }
99
+ /** The only styling in a frame, added after cleaning so that none of it comes from data. */
100
+ function dim(line) { return line ? `\x1b[2m${line}\x1b[22m` : line; }
90
101
  function availableActions(model, options, id, now = Date.now()) {
91
102
  return workbenchActions({ row: model.rows.find(row => row.id === id), busy: model.busy,
92
103
  readOnly: options.readOnly, backend: options.backend || 'api', connected: Boolean(model.lastUpdated),
@@ -126,66 +137,68 @@ function screenContent(model, options, width, view, now = Date.now()) {
126
137
  view.actionMessage || '',
127
138
  ] : view.screen === 'connection' ? connectionLines(model, options.intervalMs, now)
128
139
  : view.screen === 'overview' ? overviewLines(model.rows, now)
129
- : view.screen === 'create' && view.creation
130
- ? creationLines(view.creation, options.createOptions, options.backend || 'api', Boolean(view.creationReview))
131
- : view.screen === 'command' && view.commandMode === 'spawn' && view.workerLaunch ? [
132
- ...workerLaunchLines(view.command || '', view.workerLaunch, Boolean(view.commandReview)),
133
- `Sandbox: ${view.commandId}`, view.commandMessage || '',
134
- ] : view.screen === 'command' && view.commandMode === 'python' && view.workerLaunch && (view.commandEditing || view.commandReview) ? [
135
- ...pythonLines(view.command || '', view.workerLaunch, Boolean(view.commandReview), view.python),
136
- `Sandbox: ${view.commandId}`, view.commandMessage || '',
137
- ] : view.screen === 'command' ? [
138
- view.commandMode === 'python' ? 'PYTHON TASK RESULT' : 'RUN COMMAND', `Sandbox: ${view.commandId}`,
139
- ...(view.commandMode === 'python' && view.python ? [`Python task: ${view.python.name} | ${view.python.id}`, `Artifacts: ${view.python.directory}`]
140
- : [model.api.executeStream ? 'Runs sh -lc inside this sandbox. Output streams live.' : 'Runs sh -lc inside this sandbox. Output appears after completion.']),
141
- ...(view.commandEditing ? [`Type or paste a command (max ${COMMAND_LIMIT} characters). Enter reviews; Ctrl+U clears.`,
142
- ...`$ ${view.command || ''}_`.split('\n')]
143
- : [view.commandMode === 'python' ? `Source: ${view.python?.source}` : `$ ${view.command || ''}`]),
144
- view.commandMessage || '',
145
- ...(view.commandResult ? [
146
- view.commandResult.status,
147
- ...(view.commandResult.executionId ? [`Execution: ${view.commandResult.executionId}`] : []),
148
- ...(view.commandResult.truncated ? ['Output truncated (server limit or 64 KiB per stream).'] : []),
149
- 'STDOUT', ...(view.commandResult.stdout || '(empty)').split(/\r?\n/),
150
- 'STDERR', ...(view.commandResult.stderr || '(empty)').split(/\r?\n/),
151
- ] : []),
152
- ] : view.screen === 'subscription' ? [
153
- 'SUBSCRIPTION',
154
- ...(options.billing ? [
155
- options.readOnly ? 'Read-only: subscription actions are disabled.' : 'Enter reviews opening subscription plans in your browser.',
156
- 'Sign in as the owner and verify the organization.',
157
- 'Select a plan and review recurring fees plus usage before confirming.',
158
- 'Cancelling: use Reactivate Subscription before the period ends.',
159
- 'Canceled: start a new subscription; existing credits do not restart it.',
160
- 'Opening this page does not change your plan or submit payment.',
161
- view.subscriptionMessage || '',
162
- ...(view.subscriptionUrl ? ['Subscription link (o opens it again):', view.subscriptionUrl] : []),
163
- ] : ['Local Docker sandboxes do not require a subscription.']),
164
- ] : view.screen === 'billing' ? [
165
- 'BUY CREDITS',
166
- ...(options.billing ? [
167
- `USD amount: $${view.creditAmount ?? '25'}${view.creditEditing ? '_' : ''}`,
168
- 'Type an amount ($5-$2,000); Enter reviews it.',
169
- options.readOnly ? 'Read-only: purchases are disabled.' : 'Payment is completed in your browser.',
170
- 'Sign in as the owner and verify the organization before paying.',
171
- 'Stripe confirms payment before credits are applied.',
172
- 'Credits fund an active metered subscription; they do not change your plan.',
173
- 'Need a subscription? Press s to review plans or reactivate.',
174
- 'Return here after payment; r refreshes sandboxes.',
175
- view.creditMessage || '',
176
- ...(view.creditUrl ? ['Billing link (o opens it again):', view.creditUrl] : []),
177
- ] : ['Local Docker sandboxes do not require credits.']),
178
- ] : view.screen === 'activity' ? [
179
- 'ACTIVITY | all sandboxes',
180
- 'Current session; newest first; last 100 observations.',
181
- ...(model.activity.length ? model.activity.map(event => `${event.at.toISOString()} | ${event.message}`)
182
- : ['Waiting for the first observation...']),
183
- ] : view.screen === 'help' ? help : row ? [
184
- `ID: ${row.id}`, `Status: ${row.status}`, `CPU: ${row.cpus || '-'}`,
185
- `Memory: ${row.memory || '-'}`, `Created: ${row.createdAt || '-'}`,
186
- `Expires: ${row.expiresAt || '-'}`, `Time left: ${timeLeft(row, now)}`, `Backend: ${row.backend || 'api'}`,
187
- `Creating Herdr pane: ${row.origin || '-'}`,
188
- ] : ['Selected sandbox is no longer available. Esc returns to the list.'];
140
+ : view.screen === 'agents' ? agentLines(model.agents, model.rows, Boolean(model.lastUpdated) && !model.error, width)
141
+ : view.screen === 'create' && view.creation
142
+ ? creationLines(view.creation, options.createOptions, options.backend || 'api', Boolean(view.creationReview))
143
+ : view.screen === 'command' && view.commandMode === 'spawn' && view.workerLaunch ? [
144
+ ...workerLaunchLines(view.command || '', view.workerLaunch, Boolean(view.commandReview)),
145
+ `Sandbox: ${view.commandId}`, view.commandMessage || '',
146
+ ] : view.screen === 'command' && view.commandMode === 'python' && view.workerLaunch && (view.commandEditing || view.commandReview) ? [
147
+ ...pythonLines(view.command || '', view.workerLaunch, Boolean(view.commandReview), view.python),
148
+ `Sandbox: ${view.commandId}`, view.commandMessage || '',
149
+ ] : view.screen === 'command' ? [
150
+ view.commandMode === 'python' ? 'PYTHON TASK RESULT' : 'RUN COMMAND', `Sandbox: ${view.commandId}`,
151
+ ...(view.commandMode === 'python' && view.python ? [`Python task: ${view.python.name} | ${view.python.id}`, `Artifacts: ${view.python.directory}`]
152
+ : [model.api.executeStream ? 'Runs sh -lc inside this sandbox. Output streams live.' : 'Runs sh -lc inside this sandbox. Output appears after completion.']),
153
+ ...(view.commandEditing ? [`Type or paste a command (max ${COMMAND_LIMIT} characters). Enter reviews; Ctrl+U clears.`,
154
+ ...`$ ${view.command || ''}_`.split('\n')]
155
+ : [view.commandMode === 'python' ? `Source: ${view.python?.source}` : `$ ${view.command || ''}`]),
156
+ view.commandMessage || '',
157
+ ...(view.commandResult ? [
158
+ view.commandResult.status,
159
+ ...(view.commandResult.executionId ? [`Execution: ${view.commandResult.executionId}`] : []),
160
+ ...(view.commandResult.truncated ? ['Output truncated (server limit or 64 KiB per stream).'] : []),
161
+ 'STDOUT', ...(view.commandResult.stdout || '(empty)').split(/\r?\n/),
162
+ 'STDERR', ...(view.commandResult.stderr || '(empty)').split(/\r?\n/),
163
+ ] : []),
164
+ ] : view.screen === 'subscription' ? [
165
+ 'SUBSCRIPTION',
166
+ ...(options.billing ? [
167
+ options.readOnly ? 'Read-only: subscription actions are disabled.' : 'Enter reviews opening subscription plans in your browser.',
168
+ 'Sign in as the owner and verify the organization.',
169
+ 'Select a plan and review recurring fees plus usage before confirming.',
170
+ 'Cancelling: use Reactivate Subscription before the period ends.',
171
+ 'Canceled: start a new subscription; existing credits do not restart it.',
172
+ 'Opening this page does not change your plan or submit payment.',
173
+ view.subscriptionMessage || '',
174
+ ...(view.subscriptionUrl ? ['Subscription link (o opens it again):', view.subscriptionUrl] : []),
175
+ ] : ['Local Docker sandboxes do not require a subscription.']),
176
+ ] : view.screen === 'billing' ? [
177
+ 'BUY CREDITS',
178
+ ...(options.billing ? [
179
+ `USD amount: $${view.creditAmount ?? '25'}${view.creditEditing ? '_' : ''}`,
180
+ 'Type an amount ($5-$2,000); Enter reviews it.',
181
+ options.readOnly ? 'Read-only: purchases are disabled.' : 'Payment is completed in your browser.',
182
+ 'Sign in as the owner and verify the organization before paying.',
183
+ 'Stripe confirms payment before credits are applied.',
184
+ 'Credits fund an active metered subscription; they do not change your plan.',
185
+ 'Need a subscription? Press s to review plans or reactivate.',
186
+ 'Return here after payment; r refreshes sandboxes.',
187
+ view.creditMessage || '',
188
+ ...(view.creditUrl ? ['Billing link (o opens it again):', view.creditUrl] : []),
189
+ ] : ['Local Docker sandboxes do not require credits.']),
190
+ ] : view.screen === 'activity' ? [
191
+ 'ACTIVITY | all sandboxes',
192
+ 'Current session; newest first; last 100 observations.',
193
+ ...(model.activity.length ? model.activity.map(event => `${event.at.toISOString()} | ${event.message}`)
194
+ : ['Waiting for the first observation...']),
195
+ ] : view.screen === 'help' ? help : row ? [
196
+ `ID: ${row.id}`, `Status: ${row.status}`, `CPU: ${row.cpus || '-'}`,
197
+ `Memory: ${row.memory || '-'}`, `Created: ${row.createdAt || '-'}`,
198
+ `Expires: ${row.expiresAt || '-'}`, `Time left: ${timeLeft(row, now)}`, `Backend: ${row.backend || 'api'}`,
199
+ `Creating Herdr pane: ${row.origin || '-'}`,
200
+ ...agentDetailLines(model.agents, row.id),
201
+ ] : ['Selected sandbox is no longer available. Esc returns to the list.'];
189
202
  // Wrap before slicing so full IDs and pane names remain inspectable in splits.
190
203
  const plain = stripTerminalStyles(content.join('\n'));
191
204
  return (options.redact?.(plain) ?? plain).split('\n').flatMap(line => {
@@ -202,7 +215,7 @@ export function dashboardLines(model, options, width, height, confirmation, view
202
215
  };
203
216
  const baseTitle = `STATESET SANDBOX${options.readOnly ? ' [read only]' : ''}`;
204
217
  const running = model.rows.filter(row => row.status.toLowerCase() === 'running').length;
205
- const title = `${baseTitle}${!view.screen || view.screen === 'list' ? ` | ${running} running/${model.rows.length} total | sort:${model.sortMode}` : ''}`;
218
+ const title = `${baseTitle}${!view.screen || view.screen === 'list' ? ` | ${running} running/${model.rows.length} total | sort:${model.sortMode}${model.agents.duplicates.size ? ` | dup:${model.agents.duplicates.size}` : ''}` : ''}`;
206
219
  if (height < 8 || width < 24)
207
220
  return [title, 'Resize to at least 25x8', 'q quits; sandboxes stay alive'].slice(0, height).map(clean);
208
221
  const status = model.readRetryAt > now ? `STALE / rate limited: API reads resume in ${Math.ceil((model.readRetryAt - now) / 1000)}s`
@@ -210,17 +223,22 @@ export function dashboardLines(model, options, width, height, confirmation, view
210
223
  ? `STALE / unavailable: ${model.error}`
211
224
  : snapshotStale(model, options.intervalMs, now) ? 'STALE: refresh delayed. Press c for connection diagnostics.'
212
225
  : model.lastUpdated ? `Updated ${model.lastUpdated.toISOString()} | ${model.rows.length} sandboxes` : 'Connecting...';
213
- const compact = width < 60;
226
+ const agents = model.agents;
227
+ const note = noteRows(model, view, height);
228
+ // With agent columns the wide layout needs more room beside CPU and memory.
229
+ const compact = width < 60 || (agents.bySandbox.size > 0 && width < 64);
214
230
  const rows = model.visibleRows;
215
231
  const search = view.searching ? `Search: /${model.filter}_ Enter:apply Esc:cancel`
216
232
  : model.filter ? `Filter: ${model.filter} | ${rows.length}/${model.rows.length} matches | Esc:clear` : undefined;
217
233
  if (view.screen && view.screen !== 'list') {
218
234
  const wrapped = screenContent(model, options, width, view, now);
219
- const room = height - 5;
235
+ const room = height - 5 - note;
220
236
  const offset = Math.max(0, Math.min(view.scroll || 0, Math.max(0, wrapped.length - room)));
221
237
  const lines = [title, options.label, status, ...wrapped.slice(offset, offset + room)];
222
- while (lines.length < height - 2)
238
+ while (lines.length < height - 2 - note)
223
239
  lines.push('');
240
+ if (note)
241
+ lines.push(agents.note);
224
242
  const actionReason = view.screen === 'actions' ? view.actionMessage
225
243
  || filterActions(availableActions(model, options, view.actionTarget, now), view.actionQuery)
226
244
  .find(action => action.id === view.actionSelected)?.reason : undefined;
@@ -261,34 +279,42 @@ export function dashboardLines(model, options, width, height, confirmation, view
261
279
  ? view.commandEditing ? view.commandMode !== 'exec' ? 'Tab:field Enter:review Esc:back Ctrl+C:quit' : 'Enter:review Esc:back Ctrl+C:quit'
262
280
  : `z:cancel r:receipt f:files${canEditCommand(model, options, view.commandId, now) ? ' x:edit' : ''} h:history Esc:back q:quit`
263
281
  : 'F2:actions Esc:back j/k:scroll q:quit');
264
- return lines.map(clean);
282
+ return lines.map((line, index) => note && index === height - 3 ? dim(clean(line)) : clean(line));
265
283
  }
266
- const idWidth = width - 40;
267
- const heading = compact ? ' STATUS TIME LEFT ID' : ` ${'ID'.padEnd(idWidth)} ${'STATUS'.padEnd(11)} ${'CPU'.padEnd(5)} ${'MEMORY'.padEnd(8)} TIME LEFT`;
284
+ const idWidth = compact ? width - 21 : width - 40;
285
+ const split = agents.bySandbox.size ? agentColumns(idWidth) : { id: idWidth, name: 0, phase: 0 };
286
+ const idHeading = split.name ? `${'ID'.padEnd(split.id)} ${'AGENT'.padEnd(split.name)} ${compact ? 'PHASE' : 'PHASE'.padEnd(split.phase)}` : compact ? 'ID' : 'ID'.padEnd(idWidth);
287
+ const heading = compact ? ` STATUS TIME LEFT ${idHeading}` : ` ${idHeading} ${'STATUS'.padEnd(11)} ${'CPU'.padEnd(5)} ${'MEMORY'.padEnd(8)} TIME LEFT`;
268
288
  const lines = [title, options.label, status, search || heading];
269
289
  if (height === 8)
270
290
  lines.pop();
271
- const room = Math.max(1, height - lines.length - 4);
291
+ const room = Math.max(1, height - lines.length - 4 - note);
272
292
  const selected = rows.findIndex(row => row.id === model.selectedId);
273
293
  const start = Math.max(0, selected - room + 1);
274
294
  for (const row of rows.slice(start, start + room)) {
275
295
  const prefix = row.id === model.selectedId ? '> ' : ' ';
276
296
  const cell = (value, size) => padCells(clean(value), size);
297
+ // The name is cut to its column; the ID keeps both ends in what is left.
298
+ const id = split.name ? `${shortId(row.id, split.id).padEnd(split.id)} ${cell(agentCell(agents, row.id, split.name), split.name)} ${cell(agents.bySandbox.get(row.id)?.[0]?.phase || '-', split.phase)}`
299
+ : compact ? shortId(row.id, idWidth) : shortId(row.id, idWidth).padEnd(idWidth);
277
300
  lines.push(compact
278
- ? `${prefix}${cell(row.status, 9)} ${cell(timeLeft(row, now), 8)} ${shortId(row.id, width - 21)}`
279
- : `${prefix}${shortId(row.id, idWidth).padEnd(idWidth)} ${cell(row.status, 11)} ${cell(row.cpus || '-', 5)} ${cell(row.memory || '-', 8)} ${timeLeft(row, now)}`);
301
+ ? `${prefix}${cell(row.status, 9)} ${cell(timeLeft(row, now), 8)} ${id}`
302
+ : `${prefix}${id} ${cell(row.status, 11)} ${cell(row.cpus || '-', 5)} ${cell(row.memory || '-', 8)} ${timeLeft(row, now)}`);
280
303
  }
281
304
  if (!rows.length)
282
305
  lines.push(model.filter ? 'No matches. Esc clears search.' : model.lastUpdated
283
306
  ? options.readOnly ? 'No sandboxes.' : 'No sandboxes. Press n to create.' : 'Waiting for backend...');
284
- while (lines.length < height - 4)
307
+ while (lines.length < height - 4 - note)
285
308
  lines.push('');
309
+ if (note)
310
+ lines.push(agents.note);
286
311
  const row = model.selected;
287
- lines.push(row ? `${row.id} | CPU ${row.cpus || '-'} | RAM ${row.memory || '-'} | ${row.status}` : 'Nothing selected');
312
+ const agent = row ? agentSummary(agents, row.id) : '';
313
+ lines.push(row ? `${row.id} | ${agent ? `${agent} | ` : ''}CPU ${row.cpus || '-'} | RAM ${row.memory || '-'} | ${row.status}` : 'Nothing selected');
288
314
  lines.push(confirmation ? `${confirmation} [y] confirm / [Esc] cancel` : view.searching ? search : model.busy ? `BUSY: ${model.message}` : model.message);
289
- lines.push(confirmation ? 'y:confirm Esc:cancel' : options.readOnly ? 'F2:actions m:tasks j/k:select r:refresh c:connection' : 'F2:actions m:tasks l:delegate n:new x:exec i:python g:agent');
315
+ lines.push(confirmation ? 'y:confirm Esc:cancel' : options.readOnly ? 'F2:actions m:tasks v:agents j/k:select r:refresh c:connection' : 'F2:actions m:tasks v:agents l:delegate n:new x:exec i:python g:agent');
290
316
  lines.push(view.searching ? 'Enter:apply Esc:cancel Ctrl+C:quit' : 'q:quit /:search Enter:details o:overview t:sort ?:help r:refresh a:activity');
291
- return lines.slice(0, height).map(clean);
317
+ return lines.slice(0, height).map((line, index) => note && index === height - 5 ? dim(clean(line)) : clean(line));
292
318
  }
293
319
  /** No terminal reset or subprocess panes: works in a Herdr/tmux split. */
294
320
  export async function runDashboard(model, options, input = process.stdin, output = process.stdout) {
@@ -362,7 +388,7 @@ export async function runDashboard(model, options, input = process.stdin, output
362
388
  chatContextChanged();
363
389
  if (view.screen !== 'list') {
364
390
  const width = Math.max(1, Math.min(500, (output.columns || 80) - 1));
365
- const room = Math.max(1, Math.min(200, output.rows || 24) - 5);
391
+ const room = Math.max(1, Math.min(200, output.rows || 24) - 5 - noteRows(model, view, Math.min(200, output.rows || 24)));
366
392
  const end = Math.max(0, screenContent(model, options, width, view).length - room);
367
393
  view.scroll = ((view.screen === 'command' && view.commandEditing && (view.commandMode === 'exec' || view.workerLaunch?.field === 0))
368
394
  || (view.screen === 'agentChat' && view.chat?.follow)) && !pending ? end : Math.max(0, Math.min(view.scroll || 0, end));
@@ -734,7 +760,7 @@ export async function runDashboard(model, options, input = process.stdin, output
734
760
  void refresh();
735
761
  return;
736
762
  }
737
- const screens = { overview: 'overview', activity: 'activity', connection: 'connection', credits: 'billing', subscription: 'subscription', help: 'help' };
763
+ const screens = { overview: 'overview', activity: 'activity', connection: 'connection', credits: 'billing', subscription: 'subscription', help: 'help', agents: 'agents' };
738
764
  if (actionId in screens) {
739
765
  view.screen = screens[actionId];
740
766
  view.scroll = 0;
@@ -2483,7 +2509,7 @@ export async function runDashboard(model, options, input = process.stdin, output
2483
2509
  });
2484
2510
  }
2485
2511
  }
2486
- if (key.name === 'escape' || (key.name === 'return' && view.screen !== 'billing' && view.screen !== 'subscription') || text === '?' || key.name === 'a' || (key.name === 'o' && view.screen === 'overview'))
2512
+ if (key.name === 'escape' || (key.name === 'return' && view.screen !== 'billing' && view.screen !== 'subscription') || text === '?' || key.name === 'a' || (key.name === 'o' && view.screen === 'overview') || (key.name === 'v' && view.screen === 'agents'))
2487
2513
  view.screen = 'list';
2488
2514
  if (key.name === 's' && view.screen === 'billing') {
2489
2515
  view.screen = 'subscription';
@@ -2511,6 +2537,10 @@ export async function runDashboard(model, options, input = process.stdin, output
2511
2537
  view.screen = 'overview';
2512
2538
  view.scroll = 0;
2513
2539
  }
2540
+ if (key.name === 'v') {
2541
+ view.screen = 'agents';
2542
+ view.scroll = 0;
2543
+ }
2514
2544
  if (key.name === 't')
2515
2545
  model.cycleSort();
2516
2546
  if (key.name === 'b') {