@phnx-labs/agents-cli 1.20.51 → 1.20.53

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 (142) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/README.md +12 -0
  3. package/dist/bin/agents +0 -0
  4. package/dist/commands/browser.js +215 -7
  5. package/dist/commands/cloud.d.ts +3 -0
  6. package/dist/commands/cloud.js +8 -1
  7. package/dist/commands/events.d.ts +1 -1
  8. package/dist/commands/events.js +2 -3
  9. package/dist/commands/exec.js +82 -3
  10. package/dist/commands/factory.js +8 -0
  11. package/dist/commands/feed.d.ts +38 -0
  12. package/dist/commands/feed.js +274 -0
  13. package/dist/commands/logs.d.ts +5 -1
  14. package/dist/commands/logs.js +248 -3
  15. package/dist/commands/mcp.js +7 -0
  16. package/dist/commands/memory.d.ts +9 -0
  17. package/dist/commands/memory.js +164 -0
  18. package/dist/commands/message.d.ts +11 -6
  19. package/dist/commands/message.js +140 -5
  20. package/dist/commands/routines.js +12 -0
  21. package/dist/commands/secrets-migrate.d.ts +2 -1
  22. package/dist/commands/secrets-migrate.js +88 -13
  23. package/dist/commands/secrets.d.ts +22 -0
  24. package/dist/commands/secrets.js +176 -42
  25. package/dist/commands/sessions.js +10 -1
  26. package/dist/commands/teams.js +4 -0
  27. package/dist/commands/worktree.js +4 -2
  28. package/dist/index.js +21 -22
  29. package/dist/lib/agents.js +249 -17
  30. package/dist/lib/answer-router.d.ts +75 -0
  31. package/dist/lib/answer-router.js +149 -0
  32. package/dist/lib/ask-classifier.d.ts +71 -0
  33. package/dist/lib/ask-classifier.js +197 -0
  34. package/dist/lib/browser/login-detection.d.ts +94 -0
  35. package/dist/lib/browser/login-detection.js +274 -0
  36. package/dist/lib/browser/profiles.d.ts +17 -8
  37. package/dist/lib/browser/profiles.js +27 -8
  38. package/dist/lib/browser/secret-ref.d.ts +10 -0
  39. package/dist/lib/browser/secret-ref.js +14 -0
  40. package/dist/lib/browser/service.js +14 -12
  41. package/dist/lib/cloud/antigravity.d.ts +0 -2
  42. package/dist/lib/cloud/antigravity.js +2 -17
  43. package/dist/lib/cloud/codex.js +3 -18
  44. package/dist/lib/cloud/rush.d.ts +15 -0
  45. package/dist/lib/cloud/rush.js +10 -16
  46. package/dist/lib/cloud/stream.js +2 -0
  47. package/dist/lib/cloud/types.d.ts +21 -0
  48. package/dist/lib/cloud/types.js +81 -0
  49. package/dist/lib/crabbox/cli.d.ts +1 -1
  50. package/dist/lib/crabbox/cli.js +12 -2
  51. package/dist/lib/crabbox/lease.d.ts +19 -0
  52. package/dist/lib/crabbox/lease.js +22 -11
  53. package/dist/lib/crabbox/progress.d.ts +62 -0
  54. package/dist/lib/crabbox/progress.js +129 -0
  55. package/dist/lib/crabbox/runtimes.d.ts +38 -1
  56. package/dist/lib/crabbox/runtimes.js +98 -5
  57. package/dist/lib/daemon.d.ts +12 -9
  58. package/dist/lib/daemon.js +32 -17
  59. package/dist/lib/events.d.ts +31 -5
  60. package/dist/lib/events.js +291 -101
  61. package/dist/lib/exec.js +20 -1
  62. package/dist/lib/feed-outcome.d.ts +101 -0
  63. package/dist/lib/feed-outcome.js +244 -0
  64. package/dist/lib/feed-policy.d.ts +30 -0
  65. package/dist/lib/feed-policy.js +133 -0
  66. package/dist/lib/feed.d.ts +180 -0
  67. package/dist/lib/feed.js +627 -0
  68. package/dist/lib/git.d.ts +17 -1
  69. package/dist/lib/git.js +20 -1
  70. package/dist/lib/hooks.js +529 -14
  71. package/dist/lib/hosts/passthrough.d.ts +3 -3
  72. package/dist/lib/hosts/passthrough.js +3 -3
  73. package/dist/lib/mailbox-gc.d.ts +22 -0
  74. package/dist/lib/mailbox-gc.js +161 -0
  75. package/dist/lib/mailbox.d.ts +26 -2
  76. package/dist/lib/mailbox.js +80 -5
  77. package/dist/lib/mcp.js +82 -0
  78. package/dist/lib/memory.d.ts +55 -0
  79. package/dist/lib/memory.js +274 -0
  80. package/dist/lib/notify.d.ts +16 -0
  81. package/dist/lib/notify.js +61 -0
  82. package/dist/lib/operator.d.ts +26 -0
  83. package/dist/lib/operator.js +107 -0
  84. package/dist/lib/plugins.d.ts +35 -0
  85. package/dist/lib/plugins.js +217 -0
  86. package/dist/lib/remote-agents-json.d.ts +14 -0
  87. package/dist/lib/remote-agents-json.js +94 -0
  88. package/dist/lib/resources/mcp.js +44 -0
  89. package/dist/lib/resources/memory.d.ts +15 -0
  90. package/dist/lib/resources/memory.js +46 -0
  91. package/dist/lib/resources/types.d.ts +2 -2
  92. package/dist/lib/rotate.js +2 -0
  93. package/dist/lib/runner.d.ts +43 -0
  94. package/dist/lib/runner.js +323 -74
  95. package/dist/lib/sandbox.js +6 -0
  96. package/dist/lib/secrets/Agents CLI.app/Contents/CodeResources +0 -0
  97. package/dist/lib/secrets/Agents CLI.app/Contents/MacOS/Agents CLI +0 -0
  98. package/dist/lib/secrets/agent.d.ts +21 -0
  99. package/dist/lib/secrets/agent.js +63 -1
  100. package/dist/lib/secrets/bundles.d.ts +33 -1
  101. package/dist/lib/secrets/bundles.js +76 -21
  102. package/dist/lib/secrets/icloud-import.d.ts +79 -0
  103. package/dist/lib/secrets/icloud-import.js +203 -0
  104. package/dist/lib/secrets/index.d.ts +142 -2
  105. package/dist/lib/secrets/index.js +695 -30
  106. package/dist/lib/secrets/remote.js +1 -1
  107. package/dist/lib/secrets/sync.js +1 -1
  108. package/dist/lib/session/active.d.ts +18 -0
  109. package/dist/lib/session/active.js +47 -17
  110. package/dist/lib/session/db.d.ts +9 -1
  111. package/dist/lib/session/db.js +18 -3
  112. package/dist/lib/session/discover.d.ts +13 -0
  113. package/dist/lib/session/discover.js +32 -2
  114. package/dist/lib/session/parse.d.ts +8 -0
  115. package/dist/lib/session/parse.js +42 -21
  116. package/dist/lib/session/remote-active.js +8 -89
  117. package/dist/lib/session/state.d.ts +11 -0
  118. package/dist/lib/session/state.js +50 -1
  119. package/dist/lib/session/tail.d.ts +23 -4
  120. package/dist/lib/session/tail.js +34 -16
  121. package/dist/lib/session/throughput.d.ts +30 -0
  122. package/dist/lib/session/throughput.js +86 -0
  123. package/dist/lib/shim-heal.d.ts +12 -3
  124. package/dist/lib/shim-heal.js +12 -6
  125. package/dist/lib/staleness/detectors/subagents.js +57 -3
  126. package/dist/lib/staleness/writers/hooks.js +7 -3
  127. package/dist/lib/staleness/writers/subagents.js +37 -6
  128. package/dist/lib/startup/command-registry.d.ts +2 -0
  129. package/dist/lib/startup/command-registry.js +4 -0
  130. package/dist/lib/state.d.ts +2 -0
  131. package/dist/lib/state.js +25 -8
  132. package/dist/lib/subagents.d.ts +52 -0
  133. package/dist/lib/subagents.js +315 -12
  134. package/dist/lib/teams/agents.js +6 -3
  135. package/dist/lib/teams/worktree.d.ts +8 -0
  136. package/dist/lib/teams/worktree.js +8 -0
  137. package/dist/lib/types.d.ts +20 -2
  138. package/dist/lib/versions.js +38 -48
  139. package/dist/lib/whats-new.d.ts +5 -3
  140. package/dist/lib/whats-new.js +25 -5
  141. package/package.json +4 -3
  142. package/scripts/postinstall.js +61 -1
