@elevasis/core 0.24.1 → 0.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 (82) hide show
  1. package/dist/index.d.ts +239 -86
  2. package/dist/index.js +474 -1346
  3. package/dist/knowledge/index.d.ts +57 -39
  4. package/dist/knowledge/index.js +1 -1
  5. package/dist/organization-model/index.d.ts +239 -86
  6. package/dist/organization-model/index.js +474 -1346
  7. package/dist/test-utils/index.d.ts +24 -31
  8. package/dist/test-utils/index.js +76 -1238
  9. package/package.json +1 -1
  10. package/src/_gen/__tests__/__snapshots__/contracts.md.snap +108 -96
  11. package/src/business/acquisition/api-schemas.test.ts +70 -77
  12. package/src/business/acquisition/api-schemas.ts +21 -42
  13. package/src/business/acquisition/derive-actions.test.ts +11 -21
  14. package/src/business/acquisition/derive-actions.ts +61 -14
  15. package/src/business/acquisition/ontology-validation.ts +4 -4
  16. package/src/business/acquisition/types.ts +7 -8
  17. package/src/execution/engine/llm/adapters/__tests__/openrouter.integration.test.ts +10 -10
  18. package/src/knowledge/__tests__/queries.test.ts +960 -546
  19. package/src/knowledge/format.ts +322 -100
  20. package/src/knowledge/index.ts +18 -5
  21. package/src/knowledge/queries.ts +1004 -240
  22. package/src/organization-model/__tests__/content-kinds-registry.test.ts +35 -210
  23. package/src/organization-model/__tests__/defaults.test.ts +4 -4
  24. package/src/organization-model/__tests__/deprecate-helpers.test.ts +71 -0
  25. package/src/organization-model/__tests__/domains/actions.test.ts +12 -36
  26. package/src/organization-model/__tests__/domains/offerings.test.ts +13 -6
  27. package/src/organization-model/__tests__/domains/resources.test.ts +497 -350
  28. package/src/organization-model/__tests__/domains/systems.test.ts +6 -7
  29. package/src/organization-model/__tests__/flatten-additive-merge.test.ts +68 -80
  30. package/src/organization-model/__tests__/foundation.test.ts +81 -14
  31. package/src/organization-model/__tests__/graph.test.ts +662 -694
  32. package/src/organization-model/__tests__/knowledge.test.ts +31 -17
  33. package/src/organization-model/__tests__/lookup-helpers.test.ts +128 -438
  34. package/src/organization-model/__tests__/migration-helpers.test.ts +362 -591
  35. package/src/organization-model/__tests__/prospecting-ssot.test.ts +68 -103
  36. package/src/organization-model/__tests__/published-zero-leak.test.ts +17 -0
  37. package/src/organization-model/__tests__/recursive-system-schema.test.ts +159 -532
  38. package/src/organization-model/__tests__/resolve.test.ts +88 -49
  39. package/src/organization-model/__tests__/scaffolders.test.ts +93 -0
  40. package/src/organization-model/__tests__/schema.test.ts +65 -56
  41. package/src/organization-model/catalogs/lead-gen.ts +0 -103
  42. package/src/organization-model/defaults.ts +17 -702
  43. package/src/organization-model/domains/actions.ts +116 -333
  44. package/src/organization-model/domains/knowledge.ts +15 -7
  45. package/src/organization-model/domains/projects.ts +4 -4
  46. package/src/organization-model/domains/prospecting.ts +405 -395
  47. package/src/organization-model/domains/resources.ts +206 -135
  48. package/src/organization-model/domains/sales.ts +5 -5
  49. package/src/organization-model/domains/systems.ts +8 -23
  50. package/src/organization-model/graph/build.ts +223 -294
  51. package/src/organization-model/graph/schema.ts +2 -3
  52. package/src/organization-model/graph/types.ts +12 -14
  53. package/src/organization-model/helpers.ts +120 -141
  54. package/src/organization-model/icons.ts +1 -0
  55. package/src/organization-model/index.ts +107 -126
  56. package/src/organization-model/migration-helpers.ts +211 -249
  57. package/src/organization-model/ontology.ts +0 -60
  58. package/src/organization-model/organization-graph.mdx +4 -5
  59. package/src/organization-model/organization-model.mdx +1 -1
  60. package/src/organization-model/published.ts +251 -228
  61. package/src/organization-model/resolve.ts +4 -5
  62. package/src/organization-model/scaffolders/helpers.ts +84 -0
  63. package/src/organization-model/scaffolders/index.ts +19 -0
  64. package/src/organization-model/scaffolders/scaffoldKnowledgeNode.ts +48 -0
  65. package/src/organization-model/scaffolders/scaffoldOntologyRecord.ts +38 -0
  66. package/src/organization-model/scaffolders/scaffoldResource.ts +59 -0
  67. package/src/organization-model/scaffolders/scaffoldSystem.ts +110 -0
  68. package/src/organization-model/scaffolders/types.ts +81 -0
  69. package/src/organization-model/schema.ts +610 -704
  70. package/src/organization-model/types.ts +167 -161
  71. package/src/platform/constants/versions.ts +1 -1
  72. package/src/platform/registry/__tests__/validation.test.ts +23 -0
  73. package/src/platform/registry/validation.ts +13 -2
  74. package/src/reference/_generated/contracts.md +108 -96
  75. package/src/reference/glossary.md +71 -69
  76. package/src/organization-model/content-kinds/config.ts +0 -36
  77. package/src/organization-model/content-kinds/index.ts +0 -78
  78. package/src/organization-model/content-kinds/pipeline.ts +0 -68
  79. package/src/organization-model/content-kinds/registry.ts +0 -44
  80. package/src/organization-model/content-kinds/status.ts +0 -71
  81. package/src/organization-model/content-kinds/template.ts +0 -83
  82. 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",
