@capybara-hq/kernel 0.1.0-rc.105 → 0.1.0-rc.107

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 (359) hide show
  1. package/dist/admin/admin.schemas.d.ts +3 -0
  2. package/dist/agents/agents.schemas.d.ts +9 -9
  3. package/dist/{schedules/schedules.controller.d.ts → automations/automations.controller.d.ts} +37 -32
  4. package/dist/{schedules/schedules.controller.js → automations/automations.controller.js} +68 -57
  5. package/dist/automations/automations.module.d.ts +16 -0
  6. package/dist/{schedules/schedules.module.js → automations/automations.module.js} +18 -15
  7. package/dist/{schedules/schedules.schemas.d.ts → automations/automations.schemas.d.ts} +151 -50
  8. package/dist/automations/automations.schemas.js +253 -0
  9. package/dist/{schedules/scheduled-tasks.service.d.ts → automations/automations.service.d.ts} +99 -52
  10. package/dist/{schedules/scheduled-tasks.service.js → automations/automations.service.js} +303 -134
  11. package/dist/{schedules → automations}/calendar.d.ts +8 -8
  12. package/dist/{schedules → automations}/calendar.js +2 -2
  13. package/dist/automations/effective-settings.d.ts +28 -0
  14. package/dist/automations/effective-settings.js +25 -0
  15. package/dist/automations/errors.d.ts +19 -0
  16. package/dist/automations/errors.js +19 -0
  17. package/dist/automations/events/coalesce.d.ts +28 -0
  18. package/dist/automations/events/coalesce.js +131 -0
  19. package/dist/automations/events/deadline.d.ts +10 -0
  20. package/dist/automations/events/deadline.js +24 -0
  21. package/dist/automations/events/dispatcher.d.ts +74 -0
  22. package/dist/automations/events/dispatcher.js +353 -0
  23. package/dist/automations/events/events.module.d.ts +7 -0
  24. package/dist/automations/events/events.module.js +26 -0
  25. package/dist/automations/events/guards.d.ts +32 -0
  26. package/dist/automations/events/guards.js +87 -0
  27. package/dist/automations/events/sweep.job.d.ts +49 -0
  28. package/dist/automations/events/sweep.job.js +202 -0
  29. package/dist/automations/events/token.d.ts +5 -0
  30. package/dist/automations/events/token.js +5 -0
  31. package/dist/automations/events/trigger-events.service.d.ts +47 -0
  32. package/dist/automations/events/trigger-events.service.js +254 -0
  33. package/dist/{schedules → automations}/fire.d.ts +57 -17
  34. package/dist/{schedules → automations}/fire.js +311 -79
  35. package/dist/{schedules → automations}/grant-rules.d.ts +1 -1
  36. package/dist/{schedules → automations}/grant-rules.js +5 -5
  37. package/dist/automations/job-ids.d.ts +113 -0
  38. package/dist/automations/job-ids.js +117 -0
  39. package/dist/{schedules → automations}/pause.d.ts +3 -3
  40. package/dist/{schedules → automations}/pause.js +3 -3
  41. package/dist/{schedules → automations}/run-tracker.d.ts +21 -10
  42. package/dist/{schedules → automations}/run-tracker.js +68 -56
  43. package/dist/{schedules → automations}/scan.job.d.ts +12 -8
  44. package/dist/{schedules → automations}/scan.job.js +39 -23
  45. package/dist/{schedules → automations}/schedule-math.d.ts +19 -12
  46. package/dist/{schedules → automations}/schedule-math.js +17 -7
  47. package/dist/{schedules → automations}/store.d.ts +57 -27
  48. package/dist/{schedules → automations}/store.js +102 -52
  49. package/dist/automations/store.module.d.ts +6 -0
  50. package/dist/{schedules → automations}/store.module.js +9 -9
  51. package/dist/automations/types.d.ts +178 -0
  52. package/dist/{schedules → automations}/unattended.d.ts +22 -11
  53. package/dist/{schedules → automations}/unattended.js +53 -30
  54. package/dist/catalog/marketplaces.service.d.ts +1 -1
  55. package/dist/channels/channels.module.js +7 -6
  56. package/dist/channels/file-delivery.d.ts +26 -11
  57. package/dist/channels/file-delivery.js +32 -11
  58. package/dist/channels/outbound.d.ts +8 -8
  59. package/dist/channels/outbound.js +32 -30
  60. package/dist/channels/threads.d.ts +1 -1
  61. package/dist/channels/threads.js +1 -1
  62. package/dist/config/schema.d.ts +8 -1
  63. package/dist/config/schema.js +56 -6
  64. package/dist/conversations/approval-profile.d.ts +2 -2
  65. package/dist/conversations/approval-profile.js +3 -3
  66. package/dist/conversations/artifacts.d.ts +20 -17
  67. package/dist/conversations/artifacts.js +30 -37
  68. package/dist/conversations/attachments.controller.d.ts +6 -19
  69. package/dist/conversations/attachments.controller.js +8 -59
  70. package/dist/conversations/attachments.service.d.ts +30 -74
  71. package/dist/conversations/attachments.service.js +51 -193
  72. package/dist/conversations/conversations.controller.d.ts +7 -1
  73. package/dist/conversations/conversations.controller.js +26 -10
  74. package/dist/conversations/conversations.module.js +4 -0
  75. package/dist/conversations/conversations.service.d.ts +112 -35
  76. package/dist/conversations/conversations.service.js +160 -43
  77. package/dist/conversations/event-log.d.ts +1 -0
  78. package/dist/conversations/events.d.ts +95 -27
  79. package/dist/conversations/events.js +108 -10
  80. package/dist/conversations/files.d.ts +66 -64
  81. package/dist/conversations/files.js +127 -147
  82. package/dist/conversations/message-context.d.ts +2 -2
  83. package/dist/conversations/message-context.js +1 -1
  84. package/dist/conversations/permission-profile-store.d.ts +2 -1
  85. package/dist/conversations/permission-profiles.controller.d.ts +3 -0
  86. package/dist/conversations/permission-profiles.service.js +1 -1
  87. package/dist/conversations/prompt-suggestion-request.d.ts +1 -1
  88. package/dist/conversations/prompt-suggestion-request.js +4 -2
  89. package/dist/conversations/prompt-suggestions.d.ts +3 -3
  90. package/dist/conversations/prompt-suggestions.js +11 -10
  91. package/dist/conversations/queue.d.ts +7 -4
  92. package/dist/conversations/queue.js +6 -2
  93. package/dist/conversations/queue.service.d.ts +5 -5
  94. package/dist/conversations/queue.service.js +27 -16
  95. package/dist/ctx/create-ctx.d.ts +23 -2
  96. package/dist/ctx/create-ctx.js +78 -3
  97. package/dist/db/kernel-schema.d.ts +184 -27
  98. package/dist/devices/device-project-files.service.d.ts +88 -0
  99. package/dist/devices/device-project-files.service.js +249 -0
  100. package/dist/devices/device-projects.service.d.ts +40 -0
  101. package/dist/devices/device-projects.service.js +16 -13
  102. package/dist/devices/devices.controller.d.ts +9 -3
  103. package/dist/devices/devices.controller.js +27 -5
  104. package/dist/devices/devices.module.js +9 -1
  105. package/dist/devices/devices.schemas.js +6 -1
  106. package/dist/devices/dto.d.ts +15 -0
  107. package/dist/devices/dto.js +11 -0
  108. package/dist/devices/project-paths.d.ts +29 -0
  109. package/dist/devices/project-paths.js +66 -0
  110. package/dist/devices/project-rules.d.ts +5 -1
  111. package/dist/devices/project-rules.js +5 -1
  112. package/dist/errors.d.ts +53 -13
  113. package/dist/errors.js +53 -13
  114. package/dist/evals/canonical-json.d.ts +7 -0
  115. package/dist/evals/canonical-json.js +21 -0
  116. package/dist/evals/reconstruct.d.ts +10 -1
  117. package/dist/evals/reconstruct.js +20 -1
  118. package/dist/evals/recorded-tools.d.ts +0 -2
  119. package/dist/evals/recorded-tools.js +1 -16
  120. package/dist/evals/snapshot.d.ts +26 -3
  121. package/dist/evals/snapshot.js +110 -57
  122. package/dist/evals/worker.d.ts +4 -3
  123. package/dist/evals/worker.js +8 -4
  124. package/dist/extensions/host.d.ts +9 -2
  125. package/dist/extensions/host.js +12 -0
  126. package/dist/extensions/instance.d.ts +3 -1
  127. package/dist/extensions/instance.js +4 -0
  128. package/dist/extensions/ledger.d.ts +1 -1
  129. package/dist/extensions/permission-set.d.ts +17 -1
  130. package/dist/extensions/permission-set.js +13 -1
  131. package/dist/extensions/permission-view.d.ts +1 -1
  132. package/dist/extensions/permission-view.js +4 -1
  133. package/dist/files/blob-objects.d.ts +124 -0
  134. package/dist/files/blob-objects.js +341 -0
  135. package/dist/files/blob-sweep.job.d.ts +122 -0
  136. package/dist/files/blob-sweep.job.js +389 -0
  137. package/dist/files/blobs.service.d.ts +135 -0
  138. package/dist/files/blobs.service.js +300 -0
  139. package/dist/files/conversation-media.d.ts +41 -0
  140. package/dist/files/conversation-media.js +124 -0
  141. package/dist/files/deliveries.d.ts +64 -0
  142. package/dist/files/deliveries.js +156 -0
  143. package/dist/files/deliveries.module.d.ts +6 -0
  144. package/dist/files/deliveries.module.js +24 -0
  145. package/dist/files/draft-cleanup.job.d.ts +26 -0
  146. package/dist/files/draft-cleanup.job.js +93 -0
  147. package/dist/files/files.module.d.ts +1 -1
  148. package/dist/files/files.module.js +3 -2
  149. package/dist/files/hash-job.d.ts +127 -0
  150. package/dist/files/hash-job.js +447 -0
  151. package/dist/files/library-backfill.d.ts +63 -0
  152. package/dist/files/library-backfill.js +143 -0
  153. package/dist/files/library-files.service.d.ts +255 -0
  154. package/dist/files/library-files.service.js +883 -0
  155. package/dist/files/library-jobs.module.d.ts +8 -0
  156. package/dist/files/library-jobs.module.js +27 -0
  157. package/dist/files/library-query.d.ts +127 -0
  158. package/dist/files/library-query.js +322 -0
  159. package/dist/files/library-read.module.d.ts +9 -0
  160. package/dist/files/library-read.module.js +30 -0
  161. package/dist/files/library.controller.d.ts +77 -0
  162. package/dist/files/library.controller.js +235 -0
  163. package/dist/files/library.module.d.ts +9 -0
  164. package/dist/files/library.module.js +29 -0
  165. package/dist/files/library.schemas.d.ts +46 -0
  166. package/dist/files/library.schemas.js +49 -0
  167. package/dist/files/previewers.controller.d.ts +20 -0
  168. package/dist/files/previewers.controller.js +47 -0
  169. package/dist/files/previewers.d.ts +25 -11
  170. package/dist/files/previewers.js +43 -27
  171. package/dist/files/referenced-files.d.ts +150 -0
  172. package/dist/files/referenced-files.js +234 -0
  173. package/dist/git/gateway.js +2 -2
  174. package/dist/html/html-document.controller.d.ts +8 -1
  175. package/dist/html/html-document.controller.js +19 -1
  176. package/dist/html/html-document.service.d.ts +19 -4
  177. package/dist/html/html-document.service.js +43 -22
  178. package/dist/html/html-token.d.ts +10 -1
  179. package/dist/html/html-token.js +14 -0
  180. package/dist/html/html.module.js +8 -1
  181. package/dist/http/api.module.js +10 -5
  182. package/dist/http/request-signal.d.ts +8 -0
  183. package/dist/http/request-signal.js +14 -0
  184. package/dist/identity/settings.d.ts +26 -0
  185. package/dist/identity/settings.js +33 -2
  186. package/dist/inbox/inbox.module.js +2 -2
  187. package/dist/inbox/inbox.service.d.ts +8 -8
  188. package/dist/inbox/inbox.service.js +7 -7
  189. package/dist/infra/config/kernel-config.service.js +10 -5
  190. package/dist/infra/outbox/registry.d.ts +111 -2
  191. package/dist/infra/outbox/registry.js +104 -9
  192. package/dist/infra/throttler/named-throttlers.d.ts +2 -0
  193. package/dist/infra/throttler/named-throttlers.js +14 -0
  194. package/dist/kernel.module.js +3 -0
  195. package/dist/lifecycle/kernel-lifecycle.js +6 -0
  196. package/dist/models/purposes.js +1 -1
  197. package/dist/orgs/offboarding.js +1 -1
  198. package/dist/orgs/roles.d.ts +1 -1
  199. package/dist/orgs/roles.js +3 -3
  200. package/dist/orgs/settings.controller.d.ts +1 -1
  201. package/dist/orgs/settings.service.d.ts +75 -13
  202. package/dist/orgs/settings.service.js +104 -26
  203. package/dist/platform/exclusions.js +45 -8
  204. package/dist/platform/file-ref.d.ts +18 -3
  205. package/dist/platform/file-ref.js +22 -11
  206. package/dist/platform/operation.js +6 -2
  207. package/dist/platform/ops/admin.ops.js +5 -2
  208. package/dist/platform/ops/{schedules.ops.d.ts → automations.ops.d.ts} +4 -4
  209. package/dist/platform/ops/automations.ops.js +560 -0
  210. package/dist/platform/ops/devices.ops.d.ts +3 -1
  211. package/dist/platform/ops/devices.ops.js +77 -3
  212. package/dist/platform/ops/files.ops.d.ts +18 -0
  213. package/dist/platform/ops/files.ops.js +267 -0
  214. package/dist/platform/ops/inbox.ops.js +4 -4
  215. package/dist/platform/ops/org-settings.ops.js +6 -2
  216. package/dist/platform/ops/orgs.ops.js +2 -1
  217. package/dist/platform/ops/platform.ops.js +4 -4
  218. package/dist/platform/ops/shares.ops.js +2 -2
  219. package/dist/platform/platform-ops.module.d.ts +3 -2
  220. package/dist/platform/platform-ops.module.js +10 -5
  221. package/dist/platform/route-schemas.js +6 -3
  222. package/dist/push/jobs.d.ts +3 -3
  223. package/dist/push/jobs.js +2 -2
  224. package/dist/push/preferences.service.js +1 -1
  225. package/dist/push/push-owed.d.ts +3 -3
  226. package/dist/push/push-owed.js +6 -6
  227. package/dist/push/push.schemas.d.ts +4 -4
  228. package/dist/push/push.schemas.js +3 -3
  229. package/dist/push/recipients.d.ts +4 -4
  230. package/dist/push/recipients.js +23 -23
  231. package/dist/push/texts.d.ts +3 -3
  232. package/dist/push/texts.js +2 -2
  233. package/dist/push/triggers.d.ts +1 -1
  234. package/dist/roles/worker.module.js +18 -4
  235. package/dist/runtime/compaction-settings.service.d.ts +13 -1
  236. package/dist/runtime/compaction-settings.service.js +16 -1
  237. package/dist/runtime/compaction.service.d.ts +3 -1
  238. package/dist/runtime/compaction.service.js +3 -1
  239. package/dist/runtime/context/build.d.ts +24 -1
  240. package/dist/runtime/context/build.js +33 -11
  241. package/dist/runtime/context/cache-expiry.d.ts +31 -0
  242. package/dist/runtime/context/cache-expiry.js +60 -0
  243. package/dist/runtime/context/cache-ttl.d.ts +18 -0
  244. package/dist/runtime/context/cache-ttl.js +30 -0
  245. package/dist/runtime/context/compaction.d.ts +9 -2
  246. package/dist/runtime/context/compaction.js +64 -21
  247. package/dist/runtime/context/in-context-compaction.d.ts +156 -0
  248. package/dist/runtime/context/in-context-compaction.js +310 -0
  249. package/dist/runtime/context/run-context.d.ts +38 -0
  250. package/dist/runtime/context/run-context.js +54 -0
  251. package/dist/runtime/hook-calls.d.ts +2 -1
  252. package/dist/runtime/hook-calls.js +5 -2
  253. package/dist/runtime/maintenance.d.ts +16 -4
  254. package/dist/runtime/maintenance.js +79 -18
  255. package/dist/runtime/model-call.d.ts +34 -5
  256. package/dist/runtime/model-call.js +207 -22
  257. package/dist/runtime/providers.js +11 -1
  258. package/dist/runtime/run-finish.d.ts +4 -4
  259. package/dist/runtime/run-finish.js +3 -3
  260. package/dist/runtime/run-queue.js +12 -7
  261. package/dist/runtime/run-steps.d.ts +4 -2
  262. package/dist/runtime/run-steps.js +10 -5
  263. package/dist/runtime/run-worker.js +7 -1
  264. package/dist/runtime/runtime.module.js +6 -3
  265. package/dist/runtime/subagents/dispatch.js +11 -3
  266. package/dist/sandbox/browse-roots.d.ts +8 -0
  267. package/dist/sandbox/browse-roots.js +22 -0
  268. package/dist/sandbox/network-grants.d.ts +4 -4
  269. package/dist/sandbox/network-grants.js +7 -7
  270. package/dist/sandbox/operation-authority.d.ts +10 -3
  271. package/dist/sandbox/operation-authority.js +20 -10
  272. package/dist/sandbox/operation-intents.d.ts +3 -1
  273. package/dist/sandbox/operation-intents.js +11 -4
  274. package/dist/sandbox/permission-call-grants.js +2 -2
  275. package/dist/sandbox/permission-facts.js +1 -1
  276. package/dist/sandbox/review/classifier.d.ts +2 -2
  277. package/dist/sandbox/review/classifier.js +22 -11
  278. package/dist/sandbox/review/permission-candidate.d.ts +1 -1
  279. package/dist/sandbox/review/permission-candidate.js +1 -1
  280. package/dist/sandbox/sandbox.service.d.ts +15 -5
  281. package/dist/sandbox/sandbox.service.js +14 -8
  282. package/dist/shares/liveness.d.ts +26 -12
  283. package/dist/shares/liveness.js +79 -20
  284. package/dist/shares/revoke.d.ts +16 -11
  285. package/dist/shares/revoke.js +18 -14
  286. package/dist/shares/share-objects.d.ts +16 -21
  287. package/dist/shares/share-objects.js +25 -55
  288. package/dist/shares/share-open.service.d.ts +8 -4
  289. package/dist/shares/share-open.service.js +14 -11
  290. package/dist/shares/shares.controller.d.ts +16 -5
  291. package/dist/shares/shares.controller.js +39 -5
  292. package/dist/shares/shares.module.d.ts +4 -4
  293. package/dist/shares/shares.module.js +7 -6
  294. package/dist/shares/shares.schemas.d.ts +4 -0
  295. package/dist/shares/shares.schemas.js +2 -0
  296. package/dist/shares/shares.service.d.ts +93 -54
  297. package/dist/shares/shares.service.js +292 -131
  298. package/dist/shares/sweep.job.d.ts +18 -39
  299. package/dist/shares/sweep.job.js +47 -206
  300. package/dist/storage/purge.d.ts +1 -1
  301. package/dist/storage/purge.js +2 -2
  302. package/dist/tools/approvals.service.d.ts +6 -6
  303. package/dist/tools/approvals.service.js +19 -19
  304. package/dist/tools/builtin-names.d.ts +12 -12
  305. package/dist/tools/builtin-names.js +29 -29
  306. package/dist/tools/builtins/artifacts.d.ts +21 -13
  307. package/dist/tools/builtins/artifacts.js +81 -51
  308. package/dist/tools/builtins/{schedules.d.ts → automations.d.ts} +35 -33
  309. package/dist/tools/builtins/{schedules.js → automations.js} +236 -105
  310. package/dist/tools/builtins/builtin-tools.d.ts +15 -9
  311. package/dist/tools/builtins/builtin-tools.js +33 -22
  312. package/dist/tools/builtins/conversation-files.d.ts +23 -13
  313. package/dist/tools/builtins/conversation-files.js +62 -83
  314. package/dist/tools/builtins/image/generate.d.ts +7 -1
  315. package/dist/tools/builtins/image/generate.js +1 -1
  316. package/dist/tools/builtins/platform.js +1 -0
  317. package/dist/tools/builtins/sandbox/common.d.ts +6 -2
  318. package/dist/tools/builtins/sandbox/deliver.js +6 -7
  319. package/dist/tools/builtins/sandbox/fetch-attachment.d.ts +6 -5
  320. package/dist/tools/builtins/sandbox/fetch-attachment.js +19 -12
  321. package/dist/tools/call-scope.d.ts +1 -1
  322. package/dist/tools/git-asks.js +1 -1
  323. package/dist/tools/git-push-policy.d.ts +3 -3
  324. package/dist/tools/git-push-policy.js +6 -6
  325. package/dist/tools/network-asks.d.ts +3 -3
  326. package/dist/tools/network-asks.js +3 -3
  327. package/dist/tools/pipeline.d.ts +4 -4
  328. package/dist/tools/pipeline.js +2 -2
  329. package/dist/tools/policy.d.ts +3 -3
  330. package/dist/tools/policy.js +3 -3
  331. package/dist/tools/tools.module.js +15 -9
  332. package/dist/ui/call-extension.d.ts +6 -4
  333. package/dist/ui/call-extension.js +5 -4
  334. package/dist/ui/embed-token.js +6 -3
  335. package/dist/ui/registry.d.ts +21 -5
  336. package/dist/ui/registry.js +24 -6
  337. package/dist/ui/ui.schemas.d.ts +22 -0
  338. package/dist/ui/ui.schemas.js +22 -4
  339. package/dist/ui/views.controller.d.ts +13 -3
  340. package/dist/ui/views.controller.js +33 -2
  341. package/dist/ui/views.d.ts +29 -1
  342. package/dist/ui/views.js +131 -7
  343. package/package.json +3 -3
  344. package/src/migrations/0188_automations_rename.sql +309 -0
  345. package/src/migrations/0189_event_automations.sql +136 -0
  346. package/src/migrations/0190_file_library.sql +285 -0
  347. package/src/migrations/0191_file_library_copy.sql +4 -0
  348. package/dist/platform/ops/schedules.ops.js +0 -509
  349. package/dist/schedules/effective-settings.d.ts +0 -22
  350. package/dist/schedules/effective-settings.js +0 -18
  351. package/dist/schedules/errors.d.ts +0 -8
  352. package/dist/schedules/errors.js +0 -8
  353. package/dist/schedules/job-ids.d.ts +0 -81
  354. package/dist/schedules/job-ids.js +0 -95
  355. package/dist/schedules/schedules.module.d.ts +0 -16
  356. package/dist/schedules/schedules.schemas.js +0 -213
  357. package/dist/schedules/store.module.d.ts +0 -6
  358. package/dist/schedules/types.d.ts +0 -110
  359. /package/dist/{schedules → automations}/types.js +0 -0
