@phnx-labs/agents-cli 1.23.13 → 1.23.14

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 (162) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +30 -59
  3. package/dist/cli/command-registry.js +0 -24
  4. package/dist/commands/accounts.js +3 -3
  5. package/dist/commands/daemon.js +5 -147
  6. package/dist/commands/doctor.js +7 -0
  7. package/dist/commands/events-logs.d.ts +2 -0
  8. package/dist/commands/{logs.js → events-logs.js} +28 -127
  9. package/dist/commands/events.js +3 -1
  10. package/dist/commands/exec.d.ts +0 -1
  11. package/dist/commands/exec.js +3 -11
  12. package/dist/commands/feed.d.ts +1 -1
  13. package/dist/commands/feed.js +4 -7
  14. package/dist/commands/mcp.js +1 -1
  15. package/dist/commands/menubar.js +12 -226
  16. package/dist/commands/projects.js +1 -2
  17. package/dist/commands/{trash.d.ts → prune-trash.d.ts} +1 -1
  18. package/dist/commands/{trash.js → prune-trash.js} +8 -8
  19. package/dist/commands/prune.js +3 -1
  20. package/dist/commands/send.js +2 -5
  21. package/dist/commands/sessions.js +1 -1
  22. package/dist/commands/ssh.js +2 -2
  23. package/dist/commands/utils.d.ts +1 -5
  24. package/dist/commands/utils.js +1 -7
  25. package/dist/lib/agent-spec/agents.d.ts +0 -2
  26. package/dist/lib/agent-spec/agents.js +0 -12
  27. package/dist/lib/agent-spec/index.d.ts +0 -4
  28. package/dist/lib/agent-spec/index.js +0 -4
  29. package/dist/lib/commands.d.ts +1 -5
  30. package/dist/lib/commands.js +2 -69
  31. package/dist/lib/comms-render.d.ts +0 -7
  32. package/dist/lib/comms-render.js +0 -41
  33. package/dist/lib/config-keys.d.ts +1 -1
  34. package/dist/lib/config-keys.js +8 -0
  35. package/dist/lib/daemon/daemon.js +1 -6
  36. package/dist/lib/daemon-services.d.ts +1 -1
  37. package/dist/lib/daemon-services.js +0 -5
  38. package/dist/lib/device-config.d.ts +2 -0
  39. package/dist/lib/device-config.js +81 -8
  40. package/dist/lib/devices/doctor-findings.d.ts +6 -1
  41. package/dist/lib/devices/doctor-findings.js +34 -1
  42. package/dist/lib/git.d.ts +1 -0
  43. package/dist/lib/git.js +5 -0
  44. package/dist/lib/hooks/install.d.ts +0 -7
  45. package/dist/lib/hooks/install.js +0 -55
  46. package/dist/lib/hosts/passthrough.js +2 -4
  47. package/dist/lib/hosts/progress.js +2 -2
  48. package/dist/lib/hosts/remote-cmd.js +0 -1
  49. package/dist/lib/installations/migrate.d.ts +1 -0
  50. package/dist/lib/installations/migrate.js +18 -1
  51. package/dist/lib/installations/versions.js +2 -2
  52. package/dist/lib/loop.js +1 -1
  53. package/dist/lib/mailbox-target.d.ts +0 -31
  54. package/dist/lib/mailbox-target.js +0 -37
  55. package/dist/lib/mcp-lookup.d.ts +7 -0
  56. package/dist/lib/mcp-lookup.js +71 -0
  57. package/dist/lib/mcp.d.ts +0 -8
  58. package/dist/lib/mcp.js +0 -47
  59. package/dist/lib/menubar/install-menubar.d.ts +0 -15
  60. package/dist/lib/menubar/install-menubar.js +24 -118
  61. package/dist/lib/menubar/resolve-version.d.ts +9 -10
  62. package/dist/lib/menubar/resolve-version.js +70 -30
  63. package/dist/lib/paths.d.ts +0 -1
  64. package/dist/lib/paths.js +0 -18
  65. package/dist/lib/plugins/skills.d.ts +0 -10
  66. package/dist/lib/plugins/skills.js +2 -165
  67. package/dist/lib/project-pull.js +1 -2
  68. package/dist/lib/resources.d.ts +1 -1
  69. package/dist/lib/routines-project.js +1 -1
  70. package/dist/lib/session/local-tmux-attach.js +2 -2
  71. package/dist/lib/startup/command-registry.js +20 -7
  72. package/dist/lib/teams/agents.js +1 -1
  73. package/dist/lib/triggers/webhook.d.ts +2 -59
  74. package/dist/lib/triggers/webhook.js +2 -422
  75. package/package.json +2 -1
  76. package/dist/commands/funnel.d.ts +0 -2
  77. package/dist/commands/funnel.js +0 -77
  78. package/dist/commands/logs.d.ts +0 -2
  79. package/dist/commands/mailboxes.d.ts +0 -2
  80. package/dist/commands/mailboxes.js +0 -400
  81. package/dist/commands/message.d.ts +0 -2
  82. package/dist/commands/message.js +0 -259
  83. package/dist/commands/packages-materialize.d.ts +0 -6
  84. package/dist/commands/packages-materialize.js +0 -90
  85. package/dist/commands/packages.d.ts +0 -5
  86. package/dist/commands/packages.js +0 -763
  87. package/dist/commands/route.d.ts +0 -2
  88. package/dist/commands/route.js +0 -259
  89. package/dist/commands/testdata/feed-hub.d.ts +0 -1
  90. package/dist/commands/testdata/feed-hub.js +0 -11
  91. package/dist/commands/tmux.d.ts +0 -7
  92. package/dist/commands/tmux.js +0 -529
  93. package/dist/commands/traces.d.ts +0 -2
  94. package/dist/commands/traces.js +0 -204
  95. package/dist/commands/webhook.d.ts +0 -5
  96. package/dist/commands/webhook.js +0 -105
  97. package/dist/lib/agent-spec/materialize.d.ts +0 -3
  98. package/dist/lib/agent-spec/materialize.js +0 -277
  99. package/dist/lib/agent-spec/package-resolve.d.ts +0 -4
  100. package/dist/lib/agent-spec/package-resolve.js +0 -231
  101. package/dist/lib/agent-spec/package-schema.d.ts +0 -3
  102. package/dist/lib/agent-spec/package-schema.js +0 -136
  103. package/dist/lib/agent-spec/package-types.d.ts +0 -94
  104. package/dist/lib/agent-spec/package-types.js +0 -10
  105. package/dist/lib/daemon/testdata/process-view-daemon.d.ts +0 -1
  106. package/dist/lib/daemon/testdata/process-view-daemon.js +0 -12
  107. package/dist/lib/daemon/testdata/process-view-start.d.ts +0 -1
  108. package/dist/lib/daemon/testdata/process-view-start.js +0 -41
  109. package/dist/lib/daemon/webhook-receiver-service.d.ts +0 -8
  110. package/dist/lib/daemon/webhook-receiver-service.js +0 -16
  111. package/dist/lib/daemon-webhooks.d.ts +0 -48
  112. package/dist/lib/daemon-webhooks.js +0 -177
  113. package/dist/lib/funnel.d.ts +0 -6
  114. package/dist/lib/funnel.js +0 -31
  115. package/dist/lib/net-close.d.ts +0 -2
  116. package/dist/lib/net-close.js +0 -20
  117. package/dist/lib/packages/output-home.d.ts +0 -9
  118. package/dist/lib/packages/output-home.js +0 -89
  119. package/dist/lib/registry.d.ts +0 -65
  120. package/dist/lib/registry.js +0 -432
  121. package/dist/lib/routers.d.ts +0 -25
  122. package/dist/lib/routers.js +0 -122
  123. package/dist/lib/run-trace-sync.d.ts +0 -7
  124. package/dist/lib/run-trace-sync.js +0 -35
  125. package/dist/lib/session/testdata/pid-registry-namespace.d.ts +0 -1
  126. package/dist/lib/session/testdata/pid-registry-namespace.js +0 -25
  127. package/dist/lib/session/testdata/process-view-namespace.d.ts +0 -1
  128. package/dist/lib/session/testdata/process-view-namespace.js +0 -56
  129. package/dist/lib/session/testdata/process-view-private.d.ts +0 -1
  130. package/dist/lib/session/testdata/process-view-private.js +0 -11
  131. package/dist/lib/testdata/daemon-health-writer.d.ts +0 -1
  132. package/dist/lib/testdata/daemon-health-writer.js +0 -8
  133. package/dist/lib/testdata/owner-notify-api.d.ts +0 -23
  134. package/dist/lib/testdata/owner-notify-api.js +0 -82
  135. package/dist/lib/testdata/refresh-coordinator-worker.d.ts +0 -1
  136. package/dist/lib/testdata/refresh-coordinator-worker.js +0 -23
  137. package/dist/lib/traces/backend.d.ts +0 -8
  138. package/dist/lib/traces/backend.js +0 -33
  139. package/dist/lib/traces/classify.d.ts +0 -40
  140. package/dist/lib/traces/classify.js +0 -70
  141. package/dist/lib/traces/config.d.ts +0 -2
  142. package/dist/lib/traces/config.js +0 -2
  143. package/dist/lib/traces/insights.d.ts +0 -30
  144. package/dist/lib/traces/insights.js +0 -198
  145. package/dist/lib/traces/phenotype.d.ts +0 -18
  146. package/dist/lib/traces/phenotype.js +0 -335
  147. package/dist/lib/traces/provision.d.ts +0 -16
  148. package/dist/lib/traces/provision.js +0 -25
  149. package/dist/lib/traces/schema2-build.d.ts +0 -28
  150. package/dist/lib/traces/schema2-build.js +0 -496
  151. package/dist/lib/traces/schema2-danger.d.ts +0 -7
  152. package/dist/lib/traces/schema2-danger.js +0 -123
  153. package/dist/lib/traces/schema2.d.ts +0 -139
  154. package/dist/lib/traces/schema2.js +0 -20
  155. package/dist/lib/traces/segments.d.ts +0 -73
  156. package/dist/lib/traces/segments.js +0 -236
  157. package/dist/lib/traces/sync.d.ts +0 -197
  158. package/dist/lib/traces/sync.js +0 -654
  159. package/dist/lib/traces/worker-template.d.ts +0 -1
  160. package/dist/lib/traces/worker-template.js +0 -292
  161. package/dist/lib/triggers/handlers.d.ts +0 -66
  162. package/dist/lib/triggers/handlers.js +0 -383
