@phnx-labs/agents-cli 1.22.40 → 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 (201) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +14 -3
  3. package/dist/bin/agents +0 -0
  4. package/dist/bootstrap.js +0 -1
  5. package/dist/cli/command-registry.d.ts +2 -0
  6. package/dist/cli/command-registry.js +5 -2
  7. package/dist/commands/accounts.d.ts +29 -0
  8. package/dist/commands/accounts.js +220 -29
  9. package/dist/commands/alias.js +1 -1
  10. package/dist/commands/auth.d.ts +9 -0
  11. package/dist/commands/auth.js +104 -0
  12. package/dist/commands/browser-sessions-picker.js +42 -62
  13. package/dist/commands/browser.d.ts +15 -0
  14. package/dist/commands/browser.js +145 -78
  15. package/dist/commands/computer-actions.d.ts +1 -1
  16. package/dist/commands/computer-actions.js +1 -1
  17. package/dist/commands/computer-sessions-picker.js +32 -55
  18. package/dist/commands/computer.d.ts +1 -1
  19. package/dist/commands/computer.js +2 -2
  20. package/dist/commands/doctor.d.ts +1 -1
  21. package/dist/commands/doctor.js +3 -3
  22. package/dist/commands/feed.js +4 -12
  23. package/dist/commands/hooks.js +1 -1
  24. package/dist/commands/import.js +1 -1
  25. package/dist/commands/insights.js +163 -85
  26. package/dist/commands/inspect.js +2 -2
  27. package/dist/commands/mine.js +1 -1
  28. package/dist/commands/org.d.ts +6 -0
  29. package/dist/commands/org.js +174 -0
  30. package/dist/commands/packages.js +1 -1
  31. package/dist/commands/prune.js +1 -1
  32. package/dist/commands/routines.js +1 -1
  33. package/dist/commands/run-account-picker.d.ts +19 -0
  34. package/dist/commands/run-account-picker.js +81 -0
  35. package/dist/commands/secrets.js +87 -97
  36. package/dist/commands/sessions-picker-factory.d.ts +40 -0
  37. package/dist/commands/sessions-picker-factory.js +67 -0
  38. package/dist/commands/sessions-picker.d.ts +1 -0
  39. package/dist/commands/sessions-picker.js +27 -5
  40. package/dist/commands/sessions-share.d.ts +25 -0
  41. package/dist/commands/sessions-share.js +166 -0
  42. package/dist/commands/sessions.js +2 -0
  43. package/dist/commands/setup-browser.js +5 -5
  44. package/dist/commands/setup-mine.js +1 -1
  45. package/dist/commands/setup-preferences.js +4 -4
  46. package/dist/commands/setup.js +5 -3
  47. package/dist/commands/sync.js +1 -1
  48. package/dist/commands/versions.js +1 -1
  49. package/dist/commands/view.js +1 -1
  50. package/dist/commands/webhook.js +14 -9
  51. package/dist/lib/account-capabilities.d.ts +10 -0
  52. package/dist/lib/account-capabilities.js +34 -0
  53. package/dist/lib/agent-spec/agents.d.ts +584 -0
  54. package/dist/lib/agent-spec/agents.js +3127 -0
  55. package/dist/lib/agent-spec/provider.js +1 -1
  56. package/dist/lib/agents.d.ts +2 -584
  57. package/dist/lib/agents.js +2 -3127
  58. package/dist/lib/browser/cdp.js +4 -0
  59. package/dist/lib/browser/chrome.js +12 -1
  60. package/dist/lib/browser/drivers/local.d.ts +8 -2
  61. package/dist/lib/browser/drivers/local.js +8 -2
  62. package/dist/lib/browser/drivers/ssh.d.ts +8 -2
  63. package/dist/lib/browser/drivers/ssh.js +11 -4
  64. package/dist/lib/browser/hygiene.d.ts +1 -1
  65. package/dist/lib/browser/hygiene.js +5 -1
  66. package/dist/lib/browser/profiles.d.ts +77 -4
  67. package/dist/lib/browser/profiles.js +121 -12
  68. package/dist/lib/browser/runtime-state.d.ts +11 -5
  69. package/dist/lib/browser/runtime-state.js +13 -9
  70. package/dist/lib/browser/service.d.ts +91 -30
  71. package/dist/lib/browser/service.js +342 -207
  72. package/dist/lib/browser/types.d.ts +96 -4
  73. package/dist/lib/browser/types.js +51 -0
  74. package/dist/lib/catchup.js +1 -1
  75. package/dist/lib/computer/actions.d.ts +1 -1
  76. package/dist/lib/computer/actions.js +1 -1
  77. package/dist/lib/{computer-rpc.js → computer/computer-rpc.js} +5 -5
  78. package/dist/lib/computer/dispatch.d.ts +1 -1
  79. package/dist/lib/computer/download.d.ts +1 -1
  80. package/dist/lib/computer/download.js +3 -3
  81. package/dist/lib/{ssh-tunnel.d.ts → computer/ssh-tunnel.d.ts} +1 -1
  82. package/dist/lib/{ssh-tunnel.js → computer/ssh-tunnel.js} +12 -12
  83. package/dist/lib/daemon/daemon.js +1 -1
  84. package/dist/lib/{runner.d.ts → daemon/runner.d.ts} +10 -10
  85. package/dist/lib/{runner.js → daemon/runner.js} +59 -118
  86. package/dist/lib/daemon-webhooks.d.ts +3 -1
  87. package/dist/lib/daemon-webhooks.js +12 -7
  88. package/dist/lib/device-config.js +1 -1
  89. package/dist/lib/devices/doctor-findings.d.ts +1 -1
  90. package/dist/lib/devices/doctor-findings.js +3 -3
  91. package/dist/lib/devices/fleet-inventory.js +1 -1
  92. package/dist/lib/devices/harness-inventory.js +1 -1
  93. package/dist/lib/devices/registry.js +4 -22
  94. package/dist/lib/doctor-diff.d.ts +1 -1
  95. package/dist/lib/doctor-diff.js +1 -1
  96. package/dist/lib/drift.js +1 -1
  97. package/dist/lib/entitlement.d.ts +31 -0
  98. package/dist/lib/entitlement.js +137 -0
  99. package/dist/lib/exec.js +39 -202
  100. package/dist/lib/feed/feed.js +2 -8
  101. package/dist/lib/fs-atomic.d.ts +7 -0
  102. package/dist/lib/fs-atomic.js +9 -0
  103. package/dist/lib/harness/adapter.d.ts +160 -0
  104. package/dist/lib/harness/adapter.js +47 -0
  105. package/dist/lib/harness/adapters/claude.d.ts +2 -0
  106. package/dist/lib/harness/adapters/claude.js +110 -0
  107. package/dist/lib/harness/adapters/codex.d.ts +2 -0
  108. package/dist/lib/harness/adapters/codex.js +83 -0
  109. package/dist/lib/harness/adapters/copilot.d.ts +2 -0
  110. package/dist/lib/harness/adapters/copilot.js +23 -0
  111. package/dist/lib/harness/adapters/cursor.d.ts +2 -0
  112. package/dist/lib/harness/adapters/cursor.js +38 -0
  113. package/dist/lib/harness/adapters/droid.d.ts +2 -0
  114. package/dist/lib/harness/adapters/droid.js +17 -0
  115. package/dist/lib/harness/adapters/grok.d.ts +2 -0
  116. package/dist/lib/harness/adapters/grok.js +14 -0
  117. package/dist/lib/harness/adapters/kimi.d.ts +2 -0
  118. package/dist/lib/harness/adapters/kimi.js +49 -0
  119. package/dist/lib/harness/adapters/muse.d.ts +2 -0
  120. package/dist/lib/harness/adapters/muse.js +44 -0
  121. package/dist/lib/harness/adapters/opencode.d.ts +2 -0
  122. package/dist/lib/harness/adapters/opencode.js +14 -0
  123. package/dist/lib/harness/exec-config-version.d.ts +8 -0
  124. package/dist/lib/harness/exec-config-version.js +22 -0
  125. package/dist/lib/harness/index.d.ts +1 -0
  126. package/dist/lib/harness/index.js +34 -0
  127. package/dist/lib/{hooks.d.ts → hooks/install.d.ts} +1 -1
  128. package/dist/lib/{hooks.js → hooks/install.js} +11 -11
  129. package/dist/lib/import.js +1 -1
  130. package/dist/lib/installations/index.d.ts +4 -4
  131. package/dist/lib/installations/index.js +3 -4
  132. package/dist/lib/installations/migrate.js +6 -6
  133. package/dist/lib/{shims.d.ts → installations/shims.d.ts} +2 -2
  134. package/dist/lib/{shims.js → installations/shims.js} +12 -114
  135. package/dist/lib/installations/store.d.ts +141 -3
  136. package/dist/lib/installations/store.js +475 -5
  137. package/dist/lib/installations/versions.d.ts +1 -126
  138. package/dist/lib/installations/versions.js +5 -465
  139. package/dist/lib/isolation-boundary-report.d.ts +1 -1
  140. package/dist/lib/isolation-boundary-report.js +1 -1
  141. package/dist/lib/mailbox-gc.js +2 -3
  142. package/dist/lib/menubar/MenubarHelper.app/Contents/CodeResources +0 -0
  143. package/dist/lib/menubar/MenubarHelper.app/Contents/MacOS/MenubarHelper +0 -0
  144. package/dist/lib/monitors/dispatch.d.ts +1 -1
  145. package/dist/lib/monitors/dispatch.js +2 -2
  146. package/dist/lib/monitors/state.d.ts +1 -1
  147. package/dist/lib/observe-aliases.d.ts +2 -2
  148. package/dist/lib/observe-aliases.js +2 -11
  149. package/dist/lib/plugins/plugins.js +1 -1
  150. package/dist/lib/plugins/skills.js +1 -1
  151. package/dist/lib/prix-account.d.ts +158 -0
  152. package/dist/lib/prix-account.js +214 -0
  153. package/dist/lib/project-key.js +7 -0
  154. package/dist/lib/project-launch.js +1 -1
  155. package/dist/lib/refresh.js +2 -2
  156. package/dist/lib/resource-inventory.d.ts +1 -1
  157. package/dist/lib/resource-inventory.js +1 -1
  158. package/dist/lib/rules/rules.js +1 -1
  159. package/dist/lib/scheduling/routines.js +1 -1
  160. package/dist/lib/secrets/Agents CLI.app/Contents/CodeResources +0 -0
  161. package/dist/lib/secrets/Agents CLI.app/Contents/MacOS/Agents CLI +0 -0
  162. package/dist/lib/secrets/bundles.d.ts +1 -1
  163. package/dist/lib/secrets/bundles.js +1 -1
  164. package/dist/lib/secrets/headless.d.ts +16 -0
  165. package/dist/lib/secrets/headless.js +21 -0
  166. package/dist/lib/secrets/remote.d.ts +9 -7
  167. package/dist/lib/secrets/remote.js +18 -9
  168. package/dist/lib/self-heal/checks/hook-runtime.js +1 -1
  169. package/dist/lib/self-heal/checks/path.js +1 -1
  170. package/dist/lib/self-heal/checks/shadowing.js +1 -1
  171. package/dist/lib/self-heal/checks/shims.js +1 -1
  172. package/dist/lib/session/discover.d.ts +39 -0
  173. package/dist/lib/session/discover.js +3 -3
  174. package/dist/lib/session/parse.js +24 -42
  175. package/dist/lib/session/recovery.js +1 -1
  176. package/dist/lib/session/share-html.d.ts +55 -0
  177. package/dist/lib/session/share-html.js +319 -0
  178. package/dist/lib/settings-manifest.d.ts +2 -0
  179. package/dist/lib/settings-manifest.js +81 -3
  180. package/dist/lib/share/publish.d.ts +38 -0
  181. package/dist/lib/share/publish.js +81 -8
  182. package/dist/lib/staleness/prune.d.ts +1 -1
  183. package/dist/lib/staleness/prune.js +1 -1
  184. package/dist/lib/staleness/writers/hooks.js +1 -1
  185. package/dist/lib/startup/command-registry.d.ts +2 -1
  186. package/dist/lib/startup/command-registry.js +5 -3
  187. package/dist/lib/teams/agents.js +2 -19
  188. package/dist/lib/teams/parsers.js +20 -26
  189. package/dist/lib/teams/registry.js +2 -21
  190. package/dist/lib/triggers/handlers.d.ts +37 -2
  191. package/dist/lib/triggers/handlers.js +57 -6
  192. package/dist/lib/triggers/webhook.d.ts +80 -6
  193. package/dist/lib/triggers/webhook.js +128 -4
  194. package/dist/lib/types.d.ts +1 -1
  195. package/dist/lib/uninstall.js +1 -1
  196. package/dist/lib/version.d.ts +9 -2
  197. package/dist/lib/version.js +11 -9
  198. package/dist/lib/wrap.d.ts +33 -0
  199. package/dist/lib/wrap.js +70 -0
  200. package/package.json +1 -1
  201. /package/dist/lib/{computer-rpc.d.ts → computer/computer-rpc.d.ts} +0 -0
