@elevasis/core 0.25.0 → 0.27.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 (80) hide show
  1. package/dist/index.d.ts +171 -90
  2. package/dist/index.js +377 -1541
  3. package/dist/knowledge/index.d.ts +48 -59
  4. package/dist/knowledge/index.js +1 -1
  5. package/dist/organization-model/index.d.ts +171 -90
  6. package/dist/organization-model/index.js +377 -1541
  7. package/dist/test-utils/index.d.ts +25 -33
  8. package/dist/test-utils/index.js +250 -1357
  9. package/package.json +1 -1
  10. package/src/_gen/__tests__/__snapshots__/contracts.md.snap +990 -1065
  11. package/src/business/acquisition/api-schemas.test.ts +1996 -1882
  12. package/src/business/acquisition/api-schemas.ts +1478 -1502
  13. package/src/business/acquisition/crm-next-action.test.ts +45 -25
  14. package/src/business/acquisition/crm-next-action.ts +227 -220
  15. package/src/business/acquisition/crm-priority.test.ts +41 -8
  16. package/src/business/acquisition/crm-priority.ts +365 -349
  17. package/src/business/acquisition/crm-state-actions.test.ts +208 -153
  18. package/src/business/acquisition/derive-actions.test.ts +101 -34
  19. package/src/business/acquisition/derive-actions.ts +8 -92
  20. package/src/business/acquisition/ontology-validation.ts +76 -162
  21. package/src/business/acquisition/types.ts +7 -8
  22. package/src/business/pdf/sections/investment.ts +1 -1
  23. package/src/business/pdf/sections/summary-investment.ts +1 -1
  24. package/src/execution/engine/tools/tool-maps.ts +872 -831
  25. package/src/knowledge/queries.ts +0 -1
  26. package/src/organization-model/__tests__/content-kinds-registry.test.ts +35 -210
  27. package/src/organization-model/__tests__/cross-ref.test.ts +167 -0
  28. package/src/organization-model/__tests__/defaults.test.ts +4 -4
  29. package/src/organization-model/__tests__/domains/actions.test.ts +12 -36
  30. package/src/organization-model/__tests__/domains/offerings.test.ts +13 -6
  31. package/src/organization-model/__tests__/domains/resources.test.ts +497 -350
  32. package/src/organization-model/__tests__/domains/systems.test.ts +6 -7
  33. package/src/organization-model/__tests__/flatten-additive-merge.test.ts +68 -80
  34. package/src/organization-model/__tests__/foundation.test.ts +81 -14
  35. package/src/organization-model/__tests__/graph.test.ts +662 -694
  36. package/src/organization-model/__tests__/knowledge.test.ts +31 -17
  37. package/src/organization-model/__tests__/lookup-helpers.test.ts +128 -438
  38. package/src/organization-model/__tests__/migration-helpers.test.ts +362 -591
  39. package/src/organization-model/__tests__/prospecting-ssot.test.ts +68 -103
  40. package/src/organization-model/__tests__/published-zero-leak.test.ts +76 -0
  41. package/src/organization-model/__tests__/recursive-system-schema.test.ts +159 -532
  42. package/src/organization-model/__tests__/resolve.test.ts +79 -42
  43. package/src/organization-model/__tests__/schema-refinements.test.ts +72 -0
  44. package/src/organization-model/__tests__/schema.test.ts +65 -56
  45. package/src/organization-model/catalogs/lead-gen.ts +0 -103
  46. package/src/organization-model/cross-ref.ts +175 -0
  47. package/src/organization-model/defaults.ts +17 -702
  48. package/src/organization-model/domains/actions.ts +116 -333
  49. package/src/organization-model/domains/branding.ts +6 -6
  50. package/src/organization-model/domains/knowledge.ts +15 -7
  51. package/src/organization-model/domains/projects.ts +4 -4
  52. package/src/organization-model/domains/prospecting.ts +405 -395
  53. package/src/organization-model/domains/resources.ts +206 -135
  54. package/src/organization-model/domains/sales.test.ts +104 -218
  55. package/src/organization-model/domains/sales.ts +217 -380
  56. package/src/organization-model/domains/systems.ts +8 -23
  57. package/src/organization-model/graph/build.ts +223 -294
  58. package/src/organization-model/graph/schema.ts +2 -3
  59. package/src/organization-model/graph/types.ts +12 -14
  60. package/src/organization-model/helpers.ts +130 -218
  61. package/src/organization-model/index.ts +105 -124
  62. package/src/organization-model/migration-helpers.ts +211 -249
  63. package/src/organization-model/ontology.ts +0 -60
  64. package/src/organization-model/organization-graph.mdx +4 -5
  65. package/src/organization-model/organization-model.mdx +1 -1
  66. package/src/organization-model/published.ts +236 -226
  67. package/src/organization-model/resolve.ts +4 -5
  68. package/src/organization-model/schema-refinements.ts +667 -0
  69. package/src/organization-model/schema.ts +88 -889
  70. package/src/organization-model/types.ts +167 -161
  71. package/src/platform/registry/__tests__/validation.test.ts +23 -0
  72. package/src/platform/registry/validation.ts +13 -2
  73. package/src/reference/_generated/contracts.md +990 -1065
  74. package/src/organization-model/content-kinds/config.ts +0 -36
  75. package/src/organization-model/content-kinds/index.ts +0 -78
  76. package/src/organization-model/content-kinds/pipeline.ts +0 -68
  77. package/src/organization-model/content-kinds/registry.ts +0 -44
  78. package/src/organization-model/content-kinds/status.ts +0 -71
  79. package/src/organization-model/content-kinds/template.ts +0 -83
  80. package/src/organization-model/content-kinds/types.ts +0 -117
@@ -19744,40 +19744,6 @@ function addLegacyActionProjections(index2, diagnostics, sourcesById, actions, e
19744
19744
  });
19745
19745
  }
19746
19746
  }
