@elevasis/sdk 1.44.3 → 1.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (259) hide show
  1. package/dist/cli.cjs +35026 -30226
  2. package/dist/index.d.ts +1786 -808
  3. package/dist/index.js +789 -739
  4. package/dist/node/index.d.ts +105 -181
  5. package/dist/node/index.js +2 -2
  6. package/dist/test-utils/index.d.ts +901 -359
  7. package/dist/test-utils/index.js +587 -824
  8. package/dist/worker/index.d.ts +12685 -0
  9. package/dist/worker/index.js +188 -216
  10. package/package.json +4 -7
  11. package/reference/_navigation.md +161 -22
  12. package/reference/_reference-manifest.json +228 -4
  13. package/reference/claude-config.md +8 -0
  14. package/reference/core/exports.mdx +2 -0
  15. package/reference/core/index.mdx +3 -3
  16. package/reference/examples/organization-model.ts +117 -111
  17. package/reference/index.mdx +4 -4
  18. package/reference/packages/core/src/business/README.md +4 -1
  19. package/reference/packages/core/src/content/README.md +19 -0
  20. package/reference/packages/core/src/organization-model/README.md +148 -149
  21. package/reference/packages/core/src/organization-model/readiness/README.md +42 -0
  22. package/reference/packages/ui/src/features/README.md +28 -28
  23. package/reference/rules/active-change-index.md +40 -54
  24. package/reference/rules/agent-runtime.md +81 -0
  25. package/reference/rules/agent-start-here.md +71 -163
  26. package/reference/rules/deployment.md +33 -10
  27. package/reference/rules/error-handling.md +26 -0
  28. package/reference/rules/execution.md +13 -0
  29. package/reference/rules/frontend.md +10 -3
  30. package/reference/rules/observability.md +9 -1
  31. package/reference/rules/operations.md +26 -17
  32. package/reference/rules/organization-model.md +74 -88
  33. package/reference/rules/organization-os.md +71 -88
  34. package/reference/rules/package-taxonomy.md +11 -2
  35. package/reference/rules/platform.md +13 -7
  36. package/reference/rules/shared-types.md +36 -0
  37. package/reference/rules/task-tracking.md +30 -5
  38. package/reference/rules/ui.md +145 -3
  39. package/reference/rules/vibe-intents.md +271 -0
  40. package/reference/rules/vibe.md +17 -243
  41. package/reference/scaffold/core/organization-graph.mdx +112 -99
  42. package/reference/scaffold/core/organization-model.mdx +231 -215
  43. package/reference/scaffold/operations/propagation-pipeline.md +16 -17
  44. package/reference/scaffold/operations/scaffold-maintenance.md +22 -20
  45. package/reference/scaffold/operations/workflow-recipes.md +72 -20
  46. package/reference/scaffold/recipes/add-a-feature.md +156 -146
  47. package/reference/scaffold/recipes/add-a-resource.md +123 -117
  48. package/reference/scaffold/recipes/customize-crm-actions.md +28 -13
  49. package/reference/scaffold/recipes/customize-knowledge-browser.md +52 -117
  50. package/reference/scaffold/recipes/customize-organization-model.md +161 -149
  51. package/reference/scaffold/recipes/extend-a-base-entity.md +156 -140
  52. package/reference/scaffold/recipes/extend-content.md +265 -0
  53. package/reference/scaffold/recipes/extend-crm.md +16 -11
  54. package/reference/scaffold/recipes/extend-lead-gen.md +37 -21
  55. package/reference/scaffold/recipes/gate-by-feature-or-admin.md +160 -118
  56. package/reference/scaffold/recipes/index.md +6 -3
  57. package/reference/scaffold/recipes/query-the-knowledge-graph.md +23 -23
  58. package/reference/scaffold/reference/contracts.md +30 -56
  59. package/reference/scaffold/reference/feature-registry.md +3 -0
  60. package/reference/scaffold/reference/glossary.md +4 -4
  61. package/reference/scaffold/reference/system-interface-capabilities.md +5 -4
  62. package/reference/scaffold/ui/composition-extensibility.mdx +271 -232
  63. package/reference/scaffold/ui/customization.md +2 -2
  64. package/reference/scaffold/ui/feature-flags-and-gating.md +14 -6
  65. package/reference/scaffold/ui/feature-shell.mdx +277 -62
  66. package/reference/scaffold/ui/recipes.md +229 -197
  67. package/reference/sdk/cli-management.mdx +166 -33
  68. package/reference/sdk/cli.mdx +90 -13
  69. package/reference/sdk/concepts.mdx +2 -0
  70. package/reference/sdk/define-builders.mdx +76 -0
  71. package/reference/sdk/deployment/command-center.mdx +6 -2
  72. package/reference/sdk/deployment/execution-reference.mdx +64 -186
  73. package/reference/sdk/deployment/index.mdx +2 -0
  74. package/reference/sdk/exports.mdx +4 -4
  75. package/reference/sdk/framework/agent.mdx +52 -116
  76. package/reference/sdk/framework/index.mdx +46 -65
  77. package/reference/sdk/framework/project-structure.mdx +150 -205
  78. package/reference/sdk/framework/tutorial-system.mdx +2 -2
  79. package/reference/sdk/human-in-the-loop.mdx +152 -0
  80. package/reference/sdk/index.mdx +6 -7
  81. package/reference/sdk/platform-tools/adapters-platform.mdx +3 -1
  82. package/reference/sdk/platform-tools/index.mdx +12 -0
  83. package/reference/sdk/platform-tools/type-safety.mdx +4 -0
  84. package/reference/sdk/project-deployment-spec.mdx +131 -0
  85. package/reference/sdk/resources/index.mdx +21 -7
  86. package/reference/sdk/resources/patterns.mdx +54 -24
  87. package/reference/sdk/resources/types.mdx +7 -4
  88. package/reference/sdk/templates/data-enrichment.mdx +7 -3
  89. package/reference/sdk/templates/email-sender.mdx +139 -135
  90. package/reference/sdk/templates/lead-scorer.mdx +5 -1
  91. package/reference/sdk/templates/pdf-generator.mdx +155 -151
  92. package/reference/sdk/templates/recurring-job.mdx +195 -189
  93. package/reference/sdk/templates/text-classifier.mdx +4 -0
  94. package/reference/sdk/templates/web-scraper.mdx +139 -135
  95. package/reference/spine/spine-primer.md +135 -96
  96. package/reference/ui/exports.mdx +1 -0
  97. package/reference/ui/index.mdx +14 -7
  98. package/dist/types/worker/adapters/anymailfinder.d.ts +0 -14
  99. package/dist/types/worker/adapters/apify.d.ts +0 -14
  100. package/dist/types/worker/adapters/approval.d.ts +0 -23
  101. package/dist/types/worker/adapters/attio.d.ts +0 -22
  102. package/dist/types/worker/adapters/clickup.d.ts +0 -22
  103. package/dist/types/worker/adapters/create-adapter.d.ts +0 -41
  104. package/dist/types/worker/adapters/crm.d.ts +0 -20
  105. package/dist/types/worker/adapters/dropbox.d.ts +0 -14
  106. package/dist/types/worker/adapters/email.d.ts +0 -25
  107. package/dist/types/worker/adapters/execution.d.ts +0 -22
  108. package/dist/types/worker/adapters/gmail.d.ts +0 -14
  109. package/dist/types/worker/adapters/google-sheets.d.ts +0 -14
  110. package/dist/types/worker/adapters/index.d.ts +0 -33
  111. package/dist/types/worker/adapters/instantly.d.ts +0 -14
  112. package/dist/types/worker/adapters/lead.d.ts +0 -28
  113. package/dist/types/worker/adapters/list.d.ts +0 -9
  114. package/dist/types/worker/adapters/llm.d.ts +0 -45
  115. package/dist/types/worker/adapters/millionverifier.d.ts +0 -14
  116. package/dist/types/worker/adapters/notification.d.ts +0 -28
  117. package/dist/types/worker/adapters/pdf.d.ts +0 -22
  118. package/dist/types/worker/adapters/projects.d.ts +0 -20
  119. package/dist/types/worker/adapters/resend.d.ts +0 -14
  120. package/dist/types/worker/adapters/scheduler.d.ts +0 -25
  121. package/dist/types/worker/adapters/signature-api.d.ts +0 -14
  122. package/dist/types/worker/adapters/storage.d.ts +0 -33
  123. package/dist/types/worker/adapters/stripe.d.ts +0 -14
  124. package/dist/types/worker/adapters/tomba.d.ts +0 -14
  125. package/dist/types/worker/index.d.ts +0 -60
  126. package/dist/types/worker/platform.d.ts +0 -90
  127. package/dist/types/worker/utils.d.ts +0 -9
  128. package/reference/claude-config/Overview.md +0 -230
  129. package/reference/claude-config/hooks/post-edit-validate.mjs +0 -98
  130. package/reference/claude-config/hooks/scaffold-registry-reminder.mjs +0 -187
  131. package/reference/claude-config/hooks/tool-failure-recovery.mjs +0 -73
  132. package/reference/claude-config/registries/graph-skills.json +0 -4
  133. package/reference/claude-config/registries/knowledge-flags.json +0 -154
  134. package/reference/claude-config/registries/skill-coverage.json +0 -20
  135. package/reference/claude-config/rules/active-change-index.md +0 -22
  136. package/reference/claude-config/rules/agent-start-here.md +0 -22
  137. package/reference/claude-config/rules/deployment.md +0 -22
  138. package/reference/claude-config/rules/error-handling.md +0 -22
  139. package/reference/claude-config/rules/execution.md +0 -22
  140. package/reference/claude-config/rules/frontend.md +0 -22
  141. package/reference/claude-config/rules/observability.md +0 -22
  142. package/reference/claude-config/rules/operations.md +0 -22
  143. package/reference/claude-config/rules/organization-model.md +0 -22
  144. package/reference/claude-config/rules/organization-os.md +0 -22
  145. package/reference/claude-config/rules/package-taxonomy.md +0 -22
  146. package/reference/claude-config/rules/platform.md +0 -22
  147. package/reference/claude-config/rules/shared-types.md +0 -22
  148. package/reference/claude-config/rules/task-tracking.md +0 -22
  149. package/reference/claude-config/rules/topbar-actions.md +0 -70
  150. package/reference/claude-config/rules/ui.md +0 -22
  151. package/reference/claude-config/rules/vibe.md +0 -22
  152. package/reference/claude-config/scripts/statusline-command.js +0 -18
  153. package/reference/claude-config/settings.json +0 -30
  154. package/reference/claude-config/skills/client/SKILL.md +0 -201
  155. package/reference/claude-config/skills/deploy/SKILL.md +0 -159
  156. package/reference/claude-config/skills/dsp/SKILL.md +0 -66
  157. package/reference/claude-config/skills/elevasis/SKILL.md +0 -251
  158. package/reference/claude-config/skills/explore/SKILL.md +0 -78
  159. package/reference/claude-config/skills/git-sync/SKILL.md +0 -166
  160. package/reference/claude-config/skills/om/SKILL.md +0 -475
  161. package/reference/claude-config/skills/om/operations/build.md +0 -237
  162. package/reference/claude-config/skills/om/operations/codify-level-a.md +0 -109
  163. package/reference/claude-config/skills/om/operations/codify-level-b.md +0 -159
  164. package/reference/claude-config/skills/om/operations/customers.md +0 -114
  165. package/reference/claude-config/skills/om/operations/features.md +0 -88
  166. package/reference/claude-config/skills/om/operations/goals.md +0 -123
  167. package/reference/claude-config/skills/om/operations/identity.md +0 -97
  168. package/reference/claude-config/skills/om/operations/labels.md +0 -110
  169. package/reference/claude-config/skills/om/operations/offerings.md +0 -114
  170. package/reference/claude-config/skills/om/operations/roles.md +0 -104
  171. package/reference/claude-config/skills/om/operations/scaffold.md +0 -163
  172. package/reference/claude-config/skills/om/operations/techStack.md +0 -38
  173. package/reference/claude-config/skills/project/SKILL.md +0 -1114
  174. package/reference/claude-config/skills/run-ui/SKILL.md +0 -73
  175. package/reference/claude-config/skills/save/SKILL.md +0 -183
  176. package/reference/claude-config/skills/setup/SKILL.md +0 -290
  177. package/reference/claude-config/skills/status/SKILL.md +0 -59
  178. package/reference/claude-config/skills/submit-request/SKILL.md +0 -180
  179. package/reference/claude-config/skills/sync/SKILL.md +0 -47
  180. package/reference/claude-config/skills/tutorial/SKILL.md +0 -259
  181. package/reference/claude-config/skills/tutorial/progress-template.md +0 -74
  182. package/reference/claude-config/skills/tutorial/technical.md +0 -1303
  183. package/reference/claude-config/skills/tutorial/vibe-coder.md +0 -890
  184. package/reference/claude-config/sync-notes/2026-04-22-git-sync-and-sync-notes.md +0 -27
  185. package/reference/claude-config/sync-notes/2026-04-22-lead-gen-deliverability-removal.md +0 -30
  186. package/reference/claude-config/sync-notes/2026-04-24-test-utils-and-template-tests.md +0 -73
  187. package/reference/claude-config/sync-notes/2026-04-24-ui-consolidation-and-sdk-cli-train.md +0 -86
  188. package/reference/claude-config/sync-notes/2026-04-25-auth-role-system-and-settings-roles.md +0 -55
  189. package/reference/claude-config/sync-notes/2026-04-27-crm-hitl-action-layer-cutover.md +0 -97
  190. package/reference/claude-config/sync-notes/2026-04-27-lead-gen-substrate-train.md +0 -112
  191. package/reference/claude-config/sync-notes/2026-04-29-crm-state-and-lead-gen-processing-status.md +0 -93
  192. package/reference/claude-config/sync-notes/2026-05-02-crm-ownership-next-action.md +0 -58
  193. package/reference/claude-config/sync-notes/2026-05-02-template-hardcode-workos-config.md +0 -56
  194. package/reference/claude-config/sync-notes/2026-05-04-elevasis-workspace.md +0 -71
  195. package/reference/claude-config/sync-notes/2026-05-04-knowledge-bundle.md +0 -83
  196. package/reference/claude-config/sync-notes/2026-05-04-template-skills-run-ui-and-tutorial.md +0 -59
  197. package/reference/claude-config/sync-notes/2026-05-05-list-builder.md +0 -42
  198. package/reference/claude-config/sync-notes/2026-05-06-crm-spine.md +0 -60
  199. package/reference/claude-config/sync-notes/2026-05-06-sdk-changes-release-train.md +0 -37
  200. package/reference/claude-config/sync-notes/2026-05-07-sdk-changes-release-train.md +0 -34
  201. package/reference/claude-config/sync-notes/2026-05-08-resource-governance-scaffold-guidance.md +0 -38
  202. package/reference/claude-config/sync-notes/2026-05-09-clients-domain.md +0 -32
  203. package/reference/claude-config/sync-notes/2026-05-09-command-system.md +0 -33
  204. package/reference/claude-config/sync-notes/2026-05-09-resource-governance-and-misc.md +0 -69
  205. package/reference/claude-config/sync-notes/2026-05-12-sdk-ready-release-train.md +0 -30
  206. package/reference/claude-config/sync-notes/2026-05-14-organization-model-ontology-refactor.md +0 -45
  207. package/reference/claude-config/sync-notes/2026-05-15-om-skill-rename-and-write-family.md +0 -52
  208. package/reference/claude-config/sync-notes/2026-05-17-sdk-boundary-consolidation.md +0 -33
  209. package/reference/claude-config/sync-notes/2026-05-20-om-define-helpers.md +0 -32
  210. package/reference/claude-config/sync-notes/2026-05-22-access-model-and-right-panel.md +0 -43
  211. package/reference/claude-config/sync-notes/2026-05-22-lead-gen-tenant-config.md +0 -40
  212. package/reference/claude-config/sync-notes/2026-05-22-org-model-multi-file-split.md +0 -61
  213. package/reference/claude-config/sync-notes/2026-05-23-branding-names-to-identity.md +0 -49
  214. package/reference/claude-config/sync-notes/2026-05-23-lead-gen-manage-access.md +0 -31
  215. package/reference/claude-config/sync-notes/2026-05-23-om-deployment-drift-detection.md +0 -42
  216. package/reference/claude-config/sync-notes/2026-05-23-om-full-model-deploy-contract.md +0 -33
  217. package/reference/claude-config/sync-notes/2026-05-23-ui-sdk-package-fixes.md +0 -37
  218. package/reference/claude-config/sync-notes/2026-05-24-platform-invite-router-core-baseline.md +0 -28
  219. package/reference/claude-config/sync-notes/2026-05-24-system-interface-readiness.md +0 -43
  220. package/reference/claude-config/sync-notes/2026-05-25-invitation-login-loader.md +0 -26
  221. package/reference/claude-config/sync-notes/2026-05-25-om-topbar-requests.md +0 -33
  222. package/reference/claude-config/sync-notes/2026-05-25-system-interface-profile-registry-and-substrate.md +0 -35
  223. package/reference/claude-config/sync-notes/2026-05-25-tenant-om-scaffold-cli.md +0 -49
  224. package/reference/claude-config/sync-notes/2026-05-25-vibe-operate-intent.md +0 -47
  225. package/reference/claude-config/sync-notes/2026-05-28-om-snapshot-sdk-workflow-config.md +0 -33
  226. package/reference/claude-config/sync-notes/2026-05-30-client-source-and-om-profiles.md +0 -39
  227. package/reference/claude-config/sync-notes/2026-06-02-knowledge-nested-group-routing.md +0 -27
  228. package/reference/claude-config/sync-notes/2026-06-02-nest-projects-under-platform.md +0 -45
  229. package/reference/claude-config/sync-notes/2026-06-03-skill-autogen-and-client-skill.md +0 -34
  230. package/reference/claude-config/sync-notes/2026-06-04-scaffold-registry-lane-severity.md +0 -34
  231. package/reference/claude-config/sync-notes/2026-06-05-appearance-app-mode-decouple.md +0 -29
  232. package/reference/claude-config/sync-notes/2026-06-05-ontology-endpoint-rename-and-knowledge-browser-ui.md +0 -86
  233. package/reference/claude-config/sync-notes/2026-06-06-om-build-systems-scaffold.md +0 -47
  234. package/reference/claude-config/sync-notes/2026-06-06-om-item-copy-references.md +0 -50
  235. package/reference/claude-config/sync-notes/2026-06-08-knowledge-base-page-not-found-fix.md +0 -76
  236. package/reference/claude-config/sync-notes/2026-06-09-agent-sessions-public-agent-chat-route.md +0 -75
  237. package/reference/claude-config/sync-notes/2026-06-09-sdk-cli-load-org-model-resolution.md +0 -42
  238. package/reference/claude-config/sync-notes/2026-06-12-agent-grants-visualizer-operations.md +0 -30
  239. package/reference/claude-config/sync-notes/2026-06-14-session-ux-and-project-cli-json.md +0 -33
  240. package/reference/claude-config/sync-notes/2026-06-14-shared-session-conversation-view.md +0 -26
  241. package/reference/claude-config/sync-notes/2026-06-15-session-chat-zero-wiring.md +0 -46
  242. package/reference/claude-config/sync-notes/2026-06-17-agent-session-ux-features.md +0 -34
  243. package/reference/claude-config/sync-notes/2026-06-25-shared-page-scroll-contract-guard.md +0 -52
  244. package/reference/claude-config/sync-notes/2026-06-26-leadgen-overview-om-telemetry.md +0 -47
  245. package/reference/claude-config/sync-notes/2026-07-21-agent-scaffold-hardening.md +0 -75
  246. package/reference/claude-config/sync-notes/2026-07-23-agent-session-memory.md +0 -49
  247. package/reference/claude-config/sync-notes/2026-07-23-workos-org-marker.md +0 -50
  248. package/reference/claude-config/sync-notes/2026-07-24-claude-5-models-and-session-surface-fixes.md +0 -116
  249. package/reference/claude-config/sync-notes/2026-07-27-agent-strict-output-and-turn-drift.md +0 -73
  250. package/reference/claude-config/sync-notes/2026-07-28-agent-reply-is-its-own-field.md +0 -84
  251. package/reference/claude-config/sync-notes/2026-07-30-login-screen-and-member-provisioning-state.md +0 -114
  252. package/reference/claude-config/sync-notes/2026-08-02-auth-guard-defaults-and-truncation-fix.md +0 -122
  253. package/reference/claude-config/sync-notes/2026-08-03-agent-prose-escape-normalization.md +0 -88
  254. package/reference/claude-config/sync-notes/2026-08-03-cli-gateway-errors-and-request-timeout.md +0 -120
  255. package/reference/claude-config/sync-notes/README.md +0 -43
  256. package/reference/sdk/framework/interaction-guidance.mdx +0 -182
  257. package/reference/sdk/framework/memory.mdx +0 -326
  258. package/reference/sdk/framework/resource-documentation.mdx +0 -90
  259. package/reference/sdk/roadmap.mdx +0 -164