@@ -1,56 +1,41 @@
1
1
  import { KernelDb } from "../infra/database/kernel-db.js";
2
2
  import { TransactionHost } from "../infra/database/transaction-host.js";
3
3
  import { LockService } from "../infra/lock/lock.service.js";
4
- import { OutboxService } from "../infra/outbox/outbox.service.js";
5
4
  import type { KernelLogger } from "../log.js";
6
- import { StorageService } from "../storage/storage.service.js";
7
- import { ShareObjects } from "./share-objects.js";
8
5
  /** The daily share sweep's name (scheduler key and lock; no `:`). */
9
6
  export declare const SHARE_SWEEP_JOB = "share-sweep";
10
7
  /** When the daily share sweep runs (the deployment's time zone). */
11
8
  export declare const SHARE_SWEEP_CRON = "40 3 * * *";
9
+ /** Shares expired or revoked longer ago than this stop pointing at their blob (rows kept). */
10
+ export declare const RETAIN_DAYS = 7;
12
11
  /** What one sweep did (logged; returned for tests). */
13
12
  export interface ShareSweepResult {
14
- /** Shares revoked with `creator_lost_access` (their snapshots owed for deletion). */
13
+ /** Shares revoked with `creator_lost_access`. */
15
14
  revoked: number;
16
- /** Snapshots of shares expired or revoked more than {@link RETAIN_DAYS} days ago deleted. */
15
+ /** Shares expired or revoked more than {@link RETAIN_DAYS} days ago that let go of their blob. */
17
16
  freed: number;
18
- /** Orphan objects under `shares/` deleted. */
19
- orphans: number;
20
17
  }
