@elevasis/core 0.39.0 → 0.41.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.
- package/dist/auth/index.d.ts +69 -2
- package/dist/index.d.ts +650 -413
- package/dist/index.js +92 -3
- package/dist/knowledge/index.d.ts +90 -19
- package/dist/knowledge/index.js +10 -1
- package/dist/organization-model/index.d.ts +650 -413
- package/dist/organization-model/index.js +92 -3
- package/dist/test-utils/index.d.ts +104 -37
- package/dist/test-utils/index.js +81 -2
- package/package.json +1 -1
- package/src/_gen/__tests__/__snapshots__/contracts.md.snap +54 -0
- package/src/business/acquisition/ontology-validation.ts +31 -9
- package/src/business/clients/api-schemas.test.ts +63 -29
- package/src/business/clients/api-schemas.ts +41 -29
- package/src/knowledge/index.ts +14 -1
- package/src/knowledge/queries.ts +74 -15
- package/src/organization-model/__tests__/clients.test.ts +146 -0
- package/src/organization-model/__tests__/snapshot-hash.test.ts +82 -0
- package/src/organization-model/cross-ref.ts +4 -0
- package/src/organization-model/defaults.ts +2 -2
- package/src/organization-model/domains/knowledge.ts +1 -0
- package/src/organization-model/graph/build.ts +23 -6
- package/src/organization-model/graph/schema.ts +4 -3
- package/src/organization-model/graph/types.ts +4 -3
- package/src/organization-model/helpers.ts +15 -0
- package/src/organization-model/index.ts +1 -0
- package/src/organization-model/published.ts +19 -1
- package/src/organization-model/schema-refinements.ts +2 -2
- package/src/organization-model/schema.ts +109 -0
- package/src/organization-model/server/snapshot-hash-server.ts +23 -0
- package/src/organization-model/snapshot-hash.ts +62 -0
- package/src/organization-model/types.ts +19 -1
- package/src/platform/constants/versions.ts +1 -1
- package/src/reference/_generated/contracts.md +54 -0
- package/src/server.ts +292 -289
- package/src/supabase/database.types.ts +3 -0
package/dist/index.js
CHANGED
|
@@ -740,6 +740,15 @@ function defineDomainRecord(schema, entries) {
|
|
|
740
740
|
function childSystemsOf2(system) {
|
|
741
741
|
return system.systems ?? system.subsystems ?? {};
|
|
742
742
|
}
|
|
743
|
+
function listClientProfiles(model) {
|
|
744
|
+
return Object.values(model.clients ?? {}).sort((a, b) => a.slug.localeCompare(b.slug));
|
|
745
|
+
}
|
|
746
|
+
function getClientProfile(model, id) {
|
|
747
|
+
return model.clients?.[id];
|
|
748
|
+
}
|
|
749
|
+
function getClientProfileBySlug(model, slug) {
|
|
750
|
+
return Object.values(model.clients ?? {}).find((client) => client.slug === slug);
|
|
751
|
+
}
|
|
743
752
|
function getSystem(model, path) {
|
|
744
753
|
const flatMatch = model.systems[path];
|
|
745
754
|
if (flatMatch !== void 0) return flatMatch;
|
|
@@ -1425,6 +1434,7 @@ function defineGoals(entries) {
|
|
|
1425
1434
|
}
|
|
1426
1435
|
var KnowledgeTargetKindSchema = z.enum([
|
|
1427
1436
|
"system",
|
|
1437
|
+
"client",
|
|
1428
1438
|
"resource",
|
|
1429
1439
|
"knowledge",
|
|
1430
1440
|
"stage",
|
|
@@ -1800,6 +1810,7 @@ function buildOmCrossRefIndex(model) {
|
|
|
1800
1810
|
systemsById.set(system.id, system);
|
|
1801
1811
|
}
|
|
1802
1812
|
const resourceIds = new Set(Object.keys(model.resources ?? {}));
|
|
1813
|
+
const clientIds = new Set(Object.keys(model.clients ?? {}));
|
|
1803
1814
|
const knowledgeIds = new Set(Object.keys(model.knowledge ?? {}));
|
|
1804
1815
|
const roleIds = new Set(Object.keys(model.roles ?? {}));
|
|
1805
1816
|
const goalIds = new Set(Object.keys(model.goals ?? {}));
|
|
@@ -1833,6 +1844,7 @@ function buildOmCrossRefIndex(model) {
|
|
|
1833
1844
|
return {
|
|
1834
1845
|
systemsById,
|
|
1835
1846
|
resourceIds,
|
|
1847
|
+
clientIds,
|
|
1836
1848
|
knowledgeIds,
|
|
1837
1849
|
roleIds,
|
|
1838
1850
|
goalIds,
|
|
@@ -1846,6 +1858,7 @@ function buildOmCrossRefIndex(model) {
|
|
|
1846
1858
|
}
|
|
1847
1859
|
function knowledgeTargetExists(index, kind, id) {
|
|
1848
1860
|
if (kind === "system") return index.systemsById.has(id);
|
|
1861
|
+
if (kind === "client") return index.clientIds.has(id);
|
|
1849
1862
|
if (kind === "resource") return index.resourceIds.has(id);
|
|
1850
1863
|
if (kind === "knowledge") return index.knowledgeIds.has(id);
|
|
1851
1864
|
if (kind === "stage") return index.stageIds.has(id);
|
|
@@ -1879,10 +1892,10 @@ function asRoleHolderArray(heldBy) {
|
|
|
1879
1892
|
function isKnowledgeKindCompatibleWithTarget(knowledgeKind, targetKind) {
|
|
1880
1893
|
if (knowledgeKind === "reference") return true;
|
|
1881
1894
|
if (knowledgeKind === "playbook") {
|
|
1882
|
-
return ["system", "resource", "stage", "action", "ontology"].includes(targetKind);
|
|
1895
|
+
return ["system", "client", "resource", "stage", "action", "ontology"].includes(targetKind);
|
|
1883
1896
|
}
|
|
1884
1897
|
if (knowledgeKind === "strategy") {
|
|
1885
|
-
return ["system", "goal", "offering", "customer-segment", "ontology"].includes(targetKind);
|
|
1898
|
+
return ["system", "client", "goal", "offering", "customer-segment", "ontology"].includes(targetKind);
|
|
1886
1899
|
}
|
|
1887
1900
|
return false;
|
|
1888
1901
|
}
|
|
@@ -2410,9 +2423,68 @@ function refineOrganizationModel(model, ctx) {
|
|
|
2410
2423
|
}
|
|
2411
2424
|
|
|
2412
2425
|
// src/organization-model/schema.ts
|
|
2426
|
+
var ClientProfileIdSchema = z.string().uuid();
|
|
2427
|
+
var ClientProfileStatusSchema = z.enum(["active", "onboarding", "paused", "completed", "churned"]);
|
|
2428
|
+
var ClientProfileSourceSchema = z.string().trim().min(1).max(64).regex(/^[a-z][a-z0-9_]*$/, "Source must use lowercase letters, numbers, and underscores");
|
|
2429
|
+
var ClientProfileIdentitySchema = z.object({
|
|
2430
|
+
organizationName: LabelSchema.optional(),
|
|
2431
|
+
shortName: z.string().trim().min(1).max(40).optional(),
|
|
2432
|
+
clientBrief: z.string().trim().max(4e3).default(""),
|
|
2433
|
+
geographicFocus: z.array(z.string().trim().min(1).max(200)).default([]),
|
|
2434
|
+
timeZone: z.string().trim().min(1).max(100).default("UTC")
|
|
2435
|
+
}).passthrough().default({
|
|
2436
|
+
clientBrief: "",
|
|
2437
|
+
geographicFocus: [],
|
|
2438
|
+
timeZone: "UTC"
|
|
2439
|
+
});
|
|
2440
|
+
var ClientProfileBrandingSchema = z.object({
|
|
2441
|
+
voice: z.string().trim().max(280).optional(),
|
|
2442
|
+
tagline: z.string().trim().max(200).optional(),
|
|
2443
|
+
values: z.array(z.string().trim().min(1).max(100)).default([])
|
|
2444
|
+
}).passthrough().default({
|
|
2445
|
+
values: []
|
|
2446
|
+
});
|
|
2447
|
+
var ClientProfileWorkspaceSchema = z.object({
|
|
2448
|
+
kind: z.enum(["external-project", "internal-project", "none"]).optional(),
|
|
2449
|
+
owner: z.enum(["developer", "client", "platform"]).optional(),
|
|
2450
|
+
projectId: z.string().trim().min(1).max(200).optional(),
|
|
2451
|
+
workspacePath: z.string().trim().min(1).max(500).optional()
|
|
2452
|
+
}).passthrough().default({});
|
|
2453
|
+
var ClientProfileLinksSchema = z.object({
|
|
2454
|
+
projectIds: z.array(z.string().uuid()).default([]),
|
|
2455
|
+
primaryCompanyId: z.string().uuid().optional(),
|
|
2456
|
+
primaryContactId: z.string().uuid().optional(),
|
|
2457
|
+
sourceDealId: z.string().uuid().optional()
|
|
2458
|
+
}).default({
|
|
2459
|
+
projectIds: []
|
|
2460
|
+
});
|
|
2461
|
+
var ClientProfilePromptsSchema = z.object({
|
|
2462
|
+
defaultContext: z.string().trim().max(8e3).default("")
|
|
2463
|
+
}).passthrough().default({
|
|
2464
|
+
defaultContext: ""
|
|
2465
|
+
});
|
|
2466
|
+
var ClientProfileSchema = z.object({
|
|
2467
|
+
id: ClientProfileIdSchema,
|
|
2468
|
+
slug: ModelIdSchema,
|
|
2469
|
+
name: LabelSchema,
|
|
2470
|
+
status: ClientProfileStatusSchema.default("onboarding"),
|
|
2471
|
+
source: ClientProfileSourceSchema.optional(),
|
|
2472
|
+
identity: ClientProfileIdentitySchema,
|
|
2473
|
+
branding: ClientProfileBrandingSchema,
|
|
2474
|
+
workspace: ClientProfileWorkspaceSchema,
|
|
2475
|
+
links: ClientProfileLinksSchema,
|
|
2476
|
+
prompts: ClientProfilePromptsSchema,
|
|
2477
|
+
config: z.record(z.string().trim().min(1).max(200), JsonValueSchema).default({}),
|
|
2478
|
+
customValues: z.record(z.string().trim().min(1).max(200), JsonValueSchema).default({})
|
|
2479
|
+
}).strict();
|
|
2480
|
+
var ClientProfilesDomainSchema = z.record(ClientProfileIdSchema, ClientProfileSchema).refine((record) => Object.entries(record).every(([key, entry]) => entry.id === key), {
|
|
2481
|
+
message: "Each client profile id must match its map key"
|
|
2482
|
+
}).default({});
|
|
2483
|
+
var DEFAULT_ORGANIZATION_MODEL_CLIENTS = {};
|
|
2413
2484
|
var OrganizationModelDomainKeySchema = z.enum([
|
|
2414
2485
|
"branding",
|
|
2415
2486
|
"identity",
|
|
2487
|
+
"clients",
|
|
2416
2488
|
"customers",
|
|
2417
2489
|
"offerings",
|
|
2418
2490
|
"roles",
|
|
@@ -2433,6 +2505,7 @@ var OrganizationModelDomainMetadataSchema = z.object({
|
|
|
2433
2505
|
var DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA = {
|
|
2434
2506
|
branding: { version: 1, lastModified: "2026-05-10" },
|
|
2435
2507
|
identity: { version: 1, lastModified: "2026-05-10" },
|
|
2508
|
+
clients: { version: 1, lastModified: "2026-05-30" },
|
|
2436
2509
|
customers: { version: 1, lastModified: "2026-05-10" },
|
|
2437
2510
|
offerings: { version: 1, lastModified: "2026-05-10" },
|
|
2438
2511
|
roles: { version: 1, lastModified: "2026-05-10" },
|
|
@@ -2449,6 +2522,7 @@ var DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA = {
|
|
|
2449
2522
|
var OrganizationModelDomainMetadataByDomainSchema = z.object({
|
|
2450
2523
|
branding: OrganizationModelDomainMetadataSchema,
|
|
2451
2524
|
identity: OrganizationModelDomainMetadataSchema,
|
|
2525
|
+
clients: OrganizationModelDomainMetadataSchema,
|
|
2452
2526
|
customers: OrganizationModelDomainMetadataSchema,
|
|
2453
2527
|
offerings: OrganizationModelDomainMetadataSchema,
|
|
2454
2528
|
roles: OrganizationModelDomainMetadataSchema,
|
|
@@ -2464,10 +2538,23 @@ var OrganizationModelDomainMetadataByDomainSchema = z.object({
|
|
|
2464
2538
|
}).partial().default(DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA).transform((metadata) => ({ ...DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA, ...metadata }));
|
|
2465
2539
|
var OrganizationModelSchemaBase = z.object({
|
|
2466
2540
|
version: z.literal(1).default(1),
|
|
2541
|
+
/**
|
|
2542
|
+
* Deterministic SHA-256 hex hash of the full resolved model, excluding this
|
|
2543
|
+
* field itself and volatile domainMetadata.lastModified values.
|
|
2544
|
+
*
|
|
2545
|
+
* Stamped at deploy time by the platform OM assembly and persisted alongside
|
|
2546
|
+
* the snapshot in the DB. Compared at API boot to detect stale deployed
|
|
2547
|
+
* snapshots (primary gate: deploy; secondary backstop: boot).
|
|
2548
|
+
*
|
|
2549
|
+
* Optional — absent on models that predate Step 2 versioning or that have
|
|
2550
|
+
* not been stamped (e.g. tenant partial overrides before re-deploy).
|
|
2551
|
+
*/
|
|
2552
|
+
snapshotHash: z.string().optional(),
|
|
2467
2553
|
domainMetadata: OrganizationModelDomainMetadataByDomainSchema,
|
|
2468
2554
|
branding: OrganizationModelBrandingSchema.default(DEFAULT_ORGANIZATION_MODEL_BRANDING),
|
|
2469
2555
|
navigation: OrganizationModelNavigationSchema,
|
|
2470
2556
|
identity: IdentityDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_IDENTITY),
|
|
2557
|
+
clients: ClientProfilesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_CLIENTS),
|
|
2471
2558
|
customers: CustomersDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_CUSTOMERS),
|
|
2472
2559
|
offerings: OfferingsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_OFFERINGS),
|
|
2473
2560
|
roles: RolesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_ROLES),
|
|
@@ -2486,6 +2573,7 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine(refineOrga
|
|
|
2486
2573
|
var OrganizationGraphNodeKindSchema = z.enum([
|
|
2487
2574
|
"organization",
|
|
2488
2575
|
"system",
|
|
2576
|
+
"client",
|
|
2489
2577
|
"role",
|
|
2490
2578
|
"action",
|
|
2491
2579
|
"entity",
|
|
@@ -2597,6 +2685,7 @@ var DEFAULT_ORGANIZATION_MODEL = {
|
|
|
2597
2685
|
branding: DEFAULT_ORGANIZATION_MODEL_BRANDING,
|
|
2598
2686
|
navigation: DEFAULT_ORGANIZATION_MODEL_NAVIGATION2,
|
|
2599
2687
|
identity: DEFAULT_ORGANIZATION_MODEL_IDENTITY,
|
|
2688
|
+
clients: DEFAULT_ORGANIZATION_MODEL_CLIENTS,
|
|
2600
2689
|
customers: DEFAULT_ORGANIZATION_MODEL_CUSTOMERS,
|
|
2601
2690
|
offerings: DEFAULT_ORGANIZATION_MODEL_OFFERINGS,
|
|
2602
2691
|
roles: DEFAULT_ORGANIZATION_MODEL_ROLES,
|
|
@@ -3492,4 +3581,4 @@ function scaffoldOrganizationModel(model, spec) {
|
|
|
3492
3581
|
return scaffoldKnowledgeNode(model, spec);
|
|
3493
3582
|
}
|
|
3494
3583
|
|
|
3495
|
-
export { ActionIdSchema, ActionInvocationKindSchema, ActionInvocationSchema, ActionRefSchema, ActionSchema, ActionScopeSchema, ActionsDomainSchema, AgentKindSchema, AgentResourceEntrySchema, AgentRoleHolderSchema, ApiEndpointInvocationSchema, CodeReferenceRoleSchema, CodeReferenceSchema, ContractRefSchema, CustomerSegmentSchema, CustomersDomainSchema, DEFAULT_ONTOLOGY_SCOPE, DEFAULT_ORGANIZATION_MODEL, DEFAULT_ORGANIZATION_MODEL_ACTIONS, DEFAULT_ORGANIZATION_MODEL_CUSTOMERS, DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA, DEFAULT_ORGANIZATION_MODEL_GOALS, DEFAULT_ORGANIZATION_MODEL_NAVIGATION, DEFAULT_ORGANIZATION_MODEL_OFFERINGS, DEFAULT_ORGANIZATION_MODEL_POLICIES, DEFAULT_ORGANIZATION_MODEL_RESOURCES, DEFAULT_ORGANIZATION_MODEL_ROLES, DEFAULT_ORGANIZATION_MODEL_STATUSES, DEFAULT_ORGANIZATION_MODEL_SYSTEMS, DEFAULT_ORGANIZATION_MODEL_TOPOLOGY, EntitiesDomainSchema, EntityIdSchema, EntityLinkKindSchema, EntityLinkSchema, EntitySchema, EventDescriptorSchema, EventEmissionDescriptorSchema, EventIdSchema, FirmographicsSchema, GoalsDomainSchema, HumanRoleHolderSchema, IconNameSchema, IntegrationResourceEntrySchema, KNOWLEDGE_FEATURE_ID, KNOWLEDGE_SYSTEM_ID, KeyResultSchema, KnowledgeDomainSchema, KnowledgeLinkSchema, KnowledgeTargetKindSchema, KnowledgeTargetRefSchema, LinkSchema, MONITORING_FEATURE_ID, MONITORING_SYSTEM_ID, McpToolInvocationSchema, NavigationGroupSchema, NodeIdPathSchema, NodeIdStringSchema, OPERATIONS_COMMAND_VIEW_SURFACE_ID, OPERATIONS_FEATURE_ID, OPERATIONS_SYSTEM_ID, ORGANIZATION_MODEL_ICON_TOKENS, ObjectiveSchema, OfferingsDomainSchema, OmTopologyDomainSchema, OmTopologyMetadataSchema, OmTopologyNodeKindSchema, OmTopologyNodeRefSchema, OmTopologyRelationshipKindSchema, OmTopologyRelationshipSchema, OmTopologySystemInterfaceGrantMetadataSchema, OmTopologySystemInterfaceGrantSchema, OntologyActionTypeSchema, OntologyCatalogTypeSchema, OntologyEventTypeSchema, OntologyGroupSchema, OntologyIdSchema, OntologyInterfaceTypeSchema, OntologyKindSchema, OntologyLinkTypeSchema, OntologyObjectTypeSchema, OntologyScopeSchema, OntologySharedPropertySchema, OntologySurfaceTypeSchema, OntologyValueTypeSchema, OrgKnowledgeKindSchema, OrgKnowledgeNodeSchema, OrganizationModelBuiltinIconTokenSchema, OrganizationModelDomainKeySchema, OrganizationModelDomainMetadataByDomainSchema, OrganizationModelDomainMetadataSchema, OrganizationModelIconTokenSchema, OrganizationModelNavigationSchema, OrganizationModelSchema, PROJECTS_FEATURE_ID, PROJECTS_INDEX_SURFACE_ID, PROJECTS_SYSTEM_ID, PROJECTS_VIEW_ACTION_ID, PROSPECTING_FEATURE_ID, PROSPECTING_LISTS_SURFACE_ID, PROSPECTING_SYSTEM_ID, PoliciesDomainSchema, PolicyApplicabilitySchema, PolicyEffectSchema, PolicyIdSchema, PolicyPredicateSchema, PolicySchema, PolicyTriggerSchema, PricingModelSchema, ProductSchema, ResourceEntrySchema, ResourceGovernanceStatusSchema, ResourceIdSchema, ResourceKindSchema, ResourceOntologyBindingSchema, ResourcesDomainSchema, RoleHolderSchema, RoleHoldersSchema, RoleIdSchema, RoleSchema, RolesDomainSchema, SALES_FEATURE_ID, SALES_PIPELINE_SURFACE_ID, SALES_SYSTEM_ID, SEO_FEATURE_ID, SEO_SYSTEM_ID, SETTINGS_FEATURE_ID, SETTINGS_ROLES_SURFACE_ID, SETTINGS_SYSTEM_ID, SYSTEM_INTERFACE_PROFILES, SYSTEM_INTERFACE_READINESS_PROFILES, ScriptExecutionInvocationSchema, ScriptResourceEntrySchema, ScriptResourceLanguageSchema, ScriptResourceSourceSchema, SidebarNavigationSchema, SidebarNodeSchema, SidebarSectionSchema, SidebarSurfaceTargetsSchema, SlashCommandInvocationSchema, StatusEntrySchema, StatusSemanticClassSchema, StatusesDomainSchema, SurfaceDefinitionSchema, SurfaceTypeSchema, SystemApiInterfaceSchema, SystemEntrySchema, SystemIdSchema, SystemInterfaceKeySchema, SystemInterfaceLifecycleSchema, SystemInterfaceReadinessProfileSchema, SystemInterfaceRefSchema, SystemKindSchema, SystemLifecycleSchema, SystemPathSchema, SystemStatusSchema, SystemUiSchema, SystemsDomainSchema, TeamRoleHolderSchema, TechStackEntrySchema, TopbarActionNodeSchema, TopbarSectionSchema, UiPositionSchema, WorkflowResourceEntrySchema, compileOrganizationOntology, compileTopologyNodeRef, createFoundationOrganizationModel, defineAction, defineActions, defineCustomer, defineCustomers, defineDomainRecord, defineEntities, defineEntity, defineGoal, defineGoals, defineKnowledgeNode, defineKnowledgeNodes, defineOffering, defineOfferings, defineOrganizationModel, definePolicies, definePolicy, defineResource, defineResourceOntology, defineResources, defineRole, defineRoles, defineStatus, defineStatuses, defineSystem, defineSystems, defineTopology, defineTopologyRelationship, findOrganizationActionById, formatOntologyId, getOntologyDiagnostics, getSortedSidebarEntries, isOntologyGraphNodeId, isOntologyTopologyRef, listAllSystems, listResolvedOntologyRecords, ontologyGraphNodeId, ontologyIdFromGraphNodeId, parseContractRef, parseOntologyId, parseTopologyNodeRef, projectOrganizationSurfaces, resolveOrganizationModel, resolveOrganizationModelWithResources, scaffoldOrganizationModel, topologyRef, topologyRelationship, validateOrganizationSurfaceProjection };
|
|
3584
|
+
export { ActionIdSchema, ActionInvocationKindSchema, ActionInvocationSchema, ActionRefSchema, ActionSchema, ActionScopeSchema, ActionsDomainSchema, AgentKindSchema, AgentResourceEntrySchema, AgentRoleHolderSchema, ApiEndpointInvocationSchema, ClientProfileBrandingSchema, ClientProfileIdentitySchema, ClientProfileLinksSchema, ClientProfilePromptsSchema, ClientProfileSchema, ClientProfileSourceSchema, ClientProfileStatusSchema, ClientProfileWorkspaceSchema, ClientProfilesDomainSchema, CodeReferenceRoleSchema, CodeReferenceSchema, ContractRefSchema, CustomerSegmentSchema, CustomersDomainSchema, DEFAULT_ONTOLOGY_SCOPE, DEFAULT_ORGANIZATION_MODEL, DEFAULT_ORGANIZATION_MODEL_ACTIONS, DEFAULT_ORGANIZATION_MODEL_CUSTOMERS, DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA, DEFAULT_ORGANIZATION_MODEL_GOALS, DEFAULT_ORGANIZATION_MODEL_NAVIGATION, DEFAULT_ORGANIZATION_MODEL_OFFERINGS, DEFAULT_ORGANIZATION_MODEL_POLICIES, DEFAULT_ORGANIZATION_MODEL_RESOURCES, DEFAULT_ORGANIZATION_MODEL_ROLES, DEFAULT_ORGANIZATION_MODEL_STATUSES, DEFAULT_ORGANIZATION_MODEL_SYSTEMS, DEFAULT_ORGANIZATION_MODEL_TOPOLOGY, EntitiesDomainSchema, EntityIdSchema, EntityLinkKindSchema, EntityLinkSchema, EntitySchema, EventDescriptorSchema, EventEmissionDescriptorSchema, EventIdSchema, FirmographicsSchema, GoalsDomainSchema, HumanRoleHolderSchema, IconNameSchema, IntegrationResourceEntrySchema, KNOWLEDGE_FEATURE_ID, KNOWLEDGE_SYSTEM_ID, KeyResultSchema, KnowledgeDomainSchema, KnowledgeLinkSchema, KnowledgeTargetKindSchema, KnowledgeTargetRefSchema, LinkSchema, MONITORING_FEATURE_ID, MONITORING_SYSTEM_ID, McpToolInvocationSchema, NavigationGroupSchema, NodeIdPathSchema, NodeIdStringSchema, OPERATIONS_COMMAND_VIEW_SURFACE_ID, OPERATIONS_FEATURE_ID, OPERATIONS_SYSTEM_ID, ORGANIZATION_MODEL_ICON_TOKENS, ObjectiveSchema, OfferingsDomainSchema, OmTopologyDomainSchema, OmTopologyMetadataSchema, OmTopologyNodeKindSchema, OmTopologyNodeRefSchema, OmTopologyRelationshipKindSchema, OmTopologyRelationshipSchema, OmTopologySystemInterfaceGrantMetadataSchema, OmTopologySystemInterfaceGrantSchema, OntologyActionTypeSchema, OntologyCatalogTypeSchema, OntologyEventTypeSchema, OntologyGroupSchema, OntologyIdSchema, OntologyInterfaceTypeSchema, OntologyKindSchema, OntologyLinkTypeSchema, OntologyObjectTypeSchema, OntologyScopeSchema, OntologySharedPropertySchema, OntologySurfaceTypeSchema, OntologyValueTypeSchema, OrgKnowledgeKindSchema, OrgKnowledgeNodeSchema, OrganizationModelBuiltinIconTokenSchema, OrganizationModelDomainKeySchema, OrganizationModelDomainMetadataByDomainSchema, OrganizationModelDomainMetadataSchema, OrganizationModelIconTokenSchema, OrganizationModelNavigationSchema, OrganizationModelSchema, PROJECTS_FEATURE_ID, PROJECTS_INDEX_SURFACE_ID, PROJECTS_SYSTEM_ID, PROJECTS_VIEW_ACTION_ID, PROSPECTING_FEATURE_ID, PROSPECTING_LISTS_SURFACE_ID, PROSPECTING_SYSTEM_ID, PoliciesDomainSchema, PolicyApplicabilitySchema, PolicyEffectSchema, PolicyIdSchema, PolicyPredicateSchema, PolicySchema, PolicyTriggerSchema, PricingModelSchema, ProductSchema, ResourceEntrySchema, ResourceGovernanceStatusSchema, ResourceIdSchema, ResourceKindSchema, ResourceOntologyBindingSchema, ResourcesDomainSchema, RoleHolderSchema, RoleHoldersSchema, RoleIdSchema, RoleSchema, RolesDomainSchema, SALES_FEATURE_ID, SALES_PIPELINE_SURFACE_ID, SALES_SYSTEM_ID, SEO_FEATURE_ID, SEO_SYSTEM_ID, SETTINGS_FEATURE_ID, SETTINGS_ROLES_SURFACE_ID, SETTINGS_SYSTEM_ID, SYSTEM_INTERFACE_PROFILES, SYSTEM_INTERFACE_READINESS_PROFILES, ScriptExecutionInvocationSchema, ScriptResourceEntrySchema, ScriptResourceLanguageSchema, ScriptResourceSourceSchema, SidebarNavigationSchema, SidebarNodeSchema, SidebarSectionSchema, SidebarSurfaceTargetsSchema, SlashCommandInvocationSchema, StatusEntrySchema, StatusSemanticClassSchema, StatusesDomainSchema, SurfaceDefinitionSchema, SurfaceTypeSchema, SystemApiInterfaceSchema, SystemEntrySchema, SystemIdSchema, SystemInterfaceKeySchema, SystemInterfaceLifecycleSchema, SystemInterfaceReadinessProfileSchema, SystemInterfaceRefSchema, SystemKindSchema, SystemLifecycleSchema, SystemPathSchema, SystemStatusSchema, SystemUiSchema, SystemsDomainSchema, TeamRoleHolderSchema, TechStackEntrySchema, TopbarActionNodeSchema, TopbarSectionSchema, UiPositionSchema, WorkflowResourceEntrySchema, compileOrganizationOntology, compileTopologyNodeRef, createFoundationOrganizationModel, defineAction, defineActions, defineCustomer, defineCustomers, defineDomainRecord, defineEntities, defineEntity, defineGoal, defineGoals, defineKnowledgeNode, defineKnowledgeNodes, defineOffering, defineOfferings, defineOrganizationModel, definePolicies, definePolicy, defineResource, defineResourceOntology, defineResources, defineRole, defineRoles, defineStatus, defineStatuses, defineSystem, defineSystems, defineTopology, defineTopologyRelationship, findOrganizationActionById, formatOntologyId, getClientProfile, getClientProfileBySlug, getOntologyDiagnostics, getSortedSidebarEntries, isOntologyGraphNodeId, isOntologyTopologyRef, listAllSystems, listClientProfiles, listResolvedOntologyRecords, ontologyGraphNodeId, ontologyIdFromGraphNodeId, parseContractRef, parseOntologyId, parseTopologyNodeRef, projectOrganizationSurfaces, resolveOrganizationModel, resolveOrganizationModelWithResources, scaffoldOrganizationModel, topologyRef, topologyRelationship, validateOrganizationSurfaceProjection };
|
|
@@ -278,6 +278,7 @@ declare const OrgKnowledgeNodeSchema: z.ZodObject<{
|
|
|
278
278
|
action: "action";
|
|
279
279
|
ontology: "ontology";
|
|
280
280
|
role: "role";
|
|
281
|
+
client: "client";
|
|
281
282
|
stage: "stage";
|
|
282
283
|
goal: "goal";
|
|
283
284
|
"customer-segment": "customer-segment";
|
|
@@ -289,7 +290,7 @@ declare const OrgKnowledgeNodeSchema: z.ZodObject<{
|
|
|
289
290
|
nodeId: z.ZodUnion<readonly [z.ZodString, z.ZodTemplateLiteral<`ontology:${string}`>]>;
|
|
290
291
|
}, z.core.$strip>]>, z.ZodTransform<{
|
|
291
292
|
target: {
|
|
292
|
-
kind: "knowledge" | "system" | "resource" | "action" | "ontology" | "role" | "stage" | "goal" | "customer-segment" | "offering";
|
|
293
|
+
kind: "knowledge" | "system" | "resource" | "action" | "ontology" | "role" | "client" | "stage" | "goal" | "customer-segment" | "offering";
|
|
293
294
|
id: string;
|
|
294
295
|
};
|
|
295
296
|
nodeId: string;
|
|
@@ -297,7 +298,7 @@ declare const OrgKnowledgeNodeSchema: z.ZodObject<{
|
|
|
297
298
|
nodeId: string;
|
|
298
299
|
} | {
|
|
299
300
|
target: {
|
|
300
|
-
kind: "knowledge" | "system" | "resource" | "action" | "ontology" | "role" | "stage" | "goal" | "customer-segment" | "offering";
|
|
301
|
+
kind: "knowledge" | "system" | "resource" | "action" | "ontology" | "role" | "client" | "stage" | "goal" | "customer-segment" | "offering";
|
|
301
302
|
id: string;
|
|
302
303
|
};
|
|
303
304
|
}>>>>;
|
|
@@ -374,6 +375,7 @@ type OrganizationModelIconToken = z.infer<typeof OrganizationModelIconTokenSchem
|
|
|
374
375
|
|
|
375
376
|
declare const OrganizationModelSchema: z.ZodObject<{
|
|
376
377
|
version: z.ZodDefault<z.ZodLiteral<1>>;
|
|
378
|
+
snapshotHash: z.ZodOptional<z.ZodString>;
|
|
377
379
|
domainMetadata: z.ZodPipe<z.ZodDefault<z.ZodObject<{
|
|
378
380
|
branding: z.ZodOptional<z.ZodObject<{
|
|
379
381
|
version: z.ZodDefault<z.ZodLiteral<1>>;
|
|
@@ -383,6 +385,10 @@ declare const OrganizationModelSchema: z.ZodObject<{
|
|
|
383
385
|
version: z.ZodDefault<z.ZodLiteral<1>>;
|
|
384
386
|
lastModified: z.ZodString;
|
|
385
387
|
}, z.core.$strip>>;
|
|
388
|
+
clients: z.ZodOptional<z.ZodObject<{
|
|
389
|
+
version: z.ZodDefault<z.ZodLiteral<1>>;
|
|
390
|
+
lastModified: z.ZodString;
|
|
391
|
+
}, z.core.$strip>>;
|
|
386
392
|
customers: z.ZodOptional<z.ZodObject<{
|
|
387
393
|
version: z.ZodDefault<z.ZodLiteral<1>>;
|
|
388
394
|
lastModified: z.ZodString;
|
|
@@ -440,6 +446,10 @@ declare const OrganizationModelSchema: z.ZodObject<{
|
|
|
440
446
|
version: 1;
|
|
441
447
|
lastModified: string;
|
|
442
448
|
};
|
|
449
|
+
clients: {
|
|
450
|
+
version: 1;
|
|
451
|
+
lastModified: string;
|
|
452
|
+
};
|
|
443
453
|
customers: {
|
|
444
454
|
version: 1;
|
|
445
455
|
lastModified: string;
|
|
@@ -497,6 +507,10 @@ declare const OrganizationModelSchema: z.ZodObject<{
|
|
|
497
507
|
version: 1;
|
|
498
508
|
lastModified: string;
|
|
499
509
|
} | undefined;
|
|
510
|
+
clients?: {
|
|
511
|
+
version: 1;
|
|
512
|
+
lastModified: string;
|
|
513
|
+
} | undefined;
|
|
500
514
|
customers?: {
|
|
501
515
|
version: 1;
|
|
502
516
|
lastModified: string;
|
|
@@ -689,6 +703,56 @@ declare const OrganizationModelSchema: z.ZodObject<{
|
|
|
689
703
|
shortName: z.ZodOptional<z.ZodString>;
|
|
690
704
|
description: z.ZodOptional<z.ZodString>;
|
|
691
705
|
}, z.core.$loose>>;
|
|
706
|
+
clients: z.ZodDefault<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
707
|
+
id: z.ZodString;
|
|
708
|
+
slug: z.ZodString;
|
|
709
|
+
name: z.ZodString;
|
|
710
|
+
status: z.ZodDefault<z.ZodEnum<{
|
|
711
|
+
active: "active";
|
|
712
|
+
onboarding: "onboarding";
|
|
713
|
+
paused: "paused";
|
|
714
|
+
completed: "completed";
|
|
715
|
+
churned: "churned";
|
|
716
|
+
}>>;
|
|
717
|
+
source: z.ZodOptional<z.ZodString>;
|
|
718
|
+
identity: z.ZodDefault<z.ZodObject<{
|
|
719
|
+
organizationName: z.ZodOptional<z.ZodString>;
|
|
720
|
+
shortName: z.ZodOptional<z.ZodString>;
|
|
721
|
+
clientBrief: z.ZodDefault<z.ZodString>;
|
|
722
|
+
geographicFocus: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
723
|
+
timeZone: z.ZodDefault<z.ZodString>;
|
|
724
|
+
}, z.core.$loose>>;
|
|
725
|
+
branding: z.ZodDefault<z.ZodObject<{
|
|
726
|
+
voice: z.ZodOptional<z.ZodString>;
|
|
727
|
+
tagline: z.ZodOptional<z.ZodString>;
|
|
728
|
+
values: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
729
|
+
}, z.core.$loose>>;
|
|
730
|
+
workspace: z.ZodDefault<z.ZodObject<{
|
|
731
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
732
|
+
"external-project": "external-project";
|
|
733
|
+
"internal-project": "internal-project";
|
|
734
|
+
none: "none";
|
|
735
|
+
}>>;
|
|
736
|
+
owner: z.ZodOptional<z.ZodEnum<{
|
|
737
|
+
platform: "platform";
|
|
738
|
+
client: "client";
|
|
739
|
+
developer: "developer";
|
|
740
|
+
}>>;
|
|
741
|
+
projectId: z.ZodOptional<z.ZodString>;
|
|
742
|
+
workspacePath: z.ZodOptional<z.ZodString>;
|
|
743
|
+
}, z.core.$loose>>;
|
|
744
|
+
links: z.ZodDefault<z.ZodObject<{
|
|
745
|
+
projectIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
746
|
+
primaryCompanyId: z.ZodOptional<z.ZodString>;
|
|
747
|
+
primaryContactId: z.ZodOptional<z.ZodString>;
|
|
748
|
+
sourceDealId: z.ZodOptional<z.ZodString>;
|
|
749
|
+
}, z.core.$strip>>;
|
|
750
|
+
prompts: z.ZodDefault<z.ZodObject<{
|
|
751
|
+
defaultContext: z.ZodDefault<z.ZodString>;
|
|
752
|
+
}, z.core.$loose>>;
|
|
753
|
+
config: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
754
|
+
customValues: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
755
|
+
}, z.core.$strict>>>>;
|
|
692
756
|
customers: z.ZodDefault<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
693
757
|
id: z.ZodString;
|
|
694
758
|
order: z.ZodNumber;
|
|
@@ -1342,6 +1406,7 @@ declare const OrganizationModelSchema: z.ZodObject<{
|
|
|
1342
1406
|
action: "action";
|
|
1343
1407
|
ontology: "ontology";
|
|
1344
1408
|
role: "role";
|
|
1409
|
+
client: "client";
|
|
1345
1410
|
stage: "stage";
|
|
1346
1411
|
goal: "goal";
|
|
1347
1412
|
"customer-segment": "customer-segment";
|
|
@@ -1353,7 +1418,7 @@ declare const OrganizationModelSchema: z.ZodObject<{
|
|
|
1353
1418
|
nodeId: z.ZodUnion<readonly [z.ZodString, z.ZodTemplateLiteral<`ontology:${string}`>]>;
|
|
1354
1419
|
}, z.core.$strip>]>, z.ZodTransform<{
|
|
1355
1420
|
target: {
|
|
1356
|
-
kind: "knowledge" | "system" | "resource" | "action" | "ontology" | "role" | "stage" | "goal" | "customer-segment" | "offering";
|
|
1421
|
+
kind: "knowledge" | "system" | "resource" | "action" | "ontology" | "role" | "client" | "stage" | "goal" | "customer-segment" | "offering";
|
|
1357
1422
|
id: string;
|
|
1358
1423
|
};
|
|
1359
1424
|
nodeId: string;
|
|
@@ -1361,7 +1426,7 @@ declare const OrganizationModelSchema: z.ZodObject<{
|
|
|
1361
1426
|
nodeId: string;
|
|
1362
1427
|
} | {
|
|
1363
1428
|
target: {
|
|
1364
|
-
kind: "knowledge" | "system" | "resource" | "action" | "ontology" | "role" | "stage" | "goal" | "customer-segment" | "offering";
|
|
1429
|
+
kind: "knowledge" | "system" | "resource" | "action" | "ontology" | "role" | "client" | "stage" | "goal" | "customer-segment" | "offering";
|
|
1365
1430
|
id: string;
|
|
1366
1431
|
};
|
|
1367
1432
|
}>>>>;
|
|
@@ -1391,7 +1456,7 @@ type OrganizationModel = z.infer<typeof OrganizationModelSchema>;
|
|
|
1391
1456
|
*/
|
|
1392
1457
|
type RelationshipType = 'triggers' | 'uses' | 'approval';
|
|
1393
1458
|
|
|
1394
|
-
type OrganizationGraphNodeKind = 'organization' | 'system' | 'role' | 'action' | 'entity' | 'event' | 'policy' | 'stage' | 'resource' | 'knowledge' | 'customer-segment' | 'offering' | 'goal' | 'surface' | 'navigation-group' | 'ontology';
|
|
1459
|
+
type OrganizationGraphNodeKind = 'organization' | 'system' | 'client' | 'role' | 'action' | 'entity' | 'event' | 'policy' | 'stage' | 'resource' | 'knowledge' | 'customer-segment' | 'offering' | 'goal' | 'surface' | 'navigation-group' | 'ontology';
|
|
1395
1460
|
type OrganizationGraphEdgeKind = 'contains' | 'references' | 'maps_to' | 'uses' | 'governs' | 'links' | 'affects' | 'emits' | 'originates_from' | 'triggers' | 'approval' | 'applies_to' | 'effects' | 'actions' | 'reads' | 'writes' | 'uses_catalog';
|
|
1396
1461
|
|
|
1397
1462
|
interface OrganizationGraphNode {
|
|
@@ -1467,19 +1532,22 @@ declare function governs(graph: OrganizationGraph, nodeId: string): string[];
|
|
|
1467
1532
|
*/
|
|
1468
1533
|
declare function governedBy(graph: OrganizationGraph, nodeId: string): string[];
|
|
1469
1534
|
/** The recognized mount axes for Knowledge Map paths. */
|
|
1470
|
-
type KnowledgeMount = 'by-system' | 'by-ontology' | 'by-kind' | 'by-owner' | 'graph' | 'node';
|
|
1535
|
+
type KnowledgeMount = 'by-system' | 'by-ontology' | 'by-kind' | 'by-owner' | 'graph' | 'node' | 'all-systems' | 'all-resources' | 'all-roles';
|
|
1471
1536
|
/**
|
|
1472
1537
|
* The result of parsing a Knowledge Map path string.
|
|
1473
1538
|
*
|
|
1474
1539
|
* Shape: `{ mount: KnowledgeMount, args: string[] }`
|
|
1475
1540
|
*
|
|
1476
1541
|
* Per-mount arg arrays:
|
|
1477
|
-
* - `by-system`:
|
|
1478
|
-
* - `by-ontology
|
|
1479
|
-
* - `by-kind`:
|
|
1480
|
-
* - `by-owner`:
|
|
1481
|
-
* - `graph`:
|
|
1482
|
-
* - `node`:
|
|
1542
|
+
* - `by-system`: `[systemId]` (e.g. `['sales.crm']`)
|
|
1543
|
+
* - `by-ontology`: `[ontologyId]` (e.g. `['sales.crm:object/deal']`)
|
|
1544
|
+
* - `by-kind`: `[kind]` (e.g. `['playbook']`)
|
|
1545
|
+
* - `by-owner`: `[ownerId]` (e.g. `['role.ops-lead']`)
|
|
1546
|
+
* - `graph`: `[nodeId, verb]` where verb is `'governs'` or `'governed-by'`
|
|
1547
|
+
* - `node`: `[nodeId]` (single node lookup, no sub-path)
|
|
1548
|
+
* - `all-systems`: `[]` (no args — returns all systems flattened)
|
|
1549
|
+
* - `all-resources`:`[]` (no args — returns all resources)
|
|
1550
|
+
* - `all-roles`: `[]` (no args — returns all roles)
|
|
1483
1551
|
*/
|
|
1484
1552
|
interface ParsedKnowledgePath {
|
|
1485
1553
|
mount: KnowledgeMount;
|
|
@@ -1489,13 +1557,16 @@ interface ParsedKnowledgePath {
|
|
|
1489
1557
|
* Parses a Knowledge Map path string into a `{ mount, args }` descriptor.
|
|
1490
1558
|
*
|
|
1491
1559
|
* Supported path patterns:
|
|
1492
|
-
* `/by-system/<systemId>` -> `{ mount:
|
|
1493
|
-
* `/by-ontology/<ontologyId>` -> `{ mount:
|
|
1494
|
-
* `/by-kind/<kind>`
|
|
1495
|
-
* `/by-owner/<ownerId>`
|
|
1496
|
-
* `/graph/<nodeId>/governs`
|
|
1497
|
-
* `/graph/<nodeId>/governed-by`
|
|
1498
|
-
* `/<nodeId>`
|
|
1560
|
+
* `/by-system/<systemId>` -> `{ mount: ‘by-system’, args: [‘<systemId>’] }`
|
|
1561
|
+
* `/by-ontology/<ontologyId>` -> `{ mount: ‘by-ontology’, args: [‘<ontologyId>’] }`
|
|
1562
|
+
* `/by-kind/<kind>` -> `{ mount: ‘by-kind’, args: [‘<kind>’] }`
|
|
1563
|
+
* `/by-owner/<ownerId>` -> `{ mount: ‘by-owner’, args: [‘<ownerId>’] }`
|
|
1564
|
+
* `/graph/<nodeId>/governs` -> `{ mount: ‘graph’, args: [‘<nodeId>’, ‘governs’] }`
|
|
1565
|
+
* `/graph/<nodeId>/governed-by` -> `{ mount: ‘graph’, args: [‘<nodeId>’, ‘governed-by’] }`
|
|
1566
|
+
* `/<nodeId>` -> `{ mount: ‘node’, args: [‘<nodeId>’] }`
|
|
1567
|
+
* `/all-systems` -> `{ mount: ‘all-systems’, args: [] }`
|
|
1568
|
+
* `/all-resources` -> `{ mount: ‘all-resources’,args: [] }`
|
|
1569
|
+
* `/all-roles` -> `{ mount: ‘all-roles’, args: [] }`
|
|
1499
1570
|
*
|
|
1500
1571
|
* The path MUST start with `/`. Trailing slashes are stripped before parsing.
|
|
1501
1572
|
*
|
package/dist/knowledge/index.js
CHANGED
|
@@ -200,11 +200,20 @@ function parsePath(pathString) {
|
|
|
200
200
|
}
|
|
201
201
|
return { mount: "graph", args: [graphNodeId, verb] };
|
|
202
202
|
}
|
|
203
|
+
if (first === "all-systems" && rest.length === 0) {
|
|
204
|
+
return { mount: "all-systems", args: [] };
|
|
205
|
+
}
|
|
206
|
+
if (first === "all-resources" && rest.length === 0) {
|
|
207
|
+
return { mount: "all-resources", args: [] };
|
|
208
|
+
}
|
|
209
|
+
if (first === "all-roles" && rest.length === 0) {
|
|
210
|
+
return { mount: "all-roles", args: [] };
|
|
211
|
+
}
|
|
203
212
|
if (segments.length === 1) {
|
|
204
213
|
return { mount: "node", args: [first] };
|
|
205
214
|
}
|
|
206
215
|
throw new Error(
|
|
207
|
-
`parsePath: unrecognized path pattern "${pathString}". Supported: /by-system/<id>, /by-kind/<kind>, /by-owner/<id>, /graph/<nodeId>/governs, /graph/<nodeId>/governed-by, /<nodeId
|
|
216
|
+
`parsePath: unrecognized path pattern "${pathString}". Supported: /by-system/<id>, /by-kind/<kind>, /by-owner/<id>, /graph/<nodeId>/governs, /graph/<nodeId>/governed-by, /<nodeId>, /all-systems, /all-resources, /all-roles`
|
|
208
217
|
);
|
|
209
218
|
}
|
|
210
219
|
|