@@ -226,6 +226,31 @@ interface AgentScopedLogger {
226
226
  lifecycle(lifecycle: AgentLifecycle, stage: 'failed', data: AgentLifecycleFailedData): void;
227
227
  reasoning(output: string, iteration: number, startTime: number, endTime: number, duration: number): void;
228
228
  action(actionType: string, message: string, iteration: number, startTime: number, endTime: number, duration: number): void;
229
+ /**
230
+ * Time a unit of work and emit the single `action` event it produces.
231
+ *
232
+ * Captures `Date.now()` immediately before and after `work()`, then emits the same event
233
+ * `action()` would -- collapsing the repeated `startTime = Date.now(); ...work...; endTime =
234
+ * Date.now(); action(actionType, message, iteration, startTime, endTime, endTime - startTime)`
235
+ * boilerplate found at memory-write and tool-result call sites into a single call.
236
+ *
237
+ * `actionType` may be a function of the work's result for the rare call site where the emitted
238
+ * type itself depends on the outcome (e.g. "deleted" vs "delete of a missing key") -- most
239
+ * callers just pass a fixed string.
240
+ *
241
+ * **Throw behavior:** if `work` throws synchronously or its promise rejects, the error propagates
242
+ * to the caller UNCHANGED and NO `action` event is emitted -- there is no completed unit of work
243
+ * to describe, so this deliberately does not swallow the error or log a synthetic failure action.
244
+ * A call site that needs an error-path log keeps calling `action()` manually from its own
245
+ * `catch` block.
246
+ *
247
+ * @param actionType - Action type string, or a function deriving it from the result
248
+ * @param iteration - Current iteration number
249
+ * @param work - The unit of work to time (sync or async)
250
+ * @param message - Builds the human-readable message from the work's result
251
+ * @returns The value returned by `work`
252
+ */
253
+ timed<T>(actionType: string | ((result: T) => string), iteration: number, work: () => Promise<T> | T, message: (result: T) => string): Promise<T>;
229
254
  toolCall(toolName: string, iteration: number, startTime: number, endTime: number, duration: number, success: boolean, error?: string, input?: unknown, output?: unknown): void;
230
255
  }
