@openagents-org/agent-launcher 0.2.82 → 0.2.84
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.
- package/package.json +1 -1
- package/src/cli.js +1 -1
- package/src/tui.js +45 -27
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -122,7 +122,7 @@ async function cmdCreate(connector, flags, positional) {
|
|
|
122
122
|
const role = flags.role || 'worker';
|
|
123
123
|
|
|
124
124
|
try {
|
|
125
|
-
connector.addAgent({ name, type, role, path: flags.path });
|
|
125
|
+
connector.addAgent({ name, type, role, path: flags.path || process.cwd() });
|
|
126
126
|
print(`Agent '${name}' created (type: ${type})`);
|
|
127
127
|
|
|
128
128
|
// Auto-install if not installed
|
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 =
|
|
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
|
-
|
|
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 || '
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
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
|
+
details.push(r.path || process.env.HOME || '~');
|
|
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
|
-
//
|
|
408
|
-
|
|
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' || !
|
|
1406
|
-
const a =
|
|
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' || !
|
|
1411
|
-
const a =
|
|
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' || !
|
|
1416
|
-
const a =
|
|
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' || !
|
|
1421
|
-
const a =
|
|
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' || !
|
|
1426
|
-
const a =
|
|
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' || !
|
|
1431
|
-
const a =
|
|
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' || !
|
|
1436
|
-
const a =
|
|
1453
|
+
if (currentView !== 'main' || !selectedAgent()) return;
|
|
1454
|
+
const a = selectedAgent();
|
|
1437
1455
|
if (a.configured) doRemove(a.name);
|
|
1438
1456
|
},
|
|
1439
1457
|
Daemon() {
|