@agent-watch-ai/edge 0.6.0 → 0.7.0

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 (282) hide show
  1. package/CHANGELOG.md +219 -9
  2. package/README.md +303 -4
  3. package/dist/billing/billing-mode.d.ts +37 -5
  4. package/dist/billing/billing-mode.js +28 -19
  5. package/dist/billing/constants/billing.constants.d.ts +0 -2
  6. package/dist/billing/constants/billing.constants.js +0 -2
  7. package/dist/billing/index.d.ts +2 -1
  8. package/dist/billing/index.js +1 -1
  9. package/dist/billing/session-billing.d.ts +3 -2
  10. package/dist/billing/session-billing.js +8 -8
  11. package/dist/billing/types/billing.types.d.ts +7 -0
  12. package/dist/capture/capture-env.d.ts +147 -0
  13. package/dist/capture/capture-env.js +301 -0
  14. package/dist/capture/captured-step.d.ts +88 -0
  15. package/dist/capture/captured-step.js +479 -0
  16. package/dist/capture/constants/capture.constants.d.ts +70 -0
  17. package/dist/capture/constants/capture.constants.js +72 -0
  18. package/dist/capture/launched-runs.d.ts +16 -0
  19. package/dist/capture/launched-runs.js +151 -0
  20. package/dist/capture/node.cjs +697 -0
  21. package/dist/capture/node.d.cts +32 -0
  22. package/dist/capture/python/sitecustomize.py +823 -0
  23. package/dist/capture/schemas/capture.schema.d.ts +35 -0
  24. package/dist/capture/schemas/capture.schema.js +31 -0
  25. package/dist/capture/types/capture.types.d.ts +20 -0
  26. package/dist/cli/constants/cli.constants.d.ts +2 -6
  27. package/dist/cli/constants/cli.constants.js +3 -7
  28. package/dist/cli/context.d.ts +19 -22
  29. package/dist/cli/context.js +23 -54
  30. package/dist/cli/doctor-run-capture.d.ts +13 -0
  31. package/dist/cli/doctor-run-capture.js +19 -0
  32. package/dist/cli/doctor.js +16 -67
  33. package/dist/cli/hook.d.ts +14 -0
  34. package/dist/cli/hook.js +40 -0
  35. package/dist/cli/index.d.ts +1 -1
  36. package/dist/cli/index.js +1 -1
  37. package/dist/cli/misc.js +10 -2
  38. package/dist/cli/replay.d.ts +33 -0
  39. package/dist/cli/replay.js +193 -0
  40. package/dist/cli/setup.d.ts +10 -2
  41. package/dist/cli/setup.js +154 -26
  42. package/dist/cli/status.js +45 -5
  43. package/dist/cli/toggle.js +10 -0
  44. package/dist/cli/types/cli.types.d.ts +15 -1
  45. package/dist/cli/uninstall.js +8 -22
  46. package/dist/cli.js +104 -17
  47. package/dist/config/config.d.ts +0 -2
  48. package/dist/config/config.js +0 -1
  49. package/dist/config/constants/config.constants.js +2 -0
  50. package/dist/config/events-transport.d.ts +15 -0
  51. package/dist/config/events-transport.js +29 -0
  52. package/dist/config/index.d.ts +2 -1
  53. package/dist/config/index.js +1 -0
  54. package/dist/config/root-config.d.ts +12 -0
  55. package/dist/config/root-config.js +24 -0
  56. package/dist/config/schemas/config.schema.d.ts +13 -0
  57. package/dist/config/schemas/config.schema.js +42 -6
  58. package/dist/config/types/config.types.d.ts +7 -0
  59. package/dist/core/index.d.ts +1 -1
  60. package/dist/core/index.js +1 -1
  61. package/dist/core/version.d.ts +9 -0
  62. package/dist/core/version.js +14 -0
  63. package/dist/core/which.d.ts +11 -0
  64. package/dist/core/which.js +18 -0
  65. package/dist/credentials/cloud-claim.d.ts +32 -0
  66. package/dist/credentials/cloud-claim.js +42 -0
  67. package/dist/credentials/constants/credentials.constants.d.ts +8 -1
  68. package/dist/credentials/constants/credentials.constants.js +9 -2
  69. package/dist/credentials/device-api.d.ts +15 -1
  70. package/dist/credentials/device-api.js +12 -1
  71. package/dist/credentials/sign-in.d.ts +27 -0
  72. package/dist/credentials/sign-in.js +31 -1
  73. package/dist/credentials/token-refresher.d.ts +5 -1
  74. package/dist/credentials/token-refresher.js +10 -2
  75. package/dist/events/constants/events.constants.d.ts +5 -2
  76. package/dist/events/constants/events.constants.js +4 -1
  77. package/dist/events/index.d.ts +1 -0
  78. package/dist/events/product-event.d.ts +6 -3
  79. package/dist/events/types/events.types.d.ts +6 -0
  80. package/dist/events/types/replay-progress.types.d.ts +26 -0
  81. package/dist/events/types/replay-progress.types.js +1 -0
  82. package/dist/events/types/repo-tree.types.d.ts +2 -1
  83. package/dist/feature/ticket-candidates.d.ts +1 -1
  84. package/dist/git/checkout-root.d.ts +15 -0
  85. package/dist/git/checkout-root.js +18 -0
  86. package/dist/git/code-state.d.ts +2 -16
  87. package/dist/git/code-state.js +11 -12
  88. package/dist/git/constants/git.constants.d.ts +31 -11
  89. package/dist/git/constants/git.constants.js +36 -12
  90. package/dist/git/fingerprint.d.ts +3 -6
  91. package/dist/git/fingerprint.js +5 -8
  92. package/dist/git/git-context.js +5 -1
  93. package/dist/git/index.d.ts +1 -2
  94. package/dist/git/index.js +1 -1
  95. package/dist/git/repo-snapshot.d.ts +13 -4
  96. package/dist/git/repo-snapshot.js +47 -9
  97. package/dist/git/types/snapshot.types.d.ts +2 -0
  98. package/dist/pipeline/constants/pipeline.constants.d.ts +3 -0
  99. package/dist/pipeline/constants/pipeline.constants.js +3 -0
  100. package/dist/pipeline/hook-pipeline.js +81 -57
  101. package/dist/privacy/product-capture.js +2 -0
  102. package/dist/providers/antigravity/antigravity.capture.d.ts +2 -0
  103. package/dist/providers/antigravity/antigravity.capture.js +5 -0
  104. package/dist/providers/antigravity/antigravity.detect.js +8 -22
  105. package/dist/providers/antigravity/antigravity.provider.js +10 -3
  106. package/dist/providers/antigravity/constants/antigravity.constants.d.ts +1 -0
  107. package/dist/providers/antigravity/constants/antigravity.constants.js +1 -0
  108. package/dist/providers/claude/claude.adapter.js +9 -6
  109. package/dist/providers/claude/claude.detect.js +2 -17
  110. package/dist/providers/claude/claude.otel.d.ts +21 -3
  111. package/dist/providers/claude/claude.otel.js +216 -61
  112. package/dist/providers/claude/claude.provider.js +17 -1
  113. package/dist/providers/claude/claude.version.d.ts +9 -0
  114. package/dist/providers/claude/claude.version.js +28 -0
  115. package/dist/providers/claude/constants/claude.constants.d.ts +27 -0
  116. package/dist/providers/claude/constants/claude.constants.js +27 -0
  117. package/dist/providers/claude/constants/claude.otel.constants.d.ts +27 -0
  118. package/dist/providers/claude/constants/claude.otel.constants.js +45 -5
  119. package/dist/providers/claude/types/claude.types.d.ts +13 -0
  120. package/dist/providers/codex/codex.capture.d.ts +76 -0
  121. package/dist/providers/codex/codex.capture.js +454 -0
  122. package/dist/providers/codex/codex.detect.js +2 -4
  123. package/dist/providers/codex/codex.otel.d.ts +38 -2
  124. package/dist/providers/codex/codex.otel.js +50 -6
  125. package/dist/providers/codex/codex.provider.js +8 -0
  126. package/dist/providers/codex/codex.surface.d.ts +9 -0
  127. package/dist/{turns/codex-originator.js → providers/codex/codex.surface.js} +17 -3
  128. package/dist/providers/codex/codex.titles.d.ts +14 -0
  129. package/dist/providers/codex/codex.titles.js +35 -0
  130. package/dist/providers/codex/constants/codex.constants.d.ts +4 -0
  131. package/dist/providers/codex/constants/codex.constants.js +4 -0
  132. package/dist/providers/cursor/constants/cursor.constants.d.ts +17 -4
  133. package/dist/providers/cursor/constants/cursor.constants.js +25 -5
  134. package/dist/providers/cursor/cursor-mcp-memo.d.ts +34 -0
  135. package/dist/providers/cursor/cursor-mcp-memo.js +94 -0
  136. package/dist/providers/cursor/cursor.adapter.js +20 -82
  137. package/dist/providers/cursor/cursor.capture.d.ts +1 -0
  138. package/dist/providers/cursor/cursor.capture.js +4 -0
  139. package/dist/providers/cursor/cursor.detect.d.ts +5 -1
  140. package/dist/providers/cursor/cursor.detect.js +11 -26
  141. package/dist/providers/cursor/cursor.hooks.js +2 -2
  142. package/dist/providers/cursor/cursor.provider.js +16 -7
  143. package/dist/providers/cursor/cursor.titles.d.ts +14 -0
  144. package/dist/providers/cursor/cursor.titles.js +20 -0
  145. package/dist/providers/cursor/schemas/cursor.schema.d.ts +3 -3
  146. package/dist/providers/cursor/schemas/cursor.schema.js +5 -3
  147. package/dist/providers/gemini/constants/gemini.constants.d.ts +16 -0
  148. package/dist/providers/gemini/constants/gemini.constants.js +17 -0
  149. package/dist/providers/gemini/gemini.capture.d.ts +81 -0
  150. package/dist/providers/gemini/gemini.capture.js +210 -0
  151. package/dist/providers/gemini/gemini.detect.js +57 -24
  152. package/dist/providers/gemini/gemini.otel.d.ts +38 -2
  153. package/dist/providers/gemini/gemini.otel.js +56 -125
  154. package/dist/providers/gemini/gemini.provider.js +5 -0
  155. package/dist/providers/index.d.ts +1 -0
  156. package/dist/providers/index.js +1 -0
  157. package/dist/providers/provider.d.ts +8 -0
  158. package/dist/providers/provider.js +9 -0
  159. package/dist/providers/registry.d.ts +14 -0
  160. package/dist/providers/registry.js +14 -0
  161. package/dist/providers/shared/constants/hook-config.constants.d.ts +2 -0
  162. package/dist/providers/shared/constants/hook-config.constants.js +2 -0
  163. package/dist/providers/shared/constants/terminal-capture.constants.d.ts +6 -0
  164. package/dist/providers/shared/constants/terminal-capture.constants.js +6 -0
  165. package/dist/providers/shared/editor-paths.d.ts +8 -0
  166. package/dist/providers/shared/editor-paths.js +18 -0
  167. package/dist/providers/shared/hook-config.d.ts +5 -0
  168. package/dist/providers/shared/hook-config.js +39 -1
  169. package/dist/providers/shared/hooks-marker.d.ts +14 -0
  170. package/dist/providers/shared/hooks-marker.js +23 -0
  171. package/dist/providers/shared/install-record.d.ts +29 -0
  172. package/dist/providers/shared/install-record.js +52 -0
  173. package/dist/providers/shared/session-title-store.d.ts +23 -0
  174. package/dist/providers/shared/session-title-store.js +50 -0
  175. package/dist/providers/shared/terminal-capture.d.ts +41 -0
  176. package/dist/providers/shared/terminal-capture.js +109 -0
  177. package/dist/providers/shared/tooling.d.ts +21 -0
  178. package/dist/providers/shared/tooling.js +36 -1
  179. package/dist/providers/types/provider.types.d.ts +57 -4
  180. package/dist/replay/checkout-resolver.d.ts +29 -0
  181. package/dist/replay/checkout-resolver.js +69 -0
  182. package/dist/replay/codex-turns.d.ts +24 -0
  183. package/dist/replay/codex-turns.js +221 -0
  184. package/dist/replay/constants/replay.constants.d.ts +99 -0
  185. package/dist/replay/constants/replay.constants.js +102 -0
  186. package/dist/replay/describe.d.ts +10 -0
  187. package/dist/replay/describe.js +31 -0
  188. package/dist/replay/gemini-turns.d.ts +36 -0
  189. package/dist/replay/gemini-turns.js +192 -0
  190. package/dist/replay/machine.d.ts +34 -0
  191. package/dist/replay/machine.js +68 -0
  192. package/dist/replay/progress-event.d.ts +21 -0
  193. package/dist/replay/progress-event.js +45 -0
  194. package/dist/replay/replay-runner.d.ts +58 -0
  195. package/dist/replay/replay-runner.js +529 -0
  196. package/dist/replay/replay-scan.d.ts +83 -0
  197. package/dist/replay/replay-scan.js +170 -0
  198. package/dist/replay/replay-state.d.ts +108 -0
  199. package/dist/replay/replay-state.js +199 -0
  200. package/dist/replay/resume.d.ts +18 -0
  201. package/dist/replay/resume.js +34 -0
  202. package/dist/replay/start.d.ts +23 -0
  203. package/dist/replay/start.js +39 -0
  204. package/dist/replay/throttle.d.ts +35 -0
  205. package/dist/replay/throttle.js +41 -0
  206. package/dist/replay/transcript-turns.d.ts +35 -0
  207. package/dist/replay/transcript-turns.js +215 -0
  208. package/dist/replay/turn-event.d.ts +38 -0
  209. package/dist/replay/turn-event.js +116 -0
  210. package/dist/replay/types/replay.types.d.ts +162 -0
  211. package/dist/replay/types/replay.types.js +1 -0
  212. package/dist/replay/window.d.ts +28 -0
  213. package/dist/replay/window.js +41 -0
  214. package/dist/snapshot/branch-selection.d.ts +40 -23
  215. package/dist/snapshot/branch-selection.js +71 -41
  216. package/dist/snapshot/constants/snapshot-stages.constants.d.ts +3 -1
  217. package/dist/snapshot/constants/snapshot-stages.constants.js +3 -1
  218. package/dist/snapshot/constants/snapshot.constants.d.ts +34 -7
  219. package/dist/snapshot/constants/snapshot.constants.js +34 -7
  220. package/dist/snapshot/index.d.ts +2 -2
  221. package/dist/snapshot/index.js +1 -1
  222. package/dist/snapshot/snapshot-pipeline.js +89 -26
  223. package/dist/snapshot/snapshot-state.js +6 -2
  224. package/dist/snapshot/tree-pipeline.d.ts +1 -1
  225. package/dist/snapshot/tree-pipeline.js +34 -15
  226. package/dist/snapshot/types/snapshot.types.d.ts +20 -3
  227. package/dist/storage/schemas/storage.schema.d.ts +2 -0
  228. package/dist/storage/schemas/storage.schema.js +6 -0
  229. package/dist/transport/delivery-stats.d.ts +13 -1
  230. package/dist/transport/delivery-stats.js +18 -2
  231. package/dist/transport/delivery.d.ts +4 -3
  232. package/dist/transport/delivery.js +21 -7
  233. package/dist/transport/identity-delivery.d.ts +20 -0
  234. package/dist/transport/identity-delivery.js +41 -0
  235. package/dist/transport/index.d.ts +2 -0
  236. package/dist/transport/index.js +1 -0
  237. package/dist/transport/types/delivery-flow.types.d.ts +7 -0
  238. package/dist/turns/claude-transcript.js +4 -12
  239. package/dist/turns/codex-transcript.d.ts +9 -0
  240. package/dist/turns/codex-transcript.js +27 -19
  241. package/dist/turns/constants/turns.constants.d.ts +13 -12
  242. package/dist/turns/constants/turns.constants.js +15 -19
  243. package/dist/turns/gemini-transcript.d.ts +19 -1
  244. package/dist/turns/gemini-transcript.js +29 -18
  245. package/dist/turns/index.d.ts +3 -4
  246. package/dist/turns/index.js +2 -3
  247. package/dist/turns/run-state.d.ts +71 -0
  248. package/dist/turns/run-state.js +114 -0
  249. package/dist/turns/tool-events.d.ts +11 -1
  250. package/dist/turns/tool-events.js +32 -9
  251. package/dist/turns/transcript.d.ts +15 -14
  252. package/dist/turns/transcript.js +23 -4
  253. package/dist/turns/turn-state.d.ts +49 -7
  254. package/dist/turns/turn-state.js +78 -10
  255. package/dist/turns/turn-summary.js +7 -2
  256. package/dist/turns/turn-tracker.d.ts +9 -16
  257. package/dist/turns/turn-tracker.js +162 -86
  258. package/dist/turns/types/transcript.types.d.ts +11 -1
  259. package/dist/turns/types/turn-provider.types.d.ts +33 -0
  260. package/dist/turns/types/turn-provider.types.js +1 -0
  261. package/dist/turns/types/turn-state.types.d.ts +9 -0
  262. package/dist/turns/types/turn-summary.types.d.ts +17 -1
  263. package/dist/turns/types/turn-tracker.types.d.ts +3 -1
  264. package/dist/turns/work-checkout.js +1 -2
  265. package/docs/AUDIT_PROMPT.md +10 -0
  266. package/docs/DATA_HANDLING.md +193 -7
  267. package/docs/ENTERPRISE_DEPLOYMENT.md +1 -1
  268. package/docs/PERFORMANCE.md +10 -0
  269. package/package.json +3 -2
  270. package/dist/events/canonical-event.d.ts +0 -10
  271. package/dist/events/canonical-event.js +0 -9
  272. package/dist/git/repository-root.d.ts +0 -39
  273. package/dist/git/repository-root.js +0 -131
  274. package/dist/git/types/repository-root.types.d.ts +0 -11
  275. package/dist/transport/transport.d.ts +0 -6
  276. package/dist/turns/codex-originator.d.ts +0 -11
  277. package/dist/turns/cursor-transcript.d.ts +0 -21
  278. package/dist/turns/cursor-transcript.js +0 -66
  279. package/dist/turns/native-session-titles.d.ts +0 -26
  280. package/dist/turns/native-session-titles.js +0 -102
  281. /package/dist/{git/types/repository-root.types.js → billing/types/billing.types.js} +0 -0
  282. /package/dist/{transport/transport.js → capture/types/capture.types.js} +0 -0