231
256
 
@@ -716,13 +741,6 @@ interface MemoryStatus {
716
741
  storedHistoryPercent: number;
717
742
  historyBudget: number;
718
743
  }
719
- /**
720
- * Memory constraints (optional limits)
721
- */
722
- interface MemoryConstraints {
723
- maxSessionMemoryKeys?: number;
724
- maxMemoryTokens?: number;
725
- }
726
744
 
727
745
  /**
728
746
  * Types for the schema compiler. `compile.ts` walks a `JsonSchema` once, driven entirely by a
@@ -1119,14 +1137,13 @@ declare class MemoryManager {
1119
1137
  private memory;
1120
1138
  private constraints;
1121
1139
  private logger?;
1122
- private cachedSnapshot?;
1123
1140
  /**
1124
1141
  * Rolling correction for `estimateTokens`'s bias, learned from real provider usage.
1125
1142
  * `undefined` until the first `recordActualUsage` call -- the cold-start state, where
1126
1143
  * `estimate()` returns the raw `estimateTokens` output unscaled. See `recordActualUsage`.
1127
1144
  */
1128
1145
  private tokenCorrectionFactor?;
1129
- constructor(memory: AgentMemory, constraints?: MemoryConstraints, logger?: AgentScopedLogger | undefined);
1146
+ constructor(memory: AgentMemory, constraints?: AgentConstraints, logger?: AgentScopedLogger | undefined);
1130
1147
  /**
1131
1148
  * Record how far `estimateTokens` was from reality on a real provider call, and roll it into a
1132
1149
  * correction applied to every estimate this instance makes from here on -- `getStatus`'s three
@@ -1221,17 +1238,14 @@ declare class MemoryManager {
1221
1238
  */
1222
1239
  getStatus(currentTurn?: number): MemoryStatus;
1223
1240
  /**
1224
- * Create memory snapshot for persistence
1225
- * Caches snapshot internally for later retrieval
1241
+ * Create a memory snapshot for persistence.
1242
+ *
1243
+ * Stateless: every call returns a fresh `structuredClone` of the current memory, so the caller
1244
+ * owns caching if it needs to hold onto the result across calls (see `Agent.memorySnapshot`).
1245
+ *
1226
1246
  * @returns Deep copy of current memory state
1227
1247
  */
