@agentchatme/agent-core 0.0.1313111111 → 0.0.13131111111

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.
@@ -10,7 +10,7 @@ import {
10
10
  idle,
11
11
  log,
12
12
  resolveIdentity
13
- } from "./chunk-7T7SRWWC.js";
13
+ } from "./chunk-VIUTA6W2.js";
14
14
 
15
15
  // src/daemon/ws-client.ts
16
16
  import { WebSocket } from "ws";
package/dist/index.d.ts CHANGED
@@ -4,13 +4,13 @@ import { spawn, spawnSync } from 'node:child_process';
4
4
  /** Low-cardinality identity attached to every coding-agent API operation. */
5
5
  declare const CODING_AGENTS_CLIENT_IDENTITY: {
6
6
  readonly name: "coding_agents";
7
- readonly version: "0.0.1313111111";
7
+ readonly version: "0.0.13131111111";
8
8
  };
9
9
  /** Headers for raw HTTP and WebSocket transports that bypass the SDK. */
10
10
  declare const CODING_AGENTS_CLIENT_HEADERS: Readonly<Record<string, string>>;
11
11
 
12
12
  /** Published package version, kept in lockstep with package.json by tests. */
13
- declare const VERSION = "0.0.1313111111";
13
+ declare const VERSION = "0.0.13131111111";
14
14
 
15
15
  declare const SyncRowSchema: z.ZodObject<{
16
16
  id: z.ZodString;
package/dist/index.js CHANGED
@@ -49,7 +49,7 @@ import {
49
49
  syncPeek,
50
50
  writeCredentials,
51
51
  writePending
52
- } from "./chunk-7T7SRWWC.js";
52
+ } from "./chunk-VIUTA6W2.js";
53
53
 
54
54
  // src/identity/state.ts
55
55
  var SESSION_TTL_MS = 48 * 60 * 60 * 1e3;
@@ -1456,12 +1456,45 @@ function serviceLabel(value) {
1456
1456
  }
1457
1457
  return value;
1458
1458
  }
1459
+ function transientPathEntry(value) {
1460
+ const normalized = value.replace(/\\/g, "/");
1461
+ return /\/node_modules\/\.bin\/?$/i.test(normalized) || /\/node_modules\/npm\/node_modules\/@npmcli\/run-script\/lib\/node-gyp-bin\/?$/i.test(normalized) || /\/\.[^/]+\/tmp\//i.test(normalized);
1462
+ }
1463
+ function stableServicePath(value, nodePath = process.execPath) {
1464
+ const entries = [path2.dirname(nodePath), ...value.split(path2.delimiter)];
1465
+ const seen = /* @__PURE__ */ new Set();
1466
+ const stable = [];
1467
+ for (const raw of entries) {
1468
+ const trimmed = raw.trim();
1469
+ if (!trimmed || transientPathEntry(trimmed)) continue;
1470
+ let resolved = trimmed;
1471
+ try {
1472
+ resolved = fs2.realpathSync(trimmed);
1473
+ } catch {
1474
+ }
1475
+ const key = process.platform === "win32" ? resolved.toLowerCase() : resolved;
1476
+ if (seen.has(key)) continue;
1477
+ seen.add(key);
1478
+ stable.push(resolved);
1479
+ }
1480
+ return stable.join(path2.delimiter);
1481
+ }
1459
1482
  function plan(opts) {
1460
1483
  const env = {};
1461
- if (process.env["PATH"]) env["PATH"] = serviceValue("environment value", process.env["PATH"]);
1484
+ if (process.env["PATH"]) {
1485
+ env["PATH"] = serviceValue(
1486
+ "environment value",
1487
+ stableServicePath(process.env["PATH"])
1488
+ );
1489
+ }
1462
1490
  for (const [k, v] of Object.entries(opts.env ?? {})) {
1463
1491
  if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(k)) throw new Error(`invalid service environment key: ${k}`);
1464
- if (typeof v === "string" && v.length > 0) env[k] = serviceValue("environment value", v);
1492
+ if (typeof v === "string" && v.length > 0) {
1493
+ env[k] = serviceValue(
1494
+ "environment value",
1495
+ k === "PATH" ? stableServicePath(v) : v
1496
+ );
1497
+ }
1465
1498
  }
1466
1499
  return {
1467
1500
  label: serviceLabel(opts.label),
@@ -1616,8 +1649,11 @@ function uninstallLaunchd(label) {
1616
1649
  log.info(`service ${launchdLabel(label)} removed`);
1617
1650
  }
1618
1651
  function statusLaunchd(label) {
1619
- const r = run("launchctl", ["list", launchdLabel(label)]);
1620
- return `launchd ${launchdLabel(label)}: ${r.ok ? "loaded" : "not loaded"}`;
1652
+ const fullLabel = launchdLabel(label);
1653
+ const uid = typeof process.getuid === "function" ? process.getuid() : os.userInfo().uid;
1654
+ const modern = run("launchctl", ["print", `gui/${uid}/${fullLabel}`]);
1655
+ const loaded = modern.ok || run("launchctl", ["list", fullLabel]).ok;
1656
+ return `launchd ${fullLabel}: ${loaded ? "loaded" : "not loaded"}`;
1621
1657
  }
1622
1658
  function isWslFromVersion(version) {
1623
1659
  return /microsoft|wsl/i.test(version);