@elevasis/sdk 1.44.3 → 1.45.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 (246) hide show
  1. package/dist/cli.cjs +991 -650
  2. package/dist/index.d.ts +1045 -509
  3. package/dist/index.js +738 -688
  4. package/dist/node/index.d.ts +105 -97
  5. package/dist/test-utils/index.d.ts +42 -28
  6. package/dist/test-utils/index.js +514 -783
  7. package/dist/worker/index.d.ts +12112 -0
  8. package/dist/worker/index.js +121 -182
  9. package/package.json +6 -9
  10. package/reference/_navigation.md +151 -21
  11. package/reference/_reference-manifest.json +186 -4
  12. package/reference/claude-config.md +8 -0
  13. package/reference/core/index.mdx +3 -3
  14. package/reference/examples/organization-model.ts +117 -111
  15. package/reference/index.mdx +4 -4
  16. package/reference/rules/active-change-index.md +40 -54
  17. package/reference/rules/agent-runtime.md +81 -0
  18. package/reference/rules/agent-start-here.md +71 -163
  19. package/reference/rules/deployment.md +33 -10
  20. package/reference/rules/error-handling.md +26 -0
  21. package/reference/rules/execution.md +13 -0
  22. package/reference/rules/frontend.md +10 -3
  23. package/reference/rules/observability.md +9 -1
  24. package/reference/rules/operations.md +26 -17
  25. package/reference/rules/organization-model.md +74 -88
  26. package/reference/rules/organization-os.md +71 -88
  27. package/reference/rules/package-taxonomy.md +11 -2
  28. package/reference/rules/platform.md +13 -7
  29. package/reference/rules/shared-types.md +15 -0
  30. package/reference/rules/task-tracking.md +30 -5
  31. package/reference/rules/ui.md +145 -3
  32. package/reference/rules/vibe-intents.md +271 -0
  33. package/reference/rules/vibe.md +17 -243
  34. package/reference/scaffold/core/organization-graph.mdx +111 -97
  35. package/reference/scaffold/core/organization-model.mdx +234 -214
  36. package/reference/scaffold/operations/propagation-pipeline.md +1 -1
  37. package/reference/scaffold/operations/scaffold-maintenance.md +19 -18
  38. package/reference/scaffold/operations/workflow-recipes.md +71 -19
  39. package/reference/scaffold/recipes/add-a-feature.md +156 -146
  40. package/reference/scaffold/recipes/add-a-resource.md +123 -117
  41. package/reference/scaffold/recipes/customize-crm-actions.md +25 -10
  42. package/reference/scaffold/recipes/customize-knowledge-browser.md +52 -117
  43. package/reference/scaffold/recipes/customize-organization-model.md +161 -149
  44. package/reference/scaffold/recipes/extend-a-base-entity.md +156 -140
  45. package/reference/scaffold/recipes/extend-crm.md +16 -11
  46. package/reference/scaffold/recipes/extend-lead-gen.md +25 -7
  47. package/reference/scaffold/recipes/gate-by-feature-or-admin.md +160 -118
  48. package/reference/scaffold/recipes/index.md +2 -2
  49. package/reference/scaffold/recipes/query-the-knowledge-graph.md +23 -23
  50. package/reference/scaffold/reference/contracts.md +12 -1
  51. package/reference/scaffold/reference/glossary.md +3 -3
  52. package/reference/scaffold/reference/system-interface-capabilities.md +5 -4
  53. package/reference/scaffold/ui/composition-extensibility.mdx +271 -232
  54. package/reference/scaffold/ui/feature-flags-and-gating.md +14 -6
  55. package/reference/scaffold/ui/feature-shell.mdx +279 -62
  56. package/reference/scaffold/ui/recipes.md +229 -197
  57. package/reference/sdk/cli-management.mdx +77 -29
  58. package/reference/sdk/concepts.mdx +2 -0
  59. package/reference/sdk/define-builders.mdx +76 -0
  60. package/reference/sdk/deployment/command-center.mdx +6 -2
  61. package/reference/sdk/deployment/execution-reference.mdx +64 -186
  62. package/reference/sdk/deployment/index.mdx +2 -0
  63. package/reference/sdk/exports.mdx +4 -4
  64. package/reference/sdk/framework/agent.mdx +49 -119
  65. package/reference/sdk/framework/index.mdx +46 -65
  66. package/reference/sdk/framework/project-structure.mdx +150 -205
  67. package/reference/sdk/framework/tutorial-system.mdx +2 -2
  68. package/reference/sdk/human-in-the-loop.mdx +152 -0
  69. package/reference/sdk/index.mdx +6 -7
  70. package/reference/sdk/platform-tools/index.mdx +12 -0
  71. package/reference/sdk/platform-tools/type-safety.mdx +4 -0
  72. package/reference/sdk/project-deployment-spec.mdx +131 -0
  73. package/reference/sdk/resources/index.mdx +21 -7
  74. package/reference/sdk/resources/patterns.mdx +54 -24
  75. package/reference/sdk/resources/types.mdx +7 -4
  76. package/reference/sdk/templates/data-enrichment.mdx +7 -3
  77. package/reference/sdk/templates/email-sender.mdx +139 -135
  78. package/reference/sdk/templates/lead-scorer.mdx +5 -1
  79. package/reference/sdk/templates/pdf-generator.mdx +155 -151
  80. package/reference/sdk/templates/recurring-job.mdx +195 -189
  81. package/reference/sdk/templates/text-classifier.mdx +4 -0
  82. package/reference/sdk/templates/web-scraper.mdx +139 -135
  83. package/reference/spine/spine-primer.md +135 -96
  84. package/reference/ui/index.mdx +14 -7
  85. package/dist/types/worker/adapters/anymailfinder.d.ts +0 -14
  86. package/dist/types/worker/adapters/apify.d.ts +0 -14
  87. package/dist/types/worker/adapters/approval.d.ts +0 -23
  88. package/dist/types/worker/adapters/attio.d.ts +0 -22
  89. package/dist/types/worker/adapters/clickup.d.ts +0 -22
  90. package/dist/types/worker/adapters/create-adapter.d.ts +0 -41
  91. package/dist/types/worker/adapters/crm.d.ts +0 -20
  92. package/dist/types/worker/adapters/dropbox.d.ts +0 -14
  93. package/dist/types/worker/adapters/email.d.ts +0 -25
  94. package/dist/types/worker/adapters/execution.d.ts +0 -22
  95. package/dist/types/worker/adapters/gmail.d.ts +0 -14
  96. package/dist/types/worker/adapters/google-sheets.d.ts +0 -14
  97. package/dist/types/worker/adapters/index.d.ts +0 -33
  98. package/dist/types/worker/adapters/instantly.d.ts +0 -14
  99. package/dist/types/worker/adapters/lead.d.ts +0 -28
  100. package/dist/types/worker/adapters/list.d.ts +0 -9
  101. package/dist/types/worker/adapters/llm.d.ts +0 -45
  102. package/dist/types/worker/adapters/millionverifier.d.ts +0 -14
  103. package/dist/types/worker/adapters/notification.d.ts +0 -28
  104. package/dist/types/worker/adapters/pdf.d.ts +0 -22
  105. package/dist/types/worker/adapters/projects.d.ts +0 -20
  106. package/dist/types/worker/adapters/resend.d.ts +0 -14
  107. package/dist/types/worker/adapters/scheduler.d.ts +0 -25
  108. package/dist/types/worker/adapters/signature-api.d.ts +0 -14
  109. package/dist/types/worker/adapters/storage.d.ts +0 -33
  110. package/dist/types/worker/adapters/stripe.d.ts +0 -14
  111. package/dist/types/worker/adapters/tomba.d.ts +0 -14
  112. package/dist/types/worker/index.d.ts +0 -60
  113. package/dist/types/worker/platform.d.ts +0 -90
  114. package/dist/types/worker/utils.d.ts +0 -9
  115. package/reference/claude-config/Overview.md +0 -230
  116. package/reference/claude-config/hooks/post-edit-validate.mjs +0 -98
  117. package/reference/claude-config/hooks/scaffold-registry-reminder.mjs +0 -187
  118. package/reference/claude-config/hooks/tool-failure-recovery.mjs +0 -73
  119. package/reference/claude-config/registries/graph-skills.json +0 -4
  120. package/reference/claude-config/registries/knowledge-flags.json +0 -154
  121. package/reference/claude-config/registries/skill-coverage.json +0 -20
  122. package/reference/claude-config/rules/active-change-index.md +0 -22
  123. package/reference/claude-config/rules/agent-start-here.md +0 -22
  124. package/reference/claude-config/rules/deployment.md +0 -22
  125. package/reference/claude-config/rules/error-handling.md +0 -22
  126. package/reference/claude-config/rules/execution.md +0 -22
  127. package/reference/claude-config/rules/frontend.md +0 -22
  128. package/reference/claude-config/rules/observability.md +0 -22
  129. package/reference/claude-config/rules/operations.md +0 -22
  130. package/reference/claude-config/rules/organization-model.md +0 -22
  131. package/reference/claude-config/rules/organization-os.md +0 -22
  132. package/reference/claude-config/rules/package-taxonomy.md +0 -22
  133. package/reference/claude-config/rules/platform.md +0 -22
  134. package/reference/claude-config/rules/shared-types.md +0 -22
  135. package/reference/claude-config/rules/task-tracking.md +0 -22
  136. package/reference/claude-config/rules/topbar-actions.md +0 -70
  137. package/reference/claude-config/rules/ui.md +0 -22
  138. package/reference/claude-config/rules/vibe.md +0 -22
  139. package/reference/claude-config/scripts/statusline-command.js +0 -18
  140. package/reference/claude-config/settings.json +0 -30
  141. package/reference/claude-config/skills/client/SKILL.md +0 -201
  142. package/reference/claude-config/skills/deploy/SKILL.md +0 -159
  143. package/reference/claude-config/skills/dsp/SKILL.md +0 -66
  144. package/reference/claude-config/skills/elevasis/SKILL.md +0 -251
  145. package/reference/claude-config/skills/explore/SKILL.md +0 -78
  146. package/reference/claude-config/skills/git-sync/SKILL.md +0 -166
  147. package/reference/claude-config/skills/om/SKILL.md +0 -475
  148. package/reference/claude-config/skills/om/operations/build.md +0 -237
  149. package/reference/claude-config/skills/om/operations/codify-level-a.md +0 -109
  150. package/reference/claude-config/skills/om/operations/codify-level-b.md +0 -159
  151. package/reference/claude-config/skills/om/operations/customers.md +0 -114
  152. package/reference/claude-config/skills/om/operations/features.md +0 -88
  153. package/reference/claude-config/skills/om/operations/goals.md +0 -123
  154. package/reference/claude-config/skills/om/operations/identity.md +0 -97
  155. package/reference/claude-config/skills/om/operations/labels.md +0 -110
  156. package/reference/claude-config/skills/om/operations/offerings.md +0 -114
  157. package/reference/claude-config/skills/om/operations/roles.md +0 -104
  158. package/reference/claude-config/skills/om/operations/scaffold.md +0 -163
  159. package/reference/claude-config/skills/om/operations/techStack.md +0 -38
  160. package/reference/claude-config/skills/project/SKILL.md +0 -1114
  161. package/reference/claude-config/skills/run-ui/SKILL.md +0 -73
  162. package/reference/claude-config/skills/save/SKILL.md +0 -183
  163. package/reference/claude-config/skills/setup/SKILL.md +0 -290
  164. package/reference/claude-config/skills/status/SKILL.md +0 -59
  165. package/reference/claude-config/skills/submit-request/SKILL.md +0 -180
  166. package/reference/claude-config/skills/sync/SKILL.md +0 -47
  167. package/reference/claude-config/skills/tutorial/SKILL.md +0 -259
  168. package/reference/claude-config/skills/tutorial/progress-template.md +0 -74
  169. package/reference/claude-config/skills/tutorial/technical.md +0 -1303
  170. package/reference/claude-config/skills/tutorial/vibe-coder.md +0 -890
  171. package/reference/claude-config/sync-notes/2026-04-22-git-sync-and-sync-notes.md +0 -27
  172. package/reference/claude-config/sync-notes/2026-04-22-lead-gen-deliverability-removal.md +0 -30
  173. package/reference/claude-config/sync-notes/2026-04-24-test-utils-and-template-tests.md +0 -73
  174. package/reference/claude-config/sync-notes/2026-04-24-ui-consolidation-and-sdk-cli-train.md +0 -86
  175. package/reference/claude-config/sync-notes/2026-04-25-auth-role-system-and-settings-roles.md +0 -55
  176. package/reference/claude-config/sync-notes/2026-04-27-crm-hitl-action-layer-cutover.md +0 -97
  177. package/reference/claude-config/sync-notes/2026-04-27-lead-gen-substrate-train.md +0 -112
  178. package/reference/claude-config/sync-notes/2026-04-29-crm-state-and-lead-gen-processing-status.md +0 -93
  179. package/reference/claude-config/sync-notes/2026-05-02-crm-ownership-next-action.md +0 -58
  180. package/reference/claude-config/sync-notes/2026-05-02-template-hardcode-workos-config.md +0 -56
  181. package/reference/claude-config/sync-notes/2026-05-04-elevasis-workspace.md +0 -71
  182. package/reference/claude-config/sync-notes/2026-05-04-knowledge-bundle.md +0 -83
  183. package/reference/claude-config/sync-notes/2026-05-04-template-skills-run-ui-and-tutorial.md +0 -59
  184. package/reference/claude-config/sync-notes/2026-05-05-list-builder.md +0 -42
  185. package/reference/claude-config/sync-notes/2026-05-06-crm-spine.md +0 -60
  186. package/reference/claude-config/sync-notes/2026-05-06-sdk-changes-release-train.md +0 -37
  187. package/reference/claude-config/sync-notes/2026-05-07-sdk-changes-release-train.md +0 -34
  188. package/reference/claude-config/sync-notes/2026-05-08-resource-governance-scaffold-guidance.md +0 -38
  189. package/reference/claude-config/sync-notes/2026-05-09-clients-domain.md +0 -32
  190. package/reference/claude-config/sync-notes/2026-05-09-command-system.md +0 -33
  191. package/reference/claude-config/sync-notes/2026-05-09-resource-governance-and-misc.md +0 -69
  192. package/reference/claude-config/sync-notes/2026-05-12-sdk-ready-release-train.md +0 -30
  193. package/reference/claude-config/sync-notes/2026-05-14-organization-model-ontology-refactor.md +0 -45
  194. package/reference/claude-config/sync-notes/2026-05-15-om-skill-rename-and-write-family.md +0 -52
  195. package/reference/claude-config/sync-notes/2026-05-17-sdk-boundary-consolidation.md +0 -33
  196. package/reference/claude-config/sync-notes/2026-05-20-om-define-helpers.md +0 -32
  197. package/reference/claude-config/sync-notes/2026-05-22-access-model-and-right-panel.md +0 -43
  198. package/reference/claude-config/sync-notes/2026-05-22-lead-gen-tenant-config.md +0 -40
  199. package/reference/claude-config/sync-notes/2026-05-22-org-model-multi-file-split.md +0 -61
  200. package/reference/claude-config/sync-notes/2026-05-23-branding-names-to-identity.md +0 -49
  201. package/reference/claude-config/sync-notes/2026-05-23-lead-gen-manage-access.md +0 -31
  202. package/reference/claude-config/sync-notes/2026-05-23-om-deployment-drift-detection.md +0 -42
  203. package/reference/claude-config/sync-notes/2026-05-23-om-full-model-deploy-contract.md +0 -33
  204. package/reference/claude-config/sync-notes/2026-05-23-ui-sdk-package-fixes.md +0 -37
  205. package/reference/claude-config/sync-notes/2026-05-24-platform-invite-router-core-baseline.md +0 -28
  206. package/reference/claude-config/sync-notes/2026-05-24-system-interface-readiness.md +0 -43
  207. package/reference/claude-config/sync-notes/2026-05-25-invitation-login-loader.md +0 -26
  208. package/reference/claude-config/sync-notes/2026-05-25-om-topbar-requests.md +0 -33
  209. package/reference/claude-config/sync-notes/2026-05-25-system-interface-profile-registry-and-substrate.md +0 -35
  210. package/reference/claude-config/sync-notes/2026-05-25-tenant-om-scaffold-cli.md +0 -49
  211. package/reference/claude-config/sync-notes/2026-05-25-vibe-operate-intent.md +0 -47
  212. package/reference/claude-config/sync-notes/2026-05-28-om-snapshot-sdk-workflow-config.md +0 -33
  213. package/reference/claude-config/sync-notes/2026-05-30-client-source-and-om-profiles.md +0 -39
  214. package/reference/claude-config/sync-notes/2026-06-02-knowledge-nested-group-routing.md +0 -27
  215. package/reference/claude-config/sync-notes/2026-06-02-nest-projects-under-platform.md +0 -45
  216. package/reference/claude-config/sync-notes/2026-06-03-skill-autogen-and-client-skill.md +0 -34
  217. package/reference/claude-config/sync-notes/2026-06-04-scaffold-registry-lane-severity.md +0 -34
  218. package/reference/claude-config/sync-notes/2026-06-05-appearance-app-mode-decouple.md +0 -29
  219. package/reference/claude-config/sync-notes/2026-06-05-ontology-endpoint-rename-and-knowledge-browser-ui.md +0 -86
  220. package/reference/claude-config/sync-notes/2026-06-06-om-build-systems-scaffold.md +0 -47
  221. package/reference/claude-config/sync-notes/2026-06-06-om-item-copy-references.md +0 -50
  222. package/reference/claude-config/sync-notes/2026-06-08-knowledge-base-page-not-found-fix.md +0 -76
  223. package/reference/claude-config/sync-notes/2026-06-09-agent-sessions-public-agent-chat-route.md +0 -75
  224. package/reference/claude-config/sync-notes/2026-06-09-sdk-cli-load-org-model-resolution.md +0 -42
  225. package/reference/claude-config/sync-notes/2026-06-12-agent-grants-visualizer-operations.md +0 -30
  226. package/reference/claude-config/sync-notes/2026-06-14-session-ux-and-project-cli-json.md +0 -33
  227. package/reference/claude-config/sync-notes/2026-06-14-shared-session-conversation-view.md +0 -26
  228. package/reference/claude-config/sync-notes/2026-06-15-session-chat-zero-wiring.md +0 -46
  229. package/reference/claude-config/sync-notes/2026-06-17-agent-session-ux-features.md +0 -34
  230. package/reference/claude-config/sync-notes/2026-06-25-shared-page-scroll-contract-guard.md +0 -52
  231. package/reference/claude-config/sync-notes/2026-06-26-leadgen-overview-om-telemetry.md +0 -47
  232. package/reference/claude-config/sync-notes/2026-07-21-agent-scaffold-hardening.md +0 -75
  233. package/reference/claude-config/sync-notes/2026-07-23-agent-session-memory.md +0 -49
  234. package/reference/claude-config/sync-notes/2026-07-23-workos-org-marker.md +0 -50
  235. package/reference/claude-config/sync-notes/2026-07-24-claude-5-models-and-session-surface-fixes.md +0 -116
  236. package/reference/claude-config/sync-notes/2026-07-27-agent-strict-output-and-turn-drift.md +0 -73
  237. package/reference/claude-config/sync-notes/2026-07-28-agent-reply-is-its-own-field.md +0 -84
  238. package/reference/claude-config/sync-notes/2026-07-30-login-screen-and-member-provisioning-state.md +0 -114
  239. package/reference/claude-config/sync-notes/2026-08-02-auth-guard-defaults-and-truncation-fix.md +0 -122
  240. package/reference/claude-config/sync-notes/2026-08-03-agent-prose-escape-normalization.md +0 -88
  241. package/reference/claude-config/sync-notes/2026-08-03-cli-gateway-errors-and-request-timeout.md +0 -120
  242. package/reference/claude-config/sync-notes/README.md +0 -43
  243. package/reference/sdk/framework/interaction-guidance.mdx +0 -182
  244. package/reference/sdk/framework/memory.mdx +0 -326
  245. package/reference/sdk/framework/resource-documentation.mdx +0 -90
  246. package/reference/sdk/roadmap.mdx +0 -164