1228
- toSnapshot(): AgentMemory;
1229
- /**
1230
- * Get cached memory snapshot
1231
- * Returns snapshot created by toSnapshot()
1232
- * @returns Cached snapshot (undefined if toSnapshot() not called yet)
1233
- */
1234
- getSnapshot(): AgentMemory | undefined;
1248
+ snapshot(): AgentMemory;
1235
1249
  /**
1236
1250
  * Build the framework framing and the untrusted data envelope for an LLM call.
1237
1251
  *
@@ -1434,53 +1448,6 @@ type Json = string | number | boolean | null | {
1434
1448
  type Database = {
1435
1449
  public: {
1436
1450
  Tables: {
1437
- acq_artifacts: {
1438
- Row: {
1439
- content: Json;
1440
- created_at: string;
1441
- created_by: string | null;
1442
- id: string;
1443
- kind: string;
1444
- organization_id: string;
1445
- owner_id: string;
1446
- owner_kind: string;
1447
- source_execution_id: string | null;
1448
- version: number;
1449
- };
1450
- Insert: {
1451
- content: Json;
1452
- created_at?: string;
1453
- created_by?: string | null;
1454
- id?: string;
1455
- kind: string;
1456
- organization_id: string;
1457
- owner_id: string;
1458
- owner_kind: string;
1459
- source_execution_id?: string | null;
1460
- version?: number;
1461
- };
1462
- Update: {
1463
- content?: Json;
1464
- created_at?: string;
1465
- created_by?: string | null;
1466
- id?: string;
1467
- kind?: string;
1468
- organization_id?: string;
1469
- owner_id?: string;
1470
- owner_kind?: string;
1471
- source_execution_id?: string | null;
1472
- version?: number;
1473
- };
1474
- Relationships: [
1475
- {
1476
- foreignKeyName: "acq_artifacts_organization_id_fkey";
1477
- columns: ["organization_id"];
1478
- isOneToOne: false;
1479
- referencedRelation: "organizations";
1480
- referencedColumns: ["id"];
1481
- }
1482
- ];
1483
- };
1484
1451
  acq_companies: {
1485
1452
  Row: {
1486
1453
  batch_id: string | null;
@@ -1692,122 +1659,6 @@ type Database = {
1692
1659
  }
1693
1660
  ];
1694
1661
  };
1695
- acq_content: {
1696
- Row: {
1697
- body: string | null;
1698
- created_at: string;
1699
- id: string;
1700
- organization_id: string;
1701
- pillar: string;
1702
- status: string;
1703
- title: string;
1704
- updated_at: string;
1705
- };
1706
- Insert: {
1707
- body?: string | null;
1708
- created_at?: string;
1709
- id?: string;
1710
- organization_id: string;
1711
- pillar: string;
1712
- status?: string;
1713
- title: string;
1714
- updated_at?: string;
1715
- };
1716
- Update: {
1717
- body?: string | null;
1718
- created_at?: string;
1719
- id?: string;
1720
- organization_id?: string;
1721
- pillar?: string;
1722
- status?: string;
1723
- title?: string;
1724
- updated_at?: string;
1725
- };
1726
- Relationships: [
1727
- {
1728
- foreignKeyName: "acq_content_organization_id_fkey";
1729
- columns: ["organization_id"];
1730
- isOneToOne: false;
1731
- referencedRelation: "organizations";
1732
- referencedColumns: ["id"];
1733
- }
1734
- ];
1735
- };
1736
- acq_content_distributions: {
1737
- Row: {
1738
- adapted_body: string | null;
1739
- checklist: Json | null;
1740
- content_id: string;
1741
- created_at: string;
1742
- format: string;
1743
- id: string;
1744
- media_urls: Json;
1745
- metrics: Json;
1746
- metrics_updated_at: string | null;
1747
- organization_id: string;
1748
- platform: string;
1749
- platform_content: Json | null;
1750
- platform_post_id: string | null;
1751
- platform_url: string | null;
1752
- published_at: string | null;
1753
- status: string;
1754
- updated_at: string;
1755
- };
1756
- Insert: {
1757
- adapted_body?: string | null;
1758
- checklist?: Json | null;
1759
- content_id: string;
1760
- created_at?: string;
1761
- format: string;
1762
- id?: string;
1763
- media_urls?: Json;
1764
- metrics?: Json;
1765
- metrics_updated_at?: string | null;
1766
- organization_id: string;
1767
- platform: string;
1768
- platform_content?: Json | null;
1769
- platform_post_id?: string | null;
1770
- platform_url?: string | null;
1771
- published_at?: string | null;
1772
- status?: string;
1773
- updated_at?: string;
1774
- };
1775
- Update: {
1776
- adapted_body?: string | null;
1777
- checklist?: Json | null;
1778
- content_id?: string;
1779
- created_at?: string;
1780
- format?: string;
1781
- id?: string;
1782
- media_urls?: Json;
1783
- metrics?: Json;
1784
- metrics_updated_at?: string | null;
1785
- organization_id?: string;
1786
- platform?: string;
1787
- platform_content?: Json | null;
1788
- platform_post_id?: string | null;
1789
- platform_url?: string | null;
1790
- published_at?: string | null;
1791
- status?: string;
1792
- updated_at?: string;
1793
- };
1794
- Relationships: [
1795
- {
1796
- foreignKeyName: "acq_content_distributions_content_id_fkey";
1797
- columns: ["content_id"];
1798
- isOneToOne: false;
1799
- referencedRelation: "acq_content";
1800
- referencedColumns: ["id"];
1801
- },
1802
- {
1803
- foreignKeyName: "acq_content_distributions_organization_id_fkey";
1804
- columns: ["organization_id"];
1805
- isOneToOne: false;
1806
- referencedRelation: "organizations";
1807
- referencedColumns: ["id"];
1808
- }
1809
- ];
1810
- };
1811
1662
  acq_deal_notes: {
1812
1663
  Row: {
1813
1664
  author_user_id: string | null;
@@ -1837,6 +1688,13 @@ type Database = {
1837
1688
  updated_at?: string;
1838
1689
  };
1839
1690
  Relationships: [
1691
+ {
1692
+ foreignKeyName: "acq_deal_notes_author_user_id_fkey";
1693
+ columns: ["author_user_id"];
1694
+ isOneToOne: false;
1695
+ referencedRelation: "users";
1696
+ referencedColumns: ["id"];
1697
+ },
1840
1698
  {
1841
1699
  foreignKeyName: "acq_deal_notes_deal_id_fkey";
1842
1700
  columns: ["deal_id"];
@@ -1900,6 +1758,27 @@ type Database = {
1900
1758
  updated_at?: string;
1901
1759
  };
1902
1760
  Relationships: [
1761
+ {
1762
+ foreignKeyName: "acq_deal_tasks_assignee_user_id_fkey";
1763
+ columns: ["assignee_user_id"];
1764
+ isOneToOne: false;
1765
+ referencedRelation: "users";
1766
+ referencedColumns: ["id"];
1767
+ },
1768
+ {
1769
+ foreignKeyName: "acq_deal_tasks_completed_by_user_id_fkey";
1770
+ columns: ["completed_by_user_id"];
1771
+ isOneToOne: false;
1772
+ referencedRelation: "users";
1773
+ referencedColumns: ["id"];
1774
+ },
1775
+ {
1776
+ foreignKeyName: "acq_deal_tasks_created_by_user_id_fkey";
1777
+ columns: ["created_by_user_id"];
1778
+ isOneToOne: false;
1779
+ referencedRelation: "users";
1780
+ referencedColumns: ["id"];
1781
+ },
1903
1782
  {
1904
1783
  foreignKeyName: "acq_deal_tasks_deal_id_fkey";
1905
1784
  columns: ["deal_id"];
@@ -2056,6 +1935,13 @@ type Database = {
2056
1935
  referencedRelation: "acq_contacts";
2057
1936
  referencedColumns: ["id"];
2058
1937
  },
1938
+ {
1939
+ foreignKeyName: "acq_deals_discovery_submitted_by_fkey";
1940
+ columns: ["discovery_submitted_by"];
1941
+ isOneToOne: false;
1942
+ referencedRelation: "users";
1943
+ referencedColumns: ["id"];
1944
+ },
2059
1945
  {
2060
1946
  foreignKeyName: "acq_deals_organization_id_fkey";
2061
1947
  columns: ["organization_id"];
@@ -2063,6 +1949,13 @@ type Database = {
2063
1949
  referencedRelation: "organizations";
2064
1950
  referencedColumns: ["id"];
2065
1951
  },
1952
+ {
1953
+ foreignKeyName: "acq_deals_proposal_reviewed_by_fkey";
1954
+ columns: ["proposal_reviewed_by"];
1955
+ isOneToOne: false;
1956
+ referencedRelation: "users";
1957
+ referencedColumns: ["id"];
1958
+ },
2066
1959
  {
2067
1960
  foreignKeyName: "acq_deals_source_list_id_fkey";
2068
1961
  columns: ["source_list_id"];
@@ -2116,6 +2009,13 @@ type Database = {
2116
2009
  state_key?: string;
2117
2010
  };
2118
2011
  Relationships: [
2012
+ {
2013
+ foreignKeyName: "acq_list_companies_added_by_fkey";
2014
+ columns: ["added_by"];
2015
+ isOneToOne: false;
2016
+ referencedRelation: "users";
2017
+ referencedColumns: ["id"];
2018
+ },
2119
2019
  {
2120
2020
  foreignKeyName: "acq_list_companies_company_id_fkey";
2121
2021
  columns: ["company_id"];
@@ -2222,6 +2122,13 @@ type Database = {
2222
2122
  state_key?: string;
2223
2123
  };
2224
2124
  Relationships: [
2125
+ {
2126
+ foreignKeyName: "acq_list_members_added_by_fkey";
2127
+ columns: ["added_by"];
2128
+ isOneToOne: false;
2129
+ referencedRelation: "users";
2130
+ referencedColumns: ["id"];
2131
+ },
2225
2132
  {
2226
2133
  foreignKeyName: "acq_list_members_contact_id_fkey";
2227
2134
  columns: ["contact_id"];
@@ -2622,6 +2529,13 @@ type Database = {
2622
2529
  title?: string;
2623
2530
  };
2624
2531
  Relationships: [
2532
+ {
2533
+ foreignKeyName: "activities_actor_id_fkey";
2534
+ columns: ["actor_id"];
2535
+ isOneToOne: false;
2536
+ referencedRelation: "users";
2537
+ referencedColumns: ["id"];
2538
+ },
2625
2539
  {
2626
2540
  foreignKeyName: "activities_organization_id_fkey";
2627
2541
  columns: ["organization_id"];
@@ -2734,6 +2648,62 @@ type Database = {
2734
2648
  }
2735
2649
  ];
2736
2650
  };
2651
+ artifacts: {
2652
+ Row: {
2653
+ content: Json;
2654
+ created_at: string;
2655
+ created_by: string | null;
2656
+ id: string;
2657
+ is_active: boolean;
2658
+ kind: string;
2659
+ organization_id: string;
2660
+ owner_id: string | null;
2661
+ owner_kind: string;
2662
+ pipeline_id: string | null;
2663
+ source_execution_id: string | null;
2664
+ updated_at: string;
2665
+ version: number;
2666
+ };
2667
+ Insert: {
2668
+ content: Json;
2669
+ created_at?: string;
2670
+ created_by?: string | null;
2671
+ id?: string;
2672
+ is_active?: boolean;
2673
+ kind: string;
2674
+ organization_id: string;
2675
+ owner_id?: string | null;
2676
+ owner_kind: string;
2677
+ pipeline_id?: string | null;
2678
+ source_execution_id?: string | null;
2679
+ updated_at?: string;
2680
+ version?: number;
2681
+ };
2682
+ Update: {
2683
+ content?: Json;
2684
+ created_at?: string;
2685
+ created_by?: string | null;
2686
+ id?: string;
2687
+ is_active?: boolean;
2688
+ kind?: string;
2689
+ organization_id?: string;
2690
+ owner_id?: string | null;
2691
+ owner_kind?: string;
2692
+ pipeline_id?: string | null;
2693
+ source_execution_id?: string | null;
2694
+ updated_at?: string;
2695
+ version?: number;
2696
+ };
2697
+ Relationships: [
2698
+ {
2699
+ foreignKeyName: "artifacts_organization_id_fkey";
2700
+ columns: ["organization_id"];
2701
+ isOneToOne: false;
2702
+ referencedRelation: "organizations";
2703
+ referencedColumns: ["id"];
2704
+ }
2705
+ ];
2706
+ };
2737
2707
  clients: {
2738
2708
  Row: {
2739
2709
  converted_at: string | null;
@@ -2779,129 +2749,434 @@ type Database = {
2779
2749
  };
2780
2750
  Relationships: [
2781
2751
  {
2782
- foreignKeyName: "clients_organization_id_fkey";
2752
+ foreignKeyName: "clients_organization_id_fkey";
2753
+ columns: ["organization_id"];
2754
+ isOneToOne: false;
2755
+ referencedRelation: "organizations";
2756
+ referencedColumns: ["id"];
2757
+ },
2758
+ {
2759
+ foreignKeyName: "clients_primary_company_id_fkey";
2760
+ columns: ["primary_company_id"];
2761
+ isOneToOne: false;
2762
+ referencedRelation: "acq_companies";
2763
+ referencedColumns: ["id"];
2764
+ },
2765
+ {
2766
+ foreignKeyName: "clients_primary_contact_id_fkey";
2767
+ columns: ["primary_contact_id"];
2768
+ isOneToOne: false;
2769
+ referencedRelation: "acq_contacts";
2770
+ referencedColumns: ["id"];
2771
+ },
2772
+ {
2773
+ foreignKeyName: "clients_source_deal_id_fkey";
2774
+ columns: ["source_deal_id"];
2775
+ isOneToOne: false;
2776
+ referencedRelation: "acq_deals";
2777
+ referencedColumns: ["id"];
2778
+ }
2779
+ ];
2780
+ };
2781
+ command_queue: {
2782
+ Row: {
2783
+ action_payload: Json | null;
2784
+ actions: Json;
2785
+ completed_at: string | null;
2786
+ completed_by: string | null;
2787
+ context: Json;
2788
+ created_at: string;
2789
+ description: string | null;
2790
+ expires_at: string | null;
2791
+ human_checkpoint: string | null;
2792
+ id: string;
2793
+ idempotency_key: string | null;
2794
+ metadata: Json | null;
2795
+ organization_id: string;
2796
+ origin_execution_id: string;
2797
+ origin_resource_id: string;
2798
+ origin_resource_type: string;
2799
+ priority: number;
2800
+ selected_action: string | null;
2801
+ status: string;
2802
+ target_execution_id: string | null;
2803
+ target_resource_id: string | null;
2804
+ target_resource_type: string | null;
2805
+ };
2806
+ Insert: {
2807
+ action_payload?: Json | null;
2808
+ actions: Json;
2809
+ completed_at?: string | null;
2810
+ completed_by?: string | null;
2811
+ context: Json;
2812
+ created_at?: string;
2813
+ description?: string | null;
2814
+ expires_at?: string | null;
2815
+ human_checkpoint?: string | null;
2816
+ id?: string;
2817
+ idempotency_key?: string | null;
2818
+ metadata?: Json | null;
2819
+ organization_id: string;
2820
+ origin_execution_id: string;
2821
+ origin_resource_id: string;
2822
+ origin_resource_type: string;
2823
+ priority?: number;
2824
+ selected_action?: string | null;
2825
+ status?: string;
2826
+ target_execution_id?: string | null;
2827
+ target_resource_id?: string | null;
2828
+ target_resource_type?: string | null;
2829
+ };
2830
+ Update: {
2831
+ action_payload?: Json | null;
2832
+ actions?: Json;
2833
+ completed_at?: string | null;
2834
+ completed_by?: string | null;
2835
+ context?: Json;
2836
+ created_at?: string;
2837
+ description?: string | null;
2838
+ expires_at?: string | null;
2839
+ human_checkpoint?: string | null;
2840
+ id?: string;
2841
+ idempotency_key?: string | null;
2842
+ metadata?: Json | null;
2843
+ organization_id?: string;
2844
+ origin_execution_id?: string;
2845
+ origin_resource_id?: string;
2846
+ origin_resource_type?: string;
2847
+ priority?: number;
2848
+ selected_action?: string | null;
2849
+ status?: string;
2850
+ target_execution_id?: string | null;
2851
+ target_resource_id?: string | null;
2852
+ target_resource_type?: string | null;
2853
+ };
2854
+ Relationships: [
2855
+ {
2856
+ foreignKeyName: "command_queue_completed_by_fkey";
2857
+ columns: ["completed_by"];
2858
+ isOneToOne: false;
2859
+ referencedRelation: "users";
2860
+ referencedColumns: ["id"];
2861
+ },
2862
+ {
2863
+ foreignKeyName: "command_queue_organization_id_fkey";
2864
+ columns: ["organization_id"];
2865
+ isOneToOne: false;
2866
+ referencedRelation: "organizations";
2867
+ referencedColumns: ["id"];
2868
+ },
2869
+ {
2870
+ foreignKeyName: "command_queue_target_execution_id_fkey";
2871
+ columns: ["target_execution_id"];
2872
+ isOneToOne: false;
2873
+ referencedRelation: "execution_logs";
2874
+ referencedColumns: ["execution_id"];
2875
+ }
2876
+ ];
2877
+ };
2878
+ content_distributions: {
2879
+ Row: {
2880
+ adapted_body: string | null;
2881
+ checklist: Json | null;
2882
+ content_item_id: string;
2883
+ created_at: string;
2884
+ format: string;
2885
+ id: string;
2886
+ media_urls: Json;
2887
+ metrics: Json;
2888
+ metrics_updated_at: string | null;
2889
+ organization_id: string;
2890
+ platform: string;
2891
+ platform_content: Json | null;
2892
+ platform_post_id: string | null;
2893
+ platform_url: string | null;
2894
+ processing_state: Json;
2895
+ publish_method: string | null;
2896
+ published_at: string | null;
2897
+ status: string;
2898
+ updated_at: string;
2899
+ };
2900
+ Insert: {
2901
+ adapted_body?: string | null;
2902
+ checklist?: Json | null;
2903
+ content_item_id: string;
2904
+ created_at?: string;
2905
+ format: string;
2906
+ id?: string;
2907
+ media_urls?: Json;
2908
+ metrics?: Json;
2909
+ metrics_updated_at?: string | null;
2910
+ organization_id: string;
2911
+ platform: string;
2912
+ platform_content?: Json | null;
2913
+ platform_post_id?: string | null;
2914
+ platform_url?: string | null;
2915
+ processing_state?: Json;
2916
+ publish_method?: string | null;
2917
+ published_at?: string | null;
2918
+ status?: string;
2919
+ updated_at?: string;
2920
+ };
2921
+ Update: {
2922
+ adapted_body?: string | null;
2923
+ checklist?: Json | null;
2924
+ content_item_id?: string;
2925
+ created_at?: string;
2926
+ format?: string;
2927
+ id?: string;
2928
+ media_urls?: Json;
2929
+ metrics?: Json;
2930
+ metrics_updated_at?: string | null;
2931
+ organization_id?: string;
2932
+ platform?: string;
2933
+ platform_content?: Json | null;
2934
+ platform_post_id?: string | null;
2935
+ platform_url?: string | null;
2936
+ processing_state?: Json;
2937
+ publish_method?: string | null;
2938
+ published_at?: string | null;
2939
+ status?: string;
2940
+ updated_at?: string;
2941
+ };
2942
+ Relationships: [
2943
+ {
2944
+ foreignKeyName: "content_distributions_content_item_id_fkey";
2945
+ columns: ["content_item_id"];
2946
+ isOneToOne: false;
2947
+ referencedRelation: "content_items";
2948
+ referencedColumns: ["id"];
2949
+ },
2950
+ {
2951
+ foreignKeyName: "content_distributions_organization_id_fkey";
2952
+ columns: ["organization_id"];
2953
+ isOneToOne: false;
2954
+ referencedRelation: "organizations";
2955
+ referencedColumns: ["id"];
2956
+ }
2957
+ ];
2958
+ };
2959
+ content_item_attempts: {
2960
+ Row: {
2961
+ attempt_number: number;
2962
+ content_item_id: string;
2963
+ created_at: string;
2964
+ created_by: string | null;
2965
+ id: string;
2966
+ organization_id: string;
2967
+ payload: Json;
2968
+ source_execution_id: string | null;
2969
+ step_key: string | null;
2970
+ };
2971
+ Insert: {
2972
+ attempt_number: number;
2973
+ content_item_id: string;
2974
+ created_at?: string;
2975
+ created_by?: string | null;
2976
+ id?: string;
2977
+ organization_id: string;
2978
+ payload?: Json;
2979
+ source_execution_id?: string | null;
2980
+ step_key?: string | null;
2981
+ };
2982
+ Update: {
2983
+ attempt_number?: number;
2984
+ content_item_id?: string;
2985
+ created_at?: string;
2986
+ created_by?: string | null;
2987
+ id?: string;
2988
+ organization_id?: string;
2989
+ payload?: Json;
2990
+ source_execution_id?: string | null;
2991
+ step_key?: string | null;
2992
+ };
2993
+ Relationships: [
2994
+ {
2995
+ foreignKeyName: "content_item_attempts_content_item_id_fkey";
2996
+ columns: ["content_item_id"];
2997
+ isOneToOne: false;
2998
+ referencedRelation: "content_items";
2999
+ referencedColumns: ["id"];
3000
+ },
3001
+ {
3002
+ foreignKeyName: "content_item_attempts_created_by_fkey";
3003
+ columns: ["created_by"];
3004
+ isOneToOne: false;
3005
+ referencedRelation: "users";
3006
+ referencedColumns: ["id"];
3007
+ },
3008
+ {
3009
+ foreignKeyName: "content_item_attempts_organization_id_fkey";
3010
+ columns: ["organization_id"];
3011
+ isOneToOne: false;
3012
+ referencedRelation: "organizations";
3013
+ referencedColumns: ["id"];
3014
+ },
3015
+ {
3016
+ foreignKeyName: "content_item_attempts_source_execution_id_fkey";
3017
+ columns: ["source_execution_id"];
3018
+ isOneToOne: false;
3019
+ referencedRelation: "execution_logs";
3020
+ referencedColumns: ["execution_id"];
3021
+ }
3022
+ ];
3023
+ };
3024
+ content_items: {
3025
+ Row: {
3026
+ body: string | null;
3027
+ client_id: string | null;
3028
+ created_at: string;
3029
+ created_by: string | null;
3030
+ id: string;
3031
+ organization_id: string;
3032
+ payload: Json;
3033
+ pillar: string | null;
3034
+ pipeline_id: string | null;
3035
+ processing_state: Json;
3036
+ reject_reason: string | null;
3037
+ reviewed_at: string | null;
3038
+ reviewed_by: string | null;
3039
+ reviewer_feedback: string | null;
3040
+ source_asset_id: string | null;
3041
+ status: string;
3042
+ title: string;
3043
+ updated_at: string;
3044
+ updated_by: string | null;
3045
+ };
3046
+ Insert: {
3047
+ body?: string | null;
3048
+ client_id?: string | null;
3049
+ created_at?: string;
3050
+ created_by?: string | null;
3051
+ id?: string;
3052
+ organization_id: string;
3053
+ payload?: Json;
3054
+ pillar?: string | null;
3055
+ pipeline_id?: string | null;
3056
+ processing_state?: Json;
3057
+ reject_reason?: string | null;
3058
+ reviewed_at?: string | null;
3059
+ reviewed_by?: string | null;
3060
+ reviewer_feedback?: string | null;
3061
+ source_asset_id?: string | null;
3062
+ status?: string;
3063
+ title: string;
3064
+ updated_at?: string;
3065
+ updated_by?: string | null;
3066
+ };
3067
+ Update: {
3068
+ body?: string | null;
3069
+ client_id?: string | null;
3070
+ created_at?: string;
3071
+ created_by?: string | null;
3072
+ id?: string;
3073
+ organization_id?: string;
3074
+ payload?: Json;
3075
+ pillar?: string | null;
3076
+ pipeline_id?: string | null;
3077
+ processing_state?: Json;
3078
+ reject_reason?: string | null;
3079
+ reviewed_at?: string | null;
3080
+ reviewed_by?: string | null;
3081
+ reviewer_feedback?: string | null;
3082
+ source_asset_id?: string | null;
3083
+ status?: string;
3084
+ title?: string;
3085
+ updated_at?: string;
3086
+ updated_by?: string | null;
3087
+ };
3088
+ Relationships: [
3089
+ {
3090
+ foreignKeyName: "content_items_client_id_fkey";
3091
+ columns: ["client_id"];
3092
+ isOneToOne: false;
3093
+ referencedRelation: "clients";
3094
+ referencedColumns: ["id"];
3095
+ },
3096
+ {
3097
+ foreignKeyName: "content_items_created_by_fkey";
3098
+ columns: ["created_by"];
3099
+ isOneToOne: false;
3100
+ referencedRelation: "users";
3101
+ referencedColumns: ["id"];
3102
+ },
3103
+ {
3104
+ foreignKeyName: "content_items_organization_id_fkey";
2783
3105
  columns: ["organization_id"];
2784
3106
  isOneToOne: false;
2785
3107
  referencedRelation: "organizations";
2786
3108
  referencedColumns: ["id"];
2787
3109
  },
2788
3110
  {
2789
- foreignKeyName: "clients_primary_company_id_fkey";
2790
- columns: ["primary_company_id"];
3111
+ foreignKeyName: "content_items_reviewed_by_fkey";
3112
+ columns: ["reviewed_by"];
2791
3113
  isOneToOne: false;
2792
- referencedRelation: "acq_companies";
3114
+ referencedRelation: "users";
2793
3115
  referencedColumns: ["id"];
2794
3116
  },
2795
3117
  {
2796
- foreignKeyName: "clients_primary_contact_id_fkey";
2797
- columns: ["primary_contact_id"];
3118
+ foreignKeyName: "content_items_source_asset_id_fkey";
3119
+ columns: ["source_asset_id"];
2798
3120
  isOneToOne: false;
2799
- referencedRelation: "acq_contacts";
3121
+ referencedRelation: "content_source_assets";
2800
3122
  referencedColumns: ["id"];
2801
3123
  },
2802
3124
  {
2803
- foreignKeyName: "clients_source_deal_id_fkey";
2804
- columns: ["source_deal_id"];
3125
+ foreignKeyName: "content_items_updated_by_fkey";
3126
+ columns: ["updated_by"];
2805
3127
  isOneToOne: false;
2806
- referencedRelation: "acq_deals";
3128
+ referencedRelation: "users";
2807
3129
  referencedColumns: ["id"];
2808
3130
  }
2809
3131
  ];
2810
3132
  };
2811
- command_queue: {
3133
+ content_source_assets: {
2812
3134
  Row: {
2813
- action_payload: Json | null;
2814
- actions: Json;
2815
- completed_at: string | null;
2816
- completed_by: string | null;
2817
- context: Json;
2818
3135
  created_at: string;
2819
- description: string | null;
2820
- expires_at: string | null;
2821
- human_checkpoint: string | null;
3136
+ duration_seconds: number | null;
3137
+ external_url: string | null;
2822
3138
  id: string;
2823
- idempotency_key: string | null;
2824
- metadata: Json | null;
3139
+ kind: string;
3140
+ metadata: Json;
2825
3141
  organization_id: string;
2826
- origin_execution_id: string;
2827
- origin_resource_id: string;
2828
- origin_resource_type: string;
2829
- priority: number;
2830
- selected_action: string | null;
2831
- status: string;
2832
- target_execution_id: string | null;
2833
- target_resource_id: string | null;
2834
- target_resource_type: string | null;
3142
+ processing_state: Json;
3143
+ storage_path: string | null;
3144
+ title: string;
3145
+ updated_at: string;
2835
3146
  };
2836
3147
  Insert: {
2837
- action_payload?: Json | null;
2838
- actions: Json;
2839
- completed_at?: string | null;
2840
- completed_by?: string | null;
2841
- context: Json;
2842
3148
  created_at?: string;
2843
- description?: string | null;
2844
- expires_at?: string | null;
2845
- human_checkpoint?: string | null;
3149
+ duration_seconds?: number | null;
3150
+ external_url?: string | null;
2846
3151
  id?: string;
2847
- idempotency_key?: string | null;
2848
- metadata?: Json | null;
3152
+ kind: string;
3153
+ metadata?: Json;
2849
3154
  organization_id: string;
2850
- origin_execution_id: string;
2851
- origin_resource_id: string;
2852
- origin_resource_type: string;
2853
- priority?: number;
2854
- selected_action?: string | null;
2855
- status?: string;
2856
- target_execution_id?: string | null;
2857
- target_resource_id?: string | null;
2858
- target_resource_type?: string | null;
3155
+ processing_state?: Json;
3156
+ storage_path?: string | null;
3157
+ title: string;
3158
+ updated_at?: string;
2859
3159
  };
2860
3160
  Update: {
2861
- action_payload?: Json | null;
2862
- actions?: Json;
2863
- completed_at?: string | null;
2864
- completed_by?: string | null;
2865
- context?: Json;
2866
3161
  created_at?: string;
2867
- description?: string | null;
2868
- expires_at?: string | null;
2869
- human_checkpoint?: string | null;
3162
+ duration_seconds?: number | null;
3163
+ external_url?: string | null;
2870
3164
  id?: string;
2871
- idempotency_key?: string | null;
2872
- metadata?: Json | null;
3165
+ kind?: string;
3166
+ metadata?: Json;
2873
3167
  organization_id?: string;
2874
- origin_execution_id?: string;
2875
- origin_resource_id?: string;
2876
- origin_resource_type?: string;
2877
- priority?: number;
2878
- selected_action?: string | null;
2879
- status?: string;
2880
- target_execution_id?: string | null;
2881
- target_resource_id?: string | null;
2882
- target_resource_type?: string | null;
3168
+ processing_state?: Json;
3169
+ storage_path?: string | null;
3170
+ title?: string;
3171
+ updated_at?: string;
2883
3172
  };
2884
3173
  Relationships: [
2885
3174
  {
2886
- foreignKeyName: "command_queue_completed_by_fkey";
2887
- columns: ["completed_by"];
2888
- isOneToOne: false;
2889
- referencedRelation: "users";
2890
- referencedColumns: ["id"];
2891
- },
2892
- {
2893
- foreignKeyName: "command_queue_organization_id_fkey";
3175
+ foreignKeyName: "content_source_assets_organization_id_fkey";
2894
3176
  columns: ["organization_id"];
2895
3177
  isOneToOne: false;
2896
3178
  referencedRelation: "organizations";
2897
3179
  referencedColumns: ["id"];
2898
- },
2899
- {
2900
- foreignKeyName: "command_queue_target_execution_id_fkey";
2901
- columns: ["target_execution_id"];
2902
- isOneToOne: false;
2903
- referencedRelation: "execution_logs";
2904
- referencedColumns: ["execution_id"];
2905
3180
  }
2906
3181
  ];
2907
3182
  };
@@ -4521,6 +4796,33 @@ type Database = {
4521
4796
  };
4522
4797
  Returns: boolean;
4523
4798
  };
4799
+ create_artifact_version: {
4800
+ Args: {
4801
+ p_content: Json;
4802
+ p_created_by?: string;
4803
+ p_kind: string;
4804
+ p_organization_id: string;
4805
+ p_owner_id?: string;
4806
+ p_owner_kind: string;
4807
+ p_pipeline_id?: string;
4808
+ p_source_execution_id?: string;
4809
+ };
4810
+ Returns: {
4811
+ content: Json;
4812
+ created_at: string;
4813
+ created_by: string | null;
4814
+ id: string;
4815
+ is_active: boolean;
4816
+ kind: string;
4817
+ organization_id: string;
4818
+ owner_id: string | null;
4819
+ owner_kind: string;
4820
+ pipeline_id: string | null;
4821
+ source_execution_id: string | null;
4822
+ updated_at: string;
4823
+ version: number;
4824
+ };
4825
+ };
4524
4826
  current_user_is_platform_admin: {
4525
4827
  Args: Record<PropertyKey, never>;
4526
4828
  Returns: boolean;
@@ -4535,10 +4837,6 @@ type Database = {
4535
4837
  Args: Record<PropertyKey, never>;
4536
4838
  Returns: string;
4537
4839
  };
4538
- detect_stalled_executions: {
4539
- Args: Record<PropertyKey, never>;
4540
- Returns: undefined;
4541
- };
4542
4840
  execute_session_turn: {
4543
4841
  Args: {
4544
4842
  p_session_id: string;
@@ -4631,6 +4929,12 @@ type Database = {
4631
4929
  Args: Record<PropertyKey, never>;
4632
4930
  Returns: Json;
4633
4931
  };
4932
+ purge_stale_test_data: {
4933
+ Args: {
4934
+ p_max_age?: unknown;
4935
+ };
4936
+ Returns: Json;
4937
+ };
4634
4938
  recompute_all_memberships: {
4635
4939
  Args: Record<PropertyKey, never>;
4636
4940
  Returns: undefined;
@@ -5151,6 +5455,31 @@ declare const DataModeSchema: z.ZodEnum<{
5151
5455
  mock: "mock";
5152
5456
  live: "live";
5153
5457
  }>;
5458
+ declare const AcqArtifactOwnerKindSchema: z.ZodEnum<{
5459
+ company: "company";
5460
+ contact: "contact";
5461
+ list: "list";
5462
+ organization: "organization";
5463
+ deal: "deal";
5464
+ list_member: "list_member";
5465
+ }>;
5466
+ declare const AcqArtifactResponseSchema: z.ZodObject<{
5467
+ id: z.ZodString;
5468
+ organizationId: z.ZodString;
5469
+ ownerKind: z.ZodString;
5470
+ ownerId: z.ZodNullable<z.ZodString>;
5471
+ kind: z.ZodString;
5472
+ pipelineId: z.ZodNullable<z.ZodString>;
5473
+ content: z.ZodRecord<z.ZodString, z.ZodUnknown>;
5474
+ sourceExecutionId: z.ZodNullable<z.ZodString>;
5475
+ createdBy: z.ZodNullable<z.ZodString>;
5476
+ createdAt: z.ZodString;
5477
+ updatedAt: z.ZodString;
5478
+ isActive: z.ZodBoolean;
5479
+ version: z.ZodNumber;
5480
+ }, z.core.$strip>;
5481
+ type AcqArtifactOwnerKind = z.infer<typeof AcqArtifactOwnerKindSchema>;
5482
+ type AcqArtifactResponse = z.infer<typeof AcqArtifactResponseSchema>;
5154
5483
  type PipelineStage = z.infer<typeof PipelineStageSchema>;
5155
5484
  type DataMode = z.infer<typeof DataModeSchema>;
5156
5485
  type ProcessingStageStatus = z.infer<typeof ProcessingStageStatusSchema>;
@@ -6140,8 +6469,7 @@ declare const SystemApiInterfaceSchema: z.ZodObject<{
6140
6469
  resourceIds: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
6141
6470
  readinessContract: z.ZodOptional<z.ZodObject<{
6142
6471
  requiredObjects: z.ZodDefault<z.ZodArray<z.ZodString>>;
6143
- requiredCatalogs: z.ZodDefault<z.ZodArray<z.ZodString>>;
6144
- requiredKinds: z.ZodOptional<z.ZodArray<z.ZodString>>;
6472
+ requiredCatalogs: z.ZodArray<z.ZodString>;
6145
6473
  }, z.core.$strict>>;
6146
6474
  }, z.core.$strict>;
6147
6475
  type JsonPrimitive = string | number | boolean | null;
@@ -6160,7 +6488,6 @@ interface SystemEntry {
6160
6488
  path: string;
6161
6489
  surfaces: string[];
6162
6490
  icon?: string;
6163
- order?: number;
6164
6491
  };
6165
6492
  lifecycle?: 'draft' | 'beta' | 'active' | 'deprecated' | 'archived';
6166
6493
  responsibleRoleId?: string;
@@ -6170,17 +6497,12 @@ interface SystemEntry {
6170
6497
  intent: 'exposes' | 'consumes';
6171
6498
  invocation?: unknown;
6172
6499
  }[];
6173
- policies?: string[];
6174
6500
  drivesGoals?: string[];
6175
6501
  apiInterface?: z.infer<typeof SystemApiInterfaceSchema>;
6176
- /** @deprecated Use lifecycle. Accepted for one publish cycle. */
6177
- status?: 'active' | 'deprecated' | 'archived';
6178
6502
  path?: string;
