@phnx-labs/agents-cli 1.22.60 → 1.22.62

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 (98) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/README.md +6 -0
  3. package/dist/cli/command-registry.d.ts +1 -0
  4. package/dist/cli/command-registry.js +2 -0
  5. package/dist/commands/browser.js +9 -4
  6. package/dist/commands/doctor.js +1 -1
  7. package/dist/commands/exec.js +35 -1
  8. package/dist/commands/feed.js +3 -1
  9. package/dist/commands/harness-hooks.d.ts +55 -0
  10. package/dist/commands/harness-hooks.js +104 -0
  11. package/dist/commands/harness-wizard.d.ts +33 -14
  12. package/dist/commands/harness-wizard.js +53 -23
  13. package/dist/commands/harness.d.ts +14 -0
  14. package/dist/commands/harness.js +86 -5
  15. package/dist/commands/monitors.js +3 -3
  16. package/dist/commands/reminders.d.ts +9 -0
  17. package/dist/commands/reminders.js +49 -0
  18. package/dist/commands/run-account-picker.d.ts +14 -0
  19. package/dist/commands/run-account-picker.js +13 -0
  20. package/dist/commands/send.js +4 -1
  21. package/dist/commands/teams.d.ts +1 -1
  22. package/dist/commands/teams.js +9 -3
  23. package/dist/index.js +9 -0
  24. package/dist/lib/accounting/rotate.d.ts +63 -0
  25. package/dist/lib/accounting/rotate.js +229 -13
  26. package/dist/lib/browser/drivers/local.d.ts +11 -0
  27. package/dist/lib/browser/drivers/local.js +26 -0
  28. package/dist/lib/browser/profiles.js +8 -6
  29. package/dist/lib/browser/service.d.ts +12 -8
  30. package/dist/lib/browser/service.js +38 -10
  31. package/dist/lib/channels/owner-forward.d.ts +14 -8
  32. package/dist/lib/channels/owner-forward.js +9 -5
  33. package/dist/lib/channels/registry.d.ts +2 -0
  34. package/dist/lib/channels/send.js +13 -1
  35. package/dist/lib/claude-statusline.d.ts +14 -1
  36. package/dist/lib/claude-statusline.js +27 -2
  37. package/dist/lib/daemon/runner.js +17 -2
  38. package/dist/lib/devices/doctor-findings.d.ts +1 -1
  39. package/dist/lib/devices/doctor-findings.js +22 -4
  40. package/dist/lib/doctor-diff.d.ts +21 -5
  41. package/dist/lib/doctor-diff.js +242 -76
  42. package/dist/lib/feed/events.d.ts +1 -1
  43. package/dist/lib/feed/events.js +25 -16
  44. package/dist/lib/feed-broadcast.js +5 -12
  45. package/dist/lib/github/gh-overload.d.ts +58 -0
  46. package/dist/lib/github/gh-overload.js +246 -0
  47. package/dist/lib/github/rest.d.ts +64 -0
  48. package/dist/lib/github/rest.js +111 -0
  49. package/dist/lib/harness-connection-test.d.ts +57 -0
  50. package/dist/lib/harness-connection-test.js +80 -0
  51. package/dist/lib/heal.js +8 -3
  52. package/dist/lib/humans.d.ts +9 -0
  53. package/dist/lib/humans.js +29 -8
  54. package/dist/lib/installations/shims.d.ts +22 -0
  55. package/dist/lib/installations/shims.js +104 -0
  56. package/dist/lib/linear-project-counts.js +8 -0
  57. package/dist/lib/linear-rate-limit.d.ts +26 -0
  58. package/dist/lib/linear-rate-limit.js +163 -0
  59. package/dist/lib/mcp.d.ts +9 -0
  60. package/dist/lib/mcp.js +37 -1
  61. package/dist/lib/notify.d.ts +3 -0
  62. package/dist/lib/notify.js +63 -21
  63. package/dist/lib/open-url.js +5 -3
  64. package/dist/lib/permissions.d.ts +28 -0
  65. package/dist/lib/permissions.js +156 -1
  66. package/dist/lib/refresh.js +9 -1
  67. package/dist/lib/reminders.d.ts +29 -0
  68. package/dist/lib/reminders.js +88 -0
  69. package/dist/lib/resource-content-diff.d.ts +33 -0
  70. package/dist/lib/resource-content-diff.js +103 -0
  71. package/dist/lib/rules/compile.d.ts +7 -0
  72. package/dist/lib/rules/compile.js +7 -1
  73. package/dist/lib/session/active.d.ts +41 -4
  74. package/dist/lib/session/active.js +58 -7
  75. package/dist/lib/session/host-link.d.ts +22 -0
  76. package/dist/lib/session/host-link.js +40 -4
  77. package/dist/lib/session/trajectory.d.ts +42 -0
  78. package/dist/lib/session/trajectory.js +46 -27
  79. package/dist/lib/ssh-exec.d.ts +30 -0
  80. package/dist/lib/ssh-exec.js +37 -5
  81. package/dist/lib/startup/command-registry.js +1 -1
  82. package/dist/lib/subagents-registry.d.ts +18 -0
  83. package/dist/lib/subagents-registry.js +79 -0
  84. package/dist/lib/teams/agents.d.ts +12 -0
  85. package/dist/lib/teams/agents.js +51 -0
  86. package/dist/lib/traces/schema2-build.d.ts +85 -0
  87. package/dist/lib/traces/schema2-build.js +637 -0
  88. package/dist/lib/traces/schema2-danger.d.ts +36 -0
  89. package/dist/lib/traces/schema2-danger.js +185 -0
  90. package/dist/lib/traces/schema2.d.ts +149 -0
  91. package/dist/lib/traces/schema2.js +20 -0
  92. package/dist/lib/traces/sync.d.ts +93 -0
  93. package/dist/lib/traces/sync.js +75 -22
  94. package/dist/lib/traces/worker-template.js +5 -0
  95. package/dist/lib/uninstall.js +10 -1
  96. package/dist/lib/workflows.d.ts +11 -0
  97. package/dist/lib/workflows.js +67 -8
  98. package/package.json +1 -1
