@phnx-labs/agents-cli 1.22.114 → 1.22.116

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 (243) hide show
  1. package/CHANGELOG.md +245 -0
  2. package/README.md +22 -102
  3. package/dist/browser.js +0 -0
  4. package/dist/cli/command-registry.js +0 -7
  5. package/dist/commands/accounts.d.ts +3 -77
  6. package/dist/commands/accounts.js +13 -366
  7. package/dist/commands/audit.js +1 -1
  8. package/dist/commands/auth.js +0 -2
  9. package/dist/commands/browser.d.ts +53 -0
  10. package/dist/commands/browser.js +210 -9
  11. package/dist/commands/doctor.d.ts +2 -3
  12. package/dist/commands/doctor.js +0 -11
  13. package/dist/commands/events.d.ts +1 -3
  14. package/dist/commands/events.js +4 -7
  15. package/dist/commands/exec.d.ts +0 -1
  16. package/dist/commands/exec.js +214 -148
  17. package/dist/commands/feed-watch.js +52 -8
  18. package/dist/commands/feed.js +65 -14
  19. package/dist/commands/focus.js +1 -1
  20. package/dist/commands/go.d.ts +0 -17
  21. package/dist/commands/go.js +2 -19
  22. package/dist/commands/logs.js +1 -1
  23. package/dist/commands/mcp.js +8 -83
  24. package/dist/commands/memory.js +4 -47
  25. package/dist/commands/message.js +4 -4
  26. package/dist/commands/plugins.js +1 -93
  27. package/dist/commands/repo.js +0 -44
  28. package/dist/commands/resume.js +4 -1
  29. package/dist/commands/secrets-passthrough.js +2 -2
  30. package/dist/commands/send.d.ts +4 -4
  31. package/dist/commands/send.js +6 -51
  32. package/dist/commands/sessions-backup-setup.js +1 -1
  33. package/dist/commands/sessions-picker.d.ts +11 -0
  34. package/dist/commands/sessions-picker.js +88 -7
  35. package/dist/commands/sessions-resume.js +0 -1
  36. package/dist/commands/sessions-share.d.ts +5 -7
  37. package/dist/commands/sessions-share.js +98 -49
  38. package/dist/commands/sessions.d.ts +21 -2
  39. package/dist/commands/sessions.js +158 -11
  40. package/dist/commands/setup-browser.js +18 -2
  41. package/dist/commands/setup-computer.js +20 -6
  42. package/dist/commands/setup-secrets.d.ts +2 -2
  43. package/dist/commands/setup-secrets.js +24 -4
  44. package/dist/commands/setup-term.d.ts +24 -0
  45. package/dist/commands/setup-term.js +70 -0
  46. package/dist/commands/setup-terminal.d.ts +3 -0
  47. package/dist/commands/setup-terminal.js +22 -0
  48. package/dist/commands/setup.d.ts +1 -1
  49. package/dist/commands/setup.js +29 -11
  50. package/dist/commands/skills.js +0 -8
  51. package/dist/commands/ssh.d.ts +6 -0
  52. package/dist/commands/ssh.js +93 -302
  53. package/dist/commands/sync.js +14 -5
  54. package/dist/commands/teams.js +1 -1
  55. package/dist/commands/traces.js +1 -1
  56. package/dist/lib/accounting/rotate.d.ts +63 -1
  57. package/dist/lib/accounting/rotate.js +56 -0
  58. package/dist/lib/accounts/add.d.ts +0 -5
  59. package/dist/lib/accounts/add.js +3 -9
  60. package/dist/lib/accounts/slots.js +32 -2
  61. package/dist/lib/answer-router.d.ts +11 -2
  62. package/dist/lib/answer-router.js +26 -2
  63. package/dist/lib/artifacts-client.d.ts +20 -0
  64. package/dist/lib/artifacts-client.js +46 -0
  65. package/dist/lib/auth-mint.d.ts +5 -4
  66. package/dist/lib/auth-mint.js +6 -5
  67. package/dist/lib/browser/drivers/arc.d.ts +1 -1
  68. package/dist/lib/browser/runtime-state.d.ts +55 -0
  69. package/dist/lib/browser/runtime-state.js +99 -18
  70. package/dist/lib/browser/service.d.ts +10 -0
  71. package/dist/lib/browser/service.js +229 -37
  72. package/dist/lib/browser/types.d.ts +18 -0
  73. package/dist/lib/cli-resources.js +3 -1
  74. package/dist/lib/cloud/dispatch.js +1 -1
  75. package/dist/lib/cloudflare/creds.d.ts +10 -0
  76. package/dist/lib/cloudflare/creds.js +46 -0
  77. package/dist/lib/cloudflare/provision.d.ts +35 -0
  78. package/dist/lib/cloudflare/provision.js +144 -0
  79. package/dist/lib/computer/sessions-list.d.ts +55 -0
  80. package/dist/lib/computer/sessions-list.js +168 -1
  81. package/dist/lib/config-keys.d.ts +1 -1
  82. package/dist/lib/config-keys.js +5 -0
  83. package/dist/lib/daemon/daemon.js +8 -1
  84. package/dist/lib/daemon/feed-stream-service.d.ts +23 -0
  85. package/dist/lib/daemon/feed-stream-service.js +40 -0
  86. package/dist/lib/daemon-services.d.ts +1 -1
  87. package/dist/lib/daemon-services.js +5 -0
  88. package/dist/lib/device-config.js +61 -0
  89. package/dist/lib/devices/connect.d.ts +49 -5
  90. package/dist/lib/devices/connect.js +169 -21
  91. package/dist/lib/devices/doctor-findings.js +2 -6
  92. package/dist/lib/feed/answer.d.ts +153 -4
  93. package/dist/lib/feed/answer.js +716 -105
  94. package/dist/lib/feed/envelope.d.ts +79 -0
  95. package/dist/lib/feed/envelope.js +23 -0
  96. package/dist/lib/feed/events.d.ts +6 -0
  97. package/dist/lib/feed/events.js +8 -0
  98. package/dist/lib/feed/feed.d.ts +61 -1
  99. package/dist/lib/feed/feed.js +226 -14
  100. package/dist/lib/feed/hub-server.d.ts +141 -0
  101. package/dist/lib/feed/hub-server.js +586 -0
  102. package/dist/lib/feed/hub.d.ts +95 -0
  103. package/dist/lib/feed/hub.js +255 -0
  104. package/dist/lib/feed/pr-status.d.ts +8 -0
  105. package/dist/lib/feed/pr-status.js +9 -1
  106. package/dist/lib/feed/tool-activity.d.ts +108 -0
  107. package/dist/lib/feed/tool-activity.js +313 -0
  108. package/dist/lib/feed/tools.d.ts +198 -0
  109. package/dist/lib/feed/tools.js +265 -0
  110. package/dist/lib/feed/watch.d.ts +50 -50
  111. package/dist/lib/feed/watch.js +147 -16
  112. package/dist/lib/feed-outcome.d.ts +1 -1
  113. package/dist/lib/feed-outcome.js +9 -2
  114. package/dist/lib/feed-policy.js +9 -3
  115. package/dist/lib/fleet/auth-sync.d.ts +2 -55
  116. package/dist/lib/fleet/auth-sync.js +2 -89
  117. package/dist/lib/format.d.ts +1 -1
  118. package/dist/lib/format.js +1 -1
  119. package/dist/lib/git.d.ts +0 -16
  120. package/dist/lib/git.js +0 -58
  121. package/dist/lib/harness-auth-capabilities.js +7 -2
  122. package/dist/lib/helper-versions.js +1 -1
  123. package/dist/lib/hosts/dispatch.d.ts +20 -1
  124. package/dist/lib/hosts/dispatch.js +52 -30
  125. package/dist/lib/hosts/remote-cmd.d.ts +72 -1
  126. package/dist/lib/hosts/remote-cmd.js +151 -10
  127. package/dist/lib/hosts/remote-cmd.test-fixture.d.ts +2 -0
  128. package/dist/lib/hosts/remote-cmd.test-fixture.js +22 -0
  129. package/dist/lib/mailbox.d.ts +12 -0
  130. package/dist/lib/mailbox.js +16 -2
  131. package/dist/lib/mcp.js +17 -11
  132. package/dist/lib/menubar/snapshot.d.ts +51 -0
  133. package/dist/lib/menubar/snapshot.js +42 -3
  134. package/dist/lib/open-url.js +2 -2
  135. package/dist/lib/probe.d.ts +4 -1
  136. package/dist/lib/probe.js +5 -2
  137. package/dist/lib/projects.d.ts +23 -0
  138. package/dist/lib/projects.js +78 -0
  139. package/dist/lib/pwsh.d.ts +33 -0
  140. package/dist/lib/pwsh.js +56 -0
  141. package/dist/lib/redact.d.ts +8 -0
  142. package/dist/lib/redact.js +11 -0
  143. package/dist/lib/refresh.d.ts +6 -2
  144. package/dist/lib/refresh.js +92 -72
  145. package/dist/lib/secrets-cli.d.ts +11 -0
  146. package/dist/lib/secrets-cli.js +30 -0
  147. package/dist/lib/secrets-client.js +3 -2
  148. package/dist/lib/session/active.d.ts +1 -0
  149. package/dist/lib/session/active.js +8 -0
  150. package/dist/lib/session/db.d.ts +67 -3
  151. package/dist/lib/session/db.js +381 -126
  152. package/dist/lib/session/detached.d.ts +7 -0
  153. package/dist/lib/session/detached.js +29 -0
  154. package/dist/lib/session/prompt.d.ts +23 -7
  155. package/dist/lib/session/prompt.js +46 -8
  156. package/dist/lib/session/remote/peer-stream.d.ts +24 -2
  157. package/dist/lib/session/remote/peer-stream.js +33 -6
  158. package/dist/lib/session/remote/remote-list.d.ts +20 -0
  159. package/dist/lib/session/remote/remote-list.js +22 -6
  160. package/dist/lib/session/remote/watch.d.ts +12 -0
  161. package/dist/lib/session/remote/watch.js +9 -0
  162. package/dist/lib/session/remote-preview-cache.d.ts +29 -0
  163. package/dist/lib/session/remote-preview-cache.js +373 -0
  164. package/dist/lib/session/sync/backend.d.ts +3 -3
  165. package/dist/lib/session/sync/backend.js +3 -3
  166. package/dist/lib/session/sync/provision.d.ts +1 -1
  167. package/dist/lib/session/sync/provision.js +2 -2
  168. package/dist/lib/session/tail.d.ts +50 -0
  169. package/dist/lib/session/tail.js +219 -0
  170. package/dist/lib/sessions-client.js +0 -3
  171. package/dist/lib/setup-tool-install.d.ts +3 -0
  172. package/dist/lib/setup-tool-install.js +27 -0
  173. package/dist/lib/setup-tool-status.d.ts +22 -0
  174. package/dist/lib/setup-tool-status.js +220 -0
  175. package/dist/lib/share-runtime.d.ts +11 -0
  176. package/dist/lib/share-runtime.js +63 -0
  177. package/dist/lib/signin-badge.d.ts +19 -4
  178. package/dist/lib/signin-badge.js +29 -11
  179. package/dist/lib/smart-launch.d.ts +1 -5
  180. package/dist/lib/smart-launch.js +3 -11
  181. package/dist/lib/ssh-exec.d.ts +44 -0
  182. package/dist/lib/ssh-exec.js +119 -0
  183. package/dist/lib/startup/command-registry.d.ts +6 -4
  184. package/dist/lib/startup/command-registry.js +10 -7
  185. package/dist/lib/state.js +2 -2
  186. package/dist/lib/storage/selection.d.ts +2 -2
  187. package/dist/lib/storage/selection.js +2 -2
  188. package/dist/lib/sync-umbrella.d.ts +5 -0
  189. package/dist/lib/sync-umbrella.js +18 -10
  190. package/dist/lib/term-driver.d.ts +24 -0
  191. package/dist/lib/term-driver.js +36 -0
  192. package/dist/lib/terminal/index.d.ts +1 -1
  193. package/dist/lib/terminal/index.js +1 -1
  194. package/dist/lib/terminal/inject.d.ts +38 -0
  195. package/dist/lib/terminal/inject.js +55 -9
  196. package/dist/lib/terminal/transport.d.ts +15 -5
  197. package/dist/lib/terminal/transport.js +61 -11
  198. package/dist/lib/traces/backend.d.ts +1 -2
  199. package/dist/lib/traces/backend.js +1 -2
  200. package/dist/lib/traces/provision.d.ts +1 -1
  201. package/dist/lib/traces/provision.js +2 -2
  202. package/dist/lib/types.d.ts +8 -6
  203. package/package.json +2 -3
  204. package/dist/commands/artifacts-setup.d.ts +0 -53
  205. package/dist/commands/artifacts-setup.js +0 -161
  206. package/dist/commands/artifacts.d.ts +0 -18
  207. package/dist/commands/artifacts.js +0 -58
  208. package/dist/commands/attach.d.ts +0 -12
  209. package/dist/commands/attach.js +0 -86
  210. package/dist/commands/auth-mint.d.ts +0 -12
  211. package/dist/commands/auth-mint.js +0 -108
  212. package/dist/commands/reconnect.d.ts +0 -46
  213. package/dist/commands/reconnect.js +0 -115
  214. package/dist/commands/share.d.ts +0 -293
  215. package/dist/commands/share.js +0 -1424
  216. package/dist/lib/fleet/remote-login.d.ts +0 -170
  217. package/dist/lib/fleet/remote-login.js +0 -568
  218. package/dist/lib/share/analytics.d.ts +0 -13
  219. package/dist/lib/share/analytics.js +0 -45
  220. package/dist/lib/share/backend.d.ts +0 -120
  221. package/dist/lib/share/backend.js +0 -176
  222. package/dist/lib/share/capture.d.ts +0 -31
  223. package/dist/lib/share/capture.js +0 -174
  224. package/dist/lib/share/config.d.ts +0 -72
  225. package/dist/lib/share/config.js +0 -211
  226. package/dist/lib/share/delete.d.ts +0 -123
  227. package/dist/lib/share/delete.js +0 -173
  228. package/dist/lib/share/html.d.ts +0 -20
  229. package/dist/lib/share/html.js +0 -88
  230. package/dist/lib/share/http-error.d.ts +0 -53
  231. package/dist/lib/share/http-error.js +0 -65
  232. package/dist/lib/share/og.d.ts +0 -26
  233. package/dist/lib/share/og.js +0 -84
  234. package/dist/lib/share/provision.d.ts +0 -127
  235. package/dist/lib/share/provision.js +0 -285
  236. package/dist/lib/share/publish.d.ts +0 -379
  237. package/dist/lib/share/publish.js +0 -818
  238. package/dist/lib/share/worker-template.d.ts +0 -27
  239. package/dist/lib/share/worker-template.js +0 -2424
  240. package/dist/lib/storage/index.d.ts +0 -14
  241. package/dist/lib/storage/index.js +0 -14
  242. package/dist/lib/storage/visibility.d.ts +0 -82
  243. package/dist/lib/storage/visibility.js +0 -99
