@phnx-labs/agents-cli 1.22.41 → 1.22.42

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 (167) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +9 -3
  3. package/dist/bin/agents +0 -0
  4. package/dist/cli/command-registry.d.ts +2 -0
  5. package/dist/cli/command-registry.js +4 -0
  6. package/dist/commands/accounts.d.ts +29 -0
  7. package/dist/commands/accounts.js +220 -29
  8. package/dist/commands/alias.js +1 -1
  9. package/dist/commands/auth.d.ts +9 -0
  10. package/dist/commands/auth.js +104 -0
  11. package/dist/commands/browser-sessions-picker.js +42 -62
  12. package/dist/commands/browser.js +30 -38
  13. package/dist/commands/computer-actions.d.ts +1 -1
  14. package/dist/commands/computer-actions.js +1 -1
  15. package/dist/commands/computer-sessions-picker.js +32 -55
  16. package/dist/commands/computer.d.ts +1 -1
  17. package/dist/commands/computer.js +2 -2
  18. package/dist/commands/doctor.d.ts +1 -1
  19. package/dist/commands/doctor.js +3 -3
  20. package/dist/commands/feed.js +1 -1
  21. package/dist/commands/hooks.js +1 -1
  22. package/dist/commands/import.js +1 -1
  23. package/dist/commands/insights.js +163 -85
  24. package/dist/commands/inspect.js +2 -2
  25. package/dist/commands/mine.js +1 -1
  26. package/dist/commands/org.d.ts +6 -0
  27. package/dist/commands/org.js +174 -0
  28. package/dist/commands/packages.js +1 -1
  29. package/dist/commands/prune.js +1 -1
  30. package/dist/commands/routines.js +1 -1
  31. package/dist/commands/run-account-picker.d.ts +19 -0
  32. package/dist/commands/run-account-picker.js +81 -0
  33. package/dist/commands/sessions-picker-factory.d.ts +40 -0
  34. package/dist/commands/sessions-picker-factory.js +67 -0
  35. package/dist/commands/setup-browser.js +4 -4
  36. package/dist/commands/setup-mine.js +1 -1
  37. package/dist/commands/setup-preferences.js +2 -2
  38. package/dist/commands/setup.js +5 -3
  39. package/dist/commands/sync.js +1 -1
  40. package/dist/commands/versions.js +1 -1
  41. package/dist/commands/view.js +1 -1
  42. package/dist/lib/account-capabilities.d.ts +10 -0
  43. package/dist/lib/account-capabilities.js +34 -0
  44. package/dist/lib/agent-spec/agents.d.ts +584 -0
  45. package/dist/lib/agent-spec/agents.js +3127 -0
  46. package/dist/lib/agent-spec/provider.js +1 -1
  47. package/dist/lib/agents.d.ts +2 -584
  48. package/dist/lib/agents.js +2 -3127
  49. package/dist/lib/browser/drivers/local.d.ts +8 -2
  50. package/dist/lib/browser/drivers/local.js +8 -2
  51. package/dist/lib/browser/drivers/ssh.d.ts +8 -2
  52. package/dist/lib/browser/drivers/ssh.js +10 -4
  53. package/dist/lib/browser/hygiene.d.ts +1 -1
  54. package/dist/lib/browser/hygiene.js +5 -1
  55. package/dist/lib/browser/profiles.d.ts +74 -1
  56. package/dist/lib/browser/profiles.js +114 -5
  57. package/dist/lib/browser/runtime-state.d.ts +11 -5
  58. package/dist/lib/browser/runtime-state.js +13 -9
  59. package/dist/lib/browser/service.d.ts +68 -30
  60. package/dist/lib/browser/service.js +305 -194
  61. package/dist/lib/browser/types.d.ts +95 -3
  62. package/dist/lib/browser/types.js +51 -0
  63. package/dist/lib/catchup.js +1 -1
  64. package/dist/lib/computer/actions.d.ts +1 -1
  65. package/dist/lib/computer/actions.js +1 -1
  66. package/dist/lib/{computer-rpc.js → computer/computer-rpc.js} +5 -5
  67. package/dist/lib/computer/dispatch.d.ts +1 -1
  68. package/dist/lib/computer/download.d.ts +1 -1
  69. package/dist/lib/computer/download.js +3 -3
  70. package/dist/lib/{ssh-tunnel.d.ts → computer/ssh-tunnel.d.ts} +1 -1
  71. package/dist/lib/{ssh-tunnel.js → computer/ssh-tunnel.js} +12 -12
  72. package/dist/lib/daemon/daemon.js +1 -1
  73. package/dist/lib/{runner.d.ts → daemon/runner.d.ts} +10 -10
  74. package/dist/lib/{runner.js → daemon/runner.js} +40 -114
  75. package/dist/lib/devices/doctor-findings.d.ts +1 -1
  76. package/dist/lib/devices/doctor-findings.js +3 -3
  77. package/dist/lib/devices/fleet-inventory.js +1 -1
  78. package/dist/lib/devices/harness-inventory.js +1 -1
  79. package/dist/lib/devices/registry.js +4 -22
  80. package/dist/lib/doctor-diff.d.ts +1 -1
  81. package/dist/lib/doctor-diff.js +1 -1
  82. package/dist/lib/drift.js +1 -1
  83. package/dist/lib/entitlement.d.ts +31 -0
  84. package/dist/lib/entitlement.js +137 -0
  85. package/dist/lib/exec.js +39 -202
  86. package/dist/lib/feed/feed.js +2 -8
  87. package/dist/lib/fs-atomic.d.ts +7 -0
  88. package/dist/lib/fs-atomic.js +9 -0
  89. package/dist/lib/harness/adapter.d.ts +160 -0
  90. package/dist/lib/harness/adapter.js +47 -0
  91. package/dist/lib/harness/adapters/claude.d.ts +2 -0
  92. package/dist/lib/harness/adapters/claude.js +110 -0
  93. package/dist/lib/harness/adapters/codex.d.ts +2 -0
  94. package/dist/lib/harness/adapters/codex.js +83 -0
  95. package/dist/lib/harness/adapters/copilot.d.ts +2 -0
  96. package/dist/lib/harness/adapters/copilot.js +23 -0
  97. package/dist/lib/harness/adapters/cursor.d.ts +2 -0
  98. package/dist/lib/harness/adapters/cursor.js +38 -0
  99. package/dist/lib/harness/adapters/droid.d.ts +2 -0
  100. package/dist/lib/harness/adapters/droid.js +17 -0
  101. package/dist/lib/harness/adapters/grok.d.ts +2 -0
  102. package/dist/lib/harness/adapters/grok.js +14 -0
  103. package/dist/lib/harness/adapters/kimi.d.ts +2 -0
  104. package/dist/lib/harness/adapters/kimi.js +49 -0
  105. package/dist/lib/harness/adapters/muse.d.ts +2 -0
  106. package/dist/lib/harness/adapters/muse.js +44 -0
  107. package/dist/lib/harness/adapters/opencode.d.ts +2 -0
  108. package/dist/lib/harness/adapters/opencode.js +14 -0
  109. package/dist/lib/harness/exec-config-version.d.ts +8 -0
  110. package/dist/lib/harness/exec-config-version.js +22 -0
  111. package/dist/lib/harness/index.d.ts +1 -0
  112. package/dist/lib/harness/index.js +34 -0
  113. package/dist/lib/{hooks.d.ts → hooks/install.d.ts} +1 -1
  114. package/dist/lib/{hooks.js → hooks/install.js} +11 -11
  115. package/dist/lib/import.js +1 -1
  116. package/dist/lib/installations/index.d.ts +4 -4
  117. package/dist/lib/installations/index.js +3 -4
  118. package/dist/lib/installations/migrate.js +6 -6
  119. package/dist/lib/{shims.d.ts → installations/shims.d.ts} +2 -2
  120. package/dist/lib/{shims.js → installations/shims.js} +12 -114
  121. package/dist/lib/installations/store.d.ts +141 -3
  122. package/dist/lib/installations/store.js +475 -5
  123. package/dist/lib/installations/versions.d.ts +1 -126
  124. package/dist/lib/installations/versions.js +5 -465
  125. package/dist/lib/isolation-boundary-report.d.ts +1 -1
  126. package/dist/lib/isolation-boundary-report.js +1 -1
  127. package/dist/lib/mailbox-gc.js +2 -3
  128. package/dist/lib/menubar/MenubarHelper.app/Contents/CodeResources +0 -0
  129. package/dist/lib/menubar/MenubarHelper.app/Contents/MacOS/MenubarHelper +0 -0
  130. package/dist/lib/monitors/dispatch.d.ts +1 -1
  131. package/dist/lib/monitors/dispatch.js +2 -2
  132. package/dist/lib/monitors/state.d.ts +1 -1
  133. package/dist/lib/plugins/plugins.js +1 -1
  134. package/dist/lib/plugins/skills.js +1 -1
  135. package/dist/lib/prix-account.d.ts +158 -0
  136. package/dist/lib/prix-account.js +214 -0
  137. package/dist/lib/project-key.js +2 -2
  138. package/dist/lib/project-launch.js +1 -1
  139. package/dist/lib/refresh.js +2 -2
  140. package/dist/lib/resource-inventory.d.ts +1 -1
  141. package/dist/lib/resource-inventory.js +1 -1
  142. package/dist/lib/rules/rules.js +1 -1
  143. package/dist/lib/scheduling/routines.js +1 -1
  144. package/dist/lib/secrets/Agents CLI.app/Contents/CodeResources +0 -0
  145. package/dist/lib/secrets/Agents CLI.app/Contents/MacOS/Agents CLI +0 -0
  146. package/dist/lib/self-heal/checks/hook-runtime.js +1 -1
  147. package/dist/lib/self-heal/checks/path.js +1 -1
  148. package/dist/lib/self-heal/checks/shadowing.js +1 -1
  149. package/dist/lib/self-heal/checks/shims.js +1 -1
  150. package/dist/lib/session/discover.d.ts +39 -0
  151. package/dist/lib/session/discover.js +3 -3
  152. package/dist/lib/session/parse.js +24 -42
  153. package/dist/lib/session/recovery.js +1 -1
  154. package/dist/lib/staleness/prune.d.ts +1 -1
  155. package/dist/lib/staleness/prune.js +1 -1
  156. package/dist/lib/staleness/writers/hooks.js +1 -1
  157. package/dist/lib/startup/command-registry.js +1 -1
  158. package/dist/lib/teams/agents.js +2 -19
  159. package/dist/lib/teams/parsers.js +20 -26
  160. package/dist/lib/teams/registry.js +2 -21
  161. package/dist/lib/triggers/handlers.js +1 -1
  162. package/dist/lib/triggers/webhook.js +1 -1
  163. package/dist/lib/uninstall.js +1 -1
  164. package/dist/lib/version.d.ts +9 -2
  165. package/dist/lib/version.js +11 -9
  166. package/package.json +1 -1
  167. /package/dist/lib/{computer-rpc.d.ts → computer/computer-rpc.d.ts} +0 -0
