@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
@@ -257,6 +257,14 @@ export declare const PermissionContextMetaV1Schema: z.ZodObject<{
257
257
  sandbox: z.ZodOptional<z.ZodString>;
258
258
  }, z.core.$strict>;
259
259
  export type PermissionContextMetaV1 = z.infer<typeof PermissionContextMetaV1Schema>;
260
+ /**
261
+ * The file id a logged media ref names. Events are validated on write but read back as stored, so
262
+ * a block logged before the rename still carries the same id as `attachmentId`; every reader of a
263
+ * stored ref takes the id through here.
264
+ */
265
+ export declare function refFileId(source: Extract<MediaSource, {
266
+ kind: "ref";
267
+ }>): string;
260
268
  /** The most hosts one network ask (and one `network_blocked` event) lists. */
261
269
  export declare const NETWORK_ASK_MAX_HOSTS = 20;
262
270
  /** The longest host name a network ask or `network_blocked` event carries. */
@@ -446,10 +454,10 @@ export declare const ContentBlockSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
446
454
  "image/png": "image/png";
447
455
  "image/webp": "image/webp";
448
456
  }>;
449
- source: z.ZodObject<{
457
+ source: z.ZodPreprocess<z.ZodObject<{
450
458
  kind: z.ZodLiteral<"ref">;
451
- attachmentId: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
452
- }, z.core.$strip>;
459
+ fileId: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
460
+ }, z.core.$strip>, unknown>;
453
461
  name: z.ZodOptional<z.ZodString>;
454
462
  size: z.ZodOptional<z.ZodNumber>;
455
463
  }, z.core.$strip>, z.ZodObject<{
@@ -460,19 +468,19 @@ export declare const ContentBlockSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
460
468
  "text/markdown": "text/markdown";
461
469
  "text/plain": "text/plain";
462
470
  }>;
463
- source: z.ZodObject<{
471
+ source: z.ZodPreprocess<z.ZodObject<{
464
472
  kind: z.ZodLiteral<"ref">;
465
- attachmentId: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
466
- }, z.core.$strip>;
473
+ fileId: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
474
+ }, z.core.$strip>, unknown>;
467
475
  name: z.ZodOptional<z.ZodString>;
468
476
  size: z.ZodOptional<z.ZodNumber>;
469
477
  }, z.core.$strip>, z.ZodObject<{
470
478
  type: z.ZodLiteral<"file">;
471
479
  mediaType: z.ZodString;
472
- source: z.ZodObject<{
480
+ source: z.ZodPreprocess<z.ZodObject<{
473
481
  kind: z.ZodLiteral<"ref">;
474
- attachmentId: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
475
- }, z.core.$strip>;
482
+ fileId: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
483
+ }, z.core.$strip>, unknown>;
476
484
  name: z.ZodOptional<z.ZodString>;
477
485
  size: z.ZodOptional<z.ZodNumber>;
478
486
  }, z.core.$strip>], "type">;
@@ -622,6 +630,29 @@ export declare const ScheduleMarkerSchema: z.ZodObject<{
622
630
  taskName: z.ZodString;
623
631
  localTime: z.ZodString;
624
632
  }, z.core.$strip>;
633
+ /**
634
+ * `user_message.automationEvent` (collaboration spec §4.6): the `AutomationEventMarker` shape, the
635
+ * events an event automation's message reports (at least one; coalesced events in order; at most
636
+ * the first 5 and the latest 15, `omittedEvents` counting the ones between, absent when none).
637
+ */
638
+ export declare const AutomationEventMarkerSchema: z.ZodObject<{
639
+ automationId: z.ZodString;
640
+ automationRunId: z.ZodString;
641
+ automationName: z.ZodString;
642
+ source: z.ZodString;
643
+ events: z.ZodArray<z.ZodObject<{
644
+ id: z.ZodString;
645
+ type: z.ZodString;
646
+ subject: z.ZodObject<{
647
+ kind: z.ZodString;
648
+ id: z.ZodString;
649
+ title: z.ZodString;
650
+ url: z.ZodOptional<z.ZodString>;
651
+ }, z.core.$strip>;
652
+ summary: z.ZodString;
653
+ }, z.core.$strip>>;
654
+ omittedEvents: z.ZodOptional<z.ZodNumber>;
655
+ }, z.core.$strip>;
625
656
  /** `run_context` (run context spec §3.1): every field optional, a later event holds changes only. */
