@elevasis/core 0.15.1 → 0.17.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 (72) hide show
  1. package/dist/index.d.ts +1662 -23
  2. package/dist/index.js +171 -24
  3. package/dist/knowledge/index.d.ts +1340 -0
  4. package/dist/knowledge/index.js +138 -0
  5. package/dist/organization-model/index.d.ts +1662 -23
  6. package/dist/organization-model/index.js +171 -24
  7. package/dist/test-utils/index.d.ts +711 -10
  8. package/dist/test-utils/index.js +159 -16
  9. package/package.json +7 -3
  10. package/src/__tests__/publish.test.ts +14 -13
  11. package/src/__tests__/template-core-compatibility.test.ts +4 -4
  12. package/src/_gen/__tests__/__snapshots__/contracts.md.snap +1265 -1154
  13. package/src/auth/multi-tenancy/index.ts +3 -0
  14. package/src/auth/multi-tenancy/theme-presets.ts +45 -0
  15. package/src/auth/multi-tenancy/types.ts +57 -83
  16. package/src/auth/multi-tenancy/users/api-schemas.ts +165 -194
  17. package/src/business/acquisition/activity-events.ts +1 -1
  18. package/src/business/acquisition/api-schemas.ts +1196 -1177
  19. package/src/business/acquisition/crm-state-actions.test.ts +139 -139
  20. package/src/business/acquisition/types.ts +381 -390
  21. package/src/business/crm/api-schemas.ts +40 -0
  22. package/src/business/crm/index.ts +1 -0
  23. package/src/business/deals/api-schemas.ts +79 -0
  24. package/src/business/deals/index.ts +1 -0
  25. package/src/business/projects/types.ts +124 -88
  26. package/src/execution/core/runner-types.ts +61 -80
  27. package/src/execution/engine/tools/integration/server/adapters/gmail/gmail-tools.ts +105 -104
  28. package/src/execution/engine/tools/integration/server/adapters/instantly/instantly-tools.ts +1474 -1473
  29. package/src/execution/engine/tools/integration/server/adapters/millionverifier/millionverifier-tools.ts +103 -102
  30. package/src/execution/engine/tools/integration/server/adapters/signature-api/signature-api-tools.ts +182 -179
  31. package/src/execution/engine/tools/integration/server/adapters/stripe/stripe-tools.ts +310 -309
  32. package/src/execution/engine/tools/integration/tool.ts +255 -253
  33. package/src/execution/engine/tools/lead-service-types.ts +895 -894
  34. package/src/execution/engine/tools/messages.ts +43 -0
  35. package/src/execution/engine/tools/platform/acquisition/types.ts +2 -1
  36. package/src/execution/engine/tools/platform/email/types.ts +97 -96
  37. package/src/execution/engine/tools/types.ts +234 -233
  38. package/src/execution/engine/workflow/types.ts +195 -193
  39. package/src/execution/external/api-schemas.ts +40 -0
  40. package/src/execution/external/index.ts +1 -0
  41. package/src/knowledge/README.md +32 -0
  42. package/src/knowledge/__tests__/queries.test.ts +504 -0
  43. package/src/knowledge/format.ts +99 -0
  44. package/src/knowledge/index.ts +5 -0
  45. package/src/knowledge/published.ts +5 -0
  46. package/src/knowledge/queries.ts +256 -0
  47. package/src/organization-model/__tests__/defaults.test.ts +172 -172
  48. package/src/organization-model/__tests__/foundation.test.ts +7 -7
  49. package/src/organization-model/__tests__/icons.test.ts +27 -0
  50. package/src/organization-model/__tests__/knowledge.test.ts +214 -0
  51. package/src/organization-model/contracts.ts +17 -15
  52. package/src/organization-model/defaults.ts +74 -19
  53. package/src/organization-model/domains/knowledge.ts +53 -0
  54. package/src/organization-model/domains/navigation.ts +416 -399
  55. package/src/organization-model/domains/shared.ts +6 -5
  56. package/src/organization-model/foundation.ts +10 -6
  57. package/src/organization-model/graph/build.ts +209 -182
  58. package/src/organization-model/graph/schema.ts +37 -34
  59. package/src/organization-model/graph/types.ts +47 -31
  60. package/src/organization-model/icons.ts +81 -0
  61. package/src/organization-model/index.ts +8 -3
  62. package/src/organization-model/organization-model.mdx +1 -1
  63. package/src/organization-model/published.ts +103 -86
  64. package/src/organization-model/schema.ts +90 -85
  65. package/src/organization-model/types.ts +40 -33
  66. package/src/platform/index.ts +23 -27
  67. package/src/platform/registry/index.ts +0 -4
  68. package/src/platform/registry/resource-registry.ts +0 -77
  69. package/src/platform/registry/serialized-types.ts +148 -219
  70. package/src/platform/registry/stats-types.ts +60 -60
  71. package/src/reference/_generated/contracts.md +1265 -1154
  72. package/src/platform/registry/__tests__/resource-registry.list-executable.test.ts +0 -393