@@ -24,6 +24,7 @@
24
24
  */
25
25
  import type { NativeImportReport } from './fallback.js';
26
26
  export type { NativeImportReport, NativeImportResult, NativeImportStatus } from './fallback.js';
27
+ export declare const SECRETS_ITEM_PREFIX = "agents-cli.secrets.";
27
28
  /** Supported secret resolution backends. */
28
29
  export type SecretProvider = 'keychain' | 'env' | 'file' | 'exec';
29
30
  /** A typed reference to a secret, consisting of a provider and a provider-specific value. */
@@ -73,7 +74,11 @@ export declare function secretsKeychainItem(bundle: string, key: string): string
73
74
  export interface KeychainBackend {
74
75
  has(item: string): boolean;
75
76
  get(item: string): string;
76
- set(item: string, value: string): void;
77
+ /** `opts.noAcl` mirrors setKeychainToken's no-ACL write path so tests can
78
+ * assert which path a write took; in-memory backends may ignore it. */
79
+ set(item: string, value: string, opts?: {
80
+ noAcl?: boolean;
81
+ }): void;
77
82
  delete(item: string): boolean;
78
83
  list(prefix: string): string[];
79
84
  }
@@ -84,6 +89,103 @@ export declare function setKeychainBackendForTest(b: KeychainBackend | null): Ke
84
89
  * with an in-memory backend there is no real keychain to dedup, so the broker