626
657
  export declare const RunContextSchema: z.ZodObject<{
627
658
  agent: z.ZodOptional<z.ZodObject<{
@@ -899,10 +930,10 @@ export declare const ConversationEventSchema: z.ZodDiscriminatedUnion<[z.ZodObje
899
930
  "image/png": "image/png";
900
931
  "image/webp": "image/webp";
901
932
  }>;
902
- source: z.ZodObject<{
933
+ source: z.ZodPreprocess<z.ZodObject<{
903
934
  kind: z.ZodLiteral<"ref">;
904
- attachmentId: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
905
- }, z.core.$strip>;
935
+ fileId: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
936
+ }, z.core.$strip>, unknown>;
906
937
  name: z.ZodOptional<z.ZodString>;
907
938
  size: z.ZodOptional<z.ZodNumber>;
908
939
  }, z.core.$strip>, z.ZodObject<{
@@ -913,19 +944,19 @@ export declare const ConversationEventSchema: z.ZodDiscriminatedUnion<[z.ZodObje
913
944
  "text/markdown": "text/markdown";
914
945
  "text/plain": "text/plain";
915
946
  }>;
916
- source: z.ZodObject<{
947
+ source: z.ZodPreprocess<z.ZodObject<{
917
948
  kind: z.ZodLiteral<"ref">;
918
- attachmentId: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
919
- }, z.core.$strip>;
949
+ fileId: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
950
+ }, z.core.$strip>, unknown>;
920
951
  name: z.ZodOptional<z.ZodString>;
921
952
  size: z.ZodOptional<z.ZodNumber>;
922
953
  }, z.core.$strip>, z.ZodObject<{
923
954
  type: z.ZodLiteral<"file">;
924
955
  mediaType: z.ZodString;
925
- source: z.ZodObject<{
956
+ source: z.ZodPreprocess<z.ZodObject<{
926
957
  kind: z.ZodLiteral<"ref">;
927
- attachmentId: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
928
- }, z.core.$strip>;
958
+ fileId: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
959
+ }, z.core.$strip>, unknown>;
929
960
  name: z.ZodOptional<z.ZodString>;
930
961
  size: z.ZodOptional<z.ZodNumber>;
931
962
  }, z.core.$strip>], "type">>;
@@ -935,6 +966,9 @@ export declare const ConversationEventSchema: z.ZodDiscriminatedUnion<[z.ZodObje
935
966
  uri: z.ZodString;
936
967
  name: z.ZodString;
937
968
  }, z.core.$strip>>>;
969
+ projectFiles: z.ZodOptional<z.ZodArray<z.ZodObject<{
970
+ path: z.ZodString;
971
+ }, z.core.$strip>>>;
938
972
  authorAccountId: z.ZodString;