@@ -19995,6 +19776,7 @@ var ORGANIZATION_MODEL_ICON_TOKENS = [
19995
19776
  "crm",
19996
19777
  "lead-gen",
19997
19778
  "projects",
19779
+ "clients",
19998
19780
  "operations",
19999
19781
  "monitoring",
20000
19782
  "knowledge",
@@ -20528,226 +20310,7 @@ var ActionSchema = z.object({
20528
20310
  var ActionsDomainSchema = z.record(z.string(), ActionSchema).refine((record) => Object.entries(record).every(([key, entry]) => entry.id === key), {
20529
20311
  message: "Each action entry id must match its map key"
20530
20312
  }).default({});
20531
- var LEAD_GEN_ACTION_ENTRY_INPUTS = [
20532
- {
20533
- id: "lead-gen.company.source",
20534
- order: 10,
20535
- label: "Source companies",
20536
- description: "Import source companies from a list provider.",
20537
- scope: { domain: "sales" },
20538
- resourceId: "lgn-import-workflow",
20539
- invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/companies/source" }]
20540
- },
20541
- {
20542
- id: "lead-gen.company.apollo-import",
20543
- order: 20,
20544
- label: "Import from Apollo",
20545
- description: "Pull companies and seed contact data from an Apollo search or list.",
20546
- scope: { domain: "sales" },
20547
- resourceId: "lgn-01c-apollo-import-workflow",
20548
- invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/companies/apollo-import" }]
20549
- },
20550
- {
20551
- id: "lead-gen.contact.discover",
20552
- order: 30,
20553
- label: "Discover contact emails",
20554
- description: "Find email addresses for contacts at qualified companies.",
20555
- scope: { domain: "sales" },
20556
- resourceId: "lgn-04-email-discovery-workflow",
20557
- invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/contacts/discover" }]
20558
- },
20559
- {
20560
- id: "lead-gen.contact.verify-email",
20561
- order: 40,
20562
- label: "Verify emails",
20563
- description: "Check email deliverability before outreach.",
20564
- scope: { domain: "sales" },
20565
- resourceId: "lgn-05-email-verification-workflow",
20566
- invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/contacts/verify-email" }]
20567
- },
20568
- {
20569
- id: "lead-gen.company.apify-crawl",
20570
- order: 50,
20571
- label: "Crawl websites",
20572
- description: "Crawl company websites via Apify and store raw page markdown in enrichmentData.websiteCrawl.pages for downstream LLM analysis.",
20573
- scope: { domain: "sales" },
20574
- resourceId: "lgn-02a-apify-website-crawl-workflow",
20575
- invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/companies/apify-crawl" }]
20576
- },
20577
- {
20578
- id: "lead-gen.company.website-extract",
20579
- order: 60,
20580
- label: "Extract website signals",
20581
- description: "Scrape and analyze company websites for qualification signals.",
20582
- scope: { domain: "sales" },
20583
- resourceId: "lgn-02-website-extract-workflow",
20584
- invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/companies/website-extract" }]
20585
- },
20586
- {
20587
- id: "lead-gen.company.qualify",
20588
- order: 70,
20589
- label: "Qualify companies",
20590
- description: "Score and filter companies against the ICP rubric.",
20591
- scope: { domain: "sales" },
20592
- resourceId: "lgn-03-company-qualification-workflow",
20593
- invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/companies/qualify" }]
20594
- },
20595
- {
20596
- id: "lead-gen.company.dtc-subscription-qualify",
20597
- order: 80,
20598
- label: "Qualify DTC subscription fit",
20599
- description: "Classify subscription potential and consumable-product fit for DTC brands.",
20600
- scope: { domain: "sales" },
20601
- resourceId: "lgn-03b-dtc-subscription-score-workflow",
20602
- invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/companies/dtc-subscription-qualify" }]
20603
- },
20604
- {
20605
- id: "lead-gen.contact.apollo-decision-maker-enrich",
20606
- order: 90,
20607
- label: "Enrich decision-makers",
20608
- description: "Find and enrich qualified contacts at qualified companies via Apollo.",
20609
- scope: { domain: "sales" },
20610
- resourceId: "lgn-04b-apollo-decision-maker-enrich-workflow",
20611
- invocations: [
20612
- { kind: "api-endpoint", method: "POST", path: "/api/prospecting/contacts/apollo-decision-maker-enrich" }
20613
- ]
20614
- },
20615
- {
20616
- id: "lead-gen.contact.personalize",
20617
- order: 100,
20618
- label: "Personalize outreach",
20619
- description: "Generate personalized opening lines for each contact.",
20620
- scope: { domain: "sales" },
20621
- resourceId: "ist-personalization-workflow",
20622
- invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/contacts/personalize" }]
20623
- },
20624
- {
20625
- id: "lead-gen.review.outreach-ready",
20626
- order: 110,
20627
- label: "Upload to outreach",
20628
- description: "Upload approved contacts to the outreach sequence after QC review.",
20629
- scope: { domain: "sales" },
20630
- resourceId: "ist-upload-contacts-workflow",
20631
- invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/review/outreach-ready" }]
20632
- },
20633
- {
20634
- id: "lead-gen.export.list",
20635
- order: 120,
20636
- label: "Export lead list",
20637
- description: "Export approved leads as a downloadable lead list.",
20638
- scope: { domain: "sales" },
20639
- resourceId: "lgn-06-export-list-workflow",
20640
- invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/export/list" }]
20641
- },
20642
- {
20643
- id: "lead-gen.company.cleanup",
20644
- order: 130,
20645
- label: "Clean up companies",
20646
- description: "Remove disqualified or duplicate companies from the list.",
20647
- scope: { domain: "sales" },
20648
- resourceId: "lgn-company-cleanup-workflow",
20649
- invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/companies/cleanup" }]
20650
- }
20651
- ];
20652
- var LEAD_GEN_ACTION_ENTRIES = Object.fromEntries(
20653
- LEAD_GEN_ACTION_ENTRY_INPUTS.map((action) => {
20654
- const parsed = ActionSchema.parse(action);
20655
- return [parsed.id, parsed];
20656
- })
20657
- );
20658
- var CRM_ACTION_ENTRY_INPUTS = [
20659
- {
20660
- id: "send_reply",
20661
- order: 210,
20662
- label: "Send Reply",
20663
- description: "Send a contextual reply for an active CRM deal.",
20664
- scope: { domain: "sales" },
20665
- resourceId: "crm-send-reply-workflow",
20666
- affects: ["crm.deal"]
20667
- },
20668
- {
20669
- id: "send_link",
20670
- order: 220,
20671
- label: "Send Booking Link",
20672
- description: "Send a booking link to move a deal toward a scheduled call.",
20673
- scope: { domain: "sales" },
20674
- resourceId: "crm-send-booking-link-workflow",
20675
- affects: ["crm.deal"]
20676
- },
20677
- {
20678
- id: "send_nudge",
20679
- order: 230,
20680
- label: "Send Nudge",
20681
- description: "Send a follow-up nudge for a stalled CRM deal.",
20682
- scope: { domain: "sales" },
20683
- resourceId: "crm-send-nudge-workflow",
20684
- affects: ["crm.deal"]
20685
- },
20686
- {
20687
- id: "rebook",
20688
- order: 240,
20689
- label: "Rebook",
20690
- description: "Rebook a missed or rescheduled CRM appointment.",
20691
- scope: { domain: "sales" },
20692
- resourceId: "crm-rebook-workflow",
20693
- affects: ["crm.deal"]
20694
- },
20695
- {
20696
- id: "move_to_proposal",
20697
- order: 250,
20698
- label: "Move to Proposal",
20699
- description: "Advance a qualified CRM deal into the proposal stage.",
20700
- scope: { domain: "sales" },
20701
- resourceId: "move_to_proposal-workflow",
20702
- affects: ["crm.deal"]
20703
- },
20704
- {
20705
- id: "move_to_closing",
20706
- order: 260,
20707
- label: "Move to Closing",
20708
- description: "Advance a proposal-stage CRM deal into closing.",
20709
- scope: { domain: "sales" },
20710
- resourceId: "move_to_closing-workflow",
20711
- affects: ["crm.deal"]
20712
- },
20713
- {
20714
- id: "move_to_closed_won",
20715
- order: 270,
20716
- label: "Close Won",
20717
- description: "Mark a CRM deal as closed won.",
20718
- scope: { domain: "sales" },
20719
- resourceId: "move_to_closed_won-workflow",
20720
- affects: ["crm.deal"]
20721
- },
20722
- {
20723
- id: "move_to_closed_lost",
20724
- order: 280,
20725
- label: "Close Lost",
20726
- description: "Mark a CRM deal as closed lost.",
20727
- scope: { domain: "sales" },
20728
- resourceId: "move_to_closed_lost-workflow",
20729
- affects: ["crm.deal"]
20730
- },
20731
- {
20732
- id: "move_to_nurturing",
20733
- order: 290,
20734
- label: "Move to Nurturing",
20735
- description: "Move a CRM deal into nurturing for future follow-up.",
20736
- scope: { domain: "sales" },
20737
- resourceId: "move_to_nurturing-workflow",
20738
- affects: ["crm.deal"]
20739
- }
20740
- ];
20741
- var CRM_ACTION_ENTRIES = Object.fromEntries(
20742
- CRM_ACTION_ENTRY_INPUTS.map((action) => {
20743
- const parsed = ActionSchema.parse(action);
20744
- return [parsed.id, parsed];
20745
- })
20746
- );
20747
- var DEFAULT_ORGANIZATION_MODEL_ACTIONS = {
20748
- ...LEAD_GEN_ACTION_ENTRIES,
20749
- ...CRM_ACTION_ENTRIES
20750
- };
20313
+ var DEFAULT_ORGANIZATION_MODEL_ACTIONS = {};
20751
20314
 
20752
20315
  // src/organization-model/domains/systems.ts
20753
20316
  var SystemKindSchema = z.enum(["product", "operational", "platform", "diagnostic"]).meta({ label: "System kind", color: "blue" });
@@ -20761,7 +20324,7 @@ var SystemPathSchema = z.string().trim().min(1).regex(
20761
20324
  var UiPositionSchema = z.enum(["sidebar-primary", "sidebar-bottom"]).meta({ label: "UI position" });
20762
20325
  var NodeIdStringSchema = z.string().trim().min(1).max(200).regex(
20763
20326
  /^[a-z][a-z-]*:([a-z0-9-]+)(\.[a-z0-9-]+)*(:[a-z0-9.-]+)*$/,
20764
- "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)"
20765
20328
  );
20766
20329
  var SystemUiSchema = z.object({
20767
20330
  path: PathSchema,
@@ -20835,13 +20398,6 @@ var SystemEntrySchema = z.object({
20835
20398
  * shared contract records owned by this system.
20836
20399
  */
20837
20400
  ontology: OntologyScopeSchema.optional(),
20838
- /**
20839
- * @deprecated Compatibility-only bridge for old tenant content nodes and
20840
- * migration readers. New schema/catalog authoring belongs in ontology;
20841
- * new system-local settings belong in config. Bridge nodes are keyed by
20842
- * local NodeId and may still project to content-node:* graph IDs.
20843
- */
20844
- content: z.record(z.string().trim().min(1).max(200), ContentNodeSchema).optional(),
20845
20401
  /**
20846
20402
  * Recursive child systems, authored via nesting (per L11).
20847
20403
  * The key is the local system id; the full path is computed by joining
@@ -20852,7 +20408,7 @@ var SystemEntrySchema = z.object({
20852
20408
  systems: z.lazy(() => z.record(z.string().trim().min(1).max(100), SystemEntrySchema)).optional(),
20853
20409
  /** @deprecated Use systems. Accepted as a compatibility alias during the ontology bridge. */
20854
20410
  subsystems: z.lazy(() => z.record(z.string().trim().min(1).max(100), SystemEntrySchema)).optional()
20855
- }).refine((system) => system.label !== void 0 || system.title !== void 0, {
20411
+ }).strict().refine((system) => system.label !== void 0 || system.title !== void 0, {
20856
20412
  path: ["label"],
20857
20413
  message: "System must provide label or title"
20858
20414
  }).transform((system) => {
@@ -20867,6 +20423,10 @@ var SystemsDomainSchema = z.record(z.string(), SystemEntrySchema).refine((record
20867
20423
  var DEFAULT_ORGANIZATION_MODEL_SYSTEMS = {};
20868
20424
 
20869
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
+ );
20870
20430
  z.enum(["workflow", "agent", "integration", "script"]).meta({ label: "Resource kind", color: "orange" });
20871
20431
  var ResourceGovernanceStatusSchema = z.enum(["active", "deprecated", "archived"]).meta({ label: "Governance status", color: "teal" });
20872
20432
  var AgentKindSchema = z.enum(["orchestrator", "specialist", "utility", "platform"]).meta({ label: "Agent kind", color: "violet" });
@@ -20895,7 +20455,20 @@ var ResourceOntologyBindingSchema = z.object({
20895
20455
  reads: z.array(OntologyIdSchema).optional(),
20896
20456
  writes: z.array(OntologyIdSchema).optional(),
20897
20457
  usesCatalogs: z.array(OntologyIdSchema).optional(),
20898
- 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()
20899
20472
  }).superRefine((binding, ctx) => {
20900
20473
  if (binding.primaryAction === void 0) return;
20901
20474
  if (binding.actions?.includes(binding.primaryAction)) return;
@@ -21087,13 +20660,10 @@ var KnowledgeTargetKindSchema = z.enum([
21087
20660
  "goal",
21088
20661
  "customer-segment",
21089
20662
  "offering",
21090
- "ontology",
21091
- // D4: content nodes are a valid knowledge target after compound-domain data moved into system.content
21092
- "content-node"
20663
+ "ontology"
21093
20664
  ]).meta({ label: "Target kind" });
21094
20665
  var KnowledgeTargetRefSchema = z.object({
21095
20666
  kind: KnowledgeTargetKindSchema,
21096
- // D4: content-node targets use a qualified id format '<system-path>:<local-content-id>'.
21097
20667
  // Ontology targets use the canonical '<scope>:<kind>/<local-id>' ontology id format.
21098
20668
  // Business-logic validation of target existence is done in OrganizationModelSchema.superRefine.
21099
20669
  id: z.string().trim().min(1).max(300)
@@ -21110,6 +20680,15 @@ var KnowledgeTargetRefSchema = z.object({
21110
20680
  });
21111
20681
  var LegacyKnowledgeLinkSchema = z.object({
21112
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
+ }
21113
20692
  });
21114
20693
  var CanonicalKnowledgeLinkSchema = z.object({
21115
20694
  target: KnowledgeTargetRefSchema
@@ -21413,7 +20992,10 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
21413
20992
  const childSystems = system.systems ?? system.subsystems;
21414
20993
  if (childSystems !== void 0) {
21415
20994
  result.push(
21416
- ...collectAllSystems(childSystems, path, [...currentSchemaPath, system.systems !== void 0 ? "systems" : "subsystems"])
20995
+ ...collectAllSystems(childSystems, path, [
20996
+ ...currentSchemaPath,
20997
+ system.systems !== void 0 ? "systems" : "subsystems"
20998
+ ])
21417
20999
  );
21418
21000
  }
21419
21001
  }
@@ -21434,7 +21016,9 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
21434
21016
  `System "${system.id}" references unknown parent "${system.parentSystemId}"`
21435
21017
  );
21436
21018
  }
21437
- const hasChildren = Object.keys(system.systems ?? system.subsystems ?? {}).length > 0 || allSystems.some((candidate) => candidate.path.startsWith(`${path}.`) && !candidate.path.slice(path.length + 1).includes("."));
21019
+ const hasChildren = Object.keys(system.systems ?? system.subsystems ?? {}).length > 0 || allSystems.some(
21020
+ (candidate) => candidate.path.startsWith(`${path}.`) && !candidate.path.slice(path.length + 1).includes(".")
21021
+ );
21438
21022
  const contributesRoutePath = system.ui?.path !== void 0 || system.path !== void 0 || !hasChildren;
21439
21023
  if (contributesRoutePath) {
21440
21024
  const effectivePath = system.ui?.path ?? system.path ?? defaultSystemPathFor(path);
@@ -21456,11 +21040,7 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
21456
21040
  (candidate) => candidate.path.startsWith(`${path}.`) && !candidate.path.slice(path.length + 1).includes(".") && isLifecycleEnabled(candidate.system.lifecycle, candidate.system.enabled)
21457
21041
  );
21458
21042
  if (!hasEnabledDescendant) {
21459
- addIssue(
21460
- ctx,
21461
- [...schemaPath, "lifecycle"],
21462
- `System "${path}" is active but has no active descendants`
21463
- );
21043
+ addIssue(ctx, [...schemaPath, "lifecycle"], `System "${path}" is active but has no active descendants`);
21464
21044
  }
21465
21045
  }
21466
21046
  });
@@ -21692,10 +21272,16 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
21692
21272
  }
21693
21273
  });
21694
21274
  });
21695
- const stageIds = /* @__PURE__ */ new Set();
21696
21275
  const actionIds = new Set(Object.keys(model.actions));
21697
21276
  const offeringsById = new Map(Object.entries(model.offerings));
21698
21277
  const ontologyCompilation = compileOrganizationOntology(model);
21278
+ const stageIds = /* @__PURE__ */ new Set();
21279
+ for (const catalog of Object.values(ontologyCompilation.ontology.catalogTypes)) {
21280
+ if (catalog.kind !== "stage") continue;
21281
+ for (const stageId of Object.keys(catalog.entries ?? {})) {
21282
+ stageIds.add(stageId);
21283
+ }
21284
+ }
21699
21285
  const ontologyIndexByKind = {
21700
21286
  object: ontologyCompilation.ontology.objectTypes,
21701
21287
  link: ontologyCompilation.ontology.linkTypes,
@@ -21871,13 +21457,7 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
21871
21457
  if (ontologyIndexByKind[expectedKind][ontologyId] === void 0) {
21872
21458
  addIssue(
21873
21459
  ctx,
21874
- [
21875
- "resources",
21876
- resourceId,
21877
- "ontology",
21878
- bindingKey,
21879
- ...Array.isArray(ids) ? [ontologyIndex] : []
21880
- ],
21460
+ ["resources", resourceId, "ontology", bindingKey, ...Array.isArray(ids) ? [ontologyIndex] : []],
21881
21461
  `Resource "${resourceId}" ontology binding "${bindingKey}" references unknown ${expectedKind} ontology ID "${ontologyId}"`
21882
21462
  );
21883
21463
  }
@@ -21892,6 +21472,23 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
21892
21472
  validateResourceOntologyBinding(resource.id, "writes", "object", binding.writes);
21893
21473
  validateResourceOntologyBinding(resource.id, "usesCatalogs", "catalog", binding.usesCatalogs);
21894
21474
  validateResourceOntologyBinding(resource.id, "emits", "event", binding.emits);
21475
+ if (binding.contract !== void 0) {
21476
+ const contractEntries = [
21477
+ ["input", binding.contract.input],
21478
+ ["output", binding.contract.output]
21479
+ ];
21480
+ for (const [side, ref] of contractEntries) {
21481
+ if (ref === void 0) continue;
21482
+ const result = ContractRefSchema.safeParse(ref);
21483
+ if (!result.success) {
21484
+ addIssue(
21485
+ ctx,
21486
+ ["resources", resource.id, "ontology", "contract", side],
21487
+ `Resource "${resource.id}" contract.${side} "${ref}" is not a valid ContractRef (expected "package/subpath#ExportName")`
21488
+ );
21489
+ }
21490
+ }
21491
+ }
21895
21492
  });
21896
21493
  Object.values(model.roles).forEach((role) => {
21897
21494
  if (role.heldBy === void 0) return;
@@ -21926,78 +21523,6 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
21926
21523
  }
21927
21524
  });
21928
21525
  });