@@ -1,15 +1,18 @@
1
1
  import path from 'node:path';
2
2
  import { performance } from 'node:perf_hooks';
3
+ import { armCaptureStage, capturedAtSessionEnd, capturedStage, runWasCaptured } from '../capture/captured-step.js';
4
+ import { STAGE_CAPTURE_ARM, STAGE_CAPTURED, STAGE_CAPTURED_AT_END } from '../capture/constants/capture.constants.js';
3
5
  import { asRecord } from '../core/object.js';
4
6
  import { applyProductCapture } from '../privacy/product-capture.js';
5
7
  import { debugLog } from '../core/logger.js';
6
8
  import { next, runFlow, step, stop } from '../core/pipe.js';
7
9
  import { loadEffectiveConfig } from '../config/repo-config.js';
10
+ import { transportFor } from '../config/events-transport.js';
8
11
  import { CREDENTIAL_BUDGET_SHARE, NOT_SIGNED_IN } from '../credentials/constants/credentials.constants.js';
9
12
  import { cachedBearer, resolveBearer } from '../credentials/credentials.js';
10
- import { awaitingSignIn, deviceFor, hasCredential, identityFingerprint, identityOf } from '../credentials/identity.js';
11
- import { cachedAccessToken } from '../credentials/token-refresher.js';
12
- import { credentialScope, inheritedRootConfig, selectRoot, servesMultipleIdentities } from '../config/root-config.js';
13
+ import { awaitingSignIn, deviceFor, identityFingerprint, identityOf } from '../credentials/identity.js';
14
+ import { cachedAccessToken, currentAccessToken } from '../credentials/token-refresher.js';
15
+ import { credentialScope, inheritedRootConfig, isIgnoredRoot, selectRoot, servesMultipleIdentities } from '../config/root-config.js';
13
16
  import { DECISION_BLOCK } from '../enforcement/constants/enforcement.constants.js';
