@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.js CHANGED
@@ -623,17 +623,23 @@ var SystemInterfaceResourceScopeSchema = z.array(ModelIdSchema).default([]);
623
623
  var SystemApiInterfaceReadinessContractSchema = z.object({
624
624
  /** Ontology IDs of object types the interface depends on. */
625
625
  requiredObjects: z.array(z.string().trim().min(1)).default([]),
626
- /** Ontology IDs of catalog types the interface requires (must be non-empty). */
627
- requiredCatalogs: z.array(z.string().trim().min(1)).default([]),
628
- /** Optional ontology kind filters (reserved for future profile extensions). */
629
- requiredKinds: z.array(z.string().trim().min(1)).optional()
626
+ /**
627
+ * Ontology IDs of catalog types the interface requires. Must declare at least one
628
+ * entry a `readinessContract` with no `requiredCatalogs` asserts nothing at all,
629
+ * so it has no `.default([])`; omitting the field is rejected the same as an
630
+ * explicit empty array.
631
+ */
632
+ requiredCatalogs: z.array(z.string().trim().min(1)).min(1)
630
633
  }).strict();
631
634
  var SystemApiInterfaceSchema = z.object({
632
635
  lifecycle: SystemInterfaceLifecycleSchema.default("active"),
633
636
  /**
634
637
  * Open-string profile id. Built-in platform presets are looked up through
635
638
  * the profile registry; custom ids are validated structurally via
636
- * `readinessContract`. Optional `profileForInterface` provides a default.
639
+ * `readinessContract`. Optional at the schema layer, but readiness
640
+ * computation rejects an interface that omits it with a
641
+ * `missing-readiness-profile` diagnostic — there is no positional
642
+ * fallback to `${systemPath}.${interfaceKey}`.
637
643
  */
638
644
  readinessProfile: SystemInterfaceReadinessProfileSchema.optional(),
639
645
  /**
@@ -664,9 +670,6 @@ function registerReadinessProfile(profileId) {
664
670
  _profileRegistry.set(profileId, entry);
665
671
  return entry;
666
672
  }
667
- function profileForInterface(systemPath, interfaceKey, readinessProfile) {
668
- return readinessProfile ?? `${systemPath}.${interfaceKey}`;
669
- }
670
673
  function isBuiltInReadinessProfile(profileId) {
671
674
  return _profileRegistry.get(profileId)?.kind === "built-in";
672
675
  }
@@ -1130,6 +1133,7 @@ function appliesToEntityKind(catalog) {
1130
1133
  if (id === "deal") return void 0;
1131
1134
  return void 0;
1132
1135
  }
1136
+ formatOntologyId({ scope: "sales.crm", kind: "catalog", localId: "crm.pipeline" });
1133
1137
  function getLeadGenStageCatalog(model) {
1134
1138
  const results = {};
1135
1139
  for (const catalog of catalogRecords(model).filter(
@@ -1214,106 +1218,450 @@ var ProspectingBuildTemplateSchema = DisplayMetadataSchema.extend({
1214
1218
  steps: z.array(ProspectingBuildTemplateStepSchema).min(1)
1215
1219
  });
1216
1220
 
1217
- // src/contract-ref.ts
1218
- var ContractRefResolutionError = class extends Error {
1219
- constructor(code, message, ref) {
1220
- super(message);
1221
- this.code = code;
1222
- this.ref = ref;
1223
- this.name = "ContractRefResolutionError";
1221
+ // ../core/src/organization-model/readiness/profile-registry.ts
1222
+ var _builtInProfileValidators = /* @__PURE__ */ new Map();
1223
+ function registerBuiltInReadinessProfile(profileId, registration) {
1224
+ _builtInProfileValidators.set(profileId, registration);
1225
+ }
1226
+ function getBuiltInReadinessProfile(profileId) {
1227
+ return _builtInProfileValidators.get(profileId);
1228
+ }
1229
+ var _interfaceMarkerResolvers = /* @__PURE__ */ new Map();
1230
+ function interfaceMarkerKey(systemPath, interfaceKey) {
1231
+ return `${systemPath}::${interfaceKey}`;
1232
+ }
1233
+ function registerReadinessInterfaceMarker(systemPath, interfaceKey, resolver) {
1234
+ _interfaceMarkerResolvers.set(interfaceMarkerKey(systemPath, interfaceKey), resolver);
1235
+ }
1236
+ function resolveReadinessInterfaceMarker(model, systemPath, interfaceKey) {
1237
+ return _interfaceMarkerResolvers.get(interfaceMarkerKey(systemPath, interfaceKey))?.(model);
1238
+ }
1239
+
1240
+ // ../core/src/organization-model/readiness/engine.ts
1241
+ var SystemInterfaceReadinessError = class extends Error {
1242
+ code;
1243
+ statusCode = 503;
1244
+ systemPath;
1245
+ interfaceKey;
1246
+ readinessProfile;
1247
+ issues;
1248
+ constructor(result) {
1249
+ const firstIssue = result.issues[0];
1250
+ super(formatInterfaceReadinessFailure(result));
1251
+ this.name = "SystemInterfaceReadinessError";
1252
+ this.code = firstIssue?.family ?? "SYSTEM_INTERFACE_NOT_READY";
1253
+ this.systemPath = result.systemPath;
1254
+ this.interfaceKey = result.interfaceKey;
1255
+ this.readinessProfile = result.readinessProfile;
1256
+ this.issues = result.issues;
1224
1257
  }
1225
1258
  };
1226
- function isZodType(value) {
1227
- return typeof value === "object" && value !== null && "_def" in value;
1259
+ function addReadinessIssue(issues, family, code, message, details = {}) {
1260
+ issues.push({
1261
+ family,
1262
+ code,
1263
+ message,
1264
+ ...details
1265
+ });
1228
1266
  }
1229
- function resolveContractRef(ref, registry) {
1230
- const parsed = parseContractRef(ref);
1231
- const moduleNamespace = registry[parsed.moduleSpecifier];
1232
- if (moduleNamespace === void 0) {
1233
- throw new ContractRefResolutionError(
1234
- "contract-ref-unknown-module",
1235
- `ContractRef "${ref}" references unknown module "${parsed.moduleSpecifier}".`,
1236
- ref
1267
+ function formatInterfaceIdentity(systemPath, interfaceKey) {
1268
+ return `${systemPath}/${interfaceKey}`;
1269
+ }
1270
+ function readinessMarkerPath(context) {
1271
+ return context.interfaceKey === "api" ? `systems.${context.systemPath}.apiInterface` : void 0;
1272
+ }
1273
+ function readinessMarkerFieldPath(context, suffix) {
1274
+ const base = readinessMarkerPath(context);
1275
+ return base === void 0 ? void 0 : `${base}${suffix}`;
1276
+ }
1277
+ function formatInterfaceReadinessFailure(result) {
1278
+ const identity = formatInterfaceIdentity(result.systemPath, result.interfaceKey);
1279
+ const issueSummary = result.issues.map((issue) => `${issue.family}:${issue.code}: ${issue.message}`).join("; ");
1280
+ return `${identity} readiness failed${result.readinessProfile ? ` (${result.readinessProfile})` : ""}: ${issueSummary}`;
1281
+ }
1282
+ function formatSupportedReadinessProfiles() {
1283
+ return SYSTEM_INTERFACE_PROFILES.map((p) => `"${p.readinessProfile}"`).join(", ");
1284
+ }
1285
+ function isPlainRecord(value) {
1286
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
1287
+ }
1288
+ function getCatalogEntries(catalog) {
1289
+ return isPlainRecord(catalog.entries) ? catalog.entries : {};
1290
+ }
1291
+ function getActiveScopedResources(model, resourceIds, issues, context) {
1292
+ const resources = [];
1293
+ for (const [index, resourceId] of resourceIds.entries()) {
1294
+ const resource = model.resources?.[resourceId];
1295
+ const path = readinessMarkerFieldPath(context, `.resourceIds.${index}`);
1296
+ if (resource === void 0) {
1297
+ addReadinessIssue(
1298
+ issues,
1299
+ "SYSTEM_INTERFACE_NOT_READY",
1300
+ "missing-resource",
1301
+ `System Interface "${formatInterfaceIdentity(context.systemPath, context.interfaceKey)}" scopes missing resource "${resourceId}".`,
1302
+ { path, ref: resourceId }
1303
+ );
1304
+ continue;
1305
+ }
1306
+ if (resource.systemPath !== context.systemPath) {
1307
+ addReadinessIssue(
1308
+ issues,
1309
+ "SYSTEM_INTERFACE_INVALID",
1310
+ "resource-system-mismatch",
1311
+ `System Interface "${formatInterfaceIdentity(context.systemPath, context.interfaceKey)}" scopes resource "${resourceId}" from system "${resource.systemPath}".`,
1312
+ { path, ref: resourceId }
1313
+ );
1314
+ continue;
1315
+ }
1316
+ if (resource.status !== "active") {
1317
+ addReadinessIssue(
1318
+ issues,
1319
+ "SYSTEM_INTERFACE_NOT_READY",
1320
+ "inactive-resource",
1321
+ `System Interface "${formatInterfaceIdentity(context.systemPath, context.interfaceKey)}" scopes inactive resource "${resourceId}".`,
1322
+ { path, ref: resourceId }
1323
+ );
1324
+ continue;
1325
+ }
1326
+ resources.push(resource);
1327
+ }
1328
+ return resources;
1329
+ }
1330
+ function resourceBindingIds(resources, key) {
1331
+ return new Set(resources.flatMap((resource) => resource.ontology?.[key] ?? []));
1332
+ }
1333
+ function requireScopedBinding(issues, boundIds, bindingKey, ontologyId, context) {
1334
+ if (boundIds.has(ontologyId)) return;
1335
+ addReadinessIssue(
1336
+ issues,
1337
+ "SYSTEM_INTERFACE_NOT_READY",
1338
+ "missing-resource-binding",
1339
+ `System Interface "${formatInterfaceIdentity(context.systemPath, context.interfaceKey)}" has no active scoped resource with ontology.${bindingKey} binding "${ontologyId}".`,
1340
+ { path: readinessMarkerFieldPath(context, ".resourceIds"), ref: ontologyId }
1341
+ );
1342
+ }
1343
+ function ontologyOwnerMatches(ontologyId, expectedSystemPath, catalog) {
1344
+ if (catalog?.ownerSystemId !== void 0) return catalog.ownerSystemId === expectedSystemPath;
1345
+ return parseOntologyId(ontologyId).scope === expectedSystemPath;
1346
+ }
1347
+ function requireObjectReadiness(issues, index, objectId, context) {
1348
+ const object = index.ontology.objectTypes[objectId];
1349
+ if (object === void 0) {
1350
+ addReadinessIssue(
1351
+ issues,
1352
+ "SYSTEM_INTERFACE_NOT_READY",
1353
+ "missing-object",
1354
+ `System Interface "${formatInterfaceIdentity(context.systemPath, context.interfaceKey)}" is missing required object type "${objectId}".`,
1355
+ { ref: objectId }
1237
1356
  );
1357
+ return;
1238
1358
  }
1239
- const exportValue = moduleNamespace[parsed.exportName];
1240
- if (exportValue === void 0) {
1241
- throw new ContractRefResolutionError(
1242
- "contract-ref-unknown-export",
1243
- `ContractRef "${ref}" references unknown export "${parsed.exportName}".`,
1244
- ref
1359
+ const ownerSystemId = object.ownerSystemId ?? parseOntologyId(objectId).scope;
1360
+ if (ownerSystemId !== context.systemPath) {
1361
+ addReadinessIssue(
1362
+ issues,
1363
+ "SYSTEM_INTERFACE_INVALID",
1364
+ "foreign-object",
1365
+ `System Interface "${formatInterfaceIdentity(context.systemPath, context.interfaceKey)}" requires object "${objectId}" owned by "${ownerSystemId}".`,
1366
+ { ref: objectId }
1245
1367
  );
1246
1368
  }
1247
- if (!isZodType(exportValue)) {
1248
- throw new ContractRefResolutionError(
1249
- "contract-ref-not-zod-type",
1250
- `ContractRef "${ref}" resolves to "${parsed.exportName}" but it is not a ZodType.`,
1251
- ref
1369
+ }
1370
+ function requireCatalogReadiness(issues, index, catalogId, context) {
1371
+ const catalog = index.ontology.catalogTypes[catalogId];
1372
+ if (catalog === void 0) {
1373
+ addReadinessIssue(
1374
+ issues,
1375
+ "SYSTEM_INTERFACE_NOT_READY",
1376
+ "missing-catalog",
1377
+ `System Interface "${formatInterfaceIdentity(context.systemPath, context.interfaceKey)}" is missing required catalog "${catalogId}".`,
1378
+ { ref: catalogId }
1252
1379
  );
1380
+ return void 0;
1253
1381
  }
1254
- return {
1255
- ref,
1256
- moduleSpecifier: parsed.moduleSpecifier,
1257
- exportName: parsed.exportName,
1258
- value: exportValue
1259
- };
1382
+ if (context.allowForeignOwner !== true && !ontologyOwnerMatches(catalogId, context.systemPath, catalog)) {
1383
+ addReadinessIssue(
1384
+ issues,
1385
+ "SYSTEM_INTERFACE_INVALID",
1386
+ "foreign-catalog",
1387
+ `System Interface "${formatInterfaceIdentity(context.systemPath, context.interfaceKey)}" requires catalog "${catalogId}" owned by "${catalog.ownerSystemId ?? parseOntologyId(catalogId).scope}".`,
1388
+ { ref: catalogId }
1389
+ );
1390
+ }
1391
+ if (Object.keys(getCatalogEntries(catalog)).length === 0) {
1392
+ addReadinessIssue(
1393
+ issues,
1394
+ "SYSTEM_INTERFACE_NOT_READY",
1395
+ "empty-catalog",
1396
+ `System Interface "${formatInterfaceIdentity(context.systemPath, context.interfaceKey)}" requires catalog entries for "${catalogId}".`,
1397
+ { ref: catalogId }
1398
+ );
1399
+ }
1400
+ return catalog;
1260
1401
  }
1261
- async function concurrentPool(opts) {
1262
- const { items, concurrency, process, onSuccess, onError } = opts;
1263
- const results = [];
1264
- let nextIndex = 0;
1265
- let succeeded = 0;
1266
- let failed = 0;
1267
- const active = /* @__PURE__ */ new Set();
1268
- const enqueue = () => {
1269
- while (active.size < concurrency && nextIndex < items.length) {
1270
- const idx = nextIndex++;
1271
- const item = items[idx];
1272
- const task = process(item, idx).then((value) => {
1273
- results.push({ index: idx, value });
1274
- succeeded++;
1275
- onSuccess?.(value, item, idx);
1276
- }).catch((error) => {
1277
- results.push({ index: idx, error });
1278
- failed++;
1279
- onError?.(error, item, idx);
1280
- }).finally(() => {
1281
- active.delete(task);
1282
- enqueue();
1283
- });
1284
- active.add(task);
1285
- }
1286
- };
1287
- enqueue();
1288
- while (active.size > 0) {
1289
- await Promise.race(active);
1402
+ function requireContractReadiness(issues, index, resources, contract, context) {
1403
+ const reads = resourceBindingIds(resources, "reads");
1404
+ const catalogs = resourceBindingIds(resources, "usesCatalogs");
1405
+ for (const objectId of contract.requiredObjects) {
1406
+ requireObjectReadiness(issues, index, objectId, context);
1407
+ requireScopedBinding(issues, reads, "reads", objectId, context);
1408
+ }
1409
+ for (const catalogId of contract.requiredCatalogs) {
1410
+ requireCatalogReadiness(issues, index, catalogId, context);
1411
+ requireScopedBinding(issues, catalogs, "usesCatalogs", catalogId, context);
1290
1412
  }
1291
- return { results, succeeded, failed };
1292
1413
  }
1293
- var diagnosticOutput = z.object({
1294
- success: z.boolean(),
1295
- tool: z.string(),
1296
- method: z.string(),
1297
- result: z.unknown().optional(),
1298
- error: z.string().optional(),
1299
- durationMs: z.number().optional()
1300
- });
1301
- var integrationInput = z.object({
1302
- credential: z.string().describe("Credential name registered for this integration")
1303
- });
1304
- async function runDiagnostic(tool, method, fn) {
1305
- const start = Date.now();
1306
- try {
1307
- const result = await fn();
1308
- return { success: true, tool, method, result, durationMs: Date.now() - start };
1309
- } catch (error) {
1310
- return { success: false, tool, method, error: String(error), durationMs: Date.now() - start };
1414
+ function getSystemInterfaceReadinessMarker(model, request) {
1415
+ const system = getSystem(model, request.systemPath);
1416
+ if (system === void 0) return void 0;
1417
+ const registeredMarker = resolveReadinessInterfaceMarker(model, request.systemPath, request.interfaceKey);
1418
+ if (registeredMarker !== void 0) return registeredMarker;
1419
+ if (request.interfaceKey === "api" && system.apiInterface !== void 0) {
1420
+ return system.apiInterface;
1311
1421
  }
1422
+ return void 0;
1312
1423
  }
1313
- var NAME_PREFIXES = /^(dr\.?|prof\.?|mr\.?|mrs\.?|ms\.?|rev\.?)\s+/i;
1314
- var NAME_SUFFIXES = /[,\s]+(dvm|md|phd|do|jr\.?|sr\.?|ii|iii|iv|esq\.?|rn|lvt|cvt|rvt)\.?$/i;
1315
- function splitName(name) {
1316
- const cleaned = name.trim().replace(NAME_PREFIXES, "").replace(NAME_SUFFIXES, "").trim();
1424
+ function compileReadinessOntology(model, readinessProfile, prepareModel) {
1425
+ const preparedModel = prepareModel !== void 0 ? prepareModel(model) : model;
1426
+ const compilation = compileOrganizationOntology(preparedModel);
1427
+ if (compilation.diagnostics.length > 0) {
1428
+ const summary = compilation.diagnostics.map((diagnostic) => diagnostic.message).join("; ");
1429
+ throw new Error(`${readinessProfile} ontology validation index failed to compile: ${summary}`);
1430
+ }
1431
+ return { ontology: compilation.ontology };
1432
+ }
1433
+ function tryCompileReadinessOntology(model, readinessProfile, prepareModel, issues) {
1434
+ try {
1435
+ return compileReadinessOntology(model, readinessProfile, prepareModel);
1436
+ } catch (error) {
1437
+ addReadinessIssue(
1438
+ issues,
1439
+ "SYSTEM_INTERFACE_INVALID",
1440
+ "ontology-compile-failed",
1441
+ error instanceof Error ? error.message : String(error)
1442
+ );
1443
+ return void 0;
1444
+ }
1445
+ }
1446
+ function computeInterfaceReadiness(model, request) {
1447
+ const issues = [];
1448
+ const system = getSystem(model, request.systemPath);
1449
+ const systemInterface = getSystemInterfaceReadinessMarker(model, request);
1450
+ const readinessProfile = systemInterface?.readinessProfile;
1451
+ const scopedResourceIds = systemInterface?.resourceIds ?? [];
1452
+ if (system === void 0) {
1453
+ addReadinessIssue(
1454
+ issues,
1455
+ "SYSTEM_INTERFACE_MISSING",
1456
+ "missing-system",
1457
+ `System "${request.systemPath}" is missing.`,
1458
+ { ref: request.systemPath }
1459
+ );
1460
+ return {
1461
+ ready: false,
1462
+ systemPath: request.systemPath,
1463
+ interfaceKey: request.interfaceKey,
1464
+ scopedResourceIds,
1465
+ issues
1466
+ };
1467
+ }
1468
+ if (systemInterface === void 0) {
1469
+ addReadinessIssue(
1470
+ issues,
1471
+ "SYSTEM_INTERFACE_MISSING",
1472
+ "missing-interface",
1473
+ `System "${request.systemPath}" does not declare interface "${request.interfaceKey}".`,
1474
+ { path: readinessMarkerPath(request) }
1475
+ );
1476
+ return {
1477
+ ready: false,
1478
+ systemPath: request.systemPath,
1479
+ interfaceKey: request.interfaceKey,
1480
+ scopedResourceIds,
1481
+ issues
1482
+ };
1483
+ }
1484
+ if (systemInterface.lifecycle !== "active") {
1485
+ addReadinessIssue(
1486
+ issues,
1487
+ "SYSTEM_INTERFACE_DISABLED",
1488
+ "inactive-interface",
1489
+ `System Interface "${formatInterfaceIdentity(request.systemPath, request.interfaceKey)}" lifecycle is "${systemInterface.lifecycle}".`,
1490
+ { path: readinessMarkerFieldPath(request, ".lifecycle") }
1491
+ );
1492
+ return {
1493
+ ready: false,
1494
+ systemPath: request.systemPath,
1495
+ interfaceKey: request.interfaceKey,
1496
+ readinessProfile,
1497
+ scopedResourceIds,
1498
+ issues
1499
+ };
1500
+ }
1501
+ if (readinessProfile === void 0) {
1502
+ addReadinessIssue(
1503
+ issues,
1504
+ "SYSTEM_INTERFACE_INVALID",
1505
+ "missing-readiness-profile",
1506
+ `System Interface "${formatInterfaceIdentity(request.systemPath, request.interfaceKey)}" declares an apiInterface but no readinessProfile. Declare a built-in profile (${formatSupportedReadinessProfiles()}) or a custom id paired with a readinessContract.`,
1507
+ { path: readinessMarkerFieldPath(request, ".readinessProfile") }
1508
+ );
1509
+ return {
1510
+ ready: false,
1511
+ systemPath: request.systemPath,
1512
+ interfaceKey: request.interfaceKey,
1513
+ scopedResourceIds,
1514
+ issues
1515
+ };
1516
+ }
1517
+ const isBuiltIn = isBuiltInReadinessProfile(readinessProfile);
1518
+ const readinessContract = systemInterface.readinessContract;
1519
+ if (!isBuiltIn && readinessContract === void 0) {
1520
+ addReadinessIssue(
1521
+ issues,
1522
+ "SYSTEM_INTERFACE_INVALID",
1523
+ "missing-readiness-contract",
1524
+ `System Interface "${formatInterfaceIdentity(request.systemPath, request.interfaceKey)}" uses custom readiness profile "${readinessProfile}" but declares no readinessContract. Built-in profiles: ${formatSupportedReadinessProfiles()}.`,
1525
+ { path: readinessMarkerFieldPath(request, ".readinessContract"), ref: readinessProfile }
1526
+ );
1527
+ return {
1528
+ ready: false,
1529
+ systemPath: request.systemPath,
1530
+ interfaceKey: request.interfaceKey,
1531
+ readinessProfile,
1532
+ scopedResourceIds,
1533
+ issues
1534
+ };
1535
+ }
1536
+ if (scopedResourceIds.length === 0) {
1537
+ addReadinessIssue(
1538
+ issues,
1539
+ "SYSTEM_INTERFACE_NOT_READY",
1540
+ "missing-scoped-resources",
1541
+ `System Interface "${formatInterfaceIdentity(request.systemPath, request.interfaceKey)}" must scope at least one active resource.`,
1542
+ { path: readinessMarkerFieldPath(request, ".resourceIds") }
1543
+ );
1544
+ }
1545
+ const resources = getActiveScopedResources(model, scopedResourceIds, issues, request);
1546
+ const registration = getBuiltInReadinessProfile(readinessProfile);
1547
+ const index = tryCompileReadinessOntology(model, readinessProfile, registration?.prepareModel, issues);
1548
+ if (index !== void 0) {
1549
+ if (registration !== void 0) {
1550
+ registration.validate(issues, index, resources, model, request);
1551
+ } else if (readinessContract !== void 0) {
1552
+ requireContractReadiness(issues, index, resources, readinessContract, request);
1553
+ }
1554
+ }
1555
+ return {
1556
+ ready: issues.length === 0,
1557
+ systemPath: request.systemPath,
1558
+ interfaceKey: request.interfaceKey,
1559
+ readinessProfile,
1560
+ scopedResourceIds,
1561
+ issues
1562
+ };
1563
+ }
1564
+
1565
+ // src/contract-ref.ts
1566
+ var ContractRefResolutionError = class extends Error {
1567
+ constructor(code, message, ref) {
1568
+ super(message);
1569
+ this.code = code;
1570
+ this.ref = ref;
1571
+ this.name = "ContractRefResolutionError";
1572
+ }
1573
+ };
1574
+ function isZodType(value) {
1575
+ return typeof value === "object" && value !== null && "_def" in value;
1576
+ }
1577
+ function resolveContractRef(ref, registry) {
1578
+ const parsed = parseContractRef(ref);
1579
+ const moduleNamespace = registry[parsed.moduleSpecifier];
1580
+ if (moduleNamespace === void 0) {
1581
+ throw new ContractRefResolutionError(
1582
+ "contract-ref-unknown-module",
1583
+ `ContractRef "${ref}" references unknown module "${parsed.moduleSpecifier}".`,
1584
+ ref
1585
+ );
1586
+ }
1587
+ const exportValue = moduleNamespace[parsed.exportName];
1588
+ if (exportValue === void 0) {
1589
+ throw new ContractRefResolutionError(
1590
+ "contract-ref-unknown-export",
1591
+ `ContractRef "${ref}" references unknown export "${parsed.exportName}".`,
1592
+ ref
1593
+ );
1594
+ }
1595
+ if (!isZodType(exportValue)) {
1596
+ throw new ContractRefResolutionError(
1597
+ "contract-ref-not-zod-type",
1598
+ `ContractRef "${ref}" resolves to "${parsed.exportName}" but it is not a ZodType.`,
1599
+ ref
1600
+ );
1601
+ }
1602
+ return {
1603
+ ref,
1604
+ moduleSpecifier: parsed.moduleSpecifier,
1605
+ exportName: parsed.exportName,
1606
+ value: exportValue
1607
+ };
1608
+ }
1609
+ async function concurrentPool(opts) {
1610
+ const { items, concurrency, process, onSuccess, onError } = opts;
1611
+ const results = [];
1612
+ let nextIndex = 0;
1613
+ let succeeded = 0;
1614
+ let failed = 0;
1615
+ const active = /* @__PURE__ */ new Set();
1616
+ const enqueue = () => {
1617
+ while (active.size < concurrency && nextIndex < items.length) {
1618
+ const idx = nextIndex++;
1619
+ const item = items[idx];
1620
+ const task = process(item, idx).then((value) => {
1621
+ results.push({ index: idx, value });
1622
+ succeeded++;
1623
+ onSuccess?.(value, item, idx);
1624
+ }).catch((error) => {
1625
+ results.push({ index: idx, error });
1626
+ failed++;
1627
+ onError?.(error, item, idx);
1628
+ }).finally(() => {
1629
+ active.delete(task);
1630
+ enqueue();
1631
+ });
1632
+ active.add(task);
1633
+ }
1634
+ };
1635
+ enqueue();
1636
+ while (active.size > 0) {
1637
+ await Promise.race(active);
1638
+ }
1639
+ return { results, succeeded, failed };
1640
+ }
1641
+ var diagnosticOutput = z.object({
1642
+ success: z.boolean(),
1643
+ tool: z.string(),
1644
+ method: z.string(),
1645
+ result: z.unknown().optional(),
1646
+ error: z.string().optional(),
1647
+ durationMs: z.number().optional()
1648
+ });
1649
+ var integrationInput = z.object({
1650
+ credential: z.string().describe("Credential name registered for this integration")
1651
+ });
1652
+ async function runDiagnostic(tool, method, fn) {
1653
+ const start = Date.now();
1654
+ try {
1655
+ const result = await fn();
1656
+ return { success: true, tool, method, result, durationMs: Date.now() - start };
1657
+ } catch (error) {
1658
+ return { success: false, tool, method, error: String(error), durationMs: Date.now() - start };
1659
+ }
1660
+ }
1661
+ var NAME_PREFIXES = /^(dr\.?|prof\.?|mr\.?|mrs\.?|ms\.?|rev\.?)\s+/i;
1662
+ var NAME_SUFFIXES = /[,\s]+(dvm|md|phd|do|jr\.?|sr\.?|ii|iii|iv|esq\.?|rn|lvt|cvt|rvt)\.?$/i;
1663
+ function splitName(name) {
1664
+ const cleaned = name.trim().replace(NAME_PREFIXES, "").replace(NAME_SUFFIXES, "").trim();
1317
1665
  const parts = cleaned.split(/\s+/);
1318
1666
  return { firstName: parts[0], lastName: parts.length > 1 ? parts.slice(1).join(" ") : void 0 };
1319
1667
  }
@@ -4061,598 +4409,10 @@ function buildIterationResponseSchemaUncached(tools, capabilities) {
4061
4409
  };
4062
4410
  }
4063
4411
  return {
4064
- type: "object",
4065
- properties,
4066
- required: capabilities.message === "required" ? ["nextActions", "message", "reasoning"] : ["nextActions", "reasoning"],
4067
- additionalProperties: false
4068
- };
4069
- }
4070
-
4071
- // ../core/src/business/acquisition/ontology-validation.ts
4072
- var LEAD_GEN_API_INTERFACE = SYSTEM_INTERFACE_PROFILES[0];
4073
- var CRM_API_INTERFACE = SYSTEM_INTERFACE_PROFILES[1];
4074
- var LEAD_GEN_CRM_HANDOFF_INTERFACE = SYSTEM_INTERFACE_PROFILES[2];
4075
- var LEAD_GEN_API_READINESS_LABEL = LEAD_GEN_API_INTERFACE.readinessProfile;
4076
- var CRM_API_READINESS_LABEL = CRM_API_INTERFACE.readinessProfile;
4077
- LEAD_GEN_CRM_HANDOFF_INTERFACE.readinessProfile;
4078
- var LEAD_GEN_LIST_OBJECT_ONTOLOGY_ID = formatOntologyId({
4079
- scope: "sales.lead-gen",
4080
- kind: "object",
4081
- localId: "list"
4082
- });
4083
- var LEAD_GEN_COMPANY_OBJECT_ONTOLOGY_ID = formatOntologyId({
4084
- scope: "sales.lead-gen",
4085
- kind: "object",
4086
- localId: "company"
4087
- });
4088
- var LEAD_GEN_CONTACT_OBJECT_ONTOLOGY_ID = formatOntologyId({
4089
- scope: "sales.lead-gen",
4090
- kind: "object",
4091
- localId: "contact"
4092
- });
4093
- var LEAD_GEN_BUILD_TEMPLATE_CATALOG_ONTOLOGY_ID = formatOntologyId({
4094
- scope: "sales.lead-gen",
4095
- kind: "catalog",
4096
- localId: "build-template"
4097
- });
4098
- var LEAD_GEN_COMPANY_STAGE_CATALOG_ONTOLOGY_ID = formatOntologyId({
4099
- scope: "sales.lead-gen",
4100
- kind: "catalog",
4101
- localId: "company-stage"
4102
- });
4103
- var LEAD_GEN_CONTACT_STAGE_CATALOG_ONTOLOGY_ID = formatOntologyId({
4104
- scope: "sales.lead-gen",
4105
- kind: "catalog",
4106
- localId: "contact-stage"
4107
- });
4108
- var CRM_PIPELINE_CATALOG_ONTOLOGY_ID = formatOntologyId({
4109
- scope: "sales.crm",
4110
- kind: "catalog",
4111
- localId: "crm.pipeline"
4112
- });
4113
- var LEAD_GEN_STAGE_CATALOG_ONTOLOGY_ID = formatOntologyId({
4114
- scope: "sales.lead-gen",
4115
- kind: "catalog",
4116
- localId: "lead-gen.stage-catalog"
4117
- });
4118
- var SystemInterfaceReadinessError = class extends Error {
4119
- code;
4120
- statusCode = 503;
4121
- systemPath;
4122
- interfaceKey;
4123
- readinessProfile;
4124
- issues;
4125
- constructor(result) {
4126
- const firstIssue = result.issues[0];
4127
- super(formatInterfaceReadinessFailure(result));
4128
- this.name = "SystemInterfaceReadinessError";
4129
- this.code = firstIssue?.family ?? "SYSTEM_INTERFACE_NOT_READY";
4130
- this.systemPath = result.systemPath;
4131
- this.interfaceKey = result.interfaceKey;
4132
- this.readinessProfile = result.readinessProfile;
4133
- this.issues = result.issues;
4134
- }
4135
- };
4136
- function createLeadGenStageCatalog(model) {
4137
- return {
4138
- id: LEAD_GEN_STAGE_CATALOG_ONTOLOGY_ID,
4139
- label: "Lead Gen Processing Stages",
4140
- ownerSystemId: "sales.lead-gen",
4141
- kind: "processing-stage-catalog",
4142
- entries: Object.fromEntries(
4143
- Object.entries(getLeadGenStageCatalog(model)).map(([key, entry]) => [
4144
- key,
4145
- {
4146
- ...entry
4147
- }
4148
- ])
4149
- ),
4150
- legacyCatalogKey: "LEAD_GEN_STAGE_CATALOG"
4151
- };
4152
- }
4153
- function isPlainRecord(value) {
4154
- return Boolean(value) && typeof value === "object" && !Array.isArray(value);
4155
- }
4156
- function addReadinessIssue(issues, family, code, message, details = {}) {
4157
- issues.push({
4158
- family,
4159
- code,
4160
- message,
4161
- ...details
4162
- });
4163
- }
4164
- function formatInterfaceIdentity(systemPath, interfaceKey) {
4165
- return `${systemPath}/${interfaceKey}`;
4166
- }
4167
- function readinessMarkerPath(context) {
4168
- return context.interfaceKey === "api" ? `systems.${context.systemPath}.apiInterface` : `systems.${context.systemPath}.derivedCrmHandoffReadiness`;
4169
- }
4170
- function formatInterfaceReadinessFailure(result) {
4171
- const identity = formatInterfaceIdentity(result.systemPath, result.interfaceKey);
4172
- const issueSummary = result.issues.map((issue) => `${issue.family}:${issue.code}: ${issue.message}`).join("; ");
4173
- return `${identity} readiness failed${result.readinessProfile ? ` (${result.readinessProfile})` : ""}: ${issueSummary}`;
4174
- }
4175
- function formatSupportedReadinessProfiles() {
4176
- return SYSTEM_INTERFACE_PROFILES.map((p) => `"${p.readinessProfile}"`).join(", ");
4177
- }
4178
- function throwIfInterfaceNotReady(result) {
4179
- if (result.ready) return;
4180
- throw new SystemInterfaceReadinessError(result);
4181
- }
4182
- function getActiveScopedResources(model, resourceIds, issues, context) {
4183
- const resources = [];
4184
- for (const [index, resourceId] of resourceIds.entries()) {
4185
- const resource = model.resources?.[resourceId];
4186
- const path = `${readinessMarkerPath(context)}.resourceIds.${index}`;
4187
- if (resource === void 0) {
4188
- addReadinessIssue(
4189
- issues,
4190
- "SYSTEM_INTERFACE_NOT_READY",
4191
- "missing-resource",
4192
- `System Interface "${formatInterfaceIdentity(context.systemPath, context.interfaceKey)}" scopes missing resource "${resourceId}".`,
4193
- { path, ref: resourceId }
4194
- );
4195
- continue;
4196
- }
4197
- if (resource.systemPath !== context.systemPath) {
4198
- addReadinessIssue(
4199
- issues,
4200
- "SYSTEM_INTERFACE_INVALID",
4201
- "resource-system-mismatch",
4202
- `System Interface "${formatInterfaceIdentity(context.systemPath, context.interfaceKey)}" scopes resource "${resourceId}" from system "${resource.systemPath}".`,
4203
- { path, ref: resourceId }
4204
- );
4205
- continue;
4206
- }
4207
- if (resource.status !== "active") {
4208
- addReadinessIssue(
4209
- issues,
4210
- "SYSTEM_INTERFACE_NOT_READY",
4211
- "inactive-resource",
4212
- `System Interface "${formatInterfaceIdentity(context.systemPath, context.interfaceKey)}" scopes inactive resource "${resourceId}".`,
4213
- { path, ref: resourceId }
4214
- );
4215
- continue;
4216
- }
4217
- resources.push(resource);
4218
- }
4219
- return resources;
4220
- }
4221
- function resourceBindingIds(resources, key) {
4222
- return new Set(resources.flatMap((resource) => resource.ontology?.[key] ?? []));
4223
- }
4224
- function requireScopedBinding(issues, boundIds, bindingKey, ontologyId, context) {
4225
- if (boundIds.has(ontologyId)) return;
4226
- addReadinessIssue(
4227
- issues,
4228
- "SYSTEM_INTERFACE_NOT_READY",
4229
- "missing-resource-binding",
4230
- `System Interface "${formatInterfaceIdentity(context.systemPath, context.interfaceKey)}" has no active scoped resource with ontology.${bindingKey} binding "${ontologyId}".`,
4231
- { path: `${readinessMarkerPath(context)}.resourceIds`, ref: ontologyId }
4232
- );
4233
- }
4234
- function ontologyOwnerMatches(ontologyId, expectedSystemPath, catalog) {
4235
- if (catalog?.ownerSystemId !== void 0) return catalog.ownerSystemId === expectedSystemPath;
4236
- return parseOntologyId(ontologyId).scope === expectedSystemPath;
4237
- }
4238
- function requireObjectReadiness(issues, index, objectId, context) {
4239
- const object = index.ontology.objectTypes[objectId];
4240
- if (object === void 0) {
4241
- addReadinessIssue(
4242
- issues,
4243
- "SYSTEM_INTERFACE_NOT_READY",
4244
- "missing-object",
4245
- `System Interface "${formatInterfaceIdentity(context.systemPath, context.interfaceKey)}" is missing required object type "${objectId}".`,
4246
- { ref: objectId }
4247
- );
4248
- return;
4249
- }
4250
- const ownerSystemId = object.ownerSystemId ?? parseOntologyId(objectId).scope;
4251
- if (ownerSystemId !== context.systemPath) {
4252
- addReadinessIssue(
4253
- issues,
4254
- "SYSTEM_INTERFACE_INVALID",
4255
- "foreign-object",
4256
- `System Interface "${formatInterfaceIdentity(context.systemPath, context.interfaceKey)}" requires object "${objectId}" owned by "${ownerSystemId}".`,
4257
- { ref: objectId }
4258
- );
4259
- }
4260
- }
4261
- function requireCatalogReadiness(issues, index, catalogId, context) {
4262
- const catalog = index.ontology.catalogTypes[catalogId];
4263
- if (catalog === void 0) {
4264
- addReadinessIssue(
4265
- issues,
4266
- "SYSTEM_INTERFACE_NOT_READY",
4267
- "missing-catalog",
4268
- `System Interface "${formatInterfaceIdentity(context.systemPath, context.interfaceKey)}" is missing required catalog "${catalogId}".`,
4269
- { ref: catalogId }
4270
- );
4271
- return void 0;
4272
- }
4273
- if (context.allowForeignOwner !== true && !ontologyOwnerMatches(catalogId, context.systemPath, catalog)) {
4274
- addReadinessIssue(
4275
- issues,
4276
- "SYSTEM_INTERFACE_INVALID",
4277
- "foreign-catalog",
4278
- `System Interface "${formatInterfaceIdentity(context.systemPath, context.interfaceKey)}" requires catalog "${catalogId}" owned by "${catalog.ownerSystemId ?? parseOntologyId(catalogId).scope}".`,
4279
- { ref: catalogId }
4280
- );
4281
- }
4282
- if (Object.keys(getCatalogEntries(catalog)).length === 0) {
4283
- addReadinessIssue(
4284
- issues,
4285
- "SYSTEM_INTERFACE_NOT_READY",
4286
- "empty-catalog",
4287
- `System Interface "${formatInterfaceIdentity(context.systemPath, context.interfaceKey)}" requires catalog entries for "${catalogId}".`,
4288
- { ref: catalogId }
4289
- );
4290
- }
4291
- return catalog;
4292
- }
4293
- function requireLeadGenInterfaceReadiness(issues, index, resources, context) {
4294
- const reads = resourceBindingIds(resources, "reads");
4295
- const catalogs = resourceBindingIds(resources, "usesCatalogs");
4296
- for (const objectId of [
4297
- LEAD_GEN_LIST_OBJECT_ONTOLOGY_ID,
4298
- LEAD_GEN_COMPANY_OBJECT_ONTOLOGY_ID,
4299
- LEAD_GEN_CONTACT_OBJECT_ONTOLOGY_ID
4300
- ]) {
4301
- requireObjectReadiness(issues, index, objectId, context);
4302
- requireScopedBinding(issues, reads, "reads", objectId, context);
4303
- }
4304
- for (const catalogId of [
4305
- LEAD_GEN_BUILD_TEMPLATE_CATALOG_ONTOLOGY_ID,
4306
- LEAD_GEN_COMPANY_STAGE_CATALOG_ONTOLOGY_ID,
4307
- LEAD_GEN_CONTACT_STAGE_CATALOG_ONTOLOGY_ID
4308
- ]) {
4309
- requireCatalogReadiness(issues, index, catalogId, context);
4310
- requireScopedBinding(issues, catalogs, "usesCatalogs", catalogId, context);
4311
- }
4312
- const templateStepCatalog = findLeadGenTemplateStepCatalog(index);
4313
- if (templateStepCatalog === void 0) {
4314
- addReadinessIssue(
4315
- issues,
4316
- "SYSTEM_INTERFACE_NOT_READY",
4317
- "missing-template-step-catalog",
4318
- `System Interface "${formatInterfaceIdentity(context.systemPath, context.interfaceKey)}" is missing a lead-gen template-step catalog.`
4319
- );
4320
- } else {
4321
- requireCatalogReadiness(issues, index, templateStepCatalog.id, context);
4322
- requireScopedBinding(issues, catalogs, "usesCatalogs", templateStepCatalog.id, context);
4323
- }
4324
- const leadGenStageCatalog = requireCatalogReadiness(issues, index, LEAD_GEN_STAGE_CATALOG_ONTOLOGY_ID, context);
4325
- return leadGenStageCatalog;
4326
- }
4327
- function requireCrmInterfaceReadiness(issues, index, resources, context) {
4328
- const catalogs = resourceBindingIds(resources, "usesCatalogs");
4329
- const crmPipelineCatalog = requireCatalogReadiness(issues, index, CRM_PIPELINE_CATALOG_ONTOLOGY_ID, context);
4330
- requireScopedBinding(issues, catalogs, "usesCatalogs", CRM_PIPELINE_CATALOG_ONTOLOGY_ID, context);
4331
- return crmPipelineCatalog;
4332
- }
4333
- function findSystemInterfaceGrant(model, consumer, provider) {
4334
- return Object.values(model.topology?.relationships ?? {}).find((relationship) => {
4335
- const grant = relationship.metadata?.["systemInterfaceGrant"];
4336
- if (!isPlainRecord(grant) || !isPlainRecord(grant.consumer) || !isPlainRecord(grant.provider)) return false;
4337
- return grant.consumer.systemPath === consumer.systemPath && grant.consumer.interfaceKey === consumer.interfaceKey && grant.provider.systemPath === provider.systemPath && grant.provider.interfaceKey === provider.interfaceKey;
4338
- });
4339
- }
4340
- function requireHandoffBridgeReadiness(issues, model, context) {
4341
- const crmResult = computeInterfaceReadiness(model, CRM_API_INTERFACE);
4342
- if (!crmResult.ready) {
4343
- for (const issue of crmResult.issues) {
4344
- addReadinessIssue(
4345
- issues,
4346
- "SYSTEM_BRIDGE_NOT_READY",
4347
- issue.code,
4348
- `Provider interface ${formatInterfaceIdentity(CRM_API_INTERFACE.systemPath, CRM_API_INTERFACE.interfaceKey)} is not ready: ${issue.message}`,
4349
- { path: issue.path, ref: issue.ref }
4350
- );
4351
- }
4352
- }
4353
- const bridgeGrant = findSystemInterfaceGrant(model, context, CRM_API_INTERFACE);
4354
- if (bridgeGrant === void 0) {
4355
- addReadinessIssue(
4356
- issues,
4357
- "SYSTEM_BRIDGE_NOT_READY",
4358
- "missing-topology-grant",
4359
- `System Interface "${formatInterfaceIdentity(context.systemPath, context.interfaceKey)}" requires a scoped topology grant to "${formatInterfaceIdentity(CRM_API_INTERFACE.systemPath, CRM_API_INTERFACE.interfaceKey)}".`
4360
- );
4361
- }
4362
- return bridgeGrant;
4363
- }
4364
- function getLeadGenCrmHandoffResourceIds(model) {
4365
- return Object.values(model.resources ?? {}).filter(
4366
- (resource) => resource.systemPath === LEAD_GEN_CRM_HANDOFF_INTERFACE.systemPath && resource.ontology?.usesCatalogs?.includes(CRM_PIPELINE_CATALOG_ONTOLOGY_ID) === true
4367
- ).map((resource) => resource.id);
4368
- }
4369
- function getSystemInterfaceReadinessMarker(model, request) {
4370
- const system = getSystem(model, request.systemPath);
4371
- if (system === void 0) return void 0;
4372
- if (request.systemPath === LEAD_GEN_CRM_HANDOFF_INTERFACE.systemPath && request.interfaceKey === LEAD_GEN_CRM_HANDOFF_INTERFACE.interfaceKey) {
4373
- return {
4374
- lifecycle: "active",
4375
- readinessProfile: LEAD_GEN_CRM_HANDOFF_INTERFACE.readinessProfile,
4376
- resourceIds: getLeadGenCrmHandoffResourceIds(model)
4377
- };
4378
- }
4379
- if (request.interfaceKey === "api" && system.apiInterface !== void 0) {
4380
- return system.apiInterface;
4381
- }
4382
- return void 0;
4383
- }
4384
- function mergeLeadGenDerivedCatalogs(model) {
4385
- const baseCatalogTypes = model.ontology?.catalogTypes ?? {};
4386
- const derivedCatalogTypes = {};
4387
- if (baseCatalogTypes[LEAD_GEN_STAGE_CATALOG_ONTOLOGY_ID] === void 0) {
4388
- derivedCatalogTypes[LEAD_GEN_STAGE_CATALOG_ONTOLOGY_ID] = createLeadGenStageCatalog(model);
4389
- }
4390
- if (Object.keys(derivedCatalogTypes).length === 0) return model;
4391
- return {
4392
- ...model,
4393
- ontology: {
4394
- ...model.ontology ?? {},
4395
- catalogTypes: {
4396
- ...baseCatalogTypes,
4397
- ...derivedCatalogTypes
4398
- }
4399
- }
4400
- };
4401
- }
4402
- function compileBusinessOntology(model, contractId) {
4403
- const compilation = compileOrganizationOntology(mergeLeadGenDerivedCatalogs(model));
4404
- if (compilation.diagnostics.length > 0) {
4405
- const summary = compilation.diagnostics.map((diagnostic) => diagnostic.message).join("; ");
4406
- throw new Error(`${contractId} ontology validation index failed to compile: ${summary}`);
4407
- }
4408
- return {
4409
- ontology: compilation.ontology,
4410
- actionTypesByLegacyId: indexActionTypesByLegacyId(compilation.ontology.actionTypes)
4411
- };
4412
- }
4413
- function tryCompileBusinessOntology(model, readinessProfile, issues) {
4414
- try {
4415
- return compileBusinessOntology(model, readinessProfile);
4416
- } catch (error) {
4417
- addReadinessIssue(
4418
- issues,
4419
- "SYSTEM_INTERFACE_INVALID",
4420
- "ontology-compile-failed",
4421
- error instanceof Error ? error.message : String(error)
4422
- );
4423
- return void 0;
4424
- }
4425
- }
4426
- function requireContractReadiness(issues, index, resources, contract, context) {
4427
- const reads = resourceBindingIds(resources, "reads");
4428
- const catalogs = resourceBindingIds(resources, "usesCatalogs");
4429
- for (const objectId of contract.requiredObjects) {
4430
- requireObjectReadiness(issues, index, objectId, context);
4431
- requireScopedBinding(issues, reads, "reads", objectId, context);
4432
- }
4433
- for (const catalogId of contract.requiredCatalogs) {
4434
- requireCatalogReadiness(issues, index, catalogId, context);
4435
- requireScopedBinding(issues, catalogs, "usesCatalogs", catalogId, context);
4436
- }
4437
- }
4438
- function computeInterfaceReadiness(model, request) {
4439
- const issues = [];
4440
- const system = getSystem(model, request.systemPath);
4441
- const systemInterface = getSystemInterfaceReadinessMarker(model, request);
4442
- const readinessProfile = systemInterface === void 0 ? void 0 : profileForInterface(request.systemPath, request.interfaceKey, systemInterface.readinessProfile);
4443
- const scopedResourceIds = systemInterface?.resourceIds ?? [];
4444
- if (system === void 0) {
4445
- addReadinessIssue(
4446
- issues,
4447
- "SYSTEM_INTERFACE_MISSING",
4448
- "missing-system",
4449
- `System "${request.systemPath}" is missing.`,
4450
- { ref: request.systemPath }
4451
- );
4452
- return {
4453
- ready: false,
4454
- systemPath: request.systemPath,
4455
- interfaceKey: request.interfaceKey,
4456
- scopedResourceIds,
4457
- issues
4458
- };
4459
- }
4460
- if (systemInterface === void 0) {
4461
- addReadinessIssue(
4462
- issues,
4463
- "SYSTEM_INTERFACE_MISSING",
4464
- "missing-interface",
4465
- `System "${request.systemPath}" does not declare interface "${request.interfaceKey}".`,
4466
- { path: readinessMarkerPath(request) }
4467
- );
4468
- return {
4469
- ready: false,
4470
- systemPath: request.systemPath,
4471
- interfaceKey: request.interfaceKey,
4472
- scopedResourceIds,
4473
- issues
4474
- };
4475
- }
4476
- if (systemInterface.lifecycle !== "active") {
4477
- addReadinessIssue(
4478
- issues,
4479
- "SYSTEM_INTERFACE_DISABLED",
4480
- "inactive-interface",
4481
- `System Interface "${formatInterfaceIdentity(request.systemPath, request.interfaceKey)}" lifecycle is "${systemInterface.lifecycle}".`,
4482
- { path: `${readinessMarkerPath(request)}.lifecycle` }
4483
- );
4484
- }
4485
- const checkedReadinessProfile = readinessProfile ?? profileForInterface(request.systemPath, request.interfaceKey);
4486
- const isBuiltIn = isBuiltInReadinessProfile(checkedReadinessProfile);
4487
- const readinessContract = systemInterface.readinessContract;
4488
- if (!isBuiltIn && readinessContract === void 0) {
4489
- addReadinessIssue(
4490
- issues,
4491
- "SYSTEM_INTERFACE_INVALID",
4492
- "missing-readiness-contract",
4493
- `System Interface "${formatInterfaceIdentity(request.systemPath, request.interfaceKey)}" uses custom readiness profile "${checkedReadinessProfile}" but declares no readinessContract. Built-in profiles: ${formatSupportedReadinessProfiles()}.`,
4494
- { path: `${readinessMarkerPath(request)}.readinessContract`, ref: checkedReadinessProfile }
4495
- );
4496
- return {
4497
- ready: false,
4498
- systemPath: request.systemPath,
4499
- interfaceKey: request.interfaceKey,
4500
- readinessProfile: checkedReadinessProfile,
4501
- scopedResourceIds,
4502
- issues
4503
- };
4504
- }
4505
- if (scopedResourceIds.length === 0) {
4506
- addReadinessIssue(
4507
- issues,
4508
- "SYSTEM_INTERFACE_NOT_READY",
4509
- "missing-scoped-resources",
4510
- `System Interface "${formatInterfaceIdentity(request.systemPath, request.interfaceKey)}" must scope at least one active resource.`,
4511
- { path: `${readinessMarkerPath(request)}.resourceIds` }
4512
- );
4513
- }
4514
- const resources = getActiveScopedResources(model, scopedResourceIds, issues, request);
4515
- const index = tryCompileBusinessOntology(model, checkedReadinessProfile, issues);
4516
- if (index !== void 0) {
4517
- if (checkedReadinessProfile === LEAD_GEN_API_INTERFACE.readinessProfile) {
4518
- requireLeadGenInterfaceReadiness(issues, index, resources, request);
4519
- } else if (checkedReadinessProfile === CRM_API_INTERFACE.readinessProfile) {
4520
- requireCrmInterfaceReadiness(issues, index, resources, request);
4521
- } else if (checkedReadinessProfile === LEAD_GEN_CRM_HANDOFF_INTERFACE.readinessProfile) {
4522
- requireLeadGenInterfaceReadiness(issues, index, resources, request);
4523
- requireCrmInterfaceReadiness(issues, index, resources, { ...request, allowForeignOwner: true });
4524
- requireHandoffBridgeReadiness(issues, model, request);
4525
- } else if (readinessContract !== void 0) {
4526
- requireContractReadiness(issues, index, resources, readinessContract, request);
4527
- }
4528
- }
4529
- return {
4530
- ready: issues.length === 0,
4531
- systemPath: request.systemPath,
4532
- interfaceKey: request.interfaceKey,
4533
- readinessProfile: checkedReadinessProfile,
4534
- scopedResourceIds,
4535
- issues
4536
- };
4537
- }
4538
- function requireObjectType(index, objectId, contractId) {
4539
- if (index.ontology.objectTypes[objectId] === void 0) {
4540
- throw new Error(`${contractId} is missing required object type: ${objectId}`);
4541
- }
4542
- }
4543
- function requireCatalog(index, catalogId, contractId) {
4544
- const catalog = index.ontology.catalogTypes[catalogId];
4545
- if (catalog === void 0) {
4546
- throw new Error(`${contractId} is missing required catalog: ${catalogId}`);
4547
- }
4548
- return catalog;
4549
- }
4550
- function requireCatalogEntries(catalog, contractId) {
4551
- if (Object.keys(getCatalogEntries(catalog)).length === 0) {
4552
- throw new Error(`${contractId} requires catalog entries for ${catalog.id}`);
4553
- }
4554
- }
4555
- function findLeadGenTemplateStepCatalog(index) {
4556
- return Object.values(index.ontology.catalogTypes).find(
4557
- (catalog) => catalog.ownerSystemId === "sales.lead-gen" && catalog.kind === "template-step" && catalog.appliesTo === LEAD_GEN_LIST_OBJECT_ONTOLOGY_ID
4558
- );
4559
- }
4560
- function requireLeadGenApiReadiness(index) {
4561
- requireObjectType(index, LEAD_GEN_LIST_OBJECT_ONTOLOGY_ID, LEAD_GEN_API_READINESS_LABEL);
4562
- requireObjectType(index, LEAD_GEN_COMPANY_OBJECT_ONTOLOGY_ID, LEAD_GEN_API_READINESS_LABEL);
4563
- requireObjectType(index, LEAD_GEN_CONTACT_OBJECT_ONTOLOGY_ID, LEAD_GEN_API_READINESS_LABEL);
4564
- requireCatalogEntries(
4565
- requireCatalog(index, LEAD_GEN_BUILD_TEMPLATE_CATALOG_ONTOLOGY_ID, LEAD_GEN_API_READINESS_LABEL),
4566
- LEAD_GEN_API_READINESS_LABEL
4567
- );
4568
- requireCatalogEntries(
4569
- requireCatalog(index, LEAD_GEN_COMPANY_STAGE_CATALOG_ONTOLOGY_ID, LEAD_GEN_API_READINESS_LABEL),
4570
- LEAD_GEN_API_READINESS_LABEL
4571
- );
4572
- requireCatalogEntries(
4573
- requireCatalog(index, LEAD_GEN_CONTACT_STAGE_CATALOG_ONTOLOGY_ID, LEAD_GEN_API_READINESS_LABEL),
4574
- LEAD_GEN_API_READINESS_LABEL
4575
- );
4576
- const templateStepCatalog = findLeadGenTemplateStepCatalog(index);
4577
- if (templateStepCatalog === void 0) {
4578
- throw new Error(`${LEAD_GEN_API_READINESS_LABEL} is missing a lead-gen template-step catalog`);
4579
- }
4580
- requireCatalogEntries(templateStepCatalog, LEAD_GEN_API_READINESS_LABEL);
4581
- const leadGenStageCatalog = requireCatalog(index, LEAD_GEN_STAGE_CATALOG_ONTOLOGY_ID, LEAD_GEN_API_READINESS_LABEL);
4582
- requireCatalogEntries(leadGenStageCatalog, LEAD_GEN_API_READINESS_LABEL);
4583
- return leadGenStageCatalog;
4584
- }
4585
- function requireCrmApiReadiness(index) {
4586
- const crmPipelineCatalog = requireCatalog(index, CRM_PIPELINE_CATALOG_ONTOLOGY_ID, CRM_API_READINESS_LABEL);
4587
- requireCatalogEntries(crmPipelineCatalog, CRM_API_READINESS_LABEL);
4588
- return crmPipelineCatalog;
4589
- }
4590
- function compileBusinessOntologyValidationIndex(model) {
4591
- throwIfInterfaceNotReady(computeInterfaceReadiness(model, LEAD_GEN_API_INTERFACE));
4592
- throwIfInterfaceNotReady(computeInterfaceReadiness(model, CRM_API_INTERFACE));
4593
- const index = compileBusinessOntology(model, "legacy acquisition business ontology");
4594
- return {
4595
- ...index,
4596
- leadGenStageCatalog: requireLeadGenApiReadiness(index),
4597
- crmPipelineCatalog: requireCrmApiReadiness(index)
4598
- };
4599
- }
4600
- function indexActionTypesByLegacyId(actionTypes) {
4601
- const byLegacyId = {};
4602
- for (const actionType of Object.values(actionTypes)) {
4603
- const legacyActionId = actionType["legacyActionId"];
4604
- if (typeof legacyActionId === "string") {
4605
- byLegacyId[legacyActionId] = actionType;
4606
- }
4607
- }
4608
- return byLegacyId;
4609
- }
4610
- function getCatalogEntries(catalog) {
4611
- return isPlainRecord(catalog.entries) ? catalog.entries : {};
4612
- }
4613
- function asLeadGenStageEntry(key, value) {
4614
- const record = isPlainRecord(value) ? value : {};
4615
- const entity = record.entity === "contact" ? "contact" : "company";
4616
- const additionalEntities = Array.isArray(record.additionalEntities) ? record.additionalEntities.filter(
4617
- (item) => item === "company" || item === "contact"
4618
- ) : void 0;
4619
- const recordEntity = record.recordEntity === "company" || record.recordEntity === "contact" ? record.recordEntity : void 0;
4620
- const recordStageKey = typeof record.recordStageKey === "string" ? record.recordStageKey : void 0;
4621
- return {
4622
- key: typeof record.key === "string" ? record.key : key,
4623
- label: typeof record.label === "string" ? record.label : key,
4624
- description: typeof record.description === "string" ? record.description : "",
4625
- order: typeof record.order === "number" ? record.order : 0,
4626
- entity,
4627
- ...additionalEntities !== void 0 ? { additionalEntities } : {},
4628
- ...recordEntity !== void 0 ? { recordEntity } : {},
4629
- ...recordStageKey !== void 0 ? { recordStageKey } : {}
4630
- };
4631
- }
4632
- function createLeadGenStageValidators(index) {
4633
- const getCatalog = () => Object.fromEntries(
4634
- Object.entries(getCatalogEntries(index.leadGenStageCatalog)).map(([key, value]) => [
4635
- key,
4636
- asLeadGenStageEntry(key, value)
4637
- ])
4638
- );
4639
- const getEntry = (stageKey) => getCatalog()[stageKey];
4640
- return {
4641
- getLeadGenStageCatalog: getCatalog,
4642
- getLeadGenStageEntry: getEntry,
4643
- isLeadGenStageKey: (stageKey) => getEntry(stageKey) !== void 0,
4644
- isLeadGenStageValidForEntity: (stageKey, entity) => {
4645
- const stage = getEntry(stageKey);
4646
- return stage !== void 0 && (stage.entity === entity || stage.additionalEntities?.includes(entity) === true);
4647
- },
4648
- isLeadGenRecordStageValidForEntity: (stageKey, entity) => {
4649
- const stage = getEntry(stageKey);
4650
- return stage !== void 0 && (stage.entity === entity || stage.additionalEntities?.includes(entity) === true || stage.recordEntity === entity);
4651
- },
4652
- resolveLeadGenRecordStageKey: (stageKey, entity) => {
4653
- const stage = getEntry(stageKey);
4654
- return stage?.recordEntity === entity && stage.recordStageKey ? stage.recordStageKey : stageKey;
4655
- }
4412
+ type: "object",
4413
+ properties,
4414
+ required: capabilities.message === "required" ? ["nextActions", "message", "reasoning"] : ["nextActions", "reasoning"],
4415
+ additionalProperties: false
4656
4416
  };
4657
4417
  }
4658
4418
 
@@ -5023,7 +4783,6 @@ function validateDeclaredSystemInterfaceReadiness(orgName, organizationModel) {
5023
4783
  message: `System Interface "${path}/${interfaceKey}" references unknown readiness profile "${readinessProfile}".`
5024
4784
  });
5025
4785
  }
5026
- continue;
5027
4786
  }
5028
4787
  const result = computeInterfaceReadiness(model, { systemPath: path, interfaceKey });
5029
4788
  for (const issue of result.issues) {
@@ -7380,6 +7139,297 @@ function deriveActions(deal, actions = []) {
7380
7139
  return actions.filter((a) => a.isAvailableFor(deal)).map(({ key, label, payloadSchema }) => ({ key, label, payloadSchema }));
7381
7140
  }
7382
7141
 
7142
+ // ../core/src/business/acquisition/ontology-validation.ts
7143
+ var LEAD_GEN_API_INTERFACE = SYSTEM_INTERFACE_PROFILES[0];
7144
+ var CRM_API_INTERFACE = SYSTEM_INTERFACE_PROFILES[1];
7145
+ var LEAD_GEN_CRM_HANDOFF_INTERFACE = SYSTEM_INTERFACE_PROFILES[2];
7146
+ LEAD_GEN_API_INTERFACE.readinessProfile;
7147
+ CRM_API_INTERFACE.readinessProfile;
7148
+ LEAD_GEN_CRM_HANDOFF_INTERFACE.readinessProfile;
7149
+ var LEAD_GEN_LIST_OBJECT_ONTOLOGY_ID = formatOntologyId({
7150
+ scope: "sales.lead-gen",
7151
+ kind: "object",
7152
+ localId: "list"
7153
+ });
7154
+ var LEAD_GEN_COMPANY_OBJECT_ONTOLOGY_ID = formatOntologyId({
7155
+ scope: "sales.lead-gen",
7156
+ kind: "object",
7157
+ localId: "company"
7158
+ });
7159
+ var LEAD_GEN_CONTACT_OBJECT_ONTOLOGY_ID = formatOntologyId({
7160
+ scope: "sales.lead-gen",
7161
+ kind: "object",
7162
+ localId: "contact"
7163
+ });
7164
+ var LEAD_GEN_BUILD_TEMPLATE_CATALOG_ONTOLOGY_ID = formatOntologyId({
7165
+ scope: "sales.lead-gen",
7166
+ kind: "catalog",
7167
+ localId: "build-template"
7168
+ });
7169
+ var LEAD_GEN_COMPANY_STAGE_CATALOG_ONTOLOGY_ID = formatOntologyId({
7170
+ scope: "sales.lead-gen",
7171
+ kind: "catalog",
7172
+ localId: "company-stage"
7173
+ });
7174
+ var LEAD_GEN_CONTACT_STAGE_CATALOG_ONTOLOGY_ID = formatOntologyId({
7175
+ scope: "sales.lead-gen",
7176
+ kind: "catalog",
7177
+ localId: "contact-stage"
7178
+ });
7179
+ var CRM_PIPELINE_CATALOG_ONTOLOGY_ID = formatOntologyId({
7180
+ scope: "sales.crm",
7181
+ kind: "catalog",
7182
+ localId: "crm.pipeline"
7183
+ });
7184
+ var LEAD_GEN_STAGE_CATALOG_ONTOLOGY_ID = formatOntologyId({
7185
+ scope: "sales.lead-gen",
7186
+ kind: "catalog",
7187
+ localId: "lead-gen.stage-catalog"
7188
+ });
7189
+ var LEAD_GEN_API_READINESS_CONTRACT = {
7190
+ requiredObjects: [
7191
+ LEAD_GEN_LIST_OBJECT_ONTOLOGY_ID,
7192
+ LEAD_GEN_COMPANY_OBJECT_ONTOLOGY_ID,
7193
+ LEAD_GEN_CONTACT_OBJECT_ONTOLOGY_ID
7194
+ ],
7195
+ requiredCatalogs: [
7196
+ LEAD_GEN_BUILD_TEMPLATE_CATALOG_ONTOLOGY_ID,
7197
+ LEAD_GEN_COMPANY_STAGE_CATALOG_ONTOLOGY_ID,
7198
+ LEAD_GEN_CONTACT_STAGE_CATALOG_ONTOLOGY_ID
7199
+ ]
7200
+ };
7201
+ var CRM_API_READINESS_CONTRACT = {
7202
+ requiredObjects: [],
7203
+ requiredCatalogs: [CRM_PIPELINE_CATALOG_ONTOLOGY_ID]
7204
+ };
7205
+ function isPlainRecord2(value) {
7206
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
7207
+ }
7208
+ function createLeadGenStageCatalog(model) {
7209
+ return {
7210
+ id: LEAD_GEN_STAGE_CATALOG_ONTOLOGY_ID,
7211
+ label: "Lead Gen Processing Stages",
7212
+ ownerSystemId: "sales.lead-gen",
7213
+ kind: "processing-stage-catalog",
7214
+ entries: Object.fromEntries(
7215
+ Object.entries(getLeadGenStageCatalog(model)).map(([key, entry]) => [
7216
+ key,
7217
+ {
7218
+ ...entry
7219
+ }
7220
+ ])
7221
+ ),
7222
+ legacyCatalogKey: "LEAD_GEN_STAGE_CATALOG"
7223
+ };
7224
+ }
7225
+ function throwIfInterfaceNotReady(result) {
7226
+ if (result.ready) return;
7227
+ throw new SystemInterfaceReadinessError(result);
7228
+ }
7229
+ function requireLeadGenSupplementalReadiness(issues, index, resources, context) {
7230
+ const catalogs = resourceBindingIds(resources, "usesCatalogs");
7231
+ const templateStepCatalog = findLeadGenTemplateStepCatalog(index);
7232
+ if (templateStepCatalog === void 0) {
7233
+ addReadinessIssue(
7234
+ issues,
7235
+ "SYSTEM_INTERFACE_NOT_READY",
7236
+ "missing-template-step-catalog",
7237
+ `System Interface "${formatInterfaceIdentity(context.systemPath, context.interfaceKey)}" is missing a lead-gen template-step catalog.`
7238
+ );
7239
+ } else {
7240
+ requireCatalogReadiness(issues, index, templateStepCatalog.id, context);
7241
+ requireScopedBinding(issues, catalogs, "usesCatalogs", templateStepCatalog.id, context);
7242
+ }
7243
+ requireCatalogReadiness(issues, index, LEAD_GEN_STAGE_CATALOG_ONTOLOGY_ID, context);
7244
+ }
7245
+ function requireLeadGenInterfaceReadiness(issues, index, resources, context) {
7246
+ requireContractReadiness(issues, index, resources, LEAD_GEN_API_READINESS_CONTRACT, context);
7247
+ requireLeadGenSupplementalReadiness(issues, index, resources, context);
7248
+ }
7249
+ function requireCrmInterfaceReadiness(issues, index, resources, context) {
7250
+ requireContractReadiness(issues, index, resources, CRM_API_READINESS_CONTRACT, context);
7251
+ }
7252
+ function findSystemInterfaceGrant(model, consumer, provider) {
7253
+ return Object.values(model.topology?.relationships ?? {}).find((relationship) => {
7254
+ const grant = relationship.metadata?.["systemInterfaceGrant"];
7255
+ if (!isPlainRecord2(grant) || !isPlainRecord2(grant.consumer) || !isPlainRecord2(grant.provider)) return false;
7256
+ return grant.consumer.systemPath === consumer.systemPath && grant.consumer.interfaceKey === consumer.interfaceKey && grant.provider.systemPath === provider.systemPath && grant.provider.interfaceKey === provider.interfaceKey;
7257
+ });
7258
+ }
7259
+ function requireHandoffBridgeReadiness(issues, model, context) {
7260
+ const crmResult = computeInterfaceReadiness(model, CRM_API_INTERFACE);
7261
+ if (!crmResult.ready) {
7262
+ for (const issue of crmResult.issues) {
7263
+ addReadinessIssue(
7264
+ issues,
7265
+ "SYSTEM_BRIDGE_NOT_READY",
7266
+ issue.code,
7267
+ `Provider interface ${formatInterfaceIdentity(CRM_API_INTERFACE.systemPath, CRM_API_INTERFACE.interfaceKey)} is not ready: ${issue.message}`,
7268
+ { path: issue.path, ref: issue.ref }
7269
+ );
7270
+ }
7271
+ }
7272
+ const bridgeGrant = findSystemInterfaceGrant(model, context, CRM_API_INTERFACE);
7273
+ if (bridgeGrant === void 0) {
7274
+ addReadinessIssue(
7275
+ issues,
7276
+ "SYSTEM_BRIDGE_NOT_READY",
7277
+ "missing-topology-grant",
7278
+ `System Interface "${formatInterfaceIdentity(context.systemPath, context.interfaceKey)}" requires a scoped topology grant to "${formatInterfaceIdentity(CRM_API_INTERFACE.systemPath, CRM_API_INTERFACE.interfaceKey)}".`
7279
+ );
7280
+ }
7281
+ return bridgeGrant;
7282
+ }
7283
+ function getLeadGenCrmHandoffResourceIds(model) {
7284
+ return Object.values(model.resources ?? {}).filter(
7285
+ (resource) => resource.systemPath === LEAD_GEN_CRM_HANDOFF_INTERFACE.systemPath && resource.ontology?.usesCatalogs?.includes(CRM_PIPELINE_CATALOG_ONTOLOGY_ID) === true
7286
+ ).map((resource) => resource.id);
7287
+ }
7288
+ function mergeLeadGenDerivedCatalogs(model) {
7289
+ const baseCatalogTypes = model.ontology?.catalogTypes ?? {};
7290
+ const derivedCatalogTypes = {};
7291
+ if (baseCatalogTypes[LEAD_GEN_STAGE_CATALOG_ONTOLOGY_ID] === void 0) {
7292
+ derivedCatalogTypes[LEAD_GEN_STAGE_CATALOG_ONTOLOGY_ID] = createLeadGenStageCatalog(model);
7293
+ }
7294
+ if (Object.keys(derivedCatalogTypes).length === 0) return model;
7295
+ return {
7296
+ ...model,
7297
+ ontology: {
7298
+ ...model.ontology ?? {},
7299
+ catalogTypes: {
7300
+ ...baseCatalogTypes,
7301
+ ...derivedCatalogTypes
7302
+ }
7303
+ }
7304
+ };
7305
+ }
7306
+ function compileBusinessOntology(model, contractId, includeLeadGenDerivedCatalogs) {
7307
+ const preparedModel = mergeLeadGenDerivedCatalogs(model) ;
7308
+ const compilation = compileOrganizationOntology(preparedModel);
7309
+ if (compilation.diagnostics.length > 0) {
7310
+ const summary = compilation.diagnostics.map((diagnostic) => diagnostic.message).join("; ");
7311
+ throw new Error(`${contractId} ontology validation index failed to compile: ${summary}`);
7312
+ }
7313
+ return {
7314
+ ontology: compilation.ontology,
7315
+ actionTypesByLegacyId: indexActionTypesByLegacyId(compilation.ontology.actionTypes)
7316
+ };
7317
+ }
7318
+ registerBuiltInReadinessProfile(LEAD_GEN_API_INTERFACE.readinessProfile, {
7319
+ validate: (issues, index, resources, _model, context) => requireLeadGenInterfaceReadiness(issues, index, resources, context),
7320
+ prepareModel: mergeLeadGenDerivedCatalogs
7321
+ });
7322
+ registerBuiltInReadinessProfile(CRM_API_INTERFACE.readinessProfile, {
7323
+ validate: (issues, index, resources, _model, context) => requireCrmInterfaceReadiness(issues, index, resources, context)
7324
+ });
7325
+ registerBuiltInReadinessProfile(LEAD_GEN_CRM_HANDOFF_INTERFACE.readinessProfile, {
7326
+ validate: (issues, index, resources, model, context) => {
7327
+ requireLeadGenInterfaceReadiness(issues, index, resources, context);
7328
+ requireCrmInterfaceReadiness(issues, index, resources, { ...context, allowForeignOwner: true });
7329
+ requireHandoffBridgeReadiness(issues, model, context);
7330
+ },
7331
+ prepareModel: mergeLeadGenDerivedCatalogs
7332
+ });
7333
+ registerReadinessInterfaceMarker(
7334
+ LEAD_GEN_CRM_HANDOFF_INTERFACE.systemPath,
7335
+ LEAD_GEN_CRM_HANDOFF_INTERFACE.interfaceKey,
7336
+ (model) => ({
7337
+ lifecycle: "active",
7338
+ readinessProfile: LEAD_GEN_CRM_HANDOFF_INTERFACE.readinessProfile,
7339
+ resourceIds: getLeadGenCrmHandoffResourceIds(model)
7340
+ })
7341
+ );
7342
+ function findLeadGenTemplateStepCatalog(index) {
7343
+ return Object.values(index.ontology.catalogTypes).find(
7344
+ (catalog) => catalog.ownerSystemId === "sales.lead-gen" && catalog.kind === "template-step" && catalog.appliesTo === LEAD_GEN_LIST_OBJECT_ONTOLOGY_ID
7345
+ );
7346
+ }
7347
+ function requireReadyCatalog(index, catalogId, readinessLabel) {
7348
+ const catalog = index.ontology.catalogTypes[catalogId];
7349
+ if (catalog === void 0) {
7350
+ throw new Error(
7351
+ `${readinessLabel} readiness passed but catalog "${catalogId}" is unexpectedly absent from the compiled ontology.`
7352
+ );
7353
+ }
7354
+ return catalog;
7355
+ }
7356
+ function compileBusinessOntologyValidationIndex(model) {
7357
+ throwIfInterfaceNotReady(computeInterfaceReadiness(model, LEAD_GEN_API_INTERFACE));
7358
+ throwIfInterfaceNotReady(computeInterfaceReadiness(model, CRM_API_INTERFACE));
7359
+ const index = compileBusinessOntology(model, "legacy acquisition business ontology");
7360
+ return {
7361
+ ...index,
7362
+ leadGenStageCatalog: requireReadyCatalog(
7363
+ index,
7364
+ LEAD_GEN_STAGE_CATALOG_ONTOLOGY_ID,
7365
+ "legacy acquisition business ontology"
7366
+ ),
7367
+ crmPipelineCatalog: requireReadyCatalog(
7368
+ index,
7369
+ CRM_PIPELINE_CATALOG_ONTOLOGY_ID,
7370
+ "legacy acquisition business ontology"
7371
+ )
7372
+ };
7373
+ }
7374
+ function indexActionTypesByLegacyId(actionTypes) {
7375
+ const byLegacyId = {};
7376
+ for (const actionType of Object.values(actionTypes)) {
7377
+ const legacyActionId = actionType["legacyActionId"];
7378
+ if (typeof legacyActionId === "string") {
7379
+ byLegacyId[legacyActionId] = actionType;
7380
+ }
7381
+ }
7382
+ return byLegacyId;
7383
+ }
7384
+ function getCatalogEntries2(catalog) {
7385
+ return isPlainRecord2(catalog.entries) ? catalog.entries : {};
7386
+ }
7387
+ function asLeadGenStageEntry(key, value) {
7388
+ const record = isPlainRecord2(value) ? value : {};
7389
+ const entity = record.entity === "contact" ? "contact" : "company";
7390
+ const additionalEntities = Array.isArray(record.additionalEntities) ? record.additionalEntities.filter(
7391
+ (item) => item === "company" || item === "contact"
7392
+ ) : void 0;
7393
+ const recordEntity = record.recordEntity === "company" || record.recordEntity === "contact" ? record.recordEntity : void 0;
7394
+ const recordStageKey = typeof record.recordStageKey === "string" ? record.recordStageKey : void 0;
7395
+ return {
7396
+ key: typeof record.key === "string" ? record.key : key,
7397
+ label: typeof record.label === "string" ? record.label : key,
7398
+ description: typeof record.description === "string" ? record.description : "",
7399
+ order: typeof record.order === "number" ? record.order : 0,
7400
+ entity,
7401
+ ...additionalEntities !== void 0 ? { additionalEntities } : {},
7402
+ ...recordEntity !== void 0 ? { recordEntity } : {},
7403
+ ...recordStageKey !== void 0 ? { recordStageKey } : {}
7404
+ };
7405
+ }
7406
+ function createLeadGenStageValidators(index) {
7407
+ const getCatalog = () => Object.fromEntries(
7408
+ Object.entries(getCatalogEntries2(index.leadGenStageCatalog)).map(([key, value]) => [
7409
+ key,
7410
+ asLeadGenStageEntry(key, value)
7411
+ ])
7412
+ );
7413
+ const getEntry = (stageKey) => getCatalog()[stageKey];
7414
+ return {
7415
+ getLeadGenStageCatalog: getCatalog,
7416
+ getLeadGenStageEntry: getEntry,
7417
+ isLeadGenStageKey: (stageKey) => getEntry(stageKey) !== void 0,
7418
+ isLeadGenStageValidForEntity: (stageKey, entity) => {
7419
+ const stage = getEntry(stageKey);
7420
+ return stage !== void 0 && (stage.entity === entity || stage.additionalEntities?.includes(entity) === true);
7421
+ },
7422
+ isLeadGenRecordStageValidForEntity: (stageKey, entity) => {
7423
+ const stage = getEntry(stageKey);
7424
+ return stage !== void 0 && (stage.entity === entity || stage.additionalEntities?.includes(entity) === true || stage.recordEntity === entity);
7425
+ },
7426
+ resolveLeadGenRecordStageKey: (stageKey, entity) => {
7427
+ const stage = getEntry(stageKey);
7428
+ return stage?.recordEntity === entity && stage.recordStageKey ? stage.recordStageKey : stageKey;
7429
+ }
7430
+ };
7431
+ }
7432
+
7383
7433
  // src/project-deployment-spec.ts
7384
7434
  function toSdkResourceDescriptor(resource, getResourceOntologyBinding) {
7385
7435
  const ontologyBinding = getResourceOntologyBinding?.(resource.id);
@@ -7528,4 +7578,4 @@ function defineWorkflowConfig(resourceId, descriptors, actionRegistry = []) {
7528
7578
  }
7529
7579
  var ListBuilderStageKeySchema = z.string().min(1);
7530
7580
 
7531
- 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 };
7581
+ 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 };