@@ -1,4 +1,66 @@
1
- export type BrowserType = 'chrome' | 'comet' | 'chromium' | 'brave' | 'edge' | 'custom';
1
+ export type BrowserType = 'chrome' | 'comet' | 'chromium' | 'brave' | 'edge' | 'arc' | 'custom';
2
+ /**
3
+ * The user-facing name of a profile — what `agents browser profiles list`
4
+ * prints and what `--profile <name>` takes. ALWAYS bare: it never carries an
5
+ * `@<endpoint>` suffix or a `.<fork>` suffix. `BrowserProfile.name` is one.
6
+ */
7
+ export type ProfileName = string;
8
+ /**
9
+ * The key of an endpoint preset within a profile (`endpoint-0`, `local`, …) —
10
+ * see {@link EndpointPreset} and `getEndpointPresets`.
11
+ */
12
+ export type EndpointName = string;
13
+ /**
14
+ * The RUNTIME key a live browser is registered under: `<profile>@<endpoint>`,
15
+ * plus an optional `.<n>` fork suffix for Electron forks. It keys
16
+ * `BrowserService.connections`, the profile's runtime dir, its `tasks.json`,
17
+ * and its capture dirs — so one YAML profile can run at several endpoints
18
+ * concurrently without colliding on disk.
19
+ *
20
+ * It is BRANDED on purpose. Before RUSH-2709 both this and a {@link ProfileName}
21
+ * were bare `string`s and `start()` overwrote `BrowserProfile.name` with the
22
+ * composite, so a connection key leaked into every user-facing listing and six
23
+ * consumers each invented their own rule for turning one back into the other.
24
+ * The brand makes `connections.get(someProfileName)` — the exact miss behind
25
+ * `status --profile comet-local` returning EMPTY for a live
26
+ * `comet-local@endpoint-0` — a compile error. Build one ONLY with
27
+ * {@link connectionKey} (deriving) or {@link asConnectionKey} (adopting a name
28
+ * that is already a runtime key, e.g. a directory read off disk).
29
+ */
30
+ export type ConnectionKey = string & {
31
+ readonly __connectionKey: unique symbol;
32
+ };
33
+ /** The single site that derives a {@link ConnectionKey} from its two parts. */
34
+ export declare function connectionKey(profile: ProfileName, endpoint: EndpointName): ConnectionKey;
35
+ /**
36
+ * Adopt a string that IS already a runtime key — a runtime directory name, a
37
+ * `tasks.json` `profile` field, a fork key. Never use it to launder a bare
38
+ * profile name into a key; use {@link connectionKey} for that.
39
+ */
40
+ export declare function asConnectionKey(raw: string): ConnectionKey;
41
+ /**
42
+ * Split a {@link ConnectionKey} back into its parts. The inverse of
43
+ * {@link connectionKey}, and the ONE rule every consumer uses to decide whether
44
+ * a runtime key belongs to a profile.
45
+ *
46
+ * Tolerates the legacy shape still on disk: a pre-composite key that is just
47
+ * the bare profile name (`comet-local`).
48
+ *
49
+ * A key with no `@` is read as a WHOLE profile name, never as `<name>.<fork>`,
50
+ * because nothing constrains a profile's name (`createProfile` checks only for
51
+ * a duplicate name and a port collision). Reading the trailing digits as a fork
52
+ * would let `stop --profile chrome` claim the runtime dirs of a separate
53
+ * profile named `chrome.2` and kill its browser. A fork is only ever created
54
+ * from a composite base (`forkElectronProfile` appends to a `<p>@<e>` key), so
55
+ * the `@`-bearing branch below is the one that must understand forks.
56
+ */
57
+ export declare function parseConnectionKey(key: string): {
58
+ profile: ProfileName;
59
+ endpoint?: EndpointName;
60
+ fork?: number;
61
+ };
62
+ /** True when `key` is a runtime key of `profile`. The only reconciliation rule. */
63
+ export declare function keyBelongsToProfile(key: string, profile: ProfileName): boolean;
2
64
  /**
3
65
  * A single named endpoint preset within a profile. Lets one profile cover
4
66
  * the local + remote variants of the same app (e.g. an Electron app on this
@@ -24,7 +86,12 @@ export interface EndpointPreset {
24
86
  targetFilter?: string;
25
87
  }
26
88
  export interface BrowserProfile {
27
- name: string;
89
+ /**
90
+ * The user-facing profile name, ALWAYS bare — never `name@endpoint`. The
91
+ * runtime key that carries the endpoint is a separate value
92
+ * ({@link ConnectionKey}); nothing may write one here.
93
+ */
94
+ name: ProfileName;
28
95
  description?: string;
