@phnx-labs/agents-cli 1.22.43 → 1.22.44

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 (164) hide show
  1. package/CHANGELOG.md +77 -0
  2. package/README.md +14 -12
  3. package/dist/bootstrap.js +8 -6
  4. package/dist/cli/command-registry.d.ts +0 -5
  5. package/dist/cli/command-registry.js +1 -17
  6. package/dist/commands/apply.d.ts +7 -10
  7. package/dist/commands/apply.js +15 -35
  8. package/dist/commands/artifacts.js +4 -5
  9. package/dist/commands/audit.d.ts +6 -6
  10. package/dist/commands/audit.js +12 -12
  11. package/dist/commands/auth.js +7 -3
  12. package/dist/commands/beta.d.ts +7 -1
  13. package/dist/commands/beta.js +16 -9
  14. package/dist/commands/commands.js +1 -1
  15. package/dist/commands/doctor.js +1 -4
  16. package/dist/commands/events.d.ts +2 -2
  17. package/dist/commands/events.js +6 -5
  18. package/dist/commands/exec.d.ts +1 -1
  19. package/dist/commands/exec.js +8 -4
  20. package/dist/commands/factory.d.ts +1 -1
  21. package/dist/commands/fleet-capture.d.ts +1 -1
  22. package/dist/commands/fleet-capture.js +4 -5
  23. package/dist/commands/harness.js +1 -49
  24. package/dist/commands/hooks.js +1 -1
  25. package/dist/commands/insights.d.ts +1 -1
  26. package/dist/commands/insights.js +3 -2
  27. package/dist/commands/menubar.js +58 -1
  28. package/dist/commands/org.d.ts +5 -0
  29. package/dist/commands/org.js +82 -29
  30. package/dist/commands/output.js +2 -2
  31. package/dist/commands/prune.js +5 -4
  32. package/dist/commands/routines.test-fixture.d.ts +86 -0
  33. package/dist/commands/routines.test-fixture.js +345 -0
  34. package/dist/commands/sessions.test-fixture.d.ts +24 -0
  35. package/dist/commands/sessions.test-fixture.js +224 -0
  36. package/dist/commands/setup.js +5 -1
  37. package/dist/commands/share.d.ts +9 -10
  38. package/dist/commands/share.js +68 -50
  39. package/dist/commands/skills.js +1 -1
  40. package/dist/commands/ssh.js +15 -62
  41. package/dist/commands/subagents.js +1 -1
  42. package/dist/commands/view.js +5 -2
  43. package/dist/lib/analytics/mix-commands.d.ts +6 -28
  44. package/dist/lib/analytics/mix-commands.js +14 -40
  45. package/dist/lib/audit/log.d.ts +2 -2
  46. package/dist/lib/audit/log.js +2 -2
  47. package/dist/lib/beta.js +1 -1
  48. package/dist/lib/browser/domain-skills.d.ts +26 -6
  49. package/dist/lib/browser/domain-skills.js +81 -43
  50. package/dist/lib/daemon/daemon.js +11 -0
  51. package/dist/lib/daemon/daemon.test-fixture.d.ts +24 -0
  52. package/dist/lib/daemon/daemon.test-fixture.js +71 -0
  53. package/dist/lib/daemon-ticks.d.ts +38 -1
  54. package/dist/lib/daemon-ticks.js +52 -5
  55. package/dist/lib/device-config.js +1 -2
  56. package/dist/lib/devices/discovery-policy.d.ts +3 -3
  57. package/dist/lib/devices/discovery-policy.js +3 -3
  58. package/dist/lib/devices/fleet.d.ts +4 -8
  59. package/dist/lib/devices/fleet.js +3 -15
  60. package/dist/lib/devices/health-report.js +3 -3
  61. package/dist/lib/devices/pool.d.ts +0 -6
  62. package/dist/lib/devices/pool.js +0 -6
  63. package/dist/lib/devices/registry.d.ts +0 -15
  64. package/dist/lib/devices/registry.js +0 -9
  65. package/dist/lib/devices/stats-cache.d.ts +12 -0
  66. package/dist/lib/devices/stats-cache.js +24 -5
  67. package/dist/lib/fleet/capture.d.ts +1 -1
  68. package/dist/lib/fleet/manifest.js +1 -1
  69. package/dist/lib/fleet/remote-login.d.ts +2 -2
  70. package/dist/lib/fleet/remote-login.js +3 -4
  71. package/dist/lib/hosts/dispatch.d.ts +2 -0
  72. package/dist/lib/hosts/dispatch.js +8 -1
  73. package/dist/lib/hosts/passthrough.js +0 -1
  74. package/dist/lib/hosts/providers/devices.js +1 -13
  75. package/dist/lib/hosts/ready.d.ts +12 -3
  76. package/dist/lib/hosts/ready.js +27 -12
  77. package/dist/lib/hosts/registry.d.ts +4 -5
  78. package/dist/lib/hosts/registry.js +3 -7
  79. package/dist/lib/installations/versions.js +21 -2
  80. package/dist/lib/menubar/MenubarHelper.app/Contents/Info.plist +1 -5
  81. package/dist/lib/menubar/MenubarHelper.app/Contents/MacOS/MenubarHelper +0 -0
  82. package/dist/lib/menubar/MenubarHelper.app/Contents/_CodeSignature/CodeResources +2 -15
  83. package/dist/lib/menubar/install-menubar.d.ts +109 -0
  84. package/dist/lib/menubar/install-menubar.js +199 -4
  85. package/dist/lib/prix-account.d.ts +2 -1
  86. package/dist/lib/prix-account.js +2 -1
  87. package/dist/lib/remote-agents-json.js +1 -7
  88. package/dist/lib/routines-placement.d.ts +1 -1
  89. package/dist/lib/routines-placement.js +1 -1
  90. package/dist/lib/secrets/Agents CLI.app/Contents/CodeResources +0 -0
  91. package/dist/lib/secrets/Agents CLI.app/Contents/Info.plist +0 -2
  92. package/dist/lib/secrets/Agents CLI.app/Contents/MacOS/Agents CLI +0 -0
  93. package/dist/lib/secrets/Agents CLI.app/Contents/_CodeSignature/CodeResources +1 -13
  94. package/dist/lib/session/active.d.ts +4 -16
  95. package/dist/lib/session/active.js +2 -6
  96. package/dist/lib/session/db.d.ts +13 -98
  97. package/dist/lib/session/db.js +4 -11
  98. package/dist/lib/session/discover.d.ts +5 -81
  99. package/dist/lib/session/discover.js +5 -5
  100. package/dist/lib/session/remote/remote-bundle.d.ts +12 -0
  101. package/dist/lib/session/remote/remote-bundle.js +61 -0
  102. package/dist/lib/session/remote/remote-list.d.ts +148 -0
  103. package/dist/lib/session/remote/remote-list.js +607 -0
  104. package/dist/lib/session/remote/remote.d.ts +132 -0
  105. package/dist/lib/session/remote/remote.js +314 -0
  106. package/dist/lib/session/remote/watch.d.ts +101 -0
  107. package/dist/lib/session/remote/watch.js +241 -0
  108. package/dist/lib/session/remote-bundle.d.ts +1 -12
  109. package/dist/lib/session/remote-bundle.js +3 -61
  110. package/dist/lib/session/remote-list.d.ts +1 -148
  111. package/dist/lib/session/remote-list.js +3 -607
  112. package/dist/lib/session/remote.d.ts +1 -132
  113. package/dist/lib/session/remote.js +3 -314
  114. package/dist/lib/session/watch.d.ts +1 -101
  115. package/dist/lib/session/watch.js +3 -242
  116. package/dist/lib/share/config.d.ts +12 -2
  117. package/dist/lib/share/config.js +47 -11
  118. package/dist/lib/share/delete.js +1 -1
  119. package/dist/lib/share/publish.js +1 -1
  120. package/dist/lib/share/worker-template.js +2 -2
  121. package/dist/lib/smart-launch.d.ts +4 -4
  122. package/dist/lib/smart-launch.js +8 -18
  123. package/dist/lib/staleness/index.d.ts +3 -1
  124. package/dist/lib/staleness/index.js +21 -1
  125. package/dist/lib/staleness/types.d.ts +11 -0
  126. package/dist/lib/staleness/writers/commands.js +13 -4
  127. package/dist/lib/staleness/writers/hooks.js +3 -1
  128. package/dist/lib/staleness/writers/mcp.d.ts +0 -7
  129. package/dist/lib/staleness/writers/mcp.js +16 -1
  130. package/dist/lib/staleness/writers/rules.js +1 -1
  131. package/dist/lib/staleness/writers/skills.js +3 -1
  132. package/dist/lib/staleness/writers/subagents.d.ts +0 -9
  133. package/dist/lib/staleness/writers/subagents.js +18 -1
  134. package/dist/lib/staleness/writers/types.d.ts +10 -0
  135. package/dist/lib/startup/command-registry.d.ts +7 -1
  136. package/dist/lib/startup/command-registry.js +17 -5
  137. package/dist/lib/startup/root-command.d.ts +18 -1
  138. package/dist/lib/startup/root-command.js +18 -1
  139. package/dist/lib/state.js +7 -0
  140. package/dist/lib/teams/placement-probe.js +27 -12
  141. package/dist/lib/teams/scheduler.d.ts +3 -1
  142. package/dist/lib/types.d.ts +1 -1
  143. package/dist/lib/view-types.d.ts +3 -0
  144. package/package.json +2 -3
  145. package/dist/bin/agents +0 -0
  146. package/dist/commands/serve.d.ts +0 -10
  147. package/dist/commands/serve.js +0 -68
  148. package/dist/commands/trends.d.ts +0 -10
  149. package/dist/commands/trends.js +0 -12
  150. package/dist/lib/menubar/MenubarHelper.app/Contents/CodeResources +0 -0
  151. package/dist/lib/menubar/MenubarHelper.app/Contents/Resources/AppIcon.icns +0 -0
  152. package/dist/lib/secrets/Agents CLI.app/Contents/Resources/AppIcon.icns +0 -0
  153. package/dist/lib/serve/control.d.ts +0 -95
  154. package/dist/lib/serve/control.js +0 -260
  155. package/dist/lib/serve/data.d.ts +0 -81
  156. package/dist/lib/serve/data.js +0 -91
  157. package/dist/lib/serve/page.d.ts +0 -7
  158. package/dist/lib/serve/page.js +0 -140
  159. package/dist/lib/serve/server.d.ts +0 -80
  160. package/dist/lib/serve/server.js +0 -145
  161. package/dist/lib/serve/stream.d.ts +0 -43
  162. package/dist/lib/serve/stream.js +0 -116
  163. package/dist/lib/serve/token.d.ts +0 -35
  164. package/dist/lib/serve/token.js +0 -85
