@bpinhosilva/agent-orchestrator 1.0.0-alpha.42 → 1.0.0-alpha.43
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/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [1.0.0-alpha.43](https://github.com/bpinhosilva/agent-orchestrator/compare/v1.0.0-alpha.42...v1.0.0-alpha.43) (2026-04-17)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* implement server startup verification and enhance command handling for restart, rotate-secrets ([4033161](https://github.com/bpinhosilva/agent-orchestrator/commit/40331617046bcfe3bc96e189fa27614bee505235))
|
|
7
|
+
|
|
1
8
|
# [1.0.0-alpha.42](https://github.com/bpinhosilva/agent-orchestrator/compare/v1.0.0-alpha.41...v1.0.0-alpha.42) (2026-04-17)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.registerRestartCommand = registerRestartCommand;
|
|
4
|
+
const utils_1 = require("../utils");
|
|
4
5
|
const process_manager_1 = require("../process-manager");
|
|
5
6
|
const constants_1 = require("../constants");
|
|
6
7
|
function registerRestartCommand(program) {
|
|
@@ -23,6 +24,11 @@ function registerRestartCommand(program) {
|
|
|
23
24
|
}
|
|
24
25
|
console.log('Starting Agent Orchestrator in background...');
|
|
25
26
|
const { pid, host, port } = (0, process_manager_1.startServer)();
|
|
27
|
+
const survived = await (0, utils_1.verifyServerStartup)(pid);
|
|
28
|
+
if (!survived) {
|
|
29
|
+
process.exit(1);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
26
32
|
console.log(`Orchestrator started in background.\n${(0, process_manager_1.formatProcessSummary)({
|
|
27
33
|
pid,
|
|
28
34
|
source: 'metadata',
|
|
@@ -90,6 +90,11 @@ function registerRotateSecretsCommand(program) {
|
|
|
90
90
|
(0, process_manager_1.removeRuntimeState)();
|
|
91
91
|
console.log('Orchestrator stopped. Restarting...');
|
|
92
92
|
const { pid, host, port } = (0, process_manager_1.startServer)();
|
|
93
|
+
const survived = await (0, utils_1.verifyServerStartup)(pid);
|
|
94
|
+
if (!survived) {
|
|
95
|
+
process.exit(1);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
93
98
|
console.log(`Orchestrator started.\n${(0, process_manager_1.formatProcessSummary)({
|
|
94
99
|
pid,
|
|
95
100
|
source: 'metadata',
|
|
@@ -1,40 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
3
|
exports.registerRunCommand = registerRunCommand;
|
|
37
|
-
const fs = __importStar(require("fs"));
|
|
38
4
|
const utils_1 = require("../utils");
|
|
39
5
|
const process_manager_1 = require("../process-manager");
|
|
40
6
|
const constants_1 = require("../constants");
|
|
@@ -46,18 +12,6 @@ const VALID_LOG_LEVELS = [
|
|
|
46
12
|
'debug',
|
|
47
13
|
'verbose',
|
|
48
14
|
];
|
|
49
|
-
const EARLY_CRASH_WAIT_MS = 3000;
|
|
50
|
-
const LOG_TAIL_LINES = 20;
|
|
51
|
-
function tailLogFile(logFile, lines) {
|
|
52
|
-
try {
|
|
53
|
-
const content = fs.readFileSync(logFile, 'utf8');
|
|
54
|
-
const allLines = content.split('\n');
|
|
55
|
-
return allLines.slice(-lines).join('\n').trim();
|
|
56
|
-
}
|
|
57
|
-
catch {
|
|
58
|
-
return '';
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
15
|
function registerRunCommand(program) {
|
|
62
16
|
program
|
|
63
17
|
.command('run')
|
|
@@ -78,19 +32,8 @@ function registerRunCommand(program) {
|
|
|
78
32
|
}
|
|
79
33
|
console.log('Starting Agent Orchestrator in background...');
|
|
80
34
|
const { pid, host, port } = (0, process_manager_1.startServer)({ logLevel: options.logLevel });
|
|
81
|
-
|
|
82
|
-
await new Promise((r) => setTimeout(r, EARLY_CRASH_WAIT_MS));
|
|
83
|
-
const survived = (0, process_manager_1.isManagedProcess)(pid, {
|
|
84
|
-
cwd: constants_1.PACKAGE_ROOT,
|
|
85
|
-
mainPath: constants_1.MAIN_FILE,
|
|
86
|
-
});
|
|
35
|
+
const survived = await (0, utils_1.verifyServerStartup)(pid);
|
|
87
36
|
if (!survived) {
|
|
88
|
-
(0, process_manager_1.removeRuntimeState)();
|
|
89
|
-
const tail = tailLogFile(constants_1.LOG_FILE, LOG_TAIL_LINES);
|
|
90
|
-
console.error('Server process exited immediately after starting.' +
|
|
91
|
-
(tail
|
|
92
|
-
? `\n\nLast log output:\n${tail}`
|
|
93
|
-
: `\nCheck the log file for details: ${constants_1.LOG_FILE}`));
|
|
94
37
|
process.exit(1);
|
|
95
38
|
}
|
|
96
39
|
console.log(`Orchestrator started in background.\n${(0, process_manager_1.formatProcessSummary)({
|
package/dist/cli/setup/admin.js
CHANGED
package/dist/cli/utils.js
CHANGED
|
@@ -36,9 +36,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.getPackageVersion = getPackageVersion;
|
|
37
37
|
exports.tailLogLines = tailLogLines;
|
|
38
38
|
exports.resolveActionOptions = resolveActionOptions;
|
|
39
|
+
exports.verifyServerStartup = verifyServerStartup;
|
|
39
40
|
const fs = __importStar(require("fs"));
|
|
40
41
|
const commander_1 = require("commander");
|
|
41
42
|
const constants_1 = require("./constants");
|
|
43
|
+
const process_manager_1 = require("./process-manager");
|
|
42
44
|
function getPackageVersion(packageJsonPath = constants_1.PACKAGE_JSON_PATH, readFn = (p) => fs.readFileSync(p, 'utf8')) {
|
|
43
45
|
try {
|
|
44
46
|
const packageJson = JSON.parse(readFn(packageJsonPath));
|
|
@@ -69,3 +71,36 @@ function resolveActionOptions(args) {
|
|
|
69
71
|
}
|
|
70
72
|
return {};
|
|
71
73
|
}
|
|
74
|
+
const EARLY_CRASH_WAIT_MS = 3000;
|
|
75
|
+
const LOG_TAIL_LINES = 20;
|
|
76
|
+
function tailLogFile(logFile, lines) {
|
|
77
|
+
try {
|
|
78
|
+
const content = fs.readFileSync(logFile, 'utf8');
|
|
79
|
+
const allLines = content.split('\n');
|
|
80
|
+
return allLines.slice(-lines).join('\n').trim();
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
return '';
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Waits briefly after server spawn and verifies the process survived startup.
|
|
88
|
+
* If the process died, cleans up runtime state and prints the log tail.
|
|
89
|
+
* Returns true if the process is still alive, false if it crashed.
|
|
90
|
+
*/
|
|
91
|
+
async function verifyServerStartup(pid, logFile = constants_1.LOG_FILE, mainFile = constants_1.MAIN_FILE, packageRoot = constants_1.PACKAGE_ROOT) {
|
|
92
|
+
await new Promise((r) => setTimeout(r, EARLY_CRASH_WAIT_MS));
|
|
93
|
+
const survived = (0, process_manager_1.isManagedProcess)(pid, {
|
|
94
|
+
cwd: packageRoot,
|
|
95
|
+
mainPath: mainFile,
|
|
96
|
+
});
|
|
97
|
+
if (!survived) {
|
|
98
|
+
(0, process_manager_1.removeRuntimeState)();
|
|
99
|
+
const tail = tailLogFile(logFile, LOG_TAIL_LINES);
|
|
100
|
+
console.error('Server process exited immediately after starting.' +
|
|
101
|
+
(tail
|
|
102
|
+
? `\n\nLast log output:\n${tail}`
|
|
103
|
+
: `\nCheck the log file for details: ${logFile}`));
|
|
104
|
+
}
|
|
105
|
+
return survived;
|
|
106
|
+
}
|
package/package.json
CHANGED