@elevasis/sdk 1.24.0 → 1.26.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 (66) hide show
  1. package/dist/cli.cjs +875 -834
  2. package/dist/index.d.ts +4857 -4547
  3. package/dist/index.js +564 -2338
  4. package/dist/node/index.d.ts +693 -1356
  5. package/dist/node/index.js +1 -1
  6. package/dist/test-utils/index.d.ts +4186 -4139
  7. package/dist/test-utils/index.js +694 -2769
  8. package/dist/types/worker/adapters/clickup.d.ts +22 -0
  9. package/dist/types/worker/adapters/index.d.ts +1 -0
  10. package/dist/types/worker/index.d.ts +3 -2
  11. package/dist/types/worker/platform.d.ts +2 -2
  12. package/dist/worker/index.js +427 -2803
  13. package/package.json +2 -2
  14. package/reference/_navigation.md +11 -1
  15. package/reference/_reference-manifest.json +70 -0
  16. package/reference/claude-config/rules/organization-model.md +12 -1
  17. package/reference/claude-config/rules/organization-os.md +12 -1
  18. package/reference/claude-config/skills/om/SKILL.md +13 -5
  19. package/reference/claude-config/skills/om/operations/codify-level-a.md +109 -100
  20. package/reference/claude-config/skills/om/operations/customers.md +10 -6
  21. package/reference/claude-config/skills/om/operations/features.md +7 -3
  22. package/reference/claude-config/skills/om/operations/goals.md +10 -6
  23. package/reference/claude-config/skills/om/operations/identity.md +8 -5
  24. package/reference/claude-config/skills/om/operations/labels.md +17 -1
  25. package/reference/claude-config/skills/om/operations/offerings.md +11 -7
  26. package/reference/claude-config/skills/om/operations/roles.md +11 -7
  27. package/reference/claude-config/skills/om/operations/techStack.md +10 -2
  28. package/reference/claude-config/sync-notes/2026-05-20-om-define-helpers.md +32 -0
  29. package/reference/claude-config/sync-notes/2026-05-22-access-model-and-right-panel.md +43 -0
  30. package/reference/claude-config/sync-notes/2026-05-22-lead-gen-tenant-config.md +40 -0
  31. package/reference/claude-config/sync-notes/2026-05-22-org-model-multi-file-split.md +61 -0
  32. package/reference/cli-management.mdx +539 -0
  33. package/reference/cli.mdx +579 -808
  34. package/reference/concepts.mdx +134 -146
  35. package/reference/deployment/api.mdx +296 -297
  36. package/reference/deployment/command-center.mdx +208 -209
  37. package/reference/deployment/index.mdx +194 -195
  38. package/reference/deployment/provided-features.mdx +110 -107
  39. package/reference/deployment/ui-execution.mdx +249 -250
  40. package/reference/framework/index.mdx +111 -195
  41. package/reference/framework/resource-documentation.mdx +90 -0
  42. package/reference/framework/tutorial-system.mdx +135 -135
  43. package/reference/getting-started.mdx +141 -142
  44. package/reference/index.mdx +95 -106
  45. package/reference/packages/ui/src/auth/README.md +6 -6
  46. package/reference/platform-tools/adapters-integration.mdx +300 -301
  47. package/reference/platform-tools/adapters-platform.mdx +552 -553
  48. package/reference/platform-tools/index.mdx +216 -217
  49. package/reference/platform-tools/type-safety.mdx +82 -82
  50. package/reference/resources/index.mdx +348 -349
  51. package/reference/resources/patterns.mdx +446 -449
  52. package/reference/resources/types.mdx +115 -116
  53. package/reference/roadmap.mdx +164 -165
  54. package/reference/rules/organization-model.md +14 -0
  55. package/reference/runtime.mdx +172 -173
  56. package/reference/scaffold/operations/propagation-pipeline.md +1 -1
  57. package/reference/scaffold/recipes/customize-crm-actions.md +45 -46
  58. package/reference/scaffold/recipes/extend-crm.md +253 -255
  59. package/reference/scaffold/recipes/extend-lead-gen.md +130 -77
  60. package/reference/scaffold/recipes/index.md +43 -44
  61. package/reference/scaffold/reference/contracts.md +1275 -1432
  62. package/reference/scaffold/reference/glossary.md +8 -6
  63. package/reference/scaffold/ui/feature-flags-and-gating.md +59 -46
  64. package/reference/scaffold/ui/feature-shell.mdx +11 -11
  65. package/reference/scaffold/ui/recipes.md +24 -24
  66. package/reference/troubleshooting.mdx +222 -223
package/dist/cli.cjs CHANGED
@@ -36586,681 +36586,126 @@ config(en_default());
36586
36586
  // src/cli/commands/deploy.ts
36587
36587
  var import_module = require("module");
36588
36588
 