@@ -1,170 +0,0 @@
1
- import type { AgentId } from '../types.js';
2
- import type { DeviceProfile } from '../devices/registry.js';
3
- import { type AuthVerdict, type AuthHealth } from '../auth-health.js';
4
- import { type LoginFlow } from './auth-sync.js';
5
- /** A verification URL + user code scraped from a device-code login screen. */
6
- interface ScrapedLogin {
7
- url?: string;
8
- code?: string;
9
- }
10
- /**
11
- * Extract the verification URL and user code from an ANSI-stripped login screen
12
- * using the flow's regexes. Pure — no I/O, so it is the highest-value unit test
13
- * target (a wrong code boundary or a missed URL is exactly the bug class this
14
- * whole feature turns on). Group 1 is preferred over the whole match so a
15
- * surrounding phrase ("enter code XXXX-XXXX") never leaks into the captured
16
- * value. A flow with no regex for a field yields `undefined` for that field.
17
- */
18
- export declare function scrapeLogin(screenText: string, flow: LoginFlow): ScrapedLogin;
19
- /** Why a logged-out (agent, device) pair can or cannot be driven remotely. */
20
- interface FlowClassification {
21
- flow: LoginFlow | null;
22
- remotable: boolean;
23
- reason?: string;
24
- }
25
- /**
26
- * Decide whether `agent`'s login can be driven on a box of `platform`. Only a
27
- * `device-code` flow is remotable; loopback (browser + 127.0.0.1 on the box),
28
- * api-key, unknown, or a macOS keychain-bound token are surfaced with an honest
29
- * reason instead of a mis-drive. Pure.
30
- */
31
- export declare function classifyLoginFlow(agent: AgentId | string, platform: string | undefined): FlowClassification;
32
- /**
33
- * Does a cached auth verdict mean "this (host, agent) needs an interactive
34
- * login"? A missing row (never signed in / credential absent) and a `revoked`
35
- * token do; `live`, `unverified` (signed in, no probe), `expired`, and
36
- * `rate_limited` are treated as already-logged-in (expired self-heals on next
37
- * launch — never re-login on it). Pure.
38
- */
39
- export declare function isPendingVerdict(verdict: AuthVerdict | undefined): boolean;
40
- /** A logged-out (agent, device) pair `fleet login` will target or explain. */
41
- interface PendingLogin {
42
- device: string;
43
- agent: AgentId | string;
44
- platform?: string;
45
- /** ssh dial target for the device. */
46
- target: string;
47
- extraSshArgs?: string[];
48
- flow: LoginFlow;
49
- /** True when a device-code flow this command can actually drive. */
50
- remotable: boolean;
51
- /** Present when `!remotable` — why it must be done on the box itself. */
52
- reason?: string;
53
- }
54
- interface SelectLoginOptions {
55
- /** Include pairs already logged-in (verdict live/unverified) — for a forced re-login. */
56
- includeLoggedIn?: boolean;
57
- }
58
- /**
59
- * From a device list, requested agents, and the auth-health cache, compute the
60
- * pending logins — partitioned (via {@link classifyLoginFlow}) into remotable
61
- * device-code flows and non-remotable pairs with a reason. Pure: the caller
62
- * supplies the already-loaded devices + cache, so this is fully unit-testable.
63
- *
64
- * A pair is pending when its cached verdict {@link isPendingVerdict} (or
65
- * `includeLoggedIn` forces it). Agents with no defined login flow are dropped
66
- * silently (nothing to log into).
67
- */
68
- export declare function selectLoginTargets(devices: DeviceProfile[], agents: (AgentId | string)[], cache: Record<string, AuthHealth>, opts?: SelectLoginOptions): PendingLogin[];
69
- /**
70
- * Build the `ssh -tt <target> <loginCommand>` command string driven through the
71
- * `term` CLI. `-tt` forces a tty so the remote CLI enters its interactive
72
- * device-code flow; `accept-new` learns a first-seen host key without a prompt.
73
- * Both the target and the login command are shell-quoted. Pure/testable.
74
- *
75
- * NOTE: this uses key-based ssh auth (the tailnet fleet's norm). Password-bundle
76
- * devices need the askpass shim env, which the PTY env allowlist strips — those
77
- * are a follow-up (TODO), surfaced as an error rather than silently mis-driven.
78
- */
79
- export declare function buildRemoteLoginSshCommand(target: string, flow: LoginFlow, extraSshArgs?: string[]): string;
80
- type LoginMode = 'bulk' | 'interactive';
81
- /** Per-pair status shape shared between the driver, the status endpoint, and the page. */
82
- export type LoginStatusState = 'pending' | 'driving' | 'ready' | 'authorized' | 'error' | 'skipped';
83
- export interface LoginStatus {
84
- device: string;
85
- agent: string;
86
- remotable: boolean;
87
- reason?: string;
88
- state: LoginStatusState;
89
- url?: string;
90
- code?: string;
91
- /** epoch ms the scraped code expires (best-effort ~15 min TTL). */
92
- expiresAt?: number;
93
- detail?: string;
94
- }
95
- /**
96
- * Render the self-contained dashboard page. Inlines all CSS/JS; the page polls
97
- * `/api/status` and flips rows to their live state. `bulk` shows a grid of every
98
- * pending login at once; `interactive` shows a one-at-a-time wizard. Pure — a
99
- * string in, a string out — so it renders (and is asserted) without a server.
100
- * Terminal-coded per the agents-cli brand (#0a0a0a bg, #a3e635 lime), with a
101
- * light variant via `prefers-color-scheme`.
102
- */
103
- export declare function buildDashboardHtml(pending: PendingLogin[], mode: LoginMode): string;
104
- /** The subset of the `term` CLI `driveRemoteLogin` needs — faked in tests. */
105
- export interface TermDriver {
106
- start(opts?: {
107
- rows?: number;
108
- cols?: number;
109
- }): Promise<string>;
110
- exec(id: string, command: string): Promise<void>;
111
- write(id: string, input: string): Promise<void>;
112
- screen(id: string): Promise<{
113
- screen: string;
114
- exited: boolean;
115
- }>;
116
- stop(id: string): Promise<void>;
117
- }
118
- /** Real driver over the standalone `term` CLI (`../term-client.js`). */
119
- export declare function defaultTermDriver(): TermDriver;
120
- export interface DriveOptions {
121
- /** Wait after launching ssh before steering / scraping (default 4000ms). */
122
- initialDelayMs?: number;
123
- /** Poll cadence for the scrape loop (default 1000ms). */
124
- pollMs?: number;
125
- /** Overall scrape deadline (default 90000ms). */
126
- timeoutMs?: number;
127
- }
128
- interface DriveResult extends ScrapedLogin {
129
- /** True when the underlying ssh session already exited (login finished or failed). */
130
- exited: boolean;
131
- /** The term session id, so the caller can keep polling / stop it. */
132
- sessionId: string;
133
- }
134
- /**
135
- * Drive one remote device-code login: launch `ssh -tt <target> <loginCommand>`
136
- * in a `term` session, send the flow's `deviceCodeSelect` keystrokes (if any) to reach the
137
- * device-code path, then poll the screen until {@link scrapeLogin} yields both a
138
- * URL and a code (or the deadline / session-exit). The human completes the code
139
- * in the browser; the caller polls the credential file for completion. Testable
140
- * against a fake {@link TermDriver}.
141
- */
142
- export declare function driveRemoteLogin(target: string, flow: LoginFlow, driver: TermDriver, opts?: DriveOptions, extraSshArgs?: string[]): Promise<DriveResult>;
143
- interface RunFleetLoginOptions {
144
- agents?: (AgentId | string)[];
145
- devices?: string[];
146
- interactive?: boolean;
147
- json?: boolean;
148
- /** Target every device-code pair regardless of cached login state (cold cache / forced re-login). */
149
- all?: boolean;
150
- /** Overrides for testing / non-default cadence. */
151
- driver?: TermDriver;
152
- drive?: DriveOptions;
153
- /** Port for the local dashboard (0 = ephemeral). */
154
- port?: number;
155
- /** Open the browser (default true). */
156
- open?: boolean;
157
- /** Max wall-clock to wait for all logins before giving up (default 20 min). */
158
- overallTimeoutMs?: number;
159
- /** ~15 min device-code TTL used for the countdown. */
160
- codeTtlMs?: number;
161
- }
162
- /**
163
- * Orchestrate `agents fleet login`: detect pending -> serve the local dashboard
164
- * + open the browser -> drive each box's device-code flow (concurrent in bulk,
165
- * sequential just-in-time in interactive) -> poll the credential file for
166
- * completion -> print a final matrix. The pure pieces above carry the logic;
167
- * this wires them to the live fleet.
168
- */
169
- export declare function runFleetLogin(opts?: RunFleetLoginOptions): Promise<LoginStatus[]>;
170
- export {};