@openagents-org/agent-launcher 0.2.81 → 0.2.83

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 (3) hide show
  1. package/package.json +1 -1
  2. package/src/cli.js +12 -12
  3. package/src/tui.js +45 -27
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openagents-org/agent-launcher",
3
- "version": "0.2.81",
3
+ "version": "0.2.83",
4
4
  "description": "OpenAgents Launcher — install, configure, and run AI coding agents from your terminal",
5
5
  "main": "src/index.js",
6
6
  "bin": {
package/src/cli.js CHANGED
@@ -100,7 +100,7 @@ async function cmdStatus(connector) {
100
100
 
101
101
  const agents = connector.listAgents();
102
102
  if (agents.length === 0) {
103
- print('\nNo agents configured. Run: openagents create <name> --type <type>');
103
+ print('\nNo agents configured. Run: agn create <name> --type <type>');
104
104
  return;
105
105
  }
106
106
 
@@ -117,7 +117,7 @@ async function cmdStatus(connector) {
117
117
 
118
118
  async function cmdCreate(connector, flags, positional) {
119
119
  const name = positional[0];
120
- if (!name) { print('Usage: openagents create <name> [--type <type>]'); return; }
120
+ if (!name) { print('Usage: agn create <name> [--type <type>]'); return; }
121
121
  const type = flags.type || 'openclaw';
122
122
  const role = flags.role || 'worker';
123
123
 
@@ -143,28 +143,28 @@ async function cmdCreate(connector, flags, positional) {
143
143
 
144
144
  async function cmdRemove(connector, _flags, positional) {
145
145
  const name = positional[0];
146
- if (!name) { print('Usage: openagents remove <name>'); return; }
146
+ if (!name) { print('Usage: agn remove <name>'); return; }
147
147
  connector.removeAgent(name);
148
148
  print(`Agent '${name}' removed`);
149
149
  }
150
150
 
151
151
  async function cmdStart(connector, _flags, positional) {
152
152
  const name = positional[0];
153
- if (!name) { print('Usage: openagents start <name>'); return; }
153
+ if (!name) { print('Usage: agn start <name>'); return; }
154
154
  connector.sendDaemonCommand(`restart:${name}`);
155
155
  print(`Sent start command for '${name}'`);
156
156
  }
157
157
 
158
158
  async function cmdStop(connector, _flags, positional) {
159
159
  const name = positional[0];
160
- if (!name) { print('Usage: openagents stop <name>'); return; }
160
+ if (!name) { print('Usage: agn stop <name>'); return; }
161
161
  connector.sendDaemonCommand(`stop:${name}`);
162
162
  print(`Sent stop command for '${name}'`);
163
163
  }
164
164
 
165
165
  async function cmdInstall(connector, _flags, positional) {
166
166
  const type = positional[0];
167
- if (!type) { print('Usage: openagents install <type>'); return; }
167
+ if (!type) { print('Usage: agn install <type>'); return; }
168
168
 
169
169
  if (connector.isInstalled(type)) {
170
170
  print(`${type} is already installed`);
@@ -184,7 +184,7 @@ async function cmdInstall(connector, _flags, positional) {
184
184
 
185
185
  async function cmdUninstall(connector, _flags, positional) {
186
186
  const type = positional[0];
187
- if (!type) { print('Usage: openagents uninstall <type>'); return; }
187
+ if (!type) { print('Usage: agn uninstall <type>'); return; }
188
188
 
189
189
  print(`Uninstalling ${type}...`);
190
190
  try {
@@ -271,7 +271,7 @@ async function cmdConnect(connector, flags, positional) {
271
271
  const name = positional[0];
272
272
  const token = positional[1] || flags.token;
273
273
  if (!name || !token) {
274
- print('Usage: openagents connect <agent-name> <token>');
274
+ print('Usage: agn connect <agent-name> <token>');
275
275
  return;
276
276
  }
277
277
 
@@ -308,7 +308,7 @@ async function cmdConnect(connector, flags, positional) {
308
308
 
309
309
  async function cmdDisconnect(connector, _flags, positional) {
310
310
  const name = positional[0];
311
- if (!name) { print('Usage: openagents disconnect <agent-name>'); return; }
311
+ if (!name) { print('Usage: agn disconnect <agent-name>'); return; }
312
312
  connector.disconnectWorkspace(name);
313
313
  print(`'${name}' disconnected from workspace`);
314
314
 
@@ -361,7 +361,7 @@ async function cmdWorkspace(connector, flags, positional) {
361
361
 
362
362
  case 'join': {
363
363
  const token = subArgs[0] || flags.token;
364
- if (!token) { print('Usage: openagents workspace join <token>'); return; }
364
+ if (!token) { print('Usage: agn workspace join <token>'); return; }
365
365
  try {
366
366
  const info = await connector.resolveToken(token);
367
367
  connector.config.addNetwork({
@@ -395,7 +395,7 @@ async function cmdWorkspace(connector, flags, positional) {
395
395
 
396
396
  async function cmdEnv(connector, flags, positional) {
397
397
  const type = positional[0];
398
- if (!type) { print('Usage: openagents env <type> [--set KEY=VALUE]'); return; }
398
+ if (!type) { print('Usage: agn env <type> [--set KEY=VALUE]'); return; }
399
399
 
400
400
  const setVal = flags.set;
401
401
  if (setVal) {
@@ -432,7 +432,7 @@ async function cmdEnv(connector, flags, positional) {
432
432
 
433
433
  async function cmdTestLLM(connector, _flags, positional) {
434
434
  const type = positional[0];
435
- if (!type) { print('Usage: openagents test-llm <type>'); return; }
435
+ if (!type) { print('Usage: agn test-llm <type>'); return; }
436
436
 
437
437
  const env = connector.getAgentEnv(type);
438
438
  const resolved = connector.resolveAgentEnv(type, env);
package/src/tui.js CHANGED
@@ -300,7 +300,7 @@ function createTUI() {
300
300
 
301
301
  // ── Footer rendering (context-aware, clickable) ──
302
302
  function updateFooter() {
303
- const agent = agentRows[agentList.selected];
303
+ const agent = selectedAgent();
304
304
  const items = [];
305
305
 
306
306
  items.push({ key: 'i', label: 'Install' });
@@ -357,25 +357,30 @@ function createTUI() {
357
357
 
358
358
  // ── Agent table refresh ──
359
359
  function refreshAgentTable() {
360
- const savedIdx = agentList.selected || 0;
360
+ const savedIdx = Math.floor((agentList.selected || 0) / 2);
361
361
  try { agentRows = loadAgentRows(connector); } catch { agentRows = []; }
362
362
 
363
363
  if (agentRows.length === 0) {
364
364
  agentList.setItems([' {gray-fg}No agents configured. Press {bold}i{/bold} to install, {bold}n{/bold} to create.{/gray-fg}']);
365
365
  } else {
366
- const items = agentRows.map(r => {
366
+ // Two rows per agent: main row + detail row (path + config status)
367
+ const items = [];
368
+ for (const r of agentRows) {
367
369
  const state = stateMarkup(r.state, !!r.workspace);
368
- const ws = r.workspace || '{gray-fg}-{/gray-fg}';
369
- const pathInfo = r.path ? `{gray-fg} ${r.path}{/gray-fg}` : '';
370
- const warning = r.notReadyMsg ? ` {yellow-fg}⚠ ${r.notReadyMsg}{/yellow-fg}` : '';
371
- return ` ${r.name.padEnd(22)} ${r.type.padEnd(14)} ${state.padEnd(30)} ${ws}${pathInfo}${warning}`;
372
- });
370
+ const ws = r.workspace || '';
371
+ items.push(` ${r.name.padEnd(22)} ${r.type.padEnd(14)} ${state.padEnd(30)} ${ws}`);
372
+ // Detail row: working dir + config warning
373
+ const details = [];
374
+ if (r.path) details.push(r.path);
375
+ if (r.notReadyMsg) details.push(`{yellow-fg}⚠ ${r.notReadyMsg}{/yellow-fg}`);
376
+ items.push(` {gray-fg} ${details.join(' · ') || ''}{/gray-fg}`);
377
+ }
373
378
  agentList.setItems(items);
374
379
  }
375
380
 
376
- // Restore cursor position
381
+ // Restore cursor position (2 rows per agent)
377
382
  if (agentRows.length > 0) {
378
- agentList.select(Math.min(savedIdx, agentRows.length - 1));
383
+ agentList.select(Math.min(savedIdx * 2, (agentRows.length - 1) * 2));
379
384
  }
380
385
 
381
386
  updateHeader();
@@ -404,13 +409,26 @@ function createTUI() {
404
409
  );
405
410
  }
406
411
 
407
- // Update footer when selection changes
408
- agentList.on('select item', () => updateFooter());
412
+ // Helper: get currently selected agent (2 rows per agent)
413
+ function selectedAgent() {
414
+ return agentRows[Math.floor((agentList.selected || 0) / 2)];
415
+ }
416
+
417
+ // Navigate by 2 to skip detail rows
418
+ agentList.on('select item', () => {
419
+ // Snap to even rows (main rows)
420
+ const idx = agentList.selected || 0;
421
+ if (idx % 2 !== 0 && agentRows.length > 0) {
422
+ agentList.select(idx - 1);
423
+ screen.render();
424
+ }
425
+ updateFooter();
426
+ });
409
427
 
410
428
  // ── Enter key → Context menu ──
411
429
  agentList.on('select', (_item, idx) => {
412
430
  if (currentView !== 'main') return;
413
- const agent = agentRows[idx];
431
+ const agent = agentRows[Math.floor(idx / 2)];
414
432
  if (!agent || !agent.configured) return;
415
433
  showAgentActionMenu(agent);
416
434
  });
@@ -1402,38 +1420,38 @@ function createTUI() {
1402
1420
  });
1403
1421
  },
1404
1422
  Start() {
1405
- if (currentView !== 'main' || !agentRows[agentList.selected]) return;
1406
- const a = agentRows[agentList.selected];
1423
+ if (currentView !== 'main' || !selectedAgent()) return;
1424
+ const a = selectedAgent();
1407
1425
  if (a.configured) doStart(a.name);
1408
1426
  },
1409
1427
  Stop() {
1410
- if (currentView !== 'main' || !agentRows[agentList.selected]) return;
1411
- const a = agentRows[agentList.selected];
1428
+ if (currentView !== 'main' || !selectedAgent()) return;
1429
+ const a = selectedAgent();
1412
1430
  if (a.configured) doStop(a.name);
1413
1431
  },
1414
1432
  Configure() {
1415
- if (currentView !== 'main' || !agentRows[agentList.selected]) return;
1416
- const a = agentRows[agentList.selected];
1433
+ if (currentView !== 'main' || !selectedAgent()) return;
1434
+ const a = selectedAgent();
1417
1435
  if (a.configured) showConfigureScreen(a);
1418
1436
  },
1419
1437
  Connect() {
1420
- if (currentView !== 'main' || !agentRows[agentList.selected]) return;
1421
- const a = agentRows[agentList.selected];
1438
+ if (currentView !== 'main' || !selectedAgent()) return;
1439
+ const a = selectedAgent();
1422
1440
  if (a.configured && !a.workspace) showConnectWorkspaceScreen(a.name);
1423
1441
  },
1424
1442
  Disconnect() {
1425
- if (currentView !== 'main' || !agentRows[agentList.selected]) return;
1426
- const a = agentRows[agentList.selected];
1443
+ if (currentView !== 'main' || !selectedAgent()) return;
1444
+ const a = selectedAgent();
1427
1445
  if (a.configured && a.workspace) doDisconnect(a.name);
1428
1446
  },
1429
1447
  Workspace() {
1430
- if (currentView !== 'main' || !agentRows[agentList.selected]) return;
1431
- const a = agentRows[agentList.selected];
1448
+ if (currentView !== 'main' || !selectedAgent()) return;
1449
+ const a = selectedAgent();
1432
1450
  if (a.configured && a.workspace) doOpenWorkspace(a);
1433
1451
  },
1434
1452
  Remove() {
1435
- if (currentView !== 'main' || !agentRows[agentList.selected]) return;
1436
- const a = agentRows[agentList.selected];
1453
+ if (currentView !== 'main' || !selectedAgent()) return;
1454
+ const a = selectedAgent();
1437
1455
  if (a.configured) doRemove(a.name);
1438
1456
  },
1439
1457
  Daemon() {