@phnx-labs/agents-cli 1.22.56 → 1.22.57

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 (61) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +4 -4
  3. package/dist/bootstrap.js +3 -1
  4. package/dist/cli/command-registry.d.ts +0 -1
  5. package/dist/cli/command-registry.js +0 -3
  6. package/dist/commands/exec.js +1 -1
  7. package/dist/commands/hooks.js +4 -4
  8. package/dist/commands/insights.d.ts +7 -5
  9. package/dist/commands/insights.js +16 -9
  10. package/dist/commands/perf.d.ts +16 -7
  11. package/dist/commands/perf.js +29 -20
  12. package/dist/commands/rules.js +1 -1
  13. package/dist/commands/ssh.js +24 -14
  14. package/dist/commands/trash.d.ts +2 -2
  15. package/dist/commands/trash.js +2 -6
  16. package/dist/commands/versions.d.ts +2 -2
  17. package/dist/commands/versions.js +1 -10
  18. package/dist/commands/view.d.ts +2 -2
  19. package/dist/commands/view.js +7 -6
  20. package/dist/index.d.ts +1 -0
  21. package/dist/index.js +9 -0
  22. package/dist/lib/accounting/usage-ingest.d.ts +1 -0
  23. package/dist/lib/accounting/usage-ingest.js +75 -0
  24. package/dist/lib/accounting/usage-sync.d.ts +69 -0
  25. package/dist/lib/accounting/usage-sync.js +129 -0
  26. package/dist/lib/accounting/usage.d.ts +48 -2
  27. package/dist/lib/accounting/usage.js +72 -1
  28. package/dist/lib/agent-spec/agents.js +1 -1
  29. package/dist/lib/analytics/mix-commands.d.ts +8 -7
  30. package/dist/lib/analytics/mix-commands.js +50 -73
  31. package/dist/lib/daemon/daemon.js +5 -0
  32. package/dist/lib/daemon/runner.js +9 -8
  33. package/dist/lib/daemon/usage-sync-service.d.ts +21 -0
  34. package/dist/lib/daemon/usage-sync-service.js +36 -0
  35. package/dist/lib/daemon-services.d.ts +1 -1
  36. package/dist/lib/daemon-services.js +5 -0
  37. package/dist/lib/device-config.d.ts +17 -6
  38. package/dist/lib/device-config.js +25 -11
  39. package/dist/lib/devices/pool.d.ts +4 -3
  40. package/dist/lib/devices/pool.js +13 -5
  41. package/dist/lib/exec.d.ts +6 -41
  42. package/dist/lib/exec.js +6 -41
  43. package/dist/lib/git.d.ts +13 -1
  44. package/dist/lib/git.js +36 -7
  45. package/dist/lib/harness/adapter.d.ts +7 -7
  46. package/dist/lib/harness/adapters/claude.js +3 -2
  47. package/dist/lib/hosts/remote-cmd.d.ts +9 -0
  48. package/dist/lib/hosts/remote-cmd.js +22 -0
  49. package/dist/lib/perf/db.d.ts +1 -1
  50. package/dist/lib/perf/db.js +1 -1
  51. package/dist/lib/session/active.d.ts +3 -31
  52. package/dist/lib/session/active.js +8 -68
  53. package/dist/lib/session/db.d.ts +4 -35
  54. package/dist/lib/session/db.js +4 -35
  55. package/dist/lib/session/discover.d.ts +6 -58
  56. package/dist/lib/session/discover.js +5 -43
  57. package/dist/lib/session/parse.d.ts +1 -19
  58. package/dist/lib/session/parse.js +2 -15
  59. package/dist/lib/startup/command-registry.d.ts +8 -2
  60. package/dist/lib/startup/command-registry.js +12 -4
  61. package/package.json +1 -1
@@ -28,28 +28,10 @@ export declare function sanitizeEvents(events: SessionEvent[]): void;
28
28
  * ERR_STRING_TOO_LONG ceiling.
29
29
  */
30
30
  export declare function safeReadSessionFile(filePath: string, maxBytes?: number): string;
