@openagents-org/agent-launcher 0.2.154 → 0.2.155
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 +29 -5
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -434,13 +434,20 @@ async function cmdNode(connector, flags, positional) {
|
|
|
434
434
|
print(`Node connected to workspace '${res.workspaceName}' (${res.workspaceSlug})`);
|
|
435
435
|
print(` This device: ${info.hostname} (${info.deviceType})`);
|
|
436
436
|
|
|
437
|
-
//
|
|
437
|
+
// (Re)start the daemon so it runs the CURRENT launcher build and loads
|
|
438
|
+
// the new node identity. A daemon started before the connect-a-node
|
|
439
|
+
// feature has no node-heartbeat loop, so reusing it would leave the node
|
|
440
|
+
// showing offline — recycle it rather than reuse it.
|
|
438
441
|
if (connector.getDaemonPid()) {
|
|
439
|
-
print('
|
|
442
|
+
print(' Restarting daemon...');
|
|
443
|
+
connector.stopDaemon();
|
|
444
|
+
for (let i = 0; i < 25 && connector.getDaemonPid(); i++) {
|
|
445
|
+
await new Promise((resolve) => setTimeout(resolve, 200));
|
|
446
|
+
}
|
|
440
447
|
} else {
|
|
441
448
|
print(' Starting daemon...');
|
|
442
|
-
connector.startDaemon();
|
|
443
449
|
}
|
|
450
|
+
connector.startDaemon();
|
|
444
451
|
print('');
|
|
445
452
|
print('Next: add an agent from the workspace, or run:');
|
|
446
453
|
print(' agn create <name> --type <type> --install');
|
|
@@ -775,7 +782,7 @@ async function cmdVersion() {
|
|
|
775
782
|
print(`${pkg.name} v${pkg.version}`);
|
|
776
783
|
}
|
|
777
784
|
|
|
778
|
-
async function cmdUpdate() {
|
|
785
|
+
async function cmdUpdate(connector) {
|
|
779
786
|
const { checkForUpdate, runUpdate, currentVersion } = require('./update-check');
|
|
780
787
|
const info = await checkForUpdate();
|
|
781
788
|
if (!info) {
|
|
@@ -795,6 +802,23 @@ async function cmdUpdate() {
|
|
|
795
802
|
return;
|
|
796
803
|
}
|
|
797
804
|
print(`Updated to ${info.latest}.`);
|
|
805
|
+
|
|
806
|
+
// Recycle a running daemon so the new build takes effect immediately. Without
|
|
807
|
+
// this, a long-lived daemon keeps executing the OLD in-memory code (and misses
|
|
808
|
+
// new features) until the next manual restart or reboot — the failure mode
|
|
809
|
+
// that left a connected node showing offline after its launcher was upgraded.
|
|
810
|
+
try {
|
|
811
|
+
if (connector && connector.getDaemonPid()) {
|
|
812
|
+
print('Restarting daemon to apply the update...');
|
|
813
|
+
connector.stopDaemon();
|
|
814
|
+
for (let i = 0; i < 25 && connector.getDaemonPid(); i++) {
|
|
815
|
+
await new Promise((resolve) => setTimeout(resolve, 200));
|
|
816
|
+
}
|
|
817
|
+
connector.startDaemon();
|
|
818
|
+
}
|
|
819
|
+
} catch (e) {
|
|
820
|
+
print(`Note: could not restart the daemon automatically (${e.message}). Run 'agn restart'.`);
|
|
821
|
+
}
|
|
798
822
|
}
|
|
799
823
|
|
|
800
824
|
async function cmdHelp() {
|
|
@@ -909,7 +933,7 @@ async function main() {
|
|
|
909
933
|
skills: () => cmdSkills(connector, flags, positional),
|
|
910
934
|
'tool-mode': () => cmdToolMode(connector, flags, positional),
|
|
911
935
|
'test-llm': () => cmdTestLLM(connector, flags, positional),
|
|
912
|
-
update: () => cmdUpdate(),
|
|
936
|
+
update: () => cmdUpdate(connector),
|
|
913
937
|
'mcp-server': () => {
|
|
914
938
|
const { runMcpServer } = require('./mcp-server');
|
|
915
939
|
const workspaceId = flags['workspace-id'] || process.env.OPENAGENTS_WORKSPACE_ID;
|