package/dist/index.d.ts CHANGED
@@ -289,6 +289,31 @@ interface AgentScopedLogger {
289
289
  lifecycle(lifecycle: AgentLifecycle, stage: 'failed', data: AgentLifecycleFailedData): void;
290
290
  reasoning(output: string, iteration: number, startTime: number, endTime: number, duration: number): void;
291
291
  action(actionType: string, message: string, iteration: number, startTime: number, endTime: number, duration: number): void;
292
+ /**
293
+ * Time a unit of work and emit the single `action` event it produces.
294
+ *
295
+ * Captures `Date.now()` immediately before and after `work()`, then emits the same event
296
+ * `action()` would -- collapsing the repeated `startTime = Date.now(); ...work...; endTime =
297
+ * Date.now(); action(actionType, message, iteration, startTime, endTime, endTime - startTime)`
298
+ * boilerplate found at memory-write and tool-result call sites into a single call.
299
+ *
300
+ * `actionType` may be a function of the work's result for the rare call site where the emitted
301
+ * type itself depends on the outcome (e.g. "deleted" vs "delete of a missing key") -- most
302
+ * callers just pass a fixed string.
303
+ *
304
+ * **Throw behavior:** if `work` throws synchronously or its promise rejects, the error propagates
305
+ * to the caller UNCHANGED and NO `action` event is emitted -- there is no completed unit of work
306
+ * to describe, so this deliberately does not swallow the error or log a synthetic failure action.
307
+ * A call site that needs an error-path log keeps calling `action()` manually from its own
308
+ * `catch` block.
309
+ *
310
+ * @param actionType - Action type string, or a function deriving it from the result
311
+ * @param iteration - Current iteration number
312
+ * @param work - The unit of work to time (sync or async)
313
+ * @param message - Builds the human-readable message from the work's result
314
+ * @returns The value returned by `work`
315
+ */
316
+ timed<T>(actionType: string | ((result: T) => string), iteration: number, work: () => Promise<T> | T, message: (result: T) => string): Promise<T>;
292
317
  toolCall(toolName: string, iteration: number, startTime: number, endTime: number, duration: number, success: boolean, error?: string, input?: unknown, output?: unknown): void;
293
318
  }
294
319
 
@@ -305,7 +330,30 @@ declare const ResourceGovernanceStatusSchema: z.ZodEnum<{
305
330
  deprecated: "deprecated";
306
331
  archived: "archived";
307
332
  }>;
308
- declare const WorkflowResourceEntrySchema$1: z.ZodObject<{
333
+ declare const ResourceOntologyBindingSchema: z.ZodObject<{
334
+ actions: z.ZodOptional<z.ZodArray<z.ZodString>>;
335
+ primaryAction: z.ZodOptional<z.ZodString>;
336
+ reads: z.ZodOptional<z.ZodArray<z.ZodString>>;
337
+ writes: z.ZodOptional<z.ZodArray<z.ZodString>>;
338
+ usesCatalogs: z.ZodOptional<z.ZodArray<z.ZodString>>;
339
+ emits: z.ZodOptional<z.ZodArray<z.ZodString>>;
340
+ contract: z.ZodOptional<z.ZodObject<{
341
+ input: z.ZodOptional<z.ZodString>;
342
+ output: z.ZodOptional<z.ZodString>;
343
+ }, z.core.$strip>>;
344
+ }, z.core.$strip>;
345
+ type OntologyRefInput = string | {
346
+ id: string;
347
+ };
348
+ type ResourceOntologyBindingInput = {
349
+ actions?: OntologyRefInput[];
350
+ primaryAction?: OntologyRefInput;
351
+ reads?: OntologyRefInput[];
352
+ writes?: OntologyRefInput[];
353
+ usesCatalogs?: OntologyRefInput[];
354
+ emits?: OntologyRefInput[];
355
+ };
356
+ declare const WorkflowResourceEntrySchema: z.ZodObject<{
309
357
  id: z.ZodString;
310
358
  order: z.ZodDefault<z.ZodNumber>;
311
359
  systemPath: z.ZodString;
@@ -356,7 +404,7 @@ declare const WorkflowResourceEntrySchema$1: z.ZodObject<{
356
404
  }>>;
357
405
  }, z.core.$strip>>>;
358
406
  }, z.core.$strip>;
359
- declare const AgentResourceEntrySchema$1: z.ZodObject<{
407
+ declare const AgentResourceEntrySchema: z.ZodObject<{
360
408
  id: z.ZodString;
361
409
  order: z.ZodDefault<z.ZodNumber>;
362
410
  systemPath: z.ZodString;
@@ -438,7 +486,47 @@ declare const AgentResourceEntrySchema$1: z.ZodObject<{
438
486
  }>>;
439
487
  }, z.core.$strip>>>;
440
488
  }, z.core.$strip>;
441
- declare const ResourceEntrySchema$1: z.ZodDiscriminatedUnion<[z.ZodObject<{
489
+ declare const IntegrationResourceEntrySchema: z.ZodObject<{
490
+ id: z.ZodString;
491
+ order: z.ZodDefault<z.ZodNumber>;
492
+ systemPath: z.ZodString;
493
+ title: z.ZodOptional<z.ZodString>;
494
+ description: z.ZodOptional<z.ZodString>;
495
+ ownerRoleId: z.ZodOptional<z.ZodString>;
496
+ status: z.ZodEnum<{
497
+ active: "active";
498
+ deprecated: "deprecated";
499
+ archived: "archived";
500
+ }>;
501
+ ontology: z.ZodOptional<z.ZodObject<{
502
+ actions: z.ZodOptional<z.ZodArray<z.ZodString>>;
503
+ primaryAction: z.ZodOptional<z.ZodString>;
504
+ reads: z.ZodOptional<z.ZodArray<z.ZodString>>;
505
+ writes: z.ZodOptional<z.ZodArray<z.ZodString>>;
506
+ usesCatalogs: z.ZodOptional<z.ZodArray<z.ZodString>>;
507
+ emits: z.ZodOptional<z.ZodArray<z.ZodString>>;
508
+ contract: z.ZodOptional<z.ZodObject<{
509
+ input: z.ZodOptional<z.ZodString>;
510
+ output: z.ZodOptional<z.ZodString>;
511
+ }, z.core.$strip>>;
512
+ }, z.core.$strip>>;
513
+ codeRefs: z.ZodDefault<z.ZodArray<z.ZodObject<{
514
+ path: z.ZodString;
515
+ role: z.ZodEnum<{
516
+ entrypoint: "entrypoint";
517
+ handler: "handler";
518
+ schema: "schema";
519
+ test: "test";
520
+ docs: "docs";
521
+ config: "config";
522
+ }>;
523
+ symbol: z.ZodOptional<z.ZodString>;
524
+ description: z.ZodOptional<z.ZodString>;
525
+ }, z.core.$strip>>>;
526
+ kind: z.ZodLiteral<"integration">;
527
+ provider: z.ZodString;
528
+ }, z.core.$strip>;
529
+ declare const ResourceEntrySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
442
530
  id: z.ZodString;
443
531
  order: z.ZodDefault<z.ZodNumber>;
444
532
  systemPath: z.ZodString;
@@ -656,10 +744,14 @@ declare const ResourceEntrySchema$1: z.ZodDiscriminatedUnion<[z.ZodObject<{
656
744
  file: z.ZodString;
657
745
  }, z.core.$strip>]>;
658
746
  }, z.core.$strip>], "kind">;
747
+ declare function defineResource<const TResource extends ResourceEntry>(resource: TResource): TResource;
748
+ declare function defineResources<const TResources extends Record<string, ResourceEntry>>(resources: TResources): TResources;
749
+ declare function defineResourceOntology(input: ResourceOntologyBindingInput): ResourceOntologyBinding;
659
750
  type ResourceGovernanceStatus = z.infer<typeof ResourceGovernanceStatusSchema>;
660
- type WorkflowResourceEntry = z.infer<typeof WorkflowResourceEntrySchema$1>;
661
- type AgentResourceEntry = z.infer<typeof AgentResourceEntrySchema$1>;
662
- type ResourceEntry$1 = z.infer<typeof ResourceEntrySchema$1>;
751
+ type ResourceOntologyBinding = z.infer<typeof ResourceOntologyBindingSchema>;
752
+ type WorkflowResourceEntry = z.infer<typeof WorkflowResourceEntrySchema>;
753
+ type AgentResourceEntry = z.infer<typeof AgentResourceEntrySchema>;
754
+ type ResourceEntry = z.infer<typeof ResourceEntrySchema>;
663
755
 
664
756
  /**
665
757
  * Memory type definitions
@@ -779,13 +871,6 @@ interface MemoryStatus {
779
871
  storedHistoryPercent: number;
780
872
  historyBudget: number;
781
873
  }
782
- /**
783
- * Memory constraints (optional limits)
784
- */
785
- interface MemoryConstraints {
786
- maxSessionMemoryKeys?: number;
787
- maxMemoryTokens?: number;
788
- }
789
874
 
790
875
  /**
791
876
  * Types for the schema compiler. `compile.ts` walks a `JsonSchema` once, driven entirely by a
@@ -1182,14 +1267,13 @@ declare class MemoryManager {
1182
1267
  private memory;
1183
1268
  private constraints;
1184
1269
  private logger?;
1185
- private cachedSnapshot?;
1186
1270
  /**
1187
1271
  * Rolling correction for `estimateTokens`'s bias, learned from real provider usage.
1188
1272
  * `undefined` until the first `recordActualUsage` call -- the cold-start state, where
1189
1273
  * `estimate()` returns the raw `estimateTokens` output unscaled. See `recordActualUsage`.
1190
1274
  */
1191
1275
  private tokenCorrectionFactor?;
1192
- constructor(memory: AgentMemory, constraints?: MemoryConstraints, logger?: AgentScopedLogger | undefined);
1276
+ constructor(memory: AgentMemory, constraints?: AgentConstraints, logger?: AgentScopedLogger | undefined);
1193
1277
  /**
1194
1278
  * Record how far `estimateTokens` was from reality on a real provider call, and roll it into a
1195
1279
  * correction applied to every estimate this instance makes from here on -- `getStatus`'s three
@@ -1284,17 +1368,14 @@ declare class MemoryManager {
1284
1368
  */
1285
1369
  getStatus(currentTurn?: number): MemoryStatus;
1286
1370
  /**
1287
- * Create memory snapshot for persistence
1288
- * Caches snapshot internally for later retrieval
1371
+ * Create a memory snapshot for persistence.
1372
+ *
1373
+ * Stateless: every call returns a fresh `structuredClone` of the current memory, so the caller
1374
+ * owns caching if it needs to hold onto the result across calls (see `Agent.memorySnapshot`).
1375
+ *
1289
1376
  * @returns Deep copy of current memory state
1290
1377
  */
