@elevasis/sdk 1.36.5 → 1.38.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 (57) hide show
  1. package/dist/cli.cjs +64 -22
  2. package/dist/index.d.ts +105 -7
  3. package/dist/index.js +81 -33
  4. package/dist/node/index.d.ts +6 -5
  5. package/dist/test-utils/index.d.ts +6 -5
  6. package/dist/test-utils/index.js +70 -32
  7. package/dist/worker/index.js +7 -11
  8. package/package.json +4 -4
  9. package/reference/claude-config/Overview.md +140 -32
  10. package/reference/claude-config/rules/active-change-index.md +13 -2
  11. package/reference/claude-config/rules/agent-start-here.md +13 -2
  12. package/reference/claude-config/rules/deployment.md +13 -2
  13. package/reference/claude-config/rules/error-handling.md +13 -2
  14. package/reference/claude-config/rules/execution.md +13 -2
  15. package/reference/claude-config/rules/frontend.md +13 -2
  16. package/reference/claude-config/rules/observability.md +13 -2
  17. package/reference/claude-config/rules/operations.md +13 -2
  18. package/reference/claude-config/rules/organization-model.md +1 -1
  19. package/reference/claude-config/rules/organization-os.md +1 -1
  20. package/reference/claude-config/rules/package-taxonomy.md +13 -2
  21. package/reference/claude-config/rules/platform.md +13 -2
  22. package/reference/claude-config/rules/shared-types.md +13 -2
  23. package/reference/claude-config/rules/task-tracking.md +13 -2
  24. package/reference/claude-config/rules/topbar-actions.md +2 -2
  25. package/reference/claude-config/rules/ui.md +13 -2
  26. package/reference/claude-config/rules/vibe.md +13 -2
  27. package/reference/claude-config/settings.json +30 -34
  28. package/reference/claude-config/skills/deploy/SKILL.md +159 -156
  29. package/reference/claude-config/skills/elevasis/SKILL.md +11 -4
  30. package/reference/claude-config/skills/explore/SKILL.md +78 -78
  31. package/reference/claude-config/skills/git-sync/SKILL.md +166 -126
  32. package/reference/claude-config/skills/om/SKILL.md +15 -15
  33. package/reference/claude-config/skills/om/operations/build.md +2 -2
  34. package/reference/claude-config/skills/project/SKILL.md +1 -1
  35. package/reference/claude-config/skills/save/SKILL.md +183 -183
  36. package/reference/claude-config/skills/setup/SKILL.md +9 -3
  37. package/reference/claude-config/skills/status/SKILL.md +59 -59
  38. package/reference/claude-config/skills/sync/SKILL.md +47 -47
  39. package/reference/claude-config/skills/tutorial/SKILL.md +1 -1
  40. package/reference/claude-config/skills/tutorial/technical.md +11 -11
  41. package/reference/claude-config/sync-notes/2026-06-15-session-chat-zero-wiring.md +46 -0
  42. package/reference/claude-config/sync-notes/2026-06-17-agent-session-ux-features.md +34 -0
  43. package/reference/claude-config/sync-notes/2026-06-25-shared-page-scroll-contract-guard.md +52 -0
  44. package/reference/claude-config/sync-notes/2026-06-26-leadgen-overview-om-telemetry.md +47 -0
  45. package/reference/claude-config/sync-notes/2026-07-21-agent-scaffold-hardening.md +75 -0
  46. package/reference/rules/active-change-index.md +5 -5
  47. package/reference/rules/agent-start-here.md +34 -30
  48. package/reference/rules/deployment.md +21 -8
  49. package/reference/rules/frontend.md +4 -4
  50. package/reference/rules/observability.md +1 -1
  51. package/reference/rules/organization-model.md +1 -1
  52. package/reference/rules/organization-os.md +29 -29
  53. package/reference/rules/ui.md +205 -202
  54. package/reference/rules/vibe.md +5 -4
  55. package/reference/scaffold/operations/propagation-pipeline.md +1 -1
  56. package/reference/scaffold/recipes/extend-lead-gen.md +505 -332
  57. package/reference/scaffold/reference/contracts.md +14 -21