14
17
  import { enforcementWouldAsk, resolveEnforcement } from '../enforcement/enforcement.js';
15
18
  import { sessionBillingFact } from '../billing/session-billing.js';
@@ -25,21 +28,17 @@ import { runSnapshotPipeline } from '../snapshot/snapshot-pipeline.js';
25
28
  import { runTreePipeline } from '../snapshot/tree-pipeline.js';
26
29
  import { SnapshotStateStore } from '../snapshot/snapshot-state.js';
27
30
  import { SNAPSHOT_BUDGET_MS } from '../snapshot/constants/snapshot.constants.js';
28
- import { BackendAuthBlock } from '../transport/auth-block.js';
29
- import { BackendCooldown } from '../transport/cooldown.js';
30
- import { DeliveryStats } from '../transport/delivery-stats.js';
31
31
  import { deliverEvents } from '../transport/delivery.js';
32
- import { HttpTransport } from '../transport/http-transport.js';
33
- import { EventQueue } from '../transport/queue.js';
34
- import { identityPaths, settleLegacyQueue } from '../transport/queue-partition.js';
35
- import { eventsUrl } from '../config/config.js';
32
+ import { identityDelivery } from '../transport/identity-delivery.js';
33
+ import { settleLegacyQueue } from '../transport/queue-partition.js';
36
34
  import { untracedNotice as untracedNoticeText } from '../untraced/constants/untraced.constants.js';
