alink-cli 0.9.1 → 0.10.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/daemon.js CHANGED
@@ -23527,7 +23527,7 @@ import {
23527
23527
  import { homedir as homedir5 } from "node:os";
23528
23528
  import { basename, join as join5 } from "node:path";
23529
23529
 
23530
- // ../../node_modules/.pnpm/@agentlink+core@file+packages+core_ai@7.0.52_zod@4.4.3_/node_modules/@agentlink/core/src/session-archive.ts
23530
+ // ../../node_modules/.pnpm/@agentlink+core@file+packages+core/node_modules/@agentlink/core/src/session-archive.ts
23531
23531
  function resultText(content) {
23532
23532
  if (typeof content === "string") return content;
23533
23533
  if (Array.isArray(content)) {
package/dist/ui.js CHANGED
@@ -48133,6 +48133,11 @@ var STATE_DIR = process.env.AGENTLINK_STATE_DIR || join(homedir(), ".agentlink")
48133
48133
  var CREDENTIAL_FILE = join(STATE_DIR, "credential");
48134
48134
  var PID_FILE = join(STATE_DIR, "daemon.pid");
48135
48135
  var STATUS_FILE = join(STATE_DIR, "status.json");
48136
+ var DAEMON_LOCK_FILE = join(
48137
+ resolve(process.env.T3CODE_HOME || join(homedir(), ".t3")),
48138
+ "userdata",
48139
+ "daemon.lock"
48140
+ );
48136
48141
  function normalizeHub(hub) {
48137
48142
  const url = new URL(hub);
48138
48143
  if (url.protocol === "http:") url.protocol = "ws:";
@@ -48206,26 +48211,32 @@ function isProcessAlive(pid) {
48206
48211
  return false;
48207
48212
  }
48208
48213
  }
48209
- function daemonPid() {
48214
+ function readPid(path) {
48210
48215
  try {
48211
- const raw = readFileSync2(PID_FILE, "utf8").trim();
48212
- const pid = Number(raw);
48216
+ const raw = readFileSync2(path, "utf8").trim();
48217
+ const pid = raw.startsWith("{") ? Number(JSON.parse(raw).pid) : Number(raw);
48213
48218
  return Number.isInteger(pid) && pid > 0 ? pid : void 0;
48214
48219
  } catch {
48215
48220
  return void 0;
48216
48221
  }
48217
48222
  }
48218
- function isDaemonRunning() {
48219
- const pid = daemonPid();
48220
- if (!pid) return false;
48221
- if (!isProcessAlive(pid)) {
48223
+ function discoverDaemonPid(pidFile = PID_FILE, lockFile = DAEMON_LOCK_FILE) {
48224
+ const managedPid = readPid(pidFile);
48225
+ if (managedPid && isProcessAlive(managedPid)) return managedPid;
48226
+ if (managedPid) {
48222
48227
  try {
48223
- rmSync(PID_FILE, { force: true });
48228
+ rmSync(pidFile, { force: true });
48224
48229
  } catch {
48225
48230
  }
48226
- return false;
48227
48231
  }
48228
- return true;
48232
+ const sharedPid = readPid(lockFile);
48233
+ return sharedPid && isProcessAlive(sharedPid) ? sharedPid : void 0;
48234
+ }
48235
+ function daemonPid() {
48236
+ return discoverDaemonPid();
48237
+ }
48238
+ function isDaemonRunning() {
48239
+ return daemonPid() !== void 0;
48229
48240
  }
48230
48241
  function startDaemon(options) {
48231
48242
  if (isDaemonRunning()) {
@@ -48233,7 +48244,7 @@ function startDaemon(options) {
48233
48244
  }
48234
48245
  const { machineToken, enckey } = parseCredential(options.credential);
48235
48246
  const cwd2 = resolve(options.cwd);
48236
- const daemonPath = fileURLToPath(new URL("../dist/bin.mjs", import.meta.url));
48247
+ const daemonPath = options.daemonPath ? resolve(options.daemonPath) : fileURLToPath(new URL("../dist/bin.mjs", import.meta.url));
48237
48248
  if (!existsSync2(daemonPath)) {
48238
48249
  throw new Error(
48239
48250
  `daemon bundle not found: ${daemonPath}
@@ -48247,6 +48258,7 @@ function startDaemon(options) {
48247
48258
  T3CODE_HUB_MACHINE_TOKEN: machineToken,
48248
48259
  T3CODE_HUB_ENCKEY: enckey
48249
48260
  };
48261
+ if (process.versions.electron) env3.ELECTRON_RUN_AS_NODE = "1";
48250
48262
  if (options.approval) env3.AGENTLINK_APPROVAL = "1";
48251
48263
  if (options.approvalRenotifyMin !== void 0) {
48252
48264
  env3.AGENTLINK_APPROVAL_RENOTIFY_MIN = String(options.approvalRenotifyMin);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alink-cli",
3
- "version": "0.9.1",
3
+ "version": "0.10.1",
4
4
  "description": "一条命令把工作机接入 AgentLink,随时随地遥控本机的编码 agent。One command to link your machine to AgentLink and control your coding agents from anywhere.",
5
5
  "keywords": [
6
6
  "acp",
@@ -9,8 +9,7 @@
9
9
  "cli",
10
10
  "codex",
11
11
  "coding-agent",
12
- "remote-control",
13
- "self-hosted"
12
+ "remote-control"
14
13
  ],
15
14
  "homepage": "https://github.com/baichen99/agentlink#readme",
16
15
  "bugs": "https://github.com/baichen99/agentlink/issues",