@@ -0,0 +1,148 @@
1
+ import { type DeviceProfile } from '../../devices/registry.js';
2
+ import { type RemoteAgentsJsonParseResult } from '../../remote-agents-json.js';
3
+ import type { SessionMeta } from '../types.js';
4
+ import { type ToolProgramCountEnvelope, type ToolSearchEnvelope } from '../tool-index.js';
5
+ export { REMOTE_STDOUT_MAX_BYTES, RemoteUtf8Accumulator } from '../../ssh-exec.js';
6
+ export declare const REMOTE_TOOL_AGGREGATE_MAX_BYTES: number;
7
+ export interface RemoteToolByteBudget {
8
+ remainingBytes: number;
9
+ exhausted: boolean;
10
+ }
11
+ /** Claim received bytes against one fleet-query budget before retaining them. */
12
+ export declare function consumeRemoteToolByteBudget(budget: RemoteToolByteBudget, bytes: number): boolean;
13
+ /** Charge sanitized, machine-stamped evidence because redaction may expand it. */
14
+ export declare function consumeParsedRemoteToolSearchBudget(budget: RemoteToolByteBudget, envelope: ToolSearchEnvelope): boolean;
15
+ /**
16
+ * The command run on each peer: answer for itself, as JSON, without recursing.
17
+ * `forwardedArgs` carry the caller's own query/filters (already including the
18
+ * leading `sessions` and a `--json`) so each peer returns a comparable slice.
19
+ * A Windows peer gets a PowerShell invocation (ssh lands in cmd.exe/PowerShell
20
+ * there, where `bash -lc` is not a command); every other OS keeps `bash -lc`.
21
+ */
22
+ export declare function remoteListCommand(forwardedArgs: string[], os?: string): string;
23
+ /**
24
+ * Parse a peer's `sessions --json` stdout into `SessionMeta[]`, tagging each
25
+ * with `machine`. Defensive against version skew / partial output: non-JSON or
26
+ * a non-array yields `[]`, and non-object entries are dropped rather than
27
+ * throwing. The `machine` we dialed always wins over any value the peer set on
28
+ * its own rows, so grouping keys off the computer we asked. Exported for unit
29
+ * testing without a live tailnet.
30
+ */
31
+ export declare function parseRemoteList(stdout: string, machine: string): SessionMeta[];
32
+ export declare function parseRemoteListPayload(stdout: string, machine: string, safeResolver?: boolean): {
33
+ items: SessionMeta[];
34
+ valid: boolean;
35
+ };
36
+ /** Run one remote `agents sessions … --json` and capture stdout. Resolves
37
+ * `{ code: null }` on spawn error or timeout (host treated as dead). */
38
+ export declare function sshCapture(target: string, remoteCmd: string, timeoutMs: number, aggregateBudget?: RemoteToolByteBudget, options?: {
39
+ multiplex?: boolean;
40
+ port?: number;
41
+ hostKeyOpts?: string[];
42
+ }): Promise<{
43
+ code: number | null;
44
+ stdout: string;
45
+ aggregateBudgetExceeded?: boolean;
46
+ }>;
47
+ export interface RemoteListResult {
48
+ sessions: SessionMeta[];
49
+ /** How many peer machines we attempted to reach (drives the empty-fleet tip). */
50
+ deviceCount: number;
51
+ /**
52
+ * Peers that failed to answer, by display name. The stderr note above is
53
+ * enough for a printed listing, but the interactive browser repaints over it —
54
+ * so callers rendering a full-screen UI need the outcome as data to tell
55
+ * "that box is asleep" apart from "that box has no matching sessions".
56
+ */
57
+ unreachable: string[];
58
+ }
59
+ /** Keep browse and tool-search fan-out on the same automatic peer set. */
60
+ export declare function isAutomaticSessionPeer(d: DeviceProfile, self: string): boolean;
61
+ /**
62
+ * Gather listing sessions from other machines. With an explicit `hosts` list
63
+ * (from `--device`), fan out to exactly those. Otherwise sweep the registered,
64
+ * online devices from `ag devices`, excluding this machine and any without an
65
+ * address. `forwardedArgs` are the caller's own sessions args (query + filters,
66
+ * already `--json`) so every peer returns the same slice this machine asked for.
67
+ */
68
+ export interface GatherRemoteListOptions {
69
+ /**
70
+ * Opt-in early-exit for a globally-unique id lookup (a full UUID): the first
71
+ * peer to return the matching row resolves the fan-out and cancels the rest.
72
+ * Omitted for browse/label/prefix sweeps, which must wait for every peer to
73
+ * know whether the match is unique or conflicting.
74
+ */
75
+ isDefinitive?: (session: SessionMeta, machine: string) => boolean;
76
+ /** Per-peer deadline for slower indexed browse queries. */
77
+ timeoutMs?: number;
78
+ }
79
+ export declare function gatherRemoteList(forwardedArgs: string[], hosts?: string[], opts?: GatherRemoteListOptions): Promise<RemoteListResult>;
80
+ export interface RemoteToolSearchResult {
81
+ envelopes: Array<{
82
+ machine: string;
83
+ envelope: ToolSearchEnvelope;
84
+ }>;
85
+ deviceCount: number;
86
+ unreachable: string[];
87
+ truncated: string[];
88
+ }
89
+ export interface RemoteToolProgramCountResult {
90
+ envelopes: Array<{
91
+ machine: string;
92
+ envelope: ToolProgramCountEnvelope;
93
+ }>;
94
+ deviceCount: number;
95
+ unreachable: string[];
96
+ }
97
+ export declare function parseRemoteToolProgramCount(stdout: string, machine: string, expectedProgram: string): RemoteAgentsJsonParseResult<{
98
+ machine: string;
99
+ envelope: ToolProgramCountEnvelope;
100
+ }>;
101
+ export declare function gatherRemoteToolProgramCounts(forwardedArgs: string[], hosts: string[] | undefined, expectedProgram: string): Promise<RemoteToolProgramCountResult>;
102
+ export declare function parseRemoteToolSearch(stdout: string, machine: string, expectedClauses?: string[]): ToolSearchEnvelope | undefined;
103
+ /**
104
+ * Fleet sibling of {@link gatherRemoteList} for the versioned tool-search
105
+ * envelope. Each peer executes the same local-only query against its own
106
+ * SQLite index; only compact matches cross SSH.
107
+ */
108
+ export declare function gatherRemoteToolSearch(forwardedArgs: string[], hosts?: string[], maxAggregateBytes?: number, expectedClauses?: string[]): Promise<RemoteToolSearchResult>;
109
+ /** Resolve a peer's SSH target (and OS) from the device registry by its
110
+ * normalized machine id — the same id the fan-out tags rows with. Returns
111
+ * undefined when no registered device with an address matches. */
112
+ export declare function resolvePeerTarget(machine: string): Promise<{
113
+ target: string;
114
+ os?: string;
115
+ } | undefined>;
116
+ /**
117
+ * Fetch one remote session's preview digest from its owning peer — the data
118
+ * behind the picker pane for a `_remote` row, whose transcript file this
119
+ * machine cannot parse. Runs the peer's own `agents sessions preview <id>
120
+ * --local --json` (the same envelope `agents sessions preview` already
121
+ * delegates to for a remote id) and returns its `preview` object, verbatim and
122
+ * UNSANITIZED — the caller owns scrubbing peer-supplied strings before any of
123
+ * them reach a TTY. Undefined on every failure: unregistered machine, SSH
124
+ * error, timeout, version-skewed peer with no `--json` preview envelope.
125
+ */
126
+ export declare function fetchPeerPreviewDigest(sessionId: string, machine: string, timeoutMs?: number): Promise<unknown | undefined>;
127
+ /**
128
+ * Run `agents <args>` ON a peer over SSH, attached to this terminal (inherited
129
+ * stdio). `args` is the full arg vector after the binary — callers pass e.g.
130
+ * `['sessions', id, '--markdown']` or `['sessions', 'resume', id]`. Used when a
131
+ * picked session lives on another machine: its transcript and agent binary are
132
+ * there, so both reading (no TTY) and resuming (TTY) must execute on the peer —
133
+ * not via a local `--device` hop, which would discover locally and dead-end for a
134
+ * session that exists only on the peer. Resolves 'no-target' when the machine
135
+ * isn't a dialable registered device; the caller surfaces a clear message.
136
+ *
137
+ * `opts.env` adds variables to the remote command. It deliberately does NOT
138
+ * carry `AGENTS_FLEET_REMOTE` the way the `--device` passthrough does: that marker
139
+ * gates consent-sensitive actions on the far side
140
+ * (lib/browser/remote-control.ts), and a resumed agent is a long-lived session
141
+ * that would inherit it for its whole life — `agents browser start` inside it
142
+ * would then be refused as a cross-machine drive. A one-shot `--device` command
143
+ * can carry the marker; a session cannot.
144
+ */
145
+ export declare function runOnPeer(args: string[], machine: string, opts?: {
146
+ tty?: boolean;
147
+ env?: Record<string, string>;
148
+ }): Promise<'ok' | 'no-target'>;