37
35
  import { isRunCommand, manifestVerdict, rootHash } from '../untraced/untraced.js';
36
+ import { resumeReplayIfOwed } from '../replay/resume.js';
38
37
  import { installedPackage, startUpdateCheck, updateNotice } from '../update/update-check.js';
39
38
  import { TurnStateStore } from '../turns/turn-state.js';
40
39
  import { MAX_TURN_CHECKOUTS, SHELL_REREAD_TYPES, TOOL_START_TYPES } from '../turns/constants/turns.constants.js';
41
40
  import { resolveSurface, trackTurnOutcome } from '../turns/turn-tracker.js';
42
- import { PAYLOAD_CWD_KEY, PROMPT_SUBMITTED_TYPE, STAGE_DELIVER, STAGE_ENFORCE, STAGE_ENRICH, MAX_WORKSPACE_ROOTS, STAGE_NOMINATE, STAGE_PARSE_EVENTS, STAGE_RESOLVE_CONTEXT, STAGE_REWRITE_BEARERS, STAGE_SNAPSHOT, STAGE_TRACK_TURN, STAGE_UNTRACED, STAGE_UPDATE, QUIET_SESSION_SOURCES, STOP_DRY_RUN, STAGE_AWAIT_SIGN_IN, STOP_NO_EVENTS, STOP_NOT_SIGNED_IN, STOP_NO_SNAPSHOT } from './constants/pipeline.constants.js';
41
+ import { PAYLOAD_CWD_KEY, PROMPT_SUBMITTED_TYPE, STAGE_DELIVER, STAGE_ENFORCE, STAGE_ENRICH, STAGE_IGNORED_ROOT, MAX_WORKSPACE_ROOTS, STAGE_NOMINATE, STAGE_PARSE_EVENTS, STAGE_RESOLVE_CONTEXT, STAGE_REWRITE_BEARERS, STAGE_SNAPSHOT, STAGE_TRACK_TURN, STAGE_UNTRACED, STAGE_REPLAY_RESUME, STAGE_UPDATE, QUIET_SESSION_SOURCES, STOP_DRY_RUN, STOP_IGNORED_ROOT, STAGE_AWAIT_SIGN_IN, STOP_NO_EVENTS, STOP_NOT_SIGNED_IN, STOP_NO_SNAPSHOT } from './constants/pipeline.constants.js';
43
42
  /**
44
43
  * The hook flow, as the list of stages it is.
45
44
  *
@@ -53,15 +52,20 @@ import { PAYLOAD_CWD_KEY, PROMPT_SUBMITTED_TYPE, STAGE_DELIVER, STAGE_ENFORCE, S
53
52
  * reordering a step is a change to this array rather than to a call graph.
54
53
  */
55
54
  const HOOK_STAGES = [
55
+ step(STAGE_IGNORED_ROOT, ignoredRoot),
56
56
  step(STAGE_RESOLVE_CONTEXT, resolveContext),
57
57
  step(STAGE_PARSE_EVENTS, parseEvents),
58
+ step(STAGE_CAPTURE_ARM, armCaptureStage),
58
59
  step(STAGE_AWAIT_SIGN_IN, awaitSignIn),
59
60
  step(STAGE_NOMINATE, nominate),
60
61
  step(STAGE_UNTRACED, untracedNotice),
61
62
  step(STAGE_UPDATE, updateNoticeStage),
63
+ step(STAGE_REPLAY_RESUME, resumeReplayStage),
62
64
  step(STAGE_ENFORCE, enforce),
63
65
  step(STAGE_ENRICH, enrich),
66
+ step(STAGE_CAPTURED_AT_END, (state) => capturedAtSessionEnd(state, openDelivery(state).queue)),
64
67
  step(STAGE_TRACK_TURN, trackTurnStage),
68
+ step(STAGE_CAPTURED, (state) => capturedStage(state, openDelivery(state).queue)),
65
69
  step(STAGE_DELIVER, deliver),
66
70
  step(STAGE_REWRITE_BEARERS, rewriteBearers),
67
71
  step(STAGE_SNAPSHOT, snapshot)
@@ -90,6 +94,20 @@ export function runHookPipeline(input) {
90
94
  debugLog(`hook flow ${trace.outcome} at ${trace.step}${trace.reason ? `: ${trace.reason}` : ''}`);
91
95
  });