29
96
  browser: BrowserType;
30
97
  binary?: string;
@@ -84,8 +151,24 @@ export interface Task {
84
151
  * short machine id can stay addressable while status stays readable.
85
152
  */
86
153
  label?: string;
87
- profile: string;
154
+ /**
155
+ * The RUNTIME key of the browser this task lives on (`<profile>@<endpoint>`),
156
+ * not the bare profile name — it addresses the runtime dir this task's
157
+ * `tasks.json` and captures are written under. Use
158
+ * {@link parseConnectionKey} to get the user-facing name out of it.
159
+ */
160
+ profile: ConnectionKey;
88
161
  tabs: Record<string, string>;
162
+ /**
163
+ * Tabs this task DRIVES but did not create, by shortId — a tab that already
164
+ * existed in the browser and was reused because the browser cannot open new
165
+ * ones (Arc: `Target.createTarget` crashes it, #2778/#2786). Every close path
166
+ * skips these: the task never opened the tab, so closing it on `done` would
167
+ * take away something that was there first. Same rule `adoptTabShowing`
168
+ * states for unowned pages, kept when reuse is unavoidable rather than
169
+ * optional.
170
+ */
171
+ borrowedTabs?: string[];
89
172
  currentTabId?: string;
90
173
  createdAt: number;
91
174
  /**
@@ -142,7 +225,16 @@ export interface TabInfo {
142
225
  task: string;
143
226
  }
144
227
  export interface ProfileStatus {
145
- name: string;
228
+ /**
229
+ * The BARE profile name — what the user passed to `--profile` and what
230
+ * `status` prints. The endpoint is reported separately in {@link endpoint};
231
+ * the raw runtime key (if a caller genuinely needs it) is {@link key}.
232
+ */
233
+ name: ProfileName;
234
+ /** Endpoint preset this browser is running at, when the key carries one. */
235
+ endpoint?: EndpointName;
236
+ /** The runtime key backing this status: `<profile>@<endpoint>[.<fork>]`. */
237
+ key?: ConnectionKey;
146
238
  running: boolean;
147
239
  port?: number;
148
240
  pid?: number;
@@ -1,3 +1,54 @@
1
+ /** The single site that derives a {@link ConnectionKey} from its two parts. */
2
+ export function connectionKey(profile, endpoint) {
3
+ return `${profile}@${endpoint}`;
4
+ }
5
+ /**
6
+ * Adopt a string that IS already a runtime key — a runtime directory name, a
7
+ * `tasks.json` `profile` field, a fork key. Never use it to launder a bare
8
+ * profile name into a key; use {@link connectionKey} for that.
9
+ */
10
+ export function asConnectionKey(raw) {
11
+ return raw;
12
+ }
13
+ /**
14
+ * Split a {@link ConnectionKey} back into its parts. The inverse of
15
+ * {@link connectionKey}, and the ONE rule every consumer uses to decide whether
16
+ * a runtime key belongs to a profile.
17
+ *
18
+ * Tolerates the legacy shape still on disk: a pre-composite key that is just
19
+ * the bare profile name (`comet-local`).
20
+ *
21
+ * A key with no `@` is read as a WHOLE profile name, never as `<name>.<fork>`,
22
+ * because nothing constrains a profile's name (`createProfile` checks only for
23
+ * a duplicate name and a port collision). Reading the trailing digits as a fork
24
+ * would let `stop --profile chrome` claim the runtime dirs of a separate
25
+ * profile named `chrome.2` and kill its browser. A fork is only ever created
26
+ * from a composite base (`forkElectronProfile` appends to a `<p>@<e>` key), so
27
+ * the `@`-bearing branch below is the one that must understand forks.
28
+ */
29
+ export function parseConnectionKey(key) {
30
+ // LAST `@`, not the first: a profile name may itself contain one (`me@work`),
31
+ // and splitting on the first would report its profile as `me` — so
32
+ // `status --profile me@work` would find nothing for a running browser.
33
+ const at = key.lastIndexOf('@');
34
+ if (at === -1)
35
+ return { profile: key };
36
+ const profile = key.slice(0, at);
37
+ const rest = key.slice(at + 1);
38
+ const dot = rest.indexOf('.');
39
+ if (dot === -1)
40
+ return { profile, endpoint: rest };
41
+ const fork = Number(rest.slice(dot + 1));
42
+ return {
43
+ profile,
44
+ endpoint: rest.slice(0, dot),
45
+ fork: Number.isFinite(fork) ? fork : undefined,
46
+ };
47
+ }
48
+ /** True when `key` is a runtime key of `profile`. The only reconciliation rule. */
49
+ export function keyBelongsToProfile(key, profile) {
50
+ return parseConnectionKey(key).profile === profile;
51
+ }
1
52
  export const TASK_ID_REGEX = /^[a-z0-9][a-z0-9-]*$/;
2
53
  export function isValidTaskId(id) {
3
54
  return TASK_ID_REGEX.test(id) && id.length <= 64;
@@ -38,7 +38,7 @@ import * as fs from 'fs';
38
38
  import * as path from 'path';
39
39
  import { readJob, writeRunMeta, getRunDir, } from './scheduling/routines.js';
40
40
  import { detectOverdueJobs } from './overdue.js';
41
- import { executeJobDetached } from './runner.js';
41
+ import { executeJobDetached } from './daemon/runner.js';
42
42
  /**
43
43
  * Is this routine allowed to run late? Default true — a routine you scheduled
44
44
  * is one you expect to have run, so losing a fire silently is never the helpful
@@ -1,4 +1,4 @@
1
- import type { ComputerClient } from '../computer-rpc.js';
1
+ import type { ComputerClient } from './computer-rpc.js';
2
2
  export interface AppInfo {
3
3
  pid: number;
4
4
  name: string;
@@ -1,7 +1,7 @@
1
1
  import * as fs from 'fs';
2
2
  import * as path from 'path';
3
3
  import { randomUUID } from 'node:crypto';
4
- import { resolvePolicyPath } from '../computer-rpc.js';
4
+ import { resolvePolicyPath } from './computer-rpc.js';
5
5
  import { COMPUTER_INPUT_GATED_VERBS, formatComputerPermissionGrantHint } from '../permissions.js';
6
6
  import { emit as emitEvent } from '../feed/events.js';
7
7
  import { recordComputerSession } from '../session/db.js';
@@ -16,7 +16,7 @@ import { createConnection } from 'net';
16
16
  import * as fs from 'fs';
17
17
  import * as path from 'path';
18
18
  import { fileURLToPath } from 'url';
19
- import { getHelpersDir, getLogsDir, getUserPermissionsDir, getPermissionsDir } from './state.js';
19
+ import { getHelpersDir, getLogsDir, getUserPermissionsDir, getPermissionsDir } from '../state.js';
20
20
  // Resolve the socket path used by the launchd-managed daemon. Internal
21
21
  // scratch — lives under getHelpersDir() (~/.agents/.cache/helpers/),
22
22
  // matching browser.sock.
@@ -174,10 +174,10 @@ export function writeComputerPeers(allowedExecPaths) {
174
174
  export function resolveHelperExec() {
175
175
  const here = path.dirname(fileURLToPath(import.meta.url));
176
176
  const candidates = [
177
- // Local build (running from the agents-cli checkout). apps/cli/dist/lib -> repo root (4 up) -> native/computer-mac.
178
- path.resolve(here, '..', '..', '..', '..', 'native', 'computer-mac', 'dist', 'ComputerHelper.app', 'Contents', 'MacOS', 'ComputerHelper'),
179
- // Bundled with the npm package.
180
- path.resolve(here, '..', 'computer-helper', 'ComputerHelper.app', 'Contents', 'MacOS', 'ComputerHelper'),
177
+ // Local build (running from the agents-cli checkout). apps/cli/dist/lib/computer -> repo root (5 up) -> native/computer-mac.
178
+ path.resolve(here, '..', '..', '..', '..', '..', 'native', 'computer-mac', 'dist', 'ComputerHelper.app', 'Contents', 'MacOS', 'ComputerHelper'),
179
+ // Bundled with the npm package (dist/lib/computer -> dist/).
180
+ path.resolve(here, '..', '..', 'computer-helper', 'ComputerHelper.app', 'Contents', 'MacOS', 'ComputerHelper'),
181
181
  ];
182
182
  for (const c of candidates) {
183
183
  if (fs.existsSync(c))
@@ -1,4 +1,4 @@
1
- import type { ComputerClient } from '../computer-rpc.js';
1
+ import type { ComputerClient } from './computer-rpc.js';
2
2
  import { type AppInfo } from './actions.js';
3
3
  import type { VerbDispatcher } from './loop.js';
4
4
  declare function rpcMethodFor(verb: string): string;
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * The helper is a signed + notarized universal `.app` bundle published as a
6
6
  * GitHub release asset per tagged CLI version — the same distribution model as
7
- * the Windows helper (see `lib/ssh-tunnel.ts`). A fresh `npm i -g` machine has
7
+ * the Windows helper (see `lib/computer/ssh-tunnel.ts`). A fresh `npm i -g` machine has
8
8
  * no local build, so `agents computer setup` / `agents setup computer` fetch the
9
9
  * asset for the running CLI version, verify its sha256 against the published
10
10
  * `.sha256`, then verify the code signature (Developer ID Team + notarization)
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * The helper is a signed + notarized universal `.app` bundle published as a
6
6
  * GitHub release asset per tagged CLI version — the same distribution model as
7
- * the Windows helper (see `lib/ssh-tunnel.ts`). A fresh `npm i -g` machine has
7
+ * the Windows helper (see `lib/computer/ssh-tunnel.ts`). A fresh `npm i -g` machine has
8
8
  * no local build, so `agents computer setup` / `agents setup computer` fetch the
9
9
  * asset for the running CLI version, verify its sha256 against the published
10
10
  * `.sha256`, then verify the code signature (Developer ID Team + notarization)
@@ -21,8 +21,8 @@ import { Readable } from 'node:stream';
21
21
  import { pipeline } from 'node:stream/promises';
22
22
  import { getCacheDir } from '../state.js';
23
23
  import { getCliVersion } from '../version.js';
24
- import { parseSha256Asset, sha256File } from '../ssh-tunnel.js';
25
- import { resolveHelperApp } from '../computer-rpc.js';
24
+ import { parseSha256Asset, sha256File } from './ssh-tunnel.js';
25
+ import { resolveHelperApp } from './computer-rpc.js';
26
26
  /** GitHub repo whose `v<version>` releases carry the helper asset. */
27
27
  export const HELPER_RELEASE_REPO = 'phnx-labs/agents-cli';
28
28
  /** The zipped `.app` release asset name. */
@@ -17,7 +17,7 @@
17
17
  * `devices/connect` primitives — no parallel SSH implementation.
18
18
  */
19
19
  import { type ChildProcess } from 'child_process';
20
- import { type DeviceProfile } from './devices/registry.js';
20
+ import { type DeviceProfile } from '../devices/registry.js';
21
21
  export interface StartTunnelOptions {
22
22
  /**
23
23
  * Detach the tunnel so it OUTLIVES this CLI process. Used by
@@ -24,14 +24,14 @@ import { fileURLToPath } from 'url';
24
24
  import { randomBytes, createHash } from 'crypto';
25
25
  import { Readable } from 'stream';
26
26
  import { pipeline } from 'stream/promises';
27
- import { sshExec, SSH_OPTS, assertValidSshTarget } from './ssh-exec.js';
28
- import { backgroundSpawnOptions } from './platform/process.js';
29
- import { encodePowerShell } from './browser/drivers/ssh.js';
30
- import { getDevice } from './devices/registry.js';
31
- import { deviceIdentityArgs, sshTargetFor } from './devices/connect.js';
32
- import { hostNameFor } from './devices/ssh-config.js';
33
- import { getCacheDir } from './state.js';
34
- import { getCliVersion } from './version.js';
27
+ import { sshExec, SSH_OPTS, assertValidSshTarget } from '../ssh-exec.js';
28
+ import { backgroundSpawnOptions } from '../platform/process.js';
29
+ import { encodePowerShell } from '../browser/drivers/ssh.js';
30
+ import { getDevice } from '../devices/registry.js';
31
+ import { deviceIdentityArgs, sshTargetFor } from '../devices/connect.js';
32
+ import { hostNameFor } from '../devices/ssh-config.js';
33
+ import { getCacheDir } from '../state.js';
34
+ import { getCliVersion } from '../version.js';
35
35
  import { openComputerClient, resolveTcpEndpoint } from './computer-rpc.js';
36
36
  /** Build the ssh argv (after the `ssh` program name) for an `-L` tunnel. Pure.
37
37
  *
@@ -115,10 +115,10 @@ export const WIN_HELPER_TOKEN_FILE = 'helper-token';
115
115
  export function resolveWinHelperExe() {
116
116
  const here = path.dirname(fileURLToPath(import.meta.url));
117
117
  const candidates = [
118
- // Running from the agents-cli checkout. apps/cli/dist/lib -> repo root (4 up) -> native/computer-win.
119
- path.resolve(here, '..', '..', '..', '..', 'native', 'computer-win', 'dist', WIN_HELPER_EXE),
120
- // Bundled with the npm package (dist/lib -> package root).
121
- path.resolve(here, '..', 'computer-helper-win', WIN_HELPER_EXE),
118
+ // Running from the agents-cli checkout. apps/cli/dist/lib/computer -> repo root (5 up) -> native/computer-win.
119
+ path.resolve(here, '..', '..', '..', '..', '..', 'native', 'computer-win', 'dist', WIN_HELPER_EXE),
120
+ // Bundled with the npm package (dist/lib/computer -> dist/).
121
+ path.resolve(here, '..', '..', 'computer-helper-win', WIN_HELPER_EXE),
122
122
  ];
123
123
  for (const c of candidates) {
124
124
  if (fs.existsSync(c))
@@ -17,7 +17,7 @@ import { listJobs as listAllJobs } from '../scheduling/routines.js';
17
17
  import { syncAllProjectRoutines } from '../routines-project.js';
18
18
  import { JobScheduler } from '../scheduler.js';
19
19
  import { MonitorEngine } from '../monitors/engine.js';
20
- import { executeJobDetached, monitorRunningJobs, listLiveRoutineChildren } from '../runner.js';
20
+ import { executeJobDetached, monitorRunningJobs, listLiveRoutineChildren } from './runner.js';
21
21
  import { detectOverdueJobs, notifyOverdue } from '../overdue.js';
22
22
  import { runCatchup } from '../catchup.js';
23
23
  import { notifyRoutineStart, notifyRoutineFinish, notifyRoutineStartFailed } from '../routine-notify.js';
@@ -13,12 +13,12 @@
13
13
  * limit is detected mid-run (foreground `executeJob` only — detached daemon
14
14
  * fires once with the pre-flight pick).
15
15
  */
16
- import type { JobConfig, RunMeta } from './scheduling/routines.js';
17
- import { readMeta } from './state.js';
18
- import type { AgentId } from './types.js';
19
- import { type FallbackEntry } from './exec.js';
20
- import type { LoopDeps } from './loop.js';
21
- import { resolveRunVersion, resolveAccountVersion, type RotateResult } from './accounting/rotate.js';
16
+ import type { JobConfig, RunMeta } from '../scheduling/routines.js';
17
+ import { readMeta } from '../state.js';
18
+ import type { AgentId } from '../types.js';
19
+ import { type FallbackEntry } from '../exec.js';
20
+ import type { LoopDeps } from '../loop.js';
21
+ import { resolveRunVersion, resolveAccountVersion, type RotateResult } from '../accounting/rotate.js';
22
22
  /** Result of a completed job execution, including metadata and optional report. */
23
23
  export interface RunResult {
24
24
  meta: RunMeta;
@@ -142,11 +142,11 @@ export declare function pinJobBinary(cmd: string[], agent: AgentId, version: str
142
142
  * registry or a real dispatch.
143
143
  */
144
144
  export declare function assertRoutineAccountLocalForPlacement(config: Pick<JobConfig, 'name' | 'account'>, mode: 'host' | 'cloud', deps?: {
145
- account?: import('./account-registry.js').UnifiedAccount | null;
145
+ account?: import('../account-registry.js').UnifiedAccount | null;
146
146
  readMeta?: typeof readMeta;
147
147
  }): Promise<void>;
148
- export declare function dispatchPlacedJob(config: JobConfig, target: import('./routines-placement.js').PlacementTarget, attempt: RoutineAttempt, deps?: {
149
- account?: import('./account-registry.js').UnifiedAccount | null;
148
+ export declare function dispatchPlacedJob(config: JobConfig, target: import('../routines-placement.js').PlacementTarget, attempt: RoutineAttempt, deps?: {
149
+ account?: import('../account-registry.js').UnifiedAccount | null;
150
150
  host?: typeof executeJobOnHost;
151
151
  cloud?: typeof executeJobOnCloud;
152
152
  }): Promise<RunResult | undefined>;
@@ -160,7 +160,7 @@ export declare function buildHostDispatchOptions(config: JobConfig, ctx: {
160
160
  remoteCwd: string | undefined;
161
161
  runDir: string;
162
162
  detached: boolean;
163
- }): import('./hosts/run-target.js').HostPromptRun;
163
+ }): import('../hosts/run-target.js').HostPromptRun;
164
164
  export declare function dispatchesViaAgentsRun(config: Pick<JobConfig, 'workflow' | 'resume'>): boolean;
165
165
  /**
166
166
  * Merge sandbox/base env with the canonical per-version exec env