@@ -5,7 +5,7 @@ import { isSelfHost } from '../devices/self-host.js';
5
5
  import { nativeResume } from '../exec.js';
6
6
  import { machineId, normalizeHost } from '../machine-id.js';
7
7
  import { collectRunCandidates, formatNoHealthyAccountError, pickBalancedCandidate, readinessFromCandidate, } from '../accounting/rotate.js';
8
- import { getVersionHomePath } from '../installations/versions.js';
8
+ import { getVersionHomePath } from '../installations/store.js';
9
9
  export class SessionRecoveryError extends Error {
10
10
  constructor(message) {
11
11
  super(message);
@@ -42,7 +42,7 @@ import type { SyncManifest } from './types.js';
42
42
  * - hooks — a version-home hook script is coupled to a settings.json /
43
43
  * hooks.json REGISTRATION. Pruning the last hook to zero would delete the
44
44
  * script but must also GC its registration in the same pass, and that lands
45
- * in `src/lib/hooks.ts` — a Windows-portable-path surface the CI windows leg
45
+ * in `src/lib/hooks/install.ts` — a Windows-portable-path surface the CI windows leg
46
46
  * gates on. Split to RUSH-2456 so this PR stays Linux-only-green; hook FILES
47
47
  * are still reconciled by the in-write orphan sweep (versions.ts, gated on
48
48
  * `hooksToSync > 0`).
@@ -5,7 +5,7 @@ import { getWriter, getDetector } from './registry.js';
5
5
  * - hooks — a version-home hook script is coupled to a settings.json /
6
6
  * hooks.json REGISTRATION. Pruning the last hook to zero would delete the
7
7
  * script but must also GC its registration in the same pass, and that lands
8
- * in `src/lib/hooks.ts` — a Windows-portable-path surface the CI windows leg
8
+ * in `src/lib/hooks/install.ts` — a Windows-portable-path surface the CI windows leg
9
9
  * gates on. Split to RUSH-2456 so this PR stays Linux-only-green; hook FILES
10
10
  * are still reconciled by the in-write orphan sweep (versions.ts, gated on
11
11
  * `hooksToSync > 0`).
@@ -9,7 +9,7 @@ import { agentConfigDirName } from '../../agents.js';
9
9
  import * as path from 'path';
10
10
  import { capableAgents } from '../../capabilities.js';
11
11
  import { safeJoin } from '../../paths.js';
12
- import { registerHooksToSettings } from '../../hooks.js';
12
+ import { registerHooksToSettings } from '../../hooks/install.js';
13
13
  import { resolveHookSource } from './sources.js';
14
14
  import { lazyAgentMap } from './lazy-map.js';
15
15
  function removePath(target) {
@@ -1,5 +1,5 @@
1
1
  const LOADED_COMMAND_NAMES = [
2
- 'accounts', 'view', 'inspect', 'feedback', 'commands', 'hooks', 'skills', 'rules', 'memory',
2
+ 'accounts', 'auth', 'org', 'view', 'inspect', 'feedback', 'commands', 'hooks', 'skills', 'rules', 'memory',
3
3
  'permissions', 'mcp', 'clis', 'subagents', 'plugins', 'workflows', 'add', 'use', 'list',
4
4
  'remove', 'rm', 'purge', 'update', 'prune', 'import', 'registry', 'search', 'install',
5
5
  'routines', 'monitors', 'projects', 'run', 'open', 'reconnect', 'fork', 'config',
@@ -34,6 +34,7 @@ import { resolveRemoteOsSync } from '../hosts/remote-os.js';
34
34
  import { pullRemoteLogDelta, REMOTE_MIRROR_MAX_BYTES } from '../hosts/progress.js';
35
35
  import { createRemoteWorktree, ensureRemoteRepo } from './remoteWorktree.js';
36
36
  import { getTeam, isTeamDisbanded } from './registry.js';
37
+ import { atomicWriteJsonSync } from '../fs-atomic.js';
37
38
  import { resolvePlacement, classifyExclusions, NoViableDeviceError } from './scheduler.js';
38
39
  import { probePoolSignals } from './placement-probe.js';
39
40
  import { readMaxConcurrentCaps } from '../device-config.js';
@@ -321,24 +322,6 @@ function extractTimestamp(raw) {
321
322
  }
322
323
  return null;
323
324
  }
324
- /**
325
- * Atomic JSON write: writes to a unique sibling tmp file then renames over the
326
- * target. rename(2) is atomic on POSIX, so a process killed mid-write leaves
327
- * either the previous valid meta.json or the new one, never a torn,
328
- * unparseable file (RUSH-2429). Mirrors the identical pattern already used by
329
- * `teams/registry.ts`'s `atomicWriteJson`.
330
- */
331
- async function atomicWriteJson(p, data) {
332
- const tmp = `${p}.tmp.${process.pid}.${randomUUID()}`;
333
- await fs.writeFile(tmp, JSON.stringify(data, null, 2));
334
- try {
335
- await fs.rename(tmp, p);
336
- }
337
- catch (err) {
338
- await fs.unlink(tmp).catch(() => { });
339
- throw err;
340
- }
341
- }
342
325
  /** Resolve a mode string to a validated Mode, falling back to the given default. */
343
326
  export function resolveMode(requestedMode, defaultMode = 'plan') {
344
327
  const normalizedDefault = normalizeModeValue(defaultMode);
@@ -1011,7 +994,7 @@ export class AgentProcess {
1011
994
  remote_log_offset: this.remoteLogOffset,
1012
995
  };
1013
996
  const metaPath = await this.getMetaPath();
1014
- await atomicWriteJson(metaPath, meta);
997
+ atomicWriteJsonSync(metaPath, meta);
1015
998
  }
1016
999
  /**
1017
1000
  * Rename an unreadable meta.json out of the way so it stops silently
@@ -9,34 +9,28 @@
9
9
  import { extractFileOpsFromBash } from './file_ops.js';
10
10
  const claudeToolUseMap = new Map();
11
11
  const droidToolUseMap = new Map();
12
+ /**
13
+ * Registry-dispatch table: each teams `AgentType` to its live team-event
14
+ * normalizer. Replaces the per-type name-chain — the harness axis of Move 3.
15
+ * warp (and any unlisted type) is absent, so it falls through to the generic
16
+ * unknown-event shape below, exactly as the old `else` did.
17
+ */
18
+ const TEAM_EVENT_NORMALIZERS = {
19
+ codex: normalizeCodex,
20
+ cursor: normalizeCursor,
21
+ gemini: normalizeGemini,
22
+ claude: normalizeClaude,
23
+ opencode: normalizeOpencode,
24
+ grok: normalizeGrok,
25
+ antigravity: normalizeAntigravity,
26
+ kimi: normalizeKimi,
27
+ droid: normalizeDroid,
28
+ };
12
29
  /** Normalize a raw JSON event from any agent type into an array of unified event objects. */
13
30
  export function normalizeEvents(agentType, raw) {
14
- if (agentType === 'codex') {
15
- return normalizeCodex(raw);
16
- }
17
- else if (agentType === 'cursor') {
18
- return normalizeCursor(raw);
19
- }
20
- else if (agentType === 'gemini') {
21
- return normalizeGemini(raw);
22
- }
23
- else if (agentType === 'claude') {
24
- return normalizeClaude(raw);
25
- }
26
- else if (agentType === 'opencode') {
27
- return normalizeOpencode(raw);
28
- }
29
- else if (agentType === 'grok') {
30
- return normalizeGrok(raw);
31
- }
32
- else if (agentType === 'antigravity') {
33
- return normalizeAntigravity(raw);
34
- }
35
- else if (agentType === 'kimi') {
36
- return normalizeKimi(raw);
37
- }
38
- else if (agentType === 'droid') {
39
- return normalizeDroid(raw);
31
+ const normalizer = TEAM_EVENT_NORMALIZERS[agentType];
32
+ if (normalizer) {
33
+ return normalizer(raw);
40
34
  }
41
35
  const timestamp = new Date().toISOString();
42
36
  return [{
@@ -10,32 +10,13 @@
10
10
  import * as fs from 'fs/promises';
11
11
  import * as fsSync from 'fs';
12
12
  import * as path from 'path';
13
- import { randomBytes } from 'crypto';
14
13
  import lockfile from 'proper-lockfile';
15
14
  import { getTeamsRegistryPath } from '../state.js';
16
15
  import { emit } from '../feed/events.js';
16
+ import { atomicWriteJsonSync } from '../fs-atomic.js';
17
17
  async function registryPath() {
18
18
  return getTeamsRegistryPath();
19
19
  }
20
- /**
21
- * Atomic JSON write: writes to a unique sibling tmp file then renames over
22
- * the target. rename(2) is atomic on POSIX, so a crashed write leaves the
23
- * old file untouched instead of producing a half-written registry that
24
- * loadTeams() would reject.
25
- */
26
- async function atomicWriteJson(p, data) {
27
- await fs.mkdir(path.dirname(p), { recursive: true });
28
- const tmp = `${p}.tmp.${process.pid}.${randomBytes(4).toString('hex')}`;
29
- const body = JSON.stringify(data, null, 2);
30
- await fs.writeFile(tmp, body);
31
- try {
32
- await fs.rename(tmp, p);
33
- }
34
- catch (err) {
35
- await fs.unlink(tmp).catch(() => { });
36
- throw err;
37
- }
38
- }
39
20
  /**
40
21
  * Run `fn` while holding an exclusive cross-process lock on the registry
41
22
  * file. proper-lockfile requires the target to exist, so we touch it first.
@@ -91,7 +72,7 @@ export async function loadTeams() {
91
72
  }
92
73
  async function saveTeams(reg) {
93
74
  const p = await registryPath();
94
- await atomicWriteJson(p, reg);
75
+ atomicWriteJsonSync(p, reg);
95
76
  }
96
77
  /** Create a new team. Throws if a team with the same name already exists. */
97
78
  export async function createTeam(name, options) {
@@ -352,7 +352,7 @@ function dispatchDefault(config) {
352
352
  // Import lazily so the runner module (heavy) is only loaded when a handler
353
353
  // actually needs to spawn. Tests inject dispatch functions, so this path is
354
354
  // not exercised in unit tests.
355
- return import('../runner.js').then((m) => m.executeJobDetached(config));
355
+ return import('../daemon/runner.js').then((m) => m.executeJobDetached(config));
356
356
  }
357
357
  /**
358
358
  * Execute a handler's action. Runs the configured agent/workflow/command or
@@ -16,7 +16,7 @@ import * as fs from 'fs';
16
16
  import * as http from 'http';
17
17
  import * as path from 'path';
18
18
  import { jobRunsOnThisDevice, listJobs, substituteWebhookPrompt } from '../scheduling/routines.js';
19
- import { executeJobDetached } from '../runner.js';
19
+ import { executeJobDetached } from '../daemon/runner.js';
20
20
  import { emit } from '../feed/events.js';
21
21
  import { listHandlers, handlerMatchesWebhook, executeHandler, buildWebhookContext, } from './handlers.js';
22
22
  /** Read `repository.full_name` (`owner/name`) from a webhook payload, if present. */
@@ -19,7 +19,7 @@ import * as fs from 'fs';
19
19
  import * as os from 'os';
20
20
  import * as path from 'path';
21
21
  import { AGENTS, ALL_AGENT_IDS } from './agents.js';
22
- import { getAgentConfigPath, getConfigSymlinkVersion, stripShimPathLines, releaseAdoptedLauncher, } from './shims.js';
22
+ import { getAgentConfigPath, getConfigSymlinkVersion, stripShimPathLines, releaseAdoptedLauncher, } from './installations/shims.js';
23
23
  import { moveDirCrossDevice, copyDirStrippingAgentsSymlinks } from './config-transfer.js';
24
24
  import { getUserAgentsDir, getBackupsDir, getHistoryDir, getShimsDir, getLegacySystemAgentsDir, } from './state.js';
25
25
  /** Home dir honoring the AGENTS_REAL_HOME test/override, mirroring shims.ts. */
@@ -43,8 +43,15 @@ export declare function resolveInstalledLayout(): InstallLayout | null;
43
43
  * binary can't read its own bundled package.json), fall back to the on-disk
44
44
  * install found via the launcher symlink so callers like the menu bar don't see
45
45
  * a bogus `unknown`.
46
+ *
47
+ * `pkgJsonPath` is an optional override of the shipping package.json path,
48
+ * accepted by both this function and {@link getCliVersionFresh}. Every
49
+ * production call site uses the zero-argument form and gets the real on-disk
50
+ * path below; the parameter exists only so a unit test can point both
51
+ * functions at a fixture package.json instead of the real one shared by every
52
+ * parallel test fork.
46
53
  */
47
- export declare function getCliVersion(): string;
54
+ export declare function getCliVersion(pkgJsonPath?: string): string;
48
55
  /**
49
56
  * Read the version from package.json on disk every call, bypassing the cache.
50
57
  *
@@ -55,4 +62,4 @@ export declare function getCliVersion(): string;
55
62
  * is now stale and should reload onto the new code (self-healing). Returns
56
63
  * 'unknown' on any error.
57
64
  */
58
- export declare function getCliVersionFresh(): string;
65
+ export declare function getCliVersionFresh(pkgJsonPath?: string): string;
@@ -91,14 +91,18 @@ export function resolveInstalledLayout() {
91
91
  * binary can't read its own bundled package.json), fall back to the on-disk
92
92
  * install found via the launcher symlink so callers like the menu bar don't see
93
93
  * a bogus `unknown`.
94
+ *
95
+ * `pkgJsonPath` is an optional override of the shipping package.json path,
96
+ * accepted by both this function and {@link getCliVersionFresh}. Every
97
+ * production call site uses the zero-argument form and gets the real on-disk
98
+ * path below; the parameter exists only so a unit test can point both
99
+ * functions at a fixture package.json instead of the real one shared by every
100
+ * parallel test fork.
94
101
  */
95
- export function getCliVersion() {
102
+ export function getCliVersion(pkgJsonPath = path.join(__dirname, '..', '..', 'package.json')) {
96
103
  if (cached)
97
104
  return cached;
98
- cached =
99
- readVersionAt(path.join(__dirname, '..', '..', 'package.json')) ??
100
- readInstalledPackageVersion() ??
101
- 'unknown';
105
+ cached = readVersionAt(pkgJsonPath) ?? readInstalledPackageVersion() ?? 'unknown';
102
106
  return cached;
103
107
  }
104
108
  /** Version from the on-disk install (Bun-binary fallback). */
@@ -116,8 +120,6 @@ function readInstalledPackageVersion() {
116
120
  * is now stale and should reload onto the new code (self-healing). Returns
117
121
  * 'unknown' on any error.
118
122
  */
119
- export function getCliVersionFresh() {
120
- return (readVersionAt(path.join(__dirname, '..', '..', 'package.json')) ??
121
- readInstalledPackageVersion() ??
122
- 'unknown');
123
+ export function getCliVersionFresh(pkgJsonPath = path.join(__dirname, '..', '..', 'package.json')) {
124
+ return readVersionAt(pkgJsonPath) ?? readInstalledPackageVersion() ?? 'unknown';
123
125
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phnx-labs/agents-cli",
3
- "version": "1.22.41",
3
+ "version": "1.22.42",
4
4
  "description": "One CLI for all your AI coding agents - versions, config, cloud dispatch, sessions, and teams (now with first-class Grok Build CLI support)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",