92
96
  }
97
+ /**
98
+ * End the flow in a directory the developer listed in `ignoredRoots`.
99
+ *
100
+ * First, so nothing is parsed, enforced, sent or queued — the same as a
101
+ * disabled machine, but only here.
102
+ *
103
+ * @param state - Current flow state.
104
+ * @returns A stop in an ignored directory, otherwise the state unchanged.
105
+ */
106
+ function ignoredRoot(state) {
107
+ if (isIgnoredRoot(state.globalConfig.config.ignoredRoots, state.cwd))
108
+ return stop(state, STOP_IGNORED_ROOT);
109
+ return next(state);
110
+ }
93
111
  /**
94
112
  * Apply the repository's `.agentwatch.json` on top of the global config.
95
113
  *
@@ -207,6 +225,24 @@ async function updateNoticeStage(state) {
207
225
  const notice = await updateNotice(state.paths.dataDir, state.env.now(), installedPackage().version, () => startUpdateCheck(state.env));
208
226
  return next(notice === undefined ? state : { ...state, notice });
209
227
  }
228
+ /**
229
+ * Pick an unfinished replay of earlier sessions up again, as a session opens.
230
+ *
231
+ * One `stat` of a marker that is absent unless a replay is owed; the work
232
+ * itself runs in a process of its own. Never delays or fails the hook.
233
+ *
234
+ * @param state - Current flow state.
235
+ * @returns The state, unchanged.
236
+ */
237
+ async function resumeReplayStage(state) {
238
+ if (state.dryRun || !isLoudSessionStart(state))
239
+ return next(state);
240
+ await resumeReplayIfOwed(state.env, state.paths, identityOf(state.config), state.credentialScope).catch((error) => debugLog('replay: resume check failed:', error));
241
+ if (state.credentialScope !== undefined) {
242
+ await resumeReplayIfOwed(state.env, state.paths, identityOf(state.globalConfig.config)).catch((error) => debugLog('replay: machine resume check failed:', error));
243
+ }
244
+ return next(state);
245
+ }
210
246
  /**
211
247
  * Tell the developer, once per repository per session, that a run called an
212
248
  * LLM with no tracing (AWT-310).
@@ -229,6 +265,9 @@ async function untracedNotice(state) {
229
265
  const call = state.provider.shellCall?.(state.payload);
230
266
  if (typeof call?.command !== 'string' || !isRunCommand(call.command))
231
267
  return next(state);
268
+ // Its calls are counted, so there is nothing to tell the developer about this run.
269
+ if (await runWasCaptured(state, sessionId))
270
+ return next(state);
232
271
  const workdir = typeof call.workdir === 'string' && path.isAbsolute(call.workdir) ? call.workdir : state.cwd;
233
272
  // The checkouts the command names, then the one the agent sits in: the run may be in either.
234
273
  const here = await checkoutRootOf(workdir);
@@ -467,8 +506,8 @@ async function trackTurnStage(state) {
467
506
  */