21929
- function validateSystemContent(system, systemPath) {
21930
- const childSystems = system.systems ?? system.subsystems;
21931
- const childKey = system.systems !== void 0 ? "systems" : "subsystems";
21932
- const content = system.content;
21933
- if (content === void 0 || Object.keys(content).length === 0) {
21934
- if (childSystems !== void 0) {
21935
- Object.entries(childSystems).forEach(([childLocalId, child]) => {
21936
- validateSystemContent(child, [...systemPath, childKey, childLocalId]);
21937
- });
21938
- }
21939
- return;
21940
- }
21941
- Object.entries(content).forEach(([localId, node]) => {
21942
- if (node.parentContentId !== void 0 && !(node.parentContentId in content)) {
21943
- addIssue(
21944
- ctx,
21945
- [...systemPath, "content", localId, "parentContentId"],
21946
- `Content node "${localId}" parentContentId "${node.parentContentId}" does not resolve within the same system`
21947
- );
21948
- }
21949
- });
21950
- Object.entries(content).forEach(([localId, node]) => {
21951
- const visited = /* @__PURE__ */ new Set();
21952
- let currentId = node.parentContentId;
21953
- while (currentId !== void 0) {
21954
- if (currentId === localId || visited.has(currentId)) {
21955
- addIssue(
21956
- ctx,
21957
- [...systemPath, "content", localId, "parentContentId"],
21958
- `Content node "${localId}" has a parentContentId cycle`
21959
- );
21960
- break;
21961
- }
21962
- visited.add(currentId);
21963
- currentId = content[currentId]?.parentContentId;
21964
- }
21965
- });
21966
- Object.entries(content).forEach(([localId, node]) => {
21967
- const childDef = lookupContentType(node.kind, node.type);
21968
- if (childDef !== void 0 && node.data !== void 0) {
21969
- const result = childDef.payloadSchema.safeParse(node.data);
21970
- if (!result.success) {
21971
- addIssue(
21972
- ctx,
21973
- [...systemPath, "content", localId, "data"],
21974
- `Content node "${localId}" (${node.kind}:${node.type}) data failed payload validation: ${result.error.message}`
21975
- );
21976
- }
21977
- }
21978
- if (node.parentContentId !== void 0 && childDef !== void 0) {
21979
- const parentNode = content[node.parentContentId];
21980
- if (parentNode !== void 0) {
21981
- const parentDef = lookupContentType(parentNode.kind, parentNode.type);
21982
- if (parentDef !== void 0 && childDef.kind !== parentDef.kind) {
21983
- addIssue(
21984
- ctx,
21985
- [...systemPath, "content", localId, "parentContentId"],
21986
- `Content node "${localId}" kind "${childDef.kind}" cannot parent under "${node.parentContentId}" kind "${parentDef.kind}": parentContentId must be same-meta-kind (per L19)`
21987
- );
21988
- }
21989
- }
21990
- }
21991
- });
21992
- if (childSystems !== void 0) {
21993
- Object.entries(childSystems).forEach(([childLocalId, child]) => {
21994
- validateSystemContent(child, [...systemPath, childKey, childLocalId]);
21995
- });
21996
- }
21997
- }
21998
- Object.entries(model.systems).forEach(([systemKey, system]) => {
21999
- validateSystemContent(system, ["systems", systemKey]);
22000
- });
22001
21526
  for (const diagnostic of ontologyCompilation.diagnostics) {
22002
21527
  addIssue(ctx, diagnostic.path, diagnostic.message);
22003
21528
  }