@@ -1,2 +0,0 @@
1
- import type { Command } from 'commander';
2
- export declare function registerRouteCommands(program: Command): void;
@@ -1,259 +0,0 @@
1
- import chalk from 'chalk';
2
- import { withAliases } from '../lib/verbs.js';
3
- import { listRouters, readRouter, writeRouter, deleteRouter, renameRouter, routerExists, routerSource, routersDir, validateRouter, } from '../lib/routers.js';
4
- import { MODEL_TIERS, isTierToken } from '../lib/model-tiers.js';
5
- import { die } from '../lib/format.js';
6
- import { setHelpSections } from '../lib/help.js';
7
- import { findAccount } from '../lib/account-registry.js';
8
- import * as path from 'path';
9
- function requireEditableRouter(name) {
10
- const source = routerSource(name);
11
- if (source === null)
12
- die(`Router '${name}' not found.`);
13
- if (source !== 'user') {
14
- die(`Router '${name}' resolves from the '${source}' layer, not 'user' -- ` +
15
- `agents route can only edit or remove a user-layer router. Edit its file directly, ` +
16
- `or create a user-layer router under a different name.`);
17
- }
18
- return readRouter(name);
19
- }
20
- function routerTierSummary(router) {
21
- const seen = new Set();
22
- for (const allowlist of Object.values(router.harnesses)) {
23
- for (const token of allowlist.models) {
24
- if (isTierToken(token))
25
- seen.add(token);
26
- }
27
- }
28
- if (seen.size === 0)
29
- return '-';
30
- const ordered = MODEL_TIERS.filter((t) => seen.has(t));
31
- return ordered.length === 1 ? `tier=${ordered[0]}` : `tier<=${ordered[ordered.length - 1]}`;
32
- }
33
- function accountCount(router) {
34
- const accounts = new Set();
35
- for (const allowlist of Object.values(router.harnesses)) {
36
- for (const account of allowlist.accounts ?? [])
37
- accounts.add(`${account}`);
38
- }
39
- return accounts.size;
40
- }
41
- function renderRouterRow(router) {
42
- const harnessCount = Object.keys(router.harnesses).length;
43
- return ` ${chalk.cyan(router.name.padEnd(16))} ${harnessCount} harnesses . ${accountCount(router)} accounts . ${routerTierSummary(router)}`;
44
- }
45
- function printRouterDetail(router) {
46
- const header = router.task ? `router: ${router.name} task type: ${router.task}` : `router: ${router.name}`;
47
- console.log(chalk.bold(header));
48
- const harnessNames = Object.keys(router.harnesses);
49
- if (harnessNames.length === 0) {
50
- console.log(chalk.gray(' (no harnesses allowed yet -- add one with `agents route allow <name> <harness> <model|tier>...`)'));
51
- }
52
- for (const name of harnessNames) {
53
- const allowlist = router.harnesses[name];
54
- console.log(` ${chalk.cyan(name.padEnd(10))} models: [${allowlist.models.join(', ')}] accounts: [${(allowlist.accounts ?? []).join(', ')}]`);
55
- }
56
- if (router.weights) {
57
- const w = router.weights;
58
- const parts = [];
59
- if (w.cost != null)
60
- parts.push(`cost ${w.cost}`);
61
- if (w.success != null)
62
- parts.push(`success ${w.success}`);
63
- if (w.headroom != null)
64
- parts.push(`headroom ${w.headroom}`);
65
- console.log(` ${chalk.gray('weights:')} ${parts.join(' . ')} hijack: ${router.hijack ? 'on' : 'off'}`);
66
- }
67
- else {
68
- console.log(` ${chalk.gray('hijack:')} ${router.hijack ? 'on' : 'off'}`);
69
- }
70
- }
71
- export function registerRouteCommands(program) {
72
- const routeCmd = program
73
- .command('route')
74
- .alias('routes')
75
- .description('Named routers -- reusable, task-typed allowlists of harnesses x models/tiers x linked accounts.');
76
- setHelpSections(routeCmd, {
77
- examples: `
78
- # Create a router scoped to two harnesses, capped at a tier
79
- agents route add research --harness grok,kimi --tier cheap,default
80
-
81
- # Narrow one harness's model set
82
- agents route allow research kimi kimi-k2
83
-
84
- # Link accounts so routing under this router only ever picks them
85
- agents route link-account research grok personal
86
- agents route link-account research kimi work
87
-
88
- # Inspect, rename, remove it
89
- agents route view research
90
- agents route rename research deep-research
91
- agents route list --json
92
- `,
93
- notes: `
94
- A router is a generalization of a profile -- a profile is a router
95
- pinned to one harness and one account. It never resolves a target
96
- outside its declared harness/model/tier allowlist or linked accounts.
97
-
98
- Routers are a layered resource (project > user > system, like commands,
99
- skills, and profiles) but 'agents route add'/'allow'/'link-account'
100
- always write to the user layer (~/.agents/routers/<name>.yml).
101
-
102
- The older verb names still work as aliases: 'create' for 'add',
103
- 'show' for 'view'.
104
- `,
105
- });
106
- routeCmd
107
- .command('add <name>')
108
- .alias('create')
109
- .description('Create a named router with an initial harness + tier allowlist.')
110
- .option('--harness <list>', 'Comma-separated harness ids to allow, e.g. grok,kimi')
111
- .option('--tier <list>', 'Comma-separated tier tokens applied to every listed harness, e.g. cheap,default')
112
- .option('--task <type>', 'Free-text task type this router serves, e.g. research')
113
- .action((name, opts) => {
114
- if (routerExists(name)) {
115
- die(`Router '${name}' already exists. Use 'agents route allow ${name} <harness> <model|tier>...' to edit it.`);
116
- }
117
- if (!opts.harness) {
118
- die("Missing --harness. Example: agents route add research --harness grok,kimi --tier cheap,default");
119
- }
120
- const harnesses = opts.harness.split(',').map((h) => h.trim()).filter(Boolean);
121
- const tiers = (opts.tier ?? '').split(',').map((t) => t.trim()).filter(Boolean);
122
- const router = {
123
- name,
124
- task: opts.task,
125
- harnesses: Object.fromEntries(harnesses.map((h) => [h, { models: [...tiers] }])),
126
- };
127
- try {
128
- validateRouter(router);
129
- }
130
- catch (err) {
131
- die(err.message);
132
- }
133
- writeRouter(router);
134
- console.log(chalk.green(`+ created router "${name}"`) + chalk.gray(` (${path.join(routersDir(), `${name}.yml`)})`));
135
- });
136
- withAliases(routeCmd
137
- .command('list'), 'list')
138
- .description('List every configured router.')
139
- .option('--json', 'Emit machine-readable JSON')
140
- .action((opts) => {
141
- const routers = listRouters();
142
- if (opts.json) {
143
- console.log(JSON.stringify(routers.map((r) => ({
144
- name: r.name,
145
- task: r.task ?? null,
146
- harnessCount: Object.keys(r.harnesses).length,
147
- accountCount: accountCount(r),
148
- tierSummary: routerTierSummary(r),
149
- })), null, 2));
150
- return;
151
- }
152
- if (routers.length === 0) {
153
- console.log(chalk.gray('No routers configured.'));
154
- console.log(chalk.gray('Try: agents route add research --harness grok,kimi --tier cheap,default'));
155
- return;
156
- }
157
- for (const router of routers)
158
- console.log(renderRouterRow(router));
159
- });
160
- withAliases(routeCmd
161
- .command('view <name>'), 'view')
162
- .description("Show a router's harness/model/account allowlist, weights, and hijack flag.")
163
- .option('--json', 'Emit machine-readable JSON')
164
- .action((name, opts) => {
165
- let router;
166
- try {
167
- router = readRouter(name);
168
- }
169
- catch (err) {
170
- die(err.message);
171
- }
172
- if (opts.json) {
173
- console.log(JSON.stringify(router, null, 2));
174
- return;
175
- }
176
- printRouterDetail(router);
177
- });
178
- routeCmd
179
- .command('allow <name> <harness> <models...>')
180
- .description("Set (replace) a harness's eligible model/tier allowlist under a router.")
181
- .action((name, harness, models) => {
182
- const router = requireEditableRouter(name);
183
- const existingAccounts = router.harnesses[harness]?.accounts;
184
- const next = {
185
- ...router,
186
- harnesses: {
187
- ...router.harnesses,
188
- [harness]: { models, ...(existingAccounts ? { accounts: existingAccounts } : {}) },
189
- },
190
- };
191
- try {
192
- validateRouter(next);
193
- }
194
- catch (err) {
195
- die(err.message);
196
- }
197
- writeRouter(next);
198
- console.log(chalk.green(`Router '${name}': ${harness} models -> [${models.join(', ')}]`));
199
- });
200
- routeCmd
201
- .command('link-account <name> <harness> <account>')
202
- .description('Link a durable credential account to a harness under a router.')
203
- .action((name, harness, account) => {
204
- if (!findAccount(account))
205
- die(`Unknown account '${account}'.`);
206
- const router = requireEditableRouter(name);
207
- const allowlist = router.harnesses[harness];
208
- if (!allowlist) {
209
- die(`Harness '${harness}' is not part of router '${name}'. Add it first: agents route allow ${name} ${harness} <model|tier>...`);
210
- }
211
- allowlist.accounts = allowlist.accounts ?? [];
212
- if (!allowlist.accounts.includes(account))
213
- allowlist.accounts.push(account);
214
- writeRouter(router);
215
- console.log(chalk.green(`Router '${name}': linked ${harness} account '${account}'`));
216
- });
217
- routeCmd
218
- .command('unlink-account <name> <harness> <account>')
219
- .description('Unlink a durable credential account from a harness under a router.')
220
- .action((name, harness, account) => {
221
- if (!findAccount(account))
222
- die(`Unknown account '${account}'.`);
223
- const router = requireEditableRouter(name);
224
- const allowlist = router.harnesses[harness];
225
- if (!allowlist) {
226
- die(`Harness '${harness}' is not part of router '${name}'.`);
227
- }
228
- allowlist.accounts = (allowlist.accounts ?? []).filter((a) => a !== account);
229
- writeRouter(router);
230
- console.log(chalk.green(`Router '${name}': unlinked ${harness} account '${account}'`));
231
- });
232
- withAliases(routeCmd
233
- .command('rename <old-name> <new-name>'), 'rename')
234
- .description('Rename a router, preserving every field (allowlists, weights, accounts, hijack). Errors on a name collision.')
235
- .action((oldName, newName) => {
236
- try {
237
- renameRouter(oldName, newName);
238
- console.log(chalk.green(`Router '${oldName}' renamed to '${newName}'.`));
239
- }
240
- catch (err) {
241
- die(err.message);
242
- }
243
- });
244
- withAliases(routeCmd
245
- .command('remove <name>'), 'remove')
246
- .description('Remove a router.')
247
- .action((name) => {
248
- const source = routerSource(name);
249
- if (source === null)
250
- die(`Router '${name}' not found.`);
251
- if (source !== 'user') {
252
- die(`Router '${name}' resolves from the '${source}' layer, not 'user' -- agents route remove can only remove a user-layer router.`);
253
- }
254
- const existed = deleteRouter(name);
255
- if (!existed)
256
- die(`Router '${name}' not found.`);
257
- console.log(chalk.green(`Router '${name}' removed.`));
258
- });
259
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,11 +0,0 @@
1
- import { FeedHub } from '../../lib/feed/hub.js';
2
- import { FeedHubServer } from '../../lib/feed/hub-server.js';
3
- import { watchFleetFeed, watchLocalFeed } from '../../lib/feed/watch.js';
4
- import { machineId } from '../../lib/machine-id.js';
5
- const local = new FeedHub({
6
- watch: ({ signal, emit }) => watchLocalFeed({ scope: machineId(), signal, emit, sessions: { heartbeatMs: 200 } }),
7
- });
8
- const server = new FeedHubServer(new FeedHub({ watch: watchFleetFeed }), undefined, local);
9
- await server.start();
10
- process.stdout.write('ready\n');
11
- process.once('SIGTERM', () => { void server.stop().then(() => process.exit(0)); });
@@ -1,7 +0,0 @@
1
- import type { Command } from 'commander';
2
- import { type ListedSession } from '../lib/tmux/index.js';
3
- export declare function registerTmuxCommands(program: Command): void;
4
- export declare function tmuxScreenSnippet(raw: string, max?: number): string;
5
- export declare function tmuxScreenPreview(raw: string, maxLines?: number): string;
6
- export declare function formatTmuxKillLabel(s: ListedSession, snippet: string, nowMs?: number): string;
7
- export declare function formatTmuxKillPreview(s: ListedSession, raw: string, nowMs?: number): string;