85
90
  * fast-path must not engage. Always false in production (`backend` is null). */
86
91
  export declare function isKeychainBackendOverridden(): boolean;
92
+ export declare const HMAC_KEY_ITEM = "agents-cli.hmackey";
93
+ /** Force hashed service names on with a fixed key (test only). Pass null to
94
+ * restore lazy production resolution. Composes with setKeychainBackendForTest
95
+ * so unit tests exercise the exact transform production uses. */
96
+ export declare function setKeychainServiceHashingForTest(key: Buffer | null): void;
97
+ /**
98
+ * Run `fn` with service-name hashing suspended: every primitive uses the
99
+ * literal names it is given. For migration flows ONLY — they enumerate raw
100
+ * names from the helper (which may be pre-re-key cleartext leftovers) and must
101
+ * read/delete those exact items, not their hashed transforms.
102
+ */
103
+ export declare function withRawKeychainServiceNames<T>(fn: () => T): T;
104
+ /** The hashed (storage) service name for a cleartext item name. Exported for
105
+ * the re-key migration and tests; runtime callers go through the primitives,
106
+ * which apply this transparently. */
107
+ export declare function hashedServiceName(item: string, key: Buffer): string;
108
+ /**
109
+ * The storage-layer service name for `item`: hashed when hashing is active,
110
+ * the item itself otherwise. For callers that mix helper-enumerated
111
+ * (already-hashed) names with computed cleartext names in one lookup map —
112
+ * see readAndResolveBundleEnv.
113
+ */
114
+ export declare function keychainServiceAlias(item: string): string;
115
+ /** One re-keyed (or failed) item, by its old cleartext service name. */
116
+ export interface RekeyPlanItem {
117
+ oldService: string;
118
+ newService: string;
119
+ /** Preserve the no-ACL write path for `never`-policy bundle items. */
120
+ noAcl: boolean;
121
+ /** Replacement payload (bundle metadata gets `name` injected); absent = copy verbatim. */
122
+ payload?: string;
123
+ }
124
+ /**
125
+ * Build the old→new mapping for a set of cleartext services. Bundle metadata
126
+ * is parsed first to (a) recover each bundle's prompt policy — the persisted
127
+ * `tier` token, where `none`/`never` means the item must be re-written through
128
+ * the no-ACL path — and (b) inject the cleartext `name` into the JSON, because
129
+ * after hashing the service name can no longer carry it (listBundles reads it
130
+ * back from the payload). A value item's tier is resolved from its bundle's
131
+ * metadata PAYLOAD in `values` — under the cleartext metadata name or its
132
+ * hashed transform — never from the metadata item being part of the same
133
+ * `services` batch: a --prefix run can scope a bundle's value items alone, and
134
+ * rekeyServiceNames supplies the out-of-scope metadata reads (see the
135
+ * supplemental batch there). Exported for unit tests.
136
+ */
137
+ export declare function computeRekeyPlan(services: string[], values: Map<string, string>, key: Buffer): {
138
+ items: RekeyPlanItem[];
139
+ unreadable: string[];
140
+ };
141
+ /** Outcome of one rekeyServiceNames run. */
142
+ export interface RekeyReport {
143
+ /** Old cleartext services whose items now live under hashed names. */
144
+ migrated: string[];
145
+ failed: Array<{
146
+ item: string;
147
+ detail: string;
148
+ }>;
149
+ /** True when hashed naming is on after this run. */
150
+ activated: boolean;
151
+ nothingToDo: boolean;
152
+ }
153
+ /**
154
+ * The one-time re-key: move every cleartext-named `agents-cli.*` item to its
155
+ * hashed service name. Composed entirely from the existing helper primitives —
156
+ * no new Swift command:
157
+ *
158
+ * 1. Enumerate cleartext services (silent) and batch-read every value behind
159
+ * ONE Touch ID (`get-batch`; readItem also sweeps legacy/orphaned copies).
160
+ * 2. Write each hashed copy (`set`/`set-no-acl` never prompt), preserving
161
+ * the no-ACL tier for `never`-policy bundles.
162
+ * 3. Batch-verify every copy round-trips (second Touch ID).
163
+ * 4. Only then activate hashing (sentinel + pendingDeletes) and delete the
164
+ * old items (silent).
165
+ *
166
+ * Add-before-delete throughout: a cancel/crash/failure anywhere before step 4
167
+ * leaves every old item intact and hashing OFF — same rationale as the
168
+ * helper's migrate-orphans, which is also why no pre-write backup is taken.
169
+ * On ANY per-item failure nothing is deleted and the sentinel stays off
170
+ * (all-or-nothing activation); the report names every failed item. A crash
171
+ * between the sentinel write and the deletes is resumed silently by the next
172
+ * process (pendingDeletes). Idempotent: re-running converges.
173
+ */
174
+ export declare function rekeyServiceNames(opts?: {
175
+ prefixes?: string[];
176
+ announce?: boolean;
177
+ log?: (line: string) => void;
178
+ }): RekeyReport;
179
+ /** Re-key state snapshot for `agents secrets rekey --status`. */
180
+ export declare function rekeyStatus(): {
181
+ migrated: boolean;
182
+ hasKey: boolean;
183
+ pendingDeletes: number;
184
+ cleartext: string[];
185
+ /** False when the enumeration probe fails (locked keybag) — the cleartext
186
+ * count is then meaningless. Only probeable once the key record exists. */
187
+ enumerationOk: boolean;
188
+ };
87
189
  /** Check if a keychain/keyring item exists. Never prompts for biometry. */