31
- /**
32
- * Auto-detect agent type from file path and parse the session.
33
- */
34
31
  export interface ParseSessionOptions {
35
32
  /** Keep normalized tool results compact by default; renderers can request full output. */
36
33
  maxToolOutputChars?: number;
37
- /**
38
- * Emit an `interrupt` event where the transcript records `[Request interrupted`.
39
- *
40
- * OFF by default, deliberately. That marker is not a user message, and the default
41
- * event array is a versioned consumer contract: `agents sessions <id> --json`
42
- * serializes it verbatim (see render.ts, issue #743), `computeSummaryStats` folds
43
- * every event's timestamp into the session duration, and the live-state reader and
44
- * tail renderer inspect fixed-size windows of the last N events. Emitting it
45
- * unconditionally changed all four — a measured 12x duration swing on one real
46
- * transcript, a new object in a published payload, and an eviction from the
47
- * 12-event rate-limit window whose trigger shape (a trailing interrupt) is exactly
48
- * a session the user just cancelled.
49
- *
50
- * `agents insights` opts in: an interruption is a real friction signal, and dropping
51
- * it outright is what made it unrecoverable.
52
- */
34
+ /** Opt-in because interrupts are not user messages and would change the published event stream. */
53
35
  includeInterrupts?: boolean;
54
36
  }
55
37
  export declare function parseSession(filePath: string, agent?: SessionAgentId, opts?: ParseSessionOptions): SessionEvent[];
@@ -117,14 +117,7 @@ function truncateNormalizedToolOutput(output, maxChars) {
117
117
  return output;
118
118
  return `${output.slice(0, maxChars)}\n\n[Output truncated: ${output.length - maxChars} characters omitted.]`;
119
119
  }
