@elevasis/sdk 1.22.1 → 1.24.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 (70) hide show
  1. package/dist/cli.cjs +5738 -6283
  2. package/dist/index.d.ts +187 -242
  3. package/dist/index.js +1830 -2912
  4. package/dist/node/index.d.ts +3722 -2
  5. package/dist/node/index.js +163 -1
  6. package/dist/test-utils/index.d.ts +61 -72
  7. package/dist/test-utils/index.js +240 -1479
  8. package/dist/types/worker/index.d.ts +2 -0
  9. package/dist/types/worker/utils.d.ts +9 -0
  10. package/dist/worker/index.js +261 -1487
  11. package/package.json +5 -4
  12. package/reference/_navigation.md +1 -0
  13. package/reference/claude-config/rules/active-change-index.md +11 -80
  14. package/reference/claude-config/rules/agent-start-here.md +11 -277
  15. package/reference/claude-config/rules/deployment.md +11 -57
  16. package/reference/claude-config/rules/error-handling.md +11 -56
  17. package/reference/claude-config/rules/execution.md +11 -40
  18. package/reference/claude-config/rules/frontend.md +11 -43
  19. package/reference/claude-config/rules/observability.md +11 -31
  20. package/reference/claude-config/rules/operations.md +11 -80
  21. package/reference/claude-config/rules/organization-model.md +7 -115
  22. package/reference/claude-config/rules/organization-os.md +8 -112
  23. package/reference/claude-config/rules/package-taxonomy.md +11 -33
  24. package/reference/claude-config/rules/platform.md +11 -42
  25. package/reference/claude-config/rules/shared-types.md +10 -48
  26. package/reference/claude-config/rules/task-tracking.md +11 -47
  27. package/reference/claude-config/rules/ui.md +11 -200
  28. package/reference/claude-config/rules/vibe.md +11 -235
  29. package/reference/claude-config/skills/om/SKILL.md +324 -0
  30. package/reference/claude-config/skills/{knowledge → om}/operations/customers.md +110 -109
  31. package/reference/claude-config/skills/{knowledge → om}/operations/features.md +77 -76
  32. package/reference/claude-config/skills/{knowledge → om}/operations/goals.md +119 -118
  33. package/reference/claude-config/skills/{knowledge → om}/operations/identity.md +94 -93
  34. package/reference/claude-config/skills/{knowledge → om}/operations/labels.md +94 -94
  35. package/reference/claude-config/skills/{knowledge → om}/operations/offerings.md +110 -109
  36. package/reference/claude-config/skills/{knowledge → om}/operations/roles.md +100 -99
  37. package/reference/claude-config/skills/{knowledge → om}/operations/techStack.md +30 -30
  38. package/reference/claude-config/skills/project/SKILL.md +1088 -1088
  39. package/reference/claude-config/skills/setup/SKILL.md +275 -275
  40. package/reference/claude-config/skills/tutorial/SKILL.md +259 -259
  41. package/reference/claude-config/skills/tutorial/progress-template.md +74 -74
  42. package/reference/claude-config/skills/tutorial/technical.md +1303 -1303
  43. package/reference/claude-config/skills/tutorial/vibe-coder.md +890 -890
  44. package/reference/claude-config/sync-notes/2026-05-04-knowledge-bundle.md +83 -83
  45. package/reference/claude-config/sync-notes/2026-05-15-om-skill-rename-and-write-family.md +52 -0
  46. package/reference/claude-config/sync-notes/2026-05-17-sdk-boundary-consolidation.md +33 -0
  47. package/reference/rules/active-change-index.md +83 -0
  48. package/reference/rules/agent-start-here.md +280 -0
  49. package/reference/rules/deployment.md +60 -0
  50. package/reference/rules/error-handling.md +59 -0
  51. package/reference/rules/execution.md +43 -0
  52. package/reference/rules/frontend.md +46 -0
  53. package/reference/rules/observability.md +34 -0
  54. package/reference/rules/operations.md +85 -0
  55. package/reference/rules/organization-model.md +119 -0
  56. package/reference/rules/organization-os.md +118 -0
  57. package/reference/rules/package-taxonomy.md +36 -0
  58. package/reference/rules/platform.md +45 -0
  59. package/reference/rules/shared-types.md +52 -0
  60. package/reference/rules/task-tracking.md +50 -0
  61. package/reference/rules/ui.md +203 -0
  62. package/reference/rules/vibe.md +238 -0
  63. package/reference/scaffold/core/organization-graph.mdx +4 -5
  64. package/reference/scaffold/core/organization-model.mdx +1 -1
  65. package/reference/scaffold/recipes/query-the-knowledge-graph.md +189 -185
  66. package/reference/scaffold/reference/contracts.md +108 -96
  67. package/reference/scaffold/reference/glossary.md +71 -69
  68. package/reference/claude-config/skills/knowledge/SKILL.md +0 -345
  69. /package/reference/claude-config/skills/{knowledge → om}/operations/codify-level-a.md +0 -0
  70. /package/reference/claude-config/skills/{knowledge → om}/operations/codify-level-b.md +0 -0
@@ -1,5 +1,6 @@
1
1
  import { workerData, parentPort } from 'worker_threads';
2
2
  import { z, ZodError } from 'zod';
3
+ import 'crypto';
3
4
  import { isatty } from 'tty';
4
5
 
5
6
  var __create = Object.create;
@@ -5531,8 +5532,8 @@ async function processMemory(memoryManager, response, logger, iteration) {
5531
5532
  continue;
5532
5533
  }
5533
5534
  const startTime = Date.now();
5534
- const stringValue = typeof content === "string" ? content : JSON.stringify(content);
5535
- memoryManager.set(key, stringValue);
5535
+ const stringValue2 = typeof content === "string" ? content : JSON.stringify(content);
5536
+ memoryManager.set(key, stringValue2);
5536
5537
  const endTime = Date.now();
5537
5538
  logger.action("memory-set", `Set: ${key}`, iteration, startTime, endTime, endTime - startTime);
5538
5539
  }
