@bpinhosilva/agent-orchestrator 1.0.0-alpha.41 → 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,17 @@
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
+
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)
9
+
10
+
11
+ ### Features
12
+
13
+ * add early crash detection and log tailing for server process ([b3c7945](https://github.com/bpinhosilva/agent-orchestrator/commit/b3c79454f030845f3056e30f9daab1a7726ce00e))
14
+
1
15
  # [1.0.0-alpha.41](https://github.com/bpinhosilva/agent-orchestrator/compare/v1.0.0-alpha.40...v1.0.0-alpha.41) (2026-04-17)
2
16
 
3
17
 
@@ -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',
@@ -17,7 +17,7 @@ function registerRunCommand(program) {
17
17
  .command('run')
18
18
  .description('Start the orchestrator server in detached mode')
19
19
  .option('--log-level <level>', 'Set the log level (fatal, error, warn, log, debug, verbose)')
20
- .action((...args) => {
20
+ .action(async (...args) => {
21
21
  try {
22
22
  const options = (0, utils_1.resolveActionOptions)(args);
23
23
  if (options.logLevel) {
@@ -32,6 +32,10 @@ function registerRunCommand(program) {
32
32
  }
33
33
  console.log('Starting Agent Orchestrator in background...');
34
34
  const { pid, host, port } = (0, process_manager_1.startServer)({ logLevel: options.logLevel });
35
+ const survived = await (0, utils_1.verifyServerStartup)(pid);
36
+ if (!survived) {
37
+ process.exit(1);
38
+ }
35
39
  console.log(`Orchestrator started in background.\n${(0, process_manager_1.formatProcessSummary)({
36
40
  pid,
37
41
  source: 'metadata',
@@ -146,5 +146,6 @@ bcryptDep = require('bcrypt')) {
146
146
  }
147
147
  catch (err) {
148
148
  console.error('Admin setup failed:', err instanceof Error ? err.message : err);
149
+ throw err;
149
150
  }
150
151
  }
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bpinhosilva/agent-orchestrator",
3
- "version": "1.0.0-alpha.41",
3
+ "version": "1.0.0-alpha.43",
4
4
  "description": "An open-source AI agent orchestrator platform built with NestJS.",
5
5
  "author": "bpinhosilva",
6
6
  "license": "MIT",