@pushpalsdev/cli 1.0.12 → 1.0.14

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.
Files changed (2) hide show
  1. package/dist/pushpals-cli.js +133 -17
  2. package/package.json +1 -1
@@ -618,7 +618,7 @@ function loadPushPalsConfig(options = {}) {
618
618
  retentionDays: remoteMemoryRetentionDays
619
619
  },
620
620
  autonomy: {
621
- enabled: parseBoolEnv("REMOTEBUDDY_AUTONOMY_ENABLED") ?? asBoolean(remoteAutonomyNode.enabled, false),
621
+ enabled: parseBoolEnv("REMOTEBUDDY_AUTONOMY_ENABLED") ?? asBoolean(remoteAutonomyNode.enabled, true),
622
622
  killSwitchEnabled: parseBoolEnv("REMOTEBUDDY_AUTONOMY_KILL_SWITCH_ENABLED") ?? asBoolean(remoteAutonomyNode.kill_switch_enabled, false),
623
623
  tickIntervalMs: Math.max(5000, asInt(parseIntEnv("REMOTEBUDDY_AUTONOMY_TICK_INTERVAL_MS") ?? remoteAutonomyNode.tick_interval_ms, 120000)),
624
624
  heartbeatLogMs: Math.max(1000, asInt(parseIntEnv("REMOTEBUDDY_AUTONOMY_HEARTBEAT_LOG_MS") ?? remoteAutonomyNode.heartbeat_log_ms, 30000)),
@@ -1716,7 +1716,8 @@ function buildEmbeddedRuntimeEnv(baseEnv, opts) {
1716
1716
  },
1717
1717
  PUSHPALS_PROTOCOL_SCHEMAS_DIR: join2(opts.runtimeRoot, "protocol", "schemas"),
1718
1718
  ...typeof opts.sessionId === "string" && opts.sessionId.trim() ? { PUSHPALS_SESSION_ID: opts.sessionId.trim() } : {},
1719
- ...typeof env.PUSHPALS_GIT_BIN === "string" && env.PUSHPALS_GIT_BIN.trim() ? { PUSHPALS_GIT_BIN: env.PUSHPALS_GIT_BIN.trim() } : {}
1719
+ ...typeof env.PUSHPALS_GIT_BIN === "string" && env.PUSHPALS_GIT_BIN.trim() ? { PUSHPALS_GIT_BIN: env.PUSHPALS_GIT_BIN.trim() } : {},
1720
+ ...typeof env.PUSHPALS_GIT_BIN_ABSOLUTE === "string" && env.PUSHPALS_GIT_BIN_ABSOLUTE.trim() ? { PUSHPALS_GIT_BIN_ABSOLUTE: env.PUSHPALS_GIT_BIN_ABSOLUTE.trim() } : {}
1720
1721
  };
1721
1722
  }