@@ -6519,6 +6520,7 @@ var ORGANIZATION_MODEL_ICON_TOKENS = [
6519
6520
  "crm",
6520
6521
  "lead-gen",
6521
6522
  "projects",
6523
+ "clients",
6522
6524
  "operations",
6523
6525
  "monitoring",
6524
6526
  "knowledge",
@@ -6818,226 +6820,7 @@ var ActionSchema = z.object({
6818
6820
  var ActionsDomainSchema = z.record(z.string(), ActionSchema).refine((record) => Object.entries(record).every(([key, entry]) => entry.id === key), {
6819
6821
  message: "Each action entry id must match its map key"
6820
6822
  }).default({});
6821
- var LEAD_GEN_ACTION_ENTRY_INPUTS = [
6822
- {
6823
- id: "lead-gen.company.source",
6824
- order: 10,
6825
- label: "Source companies",
6826
- description: "Import source companies from a list provider.",
6827
- scope: { domain: "sales" },
6828
- resourceId: "lgn-import-workflow",
6829
- invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/companies/source" }]
6830
- },
6831
- {
6832
- id: "lead-gen.company.apollo-import",
6833
- order: 20,
6834
- label: "Import from Apollo",
6835
- description: "Pull companies and seed contact data from an Apollo search or list.",
6836
- scope: { domain: "sales" },
6837
- resourceId: "lgn-01c-apollo-import-workflow",
6838
- invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/companies/apollo-import" }]
6839
- },
6840
- {
6841
- id: "lead-gen.contact.discover",
6842
- order: 30,
6843
- label: "Discover contact emails",
6844
- description: "Find email addresses for contacts at qualified companies.",
6845
- scope: { domain: "sales" },
6846
- resourceId: "lgn-04-email-discovery-workflow",
6847
- invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/contacts/discover" }]
6848
- },
6849
- {
6850
- id: "lead-gen.contact.verify-email",
6851
- order: 40,
6852
- label: "Verify emails",
6853
- description: "Check email deliverability before outreach.",
6854
- scope: { domain: "sales" },
6855
- resourceId: "lgn-05-email-verification-workflow",
6856
- invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/contacts/verify-email" }]
6857
- },
6858
- {
6859
- id: "lead-gen.company.apify-crawl",
6860
- order: 50,
6861
- label: "Crawl websites",
6862
- description: "Crawl company websites via Apify and store raw page markdown in enrichmentData.websiteCrawl.pages for downstream LLM analysis.",
6863
- scope: { domain: "sales" },
6864
- resourceId: "lgn-02a-apify-website-crawl-workflow",
6865
- invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/companies/apify-crawl" }]
6866
- },
6867
- {
6868
- id: "lead-gen.company.website-extract",
6869
- order: 60,
6870
- label: "Extract website signals",
6871
- description: "Scrape and analyze company websites for qualification signals.",
6872
- scope: { domain: "sales" },
6873
- resourceId: "lgn-02-website-extract-workflow",
6874
- invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/companies/website-extract" }]
6875
- },
6876
- {
6877
- id: "lead-gen.company.qualify",
6878
- order: 70,
6879
- label: "Qualify companies",
6880
- description: "Score and filter companies against the ICP rubric.",
6881
- scope: { domain: "sales" },
6882
- resourceId: "lgn-03-company-qualification-workflow",
6883
- invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/companies/qualify" }]
6884
- },
6885
- {
6886
- id: "lead-gen.company.dtc-subscription-qualify",
6887
- order: 80,
6888
- label: "Qualify DTC subscription fit",
6889
- description: "Classify subscription potential and consumable-product fit for DTC brands.",
6890
- scope: { domain: "sales" },
6891
- resourceId: "lgn-03b-dtc-subscription-score-workflow",
6892
- invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/companies/dtc-subscription-qualify" }]
6893
- },
6894
- {
6895
- id: "lead-gen.contact.apollo-decision-maker-enrich",
6896
- order: 90,
6897
- label: "Enrich decision-makers",
6898
- description: "Find and enrich qualified contacts at qualified companies via Apollo.",
6899
- scope: { domain: "sales" },
6900
- resourceId: "lgn-04b-apollo-decision-maker-enrich-workflow",
6901
- invocations: [
6902
- { kind: "api-endpoint", method: "POST", path: "/api/prospecting/contacts/apollo-decision-maker-enrich" }
6903
- ]
6904
- },
6905
- {
6906
- id: "lead-gen.contact.personalize",
6907
- order: 100,
6908
- label: "Personalize outreach",
6909
- description: "Generate personalized opening lines for each contact.",
6910
- scope: { domain: "sales" },
6911
- resourceId: "ist-personalization-workflow",
6912
- invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/contacts/personalize" }]
6913
- },
6914
- {
6915
- id: "lead-gen.review.outreach-ready",
6916
- order: 110,
6917
- label: "Upload to outreach",
6918
- description: "Upload approved contacts to the outreach sequence after QC review.",
6919
- scope: { domain: "sales" },
6920
- resourceId: "ist-upload-contacts-workflow",
6921
- invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/review/outreach-ready" }]
6922
- },
6923
- {
6924
- id: "lead-gen.export.list",
6925
- order: 120,
6926
- label: "Export lead list",
6927
- description: "Export approved leads as a downloadable lead list.",
6928
- scope: { domain: "sales" },
6929
- resourceId: "lgn-06-export-list-workflow",
6930
- invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/export/list" }]
6931
- },
6932
- {
6933
- id: "lead-gen.company.cleanup",
6934
- order: 130,
6935
- label: "Clean up companies",
6936
- description: "Remove disqualified or duplicate companies from the list.",
6937
- scope: { domain: "sales" },
6938
- resourceId: "lgn-company-cleanup-workflow",
6939
- invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/companies/cleanup" }]
6940
- }
6941
- ];
6942
- var LEAD_GEN_ACTION_ENTRIES = Object.fromEntries(
6943
- LEAD_GEN_ACTION_ENTRY_INPUTS.map((action) => {
6944
- const parsed = ActionSchema.parse(action);
6945
- return [parsed.id, parsed];
6946
- })
6947
- );
6948
- var CRM_ACTION_ENTRY_INPUTS = [
6949
- {
6950
- id: "send_reply",
6951
- order: 210,
6952
- label: "Send Reply",
6953
- description: "Send a contextual reply for an active CRM deal.",
6954
- scope: { domain: "sales" },
6955
- resourceId: "crm-send-reply-workflow",
6956
- affects: ["crm.deal"]
6957
- },
6958
- {
6959
- id: "send_link",
6960
- order: 220,
6961
- label: "Send Booking Link",
6962
- description: "Send a booking link to move a deal toward a scheduled call.",
6963
- scope: { domain: "sales" },
6964
- resourceId: "crm-send-booking-link-workflow",
6965
- affects: ["crm.deal"]
6966
- },
6967
- {
6968
- id: "send_nudge",
6969
- order: 230,
6970
- label: "Send Nudge",
6971
- description: "Send a follow-up nudge for a stalled CRM deal.",
6972
- scope: { domain: "sales" },
6973
- resourceId: "crm-send-nudge-workflow",
6974
- affects: ["crm.deal"]
6975
- },
6976
- {
6977
- id: "rebook",
6978
- order: 240,
6979
- label: "Rebook",
6980
- description: "Rebook a missed or rescheduled CRM appointment.",
6981
- scope: { domain: "sales" },
6982
- resourceId: "crm-rebook-workflow",
6983
- affects: ["crm.deal"]
6984
- },
6985
- {
6986
- id: "move_to_proposal",
6987
- order: 250,
6988
- label: "Move to Proposal",
6989
- description: "Advance a qualified CRM deal into the proposal stage.",
6990
- scope: { domain: "sales" },
6991
- resourceId: "move_to_proposal-workflow",
6992
- affects: ["crm.deal"]
6993
- },
6994
- {
6995
- id: "move_to_closing",
6996
- order: 260,
6997
- label: "Move to Closing",
6998
- description: "Advance a proposal-stage CRM deal into closing.",
6999
- scope: { domain: "sales" },
7000
- resourceId: "move_to_closing-workflow",
7001
- affects: ["crm.deal"]
7002
- },
7003
- {
7004
- id: "move_to_closed_won",
7005
- order: 270,
7006
- label: "Close Won",
7007
- description: "Mark a CRM deal as closed won.",
7008
- scope: { domain: "sales" },
7009
- resourceId: "move_to_closed_won-workflow",
7010
- affects: ["crm.deal"]
7011
- },
7012
- {
7013
- id: "move_to_closed_lost",
7014
- order: 280,
7015
- label: "Close Lost",
7016
- description: "Mark a CRM deal as closed lost.",
7017
- scope: { domain: "sales" },
7018
- resourceId: "move_to_closed_lost-workflow",
7019
- affects: ["crm.deal"]
7020
- },
7021
- {
7022
- id: "move_to_nurturing",
7023
- order: 290,
7024
- label: "Move to Nurturing",
7025
- description: "Move a CRM deal into nurturing for future follow-up.",
7026
- scope: { domain: "sales" },
7027
- resourceId: "move_to_nurturing-workflow",
7028
- affects: ["crm.deal"]
7029
- }
7030
- ];
7031
- var CRM_ACTION_ENTRIES = Object.fromEntries(
7032
- CRM_ACTION_ENTRY_INPUTS.map((action) => {
7033
- const parsed = ActionSchema.parse(action);
7034
- return [parsed.id, parsed];
7035
- })
7036
- );
7037
- var DEFAULT_ORGANIZATION_MODEL_ACTIONS = {
7038
- ...LEAD_GEN_ACTION_ENTRIES,
7039
- ...CRM_ACTION_ENTRIES
7040
- };
6823
+ var DEFAULT_ORGANIZATION_MODEL_ACTIONS = {};
7041
6824
 
7042
6825
  // ../core/src/organization-model/domains/prospecting.ts
7043
6826
  DisplayMetadataSchema.extend({
@@ -7176,7 +6959,6 @@ var DTC_RECORD_COLUMNS = {
7176
6959
  ]
7177
6960
  }
7178
6961
  };
7179
- Object.values(LEAD_GEN_ACTION_ENTRIES);
7180
6962
  var PROSPECTING_STEPS = {
7181
6963
  localServices: {
7182
6964
  sourceCompanies: {
@@ -7422,177 +7204,6 @@ var PROSPECTING_BUILD_TEMPLATE_OPTIONS = BUILD_TEMPLATE_CATALOG.map(({ id, label
7422
7204
  function isProspectingBuildTemplateId(value) {
7423
7205
  return PROSPECTING_BUILD_TEMPLATE_OPTIONS.some((template) => template.id === value);
7424
7206
  }
7425
-
7426
- // ../core/src/organization-model/catalogs/lead-gen.ts
7427
- var LEAD_GEN_STAGE_CATALOG = {
7428
- // Prospecting - company population
7429
- scraped: {
7430
- key: "scraped",
7431
- label: "Scraped",
7432
- description: "Company was scraped from a source directory (Apify actor run).",
7433
- order: 1,
7434
- entity: "company"
7435
- },
7436
- populated: {
7437
- key: "populated",
7438
- label: "Companies found",
7439
- description: "Companies have been found and added to the lead-gen list.",
7440
- order: 2,
7441
- entity: "company"
7442
- },
7443
- crawled: {
7444
- key: "crawled",
7445
- label: "Websites crawled",
7446
- description: "Company websites have been crawled (e.g. via Apify) and raw page content stored for downstream LLM analysis.",
7447
- order: 2.5,
7448
- entity: "company"
7449
- },
7450
- extracted: {
7451
- key: "extracted",
7452
- label: "Websites analyzed",
7453
- description: "Company websites have been analyzed for business signals.",
7454
- order: 3,
7455
- entity: "company"
7456
- },
7457
- enriched: {
7458
- key: "enriched",
7459
- label: "Enriched",
7460
- description: "Company or contact enriched with third-party data (e.g. Tomba, Anymailfinder).",
7461
- order: 4,
7462
- entity: "company"
7463
- },
7464
- "decision-makers-enriched": {
7465
- key: "decision-makers-enriched",
7466
- label: "Decision-makers found",
7467
- description: "Decision-maker contacts discovered and attached to a qualified company.",
7468
- order: 6,
7469
- entity: "company",
7470
- recordEntity: "contact",
7471
- recordStageKey: "discovered"
7472
- },
7473
- // Prospecting - contact discovery
7474
- discovered: {
7475
- key: "discovered",
7476
- label: "Decision-makers found",
7477
- description: "Decision-maker contact details have been found.",
7478
- order: 5,
7479
- entity: "contact"
7480
- },
7481
- verified: {
7482
- key: "verified",
7483
- label: "Emails verified",
7484
- description: "Contact email addresses have been checked for deliverability.",
7485
- order: 7,
7486
- entity: "contact"
7487
- },
7488
- // Qualification
7489
- qualified: {
7490
- key: "qualified",
7491
- label: "Companies qualified",
7492
- description: "Companies have been scored against the qualification criteria.",
7493
- order: 8,
7494
- entity: "company"
7495
- },
7496
- // Outreach
7497
- personalized: {
7498
- key: "personalized",
7499
- label: "Personalized",
7500
- description: "Outreach message personalized for the contact (Instantly personalization workflow).",
7501
- order: 9,
7502
- entity: "contact"
7503
- },
7504
- uploaded: {
7505
- key: "uploaded",
7506
- label: "Reviewed and exported",
7507
- description: "Approved records have been reviewed and exported for handoff.",
7508
- order: 10,
7509
- entity: "company",
7510
- additionalEntities: ["contact"]
7511
- },
7512
- interested: {
7513
- key: "interested",
7514
- label: "Interested",
7515
- description: "Contact replied with a positive signal (Instantly reply-handler transition).",
7516
- order: 11,
7517
- entity: "contact"
7518
- }
7519
- };
7520
-
7521
- // ../core/src/organization-model/domains/sales.ts
7522
- var SalesStageSemanticClassSchema = z.enum(["open", "active", "nurturing", "closed_won", "closed_lost"]);
7523
- var SalesStageSchema = DisplayMetadataSchema.extend({
7524
- id: ModelIdSchema,
7525
- order: z.number().int().min(0),
7526
- semanticClass: SalesStageSemanticClassSchema,
7527
- surfaceIds: ReferenceIdsSchema,
7528
- resourceIds: ReferenceIdsSchema
7529
- });
7530
- z.object({
7531
- id: ModelIdSchema,
7532
- label: z.string().trim().min(1).max(120),
7533
- description: DescriptionSchema.optional(),
7534
- entityId: ModelIdSchema,
7535
- stages: z.array(SalesStageSchema).min(1)
7536
- });
7537
- var CRM_DISCOVERY_REPLIED_STATE = {
7538
- stateKey: "discovery_replied",
7539
- label: "Discovery Replied"
7540
- };
7541
- var CRM_DISCOVERY_LINK_SENT_STATE = {
7542
- stateKey: "discovery_link_sent",
7543
- label: "Discovery Link Sent"
7544
- };
7545
- var CRM_DISCOVERY_NUDGING_STATE = {
7546
- stateKey: "discovery_nudging",
7547
- label: "Discovery Nudging"
7548
- };
7549
- var CRM_DISCOVERY_BOOKING_CANCELLED_STATE = {
7550
- stateKey: "discovery_booking_cancelled",
7551
- label: "Discovery Booking Cancelled"
7552
- };
7553
- var CRM_REPLY_SENT_STATE = {
7554
- stateKey: "reply_sent",
7555
- label: "Reply Sent"
7556
- };
7557
- var CRM_FOLLOWUP_1_SENT_STATE = {
7558
- stateKey: "followup_1_sent",
7559
- label: "Follow-up 1 Sent"
7560
- };
7561
- var CRM_FOLLOWUP_2_SENT_STATE = {
7562
- stateKey: "followup_2_sent",
7563
- label: "Follow-up 2 Sent"
7564
- };
7565
- var CRM_FOLLOWUP_3_SENT_STATE = {
7566
- stateKey: "followup_3_sent",
7567
- label: "Follow-up 3 Sent"
7568
- };
7569
- var CRM_PIPELINE_DEFINITION = {
7570
- pipelineKey: "crm",
7571
- label: "CRM",
7572
- entityKey: "crm.deal",
7573
- stages: [
7574
- {
7575
- stageKey: "interested",
7576
- label: "Interested",
7577
- color: "blue",
7578
- states: [
7579
- CRM_DISCOVERY_REPLIED_STATE,
7580
- CRM_DISCOVERY_LINK_SENT_STATE,
7581
- CRM_DISCOVERY_NUDGING_STATE,
7582
- CRM_DISCOVERY_BOOKING_CANCELLED_STATE,
7583
- CRM_REPLY_SENT_STATE,
7584
- CRM_FOLLOWUP_1_SENT_STATE,
7585
- CRM_FOLLOWUP_2_SENT_STATE,
7586
- CRM_FOLLOWUP_3_SENT_STATE
7587
- ]
7588
- },
7589
- { stageKey: "proposal", label: "Proposal", color: "yellow", states: [] },
7590
- { stageKey: "closing", label: "Closing", color: "orange", states: [] },
7591
- { stageKey: "closed_won", label: "Closed Won", color: "green", states: [] },
7592
- { stageKey: "closed_lost", label: "Closed Lost", color: "red", states: [] },
7593
- { stageKey: "nurturing", label: "Nurturing", color: "grape", states: [] }
7594
- ]
7595
- };
7596
7207
  var OrganizationModelBrandingSchema = z.object({
7597
7208
  organizationName: LabelSchema,
7598
7209
  productName: LabelSchema,
@@ -7767,45 +7378,6 @@ var OfferingsDomainSchema = z.record(z.string(), ProductSchema).refine((record)
7767
7378
  message: "Each product entry id must match its map key"
7768
7379
  }).default({});
7769
7380
  var DEFAULT_ORGANIZATION_MODEL_OFFERINGS = {};
7770
- var ContentNodeBaseSchema = z.object({
7771
- /** Human-readable label for the content node. */
7772
- label: z.string().trim().min(1).max(120).meta({ label: "Label" }),
7773
- /** Optional one-paragraph description. */
7774
- description: z.string().trim().min(1).max(2e3).optional().meta({ label: "Description" }),
7775
- /** Optional display order within the system content map. */
7776
- order: z.number().int().optional().meta({ label: "Order" }),
7777
- /**
7778
- * Local NodeId of the parent content node within the SAME system.
7779
- * Per B4/L9: MUST resolve to a sibling in the same `system.content` map.
7780
- * Per L19: parent and child MUST share the same `kind` (meta-category).
7781
- */
7782
- parentContentId: z.string().trim().min(1).max(200).optional().meta({ label: "Parent content id" })
7783
- });
7784
- var ContentNodeSchema = ContentNodeBaseSchema.extend({
7785
- /** Meta-category (e.g. 'schema', 'config', 'knowledge', tenant-defined). */
7786
- kind: z.string().trim().min(1).max(100).meta({ label: "Kind" }),
7787
- /** Specific family within the meta-category (e.g. 'pipeline', 'kv'). */
7788
- type: z.string().trim().min(1).max(100).meta({ label: "Type" }),
7789
- /** Payload data; validated against registered payloadSchema when (kind, type) is known. */
7790
- data: z.record(z.string(), z.unknown()).optional().meta({ label: "Data" })
7791
- });
7792
- z.object({
7793
- /** Meta-category (tenant-defined or registry-shipped). */
7794
- kind: z.string().trim().min(1).max(100).meta({ label: "Kind" }),
7795
- /** Specific family within the meta-category. */
7796
- type: z.string().trim().min(1).max(100).meta({ label: "Type" }),
7797
- /** Human-readable label shown in the KB tree and describe views. */
7798
- label: z.string().trim().min(1).max(120).meta({ label: "Label" }),
7799
- /** Optional description. */
7800
- description: z.string().trim().min(1).max(2e3).optional().meta({ label: "Description" }),
7801
- /**
7802
- * Which KB tree group this extension renders in.
7803
- * Per L6: 'business-model' places it alongside Customers / Offerings / Goals.
7804
- */
7805
- treeGroup: z.union([z.enum(["profile", "business-model", "systems", "graph", "governance-wiring"]), z.string().min(1).max(100)]).meta({ label: "Tree group" }),
7806
- /** Untyped payload; shape governed by the registered payloadSchema when available. */
7807
- data: z.record(z.string(), z.unknown()).optional().meta({ label: "Data" })
7808
- });
7809
7381
  var OntologyKindSchema = z.enum([
7810
7382
  "object",
7811
7383
  "link",
@@ -8134,40 +7706,6 @@ function addLegacyActionProjections(index2, diagnostics, sourcesById, actions, e
8134
7706
  });
8135
7707
  }
8136
7708
  }
8137
- function addSystemContentProjections(index2, diagnostics, sourcesById, systemPath, system, schemaPath) {
8138
- const content = system.content ?? {};
8139
- for (const [localId, node] of Object.entries(content)) {
8140
- if (node.kind !== "schema") continue;
8141
- const entries = Object.fromEntries(
8142
- Object.entries(content).filter(([, candidate]) => candidate.parentContentId === localId).map(([entryId, candidate]) => [
8143
- entryId,
8144
- {
8145
- label: candidate.label ?? entryId,
8146
- type: candidate.type,
8147
- ...candidate.description !== void 0 ? { description: candidate.description } : {},
8148
- ...candidate.data !== void 0 ? candidate.data : {}
8149
- }
8150
- ])
8151
- );
8152
- const catalogType = {
8153
- id: formatOntologyId({ scope: systemPath, kind: "catalog", localId }),
8154
- label: node.label ?? localId,
8155
- description: node.description,
8156
- ownerSystemId: systemPath,
8157
- kind: node.type,
8158
- ...typeof node.data?.["entityId"] === "string" ? { appliesTo: formatOntologyId({ scope: systemPath, kind: "object", localId: node.data["entityId"] }) } : {},
8159
- ...Object.keys(entries).length > 0 ? { entries } : {},
8160
- ...node.data !== void 0 ? { data: node.data } : {}
8161
- };
8162
- addRecord(index2, diagnostics, sourcesById, "catalogTypes", catalogType, {
8163
- source: "legacy.system.content",
8164
- path: [...schemaPath, "content", localId],
8165
- kind: "projected",
8166
- systemPath,
8167
- legacyId: `${systemPath}:${localId}`
8168
- });
8169
- }
8170
- }
8171
7709
  function addSystemScopes(index2, diagnostics, sourcesById, systems, prefix, schemaPath) {
8172
7710
  for (const [key, system] of Object.entries(systems)) {
8173
7711
  const systemPath = prefix ? `${prefix}.${key}` : key;
@@ -8176,7 +7714,6 @@ function addSystemScopes(index2, diagnostics, sourcesById, systems, prefix, sche
8176
7714
  ...currentPath,
8177
7715
  "ontology"
8178
7716
  ]);
8179
- addSystemContentProjections(index2, diagnostics, sourcesById, systemPath, system, currentPath);
8180
7717
  addSystemScopes(index2, diagnostics, sourcesById, childSystemsOf(system), systemPath, [
8181
7718
  ...currentPath,
8182
7719
  system.systems !== void 0 ? "systems" : "subsystems"
@@ -8206,7 +7743,7 @@ var SystemPathSchema = z.string().trim().min(1).regex(
8206
7743
  var UiPositionSchema = z.enum(["sidebar-primary", "sidebar-bottom"]).meta({ label: "UI position" });
8207
7744
  var NodeIdStringSchema = z.string().trim().min(1).max(200).regex(
8208
7745
  /^[a-z][a-z-]*:([a-z0-9-]+)(\.[a-z0-9-]+)*(:[a-z0-9.-]+)*$/,
8209
- "Node references must use kind:dotted-path (e.g. system:sales.crm or content-node:sales.crm:pipeline-id)"
7746
+ "Node references must use kind:dotted-path (e.g. system:sales.crm or resource:lead-gen.company.qualify)"
8210
7747
  );
8211
7748
  var SystemUiSchema = z.object({
8212
7749
  path: PathSchema,
@@ -8280,13 +7817,6 @@ var SystemEntrySchema = z.object({
8280
7817
  * shared contract records owned by this system.
8281
7818
  */
8282
7819
  ontology: OntologyScopeSchema.optional(),
8283
- /**
8284
- * @deprecated Compatibility-only bridge for old tenant content nodes and
8285
- * migration readers. New schema/catalog authoring belongs in ontology;
8286
- * new system-local settings belong in config. Bridge nodes are keyed by
8287
- * local NodeId and may still project to content-node:* graph IDs.
8288
- */
8289
- content: z.record(z.string().trim().min(1).max(200), ContentNodeSchema).optional(),
8290
7820
  /**
8291
7821
  * Recursive child systems, authored via nesting (per L11).
8292
7822
  * The key is the local system id; the full path is computed by joining
@@ -8297,7 +7827,7 @@ var SystemEntrySchema = z.object({
8297
7827
  systems: z.lazy(() => z.record(z.string().trim().min(1).max(100), SystemEntrySchema)).optional(),
8298
7828
  /** @deprecated Use systems. Accepted as a compatibility alias during the ontology bridge. */
8299
7829
  subsystems: z.lazy(() => z.record(z.string().trim().min(1).max(100), SystemEntrySchema)).optional()
8300
- }).refine((system) => system.label !== void 0 || system.title !== void 0, {
7830
+ }).strict().refine((system) => system.label !== void 0 || system.title !== void 0, {
8301
7831
  path: ["label"],
8302
7832
  message: "System must provide label or title"
8303
7833
  }).transform((system) => {
@@ -8312,6 +7842,10 @@ var SystemsDomainSchema = z.record(z.string(), SystemEntrySchema).refine((record
8312
7842
  var DEFAULT_ORGANIZATION_MODEL_SYSTEMS = {};
8313
7843
 
8314
7844
  // ../core/src/organization-model/domains/resources.ts
7845
+ var ContractRefSchema = z.string().trim().min(1).max(500).regex(
7846
+ /^[A-Za-z0-9@](?:[A-Za-z0-9_./@-]*[A-Za-z0-9_])?\/?[A-Za-z0-9_./@-]*#[A-Za-z_$][A-Za-z0-9_$]*$/,
7847
+ "ContractRef must be in the format package/subpath#ExportName (e.g. @repo/elevasis-core/contracts/apollo-import#inputSchema)"
7848
+ );
8315
7849
  z.enum(["workflow", "agent", "integration", "script"]).meta({ label: "Resource kind", color: "orange" });
8316
7850
  var ResourceGovernanceStatusSchema = z.enum(["active", "deprecated", "archived"]).meta({ label: "Governance status", color: "teal" });
8317
7851
  var AgentKindSchema = z.enum(["orchestrator", "specialist", "utility", "platform"]).meta({ label: "Agent kind", color: "violet" });
@@ -8340,7 +7874,20 @@ var ResourceOntologyBindingSchema = z.object({
8340
7874
  reads: z.array(OntologyIdSchema).optional(),
8341
7875
  writes: z.array(OntologyIdSchema).optional(),
8342
7876
  usesCatalogs: z.array(OntologyIdSchema).optional(),
8343
- emits: z.array(OntologyIdSchema).optional()
7877
+ emits: z.array(OntologyIdSchema).optional(),
7878
+ /**
7879
+ * Optional typed contract binding for this resource's workflow I/O.
7880
+ * Each ref is a `package/subpath#ExportName` string that resolves to a
7881
+ * Zod schema in `@repo/elevasis-core` (or the consumer's equivalent package).
7882
+ *
7883
+ * Absence of this field preserves all existing behavior — it is additive + optional.
7884
+ * Tier-1 validation (schema.ts): ref-string shape only (browser-safe, no imports).
7885
+ * Tier-2 validation (om:verify): intra-package typed-map resolution asserts ZodType.
7886
+ */
7887
+ contract: z.object({
7888
+ input: ContractRefSchema.optional(),
7889
+ output: ContractRefSchema.optional()
7890
+ }).optional()
8344
7891
  }).superRefine((binding, ctx) => {
8345
7892
  if (binding.primaryAction === void 0) return;
8346
7893
  if (binding.actions?.includes(binding.primaryAction)) return;
@@ -8666,151 +8213,6 @@ var PoliciesDomainSchema = z.record(z.string(), PolicySchema).refine((record) =>
8666
8213
  message: "Each policy entry id must match its map key"
8667
8214
  }).default({});
8668
8215
  var DEFAULT_ORGANIZATION_MODEL_POLICIES = {};
8669
-
8670
- // ../core/src/organization-model/content-kinds/registry.ts
8671
- function defineContentType(def) {
8672
- return def;
8673
- }
8674
- var PipelinePayloadSchema = z.object({
8675
- /**
8676
- * Local NodeId of the entity this pipeline applies to (e.g. 'crm.deal').
8677
- * `.meta({ ref: 'entity' })` enables SchemaDrivenFieldList to render a
8678
- * clickable graph link to the referenced entity node.
8679
- */
8680
- entityId: z.string().trim().min(1).max(200).meta({ label: "Entity", ref: "entity", hint: "The entity type this pipeline tracks" }),
8681
- /**
8682
- * Optional Kanban column color token for UI rendering.
8683
- */
8684
- kanbanColor: z.string().trim().min(1).max(40).optional().meta({ label: "Kanban color", hint: "UI color token" })
8685
- });
8686
- var pipelineKind = defineContentType({
8687
- kind: "schema",
8688
- type: "pipeline",
8689
- label: "Pipeline",
8690
- description: "A named progression pipeline that applies to a specific entity type.",
8691
- payloadSchema: PipelinePayloadSchema,
8692
- parentTypes: []
8693
- });
8694
- var StagePayloadSchema = z.object({
8695
- /**
8696
- * Semantic classification for this stage.
8697
- * Drives color, icon, and CRM-priority logic in consuming views.
8698
- * Optional — prospecting stages use data.entityKind instead.
8699
- * Enum aligned with SalesStageSemanticClassSchema (sales.ts).
8700
- */
8701
- 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" })
8702
- });
8703
- var stageKind = defineContentType({
8704
- kind: "schema",
8705
- type: "stage",
8706
- label: "Stage",
8707
- description: "A stage within a pipeline. Must be parented under a schema:pipeline content node.",
8708
- payloadSchema: StagePayloadSchema,
8709
- parentTypes: ["schema:pipeline"]
8710
- });
8711
- var TemplatePayloadSchema = z.object({
8712
- /**
8713
- * Optional description surfaced in the KB describe view and tooling.
8714
- */
8715
- description: z.string().trim().min(1).max(2e3).optional().meta({ label: "Description", hint: "What this template is used for" })
8716
- });
8717
- var templateKind = defineContentType({
8718
- kind: "schema",
8719
- type: "template",
8720
- label: "Template",
8721
- description: "A named build template (e.g. a prospecting pipeline sequence).",
8722
- payloadSchema: TemplatePayloadSchema,
8723
- parentTypes: []
8724
- });
8725
- var TemplateStepPayloadSchema = z.object({
8726
- /**
8727
- * Which entity type this step primarily operates on.
8728
- */
8729
- primaryEntity: z.enum(["company", "contact"]).meta({ label: "Primary entity", hint: "Entity type this step processes", color: "blue" }),
8730
- /**
8731
- * Action key identifying the workflow action executed by this step.
8732
- * `.meta({ ref: 'action' })` enables SchemaDrivenFieldList to render a
8733
- * clickable graph link.
8734
- */
8735
- actionKey: z.string().trim().min(1).max(200).meta({ label: "Action", ref: "action", hint: "Workflow action executed by this step" }),
8736
- /**
8737
- * IDs of sibling step local NodeIds this step depends on.
8738
- */
8739
- dependsOn: z.array(z.string().trim().min(1).max(200)).optional().meta({ label: "Depends on", hint: "Local NodeIds of prerequisite steps" })
8740
- });
8741
- var templateStepKind = defineContentType({
8742
- kind: "schema",
8743
- type: "template-step",
8744
- label: "Template Step",
8745
- description: "A step within a build template. Must be parented under a schema:template content node.",
8746
- payloadSchema: TemplateStepPayloadSchema,
8747
- parentTypes: ["schema:template"]
8748
- });
8749
- var StatusFlowPayloadSchema = z.object({
8750
- /**
8751
- * Which entity scope this status flow governs.
8752
- */
8753
- appliesTo: z.enum(["project", "milestone", "task"]).meta({ label: "Applies to", hint: "Entity scope governed by this status flow", color: "blue" })
8754
- });
8755
- var statusFlowKind = defineContentType({
8756
- kind: "schema",
8757
- type: "status-flow",
8758
- label: "Status Flow",
8759
- description: "A named set of statuses governing a project, milestone, or task entity.",
8760
- payloadSchema: StatusFlowPayloadSchema,
8761
- parentTypes: []
8762
- });
8763
- var StatusPayloadSchema = z.object({
8764
- /**
8765
- * Semantic classification string for this status.
8766
- * Free-form to allow tenant-defined classifications (e.g. 'active', 'blocked',
8767
- * 'completed'). Used by UI to apply color and icon fallbacks.
8768
- * Optional — status nodes may omit this when the label is self-descriptive.
8769
- */
8770
- semanticClass: z.string().trim().min(1).max(100).optional().meta({ label: "Semantic class", hint: "Semantic meaning of this status (e.g. active, blocked, completed)" }),
8771
- /**
8772
- * Optional UI color token override for this status.
8773
- */
8774
- color: z.string().trim().min(1).max(40).optional().meta({ label: "Color", hint: "UI color token" })
8775
- });
8776
- var statusKind = defineContentType({
8777
- kind: "schema",
8778
- type: "status",
8779
- label: "Status",
8780
- description: "A single status within a status flow. Must be parented under a schema:status-flow content node.",
8781
- payloadSchema: StatusPayloadSchema,
8782
- parentTypes: ["schema:status-flow"]
8783
- });
8784
- var ConfigKvPayloadSchema = z.object({
8785
- /**
8786
- * Flat key-value entries. Values are JSON primitives.
8787
- * Keys are short identifiers (e.g. 'maxBatchSize', 'featureEnabled').
8788
- */
8789
- 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)" })
8790
- });
8791
- var configKvKind = defineContentType({
8792
- kind: "config",
8793
- type: "kv",
8794
- label: "Key-Value Config",
8795
- description: "A flat key-value configuration store co-located with a system. Values are JSON primitives.",
8796
- payloadSchema: ConfigKvPayloadSchema,
8797
- parentTypes: []
8798
- });
8799
-
8800
- // ../core/src/organization-model/content-kinds/index.ts
8801
- var CONTENT_KIND_REGISTRY = {
8802
- "schema:pipeline": pipelineKind,
8803
- "schema:stage": stageKind,
8804
- "schema:template": templateKind,
8805
- "schema:template-step": templateStepKind,
8806
- "schema:status-flow": statusFlowKind,
8807
- "schema:status": statusKind,
8808
- "config:kv": configKvKind
8809
- };
8810
- function lookupContentType(kind, type3) {
8811
- const key = `${kind}:${type3}`;
8812
- return CONTENT_KIND_REGISTRY[key];
8813
- }
8814
8216
  var SurfaceTypeSchema = z.enum(["page", "dashboard", "graph", "detail", "list", "settings"]).meta({ label: "Surface type", color: "blue" });
8815
8217
  z.object({
8816
8218
  id: ModelIdSchema,
@@ -8881,13 +8283,10 @@ var KnowledgeTargetKindSchema = z.enum([
8881
8283
  "goal",
8882
8284
  "customer-segment",
8883
8285
  "offering",
8884
- "ontology",
8885
- // D4: content nodes are a valid knowledge target after compound-domain data moved into system.content
8886
- "content-node"
8286
+ "ontology"
8887
8287
  ]).meta({ label: "Target kind" });
8888
8288
  var KnowledgeTargetRefSchema = z.object({
8889
8289
  kind: KnowledgeTargetKindSchema,
8890
- // D4: content-node targets use a qualified id format '<system-path>:<local-content-id>'.
8891
8290
  // Ontology targets use the canonical '<scope>:<kind>/<local-id>' ontology id format.
8892
8291
  // Business-logic validation of target existence is done in OrganizationModelSchema.superRefine.
8893
8292
  id: z.string().trim().min(1).max(300)
@@ -8904,6 +8303,15 @@ var KnowledgeTargetRefSchema = z.object({
8904
8303
  });
8905
8304
  var LegacyKnowledgeLinkSchema = z.object({
8906
8305
  nodeId: z.union([NodeIdStringSchema, z.templateLiteral(["ontology:", OntologyIdSchema])])
8306
+ }).superRefine((link, ctx) => {
8307
+ const [kind] = link.nodeId.split(":");
8308
+ if (!KnowledgeTargetKindSchema.safeParse(kind).success) {
8309
+ ctx.addIssue({
8310
+ code: z.ZodIssueCode.custom,
8311
+ path: ["nodeId"],
8312
+ message: `Unknown knowledge target kind "${kind}"`
8313
+ });
8314
+ }
8907
8315
  });
8908
8316
  var CanonicalKnowledgeLinkSchema = z.object({
8909
8317
  target: KnowledgeTargetRefSchema
@@ -9063,7 +8471,10 @@ OrganizationModelSchemaBase.superRefine((model, ctx) => {
9063
8471
  const childSystems = system.systems ?? system.subsystems;
9064
8472
  if (childSystems !== void 0) {
9065
8473
  result.push(
9066
- ...collectAllSystems(childSystems, path, [...currentSchemaPath, system.systems !== void 0 ? "systems" : "subsystems"])
8474
+ ...collectAllSystems(childSystems, path, [
8475
+ ...currentSchemaPath,
8476
+ system.systems !== void 0 ? "systems" : "subsystems"
8477
+ ])
9067
8478
  );
9068
8479
  }
9069
8480
  }
@@ -9084,7 +8495,9 @@ OrganizationModelSchemaBase.superRefine((model, ctx) => {
9084
8495
  `System "${system.id}" references unknown parent "${system.parentSystemId}"`
9085
8496
  );
9086
8497
  }
9087
- const hasChildren = Object.keys(system.systems ?? system.subsystems ?? {}).length > 0 || allSystems.some((candidate) => candidate.path.startsWith(`${path}.`) && !candidate.path.slice(path.length + 1).includes("."));
8498
+ const hasChildren = Object.keys(system.systems ?? system.subsystems ?? {}).length > 0 || allSystems.some(
8499
+ (candidate) => candidate.path.startsWith(`${path}.`) && !candidate.path.slice(path.length + 1).includes(".")
8500
+ );
9088
8501
  const contributesRoutePath = system.ui?.path !== void 0 || system.path !== void 0 || !hasChildren;
9089
8502
  if (contributesRoutePath) {
9090
8503
  const effectivePath = system.ui?.path ?? system.path ?? defaultSystemPathFor(path);
@@ -9106,11 +8519,7 @@ OrganizationModelSchemaBase.superRefine((model, ctx) => {
9106
8519
  (candidate) => candidate.path.startsWith(`${path}.`) && !candidate.path.slice(path.length + 1).includes(".") && isLifecycleEnabled(candidate.system.lifecycle, candidate.system.enabled)
9107
8520
  );
9108
8521
  if (!hasEnabledDescendant) {
9109
- addIssue(
9110
- ctx,
9111
- [...schemaPath, "lifecycle"],
9112
- `System "${path}" is active but has no active descendants`
9113
- );
8522
+ addIssue(ctx, [...schemaPath, "lifecycle"], `System "${path}" is active but has no active descendants`);
9114
8523
  }
9115
8524
  }
9116
8525
  });
@@ -9342,10 +8751,16 @@ OrganizationModelSchemaBase.superRefine((model, ctx) => {
9342
8751
  }
9343
8752
  });
9344
8753
  });
9345
- const stageIds = /* @__PURE__ */ new Set();
9346
8754
  const actionIds = new Set(Object.keys(model.actions));
9347
8755
  const offeringsById = new Map(Object.entries(model.offerings));
9348
8756
  const ontologyCompilation = compileOrganizationOntology(model);
8757
+ const stageIds = /* @__PURE__ */ new Set();
8758
+ for (const catalog of Object.values(ontologyCompilation.ontology.catalogTypes)) {
8759
+ if (catalog.kind !== "stage") continue;
8760
+ for (const stageId of Object.keys(catalog.entries ?? {})) {
8761
+ stageIds.add(stageId);
8762
+ }
8763
+ }
9349
8764
  const ontologyIndexByKind = {
9350
8765
  object: ontologyCompilation.ontology.objectTypes,
9351
8766
  link: ontologyCompilation.ontology.linkTypes,
@@ -9521,13 +8936,7 @@ OrganizationModelSchemaBase.superRefine((model, ctx) => {
9521
8936
  if (ontologyIndexByKind[expectedKind][ontologyId] === void 0) {
9522
8937
  addIssue(
9523
8938
  ctx,
9524
- [
9525
- "resources",
9526
- resourceId,
9527
- "ontology",
9528
- bindingKey,
9529
- ...Array.isArray(ids) ? [ontologyIndex] : []
9530
- ],
8939
+ ["resources", resourceId, "ontology", bindingKey, ...Array.isArray(ids) ? [ontologyIndex] : []],
9531
8940
  `Resource "${resourceId}" ontology binding "${bindingKey}" references unknown ${expectedKind} ontology ID "${ontologyId}"`
9532
8941
  );
9533
8942
  }
@@ -9542,6 +8951,23 @@ OrganizationModelSchemaBase.superRefine((model, ctx) => {
9542
8951
  validateResourceOntologyBinding(resource.id, "writes", "object", binding.writes);
9543
8952
  validateResourceOntologyBinding(resource.id, "usesCatalogs", "catalog", binding.usesCatalogs);
9544
8953
  validateResourceOntologyBinding(resource.id, "emits", "event", binding.emits);
8954
+ if (binding.contract !== void 0) {
8955
+ const contractEntries = [
8956
+ ["input", binding.contract.input],
8957
+ ["output", binding.contract.output]
8958
+ ];
8959
+ for (const [side, ref] of contractEntries) {
8960
+ if (ref === void 0) continue;
8961
+ const result = ContractRefSchema.safeParse(ref);
8962
+ if (!result.success) {
8963
+ addIssue(
8964
+ ctx,
8965
+ ["resources", resource.id, "ontology", "contract", side],
8966
+ `Resource "${resource.id}" contract.${side} "${ref}" is not a valid ContractRef (expected "package/subpath#ExportName")`
8967
+ );
8968
+ }
8969
+ }
8970
+ }
9545
8971
  });
9546
8972
  Object.values(model.roles).forEach((role) => {
9547
8973
  if (role.heldBy === void 0) return;
@@ -9576,78 +9002,6 @@ OrganizationModelSchemaBase.superRefine((model, ctx) => {
9576
9002
  }
9577
9003
  });
9578
9004
  });
9579
- function validateSystemContent(system, systemPath) {
9580
- const childSystems = system.systems ?? system.subsystems;
9581
- const childKey = system.systems !== void 0 ? "systems" : "subsystems";
9582
- const content = system.content;
9583
- if (content === void 0 || Object.keys(content).length === 0) {
9584
- if (childSystems !== void 0) {
9585
- Object.entries(childSystems).forEach(([childLocalId, child]) => {
9586
- validateSystemContent(child, [...systemPath, childKey, childLocalId]);
9587
- });
9588
- }
9589
- return;
9590
- }
9591
- Object.entries(content).forEach(([localId, node]) => {
9592
- if (node.parentContentId !== void 0 && !(node.parentContentId in content)) {
9593
- addIssue(
9594
- ctx,
9595
- [...systemPath, "content", localId, "parentContentId"],
9596
- `Content node "${localId}" parentContentId "${node.parentContentId}" does not resolve within the same system`
9597
- );
9598
- }
9599
- });
9600
- Object.entries(content).forEach(([localId, node]) => {
9601
- const visited = /* @__PURE__ */ new Set();
9602
- let currentId = node.parentContentId;
9603
- while (currentId !== void 0) {
9604
- if (currentId === localId || visited.has(currentId)) {
9605
- addIssue(
9606
- ctx,
9607
- [...systemPath, "content", localId, "parentContentId"],
9608
- `Content node "${localId}" has a parentContentId cycle`
9609
- );
9610
- break;
9611
- }
9612
- visited.add(currentId);
9613
- currentId = content[currentId]?.parentContentId;
9614
- }
9615
- });
9616
- Object.entries(content).forEach(([localId, node]) => {
9617
- const childDef = lookupContentType(node.kind, node.type);
9618
- if (childDef !== void 0 && node.data !== void 0) {
9619
- const result = childDef.payloadSchema.safeParse(node.data);
9620
- if (!result.success) {
9621
- addIssue(
9622
- ctx,
9623
- [...systemPath, "content", localId, "data"],
9624
- `Content node "${localId}" (${node.kind}:${node.type}) data failed payload validation: ${result.error.message}`
9625
- );
9626
- }
9627
- }
9628
- if (node.parentContentId !== void 0 && childDef !== void 0) {
9629
- const parentNode = content[node.parentContentId];
9630
- if (parentNode !== void 0) {
9631
- const parentDef = lookupContentType(parentNode.kind, parentNode.type);
9632
- if (parentDef !== void 0 && childDef.kind !== parentDef.kind) {
9633
- addIssue(
9634
- ctx,
9635
- [...systemPath, "content", localId, "parentContentId"],
9636
- `Content node "${localId}" kind "${childDef.kind}" cannot parent under "${node.parentContentId}" kind "${parentDef.kind}": parentContentId must be same-meta-kind (per L19)`
9637
- );
9638
- }
9639
- }
9640
- }
9641
- });
9642
- if (childSystems !== void 0) {
9643
- Object.entries(childSystems).forEach(([childLocalId, child]) => {
9644
- validateSystemContent(child, [...systemPath, childKey, childLocalId]);
9645
- });
9646
- }
9647
- }
9648
- Object.entries(model.systems).forEach(([systemKey, system]) => {
9649
- validateSystemContent(system, ["systems", systemKey]);
9650
- });
9651
9005
  for (const diagnostic of ontologyCompilation.diagnostics) {
9652
9006
  addIssue(ctx, diagnostic.path, diagnostic.message);
9653
9007
  }
@@ -9655,311 +9009,11 @@ OrganizationModelSchemaBase.superRefine((model, ctx) => {
9655
9009
 
9656
9010
  // ../core/src/organization-model/defaults.ts
9657
9011
  var DEFAULT_ORGANIZATION_MODEL_KNOWLEDGE = {};
9658
- var DEFAULT_ORGANIZATION_MODEL_ENTITIES2 = DEFAULT_ORGANIZATION_MODEL_ENTITIES;
9012
+ var DEFAULT_ORGANIZATION_MODEL_ENTITIES2 = {};
9659
9013
  var DEFAULT_ORGANIZATION_MODEL_NAVIGATION = {
9660
9014
  sidebar: {
9661
- primary: {
9662
- dashboard: {
9663
- type: "surface",
9664
- label: "Dashboard",
9665
- path: "/",
9666
- surfaceType: "dashboard",
9667
- icon: "dashboard",
9668
- order: 10,
9669
- targets: { systems: ["dashboard"] }
9670
- },
9671
- business: {
9672
- type: "group",
9673
- label: "Business",
9674
- icon: "business",
9675
- order: 20,
9676
- children: {
9677
- sales: {
9678
- type: "surface",
9679
- label: "Sales",
9680
- path: "/sales",
9681
- surfaceType: "page",
9682
- icon: "sales",
9683
- order: 10,
9684
- targets: { systems: ["sales"] }
9685
- },
9686
- clients: {
9687
- type: "surface",
9688
- label: "Clients",
9689
- path: "/clients",
9690
- surfaceType: "list",
9691
- icon: "projects",
9692
- order: 20,
9693
- targets: { systems: ["clients"] }
9694
- },
9695
- projects: {
9696
- type: "surface",
9697
- label: "Projects",
9698
- path: "/projects",
9699
- surfaceType: "page",
9700
- icon: "projects",
9701
- order: 30,
9702
- targets: { systems: ["projects"] }
9703
- }
9704
- }
9705
- },
9706
- operations: {
9707
- type: "group",
9708
- label: "Operations",
9709
- icon: "operations",
9710
- order: 30,
9711
- children: {
9712
- "operations-overview": {
9713
- type: "surface",
9714
- label: "Overview",
9715
- path: "/operations",
9716
- surfaceType: "page",
9717
- order: 10,
9718
- targets: { systems: ["operations.overview"] }
9719
- },
9720
- "operations-systems": {
9721
- type: "surface",
9722
- label: "Systems",
9723
- path: "/operations/systems",
9724
- surfaceType: "page",
9725
- order: 20,
9726
- targets: { systems: ["operations"] }
9727
- },
9728
- "operations-resources": {
9729
- type: "surface",
9730
- label: "Resources",
9731
- path: "/operations/resources",
9732
- surfaceType: "list",
9733
- order: 30,
9734
- targets: { systems: ["operations.resources"] }
9735
- },
9736
- "operations-command-queue": {
9737
- type: "surface",
9738
- label: "Command Queue",
9739
- path: "/operations/command-queue",
9740
- surfaceType: "list",
9741
- order: 40,
9742
- targets: { systems: ["operations.command-queue"] }
9743
- },
9744
- "operations-task-scheduler": {
9745
- type: "surface",
9746
- label: "Task Scheduler",
9747
- path: "/operations/task-scheduler",
9748
- surfaceType: "list",
9749
- order: 50,
9750
- targets: { systems: ["operations.task-scheduler"] }
9751
- }
9752
- }
9753
- },
9754
- monitoring: {
9755
- type: "group",
9756
- label: "Monitoring",
9757
- icon: "monitoring",
9758
- order: 40,
9759
- children: {
9760
- "monitoring-overview": {
9761
- type: "surface",
9762
- label: "Overview",
9763
- path: "/monitoring",
9764
- surfaceType: "page",
9765
- order: 10,
9766
- targets: { systems: ["monitoring"] }
9767
- },
9768
- "monitoring-calendar": {
9769
- type: "surface",
9770
- label: "Calendar",
9771
- path: "/monitoring/calendar",
9772
- surfaceType: "page",
9773
- order: 20,
9774
- targets: { systems: ["monitoring.calendar"] }
9775
- },
9776
- "monitoring-activity-log": {
9777
- type: "surface",
9778
- label: "Activity Log",
9779
- path: "/monitoring/activity-log",
9780
- surfaceType: "list",
9781
- order: 30,
9782
- targets: { systems: ["monitoring.activity-log"] }
9783
- },
9784
- "monitoring-execution-logs": {
9785
- type: "surface",
9786
- label: "Execution Logs",
9787
- path: "/monitoring/execution-logs",
9788
- surfaceType: "list",
9789
- order: 40,
9790
- targets: { systems: ["monitoring.execution-logs"] }
9791
- },
9792
- "monitoring-execution-health": {
9793
- type: "surface",
9794
- label: "Execution Health",
9795
- path: "/monitoring/execution-health",
9796
- surfaceType: "dashboard",
9797
- order: 50,
9798
- targets: { systems: ["monitoring.execution-health"] }
9799
- },
9800
- "monitoring-notifications": {
9801
- type: "surface",
9802
- label: "Notifications",
9803
- path: "/monitoring/notifications",
9804
- surfaceType: "list",
9805
- order: 60,
9806
- targets: { systems: ["monitoring.notifications"] }
9807
- },
9808
- "monitoring-requests": {
9809
- type: "surface",
9810
- label: "Requests",
9811
- path: "/monitoring/requests",
9812
- surfaceType: "list",
9813
- order: 70,
9814
- targets: { systems: ["monitoring.submitted-requests"] }
9815
- }
9816
- }
9817
- },
9818
- knowledge: {
9819
- type: "surface",
9820
- label: "Knowledge Base",
9821
- path: "/knowledge",
9822
- surfaceType: "page",
9823
- icon: "knowledge",
9824
- order: 50
9825
- }
9826
- },
9827
- bottom: {
9828
- settings: {
9829
- type: "group",
9830
- label: "Settings",
9831
- icon: "settings",
9832
- order: 10,
9833
- children: {
9834
- "settings-account": {
9835
- type: "surface",
9836
- label: "Account",
9837
- path: "/settings/account",
9838
- surfaceType: "settings",
9839
- order: 10,
9840
- targets: { systems: ["settings.account"] }
9841
- },
9842
- "settings-appearance": {
9843
- type: "surface",
9844
- label: "Appearance",
9845
- path: "/settings/appearance",
9846
- surfaceType: "settings",
9847
- order: 20,
9848
- targets: { systems: ["settings.appearance"] }
9849
- },
9850
- "settings-roles": {
9851
- type: "surface",
9852
- label: "My Roles",
9853
- path: "/settings/roles",
9854
- surfaceType: "settings",
9855
- order: 30,
9856
- targets: { systems: ["settings.roles"] }
9857
- },
9858
- "settings-organization": {
9859
- type: "surface",
9860
- label: "Organization",
9861
- path: "/settings/organization",
9862
- surfaceType: "settings",
9863
- order: 40,
9864
- targets: { systems: ["settings.organization"] }
9865
- },
9866
- "settings-credentials": {
9867
- type: "surface",
9868
- label: "Credentials",
9869
- path: "/settings/credentials",
9870
- surfaceType: "settings",
9871
- order: 50,
9872
- targets: { systems: ["settings.credentials"] }
9873
- },
9874
- "settings-api-keys": {
9875
- type: "surface",
9876
- label: "API Keys",
9877
- path: "/settings/api-keys",
9878
- surfaceType: "settings",
9879
- order: 60,
9880
- targets: { systems: ["settings.api-keys"] }
9881
- },
9882
- "settings-webhooks": {
9883
- type: "surface",
9884
- label: "Webhooks",
9885
- path: "/settings/webhooks",
9886
- surfaceType: "settings",
9887
- order: 70,
9888
- targets: { systems: ["settings.webhooks"] }
9889
- },
9890
- "settings-deployments": {
9891
- type: "surface",
9892
- label: "Deployments",
9893
- path: "/settings/deployments",
9894
- surfaceType: "settings",
9895
- order: 80,
9896
- targets: { systems: ["settings.deployments"] }
9897
- }
9898
- }
9899
- },
9900
- admin: {
9901
- type: "group",
9902
- label: "Admin",
9903
- icon: "admin",
9904
- order: 20,
9905
- children: {
9906
- "admin-dashboard": {
9907
- type: "surface",
9908
- label: "Dashboard",
9909
- path: "/admin/dashboard",
9910
- surfaceType: "dashboard",
9911
- order: 10,
9912
- targets: { systems: ["admin"] },
9913
- requiresAdmin: true
9914
- },
9915
- "admin-system-health": {
9916
- type: "surface",
9917
- label: "System Health",
9918
- path: "/admin/system-health",
9919
- surfaceType: "dashboard",
9920
- order: 20,
9921
- targets: { systems: ["admin.system-health"] },
9922
- requiresAdmin: true
9923
- },
9924
- "admin-organizations": {
9925
- type: "surface",
9926
- label: "Organizations",
9927
- path: "/admin/organizations",
9928
- surfaceType: "list",
9929
- order: 30,
9930
- targets: { systems: ["admin.organizations"] },
9931
- requiresAdmin: true
9932
- },
9933
- "admin-users": {
9934
- type: "surface",
9935
- label: "Users",
9936
- path: "/admin/users",
9937
- surfaceType: "list",
9938
- order: 40,
9939
- targets: { systems: ["admin.users"] },
9940
- requiresAdmin: true
9941
- },
9942
- "admin-design-showcase": {
9943
- type: "surface",
9944
- label: "Design Showcase",
9945
- path: "/admin/design-showcase",
9946
- surfaceType: "page",
9947
- order: 50,
9948
- targets: { systems: ["admin.design-showcase"] },
9949
- requiresAdmin: true
9950
- },
9951
- "admin-debug": {
9952
- type: "surface",
9953
- label: "Debug",
9954
- path: "/admin/debug",
9955
- surfaceType: "page",
9956
- order: 60,
9957
- targets: { systems: ["admin.debug"] },
9958
- requiresAdmin: true
9959
- }
9960
- }
9961
- }
9962
- }
9015
+ primary: {},
9016
+ bottom: {}
9963
9017
  }
9964
9018
  };
9965
9019
  var DEFAULT_ORGANIZATION_MODEL = {
@@ -9972,408 +9026,159 @@ var DEFAULT_ORGANIZATION_MODEL = {
9972
9026
  offerings: DEFAULT_ORGANIZATION_MODEL_OFFERINGS,
9973
9027
  roles: DEFAULT_ORGANIZATION_MODEL_ROLES,
9974
9028
  goals: DEFAULT_ORGANIZATION_MODEL_GOALS,
9975
- systems: {
9976
- dashboard: {
9977
- id: "dashboard",
9978
- order: 10,
9979
- label: "Dashboard",
9980
- enabled: true,
9981
- lifecycle: "active",
9982
- path: "/",
9983
- icon: "dashboard"
9984
- },
9985
- platform: {
9986
- id: "platform",
9987
- order: 30,
9988
- label: "Platform",
9989
- description: "Elevasis platform architecture, capabilities, and implementation patterns",
9990
- enabled: true,
9991
- lifecycle: "active",
9992
- color: "cyan",
9993
- icon: "platform"
9994
- },
9995
- finance: {
9996
- id: "finance",
9997
- order: 40,
9998
- label: "Finance",
9999
- description: "Finance operations, accounting, billing, reconciliation, and tax prep",
10000
- enabled: true,
10001
- lifecycle: "active",
10002
- color: "green",
10003
- icon: "finance"
10004
- },
10005
- sales: {
10006
- id: "sales",
10007
- order: 60,
10008
- label: "Sales",
10009
- description: "Revenue workflows and customer acquisition",
10010
- enabled: true,
10011
- lifecycle: "active",
10012
- color: "blue",
10013
- icon: "sales",
10014
- path: "/sales"
10015
- },
10016
- "sales.crm": {
10017
- id: "sales.crm",
10018
- order: 70,
10019
- label: "CRM",
10020
- description: "Relationship pipeline and deal management",
10021
- enabled: true,
10022
- lifecycle: "active",
10023
- actions: Object.values(CRM_ACTION_ENTRIES).map((action) => ({
10024
- actionId: action.id,
10025
- intent: "exposes"
10026
- })),
10027
- color: "blue",
10028
- icon: "crm",
10029
- path: "/crm"
10030
- },
10031
- "sales.lead-gen": {
10032
- id: "sales.lead-gen",
10033
- order: 80,
10034
- label: "Lead Gen",
10035
- description: "Prospecting, qualification, and outreach preparation",
10036
- enabled: true,
10037
- lifecycle: "active",
10038
- actions: Object.values(LEAD_GEN_ACTION_ENTRIES).map((action) => ({
10039
- actionId: action.id,
10040
- intent: "exposes"
10041
- })),
10042
- color: "cyan",
10043
- icon: "lead-gen",
10044
- path: "/lead-gen"
10045
- },
10046
- projects: {
10047
- id: "projects",
10048
- order: 90,
10049
- label: "Projects",
10050
- description: "Projects, milestones, and client work execution",
10051
- enabled: true,
10052
- lifecycle: "active",
10053
- color: "orange",
10054
- icon: "projects",
10055
- path: "/projects"
10056
- },
10057
- clients: {
10058
- id: "clients",
10059
- order: 100,
10060
- label: "Clients",
10061
- description: "Client relationships, accounts, and business context",
10062
- enabled: true,
10063
- lifecycle: "active",
10064
- color: "orange",
10065
- icon: "projects",
10066
- path: "/clients"
10067
- },
10068
- operations: {
10069
- id: "operations",
10070
- order: 110,
10071
- label: "Operations",
10072
- description: "Operational resources, topology, and orchestration visibility",
10073
- enabled: true,
10074
- lifecycle: "active",
10075
- color: "violet",
10076
- icon: "operations"
10077
- },
10078
- "knowledge.command-view": {
10079
- id: "knowledge.command-view",
10080
- order: 120,
10081
- label: "Command View",
10082
- enabled: true,
10083
- lifecycle: "active",
10084
- path: "/knowledge/command-view",
10085
- devOnly: true
10086
- },
10087
- "operations.overview": {
10088
- id: "operations.overview",
10089
- order: 130,
10090
- label: "Overview",
10091
- enabled: true,
10092
- lifecycle: "active",
10093
- path: "/operations"
10094
- },
10095
- "operations.resources": {
10096
- id: "operations.resources",
10097
- order: 140,
10098
- label: "Resources",
10099
- enabled: true,
10100
- lifecycle: "active",
10101
- path: "/operations/resources"
10102
- },
10103
- "operations.command-queue": {
10104
- id: "operations.command-queue",
10105
- order: 150,
10106
- label: "Command Queue",
10107
- enabled: true,
10108
- lifecycle: "active",
10109
- path: "/operations/command-queue"
10110
- },
10111
- "operations.sessions": {
10112
- id: "operations.sessions",
10113
- order: 160,
10114
- label: "Sessions",
10115
- enabled: false,
10116
- lifecycle: "deprecated",
10117
- path: "/operations/sessions"
10118
- },
10119
- "operations.task-scheduler": {
10120
- id: "operations.task-scheduler",
10121
- order: 170,
10122
- label: "Task Scheduler",
10123
- enabled: true,
10124
- lifecycle: "active",
10125
- path: "/operations/task-scheduler"
10126
- },
10127
- monitoring: {
10128
- id: "monitoring",
10129
- order: 180,
10130
- label: "Monitoring",
10131
- enabled: true,
10132
- lifecycle: "active"
10133
- },
10134
- "monitoring.calendar": {
10135
- id: "monitoring.calendar",
10136
- order: 190,
10137
- label: "Calendar",
10138
- description: "Google Calendar events and agenda views",
10139
- enabled: true,
10140
- lifecycle: "active",
10141
- path: "/monitoring/calendar",
10142
- icon: "calendar"
10143
- },
10144
- "monitoring.activity-log": {
10145
- id: "monitoring.activity-log",
10146
- order: 200,
10147
- label: "Activity Log",
10148
- enabled: true,
10149
- lifecycle: "active",
10150
- path: "/monitoring/activity-log"
10151
- },
10152
- "monitoring.execution-logs": {
10153
- id: "monitoring.execution-logs",
10154
- order: 210,
10155
- label: "Execution Logs",
10156
- enabled: true,
10157
- lifecycle: "active",
10158
- path: "/monitoring/execution-logs"
10159
- },
10160
- "monitoring.execution-health": {
10161
- id: "monitoring.execution-health",
10162
- order: 220,
10163
- label: "Execution Health",
10164
- enabled: true,
10165
- lifecycle: "active",
10166
- path: "/monitoring/execution-health"
10167
- },
10168
- "monitoring.cost-analytics": {
10169
- id: "monitoring.cost-analytics",
10170
- order: 230,
10171
- label: "Cost Analytics",
10172
- enabled: false,
10173
- lifecycle: "deprecated",
10174
- path: "/monitoring/cost-analytics"
10175
- },
10176
- "monitoring.notifications": {
10177
- id: "monitoring.notifications",
10178
- order: 240,
10179
- label: "Notifications",
10180
- enabled: true,
10181
- lifecycle: "active",
10182
- path: "/monitoring/notifications"
10183
- },
10184
- "monitoring.submitted-requests": {
10185
- id: "monitoring.submitted-requests",
10186
- order: 250,
10187
- label: "Submitted Requests",
10188
- enabled: true,
10189
- lifecycle: "active",
10190
- path: "/monitoring/requests"
10191
- },
10192
- settings: {
10193
- id: "settings",
10194
- order: 260,
10195
- label: "Settings",
10196
- enabled: true,
10197
- lifecycle: "active",
10198
- icon: "settings"
10199
- },
10200
- "settings.account": {
10201
- id: "settings.account",
10202
- order: 270,
10203
- label: "Account",
10204
- enabled: true,
10205
- lifecycle: "active",
10206
- path: "/settings/account"
10207
- },
10208
- "settings.appearance": {
10209
- id: "settings.appearance",
10210
- order: 280,
10211
- label: "Appearance",
10212
- enabled: true,
10213
- lifecycle: "active",
10214
- path: "/settings/appearance"
10215
- },
10216
- "settings.roles": {
10217
- id: "settings.roles",
10218
- order: 290,
10219
- label: "My Roles",
10220
- enabled: true,
10221
- lifecycle: "active",
10222
- path: "/settings/roles"
10223
- },
10224
- "settings.organization": {
10225
- id: "settings.organization",
10226
- order: 300,
10227
- label: "Organization",
10228
- enabled: true,
10229
- lifecycle: "active",
10230
- path: "/settings/organization"
10231
- },
10232
- "settings.credentials": {
10233
- id: "settings.credentials",
10234
- order: 310,
10235
- label: "Credentials",
10236
- enabled: true,
10237
- lifecycle: "active",
10238
- path: "/settings/credentials"
10239
- },
10240
- "settings.api-keys": {
10241
- id: "settings.api-keys",
10242
- order: 320,
10243
- label: "API Keys",
10244
- enabled: true,
10245
- lifecycle: "active",
10246
- path: "/settings/api-keys"
10247
- },
10248
- "settings.webhooks": {
10249
- id: "settings.webhooks",
10250
- order: 330,
10251
- label: "Webhooks",
10252
- enabled: true,
10253
- lifecycle: "active",
10254
- path: "/settings/webhooks"
10255
- },
10256
- "settings.deployments": {
10257
- id: "settings.deployments",
10258
- order: 340,
10259
- label: "Deployments",
10260
- enabled: true,
10261
- lifecycle: "active",
10262
- path: "/settings/deployments"
10263
- },
10264
- admin: {
10265
- id: "admin",
10266
- order: 350,
10267
- label: "Admin",
10268
- enabled: true,
10269
- lifecycle: "active",
10270
- path: "/admin",
10271
- icon: "admin",
10272
- requiresAdmin: true
10273
- },
10274
- "admin.system-health": {
10275
- id: "admin.system-health",
10276
- order: 360,
10277
- label: "System Health",
10278
- enabled: true,
10279
- lifecycle: "active",
10280
- path: "/admin/system-health"
10281
- },
10282
- "admin.organizations": {
10283
- id: "admin.organizations",
10284
- order: 370,
10285
- label: "Organizations",
10286
- enabled: true,
10287
- lifecycle: "active",
10288
- path: "/admin/organizations"
10289
- },
10290
- "admin.users": {
10291
- id: "admin.users",
10292
- order: 380,
10293
- label: "Users",
10294
- enabled: true,
10295
- lifecycle: "active",
10296
- path: "/admin/users"
10297
- },
10298
- "admin.design-showcase": {
10299
- id: "admin.design-showcase",
10300
- order: 390,
10301
- label: "Design Showcase",
10302
- enabled: true,
10303
- lifecycle: "active",
10304
- path: "/admin/design-showcase"
10305
- },
10306
- "admin.debug": {
10307
- id: "admin.debug",
10308
- order: 400,
10309
- label: "Debug",
10310
- enabled: true,
10311
- lifecycle: "active",
10312
- path: "/admin/debug"
10313
- },
10314
- archive: {
10315
- id: "archive",
10316
- order: 410,
10317
- label: "Archive",
10318
- enabled: true,
10319
- lifecycle: "active",
10320
- path: "/archive",
10321
- icon: "archive",
10322
- devOnly: true
10323
- },
10324
- "archive.agent-chat": {
10325
- id: "archive.agent-chat",
10326
- order: 420,
10327
- label: "Agent Chat",
10328
- enabled: true,
10329
- lifecycle: "active",
10330
- path: "/archive/agent-chat"
10331
- },
10332
- "archive.execution-runner": {
10333
- id: "archive.execution-runner",
10334
- order: 430,
10335
- label: "Execution Runner",
10336
- enabled: true,
10337
- lifecycle: "active",
10338
- path: "/archive/execution-runner"
10339
- },
10340
- seo: {
10341
- id: "seo",
10342
- order: 440,
10343
- label: "SEO",
10344
- enabled: false,
10345
- lifecycle: "deprecated",
10346
- path: "/seo"
10347
- },
10348
- knowledge: {
10349
- id: "knowledge",
10350
- order: 450,
10351
- label: "Knowledge",
10352
- description: "Operational knowledge, playbooks, and strategy docs",
10353
- enabled: true,
10354
- lifecycle: "active",
10355
- color: "teal",
10356
- icon: "knowledge"
10357
- },
10358
- "knowledge.base": {
10359
- id: "knowledge.base",
10360
- order: 460,
10361
- label: "Knowledge Base",
10362
- enabled: true,
10363
- lifecycle: "active",
10364
- path: "/knowledge"
10365
- }
10366
- },
9029
+ // Generic empty systems map. Elevasis-specific systems (platform, sales, sales.crm,
9030
+ // sales.lead-gen, monitoring, settings, admin, etc.) have been relocated to
9031
+ // `@repo/elevasis-core/src/organization-model/systems.ts` via `canonicalOrganizationModel`.
9032
+ // Tenant OM configs supply their own systems via `resolveOrganizationModel`.
9033
+ systems: {},
10367
9034
  ontology: DEFAULT_ONTOLOGY_SCOPE,
10368
9035
  resources: DEFAULT_ORGANIZATION_MODEL_RESOURCES,
10369
9036
  topology: DEFAULT_ORGANIZATION_MODEL_TOPOLOGY,
10370
- actions: DEFAULT_ORGANIZATION_MODEL_ACTIONS,
9037
+ // Generic empty actions map. Elevasis-specific action entries have been relocated to
9038
+ // `@repo/elevasis-core/src/organization-model/actions.ts`.
9039
+ actions: {},
10371
9040
  entities: DEFAULT_ORGANIZATION_MODEL_ENTITIES2,
10372
9041
  policies: DEFAULT_ORGANIZATION_MODEL_POLICIES,
10373
- // Phase 4 (D1): statuses top-level field removed; bridge status mirrors may
10374
- // still project from System.content, but primary authoring belongs in ontology.
10375
9042
  knowledge: DEFAULT_ORGANIZATION_MODEL_KNOWLEDGE
10376
9043
  };
9044
+ var SalesStageSemanticClassSchema = z.enum(["open", "active", "nurturing", "closed_won", "closed_lost"]);
9045
+ var SalesStageSchema = DisplayMetadataSchema.extend({
9046
+ id: ModelIdSchema,
9047
+ order: z.number().int().min(0),
9048
+ semanticClass: SalesStageSemanticClassSchema,
9049
+ surfaceIds: ReferenceIdsSchema,
9050
+ resourceIds: ReferenceIdsSchema
9051
+ });
9052
+ z.object({
9053
+ id: ModelIdSchema,
9054
+ label: z.string().trim().min(1).max(120),
9055
+ description: DescriptionSchema.optional(),
9056
+ entityId: ModelIdSchema,
9057
+ stages: z.array(SalesStageSchema).min(1)
9058
+ });
9059
+ var CRM_DISCOVERY_REPLIED_STATE = {
9060
+ stateKey: "discovery_replied",
9061
+ label: "Discovery Replied"
9062
+ };
9063
+ var CRM_DISCOVERY_LINK_SENT_STATE = {
9064
+ stateKey: "discovery_link_sent",
9065
+ label: "Discovery Link Sent"
9066
+ };
9067
+ var CRM_DISCOVERY_NUDGING_STATE = {
9068
+ stateKey: "discovery_nudging",
9069
+ label: "Discovery Nudging"
9070
+ };
9071
+ var CRM_DISCOVERY_BOOKING_CANCELLED_STATE = {
9072
+ stateKey: "discovery_booking_cancelled",
9073
+ label: "Discovery Booking Cancelled"
9074
+ };
9075
+ var CRM_REPLY_SENT_STATE = {
9076
+ stateKey: "reply_sent",
9077
+ label: "Reply Sent"
9078
+ };
9079
+ var CRM_FOLLOWUP_1_SENT_STATE = {
9080
+ stateKey: "followup_1_sent",
9081
+ label: "Follow-up 1 Sent"
9082
+ };
9083
+ var CRM_FOLLOWUP_2_SENT_STATE = {
9084
+ stateKey: "followup_2_sent",
9085
+ label: "Follow-up 2 Sent"
9086
+ };
9087
+ var CRM_FOLLOWUP_3_SENT_STATE = {
9088
+ stateKey: "followup_3_sent",
9089
+ label: "Follow-up 3 Sent"
9090
+ };
9091
+ var CRM_PIPELINE_DEFINITION = {
9092
+ pipelineKey: "crm",
9093
+ label: "CRM",
9094
+ entityKey: "crm.deal",
9095
+ stages: [
9096
+ {
9097
+ stageKey: "interested",
9098
+ label: "Interested",
9099
+ color: "blue",
9100
+ states: [
9101
+ CRM_DISCOVERY_REPLIED_STATE,
9102
+ CRM_DISCOVERY_LINK_SENT_STATE,
9103
+ CRM_DISCOVERY_NUDGING_STATE,
9104
+ CRM_DISCOVERY_BOOKING_CANCELLED_STATE,
9105
+ CRM_REPLY_SENT_STATE,
9106
+ CRM_FOLLOWUP_1_SENT_STATE,
9107
+ CRM_FOLLOWUP_2_SENT_STATE,
9108
+ CRM_FOLLOWUP_3_SENT_STATE
9109
+ ]
9110
+ },
9111
+ { stageKey: "proposal", label: "Proposal", color: "yellow", states: [] },
9112
+ { stageKey: "closing", label: "Closing", color: "orange", states: [] },
9113
+ { stageKey: "closed_won", label: "Closed Won", color: "green", states: [] },
9114
+ { stageKey: "closed_lost", label: "Closed Lost", color: "red", states: [] },
9115
+ { stageKey: "nurturing", label: "Nurturing", color: "grape", states: [] }
9116
+ ]
9117
+ };
9118
+
9119
+ // ../core/src/organization-model/migration-helpers.ts
9120
+ function catalogRecords(model) {
9121
+ return Object.values(compileOrganizationOntology(model).ontology.catalogTypes);
9122
+ }
9123
+ function systemScope(id, fallback) {
9124
+ return parseOntologyId(id).scope || fallback || "";
9125
+ }
9126
+ function entriesOf(catalog) {
9127
+ return Object.entries(catalog.entries ?? {}).map(([id, value]) => [
9128
+ id,
9129
+ value && typeof value === "object" && !Array.isArray(value) ? value : {}
9130
+ ]);
9131
+ }
9132
+ function stringValue(value) {
9133
+ return typeof value === "string" ? value : void 0;
9134
+ }
9135
+ function stringArray(value) {
9136
+ return Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
9137
+ }
9138
+ function numberValue(value, fallback = 0) {
9139
+ return typeof value === "number" ? value : fallback;
9140
+ }
9141
+ function appliesToLocalId(catalog) {
9142
+ const appliesTo = catalog.appliesTo;
9143
+ if (appliesTo === void 0) return void 0;
9144
+ return parseOntologyId(appliesTo).localId;
9145
+ }
9146
+ function appliesToEntityKind(catalog) {
9147
+ const id = appliesToLocalId(catalog);
9148
+ if (id === "company" || id === "contact" || id === "project" || id === "milestone" || id === "task") return id;
9149
+ if (id === "deal") return void 0;
9150
+ return void 0;
9151
+ }
9152
+ function getLeadGenStageCatalog(model) {
9153
+ const results = {};
9154
+ for (const catalog of catalogRecords(model).filter(
9155
+ (record) => record.kind === "stage" && (record.ownerSystemId ?? systemScope(record.id)) === "sales.lead-gen"
9156
+ )) {
9157
+ const catalogEntity = appliesToEntityKind(catalog);
9158
+ if (catalogEntity !== "company" && catalogEntity !== "contact") continue;
9159
+ for (const [entryId, entry] of entriesOf(catalog)) {
9160
+ const entity = entry.entity === "contact" ? "contact" : entry.entity === "company" ? "company" : catalogEntity;
9161
+ const additionalEntities = stringArray(entry.additionalEntities).filter(
9162
+ (item) => item === "company" || item === "contact"
9163
+ );
9164
+ const recordEntity = entry.recordEntity === "company" || entry.recordEntity === "contact" ? entry.recordEntity : void 0;
9165
+ const recordStageKey = stringValue(entry.recordStageKey);
9166
+ results[entryId] = {
9167
+ key: entryId,
9168
+ label: stringValue(entry.label) ?? entryId,
9169
+ description: stringValue(entry.description) ?? "",
9170
+ order: numberValue(entry.order),
9171
+ entity,
9172
+ ...additionalEntities.length > 0 ? { additionalEntities } : {},
9173
+ ...recordEntity ? { recordEntity } : {},
9174
+ ...recordStageKey ? { recordStageKey } : {}
9175
+ };
9176
+ }
9177
+ }
9178
+ return Object.fromEntries(
9179
+ Object.entries(results).sort(([, a3], [, b2]) => a3.order - b2.order || a3.key.localeCompare(b2.key))
9180
+ );
9181
+ }
10377
9182
 
10378
9183
  // ../core/src/business/acquisition/ontology-validation.ts
10379
9184
  var CRM_PIPELINE_CATALOG_ONTOLOGY_ID = formatOntologyId({
@@ -10414,14 +9219,14 @@ function createCrmPipelineCatalog() {
10414
9219
  legacyEntityKey: CRM_PIPELINE_DEFINITION.entityKey
10415
9220
  };
10416
9221
  }
10417
- function createLeadGenStageCatalog() {
9222
+ function createLeadGenStageCatalog(model) {
10418
9223
  return {
10419
9224
  id: LEAD_GEN_STAGE_CATALOG_ONTOLOGY_ID,
10420
9225
  label: "Lead Gen Processing Stages",
10421
9226
  ownerSystemId: "sales.lead-gen",
10422
9227
  kind: "processing-stage-catalog",
10423
9228
  entries: Object.fromEntries(
10424
- Object.entries(LEAD_GEN_STAGE_CATALOG).map(([key, entry]) => [
9229
+ Object.entries(getLeadGenStageCatalog(model)).map(([key, entry]) => [
10425
9230
  key,
10426
9231
  {
10427
9232
  ...entry
@@ -10441,7 +9246,7 @@ function mergeBridgeCatalogs(model) {
10441
9246
  bridgeCatalogTypes[CRM_PIPELINE_CATALOG_ONTOLOGY_ID] = createCrmPipelineCatalog();
10442
9247
  }
10443
9248
  if (baseCatalogTypes[LEAD_GEN_STAGE_CATALOG_ONTOLOGY_ID] === void 0) {
10444
- bridgeCatalogTypes[LEAD_GEN_STAGE_CATALOG_ONTOLOGY_ID] = createLeadGenStageCatalog();
9249
+ bridgeCatalogTypes[LEAD_GEN_STAGE_CATALOG_ONTOLOGY_ID] = createLeadGenStageCatalog(model);
10445
9250
  }
10446
9251
  if (Object.keys(bridgeCatalogTypes).length === 0) return model;
10447
9252
  return {
@@ -10510,25 +9315,6 @@ function asCrmStageEntry(key, value) {
10510
9315
  states
10511
9316
  };
10512
9317
  }
10513
- function asLeadGenStageEntry(key, value) {
10514
- const record = isPlainRecord(value) ? value : {};
10515
- const entity = record.entity === "contact" ? "contact" : "company";
10516
- const additionalEntities = Array.isArray(record.additionalEntities) ? record.additionalEntities.filter(
10517
- (item) => item === "company" || item === "contact"
10518
- ) : void 0;
10519
- const recordEntity = record.recordEntity === "company" || record.recordEntity === "contact" ? record.recordEntity : void 0;
10520
- const recordStageKey = typeof record.recordStageKey === "string" ? record.recordStageKey : void 0;
10521
- return {
10522
- key: typeof record.key === "string" ? record.key : key,
10523
- label: typeof record.label === "string" ? record.label : key,
10524
- description: typeof record.description === "string" ? record.description : "",
10525
- order: typeof record.order === "number" ? record.order : 0,
10526
- entity,
10527
- ...additionalEntities !== void 0 ? { additionalEntities } : {},
10528
- ...recordEntity !== void 0 ? { recordEntity } : {},
10529
- ...recordStageKey !== void 0 ? { recordStageKey } : {}
10530
- };
10531
- }
10532
9318
  var CRM_STAGE_KEYS_FROM_ONTOLOGY = Object.keys(
10533
9319
  getCatalogEntries(BUSINESS_ONTOLOGY_VALIDATION_INDEX.crmPipelineCatalog)
10534
9320
  );
@@ -10542,36 +9328,11 @@ var CRM_STATE_KEYS_FROM_ONTOLOGY = Object.values(
10542
9328
  Object.keys(
10543
9329
  getCatalogEntries(BUSINESS_ONTOLOGY_VALIDATION_INDEX.leadGenStageCatalog)
10544
9330
  );
10545
- function getLeadGenStageCatalogFromOntology() {
10546
- return Object.fromEntries(
10547
- Object.entries(getCatalogEntries(BUSINESS_ONTOLOGY_VALIDATION_INDEX.leadGenStageCatalog)).map(([key, value]) => [
10548
- key,
10549
- asLeadGenStageEntry(key, value)
10550
- ])
10551
- );
10552
- }
10553
- function getLeadGenStageEntry(stageKey) {
10554
- return getLeadGenStageCatalogFromOntology()[stageKey];
10555
- }
10556
- function isLeadGenStageKey(stageKey) {
10557
- return getLeadGenStageEntry(stageKey) !== void 0;
10558
- }
10559
- function isLeadGenRecordStageValidForEntity(stageKey, entity) {
10560
- const stage = getLeadGenStageEntry(stageKey);
10561
- return stage !== void 0 && (stage.entity === entity || stage.additionalEntities?.includes(entity) === true || stage.recordEntity === entity);
10562
- }
10563
- function isLeadGenActionKey(actionKey) {
10564
- return actionKey.startsWith("lead-gen.") && BUSINESS_ONTOLOGY_VALIDATION_INDEX.actionTypesByLegacyId[actionKey] !== void 0;
10565
- }
10566
9331
 
10567
9332
  // ../core/src/business/acquisition/api-schemas.ts
10568
9333
  var ProcessingStageStatusSchema = z.enum(["success", "no_result", "skipped", "error"]);
10569
- var LeadGenStageKeySchema = z.string().refine((value) => isLeadGenStageKey(value), {
10570
- message: "processing state key must match LEAD_GEN_STAGE_CATALOG"
10571
- });
10572
- var LeadGenActionKeySchema = z.string().refine((value) => isLeadGenActionKey(value), {
10573
- message: "actionKey must match ACTION_REGISTRY"
10574
- });
9334
+ var LeadGenStageKeySchema = z.string().trim().min(1);
9335
+ var LeadGenActionKeySchema = z.string().trim().min(1);
10575
9336
  var crmStageKeys = CRM_STAGE_KEYS_FROM_ONTOLOGY;
10576
9337
  var crmStateKeys = CRM_STATE_KEYS_FROM_ONTOLOGY;
10577
9338
  var CrmStageKeySchema = z.enum(crmStageKeys);
@@ -10627,7 +9388,7 @@ z.object({
10627
9388
  expectedUpdatedAt: z.string().datetime().optional()
10628
9389
  }).strict();
10629
9390
  z.object({
10630
- pipelineKey: z.literal(CRM_PIPELINE_DEFINITION.pipelineKey),
9391
+ pipelineKey: z.string().min(1),
10631
9392
  stageKey: CrmStageKeySchema,
10632
9393
  stateKey: CrmStateKeySchema.nullable().optional(),
10633
9394
  reason: z.string().optional(),
@@ -10828,9 +9589,7 @@ var IcpRubricSchema = z.object({
10828
9589
  customRules: z.string().optional()
10829
9590
  });
10830
9591
  var PipelineStageSchema = z.object({
10831
- key: z.string().refine((value) => isLeadGenStageKey(value), {
10832
- message: "pipeline stage key must match LEAD_GEN_STAGE_CATALOG"
10833
- }),
9592
+ key: LeadGenStageKeySchema,
10834
9593
  label: z.string().optional(),
10835
9594
  enabled: z.boolean().optional(),
10836
9595
  order: z.number().int().optional()
@@ -11298,16 +10057,7 @@ z.object({
11298
10057
  stage: LeadGenStageKeySchema.optional(),
11299
10058
  limit: z.coerce.number().int().min(1).max(500).default(50),
11300
10059
  offset: z.coerce.number().int().min(0).default(0)
11301
- }).strict().superRefine((query, ctx) => {
11302
- if (!query.stage) return;
11303
- if (!isLeadGenRecordStageValidForEntity(query.stage, query.entity)) {
11304
- ctx.addIssue({
11305
- code: z.ZodIssueCode.custom,
11306
- message: `stage "${query.stage}" is not valid for ${query.entity} records`,
11307
- path: ["stage"]
11308
- });
11309
- }
11310
- });
10060
+ }).strict();
11311
10061
  z.object({
11312
10062
  memberId: UuidSchema
11313
10063
  });
@@ -11784,6 +10534,17 @@ function listAllSystems(model) {
11784
10534
  walk(model.systems, "");
11785
10535
  return results;
11786
10536
  }
10537
+ z.object({
10538
+ success: z.boolean(),
10539
+ tool: z.string(),
10540
+ method: z.string(),
10541
+ result: z.unknown().optional(),
10542
+ error: z.string().optional(),
10543
+ durationMs: z.number().optional()
10544
+ });
10545
+ z.object({
10546
+ credential: z.string().describe("Credential name registered for this integration")
10547
+ });
11787
10548
 
11788
10549
  // ../core/src/platform/registry/validation.ts
11789
10550
  var RegistryValidationError = class extends Error {
@@ -11842,7 +10603,7 @@ function hasOntologySources(organizationModel) {
11842
10603
  return organizationModel.ontology !== void 0 || organizationModel.entities !== void 0 || organizationModel.actions !== void 0 || Object.values(organizationModel.systems ?? {}).some(systemHasOntologySource);
11843
10604
  }
11844
10605
  function systemHasOntologySource(system) {
11845
- if (system.ontology !== void 0 || system.content !== void 0 && Object.keys(system.content).length > 0) return true;
10606
+ if (system.ontology !== void 0) return true;
11846
10607
  return Object.values(system.systems ?? system.subsystems ?? {}).some(systemHasOntologySource);
11847
10608
  }
11848
10609
  function ontologyIndexForKind(index2, kind) {
@@ -11875,7 +10636,8 @@ function sameJson(left, right) {
11875
10636
  function addOntologyBindingIssues(issues, orgName, resource, ontologyIndex) {
11876
10637
  const binding = resource.ontology;
11877
10638
  if (binding === void 0) return;
11878
- if ((resource.kind === "workflow" || resource.kind === "agent") && (binding.actions?.length ?? 0) === 0) {
10639
+ const hasOperationalOntologyBinding = binding.primaryAction !== void 0 || (binding.reads?.length ?? 0) > 0 || (binding.writes?.length ?? 0) > 0 || (binding.usesCatalogs?.length ?? 0) > 0 || (binding.emits?.length ?? 0) > 0;
10640
+ if ((resource.kind === "workflow" || resource.kind === "agent") && hasOperationalOntologyBinding && (binding.actions?.length ?? 0) === 0) {
11879
10641
  addGovernanceIssue(
11880
10642
  issues,
11881
10643
  "missing-ontology-actions",
@@ -12378,8 +11140,7 @@ function validateHumanCheckpoints(orgName, humanCheckpoints, allInternalIds, val
12378
11140
  });
12379
11141
  });
12380
11142
  }
12381
- var listBuilderStageKeys = Object.keys(LEAD_GEN_STAGE_CATALOG);
12382
- var ListBuilderStageKeySchema = z.enum(listBuilderStageKeys);
11143
+ var ListBuilderStageKeySchema = z.string().min(1);
12383
11144
 
12384
11145
  // src/worker/list-builder-workflow.ts
12385
11146
  var ListBuilderResultSchema = z.object({