@@ -22005,311 +21530,11 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
22005
21530
 
22006
21531
  // src/organization-model/defaults.ts
22007
21532
  var DEFAULT_ORGANIZATION_MODEL_KNOWLEDGE = {};
22008
- var DEFAULT_ORGANIZATION_MODEL_ENTITIES2 = DEFAULT_ORGANIZATION_MODEL_ENTITIES;
21533
+ var DEFAULT_ORGANIZATION_MODEL_ENTITIES2 = {};
22009
21534
  var DEFAULT_ORGANIZATION_MODEL_NAVIGATION = {
22010
21535
  sidebar: {
22011
- primary: {
22012
- dashboard: {
22013
- type: "surface",
22014
- label: "Dashboard",
22015
- path: "/",
22016
- surfaceType: "dashboard",
22017
- icon: "dashboard",
22018
- order: 10,
22019
- targets: { systems: ["dashboard"] }
22020
- },
22021
- business: {
22022
- type: "group",
22023
- label: "Business",
22024
- icon: "business",
22025
- order: 20,
22026
- children: {
22027
- sales: {
22028
- type: "surface",
22029
- label: "Sales",
22030
- path: "/sales",
22031
- surfaceType: "page",
22032
- icon: "sales",
22033
- order: 10,
22034
- targets: { systems: ["sales"] }
22035
- },
22036
- clients: {
22037
- type: "surface",
22038
- label: "Clients",
22039
- path: "/clients",
22040
- surfaceType: "list",
22041
- icon: "projects",
22042
- order: 20,
22043
- targets: { systems: ["clients"] }
22044
- },
22045
- projects: {
22046
- type: "surface",
22047
- label: "Projects",
22048
- path: "/projects",
22049
- surfaceType: "page",
22050
- icon: "projects",
22051
- order: 30,
22052
- targets: { systems: ["projects"] }
22053
- }
22054
- }
22055
- },
22056
- operations: {
22057
- type: "group",
22058
- label: "Operations",
22059
- icon: "operations",
22060
- order: 30,
22061
- children: {
22062
- "operations-overview": {
22063
- type: "surface",
22064
- label: "Overview",
22065
- path: "/operations",
22066
- surfaceType: "page",
22067
- order: 10,
22068
- targets: { systems: ["operations.overview"] }
22069
- },
22070
- "operations-systems": {
22071
- type: "surface",
22072
- label: "Systems",
22073
- path: "/operations/systems",
22074
- surfaceType: "page",
22075
- order: 20,
22076
- targets: { systems: ["operations"] }
22077
- },
22078
- "operations-resources": {
22079
- type: "surface",
22080
- label: "Resources",
22081
- path: "/operations/resources",
22082
- surfaceType: "list",
22083
- order: 30,
22084
- targets: { systems: ["operations.resources"] }
22085
- },
22086
- "operations-command-queue": {
22087
- type: "surface",
22088
- label: "Command Queue",
22089
- path: "/operations/command-queue",
22090
- surfaceType: "list",
22091
- order: 40,
22092
- targets: { systems: ["operations.command-queue"] }
22093
- },
22094
- "operations-task-scheduler": {
22095
- type: "surface",
22096
- label: "Task Scheduler",
22097
- path: "/operations/task-scheduler",
22098
- surfaceType: "list",
22099
- order: 50,
22100
- targets: { systems: ["operations.task-scheduler"] }
22101
- }
22102
- }
22103
- },
22104
- monitoring: {
22105
- type: "group",
22106
- label: "Monitoring",
22107
- icon: "monitoring",
22108
- order: 40,
22109
- children: {
22110
- "monitoring-overview": {
22111
- type: "surface",
22112
- label: "Overview",
22113
- path: "/monitoring",
22114
- surfaceType: "page",
22115
- order: 10,
22116
- targets: { systems: ["monitoring"] }
22117
- },
22118
- "monitoring-calendar": {
22119
- type: "surface",
22120
- label: "Calendar",
22121
- path: "/monitoring/calendar",
22122
- surfaceType: "page",
22123
- order: 20,
22124
- targets: { systems: ["monitoring.calendar"] }
22125
- },
22126
- "monitoring-activity-log": {
22127
- type: "surface",
22128
- label: "Activity Log",
22129
- path: "/monitoring/activity-log",
22130
- surfaceType: "list",
22131
- order: 30,
22132
- targets: { systems: ["monitoring.activity-log"] }
22133
- },
22134
- "monitoring-execution-logs": {
22135
- type: "surface",
22136
- label: "Execution Logs",
22137
- path: "/monitoring/execution-logs",
22138
- surfaceType: "list",
22139
- order: 40,
22140
- targets: { systems: ["monitoring.execution-logs"] }
22141
- },
22142
- "monitoring-execution-health": {
22143
- type: "surface",
22144
- label: "Execution Health",
22145
- path: "/monitoring/execution-health",
22146
- surfaceType: "dashboard",
22147
- order: 50,
22148
- targets: { systems: ["monitoring.execution-health"] }
22149
- },
22150
- "monitoring-notifications": {
22151
- type: "surface",
22152
- label: "Notifications",
22153
- path: "/monitoring/notifications",
22154
- surfaceType: "list",
22155
- order: 60,
22156
- targets: { systems: ["monitoring.notifications"] }
22157
- },
22158
- "monitoring-requests": {
22159
- type: "surface",
22160
- label: "Requests",
22161
- path: "/monitoring/requests",
22162
- surfaceType: "list",
22163
- order: 70,
22164
- targets: { systems: ["monitoring.submitted-requests"] }
22165
- }
22166
- }
22167
- },
22168
- knowledge: {
22169
- type: "surface",
22170
- label: "Knowledge Base",
22171
- path: "/knowledge",
22172
- surfaceType: "page",
22173
- icon: "knowledge",
22174
- order: 50
22175
- }
22176
- },
22177
- bottom: {
22178
- settings: {
22179
- type: "group",
22180
- label: "Settings",
22181
- icon: "settings",
22182
- order: 10,
22183
- children: {
22184
- "settings-account": {
22185
- type: "surface",
22186
- label: "Account",
22187
- path: "/settings/account",
22188
- surfaceType: "settings",
22189
- order: 10,
22190
- targets: { systems: ["settings.account"] }
22191
- },
22192
- "settings-appearance": {
22193
- type: "surface",
22194
- label: "Appearance",
22195
- path: "/settings/appearance",
22196
- surfaceType: "settings",
22197
- order: 20,
22198
- targets: { systems: ["settings.appearance"] }
22199
- },
22200
- "settings-roles": {
22201
- type: "surface",
22202
- label: "My Roles",
22203
- path: "/settings/roles",
22204
- surfaceType: "settings",
22205
- order: 30,
22206
- targets: { systems: ["settings.roles"] }
22207
- },
22208
- "settings-organization": {
22209
- type: "surface",
22210
- label: "Organization",
22211
- path: "/settings/organization",
22212
- surfaceType: "settings",
22213
- order: 40,
22214
- targets: { systems: ["settings.organization"] }
22215
- },
22216
- "settings-credentials": {
22217
- type: "surface",
22218
- label: "Credentials",
22219
- path: "/settings/credentials",
22220
- surfaceType: "settings",
22221
- order: 50,
22222
- targets: { systems: ["settings.credentials"] }
22223
- },
22224
- "settings-api-keys": {
22225
- type: "surface",
22226
- label: "API Keys",
22227
- path: "/settings/api-keys",
22228
- surfaceType: "settings",
22229
- order: 60,
22230
- targets: { systems: ["settings.api-keys"] }
22231
- },
22232
- "settings-webhooks": {
22233
- type: "surface",
22234
- label: "Webhooks",
22235
- path: "/settings/webhooks",
22236
- surfaceType: "settings",
22237
- order: 70,
22238
- targets: { systems: ["settings.webhooks"] }
22239
- },
22240
- "settings-deployments": {
22241
- type: "surface",
22242
- label: "Deployments",
22243
- path: "/settings/deployments",
22244
- surfaceType: "settings",
22245
- order: 80,
22246
- targets: { systems: ["settings.deployments"] }
22247
- }
22248
- }
22249
- },
22250
- admin: {
22251
- type: "group",
22252
- label: "Admin",
22253
- icon: "admin",
22254
- order: 20,
22255
- children: {
22256
- "admin-dashboard": {
22257
- type: "surface",
22258
- label: "Dashboard",
22259
- path: "/admin/dashboard",
22260
- surfaceType: "dashboard",
22261
- order: 10,
22262
- targets: { systems: ["admin"] },
22263
- requiresAdmin: true
22264
- },
22265
- "admin-system-health": {
22266
- type: "surface",
22267
- label: "System Health",
22268
- path: "/admin/system-health",
22269
- surfaceType: "dashboard",
22270
- order: 20,
22271
- targets: { systems: ["admin.system-health"] },
22272
- requiresAdmin: true
22273
- },
22274
- "admin-organizations": {
22275
- type: "surface",
22276
- label: "Organizations",
22277
- path: "/admin/organizations",
22278
- surfaceType: "list",
22279
- order: 30,
22280
- targets: { systems: ["admin.organizations"] },
22281
- requiresAdmin: true
22282
- },
22283
- "admin-users": {
22284
- type: "surface",
22285
- label: "Users",
22286
- path: "/admin/users",
22287
- surfaceType: "list",
22288
- order: 40,
22289
- targets: { systems: ["admin.users"] },
22290
- requiresAdmin: true
22291
- },
22292
- "admin-design-showcase": {
22293
- type: "surface",
22294
- label: "Design Showcase",
22295
- path: "/admin/design-showcase",
22296
- surfaceType: "page",
22297
- order: 50,
22298
- targets: { systems: ["admin.design-showcase"] },
22299
- requiresAdmin: true
22300
- },
22301
- "admin-debug": {
22302
- type: "surface",
22303
- label: "Debug",
22304
- path: "/admin/debug",
22305
- surfaceType: "page",
22306
- order: 60,
22307
- targets: { systems: ["admin.debug"] },
22308
- requiresAdmin: true
22309
- }
22310
- }
22311
- }
22312
- }
21536
+ primary: {},
21537
+ bottom: {}
22313
21538
  }
22314
21539
  };