@@ -0,0 +1,85 @@
1
+ /**
2
+ * schema2-build — the PRODUCER's per-tool mappers + `buildSessionDetailV2`
3
+ * (PHNX-3442 step 2, increments 2-4).
4
+ *
5
+ * Populates the `SessionStepV2` discriminated union (schema2.ts) from the parsed
6
+ * session events, reusing the SAME infrastructure the schema-1 path already uses:
7
+ *
8
+ * - the callId pairing loop (`pairSteps` in session/trajectory.ts) — so a step's
9
+ * (use event, result event) triple is recovered without a duplicate loop;
10
+ * - bash unwrap/tokenize/classify (`session/bash-command.ts`) + the effective
11
+ * program resolver (`effectiveProgram`);
12
+ * - the meta / whereItWentWrong / surfacedToolFailures / active-time helpers
13
+ * factored out of sync.ts (`buildDetailMeta`, `buildWhereItWentWrong`, …).
14
+ *
15
+ * The command/patch/output PARSING lives here; the worker stores the shard
16
+ * opaquely and the console reads the union directly and never reparses (spec §5).
17
+ *
18
+ * category / risk / categoryMetrics are DELIBERATELY omitted from the schema-2
19
+ * detail: the shipped consumer (`decodeSessionDetail` → coerceCategory/Risk/Metrics)
20
+ * backfills them to the same neutral defaults it uses for schema-1, so computing
21
+ * them here would be inventing session-level signal this step does not own.
22
+ */
23
+ import { type BashCategory as ClassifierCategory } from '../session/bash-command.js';
24
+ import { type SessionTrajectory } from '../session/trajectory.js';
25
+ import type { SessionEvent } from '../session/types.js';
26
+ import type { BashAction, BashCategory, SessionStepV2 } from './schema2.js';
27
+ import { activeMsFromTrajectory, type SessionDetail } from './sync.js';
28
+ /**
29
+ * SessionDetailV2 — the schema-2 shard this producer emits.
30
+ *
31
+ * `category` / `risk` / `categoryMetrics` are DELIBERATELY OMITTED. The consumer's
32
+ * `SessionDetailV2` declares them, but its `decodeSchema2` backfills neutral
33
+ * defaults via `coerceCategory`/`coerceRisk`/`coerceMetrics` (never throws) — the
34
+ * same defaulting it applies to schema-1 shards today. This producer does not yet
35
+ * author those fields (their provenance is the prix/api PHNX-3351 hosted backend,
36
+ * not agents-cli), so emitting them here would fabricate classification. Omission
37
+ * is the honest choice and is asserted as a tested contract in
38
+ * `schema2-fixture.test.ts`. Wire real category/risk here once its source is settled.
39
+ */
40
+ export interface SessionDetailV2 {
41
+ schema: 2;
42
+ id: string;
43
+ meta: SessionDetail['meta'];
44
+ steps: SessionStepV2[];
45
+ gaps: SessionTrajectory['gaps'];
46
+ truncatedSteps: number;
47
+ whereItWentWrong: string | null;
48
+ surfacedToolFailures: Array<{
49
+ tool?: string;
50
+ label: string;
51
+ detail?: string;
52
+ }>;
53
+ }
54
+ /**
55
+ * `unwrapCommand` (bash-command.ts) strips VAR=/sudo/cd&&/npx/loops/subshells but
56
+ * NOT an interpreter wrapper like `/bin/zsh -lc "…"`, `bash -lc '…'`, or `sh -c …`
57
+ * — the exact shape the managed runner wraps every command in. Peel that first,
58
+ * then hand the inner payload to the existing unwrapper so all the wrappers it DOES
59
+ * know still apply. One extra rule, at the source, not a fork of unwrapCommand.
60
+ */
61
+ export declare function unwrapShellExec(command: string): string;
62
+ /**
63
+ * Map a classifier `BashCategory` (the rich vcs|build-test|install|… taxonomy) to
64
+ * the coarse schema-2 `BashCategory` (build|test|git|network|other). `build-test`
65
+ * needs the argv/subcommand to decide build vs test — `bun test` is test, `bun
66
+ * build` is build — so this takes the tokenized argv too.
67
+ */
68
+ export declare function mapBashCategory(cat: ClassifierCategory, argv: string[]): BashCategory;
69
+ /** Build the per-segment BashAction list for a bash command. */
70
+ export declare function buildBashActions(unwrapped: string): BashAction[];
71
+ export interface BuildDetailV2Options {
72
+ redact?: boolean;
73
+ knownSecrets?: readonly string[];
74
+ }
75
+ /**
76
+ * Build the schema-2 per-session detail from a pre-built trajectory and its raw
77
+ * events. The trajectory supplies meta/gaps/whereItWentWrong/surfacedToolFailures
78
+ * (via the shared sync.ts helpers) and the truncation count; the raw events supply
79
+ * the per-tool detail the schema-1 flat step could not carry.
80
+ *
81
+ * Re-pairs the events with `pairSteps` (the SAME loop buildTrajectory ran) to
82
+ * recover each step's (use event, result event) triple, then dispatches per tool.
83
+ */
84
+ export declare function buildSessionDetailV2(traj: SessionTrajectory, events: SessionEvent[], options?: BuildDetailV2Options): SessionDetailV2;
85
+ export { activeMsFromTrajectory };