36589
- // ../core/src/organization-model/icons.ts
36590
- var ORGANIZATION_MODEL_ICON_TOKENS = [
36591
- // Navigation / app areas
36592
- "dashboard",
36593
- "calendar",
36594
- "sales",
36595
- "crm",
36596
- "lead-gen",
36597
- "projects",
36598
- "clients",
36599
- "operations",
36600
- "monitoring",
36601
- "knowledge",
36602
- "settings",
36603
- "admin",
36604
- "archive",
36605
- "business",
36606
- "finance",
36607
- "platform",
36608
- "seo",
36609
- // Knowledge kinds
36610
- "playbook",
36611
- "strategy",
36612
- "reference",
36613
- // Resource kinds
36614
- "agent",
36615
- "workflow",
36616
- "integration",
36617
- "database",
36618
- "user",
36619
- "team",
36620
- // Integration specifics
36621
- "gmail",
36622
- "google-sheets",
36623
- "attio",
36624
- // Surface / UI views
36625
- "overview",
36626
- "command-view",
36627
- "command-queue",
36628
- "pipeline",
36629
- "lists",
36630
- "resources",
36631
- // Actions
36632
- "approve",
36633
- "reject",
36634
- "retry",
36635
- "edit",
36636
- "view",
36637
- "launch",
36638
- "message",
36639
- "escalate",
36640
- "promote",
36641
- "submit",
36642
- "email",
36643
- // Status
36644
- "success",
36645
- "error",
36646
- "warning",
36647
- "info",
36648
- "pending",
36649
- // OM / UI group icons
36650
- "bolt",
36651
- "building",
36652
- "briefcase",
36653
- "apps",
36654
- "graph",
36655
- "shield",
36656
- "users",
36657
- "chart-bar",
36658
- "search"
36659
- ];
36660
- var CustomIconTokenSchema = external_exports.string().trim().max(80).regex(
36661
- /^custom\.[a-z0-9]+(?:[-._][a-z0-9]+)*$/,
36662
- 'Custom icon tokens must start with "custom." followed by lowercase alphanumeric segments'
36663
- );
36664
- var OrganizationModelBuiltinIconTokenSchema = external_exports.enum(ORGANIZATION_MODEL_ICON_TOKENS);
36665
- var OrganizationModelIconTokenSchema = external_exports.union([
36666
- OrganizationModelBuiltinIconTokenSchema,
36667
- CustomIconTokenSchema
36589
+ // ../core/src/organization-model/ontology.ts
36590
+ var OntologyKindSchema = external_exports.enum([
36591
+ "object",
36592
+ "link",
36593
+ "action",
36594
+ "catalog",
36595
+ "event",
36596
+ "interface",
36597
+ "value-type",
36598
+ "property",
36599
+ "group",
36600
+ "surface"
36668
36601
  ]);
36669
-
36670
- // ../core/src/organization-model/domains/shared.ts
36671
- var ModelIdSchema = external_exports.string().trim().min(1).max(100).regex(/^[a-z0-9]+(?:[-._][a-z0-9]+)*$/, "IDs must be lowercase and use -, _, or . separators");
36672
- var LabelSchema = external_exports.string().trim().min(1).max(120);
36673
- var DescriptionSchema = external_exports.string().trim().min(1).max(2e3);
36674
- var ColorTokenSchema = external_exports.string().trim().min(1).max(50);
36675
- var IconNameSchema = OrganizationModelIconTokenSchema;
36676
- var PathSchema = external_exports.string().trim().startsWith("/").max(300);
36677
- var ReferenceIdsSchema = external_exports.array(ModelIdSchema).default([]);
36678
- var DisplayMetadataSchema = external_exports.object({
36679
- label: LabelSchema,
36680
- description: DescriptionSchema.optional(),
36681
- color: ColorTokenSchema.optional(),
36682
- icon: IconNameSchema.optional()
36602
+ var SYSTEM_PATH_PATTERN = "[a-z0-9][a-z0-9-]*(?:\\.[a-z0-9][a-z0-9-]*)*";
36603
+ var LOCAL_ID_PATTERN = "[a-z0-9][a-z0-9._-]*";
36604
+ var ONTOLOGY_ID_PATTERN = `^(global|${SYSTEM_PATH_PATTERN}):(${OntologyKindSchema.options.join("|")})\\/(${LOCAL_ID_PATTERN})$`;
36605
+ var ONTOLOGY_ID_REGEX = new RegExp(ONTOLOGY_ID_PATTERN);
36606
+ var OntologyIdSchema = external_exports.string().trim().min(1).max(300).regex(
36607
+ ONTOLOGY_ID_REGEX,
36608
+ "Ontology IDs must use <system-path>:<kind>/<local-id> or global:<kind>/<local-id>"
36609
+ );
36610
+ function parseOntologyId(id) {
36611
+ const normalized = OntologyIdSchema.parse(id);
36612
+ const match = ONTOLOGY_ID_REGEX.exec(normalized);
36613
+ if (match === null) {
36614
+ throw new Error(`Invalid ontology ID "${id}"`);
36615
+ }
36616
+ return {
36617
+ id: normalized,
36618
+ scope: match[1],
36619
+ kind: match[2],
36620
+ localId: match[3],
36621
+ isGlobal: match[1] === "global"
36622
+ };
36623
+ }
36624
+ function formatOntologyId(input) {
36625
+ return OntologyIdSchema.parse(`${input.scope}:${input.kind}/${input.localId}`);
36626
+ }
36627
+ var OntologyReferenceListSchema = external_exports.array(OntologyIdSchema).default([]).optional();
36628
+ var OntologyRecordBaseSchema = external_exports.object({
36629
+ id: OntologyIdSchema,
36630
+ label: external_exports.string().trim().min(1).max(160).optional(),
36631
+ description: external_exports.string().trim().min(1).max(2e3).optional(),
36632
+ ownerSystemId: external_exports.string().trim().min(1).max(200).optional(),
36633
+ aliases: external_exports.array(OntologyIdSchema).optional()
36634
+ }).passthrough();
36635
+ var OntologyObjectTypeSchema = OntologyRecordBaseSchema.extend({
36636
+ properties: external_exports.record(external_exports.string().trim().min(1).max(200), external_exports.unknown()).optional(),
36637
+ storage: external_exports.record(external_exports.string(), external_exports.unknown()).optional()
36683
36638
  });
36684
- var TechStackEntrySchema = external_exports.object({
36685
- /** Name of the external platform (e.g. "HubSpot", "Stripe", "Notion"). */
36686
- platform: external_exports.string().trim().min(1).max(200),
36687
- /** Free-form description of what this integration is used for. */
36688
- purpose: external_exports.string().trim().min(1).max(500),
36689
- /**
36690
- * Health of the credential backing this integration.
36691
- * - configured: credential present and valid
36692
- * - pending: not yet set up
36693
- * - expired: credential existed but has lapsed
36694
- * - missing: expected but not present
36695
- */
36696
- credentialStatus: external_exports.enum(["configured", "pending", "expired", "missing"]),
36697
- /**
36698
- * Whether this integration is the primary system of record for its domain
36699
- * (e.g. HubSpot is SoR for contacts). Defaults to false.
36700
- */
36701
- isSystemOfRecord: external_exports.boolean().default(false)
36639
+ var OntologyLinkTypeSchema = OntologyRecordBaseSchema.extend({
36640
+ from: OntologyIdSchema,
36641
+ to: OntologyIdSchema,
36642
+ cardinality: external_exports.string().trim().min(1).max(80).optional(),
36643
+ via: external_exports.string().trim().min(1).max(255).optional()
36702
36644
  });
36703
- var ResourceMappingSchema = DisplayMetadataSchema.extend({
36704
- id: ModelIdSchema,
36705
- resourceId: external_exports.string().trim().min(1).max(255),
36706
- resourceType: external_exports.enum(["workflow", "agent", "trigger", "integration", "external", "human_checkpoint"]),
36707
- systemIds: ReferenceIdsSchema,
36708
- entityIds: ReferenceIdsSchema,
36709
- surfaceIds: ReferenceIdsSchema,
36710
- actionIds: ReferenceIdsSchema,
36711
- /** Optional tech-stack metadata for external-SaaS integrations. */
36712
- techStack: TechStackEntrySchema.optional()
36645
+ var OntologyActionTypeSchema = OntologyRecordBaseSchema.extend({
36646
+ actsOn: OntologyReferenceListSchema,
36647
+ input: external_exports.record(external_exports.string().trim().min(1).max(200), external_exports.unknown()).optional(),
36648
+ effects: external_exports.array(external_exports.record(external_exports.string(), external_exports.unknown())).optional()
36713
36649
  });
36714
-
36715
- // ../core/src/organization-model/domains/branding.ts
36716
- var OrganizationModelBrandingSchema = external_exports.object({
36717
- organizationName: LabelSchema,
36718
- productName: LabelSchema,
36719
- shortName: external_exports.string().trim().min(1).max(40),
36720
- description: DescriptionSchema.optional(),
36721
- logos: external_exports.object({
36722
- light: external_exports.string().trim().min(1).max(2048).optional(),
36723
- dark: external_exports.string().trim().min(1).max(2048).optional()
36724
- }).default({})
36650
+ var OntologyCatalogTypeSchema = OntologyRecordBaseSchema.extend({
36651
+ kind: external_exports.string().trim().min(1).max(120).optional(),
36652
+ appliesTo: OntologyIdSchema.optional(),
36653
+ entries: external_exports.record(external_exports.string().trim().min(1).max(200), external_exports.unknown()).optional()
36725
36654
  });
36726
- var DEFAULT_ORGANIZATION_MODEL_BRANDING = {
36727
- organizationName: "Default Organization",
36728
- productName: "Elevasis",
36729
- shortName: "Elevasis",
36730
- logos: {}
36731
- };
36732
-
36733
- // ../core/src/organization-model/domains/navigation.ts
36734
- var SurfaceTypeSchema = external_exports.enum(["page", "dashboard", "graph", "detail", "list", "settings"]).meta({ label: "Surface type", color: "blue" });
36735
- var SurfaceDefinitionSchema = external_exports.object({
36736
- id: ModelIdSchema,
36737
- label: LabelSchema,
36738
- path: PathSchema,
36739
- surfaceType: SurfaceTypeSchema,
36740
- description: DescriptionSchema.optional(),
36741
- enabled: external_exports.boolean().default(true),
36742
- devOnly: external_exports.boolean().optional(),
36743
- icon: IconNameSchema.optional(),
36744
- systemIds: external_exports.array(ModelIdSchema.meta({ ref: "system" })).default([]),
36745
- entityIds: external_exports.array(ModelIdSchema.meta({ ref: "entity" })).default([]),
36746
- resourceIds: external_exports.array(ModelIdSchema.meta({ ref: "resource" })).default([]),
36747
- actionIds: external_exports.array(ModelIdSchema.meta({ ref: "action" })).default([]),
36748
- parentId: ModelIdSchema.meta({ ref: "surface" }).optional()
36655
+ var OntologyEventTypeSchema = OntologyRecordBaseSchema.extend({
36656
+ payload: external_exports.record(external_exports.string().trim().min(1).max(200), external_exports.unknown()).optional()
36749
36657
  });
36750
- var SidebarSurfaceTargetsSchema = external_exports.object({
36751
- systems: external_exports.array(ModelIdSchema.meta({ ref: "system" })).default([]).optional(),
36752
- entities: external_exports.array(ModelIdSchema.meta({ ref: "entity" })).default([]).optional(),
36753
- resources: external_exports.array(ModelIdSchema.meta({ ref: "resource" })).default([]).optional(),
36754
- actions: external_exports.array(ModelIdSchema.meta({ ref: "action" })).default([]).optional()
36658
+ var OntologyInterfaceTypeSchema = OntologyRecordBaseSchema.extend({
36659
+ properties: external_exports.record(external_exports.string().trim().min(1).max(200), external_exports.unknown()).optional()
36660
+ });
36661
+ var OntologyValueTypeSchema = OntologyRecordBaseSchema.extend({
36662
+ primitive: external_exports.string().trim().min(1).max(120).optional()
36663
+ });
36664
+ var OntologySharedPropertySchema = OntologyRecordBaseSchema.extend({
36665
+ valueType: OntologyIdSchema.optional(),
36666
+ searchable: external_exports.boolean().optional(),
36667
+ pii: external_exports.boolean().optional()
36668
+ });
36669
+ var OntologyGroupSchema = OntologyRecordBaseSchema.extend({
36670
+ members: OntologyReferenceListSchema
36671
+ });
36672
+ var OntologySurfaceTypeSchema = OntologyRecordBaseSchema.extend({
36673
+ route: external_exports.string().trim().min(1).max(500).optional()
36674
+ });
36675
+ var OntologyScopeSchema = external_exports.object({
36676
+ objectTypes: external_exports.record(OntologyIdSchema, OntologyObjectTypeSchema).default({}).optional(),
36677
+ linkTypes: external_exports.record(OntologyIdSchema, OntologyLinkTypeSchema).default({}).optional(),
36678
+ actionTypes: external_exports.record(OntologyIdSchema, OntologyActionTypeSchema).default({}).optional(),
36679
+ catalogTypes: external_exports.record(OntologyIdSchema, OntologyCatalogTypeSchema).default({}).optional(),
36680
+ eventTypes: external_exports.record(OntologyIdSchema, OntologyEventTypeSchema).default({}).optional(),
36681
+ interfaceTypes: external_exports.record(OntologyIdSchema, OntologyInterfaceTypeSchema).default({}).optional(),
36682
+ valueTypes: external_exports.record(OntologyIdSchema, OntologyValueTypeSchema).default({}).optional(),
36683
+ sharedProperties: external_exports.record(OntologyIdSchema, OntologySharedPropertySchema).default({}).optional(),
36684
+ groups: external_exports.record(OntologyIdSchema, OntologyGroupSchema).default({}).optional(),
36685
+ surfaces: external_exports.record(OntologyIdSchema, OntologySurfaceTypeSchema).default({}).optional()
36755
36686
  }).default({});
36756
- var SidebarNodeSchema = external_exports.lazy(
36757
- () => external_exports.discriminatedUnion("type", [
36758
- external_exports.object({
36759
- type: external_exports.literal("group"),
36760
- label: LabelSchema,
36761
- description: DescriptionSchema.optional(),
36762
- icon: IconNameSchema.optional(),
36763
- order: external_exports.number().int().optional(),
36764
- children: external_exports.record(external_exports.string(), SidebarNodeSchema).default({})
36765
- }),
36766
- external_exports.object({
36767
- type: external_exports.literal("surface"),
36768
- label: LabelSchema,
36769
- path: PathSchema,
36770
- surfaceType: SurfaceTypeSchema,
36771
- description: DescriptionSchema.optional(),
36772
- icon: IconNameSchema.optional(),
36773
- order: external_exports.number().int().optional(),
36774
- targets: SidebarSurfaceTargetsSchema.optional(),
36775
- devOnly: external_exports.boolean().optional(),
36776
- requiresAdmin: external_exports.boolean().optional()
36777
- })
36778
- ])
36779
- );
36780
- var SidebarSectionSchema = external_exports.record(external_exports.string(), SidebarNodeSchema).default({});
36781
- var SidebarNavigationSchema = external_exports.object({
36782
- primary: SidebarSectionSchema,
36783
- bottom: SidebarSectionSchema
36784
- }).default({ primary: {}, bottom: {} });
36785
- var OrganizationModelNavigationSchema = external_exports.object({
36786
- sidebar: SidebarNavigationSchema
36787
- }).default({ sidebar: { primary: {}, bottom: {} } });
36788
- var NavigationGroupSchema = external_exports.object({
36789
- id: ModelIdSchema,
36790
- label: LabelSchema,
36791
- placement: external_exports.string().trim().min(1).max(50),
36792
- surfaceIds: external_exports.array(ModelIdSchema.meta({ ref: "surface" })).default([])
36793
- });
36794
-
36795
- // ../core/src/organization-model/domains/identity.ts
36796
- var BusinessHoursDaySchema = external_exports.object({
36797
- open: external_exports.string().trim().regex(/^\d{2}:\d{2}$/, "Expected HH:MM format"),
36798
- close: external_exports.string().trim().regex(/^\d{2}:\d{2}$/, "Expected HH:MM format")
36799
- });
36800
- var BusinessHoursSchema = external_exports.object({
36801
- monday: BusinessHoursDaySchema.optional(),
36802
- tuesday: BusinessHoursDaySchema.optional(),
36803
- wednesday: BusinessHoursDaySchema.optional(),
36804
- thursday: BusinessHoursDaySchema.optional(),
36805
- friday: BusinessHoursDaySchema.optional(),
36806
- saturday: BusinessHoursDaySchema.optional(),
36807
- sunday: BusinessHoursDaySchema.optional()
36808
- }).default({});
36809
- var IdentityDomainSchema = external_exports.object({
36810
- /** Why the organization exists — one or two plain-language sentences. */
36811
- mission: external_exports.string().trim().max(1e3).default(""),
36812
- /** Long-term direction the organization is moving toward. */
36813
- vision: external_exports.string().trim().max(1e3).default(""),
36814
- /** Legal registered name of the entity. */
36815
- legalName: external_exports.string().trim().max(200).default(""),
36816
- /**
36817
- * Type of legal entity (e.g. "LLC", "Corporation", "Sole Proprietor",
36818
- * "Non-profit"). Free-form string so it covers any jurisdiction.
36819
- */
36820
- entityType: external_exports.string().trim().max(100).default(""),
36821
- /**
36822
- * Primary jurisdiction of registration or operation
36823
- * (e.g. "United States – Delaware", "Canada – Ontario").
36824
- */
36825
- jurisdiction: external_exports.string().trim().max(200).default(""),
36826
- /**
36827
- * Industry category — broad classification (e.g. "Marketing Agency",
36828
- * "Software / SaaS", "Professional Services").
36829
- */
36830
- industryCategory: external_exports.string().trim().max(200).default(""),
36831
- /**
36832
- * Geographic focus — where the organization primarily operates or serves
36833
- * (e.g. "North America", "Global", "Southeast Asia").
36834
- */
36835
- geographicFocus: external_exports.string().trim().max(200).default(""),
36836
- /**
36837
- * IANA timezone identifier for the organization's primary operating timezone
36838
- * (e.g. "America/Los_Angeles", "Europe/London", "UTC").
36839
- */
36840
- timeZone: external_exports.string().trim().max(100).default("UTC"),
36841
- /** Typical operating hours per day of week. Empty object means not configured. */
36842
- businessHours: BusinessHoursSchema,
36843
- /**
36844
- * Long-form markdown capturing client context, problem narrative, and domain
36845
- * background. Populated by /setup; surfaced to agents as organizational context.
36846
- * Optional — many projects have no external client.
36847
- */
36848
- clientBrief: external_exports.string().trim().default("")
36849
- });
36850
- var DEFAULT_ORGANIZATION_MODEL_IDENTITY = {
36851
- mission: "",
36852
- vision: "",
36853
- legalName: "",
36854
- entityType: "",
36855
- jurisdiction: "",
36856
- industryCategory: "",
36857
- geographicFocus: "",
36858
- timeZone: "UTC",
36859
- businessHours: {},
36860
- clientBrief: ""
36861
- };
36862
-
36863
- // ../core/src/organization-model/domains/customers.ts
36864
- var FirmographicsSchema = external_exports.object({
36865
- /** Industry vertical (e.g. "Marketing Agency", "Legal", "Real Estate"). */
36866
- industry: external_exports.string().trim().max(200).optional(),
36867
- /**
36868
- * Company headcount band (e.g. "1–10", "11–50", "51–200", "200+").
36869
- * Free-form string to accommodate any band notation.
36870
- */
36871
- companySize: external_exports.string().trim().max(100).optional(),
36872
- /**
36873
- * Primary geographic region the segment operates in or is targeted from
36874
- * (e.g. "North America", "Europe", "Global").
36875
- */
36876
- region: external_exports.string().trim().max(200).optional()
36877
- });
36878
- var CustomerSegmentSchema = external_exports.object({
36879
- /** Stable unique identifier for the segment (e.g. "segment-smb-agencies"). */
36880
- id: external_exports.string().trim().min(1).max(100),
36881
- /** Domain-map iteration order. Convention: multiples of 10 (10, 20, 30, ...) to allow easy insertion. */
36882
- order: external_exports.number(),
36883
- /** Human-readable name shown to agents and in UI (e.g. "SMB Marketing Agencies"). */
36884
- name: external_exports.string().trim().max(200).default(""),
36885
- /** One or two sentences describing who this segment is. */
36886
- description: external_exports.string().trim().max(2e3).default(""),
36887
- /**
36888
- * The primary job(s) this segment is trying to get done — the goal they hire
36889
- * a product/service to accomplish. Plain-language narrative or bullet list.
36890
- */
36891
- jobsToBeDone: external_exports.string().trim().max(2e3).default(""),
36892
- /**
36893
- * Pains — frustrations, obstacles, and risks the segment experiences
36894
- * when trying to accomplish their jobs-to-be-done.
36895
- */
36896
- pains: external_exports.array(external_exports.string().trim().max(500)).default([]),
36897
- /**
36898
- * Gains — outcomes and benefits the segment desires; positive motivators
36899
- * beyond merely resolving pains.
36900
- */
36901
- gains: external_exports.array(external_exports.string().trim().max(500)).default([]),
36902
- /** Firmographic profile for targeting and filtering. */
36903
- firmographics: FirmographicsSchema.default({}),
36904
- /**
36905
- * Value proposition — one or two sentences stating why this organization's
36906
- * offering is uniquely suited for this segment's needs.
36907
- */
36908
- valueProp: external_exports.string().trim().max(2e3).default("")
36909
- });
36910
- var CustomersDomainSchema = external_exports.record(external_exports.string(), CustomerSegmentSchema).refine((record2) => Object.entries(record2).every(([key, entry]) => entry.id === key), {
36911
- message: "Each segment entry id must match its map key"
36912
- }).default({});
36913
- var DEFAULT_ORGANIZATION_MODEL_CUSTOMERS = {};
36914
-
36915
- // ../core/src/organization-model/domains/offerings.ts
36916
- var PricingModelSchema = external_exports.enum(["one-time", "subscription", "usage-based", "custom"]).meta({ label: "Pricing model", color: "green" });
36917
- var ProductSchema = external_exports.object({
36918
- /** Stable unique identifier for the product (e.g. "product-starter-plan"). */
36919
- id: external_exports.string().trim().min(1).max(100),
36920
- /** Domain-map iteration order. Convention: multiples of 10 (10, 20, 30, ...) to allow easy insertion. */
36921
- order: external_exports.number(),
36922
- /** Human-readable name shown to agents and in UI (e.g. "Starter Plan"). */
36923
- name: external_exports.string().trim().max(200).default(""),
36924
- /** One or two sentences describing what this product/service delivers. */
36925
- description: external_exports.string().trim().max(2e3).default(""),
36926
- /**
36927
- * How this product is priced:
36928
- * - "one-time" — single purchase (setup fee, project fee)
36929
- * - "subscription" — recurring (monthly/annual SaaS, retainer)
36930
- * - "usage-based" — metered by consumption (API calls, seats)
36931
- * - "custom" — negotiated or bespoke pricing
36932
- */
36933
- pricingModel: PricingModelSchema.default("custom"),
36934
- /** Base price amount (≥ 0). Currency unit defined by `currency`. */
36935
- price: external_exports.number().min(0).default(0),
36936
- /**
36937
- * ISO 4217 currency code (e.g. "USD", "EUR", "GBP").
36938
- * Free-form string to accommodate any currency; defaults to "USD".
36939
- */
36940
- currency: external_exports.string().trim().max(10).default("USD"),
36941
- /**
36942
- * IDs of customer segments this product targets.
36943
- * Each id must reference a declared `customers.segments[].id`.
36944
- * Cross-reference enforced in `OrganizationModelSchema.superRefine()`.
36945
- */
36946
- targetSegmentIds: external_exports.array(external_exports.string().trim().min(1)).default([]),
36947
- /**
36948
- * Optional: ID of the platform system responsible for delivering this product.
36949
- * When present, must reference a declared `systems.systems[].id`.
36950
- * Cross-reference enforced in `OrganizationModelSchema.superRefine()`.
36951
- */
36952
- deliveryFeatureId: external_exports.string().trim().min(1).optional()
36953
- });
36954
- var OfferingsDomainSchema = external_exports.record(external_exports.string(), ProductSchema).refine((record2) => Object.entries(record2).every(([key, entry]) => entry.id === key), {
36955
- message: "Each product entry id must match its map key"
36956
- }).default({});
36957
- var DEFAULT_ORGANIZATION_MODEL_OFFERINGS = {};
36958
-
36959
- // ../core/src/organization-model/domains/entities.ts
36960
- var EntityIdSchema = ModelIdSchema;
36961
- var EntityLinkKindSchema = external_exports.enum(["belongs-to", "has-many", "has-one", "many-to-many"]).meta({ label: "Link kind" });
36962
- var EntityLinkSchema = external_exports.object({
36963
- toEntity: EntityIdSchema.meta({ ref: "entity" }),
36964
- kind: EntityLinkKindSchema,
36965
- via: external_exports.string().trim().min(1).max(255).optional(),
36966
- label: LabelSchema.optional()
36967
- });
36968
- var EntitySchema = external_exports.object({
36969
- id: EntityIdSchema,
36970
- /** Domain-map iteration order. Convention: multiples of 10 (10, 20, 30, ...) to allow easy insertion. */
36971
- order: external_exports.number(),
36972
- label: LabelSchema,
36973
- description: DescriptionSchema.optional(),
36974
- ownedBySystemId: ModelIdSchema.meta({ ref: "system" }),
36975
- table: external_exports.string().trim().min(1).max(255).optional(),
36976
- rowSchema: ModelIdSchema.optional(),
36977
- stateCatalogId: ModelIdSchema.optional(),
36978
- links: external_exports.array(EntityLinkSchema).optional()
36979
- });
36980
- var EntitiesDomainSchema = external_exports.record(external_exports.string(), EntitySchema).refine((record2) => Object.entries(record2).every(([key, entry]) => entry.id === key), {
36981
- message: "Each entity entry id must match its map key"
36982
- }).default({});
36983
- var ENTITY_ENTRY_INPUTS = [
36984
- {
36985
- id: "crm.deal",
36986
- order: 10,
36987
- label: "Deal",
36988
- description: "A CRM opportunity or sales pipeline record.",
36989
- ownedBySystemId: "sales.crm",
36990
- table: "crm_deals",
36991
- stateCatalogId: "crm.pipeline",
36992
- links: [{ toEntity: "crm.contact", kind: "has-many", via: "deal_contacts", label: "contacts" }]
36993
- },
36994
- {
36995
- id: "crm.contact",
36996
- order: 20,
36997
- label: "CRM Contact",
36998
- description: "A person associated with a CRM relationship or deal.",
36999
- ownedBySystemId: "sales.crm",
37000
- table: "crm_contacts"
37001
- },
37002
- {
37003
- id: "leadgen.list",
37004
- order: 30,
37005
- label: "Lead List",
37006
- description: "A prospecting list that groups companies and contacts for acquisition workflows.",
37007
- ownedBySystemId: "sales.lead-gen",
37008
- table: "acq_lists",
37009
- links: [
37010
- { toEntity: "leadgen.company", kind: "has-many", via: "acq_list_companies", label: "companies" },
37011
- { toEntity: "leadgen.contact", kind: "has-many", via: "acq_list_members", label: "contacts" }
37012
- ]
37013
- },
37014
- {
37015
- id: "leadgen.company",
37016
- order: 40,
37017
- label: "Lead Company",
37018
- description: "A company record sourced, enriched, and qualified during prospecting.",
37019
- ownedBySystemId: "sales.lead-gen",
37020
- table: "acq_list_companies",
37021
- stateCatalogId: "lead-gen.company",
37022
- links: [
37023
- { toEntity: "leadgen.list", kind: "belongs-to", via: "list_id", label: "list" },
37024
- { toEntity: "leadgen.contact", kind: "has-many", via: "company_id", label: "contacts" }
37025
- ]
37026
- },
37027
- {
37028
- id: "leadgen.contact",
37029
- order: 50,
37030
- label: "Lead Contact",
37031
- description: "A prospect contact discovered or enriched during lead generation.",
37032
- ownedBySystemId: "sales.lead-gen",
37033
- table: "acq_list_members",
37034
- stateCatalogId: "lead-gen.contact",
37035
- links: [
37036
- { toEntity: "leadgen.list", kind: "belongs-to", via: "list_id", label: "list" },
37037
- { toEntity: "leadgen.company", kind: "belongs-to", via: "company_id", label: "company" }
37038
- ]
37039
- },
37040
- {
37041
- id: "delivery.project",
37042
- order: 60,
37043
- label: "Project",
37044
- description: "A client delivery project.",
37045
- ownedBySystemId: "projects",
37046
- table: "projects",
37047
- links: [
37048
- { toEntity: "delivery.milestone", kind: "has-many", via: "project_id", label: "milestones" },
37049
- { toEntity: "delivery.task", kind: "has-many", via: "project_id", label: "tasks" }
37050
- ]
37051
- },
37052
- {
37053
- id: "delivery.milestone",
37054
- order: 70,
37055
- label: "Milestone",
37056
- description: "A delivery checkpoint within a project.",
37057
- ownedBySystemId: "projects",
37058
- table: "project_milestones",
37059
- links: [
37060
- { toEntity: "delivery.project", kind: "belongs-to", via: "project_id", label: "project" },
37061
- { toEntity: "delivery.task", kind: "has-many", via: "milestone_id", label: "tasks" }
37062
- ]
37063
- },
37064
- {
37065
- id: "delivery.task",
37066
- order: 80,
37067
- label: "Task",
37068
- description: "A delivery task that can move through the task status catalog.",
37069
- ownedBySystemId: "projects",
37070
- table: "project_tasks",
37071
- stateCatalogId: "delivery.task",
37072
- links: [
37073
- { toEntity: "delivery.project", kind: "belongs-to", via: "project_id", label: "project" },
37074
- { toEntity: "delivery.milestone", kind: "belongs-to", via: "milestone_id", label: "milestone" }
37075
- ]
37076
- }
37077
- ];
37078
- var DEFAULT_ORGANIZATION_MODEL_ENTITIES = Object.fromEntries(
37079
- ENTITY_ENTRY_INPUTS.map((entity) => {
37080
- const parsed = EntitySchema.parse(entity);
37081
- return [parsed.id, parsed];
37082
- })
37083
- );
37084
-
37085
- // ../core/src/organization-model/domains/actions.ts
37086
- var ActionResourceIdSchema = external_exports.string().trim().min(1).max(255).regex(/^[A-Za-z0-9]+(?:[-._][A-Za-z0-9]+)*$/, "Resource IDs must use letters, numbers, -, _, or . separators");
37087
- var ActionInvocationKindSchema = external_exports.enum(["slash-command", "mcp-tool", "api-endpoint", "script-execution"]).meta({ label: "Invocation kind" });
37088
- var ActionIdSchema = ModelIdSchema;
37089
- var ActionScopeSchema = external_exports.union([
37090
- external_exports.literal("global"),
37091
- external_exports.object({
37092
- domain: ModelIdSchema
37093
- })
37094
- ]);
37095
- var ActionRefSchema = external_exports.object({
37096
- actionId: ActionIdSchema.meta({ ref: "action" }),
37097
- intent: external_exports.enum(["exposes", "consumes"]).meta({ label: "Intent" })
37098
- });
37099
- var SlashCommandInvocationSchema = external_exports.object({
37100
- kind: external_exports.literal("slash-command"),
37101
- command: external_exports.string().trim().min(1).max(200).regex(/^\/[^\s].*$/, "Slash commands must start with /"),
37102
- toolFactory: ModelIdSchema.optional()
37103
- });
37104
- var McpToolInvocationSchema = external_exports.object({
37105
- kind: external_exports.literal("mcp-tool"),
37106
- server: ModelIdSchema,
37107
- name: ModelIdSchema
37108
- });
37109
- var ApiEndpointInvocationSchema = external_exports.object({
37110
- kind: external_exports.literal("api-endpoint"),
37111
- method: external_exports.enum(["GET", "POST", "PATCH", "DELETE"]).meta({ label: "HTTP method" }),
37112
- path: external_exports.string().trim().startsWith("/").max(500),
37113
- requestSchema: ModelIdSchema.optional(),
37114
- responseSchema: ModelIdSchema.optional()
37115
- });
37116
- var ScriptExecutionInvocationSchema = external_exports.object({
37117
- kind: external_exports.literal("script-execution"),
37118
- resourceId: ActionResourceIdSchema
37119
- });
37120
- var ActionInvocationSchema = external_exports.discriminatedUnion("kind", [
37121
- SlashCommandInvocationSchema,
37122
- McpToolInvocationSchema,
37123
- ApiEndpointInvocationSchema,
37124
- ScriptExecutionInvocationSchema
37125
- ]);
37126
- var ActionSchema = external_exports.object({
37127
- id: ActionIdSchema,
37128
- /** Domain-map iteration order. Convention: multiples of 10 (10, 20, 30, ...) to allow easy insertion. */
37129
- order: external_exports.number(),
37130
- label: LabelSchema,
37131
- description: DescriptionSchema.optional(),
37132
- scope: ActionScopeSchema.default("global"),
37133
- resourceId: ActionResourceIdSchema.optional(),
37134
- affects: external_exports.array(EntityIdSchema.meta({ ref: "entity" })).optional(),
37135
- invocations: external_exports.array(ActionInvocationSchema).default([]),
37136
- knowledge: external_exports.array(ModelIdSchema.meta({ ref: "knowledge" })).default([]).optional(),
37137
- lifecycle: external_exports.enum(["draft", "beta", "active", "deprecated", "archived"]).meta({ label: "Lifecycle", color: "teal" }).default("active")
37138
- });
37139
- var ActionsDomainSchema = external_exports.record(external_exports.string(), ActionSchema).refine((record2) => Object.entries(record2).every(([key, entry]) => entry.id === key), {
37140
- message: "Each action entry id must match its map key"
37141
- }).default({});
37142
- var DEFAULT_ORGANIZATION_MODEL_ACTIONS = {};
37143
-
37144
- // ../core/src/organization-model/ontology.ts
37145
- var OntologyKindSchema = external_exports.enum([
37146
- "object",
37147
- "link",
37148
- "action",
37149
- "catalog",
37150
- "event",
37151
- "interface",
37152
- "value-type",
37153
- "property",
37154
- "group",
37155
- "surface"
37156
- ]);
37157
- var SYSTEM_PATH_PATTERN = "[a-z0-9][a-z0-9-]*(?:\\.[a-z0-9][a-z0-9-]*)*";
37158
- var LOCAL_ID_PATTERN = "[a-z0-9][a-z0-9._-]*";
37159
- var ONTOLOGY_ID_PATTERN = `^(global|${SYSTEM_PATH_PATTERN}):(${OntologyKindSchema.options.join("|")})\\/(${LOCAL_ID_PATTERN})$`;
37160
- var ONTOLOGY_ID_REGEX = new RegExp(ONTOLOGY_ID_PATTERN);
37161
- var OntologyIdSchema = external_exports.string().trim().min(1).max(300).regex(
37162
- ONTOLOGY_ID_REGEX,
37163
- "Ontology IDs must use <system-path>:<kind>/<local-id> or global:<kind>/<local-id>"
37164
- );
37165
- function parseOntologyId(id) {
37166
- const normalized = OntologyIdSchema.parse(id);
37167
- const match = ONTOLOGY_ID_REGEX.exec(normalized);
37168
- if (match === null) {
37169
- throw new Error(`Invalid ontology ID "${id}"`);
37170
- }
37171
- return {
37172
- id: normalized,
37173
- scope: match[1],
37174
- kind: match[2],
37175
- localId: match[3],
37176
- isGlobal: match[1] === "global"
37177
- };
37178
- }
37179
- function formatOntologyId(input) {
37180
- return OntologyIdSchema.parse(`${input.scope}:${input.kind}/${input.localId}`);
37181
- }
37182
- var OntologyReferenceListSchema = external_exports.array(OntologyIdSchema).default([]).optional();
37183
- var OntologyRecordBaseSchema = external_exports.object({
37184
- id: OntologyIdSchema,
37185
- label: external_exports.string().trim().min(1).max(160).optional(),
37186
- description: external_exports.string().trim().min(1).max(2e3).optional(),
37187
- ownerSystemId: external_exports.string().trim().min(1).max(200).optional(),
37188
- aliases: external_exports.array(OntologyIdSchema).optional()
37189
- }).passthrough();
37190
- var OntologyObjectTypeSchema = OntologyRecordBaseSchema.extend({
37191
- properties: external_exports.record(external_exports.string().trim().min(1).max(200), external_exports.unknown()).optional(),
37192
- storage: external_exports.record(external_exports.string(), external_exports.unknown()).optional()
37193
- });
37194
- var OntologyLinkTypeSchema = OntologyRecordBaseSchema.extend({
37195
- from: OntologyIdSchema,
37196
- to: OntologyIdSchema,
37197
- cardinality: external_exports.string().trim().min(1).max(80).optional(),
37198
- via: external_exports.string().trim().min(1).max(255).optional()
37199
- });
37200
- var OntologyActionTypeSchema = OntologyRecordBaseSchema.extend({
37201
- actsOn: OntologyReferenceListSchema,
37202
- input: external_exports.record(external_exports.string().trim().min(1).max(200), external_exports.unknown()).optional(),
37203
- effects: external_exports.array(external_exports.record(external_exports.string(), external_exports.unknown())).optional()
37204
- });
37205
- var OntologyCatalogTypeSchema = OntologyRecordBaseSchema.extend({
37206
- kind: external_exports.string().trim().min(1).max(120).optional(),
37207
- appliesTo: OntologyIdSchema.optional(),
37208
- entries: external_exports.record(external_exports.string().trim().min(1).max(200), external_exports.unknown()).optional()
37209
- });
37210
- var OntologyEventTypeSchema = OntologyRecordBaseSchema.extend({
37211
- payload: external_exports.record(external_exports.string().trim().min(1).max(200), external_exports.unknown()).optional()
37212
- });
37213
- var OntologyInterfaceTypeSchema = OntologyRecordBaseSchema.extend({
37214
- properties: external_exports.record(external_exports.string().trim().min(1).max(200), external_exports.unknown()).optional()
37215
- });
37216
- var OntologyValueTypeSchema = OntologyRecordBaseSchema.extend({
37217
- primitive: external_exports.string().trim().min(1).max(120).optional()
37218
- });
37219
- var OntologySharedPropertySchema = OntologyRecordBaseSchema.extend({
37220
- valueType: OntologyIdSchema.optional(),
37221
- searchable: external_exports.boolean().optional(),
37222
- pii: external_exports.boolean().optional()
37223
- });
37224
- var OntologyGroupSchema = OntologyRecordBaseSchema.extend({
37225
- members: OntologyReferenceListSchema
37226
- });
37227
- var OntologySurfaceTypeSchema = OntologyRecordBaseSchema.extend({
37228
- route: external_exports.string().trim().min(1).max(500).optional()
37229
- });
37230
- var OntologyScopeSchema = external_exports.object({
37231
- objectTypes: external_exports.record(OntologyIdSchema, OntologyObjectTypeSchema).default({}).optional(),
37232
- linkTypes: external_exports.record(OntologyIdSchema, OntologyLinkTypeSchema).default({}).optional(),
37233
- actionTypes: external_exports.record(OntologyIdSchema, OntologyActionTypeSchema).default({}).optional(),
37234
- catalogTypes: external_exports.record(OntologyIdSchema, OntologyCatalogTypeSchema).default({}).optional(),
37235
- eventTypes: external_exports.record(OntologyIdSchema, OntologyEventTypeSchema).default({}).optional(),
37236
- interfaceTypes: external_exports.record(OntologyIdSchema, OntologyInterfaceTypeSchema).default({}).optional(),
37237
- valueTypes: external_exports.record(OntologyIdSchema, OntologyValueTypeSchema).default({}).optional(),
37238
- sharedProperties: external_exports.record(OntologyIdSchema, OntologySharedPropertySchema).default({}).optional(),
37239
- groups: external_exports.record(OntologyIdSchema, OntologyGroupSchema).default({}).optional(),
37240
- surfaces: external_exports.record(OntologyIdSchema, OntologySurfaceTypeSchema).default({}).optional()
37241
- }).default({});
37242
- var DEFAULT_ONTOLOGY_SCOPE = {
37243
- valueTypes: {
37244
- "global:value-type/uuid": {
37245
- id: "global:value-type/uuid",
37246
- label: "UUID",
37247
- primitive: "string"
37248
- },
37249
- "global:value-type/text": {
37250
- id: "global:value-type/text",
37251
- label: "Text",
37252
- primitive: "string"
37253
- },
37254
- "global:value-type/url": {
37255
- id: "global:value-type/url",
37256
- label: "URL",
37257
- primitive: "string"
37258
- },
37259
- "global:value-type/email": {
37260
- id: "global:value-type/email",
37261
- label: "Email",
37262
- primitive: "string"
37263
- }
36687
+ var DEFAULT_ONTOLOGY_SCOPE = {
36688
+ valueTypes: {
36689
+ "global:value-type/uuid": {
36690
+ id: "global:value-type/uuid",
36691
+ label: "UUID",
36692
+ primitive: "string"
36693
+ },
36694
+ "global:value-type/text": {
36695
+ id: "global:value-type/text",
36696
+ label: "Text",
36697
+ primitive: "string"
36698
+ },
36699
+ "global:value-type/url": {
36700
+ id: "global:value-type/url",
36701
+ label: "URL",
36702
+ primitive: "string"
36703
+ },
36704
+ "global:value-type/email": {
36705
+ id: "global:value-type/email",
36706
+ label: "Email",
36707
+ primitive: "string"
36708
+ }
37264
36709
  }
37265
36710
  };
37266
36711
  var SCOPE_KIND = {
@@ -37498,6 +36943,570 @@ function compileOrganizationOntology(model) {
37498
36943
  return { ontology: sortResolvedOntologyIndex(ontology), diagnostics };
37499
36944
  }
37500
36945
 
36946
+ // ../core/src/organization-model/helpers.ts
36947
+ function childSystemsOf2(system) {
36948
+ return system.systems ?? system.subsystems ?? {};
36949
+ }
36950
+ function getSystem(model, path3) {
36951
+ const segments = path3.split(".");
36952
+ let current = model.systems;
36953
+ let node;
36954
+ for (const seg of segments) {
36955
+ node = current[seg];
36956
+ if (node === void 0) return void 0;
36957
+ current = childSystemsOf2(node);
36958
+ }
36959
+ return node;
36960
+ }
36961
+ function listAllSystems(model) {
36962
+ const results = [];
36963
+ function walk(map2, prefix) {
36964
+ for (const [localId2, system] of Object.entries(map2)) {
36965
+ const fullPath = prefix ? `${prefix}.${localId2}` : localId2;
36966
+ results.push({ path: fullPath, system });
36967
+ const childSystems = childSystemsOf2(system);
36968
+ if (Object.keys(childSystems).length > 0) {
36969
+ walk(childSystems, fullPath);
36970
+ }
36971
+ }
36972
+ }
36973
+ walk(model.systems, "");
36974
+ return results;
36975
+ }
36976
+
36977
+ // ../core/src/organization-model/cross-ref.ts
36978
+ var ONTOLOGY_REFERENCE_KEY_KINDS = {
36979
+ valueType: "value-type",
36980
+ catalogType: "catalog",
36981
+ objectType: "object",
36982
+ eventType: "event",
36983
+ actionType: "action",
36984
+ linkType: "link",
36985
+ interfaceType: "interface",
36986
+ propertyType: "property",
36987
+ groupType: "group",
36988
+ surfaceType: "surface",
36989
+ stepCatalog: "catalog"
36990
+ };
36991
+ function buildOmCrossRefIndex(model) {
36992
+ const systemsById = /* @__PURE__ */ new Map();
36993
+ for (const { path: path3, system } of listAllSystems(model)) {
36994
+ systemsById.set(path3, system);
36995
+ systemsById.set(system.id, system);
36996
+ }
36997
+ const resourceIds = new Set(Object.keys(model.resources ?? {}));
36998
+ const knowledgeIds = new Set(Object.keys(model.knowledge ?? {}));
36999
+ const roleIds = new Set(Object.keys(model.roles ?? {}));
37000
+ const goalIds = new Set(Object.keys(model.goals ?? {}));
37001
+ const actionIds = new Set(Object.keys(model.actions ?? {}));
37002
+ const customerSegmentIds = new Set(Object.keys(model.customers ?? {}));
37003
+ const offeringIds = new Set(Object.keys(model.offerings ?? {}));
37004
+ const ontologyCompilation = compileOrganizationOntology(model);
37005
+ const ontologyIndexByKind = {
37006
+ object: ontologyCompilation.ontology.objectTypes,
37007
+ link: ontologyCompilation.ontology.linkTypes,
37008
+ action: ontologyCompilation.ontology.actionTypes,
37009
+ catalog: ontologyCompilation.ontology.catalogTypes,
37010
+ event: ontologyCompilation.ontology.eventTypes,
37011
+ interface: ontologyCompilation.ontology.interfaceTypes,
37012
+ "value-type": ontologyCompilation.ontology.valueTypes,
37013
+ property: ontologyCompilation.ontology.sharedProperties,
37014
+ group: ontologyCompilation.ontology.groups,
37015
+ surface: ontologyCompilation.ontology.surfaces
37016
+ };
37017
+ const ontologyIds = new Set(Object.values(ontologyIndexByKind).flatMap((index) => Object.keys(index)));
37018
+ const stageIds = /* @__PURE__ */ new Set();
37019
+ for (const catalog of Object.values(ontologyCompilation.ontology.catalogTypes)) {
37020
+ if (catalog.kind !== "stage") continue;
37021
+ const entries = catalog.entries;
37022
+ if (entries !== void 0) {
37023
+ for (const stageId of Object.keys(entries)) {
37024
+ stageIds.add(stageId);
37025
+ }
37026
+ }
37027
+ }
37028
+ return {
37029
+ systemsById,
37030
+ resourceIds,
37031
+ knowledgeIds,
37032
+ roleIds,
37033
+ goalIds,
37034
+ actionIds,
37035
+ customerSegmentIds,
37036
+ offeringIds,
37037
+ ontologyIds,
37038
+ ontologyIndexByKind,
37039
+ stageIds
37040
+ };
37041
+ }
37042
+ function knowledgeTargetExists(index, kind, id) {
37043
+ if (kind === "system") return index.systemsById.has(id);
37044
+ if (kind === "resource") return index.resourceIds.has(id);
37045
+ if (kind === "knowledge") return index.knowledgeIds.has(id);
37046
+ if (kind === "stage") return index.stageIds.has(id);
37047
+ if (kind === "action") return index.actionIds.has(id);
37048
+ if (kind === "role") return index.roleIds.has(id);
37049
+ if (kind === "goal") return index.goalIds.has(id);
37050
+ if (kind === "customer-segment") return index.customerSegmentIds.has(id);
37051
+ if (kind === "offering") return index.offeringIds.has(id);
37052
+ if (kind === "ontology") return index.ontologyIds.has(id);
37053
+ return false;
37054
+ }
37055
+
37056
+ // ../core/src/organization-model/icons.ts
37057
+ var ORGANIZATION_MODEL_ICON_TOKENS = [
37058
+ // Navigation / app areas
37059
+ "dashboard",
37060
+ "calendar",
37061
+ "sales",
37062
+ "crm",
37063
+ "lead-gen",
37064
+ "projects",
37065
+ "clients",
37066
+ "operations",
37067
+ "monitoring",
37068
+ "knowledge",
37069
+ "settings",
37070
+ "admin",
37071
+ "archive",
37072
+ "business",
37073
+ "finance",
37074
+ "platform",
37075
+ "seo",
37076
+ // Knowledge kinds
37077
+ "playbook",
37078
+ "strategy",
37079
+ "reference",
37080
+ // Resource kinds
37081
+ "agent",
37082
+ "workflow",
37083
+ "integration",
37084
+ "database",
37085
+ "user",
37086
+ "team",
37087
+ // Integration specifics
37088
+ "gmail",
37089
+ "google-sheets",
37090
+ "attio",
37091
+ // Surface / UI views
37092
+ "overview",
37093
+ "command-view",
37094
+ "command-queue",
37095
+ "pipeline",
37096
+ "lists",
37097
+ "resources",
37098
+ // Actions
37099
+ "approve",
37100
+ "reject",
37101
+ "retry",
37102
+ "edit",
37103
+ "view",
37104
+ "launch",
37105
+ "message",
37106
+ "escalate",
37107
+ "promote",
37108
+ "submit",
37109
+ "email",
37110
+ // Status
37111
+ "success",
37112
+ "error",
37113
+ "warning",
37114
+ "info",
37115
+ "pending",
37116
+ // OM / UI group icons
37117
+ "bolt",
37118
+ "building",
37119
+ "briefcase",
37120
+ "apps",
37121
+ "graph",
37122
+ "shield",
37123
+ "users",
37124
+ "chart-bar",
37125
+ "search"
37126
+ ];
37127
+ var CustomIconTokenSchema = external_exports.string().trim().max(80).regex(
37128
+ /^custom\.[a-z0-9]+(?:[-._][a-z0-9]+)*$/,
37129
+ 'Custom icon tokens must start with "custom." followed by lowercase alphanumeric segments'
37130
+ );
37131
+ var OrganizationModelBuiltinIconTokenSchema = external_exports.enum(ORGANIZATION_MODEL_ICON_TOKENS);
37132
+ var OrganizationModelIconTokenSchema = external_exports.union([
37133
+ OrganizationModelBuiltinIconTokenSchema,
37134
+ CustomIconTokenSchema
37135
+ ]);
37136
+
37137
+ // ../core/src/organization-model/domains/shared.ts
37138
+ var ModelIdSchema = external_exports.string().trim().min(1).max(100).regex(/^[a-z0-9]+(?:[-._][a-z0-9]+)*$/, "IDs must be lowercase and use -, _, or . separators");
37139
+ var LabelSchema = external_exports.string().trim().min(1).max(120);
37140
+ var DescriptionSchema = external_exports.string().trim().min(1).max(2e3);
37141
+ var ColorTokenSchema = external_exports.string().trim().min(1).max(50);
37142
+ var IconNameSchema = OrganizationModelIconTokenSchema;
37143
+ var PathSchema = external_exports.string().trim().startsWith("/").max(300);
37144
+ var ReferenceIdsSchema = external_exports.array(ModelIdSchema).default([]);
37145
+ var DisplayMetadataSchema = external_exports.object({
37146
+ label: LabelSchema,
37147
+ description: DescriptionSchema.optional(),
37148
+ color: ColorTokenSchema.optional(),
37149
+ icon: IconNameSchema.optional()
37150
+ });
37151
+ var TechStackEntrySchema = external_exports.object({
37152
+ /** Name of the external platform (e.g. "HubSpot", "Stripe", "Notion"). */
37153
+ platform: external_exports.string().trim().min(1).max(200),
37154
+ /** Free-form description of what this integration is used for. */
37155
+ purpose: external_exports.string().trim().min(1).max(500),
37156
+ /**
37157
+ * Health of the credential backing this integration.
37158
+ * - configured: credential present and valid
37159
+ * - pending: not yet set up
37160
+ * - expired: credential existed but has lapsed
37161
+ * - missing: expected but not present
37162
+ */
37163
+ credentialStatus: external_exports.enum(["configured", "pending", "expired", "missing"]),
37164
+ /**
37165
+ * Whether this integration is the primary system of record for its domain
37166
+ * (e.g. HubSpot is SoR for contacts). Defaults to false.
37167
+ */
37168
+ isSystemOfRecord: external_exports.boolean().default(false)
37169
+ });
37170
+ var ResourceMappingSchema = DisplayMetadataSchema.extend({
37171
+ id: ModelIdSchema,
37172
+ resourceId: external_exports.string().trim().min(1).max(255),
37173
+ resourceType: external_exports.enum(["workflow", "agent", "trigger", "integration", "external", "human_checkpoint"]),
37174
+ systemIds: ReferenceIdsSchema,
37175
+ entityIds: ReferenceIdsSchema,
37176
+ surfaceIds: ReferenceIdsSchema,
37177
+ actionIds: ReferenceIdsSchema,
37178
+ /** Optional tech-stack metadata for external-SaaS integrations. */
37179
+ techStack: TechStackEntrySchema.optional()
37180
+ });
37181
+
37182
+ // ../core/src/organization-model/domains/branding.ts
37183
+ var OrganizationModelBrandingSchema = external_exports.object({
37184
+ organizationName: LabelSchema,
37185
+ productName: LabelSchema,
37186
+ shortName: external_exports.string().trim().min(1).max(40),
37187
+ description: DescriptionSchema.optional(),
37188
+ logos: external_exports.object({
37189
+ light: external_exports.string().trim().min(1).max(2048).optional(),
37190
+ dark: external_exports.string().trim().min(1).max(2048).optional()
37191
+ }).default({})
37192
+ });
37193
+ var DEFAULT_ORGANIZATION_MODEL_BRANDING = {
37194
+ organizationName: "Default Organization",
37195
+ productName: "Organization OS",
37196
+ shortName: "Org OS",
37197
+ logos: {}
37198
+ };
37199
+
37200
+ // ../core/src/organization-model/domains/navigation.ts
37201
+ var SurfaceTypeSchema = external_exports.enum(["page", "dashboard", "graph", "detail", "list", "settings"]).meta({ label: "Surface type", color: "blue" });
37202
+ var SurfaceDefinitionSchema = external_exports.object({
37203
+ id: ModelIdSchema,
37204
+ label: LabelSchema,
37205
+ path: PathSchema,
37206
+ surfaceType: SurfaceTypeSchema,
37207
+ description: DescriptionSchema.optional(),
37208
+ enabled: external_exports.boolean().default(true),
37209
+ devOnly: external_exports.boolean().optional(),
37210
+ icon: IconNameSchema.optional(),
37211
+ systemIds: external_exports.array(ModelIdSchema.meta({ ref: "system" })).default([]),
37212
+ entityIds: external_exports.array(ModelIdSchema.meta({ ref: "entity" })).default([]),
37213
+ resourceIds: external_exports.array(ModelIdSchema.meta({ ref: "resource" })).default([]),
37214
+ actionIds: external_exports.array(ModelIdSchema.meta({ ref: "action" })).default([]),
37215
+ parentId: ModelIdSchema.meta({ ref: "surface" }).optional()
37216
+ });
37217
+ var SidebarSurfaceTargetsSchema = external_exports.object({
37218
+ systems: external_exports.array(ModelIdSchema.meta({ ref: "system" })).default([]).optional(),
37219
+ entities: external_exports.array(ModelIdSchema.meta({ ref: "entity" })).default([]).optional(),
37220
+ resources: external_exports.array(ModelIdSchema.meta({ ref: "resource" })).default([]).optional(),
37221
+ actions: external_exports.array(ModelIdSchema.meta({ ref: "action" })).default([]).optional()
37222
+ }).default({});
37223
+ var SidebarNodeSchema = external_exports.lazy(
37224
+ () => external_exports.discriminatedUnion("type", [
37225
+ external_exports.object({
37226
+ type: external_exports.literal("group"),
37227
+ label: LabelSchema,
37228
+ description: DescriptionSchema.optional(),
37229
+ icon: IconNameSchema.optional(),
37230
+ order: external_exports.number().int().optional(),
37231
+ children: external_exports.record(external_exports.string(), SidebarNodeSchema).default({})
37232
+ }),
37233
+ external_exports.object({
37234
+ type: external_exports.literal("surface"),
37235
+ label: LabelSchema,
37236
+ path: PathSchema,
37237
+ surfaceType: SurfaceTypeSchema,
37238
+ description: DescriptionSchema.optional(),
37239
+ icon: IconNameSchema.optional(),
37240
+ order: external_exports.number().int().optional(),
37241
+ targets: SidebarSurfaceTargetsSchema.optional(),
37242
+ devOnly: external_exports.boolean().optional(),
37243
+ requiresAdmin: external_exports.boolean().optional()
37244
+ })
37245
+ ])
37246
+ );
37247
+ var SidebarSectionSchema = external_exports.record(external_exports.string(), SidebarNodeSchema).default({});
37248
+ var SidebarNavigationSchema = external_exports.object({
37249
+ primary: SidebarSectionSchema,
37250
+ bottom: SidebarSectionSchema
37251
+ }).default({ primary: {}, bottom: {} });
37252
+ var OrganizationModelNavigationSchema = external_exports.object({
37253
+ sidebar: SidebarNavigationSchema
37254
+ }).default({ sidebar: { primary: {}, bottom: {} } });
37255
+ var NavigationGroupSchema = external_exports.object({
37256
+ id: ModelIdSchema,
37257
+ label: LabelSchema,
37258
+ placement: external_exports.string().trim().min(1).max(50),
37259
+ surfaceIds: external_exports.array(ModelIdSchema.meta({ ref: "surface" })).default([])
37260
+ });
37261
+
37262
+ // ../core/src/organization-model/domains/identity.ts
37263
+ var BusinessHoursDaySchema = external_exports.object({
37264
+ open: external_exports.string().trim().regex(/^\d{2}:\d{2}$/, "Expected HH:MM format"),
37265
+ close: external_exports.string().trim().regex(/^\d{2}:\d{2}$/, "Expected HH:MM format")
37266
+ });
37267
+ var BusinessHoursSchema = external_exports.object({
37268
+ monday: BusinessHoursDaySchema.optional(),
37269
+ tuesday: BusinessHoursDaySchema.optional(),
37270
+ wednesday: BusinessHoursDaySchema.optional(),
37271
+ thursday: BusinessHoursDaySchema.optional(),
37272
+ friday: BusinessHoursDaySchema.optional(),
37273
+ saturday: BusinessHoursDaySchema.optional(),
37274
+ sunday: BusinessHoursDaySchema.optional()
37275
+ }).default({});
37276
+ var IdentityDomainSchema = external_exports.object({
37277
+ /** Why the organization exists — one or two plain-language sentences. */
37278
+ mission: external_exports.string().trim().max(1e3).default(""),
37279
+ /** Long-term direction the organization is moving toward. */
37280
+ vision: external_exports.string().trim().max(1e3).default(""),
37281
+ /** Legal registered name of the entity. */
37282
+ legalName: external_exports.string().trim().max(200).default(""),
37283
+ /**
37284
+ * Type of legal entity (e.g. "LLC", "Corporation", "Sole Proprietor",
37285
+ * "Non-profit"). Free-form string so it covers any jurisdiction.
37286
+ */
37287
+ entityType: external_exports.string().trim().max(100).default(""),
37288
+ /**
37289
+ * Primary jurisdiction of registration or operation
37290
+ * (e.g. "United States – Delaware", "Canada – Ontario").
37291
+ */
37292
+ jurisdiction: external_exports.string().trim().max(200).default(""),
37293
+ /**
37294
+ * Industry category — broad classification (e.g. "Marketing Agency",
37295
+ * "Software / SaaS", "Professional Services").
37296
+ */
37297
+ industryCategory: external_exports.string().trim().max(200).default(""),
37298
+ /**
37299
+ * Geographic focus — where the organization primarily operates or serves
37300
+ * (e.g. "North America", "Global", "Southeast Asia").
37301
+ */
37302
+ geographicFocus: external_exports.string().trim().max(200).default(""),
37303
+ /**
37304
+ * IANA timezone identifier for the organization's primary operating timezone
37305
+ * (e.g. "America/Los_Angeles", "Europe/London", "UTC").
37306
+ */
37307
+ timeZone: external_exports.string().trim().max(100).default("UTC"),
37308
+ /** Typical operating hours per day of week. Empty object means not configured. */
37309
+ businessHours: BusinessHoursSchema,
37310
+ /**
37311
+ * Long-form markdown capturing client context, problem narrative, and domain
37312
+ * background. Populated by /setup; surfaced to agents as organizational context.
37313
+ * Optional — many projects have no external client.
37314
+ */
37315
+ clientBrief: external_exports.string().trim().default("")
37316
+ });
37317
+ var DEFAULT_ORGANIZATION_MODEL_IDENTITY = {
37318
+ mission: "",
37319
+ vision: "",
37320
+ legalName: "",
37321
+ entityType: "",
37322
+ jurisdiction: "",
37323
+ industryCategory: "",
37324
+ geographicFocus: "",
37325
+ timeZone: "UTC",
37326
+ businessHours: {},
37327
+ clientBrief: ""
37328
+ };
37329
+
37330
+ // ../core/src/organization-model/domains/customers.ts
37331
+ var FirmographicsSchema = external_exports.object({
37332
+ /** Industry vertical (e.g. "Marketing Agency", "Legal", "Real Estate"). */
37333
+ industry: external_exports.string().trim().max(200).optional(),
37334
+ /**
37335
+ * Company headcount band (e.g. "1–10", "11–50", "51–200", "200+").
37336
+ * Free-form string to accommodate any band notation.
37337
+ */
37338
+ companySize: external_exports.string().trim().max(100).optional(),
37339
+ /**
37340
+ * Primary geographic region the segment operates in or is targeted from
37341
+ * (e.g. "North America", "Europe", "Global").
37342
+ */
37343
+ region: external_exports.string().trim().max(200).optional()
37344
+ });
37345
+ var CustomerSegmentSchema = external_exports.object({
37346
+ /** Stable unique identifier for the segment (e.g. "segment-smb-agencies"). */
37347
+ id: external_exports.string().trim().min(1).max(100),
37348
+ /** Domain-map iteration order. Convention: multiples of 10 (10, 20, 30, ...) to allow easy insertion. */
37349
+ order: external_exports.number(),
37350
+ /** Human-readable name shown to agents and in UI (e.g. "SMB Marketing Agencies"). */
37351
+ name: external_exports.string().trim().max(200).default(""),
37352
+ /** One or two sentences describing who this segment is. */
37353
+ description: external_exports.string().trim().max(2e3).default(""),
37354
+ /**
37355
+ * The primary job(s) this segment is trying to get done — the goal they hire
37356
+ * a product/service to accomplish. Plain-language narrative or bullet list.
37357
+ */
37358
+ jobsToBeDone: external_exports.string().trim().max(2e3).default(""),
37359
+ /**
37360
+ * Pains — frustrations, obstacles, and risks the segment experiences
37361
+ * when trying to accomplish their jobs-to-be-done.
37362
+ */
37363
+ pains: external_exports.array(external_exports.string().trim().max(500)).default([]),
37364
+ /**
37365
+ * Gains — outcomes and benefits the segment desires; positive motivators
37366
+ * beyond merely resolving pains.
37367
+ */
37368
+ gains: external_exports.array(external_exports.string().trim().max(500)).default([]),
37369
+ /** Firmographic profile for targeting and filtering. */
37370
+ firmographics: FirmographicsSchema.default({}),
37371
+ /**
37372
+ * Value proposition — one or two sentences stating why this organization's
37373
+ * offering is uniquely suited for this segment's needs.
37374
+ */
37375
+ valueProp: external_exports.string().trim().max(2e3).default("")
37376
+ });
37377
+ var CustomersDomainSchema = external_exports.record(external_exports.string(), CustomerSegmentSchema).refine((record2) => Object.entries(record2).every(([key, entry]) => entry.id === key), {
37378
+ message: "Each segment entry id must match its map key"
37379
+ }).default({});
37380
+ var DEFAULT_ORGANIZATION_MODEL_CUSTOMERS = {};
37381
+
37382
+ // ../core/src/organization-model/domains/offerings.ts
37383
+ var PricingModelSchema = external_exports.enum(["one-time", "subscription", "usage-based", "custom"]).meta({ label: "Pricing model", color: "green" });
37384
+ var ProductSchema = external_exports.object({
37385
+ /** Stable unique identifier for the product (e.g. "product-starter-plan"). */
37386
+ id: external_exports.string().trim().min(1).max(100),
37387
+ /** Domain-map iteration order. Convention: multiples of 10 (10, 20, 30, ...) to allow easy insertion. */
37388
+ order: external_exports.number(),
37389
+ /** Human-readable name shown to agents and in UI (e.g. "Starter Plan"). */
37390
+ name: external_exports.string().trim().max(200).default(""),
37391
+ /** One or two sentences describing what this product/service delivers. */
37392
+ description: external_exports.string().trim().max(2e3).default(""),
37393
+ /**
37394
+ * How this product is priced:
37395
+ * - "one-time" — single purchase (setup fee, project fee)
37396
+ * - "subscription" — recurring (monthly/annual SaaS, retainer)
37397
+ * - "usage-based" — metered by consumption (API calls, seats)
37398
+ * - "custom" — negotiated or bespoke pricing
37399
+ */
37400
+ pricingModel: PricingModelSchema.default("custom"),
37401
+ /** Base price amount (≥ 0). Currency unit defined by `currency`. */
37402
+ price: external_exports.number().min(0).default(0),
37403
+ /**
37404
+ * ISO 4217 currency code (e.g. "USD", "EUR", "GBP").
37405
+ * Free-form string to accommodate any currency; defaults to "USD".
37406
+ */
37407
+ currency: external_exports.string().trim().max(10).default("USD"),
37408
+ /**
37409
+ * IDs of customer segments this product targets.
37410
+ * Each id must reference a declared `customers.segments[].id`.
37411
+ * Cross-reference enforced in `OrganizationModelSchema.superRefine()`.
37412
+ */
37413
+ targetSegmentIds: external_exports.array(external_exports.string().trim().min(1)).default([]),
37414
+ /**
37415
+ * Optional: ID of the platform system responsible for delivering this product.
37416
+ * When present, must reference a declared `systems.systems[].id`.
37417
+ * Cross-reference enforced in `OrganizationModelSchema.superRefine()`.
37418
+ */
37419
+ deliveryFeatureId: external_exports.string().trim().min(1).optional()
37420
+ });
37421
+ var OfferingsDomainSchema = external_exports.record(external_exports.string(), ProductSchema).refine((record2) => Object.entries(record2).every(([key, entry]) => entry.id === key), {
37422
+ message: "Each product entry id must match its map key"
37423
+ }).default({});
37424
+ var DEFAULT_ORGANIZATION_MODEL_OFFERINGS = {};
37425
+
37426
+ // ../core/src/organization-model/domains/entities.ts
37427
+ var EntityIdSchema = ModelIdSchema;
37428
+ var EntityLinkKindSchema = external_exports.enum(["belongs-to", "has-many", "has-one", "many-to-many"]).meta({ label: "Link kind" });
37429
+ var EntityLinkSchema = external_exports.object({
37430
+ toEntity: EntityIdSchema.meta({ ref: "entity" }),
37431
+ kind: EntityLinkKindSchema,
37432
+ via: external_exports.string().trim().min(1).max(255).optional(),
37433
+ label: LabelSchema.optional()
37434
+ });
37435
+ var EntitySchema = external_exports.object({
37436
+ id: EntityIdSchema,
37437
+ /** Domain-map iteration order. Convention: multiples of 10 (10, 20, 30, ...) to allow easy insertion. */
37438
+ order: external_exports.number(),
37439
+ label: LabelSchema,
37440
+ description: DescriptionSchema.optional(),
37441
+ ownedBySystemId: ModelIdSchema.meta({ ref: "system" }),
37442
+ table: external_exports.string().trim().min(1).max(255).optional(),
37443
+ rowSchema: ModelIdSchema.optional(),
37444
+ stateCatalogId: ModelIdSchema.optional(),
37445
+ links: external_exports.array(EntityLinkSchema).optional()
37446
+ });
37447
+ var EntitiesDomainSchema = external_exports.record(external_exports.string(), EntitySchema).refine((record2) => Object.entries(record2).every(([key, entry]) => entry.id === key), {
37448
+ message: "Each entity entry id must match its map key"
37449
+ }).default({});
37450
+
37451
+ // ../core/src/organization-model/domains/actions.ts
37452
+ var ActionResourceIdSchema = external_exports.string().trim().min(1).max(255).regex(/^[A-Za-z0-9]+(?:[-._][A-Za-z0-9]+)*$/, "Resource IDs must use letters, numbers, -, _, or . separators");
37453
+ var ActionInvocationKindSchema = external_exports.enum(["slash-command", "mcp-tool", "api-endpoint", "script-execution"]).meta({ label: "Invocation kind" });
37454
+ var ActionIdSchema = ModelIdSchema;
37455
+ var ActionScopeSchema = external_exports.union([
37456
+ external_exports.literal("global"),
37457
+ external_exports.object({
37458
+ domain: ModelIdSchema
37459
+ })
37460
+ ]);
37461
+ var ActionRefSchema = external_exports.object({
37462
+ actionId: ActionIdSchema.meta({ ref: "action" }),
37463
+ intent: external_exports.enum(["exposes", "consumes"]).meta({ label: "Intent" })
37464
+ });
37465
+ var SlashCommandInvocationSchema = external_exports.object({
37466
+ kind: external_exports.literal("slash-command"),
37467
+ command: external_exports.string().trim().min(1).max(200).regex(/^\/[^\s].*$/, "Slash commands must start with /"),
37468
+ toolFactory: ModelIdSchema.optional()
37469
+ });
37470
+ var McpToolInvocationSchema = external_exports.object({
37471
+ kind: external_exports.literal("mcp-tool"),
37472
+ server: ModelIdSchema,
37473
+ name: ModelIdSchema
37474
+ });
37475
+ var ApiEndpointInvocationSchema = external_exports.object({
37476
+ kind: external_exports.literal("api-endpoint"),
37477
+ method: external_exports.enum(["GET", "POST", "PATCH", "DELETE"]).meta({ label: "HTTP method" }),
37478
+ path: external_exports.string().trim().startsWith("/").max(500),
37479
+ requestSchema: ModelIdSchema.optional(),
37480
+ responseSchema: ModelIdSchema.optional()
37481
+ });
37482
+ var ScriptExecutionInvocationSchema = external_exports.object({
37483
+ kind: external_exports.literal("script-execution"),
37484
+ resourceId: ActionResourceIdSchema
37485
+ });
37486
+ var ActionInvocationSchema = external_exports.discriminatedUnion("kind", [
37487
+ SlashCommandInvocationSchema,
37488
+ McpToolInvocationSchema,
37489
+ ApiEndpointInvocationSchema,
37490
+ ScriptExecutionInvocationSchema
37491
+ ]);
37492
+ var ActionSchema = external_exports.object({
37493
+ id: ActionIdSchema,
37494
+ /** Domain-map iteration order. Convention: multiples of 10 (10, 20, 30, ...) to allow easy insertion. */
37495
+ order: external_exports.number(),
37496
+ label: LabelSchema,
37497
+ description: DescriptionSchema.optional(),
37498
+ scope: ActionScopeSchema.default("global"),
37499
+ resourceId: ActionResourceIdSchema.optional(),
37500
+ affects: external_exports.array(EntityIdSchema.meta({ ref: "entity" })).optional(),
37501
+ invocations: external_exports.array(ActionInvocationSchema).default([]),
37502
+ knowledge: external_exports.array(ModelIdSchema.meta({ ref: "knowledge" })).default([]).optional(),
37503
+ lifecycle: external_exports.enum(["draft", "beta", "active", "deprecated", "archived"]).meta({ label: "Lifecycle", color: "teal" }).default("active")
37504
+ });
37505
+ var ActionsDomainSchema = external_exports.record(external_exports.string(), ActionSchema).refine((record2) => Object.entries(record2).every(([key, entry]) => entry.id === key), {
37506
+ message: "Each action entry id must match its map key"
37507
+ }).default({});
37508
+ var DEFAULT_ORGANIZATION_MODEL_ACTIONS = {};
37509
+
37501
37510
  // ../core/src/organization-model/domains/systems.ts
37502
37511
  var SystemKindSchema = external_exports.enum(["product", "operational", "platform", "diagnostic"]).meta({ label: "System kind", color: "blue" });
37503
37512
  var SystemLifecycleSchema = external_exports.enum(["draft", "beta", "active", "deprecated", "archived"]).meta({ label: "Lifecycle", color: "teal" });
@@ -38088,79 +38097,7 @@ var PoliciesDomainSchema = external_exports.record(external_exports.string(), Po
38088
38097
  }).default({});
38089
38098
  var DEFAULT_ORGANIZATION_MODEL_POLICIES = {};
38090
38099
 
38091
- // ../core/src/organization-model/schema.ts
38092
- var OrganizationModelDomainKeySchema = external_exports.enum([
38093
- "branding",
38094
- "identity",
38095
- "customers",
38096
- "offerings",
38097
- "roles",
38098
- "goals",
38099
- "systems",
38100
- "ontology",
38101
- "resources",
38102
- "topology",
38103
- "actions",
38104
- "entities",
38105
- "policies",
38106
- "knowledge"
38107
- ]);
38108
- var OrganizationModelDomainMetadataSchema = external_exports.object({
38109
- version: external_exports.literal(1).default(1),
38110
- lastModified: external_exports.string().regex(/^\d{4}-\d{2}-\d{2}$/, "lastModified must be an ISO date string (YYYY-MM-DD)")
38111
- });
38112
- var DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA = {
38113
- branding: { version: 1, lastModified: "2026-05-10" },
38114
- identity: { version: 1, lastModified: "2026-05-10" },
38115
- customers: { version: 1, lastModified: "2026-05-10" },
38116
- offerings: { version: 1, lastModified: "2026-05-10" },
38117
- roles: { version: 1, lastModified: "2026-05-10" },
38118
- goals: { version: 1, lastModified: "2026-05-10" },
38119
- systems: { version: 1, lastModified: "2026-05-10" },
38120
- ontology: { version: 1, lastModified: "2026-05-14" },
38121
- resources: { version: 1, lastModified: "2026-05-10" },
38122
- topology: { version: 1, lastModified: "2026-05-14" },
38123
- actions: { version: 1, lastModified: "2026-05-10" },
38124
- entities: { version: 1, lastModified: "2026-05-10" },
38125
- policies: { version: 1, lastModified: "2026-05-10" },
38126
- knowledge: { version: 1, lastModified: "2026-05-10" }
38127
- };
38128
- var OrganizationModelDomainMetadataByDomainSchema = external_exports.object({
38129
- branding: OrganizationModelDomainMetadataSchema,
38130
- identity: OrganizationModelDomainMetadataSchema,
38131
- customers: OrganizationModelDomainMetadataSchema,
38132
- offerings: OrganizationModelDomainMetadataSchema,
38133
- roles: OrganizationModelDomainMetadataSchema,
38134
- goals: OrganizationModelDomainMetadataSchema,
38135
- systems: OrganizationModelDomainMetadataSchema,
38136
- ontology: OrganizationModelDomainMetadataSchema,
38137
- resources: OrganizationModelDomainMetadataSchema,
38138
- topology: OrganizationModelDomainMetadataSchema,
38139
- actions: OrganizationModelDomainMetadataSchema,
38140
- entities: OrganizationModelDomainMetadataSchema,
38141
- policies: OrganizationModelDomainMetadataSchema,
38142
- knowledge: OrganizationModelDomainMetadataSchema
38143
- }).partial().default(DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA).transform((metadata) => ({ ...DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA, ...metadata }));
38144
- var OrganizationModelSchemaBase = external_exports.object({
38145
- version: external_exports.literal(1).default(1),
38146
- domainMetadata: OrganizationModelDomainMetadataByDomainSchema,
38147
- branding: OrganizationModelBrandingSchema,
38148
- navigation: OrganizationModelNavigationSchema,
38149
- identity: IdentityDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_IDENTITY),
38150
- customers: CustomersDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_CUSTOMERS),
38151
- offerings: OfferingsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_OFFERINGS),
38152
- roles: RolesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_ROLES),
38153
- goals: GoalsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_GOALS),
38154
- systems: SystemsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_SYSTEMS),
38155
- ontology: OntologyScopeSchema.default(DEFAULT_ONTOLOGY_SCOPE),
38156
- resources: ResourcesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_RESOURCES),
38157
- topology: OmTopologyDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_TOPOLOGY),
38158
- actions: ActionsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_ACTIONS),
38159
- entities: EntitiesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_ENTITIES),
38160
- policies: PoliciesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_POLICIES),
38161
- // D3: flat Record<id, OrgKnowledgeNode> — no wrapper object
38162
- knowledge: KnowledgeDomainSchema.default({})
38163
- });
38100
+ // ../core/src/organization-model/schema-refinements.ts
38164
38101
  function addIssue(ctx, path3, message) {
38165
38102
  ctx.addIssue({
38166
38103
  code: external_exports.ZodIssueCode.custom,
@@ -38191,7 +38128,7 @@ function isKnowledgeKindCompatibleWithTarget(knowledgeKind, targetKind) {
38191
38128
  function isRecord(value) {
38192
38129
  return typeof value === "object" && value !== null && !Array.isArray(value);
38193
38130
  }
38194
- var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ctx) => {
38131
+ function refineOrganizationModel(model, ctx) {
38195
38132
  function collectAllSystems(systems, prefix = "", schemaPath = ["systems"]) {
38196
38133
  const result = [];
38197
38134
  for (const [key, system] of Object.entries(systems)) {
@@ -38363,7 +38300,7 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
38363
38300
  });
38364
38301
  });
38365
38302
  Object.values(model.entities).forEach((entity) => {
38366
- if (!systemsById.has(entity.ownedBySystemId)) {
38303
+ if (systemsById.size > 0 && !systemsById.has(entity.ownedBySystemId)) {
38367
38304
  addIssue(
38368
38305
  ctx,
38369
38306
  ["entities", entity.id, "ownedBySystemId"],
@@ -38481,29 +38418,9 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
38481
38418
  }
38482
38419
  });
38483
38420
  });
38484
- const actionIds = new Set(Object.keys(model.actions));
38485
- const offeringsById = new Map(Object.entries(model.offerings));
38421
+ const idx = buildOmCrossRefIndex(model);
38422
+ const { ontologyIndexByKind, ontologyIds } = idx;
38486
38423
  const ontologyCompilation = compileOrganizationOntology(model);
38487
- const stageIds = /* @__PURE__ */ new Set();
38488
- for (const catalog of Object.values(ontologyCompilation.ontology.catalogTypes)) {
38489
- if (catalog.kind !== "stage") continue;
38490
- for (const stageId of Object.keys(catalog.entries ?? {})) {
38491
- stageIds.add(stageId);
38492
- }
38493
- }
38494
- const ontologyIndexByKind = {
38495
- object: ontologyCompilation.ontology.objectTypes,
38496
- link: ontologyCompilation.ontology.linkTypes,
38497
- action: ontologyCompilation.ontology.actionTypes,
38498
- catalog: ontologyCompilation.ontology.catalogTypes,
38499
- event: ontologyCompilation.ontology.eventTypes,
38500
- interface: ontologyCompilation.ontology.interfaceTypes,
38501
- "value-type": ontologyCompilation.ontology.valueTypes,
38502
- property: ontologyCompilation.ontology.sharedProperties,
38503
- group: ontologyCompilation.ontology.groups,
38504
- surface: ontologyCompilation.ontology.surfaces
38505
- };
38506
- const ontologyIds = new Set(Object.values(ontologyIndexByKind).flatMap((index) => Object.keys(index)));
38507
38424
  function topologyTargetExists(ref) {
38508
38425
  if (ref.kind === "system") return systemsById.has(ref.id);
38509
38426
  if (ref.kind === "resource") return resourcesById.has(ref.id);
@@ -38524,19 +38441,6 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
38524
38441
  );
38525
38442
  });
38526
38443
  });
38527
- const ontologyReferenceKeyKinds = {
38528
- valueType: "value-type",
38529
- catalogType: "catalog",
38530
- objectType: "object",
38531
- eventType: "event",
38532
- actionType: "action",
38533
- linkType: "link",
38534
- interfaceType: "interface",
38535
- propertyType: "property",
38536
- groupType: "group",
38537
- surfaceType: "surface",
38538
- stepCatalog: "catalog"
38539
- };
38540
38444
  function validateKnownOntologyReferences(ownerId, value, path3, seen = /* @__PURE__ */ new WeakSet()) {
38541
38445
  if (Array.isArray(value)) {
38542
38446
  value.forEach((entry, index) => validateKnownOntologyReferences(ownerId, entry, [...path3, index], seen));
@@ -38546,7 +38450,7 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
38546
38450
  if (seen.has(value)) return;
38547
38451
  seen.add(value);
38548
38452
  Object.entries(value).forEach(([key, entry]) => {
38549
- const expectedKind = ontologyReferenceKeyKinds[key];
38453
+ const expectedKind = ONTOLOGY_REFERENCE_KEY_KINDS[key];
38550
38454
  if (expectedKind !== void 0) {
38551
38455
  if (typeof entry !== "string") {
38552
38456
  addIssue(ctx, [...path3, key], `Ontology record "${ownerId}" ${key} must be an ontology ID string`);
@@ -38607,22 +38511,9 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
38607
38511
  );
38608
38512
  }
38609
38513
  });
38610
- function knowledgeTargetExists(kind, id) {
38611
- if (kind === "system") return systemsById.has(id);
38612
- if (kind === "resource") return resourcesById.has(id);
38613
- if (kind === "knowledge") return knowledgeById.has(id);
38614
- if (kind === "stage") return stageIds.has(id);
38615
- if (kind === "action") return actionIds.has(id);
38616
- if (kind === "role") return rolesById.has(id);
38617
- if (kind === "goal") return goalsById.has(id);
38618
- if (kind === "customer-segment") return segmentsById.has(id);
38619
- if (kind === "offering") return offeringsById.has(id);
38620
- if (kind === "ontology") return ontologyIds.has(id);
38621
- return false;
38622
- }
38623
38514
  Object.entries(model.knowledge).forEach(([nodeId2, node]) => {
38624
38515
  node.links.forEach((link, linkIndex) => {
38625
- if (!knowledgeTargetExists(link.target.kind, link.target.id)) {
38516
+ if (!knowledgeTargetExists(idx, link.target.kind, link.target.id)) {
38626
38517
  addIssue(
38627
38518
  ctx,
38628
38519
  ["knowledge", nodeId2, "links", linkIndex, "target"],
@@ -38736,11 +38627,86 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
38736
38627
  for (const diagnostic of ontologyCompilation.diagnostics) {
38737
38628
  addIssue(ctx, diagnostic.path, diagnostic.message);
38738
38629
  }
38630
+ }
38631
+
38632
+ // ../core/src/organization-model/schema.ts
38633
+ var OrganizationModelDomainKeySchema = external_exports.enum([
38634
+ "branding",
38635
+ "identity",
38636
+ "customers",
38637
+ "offerings",
38638
+ "roles",
38639
+ "goals",
38640
+ "systems",
38641
+ "ontology",
38642
+ "resources",
38643
+ "topology",
38644
+ "actions",
38645
+ "entities",
38646
+ "policies",
38647
+ "knowledge"
38648
+ ]);
38649
+ var OrganizationModelDomainMetadataSchema = external_exports.object({
38650
+ version: external_exports.literal(1).default(1),
38651
+ lastModified: external_exports.string().regex(/^\d{4}-\d{2}-\d{2}$/, "lastModified must be an ISO date string (YYYY-MM-DD)")
38652
+ });
38653
+ var DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA = {
38654
+ branding: { version: 1, lastModified: "2026-05-10" },
38655
+ identity: { version: 1, lastModified: "2026-05-10" },
38656
+ customers: { version: 1, lastModified: "2026-05-10" },
38657
+ offerings: { version: 1, lastModified: "2026-05-10" },
38658
+ roles: { version: 1, lastModified: "2026-05-10" },
38659
+ goals: { version: 1, lastModified: "2026-05-10" },
38660
+ systems: { version: 1, lastModified: "2026-05-10" },
38661
+ ontology: { version: 1, lastModified: "2026-05-14" },
38662
+ resources: { version: 1, lastModified: "2026-05-10" },
38663
+ topology: { version: 1, lastModified: "2026-05-14" },
38664
+ actions: { version: 1, lastModified: "2026-05-10" },
38665
+ entities: { version: 1, lastModified: "2026-05-10" },
38666
+ policies: { version: 1, lastModified: "2026-05-10" },
38667
+ knowledge: { version: 1, lastModified: "2026-05-10" }
38668
+ };
38669
+ var OrganizationModelDomainMetadataByDomainSchema = external_exports.object({
38670
+ branding: OrganizationModelDomainMetadataSchema,
38671
+ identity: OrganizationModelDomainMetadataSchema,
38672
+ customers: OrganizationModelDomainMetadataSchema,
38673
+ offerings: OrganizationModelDomainMetadataSchema,
38674
+ roles: OrganizationModelDomainMetadataSchema,
38675
+ goals: OrganizationModelDomainMetadataSchema,
38676
+ systems: OrganizationModelDomainMetadataSchema,
38677
+ ontology: OrganizationModelDomainMetadataSchema,
38678
+ resources: OrganizationModelDomainMetadataSchema,
38679
+ topology: OrganizationModelDomainMetadataSchema,
38680
+ actions: OrganizationModelDomainMetadataSchema,
38681
+ entities: OrganizationModelDomainMetadataSchema,
38682
+ policies: OrganizationModelDomainMetadataSchema,
38683
+ knowledge: OrganizationModelDomainMetadataSchema
38684
+ }).partial().default(DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA).transform((metadata) => ({ ...DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA, ...metadata }));
38685
+ var OrganizationModelSchemaBase = external_exports.object({
38686
+ version: external_exports.literal(1).default(1),
38687
+ domainMetadata: OrganizationModelDomainMetadataByDomainSchema,
38688
+ branding: OrganizationModelBrandingSchema.default(DEFAULT_ORGANIZATION_MODEL_BRANDING),
38689
+ navigation: OrganizationModelNavigationSchema,
38690
+ identity: IdentityDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_IDENTITY),
38691
+ customers: CustomersDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_CUSTOMERS),
38692
+ offerings: OfferingsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_OFFERINGS),
38693
+ roles: RolesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_ROLES),
38694
+ goals: GoalsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_GOALS),
38695
+ systems: SystemsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_SYSTEMS),
38696
+ ontology: OntologyScopeSchema.default(DEFAULT_ONTOLOGY_SCOPE),
38697
+ resources: ResourcesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_RESOURCES),
38698
+ topology: OmTopologyDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_TOPOLOGY),
38699
+ actions: ActionsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_ACTIONS),
38700
+ entities: EntitiesDomainSchema.default({}),
38701
+ policies: PoliciesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_POLICIES),
38702
+ // D3: flat Record<id, OrgKnowledgeNode> — no wrapper object
38703
+ knowledge: KnowledgeDomainSchema.default({})
38739
38704
  });
38705
+ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine(refineOrganizationModel);
38740
38706
 
38741
38707
  // ../core/src/organization-model/defaults.ts
38742
38708
  var DEFAULT_ORGANIZATION_MODEL_KNOWLEDGE = {};
38743
- var DEFAULT_ORGANIZATION_MODEL_ENTITIES2 = {};
38709
+ var DEFAULT_ORGANIZATION_MODEL_ENTITIES = {};
38744
38710
  var DEFAULT_ORGANIZATION_MODEL_NAVIGATION = {
38745
38711
  sidebar: {
38746
38712
  primary: {},
@@ -38768,31 +38734,11 @@ var DEFAULT_ORGANIZATION_MODEL = {
38768
38734
  // Generic empty actions map. Elevasis-specific action entries have been relocated to
38769
38735
  // `@repo/elevasis-core/src/organization-model/actions.ts`.
38770
38736
  actions: {},
38771
- entities: DEFAULT_ORGANIZATION_MODEL_ENTITIES2,
38737
+ entities: DEFAULT_ORGANIZATION_MODEL_ENTITIES,
38772
38738
  policies: DEFAULT_ORGANIZATION_MODEL_POLICIES,
38773
38739
  knowledge: DEFAULT_ORGANIZATION_MODEL_KNOWLEDGE
38774
38740
  };
38775
38741
 
38776
- // ../core/src/organization-model/helpers.ts
38777
- function childSystemsOf2(system) {
38778
- return system.systems ?? system.subsystems ?? {};
38779
- }
38780
- function listAllSystems(model) {
38781
- const results = [];
38782
- function walk(map2, prefix) {
38783
- for (const [localId2, system] of Object.entries(map2)) {
38784
- const fullPath = prefix ? `${prefix}.${localId2}` : localId2;
38785
- results.push({ path: fullPath, system });
38786
- const childSystems = childSystemsOf2(system);
38787
- if (Object.keys(childSystems).length > 0) {
38788
- walk(childSystems, fullPath);
38789
- }
38790
- }
38791
- }
38792
- walk(model.systems, "");
38793
- return results;
38794
- }
38795
-
38796
38742
  // ../core/src/organization-model/migration-helpers.ts
38797
38743
  function catalogRecords(model) {
38798
38744
  return Object.values(compileOrganizationOntology(model).ontology.catalogTypes);
@@ -38863,19 +38809,22 @@ function getAllBuildTemplates(model) {
38863
38809
  const stepCatalog = stepCatalogId !== void 0 ? stepCatalogs.get(stepCatalogId) : void 0;
38864
38810
  const steps = stepCatalog === void 0 ? [] : entriesOf(stepCatalog);
38865
38811
  return {
38866
- id: templateId,
38867
- label: stringValue(templateEntry.label) ?? templateId,
38868
- ...stringValue(templateEntry.description) ? { description: stringValue(templateEntry.description) } : {},
38869
- ...stringValue(templateEntry.color) ? { color: stringValue(templateEntry.color) } : {},
38870
- steps: steps.map(([stepId, step]) => ({
38871
- id: stepId,
38872
- label: stringValue(step.label) ?? stepId,
38873
- ...stringValue(step.description) ? { description: stringValue(step.description) } : {},
38874
- ...step
38875
- }))
38812
+ order: numberValue(templateEntry.order, Number.MAX_SAFE_INTEGER),
38813
+ template: {
38814
+ id: templateId,
38815
+ label: stringValue(templateEntry.label) ?? templateId,
38816
+ ...stringValue(templateEntry.description) ? { description: stringValue(templateEntry.description) } : {},
38817
+ ...stringValue(templateEntry.color) ? { color: stringValue(templateEntry.color) } : {},
38818
+ steps: steps.map(([stepId, step]) => ({
38819
+ id: stepId,
38820
+ label: stringValue(step.label) ?? stepId,
38821
+ ...stringValue(step.description) ? { description: stringValue(step.description) } : {},
38822
+ ...step
38823
+ }))
38824
+ }
38876
38825
  };
38877
38826
  })
38878
- ).sort((a, b) => a.id.localeCompare(b.id));
38827
+ ).sort((a, b) => a.order - b.order || a.template.id.localeCompare(b.template.id)).map(({ template }) => template);
38879
38828
  }
38880
38829
  function getAllProspectingStages(model, kind) {
38881
38830
  return catalogRecords(model).filter((catalog) => catalog.kind === "stage" && appliesToEntityKind(catalog) === kind).flatMap(
@@ -44110,7 +44059,7 @@ function wrapAction(commandName, fn) {
44110
44059
  // package.json
44111
44060
  var package_default = {
44112
44061
  name: "@elevasis/sdk",
44113
- version: "1.24.0",
44062
+ version: "1.26.0",
44114
44063
  description: "SDK for building Elevasis organization resources",
44115
44064
  type: "module",
44116
44065
  bin: {
@@ -44316,6 +44265,38 @@ function bumpVersion(current, type) {
44316
44265
  return `${major}.${minor}.${patch + 1}`;
44317
44266
  }
44318
44267
  }
44268
+ function updateDeploymentVersionSource(source, newVersion) {
44269
+ let offset = 0;
44270
+ while (offset < source.length) {
44271
+ const keyIndex = source.indexOf("version", offset);
44272
+ if (keyIndex === -1) break;
44273
+ const before = source[keyIndex - 1];
44274
+ const after = source[keyIndex + "version".length];
44275
+ const isIdentifierBoundary = (before === void 0 || !/[A-Za-z0-9_$]/.test(before)) && (after === void 0 || !/[A-Za-z0-9_$]/.test(after));
44276
+ if (!isIdentifierBoundary) {
44277
+ offset = keyIndex + "version".length;
44278
+ continue;
44279
+ }
44280
+ let cursor = keyIndex + "version".length;
44281
+ while (/\s/.test(source[cursor] ?? "")) cursor += 1;
44282
+ if (source[cursor] !== ":") {
44283
+ offset = cursor;
44284
+ continue;
44285
+ }
44286
+ cursor += 1;
44287
+ while (/\s/.test(source[cursor] ?? "")) cursor += 1;
44288
+ const quote = source[cursor];
44289
+ if (quote !== "'" && quote !== '"') {
44290
+ offset = cursor;
44291
+ continue;
44292
+ }
44293
+ const valueStart = cursor + 1;
44294
+ const valueEnd = source.indexOf(quote, valueStart);
44295
+ if (valueEnd === -1) break;
44296
+ return `${source.slice(0, valueStart)}${newVersion}${source.slice(valueEnd)}`;
44297
+ }
44298
+ throw new Error("Unable to find a quoted version property in the deployment entry file");
44299
+ }
44319
44300
  function listOrganizationModelContractRefs(org) {
44320
44301
  return Object.values(org.organizationModel?.resources ?? {}).flatMap((resource) => {
44321
44302
  const contract = resource?.ontology?.contract;
@@ -44381,6 +44362,7 @@ function registerDeployCommand(program3) {
44381
44362
  let org;
44382
44363
  let activeWorkflows = [];
44383
44364
  let activeAgents = [];
44365
+ let bumpedEntrySource = null;
44384
44366
  try {
44385
44367
  const entryModule = await loadTsModule(entryPath);
44386
44368
  const deploymentModule = entryModule;
@@ -44409,11 +44391,10 @@ function registerDeployCommand(program3) {
44409
44391
  const newVersion = bumpVersion(currentVersion, bumpType);
44410
44392
  const absEntryPath = resolvePackageRelative(entryPath);
44411
44393
  const entryContent = await (0, import_promises.readFile)(absEntryPath, "utf-8");
44412
- const updatedContent = entryContent.replace(
44413
- /version:\s*['"][\d]+\.[\d]+\.[\d]+['"]/,
44414
- `version: '${newVersion}'`
44415
- );
44416
- await (0, import_promises.writeFile)(absEntryPath, updatedContent, "utf-8");
44394
+ bumpedEntrySource = {
44395
+ absEntryPath,
44396
+ content: updateDeploymentVersionSource(entryContent, newVersion)
44397
+ };
44417
44398
  org.version = newVersion;
44418
44399
  }
44419
44400
  console.log("");
@@ -44474,7 +44455,8 @@ function registerDeployCommand(program3) {
44474
44455
  const absEntryForImport = resolvePackageRelative(entryPath).replace(/\.ts$/, ".js");
44475
44456
  const wrapperContent = `import org from ${JSON.stringify(absEntryForImport)}
44476
44457
  import { startWorker } from '@elevasis/sdk/worker'
44477
- startWorker(org)
44458
+ ` + (bumpedEntrySource ? `org.version = ${JSON.stringify(org.version)}
44459
+ ` : "") + `startWorker(org)
44478
44460
  `;
44479
44461
  await (0, import_promises.writeFile)(wrapperPath, wrapperContent, "utf-8");
44480
44462
  await (0, import_promises.mkdir)(resolvePackageRelative("dist"), { recursive: true });
@@ -44542,6 +44524,9 @@ startWorker(org)
44542
44524
  const totalResources = activeWorkflows.length + activeAgents.length;
44543
44525
  const elapsed = ((Date.now() - startTime) / 1e3).toFixed(1);
44544
44526
  if (result.status === "active") {
44527
+ if (bumpedEntrySource) {
44528
+ await (0, import_promises.writeFile)(bumpedEntrySource.absEntryPath, bumpedEntrySource.content, "utf-8");
44529
+ }
44545
44530
  console.log("");
44546
44531
  console.log(
44547
44532
  source_default.green.bold(` Deployed! ${totalResources} resource${totalResources !== 1 ? "s" : ""} live.`)
@@ -47722,7 +47707,7 @@ function resolveKnowledgeInvocationNeighbors(model, id) {
47722
47707
  continue;
47723
47708
  }
47724
47709
  if (target.kind === "system") {
47725
- const system = model.systems[target.id];
47710
+ const system = getSystem(model, target.id);
47726
47711
  for (const actionRef of system?.actions ?? []) {
47727
47712
  pushActionSource(sources, seen, model.actions[actionRef.actionId]);
47728
47713
  }
@@ -48312,6 +48297,7 @@ var ListRequestsQuerySchema = external_exports.object({
48312
48297
  var REQUEST_TYPE_HELP = RequestTypeEnum.options.join(" | ");
48313
48298
  var REQUEST_CATEGORY_HELP = RequestCategoryEnum.options.join(" | ");
48314
48299
  var REQUEST_SEVERITY_HELP = RequestSeverityEnum.options.join(" | ");
48300
+ var REQUEST_STATUS_HELP = RequestStatusEnum.options.join(" | ");
48315
48301
  function registerRequestCommands(program3) {
48316
48302
  program3.command("request:submit").description(
48317
48303
  `Submit a structured request report via POST /api/external/requests
@@ -48367,6 +48353,59 @@ ${issues}`);
48367
48353
  }
48368
48354
  })
48369
48355
  );
48356
+ program3.command("request:list").description(
48357
+ `List reported requests via GET /api/external/requests
48358
+ Example: elevasis-sdk request:list --status open --severity critical
48359
+ status: ${REQUEST_STATUS_HELP}
48360
+ severity: ${REQUEST_SEVERITY_HELP}`
48361
+ ).option("--status <status>", `Filter by status (${REQUEST_STATUS_HELP})`).option("--severity <severity>", `Filter by severity (${REQUEST_SEVERITY_HELP})`).option("--project-id <uuid>", "Filter by project id").option("--limit <n>", "Max rows to return (1-200, default 50)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
48362
+ wrapAction("request:list", async (options) => {
48363
+ const params = new URLSearchParams();
48364
+ if (options.status) params.set("status", options.status);
48365
+ if (options.severity) params.set("severity", options.severity);
48366
+ if (options.projectId) params.set("project_id", options.projectId);
48367
+ if (options.limit) params.set("limit", options.limit);
48368
+ const qs = params.toString();
48369
+ const apiUrl = resolveApiUrl(options.apiUrl);
48370
+ const result = await apiGet(`/api/external/requests${qs ? `?${qs}` : ""}`, apiUrl);
48371
+ if (options.pretty) {
48372
+ const rows = result.requests;
48373
+ if (rows.length === 0) {
48374
+ console.log(source_default.yellow("\nNo requests found"));
48375
+ return;
48376
+ }
48377
+ console.log(source_default.green(`
48378
+ ${rows.length} request${rows.length === 1 ? "" : "s"}`));
48379
+ for (const r of rows) {
48380
+ console.log(source_default.gray(` ${r.id} [${r.severity}/${r.status}] ${r.title}`));
48381
+ }
48382
+ console.log();
48383
+ } else {
48384
+ console.log(JSON.stringify(result, null, 2));
48385
+ }
48386
+ })
48387
+ );
48388
+ program3.command("request:get <id>").description(
48389
+ "Get a reported request by id via GET /api/external/requests/:id\n Example: elevasis-sdk request:get 1a2b3c4d-5e6f-7890-abcd-ef1234567890"
48390
+ ).option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
48391
+ wrapAction("request:get", async (id, options) => {
48392
+ const apiUrl = resolveApiUrl(options.apiUrl);
48393
+ const result = await apiGet(`/api/external/requests/${encodeURIComponent(id)}`, apiUrl);
48394
+ if (options.pretty) {
48395
+ const r = result.request;
48396
+ console.log(source_default.green("\nRequest"));
48397
+ console.log(source_default.gray(` ID: ${r.id}`));
48398
+ console.log(source_default.gray(` Title: ${r.title}`));
48399
+ console.log(source_default.gray(` Severity: ${r.severity}`));
48400
+ console.log(source_default.gray(` Category: ${r.category}`));
48401
+ console.log(source_default.gray(` Status: ${r.status}`));
48402
+ console.log(source_default.gray(` Reported: ${r.reported_at}`));
48403
+ console.log();
48404
+ } else {
48405
+ console.log(JSON.stringify(result, null, 2));
48406
+ }
48407
+ })
48408
+ );
48370
48409
  }
48371
48410
 
48372
48411
  // src/cli/commands/ui/ui-switcher.ts
@@ -49828,6 +49867,8 @@ Commands:
49828
49867
  elevasis-sdk knowledge:cat <id> Print raw MDX body of a knowledge node
49829
49868
  elevasis-sdk knowledge:graph <id> Show outgoing and incoming edges for a node
49830
49869
  elevasis-sdk request:submit -f <path> Submit a structured request report
49870
+ elevasis-sdk request:list [--status open] List reported requests
49871
+ elevasis-sdk request:get <id> Get a reported request by id
49831
49872
  elevasis-sdk ui:use-local Use a local @elevasis/ui tarball
49832
49873
  elevasis-sdk ui:use-published Restore published @elevasis/ui
49833
49874
  elevasis-sdk cli [domain] Generate a registered command catalog