@vellumai/assistant 0.12.4 → 0.12.5-dev.202609251017.e467a6c

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 (281) hide show
  1. package/docs/architecture/memory.md +9 -1
  2. package/docs/architecture/scheduling.md +13 -5
  3. package/docs/desktop-browser-cli.md +3 -2
  4. package/docs/guardian-request-flow.md +1 -1
  5. package/node_modules/@vellumai/avatar-manifest/src/__tests__/notification-avatar.test.ts +48 -4
  6. package/node_modules/@vellumai/avatar-manifest/src/notification-avatar.ts +12 -8
  7. package/node_modules/@vellumai/ces-client/node_modules/@vellumai/service-contracts/src/__tests__/guardian-requests.test.ts +26 -0
  8. package/node_modules/@vellumai/ces-client/node_modules/@vellumai/service-contracts/src/guardian-requests.ts +77 -3
  9. package/node_modules/@vellumai/gateway-client/node_modules/@vellumai/service-contracts/src/__tests__/guardian-requests.test.ts +26 -0
  10. package/node_modules/@vellumai/gateway-client/node_modules/@vellumai/service-contracts/src/guardian-requests.ts +77 -3
  11. package/node_modules/@vellumai/gateway-client/src/outbound-contract.ts +2 -4
  12. package/node_modules/@vellumai/service-contracts/src/__tests__/guardian-requests.test.ts +26 -0
  13. package/node_modules/@vellumai/service-contracts/src/guardian-requests.ts +77 -3
  14. package/openapi.yaml +152 -3
  15. package/package.json +1 -1
  16. package/src/__tests__/agent-loop.test.ts +76 -0
  17. package/src/__tests__/anthropic-error-formatting.test.ts +9 -0
  18. package/src/__tests__/background-shell-bash.test.ts +34 -0
  19. package/src/__tests__/background-shell-host-bash.test.ts +98 -1
  20. package/src/__tests__/background-tool-registry.test.ts +39 -0
  21. package/src/__tests__/channel-readiness-discord.test.ts +8 -0
  22. package/src/__tests__/channel-readiness-slack-remote.test.ts +8 -0
  23. package/src/__tests__/client-os-metadata-persistence.test.ts +4 -20
  24. package/src/__tests__/conversation-agent-loop.test.ts +529 -1
  25. package/src/__tests__/conversation-error.test.ts +18 -0
  26. package/src/__tests__/conversation-pairing.test.ts +69 -0
  27. package/src/__tests__/conversation-queue.test.ts +257 -4
  28. package/src/__tests__/conversation-runtime-assembly.test.ts +27 -0
  29. package/src/__tests__/emit-signal-routing-intent.test.ts +62 -0
  30. package/src/__tests__/evict-conversations-for-reload.test.ts +21 -0
  31. package/src/__tests__/gemini-provider.test.ts +9 -0
  32. package/src/__tests__/host-cu-proxy.test.ts +79 -0
  33. package/src/__tests__/host-cu-routes-targeted.test.ts +14 -5
  34. package/src/__tests__/introduction-card-resolver.test.ts +53 -8
  35. package/src/__tests__/job-handler-registration-guard.test.ts +1 -0
  36. package/src/__tests__/non-member-access-request.test.ts +48 -0
  37. package/src/__tests__/notification-events-source-context-probe.test.ts +48 -1
  38. package/src/__tests__/notification-platform-adapter.test.ts +97 -0
  39. package/src/__tests__/notification-vellum-adapter.test.ts +103 -3
  40. package/src/__tests__/platform-callback-registration.test.ts +46 -1
  41. package/src/__tests__/plugin-import-boundary-guard.test.ts +3 -0
  42. package/src/__tests__/scaffold-managed-skill-tool.test.ts +116 -66
  43. package/src/__tests__/scheduler-disk-pressure.test.ts +1 -0
  44. package/src/__tests__/scheduler-result-notification.test.ts +521 -7
  45. package/src/__tests__/scheduler-wake.test.ts +1 -0
  46. package/src/__tests__/skill-load-inline-command.test.ts +35 -0
  47. package/src/__tests__/subagent-cron-run-attribution.test.ts +41 -2
  48. package/src/__tests__/subagent-manager-notify.test.ts +48 -0
  49. package/src/__tests__/trusted-contact-inline-approval-integration.test.ts +6 -6
  50. package/src/__tests__/usage-attribution.test.ts +31 -0
  51. package/src/__tests__/wake-schedule-escalation.test.ts +1 -0
  52. package/src/agent/loop.ts +23 -0
  53. package/src/api/ask-question-tool.ts +50 -0
  54. package/src/api/events/generation-handoff.ts +4 -0
  55. package/src/api/events/message-complete.ts +4 -0
  56. package/src/api/events/tool-result.ts +11 -0
  57. package/src/api/index.ts +11 -0
  58. package/src/api/requests/guardian-actions.test.ts +45 -0
  59. package/src/api/requests/guardian-actions.ts +20 -0
  60. package/src/api/responses/conversation-message.ts +4 -0
  61. package/src/api/responses/home.ts +27 -0
  62. package/src/approvals/guardian-decision-primitive.ts +6 -4
  63. package/src/approvals/guardian-request-resolvers.ts +35 -30
  64. package/src/avatar/notification-avatar.test.ts +42 -34
  65. package/src/avatar/notification-avatar.ts +1 -0
  66. package/src/calls/__tests__/call-controller.test.ts +18 -0
  67. package/src/calls/__tests__/voice-control-protocol.test.ts +6 -1
  68. package/src/calls/__tests__/voice-leg-coordinator.test.ts +70 -0
  69. package/src/calls/__tests__/voice-session-bridge.test.ts +116 -4
  70. package/src/calls/__tests__/voice-triage-escalate.test.ts +77 -11
  71. package/src/calls/call-controller.ts +3 -1
  72. package/src/calls/voice-control-protocol.ts +12 -4
  73. package/src/calls/voice-escalation-judge.ts +2 -2
  74. package/src/calls/voice-leg-coordinator.ts +23 -5
  75. package/src/calls/voice-screen-annotation.ts +44 -0
  76. package/src/calls/voice-session-bridge.ts +63 -20
  77. package/src/calls/voice-triage-escalate.ts +82 -27
  78. package/src/cli/commands/__tests__/conversations-clear.test.ts +156 -0
  79. package/src/cli/commands/conversations.help.ts +7 -2
  80. package/src/cli/commands/conversations.ts +36 -30
  81. package/src/cli/commands/oauth/index.help.ts +8 -2
  82. package/src/cli/commands/oauth/request.test.ts +32 -0
  83. package/src/cli/commands/platform/index.help.ts +2 -1
  84. package/src/cli/commands/platform/index.ts +8 -2
  85. package/src/cli/lib/__tests__/plugin-catalog-cache.test.ts +60 -0
  86. package/src/cli/lib/__tests__/plugin-catalog-platform.test.ts +66 -2
  87. package/src/cli/lib/bundled-marketplace.json +35 -0
  88. package/src/cli/lib/bundled-plugin-packages.json +21 -0
  89. package/src/cli/lib/plugin-catalog-cache.ts +17 -2
  90. package/src/cli/lib/plugin-catalog-platform.ts +48 -9
  91. package/src/config/__tests__/default-profile-catalog.test.ts +28 -0
  92. package/src/config/__tests__/platform-identity.test.ts +59 -0
  93. package/src/config/__tests__/profile-order.test.ts +19 -0
  94. package/src/config/__tests__/sync-gated-profiles.test.ts +71 -0
  95. package/src/config/bundled-skills/computer-use/SKILL.md +20 -0
  96. package/src/config/bundled-skills/computer-use/TOOLS.json +11 -11
  97. package/src/config/bundled-skills/screen-annotation/SKILL.md +41 -29
  98. package/src/config/bundled-skills/screen-annotation/TOOLS.json +5 -5
  99. package/src/config/call-site-defaults.ts +6 -0
  100. package/src/config/default-profile-catalog.ts +30 -1
  101. package/src/config/default-profile-names.ts +36 -2
  102. package/src/config/feature-flag-registry.json +9 -1
  103. package/src/config/platform-identity.ts +22 -5
  104. package/src/config/profile-order.ts +7 -1
  105. package/src/config/schemas/call-site-catalog.ts +7 -0
  106. package/src/config/schemas/llm.ts +21 -5
  107. package/src/config/sync-gated-profiles.ts +96 -44
  108. package/src/daemon/__tests__/abort-null-controller.test.ts +135 -1
  109. package/src/daemon/__tests__/auto-profile-router.test.ts +380 -0
  110. package/src/daemon/__tests__/turn-tail-assistant-reply-notify.test.ts +16 -0
  111. package/src/daemon/activity-trail.test.ts +206 -0
  112. package/src/daemon/activity-trail.ts +190 -0
  113. package/src/daemon/auto-profile-router.ts +431 -0
  114. package/src/daemon/computer-use-observation.test.ts +81 -0
  115. package/src/daemon/computer-use-observation.ts +23 -0
  116. package/src/daemon/conversation-agent-loop-handlers.ts +11 -0
  117. package/src/daemon/conversation-agent-loop.ts +157 -32
  118. package/src/daemon/conversation-error.ts +19 -0
  119. package/src/daemon/conversation-lifecycle.ts +70 -7
  120. package/src/daemon/conversation-media-retry.ts +1 -2
  121. package/src/daemon/conversation-messaging.ts +31 -2
  122. package/src/daemon/conversation-process.ts +107 -16
  123. package/src/daemon/conversation-queue-manager.ts +7 -0
  124. package/src/daemon/conversation-runtime-assembly.ts +1 -0
  125. package/src/daemon/conversation-turn-finalize.ts +14 -0
  126. package/src/daemon/conversation.ts +25 -6
  127. package/src/daemon/event-loop-watchdog.test.ts +201 -2
  128. package/src/daemon/event-loop-watchdog.ts +182 -6
  129. package/src/daemon/host-cu-proxy.ts +34 -3
  130. package/src/daemon/pkb-reminder-builder.test.ts +10 -3
  131. package/src/daemon/pkb-reminder-builder.ts +1 -1
  132. package/src/daemon/wake-conversation-ops.ts +4 -2
  133. package/src/desktop/desktop-computer-use.test.ts +14 -4
  134. package/src/home/feed-types.ts +2 -0
  135. package/src/inbound/platform-callback-registration.ts +19 -6
  136. package/src/live-voice/__tests__/live-voice-agent-turn.test.ts +27 -0
  137. package/src/live-voice/__tests__/live-voice-flux-turn-end.test.ts +83 -0
  138. package/src/live-voice/__tests__/live-voice-triage-escalate.test.ts +48 -1
  139. package/src/live-voice/__tests__/live-voice-vad.test.ts +34 -2
  140. package/src/live-voice/__tests__/protocol.test.ts +22 -0
  141. package/src/live-voice/continuation-judge.ts +1 -1
  142. package/src/live-voice/live-voice-session.ts +25 -19
  143. package/src/live-voice/protocol.ts +16 -5
  144. package/src/messaging/providers/discord/withdraw.ts +4 -5
  145. package/src/messaging/providers/gmail/client.ts +4 -0
  146. package/src/messaging/providers/slack/withdraw.ts +5 -5
  147. package/src/messaging/providers/telegram-bot/withdraw.ts +4 -5
  148. package/src/monitoring/__tests__/proc-fixtures.ts +28 -0
  149. package/src/monitoring/__tests__/proc-wait-state.test.ts +232 -0
  150. package/src/monitoring/__tests__/process-usage.test.ts +243 -0
  151. package/src/monitoring/proc-wait-state.ts +366 -0
  152. package/src/monitoring/process-memory.ts +4 -3
  153. package/src/monitoring/process-usage.ts +215 -0
  154. package/src/monitoring/resource-sample-types.ts +8 -0
  155. package/src/monitoring/resource-sampler.ts +17 -2
  156. package/src/monitoring/stall-capture.ts +12 -0
  157. package/src/notifications/README.md +88 -9
  158. package/src/notifications/__tests__/assistant-reply-producer.test.ts +390 -119
  159. package/src/notifications/__tests__/background-result-producer.test.ts +1272 -0
  160. package/src/notifications/__tests__/broadcaster.test.ts +292 -1
  161. package/src/notifications/__tests__/completion-policy.test.ts +243 -0
  162. package/src/notifications/__tests__/decision-engine.test.ts +51 -4
  163. package/src/notifications/__tests__/has-pending-background-work.test.ts +281 -0
  164. package/src/notifications/__tests__/home-feed-side-effect.test.ts +161 -3
  165. package/src/notifications/__tests__/resolve-visible-in-source.test.ts +110 -1
  166. package/src/notifications/__tests__/schedule-result-producer.test.ts +11 -4
  167. package/src/notifications/adapters/macos.ts +24 -12
  168. package/src/notifications/adapters/platform.ts +16 -5
  169. package/src/notifications/assistant-reply-producer.ts +96 -71
  170. package/src/notifications/background-result-producer.ts +369 -0
  171. package/src/notifications/broadcaster.ts +28 -8
  172. package/src/notifications/completion-policy.ts +115 -0
  173. package/src/notifications/completion-work.ts +46 -0
  174. package/src/notifications/conversation-pairing.ts +32 -13
  175. package/src/notifications/decision-engine.ts +18 -24
  176. package/src/notifications/emit-signal.ts +16 -1
  177. package/src/notifications/events-store.ts +4 -0
  178. package/src/notifications/has-pending-background-work.ts +91 -0
  179. package/src/notifications/home-feed-mirror.ts +44 -0
  180. package/src/notifications/home-feed-side-effect.ts +54 -28
  181. package/src/notifications/resolve-visible-in-source.ts +56 -2
  182. package/src/notifications/result-output.ts +154 -0
  183. package/src/notifications/schedule-result-producer.ts +6 -187
  184. package/src/notifications/types.ts +2 -0
  185. package/src/oauth/AGENTS.md +9 -1
  186. package/src/oauth/byo-connection.test.ts +28 -0
  187. package/src/persistence/__tests__/recent-conversation-messages.test.ts +41 -0
  188. package/src/persistence/conversation-crud.ts +26 -0
  189. package/src/persistence/conversation-types.ts +15 -37
  190. package/src/persistence/embeddings/__tests__/embedding-local-lifecycle.test.ts +85 -14
  191. package/src/persistence/jobs-store.ts +229 -0
  192. package/src/persistence/migrations/383-normalize-opencode-host-connections.ts +44 -0
  193. package/src/persistence/migrations/__tests__/383-normalize-opencode-host-connections.test.ts +102 -0
  194. package/src/persistence/steps.ts +12 -0
  195. package/src/platform/sync-avatar.test.ts +29 -0
  196. package/src/plugins/defaults/memory/AGENTS.md +5 -3
  197. package/src/plugins/defaults/memory/__tests__/skill-update-receipt-boundary-guard.test.ts +45 -0
  198. package/src/plugins/defaults/memory/__tests__/skill-update-receipt-job.test.ts +580 -0
  199. package/src/plugins/defaults/memory/__tests__/turn-retrieval.test.ts +21 -0
  200. package/src/plugins/defaults/memory/graph/tools.ts +9 -5
  201. package/src/plugins/defaults/memory/hooks/conversation-deleted.ts +4 -0
  202. package/src/plugins/defaults/memory/hooks/user-prompt-submit.ts +7 -3
  203. package/src/plugins/defaults/memory/job-handlers.ts +8 -2
  204. package/src/plugins/defaults/memory/skill-update-receipt-job.ts +334 -0
  205. package/src/plugins/defaults/memory/tools.test.ts +17 -0
  206. package/src/plugins/defaults/memory/turn-retrieval.ts +8 -0
  207. package/src/plugins/defaults/memory/v3/__tests__/injection.test.ts +24 -0
  208. package/src/plugins/defaults/memory/v3/injector.ts +4 -4
  209. package/src/plugins/types.ts +2 -0
  210. package/src/providers/__tests__/search-provider-catalog.test.ts +8 -0
  211. package/src/providers/anthropic/client.ts +4 -0
  212. package/src/providers/gemini/client.ts +7 -1
  213. package/src/providers/inference/auth.ts +25 -0
  214. package/src/providers/inference/profile-probe.ts +1 -0
  215. package/src/{calls/__tests__/typesafe-noul.test.ts → providers/jev/ask.test.ts} +4 -4
  216. package/src/{calls/typesafe-noul.ts → providers/jev/ask.ts} +67 -34
  217. package/src/providers/openai/__tests__/api-error-normalization.test.ts +12 -0
  218. package/src/providers/openai/api-error-normalization.ts +4 -0
  219. package/src/providers/retry.ts +2 -0
  220. package/src/providers/search-provider-catalog.ts +10 -0
  221. package/src/providers/types.ts +7 -0
  222. package/src/providers/usage-tracking.ts +5 -3
  223. package/src/runtime/__tests__/agent-wake.test.ts +308 -0
  224. package/src/runtime/access-request-helper.ts +16 -9
  225. package/src/runtime/agent-wake-queue.ts +52 -0
  226. package/src/runtime/agent-wake.ts +111 -18
  227. package/src/runtime/channel-approval-types.ts +6 -38
  228. package/src/runtime/channel-approvals.ts +4 -5
  229. package/src/runtime/http-server.ts +4 -1
  230. package/src/runtime/introduction-policy.test.ts +17 -1
  231. package/src/runtime/introduction-policy.ts +25 -7
  232. package/src/runtime/migrations/vbundle-builder.ts +9 -0
  233. package/src/runtime/routes/__tests__/inference-profiles-routes.test.ts +21 -1
  234. package/src/runtime/routes/__tests__/inference-provider-connection-routes.test.ts +60 -0
  235. package/src/runtime/routes/__tests__/oauth-proxy-routes.test.ts +61 -3
  236. package/src/runtime/routes/auto-profile-routes.ts +83 -0
  237. package/src/runtime/routes/conversation-management-routes.ts +1 -3
  238. package/src/runtime/routes/conversation-routes.ts +9 -0
  239. package/src/runtime/routes/guardian-action-routes.ts +8 -23
  240. package/src/runtime/routes/host-cu-routes.ts +3 -1
  241. package/src/runtime/routes/index.ts +2 -0
  242. package/src/runtime/routes/inference-profiles-routes.ts +5 -2
  243. package/src/runtime/routes/inference-provider-connection-routes.ts +25 -8
  244. package/src/runtime/routes/migration-routes.ts +8 -2
  245. package/src/runtime/routes/oauth-proxy-passthrough.test.ts +32 -0
  246. package/src/runtime/routes/platform-routes.ts +6 -1
  247. package/src/runtime/routes/user-route-dispatcher.ts +1 -2
  248. package/src/runtime/web-presence.ts +3 -4
  249. package/src/schedule/schedule-store.ts +10 -0
  250. package/src/schedule/scheduler.ts +92 -24
  251. package/src/subagent/manager.ts +32 -12
  252. package/src/telegram/__tests__/webhook-health.test.ts +8 -0
  253. package/src/telemetry/telemetry-wire-source.json +1 -1
  254. package/src/telemetry/telemetry-wire.generated.ts +1 -0
  255. package/src/tools/background-tool-registry.ts +30 -3
  256. package/src/tools/browser/cdp-client/local-cdp-client.ts +1 -2
  257. package/src/tools/host-terminal/host-shell.ts +7 -0
  258. package/src/tools/network/__tests__/web-fetch-firecrawl.test.ts +28 -1
  259. package/src/tools/network/__tests__/web-fetch-metadata.test.ts +34 -0
  260. package/src/tools/network/__tests__/web-fetch-tinyfish.test.ts +35 -1
  261. package/src/tools/network/__tests__/web-search.test.ts +96 -0
  262. package/src/tools/network/web-fetch.ts +30 -9
  263. package/src/tools/network/web-search.ts +235 -4
  264. package/src/tools/skills/load.ts +13 -17
  265. package/src/tools/skills/scaffold-managed.ts +86 -71
  266. package/src/tools/terminal/shell-launch.test.ts +27 -1
  267. package/src/tools/terminal/shell.ts +4 -0
  268. package/src/tools/workspace-tools/loader.ts +1 -2
  269. package/src/usage/attribution.ts +18 -1
  270. package/src/util/abort-reasons.ts +2 -0
  271. package/src/util/errors.ts +1 -0
  272. package/src/util/oauth-request-body.test.ts +5 -1
  273. package/src/util/provider-error-patterns.ts +11 -0
  274. package/src/util/single-flight.test.ts +6 -0
  275. package/src/util/single-flight.ts +2 -0
  276. package/src/util/worker-pipe.test.ts +56 -10
  277. package/src/util/worker-pipe.ts +9 -4
  278. package/src/workspace/git-service.ts +6 -1
  279. package/src/workspace/migrations/158-repoint-opencode-host-provider-fragments.ts +163 -0
  280. package/src/workspace/migrations/__tests__/158-repoint-opencode-host-provider-fragments.test.ts +188 -0
  281. package/src/workspace/migrations/registry.ts +2 -0