6179
6503
  icon?: string;
6180
6504
  uiPosition?: 'sidebar-primary' | 'sidebar-bottom';
6181
6505
  enabled?: boolean;
6182
- devOnly?: boolean;
6183
- requiresAdmin?: boolean;
6184
6506
  order: number;
6185
6507
  config?: Record<string, JsonValue>;
6186
6508
  ontology?: OntologyScope;
@@ -6303,10 +6625,6 @@ declare const OrganizationModelSchema: z.ZodObject<{
6303
6625
  version: z.ZodDefault<z.ZodLiteral<1>>;
6304
6626
  lastModified: z.ZodString;
6305
6627
  }, z.core.$strip>>;
6306
- policies: z.ZodOptional<z.ZodObject<{
6307
- version: z.ZodDefault<z.ZodLiteral<1>>;
6308
- lastModified: z.ZodString;
6309
- }, z.core.$strip>>;
6310
6628
  knowledge: z.ZodOptional<z.ZodObject<{
6311
6629
  version: z.ZodDefault<z.ZodLiteral<1>>;
6312
6630
  lastModified: z.ZodString;
@@ -6364,10 +6682,6 @@ declare const OrganizationModelSchema: z.ZodObject<{
6364
6682
  version: 1;
6365
6683
  lastModified: string;
6366
6684
  };
6367
- policies: {
6368
- version: 1;
6369
- lastModified: string;
6370
- };
6371
6685
  knowledge: {
6372
6686
  version: 1;
6373
6687
  lastModified: string;
@@ -6425,10 +6739,6 @@ declare const OrganizationModelSchema: z.ZodObject<{
6425
6739
  version: 1;
6426
6740
  lastModified: string;
6427
6741
  } | undefined;
6428
- policies?: {
6429
- version: 1;
6430
- lastModified: string;
6431
- } | undefined;
6432
6742
  knowledge?: {
6433
6743
  version: 1;
6434
6744
  lastModified: string;
@@ -7022,9 +7332,6 @@ declare const OrganizationModelSchema: z.ZodObject<{
7022
7332
  }, z.core.$strip>, z.ZodObject<{
7023
7333
  kind: z.ZodLiteral<"ontology">;
7024
7334
  id: z.ZodString;
7025
- }, z.core.$strip>, z.ZodObject<{
7026
- kind: z.ZodLiteral<"policy">;
7027
- id: z.ZodString;
7028
7335
  }, z.core.$strip>, z.ZodObject<{
7029
7336
  kind: z.ZodLiteral<"role">;
7030
7337
  id: z.ZodString;
@@ -7052,9 +7359,6 @@ declare const OrganizationModelSchema: z.ZodObject<{
7052
7359
  }, z.core.$strip>, z.ZodObject<{
7053
7360
  kind: z.ZodLiteral<"ontology">;
7054
7361
  id: z.ZodString;
7055
- }, z.core.$strip>, z.ZodObject<{
7056
- kind: z.ZodLiteral<"policy">;
7057
- id: z.ZodString;
7058
7362
  }, z.core.$strip>, z.ZodObject<{
7059
7363
  kind: z.ZodLiteral<"role">;
7060
7364
  id: z.ZodString;
@@ -7136,66 +7440,6 @@ declare const OrganizationModelSchema: z.ZodObject<{
7136
7440
  label: z.ZodOptional<z.ZodString>;
7137
7441
  }, z.core.$strip>>>;
7138
7442
  }, z.core.$strip>>>>;
7139
- policies: z.ZodDefault<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
7140
- id: z.ZodString;
7141
- order: z.ZodNumber;
7142
- label: z.ZodString;
7143
- description: z.ZodOptional<z.ZodString>;
7144
- trigger: z.ZodDiscriminatedUnion<[z.ZodObject<{
7145
- kind: z.ZodLiteral<"event">;
7146
- eventId: z.ZodString;
7147
- }, z.core.$strip>, z.ZodObject<{
7148
- kind: z.ZodLiteral<"action-invocation">;
7149
- actionId: z.ZodString;
7150
- }, z.core.$strip>, z.ZodObject<{
7151
- kind: z.ZodLiteral<"schedule">;
7152
- cron: z.ZodString;
7153
- }, z.core.$strip>, z.ZodObject<{
7154
- kind: z.ZodLiteral<"manual">;
7155
- }, z.core.$strip>], "kind">;
7156
- predicate: z.ZodDefault<z.ZodDiscriminatedUnion<[z.ZodObject<{
7157
- kind: z.ZodLiteral<"always">;
7158
- }, z.core.$strip>, z.ZodObject<{
7159
- kind: z.ZodLiteral<"expression">;
7160
- expression: z.ZodString;
7161
- }, z.core.$strip>, z.ZodObject<{
7162
- kind: z.ZodLiteral<"threshold">;
7163
- metric: z.ZodString;
7164
- operator: z.ZodEnum<{
7165
- lt: "lt";
7166
- lte: "lte";
7167
- eq: "eq";
7168
- gte: "gte";
7169
- gt: "gt";
7170
- }>;
7171
- value: z.ZodNumber;
7172
- }, z.core.$strip>], "kind">>;
7173
- actions: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
7174
- kind: z.ZodLiteral<"require-approval">;
7175
- roleId: z.ZodOptional<z.ZodString>;
7176
- }, z.core.$strip>, z.ZodObject<{
7177
- kind: z.ZodLiteral<"invoke-action">;
7178
- actionId: z.ZodString;
7179
- }, z.core.$strip>, z.ZodObject<{
7180
- kind: z.ZodLiteral<"notify-role">;
7181
- roleId: z.ZodString;
7182
- }, z.core.$strip>, z.ZodObject<{
7183
- kind: z.ZodLiteral<"block">;
7184
- }, z.core.$strip>], "kind">>;
7185
- appliesTo: z.ZodDefault<z.ZodObject<{
7186
- systemIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
7187
- actionIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
7188
- resourceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
7189
- roleIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
7190
- }, z.core.$strip>>;
7191
- lifecycle: z.ZodDefault<z.ZodEnum<{
7192
- active: "active";
7193
- deprecated: "deprecated";
7194
- draft: "draft";
7195
- beta: "beta";
7196
- archived: "archived";
7197
- }>>;
7198
- }, z.core.$strip>>>>;
7199
7443
  knowledge: z.ZodDefault<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
7200
7444
  id: z.ZodString;
7201
7445
  kind: z.ZodEnum<{
@@ -9295,6 +9539,154 @@ declare const ProjectSchemas: {
9295
9539
  }, z.core.$strip>;
9296
9540
  };
9297
9541
 
9542
+ /** D18: `pipeline_id` is an OM ontology id (free text), not a UUID. */
9543
+ declare const ContentPipelineIdSchema: z.ZodString;
9544
+ /** `content:catalog/status` entries. Free text, model-owned. */
9545
+ declare const ContentItemStatusSchema: z.ZodString;
9546
+ /** `content:catalog/pillar` entries. */
9547
+ declare const ContentPillarSchema: z.ZodString;
9548
+ /** `content:catalog/platform` entries, applied to `content_distributions.platform` / `.format`. */
9549
+ declare const ContentDistributionPlatformSchema: z.ZodString;
9550
+ declare const ContentDistributionFormatSchema: z.ZodString;
9551
+ declare const ContentDistributionStatusSchema: z.ZodString;
9552
+ /**
9553
+ * D12: the payload gets its own column (`content_items.payload` /
9554
+ * `content_item_attempts.payload`). This is the producer's immutable
9555
+ * emission — never edited; `body` is the human's canonical text and
9556
+ * diverges from it on first edit. The field list within the envelope is
9557
+ * declared per-step by the (not-yet-authored) step catalog; this transport
9558
+ * schema validates JSON-object shape and size only, not field membership.
9559
+ */
9560
+ declare const ContentPayloadEnvelopeSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
9561
+ declare const ContentItemResponseSchema: z.ZodObject<{
9562
+ id: z.ZodString;
9563
+ organizationId: z.ZodString;
9564
+ title: z.ZodString;
9565
+ body: z.ZodNullable<z.ZodString>;
9566
+ payload: z.ZodUnknown;
9567
+ status: z.ZodString;
9568
+ pillar: z.ZodNullable<z.ZodString>;
9569
+ pipelineId: z.ZodNullable<z.ZodString>;
9570
+ clientId: z.ZodNullable<z.ZodString>;
9571
+ sourceAssetId: z.ZodNullable<z.ZodString>;
9572
+ processingState: z.ZodRecord<z.ZodString, z.ZodObject<{
9573
+ status: z.ZodEnum<{
9574
+ error: "error";
9575
+ success: "success";
9576
+ no_result: "no_result";
9577
+ skipped: "skipped";
9578
+ }>;
9579
+ data: z.ZodOptional<z.ZodUnknown>;
9580
+ }, z.core.$loose>>;
9581
+ reviewedAt: z.ZodNullable<z.ZodString>;
9582
+ reviewedBy: z.ZodNullable<z.ZodString>;
9583
+ reviewerFeedback: z.ZodNullable<z.ZodString>;
9584
+ rejectReason: z.ZodNullable<z.ZodString>;
9585
+ createdBy: z.ZodNullable<z.ZodString>;
9586
+ updatedBy: z.ZodNullable<z.ZodString>;
9587
+ createdAt: z.ZodString;
9588
+ updatedAt: z.ZodString;
9589
+ }, z.core.$strip>;
9590
+ declare const ContentItemListResponseSchema: z.ZodObject<{
9591
+ data: z.ZodArray<z.ZodObject<{
9592
+ id: z.ZodString;
9593
+ organizationId: z.ZodString;
9594
+ title: z.ZodString;
9595
+ body: z.ZodNullable<z.ZodString>;
9596
+ payload: z.ZodUnknown;
9597
+ status: z.ZodString;
9598
+ pillar: z.ZodNullable<z.ZodString>;
9599
+ pipelineId: z.ZodNullable<z.ZodString>;
9600
+ clientId: z.ZodNullable<z.ZodString>;
9601
+ sourceAssetId: z.ZodNullable<z.ZodString>;
9602
+ processingState: z.ZodRecord<z.ZodString, z.ZodObject<{
9603
+ status: z.ZodEnum<{
9604
+ error: "error";
9605
+ success: "success";
9606
+ no_result: "no_result";
9607
+ skipped: "skipped";
9608
+ }>;
9609
+ data: z.ZodOptional<z.ZodUnknown>;
9610
+ }, z.core.$loose>>;
9611
+ reviewedAt: z.ZodNullable<z.ZodString>;
9612
+ reviewedBy: z.ZodNullable<z.ZodString>;
9613
+ reviewerFeedback: z.ZodNullable<z.ZodString>;
9614
+ rejectReason: z.ZodNullable<z.ZodString>;
9615
+ createdBy: z.ZodNullable<z.ZodString>;
9616
+ updatedBy: z.ZodNullable<z.ZodString>;
9617
+ createdAt: z.ZodString;
9618
+ updatedAt: z.ZodString;
9619
+ }, z.core.$strip>>;
9620
+ total: z.ZodNumber;
9621
+ limit: z.ZodNumber;
9622
+ offset: z.ZodNumber;
9623
+ }, z.core.$strip>;
9624
+ declare const ContentItemAttemptResponseSchema: z.ZodObject<{
9625
+ id: z.ZodString;
9626
+ organizationId: z.ZodString;
9627
+ contentItemId: z.ZodString;
9628
+ attemptNumber: z.ZodNumber;
9629
+ stepKey: z.ZodNullable<z.ZodString>;
9630
+ payload: z.ZodUnknown;
9631
+ sourceExecutionId: z.ZodNullable<z.ZodString>;
9632
+ createdBy: z.ZodNullable<z.ZodString>;
9633
+ createdAt: z.ZodString;
9634
+ }, z.core.$strip>;
9635
+ declare const ContentItemAttemptListResponseSchema: z.ZodObject<{
9636
+ data: z.ZodArray<z.ZodObject<{
9637
+ id: z.ZodString;
9638
+ organizationId: z.ZodString;
9639
+ contentItemId: z.ZodString;
9640
+ attemptNumber: z.ZodNumber;
9641
+ stepKey: z.ZodNullable<z.ZodString>;
9642
+ payload: z.ZodUnknown;
9643
+ sourceExecutionId: z.ZodNullable<z.ZodString>;
9644
+ createdBy: z.ZodNullable<z.ZodString>;
9645
+ createdAt: z.ZodString;
9646
+ }, z.core.$strip>>;
9647
+ }, z.core.$strip>;
9648
+ declare const ContentDistributionResponseSchema: z.ZodObject<{
9649
+ id: z.ZodString;
9650
+ organizationId: z.ZodString;
9651
+ contentItemId: z.ZodString;
9652
+ platform: z.ZodString;
9653
+ format: z.ZodString;
9654
+ status: z.ZodString;
9655
+ adaptedBody: z.ZodNullable<z.ZodString>;
9656
+ platformContent: z.ZodNullable<z.ZodUnknown>;
9657
+ checklist: z.ZodNullable<z.ZodUnknown>;
9658
+ mediaUrls: z.ZodArray<z.ZodUnknown>;
9659
+ processingState: z.ZodRecord<z.ZodString, z.ZodObject<{
9660
+ status: z.ZodEnum<{
9661
+ error: "error";
9662
+ success: "success";
9663
+ no_result: "no_result";
9664
+ skipped: "skipped";
9665
+ }>;
9666
+ data: z.ZodOptional<z.ZodUnknown>;
9667
+ }, z.core.$loose>>;
9668
+ publishMethod: z.ZodNullable<z.ZodString>;
9669
+ publishedAt: z.ZodNullable<z.ZodString>;
9670
+ platformPostId: z.ZodNullable<z.ZodString>;
9671
+ platformUrl: z.ZodNullable<z.ZodString>;
9672
+ metrics: z.ZodUnknown;
9673
+ metricsUpdatedAt: z.ZodNullable<z.ZodString>;
9674
+ createdAt: z.ZodString;
9675
+ updatedAt: z.ZodString;
9676
+ }, z.core.$strip>;
9677
+ type ContentPipelineId = z.infer<typeof ContentPipelineIdSchema>;
9678
+ type ContentItemStatus = z.infer<typeof ContentItemStatusSchema>;
9679
+ type ContentPillar = z.infer<typeof ContentPillarSchema>;
9680
+ type ContentDistributionPlatform = z.infer<typeof ContentDistributionPlatformSchema>;
9681
+ type ContentDistributionFormat = z.infer<typeof ContentDistributionFormatSchema>;
9682
+ type ContentDistributionStatus = z.infer<typeof ContentDistributionStatusSchema>;
9683
+ type ContentPayloadEnvelope = z.infer<typeof ContentPayloadEnvelopeSchema>;
9684
+ type ContentItemResponse = z.infer<typeof ContentItemResponseSchema>;
9685
+ type ContentItemListResponse = z.infer<typeof ContentItemListResponseSchema>;
9686
+ type ContentItemAttemptResponse = z.infer<typeof ContentItemAttemptResponseSchema>;
9687
+ type ContentItemAttemptListResponse = z.infer<typeof ContentItemAttemptListResponseSchema>;
9688
+ type ContentDistributionResponse = z.infer<typeof ContentDistributionResponseSchema>;
9689
+
9298
9690
  /**
9299
9691
  * Tool Method Maps
9300
9692
  *
@@ -10215,6 +10607,149 @@ type ListToolMap = {
10215
10607
  result: string[];
10216
10608
  };
10217
10609
  };
10610
+ type ArtifactsToolMap = {
10611
+ listArtifacts: {
10612
+ params: {
10613
+ ownerKind: AcqArtifactOwnerKind;
10614
+ ownerId?: string | null;
10615
+ };
10616
+ result: {
10617
+ artifacts: AcqArtifactResponse[];
10618
+ };
10619
+ };
10620
+ createArtifact: {
10621
+ params: {
10622
+ ownerKind: AcqArtifactOwnerKind;
10623
+ ownerId?: string | null;
10624
+ kind: string;
10625
+ content: Record<string, unknown>;
10626
+ sourceExecutionId?: string;
10627
+ pipelineId?: string | null;
10628
+ };
10629
+ result: AcqArtifactResponse;
10630
+ };
10631
+ /**
10632
+ * The active governing document for a given pipeline and kind -- the
10633
+ * two-key lookup (pipeline_id, kind) every producer would otherwise
10634
+ * re-implement. Scoped per (organization, pipelineId, kind); a tenant runs
10635
+ * many pipelines at once, so this is never "the active artifact for the org."
10636
+ */
10637
+ getActive: {
10638
+ params: {
10639
+ pipelineId: string;
10640
+ kind: string;
10641
+ };
10642
+ result: {
10643
+ artifact: AcqArtifactResponse | null;
10644
+ };
10645
+ };
10646
+ };
10647
+ type ContentToolMap = {
10648
+ /** Insert a new `content_items` row -- a producer's entry point for a new piece. */
10649
+ createItem: {
10650
+ params: {
10651
+ title: string;
10652
+ body?: string | null;
10653
+ payload?: ContentPayloadEnvelope;
10654
+ status?: ContentItemStatus;
10655
+ pillar?: ContentPillar | null;
10656
+ pipelineId?: ContentPipelineId | null;
10657
+ clientId?: string | null;
10658
+ sourceAssetId?: string | null;
10659
+ };
10660
+ result: ContentItemResponse;
10661
+ };
10662
+ /** Fetch a single item by id, org-scoped -- read before advancing or reviewing a piece. */
10663
+ getItem: {
10664
+ params: {
10665
+ itemId: string;
10666
+ };
10667
+ result: ContentItemResponse | null;
10668
+ };
10669
+ /** Query items -- how a producer finds pieces awaiting a given step or status. */
10670
+ listItems: {
10671
+ params: {
10672
+ status?: ContentItemStatus;
10673
+ pillar?: ContentPillar;
10674
+ pipelineId?: ContentPipelineId;
10675
+ clientId?: string;
10676
+ limit?: number;
10677
+ offset?: number;
10678
+ };
10679
+ result: ContentItemListResponse;
10680
+ };
10681
+ /**
10682
+ * Update an item's mutable fields as it advances through the pipeline.
10683
+ * Does NOT accept a `processingState` field -- see Decision 4 above.
10684
+ */
10685
+ updateItem: {
10686
+ params: {
10687
+ itemId: string;
10688
+ title?: string;
10689
+ body?: string | null;
10690
+ status?: ContentItemStatus;
10691
+ pillar?: ContentPillar | null;
10692
+ pipelineId?: ContentPipelineId | null;
10693
+ clientId?: string | null;
10694
+ sourceAssetId?: string | null;
10695
+ };
10696
+ result: ContentItemResponse;
10697
+ };
10698
+ /**
10699
+ * Record a pipeline-step attempt against an item. `attemptNumber` is
10700
+ * assigned server-side inside the write (Decision 6) -- never
10701
+ * client-supplied, and never accepted here.
10702
+ */
10703
+ createAttempt: {
10704
+ params: {
10705
+ contentItemId: string;
10706
+ payload: ContentPayloadEnvelope;
10707
+ /** Which step this attempt implements. Stored as-is; NULL when omitted. */
10708
+ stepKey?: string | null;
10709
+ sourceExecutionId?: string | null;
10710
+ };
10711
+ result: ContentItemAttemptResponse;
10712
+ };
10713
+ /** List attempt history for an item -- a producer checks this before retrying a step. */
10714
+ listAttempts: {
10715
+ params: {
10716
+ contentItemId: string;
10717
+ };
10718
+ result: ContentItemAttemptListResponse;
10719
+ };
10720
+ /** Insert a `content_distributions` row for one platform/format target. */
10721
+ createDistribution: {
10722
+ params: {
10723
+ contentItemId: string;
10724
+ platform: ContentDistributionPlatform;
10725
+ format: ContentDistributionFormat;
10726
+ status?: ContentDistributionStatus;
10727
+ adaptedBody?: string | null;
10728
+ platformContent?: unknown;
10729
+ checklist?: unknown;
10730
+ mediaUrls?: unknown[];
10731
+ };
10732
+ result: ContentDistributionResponse;
10733
+ };
10734
+ /** Update a distribution's status, adapted content, or publish metadata. */
10735
+ updateDistribution: {
10736
+ params: {
10737
+ distributionId: string;
10738
+ status?: ContentDistributionStatus;
10739
+ adaptedBody?: string | null;
10740
+ platformContent?: unknown;
10741
+ checklist?: unknown;
10742
+ mediaUrls?: unknown[];
10743
+ publishMethod?: string | null;
10744
+ publishedAt?: string | null;
10745
+ platformPostId?: string | null;
10746
+ platformUrl?: string | null;
10747
+ metrics?: unknown;
10748
+ metricsUpdatedAt?: string | null;
10749
+ };
10750
+ result: ContentDistributionResponse;
10751
+ };
10752
+ };
10218
10753
  type PdfToolMap = {
10219
10754
  render: {
10220
10755
  params: {
@@ -10609,10 +11144,15 @@ interface ResourceMetricsConfig {
10609
11144
  * - API process: provides createLLMAdapter (real SDKs + process.env API keys)
10610
11145
  * - SDK worker: provides PostMessageLLMAdapter (proxies via platform.call)
10611
11146
  *
10612
- * Uses `any` for optional params so both the real createLLMAdapter (with typed
10613
- * AIUsageCollector/AICallContext) and the worker proxy (which ignores them) satisfy the type.
10614
- */
10615
- type LLMAdapterFactory = (config: ModelConfig, ...args: any[]) => LLMAdapter;
11147
+ * Signature mirrors `createLLMAdapter`'s real parameter list. `context` is narrowed to the two
11148
+ * shapes an agent ever actually builds (`processReasoning` passes `AgentReasoningContext`,
11149
+ * `Agent.callLLMForOutput` passes `AgentCompletionContext`) rather than the full `AICallContext`
11150
+ * union `createLLMAdapter` accepts -- a narrower optional param here is still assignable to the
11151
+ * wider one there. `createPostMessageAdapterFactory()`'s worker proxy ignores every param past
11152
+ * `config`; a shorter-arity function remains assignable to a longer optional-param function type,
11153
+ * so it still satisfies this type unchanged.
11154
+ */
11155
+ type LLMAdapterFactory = (config: ModelConfig, aiUsageCollector?: AIUsageCollector, callType?: BaseAICall['callType'], context?: AgentReasoningContext | AgentCompletionContext, organizationId?: string) => LLMAdapter;
10616
11156
  type AgentKind = 'orchestrator' | 'specialist' | 'utility' | 'platform';
10617
11157
  interface AgentConfig extends ResourceDefinition {
10618
11158
  type: 'agent';
@@ -11415,6 +11955,8 @@ declare const mockAcqDb: (overrides?: MockAdapterOverrides<LeadToolMap>) => Type
11415
11955
  declare const mockProjects: (overrides?: MockAdapterOverrides<ProjectsToolMap>) => TypedAdapter<ProjectsToolMap>;
11416
11956
  declare const mockCrm: (overrides?: MockAdapterOverrides<CrmToolMap>) => TypedAdapter<CrmToolMap>;
11417
11957
  declare const mockList: (overrides?: MockAdapterOverrides<ListToolMap>) => TypedAdapter<ListToolMap>;
11958
+ declare const mockArtifacts: (overrides?: MockAdapterOverrides<ArtifactsToolMap>) => TypedAdapter<ArtifactsToolMap>;
11959
+ declare const mockContent: (overrides?: MockAdapterOverrides<ContentToolMap>) => TypedAdapter<ContentToolMap>;
11418
11960
  declare const mockPdf: (overrides?: MockAdapterOverrides<PdfToolMap>) => TypedAdapter<PdfToolMap>;
11419
11961
  declare const mockApproval: (overrides?: MockAdapterOverrides<ApprovalToolMap>) => TypedAdapter<ApprovalToolMap>;
11420
11962
  declare const mockExecution: (overrides?: MockAdapterOverrides<ExecutionToolMap>) => TypedAdapter<ExecutionToolMap>;
@@ -11432,5 +11974,5 @@ declare const createMockStripe: (_credential: string, overrides?: MockAdapterOve
11432
11974
  declare const createMockAnymailfinder: (_credential: string, overrides?: MockAdapterOverrides<AnymailfinderToolMap>) => TypedAdapter<AnymailfinderToolMap>;
11433
11975
  declare const createMockMillionVerifier: (_credential: string, overrides?: MockAdapterOverrides<MillionVerifierToolMap>) => TypedAdapter<MillionVerifierToolMap>;
11434
11976
 
11435
- export { assertResourceRegistry, createMockAnymailfinder, createMockApify, createMockAttio, createMockDropbox, createMockGmail, createMockGoogleSheets, createMockInstantly, createMockMillionVerifier, createMockResend, createMockSignatureApi, createMockStripe, createMockTomba, mockAcqDb, mockApproval, mockCrm, mockEmail, mockExecution, mockList, mockLlm, mockNotifications, mockPdf, mockProjects, mockScheduler, mockStorage, runLinearWorkflow, runWorkflow };
11977
+ export { assertResourceRegistry, createMockAnymailfinder, createMockApify, createMockAttio, createMockDropbox, createMockGmail, createMockGoogleSheets, createMockInstantly, createMockMillionVerifier, createMockResend, createMockSignatureApi, createMockStripe, createMockTomba, mockAcqDb, mockApproval, mockArtifacts, mockContent, mockCrm, mockEmail, mockExecution, mockList, mockLlm, mockNotifications, mockPdf, mockProjects, mockScheduler, mockStorage, runLinearWorkflow, runWorkflow };
11436
11978
  export type { AssertResourceRegistryOptions, LinearWorkflowStepEvent, MockAdapterOverrides, MockLlmAdapter, RunLinearWorkflowContext, RunLinearWorkflowOptions, RunLinearWorkflowResult, RunWorkflowContext, RunWorkflowOptions, RunWorkflowResult, WorkflowStepEvent };