120
- /**
121
- * Registry-dispatch table: each `SessionAgentId` to its offline transcript
122
- * parser. Replaces the per-harness `switch` — the harness axis of Move 3. Kept
123
- * as its own table (not on the HarnessAdapter registry) because its id domain is
124
- * `SessionAgentId`: `rush` is a session agent with no `AgentId`, and the offline
125
- * transcript reader is a deliberately separate concern from live team events.
126
- * The `Record` is total, so a new session harness must add an entry here.
127
- */
120
+ /** Separate from HarnessAdapter because offline transcripts include session-only agents such as Rush. */
128
121
  const TRANSCRIPT_PARSERS = {
129
122
  claude: (filePath, opts) => parseClaude(filePath, opts),
130
123
  codex: (filePath) => parseCodex(filePath),
@@ -146,13 +139,7 @@ export function parseSession(filePath, agent, opts = {}) {
146
139
  throw new Error(`Cannot detect agent type from path: ${filePath}`);
147
140
  }
148
141
  const events = TRANSCRIPT_PARSERS[detected](filePath, opts);
149
- // Chokepoint: every string field that originated in an untrusted session
150
- // file gets stripped of terminal escapes here, so renderers downstream can
151
- // safely splat values into chalk/console output. Same pass flags
152
- // harness-injected `role=user` scaffolding (Claude `<bash-input>`/`<bash-stdout>`
153
- // from `!`-prefix runs, `<system-reminder>`, etc.) as `_synthetic` so turn
154
- // slicing and `--include user` count only genuine user intent — one place,
155
- // every harness, instead of per-consumer regex.
142
+ // Sanitize untrusted strings and identify synthetic user scaffolding once for every consumer.
156
143
  const maxToolOutputChars = opts.maxToolOutputChars ?? 500;
157
144
  for (const e of events) {
158
145
  if (e.type === 'tool_result' && e.output) {
@@ -26,7 +26,8 @@ export declare const KNOWN_TOP_LEVEL_COMMANDS: ReadonlySet<string>;
26
26
  * (linear-cli) (RUSH-2932). `alias` moved under `agents setup alias` (RUSH-2965).
27
27
  * `inbox` was a pure alias of `agents feed` (RUSH-2984). `unshare` nested under
28
28
  * `agents artifacts unshare` (RUSH-2989). `audit` nested under `agents events audit`.
29
- * `trends` nested under `agents insights mix` / `insights trends`. `serve` (the
29
+ * `trends` was removed with the insights recipe collapse — the one counter
30
+ * surface is `agents insights mix` (PHNX-3391). `serve` (the
30
31
  * read-only local web companion + `--control` anchor) was removed with the
31
32
  * unshipped iOS Fleet Cockpit it existed for (RUSH-3001). `apply` nested under
32
33
  * `agents fleet apply` / `agents devices apply`. `beta` nested under
@@ -34,7 +35,12 @@ export declare const KNOWN_TOP_LEVEL_COMMANDS: ReadonlySet<string>;
34
35
  * removed; `agents auth` returned against Phoenix ID with `auth space` as the
35
36
  * team surface (RUSH-2581). `usage` was removed as a duplicate surface of
36
37
  * `agents view`, which renders per-account usage with account, version, and
37
- * auth state beside it (RUSH-3079).
38
+ * auth state beside it (RUSH-3079). `perf` nested under `agents insights perf`
39
+ * — performance metrics are an insight, not a top-level noun (PHNX-3391).
40
+ * `list` was removed — it was a long-deprecated full duplicate of `agents view`
41
+ * (it already printed "agents list is now agents view"); `agents view` is the
42
+ * one version-listing surface (PHNX-3391). The `agents trash restore` subcommand
43
+ * was likewise removed as an exact duplicate of top-level `agents restore`.
38
44
  */
39
45
  export declare const RETIRED_TOP_LEVEL_COMMANDS: ReadonlySet<string>;
40
46
  export declare function isKnownTopLevelCommand(name: string): boolean;
@@ -1,11 +1,11 @@
1
1
  const LOADED_COMMAND_NAMES = [
2
2
  'accounts', 'auth', 'view', 'inspect', 'feedback', 'commands', 'hooks', 'skills', 'rules', 'memory',
3
- 'permissions', 'mcp', 'clis', 'subagents', 'plugins', 'workflows', 'add', 'use', 'list',
3
+ 'permissions', 'mcp', 'clis', 'subagents', 'plugins', 'workflows', 'add', 'use',
4
4
  'remove', 'rm', 'purge', 'update', 'prune', 'import', 'registry', 'search', 'install',
5
5
  'routines', 'monitors', 'projects', 'run', 'open', 'reconnect', 'fork', 'config',
6
6
  'models', 'modes', 'trash', 'restore', 'doctor',
7
7
  'route', 'harness', 'harnesses', 'secrets', 'menubar', 'sync',
8
- 'refresh-rules', 'factory', 'insights', 'trace', 'perf',
8
+ 'refresh-rules', 'factory', 'insights', 'trace',
9
9
  'pty', 'tmux', 'watchdog', 'browser', 'computer', 'logs', 'events',
10
10
  'ssh', 'devices', 'fleet', 'repos', 'repo', 'setup', 'uninstall', 'upgrade', 'sessions',
11
11
  'teams', 'cloud', 'message', 'send', 'notify', 'feed',
@@ -46,7 +46,8 @@ export const KNOWN_TOP_LEVEL_COMMANDS = new Set([
46
46
  * (linear-cli) (RUSH-2932). `alias` moved under `agents setup alias` (RUSH-2965).
47
47
  * `inbox` was a pure alias of `agents feed` (RUSH-2984). `unshare` nested under
48
48
  * `agents artifacts unshare` (RUSH-2989). `audit` nested under `agents events audit`.
49
- * `trends` nested under `agents insights mix` / `insights trends`. `serve` (the
49
+ * `trends` was removed with the insights recipe collapse — the one counter
50
+ * surface is `agents insights mix` (PHNX-3391). `serve` (the
50
51
  * read-only local web companion + `--control` anchor) was removed with the
51
52
  * unshipped iOS Fleet Cockpit it existed for (RUSH-3001). `apply` nested under
52
53
  * `agents fleet apply` / `agents devices apply`. `beta` nested under
@@ -54,7 +55,12 @@ export const KNOWN_TOP_LEVEL_COMMANDS = new Set([
54
55
  * removed; `agents auth` returned against Phoenix ID with `auth space` as the
55
56
  * team surface (RUSH-2581). `usage` was removed as a duplicate surface of
56
57
  * `agents view`, which renders per-account usage with account, version, and
57
- * auth state beside it (RUSH-3079).
58
+ * auth state beside it (RUSH-3079). `perf` nested under `agents insights perf`
59
+ * — performance metrics are an insight, not a top-level noun (PHNX-3391).
60
+ * `list` was removed — it was a long-deprecated full duplicate of `agents view`
61
+ * (it already printed "agents list is now agents view"); `agents view` is the
62
+ * one version-listing surface (PHNX-3391). The `agents trash restore` subcommand
63
+ * was likewise removed as an exact duplicate of top-level `agents restore`.
58
64
  */
59
65
  export const RETIRED_TOP_LEVEL_COMMANDS = new Set([
60
66
  'webhook',
@@ -85,6 +91,8 @@ export const RETIRED_TOP_LEVEL_COMMANDS = new Set([
85
91
  'trends',
86
92
  'apply',
87
93
  'beta',
94
+ 'perf',
95
+ 'list',
88
96
  ]);
89
97
  export function isKnownTopLevelCommand(name) {
90
98
  return KNOWN_TOP_LEVEL_COMMANDS.has(name);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phnx-labs/agents-cli",
3
- "version": "1.22.56",
3
+ "version": "1.22.57",
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",