21
18
  /**
22
- * The daily share sweep (file sharing spec §9), a `@LockedCron` (once per tick across replicas,
23
- * provided only under `WorkerModule`). In order, with every storage call outside a transaction:
19
+ * The daily share sweep (file sharing spec §9, file library spec §7), a `@LockedCron` (once per
20
+ * tick across replicas, provided only under `WorkerModule`). In order:
24
21
  *
25
22
  * 1. revokes with `creator_lost_access` the unrevoked, unexpired shares whose creator fails the
26
23
  * live check's creator predicates (account disabled, no longer a member, agent deleted or hidden,
27
- * the conversation or its root deleted), one transaction per batch, owing each snapshot's
28
- * deletion through the outbox (the open routes already refuse them; this frees the snapshot and
29
- * shows a reason in the lists);
30
- * 2. deletes the snapshots of shares expired or revoked more than {@link RETAIN_DAYS} days ago that
31
- * still name one (a revoke owes its deletion at once; this is the expired shares' path and the
32
- * backstop) and clears `object_key`; the rows stay for the audit trail;
33
- * 3. per organization not deleted, lists `shares/` and deletes every object older than one hour
34
- * that is not the `object_key` of its row (no row: an insert that failed after its copy; another
35
- * generation: a refresh that died between its copy and its commit). An object whose age the
36
- * store does not report is kept. Its age is read again (`head`) just before the delete, and a
37
- * non-current generation of an existing share is deleted only under that share's refresh lock
38
- * (tried once), so a retried refresh writing the same key again is never undone.
24
+ * the conversation or its root deleted), one transaction per batch (the open routes already
25
+ * refuse them; this shows a reason in the lists);
26
+ * 2. frees the shares expired or revoked more than {@link RETAIN_DAYS} days ago: `blob_id` becomes
27
+ * null (the rows stay for the audit trail), so the blob sweep may delete a blob no file or other
28
+ * share still needs. No storage call: the bytes are the blob's.
39
29
  *
40
- * Steps 2 and 3 go through {@link ShareObjects.deleteObject}, which re-reads the row and never
41
- * deletes the snapshot a share that is neither revoked nor expired currently names. Deleted
42
- * organizations are skipped: their objects go with `storage-org-purge`. Nothing is kept in process
43
- * memory between runs; a run that stops midway (abort, error) is finished by the next one.
30
+ * Deleted organizations are skipped: their objects go with `storage-org-purge`. Nothing is kept in
31
+ * process memory between runs; a run that stops midway (abort, error) is finished by the next one.
44
32
  */