1291
- toSnapshot(): AgentMemory;
1292
- /**
1293
- * Get cached memory snapshot
1294
- * Returns snapshot created by toSnapshot()
1295
- * @returns Cached snapshot (undefined if toSnapshot() not called yet)
1296
- */
1297
- getSnapshot(): AgentMemory | undefined;
1378
+ snapshot(): AgentMemory;
1298
1379
  /**
1299
1380
  * Build the framework framing and the untrusted data envelope for an LLM call.
1300
1381
  *
@@ -4598,10 +4679,6 @@ type Database = {
4598
4679
  Args: Record<PropertyKey, never>;
4599
4680
  Returns: string;
4600
4681
  };
4601
- detect_stalled_executions: {
4602
- Args: Record<PropertyKey, never>;
4603
- Returns: undefined;
4604
- };
4605
4682
  execute_session_turn: {
4606
4683
  Args: {
4607
4684
  p_session_id: string;
@@ -4747,6 +4824,50 @@ type Database = {
4747
4824
  };
4748
4825
  };
4749
4826
 
4827
+ declare const ActionSchema: z.ZodObject<{
4828
+ id: z.ZodString;
4829
+ order: z.ZodNumber;
4830
+ label: z.ZodString;
4831
+ description: z.ZodOptional<z.ZodString>;
4832
+ scope: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<"global">, z.ZodObject<{
4833
+ domain: z.ZodString;
4834
+ }, z.core.$strip>]>>;
4835
+ resourceId: z.ZodOptional<z.ZodString>;
4836
+ affects: z.ZodOptional<z.ZodArray<z.ZodString>>;
4837
+ invocations: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
4838
+ kind: z.ZodLiteral<"slash-command">;
4839
+ command: z.ZodString;
4840
+ toolFactory: z.ZodOptional<z.ZodString>;
4841
+ }, z.core.$strip>, z.ZodObject<{
4842
+ kind: z.ZodLiteral<"mcp-tool">;
4843
+ server: z.ZodString;
4844
+ name: z.ZodString;
4845
+ }, z.core.$strip>, z.ZodObject<{
4846
+ kind: z.ZodLiteral<"api-endpoint">;
4847
+ method: z.ZodEnum<{
4848
+ GET: "GET";
4849
+ POST: "POST";
4850
+ PATCH: "PATCH";
4851
+ DELETE: "DELETE";
4852
+ }>;
4853
+ path: z.ZodString;
4854
+ requestSchema: z.ZodOptional<z.ZodString>;
4855
+ responseSchema: z.ZodOptional<z.ZodString>;
4856
+ }, z.core.$strip>, z.ZodObject<{
4857
+ kind: z.ZodLiteral<"script-execution">;
4858
+ resourceId: z.ZodString;
4859
+ }, z.core.$strip>], "kind">>>;
4860
+ knowledge: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
4861
+ lifecycle: z.ZodDefault<z.ZodEnum<{
4862
+ active: "active";
4863
+ deprecated: "deprecated";
4864
+ draft: "draft";
4865
+ beta: "beta";
4866
+ archived: "archived";
4867
+ }>>;
4868
+ }, z.core.$strip>;
4869
+ type Action$1 = z.infer<typeof ActionSchema>;
4870
+
4750
4871
  declare const RecordColumnConfigSchema: z.ZodObject<{
4751
4872
  key: z.ZodString;
4752
4873
  label: z.ZodString;
@@ -5169,6 +5290,8 @@ declare const ProcessingStageStatusSchema: z.ZodEnum<{
5169
5290
  no_result: "no_result";
5170
5291
  skipped: "skipped";
5171
5292
  }>;
5293
+ declare const CrmStageKeySchema: z.ZodString;
5294
+ declare const CrmStateKeySchema: z.ZodString;
5172
5295
  declare const DealSchemas: {
5173
5296
  CrmStageKey: z.ZodString;
5174
5297
  CrmStateKey: z.ZodString;
@@ -5578,6 +5701,8 @@ declare const DealSchemas: {
5578
5701
  createdByUserId: z.ZodNullable<z.ZodString>;
5579
5702
  }, z.core.$strip>>;
5580
5703
  };
5704
+ type CrmStageKey = z.infer<typeof CrmStageKeySchema>;
5705
+ type CrmStateKey = z.infer<typeof CrmStateKeySchema>;
5581
5706
  /**
5582
5707
  * One stage entry in a list's `pipeline_config.stages[]`.
5583
5708
  *
@@ -6605,7 +6730,7 @@ declare const ActivityEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
6605
6730
  }, z.core.$strip>], "type">;
6606
6731
  type ActivityEvent = z.infer<typeof ActivityEventSchema>;
6607
6732
 
6608
- interface Action$1 {
6733
+ interface Action {
6609
6734
  key: string;
6610
6735
  label: string;
6611
6736
  payloadSchema?: z.ZodTypeAny;
@@ -6621,7 +6746,7 @@ type DealActionInput = AcqDealRow & {
6621
6746
  ownership?: 'us' | 'them' | null;
6622
6747
  nextAction?: string | null;
6623
6748
  };
6624
- declare function deriveActions(deal: DealActionInput, actions?: ActionDef[]): Action$1[];
6749
+ declare function deriveActions(deal: DealActionInput, actions?: ActionDef[]): Action[];
6625
6750
 
6626
6751
  declare const OntologyIdSchema: z.ZodString;
6627
6752
  type OntologyId = z.infer<typeof OntologyIdSchema>;
@@ -6841,6 +6966,23 @@ type ResolvedOntologyRecord<TRecord> = TRecord & {
6841
6966
  origin: OntologyRecordOrigin;
6842
6967
  };
6843
6968
 
6969
+ /**
6970
+ * Tenant-authorable readiness requirements for a system's API interface.
6971
+ *
6972
+ * Built-in profiles (`sales.lead-gen.api`, `sales.crm.api`,
6973
+ * `sales.lead-gen.crm-handoff`) derive their requirements from platform code
6974
+ * and do not need a `readinessContract`. Custom systems (any profile id not in
6975
+ * the built-in registry) MUST declare a contract so structural readiness
6976
+ * validation can proceed without platform hardcoding.
6977
+ *
6978
+ * Each field is an array of ontology IDs that this system must satisfy:
6979
+ * - `requiredObjects` – ontology object types the interface depends on
6980
+ * - `requiredCatalogs` – catalog types the interface requires (must be non-empty)
6981
+ */
6982
+ declare const SystemApiInterfaceReadinessContractSchema: z.ZodObject<{
6983
+ requiredObjects: z.ZodDefault<z.ZodArray<z.ZodString>>;
6984
+ requiredCatalogs: z.ZodArray<z.ZodString>;
6985
+ }, z.core.$strict>;
6844
6986
  declare const SystemApiInterfaceSchema: z.ZodObject<{
6845
6987
  lifecycle: z.ZodDefault<z.ZodEnum<{
6846
6988
  active: "active";
@@ -6853,10 +6995,35 @@ declare const SystemApiInterfaceSchema: z.ZodObject<{
6853
6995
  resourceIds: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
6854
6996
  readinessContract: z.ZodOptional<z.ZodObject<{
6855
6997
  requiredObjects: z.ZodDefault<z.ZodArray<z.ZodString>>;
6856
- requiredCatalogs: z.ZodDefault<z.ZodArray<z.ZodString>>;
6857
- requiredKinds: z.ZodOptional<z.ZodArray<z.ZodString>>;
6998
+ requiredCatalogs: z.ZodArray<z.ZodString>;
6858
6999
  }, z.core.$strict>>;
6859
7000
  }, z.core.$strict>;
7001
+ type ReadinessProfileKind = 'built-in' | 'custom';
7002
+ interface ReadinessProfileEntry {
7003
+ readonly profileId: string;
7004
+ readonly kind: ReadinessProfileKind;
7005
+ }
7006
+ /**
7007
+ * Look up a readiness profile entry by id.
7008
+ *
7009
+ * Returns `undefined` for unknown ids (not in the built-in list and not
7010
+ * registered via `registerReadinessProfile`). Unknown profiles are validated
7011
+ * structurally through the system's `readinessContract` — unknown-profile is
7012
+ * NOT a schema-layer rejection.
7013
+ */
7014
+ declare function lookupReadinessProfile(profileId: string): ReadinessProfileEntry | undefined;
7015
+ /**
7016
+ * Register a custom readiness profile preset.
7017
+ *
7018
+ * Tenant tooling or SDK extensions may call this during startup to register
7019
+ * named presets. Registered presets are then resolvable via `lookupReadinessProfile`.
7020
+ * Built-in profile ids cannot be overwritten.
7021
+ */
7022
+ declare function registerReadinessProfile(profileId: string): ReadinessProfileEntry;
7023
+ /**
7024
+ * Return true if the given profile id is a built-in platform preset.
7025
+ */
7026
+ declare function isBuiltInReadinessProfile(profileId: string): boolean;
6860
7027
  type JsonPrimitive = string | number | boolean | null;
6861
7028
  type JsonValue = JsonPrimitive | JsonValue[] | {
6862
7029
  [key: string]: JsonValue;
@@ -6900,6 +7067,7 @@ interface SystemEntry {
6900
7067
  systems?: Record<string, SystemEntry>;
6901
7068
  subsystems?: Record<string, SystemEntry>;
6902
7069
  }
7070
+ type SystemApiInterfaceReadinessContract = z.infer<typeof SystemApiInterfaceReadinessContractSchema>;
6903
7071
 
6904
7072
  declare const SurfaceTypeSchema: z.ZodEnum<{
6905
7073
  dashboard: "dashboard";
@@ -6936,94 +7104,826 @@ interface SidebarGroupNode {
6936
7104
  }
6937
7105
  type SidebarNode = SidebarSurfaceNode | SidebarGroupNode;
6938
7106
 
6939
- declare const LinkSchema: z.ZodObject<{
6940
- nodeId: z.ZodString;
7107
+ declare const OmTopologyNodeRefSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7108
+ kind: z.ZodLiteral<"system">;
7109
+ id: z.ZodString;
7110
+ }, z.core.$strip>, z.ZodObject<{
7111
+ kind: z.ZodLiteral<"resource">;
7112
+ id: z.ZodString;
7113
+ }, z.core.$strip>, z.ZodObject<{
7114
+ kind: z.ZodLiteral<"ontology">;
7115
+ id: z.ZodString;
7116
+ }, z.core.$strip>, z.ZodObject<{
7117
+ kind: z.ZodLiteral<"policy">;
7118
+ id: z.ZodString;
7119
+ }, z.core.$strip>, z.ZodObject<{
7120
+ kind: z.ZodLiteral<"role">;
7121
+ id: z.ZodString;
7122
+ }, z.core.$strip>, z.ZodObject<{
7123
+ kind: z.ZodLiteral<"trigger">;
7124
+ id: z.ZodString;
7125
+ }, z.core.$strip>, z.ZodObject<{
7126
+ kind: z.ZodLiteral<"humanCheckpoint">;
7127
+ id: z.ZodString;
7128
+ }, z.core.$strip>, z.ZodObject<{
7129
+ kind: z.ZodLiteral<"externalResource">;
7130
+ id: z.ZodString;
7131
+ }, z.core.$strip>], "kind">;
7132
+ declare const OmTopologyRelationshipSchema: z.ZodObject<{
7133
+ from: z.ZodDiscriminatedUnion<[z.ZodObject<{
7134
+ kind: z.ZodLiteral<"system">;
7135
+ id: z.ZodString;
7136
+ }, z.core.$strip>, z.ZodObject<{
7137
+ kind: z.ZodLiteral<"resource">;
7138
+ id: z.ZodString;
7139
+ }, z.core.$strip>, z.ZodObject<{
7140
+ kind: z.ZodLiteral<"ontology">;
7141
+ id: z.ZodString;
7142
+ }, z.core.$strip>, z.ZodObject<{
7143
+ kind: z.ZodLiteral<"policy">;
7144
+ id: z.ZodString;
7145
+ }, z.core.$strip>, z.ZodObject<{
7146
+ kind: z.ZodLiteral<"role">;
7147
+ id: z.ZodString;
7148
+ }, z.core.$strip>, z.ZodObject<{
7149
+ kind: z.ZodLiteral<"trigger">;
7150
+ id: z.ZodString;
7151
+ }, z.core.$strip>, z.ZodObject<{
7152
+ kind: z.ZodLiteral<"humanCheckpoint">;
7153
+ id: z.ZodString;
7154
+ }, z.core.$strip>, z.ZodObject<{
7155
+ kind: z.ZodLiteral<"externalResource">;
7156
+ id: z.ZodString;
7157
+ }, z.core.$strip>], "kind">;
6941
7158
  kind: z.ZodEnum<{
6942
- affects: "affects";
6943
- actions: "actions";
6944
- effects: "effects";
6945
- links: "links";
6946
- reads: "reads";
6947
- writes: "writes";
6948
- emits: "emits";
6949
7159
  triggers: "triggers";
6950
7160
  uses: "uses";
6951
7161
  approval: "approval";
6952
- contains: "contains";
6953
- references: "references";
6954
- maps_to: "maps_to";
6955
- governs: "governs";
6956
- originates_from: "originates_from";
6957
- applies_to: "applies_to";
6958
- uses_catalog: "uses_catalog";
6959
7162
  }>;
7163
+ to: z.ZodDiscriminatedUnion<[z.ZodObject<{
7164
+ kind: z.ZodLiteral<"system">;
7165
+ id: z.ZodString;
7166
+ }, z.core.$strip>, z.ZodObject<{
7167
+ kind: z.ZodLiteral<"resource">;
7168
+ id: z.ZodString;
7169
+ }, z.core.$strip>, z.ZodObject<{
7170
+ kind: z.ZodLiteral<"ontology">;
7171
+ id: z.ZodString;
7172
+ }, z.core.$strip>, z.ZodObject<{
7173
+ kind: z.ZodLiteral<"policy">;
7174
+ id: z.ZodString;
7175
+ }, z.core.$strip>, z.ZodObject<{
7176
+ kind: z.ZodLiteral<"role">;
7177
+ id: z.ZodString;
7178
+ }, z.core.$strip>, z.ZodObject<{
7179
+ kind: z.ZodLiteral<"trigger">;
7180
+ id: z.ZodString;
7181
+ }, z.core.$strip>, z.ZodObject<{
7182
+ kind: z.ZodLiteral<"humanCheckpoint">;
7183
+ id: z.ZodString;
7184
+ }, z.core.$strip>, z.ZodObject<{
7185
+ kind: z.ZodLiteral<"externalResource">;
7186
+ id: z.ZodString;
7187
+ }, z.core.$strip>], "kind">;
7188
+ systemPath: z.ZodOptional<z.ZodString>;
7189
+ required: z.ZodOptional<z.ZodBoolean>;
7190
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
6960
7191
  }, z.core.$strip>;
6961
- type Link = z.infer<typeof LinkSchema>;
6962
-
6963
- declare const OrganizationModelSchema$1: z.ZodObject<{
7192
+ declare const OmTopologyDomainSchema: z.ZodDefault<z.ZodObject<{
6964
7193
  version: z.ZodDefault<z.ZodLiteral<1>>;
6965
- snapshotHash: z.ZodOptional<z.ZodString>;
6966
- domainMetadata: z.ZodPipe<z.ZodDefault<z.ZodObject<{
6967
- branding: z.ZodOptional<z.ZodObject<{
6968
- version: z.ZodDefault<z.ZodLiteral<1>>;
6969
- lastModified: z.ZodString;
6970
- }, z.core.$strip>>;
6971
- identity: z.ZodOptional<z.ZodObject<{
6972
- version: z.ZodDefault<z.ZodLiteral<1>>;
6973
- lastModified: z.ZodString;
6974
- }, z.core.$strip>>;
6975
- clients: z.ZodOptional<z.ZodObject<{
6976
- version: z.ZodDefault<z.ZodLiteral<1>>;
6977
- lastModified: z.ZodString;
6978
- }, z.core.$strip>>;
6979
- customers: z.ZodOptional<z.ZodObject<{
6980
- version: z.ZodDefault<z.ZodLiteral<1>>;
6981
- lastModified: z.ZodString;
6982
- }, z.core.$strip>>;
6983
- offerings: z.ZodOptional<z.ZodObject<{
6984
- version: z.ZodDefault<z.ZodLiteral<1>>;
6985
- lastModified: z.ZodString;
6986
- }, z.core.$strip>>;
6987
- roles: z.ZodOptional<z.ZodObject<{
6988
- version: z.ZodDefault<z.ZodLiteral<1>>;
6989
- lastModified: z.ZodString;
6990
- }, z.core.$strip>>;
6991
- goals: z.ZodOptional<z.ZodObject<{
6992
- version: z.ZodDefault<z.ZodLiteral<1>>;
6993
- lastModified: z.ZodString;
6994
- }, z.core.$strip>>;
6995
- systems: z.ZodOptional<z.ZodObject<{
6996
- version: z.ZodDefault<z.ZodLiteral<1>>;
6997
- lastModified: z.ZodString;
6998
- }, z.core.$strip>>;
6999
- ontology: z.ZodOptional<z.ZodObject<{
7000
- version: z.ZodDefault<z.ZodLiteral<1>>;
7001
- lastModified: z.ZodString;
7002
- }, z.core.$strip>>;
7003
- resources: z.ZodOptional<z.ZodObject<{
7004
- version: z.ZodDefault<z.ZodLiteral<1>>;
7005
- lastModified: z.ZodString;
7006
- }, z.core.$strip>>;
7007
- topology: z.ZodOptional<z.ZodObject<{
7008
- version: z.ZodDefault<z.ZodLiteral<1>>;
7009
- lastModified: z.ZodString;
7010
- }, z.core.$strip>>;
7011
- actions: z.ZodOptional<z.ZodObject<{
7012
- version: z.ZodDefault<z.ZodLiteral<1>>;
7013
- lastModified: z.ZodString;
7014
- }, z.core.$strip>>;
7015
- entities: z.ZodOptional<z.ZodObject<{
7016
- version: z.ZodDefault<z.ZodLiteral<1>>;
7017
- lastModified: z.ZodString;
7018
- }, z.core.$strip>>;
7019
- policies: z.ZodOptional<z.ZodObject<{
7020
- version: z.ZodDefault<z.ZodLiteral<1>>;
7021
- lastModified: z.ZodString;
7022
- }, z.core.$strip>>;
7023
- knowledge: z.ZodOptional<z.ZodObject<{
7024
- version: z.ZodDefault<z.ZodLiteral<1>>;
7025
- lastModified: z.ZodString;
7026
- }, z.core.$strip>>;
7194
+ relationships: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
7195
+ from: z.ZodDiscriminatedUnion<[z.ZodObject<{
7196
+ kind: z.ZodLiteral<"system">;
7197
+ id: z.ZodString;
7198
+ }, z.core.$strip>, z.ZodObject<{
7199
+ kind: z.ZodLiteral<"resource">;
7200
+ id: z.ZodString;
7201
+ }, z.core.$strip>, z.ZodObject<{
7202
+ kind: z.ZodLiteral<"ontology">;
7203
+ id: z.ZodString;
7204
+ }, z.core.$strip>, z.ZodObject<{
7205
+ kind: z.ZodLiteral<"policy">;
7206
+ id: z.ZodString;
7207
+ }, z.core.$strip>, z.ZodObject<{
7208
+ kind: z.ZodLiteral<"role">;
7209
+ id: z.ZodString;
7210
+ }, z.core.$strip>, z.ZodObject<{
7211
+ kind: z.ZodLiteral<"trigger">;
7212
+ id: z.ZodString;
7213
+ }, z.core.$strip>, z.ZodObject<{
7214
+ kind: z.ZodLiteral<"humanCheckpoint">;
7215
+ id: z.ZodString;
7216
+ }, z.core.$strip>, z.ZodObject<{
7217
+ kind: z.ZodLiteral<"externalResource">;
7218
+ id: z.ZodString;
7219
+ }, z.core.$strip>], "kind">;
7220
+ kind: z.ZodEnum<{
7221
+ triggers: "triggers";
7222
+ uses: "uses";
7223
+ approval: "approval";
7224
+ }>;
7225
+ to: z.ZodDiscriminatedUnion<[z.ZodObject<{
7226
+ kind: z.ZodLiteral<"system">;
7227
+ id: z.ZodString;
7228
+ }, z.core.$strip>, z.ZodObject<{
7229
+ kind: z.ZodLiteral<"resource">;
7230
+ id: z.ZodString;
7231
+ }, z.core.$strip>, z.ZodObject<{
7232
+ kind: z.ZodLiteral<"ontology">;
7233
+ id: z.ZodString;
7234
+ }, z.core.$strip>, z.ZodObject<{
7235
+ kind: z.ZodLiteral<"policy">;
7236
+ id: z.ZodString;
7237
+ }, z.core.$strip>, z.ZodObject<{
7238
+ kind: z.ZodLiteral<"role">;
7239
+ id: z.ZodString;
7240
+ }, z.core.$strip>, z.ZodObject<{
7241
+ kind: z.ZodLiteral<"trigger">;
7242
+ id: z.ZodString;
7243
+ }, z.core.$strip>, z.ZodObject<{
7244
+ kind: z.ZodLiteral<"humanCheckpoint">;
7245
+ id: z.ZodString;
7246
+ }, z.core.$strip>, z.ZodObject<{
7247
+ kind: z.ZodLiteral<"externalResource">;
7248
+ id: z.ZodString;
7249
+ }, z.core.$strip>], "kind">;
7250
+ systemPath: z.ZodOptional<z.ZodString>;
7251
+ required: z.ZodOptional<z.ZodBoolean>;
7252
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
7253
+ }, z.core.$strip>>>;
7254
+ }, z.core.$strip>>;
7255
+ type OmTopologyNodeRef = z.infer<typeof OmTopologyNodeRefSchema>;
7256
+ type OmTopologyRelationship = z.infer<typeof OmTopologyRelationshipSchema>;
7257
+ type OmTopologyDomain = z.infer<typeof OmTopologyDomainSchema>;
7258
+ type TypedIdObject = {
7259
+ id: string;
7260
+ };
7261
+ type TopologyRefFactoryInput = string | TypedIdObject;
7262
+ type TopologyRelationshipInput = Omit<OmTopologyRelationship, 'from' | 'to'> & {
7263
+ from: OmTopologyNodeInput;
7264
+ to: OmTopologyNodeInput;
7265
+ };
7266
+ type TopologyRelationshipOptions = Omit<Partial<OmTopologyRelationship>, 'from' | 'kind' | 'to'>;
7267
+ type OmTopologyNodeInput = OmTopologyNodeRef | ResourceEntry;
7268
+ declare const topologyRef: {
7269
+ readonly system: (system: TopologyRefFactoryInput) => {
7270
+ kind: "system";
7271
+ id: string;
7272
+ } | {
7273
+ kind: "resource";
7274
+ id: string;
7275
+ } | {
7276
+ kind: "ontology";
7277
+ id: string;
7278
+ } | {
7279
+ kind: "policy";
7280
+ id: string;
7281
+ } | {
7282
+ kind: "role";
7283
+ id: string;
7284
+ } | {
7285
+ kind: "trigger";
7286
+ id: string;
7287
+ } | {
7288
+ kind: "humanCheckpoint";
7289
+ id: string;
7290
+ } | {
7291
+ kind: "externalResource";
7292
+ id: string;
7293
+ };
7294
+ readonly resource: (resource: TopologyRefFactoryInput) => {
7295
+ kind: "system";
7296
+ id: string;
7297
+ } | {
7298
+ kind: "resource";
7299
+ id: string;
7300
+ } | {
7301
+ kind: "ontology";
7302
+ id: string;
7303
+ } | {
7304
+ kind: "policy";
7305
+ id: string;
7306
+ } | {
7307
+ kind: "role";
7308
+ id: string;
7309
+ } | {
7310
+ kind: "trigger";
7311
+ id: string;
7312
+ } | {
7313
+ kind: "humanCheckpoint";
7314
+ id: string;
7315
+ } | {
7316
+ kind: "externalResource";
7317
+ id: string;
7318
+ };
7319
+ readonly ontology: (record: TopologyRefFactoryInput) => {
7320
+ kind: "system";
7321
+ id: string;
7322
+ } | {
7323
+ kind: "resource";
7324
+ id: string;
7325
+ } | {
7326
+ kind: "ontology";
7327
+ id: string;
7328
+ } | {
7329
+ kind: "policy";
7330
+ id: string;
7331
+ } | {
7332
+ kind: "role";
7333
+ id: string;
7334
+ } | {
7335
+ kind: "trigger";
7336
+ id: string;
7337
+ } | {
7338
+ kind: "humanCheckpoint";
7339
+ id: string;
7340
+ } | {
7341
+ kind: "externalResource";
7342
+ id: string;
7343
+ };
7344
+ readonly policy: (policy: TopologyRefFactoryInput) => {
7345
+ kind: "system";
7346
+ id: string;
7347
+ } | {
7348
+ kind: "resource";
7349
+ id: string;
7350
+ } | {
7351
+ kind: "ontology";
7352
+ id: string;
7353
+ } | {
7354
+ kind: "policy";
7355
+ id: string;
7356
+ } | {
7357
+ kind: "role";
7358
+ id: string;
7359
+ } | {
7360
+ kind: "trigger";
7361
+ id: string;
7362
+ } | {
7363
+ kind: "humanCheckpoint";
7364
+ id: string;
7365
+ } | {
7366
+ kind: "externalResource";
7367
+ id: string;
7368
+ };
7369
+ readonly role: (role: TopologyRefFactoryInput) => {
7370
+ kind: "system";
7371
+ id: string;
7372
+ } | {
7373
+ kind: "resource";
7374
+ id: string;
7375
+ } | {
7376
+ kind: "ontology";
7377
+ id: string;
7378
+ } | {
7379
+ kind: "policy";
7380
+ id: string;
7381
+ } | {
7382
+ kind: "role";
7383
+ id: string;
7384
+ } | {
7385
+ kind: "trigger";
7386
+ id: string;
7387
+ } | {
7388
+ kind: "humanCheckpoint";
7389
+ id: string;
7390
+ } | {
7391
+ kind: "externalResource";
7392
+ id: string;
7393
+ };
7394
+ readonly trigger: (trigger: TopologyRefFactoryInput) => {
7395
+ kind: "system";
7396
+ id: string;
7397
+ } | {
7398
+ kind: "resource";
7399
+ id: string;
7400
+ } | {
7401
+ kind: "ontology";
7402
+ id: string;
7403
+ } | {
7404
+ kind: "policy";
7405
+ id: string;
7406
+ } | {
7407
+ kind: "role";
7408
+ id: string;
7409
+ } | {
7410
+ kind: "trigger";
7411
+ id: string;
7412
+ } | {
7413
+ kind: "humanCheckpoint";
7414
+ id: string;
7415
+ } | {
7416
+ kind: "externalResource";
7417
+ id: string;
7418
+ };
7419
+ readonly humanCheckpoint: (checkpoint: TopologyRefFactoryInput) => {
7420
+ kind: "system";
7421
+ id: string;
7422
+ } | {
7423
+ kind: "resource";
7424
+ id: string;
7425
+ } | {
7426
+ kind: "ontology";
7427
+ id: string;
7428
+ } | {
7429
+ kind: "policy";
7430
+ id: string;
7431
+ } | {
7432
+ kind: "role";
7433
+ id: string;
7434
+ } | {
7435
+ kind: "trigger";
7436
+ id: string;
7437
+ } | {
7438
+ kind: "humanCheckpoint";
7439
+ id: string;
7440
+ } | {
7441
+ kind: "externalResource";
7442
+ id: string;
7443
+ };
7444
+ readonly externalResource: (externalResource: TopologyRefFactoryInput) => {
7445
+ kind: "system";
7446
+ id: string;
7447
+ } | {
7448
+ kind: "resource";
7449
+ id: string;
7450
+ } | {
7451
+ kind: "ontology";
7452
+ id: string;
7453
+ } | {
7454
+ kind: "policy";
7455
+ id: string;
7456
+ } | {
7457
+ kind: "role";
7458
+ id: string;
7459
+ } | {
7460
+ kind: "trigger";
7461
+ id: string;
7462
+ } | {
7463
+ kind: "humanCheckpoint";
7464
+ id: string;
7465
+ } | {
7466
+ kind: "externalResource";
7467
+ id: string;
7468
+ };
7469
+ };
7470
+ declare const topologyRelationship: {
7471
+ readonly triggers: (from: OmTopologyNodeInput, to: OmTopologyNodeInput, options?: TopologyRelationshipOptions) => {
7472
+ from: {
7473
+ kind: "system";
7474
+ id: string;
7475
+ } | {
7476
+ kind: "resource";
7477
+ id: string;
7478
+ } | {
7479
+ kind: "ontology";
7480
+ id: string;
7481
+ } | {
7482
+ kind: "policy";
7483
+ id: string;
7484
+ } | {
7485
+ kind: "role";
7486
+ id: string;
7487
+ } | {
7488
+ kind: "trigger";
7489
+ id: string;
7490
+ } | {
7491
+ kind: "humanCheckpoint";
7492
+ id: string;
7493
+ } | {
7494
+ kind: "externalResource";
7495
+ id: string;
7496
+ };
7497
+ kind: "triggers" | "uses" | "approval";
7498
+ to: {
7499
+ kind: "system";
7500
+ id: string;
7501
+ } | {
7502
+ kind: "resource";
7503
+ id: string;
7504
+ } | {
7505
+ kind: "ontology";
7506
+ id: string;
7507
+ } | {
7508
+ kind: "policy";
7509
+ id: string;
7510
+ } | {
7511
+ kind: "role";
7512
+ id: string;
7513
+ } | {
7514
+ kind: "trigger";
7515
+ id: string;
7516
+ } | {
7517
+ kind: "humanCheckpoint";
7518
+ id: string;
7519
+ } | {
7520
+ kind: "externalResource";
7521
+ id: string;
7522
+ };
7523
+ systemPath?: string | undefined;
7524
+ required?: boolean | undefined;
7525
+ metadata?: Record<string, JsonValue> | undefined;
7526
+ };
7527
+ readonly uses: (from: OmTopologyNodeInput, to: OmTopologyNodeInput, options?: TopologyRelationshipOptions) => {
7528
+ from: {
7529
+ kind: "system";
7530
+ id: string;
7531
+ } | {
7532
+ kind: "resource";
7533
+ id: string;
7534
+ } | {
7535
+ kind: "ontology";
7536
+ id: string;
7537
+ } | {
7538
+ kind: "policy";
7539
+ id: string;
7540
+ } | {
7541
+ kind: "role";
7542
+ id: string;
7543
+ } | {
7544
+ kind: "trigger";
7545
+ id: string;
7546
+ } | {
7547
+ kind: "humanCheckpoint";
7548
+ id: string;
7549
+ } | {
7550
+ kind: "externalResource";
7551
+ id: string;
7552
+ };
7553
+ kind: "triggers" | "uses" | "approval";
7554
+ to: {
7555
+ kind: "system";
7556
+ id: string;
7557
+ } | {
7558
+ kind: "resource";
7559
+ id: string;
7560
+ } | {
7561
+ kind: "ontology";
7562
+ id: string;
7563
+ } | {
7564
+ kind: "policy";
7565
+ id: string;
7566
+ } | {
7567
+ kind: "role";
7568
+ id: string;
7569
+ } | {
7570
+ kind: "trigger";
7571
+ id: string;
7572
+ } | {
7573
+ kind: "humanCheckpoint";
7574
+ id: string;
7575
+ } | {
7576
+ kind: "externalResource";
7577
+ id: string;
7578
+ };
7579
+ systemPath?: string | undefined;
7580
+ required?: boolean | undefined;
7581
+ metadata?: Record<string, JsonValue> | undefined;
7582
+ };
7583
+ readonly approval: (from: OmTopologyNodeInput, to: OmTopologyNodeInput, options?: TopologyRelationshipOptions) => {
7584
+ from: {
7585
+ kind: "system";
7586
+ id: string;
7587
+ } | {
7588
+ kind: "resource";
7589
+ id: string;
7590
+ } | {
7591
+ kind: "ontology";
7592
+ id: string;
7593
+ } | {
7594
+ kind: "policy";
7595
+ id: string;
7596
+ } | {
7597
+ kind: "role";
7598
+ id: string;
7599
+ } | {
7600
+ kind: "trigger";
7601
+ id: string;
7602
+ } | {
7603
+ kind: "humanCheckpoint";
7604
+ id: string;
7605
+ } | {
7606
+ kind: "externalResource";
7607
+ id: string;
7608
+ };
7609
+ kind: "triggers" | "uses" | "approval";
7610
+ to: {
7611
+ kind: "system";
7612
+ id: string;
7613
+ } | {
7614
+ kind: "resource";
7615
+ id: string;
7616
+ } | {
7617
+ kind: "ontology";
7618
+ id: string;
7619
+ } | {
7620
+ kind: "policy";
7621
+ id: string;
7622
+ } | {
7623
+ kind: "role";
7624
+ id: string;
7625
+ } | {
7626
+ kind: "trigger";
7627
+ id: string;
7628
+ } | {
7629
+ kind: "humanCheckpoint";
7630
+ id: string;
7631
+ } | {
7632
+ kind: "externalResource";
7633
+ id: string;
7634
+ };
7635
+ systemPath?: string | undefined;
7636
+ required?: boolean | undefined;
7637
+ metadata?: Record<string, JsonValue> | undefined;
7638
+ };
7639
+ readonly usesIntegration: (from: OmTopologyNodeInput, integration: OmTopologyNodeInput, options?: TopologyRelationshipOptions) => {
7640
+ from: {
7641
+ kind: "system";
7642
+ id: string;
7643
+ } | {
7644
+ kind: "resource";
7645
+ id: string;
7646
+ } | {
7647
+ kind: "ontology";
7648
+ id: string;
7649
+ } | {
7650
+ kind: "policy";
7651
+ id: string;
7652
+ } | {
7653
+ kind: "role";
7654
+ id: string;
7655
+ } | {
7656
+ kind: "trigger";
7657
+ id: string;
7658
+ } | {
7659
+ kind: "humanCheckpoint";
7660
+ id: string;
7661
+ } | {
7662
+ kind: "externalResource";
7663
+ id: string;
7664
+ };
7665
+ kind: "triggers" | "uses" | "approval";
7666
+ to: {
7667
+ kind: "system";
7668
+ id: string;
7669
+ } | {
7670
+ kind: "resource";
7671
+ id: string;
7672
+ } | {
7673
+ kind: "ontology";
7674
+ id: string;
7675
+ } | {
7676
+ kind: "policy";
7677
+ id: string;
7678
+ } | {
7679
+ kind: "role";
7680
+ id: string;
7681
+ } | {
7682
+ kind: "trigger";
7683
+ id: string;
7684
+ } | {
7685
+ kind: "humanCheckpoint";
7686
+ id: string;
7687
+ } | {
7688
+ kind: "externalResource";
7689
+ id: string;
7690
+ };
7691
+ systemPath?: string | undefined;
7692
+ required?: boolean | undefined;
7693
+ metadata?: Record<string, JsonValue> | undefined;
7694
+ };
7695
+ readonly requestsApproval: (from: OmTopologyNodeInput, checkpoint: TopologyRefFactoryInput, options?: TopologyRelationshipOptions) => {
7696
+ from: {
7697
+ kind: "system";
7698
+ id: string;
7699
+ } | {
7700
+ kind: "resource";
7701
+ id: string;
7702
+ } | {
7703
+ kind: "ontology";
7704
+ id: string;
7705
+ } | {
7706
+ kind: "policy";
7707
+ id: string;
7708
+ } | {
7709
+ kind: "role";
7710
+ id: string;
7711
+ } | {
7712
+ kind: "trigger";
7713
+ id: string;
7714
+ } | {
7715
+ kind: "humanCheckpoint";
7716
+ id: string;
7717
+ } | {
7718
+ kind: "externalResource";
7719
+ id: string;
7720
+ };
7721
+ kind: "triggers" | "uses" | "approval";
7722
+ to: {
7723
+ kind: "system";
7724
+ id: string;
7725
+ } | {
7726
+ kind: "resource";
7727
+ id: string;
7728
+ } | {
7729
+ kind: "ontology";
7730
+ id: string;
7731
+ } | {
7732
+ kind: "policy";
7733
+ id: string;
7734
+ } | {
7735
+ kind: "role";
7736
+ id: string;
7737
+ } | {
7738
+ kind: "trigger";
7739
+ id: string;
7740
+ } | {
7741
+ kind: "humanCheckpoint";
7742
+ id: string;
7743
+ } | {
7744
+ kind: "externalResource";
7745
+ id: string;
7746
+ };
7747
+ systemPath?: string | undefined;
7748
+ required?: boolean | undefined;
7749
+ metadata?: Record<string, JsonValue> | undefined;
7750
+ };
7751
+ readonly checkpointRoutesTo: (checkpoint: TopologyRefFactoryInput, to: OmTopologyNodeInput, options?: TopologyRelationshipOptions) => {
7752
+ from: {
7753
+ kind: "system";
7754
+ id: string;
7755
+ } | {
7756
+ kind: "resource";
7757
+ id: string;
7758
+ } | {
7759
+ kind: "ontology";
7760
+ id: string;
7761
+ } | {
7762
+ kind: "policy";
7763
+ id: string;
7764
+ } | {
7765
+ kind: "role";
7766
+ id: string;
7767
+ } | {
7768
+ kind: "trigger";
7769
+ id: string;
7770
+ } | {
7771
+ kind: "humanCheckpoint";
7772
+ id: string;
7773
+ } | {
7774
+ kind: "externalResource";
7775
+ id: string;
7776
+ };
7777
+ kind: "triggers" | "uses" | "approval";
7778
+ to: {
7779
+ kind: "system";
7780
+ id: string;
7781
+ } | {
7782
+ kind: "resource";
7783
+ id: string;
7784
+ } | {
7785
+ kind: "ontology";
7786
+ id: string;
7787
+ } | {
7788
+ kind: "policy";
7789
+ id: string;
7790
+ } | {
7791
+ kind: "role";
7792
+ id: string;
7793
+ } | {
7794
+ kind: "trigger";
7795
+ id: string;
7796
+ } | {
7797
+ kind: "humanCheckpoint";
7798
+ id: string;
7799
+ } | {
7800
+ kind: "externalResource";
7801
+ id: string;
7802
+ };
7803
+ systemPath?: string | undefined;
7804
+ required?: boolean | undefined;
7805
+ metadata?: Record<string, JsonValue> | undefined;
7806
+ };
7807
+ };
7808
+ declare function parseTopologyNodeRef(input: string | OmTopologyNodeRef): OmTopologyNodeRef;
7809
+ declare function defineTopologyRelationship(input: TopologyRelationshipInput): OmTopologyRelationship;
7810
+ declare function defineTopology(relationships: Record<string, TopologyRelationshipInput> | TopologyRelationshipInput[]): OmTopologyDomain;
7811
+
7812
+ declare const LinkSchema: z.ZodObject<{
7813
+ nodeId: z.ZodString;
7814
+ kind: z.ZodEnum<{
7815
+ affects: "affects";
7816
+ actions: "actions";
7817
+ effects: "effects";
7818
+ links: "links";
7819
+ reads: "reads";
7820
+ writes: "writes";
7821
+ emits: "emits";
7822
+ triggers: "triggers";
7823
+ uses: "uses";
7824
+ approval: "approval";
7825
+ contains: "contains";
7826
+ references: "references";
7827
+ maps_to: "maps_to";
7828
+ governs: "governs";
7829
+ originates_from: "originates_from";
7830
+ applies_to: "applies_to";
7831
+ uses_catalog: "uses_catalog";
7832
+ }>;
7833
+ }, z.core.$strip>;
7834
+ type Link = z.infer<typeof LinkSchema>;
7835
+
7836
+ /**
7837
+ * Registration surface for the generic readiness engine (`./engine`).
7838
+ *
7839
+ * This module owns two independent extension points so `./engine` never has
7840
+ * to import anything from `business/**`:
7841
+ *
7842
+ * - `registerBuiltInReadinessProfile` — a profile id (e.g. `sales.lead-gen.api`)
7843
+ * maps to structural validation logic plus an optional model-preparation
7844
+ * hook run before ontology compilation (e.g. injecting a derived catalog).
7845
+ * - `registerReadinessInterfaceMarker` — a `(systemPath, interfaceKey)` pair
7846
+ * maps to a synthesized interface marker for interfaces that are not
7847
+ * authored on `system.apiInterface` (e.g. the lead-gen/CRM handoff bridge,
7848
+ * which is derived from scoped resources rather than declared directly).
7849
+ *
7850
+ * `business/acquisition/ontology-validation.ts` calls both at module load to
7851
+ * register its three built-in profiles. Both registries are module-level
7852
+ * mutable maps with no reset function, matching the existing
7853
+ * `domains/systems.ts` profile registry's shape.
7854
+ */
7855
+
7856
+ type SystemInterfaceReadinessIssueFamily = 'SYSTEM_INTERFACE_MISSING' | 'SYSTEM_INTERFACE_DISABLED' | 'SYSTEM_INTERFACE_INVALID' | 'SYSTEM_INTERFACE_NOT_READY' | 'SYSTEM_BRIDGE_NOT_READY'
7857
+ /**
7858
+ * The deployed OM snapshot hash does not match the canonical source hash.
7859
+ * Redeploy with `pnpm operations:deploy` to refresh the snapshot.
7860
+ */
7861
+ | 'STALE_OM_SNAPSHOT';
7862
+
7863
+ declare const OrganizationModelSchema: z.ZodObject<{
7864
+ version: z.ZodDefault<z.ZodLiteral<1>>;
7865
+ snapshotHash: z.ZodOptional<z.ZodString>;
7866
+ domainMetadata: z.ZodPipe<z.ZodDefault<z.ZodObject<{
7867
+ branding: z.ZodOptional<z.ZodObject<{
7868
+ version: z.ZodDefault<z.ZodLiteral<1>>;
7869
+ lastModified: z.ZodString;
7870
+ }, z.core.$strip>>;
7871
+ identity: z.ZodOptional<z.ZodObject<{
7872
+ version: z.ZodDefault<z.ZodLiteral<1>>;
7873
+ lastModified: z.ZodString;
7874
+ }, z.core.$strip>>;
7875
+ clients: z.ZodOptional<z.ZodObject<{
7876
+ version: z.ZodDefault<z.ZodLiteral<1>>;
7877
+ lastModified: z.ZodString;
7878
+ }, z.core.$strip>>;
7879
+ customers: z.ZodOptional<z.ZodObject<{
7880
+ version: z.ZodDefault<z.ZodLiteral<1>>;
7881
+ lastModified: z.ZodString;
7882
+ }, z.core.$strip>>;
7883
+ offerings: z.ZodOptional<z.ZodObject<{
7884
+ version: z.ZodDefault<z.ZodLiteral<1>>;
7885
+ lastModified: z.ZodString;
7886
+ }, z.core.$strip>>;
7887
+ roles: z.ZodOptional<z.ZodObject<{
7888
+ version: z.ZodDefault<z.ZodLiteral<1>>;
7889
+ lastModified: z.ZodString;
7890
+ }, z.core.$strip>>;
7891
+ goals: z.ZodOptional<z.ZodObject<{
7892
+ version: z.ZodDefault<z.ZodLiteral<1>>;
7893
+ lastModified: z.ZodString;
7894
+ }, z.core.$strip>>;
7895
+ systems: z.ZodOptional<z.ZodObject<{
7896
+ version: z.ZodDefault<z.ZodLiteral<1>>;
7897
+ lastModified: z.ZodString;
7898
+ }, z.core.$strip>>;
7899
+ ontology: z.ZodOptional<z.ZodObject<{
7900
+ version: z.ZodDefault<z.ZodLiteral<1>>;
7901
+ lastModified: z.ZodString;
7902
+ }, z.core.$strip>>;
7903
+ resources: z.ZodOptional<z.ZodObject<{
7904
+ version: z.ZodDefault<z.ZodLiteral<1>>;
7905
+ lastModified: z.ZodString;
7906
+ }, z.core.$strip>>;
7907
+ topology: z.ZodOptional<z.ZodObject<{
7908
+ version: z.ZodDefault<z.ZodLiteral<1>>;
7909
+ lastModified: z.ZodString;
7910
+ }, z.core.$strip>>;
7911
+ actions: z.ZodOptional<z.ZodObject<{
7912
+ version: z.ZodDefault<z.ZodLiteral<1>>;
7913
+ lastModified: z.ZodString;
7914
+ }, z.core.$strip>>;
7915
+ entities: z.ZodOptional<z.ZodObject<{
7916
+ version: z.ZodDefault<z.ZodLiteral<1>>;
7917
+ lastModified: z.ZodString;
7918
+ }, z.core.$strip>>;
7919
+ policies: z.ZodOptional<z.ZodObject<{
7920
+ version: z.ZodDefault<z.ZodLiteral<1>>;
7921
+ lastModified: z.ZodString;
7922
+ }, z.core.$strip>>;
7923
+ knowledge: z.ZodOptional<z.ZodObject<{
7924
+ version: z.ZodDefault<z.ZodLiteral<1>>;
7925
+ lastModified: z.ZodString;
7926
+ }, z.core.$strip>>;
7027
7927
  }, z.core.$strip>>, z.ZodTransform<{
7028
7928
  branding: {
7029
7929
  version: 1;
@@ -8022,7 +8922,15 @@ declare const OrganizationModelSchema$1: z.ZodObject<{
8022
8922
  }, z.core.$strip>>>>;
8023
8923
  }, z.core.$strip>;
8024
8924
 
8025
- type OrganizationModel$1 = z.infer<typeof OrganizationModelSchema$1>;
8925
+ type OrganizationModel = z.infer<typeof OrganizationModelSchema>;
8926
+ type OrganizationModelResourceEntry = z.infer<typeof ResourceEntrySchema>;
8927
+ type OrganizationModelResourceOntologyBinding = z.infer<typeof ResourceOntologyBindingSchema>;
8928
+ type OrganizationModelWorkflowResourceEntry = z.infer<typeof WorkflowResourceEntrySchema>;
8929
+ type OrganizationModelAgentResourceEntry = z.infer<typeof AgentResourceEntrySchema>;
8930
+ type OrganizationModelIntegrationResourceEntry = z.infer<typeof IntegrationResourceEntrySchema>;
8931
+ type OrganizationModelTopology = z.infer<typeof OmTopologyDomainSchema>;
8932
+ type OrganizationModelTopologyNodeRef = z.infer<typeof OmTopologyNodeRefSchema>;
8933
+ type OrganizationModelTopologyRelationship = z.infer<typeof OmTopologyRelationshipSchema>;
8026
8934
 
8027
8935
  type BusinessOntologyValidationIndexBase = {
8028
8936
  ontology: ResolvedOntologyIndex;
@@ -8035,12 +8943,6 @@ type CrmApiOntologyValidationIndex = BusinessOntologyValidationIndexBase & {
8035
8943
  crmPipelineCatalog: OntologyCatalogType;
8036
8944
  };
8037
8945
  type BusinessOntologyValidationIndex = LeadGenApiOntologyValidationIndex & CrmApiOntologyValidationIndex;
8038
- type SystemInterfaceReadinessIssueFamily = 'SYSTEM_INTERFACE_MISSING' | 'SYSTEM_INTERFACE_DISABLED' | 'SYSTEM_INTERFACE_INVALID' | 'SYSTEM_INTERFACE_NOT_READY' | 'SYSTEM_BRIDGE_NOT_READY'
8039
- /**
8040
- * The deployed OM snapshot hash does not match the canonical source hash.
8041
- * Redeploy with `pnpm operations:deploy` to refresh the snapshot.
8042
- */
8043
- | 'STALE_OM_SNAPSHOT';
8044
8946
  /**
8045
8947
  * Legacy mixed acquisition index.
8046
8948
  *
@@ -8049,7 +8951,7 @@ type SystemInterfaceReadinessIssueFamily = 'SYSTEM_INTERFACE_MISSING' | 'SYSTEM_
8049
8951
  * `compileLeadGenApiOntologyValidationIndex()`; CRM-aware paths should call the
8050
8952
  * CRM or bridge helpers above.
8051
8953
  */
8052
- declare function compileBusinessOntologyValidationIndex(model: OrganizationModel$1): BusinessOntologyValidationIndex;
8954
+ declare function compileBusinessOntologyValidationIndex(model: OrganizationModel): BusinessOntologyValidationIndex;
8053
8955
  /**
8054
8956
  * Lead-gen stage validators bound to a specific resolved validation index.
8055
8957
  *
@@ -11431,10 +12333,15 @@ interface ResourceMetricsConfig {
11431
12333
  * - API process: provides createLLMAdapter (real SDKs + process.env API keys)
11432
12334
  * - SDK worker: provides PostMessageLLMAdapter (proxies via platform.call)
11433
12335
  *
11434
- * Uses `any` for optional params so both the real createLLMAdapter (with typed
11435
- * AIUsageCollector/AICallContext) and the worker proxy (which ignores them) satisfy the type.
11436
- */
11437
- type LLMAdapterFactory = (config: ModelConfig, ...args: any[]) => LLMAdapter;
12336
+ * Signature mirrors `createLLMAdapter`'s real parameter list. `context` is narrowed to the two
12337
+ * shapes an agent ever actually builds (`processReasoning` passes `AgentReasoningContext`,
12338
+ * `Agent.callLLMForOutput` passes `AgentCompletionContext`) rather than the full `AICallContext`
12339
+ * union `createLLMAdapter` accepts -- a narrower optional param here is still assignable to the
12340
+ * wider one there. `createPostMessageAdapterFactory()`'s worker proxy ignores every param past
12341
+ * `config`; a shorter-arity function remains assignable to a longer optional-param function type,
12342
+ * so it still satisfies this type unchanged.
12343
+ */
12344
+ type LLMAdapterFactory = (config: ModelConfig, aiUsageCollector?: AIUsageCollector, callType?: BaseAICall['callType'], context?: AgentReasoningContext | AgentCompletionContext, organizationId?: string) => LLMAdapter;
11438
12345
  type AgentKind = 'orchestrator' | 'specialist' | 'utility' | 'platform';
11439
12346
  interface AgentConfig extends ResourceDefinition {
11440
12347
  type: 'agent';
@@ -11902,7 +12809,7 @@ interface ResourceDefinition {
11902
12809
  /** Whether this resource is archived and should be excluded from registration and deployment */
11903
12810
  archived?: boolean;
11904
12811
  }
11905
- type RuntimeResourceDescriptor = Extract<ResourceEntry$1, {
12812
+ type RuntimeResourceDescriptor = Extract<ResourceEntry, {
11906
12813
  kind: 'workflow' | 'agent' | 'integration';
11907
12814
  }>;
11908
12815
  type DescriptorBackedResourceDefinition<TResource extends RuntimeResourceDescriptor = RuntimeResourceDescriptor> = Omit<ResourceDefinition, 'resourceId' | 'type'> & {
@@ -12031,7 +12938,7 @@ interface IntegrationDefinition extends ResourceDefinition {
12031
12938
  /** Resource type discriminator (narrowed from base union) */
12032
12939
  type: 'integration';
12033
12940
  /** OM descriptor that owns canonical identity and governance metadata. */
12034
- resource?: Extract<ResourceEntry$1, {
12941
+ resource?: Extract<ResourceEntry, {
12035
12942
  kind: 'integration';
12036
12943
  }>;
12037
12944
  /** Integration provider type */
@@ -12308,7 +13215,7 @@ interface DeploymentSpec {
12308
13215
  /** Deployment version (semver) */
12309
13216
  version: string;
12310
13217
  /** Optional full Organization Model snapshot used for OM-code validation and deployment persistence */
12311
- organizationModel?: OrganizationModel$1;
13218
+ organizationModel?: OrganizationModel;
12312
13219
  /** Workflow definitions */
12313
13220
  workflows?: WorkflowDefinition[];
12314
13221
  /** Agent definitions */
@@ -12620,13 +13527,13 @@ type ResourceValidatorMode = 'strict' | 'warn-only';
12620
13527
  type ResourceGovernanceValidationIssueType = 'missing-code-resource' | 'missing-om-resource' | 'type-mismatch' | 'system-mismatch' | 'missing-om-system' | 'raw-resource-id' | 'descriptor-mismatch' | 'missing-ontology-actions' | 'ontology-reference-missing' | 'ontology-topology-grant-missing' | 'primary-action-mismatch' | 'topology-reference-missing';
12621
13528
  interface ResourceGovernanceModel {
12622
13529
  systems?: Record<string, SystemEntry>;
12623
- resources?: Record<string, ResourceEntry$1>;
12624
- ontology?: OrganizationModel$1['ontology'];
12625
- topology?: OrganizationModel$1['topology'];
12626
- roles?: OrganizationModel$1['roles'];
12627
- policies?: OrganizationModel$1['policies'];
12628
- entities?: OrganizationModel$1['entities'];
12629
- actions?: OrganizationModel$1['actions'];
13530
+ resources?: Record<string, ResourceEntry>;
13531
+ ontology?: OrganizationModel['ontology'];
13532
+ topology?: OrganizationModel['topology'];
13533
+ roles?: OrganizationModel['roles'];
13534
+ policies?: OrganizationModel['policies'];
13535
+ entities?: OrganizationModel['entities'];
13536
+ actions?: OrganizationModel['actions'];
12630
13537
  }
12631
13538
  interface ResourceGovernanceValidationIssue {
12632
13539
  type: ResourceGovernanceValidationIssueType;
@@ -12822,377 +13729,6 @@ declare class ToolingError extends ExecutionError {
12822
13729
  constructor(errorType: string, message: string, details?: unknown);
12823
13730
  }
12824
13731
 
12825
- /**
12826
- * Tenant-authorable readiness requirements for a system's API interface.
12827
- *
12828
- * Built-in profiles (`sales.lead-gen.api`, `sales.crm.api`,
12829
- * `sales.lead-gen.crm-handoff`) derive their requirements from platform code
12830
- * and do not need a `readinessContract`. Custom systems (any profile id not in
12831
- * the built-in registry) MUST declare a contract so structural readiness
12832
- * validation can proceed without platform hardcoding.
12833
- *
12834
- * Each field is an array of ontology IDs that this system must satisfy:
12835
- * - `requiredObjects` – ontology object types the interface depends on
12836
- * - `requiredCatalogs` – catalog types the interface requires (non-empty)
12837
- * - `requiredKinds` – (optional) ontology kind filters for future use
12838
- */
12839
- declare const SystemApiInterfaceReadinessContractSchema = z
12840
- .object({
12841
- /** Ontology IDs of object types the interface depends on. */
12842
- requiredObjects: z.array(z.string().trim().min(1)).default([]),
12843
- /** Ontology IDs of catalog types the interface requires (must be non-empty). */
12844
- requiredCatalogs: z.array(z.string().trim().min(1)).default([]),
12845
- /** Optional ontology kind filters (reserved for future profile extensions). */
12846
- requiredKinds: z.array(z.string().trim().min(1)).optional()
12847
- })
12848
- .strict()
12849
-
12850
- // ---------------------------------------------------------------------------
12851
- // Profile registry
12852
- //
12853
- // Maps a readiness profile id to a lookup result. Built-in presets are
12854
- // registered at module load; callers may register additional presets via
12855
- // `registerReadinessProfile`. Unknown ids resolve to `undefined` — validated
12856
- // structurally through the system's declared `readinessContract`.
12857
- // ---------------------------------------------------------------------------
12858
-
12859
- type ReadinessProfileKind = 'built-in' | 'custom'
12860
-
12861
- interface ReadinessProfileEntry {
12862
- readonly profileId: string
12863
- readonly kind: ReadinessProfileKind
12864
- }
12865
-
12866
- /**
12867
- * Look up a readiness profile entry by id.
12868
- *
12869
- * Returns `undefined` for unknown ids (not in the built-in list and not
12870
- * registered via `registerReadinessProfile`). Unknown profiles are validated
12871
- * structurally through the system's `readinessContract` — unknown-profile is
12872
- * NOT a schema-layer rejection.
12873
- */
12874
- declare function lookupReadinessProfile(profileId: string): ReadinessProfileEntry | undefined {
12875
- return _profileRegistry.get(profileId)
12876
- }
12877
-
12878
- /**
12879
- * Register a custom readiness profile preset.
12880
- *
12881
- * Tenant tooling or SDK extensions may call this during startup to register
12882
- * named presets. Registered presets are then resolvable via `lookupReadinessProfile`.
12883
- * Built-in profile ids cannot be overwritten.
12884
- */
12885
- declare function registerReadinessProfile(profileId: string): ReadinessProfileEntry {
12886
- const existing = _profileRegistry.get(profileId)
12887
- if (existing !== undefined) return existing
12888
- const entry: ReadinessProfileEntry = { profileId, kind: 'custom' }
12889
- _profileRegistry.set(profileId, entry)
12890
- return entry
12891
- }
12892
-
12893
- /**
12894
- * Return the effective readiness profile id for a system interface.
12895
- * Falls back to `systemPath.interfaceKey` when `readinessProfile` is omitted.
12896
- * This is the canonical profile-resolution function used by validation code.
12897
- */
12898
- declare function profileForInterface(systemPath: string, interfaceKey: string, readinessProfile?: string): string {
12899
- return readinessProfile ?? `${systemPath}.${interfaceKey}`
12900
- }
12901
-
12902
- /**
12903
- * Return true if the given profile id is a built-in platform preset.
12904
- */
12905
- declare function isBuiltInReadinessProfile(profileId: string): boolean {
12906
- return _profileRegistry.get(profileId)?.kind === 'built-in'
12907
- }
12908
- type SystemApiInterfaceReadinessContract = z.infer<typeof SystemApiInterfaceReadinessContractSchema>
12909
-
12910
- declare const ResourceOntologyBindingSchema = z
12911
- .object({
12912
- actions: z.array(OntologyIdSchema).optional(),
12913
- primaryAction: OntologyIdSchema.optional(),
12914
- reads: z.array(OntologyIdSchema).optional(),
12915
- writes: z.array(OntologyIdSchema).optional(),
12916
- usesCatalogs: z.array(OntologyIdSchema).optional(),
12917
- emits: z.array(OntologyIdSchema).optional(),
12918
- /**
12919
- * Optional typed contract binding for this resource's workflow I/O.
12920
- * Each ref is a `package/subpath#ExportName` string that resolves to a
12921
- * Zod schema in the tenant-owned organization model package.
12922
- *
12923
- * Absence of this field preserves all existing behavior — it is additive + optional.
12924
- * Tier-1 validation (schema.ts): ref-string shape only (browser-safe, no imports).
12925
- * Tier-2 validation (om:verify): intra-package typed-map resolution asserts ZodType.
12926
- */
12927
- contract: z
12928
- .object({
12929
- input: ContractRefSchema.optional(),
12930
- output: ContractRefSchema.optional()
12931
- })
12932
- .optional()
12933
- })
12934
- .superRefine((binding, ctx) => {
12935
- if (binding.primaryAction === undefined) return
12936
- if (binding.actions?.includes(binding.primaryAction)) return
12937
-
12938
- ctx.addIssue({
12939
- code: z.ZodIssueCode.custom,
12940
- path: ['primaryAction'],
12941
- message: 'Resource ontology primaryAction must be included in actions'
12942
- })
12943
- })
12944
-
12945
- type OntologyRefInput = string | { id: string }
12946
- type ResourceOntologyBindingInput = {
12947
- actions?: OntologyRefInput[]
12948
- primaryAction?: OntologyRefInput
12949
- reads?: OntologyRefInput[]
12950
- writes?: OntologyRefInput[]
12951
- usesCatalogs?: OntologyRefInput[]
12952
- emits?: OntologyRefInput[]
12953
- }
12954
-
12955
- declare const WorkflowResourceEntrySchema = ResourceEntryBaseSchema.extend({
12956
- kind: z.literal('workflow'),
12957
- emits: z.array(EventEmissionDescriptorSchema).optional()
12958
- })
12959
-
12960
- declare const AgentResourceEntrySchema = ResourceEntryBaseSchema.extend({
12961
- kind: z.literal('agent'),
12962
- /** Mirrors code-side AgentConfig.kind. */
12963
- agentKind: AgentKindSchema,
12964
- /** Role this agent embodies, if any. */
12965
- actsAsRoleId: ModelIdSchema.meta({ ref: 'role' }).optional(),
12966
- /** Mirrors AgentConfig.sessionCapable. */
12967
- sessionCapable: z.boolean(),
12968
- /** Broad/composite callable entry points orchestrated by this agent. */
12969
- invocations: z.array(ActionInvocationSchema).default([]),
12970
- emits: z.array(EventEmissionDescriptorSchema).optional()
12971
- })
12972
-
12973
- declare const IntegrationResourceEntrySchema = ResourceEntryBaseSchema.extend({
12974
- kind: z.literal('integration'),
12975
- provider: z.string().trim().min(1).max(100)
12976
- })
12977
-
12978
- declare const ResourceEntrySchema = z.discriminatedUnion('kind', [
12979
- WorkflowResourceEntrySchema,
12980
- AgentResourceEntrySchema,
12981
- IntegrationResourceEntrySchema,
12982
- ScriptResourceEntrySchema
12983
- ])
12984
-
12985
- declare function defineResource<const TResource extends ResourceEntry>(resource: TResource): TResource {
12986
- return ResourceEntrySchema.parse(resource) as TResource
12987
- }
12988
-
12989
- declare function defineResources<const TResources extends Record<string, ResourceEntry>>(
12990
- resources: TResources
12991
- ): TResources {
12992
- return Object.fromEntries(
12993
- Object.entries(resources).map(([key, resource]) => [key, ResourceEntrySchema.parse(resource)])
12994
- ) as TResources
12995
- }
12996
-
12997
- declare function defineResourceOntology(input: ResourceOntologyBindingInput): ResourceOntologyBinding {
12998
- return ResourceOntologyBindingSchema.parse({
12999
- actions: ontologyIdArrayFrom(input.actions),
13000
- primaryAction: input.primaryAction === undefined ? undefined : ontologyIdFrom(input.primaryAction),
13001
- reads: ontologyIdArrayFrom(input.reads),
13002
- writes: ontologyIdArrayFrom(input.writes),
13003
- usesCatalogs: ontologyIdArrayFrom(input.usesCatalogs),
13004
- emits: ontologyIdArrayFrom(input.emits)
13005
- })
13006
- }
13007
- type ResourceOntologyBinding = z.infer<typeof ResourceOntologyBindingSchema>
13008
- type ResourceEntry = z.infer<typeof ResourceEntrySchema>
13009
-
13010
- declare const OmTopologyNodeRefSchema = z.discriminatedUnion('kind', [
13011
- z.object({ kind: z.literal('system'), id: ModelIdSchema }),
13012
- z.object({ kind: z.literal('resource'), id: ResourceIdSchema }),
13013
- z.object({ kind: z.literal('ontology'), id: OntologyIdSchema }),
13014
- z.object({ kind: z.literal('policy'), id: ModelIdSchema }),
13015
- z.object({ kind: z.literal('role'), id: ModelIdSchema }),
13016
- z.object({ kind: z.literal('trigger'), id: ResourceIdSchema }),
13017
- z.object({ kind: z.literal('humanCheckpoint'), id: ResourceIdSchema }),
13018
- z.object({ kind: z.literal('externalResource'), id: ResourceIdSchema })
13019
- ])
13020
-
13021
- declare const OmTopologyRelationshipSchema = z.object({
13022
- from: OmTopologyNodeRefSchema,
13023
- kind: OmTopologyRelationshipKindSchema,
13024
- to: OmTopologyNodeRefSchema,
13025
- systemPath: SystemPathSchema.optional(),
13026
- required: z.boolean().optional(),
13027
- metadata: OmTopologyMetadataSchema.optional()
13028
- })
13029
-
13030
- declare const OmTopologyDomainSchema = z
13031
- .object({
13032
- version: z.literal(1).default(1),
13033
- relationships: z.record(z.string().trim().min(1).max(255), OmTopologyRelationshipSchema).default({})
13034
- })
13035
- .default({ version: 1, relationships: {} })
13036
- type OmTopologyNodeRef = z.infer<typeof OmTopologyNodeRefSchema>
13037
- type OmTopologyRelationship = z.infer<typeof OmTopologyRelationshipSchema>
13038
- type OmTopologyDomain = z.infer<typeof OmTopologyDomainSchema>
13039
- type TopologyRelationshipInput = Omit<OmTopologyRelationship, 'from' | 'to'> & {
13040
- from: OmTopologyNodeInput
13041
- to: OmTopologyNodeInput
13042
- }
13043
- type OmTopologyNodeInput = OmTopologyNodeRef | ResourceEntry
13044
-
13045
- declare const topologyRef = {
13046
- system: (system: TopologyRefFactoryInput) => parseRef('system', idFrom(system)),
13047
- resource: (resource: TopologyRefFactoryInput) => parseRef('resource', idFrom(resource)),
13048
- ontology: (record: TopologyRefFactoryInput) => parseRef('ontology', idFrom(record)),
13049
- policy: (policy: TopologyRefFactoryInput) => parseRef('policy', idFrom(policy)),
13050
- role: (role: TopologyRefFactoryInput) => parseRef('role', idFrom(role)),
13051
- trigger: (trigger: TopologyRefFactoryInput) => parseRef('trigger', idFrom(trigger)),
13052
- humanCheckpoint: (checkpoint: TopologyRefFactoryInput) => parseRef('humanCheckpoint', idFrom(checkpoint)),
13053
- externalResource: (externalResource: TopologyRefFactoryInput) => parseRef('externalResource', idFrom(externalResource))
13054
- } as const
13055
-
13056
- declare const topologyRelationship = {
13057
- triggers: (from: OmTopologyNodeInput, to: OmTopologyNodeInput, options: TopologyRelationshipOptions = {}) =>
13058
- defineTopologyRelationship({
13059
- ...options,
13060
- from,
13061
- kind: 'triggers',
13062
- to
13063
- }),
13064
- uses: (from: OmTopologyNodeInput, to: OmTopologyNodeInput, options: TopologyRelationshipOptions = {}) =>
13065
- defineTopologyRelationship({
13066
- ...options,
13067
- from,
13068
- kind: 'uses',
13069
- to
13070
- }),
13071
- approval: (from: OmTopologyNodeInput, to: OmTopologyNodeInput, options: TopologyRelationshipOptions = {}) =>
13072
- defineTopologyRelationship({
13073
- ...options,
13074
- from,
13075
- kind: 'approval',
13076
- to
13077
- }),
13078
- usesIntegration: (
13079
- from: OmTopologyNodeInput,
13080
- integration: OmTopologyNodeInput,
13081
- options: TopologyRelationshipOptions = {}
13082
- ) =>
13083
- defineTopologyRelationship({
13084
- required: true,
13085
- ...options,
13086
- from,
13087
- kind: 'uses',
13088
- to: integration
13089
- }),
13090
- requestsApproval: (
13091
- from: OmTopologyNodeInput,
13092
- checkpoint: TopologyRefFactoryInput,
13093
- options: TopologyRelationshipOptions = {}
13094
- ) =>
13095
- defineTopologyRelationship({
13096
- required: true,
13097
- ...options,
13098
- from,
13099
- kind: 'approval',
13100
- to: topologyRef.humanCheckpoint(checkpoint)
13101
- }),
13102
- checkpointRoutesTo: (
13103
- checkpoint: TopologyRefFactoryInput,
13104
- to: OmTopologyNodeInput,
13105
- options: TopologyRelationshipOptions = {}
13106
- ) =>
13107
- defineTopologyRelationship({
13108
- required: true,
13109
- ...options,
13110
- from: topologyRef.humanCheckpoint(checkpoint),
13111
- kind: 'triggers',
13112
- to
13113
- })
13114
- } as const
13115
-
13116
- declare function parseTopologyNodeRef(input: string | OmTopologyNodeRef): OmTopologyNodeRef {
13117
- if (typeof input !== 'string') return OmTopologyNodeRefSchema.parse(input)
13118
-
13119
- const separatorIndex = input.indexOf(':')
13120
- if (separatorIndex === -1) {
13121
- throw new Error(`Topology node ref "${input}" must use <kind>:<id>`)
13122
- }
13123
-
13124
- const kind = input.slice(0, separatorIndex)
13125
- const id = input.slice(separatorIndex + 1)
13126
- if (!OmTopologyNodeKindSchema.safeParse(kind).success) {
13127
- throw new Error(`Topology node ref "${input}" has unsupported kind "${kind}"`)
13128
- }
13129
-
13130
- return OmTopologyNodeRefSchema.parse({ kind, id })
13131
- }
13132
-
13133
- declare function defineTopologyRelationship(input: TopologyRelationshipInput): OmTopologyRelationship {
13134
- return OmTopologyRelationshipSchema.parse({
13135
- ...input,
13136
- from: compileTopologyNodeRef(input.from),
13137
- to: compileTopologyNodeRef(input.to)
13138
- })
13139
- }
13140
-
13141
- declare function defineTopology(
13142
- relationships: Record<string, TopologyRelationshipInput> | TopologyRelationshipInput[]
13143
- ): OmTopologyDomain {
13144
- const entries = Array.isArray(relationships)
13145
- ? relationships.map((relationship, index) => [`relationship-${index + 1}`, relationship] as const)
13146
- : Object.entries(relationships)
13147
-
13148
- return OmTopologyDomainSchema.parse({
13149
- version: 1,
13150
- relationships: Object.fromEntries(entries.map(([key, relationship]) => [key, defineTopologyRelationship(relationship)]))
13151
- })
13152
- }
13153
-
13154
- declare const OrganizationModelSchema = OrganizationModelSchemaBase.superRefine(refineOrganizationModel)
13155
-
13156
- type OrganizationModel = z.infer<typeof OrganizationModelSchema>
13157
- type OrganizationModelResourceEntry = z.infer<typeof ResourceEntrySchema>
13158
- type OrganizationModelResourceOntologyBinding = z.infer<typeof ResourceOntologyBindingSchema>
13159
- type OrganizationModelWorkflowResourceEntry = z.infer<typeof WorkflowResourceEntrySchema>
13160
- type OrganizationModelAgentResourceEntry = z.infer<typeof AgentResourceEntrySchema>
13161
- type OrganizationModelIntegrationResourceEntry = z.infer<typeof IntegrationResourceEntrySchema>
13162
- type OrganizationModelTopology = z.infer<typeof OmTopologyDomainSchema>
13163
- type OrganizationModelTopologyNodeRef = z.infer<typeof OmTopologyNodeRefSchema>
13164
- type OrganizationModelTopologyRelationship = z.infer<typeof OmTopologyRelationshipSchema>
13165
-
13166
- declare const ActionSchema = z.object({
13167
- id: ActionIdSchema,
13168
- /** Domain-map iteration order. Convention: multiples of 10 (10, 20, 30, ...) to allow easy insertion. */
13169
- order: z.number(),
13170
- label: LabelSchema,
13171
- description: DescriptionSchema.optional(),
13172
- scope: ActionScopeSchema.default('global'),
13173
- resourceId: ActionResourceIdSchema.optional(),
13174
- affects: z.array(EntityIdSchema.meta({ ref: 'entity' })).optional(),
13175
- invocations: z.array(ActionInvocationSchema).default([]),
13176
- knowledge: z
13177
- .array(ModelIdSchema.meta({ ref: 'knowledge' }))
13178
- .default([])
13179
- .optional(),
13180
- lifecycle: z
13181
- .enum(['draft', 'beta', 'active', 'deprecated', 'archived'])
13182
- .meta({ label: 'Lifecycle', color: 'teal' })
13183
- .default('active')
13184
- })
13185
- type Action = z.infer<typeof ActionSchema>
13186
-
13187
- // CRM stage/state catalogs are model-owned (authored in the tenant-owned organization model package
13188
- // canonicalOrganizationModel). The published core schema validates only the
13189
- // transport shape; closed-catalog membership is enforced by the caller/API
13190
- // layer via model-injected validators (mirrors LeadGenStageKeySchema).
13191
- declare const CrmStageKeySchema = z.string().trim().min(1)
13192
- declare const CrmStateKeySchema = z.string().trim().min(1)
13193
- type CrmStageKey = z.infer<typeof CrmStageKeySchema>
13194
- type CrmStateKey = z.infer<typeof CrmStateKeySchema>
13195
-
13196
13732
  type ResourceOntologyBindingResolver = (resourceId: string) => OrganizationModelResourceOntologyBinding | undefined;
13197
13733
  type WorkflowResourceDescriptorResolver = (resourceId: string) => OrganizationModelWorkflowResourceEntry;
13198
13734
  type AgentResourceDescriptorResolver = (resourceId: string) => OrganizationModelAgentResourceEntry;
@@ -13238,7 +13774,7 @@ declare function projectDeploymentSpec(options: ProjectDeploymentSpecOptions): D
13238
13774
  */
13239
13775
 
13240
13776
  type WorkflowResourceDescriptorMap = Record<string, OrganizationModelResourceEntry>;
13241
- type WorkflowConfigActionRegistry = readonly Pick<Action, 'id' | 'resourceId'>[];
13777
+ type WorkflowConfigActionRegistry = readonly Pick<Action$1, 'id' | 'resourceId'>[];
13242
13778
  declare function defineWorkflowConfig<const TResourceId extends string>(resourceId: TResourceId, descriptors: WorkflowResourceDescriptorMap, actionRegistry?: WorkflowConfigActionRegistry): {
13243
13779
  readonly name: string;
13244
13780
  readonly description: string;
@@ -13258,5 +13794,5 @@ declare function defineWorkflowConfig<const TResourceId extends string>(resource
13258
13794
  declare const ListBuilderStageKeySchema: z.ZodString;
13259
13795
  type ListBuilderStageKey = z.infer<typeof ListBuilderStageKeySchema>;
13260
13796
 
13261
- export { ActivityEventSchema, BuildPlanSnapshotStepSchema, ProspectingBuildTemplateSchema as BuildTemplateSchema, ContractRefResolutionError, CrmStageKeySchema, CrmStateKeySchema, EmailSchema, ExecutionError, ListBuilderStageKeySchema, ProcessingStageStatusSchema, RegistryValidationError, ResourceRegistry, StepType, ToolingError, bindResourceDescriptor, compileBusinessOntologyValidationIndex, concurrentPool, createLeadGenStageValidators, defineContract, defineResource, defineResourceOntology, defineResources, defineStep, defineTopology, defineTopologyRelationship, defineWorkflow, defineWorkflowConfig, deriveActions, diagnosticOutput, integrationInput, isBuiltInReadinessProfile, isZodType, lookupReadinessProfile, parseTopologyNodeRef, profileForInterface, projectDeploymentSpec, projectTopologyRelationships, registerReadinessProfile, resolveContractRef, runDiagnostic, splitName, toSdkResourceDescriptor, topologyRef, topologyRelationship, validateDeclaredSystemInterfaceReadiness, validateResourceGovernance, withPlatformAgentResourceDescriptor, withPlatformAgentResourceDescriptors, withPlatformIntegrationResourceDescriptor, withPlatformIntegrationResourceDescriptors, withPlatformResourceDescriptor, withPlatformResourceDescriptors };
13262
- export type { AbsoluteScheduleConfig, AcqCompany, AcqContact, AcqDeal, AcqDealRow, AcqList, Action$1 as Action, ActionDef, ActivityEvent, AddToCampaignLead, AddToCampaignParams, AddToCampaignResult, AgentConfig, AgentConstraints, AgentDefinition, AgentMemory, AgentResourceDescriptorResolver, FindCompanyEmailParams as AnymailfinderFindCompanyEmailParams, FindCompanyEmailResult as AnymailfinderFindCompanyEmailResult, FindDecisionMakerEmailParams as AnymailfinderFindDecisionMakerEmailParams, FindDecisionMakerEmailResult as AnymailfinderFindDecisionMakerEmailResult, FindPersonEmailParams as AnymailfinderFindPersonEmailParams, FindPersonEmailResult as AnymailfinderFindPersonEmailResult, AnymailfinderToolMap, VerifyEmailParams as AnymailfinderVerifyEmailParams, VerifyEmailResult as AnymailfinderVerifyEmailResult, ApifyToolMap, ApifyWebhookConfig, AppendRowsParams, AppendRowsResult, ApprovalToolMap, AttioToolMap, BatchUpdateParams, BatchUpdateResult, BuildPlanSnapshotStep, BulkDeleteLeadsParams, BulkDeleteLeadsResult, BulkImportParams, BulkImportResult, BusinessOntologyValidationIndex, CancelHitlByDealIdParams, CancelSchedulesAndHitlByEmailParams, ClearDealFieldsParams, ClearRangeParams, ClearRangeResult, ClickUpToolMap, CompanyFilters, ConcurrentPoolOptions, ConcurrentPoolResult, ConditionalNext, ContactFilters, Contract, ContractRefResolutionErrorCode, ContractRegistry, CreateAttributeParams, CreateAttributeResult, CreateAutoPaymentLinkParams, CreateAutoPaymentLinkResult, CreateCheckoutSessionParams, CreateCheckoutSessionResult, CreateCompanyParams, CreateContactParams, CreateEnvelopeParams, CreateEnvelopeResult, CreateFolderParams, CreateFolderResult, CreateListParams, CreateNoteParams, CreateNoteResult, CreatePaymentLinkParams, CreatePaymentLinkResult, CreateRecordParams, CreateRecordResult, CreateScheduleInput, CrmStageKey, CrmStateKey, CrmToolMap, DeleteDealParams, DeleteNoteParams, DeleteNoteResult, DeleteRecordParams, DeleteRecordResult, DeleteRowByValueParams, DeleteRowByValueResult, DeploymentSpec, DiagnosticOutput, DownloadDocumentParams, DownloadDocumentResult, DropboxToolMap, ElevasConfig, EmailToolMap, EnvelopeDocument, EventTriggerConfig, ExecutionContext, ExecutionInterface, ExecutionMetadata, ExecutionToolMap, FilterExpression, FilterRowsParams, FilterRowsResult, FormField, FormFieldType, FormSchema, GetDailyCampaignAnalyticsParams, GetDailyCampaignAnalyticsResult, GetEmailsParams, GetEmailsResult, GetEnvelopeParams, GetEnvelopeResult, GetHeadersParams, GetHeadersResult, GetLastRowParams, GetLastRowResult, GetPaymentLinkParams, GetPaymentLinkResult, GetRecordParams, GetRecordResult, GetRowByValueParams, GetRowByValueResult, GetSpreadsheetMetadataParams, GetSpreadsheetMetadataResult, GmailSendEmailParams, GmailSendEmailResult, GmailToolMap, GoogleSheetsToolMap, HumanCheckpointDefinition, InstantlyToolMap, IntegrationDefinition, IntegrationResourceDescriptorResolver, JsonSchema, LLMAdapterFactory, LLMGenerateRequest, LLMGenerateResponse, LLMMessage, LLMModel, LeadGenStageValidators, LeadToolMap, LinearNext, ListAttributesParams, ListAttributesResult, ListBuilderStageKey, ListBuilderStep, ListLeadsParams, ListLeadsResult, ListNotesParams, ListNotesResult, ListObjectsResult, ListPaymentLinksParams, ListPaymentLinksResult, ListToolMap, MarkProposalReviewedParams, MarkProposalSentParams, MethodEntry, MillionVerifierToolMap, ModelConfig, NextConfig, NotificationSDKInput, NotificationToolMap, OrganizationModelAgentResourceEntry, OrganizationModelIntegrationResourceEntry, OrganizationModelResourceEntry, OrganizationModelResourceOntologyBinding, OrganizationModelTopology, OrganizationModelTopologyNodeRef, OrganizationModelTopologyRelationship, OrganizationModelWorkflowResourceEntry, PaginatedResult, PaginationParams, PdfToolMap, ProcessingStageStatus, ProjectDeploymentSpecOptions, ProjectsToolMap, QueryRecordsParams, QueryRecordsResult, ReadSheetParams, ReadSheetResult, ReadinessProfileEntry, ReadinessProfileKind, Recipient, RecurringScheduleConfig, RelationshipDeclaration, RelativeScheduleConfig, RemoveFromSubsequenceParams, RemoveFromSubsequenceResult, ResendGetEmailParams, ResendGetEmailResult, ResendSendEmailParams, ResendSendEmailResult, ResendToolMap, ResolvedContractRef, ResourceCategory, ResourceDefinition, ResourceLink, ResourceMetricsConfig, ResourceOntologyBindingResolver, ResourceRelationships, ResourceStatus$1 as ResourceStatus, ResourceType, RunActorParams, RunActorResult, SDKLLMGenerateParams, ScheduleOriginTracking, ScheduleTarget, ScheduleTriggerConfig, SchedulerToolMap, SendReplyParams, SendReplyResult, SetContactNurtureParams, SheetInfo, SignatureApiFieldType, SignatureApiToolMap, SigningPlace, SortCriteria, StartActorParams, StartActorResult, StepHandler, StorageDeleteInput, StorageDeleteOutput, StorageDownloadInput, StorageDownloadOutput, StorageListInput, StorageListOutput, StorageSignedUrlInput, StorageSignedUrlOutput, StorageToolMap, StorageUploadInput, StorageUploadOutput, StripeToolMap, SystemApiInterfaceReadinessContract, TaskSchedule, TaskScheduleConfig, TombaToolMap, Tool, ToolExecutionOptions, ToolMethodMap, ToolingErrorType, TransitionItemParams, TriggerConfig, TriggerDefinition, UpdateAttributeParams, UpdateAttributeResult, UpdateCloseLostReasonParams, UpdateCompanyParams, UpdateContactParams, UpdateDiscoveryDataParams, UpdateFeesParams, UpdateInterestStatusParams, UpdateInterestStatusResult, UpdateListParams, UpdatePaymentLinkParams, UpdatePaymentLinkResult, UpdateProposalDataParams, UpdateRecordParams, UpdateRecordResult, UpdateRowByValueParams, UpdateRowByValueResult, UploadFileParams, UploadFileResult, UpsertCompanyParams, UpsertContactParams, UpsertDealParams, UpsertRowParams, UpsertRowResult, VoidEnvelopeParams, VoidEnvelopeResult, WebhookProviderType, WebhookTriggerConfig, WorkflowConfig, WorkflowConfigActionRegistry, WorkflowDefinition, WorkflowLogger, WorkflowResourceDescriptorMap, WorkflowResourceDescriptorResolver, WorkflowStep, WriteSheetParams, WriteSheetResult };
13797
+ export { ActivityEventSchema, BuildPlanSnapshotStepSchema, ProspectingBuildTemplateSchema as BuildTemplateSchema, ContractRefResolutionError, CrmStageKeySchema, CrmStateKeySchema, EmailSchema, ExecutionError, ListBuilderStageKeySchema, ProcessingStageStatusSchema, RegistryValidationError, ResourceRegistry, StepType, ToolingError, bindResourceDescriptor, compileBusinessOntologyValidationIndex, concurrentPool, createLeadGenStageValidators, defineContract, defineResource, defineResourceOntology, defineResources, defineStep, defineTopology, defineTopologyRelationship, defineWorkflow, defineWorkflowConfig, deriveActions, diagnosticOutput, integrationInput, isBuiltInReadinessProfile, isZodType, lookupReadinessProfile, parseTopologyNodeRef, projectDeploymentSpec, projectTopologyRelationships, registerReadinessProfile, resolveContractRef, runDiagnostic, splitName, toSdkResourceDescriptor, topologyRef, topologyRelationship, validateDeclaredSystemInterfaceReadiness, validateResourceGovernance, withPlatformAgentResourceDescriptor, withPlatformAgentResourceDescriptors, withPlatformIntegrationResourceDescriptor, withPlatformIntegrationResourceDescriptors, withPlatformResourceDescriptor, withPlatformResourceDescriptors };
13798
+ export type { AbsoluteScheduleConfig, AcqCompany, AcqContact, AcqDeal, AcqDealRow, AcqList, Action, ActionDef, ActivityEvent, AddToCampaignLead, AddToCampaignParams, AddToCampaignResult, AgentConfig, AgentConstraints, AgentDefinition, AgentMemory, AgentResourceDescriptorResolver, FindCompanyEmailParams as AnymailfinderFindCompanyEmailParams, FindCompanyEmailResult as AnymailfinderFindCompanyEmailResult, FindDecisionMakerEmailParams as AnymailfinderFindDecisionMakerEmailParams, FindDecisionMakerEmailResult as AnymailfinderFindDecisionMakerEmailResult, FindPersonEmailParams as AnymailfinderFindPersonEmailParams, FindPersonEmailResult as AnymailfinderFindPersonEmailResult, AnymailfinderToolMap, VerifyEmailParams as AnymailfinderVerifyEmailParams, VerifyEmailResult as AnymailfinderVerifyEmailResult, ApifyToolMap, ApifyWebhookConfig, AppendRowsParams, AppendRowsResult, ApprovalToolMap, AttioToolMap, BatchUpdateParams, BatchUpdateResult, BuildPlanSnapshotStep, BulkDeleteLeadsParams, BulkDeleteLeadsResult, BulkImportParams, BulkImportResult, BusinessOntologyValidationIndex, CancelHitlByDealIdParams, CancelSchedulesAndHitlByEmailParams, ClearDealFieldsParams, ClearRangeParams, ClearRangeResult, ClickUpToolMap, CompanyFilters, ConcurrentPoolOptions, ConcurrentPoolResult, ConditionalNext, ContactFilters, Contract, ContractRefResolutionErrorCode, ContractRegistry, CreateAttributeParams, CreateAttributeResult, CreateAutoPaymentLinkParams, CreateAutoPaymentLinkResult, CreateCheckoutSessionParams, CreateCheckoutSessionResult, CreateCompanyParams, CreateContactParams, CreateEnvelopeParams, CreateEnvelopeResult, CreateFolderParams, CreateFolderResult, CreateListParams, CreateNoteParams, CreateNoteResult, CreatePaymentLinkParams, CreatePaymentLinkResult, CreateRecordParams, CreateRecordResult, CreateScheduleInput, CrmStageKey, CrmStateKey, CrmToolMap, DeleteDealParams, DeleteNoteParams, DeleteNoteResult, DeleteRecordParams, DeleteRecordResult, DeleteRowByValueParams, DeleteRowByValueResult, DeploymentSpec, DiagnosticOutput, DownloadDocumentParams, DownloadDocumentResult, DropboxToolMap, ElevasConfig, EmailToolMap, EnvelopeDocument, EventTriggerConfig, ExecutionContext, ExecutionInterface, ExecutionMetadata, ExecutionToolMap, FilterExpression, FilterRowsParams, FilterRowsResult, FormField, FormFieldType, FormSchema, GetDailyCampaignAnalyticsParams, GetDailyCampaignAnalyticsResult, GetEmailsParams, GetEmailsResult, GetEnvelopeParams, GetEnvelopeResult, GetHeadersParams, GetHeadersResult, GetLastRowParams, GetLastRowResult, GetPaymentLinkParams, GetPaymentLinkResult, GetRecordParams, GetRecordResult, GetRowByValueParams, GetRowByValueResult, GetSpreadsheetMetadataParams, GetSpreadsheetMetadataResult, GmailSendEmailParams, GmailSendEmailResult, GmailToolMap, GoogleSheetsToolMap, HumanCheckpointDefinition, InstantlyToolMap, IntegrationDefinition, IntegrationResourceDescriptorResolver, JsonSchema, LLMAdapterFactory, LLMGenerateRequest, LLMGenerateResponse, LLMMessage, LLMModel, LeadGenStageValidators, LeadToolMap, LinearNext, ListAttributesParams, ListAttributesResult, ListBuilderStageKey, ListBuilderStep, ListLeadsParams, ListLeadsResult, ListNotesParams, ListNotesResult, ListObjectsResult, ListPaymentLinksParams, ListPaymentLinksResult, ListToolMap, MarkProposalReviewedParams, MarkProposalSentParams, MethodEntry, MillionVerifierToolMap, ModelConfig, NextConfig, NotificationSDKInput, NotificationToolMap, OrganizationModelAgentResourceEntry, OrganizationModelIntegrationResourceEntry, OrganizationModelResourceEntry, OrganizationModelResourceOntologyBinding, OrganizationModelTopology, OrganizationModelTopologyNodeRef, OrganizationModelTopologyRelationship, OrganizationModelWorkflowResourceEntry, PaginatedResult, PaginationParams, PdfToolMap, ProcessingStageStatus, ProjectDeploymentSpecOptions, ProjectsToolMap, QueryRecordsParams, QueryRecordsResult, ReadSheetParams, ReadSheetResult, ReadinessProfileEntry, ReadinessProfileKind, Recipient, RecurringScheduleConfig, RelationshipDeclaration, RelativeScheduleConfig, RemoveFromSubsequenceParams, RemoveFromSubsequenceResult, ResendGetEmailParams, ResendGetEmailResult, ResendSendEmailParams, ResendSendEmailResult, ResendToolMap, ResolvedContractRef, ResourceCategory, ResourceDefinition, ResourceLink, ResourceMetricsConfig, ResourceOntologyBindingResolver, ResourceRelationships, ResourceStatus$1 as ResourceStatus, ResourceType, RunActorParams, RunActorResult, SDKLLMGenerateParams, ScheduleOriginTracking, ScheduleTarget, ScheduleTriggerConfig, SchedulerToolMap, SendReplyParams, SendReplyResult, SetContactNurtureParams, SheetInfo, SignatureApiFieldType, SignatureApiToolMap, SigningPlace, SortCriteria, StartActorParams, StartActorResult, StepHandler, StorageDeleteInput, StorageDeleteOutput, StorageDownloadInput, StorageDownloadOutput, StorageListInput, StorageListOutput, StorageSignedUrlInput, StorageSignedUrlOutput, StorageToolMap, StorageUploadInput, StorageUploadOutput, StripeToolMap, SystemApiInterfaceReadinessContract, TaskSchedule, TaskScheduleConfig, TombaToolMap, Tool, ToolExecutionOptions, ToolMethodMap, ToolingErrorType, TransitionItemParams, TriggerConfig, TriggerDefinition, UpdateAttributeParams, UpdateAttributeResult, UpdateCloseLostReasonParams, UpdateCompanyParams, UpdateContactParams, UpdateDiscoveryDataParams, UpdateFeesParams, UpdateInterestStatusParams, UpdateInterestStatusResult, UpdateListParams, UpdatePaymentLinkParams, UpdatePaymentLinkResult, UpdateProposalDataParams, UpdateRecordParams, UpdateRecordResult, UpdateRowByValueParams, UpdateRowByValueResult, UploadFileParams, UploadFileResult, UpsertCompanyParams, UpsertContactParams, UpsertDealParams, UpsertRowParams, UpsertRowResult, VoidEnvelopeParams, VoidEnvelopeResult, WebhookProviderType, WebhookTriggerConfig, WorkflowConfig, WorkflowConfigActionRegistry, WorkflowDefinition, WorkflowLogger, WorkflowResourceDescriptorMap, WorkflowResourceDescriptorResolver, WorkflowStep, WriteSheetParams, WriteSheetResult };