22315
21540
  var DEFAULT_ORGANIZATION_MODEL = {
@@ -22322,406 +21547,19 @@ var DEFAULT_ORGANIZATION_MODEL = {
22322
21547
  offerings: DEFAULT_ORGANIZATION_MODEL_OFFERINGS,
22323
21548
  roles: DEFAULT_ORGANIZATION_MODEL_ROLES,
22324
21549
  goals: DEFAULT_ORGANIZATION_MODEL_GOALS,
22325
- systems: {
22326
- dashboard: {
22327
- id: "dashboard",
22328
- order: 10,
22329
- label: "Dashboard",
22330
- enabled: true,
22331
- lifecycle: "active",
22332
- path: "/",
22333
- icon: "dashboard"
22334
- },
22335
- platform: {
22336
- id: "platform",
22337
- order: 30,
22338
- label: "Platform",
22339
- description: "Elevasis platform architecture, capabilities, and implementation patterns",
22340
- enabled: true,
22341
- lifecycle: "active",
22342
- color: "cyan",
22343
- icon: "platform"
22344
- },
22345
- finance: {
22346
- id: "finance",
22347
- order: 40,
22348
- label: "Finance",
22349
- description: "Finance operations, accounting, billing, reconciliation, and tax prep",
22350
- enabled: true,
22351
- lifecycle: "active",
22352
- color: "green",
22353
- icon: "finance"
22354
- },
22355
- sales: {
22356
- id: "sales",
22357
- order: 60,
22358
- label: "Sales",
22359
- description: "Revenue workflows and customer acquisition",
22360
- enabled: true,
22361
- lifecycle: "active",
22362
- color: "blue",
22363
- icon: "sales",
22364
- path: "/sales"
22365
- },
22366
- "sales.crm": {
22367
- id: "sales.crm",
22368
- order: 70,
22369
- label: "CRM",
22370
- description: "Relationship pipeline and deal management",
22371
- enabled: true,
22372
- lifecycle: "active",
22373
- actions: Object.values(CRM_ACTION_ENTRIES).map((action) => ({
22374
- actionId: action.id,
22375
- intent: "exposes"
22376
- })),
22377
- color: "blue",
22378
- icon: "crm",
22379
- path: "/crm"
22380
- },
22381
- "sales.lead-gen": {
22382
- id: "sales.lead-gen",
22383
- order: 80,
22384
- label: "Lead Gen",
22385
- description: "Prospecting, qualification, and outreach preparation",
22386
- enabled: true,
22387
- lifecycle: "active",
22388
- actions: Object.values(LEAD_GEN_ACTION_ENTRIES).map((action) => ({
22389
- actionId: action.id,
22390
- intent: "exposes"
22391
- })),
22392
- color: "cyan",
22393
- icon: "lead-gen",
22394
- path: "/lead-gen"
22395
- },
22396
- projects: {
22397
- id: "projects",
22398
- order: 90,
22399
- label: "Projects",
22400
- description: "Projects, milestones, and client work execution",
22401
- enabled: true,
22402
- lifecycle: "active",
22403
- color: "orange",
22404
- icon: "projects",
22405
- path: "/projects"
22406
- },
22407
- clients: {
22408
- id: "clients",
22409
- order: 100,
22410
- label: "Clients",
22411
- description: "Client relationships, accounts, and business context",
22412
- enabled: true,
22413
- lifecycle: "active",
22414
- color: "orange",
22415
- icon: "projects",
22416
- path: "/clients"
22417
- },
22418
- operations: {
22419
- id: "operations",
22420
- order: 110,
22421
- label: "Operations",
22422
- description: "Operational resources, topology, and orchestration visibility",
22423
- enabled: true,
22424
- lifecycle: "active",
22425
- color: "violet",
22426
- icon: "operations"
22427
- },
22428
- "knowledge.command-view": {
22429
- id: "knowledge.command-view",
22430
- order: 120,
22431
- label: "Command View",
22432
- enabled: true,
22433
- lifecycle: "active",
22434
- path: "/knowledge/command-view",
22435
- devOnly: true
22436
- },
22437
- "operations.overview": {
22438
- id: "operations.overview",
22439
- order: 130,
22440
- label: "Overview",
22441
- enabled: true,
22442
- lifecycle: "active",
22443
- path: "/operations"
22444
- },
22445
- "operations.resources": {
22446
- id: "operations.resources",
22447
- order: 140,
22448
- label: "Resources",
22449
- enabled: true,
22450
- lifecycle: "active",
22451
- path: "/operations/resources"
22452
- },
22453
- "operations.command-queue": {
22454
- id: "operations.command-queue",
22455
- order: 150,
22456
- label: "Command Queue",
22457
- enabled: true,
22458
- lifecycle: "active",
22459
- path: "/operations/command-queue"
22460
- },
22461
- "operations.sessions": {
22462
- id: "operations.sessions",
22463
- order: 160,
22464
- label: "Sessions",
22465
- enabled: false,
22466
- lifecycle: "deprecated",
22467
- path: "/operations/sessions"
22468
- },
22469
- "operations.task-scheduler": {
22470
- id: "operations.task-scheduler",
22471
- order: 170,
22472
- label: "Task Scheduler",
22473
- enabled: true,
22474
- lifecycle: "active",
22475
- path: "/operations/task-scheduler"
22476
- },
22477
- monitoring: {
22478
- id: "monitoring",
22479
- order: 180,
22480
- label: "Monitoring",
22481
- enabled: true,
22482
- lifecycle: "active"
22483
- },
22484
- "monitoring.calendar": {
22485
- id: "monitoring.calendar",
22486
- order: 190,
22487
- label: "Calendar",
22488
- description: "Google Calendar events and agenda views",
22489
- enabled: true,
22490
- lifecycle: "active",
22491
- path: "/monitoring/calendar",
22492
- icon: "calendar"
22493
- },
22494
- "monitoring.activity-log": {
22495
- id: "monitoring.activity-log",
22496
- order: 200,
22497
- label: "Activity Log",
22498
- enabled: true,
22499
- lifecycle: "active",
22500
- path: "/monitoring/activity-log"
22501
- },
22502
- "monitoring.execution-logs": {
22503
- id: "monitoring.execution-logs",
22504
- order: 210,
22505
- label: "Execution Logs",
22506
- enabled: true,
22507
- lifecycle: "active",
22508
- path: "/monitoring/execution-logs"
22509
- },
22510
- "monitoring.execution-health": {
22511
- id: "monitoring.execution-health",
22512
- order: 220,
22513
- label: "Execution Health",
22514
- enabled: true,
22515
- lifecycle: "active",
22516
- path: "/monitoring/execution-health"
22517
- },
22518
- "monitoring.cost-analytics": {
22519
- id: "monitoring.cost-analytics",
22520
- order: 230,
22521
- label: "Cost Analytics",
22522
- enabled: false,
22523
- lifecycle: "deprecated",
22524
- path: "/monitoring/cost-analytics"
22525
- },
22526
- "monitoring.notifications": {
22527
- id: "monitoring.notifications",
22528
- order: 240,
22529
- label: "Notifications",
22530
- enabled: true,
22531
- lifecycle: "active",
22532
- path: "/monitoring/notifications"
22533
- },
22534
- "monitoring.submitted-requests": {
22535
- id: "monitoring.submitted-requests",
22536
- order: 250,
22537
- label: "Submitted Requests",
22538
- enabled: true,
22539
- lifecycle: "active",
22540
- path: "/monitoring/requests"
22541
- },
22542
- settings: {
22543
- id: "settings",
22544
- order: 260,
22545
- label: "Settings",
22546
- enabled: true,
22547
- lifecycle: "active",
22548
- icon: "settings"
22549
- },
22550
- "settings.account": {
22551
- id: "settings.account",
22552
- order: 270,
22553
- label: "Account",
22554
- enabled: true,
22555
- lifecycle: "active",
22556
- path: "/settings/account"
22557
- },
22558
- "settings.appearance": {
22559
- id: "settings.appearance",
22560
- order: 280,
22561
- label: "Appearance",
22562
- enabled: true,
22563
- lifecycle: "active",
22564
- path: "/settings/appearance"
22565
- },
22566
- "settings.roles": {
22567
- id: "settings.roles",
22568
- order: 290,
22569
- label: "My Roles",
22570
- enabled: true,
22571
- lifecycle: "active",
22572
- path: "/settings/roles"
22573
- },
22574
- "settings.organization": {
22575
- id: "settings.organization",
22576
- order: 300,
22577
- label: "Organization",
22578
- enabled: true,
22579
- lifecycle: "active",
22580
- path: "/settings/organization"
22581
- },
22582
- "settings.credentials": {
22583
- id: "settings.credentials",
22584
- order: 310,
22585
- label: "Credentials",
22586
- enabled: true,
22587
- lifecycle: "active",
22588
- path: "/settings/credentials"
22589
- },
22590
- "settings.api-keys": {
22591
- id: "settings.api-keys",
22592
- order: 320,
22593
- label: "API Keys",
22594
- enabled: true,
22595
- lifecycle: "active",
22596
- path: "/settings/api-keys"
22597
- },
22598
- "settings.webhooks": {
22599
- id: "settings.webhooks",
22600
- order: 330,
22601
- label: "Webhooks",
22602
- enabled: true,
22603
- lifecycle: "active",
22604
- path: "/settings/webhooks"
22605
- },
22606
- "settings.deployments": {
22607
- id: "settings.deployments",
22608
- order: 340,
22609
- label: "Deployments",
22610
- enabled: true,
22611
- lifecycle: "active",
22612
- path: "/settings/deployments"
22613
- },
22614
- admin: {
22615
- id: "admin",
22616
- order: 350,
22617
- label: "Admin",
22618
- enabled: true,
22619
- lifecycle: "active",
22620
- path: "/admin",
22621
- icon: "admin",
22622
- requiresAdmin: true
22623
- },
22624
- "admin.system-health": {
22625
- id: "admin.system-health",
22626
- order: 360,
22627
- label: "System Health",
22628
- enabled: true,
22629
- lifecycle: "active",
22630
- path: "/admin/system-health"
22631
- },
22632
- "admin.organizations": {
22633
- id: "admin.organizations",
22634
- order: 370,
22635
- label: "Organizations",
22636
- enabled: true,
22637
- lifecycle: "active",
22638
- path: "/admin/organizations"
22639
- },
22640
- "admin.users": {
22641
- id: "admin.users",
22642
- order: 380,
22643
- label: "Users",
22644
- enabled: true,
22645
- lifecycle: "active",
22646
- path: "/admin/users"
22647
- },
22648
- "admin.design-showcase": {
22649
- id: "admin.design-showcase",
22650
- order: 390,
22651
- label: "Design Showcase",
22652
- enabled: true,
22653
- lifecycle: "active",
22654
- path: "/admin/design-showcase"
22655
- },
22656
- "admin.debug": {
22657
- id: "admin.debug",
22658
- order: 400,
22659
- label: "Debug",
22660
- enabled: true,
22661
- lifecycle: "active",
22662
- path: "/admin/debug"
22663
- },
22664
- archive: {
22665
- id: "archive",
22666
- order: 410,
22667
- label: "Archive",
22668
- enabled: true,
22669
- lifecycle: "active",
22670
- path: "/archive",
22671
- icon: "archive",
22672
- devOnly: true
22673
- },
22674
- "archive.agent-chat": {
22675
- id: "archive.agent-chat",
22676
- order: 420,
22677
- label: "Agent Chat",
22678
- enabled: true,
22679
- lifecycle: "active",
22680
- path: "/archive/agent-chat"
22681
- },
22682
- "archive.execution-runner": {
22683
- id: "archive.execution-runner",
22684
- order: 430,
22685
- label: "Execution Runner",
22686
- enabled: true,
22687
- lifecycle: "active",
22688
- path: "/archive/execution-runner"
22689
- },
22690
- seo: {
22691
- id: "seo",
22692
- order: 440,
22693
- label: "SEO",
22694
- enabled: false,
22695
- lifecycle: "deprecated",
22696
- path: "/seo"
22697
- },
22698
- knowledge: {
22699
- id: "knowledge",
22700
- order: 450,
22701
- label: "Knowledge",
22702
- description: "Operational knowledge, playbooks, and strategy docs",
22703
- enabled: true,
22704
- lifecycle: "active",
22705
- color: "teal",
22706
- icon: "knowledge"
22707
- },
22708
- "knowledge.base": {
22709
- id: "knowledge.base",
22710
- order: 460,
22711
- label: "Knowledge Base",
22712
- enabled: true,
22713
- lifecycle: "active",
22714
- path: "/knowledge"
22715
- }
22716
- },
21550
+ // Generic empty systems map. Elevasis-specific systems (platform, sales, sales.crm,
21551
+ // sales.lead-gen, monitoring, settings, admin, etc.) have been relocated to
21552
+ // `@repo/elevasis-core/src/organization-model/systems.ts` via `canonicalOrganizationModel`.
21553
+ // Tenant OM configs supply their own systems via `resolveOrganizationModel`.
21554
+ systems: {},
22717
21555
  ontology: DEFAULT_ONTOLOGY_SCOPE,
22718
21556
  resources: DEFAULT_ORGANIZATION_MODEL_RESOURCES,
22719
21557
  topology: DEFAULT_ORGANIZATION_MODEL_TOPOLOGY,
22720
- actions: DEFAULT_ORGANIZATION_MODEL_ACTIONS,
21558
+ // Generic empty actions map. Elevasis-specific action entries have been relocated to
21559
+ // `@repo/elevasis-core/src/organization-model/actions.ts`.
21560
+ actions: {},
22721
21561
  entities: DEFAULT_ORGANIZATION_MODEL_ENTITIES2,
22722
21562
  policies: DEFAULT_ORGANIZATION_MODEL_POLICIES,
22723
- // Phase 4 (D1): statuses top-level field removed; bridge status mirrors may
22724
- // still project from System.content, but primary authoring belongs in ontology.
22725
21563
  knowledge: DEFAULT_ORGANIZATION_MODEL_KNOWLEDGE
22726
21564
  };
22727
21565