45
33
  export declare class ShareSweepJob {
46
34
  private readonly db;
47
35
  readonly txHost: TransactionHost;
48
- private readonly outbox;
49
- private readonly objects;
50
- private readonly storage;
51
36
  readonly lockService: LockService;
52
37
  readonly log: KernelLogger;
53
- constructor(db: KernelDb, txHost: TransactionHost, outbox: Pick<OutboxService, "add">, objects: Pick<ShareObjects, "deleteObject">, storage: Pick<StorageService, "available" | "kernel">, lockService: LockService, log: KernelLogger);
38
+ constructor(db: KernelDb, txHost: TransactionHost, lockService: LockService, log: KernelLogger);
54
39
  sweep(signal?: AbortSignal): Promise<void>;
55
40
  /** One sweep without the tick lock (the cron body; tests call it directly). */
56
41
  runOnce(signal?: AbortSignal): Promise<ShareSweepResult>;
@@ -58,17 +43,11 @@ export declare class ShareSweepJob {
58
43
  private revokeLostAccess;
59
44
  /** One batch of step 1 (the creator's access is checked again in the `UPDATE`). */
60
45
  revokeBatch(shareIds: readonly string[]): Promise<number>;
61
- /** Step 2: frees the snapshots of shares expired or revoked more than a week ago. */
46
+ /** Step 2: lets go of the blobs of shares expired or revoked more than a week ago. */
62
47
  private freeOld;
63
- /** Step 3: deletes the orphan objects under `shares/` of every organization not deleted. */
64
- private deleteOrphans;
65
- /** The orphan objects of one organization, page by page. */
66
- private orphansOf;
67
48
  /**
68
- * Whether `key` is still older than `cutoff` now: the listing may be stale (an upload that started
69
- * long ago, or a key written again since), so its age is read again just before deleting it.
49
+ * One batch of step 2 (one org, in its scope): the condition is checked again in the `UPDATE` (expiry is final and a
50
+ * revoke is never undone, so a row read as old is still old).
70
51
  */
71
- private stillOld;
72
- /** {@link ShareObjects.deleteObject}, logging instead of throwing (one bad object stops nothing). */
73
- private deleteGuarded;
52
+ freeBatch(orgId: string, shareIds: readonly string[]): Promise<number>;
74
53
  }
@@ -10,89 +10,58 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
10
10
  import { Inject, Injectable } from "@nestjs/common";
11
11
  import { sql } from "kysely";
12
12
  import { KernelDb } from "../infra/database/kernel-db.js";
13
+ import { withOrgScope } from "../infra/database/org-scope.js";
13
14
  import { TransactionHost } from "../infra/database/transaction-host.js";
14
15
  import { Transactional } from "../infra/database/transactional.decorator.js";
15
16
  import { LockService } from "../infra/lock/lock.service.js";
16
- import { OutboxService } from "../infra/outbox/outbox.service.js";
17
17
  import { LockedCron } from "../infra/schedule/locked-cron.decorator.js";
18
18
  import { KERNEL_LOGGER } from "../infra/tokens.js";
19
- import { StorageService } from "../storage/storage.service.js";
20
19
  import { creatorStillHasAccess } from "./liveness.js";
21
20
  import { revokeSharesIn } from "./revoke.js";
22
- import { ShareObjects, shareObjectKey, shareRefreshLockKey, } from "./share-objects.js";
23
21
  /** The daily share sweep's name (scheduler key and lock; no `:`). */
24
22
  export const SHARE_SWEEP_JOB = "share-sweep";
25
23
  /** When the daily share sweep runs (the deployment's time zone). */
26
24
  export const SHARE_SWEEP_CRON = "40 3 * * *";
27
- /** Rows per batch (one transaction per batch of revokes; one query per batch of reads). */
25
+ /** Rows per batch (one transaction per batch). */
28
26
  const BATCH = 200;
29
- /** Snapshots of shares expired or revoked longer ago than this are deleted (rows kept). */
30
- const RETAIN_DAYS = 7;
31
- /** An object under `shares/` no row names is deleted only once it is older than this. */
32
- const ORPHAN_AGE_MS = 60 * 60 * 1000;
33
- /** The objects listed per page when looking for orphans. */
34
- const LIST_PAGE = 1000;
35
- /** The sweep's hold on a share's refresh lock (tried once; a refresh holding it skips the key). */
36
- const REFRESH_LOCK_TTL_MS = 30_000;
27
+ /** Shares expired or revoked longer ago than this stop pointing at their blob (rows kept). */
28
+ export const RETAIN_DAYS = 7;
37
29
  /**
38
- * `shares/<shareId>/<generation>`, the only key shape the shares module writes. Only the shares
39
- * module writes under `shares/`, so a key of any other shape is no snapshot and is deleted directly.
40
- */
41
- const SHARE_KEY_RE = /^shares\/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\/(\d+)$/;
42
- /**
43
- * The daily share sweep (file sharing spec §9), a `@LockedCron` (once per tick across replicas,
44
- * provided only under `WorkerModule`). In order, with every storage call outside a transaction:
30
+ * The daily share sweep (file sharing spec §9, file library spec §7), a `@LockedCron` (once per
31
+ * tick across replicas, provided only under `WorkerModule`). In order:
45
32
  *
46
33
  * 1. revokes with `creator_lost_access` the unrevoked, unexpired shares whose creator fails the
47
34
  * live check's creator predicates (account disabled, no longer a member, agent deleted or hidden,
48
- * the conversation or its root deleted), one transaction per batch, owing each snapshot's
49
- * deletion through the outbox (the open routes already refuse them; this frees the snapshot and
50
- * shows a reason in the lists);
51
- * 2. deletes the snapshots of shares expired or revoked more than {@link RETAIN_DAYS} days ago that
52
- * still name one (a revoke owes its deletion at once; this is the expired shares' path and the
53
- * backstop) and clears `object_key`; the rows stay for the audit trail;
54
- * 3. per organization not deleted, lists `shares/` and deletes every object older than one hour
55
- * that is not the `object_key` of its row (no row: an insert that failed after its copy; another
56
- * generation: a refresh that died between its copy and its commit). An object whose age the
57
- * store does not report is kept. Its age is read again (`head`) just before the delete, and a
58
- * non-current generation of an existing share is deleted only under that share's refresh lock
59
- * (tried once), so a retried refresh writing the same key again is never undone.
35
+ * the conversation or its root deleted), one transaction per batch (the open routes already
36
+ * refuse them; this shows a reason in the lists);
37
+ * 2. frees the shares expired or revoked more than {@link RETAIN_DAYS} days ago: `blob_id` becomes
38
+ * null (the rows stay for the audit trail), so the blob sweep may delete a blob no file or other
39
+ * share still needs. No storage call: the bytes are the blob's.
60
40
  *
61
- * Steps 2 and 3 go through {@link ShareObjects.deleteObject}, which re-reads the row and never
62
- * deletes the snapshot a share that is neither revoked nor expired currently names. Deleted
63
- * organizations are skipped: their objects go with `storage-org-purge`. Nothing is kept in process
64
- * memory between runs; a run that stops midway (abort, error) is finished by the next one.
41
+ * Deleted organizations are skipped: their objects go with `storage-org-purge`. Nothing is kept in
42
+ * process memory between runs; a run that stops midway (abort, error) is finished by the next one.
65
43
  */
66
44
  let ShareSweepJob = class ShareSweepJob {
67
45
  db;
68
46
  txHost;
69
- outbox;
70
- objects;
71
- storage;
72
47
  lockService;
73
48
  log;
74
- constructor(db, txHost, outbox, objects, storage, lockService, log) {
49
+ constructor(db, txHost, lockService, log) {
75
50
  this.db = db;
76
51
  this.txHost = txHost;
77
- this.outbox = outbox;
78
- this.objects = objects;
79
- this.storage = storage;
80
52
  this.lockService = lockService;
81
53
  this.log = log;
82
54
  }
83
55
  async sweep(signal) {
84
56
  const r = await this.runOnce(signal);
85
- if (r.revoked + r.freed + r.orphans > 0)
57
+ if (r.revoked + r.freed > 0)
86
58
  this.log.info("share sweep done", { ...r });
87
59
  }
88
60
  /** One sweep without the tick lock (the cron body; tests call it directly). */
89
61
  async runOnce(signal) {
90
62
  const revoked = await this.revokeLostAccess(signal);
91
- if (!this.storage.available)
92
- return { revoked, freed: 0, orphans: 0 };
93
63
  const freed = await this.freeOld(signal);
94
- const orphans = await this.deleteOrphans(signal);
95
- return { revoked, freed, orphans };
64
+ return { revoked, freed };
96
65
  }
97
66
  /** Step 1: revokes, batch by batch, the shares whose creator lost access. */
98
67
  async revokeLostAccess(signal) {
@@ -105,7 +74,6 @@ let ShareSweepJob = class ShareSweepJob {
105
74
  .select("file_shares.id")
106
75
  .where("orgs.deleted_at", "is", null)
107
76
  .where("file_shares.revoked_at", "is", null)
108
- .where("file_shares.object_key", "is not", null)
109
77
  .where((eb) => eb.or([
110
78
  eb("file_shares.expires_at", "is", null),
111
79
  eb("file_shares.expires_at", ">", sql `now()`),
@@ -126,9 +94,9 @@ let ShareSweepJob = class ShareSweepJob {
126
94
  }
127
95
  /** One batch of step 1 (the creator's access is checked again in the `UPDATE`). */
128
96
  async revokeBatch(shareIds) {
129
- return revokeSharesIn(this.db.db, this.outbox, { shareIds }, "creator_lost_access");
97
+ return revokeSharesIn(this.db.db, { shareIds }, "creator_lost_access");
130
98
  }
131
- /** Step 2: frees the snapshots of shares expired or revoked more than a week ago. */
99
+ /** Step 2: lets go of the blobs of shares expired or revoked more than a week ago. */
132
100
  async freeOld(signal) {
133
101
  let freed = 0;
134
102
  let after = null;
@@ -137,14 +105,9 @@ let ShareSweepJob = class ShareSweepJob {
137
105
  const rows = await this.db
138
106
  .selectFrom("file_shares")
139
107
  .innerJoin("orgs", "orgs.id", "file_shares.org_id")
140
- .select([
141
- "file_shares.id",
142
- "file_shares.org_id",
143
- "file_shares.generation",
144
- "file_shares.object_key",
145
- ])
108
+ .select(["file_shares.id", "file_shares.org_id"])
146
109
  .where("orgs.deleted_at", "is", null)
147
- .where("file_shares.object_key", "is not", null)
110
+ .where("file_shares.blob_id", "is not", null)
148
111
  .where((eb) => eb.or([
149
112
  eb("file_shares.revoked_at", "<", old),
150
113
  eb.and([
@@ -158,17 +121,11 @@ let ShareSweepJob = class ShareSweepJob {
158
121
  .execute();
159
122
  if (rows.length === 0)
160
123
  break;
161
- for (const r of rows) {
162
- if (signal?.aborted)
163
- break;
164
- const data = {
165
- orgId: r.org_id,
166
- shareId: r.id,
167
- generation: r.generation,
168
- objectKey: r.object_key,
169
- };
170
- if (await this.deleteGuarded(data))
171
- freed++;
124
+ const byOrg = new Map();
125
+ for (const r of rows)
126
+ byOrg.set(r.org_id, [...(byOrg.get(r.org_id) ?? []), r.id]);
127
+ for (const [orgId, ids] of byOrg) {
128
+ freed += await withOrgScope(orgId, () => this.freeBatch(orgId, ids));
172
129
  }
173
130
  after = rows.at(-1).id;
174
131
  if (rows.length < BATCH)
@@ -176,141 +133,25 @@ let ShareSweepJob = class ShareSweepJob {
176
133
  }
177
134
  return freed;
178
135
  }
179
- /** Step 3: deletes the orphan objects under `shares/` of every organization not deleted. */
180
- async deleteOrphans(signal) {
181
- let deleted = 0;
182
- let after = null;
183
- while (!signal?.aborted) {
184
- const orgs = await this.db
185
- .selectFrom("orgs")
186
- .select("id")
187
- .where("deleted_at", "is", null)
188
- .$if(after !== null, (q) => q.where("id", ">", after))
189
- .orderBy("id")
190
- .limit(BATCH)
191
- .execute();
192
- for (const o of orgs) {
193
- if (signal?.aborted)
194
- break;
195
- try {
196
- deleted += await this.orphansOf(o.id, signal);
197
- }
198
- catch (err) {
199
- this.log.warn("share sweep: cannot clean orphan snapshots; the next run retries", {
200
- orgId: o.id,
201
- err,
202
- });
203
- }
204
- }
205
- if (orgs.length < BATCH)
206
- break;
207
- after = orgs.at(-1).id;
208
- }
209
- return deleted;
210
- }
211
- /** The orphan objects of one organization, page by page. */
212
- async orphansOf(orgId, signal) {
213
- const store = this.storage.kernel(orgId);
214
- let deleted = 0;
215
- let cursor;
216
- do {
217
- const page = await store.list("shares/", {
218
- limit: LIST_PAGE,
219
- ...(cursor !== undefined && { cursor }),
220
- });
221
- cursor = page.cursor;
222
- // the rows are read once per page; `deleteObject` reads its row again before deleting
223
- const cutoff = Date.now() - ORPHAN_AGE_MS;
224
- const old = page.items.filter((i) => {
225
- const at = i.lastModified === undefined ? Number.NaN : Date.parse(i.lastModified);
226
- return Number.isFinite(at) && at < cutoff;
227
- });
228
- const parsed = old.map((i) => ({ key: i.key, m: SHARE_KEY_RE.exec(i.key) }));
229
- const ids = [...new Set(parsed.flatMap((p) => (p.m ? [p.m[1]] : [])))];
230
- const named = new Map();
231
- if (ids.length > 0) {
232
- const rows = await this.db
233
- .selectFrom("file_shares")
234
- .select(["id", "object_key"])
235
- .where("org_id", "=", orgId)
236
- .where("id", "in", ids)
237
- .execute();
238
- for (const r of rows)
239
- named.set(r.id, r.object_key);
240
- }
241
- for (const p of parsed) {
242
- if (signal?.aborted)
243
- return deleted;
244
- const shareId = p.m?.[1];
245
- const generation = Number(p.m?.[2]);
246
- const snapshot = shareId !== undefined &&
247
- Number.isSafeInteger(generation) &&
248
- shareObjectKey(shareId, generation) === p.key;
249
- if (!snapshot || shareId === undefined) {
250
- if (await this.stillOld(store, p.key, cutoff)) {
251
- await store.delete(p.key);
252
- deleted++;
253
- }
254
- continue;
255
- }
256
- if (named.get(shareId) === p.key)
257
- continue; // its row's snapshot: step 2's, not an orphan
258
- const data = { orgId, shareId, generation, objectKey: p.key };
259
- if (!named.has(shareId)) {
260
- // no row (an insert that failed after its copy): a new create uses a new id
261
- if ((await this.stillOld(store, p.key, cutoff)) && (await this.deleteGuarded(data))) {
262
- deleted++;
263
- }
264
- continue;
265
- }
266
- // another generation of an existing share: a retried refresh may be writing this very key
267
- // again, its commit about to name it. Held, the refresh lock means no refresh is between its
268
- // copy and its commit, so the row `deleteObject` reads is the last word; a refresh holding
269
- // it now skips the key (the next run sees it again)
270
- const lock = await this.lockService.acquire(shareRefreshLockKey(shareId), {
271
- ttlMs: REFRESH_LOCK_TTL_MS,
272
- waitMs: 0,
273
- });
274
- if (!lock)
275
- continue;
276
- try {
277
- if ((await this.stillOld(store, p.key, cutoff)) && (await this.deleteGuarded(data))) {
278
- deleted++;
279
- }
280
- }
281
- finally {
282
- await lock.release();
283
- }
284
- }
285
- } while (cursor !== undefined && !signal?.aborted);
286
- return deleted;
287
- }
288
136
  /**
289
- * Whether `key` is still older than `cutoff` now: the listing may be stale (an upload that started
290
- * long ago, or a key written again since), so its age is read again just before deleting it.
137
+ * One batch of step 2 (one org, in its scope): the condition is checked again in the `UPDATE` (expiry is final and a
138
+ * revoke is never undone, so a row read as old is still old).
291
139
  */
292
- async stillOld(store, key, cutoff) {
293
- const head = await store.head(key);
294
- if (!head?.lastModified)
295
- return false;
296
- const at = Date.parse(head.lastModified);
297
- return Number.isFinite(at) && at < cutoff;
298
- }
299
- /** {@link ShareObjects.deleteObject}, logging instead of throwing (one bad object stops nothing). */
300
- async deleteGuarded(data) {
301
- try {
302
- await this.objects.deleteObject(data);
303
- return true;
304
- }
305
- catch (err) {
306
- this.log.warn("share sweep: cannot delete a share snapshot; the next run retries", {
307
- orgId: data.orgId,
308
- shareId: data.shareId,
309
- generation: data.generation,
310
- err,
311
- });
312
- return false;
313
- }
140
+ async freeBatch(orgId, shareIds) {
141
+ const old = sql `now() - make_interval(days => ${RETAIN_DAYS})`;
142
+ const rows = await this.db
143
+ .updateTable("file_shares")
144
+ .set({ blob_id: null })
145
+ .where("org_id", "=", orgId)
146
+ .where("id", "in", [...shareIds])
147
+ .where("blob_id", "is not", null)
148
+ .where((eb) => eb.or([
149
+ eb("revoked_at", "<", old),
150
+ eb.and([eb("revoked_at", "is", null), eb("expires_at", "<", old)]),
151
+ ]))
152
+ .returning("id")
153
+ .execute();
154
+ return rows.length;
314
155
  }
315
156
  };
316
157
  __decorate([
@@ -319,14 +160,14 @@ __decorate([
319
160
  __decorate([
320
161
  Transactional()
321
162
  ], ShareSweepJob.prototype, "revokeBatch", null);
163
+ __decorate([
164
+ Transactional()
165
+ ], ShareSweepJob.prototype, "freeBatch", null);
322
166
  ShareSweepJob = __decorate([
323
167
  Injectable(),
324
168
  __param(0, Inject(KernelDb)),
325
169
  __param(1, Inject(TransactionHost)),
326
- __param(2, Inject(OutboxService)),
327
- __param(3, Inject(ShareObjects)),
328
- __param(4, Inject(StorageService)),
329
- __param(5, Inject(LockService)),
330
- __param(6, Inject(KERNEL_LOGGER))
170
+ __param(2, Inject(LockService)),
171
+ __param(3, Inject(KERNEL_LOGGER))
331
172
  ], ShareSweepJob);
332
173
  export { ShareSweepJob };
@@ -5,7 +5,7 @@ import { KernelDb } from "../infra/database/kernel-db.js";
5
5
  import { LockService } from "../infra/lock/lock.service.js";
6
6
  import type { KernelLogger } from "../log.js";
7
7
  import { type PrefixedStorage, StorageService } from "./storage.service.js";
8
- /** 定时任务:清理已删除组织的对象存储(名字不含 `:`),每小时整点。 */
8
+ /** Scheduled job: purges the object storage of deleted organizations (the name has no `:`), hourly on the hour. */
9
9
  export declare const STORAGE_PURGE_JOB = "storage-org-purge";
10
10
  /**
11
11
  * 删除「软删除超过 `afterDays` 天、尚未清理存储」的组织的全部对象(`StorageService.deleteOrg`),
@@ -15,9 +15,9 @@ import { LockService } from "../infra/lock/lock.service.js";
15
15
  import { LockedCron } from "../infra/schedule/locked-cron.decorator.js";
16
16
  import { KERNEL_LOGGER } from "../infra/tokens.js";
17
17
  import { StorageService } from "./storage.service.js";
18
- /** 定时任务:清理已删除组织的对象存储(名字不含 `:`),每小时整点。 */
18
+ /** Scheduled job: purges the object storage of deleted organizations (the name has no `:`), hourly on the hour. */
19
19
  export const STORAGE_PURGE_JOB = "storage-org-purge";
20
- /** 每次运行最多处理的组织数(成功与失败合计)。 */
20
+ /** The most organizations one run handles (successes and failures together). */
21
21
  const PURGE_BATCH = 100;
22
22
  /** 认领超过这么久仍未完成(运行中途退出)就可被重新认领。 */
23
23
  const CLAIM_STALE_MINUTES = 60;
@@ -1,4 +1,5 @@
1
1
  import { type LocalizedName, type ToolDisplay } from "@capybara-hq/plugin-sdk";
2
+ import { AutomationStore } from "../automations/store.js";
2
3
  import { EventLog } from "../conversations/event-log.js";
3
4
  import { type EventPayload, type ReviewRecord, type ToolView } from "../conversations/events.js";
4
5
  import { ConversationLeakCheck } from "../conversations/leak-check.js";
@@ -18,7 +19,6 @@ import { PermissionAuthorityLock } from "../sandbox/permission-authority-lock.js
18
19
  import { PermissionCallGrants } from "../sandbox/permission-call-grants.js";
19
20
  import type { PermissionCandidate, PermissionEscalation, PermissionExpansion } from "../sandbox/permission-call-types.js";
20
21
  import { SandboxService } from "../sandbox/sandbox.service.js";
21
- import { ScheduledTaskStore } from "../schedules/store.js";
22
22
  import type { ApprovalPolicySource } from "./pipeline.js";
23
23
  import { ToolRegistry } from "./registry.js";
24
24
  export { APPROVAL_DENY_REASON_MAX_CHARS } from "../conversations/events.js";
@@ -474,7 +474,7 @@ export declare class ApprovalsService {
474
474
  private readonly eventLog;
475
475
  private readonly events;
476
476
  readonly txHost: TransactionHost;
477
- private readonly schedules;
477
+ private readonly automations;
478
478
  /** A trial approval is kept only for a tool the task may hold as a grant (its agent's tools). */
479
479
  private readonly registry;
480
480
  /** One decision of a network ask at a time, across replicas. */
@@ -491,7 +491,7 @@ export declare class ApprovalsService {
491
491
  private readonly devices;
492
492
  private readonly permissionLocks?;
493
493
  private readonly permissionGrants?;
494
- constructor(db: KernelDb, config: Pick<KernelConfigService, "get">, eventLog: Pick<EventLog, "appendIn" | "notify">, events: Pick<KernelEvents, "emit">, txHost: TransactionHost, schedules: Pick<ScheduledTaskStore, "addGrant">,
494
+ constructor(db: KernelDb, config: Pick<KernelConfigService, "get">, eventLog: Pick<EventLog, "appendIn" | "notify">, events: Pick<KernelEvents, "emit">, txHost: TransactionHost, automations: Pick<AutomationStore, "addGrant">,
495
495
  /** A trial approval is kept only for a tool the task may hold as a grant (its agent's tools). */
496
496
  registry: Pick<ToolRegistry, "forAgent">,
497
497
  /** One decision of a network ask at a time, across replicas. */
@@ -614,7 +614,7 @@ export declare class ApprovalsService {
614
614
  */
615
615
  private decideTx;
616
616
  /**
617
- * A trial run of a scheduled task (scheduled tasks spec §7): an approval its creator granted, in
617
+ * A trial run of an automation (scheduled tasks spec §7): an approval its creator granted, in
618
618
  * any scope, is also added to the task's grants with the approved definition's hash, so its
619
619
  * unattended runs do not ask again. Kept only by the rule `addGrants` applies
620
620
  * (`grantRefusalOf`, against the task agent's tools now): never a role-escalated approval
@@ -625,7 +625,7 @@ export declare class ApprovalsService {
625
625
  */
626
626
  private keepTrialGrant;
627
627
  /**
628
- * A trial run of a scheduled task (network ask-to-allow spec §8.1): the hosts its creator allowed
628
+ * A trial run of an automation (network ask-to-allow spec §8.1): the hosts its creator allowed
629
629
  * for this run (「这次允许」) on a network ask about one of their devices become the task's
630
630
  * `network:<host>` grants, each only when `networkGrantRefusal` allows it (exact host, within the
631
631
  * org's effective egress, the device takes remote grants). Never for an ask another account
@@ -639,7 +639,7 @@ export declare class ApprovalsService {
639
639
  */
640
640
  private allowRepoIn;
641
641
  /**
642
- * A trial run of a scheduled task (sandbox git credentials spec §7): a push its creator allowed
642
+ * A trial run of an automation (sandbox git credentials spec §7): a push its creator allowed
643
643
  * for this run (「这次允许」) becomes the task's `git:push:<owner>/<repo>` grant, when
644
644
  * `gitGrantRefusal` allows it (the org does not forbid it). Never for an ask another account
645
645
  * decided or one asked of someone else. In the decision's transaction.