19747
- function addSystemContentProjections(index2, diagnostics, sourcesById, systemPath, system, schemaPath) {
19748
- const content = system.content ?? {};
19749
- for (const [localId, node] of Object.entries(content)) {
19750
- if (node.kind !== "schema") continue;
19751
- const entries = Object.fromEntries(
19752
- Object.entries(content).filter(([, candidate]) => candidate.parentContentId === localId).map(([entryId, candidate]) => [
19753
- entryId,
19754
- {
19755
- label: candidate.label ?? entryId,
19756
- type: candidate.type,
19757
- ...candidate.description !== void 0 ? { description: candidate.description } : {},
19758
- ...candidate.data !== void 0 ? candidate.data : {}
19759
- }
19760
- ])
19761
- );
19762
- const catalogType = {
19763
- id: formatOntologyId({ scope: systemPath, kind: "catalog", localId }),
19764
- label: node.label ?? localId,
19765
- description: node.description,
19766
- ownerSystemId: systemPath,
19767
- kind: node.type,
19768
- ...typeof node.data?.["entityId"] === "string" ? { appliesTo: formatOntologyId({ scope: systemPath, kind: "object", localId: node.data["entityId"] }) } : {},
19769
- ...Object.keys(entries).length > 0 ? { entries } : {},
19770
- ...node.data !== void 0 ? { data: node.data } : {}
19771
- };
19772
- addRecord(index2, diagnostics, sourcesById, "catalogTypes", catalogType, {
19773
- source: "legacy.system.content",
19774
- path: [...schemaPath, "content", localId],
19775
- kind: "projected",
19776
- systemPath,
19777
- legacyId: `${systemPath}:${localId}`
19778
- });
19779
- }
19780
- }
19781
19747
  function addSystemScopes(index2, diagnostics, sourcesById, systems, prefix, schemaPath) {
19782
19748
  for (const [key, system] of Object.entries(systems)) {
19783
19749
  const systemPath = prefix ? `${prefix}.${key}` : key;
@@ -19786,7 +19752,6 @@ function addSystemScopes(index2, diagnostics, sourcesById, systems, prefix, sche
19786
19752
  ...currentPath,
19787
19753
  "ontology"
19788
19754
  ]);
19789
- addSystemContentProjections(index2, diagnostics, sourcesById, systemPath, system, currentPath);
19790
19755
  addSystemScopes(index2, diagnostics, sourcesById, childSystemsOf(system), systemPath, [
19791
19756
  ...currentPath,
19792
19757
  system.systems !== void 0 ? "systems" : "subsystems"
@@ -19803,190 +19768,6 @@ function compileOrganizationOntology(model) {
19803
19768
  addLegacyActionProjections(ontology, diagnostics, sourcesById, model.actions ?? {}, model.entities ?? {});
19804
19769
  return { ontology: sortResolvedOntologyIndex(ontology), diagnostics };
19805
19770
  }
19806
-
19807
- // src/organization-model/content-kinds/registry.ts
19808
- function defineContentType(def) {
19809
- return def;
19810
- }
19811
- var ContentNodeBaseSchema = z.object({
19812
- /** Human-readable label for the content node. */
19813
- label: z.string().trim().min(1).max(120).meta({ label: "Label" }),
19814
- /** Optional one-paragraph description. */
19815
- description: z.string().trim().min(1).max(2e3).optional().meta({ label: "Description" }),
19816
- /** Optional display order within the system content map. */
19817
- order: z.number().int().optional().meta({ label: "Order" }),
19818
- /**
19819
- * Local NodeId of the parent content node within the SAME system.
19820
- * Per B4/L9: MUST resolve to a sibling in the same `system.content` map.
19821
- * Per L19: parent and child MUST share the same `kind` (meta-category).
19822
- */
19823
- parentContentId: z.string().trim().min(1).max(200).optional().meta({ label: "Parent content id" })
19824
- });
19825
- var ContentNodeSchema = ContentNodeBaseSchema.extend({
19826
- /** Meta-category (e.g. 'schema', 'config', 'knowledge', tenant-defined). */
19827
- kind: z.string().trim().min(1).max(100).meta({ label: "Kind" }),
19828
- /** Specific family within the meta-category (e.g. 'pipeline', 'kv'). */
19829
- type: z.string().trim().min(1).max(100).meta({ label: "Type" }),
19830
- /** Payload data; validated against registered payloadSchema when (kind, type) is known. */
19831
- data: z.record(z.string(), z.unknown()).optional().meta({ label: "Data" })
19832
- });
19833
- z.object({
19834
- /** Meta-category (tenant-defined or registry-shipped). */
19835
- kind: z.string().trim().min(1).max(100).meta({ label: "Kind" }),
19836
- /** Specific family within the meta-category. */
19837
- type: z.string().trim().min(1).max(100).meta({ label: "Type" }),
19838
- /** Human-readable label shown in the KB tree and describe views. */
19839
- label: z.string().trim().min(1).max(120).meta({ label: "Label" }),
19840
- /** Optional description. */
19841
- description: z.string().trim().min(1).max(2e3).optional().meta({ label: "Description" }),
19842
- /**
19843
- * Which KB tree group this extension renders in.
19844
- * Per L6: 'business-model' places it alongside Customers / Offerings / Goals.
19845
- */
19846
- treeGroup: z.union([z.enum(["profile", "business-model", "systems", "graph", "governance-wiring"]), z.string().min(1).max(100)]).meta({ label: "Tree group" }),
19847
- /** Untyped payload; shape governed by the registered payloadSchema when available. */
19848
- data: z.record(z.string(), z.unknown()).optional().meta({ label: "Data" })
19849
- });
19850
- var PipelinePayloadSchema = z.object({
19851
- /**
19852
- * Local NodeId of the entity this pipeline applies to (e.g. 'crm.deal').
19853
- * `.meta({ ref: 'entity' })` enables SchemaDrivenFieldList to render a
19854
- * clickable graph link to the referenced entity node.
19855
- */
19856
- entityId: z.string().trim().min(1).max(200).meta({ label: "Entity", ref: "entity", hint: "The entity type this pipeline tracks" }),
19857
- /**
19858
- * Optional Kanban column color token for UI rendering.
19859
- */
19860
- kanbanColor: z.string().trim().min(1).max(40).optional().meta({ label: "Kanban color", hint: "UI color token" })
19861
- });
19862
- var pipelineKind = defineContentType({
19863
- kind: "schema",
19864
- type: "pipeline",
19865
- label: "Pipeline",
19866
- description: "A named progression pipeline that applies to a specific entity type.",
19867
- payloadSchema: PipelinePayloadSchema,
19868
- parentTypes: []
19869
- });
19870
- var StagePayloadSchema = z.object({
19871
- /**
19872
- * Semantic classification for this stage.
19873
- * Drives color, icon, and CRM-priority logic in consuming views.
19874
- * Optional — prospecting stages use data.entityKind instead.
19875
- * Enum aligned with SalesStageSemanticClassSchema (sales.ts).
19876
- */
19877
- semanticClass: z.enum(["open", "active", "nurturing", "closed_won", "closed_lost", "won", "lost", "closed"]).optional().meta({ label: "Semantic class", hint: "Semantic meaning of this stage", color: "blue" })
19878
- });
19879
- var stageKind = defineContentType({
19880
- kind: "schema",
19881
- type: "stage",
19882
- label: "Stage",
19883
- description: "A stage within a pipeline. Must be parented under a schema:pipeline content node.",
19884
- payloadSchema: StagePayloadSchema,
19885
- parentTypes: ["schema:pipeline"]
19886
- });
19887
- var TemplatePayloadSchema = z.object({
19888
- /**
19889
- * Optional description surfaced in the KB describe view and tooling.
19890
- */
19891
- description: z.string().trim().min(1).max(2e3).optional().meta({ label: "Description", hint: "What this template is used for" })
19892
- });
19893
- var templateKind = defineContentType({
19894
- kind: "schema",
19895
- type: "template",
19896
- label: "Template",
19897
- description: "A named build template (e.g. a prospecting pipeline sequence).",
19898
- payloadSchema: TemplatePayloadSchema,
19899
- parentTypes: []
19900
- });
19901
- var TemplateStepPayloadSchema = z.object({
19902
- /**
19903
- * Which entity type this step primarily operates on.
19904
- */
19905
- primaryEntity: z.enum(["company", "contact"]).meta({ label: "Primary entity", hint: "Entity type this step processes", color: "blue" }),
19906
- /**
19907
- * Action key identifying the workflow action executed by this step.
19908
- * `.meta({ ref: 'action' })` enables SchemaDrivenFieldList to render a
19909
- * clickable graph link.
19910
- */
19911
- actionKey: z.string().trim().min(1).max(200).meta({ label: "Action", ref: "action", hint: "Workflow action executed by this step" }),
19912
- /**
19913
- * IDs of sibling step local NodeIds this step depends on.
19914
- */
19915
- dependsOn: z.array(z.string().trim().min(1).max(200)).optional().meta({ label: "Depends on", hint: "Local NodeIds of prerequisite steps" })
19916
- });
19917
- var templateStepKind = defineContentType({
19918
- kind: "schema",
19919
- type: "template-step",
19920
- label: "Template Step",
19921
- description: "A step within a build template. Must be parented under a schema:template content node.",
19922
- payloadSchema: TemplateStepPayloadSchema,
19923
- parentTypes: ["schema:template"]
19924
- });
19925
- var StatusFlowPayloadSchema = z.object({
19926
- /**
19927
- * Which entity scope this status flow governs.
19928
- */
19929
- appliesTo: z.enum(["project", "milestone", "task"]).meta({ label: "Applies to", hint: "Entity scope governed by this status flow", color: "blue" })
19930
- });
19931
- var statusFlowKind = defineContentType({
19932
- kind: "schema",
19933
- type: "status-flow",
19934
- label: "Status Flow",
19935
- description: "A named set of statuses governing a project, milestone, or task entity.",
19936
- payloadSchema: StatusFlowPayloadSchema,
19937
- parentTypes: []
19938
- });
19939
- var StatusPayloadSchema = z.object({
19940
- /**
19941
- * Semantic classification string for this status.
19942
- * Free-form to allow tenant-defined classifications (e.g. 'active', 'blocked',
19943
- * 'completed'). Used by UI to apply color and icon fallbacks.
19944
- * Optional — status nodes may omit this when the label is self-descriptive.
19945
- */
19946
- semanticClass: z.string().trim().min(1).max(100).optional().meta({ label: "Semantic class", hint: "Semantic meaning of this status (e.g. active, blocked, completed)" }),
19947
- /**
19948
- * Optional UI color token override for this status.
19949
- */
19950
- color: z.string().trim().min(1).max(40).optional().meta({ label: "Color", hint: "UI color token" })
19951
- });
19952
- var statusKind = defineContentType({
19953
- kind: "schema",
19954
- type: "status",
19955
- label: "Status",
19956
- description: "A single status within a status flow. Must be parented under a schema:status-flow content node.",
19957
- payloadSchema: StatusPayloadSchema,
19958
- parentTypes: ["schema:status-flow"]
19959
- });
19960
- var ConfigKvPayloadSchema = z.object({
19961
- /**
19962
- * Flat key-value entries. Values are JSON primitives.
19963
- * Keys are short identifiers (e.g. 'maxBatchSize', 'featureEnabled').
19964
- */
19965
- entries: z.record(z.string().trim().min(1).max(200), z.union([z.string(), z.number(), z.boolean(), z.null()])).meta({ label: "Entries", hint: "Key-value configuration entries (string, number, boolean, or null values)" })
19966
- });
19967
- var configKvKind = defineContentType({
19968
- kind: "config",
19969
- type: "kv",
19970
- label: "Key-Value Config",
19971
- description: "A flat key-value configuration store co-located with a system. Values are JSON primitives.",
19972
- payloadSchema: ConfigKvPayloadSchema,
19973
- parentTypes: []
19974
- });
19975
-
19976
- // src/organization-model/content-kinds/index.ts
19977
- var CONTENT_KIND_REGISTRY = {
19978
- "schema:pipeline": pipelineKind,
19979
- "schema:stage": stageKind,
19980
- "schema:template": templateKind,
19981
- "schema:template-step": templateStepKind,
19982
- "schema:status-flow": statusFlowKind,
19983
- "schema:status": statusKind,
19984
- "config:kv": configKvKind
19985
- };
19986
- function lookupContentType(kind, type3) {
19987
- const key = `${kind}:${type3}`;
19988
- return CONTENT_KIND_REGISTRY[key];
19989
- }
19990
19771
  var ORGANIZATION_MODEL_ICON_TOKENS = [
19991
19772
  // Navigation / app areas
19992
19773
  "dashboard",
@@ -20125,8 +19906,8 @@ var OrganizationModelBrandingSchema = z.object({
20125
19906
  });
20126
19907
  var DEFAULT_ORGANIZATION_MODEL_BRANDING = {
20127
19908
  organizationName: "Default Organization",
20128
- productName: "Elevasis",
20129
- shortName: "Elevasis",
19909
+ productName: "Organization OS",
19910
+ shortName: "Org OS",
20130
19911
  logos: {}
20131
19912
  };
20132
19913
  var SurfaceTypeSchema = z.enum(["page", "dashboard", "graph", "detail", "list", "settings"]).meta({ label: "Surface type", color: "blue" });
@@ -20529,226 +20310,7 @@ var ActionSchema = z.object({
20529
20310
  var ActionsDomainSchema = z.record(z.string(), ActionSchema).refine((record) => Object.entries(record).every(([key, entry]) => entry.id === key), {
20530
20311
  message: "Each action entry id must match its map key"
20531
20312
  }).default({});
20532
- var LEAD_GEN_ACTION_ENTRY_INPUTS = [
20533
- {
20534
- id: "lead-gen.company.source",
20535
- order: 10,
20536
- label: "Source companies",
20537
- description: "Import source companies from a list provider.",
20538
- scope: { domain: "sales" },
20539
- resourceId: "lgn-import-workflow",
20540
- invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/companies/source" }]
20541
- },
20542
- {
20543
- id: "lead-gen.company.apollo-import",
20544
- order: 20,
20545
- label: "Import from Apollo",
20546
- description: "Pull companies and seed contact data from an Apollo search or list.",
20547
- scope: { domain: "sales" },
20548
- resourceId: "lgn-01c-apollo-import-workflow",
20549
- invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/companies/apollo-import" }]
20550
- },
20551
- {
20552
- id: "lead-gen.contact.discover",
20553
- order: 30,
20554
- label: "Discover contact emails",
20555
- description: "Find email addresses for contacts at qualified companies.",
20556
- scope: { domain: "sales" },
20557
- resourceId: "lgn-04-email-discovery-workflow",
20558
- invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/contacts/discover" }]
20559
- },
20560
- {
20561
- id: "lead-gen.contact.verify-email",
20562
- order: 40,
20563
- label: "Verify emails",
20564
- description: "Check email deliverability before outreach.",
20565
- scope: { domain: "sales" },
20566
- resourceId: "lgn-05-email-verification-workflow",
20567
- invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/contacts/verify-email" }]
20568
- },
20569
- {
20570
- id: "lead-gen.company.apify-crawl",
20571
- order: 50,
20572
- label: "Crawl websites",
20573
- description: "Crawl company websites via Apify and store raw page markdown in enrichmentData.websiteCrawl.pages for downstream LLM analysis.",
20574
- scope: { domain: "sales" },
20575
- resourceId: "lgn-02a-apify-website-crawl-workflow",
20576
- invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/companies/apify-crawl" }]
20577
- },
20578
- {
20579
- id: "lead-gen.company.website-extract",
20580
- order: 60,
20581
- label: "Extract website signals",
20582
- description: "Scrape and analyze company websites for qualification signals.",
20583
- scope: { domain: "sales" },
20584
- resourceId: "lgn-02-website-extract-workflow",
20585
- invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/companies/website-extract" }]
20586
- },
20587
- {
20588
- id: "lead-gen.company.qualify",
20589
- order: 70,
20590
- label: "Qualify companies",
20591
- description: "Score and filter companies against the ICP rubric.",
20592
- scope: { domain: "sales" },
20593
- resourceId: "lgn-03-company-qualification-workflow",
20594
- invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/companies/qualify" }]
20595
- },
20596
- {
20597
- id: "lead-gen.company.dtc-subscription-qualify",
20598
- order: 80,
20599
- label: "Qualify DTC subscription fit",
20600
- description: "Classify subscription potential and consumable-product fit for DTC brands.",
20601
- scope: { domain: "sales" },
20602
- resourceId: "lgn-03b-dtc-subscription-score-workflow",
20603
- invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/companies/dtc-subscription-qualify" }]
20604
- },
20605
- {
20606
- id: "lead-gen.contact.apollo-decision-maker-enrich",
20607
- order: 90,
20608
- label: "Enrich decision-makers",
20609
- description: "Find and enrich qualified contacts at qualified companies via Apollo.",
20610
- scope: { domain: "sales" },
20611
- resourceId: "lgn-04b-apollo-decision-maker-enrich-workflow",
20612
- invocations: [
20613
- { kind: "api-endpoint", method: "POST", path: "/api/prospecting/contacts/apollo-decision-maker-enrich" }
20614
- ]
20615
- },
20616
- {
20617
- id: "lead-gen.contact.personalize",
20618
- order: 100,
20619
- label: "Personalize outreach",
20620
- description: "Generate personalized opening lines for each contact.",
20621
- scope: { domain: "sales" },
20622
- resourceId: "ist-personalization-workflow",
20623
- invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/contacts/personalize" }]
20624
- },
20625
- {
20626
- id: "lead-gen.review.outreach-ready",
20627
- order: 110,
20628
- label: "Upload to outreach",
20629
- description: "Upload approved contacts to the outreach sequence after QC review.",
20630
- scope: { domain: "sales" },
20631
- resourceId: "ist-upload-contacts-workflow",
20632
- invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/review/outreach-ready" }]
20633
- },
20634
- {
20635
- id: "lead-gen.export.list",
20636
- order: 120,
20637
- label: "Export lead list",
20638
- description: "Export approved leads as a downloadable lead list.",
20639
- scope: { domain: "sales" },
20640
- resourceId: "lgn-06-export-list-workflow",
20641
- invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/export/list" }]
20642
- },
20643
- {
20644
- id: "lead-gen.company.cleanup",
20645
- order: 130,
20646
- label: "Clean up companies",
20647
- description: "Remove disqualified or duplicate companies from the list.",
20648
- scope: { domain: "sales" },
20649
- resourceId: "lgn-company-cleanup-workflow",
20650
- invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/companies/cleanup" }]
20651
- }
20652
- ];
20653
- var LEAD_GEN_ACTION_ENTRIES = Object.fromEntries(
20654
- LEAD_GEN_ACTION_ENTRY_INPUTS.map((action) => {
20655
- const parsed = ActionSchema.parse(action);
20656
- return [parsed.id, parsed];
20657
- })
20658
- );
20659
- var CRM_ACTION_ENTRY_INPUTS = [
20660
- {
20661
- id: "send_reply",
20662
- order: 210,
20663
- label: "Send Reply",
20664
- description: "Send a contextual reply for an active CRM deal.",
20665
- scope: { domain: "sales" },
20666
- resourceId: "crm-send-reply-workflow",
20667
- affects: ["crm.deal"]
20668
- },
20669
- {
20670
- id: "send_link",
20671
- order: 220,
20672
- label: "Send Booking Link",
20673
- description: "Send a booking link to move a deal toward a scheduled call.",
20674
- scope: { domain: "sales" },
20675
- resourceId: "crm-send-booking-link-workflow",
20676
- affects: ["crm.deal"]
20677
- },
20678
- {
20679
- id: "send_nudge",
20680
- order: 230,
20681
- label: "Send Nudge",
20682
- description: "Send a follow-up nudge for a stalled CRM deal.",
20683
- scope: { domain: "sales" },
20684
- resourceId: "crm-send-nudge-workflow",
20685
- affects: ["crm.deal"]
20686
- },
20687
- {
20688
- id: "rebook",
20689
- order: 240,
20690
- label: "Rebook",
20691
- description: "Rebook a missed or rescheduled CRM appointment.",
20692
- scope: { domain: "sales" },
20693
- resourceId: "crm-rebook-workflow",
20694
- affects: ["crm.deal"]
20695
- },
20696
- {
20697
- id: "move_to_proposal",
20698
- order: 250,
20699
- label: "Move to Proposal",
20700
- description: "Advance a qualified CRM deal into the proposal stage.",
20701
- scope: { domain: "sales" },
20702
- resourceId: "move_to_proposal-workflow",
20703
- affects: ["crm.deal"]
20704
- },
20705
- {
20706
- id: "move_to_closing",
20707
- order: 260,
20708
- label: "Move to Closing",
20709
- description: "Advance a proposal-stage CRM deal into closing.",
20710
- scope: { domain: "sales" },
20711
- resourceId: "move_to_closing-workflow",
20712
- affects: ["crm.deal"]
20713
- },
20714
- {
20715
- id: "move_to_closed_won",
20716
- order: 270,
20717
- label: "Close Won",
20718
- description: "Mark a CRM deal as closed won.",
20719
- scope: { domain: "sales" },
20720
- resourceId: "move_to_closed_won-workflow",
20721
- affects: ["crm.deal"]
20722
- },
20723
- {
20724
- id: "move_to_closed_lost",
20725
- order: 280,
20726
- label: "Close Lost",
20727
- description: "Mark a CRM deal as closed lost.",
20728
- scope: { domain: "sales" },
20729
- resourceId: "move_to_closed_lost-workflow",
20730
- affects: ["crm.deal"]
20731
- },
20732
- {
20733
- id: "move_to_nurturing",
20734
- order: 290,
20735
- label: "Move to Nurturing",
20736
- description: "Move a CRM deal into nurturing for future follow-up.",
20737
- scope: { domain: "sales" },
20738
- resourceId: "move_to_nurturing-workflow",
20739
- affects: ["crm.deal"]
20740
- }
20741
- ];
20742
- var CRM_ACTION_ENTRIES = Object.fromEntries(
20743
- CRM_ACTION_ENTRY_INPUTS.map((action) => {
20744
- const parsed = ActionSchema.parse(action);
20745
- return [parsed.id, parsed];
20746
- })
20747
- );
20748
- var DEFAULT_ORGANIZATION_MODEL_ACTIONS = {
20749
- ...LEAD_GEN_ACTION_ENTRIES,
20750
- ...CRM_ACTION_ENTRIES
20751
- };
20313
+ var DEFAULT_ORGANIZATION_MODEL_ACTIONS = {};
20752
20314
 
20753
20315
  // src/organization-model/domains/systems.ts
20754
20316
  var SystemKindSchema = z.enum(["product", "operational", "platform", "diagnostic"]).meta({ label: "System kind", color: "blue" });
@@ -20762,7 +20324,7 @@ var SystemPathSchema = z.string().trim().min(1).regex(
20762
20324
  var UiPositionSchema = z.enum(["sidebar-primary", "sidebar-bottom"]).meta({ label: "UI position" });
20763
20325
  var NodeIdStringSchema = z.string().trim().min(1).max(200).regex(
20764
20326
  /^[a-z][a-z-]*:([a-z0-9-]+)(\.[a-z0-9-]+)*(:[a-z0-9.-]+)*$/,
20765
- "Node references must use kind:dotted-path (e.g. system:sales.crm or content-node:sales.crm:pipeline-id)"
20327
+ "Node references must use kind:dotted-path (e.g. system:sales.crm or resource:lead-gen.company.qualify)"
20766
20328
  );
20767
20329
  var SystemUiSchema = z.object({
20768
20330
  path: PathSchema,
@@ -20836,13 +20398,6 @@ var SystemEntrySchema = z.object({
20836
20398
  * shared contract records owned by this system.
20837
20399
  */
20838
20400
  ontology: OntologyScopeSchema.optional(),
20839
- /**
20840
- * @deprecated Compatibility-only bridge for old tenant content nodes and
20841
- * migration readers. New schema/catalog authoring belongs in ontology;
20842
- * new system-local settings belong in config. Bridge nodes are keyed by
20843
- * local NodeId and may still project to content-node:* graph IDs.
20844
- */
20845
- content: z.record(z.string().trim().min(1).max(200), ContentNodeSchema).optional(),
20846
20401
  /**
20847
20402
  * Recursive child systems, authored via nesting (per L11).
20848
20403
  * The key is the local system id; the full path is computed by joining
@@ -20853,7 +20408,7 @@ var SystemEntrySchema = z.object({
20853
20408
  systems: z.lazy(() => z.record(z.string().trim().min(1).max(100), SystemEntrySchema)).optional(),
20854
20409
  /** @deprecated Use systems. Accepted as a compatibility alias during the ontology bridge. */
20855
20410
  subsystems: z.lazy(() => z.record(z.string().trim().min(1).max(100), SystemEntrySchema)).optional()
20856
- }).refine((system) => system.label !== void 0 || system.title !== void 0, {
20411
+ }).strict().refine((system) => system.label !== void 0 || system.title !== void 0, {
20857
20412
  path: ["label"],
20858
20413
  message: "System must provide label or title"
20859
20414
  }).transform((system) => {
@@ -20868,6 +20423,10 @@ var SystemsDomainSchema = z.record(z.string(), SystemEntrySchema).refine((record
20868
20423
  var DEFAULT_ORGANIZATION_MODEL_SYSTEMS = {};
20869
20424
 
20870
20425
  // src/organization-model/domains/resources.ts
20426
+ var ContractRefSchema = z.string().trim().min(1).max(500).regex(
20427
+ /^[A-Za-z0-9@](?:[A-Za-z0-9_./@-]*[A-Za-z0-9_])?\/?[A-Za-z0-9_./@-]*#[A-Za-z_$][A-Za-z0-9_$]*$/,
20428
+ "ContractRef must be in the format package/subpath#ExportName (e.g. @repo/elevasis-core/contracts/apollo-import#inputSchema)"
20429
+ );
20871
20430
  z.enum(["workflow", "agent", "integration", "script"]).meta({ label: "Resource kind", color: "orange" });
20872
20431
  var ResourceGovernanceStatusSchema = z.enum(["active", "deprecated", "archived"]).meta({ label: "Governance status", color: "teal" });
20873
20432
  var AgentKindSchema = z.enum(["orchestrator", "specialist", "utility", "platform"]).meta({ label: "Agent kind", color: "violet" });
@@ -20896,7 +20455,20 @@ var ResourceOntologyBindingSchema = z.object({
20896
20455
  reads: z.array(OntologyIdSchema).optional(),
20897
20456
  writes: z.array(OntologyIdSchema).optional(),
20898
20457
  usesCatalogs: z.array(OntologyIdSchema).optional(),
20899
- emits: z.array(OntologyIdSchema).optional()
20458
+ emits: z.array(OntologyIdSchema).optional(),
20459
+ /**
20460
+ * Optional typed contract binding for this resource's workflow I/O.
20461
+ * Each ref is a `package/subpath#ExportName` string that resolves to a
20462
+ * Zod schema in `@repo/elevasis-core` (or the consumer's equivalent package).
20463
+ *
20464
+ * Absence of this field preserves all existing behavior — it is additive + optional.
20465
+ * Tier-1 validation (schema.ts): ref-string shape only (browser-safe, no imports).
20466
+ * Tier-2 validation (om:verify): intra-package typed-map resolution asserts ZodType.
20467
+ */
20468
+ contract: z.object({
20469
+ input: ContractRefSchema.optional(),
20470
+ output: ContractRefSchema.optional()
20471
+ }).optional()
20900
20472
  }).superRefine((binding, ctx) => {
20901
20473
  if (binding.primaryAction === void 0) return;
20902
20474
  if (binding.actions?.includes(binding.primaryAction)) return;
@@ -21088,13 +20660,10 @@ var KnowledgeTargetKindSchema = z.enum([
21088
20660
  "goal",
21089
20661
  "customer-segment",
21090
20662
  "offering",
21091
- "ontology",
21092
- // D4: content nodes are a valid knowledge target after compound-domain data moved into system.content
21093
- "content-node"
20663
+ "ontology"
21094
20664
  ]).meta({ label: "Target kind" });
21095
20665
  var KnowledgeTargetRefSchema = z.object({
21096
20666
  kind: KnowledgeTargetKindSchema,
21097
- // D4: content-node targets use a qualified id format '<system-path>:<local-content-id>'.
21098
20667
  // Ontology targets use the canonical '<scope>:<kind>/<local-id>' ontology id format.
21099
20668
  // Business-logic validation of target existence is done in OrganizationModelSchema.superRefine.
21100
20669
  id: z.string().trim().min(1).max(300)
@@ -21111,6 +20680,15 @@ var KnowledgeTargetRefSchema = z.object({
21111
20680
  });
21112
20681
  var LegacyKnowledgeLinkSchema = z.object({
21113
20682
  nodeId: z.union([NodeIdStringSchema, z.templateLiteral(["ontology:", OntologyIdSchema])])
20683
+ }).superRefine((link, ctx) => {
20684
+ const [kind] = link.nodeId.split(":");
20685
+ if (!KnowledgeTargetKindSchema.safeParse(kind).success) {
20686
+ ctx.addIssue({
20687
+ code: z.ZodIssueCode.custom,
20688
+ path: ["nodeId"],
20689
+ message: `Unknown knowledge target kind "${kind}"`
20690
+ });
20691
+ }
21114
20692
  });
21115
20693
  var CanonicalKnowledgeLinkSchema = z.object({
21116
20694
  target: KnowledgeTargetRefSchema
@@ -21301,79 +20879,106 @@ var PoliciesDomainSchema = z.record(z.string(), PolicySchema).refine((record) =>
21301
20879
  }).default({});
21302
20880
  var DEFAULT_ORGANIZATION_MODEL_POLICIES = {};
21303
20881
 
21304
- // src/organization-model/schema.ts
21305
- z.enum([
21306
- "branding",
21307
- "identity",
21308
- "customers",
21309
- "offerings",
21310
- "roles",
21311
- "goals",
21312
- "systems",
21313
- "ontology",
21314
- "resources",
21315
- "topology",
21316
- "actions",
21317
- "entities",
21318
- "policies",
21319
- "knowledge"
21320
- ]);
21321
- var OrganizationModelDomainMetadataSchema = z.object({
21322
- version: z.literal(1).default(1),
21323
- lastModified: z.string().regex(/^\d{4}-\d{2}-\d{2}$/, "lastModified must be an ISO date string (YYYY-MM-DD)")
21324
- });
21325
- var DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA = {
21326
- branding: { version: 1, lastModified: "2026-05-10" },
21327
- identity: { version: 1, lastModified: "2026-05-10" },
21328
- customers: { version: 1, lastModified: "2026-05-10" },
21329
- offerings: { version: 1, lastModified: "2026-05-10" },
21330
- roles: { version: 1, lastModified: "2026-05-10" },
21331
- goals: { version: 1, lastModified: "2026-05-10" },
21332
- systems: { version: 1, lastModified: "2026-05-10" },
21333
- ontology: { version: 1, lastModified: "2026-05-14" },
21334
- resources: { version: 1, lastModified: "2026-05-10" },
21335
- topology: { version: 1, lastModified: "2026-05-14" },
21336
- actions: { version: 1, lastModified: "2026-05-10" },
21337
- entities: { version: 1, lastModified: "2026-05-10" },
21338
- policies: { version: 1, lastModified: "2026-05-10" },
21339
- knowledge: { version: 1, lastModified: "2026-05-10" }
20882
+ // src/organization-model/helpers.ts
20883
+ function childSystemsOf2(system) {
20884
+ return system.systems ?? system.subsystems ?? {};
20885
+ }
20886
+ function listAllSystems(model) {
20887
+ const results = [];
20888
+ function walk(map2, prefix) {
20889
+ for (const [localId, system] of Object.entries(map2)) {
20890
+ const fullPath = prefix ? `${prefix}.${localId}` : localId;
20891
+ results.push({ path: fullPath, system });
20892
+ const childSystems = childSystemsOf2(system);
20893
+ if (Object.keys(childSystems).length > 0) {
20894
+ walk(childSystems, fullPath);
20895
+ }
20896
+ }
20897
+ }
20898
+ walk(model.systems, "");
20899
+ return results;
20900
+ }
20901
+
20902
+ // src/organization-model/cross-ref.ts
20903
+ var ONTOLOGY_REFERENCE_KEY_KINDS = {
20904
+ valueType: "value-type",
20905
+ catalogType: "catalog",
20906
+ objectType: "object",
20907
+ eventType: "event",
20908
+ actionType: "action",
20909
+ linkType: "link",
20910
+ interfaceType: "interface",
20911
+ propertyType: "property",
20912
+ groupType: "group",
20913
+ surfaceType: "surface",
20914
+ stepCatalog: "catalog"
21340
20915
  };
21341
- var OrganizationModelDomainMetadataByDomainSchema = z.object({
21342
- branding: OrganizationModelDomainMetadataSchema,
21343
- identity: OrganizationModelDomainMetadataSchema,
21344
- customers: OrganizationModelDomainMetadataSchema,
21345
- offerings: OrganizationModelDomainMetadataSchema,
21346
- roles: OrganizationModelDomainMetadataSchema,
21347
- goals: OrganizationModelDomainMetadataSchema,
21348
- systems: OrganizationModelDomainMetadataSchema,
21349
- ontology: OrganizationModelDomainMetadataSchema,
21350
- resources: OrganizationModelDomainMetadataSchema,
21351
- topology: OrganizationModelDomainMetadataSchema,
21352
- actions: OrganizationModelDomainMetadataSchema,
21353
- entities: OrganizationModelDomainMetadataSchema,
21354
- policies: OrganizationModelDomainMetadataSchema,
21355
- knowledge: OrganizationModelDomainMetadataSchema
21356
- }).partial().default(DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA).transform((metadata) => ({ ...DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA, ...metadata }));
21357
- var OrganizationModelSchemaBase = z.object({
21358
- version: z.literal(1).default(1),
21359
- domainMetadata: OrganizationModelDomainMetadataByDomainSchema,
21360
- branding: OrganizationModelBrandingSchema,
21361
- navigation: OrganizationModelNavigationSchema,
21362
- identity: IdentityDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_IDENTITY),
21363
- customers: CustomersDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_CUSTOMERS),
21364
- offerings: OfferingsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_OFFERINGS),
21365
- roles: RolesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_ROLES),
21366
- goals: GoalsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_GOALS),
21367
- systems: SystemsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_SYSTEMS),
21368
- ontology: OntologyScopeSchema.default(DEFAULT_ONTOLOGY_SCOPE),
21369
- resources: ResourcesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_RESOURCES),
21370
- topology: OmTopologyDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_TOPOLOGY),
21371
- actions: ActionsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_ACTIONS),
21372
- entities: EntitiesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_ENTITIES),
21373
- policies: PoliciesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_POLICIES),
21374
- // D3: flat Record<id, OrgKnowledgeNode> — no wrapper object
21375
- knowledge: KnowledgeDomainSchema.default({})
21376
- });
20916
+ function buildOmCrossRefIndex(model) {
20917
+ const systemsById = /* @__PURE__ */ new Map();
20918
+ for (const { path, system } of listAllSystems(model)) {
20919
+ systemsById.set(path, system);
20920
+ systemsById.set(system.id, system);
20921
+ }
20922
+ const resourceIds = new Set(Object.keys(model.resources ?? {}));
20923
+ const knowledgeIds = new Set(Object.keys(model.knowledge ?? {}));
20924
+ const roleIds = new Set(Object.keys(model.roles ?? {}));
20925
+ const goalIds = new Set(Object.keys(model.goals ?? {}));
20926
+ const actionIds = new Set(Object.keys(model.actions ?? {}));
20927
+ const customerSegmentIds = new Set(Object.keys(model.customers ?? {}));
20928
+ const offeringIds = new Set(Object.keys(model.offerings ?? {}));
20929
+ const ontologyCompilation = compileOrganizationOntology(model);
20930
+ const ontologyIndexByKind = {
20931
+ object: ontologyCompilation.ontology.objectTypes,
20932
+ link: ontologyCompilation.ontology.linkTypes,
20933
+ action: ontologyCompilation.ontology.actionTypes,
20934
+ catalog: ontologyCompilation.ontology.catalogTypes,
20935
+ event: ontologyCompilation.ontology.eventTypes,
20936
+ interface: ontologyCompilation.ontology.interfaceTypes,
20937
+ "value-type": ontologyCompilation.ontology.valueTypes,
20938
+ property: ontologyCompilation.ontology.sharedProperties,
20939
+ group: ontologyCompilation.ontology.groups,
20940
+ surface: ontologyCompilation.ontology.surfaces
20941
+ };
20942
+ const ontologyIds = new Set(Object.values(ontologyIndexByKind).flatMap((index2) => Object.keys(index2)));
20943
+ const stageIds = /* @__PURE__ */ new Set();
20944
+ for (const catalog of Object.values(ontologyCompilation.ontology.catalogTypes)) {
20945
+ if (catalog.kind !== "stage") continue;
20946
+ const entries = catalog.entries;
20947
+ if (entries !== void 0) {
20948
+ for (const stageId of Object.keys(entries)) {
20949
+ stageIds.add(stageId);
20950
+ }
20951
+ }
20952
+ }
20953
+ return {
20954
+ systemsById,
20955
+ resourceIds,
20956
+ knowledgeIds,
20957
+ roleIds,
20958
+ goalIds,
20959
+ actionIds,
20960
+ customerSegmentIds,
20961
+ offeringIds,
20962
+ ontologyIds,
20963
+ ontologyIndexByKind,
20964
+ stageIds
20965
+ };
20966
+ }
20967
+ function knowledgeTargetExists(index2, kind, id) {
20968
+ if (kind === "system") return index2.systemsById.has(id);
20969
+ if (kind === "resource") return index2.resourceIds.has(id);
20970
+ if (kind === "knowledge") return index2.knowledgeIds.has(id);
20971
+ if (kind === "stage") return index2.stageIds.has(id);
20972
+ if (kind === "action") return index2.actionIds.has(id);
20973
+ if (kind === "role") return index2.roleIds.has(id);
20974
+ if (kind === "goal") return index2.goalIds.has(id);
20975
+ if (kind === "customer-segment") return index2.customerSegmentIds.has(id);
20976
+ if (kind === "offering") return index2.offeringIds.has(id);
20977
+ if (kind === "ontology") return index2.ontologyIds.has(id);
20978
+ return false;
20979
+ }
20980
+
20981
+ // src/organization-model/schema-refinements.ts
21377
20982
  function addIssue(ctx, path, message) {
21378
20983
  ctx.addIssue({
21379
20984
  code: z.ZodIssueCode.custom,
@@ -21404,7 +21009,7 @@ function isKnowledgeKindCompatibleWithTarget(knowledgeKind, targetKind) {
21404
21009
  function isRecord(value) {
21405
21010
  return typeof value === "object" && value !== null && !Array.isArray(value);
21406
21011
  }
21407
- var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ctx) => {
21012
+ function refineOrganizationModel(model, ctx) {
21408
21013
  function collectAllSystems(systems, prefix = "", schemaPath = ["systems"]) {
21409
21014
  const result = [];
21410
21015
  for (const [key, system] of Object.entries(systems)) {
@@ -21414,7 +21019,10 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
21414
21019
  const childSystems = system.systems ?? system.subsystems;
21415
21020
  if (childSystems !== void 0) {
21416
21021
  result.push(
21417
- ...collectAllSystems(childSystems, path, [...currentSchemaPath, system.systems !== void 0 ? "systems" : "subsystems"])
21022
+ ...collectAllSystems(childSystems, path, [
21023
+ ...currentSchemaPath,
21024
+ system.systems !== void 0 ? "systems" : "subsystems"
21025
+ ])
21418
21026
  );
21419
21027
  }
21420
21028
  }
@@ -21435,7 +21043,9 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
21435
21043
  `System "${system.id}" references unknown parent "${system.parentSystemId}"`
21436
21044
  );
21437
21045
  }
21438
- const hasChildren = Object.keys(system.systems ?? system.subsystems ?? {}).length > 0 || allSystems.some((candidate) => candidate.path.startsWith(`${path}.`) && !candidate.path.slice(path.length + 1).includes("."));
21046
+ const hasChildren = Object.keys(system.systems ?? system.subsystems ?? {}).length > 0 || allSystems.some(
21047
+ (candidate) => candidate.path.startsWith(`${path}.`) && !candidate.path.slice(path.length + 1).includes(".")
21048
+ );
21439
21049
  const contributesRoutePath = system.ui?.path !== void 0 || system.path !== void 0 || !hasChildren;
21440
21050
  if (contributesRoutePath) {
21441
21051
  const effectivePath = system.ui?.path ?? system.path ?? defaultSystemPathFor(path);
@@ -21457,11 +21067,7 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
21457
21067
  (candidate) => candidate.path.startsWith(`${path}.`) && !candidate.path.slice(path.length + 1).includes(".") && isLifecycleEnabled(candidate.system.lifecycle, candidate.system.enabled)
21458
21068
  );
21459
21069
  if (!hasEnabledDescendant) {
21460
- addIssue(
21461
- ctx,
21462
- [...schemaPath, "lifecycle"],
21463
- `System "${path}" is active but has no active descendants`
21464
- );
21070
+ addIssue(ctx, [...schemaPath, "lifecycle"], `System "${path}" is active but has no active descendants`);
21465
21071
  }
21466
21072
  }
21467
21073
  });
@@ -21575,7 +21181,7 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
21575
21181
  });
21576
21182
  });
21577
21183
  Object.values(model.entities).forEach((entity) => {
21578
- if (!systemsById.has(entity.ownedBySystemId)) {
21184
+ if (systemsById.size > 0 && !systemsById.has(entity.ownedBySystemId)) {
21579
21185
  addIssue(
21580
21186
  ctx,
21581
21187
  ["entities", entity.id, "ownedBySystemId"],
@@ -21693,23 +21299,9 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
21693
21299
  }
21694
21300
  });
21695
21301
  });
21696
- const stageIds = /* @__PURE__ */ new Set();
21697
- const actionIds = new Set(Object.keys(model.actions));
21698
- const offeringsById = new Map(Object.entries(model.offerings));
21302
+ const idx = buildOmCrossRefIndex(model);
21303
+ const { ontologyIndexByKind, ontologyIds } = idx;
21699
21304
  const ontologyCompilation = compileOrganizationOntology(model);
21700
- const ontologyIndexByKind = {
21701
- object: ontologyCompilation.ontology.objectTypes,
21702
- link: ontologyCompilation.ontology.linkTypes,
21703
- action: ontologyCompilation.ontology.actionTypes,
21704
- catalog: ontologyCompilation.ontology.catalogTypes,
21705
- event: ontologyCompilation.ontology.eventTypes,
21706
- interface: ontologyCompilation.ontology.interfaceTypes,
21707
- "value-type": ontologyCompilation.ontology.valueTypes,
21708
- property: ontologyCompilation.ontology.sharedProperties,
21709
- group: ontologyCompilation.ontology.groups,
21710
- surface: ontologyCompilation.ontology.surfaces
21711
- };
21712
- const ontologyIds = new Set(Object.values(ontologyIndexByKind).flatMap((index2) => Object.keys(index2)));
21713
21305
  function topologyTargetExists(ref) {
21714
21306
  if (ref.kind === "system") return systemsById.has(ref.id);
21715
21307
  if (ref.kind === "resource") return resourcesById.has(ref.id);
@@ -21729,19 +21321,6 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
21729
21321
  );
21730
21322
  });
21731
21323
  });
21732
- const ontologyReferenceKeyKinds = {
21733
- valueType: "value-type",
21734
- catalogType: "catalog",
21735
- objectType: "object",
21736
- eventType: "event",
21737
- actionType: "action",
21738
- linkType: "link",
21739
- interfaceType: "interface",
21740
- propertyType: "property",
21741
- groupType: "group",
21742
- surfaceType: "surface",
21743
- stepCatalog: "catalog"
21744
- };
21745
21324
  function validateKnownOntologyReferences(ownerId, value, path, seen = /* @__PURE__ */ new WeakSet()) {
21746
21325
  if (Array.isArray(value)) {
21747
21326
  value.forEach((entry, index2) => validateKnownOntologyReferences(ownerId, entry, [...path, index2], seen));
@@ -21751,7 +21330,7 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
21751
21330
  if (seen.has(value)) return;
21752
21331
  seen.add(value);
21753
21332
  Object.entries(value).forEach(([key, entry]) => {
21754
- const expectedKind = ontologyReferenceKeyKinds[key];
21333
+ const expectedKind = ONTOLOGY_REFERENCE_KEY_KINDS[key];
21755
21334
  if (expectedKind !== void 0) {
21756
21335
  if (typeof entry !== "string") {
21757
21336
  addIssue(ctx, [...path, key], `Ontology record "${ownerId}" ${key} must be an ontology ID string`);
@@ -21812,22 +21391,9 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
21812
21391
  );
21813
21392
  }
21814
21393
  });
21815
- function knowledgeTargetExists(kind, id) {
21816
- if (kind === "system") return systemsById.has(id);
21817
- if (kind === "resource") return resourcesById.has(id);
21818
- if (kind === "knowledge") return knowledgeById.has(id);
21819
- if (kind === "stage") return stageIds.has(id);
21820
- if (kind === "action") return actionIds.has(id);
21821
- if (kind === "role") return rolesById.has(id);
21822
- if (kind === "goal") return goalsById.has(id);
21823
- if (kind === "customer-segment") return segmentsById.has(id);
21824
- if (kind === "offering") return offeringsById.has(id);
21825
- if (kind === "ontology") return ontologyIds.has(id);
21826
- return false;
21827
- }
21828
21394
  Object.entries(model.knowledge).forEach(([nodeId, node]) => {
21829
21395
  node.links.forEach((link, linkIndex) => {
21830
- if (!knowledgeTargetExists(link.target.kind, link.target.id)) {
21396
+ if (!knowledgeTargetExists(idx, link.target.kind, link.target.id)) {
21831
21397
  addIssue(
21832
21398
  ctx,
21833
21399
  ["knowledge", nodeId, "links", linkIndex, "target"],
@@ -21872,13 +21438,7 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
21872
21438
  if (ontologyIndexByKind[expectedKind][ontologyId] === void 0) {
21873
21439
  addIssue(
21874
21440
  ctx,
21875
- [
21876
- "resources",
21877
- resourceId,
21878
- "ontology",
21879
- bindingKey,
21880
- ...Array.isArray(ids) ? [ontologyIndex] : []
21881
- ],
21441
+ ["resources", resourceId, "ontology", bindingKey, ...Array.isArray(ids) ? [ontologyIndex] : []],
21882
21442
  `Resource "${resourceId}" ontology binding "${bindingKey}" references unknown ${expectedKind} ontology ID "${ontologyId}"`
21883
21443
  );
21884
21444
  }
@@ -21893,6 +21453,23 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
21893
21453
  validateResourceOntologyBinding(resource.id, "writes", "object", binding.writes);
21894
21454
  validateResourceOntologyBinding(resource.id, "usesCatalogs", "catalog", binding.usesCatalogs);
21895
21455
  validateResourceOntologyBinding(resource.id, "emits", "event", binding.emits);
21456
+ if (binding.contract !== void 0) {
21457
+ const contractEntries = [
21458
+ ["input", binding.contract.input],
21459
+ ["output", binding.contract.output]
21460
+ ];
21461
+ for (const [side, ref] of contractEntries) {
21462
+ if (ref === void 0) continue;
21463
+ const result = ContractRefSchema.safeParse(ref);
21464
+ if (!result.success) {
21465
+ addIssue(
21466
+ ctx,
21467
+ ["resources", resource.id, "ontology", "contract", side],
21468
+ `Resource "${resource.id}" contract.${side} "${ref}" is not a valid ContractRef (expected "package/subpath#ExportName")`
21469
+ );
21470
+ }
21471
+ }
21472
+ }
21896
21473
  });
21897
21474
  Object.values(model.roles).forEach((role) => {
21898
21475
  if (role.heldBy === void 0) return;
@@ -21927,390 +21504,93 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
21927
21504
  }
21928
21505
  });
21929
21506
  });
21930
- function validateSystemContent(system, systemPath) {
21931
- const childSystems = system.systems ?? system.subsystems;
21932
- const childKey = system.systems !== void 0 ? "systems" : "subsystems";
21933
- const content = system.content;
21934
- if (content === void 0 || Object.keys(content).length === 0) {
21935
- if (childSystems !== void 0) {
21936
- Object.entries(childSystems).forEach(([childLocalId, child]) => {
21937
- validateSystemContent(child, [...systemPath, childKey, childLocalId]);
21938
- });
21939
- }
21940
- return;
21941
- }
21942
- Object.entries(content).forEach(([localId, node]) => {
21943
- if (node.parentContentId !== void 0 && !(node.parentContentId in content)) {
21944
- addIssue(
21945
- ctx,
21946
- [...systemPath, "content", localId, "parentContentId"],
21947
- `Content node "${localId}" parentContentId "${node.parentContentId}" does not resolve within the same system`
21948
- );
21949
- }
21950
- });
21951
- Object.entries(content).forEach(([localId, node]) => {
21952
- const visited = /* @__PURE__ */ new Set();
21953
- let currentId = node.parentContentId;
21954
- while (currentId !== void 0) {
21955
- if (currentId === localId || visited.has(currentId)) {
21956
- addIssue(
21957
- ctx,
21958
- [...systemPath, "content", localId, "parentContentId"],
21959
- `Content node "${localId}" has a parentContentId cycle`
21960
- );
21961
- break;
21962
- }
21963
- visited.add(currentId);
21964
- currentId = content[currentId]?.parentContentId;
21965
- }
21966
- });
21967
- Object.entries(content).forEach(([localId, node]) => {
21968
- const childDef = lookupContentType(node.kind, node.type);
21969
- if (childDef !== void 0 && node.data !== void 0) {
21970
- const result = childDef.payloadSchema.safeParse(node.data);
21971
- if (!result.success) {
21972
- addIssue(
21973
- ctx,
21974
- [...systemPath, "content", localId, "data"],
21975
- `Content node "${localId}" (${node.kind}:${node.type}) data failed payload validation: ${result.error.message}`
21976
- );
21977
- }
21978
- }
21979
- if (node.parentContentId !== void 0 && childDef !== void 0) {
21980
- const parentNode = content[node.parentContentId];
21981
- if (parentNode !== void 0) {
21982
- const parentDef = lookupContentType(parentNode.kind, parentNode.type);
21983
- if (parentDef !== void 0 && childDef.kind !== parentDef.kind) {
21984
- addIssue(
21985
- ctx,
21986
- [...systemPath, "content", localId, "parentContentId"],
21987
- `Content node "${localId}" kind "${childDef.kind}" cannot parent under "${node.parentContentId}" kind "${parentDef.kind}": parentContentId must be same-meta-kind (per L19)`
21988
- );
21989
- }
21990
- }
21991
- }
21992
- });
21993
- if (childSystems !== void 0) {
21994
- Object.entries(childSystems).forEach(([childLocalId, child]) => {
21995
- validateSystemContent(child, [...systemPath, childKey, childLocalId]);
21996
- });
21997
- }
21998
- }
21999
- Object.entries(model.systems).forEach(([systemKey, system]) => {
22000
- validateSystemContent(system, ["systems", systemKey]);
22001
- });
22002
21507
  for (const diagnostic of ontologyCompilation.diagnostics) {
22003
21508
  addIssue(ctx, diagnostic.path, diagnostic.message);
22004
21509
  }
21510
+ }
21511
+
21512
+ // src/organization-model/schema.ts
21513
+ z.enum([
21514
+ "branding",
21515
+ "identity",
21516
+ "customers",
21517
+ "offerings",
21518
+ "roles",
21519
+ "goals",
21520
+ "systems",
21521
+ "ontology",
21522
+ "resources",
21523
+ "topology",
21524
+ "actions",
21525
+ "entities",
21526
+ "policies",
21527
+ "knowledge"
21528
+ ]);
21529
+ var OrganizationModelDomainMetadataSchema = z.object({
21530
+ version: z.literal(1).default(1),
21531
+ lastModified: z.string().regex(/^\d{4}-\d{2}-\d{2}$/, "lastModified must be an ISO date string (YYYY-MM-DD)")
22005
21532
  });
21533
+ var DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA = {
21534
+ branding: { version: 1, lastModified: "2026-05-10" },
21535
+ identity: { version: 1, lastModified: "2026-05-10" },
21536
+ customers: { version: 1, lastModified: "2026-05-10" },
21537
+ offerings: { version: 1, lastModified: "2026-05-10" },
21538
+ roles: { version: 1, lastModified: "2026-05-10" },
21539
+ goals: { version: 1, lastModified: "2026-05-10" },
21540
+ systems: { version: 1, lastModified: "2026-05-10" },
21541
+ ontology: { version: 1, lastModified: "2026-05-14" },
21542
+ resources: { version: 1, lastModified: "2026-05-10" },
21543
+ topology: { version: 1, lastModified: "2026-05-14" },
21544
+ actions: { version: 1, lastModified: "2026-05-10" },
21545
+ entities: { version: 1, lastModified: "2026-05-10" },
21546
+ policies: { version: 1, lastModified: "2026-05-10" },
21547
+ knowledge: { version: 1, lastModified: "2026-05-10" }
21548
+ };
21549
+ var OrganizationModelDomainMetadataByDomainSchema = z.object({
21550
+ branding: OrganizationModelDomainMetadataSchema,
21551
+ identity: OrganizationModelDomainMetadataSchema,
21552
+ customers: OrganizationModelDomainMetadataSchema,
21553
+ offerings: OrganizationModelDomainMetadataSchema,
21554
+ roles: OrganizationModelDomainMetadataSchema,
21555
+ goals: OrganizationModelDomainMetadataSchema,
21556
+ systems: OrganizationModelDomainMetadataSchema,
21557
+ ontology: OrganizationModelDomainMetadataSchema,
21558
+ resources: OrganizationModelDomainMetadataSchema,
21559
+ topology: OrganizationModelDomainMetadataSchema,
21560
+ actions: OrganizationModelDomainMetadataSchema,
21561
+ entities: OrganizationModelDomainMetadataSchema,
21562
+ policies: OrganizationModelDomainMetadataSchema,
21563
+ knowledge: OrganizationModelDomainMetadataSchema
21564
+ }).partial().default(DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA).transform((metadata) => ({ ...DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA, ...metadata }));
21565
+ var OrganizationModelSchemaBase = z.object({
21566
+ version: z.literal(1).default(1),
21567
+ domainMetadata: OrganizationModelDomainMetadataByDomainSchema,
21568
+ branding: OrganizationModelBrandingSchema.default(DEFAULT_ORGANIZATION_MODEL_BRANDING),
21569
+ navigation: OrganizationModelNavigationSchema,
21570
+ identity: IdentityDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_IDENTITY),
21571
+ customers: CustomersDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_CUSTOMERS),
21572
+ offerings: OfferingsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_OFFERINGS),
21573
+ roles: RolesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_ROLES),
21574
+ goals: GoalsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_GOALS),
21575
+ systems: SystemsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_SYSTEMS),
21576
+ ontology: OntologyScopeSchema.default(DEFAULT_ONTOLOGY_SCOPE),
21577
+ resources: ResourcesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_RESOURCES),
21578
+ topology: OmTopologyDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_TOPOLOGY),
21579
+ actions: ActionsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_ACTIONS),
21580
+ entities: EntitiesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_ENTITIES),
21581
+ policies: PoliciesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_POLICIES),
21582
+ // D3: flat Record<id, OrgKnowledgeNode> — no wrapper object
21583
+ knowledge: KnowledgeDomainSchema.default({})
21584
+ });
21585
+ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine(refineOrganizationModel);
22006
21586
 
