@agent-dock/cli 0.3.0 → 0.3.1

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/dist/cli.js CHANGED
@@ -40,6 +40,8 @@ function writeLastDaemonDir(dir, home = process.env.HOME ?? homedir()) {
40
40
  `, "utf8");
41
41
  }
42
42
  function resolveDaemonDir(cwd = process.cwd(), home = process.env.HOME ?? homedir()) {
43
+ const pinnedDir = process.env[DAEMON_DIR_ENV]?.trim();
44
+ if (pinnedDir && existsSync(pinnedDir)) return pinnedDir;
43
45
  const localDir = defaultDaemonDir(cwd);
44
46
  if (isDaemonRunning(localDir)) return localDir;
45
47
  const lastDir = readLastDaemonDir(home);
@@ -112,7 +114,8 @@ function childMeta(env = process.env) {
112
114
  }
113
115
  function daemonize(options = {}) {
114
116
  const cwd = options.cwd ?? process.cwd();
115
- const logFile = daemonPaths(cwd ? join(cwd, ".agentdock", "daemon") : defaultDaemonDir()).logFile;
117
+ const daemonDir = cwd ? join(cwd, ".agentdock", "daemon") : defaultDaemonDir();
118
+ const logFile = daemonPaths(daemonDir).logFile;
116
119
  const startOffset = fileSizeOrZero(logFile);
117
120
  const fd = openLogFd(logFile);
118
121
  const entrypoint = process.argv[1];
@@ -125,7 +128,8 @@ function daemonize(options = {}) {
125
128
  ...options.env ?? process.env,
126
129
  [DAEMON_ENV_FLAG]: "1",
127
130
  [DAEMON_CWD_ENV]: cwd,
128
- [DAEMON_STARTED_AT_ENV]: options.startedAt ?? (/* @__PURE__ */ new Date()).toISOString()
131
+ [DAEMON_STARTED_AT_ENV]: options.startedAt ?? (/* @__PURE__ */ new Date()).toISOString(),
132
+ [DAEMON_DIR_ENV]: daemonDir
129
133
  }
130
134
  });
131
135
  child.unref();
@@ -142,13 +146,14 @@ function openLogFd(file) {
142
146
  mkdirSync(dirname(file), { recursive: true });
143
147
  return openSync(file, "a");
144
148
  }
145
- var DAEMON_ENV_FLAG, DAEMON_CWD_ENV, DAEMON_STARTED_AT_ENV, PID_FILE, STATE_FILE, LOG_FILE;
149
+ var DAEMON_ENV_FLAG, DAEMON_CWD_ENV, DAEMON_STARTED_AT_ENV, DAEMON_DIR_ENV, PID_FILE, STATE_FILE, LOG_FILE;
146
150
  var init_daemon = __esm({
147
151
  "src/daemon/daemon.ts"() {
148
152
  "use strict";
149
153
  DAEMON_ENV_FLAG = "AGENTDOCK_DAEMONIZED";
150
154
  DAEMON_CWD_ENV = "AGENTDOCK_DAEMON_CWD";
151
155
  DAEMON_STARTED_AT_ENV = "AGENTDOCK_DAEMON_STARTED_AT";
156
+ DAEMON_DIR_ENV = "AGENTDOCK_DAEMON_DIR";
152
157
  PID_FILE = "agentdock.pid";
153
158
  STATE_FILE = "agentdock.state.json";
154
159
  LOG_FILE = "agentdock.log";
@@ -27329,7 +27334,7 @@ function sandboxEnv(sandbox, base = process.env) {
27329
27334
  const env = { ...base, HOME: sandbox.home, AGENTDOCK_DISABLE_LARK_LISTENER: "true", AGENTDOCK_WEB_AUTH: "off", agentdock_database: sandbox.database };
27330
27335
  env.PATH = [shimDir(sandbox), base.PATH].filter(Boolean).join(delimiter);
27331
27336
  for (const key of ["agentdock_session_id", "agentdock_group_tools_url", "agentdock_group_tools_token"]) delete env[key];
27332
- for (const key of [DAEMON_ENV_FLAG, DAEMON_CWD_ENV, DAEMON_STARTED_AT_ENV]) delete env[key];
27337
+ for (const key of [DAEMON_ENV_FLAG, DAEMON_CWD_ENV, DAEMON_STARTED_AT_ENV, DAEMON_DIR_ENV]) delete env[key];
27333
27338
  return env;
27334
27339
  }
27335
27340
  var shellQuote5 = (value) => `'${value.replace(/'/g, `'\\''`)}'`;