@@ -19416,11 +19416,82 @@ function makeTask(overrides = {}) {
19416
19416
  ...overrides
19417
19417
  });
19418
19418
  }
19419
+ var ORGANIZATION_MODEL_ICON_TOKENS = [
19420
+ "nav.dashboard",
19421
+ "nav.sales",
19422
+ "nav.crm",
19423
+ "nav.lead-gen",
19424
+ "nav.projects",
19425
+ "nav.operations",
19426
+ "nav.monitoring",
19427
+ "nav.knowledge",
19428
+ "nav.settings",
19429
+ "nav.admin",
19430
+ "nav.archive",
19431
+ "knowledge.playbook",
19432
+ "knowledge.strategy",
19433
+ "knowledge.reference",
19434
+ "feature.dashboard",
19435
+ "feature.sales",
19436
+ "feature.crm",
19437
+ "feature.finance",
19438
+ "feature.lead-gen",
19439
+ "feature.platform",
19440
+ "feature.projects",
19441
+ "feature.operations",
19442
+ "feature.knowledge",
19443
+ "feature.monitoring",
19444
+ "feature.settings",
19445
+ "feature.admin",
19446
+ "feature.archive",
19447
+ "feature.seo",
19448
+ "resource.agent",
19449
+ "resource.workflow",
19450
+ "resource.integration",
19451
+ "resource.database",
19452
+ "resource.user",
19453
+ "resource.team",
19454
+ "integration.gmail",
19455
+ "integration.google-sheets",
19456
+ "integration.attio",
19457
+ "surface.dashboard",
19458
+ "surface.overview",
19459
+ "surface.command-view",
19460
+ "surface.command-queue",
19461
+ "surface.pipeline",
19462
+ "surface.lists",
19463
+ "surface.resources",
19464
+ "surface.settings",
19465
+ "status.success",
19466
+ "status.error",
19467
+ "status.warning",
19468
+ "status.info",
19469
+ "status.pending",
19470
+ "action.approve",
19471
+ "action.reject",
19472
+ "action.retry",
19473
+ "action.edit",
19474
+ "action.view",
19475
+ "action.launch",
19476
+ "action.message",
19477
+ "action.escalate",
19478
+ "action.promote",
19479
+ "action.submit",
19480
+ "action.email"
19481
+ ];
19482
+ var CustomIconTokenSchema = z.string().trim().max(80).regex(/^custom\.[a-z0-9]+(?:[-._][a-z0-9]+)*$/, "Custom icon tokens must start with custom.");
19483
+ var OrganizationModelBuiltinIconTokenSchema = z.enum(ORGANIZATION_MODEL_ICON_TOKENS);
19484
+ var OrganizationModelIconTokenSchema = z.union([
19485
+ OrganizationModelBuiltinIconTokenSchema,
19486
+ CustomIconTokenSchema
19487
+ ]);
19488
+
19489
+ // src/organization-model/domains/shared.ts
19419
19490
  var ModelIdSchema = z.string().trim().min(1).max(100).regex(/^[a-z0-9]+(?:[-._][a-z0-9]+)*$/, "IDs must be lowercase and use -, _, or . separators");
