@openagents-org/agent-launcher 0.1.11 → 0.1.12
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/tui.js +101 -112
package/package.json
CHANGED
package/src/tui.js
CHANGED
|
@@ -225,14 +225,6 @@ function createTUI() {
|
|
|
225
225
|
}
|
|
226
226
|
|
|
227
227
|
// ── Footer rendering (context-aware, clickable) ──
|
|
228
|
-
// Maps footer action labels to the key they simulate
|
|
229
|
-
const footerKeyMap = {
|
|
230
|
-
'Install': 'i', 'New': 'n', 'Start': 's', 'Stop': 'x',
|
|
231
|
-
'Configure': 'e', 'Connect': 'c', 'Disconnect': 'd',
|
|
232
|
-
'Workspace': 'w', 'Remove': 'delete', 'Daemon': 'u',
|
|
233
|
-
'Refresh': 'r', 'Quit': 'q',
|
|
234
|
-
};
|
|
235
|
-
|
|
236
228
|
function updateFooter() {
|
|
237
229
|
const agent = agentRows[agentList.selected];
|
|
238
230
|
const items = [];
|
|
@@ -278,9 +270,9 @@ function createTUI() {
|
|
|
278
270
|
content: `{cyan-fg}${item.key}{/cyan-fg} ${item.label}`,
|
|
279
271
|
style: { bg: COLORS.footerBg, fg: COLORS.footerFg, hover: { bg: 'cyan', fg: 'black' } },
|
|
280
272
|
});
|
|
281
|
-
const
|
|
282
|
-
if (
|
|
283
|
-
btn.on('click', () =>
|
|
273
|
+
const action = footerActions[item.label];
|
|
274
|
+
if (action) {
|
|
275
|
+
btn.on('click', () => action());
|
|
284
276
|
}
|
|
285
277
|
footerButtons.push(btn);
|
|
286
278
|
left += text.length + 2;
|
|
@@ -1221,115 +1213,112 @@ function createTUI() {
|
|
|
1221
1213
|
// Key bindings
|
|
1222
1214
|
// ────────────────────────────────────────────────────────────────────────
|
|
1223
1215
|
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
signalDaemonReload();
|
|
1216
|
+
// ── Action handlers (shared by keys and clickable footer) ──
|
|
1217
|
+
const footerActions = {
|
|
1218
|
+
Install() { if (currentView === 'main') showInstallScreen(); },
|
|
1219
|
+
New() {
|
|
1220
|
+
if (currentView !== 'main') return;
|
|
1221
|
+
showSelectAgentTypeScreen((type) => {
|
|
1222
|
+
showStartAgentScreen(type, (result) => {
|
|
1223
|
+
try {
|
|
1224
|
+
connector.addAgent({ name: result.name, type: result.type, path: result.path });
|
|
1225
|
+
log(`{green-fg}\u2713{/green-fg} Created agent {cyan-fg}${result.name}{/cyan-fg} (${result.type})`);
|
|
1226
|
+
const pid = connector.getDaemonPid();
|
|
1227
|
+
if (!pid) {
|
|
1228
|
+
connector.startDaemon();
|
|
1229
|
+
log('{green-fg}\u2713{/green-fg} Daemon starting...');
|
|
1230
|
+
} else {
|
|
1231
|
+
signalDaemonReload();
|
|
1232
|
+
}
|
|
1233
|
+
} catch (e) {
|
|
1234
|
+
log(`{red-fg}\u2717{/red-fg} ${e.message}`);
|
|
1244
1235
|
}
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
}
|
|
1248
|
-
setTimeout(refreshAgentTable, 3000);
|
|
1236
|
+
setTimeout(refreshAgentTable, 3000);
|
|
1237
|
+
});
|
|
1249
1238
|
});
|
|
1250
|
-
}
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1239
|
+
},
|
|
1240
|
+
Start() {
|
|
1241
|
+
if (currentView !== 'main' || !agentRows[agentList.selected]) return;
|
|
1242
|
+
const a = agentRows[agentList.selected];
|
|
1243
|
+
if (a.configured) doStart(a.name);
|
|
1244
|
+
},
|
|
1245
|
+
Stop() {
|
|
1246
|
+
if (currentView !== 'main' || !agentRows[agentList.selected]) return;
|
|
1247
|
+
const a = agentRows[agentList.selected];
|
|
1248
|
+
if (a.configured) doStop(a.name);
|
|
1249
|
+
},
|
|
1250
|
+
Configure() {
|
|
1251
|
+
if (currentView !== 'main' || !agentRows[agentList.selected]) return;
|
|
1252
|
+
const a = agentRows[agentList.selected];
|
|
1253
|
+
if (a.configured) showConfigureScreen(a);
|
|
1254
|
+
},
|
|
1255
|
+
Connect() {
|
|
1256
|
+
if (currentView !== 'main' || !agentRows[agentList.selected]) return;
|
|
1257
|
+
const a = agentRows[agentList.selected];
|
|
1258
|
+
if (a.configured && !a.workspace) showConnectWorkspaceScreen(a.name);
|
|
1259
|
+
},
|
|
1260
|
+
Disconnect() {
|
|
1261
|
+
if (currentView !== 'main' || !agentRows[agentList.selected]) return;
|
|
1262
|
+
const a = agentRows[agentList.selected];
|
|
1263
|
+
if (a.configured && a.workspace) doDisconnect(a.name);
|
|
1264
|
+
},
|
|
1265
|
+
Workspace() {
|
|
1266
|
+
if (currentView !== 'main' || !agentRows[agentList.selected]) return;
|
|
1267
|
+
const a = agentRows[agentList.selected];
|
|
1268
|
+
if (a.configured && a.workspace) doOpenWorkspace(a);
|
|
1269
|
+
},
|
|
1270
|
+
Remove() {
|
|
1271
|
+
if (currentView !== 'main' || !agentRows[agentList.selected]) return;
|
|
1272
|
+
const a = agentRows[agentList.selected];
|
|
1273
|
+
if (a.configured) doRemove(a.name);
|
|
1274
|
+
},
|
|
1275
|
+
Daemon() {
|
|
1276
|
+
if (currentView !== 'main') return;
|
|
1277
|
+
const pid = connector.getDaemonPid();
|
|
1278
|
+
if (pid) {
|
|
1279
|
+
showConfirmDialog('Stop daemon? This will disconnect ALL agents.', (yes) => {
|
|
1280
|
+
if (!yes) { log('{gray-fg}Cancelled{/gray-fg}'); return; }
|
|
1281
|
+
try {
|
|
1282
|
+
connector.stopDaemon();
|
|
1283
|
+
log('{green-fg}\u2713{/green-fg} Daemon stopped');
|
|
1284
|
+
} catch (e) {
|
|
1285
|
+
log(`{red-fg}\u2717{/red-fg} ${e.message}`);
|
|
1286
|
+
}
|
|
1287
|
+
setTimeout(refreshAgentTable, 1000);
|
|
1288
|
+
});
|
|
1289
|
+
} else {
|
|
1280
1290
|
try {
|
|
1281
|
-
connector.
|
|
1282
|
-
log('{green-fg}\u2713{/green-fg} Daemon
|
|
1291
|
+
connector.startDaemon();
|
|
1292
|
+
log('{green-fg}\u2713{/green-fg} Daemon starting...');
|
|
1283
1293
|
} catch (e) {
|
|
1284
1294
|
log(`{red-fg}\u2717{/red-fg} ${e.message}`);
|
|
1285
1295
|
}
|
|
1286
|
-
setTimeout(refreshAgentTable,
|
|
1287
|
-
});
|
|
1288
|
-
} else {
|
|
1289
|
-
try {
|
|
1290
|
-
connector.startDaemon();
|
|
1291
|
-
log('{green-fg}\u2713{/green-fg} Daemon starting...');
|
|
1292
|
-
} catch (e) {
|
|
1293
|
-
log(`{red-fg}\u2717{/red-fg} ${e.message}`);
|
|
1296
|
+
setTimeout(refreshAgentTable, 3000);
|
|
1294
1297
|
}
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
if (
|
|
1303
|
-
|
|
1304
|
-
});
|
|
1305
|
-
|
|
1306
|
-
screen.key('d', () => {
|
|
1307
|
-
if (currentView !== 'main' || !agentRows[agentList.selected]) return;
|
|
1308
|
-
const a = agentRows[agentList.selected];
|
|
1309
|
-
if (!a.configured || !a.workspace) return;
|
|
1310
|
-
doDisconnect(a.name);
|
|
1311
|
-
});
|
|
1312
|
-
|
|
1313
|
-
screen.key('w', () => {
|
|
1314
|
-
if (currentView !== 'main' || !agentRows[agentList.selected]) return;
|
|
1315
|
-
const a = agentRows[agentList.selected];
|
|
1316
|
-
if (!a.configured || !a.workspace) return;
|
|
1317
|
-
doOpenWorkspace(a);
|
|
1318
|
-
});
|
|
1319
|
-
|
|
1320
|
-
screen.key('e', () => {
|
|
1321
|
-
if (currentView !== 'main' || !agentRows[agentList.selected]) return;
|
|
1322
|
-
const a = agentRows[agentList.selected];
|
|
1323
|
-
if (!a.configured) return;
|
|
1324
|
-
showConfigureScreen(a);
|
|
1325
|
-
});
|
|
1298
|
+
},
|
|
1299
|
+
Refresh() {
|
|
1300
|
+
if (currentView === 'main') {
|
|
1301
|
+
refreshAgentTable();
|
|
1302
|
+
log('{green-fg}\u2713{/green-fg} Refreshed');
|
|
1303
|
+
}
|
|
1304
|
+
},
|
|
1305
|
+
Quit() { if (currentView === 'main') process.exit(0); },
|
|
1306
|
+
};
|
|
1326
1307
|
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1308
|
+
// Bind keyboard shortcuts
|
|
1309
|
+
screen.key('q', footerActions.Quit);
|
|
1310
|
+
screen.key('C-c', () => process.exit(0));
|
|
1311
|
+
screen.key('i', footerActions.Install);
|
|
1312
|
+
screen.key('n', footerActions.New);
|
|
1313
|
+
screen.key('r', footerActions.Refresh);
|
|
1314
|
+
screen.key('s', footerActions.Start);
|
|
1315
|
+
screen.key('x', footerActions.Stop);
|
|
1316
|
+
screen.key('u', footerActions.Daemon);
|
|
1317
|
+
screen.key('c', footerActions.Connect);
|
|
1318
|
+
screen.key('d', footerActions.Disconnect);
|
|
1319
|
+
screen.key('w', footerActions.Workspace);
|
|
1320
|
+
screen.key('e', footerActions.Configure);
|
|
1321
|
+
screen.key('delete', footerActions.Remove);
|
|
1333
1322
|
|
|
1334
1323
|
// ── Init ──
|
|
1335
1324
|
agentList.focus();
|