88
190
  export declare function hasKeychainToken(item: string): boolean;
89
191
  /**
@@ -128,7 +230,10 @@ export declare function deleteKeychainToken(item: string): boolean;
128
230
  * and the direct file enumeration return the same items.
129
231
  */
130
232
  export declare function keychainUsesFileFallback(): boolean;
131
- /** Enumerate keychain/keyring item names starting with the given prefix. */
233
+ /** Enumerate keychain/keyring item names starting with the given prefix.
234
+ * With hashed service names active, the two sub-namespace prefixes callers
235
+ * use (bundle metadata; one bundle's value items) are mapped to their hashed
236
+ * shapes — the returned names are then storage (opaque) names. */
132
237
  export declare function listKeychainItems(prefix: string): string[];
133
238
  /**
134
239
  * Enumerate ONLY legacy file-based-keychain item names with the given prefix —
@@ -141,6 +246,41 @@ export declare function listKeychainItems(prefix: string): string[];
141
246
  * stragglers instead of every item (which would be a Touch ID storm).
142
247
  */
143
248
  export declare function listLegacyKeychainItems(prefix: string): string[];
249
+ /**
250
+ * Test seam for the LEGACY SYNCHRONIZABLE (iCloud Keychain) recovery path.
251
+ * The main `KeychainBackend` seam models the live device-local store; this one
252
+ * models the orphaned iCloud items that `secrets import --from icloud` reads.
253
+ * Kept separate so a test can populate both sides independently.
254
+ */
255
+ export interface SyncedKeychainBackend {
256
+ list(prefix: string): string[];
257
+ getBatch(items: string[]): Map<string, string>;
258
+ delete(item: string): boolean;
259
+ }
260
+ export declare function setSyncedKeychainBackendForTest(b: SyncedKeychainBackend | null): SyncedKeychainBackend | null;
261
+ /**
262
+ * Enumerate LEGACY SYNCHRONIZABLE (iCloud Keychain) item names with the given
263
+ * prefix — bundles written by the pre-biometry helper era, which defaulted
264
+ * secrets to iCloud Keychain sync. The device-local cutover orphaned them:
265
+ * every modern query pins synchronizable=false, so only the helper's
266
+ * `list-synced` verb can see them. Silent (attributes only, never decrypts).
267
+ * macOS only — Linux/Windows never had iCloud Keychain sync, so this returns [].
268
+ */
269
+ export declare function listSyncedKeychainItems(prefix: string): string[];
270
+ /**
271
+ * Batch-read LEGACY SYNCHRONIZABLE (iCloud Keychain) items. Returns a map of
272
+ * item name → value; missing items are simply absent. Pre-biometry items carry
273
+ * no biometry ACL, so this does not normally prompt. macOS only — returns an
274
+ * empty map on Linux/Windows.
275
+ */
276
+ export declare function getSyncedKeychainTokens(items: string[]): Map<string, string>;
277
+ /**
278
+ * Delete a LEGACY SYNCHRONIZABLE (iCloud Keychain) item after a successful
279
+ * import (`--purge`). Matches synchronizable items only — the device-local
280
+ * copy the import wrote is untouched. iCloud propagates the deletion to the
281
+ * user's other devices. Returns true if a copy was removed.
282
+ */
283
+ export declare function deleteSyncedKeychainItem(item: string): boolean;
144
284
  /**
145
285
  * One-time upgrade for a keychain item that was written by a previous helper
146
286
  * generation with a trusted-app ACL. The helper reads the legacy item