1722
1723
  function normalizeChildProcessEnv(baseEnv, platform = process.platform) {
@@ -1770,6 +1771,23 @@ async function resolveCommandPath(command, cwd, env) {
1770
1771
  function timestampFileToken() {
1771
1772
  return new Date().toISOString().replace(/[:.]/g, "-");
1772
1773
  }
1774
+ function buildRuntimeServiceLogPaths(logDir, runToken) {
1775
+ return {
1776
+ server: join2(logDir, `${runToken}-server.log`),
1777
+ localbuddy: join2(logDir, `${runToken}-localbuddy.log`),
1778
+ remotebuddy: join2(logDir, `${runToken}-remotebuddy.log`),
1779
+ source_control_manager: join2(logDir, `${runToken}-source_control_manager.log`)
1780
+ };
1781
+ }
1782
+ function appendRuntimeServicesLogLine(logPath, line) {
1783
+ const text = String(line ?? "").trim();
1784
+ if (!text)
1785
+ return;
1786
+ try {
1787
+ appendFileSync(logPath, `${new Date().toISOString()} ${text}
1788
+ `, "utf8");
1789
+ } catch {}
1790
+ }
1773
1791
  function readLogTail(logPath, maxLines = 40) {
1774
1792
  if (!existsSync4(logPath))
1775
1793
  return "";
@@ -1780,6 +1798,31 @@ function readLogTail(logPath, maxLines = 40) {
1780
1798
  return lines.slice(-maxLines).join(`
1781
1799
  `);
1782
1800
  }
1801
+ function extractRemoteBuddyAutonomousEngineState(logText) {
1802
+ const text = String(logText ?? "");
1803
+ if (!text)
1804
+ return "unknown";
1805
+ let state = "unknown";
1806
+ for (const line of text.split(/\r?\n/)) {
1807
+ if (/Autonomous engine:\s*enabled\b/i.test(line)) {
1808
+ state = "enabled";
1809
+ continue;
1810
+ }
1811
+ if (/Autonomous engine:\s*disabled\b/i.test(line)) {
1812
+ state = "disabled";
1813
+ }
1814
+ }
1815
+ return state;
1816
+ }
1817
+ function readRemoteBuddyAutonomousEngineState(logPath) {
1818
+ if (!existsSync4(logPath))
1819
+ return "unknown";
1820
+ try {
1821
+ return extractRemoteBuddyAutonomousEngineState(readFileSync4(logPath, "utf8"));
1822
+ } catch {
1823
+ return "unknown";
1824
+ }
1825
+ }
1783
1826
  async function downloadBinaryAsset(tag, assetName, outPath) {
1784
1827
  console.log(`[pushpals] Downloading embedded runtime binary ${assetName} from ${tag}...`);
1785
1828
  const url = `${GITHUB_RELEASE_URL}/${encodeURIComponent(tag)}/${assetName}`;
@@ -1831,9 +1874,13 @@ async function ensureRuntimeBinaries(runtimeRoot, runtimeTag) {
1831
1874
  console.log("[pushpals] Embedded runtime binaries are ready.");
1832
1875
  return runtimeBinaries;
1833
1876
  }
1834
- function spawnRuntimeService(name, command, cwd, env, logPath) {
1835
- writeFileSync(logPath, `[pushpals] service=${name} command=${command.join(" ")} cwd=${cwd}
1877
+ function spawnRuntimeService(name, command, cwd, env, logPath, runtimeServicesLogPath) {
1878
+ const header = `[pushpals] service=${name} command=${command.join(" ")} cwd=${cwd}`;
1879
+ writeFileSync(logPath, `${header}
1836
1880
  `, "utf8");
1881
+ if (runtimeServicesLogPath) {
1882
+ appendRuntimeServicesLogLine(runtimeServicesLogPath, header);
1883
+ }
1837
1884
  const proc = Bun.spawn(command, {
1838
1885
  cwd,
1839
1886
  env,
@@ -1857,16 +1904,24 @@ function spawnRuntimeService(name, command, cwd, env, logPath) {
1857
1904
  const lines = pending.split(/\r?\n/);
1858
1905
  pending = lines.pop() ?? "";
1859
1906
  for (const line of lines) {
1860
- appendFileSync(logPath, `[${channel}] ${line}
1907
+ const serviceLine = `[${channel}] ${line}`;
1908
+ appendFileSync(logPath, `${serviceLine}
1861
1909
  `, "utf8");
1910
+ if (runtimeServicesLogPath) {
1911
+ appendRuntimeServicesLogLine(runtimeServicesLogPath, `[${name}] ${serviceLine}`);
1912
+ }
1862
1913
  }
1863
1914
  }
1864
1915
  const rest = decoder.decode();
1865
1916
  if (rest)
1866
1917
  pending += rest;
1867
1918
  if (pending.trim().length > 0) {
1868
- appendFileSync(logPath, `[${channel}] ${pending.trimEnd()}
1919
+ const serviceLine = `[${channel}] ${pending.trimEnd()}`;
1920
+ appendFileSync(logPath, `${serviceLine}
1869
1921
  `, "utf8");
1922
+ if (runtimeServicesLogPath) {
1923
+ appendRuntimeServicesLogLine(runtimeServicesLogPath, `[${name}] ${serviceLine}`);
1924
+ }
1870
1925
  }
1871
1926
  };
1872
1927
  pipeToLog(proc.stdout, "stdout");
@@ -1916,7 +1971,7 @@ function prependExecutableDirToPath(env, executablePath, platform = process.plat
1916
1971
  const executableDir = dirname(resolvedPath);
1917
1972
  const existingPath = platform === "win32" ? String(env.Path ?? env.PATH ?? "") : String(env.PATH ?? "");
1918
1973
  const pathEntries = existingPath.split(delimiter).map((entry) => entry.trim()).filter((entry) => entry.length > 0);
1919
- const hasDir = pathEntries.some((entry) => entry.toLowerCase() === executableDir.toLowerCase());
1974
+ const hasDir = pathEntries.some((entry) => platform === "win32" ? entry.toLowerCase() === executableDir.toLowerCase() : entry === executableDir);
1920
1975
  const nextPath = hasDir ? existingPath : [executableDir, ...pathEntries].join(delimiter);
1921
1976
  if (platform === "win32") {
1922
1977
  env.Path = nextPath;
@@ -1932,6 +1987,11 @@ function applyResolvedGitBinaryToRuntimeEnv(env, resolvedGitBinary, platform = p
1932
1987
  return env;
1933
1988
  prependExecutableDirToPath(env, resolvedPath, platform);
1934
1989
  env.PUSHPALS_GIT_BIN = basename(resolvedPath);
1990
+ if (resolvedPath.includes("/") || resolvedPath.includes("\\")) {
1991
+ env.PUSHPALS_GIT_BIN_ABSOLUTE = resolvedPath;
1992
+ } else {
1993
+ delete env.PUSHPALS_GIT_BIN_ABSOLUTE;
1994
+ }
1935
1995
  return env;
1936
1996
  }
1937
1997
  function isOptionalEmbeddedService(name) {
@@ -2176,7 +2236,8 @@ async function autoStartRuntimeServices(opts) {
2176
2236
  if (runtimeEnv.PUSHPALS_GIT_BIN) {
2177
2237
  applyResolvedGitBinaryToRuntimeEnv(runtimeEnv, runtimeEnv.PUSHPALS_GIT_BIN);
2178
2238
  }
2179
- const resolvedGitBinary = await resolveCommandPath("git", opts.repoRoot, normalizeChildProcessEnv(process.env));
2239
+ const gitLookupCommand = typeof runtimeEnv.PUSHPALS_GIT_BIN === "string" && runtimeEnv.PUSHPALS_GIT_BIN.trim() ? runtimeEnv.PUSHPALS_GIT_BIN.trim() : "git";
2240
+ const resolvedGitBinary = await resolveCommandPath(gitLookupCommand, opts.repoRoot, runtimeEnv);
2180
2241
  if (resolvedGitBinary) {
2181
2242
  applyResolvedGitBinaryToRuntimeEnv(runtimeEnv, resolvedGitBinary);
2182
2243
  }
@@ -2184,11 +2245,21 @@ async function autoStartRuntimeServices(opts) {
2184
2245
  const runToken = timestampFileToken();
2185
2246
  const logDir = join2(runtimeRoot, "logs", "bootstrap");
2186
2247
  mkdirSync(logDir, { recursive: true });
2187
- const logPathFor = (name) => join2(logDir, `${runToken}-${name}.log`);
2248
+ const serviceLogPaths = buildRuntimeServiceLogPaths(logDir, runToken);
2249
+ const runtimeServicesLogPath = join2(logDir, `${runToken}-runtime-services.log`);
2250
+ writeFileSync(runtimeServicesLogPath, "", "utf8");
2251
+ appendRuntimeServicesLogLine(runtimeServicesLogPath, `[pushpals] runtimeRoot=${runtimeRoot}`);
2252
+ appendRuntimeServicesLogLine(runtimeServicesLogPath, `[pushpals] runtimeTag=${runtimeTag}`);
2253
+ appendRuntimeServicesLogLine(runtimeServicesLogPath, `[pushpals] repoRoot=${opts.repoRoot}`);
2254
+ console.log(`[pushpals] runtime services log: ${runtimeServicesLogPath}`);
2255
+ console.log(`[pushpals] service log (server)=${serviceLogPaths.server}`);
2256
+ console.log(`[pushpals] service log (localbuddy)=${serviceLogPaths.localbuddy}`);
2257
+ console.log(`[pushpals] service log (remotebuddy)=${serviceLogPaths.remotebuddy}`);
2258
+ console.log(`[pushpals] service log (source_control_manager)=${serviceLogPaths.source_control_manager}`);
2188
2259
  const serverHealthy = await probeServer(opts.serverUrl);
2189
2260
  if (!serverHealthy) {
2190
2261
  console.log("[pushpals] Starting embedded server...");
2191
- const serverService = spawnRuntimeService("server", [runtimeBinaries.server], opts.repoRoot, runtimeEnv, logPathFor("server"));
2262
+ const serverService = spawnRuntimeService("server", [runtimeBinaries.server], opts.repoRoot, runtimeEnv, serviceLogPaths.server, runtimeServicesLogPath);
2192
2263
  services.push(serverService);
2193
2264
  console.log(`[pushpals] server log: ${serverService.logPath}`);
2194
2265
  const serverDeadline = Date.now() + DEFAULT_SERVER_BOOT_TIMEOUT_MS;
@@ -2196,6 +2267,7 @@ async function autoStartRuntimeServices(opts) {
2196
2267
  while (Date.now() < serverDeadline) {
2197
2268
  if (serverService.exited) {
2198
2269
  const tail = readLogTail(serverService.logPath);
2270
+ appendRuntimeServicesLogLine(runtimeServicesLogPath, `[pushpals] embedded server exited during bootstrap (code=${serverService.exitCode ?? "unknown"}).`);
2199
2271
  stopRuntimeServices(services);
2200
2272
  throw new Error(`Embedded server exited during bootstrap (code=${serverService.exitCode ?? "unknown"}). ` + `See ${serverService.logPath}${tail ? `
2201
2273
  --- server log tail ---
@@ -2209,6 +2281,7 @@ ${tail}` : ""}`);
2209
2281
  }
2210
2282
  if (!serverIsReady) {
2211
2283
  const tail = readLogTail(serverService.logPath);
2284
+ appendRuntimeServicesLogLine(runtimeServicesLogPath, `[pushpals] embedded server did not become healthy within ${DEFAULT_SERVER_BOOT_TIMEOUT_MS}ms.`);
2212
2285
  stopRuntimeServices(services);
2213
2286
  throw new Error(`Embedded server did not become healthy within ${DEFAULT_SERVER_BOOT_TIMEOUT_MS}ms. ` + `See ${serverService.logPath}${tail ? `
2214
2287
  --- server log tail ---
@@ -2217,58 +2290,84 @@ ${tail}` : ""}`);
2217
2290
  console.log("[pushpals] Embedded server is healthy.");
2218
2291
  } else {
2219
2292
  console.log("[pushpals] Server already healthy; skipping embedded server start.");
2293
+ appendRuntimeServicesLogLine(runtimeServicesLogPath, "[pushpals] server already healthy; embedded server start skipped.");
2220
2294
  }
2221
2295
  if (localBuddyEnabled) {
2222
2296
  console.log("[pushpals] Starting embedded LocalBuddy...");
2223
- const localbuddyService = spawnRuntimeService("localbuddy", [runtimeBinaries.localbuddy], opts.repoRoot, runtimeEnv, logPathFor("localbuddy"));
2297
+ const localbuddyService = spawnRuntimeService("localbuddy", [runtimeBinaries.localbuddy], opts.repoRoot, runtimeEnv, serviceLogPaths.localbuddy, runtimeServicesLogPath);
2224
2298
  services.push(localbuddyService);
2225
2299
  console.log(`[pushpals] localbuddy log: ${localbuddyService.logPath}`);
2226
2300
  } else {
2227
2301
  console.log("[pushpals] Embedded LocalBuddy disabled for this CLI session; skipping start.");
2302
+ appendRuntimeServicesLogLine(runtimeServicesLogPath, "[pushpals] localbuddy disabled for this CLI session; embedded localbuddy start skipped.");
2228
2303
  }
2229
2304
  console.log("[pushpals] Starting embedded RemoteBuddy...");
2230
- const remotebuddyService = spawnRuntimeService("remotebuddy", [runtimeBinaries.remotebuddy], opts.repoRoot, runtimeEnv, logPathFor("remotebuddy"));
2305
+ const remotebuddyService = spawnRuntimeService("remotebuddy", [runtimeBinaries.remotebuddy], opts.repoRoot, runtimeEnv, serviceLogPaths.remotebuddy, runtimeServicesLogPath);
2231
2306
  services.push(remotebuddyService);
2232
2307
  console.log(`[pushpals] remotebuddy log: ${remotebuddyService.logPath}`);
2308
+ let lastReportedRemoteBuddyAutonomyState = "unknown";
2309
+ const reportRemoteBuddyAutonomousEngineState = () => {
2310
+ const autonomyState = readRemoteBuddyAutonomousEngineState(remotebuddyService.logPath);
2311
+ if (autonomyState === "unknown" || autonomyState === lastReportedRemoteBuddyAutonomyState) {
2312
+ return;
2313
+ }
2314
+ lastReportedRemoteBuddyAutonomyState = autonomyState;
2315
+ if (autonomyState === "enabled") {
2316
+ console.log("[pushpals] Embedded RemoteBuddy autonomous engine is enabled.");
2317
+ appendRuntimeServicesLogLine(runtimeServicesLogPath, "[pushpals] embedded remotebuddy autonomous engine is enabled.");
2318
+ return;
2319
+ }
2320
+ console.warn("[pushpals] Embedded RemoteBuddy autonomous engine is disabled (remotebuddy.autonomy.enabled=false).");
2321
+ appendRuntimeServicesLogLine(runtimeServicesLogPath, "[pushpals] embedded remotebuddy autonomous engine is disabled (remotebuddy.autonomy.enabled=false).");
2322
+ };
2323
+ reportRemoteBuddyAutonomousEngineState();
2233
2324
  const scmHealthy = await probeSourceControlManager(opts.sourceControlManagerPort);
2234
2325
  const scmRemoteAvailable = await repoHasRemote(opts.repoRoot, opts.sourceControlManagerRemote);
2235
- const gitProbeCommand = typeof runtimeEnv.PUSHPALS_GIT_BIN === "string" && runtimeEnv.PUSHPALS_GIT_BIN.trim() ? [runtimeEnv.PUSHPALS_GIT_BIN.trim(), "--version"] : ["git", "--version"];
2326
+ const gitForScm = typeof runtimeEnv.PUSHPALS_GIT_BIN === "string" && runtimeEnv.PUSHPALS_GIT_BIN.trim() ? runtimeEnv.PUSHPALS_GIT_BIN.trim() : typeof runtimeEnv.PUSHPALS_GIT_BIN_ABSOLUTE === "string" && runtimeEnv.PUSHPALS_GIT_BIN_ABSOLUTE.trim() ? runtimeEnv.PUSHPALS_GIT_BIN_ABSOLUTE.trim() : "git";
2327
+ const gitProbeCommand = [gitForScm, "--version"];
2236
2328
  const gitAvailableForScm = await canSpawnCommand(gitProbeCommand, opts.repoRoot, runtimeEnv);
2237
2329
  if (!scmHealthy && scmRemoteAvailable) {
2238
2330
  if (!gitAvailableForScm) {
2239
2331
  console.warn("[pushpals] Git is not available to embedded SourceControlManager; skipping SCM startup.");
2332
+ appendRuntimeServicesLogLine(runtimeServicesLogPath, "[pushpals] source_control_manager skipped: git is unavailable in embedded runtime env.");
2240
2333
  } else {
2241
- if (runtimeEnv.PUSHPALS_GIT_BIN) {
2242
- console.log(`[pushpals] Embedded SourceControlManager git=${runtimeEnv.PUSHPALS_GIT_BIN}`);
2243
- }
2334
+ console.log(`[pushpals] Embedded SourceControlManager git=${gitForScm}`);
2244
2335
  console.log("[pushpals] Starting embedded SourceControlManager...");
2245
- const sourceControlManagerService = spawnRuntimeService("source_control_manager", [runtimeBinaries.sourceControlManager, "--skip-clean-check"], opts.repoRoot, runtimeEnv, logPathFor("source_control_manager"));
2336
+ const sourceControlManagerService = spawnRuntimeService("source_control_manager", [runtimeBinaries.sourceControlManager, "--skip-clean-check"], opts.repoRoot, runtimeEnv, serviceLogPaths.source_control_manager, runtimeServicesLogPath);
2246
2337
  services.push(sourceControlManagerService);
2247
2338
  console.log(`[pushpals] source_control_manager log: ${sourceControlManagerService.logPath}`);
2248
2339
  }
2249
2340
  } else if (!scmRemoteAvailable) {
2250
2341
  console.log(`[pushpals] Repo has no git remote "${opts.sourceControlManagerRemote}"; skipping embedded SourceControlManager.`);
2342
+ appendRuntimeServicesLogLine(runtimeServicesLogPath, `[pushpals] source_control_manager skipped: repo has no remote "${opts.sourceControlManagerRemote}".`);
2251
2343
  } else if (!gitAvailableForScm) {
2252
2344
  console.warn("[pushpals] Git is not available to embedded SourceControlManager; skipping SCM startup.");
2345
+ appendRuntimeServicesLogLine(runtimeServicesLogPath, "[pushpals] source_control_manager skipped: git is unavailable in embedded runtime env.");
2253
2346
  } else {
2254
2347
  console.log("[pushpals] SourceControlManager already healthy; skipping embedded start.");
2348
+ appendRuntimeServicesLogLine(runtimeServicesLogPath, "[pushpals] source_control_manager already healthy; embedded start skipped.");
2255
2349
  }
2256
2350
  const deadline = Date.now() + DEFAULT_RUNTIME_BOOT_TIMEOUT_MS;
2257
2351
  while (Date.now() < deadline) {
2352
+ reportRemoteBuddyAutonomousEngineState();
2258
2353
  for (let i = services.length - 1;i >= 0; i--) {
2259
2354
  const service = services[i];
2260
2355
  if (service.exited) {
2261
2356
  if (isOptionalEmbeddedService(service.name)) {
2262
2357
  console.warn(`[pushpals] Embedded ${service.name} exited during startup (code=${service.exitCode ?? "unknown"}); continuing without SCM.`);
2358
+ appendRuntimeServicesLogLine(runtimeServicesLogPath, `[pushpals] embedded ${service.name} exited during startup (code=${service.exitCode ?? "unknown"}); continuing.`);
2263
2359
  const tail2 = readLogTail(service.logPath);
2264
2360
  if (tail2) {
2265
2361
  console.warn(`[pushpals] ${service.name} log tail:
2362
+ ${tail2}`);
2363
+ appendRuntimeServicesLogLine(runtimeServicesLogPath, `[pushpals] ${service.name} log tail:
2266
2364
  ${tail2}`);
2267
2365
  }
2268
2366
  services.splice(i, 1);
2269
2367
  continue;
2270
2368
  }
2271
2369
  const tail = readLogTail(service.logPath);
2370
+ appendRuntimeServicesLogLine(runtimeServicesLogPath, `[pushpals] embedded ${service.name} exited during startup (code=${service.exitCode ?? "unknown"}).`);
2272
2371
  stopRuntimeServices(services);
2273
2372
  throw new Error(`Embedded ${service.name} exited during startup (code=${service.exitCode ?? "unknown"}). ` + `See ${service.logPath}${tail ? `
2274
2373
  --- ${service.name} log tail ---
@@ -2278,8 +2377,10 @@ ${tail}` : ""}`);
2278
2377
  const health = localBuddyEnabled ? await probeLocalBuddy(opts.localAgentUrl) : null;
2279
2378
  const remoteBuddyHealth2 = await probeRemoteBuddySessionConsumer(opts.serverUrl, opts.sessionId);
2280
2379
  if ((!localBuddyEnabled || health?.ok) && remoteBuddyHealth2.ok) {
2380
+ reportRemoteBuddyAutonomousEngineState();
2281
2381
  const stabilityDeadline = Date.now() + DEFAULT_SERVICE_STABILITY_GRACE_MS;
2282
2382
  while (Date.now() < stabilityDeadline) {
2383
+ reportRemoteBuddyAutonomousEngineState();
2283
2384
  for (let i = services.length - 1;i >= 0; i--) {
2284
2385
  const service = services[i];
2285
2386
  if (!service.exited)
@@ -2287,14 +2388,18 @@ ${tail}` : ""}`);
2287
2388
  if (isOptionalEmbeddedService(service.name)) {
2288
2389
  const tail2 = readLogTail(service.logPath);
2289
2390
  console.warn(`[pushpals] Embedded ${service.name} exited immediately after bootstrap (code=${service.exitCode ?? "unknown"}); continuing without SCM.`);
2391
+ appendRuntimeServicesLogLine(runtimeServicesLogPath, `[pushpals] embedded ${service.name} exited immediately after bootstrap (code=${service.exitCode ?? "unknown"}); continuing.`);
2290
2392
  if (tail2) {
2291
2393
  console.warn(`[pushpals] ${service.name} log tail:
2394
+ ${tail2}`);
2395
+ appendRuntimeServicesLogLine(runtimeServicesLogPath, `[pushpals] ${service.name} log tail:
2292
2396
  ${tail2}`);
2293
2397
  }
2294
2398
  services.splice(i, 1);
2295
2399
  continue;
2296
2400
  }
2297
2401
  const tail = readLogTail(service.logPath);
2402
+ appendRuntimeServicesLogLine(runtimeServicesLogPath, `[pushpals] embedded ${service.name} exited immediately after bootstrap (code=${service.exitCode ?? "unknown"}).`);
2298
2403
  stopRuntimeServices(services);
2299
2404
  throw new Error(`Embedded ${service.name} exited immediately after bootstrap (code=${service.exitCode ?? "unknown"}). ` + `See ${service.logPath}${tail ? `
2300
2405
  --- ${service.name} log tail ---
@@ -2303,6 +2408,7 @@ ${tail}` : ""}`);
2303
2408
  await Bun.sleep(250);
2304
2409
  }
2305
2410
  console.log("[pushpals] Embedded runtime is ready.");
2411
+ appendRuntimeServicesLogLine(runtimeServicesLogPath, "[pushpals] embedded runtime is ready.");
2306
2412
  return services;
2307
2413
  }
2308
2414
  await Bun.sleep(DEFAULT_RUNTIME_BOOT_POLL_MS);
@@ -2310,11 +2416,14 @@ ${tail}` : ""}`);
2310
2416
  stopRuntimeServices(services);
2311
2417
  const remoteBuddyHealth = await probeRemoteBuddySessionConsumer(opts.serverUrl, opts.sessionId);
2312
2418
  if (!localBuddyEnabled && !remoteBuddyHealth.ok) {
2419
+ appendRuntimeServicesLogLine(runtimeServicesLogPath, `[pushpals] timed out waiting for RemoteBuddy session consumer readiness after ${DEFAULT_RUNTIME_BOOT_TIMEOUT_MS}ms (${remoteBuddyHealth.detail}).`);
2313
2420
  throw new Error(`Timed out waiting for RemoteBuddy session consumer readiness after ${DEFAULT_RUNTIME_BOOT_TIMEOUT_MS}ms (${remoteBuddyHealth.detail})`);
2314
2421
  }
2315
2422
  if (!localBuddyEnabled) {
2423
+ appendRuntimeServicesLogLine(runtimeServicesLogPath, `[pushpals] timed out waiting for embedded runtime readiness after ${DEFAULT_RUNTIME_BOOT_TIMEOUT_MS}ms.`);
2316
2424
  throw new Error(`Timed out waiting for embedded runtime readiness after ${DEFAULT_RUNTIME_BOOT_TIMEOUT_MS}ms`);
2317
2425
  }
2426
+ appendRuntimeServicesLogLine(runtimeServicesLogPath, `[pushpals] timed out waiting for LocalBuddy at ${opts.localAgentUrl} and RemoteBuddy session consumer after ${DEFAULT_RUNTIME_BOOT_TIMEOUT_MS}ms.`);
2318
2427
  throw new Error(`Timed out waiting for LocalBuddy at ${opts.localAgentUrl} and RemoteBuddy session consumer after ${DEFAULT_RUNTIME_BOOT_TIMEOUT_MS}ms`);
2319
2428
  }
2320
2429
  function readCliState(pathValue) {
@@ -2859,6 +2968,11 @@ async function main() {
2859
2968
  process.exit(1);
2860
2969
  }
2861
2970
  const config = preparedRuntime.runtimePreflight.config;
2971
+ if (config.remotebuddy.autonomy.enabled) {
2972
+ console.log("[pushpals] RemoteBuddy autonomy is enabled for CLI.");
2973
+ } else {
2974
+ console.warn("[pushpals] RemoteBuddy autonomy is disabled in config (remotebuddy.autonomy.enabled=false); continuing.");
2975
+ }
2862
2976
  const serverUrl = normalizeLoopbackUrl(parsed.serverUrl ?? process.env.PUSHPALS_SERVER_URL, config.server.url);
2863
2977
  const localAgentUrl = normalizeLoopbackUrl(parsed.localAgentUrl ?? process.env.EXPO_PUBLIC_LOCAL_AGENT_URL, config.client.localAgentUrl);
2864
2978
  const sessionId = String(parsed.sessionId ?? process.env.PUSHPALS_SESSION_ID ?? config.sessionId).trim();
@@ -3135,8 +3249,10 @@ export {
3135
3249
  formatTimestampedCliLine,
3136
3250
  formatSessionEventLine,
3137
3251
  extractRemoteBuddySessionConsumerHealth,
3252
+ extractRemoteBuddyAutonomousEngineState,
3138
3253
  bundledMonitoringHubNeedsRefresh,
3139
3254
  buildServiceStopCommand,
3255
+ buildRuntimeServiceLogPaths,
3140
3256
  buildOpenMonitoringHubCommand,
3141
3257
  buildEmbeddedRuntimeEnv,
3142
3258
  buildEmbeddedMonitoringHubHtml,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushpalsdev/cli",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "description": "PushPals terminal CLI for LocalBuddy -> RemoteBuddy orchestration",
5
5
  "license": "MIT",
6
6
  "repository": {