19420
19491
  var LabelSchema = z.string().trim().min(1).max(120);
19421
19492
  var DescriptionSchema = z.string().trim().min(1).max(2e3);
19422
19493
  var ColorTokenSchema = z.string().trim().min(1).max(50);
19423
- var IconNameSchema = z.string().trim().min(1).max(80);
19494
+ var IconNameSchema = OrganizationModelIconTokenSchema;
19424
19495
  var PathSchema = z.string().trim().startsWith("/").max(300);
19425
19496
  var ReferenceIdsSchema = z.array(ModelIdSchema).default([]);
19426
19497
  var DisplayMetadataSchema = z.object({
@@ -19608,7 +19679,7 @@ var DEFAULT_ORGANIZATION_MODEL_PROJECTS = {
19608
19679
  ]
19609
19680
  };
19610
19681
  var NodeIdPathSchema = z.string().trim().min(1).max(100).regex(/^([a-z0-9-]+)(\.[a-z0-9-]+)*$/, "Node IDs must be lowercase dotted paths");
19611
- z.string().trim().min(1).max(200).regex(/^[a-z]+:([a-z0-9-]+)(\.[a-z0-9-]+)*$/, "Node references must use kind:dotted-path");
19682
+ var NodeIdStringSchema = z.string().trim().min(1).max(200).regex(/^[a-z]+:([a-z0-9-]+)(\.[a-z0-9-]+)*$/, "Node references must use kind:dotted-path");
19612
19683
  var UiPositionSchema = z.enum(["sidebar-primary", "sidebar-bottom"]);
19613
19684
  var FeatureSchema = z.object({
19614
19685
  id: NodeIdPathSchema,
@@ -20268,6 +20339,31 @@ var DEFAULT_ORGANIZATION_MODEL_STATUSES = {
20268
20339
  { id: "request.wont_fix", label: "Won't Fix", semanticClass: "request", category: "request" }
20269
20340
  ]
20270
20341
  };
20342
+ var KnowledgeLinkSchema = z.object({
20343
+ nodeId: NodeIdStringSchema
20344
+ });
20345
+ var OrgKnowledgeKindSchema = z.enum(["playbook", "strategy", "reference"]);
20346
+ var OrgKnowledgeNodeSchema = z.object({
20347
+ id: ModelIdSchema,
20348
+ kind: OrgKnowledgeKindSchema,
20349
+ title: z.string().trim().min(1).max(200),
20350
+ summary: z.string().trim().min(1).max(1e3),
20351
+ icon: IconNameSchema.optional(),
20352
+ /** Raw MDX string. Phase 2 will introduce a structured block format. */
20353
+ body: z.string().trim().min(1),
20354
+ /**
20355
+ * Graph links to other OM nodes this knowledge node governs.
20356
+ * Each link emits a `governs` edge: knowledge-node -> target node.
20357
+ */
20358
+ links: z.array(KnowledgeLinkSchema).default([]),
20359
+ /** Identifiers of the roles or members who own this knowledge node. */
20360
+ ownerIds: z.array(ModelIdSchema).default([]),
20361
+ /** ISO date string (YYYY-MM-DD or full ISO 8601) of last meaningful update. */
20362
+ updatedAt: z.string().trim().min(1).max(50)
20363
+ });
20364
+ var KnowledgeDomainSchema = z.object({
20365
+ nodes: z.array(OrgKnowledgeNodeSchema).default([])
20366
+ });
20271
20367
 
20272
20368
  // src/organization-model/schema.ts
20273
20369
  var OrganizationModelSchemaBase = z.object({
@@ -20284,7 +20380,8 @@ var OrganizationModelSchemaBase = z.object({
20284
20380
  roles: RolesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_ROLES),
20285
20381
  goals: GoalsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_GOALS),
20286
20382
  statuses: StatusesDomainSchema.default({ entries: [] }),
20287
- operations: OperationsDomainSchema.default({ entries: [] })
20383
+ operations: OperationsDomainSchema.default({ entries: [] }),
20384
+ knowledge: KnowledgeDomainSchema.default({ nodes: [] })
20288
20385
  });
20289
20386
  function addIssue(ctx, path, message) {
20290
20387
  ctx.addIssue({
@@ -20319,7 +20416,11 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
20319
20416
  if (segments.length > 1) {
20320
20417
  const parentId = segments.slice(0, -1).join(".");
20321
20418
  if (!featuresById.has(parentId)) {
20322
- addIssue(ctx, ["features", featureIndex, "id"], `Feature "${feature.id}" references unknown parent "${parentId}"`);
20419
+ addIssue(
20420
+ ctx,
20421
+ ["features", featureIndex, "id"],
20422
+ `Feature "${feature.id}" references unknown parent "${parentId}"`
20423
+ );
20323
20424
  }
20324
20425
  }
20325
20426
  const hasChildren = model.features.some(
@@ -20379,6 +20480,9 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
20379
20480
  });
20380
20481
 
20381
20482
  // src/organization-model/defaults.ts
20483
+ var DEFAULT_ORGANIZATION_MODEL_KNOWLEDGE = {
20484
+ nodes: []
20485
+ };
20382
20486
  var DEFAULT_ORGANIZATION_MODEL = {
20383
20487
  version: 1,
20384
20488
  features: [
@@ -20387,16 +20491,39 @@ var DEFAULT_ORGANIZATION_MODEL = {
20387
20491
  label: "Dashboard",
20388
20492
  enabled: true,
20389
20493
  path: "/",
20390
- icon: "dashboard",
20494
+ icon: "feature.dashboard",
20391
20495
  uiPosition: "sidebar-primary"
20392
20496
  },
20497
+ {
20498
+ id: "identity",
20499
+ label: "Identity",
20500
+ description: "Company identity, positioning, and market context",
20501
+ enabled: true,
20502
+ color: "indigo"
20503
+ },
20504
+ {
20505
+ id: "platform",
20506
+ label: "Platform",
20507
+ description: "Elevasis platform architecture, capabilities, and implementation patterns",
20508
+ enabled: true,
20509
+ color: "cyan",
20510
+ icon: "feature.platform"
20511
+ },
20512
+ {
20513
+ id: "finance",
20514
+ label: "Finance",
20515
+ description: "Finance operations, accounting, billing, reconciliation, and tax prep",
20516
+ enabled: true,
20517
+ color: "green",
20518
+ icon: "feature.finance"
20519
+ },
20393
20520
  {
20394
20521
  id: "sales",
20395
20522
  label: "Sales",
20396
20523
  description: "Revenue workflows and customer acquisition",
20397
20524
  enabled: true,
20398
20525
  color: "blue",
20399
- icon: "crm",
20526
+ icon: "feature.sales",
20400
20527
  uiPosition: "sidebar-primary"
20401
20528
  },
20402
20529
  {
@@ -20405,7 +20532,7 @@ var DEFAULT_ORGANIZATION_MODEL = {
20405
20532
  description: "Relationship pipeline and deal management",
20406
20533
  enabled: true,
20407
20534
  color: "blue",
20408
- icon: "crm",
20535
+ icon: "feature.crm",
20409
20536
  path: "/crm"
20410
20537
  },
20411
20538
  {
@@ -20414,7 +20541,7 @@ var DEFAULT_ORGANIZATION_MODEL = {
20414
20541
  description: "Prospecting, qualification, and outreach preparation",
20415
20542
  enabled: true,
20416
20543
  color: "cyan",
20417
- icon: "lead-gen",
20544
+ icon: "feature.lead-gen",
20418
20545
  path: "/lead-gen"
20419
20546
  },
20420
20547
  {
@@ -20423,7 +20550,7 @@ var DEFAULT_ORGANIZATION_MODEL = {
20423
20550
  description: "Projects, milestones, and client work execution",
20424
20551
  enabled: true,
20425
20552
  color: "orange",
20426
- icon: "projects",
20553
+ icon: "feature.projects",
20427
20554
  path: "/projects",
20428
20555
  uiPosition: "sidebar-primary"
20429
20556
  },
@@ -20433,14 +20560,14 @@ var DEFAULT_ORGANIZATION_MODEL = {
20433
20560
  description: "Operational resources, topology, and orchestration visibility",
20434
20561
  enabled: true,
20435
20562
  color: "violet",
20436
- icon: "operations",
20563
+ icon: "feature.operations",
20437
20564
  uiPosition: "sidebar-primary"
20438
20565
  },
20439
20566
  {
20440
- id: "operations.command-view",
20567
+ id: "knowledge.command-view",
20441
20568
  label: "Command View",
20442
20569
  enabled: true,
20443
- path: "/operations/command-view",
20570
+ path: "/knowledge/command-view",
20444
20571
  devOnly: true
20445
20572
  },
20446
20573
  {
@@ -20519,7 +20646,7 @@ var DEFAULT_ORGANIZATION_MODEL = {
20519
20646
  id: "settings",
20520
20647
  label: "Settings",
20521
20648
  enabled: true,
20522
- icon: "settings",
20649
+ icon: "feature.settings",
20523
20650
  uiPosition: "sidebar-bottom"
20524
20651
  },
20525
20652
  {
@@ -20575,7 +20702,7 @@ var DEFAULT_ORGANIZATION_MODEL = {
20575
20702
  label: "Admin",
20576
20703
  enabled: true,
20577
20704
  path: "/admin",
20578
- icon: "settings",
20705
+ icon: "feature.admin",
20579
20706
  uiPosition: "sidebar-bottom",
20580
20707
  requiresAdmin: true
20581
20708
  },
@@ -20614,7 +20741,7 @@ var DEFAULT_ORGANIZATION_MODEL = {
20614
20741
  label: "Archive",
20615
20742
  enabled: true,
20616
20743
  path: "/archive",
20617
- icon: "archive",
20744
+ icon: "feature.archive",
20618
20745
  uiPosition: "sidebar-bottom",
20619
20746
  devOnly: true
20620
20747
  },
@@ -20635,6 +20762,21 @@ var DEFAULT_ORGANIZATION_MODEL = {
20635
20762
  label: "SEO",
20636
20763
  enabled: false,
20637
20764
  path: "/seo"
20765
+ },
20766
+ {
20767
+ id: "knowledge",
20768
+ label: "Knowledge",
20769
+ description: "Operational knowledge, playbooks, and strategy docs",
20770
+ enabled: true,
20771
+ color: "teal",
20772
+ icon: "feature.knowledge",
20773
+ uiPosition: "sidebar-primary"
20774
+ },
20775
+ {
20776
+ id: "knowledge.base",
20777
+ label: "Knowledge Base",
20778
+ enabled: true,
20779
+ path: "/knowledge"
20638
20780
  }
20639
20781
  ],
20640
20782
  branding: DEFAULT_ORGANIZATION_MODEL_BRANDING,
@@ -20648,7 +20790,8 @@ var DEFAULT_ORGANIZATION_MODEL = {
20648
20790
  roles: DEFAULT_ORGANIZATION_MODEL_ROLES,
20649
20791
  goals: DEFAULT_ORGANIZATION_MODEL_GOALS,
20650
20792
  statuses: DEFAULT_ORGANIZATION_MODEL_STATUSES,
20651
- operations: DEFAULT_ORGANIZATION_MODEL_OPERATIONS
20793
+ operations: DEFAULT_ORGANIZATION_MODEL_OPERATIONS,
20794
+ knowledge: DEFAULT_ORGANIZATION_MODEL_KNOWLEDGE
20652
20795
  };
20653
20796
 
20654
20797
  // src/organization-model/resolve.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elevasis/core",
3
- "version": "0.15.1",
3
+ "version": "0.17.0",
4
4
  "license": "MIT",
5
5
  "description": "Minimal shared constants across Elevasis monorepo",
6
6
  "sideEffects": false,
@@ -9,6 +9,8 @@
9
9
  "dist"
10
10
  ],
11
11
  "type": "module",
12
+ "main": "./dist/index.js",
13
+ "types": "./dist/index.d.ts",
12
14
  "exports": {
13
15
  ".": {
14
16
  "types": "./dist/index.d.ts",
@@ -25,6 +27,10 @@
25
27
  "./entities": {
26
28
  "types": "./dist/business/entities-published.d.ts",
27
29
  "import": "./dist/business/entities-published.js"
30
+ },
31
+ "./knowledge": {
32
+ "types": "./dist/knowledge/index.d.ts",
33
+ "import": "./dist/knowledge/index.js"
28
34
  }
29
35
  },
30
36
  "devDependencies": {
@@ -58,8 +64,6 @@
58
64
  "stripe": "^20.2.0",
59
65
  "zod": "^4.1.0"
60
66
  },
61
- "main": "./dist/index.js",
62
- "types": "./dist/index.d.ts",
63
67
  "scripts": {
64
68
  "build": "tsc --noEmit",
65
69
  "build:publish": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.build.json && pnpm exec tsup && pnpm exec rollup -c rollup.dts.config.mjs && node -e \"require('fs').rmSync('dist/_dts',{recursive:true,force:true})\"",
@@ -1,15 +1,15 @@
1
- import { readFileSync } from 'node:fs'
2
- import path from 'node:path'
3
- import { describe, expect, it } from 'vitest'
4
-
5
- const packageJsonPath = path.resolve(__dirname, '../../package.json')
6
- const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8')) as {
7
- publishConfig?: {
8
- name?: string
9
- exports?: Record<string, unknown>
10
- }
11
- }
12
-
1
+ import { readFileSync } from 'node:fs'
2
+ import path from 'node:path'
3
+ import { describe, expect, it } from 'vitest'
4
+
5
+ const packageJsonPath = path.resolve(__dirname, '../../package.json')
6
+ const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8')) as {
7
+ publishConfig?: {
8
+ name?: string
9
+ exports?: Record<string, unknown>
10
+ }
11
+ }
12
+
13
13
  describe('core publish surface', () => {
14
14
  it('publishes the curated @elevasis/core organization-model wrapper', () => {
15
15
  expect(packageJson.publishConfig?.name).toBe('@elevasis/core')
@@ -17,7 +17,8 @@ describe('core publish surface', () => {
17
17
  '.',
18
18
  './test-utils',
19
19
  './organization-model',
20
- './entities'
20
+ './entities',
21
+ './knowledge'
21
22
  ])
22
23
  })
23
24
  })
@@ -27,28 +27,28 @@ describe('template core compatibility', () => {
27
27
  id: 'operations',
28
28
  label: 'Operations',
29
29
  surfaceType: 'dashboard',
30
- expectedIcon: 'operations',
30
+ expectedIcon: 'feature.operations',
31
31
  expectedPath: '/operations',
32
32
  },
33
33
  {
34
34
  id: PROJECTS_FEATURE_ID,
35
35
  label: 'Projects',
36
36
  surfaceType: 'list',
37
- expectedIcon: 'projects',
37
+ expectedIcon: 'feature.projects',
38
38
  expectedPath: '/projects',
39
39
  },
40
40
  {
41
41
  id: 'lead-gen',
42
42
  label: 'Lead Gen',
43
43
  surfaceType: 'list',
44
- expectedIcon: 'lead-gen',
44
+ expectedIcon: 'feature.lead-gen',
45
45
  expectedPath: '/lead-gen',
46
46
  },
47
47
  {
48
48
  id: 'crm',
49
49
  label: 'CRM',
50
50
  surfaceType: 'graph',
51
- expectedIcon: 'crm',
51
+ expectedIcon: 'feature.crm',
52
52
  expectedPath: '/crm',
53
53
  }
54
54
  ] as const