@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
@@ -19,6 +19,33 @@ export interface OutboxJobSpec {
19
19
  * name without one does not type-check as an `OutboxJobName` (`add` does not check it at runtime).
20
20
  */
21
21
  export declare const OUTBOX_JOBS: {
22
+ readonly "trigger-dispatch": {
23
+ readonly queue: "cap-kernel-maintenance";
24
+ readonly idempotent: "Dispatches one stored event by id; the dispatcher reads the event's state and delivers each automation at most once (deliveries keyed by automation and event)";
25
+ readonly processedIn: "packages/kernel/src/runtime/maintenance.ts";
26
+ readonly opts: {
27
+ readonly attempts: 10;
28
+ readonly backoff: {
29
+ readonly type: "exponential";
30
+ readonly delay: 5000;
31
+ };
32
+ readonly removeOnComplete: true;
33
+ };
34
+ };
35
+ readonly "automation-coalesce": {
36
+ readonly queue: "cap-kernel-maintenance";
37
+ readonly idempotent: "Flushes the pair's deliveries still waiting for a run under the automation row lock; a repeat finds none and records nothing";
38
+ readonly processedIn: "packages/kernel/src/runtime/maintenance.ts";
39
+ readonly opts: {
40
+ readonly attempts: 10;
41
+ readonly backoff: {
42
+ readonly type: "exponential";
43
+ readonly delay: 5000;
44
+ };
45
+ readonly removeOnComplete: true;
46
+ readonly removeOnFail: true;
47
+ };
48
+ };
22
49
  readonly "share-object-delete": {
23
50
  readonly queue: "cap-kernel-maintenance";
24
51
  readonly idempotent: "Deletes one object key; deleting a missing object is a no-op";
@@ -32,6 +59,88 @@ export declare const OUTBOX_JOBS: {
32
59
  readonly removeOnComplete: true;
33
60
  };
34
61
  };
62
+ readonly "blob-delete": {
63
+ readonly queue: "cap-kernel-maintenance";
64
+ readonly idempotent: "Deletes the object and row only of a blob still in deleting status that no file or share points at; deleting a missing object is a no-op";
65
+ readonly processedIn: "packages/kernel/src/runtime/maintenance.ts";
66
+ readonly opts: {
67
+ readonly attempts: 10;
68
+ readonly backoff: {
69
+ readonly type: "exponential";
70
+ readonly delay: 5000;
71
+ };
72
+ readonly removeOnComplete: true;
73
+ readonly removeOnFail: true;
74
+ };
75
+ };
76
+ readonly "file-library-hash": {
77
+ readonly queue: "cap-kernel-maintenance";
78
+ readonly idempotent: "Owes each org's first hashing batch under a deterministic id; a second run owes the same ids, deduplicated";
79
+ readonly processedIn: "packages/kernel/src/runtime/maintenance.ts";
80
+ readonly opts: {
81
+ readonly attempts: 5;
82
+ readonly backoff: {
83
+ readonly type: "exponential";
84
+ readonly delay: 5000;
85
+ };
86
+ readonly removeOnComplete: true;
87
+ readonly removeOnFail: true;
88
+ };
89
+ };
90
+ readonly "file-library-hash-org": {
91
+ readonly queue: "cap-kernel-maintenance";
92
+ readonly idempotent: "Holds the org's hashing lock and re-checks each blob under its row lock and the hash's lock; a blob already hashed or merged is skipped";
93
+ readonly processedIn: "packages/kernel/src/runtime/maintenance.ts";
94
+ readonly opts: {
95
+ readonly attempts: 5;
96
+ readonly backoff: {
97
+ readonly type: "exponential";
98
+ readonly delay: 5000;
99
+ };
100
+ readonly removeOnComplete: true;
101
+ readonly removeOnFail: true;
102
+ };
103
+ };
104
+ readonly "file-library-backfill": {
105
+ readonly queue: "cap-kernel-maintenance";
106
+ readonly idempotent: "Does nothing once the settled marker exists; the copy itself is idempotent and writes the marker in its own transaction";
107
+ readonly processedIn: "packages/kernel/src/runtime/maintenance.ts";
108
+ readonly opts: {
109
+ readonly attempts: 5;
110
+ readonly backoff: {
111
+ readonly type: "exponential";
112
+ readonly delay: 30000;
113
+ };
114
+ readonly removeOnComplete: true;
115
+ readonly removeOnFail: true;
116
+ };
117
+ };
118
+ readonly "file-release": {
119
+ readonly queue: "cap-kernel-maintenance";
120
+ readonly idempotent: "Re-reads the deleted file under its row lock and releases its blob only while nothing else points at it, or deletes its own staging key; a second run finds nothing to do";
121
+ readonly processedIn: "packages/kernel/src/runtime/maintenance.ts";
122
+ readonly opts: {
123
+ readonly attempts: 10;
124
+ readonly backoff: {
125
+ readonly type: "exponential";
126
+ readonly delay: 5000;
127
+ };
128
+ readonly removeOnComplete: true;
129
+ };
130
+ };
131
+ readonly "file-staging-delete": {
132
+ readonly queue: "cap-kernel-maintenance";
133
+ readonly idempotent: "Deletes the file's own staging key only when the file is no longer uploading and no blob names that key; deleting a missing object is a no-op";
134
+ readonly processedIn: "packages/kernel/src/runtime/maintenance.ts";
135
+ readonly opts: {
136
+ readonly attempts: 10;
137
+ readonly backoff: {
138
+ readonly type: "exponential";
139
+ readonly delay: 5000;
140
+ };
141
+ readonly removeOnComplete: true;
142
+ };
143
+ };
35
144
  readonly "platform-icon-delete": {
36
145
  readonly queue: "cap-kernel-maintenance";
37
146
  readonly idempotent: "Deletes one icon object only when the purpose's row does not name it, under the purpose's lock; deleting a missing object is a no-op";
@@ -326,7 +435,7 @@ export declare const OUTBOX_JOBS: {
326
435
  readonly removeOnFail: true;
327
436
  };
328
437
  };
329
- readonly "sched-fire": {
438
+ readonly "automation-fire": {
330
439
  readonly queue: "cap-kernel-maintenance";
331
440
  readonly idempotent: "a fire acts only on a pending task run, under its row lock; a retried start reuses what the first one made";
332
441
  readonly processedIn: "packages/kernel/src/runtime/maintenance.ts";
@@ -340,7 +449,7 @@ export declare const OUTBOX_JOBS: {
340
449
  readonly removeOnFail: true;
341
450
  };
342
451
  };
343
- readonly "sched-settle": {
452
+ readonly "automation-settle": {
344
453
  readonly queue: "cap-kernel-maintenance";
345
454
  readonly idempotent: "a check acts only on a task run still pending (claimed for the claimed check, unclaimed for the unfired one), under the task and run row locks, so a run claimed, started, ended or skipped since is left as it is";
346
455
  readonly processedIn: "packages/kernel/src/runtime/maintenance.ts";
@@ -21,14 +21,109 @@ const SCOPE_JOB_OPTS = {
21
21
  * name without one does not type-check as an `OutboxJobName` (`add` does not check it at runtime).
22
22
  */
23
23
  export const OUTBOX_JOBS = {
24
- // `shares/share-objects.ts` SHARE_OBJECT_DELETE_JOB: owed by a share's refresh (the previous
25
- // generation) and revoke (the current one), under `shareObjectDeleteJobId` (file sharing spec §2)
24
+ // `automations/job-ids.ts` TRIGGER_DISPATCH_JOB: owed by the transaction that stores a trigger
25
+ // event (`TriggerEventsService.emit`, collaboration spec §4.2), under `trigger-dispatch-<eventId>`
26
+ "trigger-dispatch": {
27
+ queue: "cap-kernel-maintenance",
28
+ idempotent: "Dispatches one stored event by id; the dispatcher reads the event's state and delivers each automation at most once (deliveries keyed by automation and event)",
29
+ processedIn: "packages/kernel/src/runtime/maintenance.ts",
30
+ opts: { attempts: 10, backoff: { type: "exponential", delay: 5000 }, removeOnComplete: true },
31
+ },
32
+ // `automations/job-ids.ts` AUTOMATION_COALESCE_JOB: owed by the dispatch that opens a window of
33
+ // events for one (automation, subject) pair (`TriggerDispatcher`, collaboration spec §4.7), under
34
+ // `<coalesceJobId(automation, subject)>-<first event id>`, due when the window closes
35
+ "automation-coalesce": {
36
+ queue: "cap-kernel-maintenance",
37
+ idempotent: "Flushes the pair's deliveries still waiting for a run under the automation row lock; a repeat finds none and records nothing",
38
+ processedIn: "packages/kernel/src/runtime/maintenance.ts",
39
+ // removed once done, so a later window's add is never swallowed by a kept job
40
+ opts: {
41
+ attempts: 10,
42
+ backoff: { type: "exponential", delay: 5000 },
43
+ removeOnComplete: true,
44
+ removeOnFail: true,
45
+ },
46
+ },
47
+ // `shares/share-objects.ts` SHARE_OBJECT_DELETE_JOB: owed before the file library by a share's
48
+ // refresh and revoke (`shareObjectDeleteJobId`); no longer owed, handled for rows owed before the
49
+ // deploy (a key a blob uses is never deleted)
26
50
  "share-object-delete": {
27
51
  queue: "cap-kernel-maintenance",
28
52
  idempotent: "Deletes one object key; deleting a missing object is a no-op",
29
53
  processedIn: "packages/kernel/src/runtime/maintenance.ts",
30
54
  opts: { attempts: 10, backoff: { type: "exponential", delay: 5000 }, removeOnComplete: true },
31
55
  },
56
+ // `files/blob-objects.ts` BLOB_DELETE_JOB: owed with a blob turned `deleting` (an upload dropped
57
+ // before use whose own blob nothing else points at; the blob sweep; a hashing merge's
58
+ // duplicate), under `blobDeleteJobId`
59
+ "blob-delete": {
60
+ queue: "cap-kernel-maintenance",
61
+ idempotent: "Deletes the object and row only of a blob still in deleting status that no file or share points at; deleting a missing object is a no-op",
62
+ processedIn: "packages/kernel/src/runtime/maintenance.ts",
63
+ // removed on failure too: the blob sweep owes a stale deletion again under the same id
64
+ opts: {
65
+ attempts: 10,
66
+ backoff: { type: "exponential", delay: 5000 },
67
+ removeOnComplete: true,
68
+ removeOnFail: true,
69
+ },
70
+ },
71
+ // `files/hash-job.ts` FILE_LIBRARY_HASH_JOB: the hashing dispatcher, owed by the hourly kickoff
72
+ // under its own name as id
73
+ "file-library-hash": {
74
+ queue: "cap-kernel-maintenance",
75
+ idempotent: "Owes each org's first hashing batch under a deterministic id; a second run owes the same ids, deduplicated",
76
+ processedIn: "packages/kernel/src/runtime/maintenance.ts",
77
+ // removed either way, so the next kickoff can owe it again
78
+ opts: {
79
+ attempts: 5,
80
+ backoff: { type: "exponential", delay: 5000 },
81
+ removeOnComplete: true,
82
+ removeOnFail: true,
83
+ },
84
+ },
85
+ // `files/hash-job.ts` FILE_LIBRARY_HASH_ORG_JOB: one org's hashing batch, owed by the dispatcher
86
+ // and by the previous batch, under `fileLibraryHashOrgJobId`
87
+ "file-library-hash-org": {
88
+ queue: "cap-kernel-maintenance",
89
+ idempotent: "Holds the org's hashing lock and re-checks each blob under its row lock and the hash's lock; a blob already hashed or merged is skipped",
90
+ processedIn: "packages/kernel/src/runtime/maintenance.ts",
91
+ opts: {
92
+ attempts: 5,
93
+ backoff: { type: "exponential", delay: 5000 },
94
+ removeOnComplete: true,
95
+ removeOnFail: true,
96
+ },
97
+ },
98
+ // `files/library-backfill.ts` FILE_LIBRARY_BACKFILL_JOB: the one-off catch-up copy, owed by the
99
+ // kickoff until it settled, under its own name as id
100
+ "file-library-backfill": {
101
+ queue: "cap-kernel-maintenance",
102
+ idempotent: "Does nothing once the settled marker exists; the copy itself is idempotent and writes the marker in its own transaction",
103
+ processedIn: "packages/kernel/src/runtime/maintenance.ts",
104
+ opts: {
105
+ attempts: 5,
106
+ backoff: { type: "exponential", delay: 30000 },
107
+ removeOnComplete: true,
108
+ removeOnFail: true,
109
+ },
110
+ },
111
+ // `files/blob-objects.ts` FILE_RELEASE_JOB: owed, deferred, by every discard and draft cleanup
112
+ // of an upload, under `fileReleaseJobId`
113
+ "file-release": {
114
+ queue: "cap-kernel-maintenance",
115
+ idempotent: "Re-reads the deleted file under its row lock and releases its blob only while nothing else points at it, or deletes its own staging key; a second run finds nothing to do",
116
+ processedIn: "packages/kernel/src/runtime/maintenance.ts",
117
+ opts: { attempts: 10, backoff: { type: "exponential", delay: 5000 }, removeOnComplete: true },
118
+ },
119
+ // `files/blob-objects.ts` FILE_STAGING_DELETE_JOB: owed by a finalize that reused another blob, a
120
+ // discard and the draft cleanup, under `fileStagingDeleteJobId`
121
+ "file-staging-delete": {
122
+ queue: "cap-kernel-maintenance",
123
+ idempotent: "Deletes the file's own staging key only when the file is no longer uploading and no blob names that key; deleting a missing object is a no-op",
124
+ processedIn: "packages/kernel/src/runtime/maintenance.ts",
125
+ opts: { attempts: 10, backoff: { type: "exponential", delay: 5000 }, removeOnComplete: true },
126
+ },
32
127
  // `themes/platform-icon-objects.ts` PLATFORM_ICON_DELETE_JOB: owed by an icon upload (its own
33
128
  // object's delayed orphan check), a replace and a clear (the object the row stopped naming)
34
129
  "platform-icon-delete": {
@@ -287,9 +382,9 @@ export const OUTBOX_JOBS = {
287
382
  removeOnFail: true,
288
383
  },
289
384
  },
290
- // `schedules/job-ids.ts` SCHED_FIRE_JOB: owed by the transaction that writes a pending task run
291
- // (the scan's tick, a person's "run now"), under `schedFireJobId` (spec §8.1)
292
- "sched-fire": {
385
+ // `automations/job-ids.ts` AUTOMATION_FIRE_JOB: owed by the transaction that writes a pending task run
386
+ // (the scan's tick, a person's "run now"), under `automationFireJobId` (spec §8.1)
387
+ "automation-fire": {
293
388
  queue: "cap-kernel-maintenance",
294
389
  idempotent: "a fire acts only on a pending task run, under its row lock; a retried start reuses what the first one made",
295
390
  processedIn: "packages/kernel/src/runtime/maintenance.ts",
@@ -301,11 +396,11 @@ export const OUTBOX_JOBS = {
301
396
  removeOnFail: true,
302
397
  },
303
398
  },
304
- // `schedules/job-ids.ts` SCHED_SETTLE_JOB: the claimed check, owed by the fire job's claim (the
305
- // transaction that writes `fired_at`) with `runAt` 10 min on, under `schedSettleJobId` (a run
399
+ // `automations/job-ids.ts` AUTOMATION_SETTLE_JOB: the claimed check, owed by the fire job's claim (the
400
+ // transaction that writes `fired_at`) with `runAt` 10 min on, under `automationSettleJobId` (a run
306
401
  // still in flight owes the next check an hour on); the unfired check, owed with the task run
307
- // (scan tick, "run now") under `schedSettleUnfiredJobId` (ruling R26)
308
- "sched-settle": {
402
+ // (scan tick, "run now") under `automationSettleUnfiredJobId` (ruling R26)
403
+ "automation-settle": {
309
404
  queue: "cap-kernel-maintenance",
310
405
  idempotent: "a check acts only on a task run still pending (claimed for the claimed check, unclaimed for the unfired one), under the task and run row locks, so a run claimed, started, ended or skipped since is left as it is",
311
406
  processedIn: "packages/kernel/src/runtime/maintenance.ts",
@@ -38,6 +38,8 @@ export interface NamedThrottler {
38
38
  * and `device-token-ip` with `@Throttled` (every request counts; neither checks a guessable
39
39
  * credential: the device code is 32 random bytes). `POST /api/v1/app-auth/token` opts in to
40
40
  * `app-auth-token-ip` the same way (the one-time code is 32 random bytes).
41
+ * `POST /api/v1/orgs/:orgId/files/:id/finalize` opts in to `file-finalize` (60 per minute per
42
+ * account: each finalize reads a whole upload and copies it).
41
43
  * `POST …/guides/:guideId/checks/:checkId/run` opts in to `setup-check` (setup guides v2 §10.3: each run may call a third party).
42
44
  *
43
45
  * `device-stream-ip` is not a Nest route limit either: the gateway's raw viewer route
@@ -39,6 +39,8 @@ const LOGIN_MSG = "Too many failed login attempts; try again later";
39
39
  * and `device-token-ip` with `@Throttled` (every request counts; neither checks a guessable
40
40
  * credential: the device code is 32 random bytes). `POST /api/v1/app-auth/token` opts in to
41
41
  * `app-auth-token-ip` the same way (the one-time code is 32 random bytes).
42
+ * `POST /api/v1/orgs/:orgId/files/:id/finalize` opts in to `file-finalize` (60 per minute per
43
+ * account: each finalize reads a whole upload and copies it).
42
44
  * `POST …/guides/:guideId/checks/:checkId/run` opts in to `setup-check` (setup guides v2 §10.3: each run may call a third party).
43
45
  *
44
46
  * `device-stream-ip` is not a Nest route limit either: the gateway's raw viewer route
@@ -239,6 +241,18 @@ export const NAMED_THROTTLERS = [
239
241
  message: "Too many share link requests; try again later",
240
242
  getTracker: ip,
241
243
  },
244
+ // file upload finalizes per signed-in person (file library spec §3): 60 a minute, every request
245
+ // counts (@Throttled); each one reads a whole upload into memory and copies it
246
+ {
247
+ name: "file-finalize",
248
+ group: "file-finalize",
249
+ onSuccess: "clear",
250
+ limit: 60,
251
+ ttl: 60_000,
252
+ message: "Too many file uploads finished at once; try again in a minute",
253
+ code: "rate_limited",
254
+ getTracker: (req) => sha256(principalAccountId(req)),
255
+ },
242
256
  ];
243
257
  /** The storage key of a named throttler's counter for a tracker (shared by the guard and success paths). */
244
258
  export const throttlerKey = (name, tracker) => sha256(`${name}:${tracker}`);
@@ -7,6 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  var KernelAppOptionsModule_1, KernelModule_1;
8
8
  import { Global, Module } from "@nestjs/common";
9
9
  import { APP_INTERCEPTOR } from "@nestjs/core";
10
+ import { TriggerEventsModule } from "./automations/events/events.module.js";
10
11
  import { CatalogModule } from "./catalog/catalog.module.js";
11
12
  import { ChannelsModule } from "./channels/channels.module.js";
12
13
  import { ClientModule } from "./client/client.module.js";
@@ -131,6 +132,8 @@ let KernelModule = KernelModule_1 = class KernelModule {
131
132
  ClientModule,
132
133
  // ctx.deviceAccess: extensions' device services (the host finds it at the time of use)
133
134
  ExtensionDeviceAccessModule,
135
+ // ctx.triggers: the events extensions emit (the host finds it at the time of use)
136
+ TriggerEventsModule,
134
137
  // the Platform tool's operation registry and actor facts
135
138
  PlatformModule,
136
139
  // its operations (skills, agents, ...), registered at start on every role
@@ -334,6 +334,12 @@ let KernelLifecycle = class KernelLifecycle {
334
334
  if (bootstrapAgain && opts.bootstrap !== undefined) {
335
335
  await this.runBootstrap(opts.bootstrap.dir, true);
336
336
  this.checkpoint();
337
+ // The second pass installs its extensions through the lifecycle ops, which only publish
338
+ // `kernel.plugins.changed`: this replica would load them whenever the message arrives. The
339
+ // start loads them itself before it goes on (the template connectors plan against them) and
340
+ // serves (an org's first request sees the builtin plugin's tools)
341
+ await this.extensionLifecycle.reconcile("bootstrap");
342
+ this.checkpoint();
337
343
  }
338
344
  // The one-off reconciliation of template connectors (plugin pages spec §7): once the
339
345
  // extensions loaded (it plans connectors against their connector extensions) and the bootstrap
@@ -424,7 +424,7 @@ let ModelPurposesService = class ModelPurposesService {
424
424
  try {
425
425
  const out = await consumeModelStream(provider, request, idleMs, signal, (ev) => {
426
426
  chars += deltaChars(ev);
427
- });
427
+ }, this.log);
428
428
  return {
429
429
  content: out.content,
430
430
  stopReason: out.stopReason,
@@ -322,7 +322,7 @@ let Offboarding = class Offboarding {
322
322
  .where("account_id", "=", accountId)
323
323
  .execute();
324
324
  // after the conversations above (the share rows come last, as in every other share write)
325
- const sharesRevoked = await revokeSharesIn(this.db.db, this.outbox, { orgId, createdBy: accountId }, "member_offboarded");
325
+ const sharesRevoked = await revokeSharesIn(this.db.db, { orgId, createdBy: accountId }, "member_offboarded");
326
326
  await audit(this.db.db, {
327
327
  ...(actor.actorAccountId !== undefined && { actorAccountId: actor.actorAccountId }),
328
328
  ...(actor.actorTokenId !== undefined && { actorTokenId: actor.actorTokenId }),
@@ -4,7 +4,7 @@ export type OrgRole = (typeof ORG_ROLES)[number];
4
4
  /** `role` 是否不低于 `min`。 */
5
5
  export declare function roleAtLeast(role: OrgRole, min: OrgRole): boolean;
6
6
  /** 组织级动作;路由用 `@OrgAction(action)` 声明所需动作。 */
7
- export type OrgAction = "org.read" | "org.update" | "org.delete" | "org.transfer" | "org.members.read" | "org.members.manage" | "org.invitations.manage" | "org.tokens.manage" | "org.extensions.read" | "org.extensions.manage" | "agents.create" | "agents.use" | "agents.manage" | "conversations.compact" | "connectors.manage" | "connectors.use" | "approvals.decide" | "channels.manage" | "skills.read" | "skills.manage" | "ui.use" | "trajectories.read" | "evals.manage" | "org.models.manage" | "catalog.read" | "catalog.request" | "catalog.decide" | "catalog.upload" | "schedules.use" | "schedules.manage";
7
+ export type OrgAction = "org.read" | "org.update" | "org.delete" | "org.transfer" | "org.members.read" | "org.members.manage" | "org.invitations.manage" | "org.tokens.manage" | "org.extensions.read" | "org.extensions.manage" | "agents.create" | "agents.use" | "agents.manage" | "conversations.compact" | "connectors.manage" | "connectors.use" | "approvals.decide" | "channels.manage" | "skills.read" | "skills.manage" | "ui.use" | "trajectories.read" | "evals.manage" | "org.models.manage" | "catalog.read" | "catalog.request" | "catalog.decide" | "catalog.upload" | "automations.use" | "automations.manage";
8
8
  /** 每个动作所需的最低角色。 */
9
9
  export declare const ACTION_MIN_ROLE: Record<OrgAction, OrgRole>;
10
10
  /** 只允许 user principal 执行的动作:服务令牌即使角色足够也拒绝(除 SERVICE_ALLOWED 外全部)。 */
@@ -49,10 +49,10 @@ export const ACTION_MIN_ROLE = {
49
49
  "catalog.decide": "admin",
50
50
  // An org admin uploads a plugin package the org owns (spec §14.1 item 1, ruling P3-7)
51
51
  "catalog.upload": "admin",
52
- // Scheduled tasks (spec 2026-11-11 §10): create, edit, pause, resume, run and delete one's own
53
- "schedules.use": "member",
52
+ // Automations (spec 2026-11-11 §10): create, edit, pause, resume, run and delete one's own
53
+ "automations.use": "member",
54
54
  // list every task of the org, pause, resume and delete any (never edit another person's)
55
- "schedules.manage": "admin",
55
+ "automations.manage": "admin",
56
56
  };
57
57
  /** 服务令牌也可执行的动作:只读的 org.read、org.members.read,以及使用 agent 的 agents.use。 */
58
58
  const SERVICE_ALLOWED = new Set([
@@ -7,7 +7,7 @@ import { type OrgEffectiveNetwork, type OrgSandboxLimits, type OrgSettingsDeploy
7
7
  * 以及只读的 `sandboxLimits`(组织实际生效的沙箱 cpu / 内存与来源,超级管理员在部署设置里覆盖,C19)。
8
8
  */
9
9
  type SettingsResponse = {
10
- /** `scheduledTasks.forbiddenToolsUnreadable: true` when the stored list cannot be read. */
10
+ /** `automations.forbiddenToolsUnreadable: true` when the stored list cannot be read. */
11
11
  settings: OrgSettingsView;
12
12
  deployment: OrgSettingsDeployment;
13
13
  /** The org's effective sandbox-mode network (org egress ceiling spec §D4). */
@@ -1,9 +1,9 @@
1
- import type { SandboxLimits } from "@capybara-hq/plugin-sdk";
1
+ import { type SandboxLimits } from "@capybara-hq/plugin-sdk";
2
2
  import { z } from "zod";
3
3
  import { type PlatformAttribution } from "../attribution/platform-attribution.js";
4
4
  import type { KernelSchemaDb } from "../db/kernel-schema.js";
5
5
  import type { ExtensionPointDefaults } from "../extensions/point-defaults.js";
6
- import { type CompactionSettings } from "../identity/settings.js";
6
+ import { type CompactionSettings, type PromptCacheSettings } from "../identity/settings.js";
7
7
  import { KernelConfigService } from "../infra/config/kernel-config.service.js";
8
8
  import { KernelDb } from "../infra/database/kernel-db.js";
9
9
  import { TransactionHost } from "../infra/database/transaction-host.js";
@@ -49,6 +49,8 @@ import { OrgLock } from "./org-lock.js";
49
49
  * absent (or an invalid stored value) = follow the platform, personal picks allowed.
50
50
  * - `uiArrangement`: per slot, the extension contributions the org hides and their order (UI slots
51
51
  * spec §5); a slot with no entry follows the platform's; an invalid stored value reads as absent.
52
+ * - `navigation`: where the org's plugin pages sit in the navigation (`pluginPages`: per contribution
53
+ * key the section an admin chose, at most 3 primary); absent follows each page's `nav` suggestion.
52
54
  * - `gitGateway`: the org's git gateway switch and host sources (sandbox git credentials spec §9);
53
55
  * not in the PATCH yet; an invalid stored value reads as `{ enabled: false }` (fails closed).
54
56
  */
@@ -77,12 +79,12 @@ export type OrgThemeSetting = z.infer<typeof OrgThemeSettingSchema>;
77
79
  /** The theme setting of an org that has none: follow the platform, personal picks allowed. */
78
80
  export declare const DEFAULT_ORG_THEME: OrgThemeSetting;
79
81
  /**
80
- * Org settings of scheduled tasks (spec §9); every field reads leniently (invalid = default,
82
+ * Org settings of automations (spec §9); every field reads leniently (invalid = default,
81
83
  * except `forbiddenTools`, which keeps its valid entries). A stored `forbiddenTools` that is not a
82
84
  * list (or a group that is not an object) reads as `[]` here, for display; enforcement checks
83
85
  * {@link invalidStoredForbiddenTools} and fails unattended runs instead (never wider).
84
86
  */
85
- export declare const ScheduledTasksSettingsSchema: z.ZodObject<{
87
+ export declare const AutomationsSettingsSchema: z.ZodObject<{
86
88
  enabled: z.ZodCatch<z.ZodDefault<z.ZodBoolean>>;
87
89
  minIntervalMinutes: z.ZodCatch<z.ZodDefault<z.ZodNumber>>;
88
90
  maxTasksPerMember: z.ZodCatch<z.ZodDefault<z.ZodNumber>>;
@@ -95,14 +97,18 @@ export declare const ScheduledTasksSettingsSchema: z.ZodObject<{
95
97
  wait: "wait";
96
98
  }>>>;
97
99
  pauseAfterFailures: z.ZodCatch<z.ZodDefault<z.ZodNumber>>;
100
+ maxEventDepth: z.ZodCatch<z.ZodDefault<z.ZodNumber>>;
101
+ coalesceSeconds: z.ZodCatch<z.ZodDefault<z.ZodNumber>>;
102
+ maxEventRunsPerSubjectPerHour: z.ZodCatch<z.ZodDefault<z.ZodNumber>>;
103
+ eventSourcesOff: z.ZodCatch<z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodString>>, unknown>>;
98
104
  forbiddenTools: z.ZodCatch<z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodString>>, unknown>>;
99
105
  }, z.core.$strip>;
100
- export type ScheduledTasksSettings = z.infer<typeof ScheduledTasksSettingsSchema>;
106
+ export type AutomationsSettings = z.infer<typeof AutomationsSettingsSchema>;
101
107
  /**
102
108
  * The PATCH form: a partial merge into the group (fields left out keep their stored value; see
103
109
  * `OrgSettingsService.update`). A field given replaces that field whole, `forbiddenTools` too.
104
110
  */
105
- export declare const ScheduledTasksPatchSchema: z.ZodObject<{
111
+ export declare const AutomationsPatchSchema: z.ZodObject<{
106
112
  enabled: z.ZodOptional<z.ZodBoolean>;
107
113
  minIntervalMinutes: z.ZodOptional<z.ZodNumber>;
108
114
  maxTasksPerMember: z.ZodOptional<z.ZodNumber>;
@@ -115,6 +121,10 @@ export declare const ScheduledTasksPatchSchema: z.ZodObject<{
115
121
  wait: "wait";
116
122
  }>>;
117
123
  pauseAfterFailures: z.ZodOptional<z.ZodNumber>;
124
+ maxEventDepth: z.ZodOptional<z.ZodNumber>;
125
+ coalesceSeconds: z.ZodOptional<z.ZodNumber>;
126
+ maxEventRunsPerSubjectPerHour: z.ZodOptional<z.ZodNumber>;
127
+ eventSourcesOff: z.ZodOptional<z.ZodArray<z.ZodString>>;
118
128
  forbiddenTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
119
129
  }, z.core.$strict>;
120
130
  /**
@@ -132,6 +142,24 @@ export declare const GIT_GATEWAY_INVALID: {
132
142
  readonly enabled: false;
133
143
  };
134
144
  export type GitGatewaySetting = z.infer<typeof GitGatewaySettingSchema>;
145
+ /** At most this many plugin pages in the primary navigation (plugin full pages spec §9). */
146
+ export declare const NAV_PRIMARY_MAX = 3;
147
+ /**
148
+ * The org's placement of plugin pages in the navigation (plugin full pages spec §9): per
149
+ * contribution key `<plugin>/<id>` the section an org admin chose. A page with no entry follows
150
+ * the contribution's `nav` suggestion (default `more`). Replaced whole by the PATCH; at most
151
+ * {@link NAV_PRIMARY_MAX} entries with section `primary`.
152
+ */
153
+ export declare const NavigationSettingSchema: z.ZodObject<{
154
+ pluginPages: z.ZodArray<z.ZodObject<{
155
+ contribution: z.ZodString;
156
+ section: z.ZodEnum<{
157
+ more: "more";
158
+ primary: "primary";
159
+ }>;
160
+ }, z.core.$strict>>;
161
+ }, z.core.$strict>;
162
+ export type NavigationSetting = z.infer<typeof NavigationSettingSchema>;
135
163
  /** Whether prompt suggestions run for an org: the platform is on and the org has not turned it off. */
136
164
  export declare function effectivePromptSuggestions(platform: "on" | "off", org: "on" | "off" | undefined): boolean;
137
165
  export declare const OrgSettingsSchema: z.ZodObject<{
@@ -183,11 +211,20 @@ export declare const OrgSettingsSchema: z.ZodObject<{
183
211
  }>;
184
212
  }, z.core.$strict>>>;
185
213
  uiArrangement: z.ZodCatch<z.ZodOptional<z.ZodType<Partial<Record<"agent.detail.section" | "conversation.composer.frame" | "conversation.empty" | "conversation.panel" | "conversation.properties.section" | "conversation.tool-result.card" | "file.preview" | "org.page" | "org.settings.section" | "platform.page" | "shell.brand" | "shell.overlay", import("../ui/arrangement.js").UiArrangementEntry>>, unknown, z.core.$ZodTypeInternals<Partial<Record<"agent.detail.section" | "conversation.composer.frame" | "conversation.empty" | "conversation.panel" | "conversation.properties.section" | "conversation.tool-result.card" | "file.preview" | "org.page" | "org.settings.section" | "platform.page" | "shell.brand" | "shell.overlay", import("../ui/arrangement.js").UiArrangementEntry>>, unknown>>>>;
214
+ navigation: z.ZodCatch<z.ZodOptional<z.ZodObject<{
215
+ pluginPages: z.ZodArray<z.ZodObject<{
216
+ contribution: z.ZodString;
217
+ section: z.ZodEnum<{
218
+ more: "more";
219
+ primary: "primary";
220
+ }>;
221
+ }, z.core.$strict>>;
222
+ }, z.core.$strict>>>;
186
223
  gitGateway: z.ZodCatch<z.ZodOptional<z.ZodObject<{
187
224
  enabled: z.ZodOptional<z.ZodBoolean>;
188
225
  hostSources: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
189
226
  }, z.core.$strip>>>;
190
- scheduledTasks: z.ZodCatch<z.ZodPrefault<z.ZodObject<{
227
+ automations: z.ZodCatch<z.ZodPrefault<z.ZodObject<{
191
228
  enabled: z.ZodCatch<z.ZodDefault<z.ZodBoolean>>;
192
229
  minIntervalMinutes: z.ZodCatch<z.ZodDefault<z.ZodNumber>>;
193
230
  maxTasksPerMember: z.ZodCatch<z.ZodDefault<z.ZodNumber>>;
@@ -200,6 +237,10 @@ export declare const OrgSettingsSchema: z.ZodObject<{
200
237
  wait: "wait";
201
238
  }>>>;
202
239
  pauseAfterFailures: z.ZodCatch<z.ZodDefault<z.ZodNumber>>;
240
+ maxEventDepth: z.ZodCatch<z.ZodDefault<z.ZodNumber>>;
241
+ coalesceSeconds: z.ZodCatch<z.ZodDefault<z.ZodNumber>>;
242
+ maxEventRunsPerSubjectPerHour: z.ZodCatch<z.ZodDefault<z.ZodNumber>>;
243
+ eventSourcesOff: z.ZodCatch<z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodString>>, unknown>>;
203
244
  forbiddenTools: z.ZodCatch<z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodString>>, unknown>>;
204
245
  }, z.core.$strip>>>;
205
246
  compaction: z.ZodCatch<z.ZodOptional<z.ZodObject<{
@@ -209,6 +250,9 @@ export declare const OrgSettingsSchema: z.ZodObject<{
209
250
  reserveTokens: z.ZodOptional<z.ZodNumber>;
210
251
  maxOutputTokens: z.ZodOptional<z.ZodNumber>;
211
252
  }, z.core.$strip>>>;
253
+ promptCache: z.ZodCatch<z.ZodOptional<z.ZodObject<{
254
+ longTtl: z.ZodOptional<z.ZodBoolean>;
255
+ }, z.core.$strip>>>;
212
256
  externalSharing: z.ZodCatch<z.ZodOptional<z.ZodEnum<{
213
257
  off: "off";
214
258
  on: "on";
@@ -221,12 +265,12 @@ export declare const OrgSettingsSchema: z.ZodObject<{
221
265
  export type OrgSettings = z.infer<typeof OrgSettingsSchema>;
222
266
  /**
223
267
  * The settings as the responses carry them: {@link OrgSettings} plus
224
- * `scheduledTasks.forbiddenToolsUnreadable: true` when the stored list cannot be read
268
+ * `automations.forbiddenToolsUnreadable: true` when the stored list cannot be read
225
269
  * ({@link invalidStoredForbiddenTools}; `forbiddenTools` then reads `[]`), so the settings page
226
270
  * says so and saves the list. Never stored.
227
271
  */
228
272
  export type OrgSettingsView = OrgSettings & {
229
- scheduledTasks: OrgSettings["scheduledTasks"] & {
273
+ automations: OrgSettings["automations"] & {
230
274
  forbiddenToolsUnreadable?: true;
231
275
  };
232
276
  };
@@ -280,7 +324,16 @@ export declare const OrgSettingsPatchSchema: z.ZodObject<{
280
324
  }>;
281
325
  }, z.core.$strict>>>;
282
326
  uiArrangement: z.ZodOptional<z.ZodType<Partial<Record<"agent.detail.section" | "conversation.composer.frame" | "conversation.empty" | "conversation.panel" | "conversation.properties.section" | "conversation.tool-result.card" | "file.preview" | "org.page" | "org.settings.section" | "platform.page" | "shell.brand" | "shell.overlay", import("../ui/arrangement.js").UiArrangementEntry | null>>, unknown, z.core.$ZodTypeInternals<Partial<Record<"agent.detail.section" | "conversation.composer.frame" | "conversation.empty" | "conversation.panel" | "conversation.properties.section" | "conversation.tool-result.card" | "file.preview" | "org.page" | "org.settings.section" | "platform.page" | "shell.brand" | "shell.overlay", import("../ui/arrangement.js").UiArrangementEntry | null>>, unknown>>>;
283
- scheduledTasks: z.ZodOptional<z.ZodObject<{
327
+ navigation: z.ZodOptional<z.ZodNullable<z.ZodObject<{
328
+ pluginPages: z.ZodArray<z.ZodObject<{
329
+ contribution: z.ZodString;
330
+ section: z.ZodEnum<{
331
+ more: "more";
332
+ primary: "primary";
333
+ }>;
334
+ }, z.core.$strict>>;
335
+ }, z.core.$strict>>>;
336
+ automations: z.ZodOptional<z.ZodObject<{
284
337
  enabled: z.ZodOptional<z.ZodBoolean>;
285
338
  minIntervalMinutes: z.ZodOptional<z.ZodNumber>;
286
339
  maxTasksPerMember: z.ZodOptional<z.ZodNumber>;
@@ -293,6 +346,10 @@ export declare const OrgSettingsPatchSchema: z.ZodObject<{
293
346
  wait: "wait";
294
347
  }>>;
295
348
  pauseAfterFailures: z.ZodOptional<z.ZodNumber>;
349
+ maxEventDepth: z.ZodOptional<z.ZodNumber>;
350
+ coalesceSeconds: z.ZodOptional<z.ZodNumber>;
351
+ maxEventRunsPerSubjectPerHour: z.ZodOptional<z.ZodNumber>;
352
+ eventSourcesOff: z.ZodOptional<z.ZodArray<z.ZodString>>;
296
353
  forbiddenTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
297
354
  }, z.core.$strict>>;
298
355
  compaction: z.ZodOptional<z.ZodNullable<z.ZodObject<{
@@ -302,6 +359,9 @@ export declare const OrgSettingsPatchSchema: z.ZodObject<{
302
359
  reserveTokens: z.ZodOptional<z.ZodNumber>;
303
360
  maxOutputTokens: z.ZodOptional<z.ZodNumber>;
304
361
  }, z.core.$strict>>>;
362
+ promptCache: z.ZodOptional<z.ZodNullable<z.ZodObject<{
363
+ longTtl: z.ZodOptional<z.ZodBoolean>;
364
+ }, z.core.$strict>>>;
305
365
  externalSharing: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
306
366
  off: "off";
307
367
  on: "on";
@@ -357,6 +417,8 @@ export interface OrgSettingsDeployment {
357
417
  publicUrl: boolean;
358
418
  /** The platform's conversation compaction settings (what "follow the platform" means). */
359
419
  compaction: CompactionSettings;
420
+ /** The platform's prompt cache settings (what "follow the platform" means). */
421
+ promptCache: PromptCacheSettings;
360
422
  /** The platform's external sharing switch and its source (deny: the org cannot turn it on). */
361
423
  externalSharing: ExternalSharingView;
362
424
  /** The longest expiry a share may take, in days. */
@@ -383,16 +445,16 @@ log?: Pick<KernelLogger, "debug">): Promise<OrgSettings>;
383
445
  /** Whether a stored settings object holds a `sandboxToolPolicy` this version reads as `ask`. */
384
446
  export declare function invalidStoredSandboxToolPolicy(raw: unknown): boolean;
385
447
  /**
386
- * Whether the stored scheduled-task `forbiddenTools` cannot be read: the group or the field is
448
+ * Whether the stored automation `forbiddenTools` cannot be read: the group or the field is
387
449
  * present but not an object / a list. Unattended runs of such an org fail
388
450
  * ({@link FORBIDDEN_TOOLS_UNREADABLE_ERROR}) rather than run with nothing forbidden. Invalid
389
451
  * entries inside a list are dropped instead (the valid ones stay forbidden).
390
452
  */
391
453
  export declare function invalidStoredForbiddenTools(raw: unknown): boolean;
392
454
  /** The refusal of an unattended run of an org whose `forbiddenTools` cannot be read. */
393
- export declare const FORBIDDEN_TOOLS_UNREADABLE_ERROR = "The organization's forbidden tool list for scheduled tasks is unreadable, so this scheduled run cannot continue; an org admin must save the list again in the organization's scheduled task settings.";
455
+ export declare const FORBIDDEN_TOOLS_UNREADABLE_ERROR = "The organization's forbidden tool list for automations is unreadable, so this scheduled run cannot continue; an org admin must save the list again in the organization's automation settings.";
394
456
  /** The refusal of a new task grant while the org's `forbiddenTools` cannot be read. */
395
- export declare const FORBIDDEN_TOOLS_UNREADABLE_GRANT_ERROR = "The organization's forbidden tool list for scheduled tasks is unreadable, so no tool can be approved for a task now; an org admin must save the list again in the organization's scheduled task settings.";
457
+ export declare const FORBIDDEN_TOOLS_UNREADABLE_GRANT_ERROR = "The organization's forbidden tool list for automations is unreadable, so no tool can be approved for a task now; an org admin must save the list again in the organization's automation settings.";
396
458
  /**
397
459
  * Logs (through `log`, at the caller's level) the security settings a stored value reads narrower
398
460
  * than written, with the org id.