package/dist/cli.cjs CHANGED
@@ -38577,17 +38577,48 @@ var SYSTEM_INTERFACE_PROFILES = [
38577
38577
  var SYSTEM_INTERFACE_READINESS_PROFILES = SYSTEM_INTERFACE_PROFILES.map(
38578
38578
  (profile) => profile.readinessProfile
38579
38579
  );
38580
- var SystemInterfaceReadinessProfileSchema = external_exports.enum(SYSTEM_INTERFACE_READINESS_PROFILES);
38580
+ var SystemInterfaceReadinessProfileSchema = external_exports.string().trim().min(1);
38581
38581
  var SystemInterfaceResourceScopeSchema = external_exports.array(ModelIdSchema).default([]);
38582
+ var SystemApiInterfaceReadinessContractSchema = external_exports.object({
38583
+ /** Ontology IDs of object types the interface depends on. */
38584
+ requiredObjects: external_exports.array(external_exports.string().trim().min(1)).default([]),
38585
+ /** Ontology IDs of catalog types the interface requires (must be non-empty). */
38586
+ requiredCatalogs: external_exports.array(external_exports.string().trim().min(1)).default([]),
38587
+ /** Optional ontology kind filters (reserved for future profile extensions). */
38588
+ requiredKinds: external_exports.array(external_exports.string().trim().min(1)).optional()
38589
+ }).strict();
38582
38590
  var SystemApiInterfaceSchema = external_exports.object({
38583
38591
  lifecycle: SystemInterfaceLifecycleSchema.default("active"),
38592
+ /**
38593
+ * Open-string profile id. Built-in platform presets are looked up through
38594
+ * the profile registry; custom ids are validated structurally via
38595
+ * `readinessContract`. Optional — `profileForInterface` provides a default.
38596
+ */
38584
38597
  readinessProfile: SystemInterfaceReadinessProfileSchema.optional(),
38585
38598
  /**
38586
38599
  * Resource ids that participate in this API interface. This scopes readiness
38587
38600
  * derivation without duplicating authored required/provided contract refs.
38588
38601
  */
38589
- resourceIds: SystemInterfaceResourceScopeSchema.optional()
38602
+ resourceIds: SystemInterfaceResourceScopeSchema.optional(),
38603
+ /**
38604
+ * Tenant-authorable readiness declaration. Required for custom
38605
+ * (non-built-in) profile ids so structural validation can proceed. Built-in
38606
+ * profiles ignore this field (requirements are derived from platform code).
38607
+ */
38608
+ readinessContract: SystemApiInterfaceReadinessContractSchema.optional()
38590
38609
  }).strict();
38610
+ var _profileRegistry = new Map(
38611
+ SYSTEM_INTERFACE_READINESS_PROFILES.map((profileId) => [
38612
+ profileId,
38613
+ { profileId, kind: "built-in" }
38614
+ ])
38615
+ );
38616
+ function profileForInterface(systemPath, interfaceKey, readinessProfile) {
38617
+ return readinessProfile ?? `${systemPath}.${interfaceKey}`;
38618
+ }
38619
+ function isBuiltInReadinessProfile(profileId) {
38620
+ return _profileRegistry.get(profileId)?.kind === "built-in";
38621
+ }
38591
38622
  var SystemInterfaceRefSchema = external_exports.object({
38592
38623
  systemPath: SystemPathSchema,
38593
38624
  interfaceKey: SystemInterfaceKeySchema
@@ -40023,6 +40054,7 @@ function getLeadGenStageCatalog(model) {
40023
40054
  );
40024
40055
  const recordEntity = entry.recordEntity === "company" || entry.recordEntity === "contact" ? entry.recordEntity : void 0;
40025
40056
  const recordStageKey = stringValue(entry.recordStageKey);
40057
+ const readinessTarget = entry.readinessTarget === true ? true : void 0;
40026
40058
  results[entryId] = {
40027
40059
  key: entryId,
40028
40060
  label: stringValue(entry.label) ?? entryId,
@@ -40031,7 +40063,8 @@ function getLeadGenStageCatalog(model) {
40031
40063
  entity,
40032
40064
  ...additionalEntities.length > 0 ? { additionalEntities } : {},
40033
40065
  ...recordEntity ? { recordEntity } : {},
40034
- ...recordStageKey ? { recordStageKey } : {}
40066
+ ...recordStageKey ? { recordStageKey } : {},
40067
+ ...readinessTarget ? { readinessTarget } : {}
40035
40068
  };
40036
40069
  }
40037
40070
  }
@@ -41491,14 +41524,11 @@ function addReadinessIssue(issues, family, code, message, details = {}) {
41491
41524
  function formatInterfaceIdentity(systemPath, interfaceKey) {
41492
41525
  return `${systemPath}/${interfaceKey}`;
41493
41526
  }
41494
- function profileForInterface(systemPath, interfaceKey, readinessProfile) {
41495
- return readinessProfile ?? `${systemPath}.${interfaceKey}`;
41496
- }
41497
41527
  function readinessMarkerPath(context) {
41498
41528
  return context.interfaceKey === "api" ? `systems.${context.systemPath}.apiInterface` : `systems.${context.systemPath}.derivedCrmHandoffReadiness`;
41499
41529
  }
41500
41530
  function formatSupportedReadinessProfiles() {
41501
- return SYSTEM_INTERFACE_READINESS_PROFILES.map((profile) => `"${profile}"`).join(", ");
41531
+ return SYSTEM_INTERFACE_PROFILES.map((p) => `"${p.readinessProfile}"`).join(", ");
41502
41532
  }
41503
41533
  function getActiveScopedResources(model, resourceIds, issues, context) {
41504
41534
  const resources = [];
@@ -41690,9 +41720,6 @@ function getLeadGenCrmHandoffResourceIds(model) {
41690
41720
  function getSystemInterfaceReadinessMarker(model, request) {
41691
41721
  const system = getSystem(model, request.systemPath);
41692
41722
  if (system === void 0) return void 0;
41693
- if (request.interfaceKey === LEAD_GEN_API_INTERFACE.interfaceKey) {
41694
- return system.apiInterface;
41695
- }
41696
41723
  if (request.systemPath === LEAD_GEN_CRM_HANDOFF_INTERFACE.systemPath && request.interfaceKey === LEAD_GEN_CRM_HANDOFF_INTERFACE.interfaceKey) {
41697
41724
  return {
41698
41725
  lifecycle: "active",
@@ -41700,6 +41727,9 @@ function getSystemInterfaceReadinessMarker(model, request) {
41700
41727
  resourceIds: getLeadGenCrmHandoffResourceIds(model)
41701
41728
  };
41702
41729
  }
41730
+ if (request.interfaceKey === "api" && system.apiInterface !== void 0) {
41731
+ return system.apiInterface;
41732
+ }
41703
41733
  return void 0;
41704
41734
  }
41705
41735
  function mergeLeadGenDerivedCatalogs(model) {
@@ -41744,6 +41774,18 @@ function tryCompileBusinessOntology(model, readinessProfile, issues) {
41744
41774
  return void 0;
41745
41775
  }
41746
41776
  }
41777
+ function requireContractReadiness(issues, index, resources, contract, context) {
41778
+ const reads = resourceBindingIds(resources, "reads");
41779
+ const catalogs = resourceBindingIds(resources, "usesCatalogs");
41780
+ for (const objectId of contract.requiredObjects) {
41781
+ requireObjectReadiness(issues, index, objectId, context);
41782
+ requireScopedBinding(issues, reads, "reads", objectId, context);
41783
+ }
41784
+ for (const catalogId of contract.requiredCatalogs) {
41785
+ requireCatalogReadiness(issues, index, catalogId, context);
41786
+ requireScopedBinding(issues, catalogs, "usesCatalogs", catalogId, context);
41787
+ }
41788
+ }
41747
41789
  function computeInterfaceReadiness(model, request) {
41748
41790
  const issues = [];
41749
41791
  const system = getSystem(model, request.systemPath);
@@ -41791,20 +41833,22 @@ function computeInterfaceReadiness(model, request) {
41791
41833
  { path: `${readinessMarkerPath(request)}.lifecycle` }
41792
41834
  );
41793
41835
  }
41794
- const supportedProfile = readinessProfile !== void 0 && SYSTEM_INTERFACE_PROFILES.some((profile) => profile.readinessProfile === readinessProfile);
41795
- if (!supportedProfile) {
41836
+ const checkedReadinessProfile = readinessProfile ?? profileForInterface(request.systemPath, request.interfaceKey);
41837
+ const isBuiltIn = isBuiltInReadinessProfile(checkedReadinessProfile);
41838
+ const readinessContract = systemInterface.readinessContract;
41839
+ if (!isBuiltIn && readinessContract === void 0) {
41796
41840
  addReadinessIssue(
41797
41841
  issues,
41798
41842
  "SYSTEM_INTERFACE_INVALID",
41799
- "unknown-readiness-profile",
41800
- `System Interface "${formatInterfaceIdentity(request.systemPath, request.interfaceKey)}" references unknown readiness profile "${readinessProfile}". Supported profiles: ${formatSupportedReadinessProfiles()}. Custom Systems should not declare apiInterface; route custom behavior through workflows/operations plus ontology, resources, and topology.`,
41801
- { path: `${readinessMarkerPath(request)}.readinessProfile`, ref: readinessProfile }
41843
+ "missing-readiness-contract",
41844
+ `System Interface "${formatInterfaceIdentity(request.systemPath, request.interfaceKey)}" uses custom readiness profile "${checkedReadinessProfile}" but declares no readinessContract. Built-in profiles: ${formatSupportedReadinessProfiles()}.`,
41845
+ { path: `${readinessMarkerPath(request)}.readinessContract`, ref: checkedReadinessProfile }
41802
41846
  );
41803
41847
  return {
41804
41848
  ready: false,
41805
41849
  systemPath: request.systemPath,
41806
41850
  interfaceKey: request.interfaceKey,
41807
- readinessProfile,
41851
+ readinessProfile: checkedReadinessProfile,
41808
41852
  scopedResourceIds,
41809
41853
  issues
41810
41854
  };
@@ -41818,10 +41862,6 @@ function computeInterfaceReadiness(model, request) {
41818
41862
  { path: `${readinessMarkerPath(request)}.resourceIds` }
41819
41863
  );
41820
41864
  }
41821
- const checkedReadinessProfile = readinessProfile;
41822
- if (checkedReadinessProfile === void 0) {
41823
- throw new Error("Supported readiness profile unexpectedly resolved to undefined");
41824
- }
41825
41865
  const resources = getActiveScopedResources(model, scopedResourceIds, issues, request);
41826
41866
  const index = tryCompileBusinessOntology(model, checkedReadinessProfile, issues);
41827
41867
  if (index !== void 0) {
@@ -41833,13 +41873,15 @@ function computeInterfaceReadiness(model, request) {
41833
41873
  requireLeadGenInterfaceReadiness(issues, index, resources, request);
41834
41874
  requireCrmInterfaceReadiness(issues, index, resources, { ...request, allowForeignOwner: true });
41835
41875
  requireHandoffBridgeReadiness(issues, model, request);
41876
+ } else if (readinessContract !== void 0) {
41877
+ requireContractReadiness(issues, index, resources, readinessContract, request);
41836
41878
  }
41837
41879
  }
41838
41880
  return {
41839
41881
  ready: issues.length === 0,
41840
41882
  systemPath: request.systemPath,
41841
41883
  interfaceKey: request.interfaceKey,
41842
- readinessProfile,
41884
+ readinessProfile: checkedReadinessProfile,
41843
41885
  scopedResourceIds,
41844
41886
  issues
41845
41887
  };
@@ -45808,7 +45850,7 @@ function wrapAction(commandName, fn) {
45808
45850
  // package.json
45809
45851
  var package_default = {
45810
45852
  name: "@elevasis/sdk",
45811
- version: "1.36.5",
45853
+ version: "1.38.0",
45812
45854
  description: "SDK for building Elevasis organization resources",
45813
45855
  type: "module",
45814
45856
  bin: {
package/dist/index.d.ts CHANGED
@@ -5062,6 +5062,18 @@ interface LeadGenStageCatalogEntry {
5062
5062
  recordEntity?: 'company' | 'contact';
5063
5063
  /** Stage key to read from recordEntity.processing_state for Records views. */
5064
5064
  recordStageKey?: string;
5065
+ /**
5066
+ * Marks this stage as the pipeline objective ("ready" target).
5067
+ *
5068
+ * When declared, the platform UI uses the preceding stage (derived from
5069
+ * `order`) as the backlog source and this stage as the drain, producing a
5070
+ * "contacts ready for <next step>" count without hardcoding tenant-specific
5071
+ * stage keys. Only one stage per catalog should set this to `true`.
5072
+ *
5073
+ * Absent (undefined) when not declared — no tenant authoring is required;
5074
+ * the UI falls back to a generic last-incomplete-stage backlog.
5075
+ */
5076
+ readinessTarget?: boolean;
5065
5077
  }
5066
5078
 
5067
5079
  declare const ProcessingStageStatusSchema: z.ZodEnum<{
@@ -6750,12 +6762,13 @@ declare const SystemApiInterfaceSchema: z.ZodObject<{
6750
6762
  archived: "archived";
6751
6763
  disabled: "disabled";
6752
6764
  }>>;
6753
- readinessProfile: z.ZodOptional<z.ZodEnum<{
6754
- "sales.lead-gen.api": "sales.lead-gen.api";
6755
- "sales.crm.api": "sales.crm.api";
6756
- "sales.lead-gen.crm-handoff": "sales.lead-gen.crm-handoff";
6757
- }>>;
6765
+ readinessProfile: z.ZodOptional<z.ZodString>;
6758
6766
  resourceIds: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
6767
+ readinessContract: z.ZodOptional<z.ZodObject<{
6768
+ requiredObjects: z.ZodDefault<z.ZodArray<z.ZodString>>;
6769
+ requiredCatalogs: z.ZodDefault<z.ZodArray<z.ZodString>>;
6770
+ requiredKinds: z.ZodOptional<z.ZodArray<z.ZodString>>;
6771
+ }, z.core.$strict>>;
6759
6772
  }, z.core.$strict>;
6760
6773
  type JsonPrimitive = string | number | boolean | null;
6761
6774
  type JsonValue = JsonPrimitive | JsonValue[] | {
@@ -12274,6 +12287,91 @@ declare class ToolingError extends ExecutionError {
12274
12287
  constructor(errorType: string, message: string, details?: unknown);
12275
12288
  }
12276
12289
 
12290
+ /**
12291
+ * Tenant-authorable readiness requirements for a system's API interface.
12292
+ *
12293
+ * Built-in profiles (`sales.lead-gen.api`, `sales.crm.api`,
12294
+ * `sales.lead-gen.crm-handoff`) derive their requirements from platform code
12295
+ * and do not need a `readinessContract`. Custom systems (any profile id not in
12296
+ * the built-in registry) MUST declare a contract so structural readiness
12297
+ * validation can proceed without platform hardcoding.
12298
+ *
12299
+ * Each field is an array of ontology IDs that this system must satisfy:
12300
+ * - `requiredObjects` – ontology object types the interface depends on
12301
+ * - `requiredCatalogs` – catalog types the interface requires (non-empty)
12302
+ * - `requiredKinds` – (optional) ontology kind filters for future use
12303
+ */
12304
+ declare const SystemApiInterfaceReadinessContractSchema = z
12305
+ .object({
12306
+ /** Ontology IDs of object types the interface depends on. */
12307
+ requiredObjects: z.array(z.string().trim().min(1)).default([]),
12308
+ /** Ontology IDs of catalog types the interface requires (must be non-empty). */
12309
+ requiredCatalogs: z.array(z.string().trim().min(1)).default([]),
12310
+ /** Optional ontology kind filters (reserved for future profile extensions). */
12311
+ requiredKinds: z.array(z.string().trim().min(1)).optional()
12312
+ })
12313
+ .strict()
12314
+
12315
+ // ---------------------------------------------------------------------------
12316
+ // Profile registry
12317
+ //
12318
+ // Maps a readiness profile id to a lookup result. Built-in presets are
12319
+ // registered at module load; callers may register additional presets via
12320
+ // `registerReadinessProfile`. Unknown ids resolve to `undefined` — validated
12321
+ // structurally through the system's declared `readinessContract`.
12322
+ // ---------------------------------------------------------------------------
12323
+
12324
+ type ReadinessProfileKind = 'built-in' | 'custom'
12325
+
12326
+ interface ReadinessProfileEntry {
12327
+ readonly profileId: string
12328
+ readonly kind: ReadinessProfileKind
12329
+ }
12330
+
12331
+ /**
12332
+ * Look up a readiness profile entry by id.
12333
+ *
12334
+ * Returns `undefined` for unknown ids (not in the built-in list and not
12335
+ * registered via `registerReadinessProfile`). Unknown profiles are validated
12336
+ * structurally through the system's `readinessContract` — unknown-profile is
12337
+ * NOT a schema-layer rejection.
12338
+ */
12339
+ declare function lookupReadinessProfile(profileId: string): ReadinessProfileEntry | undefined {
12340
+ return _profileRegistry.get(profileId)
12341
+ }
12342
+
12343
+ /**
12344
+ * Register a custom readiness profile preset.
12345
+ *
12346
+ * Tenant tooling or SDK extensions may call this during startup to register
12347
+ * named presets. Registered presets are then resolvable via `lookupReadinessProfile`.
12348
+ * Built-in profile ids cannot be overwritten.
12349
+ */
12350
+ declare function registerReadinessProfile(profileId: string): ReadinessProfileEntry {
12351
+ const existing = _profileRegistry.get(profileId)
12352
+ if (existing !== undefined) return existing
12353
+ const entry: ReadinessProfileEntry = { profileId, kind: 'custom' }
12354
+ _profileRegistry.set(profileId, entry)
12355
+ return entry
12356
+ }
12357
+
12358
+ /**
12359
+ * Return the effective readiness profile id for a system interface.
12360
+ * Falls back to `systemPath.interfaceKey` when `readinessProfile` is omitted.
12361
+ * This is the canonical profile-resolution function used by validation code.
12362
+ */
12363
+ declare function profileForInterface(systemPath: string, interfaceKey: string, readinessProfile?: string): string {
12364
+ return readinessProfile ?? `${systemPath}.${interfaceKey}`
12365
+ }
12366
+
12367
+ /**
12368
+ * Return true if the given profile id is a built-in platform preset.
12369
+ */
12370
+ declare function isBuiltInReadinessProfile(profileId: string): boolean {
12371
+ return _profileRegistry.get(profileId)?.kind === 'built-in'
12372
+ }
12373
+ type SystemApiInterfaceReadinessContract = z.infer<typeof SystemApiInterfaceReadinessContractSchema>
12374
+
12277
12375
  declare const ResourceOntologyBindingSchema = z
12278
12376
  .object({
12279
12377
  actions: z.array(OntologyIdSchema).optional(),
@@ -12625,5 +12723,5 @@ declare function defineWorkflowConfig<const TResourceId extends string>(resource
12625
12723
  declare const ListBuilderStageKeySchema: z.ZodString;
12626
12724
  type ListBuilderStageKey = z.infer<typeof ListBuilderStageKeySchema>;
12627
12725
 
12628
- 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, isZodType, parseTopologyNodeRef, projectDeploymentSpec, projectTopologyRelationships, resolveContractRef, runDiagnostic, splitName, toSdkResourceDescriptor, topologyRef, topologyRelationship, validateDeclaredSystemInterfaceReadiness, validateResourceGovernance, withPlatformAgentResourceDescriptor, withPlatformAgentResourceDescriptors, withPlatformIntegrationResourceDescriptor, withPlatformIntegrationResourceDescriptors, withPlatformResourceDescriptor, withPlatformResourceDescriptors };
12629
- 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, 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, 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, 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 };
12726
+ 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 };
12727
+ 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, 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 };
package/dist/index.js CHANGED
@@ -618,17 +618,58 @@ var SYSTEM_INTERFACE_PROFILES = [
618
618
  var SYSTEM_INTERFACE_READINESS_PROFILES = SYSTEM_INTERFACE_PROFILES.map(
619
619
  (profile) => profile.readinessProfile
620
620
  );
621
- var SystemInterfaceReadinessProfileSchema = z.enum(SYSTEM_INTERFACE_READINESS_PROFILES);
621
+ var SystemInterfaceReadinessProfileSchema = z.string().trim().min(1);
622
622
  var SystemInterfaceResourceScopeSchema = z.array(ModelIdSchema).default([]);
623
+ var SystemApiInterfaceReadinessContractSchema = z.object({
624
+ /** Ontology IDs of object types the interface depends on. */
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()
630
+ }).strict();
623
631
  var SystemApiInterfaceSchema = z.object({
624
632
  lifecycle: SystemInterfaceLifecycleSchema.default("active"),
633
+ /**
634
+ * Open-string profile id. Built-in platform presets are looked up through
635
+ * the profile registry; custom ids are validated structurally via
636
+ * `readinessContract`. Optional — `profileForInterface` provides a default.
637
+ */
625
638
  readinessProfile: SystemInterfaceReadinessProfileSchema.optional(),
626
639
  /**
627
640
  * Resource ids that participate in this API interface. This scopes readiness
628
641
  * derivation without duplicating authored required/provided contract refs.
629
642
  */
630
- resourceIds: SystemInterfaceResourceScopeSchema.optional()
643
+ resourceIds: SystemInterfaceResourceScopeSchema.optional(),
644
+ /**
645
+ * Tenant-authorable readiness declaration. Required for custom
646
+ * (non-built-in) profile ids so structural validation can proceed. Built-in
647
+ * profiles ignore this field (requirements are derived from platform code).
648
+ */
649
+ readinessContract: SystemApiInterfaceReadinessContractSchema.optional()
631
650
  }).strict();
651
+ var _profileRegistry = new Map(
652
+ SYSTEM_INTERFACE_READINESS_PROFILES.map((profileId) => [
653
+ profileId,
654
+ { profileId, kind: "built-in" }
655
+ ])
656
+ );
657
+ function lookupReadinessProfile(profileId) {
658
+ return _profileRegistry.get(profileId);
659
+ }
660
+ function registerReadinessProfile(profileId) {
661
+ const existing = _profileRegistry.get(profileId);
662
+ if (existing !== void 0) return existing;
663
+ const entry = { profileId, kind: "custom" };
664
+ _profileRegistry.set(profileId, entry);
665
+ return entry;
666
+ }
667
+ function profileForInterface(systemPath, interfaceKey, readinessProfile) {
668
+ return readinessProfile ?? `${systemPath}.${interfaceKey}`;
669
+ }
670
+ function isBuiltInReadinessProfile(profileId) {
671
+ return _profileRegistry.get(profileId)?.kind === "built-in";
672
+ }
632
673
  var SystemInterfaceRefSchema = z.object({
633
674
  systemPath: SystemPathSchema,
634
675
  interfaceKey: SystemInterfaceKeySchema
@@ -1103,6 +1144,7 @@ function getLeadGenStageCatalog(model) {
1103
1144
  );
1104
1145
  const recordEntity = entry.recordEntity === "company" || entry.recordEntity === "contact" ? entry.recordEntity : void 0;
1105
1146
  const recordStageKey = stringValue(entry.recordStageKey);
1147
+ const readinessTarget = entry.readinessTarget === true ? true : void 0;
1106
1148
  results[entryId] = {
1107
1149
  key: entryId,
1108
1150
  label: stringValue(entry.label) ?? entryId,
@@ -1111,7 +1153,8 @@ function getLeadGenStageCatalog(model) {
1111
1153
  entity,
1112
1154
  ...additionalEntities.length > 0 ? { additionalEntities } : {},
1113
1155
  ...recordEntity ? { recordEntity } : {},
1114
- ...recordStageKey ? { recordStageKey } : {}
1156
+ ...recordStageKey ? { recordStageKey } : {},
1157
+ ...readinessTarget ? { readinessTarget } : {}
1115
1158
  };
1116
1159
  }
1117
1160
  }
@@ -1757,9 +1800,6 @@ function addReadinessIssue(issues, family, code, message, details = {}) {
1757
1800
  function formatInterfaceIdentity(systemPath, interfaceKey) {
1758
1801
  return `${systemPath}/${interfaceKey}`;
1759
1802
  }
1760
- function profileForInterface(systemPath, interfaceKey, readinessProfile) {
1761
- return readinessProfile ?? `${systemPath}.${interfaceKey}`;
1762
- }
1763
1803
  function readinessMarkerPath(context) {
1764
1804
  return context.interfaceKey === "api" ? `systems.${context.systemPath}.apiInterface` : `systems.${context.systemPath}.derivedCrmHandoffReadiness`;
1765
1805
  }
@@ -1769,7 +1809,7 @@ function formatInterfaceReadinessFailure(result) {
1769
1809
  return `${identity} readiness failed${result.readinessProfile ? ` (${result.readinessProfile})` : ""}: ${issueSummary}`;
1770
1810
  }
1771
1811
  function formatSupportedReadinessProfiles() {
1772
- return SYSTEM_INTERFACE_READINESS_PROFILES.map((profile) => `"${profile}"`).join(", ");
1812
+ return SYSTEM_INTERFACE_PROFILES.map((p) => `"${p.readinessProfile}"`).join(", ");
1773
1813
  }
1774
1814
  function throwIfInterfaceNotReady(result) {
1775
1815
  if (result.ready) return;
@@ -1965,9 +2005,6 @@ function getLeadGenCrmHandoffResourceIds(model) {
1965
2005
  function getSystemInterfaceReadinessMarker(model, request) {
1966
2006
  const system = getSystem(model, request.systemPath);
1967
2007
  if (system === void 0) return void 0;
1968
- if (request.interfaceKey === LEAD_GEN_API_INTERFACE.interfaceKey) {
1969
- return system.apiInterface;
1970
- }
1971
2008
  if (request.systemPath === LEAD_GEN_CRM_HANDOFF_INTERFACE.systemPath && request.interfaceKey === LEAD_GEN_CRM_HANDOFF_INTERFACE.interfaceKey) {
1972
2009
  return {
1973
2010
  lifecycle: "active",
@@ -1975,6 +2012,9 @@ function getSystemInterfaceReadinessMarker(model, request) {
1975
2012
  resourceIds: getLeadGenCrmHandoffResourceIds(model)
1976
2013
  };
1977
2014
  }
2015
+ if (request.interfaceKey === "api" && system.apiInterface !== void 0) {
2016
+ return system.apiInterface;
2017
+ }
1978
2018
  return void 0;
1979
2019
  }
1980
2020
  function mergeLeadGenDerivedCatalogs(model) {
@@ -2019,6 +2059,18 @@ function tryCompileBusinessOntology(model, readinessProfile, issues) {
2019
2059
  return void 0;
2020
2060
  }
2021
2061
  }
2062
+ function requireContractReadiness(issues, index, resources, contract, context) {
2063
+ const reads = resourceBindingIds(resources, "reads");
2064
+ const catalogs = resourceBindingIds(resources, "usesCatalogs");
2065
+ for (const objectId of contract.requiredObjects) {
2066
+ requireObjectReadiness(issues, index, objectId, context);
2067
+ requireScopedBinding(issues, reads, "reads", objectId, context);
2068
+ }
2069
+ for (const catalogId of contract.requiredCatalogs) {
2070
+ requireCatalogReadiness(issues, index, catalogId, context);
2071
+ requireScopedBinding(issues, catalogs, "usesCatalogs", catalogId, context);
2072
+ }
2073
+ }
2022
2074
  function computeInterfaceReadiness(model, request) {
2023
2075
  const issues = [];
2024
2076
  const system = getSystem(model, request.systemPath);
@@ -2066,20 +2118,22 @@ function computeInterfaceReadiness(model, request) {
2066
2118
  { path: `${readinessMarkerPath(request)}.lifecycle` }
2067
2119
  );
2068
2120
  }
2069
- const supportedProfile = readinessProfile !== void 0 && SYSTEM_INTERFACE_PROFILES.some((profile) => profile.readinessProfile === readinessProfile);
2070
- if (!supportedProfile) {
2121
+ const checkedReadinessProfile = readinessProfile ?? profileForInterface(request.systemPath, request.interfaceKey);
2122
+ const isBuiltIn = isBuiltInReadinessProfile(checkedReadinessProfile);
2123
+ const readinessContract = systemInterface.readinessContract;
2124
+ if (!isBuiltIn && readinessContract === void 0) {
2071
2125
  addReadinessIssue(
2072
2126
  issues,
2073
2127
  "SYSTEM_INTERFACE_INVALID",
2074
- "unknown-readiness-profile",
2075
- `System Interface "${formatInterfaceIdentity(request.systemPath, request.interfaceKey)}" references unknown readiness profile "${readinessProfile}". Supported profiles: ${formatSupportedReadinessProfiles()}. Custom Systems should not declare apiInterface; route custom behavior through workflows/operations plus ontology, resources, and topology.`,
2076
- { path: `${readinessMarkerPath(request)}.readinessProfile`, ref: readinessProfile }
2128
+ "missing-readiness-contract",
2129
+ `System Interface "${formatInterfaceIdentity(request.systemPath, request.interfaceKey)}" uses custom readiness profile "${checkedReadinessProfile}" but declares no readinessContract. Built-in profiles: ${formatSupportedReadinessProfiles()}.`,
2130
+ { path: `${readinessMarkerPath(request)}.readinessContract`, ref: checkedReadinessProfile }
2077
2131
  );
2078
2132
  return {
2079
2133
  ready: false,
2080
2134
  systemPath: request.systemPath,
2081
2135
  interfaceKey: request.interfaceKey,
2082
- readinessProfile,
2136
+ readinessProfile: checkedReadinessProfile,
2083
2137
  scopedResourceIds,
2084
2138
  issues
2085
2139
  };
@@ -2093,10 +2147,6 @@ function computeInterfaceReadiness(model, request) {
2093
2147
  { path: `${readinessMarkerPath(request)}.resourceIds` }
2094
2148
  );
2095
2149
  }
2096
- const checkedReadinessProfile = readinessProfile;
2097
- if (checkedReadinessProfile === void 0) {
2098
- throw new Error("Supported readiness profile unexpectedly resolved to undefined");
2099
- }
2100
2150
  const resources = getActiveScopedResources(model, scopedResourceIds, issues, request);
2101
2151
  const index = tryCompileBusinessOntology(model, checkedReadinessProfile, issues);
2102
2152
  if (index !== void 0) {
@@ -2108,13 +2158,15 @@ function computeInterfaceReadiness(model, request) {
2108
2158
  requireLeadGenInterfaceReadiness(issues, index, resources, request);
2109
2159
  requireCrmInterfaceReadiness(issues, index, resources, { ...request, allowForeignOwner: true });
2110
2160
  requireHandoffBridgeReadiness(issues, model, request);
2161
+ } else if (readinessContract !== void 0) {
2162
+ requireContractReadiness(issues, index, resources, readinessContract, request);
2111
2163
  }
2112
2164
  }
2113
2165
  return {
2114
2166
  ready: issues.length === 0,
2115
2167
  systemPath: request.systemPath,
2116
2168
  interfaceKey: request.interfaceKey,
2117
- readinessProfile,
2169
+ readinessProfile: checkedReadinessProfile,
2118
2170
  scopedResourceIds,
2119
2171
  issues
2120
2172
  };
@@ -6337,17 +6389,13 @@ var AcqListMetadataSchema = z.object({
6337
6389
  }).catchall(z.unknown());
6338
6390
  var ProspectingBuildTemplateIdSchema = z.string().trim().min(1).max(100);
6339
6391
  var ListStageCountsSchema = z.object({
6340
- // Attempted counts by canonical lead-gen stage. The detailed status
6341
- // distribution lives on ListProgress; telemetry keeps the overview payload small.
6342
- stageCounts: z.object({
6343
- populated: z.number().int(),
6344
- extracted: z.number().int(),
6345
- qualified: z.number().int(),
6346
- discovered: z.number().int(),
6347
- verified: z.number().int(),
6348
- personalized: z.number().int(),
6349
- uploaded: z.number().int()
6350
- }),
6392
+ // Attempted counts keyed by the tenant's declared lead-gen stage catalog IDs.
6393
+ // The catalog is tenant-owned and OM-derived at compute time; the schema
6394
+ // validates the transport shape (string keys → integer values) rather than
6395
+ // a fixed key set, so tenants with custom stages receive complete telemetry.
6396
+ // Canonical Elevasis stages (populated, extracted, qualified, discovered,
6397
+ // verified, personalized, uploaded) are included when declared in the catalog.
6398
+ stageCounts: z.record(z.string().min(1), z.number().int()),
6351
6399
  deliverability: z.object({
6352
6400
  valid: z.number().int(),
6353
6401
  risky: z.number().int(),
@@ -7069,4 +7117,4 @@ function defineWorkflowConfig(resourceId, descriptors, actionRegistry = []) {
7069
7117
  }
7070
7118
  var ListBuilderStageKeySchema = z.string().min(1);
7071
7119
 
7072
- 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, isZodType, parseTopologyNodeRef, projectDeploymentSpec, projectTopologyRelationships, resolveContractRef, runDiagnostic, splitName, toSdkResourceDescriptor, topologyRef, topologyRelationship, validateDeclaredSystemInterfaceReadiness, validateResourceGovernance, withPlatformAgentResourceDescriptor, withPlatformAgentResourceDescriptors, withPlatformIntegrationResourceDescriptor, withPlatformIntegrationResourceDescriptors, withPlatformResourceDescriptor, withPlatformResourceDescriptors };
7120
+ 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 };
@@ -1396,12 +1396,13 @@ declare const SystemApiInterfaceSchema: z.ZodObject<{
1396
1396
  archived: "archived";
1397
1397
  disabled: "disabled";
1398
1398
  }>>;
1399
- readinessProfile: z.ZodOptional<z.ZodEnum<{
1400
- "sales.lead-gen.api": "sales.lead-gen.api";
1401
- "sales.crm.api": "sales.crm.api";
1402
- "sales.lead-gen.crm-handoff": "sales.lead-gen.crm-handoff";
1403
- }>>;
1399
+ readinessProfile: z.ZodOptional<z.ZodString>;
1404
1400
  resourceIds: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
1401
+ readinessContract: z.ZodOptional<z.ZodObject<{
1402
+ requiredObjects: z.ZodDefault<z.ZodArray<z.ZodString>>;
1403
+ requiredCatalogs: z.ZodDefault<z.ZodArray<z.ZodString>>;
1404
+ requiredKinds: z.ZodOptional<z.ZodArray<z.ZodString>>;
1405
+ }, z.core.$strict>>;
1405
1406
  }, z.core.$strict>;
1406
1407
  type JsonPrimitive = string | number | boolean | null;
1407
1408
  type JsonValue = JsonPrimitive | JsonValue[] | {
@@ -5945,12 +5945,13 @@ declare const SystemApiInterfaceSchema: z.ZodObject<{
5945
5945
  archived: "archived";
5946
5946
  disabled: "disabled";
5947
5947
  }>>;
5948
- readinessProfile: z.ZodOptional<z.ZodEnum<{
5949
- "sales.lead-gen.api": "sales.lead-gen.api";
5950
- "sales.crm.api": "sales.crm.api";
5951
- "sales.lead-gen.crm-handoff": "sales.lead-gen.crm-handoff";
5952
- }>>;
5948
+ readinessProfile: z.ZodOptional<z.ZodString>;
5953
5949
  resourceIds: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
5950
+ readinessContract: z.ZodOptional<z.ZodObject<{
5951
+ requiredObjects: z.ZodDefault<z.ZodArray<z.ZodString>>;
5952
+ requiredCatalogs: z.ZodDefault<z.ZodArray<z.ZodString>>;
5953
+ requiredKinds: z.ZodOptional<z.ZodArray<z.ZodString>>;
5954
+ }, z.core.$strict>>;
5954
5955
  }, z.core.$strict>;
5955
5956
  type JsonPrimitive = string | number | boolean | null;
5956
5957
  type JsonValue = JsonPrimitive | JsonValue[] | {