939
973
  sender: z.ZodOptional<z.ZodObject<{
940
974
  name: z.ZodString;
@@ -978,6 +1012,24 @@ export declare const ConversationEventSchema: z.ZodDiscriminatedUnion<[z.ZodObje
978
1012
  taskName: z.ZodString;
979
1013
  localTime: z.ZodString;
980
1014
  }, z.core.$strip>>;
1015
+ automationEvent: z.ZodOptional<z.ZodObject<{
1016
+ automationId: z.ZodString;
1017
+ automationRunId: z.ZodString;
1018
+ automationName: z.ZodString;
1019
+ source: z.ZodString;
1020
+ events: z.ZodArray<z.ZodObject<{
1021
+ id: z.ZodString;
1022
+ type: z.ZodString;
1023
+ subject: z.ZodObject<{
1024
+ kind: z.ZodString;
1025
+ id: z.ZodString;
1026
+ title: z.ZodString;
1027
+ url: z.ZodOptional<z.ZodString>;
1028
+ }, z.core.$strip>;
1029
+ summary: z.ZodString;
1030
+ }, z.core.$strip>>;
1031
+ omittedEvents: z.ZodOptional<z.ZodNumber>;
1032
+ }, z.core.$strip>>;
981
1033
  dispatch: z.ZodOptional<z.ZodObject<{
982
1034
  parentConversationId: z.ZodString;
983
1035
  parentRunId: z.ZodString;
@@ -1040,6 +1092,7 @@ export declare const ConversationEventSchema: z.ZodDiscriminatedUnion<[z.ZodObje
1040
1092
  }, z.core.$strip>;
1041
1093
  triggerAccountId: z.ZodString;
1042
1094
  trigger: z.ZodOptional<z.ZodEnum<{
1095
+ automation_event: "automation_event";
1043
1096
  background_task: "background_task";
1044
1097
  compact: "compact";
1045
1098
  message: "message";
@@ -1069,6 +1122,7 @@ export declare const ConversationEventSchema: z.ZodDiscriminatedUnion<[z.ZodObje
1069
1122
  }, z.core.$strict>>;
1070
1123
  reminderSeqs: z.ZodArray<z.ZodNumber>;
1071
1124
  runOutcomeSeqs: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
1125
+ automationEventSeqs: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
1072
1126
  maxOutputTokens: z.ZodNumber;
1073
1127
  params: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
1074
1128
  droppedParams: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -1087,6 +1141,7 @@ export declare const ConversationEventSchema: z.ZodDiscriminatedUnion<[z.ZodObje
1087
1141
  auto: "auto";
1088
1142
  none: "none";
1089
1143
  }>>;
1144
+ cacheTtl: z.ZodOptional<z.ZodNumber>;
1090
1145
  media: z.ZodOptional<z.ZodArray<z.ZodObject<{
1091
1146
  attachmentId: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1092
1147
  outcome: z.ZodEnum<{
@@ -1159,10 +1214,10 @@ export declare const ConversationEventSchema: z.ZodDiscriminatedUnion<[z.ZodObje
1159
1214
  "image/png": "image/png";
1160
1215
  "image/webp": "image/webp";
1161
1216
  }>;
1162
- source: z.ZodObject<{
1217
+ source: z.ZodPreprocess<z.ZodObject<{
1163
1218
  kind: z.ZodLiteral<"ref">;
1164
- attachmentId: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1165
- }, z.core.$strip>;
1219
+ fileId: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1220
+ }, z.core.$strip>, unknown>;
1166
1221
  name: z.ZodOptional<z.ZodString>;
1167
1222
  size: z.ZodOptional<z.ZodNumber>;
1168
1223
  }, z.core.$strip>, z.ZodObject<{
@@ -1173,19 +1228,19 @@ export declare const ConversationEventSchema: z.ZodDiscriminatedUnion<[z.ZodObje
1173
1228
  "text/markdown": "text/markdown";
1174
1229
  "text/plain": "text/plain";
1175
1230
  }>;
1176
- source: z.ZodObject<{
1231
+ source: z.ZodPreprocess<z.ZodObject<{
1177
1232
  kind: z.ZodLiteral<"ref">;
1178
- attachmentId: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1179
- }, z.core.$strip>;
1233
+ fileId: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1234
+ }, z.core.$strip>, unknown>;
1180
1235
  name: z.ZodOptional<z.ZodString>;
1181
1236
  size: z.ZodOptional<z.ZodNumber>;
1182
1237
  }, z.core.$strip>, z.ZodObject<{
1183
1238
  type: z.ZodLiteral<"file">;
1184
1239
  mediaType: z.ZodString;
1185
- source: z.ZodObject<{
1240
+ source: z.ZodPreprocess<z.ZodObject<{
1186
1241
  kind: z.ZodLiteral<"ref">;
1187
- attachmentId: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1188
- }, z.core.$strip>;
1242
+ fileId: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1243
+ }, z.core.$strip>, unknown>;
1189
1244
  name: z.ZodOptional<z.ZodString>;
1190
1245
  size: z.ZodOptional<z.ZodNumber>;
1191
1246
  }, z.core.$strip>], "type">>;
@@ -1206,6 +1261,10 @@ export declare const ConversationEventSchema: z.ZodDiscriminatedUnion<[z.ZodObje
1206
1261
  cacheReadTokens: z.ZodNumber;
1207
1262
  cacheWriteTokens: z.ZodNumber;
1208
1263
  outputImages: z.ZodExactOptional<z.ZodNumber>;
1264
+ cacheWriteByTtl: z.ZodExactOptional<z.ZodArray<z.ZodObject<{
1265
+ ttl: z.ZodNumber;
1266
+ tokens: z.ZodNumber;
1267
+ }, z.core.$strip>>>;
1209
1268
  step: z.ZodNumber;
1210
1269
  provider: z.ZodString;
1211
1270
  model: z.ZodString;
@@ -1688,6 +1747,7 @@ export declare const ConversationEventSchema: z.ZodDiscriminatedUnion<[z.ZodObje
1688
1747
  type: z.ZodLiteral<"artifact_created">;
1689
1748
  payload: z.ZodObject<{
1690
1749
  artifactId: z.ZodUUID;
1750
+ fileId: z.ZodOptional<z.ZodUUID>;
1691
1751
  name: z.ZodString;
1692
1752
  contentType: z.ZodString;
1693
1753
  size: z.ZodNumber;
@@ -1972,6 +2032,10 @@ export declare const ConversationEventSchema: z.ZodDiscriminatedUnion<[z.ZodObje
1972
2032
  cacheReadTokens: z.ZodNumber;
1973
2033
  cacheWriteTokens: z.ZodNumber;
1974
2034
  outputImages: z.ZodExactOptional<z.ZodNumber>;
2035
+ cacheWriteByTtl: z.ZodExactOptional<z.ZodArray<z.ZodObject<{
2036
+ ttl: z.ZodNumber;
2037
+ tokens: z.ZodNumber;
2038
+ }, z.core.$strip>>>;
1975
2039
  }, z.core.$strip>;
1976
2040
  }, z.core.$strip>;
1977
2041
  }, z.core.$strip>, z.ZodObject<{
@@ -2043,6 +2107,10 @@ export declare const ConversationEventSchema: z.ZodDiscriminatedUnion<[z.ZodObje
2043
2107
  text: z.ZodString;
2044
2108
  savedTokens: z.ZodNumber;
2045
2109
  openingSeqs: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
2110
+ method: z.ZodOptional<z.ZodEnum<{
2111
+ in_context: "in_context";
2112
+ transcript: "transcript";
2113
+ }>>;
2046
2114
  step: z.ZodNumber;
2047
2115
  }, z.core.$strip>;
2048
2116
  }, z.core.$strip>, z.ZodObject<{
@@ -1,5 +1,5 @@
1
1
  import { posix } from "node:path";
2
- import { CARD_BADGE_MAX, CARD_TEXT_MAX, CONTEXT_LIMITS, DOCUMENT_MEDIA_TYPES, hasControlChars, IMAGE_MEDIA_TYPES, isAttachmentId, isSkillName, MEDIA_NAME_MAX_CHARS, validateAllowHost, validateSandboxPathShape, } from "@capybara-hq/plugin-sdk";
2
+ import { CARD_BADGE_MAX, CARD_TEXT_MAX, CONTEXT_LIMITS, DOCUMENT_MEDIA_TYPES, hasControlChars, IMAGE_MEDIA_TYPES, isAttachmentId, isFileId, isSkillName, MEDIA_NAME_MAX_CHARS, validateAllowHost, validateSandboxPathShape, } from "@capybara-hq/plugin-sdk";
3
3
  import { z } from "zod";
4
4
  import { AgentDefinitionSchema, DisabledSkillRef, DisabledToolRef, ModelRef, } from "../agents/definition.js";
5
5
  import { ORG_ROLES } from "../orgs/roles.js";
@@ -314,15 +314,37 @@ const ProviderOpaqueSchema = z.object({
314
314
  model: z.string(),
315
315
  data: z.unknown(),
316
316
  });
317
+ const AttachmentIdSchema = z.string().refine(isAttachmentId, "attachmentId must be a UUID");
317
318
  /**
318
- * 日志里的媒体来源:只有附件引用。字节(`base64`)绝不进事件日志——日志是事实源、字节不是;
319
- * 构建模型请求时内核按 `attachmentId` 取字节换成 `base64`(见 {@link LogContentBlock})。
319
+ * A media source in the log is only a file reference. Bytes (`base64`) never enter the event log:
320
+ * the log is the source of truth, bytes are not; request building fetches the bytes by `fileId`
321
+ * and swaps in `base64` (see {@link LogContentBlock}).
322
+ *
323
+ * Blocks logged before the file library name the same id `attachmentId`: parsing accepts that key
324
+ * as an alias of `fileId` (the stored JSON is never rewritten, so readers of stored payloads go
325
+ * through {@link refFileId}).
320
326
  */
321
- const AttachmentIdSchema = z.string().refine(isAttachmentId, "attachmentId must be a UUID");
322
- const RefMediaSourceSchema = z.object({
327
+ const RefMediaSourceSchema = z.preprocess((v) => {
328
+ if (v === null || typeof v !== "object" || Array.isArray(v))
329
+ return v;
330
+ const o = v;
331
+ if (o.fileId !== undefined || !Object.hasOwn(o, "attachmentId"))
332
+ return v;
333
+ const { attachmentId, ...rest } = o;
334
+ return { ...rest, fileId: attachmentId };
335
+ }, z.object({
323
336
  kind: z.literal("ref"),
324
- attachmentId: AttachmentIdSchema,
325
- });
337
+ fileId: z.string().refine(isFileId, "fileId must be a UUID"),
338
+ }));
339
+ /**
340
+ * The file id a logged media ref names. Events are validated on write but read back as stored, so
341
+ * a block logged before the rename still carries the same id as `attachmentId`; every reader of a
342
+ * stored ref takes the id through here.
343
+ */
344
+ export function refFileId(source) {
345
+ const s = source;
346
+ return (s.fileId ?? s.attachmentId);
347
+ }
326
348
  /**
327
349
  * Who may decide an approval, as the approval row says (display only): the assigned account
328
350
  * (`requestedFor`), else the escalation role (`approverRole`). Pages word the waiting state with it
@@ -650,6 +672,11 @@ const ModelUsageShape = {
650
672
  cacheWriteTokens: count,
651
673
  /** Images produced (an image generation call). */
652
674
  outputImages: count.exactOptional(),
675
+ /**
676
+ * Cache writes per lifetime tier (`ttl` seconds), as the provider reported them; sums to
677
+ * `cacheWriteTokens`. Absent when the provider reported no breakdown.
678
+ */
679
+ cacheWriteByTtl: z.array(z.object({ ttl: count, tokens: count })).exactOptional(),
653
680
  };
654
681
  /**
655
682
  * How a sub-agent's run ended (`subagent_finished`, a `subagent_delivery` finish). `timed_out`:
@@ -709,6 +736,31 @@ export const ScheduleMarkerSchema = z.object({
709
736
  taskName: z.string(),
710
737
  localTime: z.string(),
711
738
  });
739
+ /**
740
+ * `user_message.automationEvent` (collaboration spec §4.6): the `AutomationEventMarker` shape, the
741
+ * events an event automation's message reports (at least one; coalesced events in order; at most
742
+ * the first 5 and the latest 15, `omittedEvents` counting the ones between, absent when none).
743
+ */
744
+ export const AutomationEventMarkerSchema = z.object({
745
+ automationId: z.string(),
746
+ automationRunId: z.string(),
747
+ automationName: z.string(),
748
+ source: z.string(),
749
+ events: z
750
+ .array(z.object({
751
+ id: z.string(),
752
+ type: z.string(),
753
+ subject: z.object({
754
+ kind: z.string(),
755
+ id: z.string(),
756
+ title: z.string(),
757
+ url: z.string().optional(),
758
+ }),
759
+ summary: z.string(),
760
+ }))
761
+ .min(1),
762
+ omittedEvents: z.number().int().positive().optional(),
763
+ });
712
764
  /** `run_context` (run context spec §3.1): every field optional, a later event holds changes only. */
713
765
  export const RunContextSchema = z.object({
714
766
  /** The agent itself: its name and its versioned description collapsed to one line. */
@@ -831,6 +883,13 @@ export const ConversationEventSchema = z.discriminatedUnion("type", [
831
883
  attachments: z
832
884
  .array(z.object({ appId: z.string(), appName: z.string(), uri: z.string(), name: z.string() }))
833
885
  .optional(),
886
+ /**
887
+ * The referenced project files (composer menus §5), paths relative to the conversation's
888
+ * project root: the text block of file i is `content[1 + attachments.length + i]`, before
889
+ * the uploaded files' blocks. Normalized and deduplicated, so possibly shorter than the
890
+ * body's list. Absent: none.
891
+ */
892
+ projectFiles: z.array(z.object({ path: z.string() })).optional(),
834
893
  authorAccountId: z.string(),
835
894
  /**
836
895
  * Who wrote the message, at send time (run context spec §3.2): display name and org role
@@ -889,9 +948,17 @@ export const ConversationEventSchema = z.discriminatedUnion("type", [
889
948
  * Not model-visible as such: request building renders only `taskName` and `localTime`, fixed
890
949
  * here at write time, as the header `[Scheduled task "<name>", run for <local time>]`
891
950
  * (`scheduleHeader`). The run this message triggers is unattended
892
- * (`runs.scheduled_task_run_id`).
951
+ * (`runs.automation_run_id`).
893
952
  */
894
953
  schedule: ScheduleMarkerSchema.optional(),
954
+ /**
955
+ * An event automation's message (collaboration spec §4.6): which automation and run posted
956
+ * it and the events it reports. Request building renders it, from these fields fixed at
957
+ * write time, as a block before the automation's prompt (`automationEventBlock`); the ids
958
+ * are not model-visible. The run this message triggers is unattended
959
+ * (`runs.automation_run_id`) and records its last event (`runs.trigger_event_id`).
960
+ */
961
+ automationEvent: AutomationEventMarkerSchema.optional(),
895
962
  /**
896
963
  * Set on a sub-agent's task message (phase C, spec §6.3): which parent call dispatched it.
897
964
  * Not model-visible; the web renders the message as the task block.
@@ -946,9 +1013,12 @@ export const ConversationEventSchema = z.discriminatedUnion("type", [
946
1013
  * (spec 2026-11-05-background-bash-design §3), `subagent` = a sub-agent's delivery woke it
947
1014
  * (agent map spec §5.3), `schedule` = a scheduled task's message (scheduled tasks spec §6),
948
1015
  * `compact` = a manual compaction run (context compaction spec §4.7): no message, no model
949
- * step, only the summary and its usage.
1016
+ * step, only the summary and its usage, `automation_event` = an event automation's message
1017
+ * (collaboration spec §4.6).
950
1018
  */
951
- trigger: z.enum(["message", "background_task", "subagent", "schedule", "compact"]).optional(),
1019
+ trigger: z
1020
+ .enum(["message", "background_task", "subagent", "schedule", "compact", "automation_event"])
1021
+ .optional(),
952
1022
  /**
953
1023
  * A wake run's boundary: the seq of the finish or delivery that woke it (full-run replay
954
1024
  * seeds from it).
@@ -976,6 +1046,12 @@ export const ConversationEventSchema = z.discriminatedUnion("type", [
976
1046
  * renders another set (a request sent before the note existed).
977
1047
  */
978
1048
  runOutcomeSeqs: z.array(seqNo).optional(),
1049
+ /**
1050
+ * The `user_message` events whose event automation block (`automationEventBlock`) the
1051
+ * request rendered, in seq order; absent when it rendered none. Reconstruction reports
1052
+ * `automation_event_block` when the rebuild renders another set.
1053
+ */
1054
+ automationEventSeqs: z.array(seqNo).optional(),
979
1055
  /**
980
1056
  * The request's output cap: `min(model cap, maxOutputTokens knob ??
981
1057
  * runtime.maxOutputTokens)`, clamped by the hard fit guard.
@@ -1028,6 +1104,13 @@ export const ConversationEventSchema = z.discriminatedUnion("type", [
1028
1104
  * themselves are in `capybara.tool_specs` by specHash.
1029
1105
  */
1030
1106
  toolChoice: z.enum(["auto", "none"]).optional(),
1107
+ /**
1108
+ * The prompt cache lifetime the request asked for (`ModelRequest.cacheTtl`, seconds: one
1109
+ * of the model's `ttlOptions`, chosen from `promptCache.longTtl`); absent when it named
1110
+ * none (the model's default). A transport option, not model-visible: no DriftReason
1111
+ * (idle compaction spec §9.2).
1112
+ */
1113
+ cacheTtl: count.optional(),
1031
1114
  /**
1032
1115
  * What became of each attachment in the request (Ruling M8, in first-seen order, one
1033
1116
  * entry per attachment): bytes sent (`bytes`, with the etag at finalize), inline text, a
@@ -1487,6 +1570,11 @@ export const ConversationEventSchema = z.discriminatedUnion("type", [
1487
1570
  */
1488
1571
  ev("artifact_created", z.object({
1489
1572
  artifactId: z.uuid(),
1573
+ /**
1574
+ * The library file the delivery created (file library spec §4): the artifact id itself.
1575
+ * Optional because earlier events lack it (their file, migrated, kept the artifact id).
1576
+ */
1577
+ fileId: z.uuid().optional(),
1490
1578
  name: ArtifactNameSchema,
1491
1579
  contentType: z.string().min(1).max(200),
1492
1580
  size: z.number().int().nonnegative(),
@@ -1777,6 +1865,14 @@ export const ConversationEventSchema = z.discriminatedUnion("type", [
1777
1865
  * (nothing re-rendered).
1778
1866
  */
1779
1867
  openingSeqs: z.array(seqNo).optional(),
1868
+ /**
1869
+ * How the summary was written (idle compaction spec §9.4): `in_context` from the
1870
+ * conversation's last request rebuilt with the summary instruction appended (its cached
1871
+ * prefix), `transcript` from the plan's transcript. Not model-visible itself: only the
1872
+ * framing sentence after the summary reads it (context compaction spec §4.2.2), derived from
1873
+ * the log, so no `DriftReason`. Absent on summaries written before it (read as `transcript`).
1874
+ */
1875
+ method: z.enum(["transcript", "in_context"]).optional(),
1780
1876
  /**
1781
1877
  * The step the compaction ran in (0 for a manual compact run), so a later compaction in the
1782
1878
  * same step takes the next idempotency key.
@@ -1852,6 +1948,8 @@ const _toolResult = true;
1852
1948
  void _toolResult;
1853
1949
  const _schedule = true;
1854
1950
  void _schedule;
1951
+ const _automationEvent = true;
1952
+ void _automationEvent;
1855
1953
  void _blocks;
1856
1954
  void _logIsBlock;
1857
1955
  void _stop;