22007
21587
  // src/organization-model/defaults.ts
22008
21588
  var DEFAULT_ORGANIZATION_MODEL_KNOWLEDGE = {};
22009
- var DEFAULT_ORGANIZATION_MODEL_ENTITIES2 = DEFAULT_ORGANIZATION_MODEL_ENTITIES;
21589
+ var DEFAULT_ORGANIZATION_MODEL_ENTITIES2 = {};
22010
21590
  var DEFAULT_ORGANIZATION_MODEL_NAVIGATION = {
22011
21591
  sidebar: {
22012
- primary: {
22013
- dashboard: {
22014
- type: "surface",
22015
- label: "Dashboard",
22016
- path: "/",
22017
- surfaceType: "dashboard",
22018
- icon: "dashboard",
22019
- order: 10,
22020
- targets: { systems: ["dashboard"] }
22021
- },
22022
- business: {
22023
- type: "group",
22024
- label: "Business",
22025
- icon: "briefcase",
22026
- order: 20,
22027
- children: {
22028
- sales: {
22029
- type: "surface",
22030
- label: "Sales",
22031
- path: "/sales",
22032
- surfaceType: "page",
22033
- icon: "sales",
22034
- order: 10,
22035
- targets: { systems: ["sales"] }
22036
- },
22037
- clients: {
22038
- type: "surface",
22039
- label: "Clients",
22040
- path: "/clients",
22041
- surfaceType: "list",
22042
- icon: "clients",
22043
- order: 20,
22044
- targets: { systems: ["clients"] }
22045
- },
22046
- projects: {
22047
- type: "surface",
22048
- label: "Projects",
22049
- path: "/projects",
22050
- surfaceType: "page",
22051
- icon: "projects",
22052
- order: 30,
22053
- targets: { systems: ["projects"] }
22054
- }
22055
- }
22056
- },
22057
- operations: {
22058
- type: "group",
22059
- label: "Operations",
22060
- icon: "operations",
22061
- order: 30,
22062
- children: {
22063
- "operations-overview": {
22064
- type: "surface",
22065
- label: "Overview",
22066
- path: "/operations",
22067
- surfaceType: "page",
22068
- order: 10,
22069
- targets: { systems: ["operations.overview"] }
22070
- },
22071
- "operations-systems": {
22072
- type: "surface",
22073
- label: "Systems",
22074
- path: "/operations/systems",
22075
- surfaceType: "page",
22076
- order: 20,
22077
- targets: { systems: ["operations"] }
22078
- },
22079
- "operations-resources": {
22080
- type: "surface",
22081
- label: "Resources",
22082
- path: "/operations/resources",
22083
- surfaceType: "list",
22084
- order: 30,
22085
- targets: { systems: ["operations.resources"] }
22086
- },
22087
- "operations-command-queue": {
22088
- type: "surface",
22089
- label: "Command Queue",
22090
- path: "/operations/command-queue",
22091
- surfaceType: "list",
22092
- order: 40,
22093
- targets: { systems: ["operations.command-queue"] }
22094
- },
22095
- "operations-task-scheduler": {
22096
- type: "surface",
22097
- label: "Task Scheduler",
22098
- path: "/operations/task-scheduler",
22099
- surfaceType: "list",
22100
- order: 50,
22101
- targets: { systems: ["operations.task-scheduler"] }
22102
- }
22103
- }
22104
- },
22105
- monitoring: {
22106
- type: "group",
22107
- label: "Monitoring",
22108
- icon: "monitoring",
22109
- order: 40,
22110
- children: {
22111
- "monitoring-overview": {
22112
- type: "surface",
22113
- label: "Overview",
22114
- path: "/monitoring",
22115
- surfaceType: "page",
22116
- order: 10,
22117
- targets: { systems: ["monitoring"] }
22118
- },
22119
- "monitoring-calendar": {
22120
- type: "surface",
22121
- label: "Calendar",
22122
- path: "/monitoring/calendar",
22123
- surfaceType: "page",
22124
- order: 20,
22125
- targets: { systems: ["monitoring.calendar"] }
22126
- },
22127
- "monitoring-activity-log": {
22128
- type: "surface",
22129
- label: "Activity Log",
22130
- path: "/monitoring/activity-log",
22131
- surfaceType: "list",
22132
- order: 30,
22133
- targets: { systems: ["monitoring.activity-log"] }
22134
- },
22135
- "monitoring-execution-logs": {
22136
- type: "surface",
22137
- label: "Execution Logs",
22138
- path: "/monitoring/execution-logs",
22139
- surfaceType: "list",
22140
- order: 40,
22141
- targets: { systems: ["monitoring.execution-logs"] }
22142
- },
22143
- "monitoring-execution-health": {
22144
- type: "surface",
22145
- label: "Execution Health",
22146
- path: "/monitoring/execution-health",
22147
- surfaceType: "dashboard",
22148
- order: 50,
22149
- targets: { systems: ["monitoring.execution-health"] }
22150
- },
22151
- "monitoring-notifications": {
22152
- type: "surface",
22153
- label: "Notifications",
22154
- path: "/monitoring/notifications",
22155
- surfaceType: "list",
22156
- order: 60,
22157
- targets: { systems: ["monitoring.notifications"] }
22158
- },
22159
- "monitoring-requests": {
22160
- type: "surface",
22161
- label: "Requests",
22162
- path: "/monitoring/requests",
22163
- surfaceType: "list",
22164
- order: 70,
22165
- targets: { systems: ["monitoring.submitted-requests"] }
22166
- }
22167
- }
22168
- },
22169
- knowledge: {
22170
- type: "surface",
22171
- label: "Knowledge Base",
22172
- path: "/knowledge",
22173
- surfaceType: "page",
22174
- icon: "knowledge",
22175
- order: 50
22176
- }
22177
- },
22178
- bottom: {
22179
- settings: {
22180
- type: "group",
22181
- label: "Settings",
22182
- icon: "settings",
22183
- order: 10,
22184
- children: {
22185
- "settings-account": {
22186
- type: "surface",
22187
- label: "Account",
22188
- path: "/settings/account",
22189
- surfaceType: "settings",
22190
- order: 10,
22191
- targets: { systems: ["settings.account"] }
22192
- },
22193
- "settings-appearance": {
22194
- type: "surface",
22195
- label: "Appearance",
22196
- path: "/settings/appearance",
22197
- surfaceType: "settings",
22198
- order: 20,
22199
- targets: { systems: ["settings.appearance"] }
22200
- },
22201
- "settings-roles": {
22202
- type: "surface",
22203
- label: "My Roles",
22204
- path: "/settings/roles",
22205
- surfaceType: "settings",
22206
- order: 30,
22207
- targets: { systems: ["settings.roles"] }
22208
- },
22209
- "settings-organization": {
22210
- type: "surface",
22211
- label: "Organization",
22212
- path: "/settings/organization",
22213
- surfaceType: "settings",
22214
- order: 40,
22215
- targets: { systems: ["settings.organization"] }
22216
- },
22217
- "settings-credentials": {
22218
- type: "surface",
22219
- label: "Credentials",
22220
- path: "/settings/credentials",
22221
- surfaceType: "settings",
22222
- order: 50,
22223
- targets: { systems: ["settings.credentials"] }
22224
- },
22225
- "settings-api-keys": {
22226
- type: "surface",
22227
- label: "API Keys",
22228
- path: "/settings/api-keys",
22229
- surfaceType: "settings",
22230
- order: 60,
22231
- targets: { systems: ["settings.api-keys"] }
22232
- },
22233
- "settings-webhooks": {
22234
- type: "surface",
22235
- label: "Webhooks",
22236
- path: "/settings/webhooks",
22237
- surfaceType: "settings",
22238
- order: 70,
22239
- targets: { systems: ["settings.webhooks"] }
22240
- },
22241
- "settings-deployments": {
22242
- type: "surface",
22243
- label: "Deployments",
22244
- path: "/settings/deployments",
22245
- surfaceType: "settings",
22246
- order: 80,
22247
- targets: { systems: ["settings.deployments"] }
22248
- }
22249
- }
22250
- },
22251
- admin: {
22252
- type: "group",
22253
- label: "Admin",
22254
- icon: "admin",
22255
- order: 20,
22256
- children: {
22257
- "admin-dashboard": {
22258
- type: "surface",
22259
- label: "Dashboard",
22260
- path: "/admin/dashboard",
22261
- surfaceType: "dashboard",
22262
- order: 10,
22263
- targets: { systems: ["admin"] },
22264
- requiresAdmin: true
22265
- },
22266
- "admin-system-health": {
22267
- type: "surface",
22268
- label: "System Health",
22269
- path: "/admin/system-health",
22270
- surfaceType: "dashboard",
22271
- order: 20,
22272
- targets: { systems: ["admin.system-health"] },
22273
- requiresAdmin: true
22274
- },
22275
- "admin-organizations": {
22276
- type: "surface",
22277
- label: "Organizations",
22278
- path: "/admin/organizations",
22279
- surfaceType: "list",
22280
- order: 30,
22281
- targets: { systems: ["admin.organizations"] },
22282
- requiresAdmin: true
22283
- },
22284
- "admin-users": {
22285
- type: "surface",
22286
- label: "Users",
22287
- path: "/admin/users",
22288
- surfaceType: "list",
22289
- order: 40,
22290
- targets: { systems: ["admin.users"] },
22291
- requiresAdmin: true
22292
- },
22293
- "admin-design-showcase": {
22294
- type: "surface",
22295
- label: "Design Showcase",
22296
- path: "/admin/design-showcase",
22297
- surfaceType: "page",
22298
- order: 50,
22299
- targets: { systems: ["admin.design-showcase"] },
22300
- requiresAdmin: true
22301
- },
22302
- "admin-debug": {
22303
- type: "surface",
22304
- label: "Debug",
22305
- path: "/admin/debug",
22306
- surfaceType: "page",
22307
- order: 60,
22308
- targets: { systems: ["admin.debug"] },
22309
- requiresAdmin: true
22310
- }
22311
- }
22312
- }
22313
- }
21592
+ primary: {},
21593
+ bottom: {}
22314
21594
  }
22315
21595
  };
