@alook/daemon 0.1.7 → 0.1.8

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/cli/index.js +31 -3
  2. package/package.json +1 -1
package/dist/cli/index.js CHANGED
@@ -28057,6 +28057,17 @@ async function daemonResume(opts) {
28057
28057
  resumeRequestId: opts.requestId
28058
28058
  });
28059
28059
  }
28060
+ async function daemonStartById(opts) {
28061
+ const baseDir = opts.baseDir || process.env.ALOOK_DATA_DIR || DEFAULT_BASE_DIR;
28062
+ const record2 = readDaemonLaunchRecord(baseDir, opts.id);
28063
+ await daemonStart({
28064
+ machineKey: record2.credential,
28065
+ serverUrl: record2.serverUrl,
28066
+ wsUrl: record2.wsUrl,
28067
+ baseDir,
28068
+ foreground: opts.foreground
28069
+ });
28070
+ }
28060
28071
  function runnerArguments() {
28061
28072
  const command = process.env.ALOOK_DAEMON_PACKAGE_WRAPPER === "1" ? ["run"] : ["daemon", "run"];
28062
28073
  return [...process.execArgv, process.argv[1], ...command];
@@ -28951,10 +28962,23 @@ function buildProgram() {
28951
28962
  });
28952
28963
  const daemon = program.command("daemon").description("daemon operations").exitOverride();
28953
28964
  daemon.configureOutput({ writeOut: () => {}, writeErr: () => {} });
28954
- daemon.command("start").description("start the daemon (connects to server, manages agent lifecycles)").requiredOption("--machine-key <key>", "machine key for server authentication").option("--server-url <url>", "server HTTP URL (or ALOOK_SERVER_URL env)").option("--ws-url <url>", "server WebSocket URL (or ALOOK_SERVER_WS_URL env)").option("--base-dir <path>", "data directory for agent workspaces and pidfile (or ALOOK_DATA_DIR env)").option("--foreground", "run in the current process and tee daemon logs to the terminal").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).action(async function() {
28965
+ daemon.command("start").description("start the daemon (connects to server, manages agent lifecycles)").option("--machine-key <key>", "machine key for first-time pairing").option("--id <machineId>", "restart a previously paired machine by id").option("--server-url <url>", "server HTTP URL (or ALOOK_SERVER_URL env)").option("--ws-url <url>", "server WebSocket URL (or ALOOK_SERVER_WS_URL env)").option("--base-dir <path>", "data directory for agent workspaces and pidfile (or ALOOK_DATA_DIR env)").option("--foreground", "run in the current process and tee daemon logs to the terminal").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).action(async function() {
28955
28966
  const localOpts = this.opts();
28967
+ const machineKey = localOpts.machineKey;
28968
+ const id = localOpts.id;
28969
+ if (!machineKey && !id || machineKey && id) {
28970
+ throw new CliError("daemon start requires exactly one of --machine-key <key> or --id <machineId>");
28971
+ }
28972
+ if (id) {
28973
+ await daemonStartById({
28974
+ id,
28975
+ baseDir: localOpts.baseDir,
28976
+ foreground: localOpts.foreground === true
28977
+ });
28978
+ return;
28979
+ }
28956
28980
  await daemonStart({
28957
- machineKey: localOpts.machineKey,
28981
+ machineKey,
28958
28982
  serverUrl: localOpts.serverUrl,
28959
28983
  wsUrl: localOpts.wsUrl,
28960
28984
  baseDir: localOpts.baseDir,
@@ -28987,9 +29011,13 @@ function buildProgram() {
28987
29011
  baseDir: localOpts.baseDir
28988
29012
  });
28989
29013
  });
28990
- daemon.command("list").description("list running daemons on this machine").option("--base-dir <path>", "data directory (or ALOOK_DATA_DIR env)").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).action(function() {
29014
+ daemon.command("list").description("list running daemons on this machine").option("--base-dir <path>", "data directory (or ALOOK_DATA_DIR env)").option("--json", "print a machine-readable JSON envelope").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).action(function() {
28991
29015
  const localOpts = this.opts();
28992
29016
  const daemons = daemonList({ baseDir: localOpts.baseDir });
29017
+ if (localOpts.json === true) {
29018
+ printEnvelope({ success: { daemons } });
29019
+ return;
29020
+ }
28993
29021
  process.stdout.write(renderDaemonList(daemons) + `
28994
29022
  `);
28995
29023
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alook/daemon",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Alook agent daemon — host-side runtime backend, process manager, credential proxy, and control plane.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/alookai/alook#readme",