468
507
  async function billingFactSafely(state) {
469
508
  try {
470
- const surface = await resolveSurface(state.events[0]?.agent.provider ?? state.provider.id, state.env, state.payload);
471
- return await sessionBillingFact(new TurnStateStore(state.paths.turnsDir), state.events, state.provider.id, state.env, surface);
509
+ const surface = await resolveSurface(state.provider, state.env, state.payload);
510
+ return await sessionBillingFact(new TurnStateStore(state.paths.turnsDir), state.events, state.provider, state.env, surface);
472
511
  }
473
512
  catch (error) {
474
513
  debugLog('session billing fact failed:', error);
@@ -484,7 +523,7 @@ async function billingFactSafely(state) {
484
523
  async function trackTurnSafely(state) {
485
524
  try {
486
525
  return await trackTurnOutcome({
487
- agentId: state.provider.id,
526
+ provider: state.provider,
488
527
  rawPayload: state.payload,
489
528
  events: state.events,
490
529
  config: state.config,
@@ -517,7 +556,7 @@ async function deliver(state) {
517
556
  // `globalConfig`, not `config`: roots are stripped from the effective config
518
557
  // once applied, and the question is what the *machine* sends as.
519
558
  await settleLegacyQueue(state.paths.queueDir, identityOf(state.config), servesMultipleIdentities(state.globalConfig.config));
520
- const identity = identityPaths(state.paths, identityOf(state.config));
559
+ const opened = openDelivery(state);
521
560
  // One budget for the credential and the send: credential work (a keychain
522
561
  // read, a refresh, an exchange) may spend its share of it and no more, and
523
562
  // the send gets what is left. A hook never waits longer than it did before.
@@ -527,7 +566,25 @@ async function deliver(state) {
527
566
  const started = performance.now();
528
567
  const bearer = await resolveBearer({ ...credentialContext(state, budgetMs), deadline: started + budgetMs * CREDENTIAL_BUDGET_SHARE }, state.config);
529
568
  const remaining = Math.max(0, budgetMs - (performance.now() - started));
530
- const delivery = await deliverEvents(state.outbound, buildTransport(state, bearer, remaining), buildQueue(state), state.config.delivery.drainBatchSize, new BackendCooldown(identity.cooldownFile, state.env.now), new DeliveryStats(identity.statsFile, state.env.now, state.paths.locksDir), new BackendAuthBlock(identity.authBlockFile, state.env.now));
569
+ const delivery = await deliverEvents(state.outbound, transportFor(state.config, bearer, { budgetMs: remaining }), opened.queue, state.config.delivery.drainBatchSize, opened.cooldown, opened.stats, opened.authBlock,
570
+ // A plain 401 for a device access token: one forced refresh, and a transport
571
+ // on the new token for the resend, within what is left of the hook's budget.
572
+ async () => {
573
+ const left = budgetMs - (performance.now() - started);
574
+ if (!bearer || !deviceFor(state.config) || left <= 0)
575
+ return undefined;
576
+ try {
577
+ const ctx = { ...credentialContext(state, left), deadline: performance.now() + left * CREDENTIAL_BUDGET_SHARE };
578
+ const renewed = await currentAccessToken(ctx, state.config, { force: true });
579
+ if (!renewed || renewed === bearer)
580
+ return undefined;
581
+ return transportFor(state.config, renewed, { budgetMs: Math.max(0, budgetMs - (performance.now() - started)) });
582
+ }
583
+ catch (error) {
584
+ debugLog('credentials: refreshing after a 401 failed; queueing instead:', error);
585
+ return undefined;
586
+ }
587
+ });
531
588
  debugLog(`delivery: sent=${delivery.delivered} queued=${delivery.queued} drained=${delivery.drained} rejected=${delivery.rejected}`);
532
589
  return next({ ...state, delivery });
533
590
  }
@@ -582,7 +639,7 @@ async function snapshot(state) {
582
639
  // The repository's own policy, which may lower the global one: file names
583
640
  // off means the files listing never runs, not that it is emptied later.
584
641
  files: capture.files !== false,
585
- // A digest, never the credential: the tree is owed once per repository and identity.
642
+ // A digest, never the credential: the tree is owed per repository and identity.
586
643
  identity: treeIdentity(state),
587
644
  repository,
588
645
  provider: state.summary?.provider ?? state.provider.id,
@@ -598,9 +655,9 @@ async function snapshot(state) {
598
655
  run: runGit
599
656
  };
600
657
  const store = new SnapshotStateStore(state.paths.snapshotsDir);
601
- const queue = buildQueue(state);
658
+ const { queue } = openDelivery(state);
602
659
  await runSnapshotPipeline({ input, store, queue });
603
- // The trunk's paths and declaration names, once per repository and identity,
660
+ // The trunk's paths and declaration names, per repository and identity and when the trunk changes,
604
661
  // inside the same deadline. File names off means no listing at all.
605
662
  if (input.files)
606
663
  await runTreePipeline({ input, store, queue });
@@ -617,47 +674,14 @@ function treeIdentity(state) {
617
674
  return identity ? identityFingerprint(identity) : undefined;
618
675
  }
619
676
  /**
620
- * The offline queue for this run, partitioned by the identity it sends as.
621
- * `deliver` settles a pre-partition backlog before the first build.
622
- *
623
- * @param state - Current flow state.
624
- * @returns A queue bound to this run's paths and delivery limits.
625
- */
626
- function buildQueue(state) {
627
- const identity = identityPaths(state.paths, identityOf(state.config));
628
- return new EventQueue({
629
- queueDir: identity.queueDir,
630
- locksDir: state.paths.locksDir,
631
- maxEvents: state.config.delivery.maxQueueEvents,
632
- maxAttempts: state.config.delivery.maxAttempts,
633
- maxEventAgeDays: state.config.delivery.maxEventAgeDays,
634
- now: state.env.now,
635
- // So the entries the bound sacrifices are counted wherever an enqueue
636
- // happens, the snapshot pipeline's included.
637
- stats: new DeliveryStats(identity.statsFile, state.env.now, state.paths.locksDir)
638
- });
639
- }
640
- /**
641
- * The transport for this run, when a backend is configured.
677
+ * This run's delivery state, for the identity it sends as. `deliver` settles a
678
+ * pre-partition backlog before it first opens this; `snapshot` runs after it.
642
679
  *
643
680
  * @param state - Current flow state.
644
- * @param bearer - What to authenticate with; see `resolveBearer`.
645
- * @param budgetMs - What is left of the delivery budget.
646
- * @returns The transport, or undefined before setup has run.
681
+ * @returns The queue, stats, cooldown and auth block of this run's identity.
647
682
  */
648
- function buildTransport(state, bearer, budgetMs) {
649
- const url = eventsUrl(state.config);
650
- if (!url)
651
- return undefined;
652
- return new HttpTransport({
653
- eventsUrl: url,
654
- capture: state.config.capture,
655
- token: bearer,
656
- credentialPending: hasCredential(state.config) && !bearer,
657
- installationId: state.config.installationId,
658
- timeoutMs: state.config.delivery.timeoutMs,
659
- budgetMs
660
- });
683
+ function openDelivery(state) {
684
+ return identityDelivery(state.paths, identityOf(state.config), state.config.delivery, state.env.now);
661
685
  }
662
686
  /**
663
687
  * What the credential code needs from this run.
@@ -60,6 +60,8 @@ export function applyProductCapture(event, capture) {
60
60
  // context and withheld whole without it: a digest of a command still says
61
61
  // which command ran when.
62
62
  tool_events: git ? undefined : withMcpPolicy(summary.tool_events, capture?.mcpNames === false),
63
+ // A name only, and withheld with the tool events it describes the turn beside.
64
+ command: git ? undefined : summary.command,
63
65
  // The blob id is what is matched; the path beside it in older records is not read.
64
66
  content_hashes: files ? undefined : summary.content_hashes?.map(({ blob_sha }) => ({ blob_sha })),
65
67
  manifest_repository: files ? undefined : summary.manifest_repository,
@@ -0,0 +1,2 @@
1
+ /** Antigravity is built on VS Code's settings too, so the route is Cursor's in its own folder. */
2
+ export declare const antigravityCapture: import("../shared/terminal-capture.js").TerminalCapture;
@@ -0,0 +1,5 @@
1
+ import { terminalCapture } from '../shared/terminal-capture.js';
2
+ /** Flip to true, with the PR's verification done on the installed app. */
3
+ const ANTIGRAVITY_ROUTE_VERIFIED = false;
4
+ /** Antigravity is built on VS Code's settings too, so the route is Cursor's in its own folder. */
5
+ export const antigravityCapture = terminalCapture('Antigravity', ANTIGRAVITY_ROUTE_VERIFIED);
@@ -1,9 +1,8 @@
1
1
  import fs from 'node:fs';
2
2
  import path from 'node:path';
3
- import { findExecutable } from '../../core/which.js';
4
- import { readJsonFile } from '../../storage/json-file.js';
5
- import { HOOK_COMMAND_MARKER } from '../constants/provider.constants.js';
6
- import { ANTIGRAVITY_CLI_DIR_SEGMENTS, ANTIGRAVITY_EXECUTABLES, ANTIGRAVITY_HOOKS_FILE, ANTIGRAVITY_ROOT_SEGMENTS } from './constants/antigravity.constants.js';
3
+ import { findFirstExecutable } from '../../core/which.js';
4
+ import { hooksMarkerPresent } from '../shared/hooks-marker.js';
5
+ import { ANTIGRAVITY_BIN_DIR_SEGMENTS, ANTIGRAVITY_CLI_DIR_SEGMENTS, ANTIGRAVITY_EXECUTABLES, ANTIGRAVITY_HOOKS_FILE, ANTIGRAVITY_ROOT_SEGMENTS } from './constants/antigravity.constants.js';
7
6
  /**
8
7
  * Antigravity's configuration root.
9
8
  *
@@ -35,30 +34,17 @@ export async function detectAntigravity(env) {
35
34
  if (fs.existsSync(path.join(env.home, ...ANTIGRAVITY_CLI_DIR_SEGMENTS))) {
36
35
  evidence.push('~/.gemini/antigravity-cli directory exists');
37
36
  }
38
- const executablePath = findFirstExecutable(env);
37
+ const bundledBin = path.join(env.home, ...ANTIGRAVITY_BIN_DIR_SEGMENTS);
38
+ const executablePath = findFirstExecutable(env, ANTIGRAVITY_EXECUTABLES)
39
+ ?? findFirstExecutable({ ...env, vars: { ...env.vars, PATH: bundledBin } }, ANTIGRAVITY_EXECUTABLES);
39
40
  if (executablePath)
40
- evidence.push(`agy executable on PATH (${executablePath})`);
41
+ evidence.push(`agy executable found (${executablePath})`);
41
42
  const hookConfigPath = antigravityHooksPath(env);
42
- const read = await readJsonFile(hookConfigPath);
43
43
  return {
44
44
  detected: evidence.length > 0,
45
45
  evidence,
46
46
  executablePath,
47
47
  hookConfigPath,
48
- hooksInstalled: read.state === 'ok' && JSON.stringify(read.value).includes(HOOK_COMMAND_MARKER)
48
+ hooksInstalled: await hooksMarkerPresent(hookConfigPath)
49
49
  };
50
50
  }
51
- /**
52
- * The first of Antigravity's executable names found on PATH.
53
- *
54
- * @param env - Environment supplying PATH.
55
- * @returns The path, or undefined when neither is installed.
56
- */
57
- function findFirstExecutable(env) {
58
- for (const name of ANTIGRAVITY_EXECUTABLES) {
59
- const found = findExecutable(env, name);
60
- if (found)
61
- return found;
62
- }
63
- return undefined;
64
- }
@@ -1,4 +1,7 @@
1
+ import { googleAccountBillingMode } from '../../billing/billing-mode.js';
2
+ import { IDE_SURFACE } from '../../turns/constants/turns.constants.js';
1
3
  import { antigravityCwd, antigravityHookEvent, antigravityShellCall, parseAntigravityHookEvent } from './antigravity.adapter.js';
4
+ import { antigravityCapture } from './antigravity.capture.js';
2
5
  import { detectAntigravity } from './antigravity.detect.js';
3
6
  import { installAntigravityHooks, uninstallAntigravityHooks } from './antigravity.hooks.js';
4
7
  import { ANTIGRAVITY_DISPLAY_NAME, ANTIGRAVITY_FALLBACK_DECISION, ANTIGRAVITY_HOOK_DECISIONS, ANTIGRAVITY_PROVIDER_ID } from './constants/antigravity.constants.js';
@@ -6,8 +9,9 @@ export const antigravityProvider = {
6
9
  id: ANTIGRAVITY_PROVIDER_ID,
7
10
  displayName: ANTIGRAVITY_DISPLAY_NAME,
8
11
  detect: detectAntigravity,
9
- installHooks: installAntigravityHooks,
10
- uninstallHooks: uninstallAntigravityHooks,
12
+ installHooks: antigravityCapture.install(installAntigravityHooks),
13
+ uninstallHooks: antigravityCapture.uninstall(uninstallAntigravityHooks),
14
+ runCapture: antigravityCapture.route,
11
15
  parseHookEvent: async (payload, context) => parseAntigravityHookEvent(payload, context),
12
16
  getHookResponse: (payload) => {
13
17
  const hook = antigravityHookEvent(payload);
@@ -15,7 +19,10 @@ export const antigravityProvider = {
15
19
  return { stdout: JSON.stringify(decision ?? {}), exitCode: 0 };
16
20
  },
17
21
  resolveCwd: antigravityCwd,
18
- shellCall: antigravityShellCall
22
+ shellCall: antigravityShellCall,
23
+ surface: async () => IDE_SURFACE,
24
+ /** Signed in through the shared `~/.gemini` Google account, as Gemini CLI is. */
25
+ billingMode: googleAccountBillingMode
19
26
  // No nativeTelemetry: Antigravity exposes no OTLP exporter configuration, so
20
27
  // there is no llm.call ledger source and turn summaries stay
21
28
  // usage_status=pending. Adding a configurator would claim a capability the
@@ -5,6 +5,7 @@ export declare const ANTIGRAVITY_CWD_KEY = "Cwd";
5
5
  /** Antigravity shares Gemini's home; its own config lives one level down. */
6
6
  export declare const ANTIGRAVITY_ROOT_SEGMENTS: readonly [".gemini", "config"];
7
7
  export declare const ANTIGRAVITY_CLI_DIR_SEGMENTS: readonly [".gemini", "antigravity-cli"];
8
+ export declare const ANTIGRAVITY_BIN_DIR_SEGMENTS: readonly [".gemini", "bin"];
8
9
  export declare const ANTIGRAVITY_HOOKS_FILE = "hooks.json";
9
10
  export declare const ANTIGRAVITY_EXECUTABLES: readonly ["agy", "antigravity"];
10
11
  /**
@@ -5,6 +5,7 @@ export const ANTIGRAVITY_CWD_KEY = 'Cwd';
5
5
  /** Antigravity shares Gemini's home; its own config lives one level down. */
6
6
  export const ANTIGRAVITY_ROOT_SEGMENTS = ['.gemini', 'config'];
7
7
  export const ANTIGRAVITY_CLI_DIR_SEGMENTS = ['.gemini', 'antigravity-cli'];
8
+ export const ANTIGRAVITY_BIN_DIR_SEGMENTS = ['.gemini', 'bin'];
8
9
  export const ANTIGRAVITY_HOOKS_FILE = 'hooks.json';
9
10
  export const ANTIGRAVITY_EXECUTABLES = ['agy', 'antigravity'];
10
11
  /**
@@ -1,7 +1,7 @@
1
1
  import { sha256Hex } from '../../events/event-id.js';
2
- import { baseEvent, promptPatch, responsePatch, toolPatch, withPatch } from '../shared/event-builder.js';
3
- import { classifyTool, extractCommand, parseMcpToolName, toolCompleteType, toolStartType } from '../shared/tooling.js';
4
- import { CLAUDE_DISPLAY_NAME, CLAUDE_EVENT_TYPE_MAP, CLAUDE_PROVIDER_ID, CLAUDE_SHELL_REREAD_EVENTS, CLAUDE_TOOL_EVENTS, CLAUDE_TOOL_START_EVENTS, CLAUDE_UNKNOWN_EVENT, RE_CLAUDE_EXIT_CODE } from './constants/claude.constants.js';
2
+ import { baseEvent, promptPatch, providerPatch, responsePatch, toolPatch, withPatch } from '../shared/event-builder.js';
3
+ import { classifyTool, extractCommand, parseMcpToolName, skillName, slashCommandName, toolCompleteType, toolStartType } from '../shared/tooling.js';
4
+ import { CLAUDE_DISPLAY_NAME, CLAUDE_EVENT_TYPE_MAP, CLAUDE_PROVIDER_ID, CLAUDE_SHELL_REREAD_EVENTS, CLAUDE_SKILL_TOOL, CLAUDE_TOOL_EVENTS, CLAUDE_TOOL_START_EVENTS, CLAUDE_UNKNOWN_EVENT, RE_CLAUDE_EXIT_CODE } from './constants/claude.constants.js';
5
5
  import { claudePayloadSchema } from './schemas/claude.schema.js';
6
6
  /**
7
7
  * Translate one Claude Code hook payload into canonical events.
@@ -92,8 +92,11 @@ function hookPatch(payload, providerEventType, context) {
92
92
  }
93
93
  if (providerEventType === 'SessionEnd')
94
94
  return { metadata: { sessionEndReason: payload.reason } };
95
- if (providerEventType === 'UserPromptSubmit')
96
- return promptPatch(payload.prompt ?? '', context.config.capture);
95
+ if (providerEventType === 'UserPromptSubmit') {
96
+ const prompt = promptPatch(payload.prompt ?? '', context.config.capture);
97
+ // The command's name only, read here in memory; its arguments stay in the prompt (AWT-711).
98
+ return { metadata: { ...prompt.metadata, ...providerPatch({ command: slashCommandName(payload.prompt) }).metadata } };
99
+ }
97
100
  if (CLAUDE_TOOL_EVENTS.has(providerEventType))
98
101
  return claudeToolPatch(payload, providerEventType, context);
99
102
  if (providerEventType === 'Stop') {
@@ -125,7 +128,7 @@ function claudeToolPatch(payload, providerEventType, context) {
125
128
  output: payload.tool_response,
126
129
  error: providerEventType === 'PostToolUseFailure' ? payload.tool_error : undefined,
127
130
  exitCode: providerEventType === 'PostToolUseFailure' && kind === 'shell' ? exitCodeIn(payload.tool_error) : undefined,
128
- providerFields: mcp ? { mcpServer: mcp.server, mcpTool: mcp.tool } : undefined
131
+ providerFields: mcp ? { mcpServer: mcp.server, mcpTool: mcp.tool } : { skill: payload.tool_name === CLAUDE_SKILL_TOOL ? skillName(payload.tool_input, 'skill') : undefined }
129
132
  }, context.config.capture);
130
133
  }
131
134
  /**
@@ -1,9 +1,7 @@
1
1
  import fs from 'node:fs';
2
2
  import path from 'node:path';
3
- import { asRecord } from '../../core/object.js';
4
3
  import { findExecutable } from '../../core/which.js';
5
- import { readJsonFile } from '../../storage/json-file.js';
6
- import { HOOK_COMMAND_MARKER } from '../constants/provider.constants.js';
4
+ import { hooksMarkerPresent } from '../shared/hooks-marker.js';
7
5
  import { CLAUDE_EXECUTABLE, CLAUDE_HOME_DIR, CLAUDE_SETTINGS_FILE } from './constants/claude.constants.js';
8
6
  /**
9
7
  * Where Claude Code keeps the settings file AgentWatch registers hooks in.
@@ -39,19 +37,6 @@ export async function detectClaude(env) {
39
37
  evidence,
40
38
  executablePath,
41
39
  hookConfigPath,
42
- hooksInstalled: await hasOurHooks(hookConfigPath)
40
+ hooksInstalled: await hooksMarkerPresent(hookConfigPath, 'hooks')
43
41
  };
44
42
  }
45
- /**
46
- * Whether the settings file already names the agentwatch hook command.
47
- *
48
- * @param settingsPath - Claude settings file.
49
- * @returns True when our marker appears in the hooks block.
50
- */
51
- async function hasOurHooks(settingsPath) {
52
- const read = await readJsonFile(settingsPath);
53
- const settings = read.state === 'ok' ? asRecord(read.value) : undefined;
54
- if (!settings)
55
- return false;
56
- return JSON.stringify(settings['hooks'] ?? {}).includes(HOOK_COMMAND_MARKER);
57
- }
@@ -1,5 +1,6 @@
1
1
  import type { Env } from '../../core/types/core.types.js';
2
2
  import type { NativeTelemetryConfigurator, NativeTelemetryStatus, SetupContext, SetupOutcome } from '../types/provider.types.js';
3
+ import { claudeSettingsPath } from './claude.detect.js';
3
4
  /** Where Claude Code's exporters send, as its settings file says. */
4
5
  export interface ClaudeExporterTargets {
5
6
  /** `OTEL_EXPORTER_OTLP_ENDPOINT`, when set. */
@@ -37,6 +38,21 @@ export declare function claudeOverrideTargets(env: Env): Promise<readonly string
37
38
  * ledger comes from.
38
39
  */
39
40
  export declare class ClaudeOtelConfigurator implements NativeTelemetryConfigurator {
41
+ private readonly captureSource;
42
+ /**
43
+ * Bind to the shims setup copies.
44
+ *
45
+ * @param captureSource - The package's shims; tests name their own.
46
+ */
47
+ constructor(captureSource?: {
48
+ node: string;
49
+ python: string;
50
+ });
51
+ /** Run capture rides in the same env block, and comes and goes with the exporters. */
52
+ readonly runCapture: {
53
+ configPath: typeof claudeSettingsPath;
54
+ inspect: (context: SetupContext) => Promise<import("../types/provider.types.js").RunCaptureStatus>;
55
+ };
40
56
  /**
41
57
  * Whether this agent can export native telemetry at all.
42
58
  *
@@ -67,9 +83,11 @@ export declare class ClaudeOtelConfigurator implements NativeTelemetryConfigurat
67
83
  /**
68
84
  * Remove the telemetry configuration AgentWatch wrote.
69
85
  *
70
- * Only our own keys go. Without a recorded key list we fall back to the
71
- * well-known ones, and then only when their values are the ones we would have
72
- * written — user-owned telemetry config is never removed.
86
+ * Only our own keys go, and a key the developer had before setup gets its
87
+ * value back. Without a recorded key list, keys holding values AgentWatch
88
+ * writes go only while the base endpoint is an Agent Watch one, and a signal
89
+ * the developer sends to their own collector keeps what it needs. Whatever is
90
+ * left in place for want of proof is named, never dropped silently.
73
91
  *
74
92
  * @param context - Environment, paths, config and install state.
75
93
  * @returns Whether the file changed, what to tell the user, and the next