22316
21596
  var DEFAULT_ORGANIZATION_MODEL = {
@@ -22323,406 +21603,19 @@ var DEFAULT_ORGANIZATION_MODEL = {
22323
21603
  offerings: DEFAULT_ORGANIZATION_MODEL_OFFERINGS,
22324
21604
  roles: DEFAULT_ORGANIZATION_MODEL_ROLES,
22325
21605
  goals: DEFAULT_ORGANIZATION_MODEL_GOALS,
22326
- systems: {
22327
- dashboard: {
22328
- id: "dashboard",
22329
- order: 10,
22330
- label: "Dashboard",
22331
- enabled: true,
22332
- lifecycle: "active",
22333
- path: "/",
22334
- icon: "dashboard"
22335
- },
22336
- platform: {
22337
- id: "platform",
22338
- order: 30,
22339
- label: "Platform",
22340
- description: "Elevasis platform architecture, capabilities, and implementation patterns",
22341
- enabled: true,
22342
- lifecycle: "active",
22343
- color: "cyan",
22344
- icon: "platform"
22345
- },
22346
- finance: {
22347
- id: "finance",
22348
- order: 40,
22349
- label: "Finance",
22350
- description: "Finance operations, accounting, billing, reconciliation, and tax prep",
22351
- enabled: true,
22352
- lifecycle: "active",
22353
- color: "green",
22354
- icon: "finance"
22355
- },
22356
- sales: {
22357
- id: "sales",
22358
- order: 60,
22359
- label: "Sales",
22360
- description: "Revenue workflows and customer acquisition",
22361
- enabled: true,
22362
- lifecycle: "active",
22363
- color: "blue",
22364
- icon: "sales",
22365
- path: "/sales"
22366
- },
22367
- "sales.crm": {
22368
- id: "sales.crm",
22369
- order: 70,
22370
- label: "CRM",
22371
- description: "Relationship pipeline and deal management",
22372
- enabled: true,
22373
- lifecycle: "active",
22374
- actions: Object.values(CRM_ACTION_ENTRIES).map((action) => ({
22375
- actionId: action.id,
22376
- intent: "exposes"
22377
- })),
22378
- color: "blue",
22379
- icon: "crm",
22380
- path: "/crm"
22381
- },
22382
- "sales.lead-gen": {
22383
- id: "sales.lead-gen",
22384
- order: 80,
22385
- label: "Lead Gen",
22386
- description: "Prospecting, qualification, and outreach preparation",
22387
- enabled: true,
22388
- lifecycle: "active",
22389
- actions: Object.values(LEAD_GEN_ACTION_ENTRIES).map((action) => ({
22390
- actionId: action.id,
22391
- intent: "exposes"
22392
- })),
22393
- color: "cyan",
22394
- icon: "lead-gen",
22395
- path: "/lead-gen"
22396
- },
22397
- projects: {
22398
- id: "projects",
22399
- order: 90,
22400
- label: "Projects",
22401
- description: "Projects, milestones, and client work execution",
22402
- enabled: true,
22403
- lifecycle: "active",
22404
- color: "orange",
22405
- icon: "projects",
22406
- path: "/projects"
22407
- },
22408
- clients: {
22409
- id: "clients",
22410
- order: 100,
22411
- label: "Clients",
22412
- description: "Client relationships, accounts, and business context",
22413
- enabled: true,
22414
- lifecycle: "active",
22415
- color: "orange",
22416
- icon: "clients",
22417
- path: "/clients"
22418
- },
22419
- operations: {
22420
- id: "operations",
22421
- order: 110,
22422
- label: "Operations",
22423
- description: "Operational resources, topology, and orchestration visibility",
22424
- enabled: true,
22425
- lifecycle: "active",
22426
- color: "violet",
22427
- icon: "operations"
22428
- },
22429
- "knowledge.command-view": {
22430
- id: "knowledge.command-view",
22431
- order: 120,
22432
- label: "Command View",
22433
- enabled: true,
22434
- lifecycle: "active",
22435
- path: "/knowledge/command-view",
22436
- devOnly: true
22437
- },
22438
- "operations.overview": {
22439
- id: "operations.overview",
22440
- order: 130,
22441
- label: "Overview",
22442
- enabled: true,
22443
- lifecycle: "active",
22444
- path: "/operations"
22445
- },
22446
- "operations.resources": {
22447
- id: "operations.resources",
22448
- order: 140,
22449
- label: "Resources",
22450
- enabled: true,
22451
- lifecycle: "active",
22452
- path: "/operations/resources"
22453
- },
22454
- "operations.command-queue": {
22455
- id: "operations.command-queue",
22456
- order: 150,
22457
- label: "Command Queue",
22458
- enabled: true,
22459
- lifecycle: "active",
22460
- path: "/operations/command-queue"
22461
- },
22462
- "operations.sessions": {
22463
- id: "operations.sessions",
22464
- order: 160,
22465
- label: "Sessions",
22466
- enabled: false,
22467
- lifecycle: "deprecated",
22468
- path: "/operations/sessions"
22469
- },
22470
- "operations.task-scheduler": {
22471
- id: "operations.task-scheduler",
22472
- order: 170,
22473
- label: "Task Scheduler",
22474
- enabled: true,
22475
- lifecycle: "active",
22476
- path: "/operations/task-scheduler"
22477
- },
22478
- monitoring: {
22479
- id: "monitoring",
22480
- order: 180,
22481
- label: "Monitoring",
22482
- enabled: true,
22483
- lifecycle: "active"
22484
- },
22485
- "monitoring.calendar": {
22486
- id: "monitoring.calendar",
22487
- order: 190,
22488
- label: "Calendar",
22489
- description: "Google Calendar events and agenda views",
22490
- enabled: true,
22491
- lifecycle: "active",
22492
- path: "/monitoring/calendar",
22493
- icon: "calendar"
22494
- },
22495
- "monitoring.activity-log": {
22496
- id: "monitoring.activity-log",
22497
- order: 200,
22498
- label: "Activity Log",
22499
- enabled: true,
22500
- lifecycle: "active",
22501
- path: "/monitoring/activity-log"
22502
- },
22503
- "monitoring.execution-logs": {
22504
- id: "monitoring.execution-logs",
22505
- order: 210,
22506
- label: "Execution Logs",
22507
- enabled: true,
22508
- lifecycle: "active",
22509
- path: "/monitoring/execution-logs"
22510
- },
22511
- "monitoring.execution-health": {
22512
- id: "monitoring.execution-health",
22513
- order: 220,
22514
- label: "Execution Health",
22515
- enabled: true,
22516
- lifecycle: "active",
22517
- path: "/monitoring/execution-health"
22518
- },
22519
- "monitoring.cost-analytics": {
22520
- id: "monitoring.cost-analytics",
22521
- order: 230,
22522
- label: "Cost Analytics",
22523
- enabled: false,
22524
- lifecycle: "deprecated",
22525
- path: "/monitoring/cost-analytics"
22526
- },
22527
- "monitoring.notifications": {
22528
- id: "monitoring.notifications",
22529
- order: 240,
22530
- label: "Notifications",
22531
- enabled: true,
22532
- lifecycle: "active",
22533
- path: "/monitoring/notifications"
22534
- },
22535
- "monitoring.submitted-requests": {
22536
- id: "monitoring.submitted-requests",
22537
- order: 250,
22538
- label: "Submitted Requests",
22539
- enabled: true,
22540
- lifecycle: "active",
22541
- path: "/monitoring/requests"
22542
- },
22543
- settings: {
22544
- id: "settings",
22545
- order: 260,
22546
- label: "Settings",
22547
- enabled: true,
22548
- lifecycle: "active",
22549
- icon: "settings"
22550
- },
22551
- "settings.account": {
22552
- id: "settings.account",
22553
- order: 270,
22554
- label: "Account",
22555
- enabled: true,
22556
- lifecycle: "active",
22557
- path: "/settings/account"
22558
- },
22559
- "settings.appearance": {
22560
- id: "settings.appearance",
22561
- order: 280,
22562
- label: "Appearance",
22563
- enabled: true,
22564
- lifecycle: "active",
22565
- path: "/settings/appearance"
22566
- },
22567
- "settings.roles": {
22568
- id: "settings.roles",
22569
- order: 290,
22570
- label: "My Roles",
22571
- enabled: true,
22572
- lifecycle: "active",
22573
- path: "/settings/roles"
22574
- },
22575
- "settings.organization": {
22576
- id: "settings.organization",
22577
- order: 300,
22578
- label: "Organization",
22579
- enabled: true,
22580
- lifecycle: "active",
22581
- path: "/settings/organization"
22582
- },
22583
- "settings.credentials": {
22584
- id: "settings.credentials",
22585
- order: 310,
22586
- label: "Credentials",
22587
- enabled: true,
22588
- lifecycle: "active",
22589
- path: "/settings/credentials"
22590
- },
22591
- "settings.api-keys": {
22592
- id: "settings.api-keys",
22593
- order: 320,
22594
- label: "API Keys",
22595
- enabled: true,
22596
- lifecycle: "active",
22597
- path: "/settings/api-keys"
22598
- },
22599
- "settings.webhooks": {
22600
- id: "settings.webhooks",
22601
- order: 330,
22602
- label: "Webhooks",
22603
- enabled: true,
22604
- lifecycle: "active",
22605
- path: "/settings/webhooks"
22606
- },
22607
- "settings.deployments": {
22608
- id: "settings.deployments",
22609
- order: 340,
22610
- label: "Deployments",
22611
- enabled: true,
22612
- lifecycle: "active",
22613
- path: "/settings/deployments"
22614
- },
22615
- admin: {
22616
- id: "admin",
22617
- order: 350,
22618
- label: "Admin",
22619
- enabled: true,
22620
- lifecycle: "active",
22621
- path: "/admin",
22622
- icon: "admin",
22623
- requiresAdmin: true
22624
- },
22625
- "admin.system-health": {
22626
- id: "admin.system-health",
22627
- order: 360,
22628
- label: "System Health",
22629
- enabled: true,
22630
- lifecycle: "active",
22631
- path: "/admin/system-health"
22632
- },
22633
- "admin.organizations": {
22634
- id: "admin.organizations",
22635
- order: 370,
22636
- label: "Organizations",
22637
- enabled: true,
22638
- lifecycle: "active",
22639
- path: "/admin/organizations"
22640
- },
22641
- "admin.users": {
22642
- id: "admin.users",
22643
- order: 380,
22644
- label: "Users",
22645
- enabled: true,
22646
- lifecycle: "active",
22647
- path: "/admin/users"
22648
- },
22649
- "admin.design-showcase": {
22650
- id: "admin.design-showcase",
22651
- order: 390,
22652
- label: "Design Showcase",
22653
- enabled: true,
22654
- lifecycle: "active",
22655
- path: "/admin/design-showcase"
22656
- },
22657
- "admin.debug": {
22658
- id: "admin.debug",
22659
- order: 400,
22660
- label: "Debug",
22661
- enabled: true,
22662
- lifecycle: "active",
22663
- path: "/admin/debug"
22664
- },
22665
- archive: {
22666
- id: "archive",
22667
- order: 410,
22668
- label: "Archive",
22669
- enabled: true,
22670
- lifecycle: "active",
22671
- path: "/archive",
22672
- icon: "archive",
22673
- devOnly: true
22674
- },
22675
- "archive.agent-chat": {
22676
- id: "archive.agent-chat",
22677
- order: 420,
22678
- label: "Agent Chat",
22679
- enabled: true,
22680
- lifecycle: "active",
22681
- path: "/archive/agent-chat"
22682
- },
22683
- "archive.execution-runner": {
22684
- id: "archive.execution-runner",
22685
- order: 430,
22686
- label: "Execution Runner",
22687
- enabled: true,
22688
- lifecycle: "active",
22689
- path: "/archive/execution-runner"
22690
- },
22691
- seo: {
22692
- id: "seo",
22693
- order: 440,
22694
- label: "SEO",
22695
- enabled: false,
22696
- lifecycle: "deprecated",
22697
- path: "/seo"
22698
- },
22699
- knowledge: {
22700
- id: "knowledge",
22701
- order: 450,
22702
- label: "Knowledge",
22703
- description: "Operational knowledge, playbooks, and strategy docs",
22704
- enabled: true,
22705
- lifecycle: "active",
22706
- color: "teal",
22707
- icon: "knowledge"
22708
- },
22709
- "knowledge.base": {
22710
- id: "knowledge.base",
22711
- order: 460,
22712
- label: "Knowledge Base",
22713
- enabled: true,
22714
- lifecycle: "active",
22715
- path: "/knowledge"
22716
- }
22717
- },
21606
+ // Generic empty systems map. Elevasis-specific systems (platform, sales, sales.crm,
21607
+ // sales.lead-gen, monitoring, settings, admin, etc.) have been relocated to
21608
+ // `@repo/elevasis-core/src/organization-model/systems.ts` via `canonicalOrganizationModel`.
21609
+ // Tenant OM configs supply their own systems via `resolveOrganizationModel`.
21610
+ systems: {},
22718
21611
  ontology: DEFAULT_ONTOLOGY_SCOPE,
22719
21612
  resources: DEFAULT_ORGANIZATION_MODEL_RESOURCES,
22720
21613
  topology: DEFAULT_ORGANIZATION_MODEL_TOPOLOGY,
22721
- actions: DEFAULT_ORGANIZATION_MODEL_ACTIONS,
21614
+ // Generic empty actions map. Elevasis-specific action entries have been relocated to
21615
+ // `@repo/elevasis-core/src/organization-model/actions.ts`.
21616
+ actions: {},
22722
21617
  entities: DEFAULT_ORGANIZATION_MODEL_ENTITIES2,
22723
21618
  policies: DEFAULT_ORGANIZATION_MODEL_POLICIES,
22724
- // Phase 4 (D1): statuses top-level field removed; bridge status mirrors may
22725
- // still project from System.content, but primary authoring belongs in ontology.
22726
21619
  knowledge: DEFAULT_ORGANIZATION_MODEL_KNOWLEDGE
22727
21620
  };
22728
21621