@@ -1,14 +1,16 @@
1
1
  import { existsSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
 
4
+ import { v4 as uuid } from "uuid";
5
+
4
6
  import type { SkillSource } from "../../config/skills.js";
5
7
  import { loadSkillCatalog } from "../../config/skills.js";
6
8
  import { refreshSkillCapabilityMemories } from "../../daemon/skill-memory-refresh.js";
7
- import { emitNotificationSignal } from "../../notifications/emit-signal.js";
8
9
  import { sanitizeMultilineMessagePreview } from "../../notifications/notification-utils.js";
9
10
  import { getConversation } from "../../persistence/conversation-crud.js";
10
11
  import { upsertSkillCardInsertJob } from "../../persistence/jobs-store.js";
11
12
  import { MEMORY_RETROSPECTIVE_ORIGIN } from "../../plugins/defaults/memory/memory-retrospective-constants.js";
13
+ import { recordSkillUpdate } from "../../plugins/defaults/memory/skill-update-receipt-job.js";
12
14
  import { readInstallMeta } from "../../skills/install-meta.js";
13
15
  import {
14
16
  createManagedSkill,
@@ -90,78 +92,90 @@ function normalizeOptionalStringArray(
90
92
  return { value: normalized };
91
93
  }
92
94
 
95
+ /** Watchdog check_name counted when a receipt entry could not be recorded. */
96
+ const SKILL_UPDATE_RECEIPT_RECORD_FAILED_CHECK_NAME =
97
+ "skill_update_receipt_record_failed";
98
+
93
99
  /**
94
- * Tell the user that a background pass changed a skill they already have.
100
+ * Record that a background pass changed a skill the user already has.
95
101
  *
96
102
  * A newly authored skill announces itself in the conversation through the
97
- * `skill_card` surface; an update announces itself here instead. The pass
98
- * runs in a background fork and rewrites the body of a skill the user may be
99
- * relying on, and `createManagedSkill` writes through an atomic rename
100
- * keeping no prior version, so the notification pipeline is what puts the
101
- * change in the background feed alongside the other unattended work (sweeps,
102
- * scheduled jobs, heartbeat), where a user already looks to see what the
103
- * assistant did on its own.
103
+ * `skill_card` surface; an update is announced through a skill-update
104
+ * receipt instead. The pass runs in a background fork and rewrites the body
105
+ * of a skill the user may be relying on, and `createManagedSkill` writes
106
+ * through an atomic rename keeping no prior version, so the receipt is what
107
+ * puts the change in the background feed alongside the other unattended
108
+ * work (sweeps, scheduled jobs, heartbeat), where a user already looks to
109
+ * see what the assistant did on its own. One pass can rewrite several skills
110
+ * within minutes, so the rewrites accumulate on one pending receipt job
111
+ * (`plugins/defaults/memory/skill-update-receipt-job.ts`), which announces
112
+ * the whole burst once it has settled rather than one notification per
113
+ * rewrite.
104
114
  *
105
115
  * `changeSummary` is the pass's own account of what it changed and is the
106
- * notice's body: the feed item is the only place the change surfaces, and a
107
- * reader triaging it there has no diff to look at, so a notice that only
116
+ * entry's body: the receipt is the only place the change surfaces, and a
117
+ * reader triaging it there has no diff to look at, so an entry that only
108
118
  * names the skill sends them into the skill to find out what happened. The
109
119
  * executor refuses the overwrite without one, so this never runs without it.
110
120
  *
111
- * `sourceContextId` is a conversation id so the feed item's "Go to Convo"
112
- * target resolves (see `home-feed-side-effect.ts`, which looks it up via
113
- * `getConversation`): the source conversation when lineage resolved, else the
114
- * run's own conversation. Deduped per skill per day, so a pass that refines
115
- * the same skill repeatedly cannot flood the feed. Best-effort and
116
- * non-blocking: the skill is already written, and a notification failure must
117
- * never turn that into a tool error.
121
+ * `sourceConversationId` is the conversation the receipt's link resolves to
122
+ * for this entry (see `home-updates-list.tsx`): the source conversation when
123
+ * lineage resolved, else none. The run's own conversation is never used in
124
+ * its place: it is an ephemeral fork the next successful retrospective
125
+ * garbage-collects, and the receipt job leaves out any entry whose source
126
+ * is gone by the time it announces, so naming the fork would drop the
127
+ * entry rather than link it. `entryId` is the producing tool call's id, so a
128
+ * re-executed call records nothing new. A context with no tool call id (a
129
+ * direct caller) has no re-execution to guard against, so it gets a fresh
130
+ * id: a stable key on the run and skill would drop a second rewrite of the
131
+ * same skill in the same run.
132
+ *
133
+ * Best-effort and non-blocking: the skill is already written, and a receipt
134
+ * that cannot be recorded is a receipt the user will not get, not a reason
135
+ * to fail or retry a write that already landed. The failure is logged with
136
+ * the ids and counted, and the tool-invocation history keeps the summary as
137
+ * audit evidence.
118
138
  */
119
- function notifyBackgroundSkillUpdate(args: {
139
+ function recordBackgroundSkillUpdate(args: {
120
140
  skillId: string;
121
141
  name: string;
122
- conversationId: string;
123
142
  changeSummary: string;
143
+ runConversationId: string;
144
+ sourceConversationId: string | undefined;
145
+ toolUseId: string | undefined;
124
146
  }): void {
125
- const day = new Date().toISOString().slice(0, 10);
126
- void emitNotificationSignal({
127
- // This emit is a tool executor's, not the scheduler's. The channel is
128
- // provenance the pipeline reads: `home-feed-side-effect` derives
129
- // `fromAssistant` from it, so labelling this "scheduler" would drop the
130
- // item from the feed's assistant-initiated filter despite being exactly
131
- // that.
132
- sourceChannel: "assistant_tool",
133
- sourceContextId: args.conversationId,
134
- sourceEventName: "activity.complete",
135
- dedupeKey: `skill-updated:${args.skillId}:${day}`,
136
- contextPayload: {
137
- // `summary` feeds the copy composer and `title` is the headline both
138
- // it and the home feed keep; `title`/`body` are also the feed's
139
- // fallback when no channel copy was rendered. Without them a fully
140
- // suppressed delivery (the intended shape for this signal: low urgency,
141
- // background, no interruption) leaves the feed writer with no summary
142
- // and it skips the item entirely, so the quiet case would surface
143
- // nothing at all.
144
- summary: args.changeSummary,
145
- // Named, not just "Skill updated": the feed sits several rows deep and
146
- // a generic title is unscannable next to entries that name their
147
- // subject (`Background job failed: memory.v2.sweep`). The word "Skill"
148
- // stays because a bare skill name does not always read as one.
149
- title: `Skill updated: ${args.name}`,
150
- body: args.changeSummary,
147
+ const entryId = `${args.runConversationId}:${args.toolUseId ?? uuid()}`;
148
+ try {
149
+ recordSkillUpdate({
150
+ entryId,
151
151
  skillId: args.skillId,
152
- },
153
- attentionHints: {
154
- requiresAction: false,
155
- urgency: "low",
156
- isAsyncBackground: true,
157
- visibleInSourceNow: false,
158
- },
159
- }).catch((err: unknown) => {
152
+ name: args.name,
153
+ changeSummary: args.changeSummary,
154
+ runConversationId: args.runConversationId,
155
+ ...(args.sourceConversationId
156
+ ? { sourceConversationId: args.sourceConversationId }
157
+ : {}),
158
+ });
159
+ } catch (err) {
160
160
  log.warn(
161
- { err, skillId: args.skillId },
162
- "skill update notification failed; the skill write stands",
161
+ {
162
+ err,
163
+ skillId: args.skillId,
164
+ runConversationId: args.runConversationId,
165
+ entryId,
166
+ },
167
+ "skill update receipt recording failed; the skill write stands and no receipt will name this update",
163
168
  );
164
- });
169
+ try {
170
+ recordWatchdogEvent({
171
+ checkName: SKILL_UPDATE_RECEIPT_RECORD_FAILED_CHECK_NAME,
172
+ value: 1,
173
+ });
174
+ } catch {
175
+ // recordWatchdogEvent already no-ops on opt-out and a missing
176
+ // telemetry DB; anything past that is not worth surfacing here.
177
+ }
178
+ }
165
179
  }
166
180
 
167
181
  /**
@@ -333,10 +347,11 @@ export async function executeScaffoldManagedSkill(
333
347
  category = input.category.trim().toLowerCase();
334
348
  }
335
349
 
336
- // The update notice's body. Model-authored text bound for a notification
350
+ // The receipt entry's body. Model-authored text bound for a notification
337
351
  // surface, so it gets the same control-character strip and preview clamp as
338
352
  // any other producer-supplied body; blank collapses to absent so the
339
- // requirement below treats it as missing rather than posting an empty notice.
353
+ // requirement below treats it as missing rather than recording an empty
354
+ // entry.
340
355
  let changeSummary: string | undefined;
341
356
  if (input.change_summary !== undefined) {
342
357
  if (typeof input.change_summary !== "string") {
@@ -404,9 +419,9 @@ export async function executeScaffoldManagedSkill(
404
419
  }
405
420
  }
406
421
 
407
- // A background overwrite announces itself through the notice built in
408
- // notifyBackgroundSkillUpdate, whose body is this summary, so the write is
409
- // refused without one. The error returns to the pass in the same turn and
422
+ // A background overwrite announces itself through the receipt entry
423
+ // recorded in recordBackgroundSkillUpdate, whose body is this summary, so
424
+ // the write is refused without one. The error returns to the pass in the same turn and
410
425
  // it retries with the field, the way a missing activation_hints does.
411
426
  // Checked after the ownership backstop so a pass that may not touch the
412
427
  // skill hears that first, and only for a call that asked to overwrite: a
@@ -500,23 +515,23 @@ export async function executeScaffoldManagedSkill(
500
515
  }
501
516
 
502
517
  // A background pass changed a skill that already existed. Creates announce
503
- // themselves through the skill card below; updates announce themselves in
504
- // the background activity feed. Covers an explicit `overwrite: true`
505
- // refinement as well as any other background write onto a pre-existing
506
- // skill.
507
- const notifyConversationId =
508
- sourceConversationId ?? retrospectiveConversationId;
518
+ // themselves through the skill card below; updates land on the skill-update
519
+ // receipt that announces the whole burst. Covers an explicit
520
+ // `overwrite: true` refinement as well as any other background write onto
521
+ // a pre-existing skill.
509
522
  if (
510
523
  fromRetrospective &&
511
524
  managedSkillExistedBefore &&
512
- notifyConversationId &&
525
+ retrospectiveConversationId &&
513
526
  changeSummary
514
527
  ) {
515
- notifyBackgroundSkillUpdate({
528
+ recordBackgroundSkillUpdate({
516
529
  skillId: id,
517
530
  name: normalizedName,
518
- conversationId: notifyConversationId,
519
531
  changeSummary,
532
+ runConversationId: retrospectiveConversationId,
533
+ sourceConversationId,
534
+ toolUseId: context.toolUseId,
520
535
  });
521
536
  }
522
537
 
@@ -6,6 +6,7 @@ import { join } from "node:path";
6
6
  import { afterEach, beforeEach, describe, expect, mock, test } from "bun:test";
7
7
 
8
8
  import { setConfig } from "../../__tests__/helpers/set-config.js";
9
+ import type { WakeOptions } from "../../runtime/agent-wake.js";
9
10
  import { SHELL_DID_NOT_START_MESSAGE } from "../shared/shell-output.js";
10
11
  import type { ToolContext } from "../types.js";
11
12
 
@@ -62,9 +63,13 @@ mock.module("../../runtime/assistant-event-hub.js", () => ({
62
63
  }));
63
64
 
64
65
  const realWake = await import("../../runtime/agent-wake.js");
66
+ const wakeCalls: WakeOptions[] = [];
65
67
  mock.module("../../runtime/agent-wake.js", () => ({
66
68
  ...realWake,
67
- wakeAgentForOpportunity: async () => ({}),
69
+ wakeAgentForOpportunity: async (opts: WakeOptions) => {
70
+ wakeCalls.push(opts);
71
+ return {};
72
+ },
68
73
  }));
69
74
 
70
75
  const { shellTool } = await import("./shell.js");
@@ -108,6 +113,7 @@ describe("bash launch failures are not success", () => {
108
113
 
109
114
  beforeEach(() => {
110
115
  spawnCalls.length = 0;
116
+ wakeCalls.length = 0;
111
117
  spawnImpl = originalSpawn as SpawnImpl;
112
118
  workingDir = mkdtempSync(join(tmpdir(), "bash-launch-"));
113
119
  });
@@ -159,4 +165,24 @@ describe("bash launch failures are not success", () => {
159
165
  expect(result.content).not.toContain("<command_completed />");
160
166
  expect(existsSync(join(workingDir, "help.txt"))).toBe(false);
161
167
  });
168
+
169
+ for (const cronRunId of [undefined, null, "cron-run-123"]) {
170
+ test(`preserves originating schedule ${String(cronRunId)} on background spawn error`, async () => {
171
+ const child = fakeChild();
172
+ spawnImpl = () =>
173
+ child as unknown as ReturnType<typeof realChildProcess.spawn>;
174
+ const context = { ...makeContext(workingDir), cronRunId };
175
+ await shellTool.execute(
176
+ { command: "echo hello", activity: "test", background: true },
177
+ context,
178
+ );
179
+ context.cronRunId = "cron-run-later";
180
+ child.emit("error", new Error("spawn ENOENT"));
181
+ child.emit("close", null, null);
182
+
183
+ expect(wakeCalls).toHaveLength(1);
184
+ expect(wakeCalls[0]!.cronRunId).toBe(cronRunId ?? undefined);
185
+ expect(wakeCalls[0]!.backgroundToolCompletion?.status).toBe("failed");
186
+ });
187
+ }
162
188
  });
@@ -125,6 +125,7 @@ export const shellTool = {
125
125
  input: Record<string, unknown>,
126
126
  context: ToolContext,
127
127
  ): Promise<ToolExecutionResult> {
128
+ const cronRunId = context.cronRunId ?? undefined;
128
129
  const parsed = shellInputSchema.safeParse(input);
129
130
  if (!parsed.success) {
130
131
  return invalidToolInputResult("bash", parsed.error);
@@ -410,6 +411,7 @@ export const shellTool = {
410
411
  : `Background command completed (id=${bgId}, exit=${code ?? "unknown"}):`;
411
412
  void wakeAgentForOpportunity({
412
413
  conversationId: context.conversationId,
414
+ cronRunId,
413
415
  hint: framing,
414
416
  source: "background-tool",
415
417
  persistTriggerAsEvent: true,
@@ -473,6 +475,7 @@ export const shellTool = {
473
475
  };
474
476
  void wakeAgentForOpportunity({
475
477
  conversationId: context.conversationId,
478
+ cronRunId,
476
479
  hint: framing,
477
480
  source: "background-tool",
478
481
  persistTriggerAsEvent: true,
@@ -496,6 +499,7 @@ export const shellTool = {
496
499
 
497
500
  registerBackgroundTool({
498
501
  id: bgId,
502
+ cronRunId,
499
503
  toolName: "bash",
500
504
  conversationId: context.conversationId,
501
505
  command,
@@ -236,7 +236,7 @@ function selectLiveExtension(
236
236
  * delete of the file unregisters the right tool.
237
237
  */
238
238
  function applyWorkspaceToolDefaults(tool: ToolDefinition, name: string): Tool {
239
- const finalized = finalizeTool(
239
+ return finalizeTool(
240
240
  {
241
241
  ...tool,
242
242
  name,
@@ -253,7 +253,6 @@ function applyWorkspaceToolDefaults(tool: ToolDefinition, name: string): Tool {
253
253
  },
254
254
  name,
255
255
  );
256
- return finalized;
257
256
  }
258
257
 
259
258
  /**
@@ -10,11 +10,15 @@ import { safeStringSlice } from "../util/unicode.js";
10
10
 
11
11
  const MAX_METADATA_VALUE_LENGTH = 128;
12
12
 
13
+ /** `profileSource` reported for a turn whose profile the Auto router chose. */
14
+ export const AUTO_PROFILE_SOURCE = "auto";
15
+
13
16
  export type UsageAttributionProfileSource =
14
17
  | "call_site"
15
18
  | "conversation"
16
19
  | "active"
17
20
  | "default"
21
+ | typeof AUTO_PROFILE_SOURCE
18
22
  | "unknown";
19
23
 
20
24
  export interface UsageAttributionInput {
@@ -27,6 +31,12 @@ export interface UsageAttributionInput {
27
31
  */
28
32
  profileResolutionCallSite?: LLMCallSite | null;
29
33
  overrideProfile?: string | null;
34
+ /**
35
+ * Who chose `overrideProfile`. `"auto"` marks a profile the Auto profile's
36
+ * router picked for the turn, so usage rows can tell an Auto pick from a
37
+ * user pin that landed on the same profile. Absent for a user pin.
38
+ */
39
+ overrideProfileOrigin?: "auto" | null;
30
40
  /**
31
41
  * Mirrors `ResolveCallSiteOpts.forceOverrideProfile`: the override profile
32
42
  * was floated above the call-site layers for this request, so attribution
@@ -227,9 +237,16 @@ function appliedProfileFromWinnerSelection(
227
237
  call_site: "call_site",
228
238
  default: "default",
229
239
  } as const;
240
+ // An override the Auto router chose is reported as its own source: the
241
+ // applied profile is the routed arm, so without this a routed turn would
242
+ // be indistinguishable from a user who pinned that arm.
243
+ const profileSource =
244
+ selection.source === "override" && input.overrideProfileOrigin === "auto"
245
+ ? AUTO_PROFILE_SOURCE
246
+ : sourceBySelection[selection.source];
230
247
  return {
231
248
  appliedProfile: selection.profileName,
232
- profileSource: sourceBySelection[selection.source],
249
+ profileSource,
233
250
  };
234
251
  }
235
252
 
@@ -10,6 +10,8 @@
10
10
  */
11
11
 
12
12
  export type AbortReasonKind =
13
+ /** A scheduled run exhausted its execution budget. */
14
+ | "schedule_timeout"
13
15
  /** User explicitly hit Stop / Esc on the active conversation. */
14
16
  | "user_cancel"
15
17
  /** A new user message arrived for the same conversation, preempting the in-flight turn. */
@@ -114,6 +114,7 @@ export type ProviderErrorReason =
114
114
  | "model_not_found"
115
115
  | "insufficient_credits"
116
116
  | "daily_limit_reached"
117
+ | "free_tier_daily_limit_reached"
117
118
  | "rate_limited"
118
119
  | "overloaded"
119
120
  | "context_overflow"
@@ -53,6 +53,9 @@ describe("parseRequestBodyData", () => {
53
53
  expect(parseRequestBodyData('{"a":1}', "multipart/related")).toBe(
54
54
  '{"a":1}',
55
55
  );
56
+ expect(
57
+ parseRequestBodyData("From: user@example.com\r\n\r\nHi", "message/rfc822"),
58
+ ).toBe("From: user@example.com\r\n\r\nHi");
56
59
  });
57
60
 
58
61
  test("parses under a JSON Content-Type", () => {
@@ -82,7 +85,7 @@ describe("isBinaryOAuthContentType", () => {
82
85
  expect(isBinaryOAuthContentType("image/png; charset=binary")).toBe(true);
83
86
  });
84
87
 
85
- test("rejects JSON, multipart, and form types", () => {
88
+ test("rejects JSON, multipart, form, and rfc822 types", () => {
86
89
  expect(isBinaryOAuthContentType("application/json")).toBe(false);
87
90
  expect(isBinaryOAuthContentType("multipart/related; boundary=b")).toBe(
88
91
  false,
@@ -90,6 +93,7 @@ describe("isBinaryOAuthContentType", () => {
90
93
  expect(isBinaryOAuthContentType("application/x-www-form-urlencoded")).toBe(
91
94
  false,
92
95
  );
96
+ expect(isBinaryOAuthContentType("message/rfc822")).toBe(false);
93
97
  expect(isBinaryOAuthContentType(undefined)).toBe(false);
94
98
  });
95
99
  });
@@ -99,3 +99,14 @@ export const INSUFFICIENT_CREDITS_PATTERNS = [
99
99
  // credit-exhaustion prose above — both are 402s from the same proxy — so
100
100
  // classification sites must test this before INSUFFICIENT_CREDITS_PATTERNS.
101
101
  export const DAILY_LIMIT_PATTERNS = [/"code"\s*:\s*"daily_limit_reached"/i];
102
+
103
+ // Managed-proxy free-tier daily usage-credit cap: a 402 whose body carries
104
+ // `"code": "free_tier_daily_limit_reached"`. The platform imposes it on a
105
+ // cohort of free-tier orgs (it is not the user-configured daily limit above,
106
+ // which caps purchased spend), so it gets its own reason and copy: there is
107
+ // no limit for the user to raise, only the UTC reset, an upgrade, or extra
108
+ // credits. Anchored on the opening quote so DAILY_LIMIT_PATTERNS, which is
109
+ // anchored the same way, never matches this code as its suffix.
110
+ export const FREE_TIER_DAILY_LIMIT_PATTERNS = [
111
+ /"code"\s*:\s*"free_tier_daily_limit_reached"/i,
112
+ ];
@@ -31,6 +31,9 @@ describe("createKeyedSingleFlight", () => {
31
31
  return "b";
32
32
  });
33
33
 
34
+ expect(run.isPending("k")).toBe(true);
35
+ expect(run.isPending("other")).toBe(false);
36
+
34
37
  // B must not start until A finishes.
35
38
  await tick();
36
39
  expect(order).toEqual(["a:start"]);
@@ -39,6 +42,7 @@ describe("createKeyedSingleFlight", () => {
39
42
  await expect(a).resolves.toBe("a");
40
43
  await expect(b).resolves.toBe("b");
41
44
  expect(order).toEqual(["a:start", "a:end", "b:start"]);
45
+ expect(run.isPending("k")).toBe(false);
42
46
  });
43
47
 
44
48
  test("does not serialize across different keys", async () => {
@@ -69,6 +73,7 @@ describe("createKeyedSingleFlight", () => {
69
73
  throw new Error("boom");
70
74
  }),
71
75
  ).rejects.toThrow("boom");
76
+ expect(run.isPending("k")).toBe(false);
72
77
  await expect(run("k", async () => "ok")).resolves.toBe("ok");
73
78
  });
74
79
 
@@ -80,6 +85,7 @@ describe("createKeyedSingleFlight", () => {
80
85
  await tick();
81
86
 
82
87
  run.reset();
88
+ expect(run.isPending("k")).toBe(false);
83
89
 
84
90
  // After reset, a fresh call for the same key does not wait on the
85
91
  // abandoned one.
@@ -13,6 +13,7 @@
13
13
  */
14
14
  export interface KeyedSingleFlight {
15
15
  <T>(key: string, fn: () => Promise<T>): Promise<T>;
16
+ isPending(key: string): boolean;
16
17
  /**
17
18
  * Drop all chain entries. Test-only escape hatch for a clean slate between
18
19
  * cases; production code never needs it because entries self-clear once
@@ -52,6 +53,7 @@ export function createKeyedSingleFlight(): KeyedSingleFlight {
52
53
  run.reset = (): void => {
53
54
  chain.clear();
54
55
  };
56
+ run.isPending = (key: string): boolean => chain.has(key);
55
57
 
56
58
  return run;
57
59
  }
@@ -32,21 +32,67 @@ function spawnBusyWorker() {
32
32
 
33
33
  describe("writeWorkerLine", () => {
34
34
  /**
35
- * The production failure: the payload outruns the pipe buffer, Bun returns a
36
- * pending promise, and the worker dies before draining it. Unobserved, that
37
- * rejection is an `unhandledRejection`, which `bun test` reports as a failure
38
- * of this test.
35
+ * The contract this module rests on, against the real Bun API: a payload
36
+ * that outruns the pipe buffer comes back as a `Promise`, and killing the
37
+ * worker settles it. Which way it settles is Bun's to choose. It rejects
38
+ * with EPIPE on nearly every kill and, rarely on Linux, resolves with a
39
+ * short count instead, so this asserts only that nothing escapes either
40
+ * way. Demanding the rejection is what made this case flaky on CI.
39
41
  */
40
- test("reports a write still pending when the worker dies", async () => {
42
+ test("observes a real pending write however Bun settles it", async () => {
41
43
  const proc = spawnBusyWorker();
42
- const failure = Promise.withResolvers<unknown>();
44
+ const failures: unknown[] = [];
45
+ const settling: Promise<number>[] = [];
46
+ const record = (result: number | Promise<number>) => {
47
+ if (result instanceof Promise) {
48
+ settling.push(result);
49
+ }
50
+ return result;
51
+ };
43
52
 
44
- writeWorkerLine(proc.stdin, OVERSIZED_LINE, failure.resolve);
53
+ writeWorkerLine(
54
+ {
55
+ write: (chunk) => record(proc.stdin.write(chunk)),
56
+ flush: () => record(proc.stdin.flush()),
57
+ },
58
+ OVERSIZED_LINE,
59
+ (err) => failures.push(err),
60
+ );
45
61
  proc.kill("SIGKILL");
62
+ const outcomes = await Promise.race([
63
+ Promise.allSettled(settling),
64
+ Bun.sleep(10_000).then(() => null),
65
+ ]);
66
+
67
+ expect(settling.length).toBeGreaterThan(0);
68
+ expect(outcomes).not.toBeNull();
69
+ expect(failures).toHaveLength(
70
+ outcomes!.some((o) => o.status === "rejected") ? 1 : 0,
71
+ );
72
+ });
73
+
74
+ /**
75
+ * The production failure: the payload outruns the pipe buffer, Bun hands
76
+ * `write` and `flush` one pending promise, and the worker dies before
77
+ * draining it. Bun rejects that promise from its own event loop, after this
78
+ * call has returned. Unobserved, the rejection is an `unhandledRejection`,
79
+ * which `bun test` reports as a failure of this test.
80
+ */
81
+ test("reports a write still pending when the worker dies", async () => {
82
+ const failure = Promise.withResolvers<unknown>();
83
+ const epipe = Object.assign(new Error("EPIPE: broken pipe, write"), {
84
+ code: "EPIPE",
85
+ });
86
+ const pending = Promise.withResolvers<number>();
87
+ const stdin = {
88
+ write: () => pending.promise,
89
+ flush: () => pending.promise,
90
+ };
91
+
92
+ writeWorkerLine(stdin, "line", failure.resolve);
93
+ pending.reject(epipe);
46
94
 
47
- const err = await failure.promise;
48
- expect(err).toBeInstanceOf(Error);
49
- expect((err as NodeJS.ErrnoException).code).toBe("EPIPE");
95
+ expect(await failure.promise).toBe(epipe);
50
96
  });
51
97
 
52
98
  test("reports a synchronous throw", () => {
@@ -8,10 +8,15 @@ import type { FileSink } from "bun";
8
8
  * While the pipe has room they complete synchronously. Once a payload outruns
9
9
  * the pipe buffer, which is what happens when the worker is busy and not
10
10
  * draining stdin, they return a pending promise instead, and that promise
11
- * rejects with EPIPE if the worker dies before the write completes. A
12
- * `try/catch` sees only the synchronous half: the rejection escapes it, reaches
13
- * the process's `unhandledRejection` handler, and in the daemon that handler
14
- * shuts the whole process down.
11
+ * rejects with EPIPE once the worker dies, from Bun's event loop, after this
12
+ * call has returned. A `try/catch` sees only the synchronous half: the
13
+ * rejection escapes it, reaches the process's `unhandledRejection` handler,
14
+ * and in the daemon that handler shuts the whole process down.
15
+ *
16
+ * On Linux, Bun occasionally treats a zero-byte write to the dead worker's
17
+ * pipe as end-of-file and resolves that promise with the bytes written so
18
+ * far instead. `onFailure` then never runs, and the caller learns of the
19
+ * death only when the worker's stdout ends.
15
20
  *
16
21
  * `onFailure` runs at most once per call, even though `write` and `flush` can
17
22
  * each report the same broken pipe.
@@ -12,6 +12,7 @@ import { join } from "node:path";
12
12
  import { promisify } from "node:util";
13
13
 
14
14
  import { getConfig } from "../config/loader.js";
15
+ import { trackDaemonActivity } from "../daemon/activity-trail.js";
15
16
  import { isFileUnheld } from "../util/file-use.js";
16
17
  import { getLogger } from "../util/logger.js";
17
18
  import { Mutex } from "../util/mutex.js";
@@ -1049,7 +1050,11 @@ export class WorkspaceGitService {
1049
1050
  retryAfterMs?: number;
1050
1051
  }> {
1051
1052
  await this.ensureInitialized();
1052
- return this.mutex.withLock(() => this.compactHistoryLocked(options));
1053
+ return this.mutex.withLock(() =>
1054
+ trackDaemonActivity({ kind: "git_compaction" }, () =>
1055
+ this.compactHistoryLocked(options),
1056
+ ),
1057
+ );
1053
1058
  }
1054
1059
 
1055
1060
  /**