@elevasis/core 0.24.0 → 0.25.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/index.d.ts +3117 -2166
- package/dist/index.js +574 -16
- package/dist/knowledge/index.d.ts +122 -7
- package/dist/organization-model/index.d.ts +3117 -2166
- package/dist/organization-model/index.js +574 -16
- package/dist/test-utils/index.d.ts +135 -45
- package/dist/test-utils/index.js +122 -14
- package/package.json +3 -3
- package/src/_gen/__tests__/__snapshots__/contracts.md.snap +139 -101
- package/src/execution/engine/llm/adapters/__tests__/openrouter.integration.test.ts +10 -10
- package/src/execution/engine/workflow/types.ts +5 -7
- package/src/knowledge/__tests__/queries.test.ts +960 -546
- package/src/knowledge/format.ts +322 -100
- package/src/knowledge/index.ts +18 -5
- package/src/knowledge/queries.ts +1004 -239
- package/src/organization-model/__tests__/deprecate-helpers.test.ts +71 -0
- package/src/organization-model/__tests__/domains/resources.test.ts +19 -8
- package/src/organization-model/__tests__/domains/topology.test.ts +188 -0
- package/src/organization-model/__tests__/graph.test.ts +98 -7
- package/src/organization-model/__tests__/resolve.test.ts +9 -7
- package/src/organization-model/__tests__/scaffolders.test.ts +93 -0
- package/src/organization-model/__tests__/schema.test.ts +14 -4
- package/src/organization-model/defaults.ts +5 -3
- package/src/organization-model/domains/resources.ts +63 -20
- package/src/organization-model/domains/topology.ts +261 -0
- package/src/organization-model/graph/build.ts +63 -15
- package/src/organization-model/graph/schema.ts +4 -3
- package/src/organization-model/graph/types.ts +5 -4
- package/src/organization-model/helpers.ts +76 -9
- package/src/organization-model/icons.ts +1 -0
- package/src/organization-model/index.ts +7 -5
- package/src/organization-model/ontology.ts +2 -5
- package/src/organization-model/organization-model.mdx +16 -11
- package/src/organization-model/published.ts +51 -15
- package/src/organization-model/scaffolders/helpers.ts +84 -0
- package/src/organization-model/scaffolders/index.ts +19 -0
- package/src/organization-model/scaffolders/scaffoldKnowledgeNode.ts +48 -0
- package/src/organization-model/scaffolders/scaffoldOntologyRecord.ts +38 -0
- package/src/organization-model/scaffolders/scaffoldResource.ts +59 -0
- package/src/organization-model/scaffolders/scaffoldSystem.ts +110 -0
- package/src/organization-model/scaffolders/types.ts +81 -0
- package/src/organization-model/schema.ts +51 -11
- package/src/organization-model/types.ts +25 -11
- package/src/platform/constants/versions.ts +1 -1
- package/src/platform/registry/__tests__/validation.test.ts +199 -14
- package/src/platform/registry/resource-registry.ts +11 -11
- package/src/platform/registry/validation.ts +226 -34
- package/src/reference/_generated/contracts.md +139 -101
- package/src/reference/glossary.md +74 -72
- package/src/supabase/database.types.ts +3156 -3153
package/dist/index.js
CHANGED
|
@@ -281,7 +281,6 @@ function addLegacyEntityProjections(index, diagnostics, sourcesById, entities) {
|
|
|
281
281
|
table: entity.table
|
|
282
282
|
}
|
|
283
283
|
} : {},
|
|
284
|
-
legacyEntityId: entity.id,
|
|
285
284
|
...entity.rowSchema !== void 0 ? { rowSchema: entity.rowSchema } : {},
|
|
286
285
|
...entity.stateCatalogId !== void 0 ? { stateCatalogId: entity.stateCatalogId } : {}
|
|
287
286
|
};
|
|
@@ -306,8 +305,7 @@ function addLegacyEntityProjections(index, diagnostics, sourcesById, entities) {
|
|
|
306
305
|
from: legacyObjectId(entity),
|
|
307
306
|
to: legacyObjectId(targetEntity),
|
|
308
307
|
cardinality: link.kind,
|
|
309
|
-
...link.via !== void 0 ? { via: link.via } : {}
|
|
310
|
-
legacyEntityId: entity.id
|
|
308
|
+
...link.via !== void 0 ? { via: link.via } : {}
|
|
311
309
|
};
|
|
312
310
|
addRecord(index, diagnostics, sourcesById, "linkTypes", linkType, {
|
|
313
311
|
source: "legacy.entities.links",
|
|
@@ -365,8 +363,7 @@ function addSystemContentProjections(index, diagnostics, sourcesById, systemPath
|
|
|
365
363
|
kind: node.type,
|
|
366
364
|
...typeof node.data?.["entityId"] === "string" ? { appliesTo: formatOntologyId({ scope: systemPath, kind: "object", localId: node.data["entityId"] }) } : {},
|
|
367
365
|
...Object.keys(entries).length > 0 ? { entries } : {},
|
|
368
|
-
...node.data !== void 0 ? { data: node.data } : {}
|
|
369
|
-
legacyContentId: `${systemPath}:${localId}`
|
|
366
|
+
...node.data !== void 0 ? { data: node.data } : {}
|
|
370
367
|
};
|
|
371
368
|
addRecord(index, diagnostics, sourcesById, "catalogTypes", catalogType, {
|
|
372
369
|
source: "legacy.system.content",
|
|
@@ -597,6 +594,7 @@ var ORGANIZATION_MODEL_ICON_TOKENS = [
|
|
|
597
594
|
"crm",
|
|
598
595
|
"lead-gen",
|
|
599
596
|
"projects",
|
|
597
|
+
"clients",
|
|
600
598
|
"operations",
|
|
601
599
|
"monitoring",
|
|
602
600
|
"knowledge",
|
|
@@ -1508,11 +1506,20 @@ var EventDescriptorSchema = EventEmissionDescriptorSchema.extend({
|
|
|
1508
1506
|
ownerKind: z.enum(["resource", "entity"]).meta({ label: "Owner kind" })
|
|
1509
1507
|
});
|
|
1510
1508
|
var ResourceOntologyBindingSchema = z.object({
|
|
1511
|
-
|
|
1509
|
+
actions: z.array(OntologyIdSchema).optional(),
|
|
1510
|
+
primaryAction: OntologyIdSchema.optional(),
|
|
1512
1511
|
reads: z.array(OntologyIdSchema).optional(),
|
|
1513
1512
|
writes: z.array(OntologyIdSchema).optional(),
|
|
1514
1513
|
usesCatalogs: z.array(OntologyIdSchema).optional(),
|
|
1515
1514
|
emits: z.array(OntologyIdSchema).optional()
|
|
1515
|
+
}).superRefine((binding, ctx) => {
|
|
1516
|
+
if (binding.primaryAction === void 0) return;
|
|
1517
|
+
if (binding.actions?.includes(binding.primaryAction)) return;
|
|
1518
|
+
ctx.addIssue({
|
|
1519
|
+
code: z.ZodIssueCode.custom,
|
|
1520
|
+
path: ["primaryAction"],
|
|
1521
|
+
message: "Resource ontology primaryAction must be included in actions"
|
|
1522
|
+
});
|
|
1516
1523
|
});
|
|
1517
1524
|
var CodeReferenceSchema = z.object({
|
|
1518
1525
|
path: z.string().trim().min(1).max(500).regex(/^[A-Za-z0-9_./$@()[\] -]+$/, "Code reference paths must be repo-relative paths"),
|
|
@@ -1527,6 +1534,10 @@ var ResourceEntryBaseSchema = z.object({
|
|
|
1527
1534
|
order: z.number().default(0),
|
|
1528
1535
|
/** Required single System membership — value is a dot-separated system path (e.g. "sales.lead-gen"). */
|
|
1529
1536
|
systemPath: SystemPathSchema.meta({ ref: "system" }),
|
|
1537
|
+
/** Executable display title owned by the OM Resource descriptor. */
|
|
1538
|
+
title: LabelSchema.optional(),
|
|
1539
|
+
/** Executable display description owned by the OM Resource descriptor. */
|
|
1540
|
+
description: DescriptionSchema.optional(),
|
|
1530
1541
|
/** Optional role responsible for maintaining this resource. */
|
|
1531
1542
|
ownerRoleId: ModelIdSchema.meta({ ref: "role" }).optional(),
|
|
1532
1543
|
status: ResourceGovernanceStatusSchema,
|
|
@@ -1541,8 +1552,6 @@ var ResourceEntryBaseSchema = z.object({
|
|
|
1541
1552
|
});
|
|
1542
1553
|
var WorkflowResourceEntrySchema = ResourceEntryBaseSchema.extend({
|
|
1543
1554
|
kind: z.literal("workflow"),
|
|
1544
|
-
/** Mirrors WorkflowConfig.actionKey when the runtime workflow has one. */
|
|
1545
|
-
actionKey: z.string().trim().min(1).max(255).optional(),
|
|
1546
1555
|
emits: z.array(EventEmissionDescriptorSchema).optional()
|
|
1547
1556
|
});
|
|
1548
1557
|
var AgentResourceEntrySchema = ResourceEntryBaseSchema.extend({
|
|
@@ -1590,6 +1599,22 @@ function defineResources(resources) {
|
|
|
1590
1599
|
Object.entries(resources).map(([key, resource]) => [key, ResourceEntrySchema.parse(resource)])
|
|
1591
1600
|
);
|
|
1592
1601
|
}
|
|
1602
|
+
function ontologyIdFrom(input) {
|
|
1603
|
+
return typeof input === "string" ? input : input.id;
|
|
1604
|
+
}
|
|
1605
|
+
function ontologyIdArrayFrom(input) {
|
|
1606
|
+
return input?.map(ontologyIdFrom);
|
|
1607
|
+
}
|
|
1608
|
+
function defineResourceOntology(input) {
|
|
1609
|
+
return ResourceOntologyBindingSchema.parse({
|
|
1610
|
+
actions: ontologyIdArrayFrom(input.actions),
|
|
1611
|
+
primaryAction: input.primaryAction === void 0 ? void 0 : ontologyIdFrom(input.primaryAction),
|
|
1612
|
+
reads: ontologyIdArrayFrom(input.reads),
|
|
1613
|
+
writes: ontologyIdArrayFrom(input.writes),
|
|
1614
|
+
usesCatalogs: ontologyIdArrayFrom(input.usesCatalogs),
|
|
1615
|
+
emits: ontologyIdArrayFrom(input.emits)
|
|
1616
|
+
});
|
|
1617
|
+
}
|
|
1593
1618
|
|
|
1594
1619
|
// src/organization-model/domains/roles.ts
|
|
1595
1620
|
var RoleIdSchema = ModelIdSchema;
|
|
@@ -1770,6 +1795,179 @@ var OrgKnowledgeNodeSchema = z.object({
|
|
|
1770
1795
|
updatedAt: z.string().trim().min(1).max(50)
|
|
1771
1796
|
});
|
|
1772
1797
|
var KnowledgeDomainSchema = z.record(ModelIdSchema, OrgKnowledgeNodeSchema).default({});
|
|
1798
|
+
var SecretLikeMetadataKeySchema = /(?:secret|password|passwd|token|api[-_]?key|credential|private[-_]?key)/i;
|
|
1799
|
+
var SecretLikeMetadataValueSchema = /(?:sk-[A-Za-z0-9_-]{12,}|pk_live_[A-Za-z0-9_-]{12,}|eyJ[A-Za-z0-9_-]{20,}|-----BEGIN (?:RSA |OPENSSH |EC )?PRIVATE KEY-----)/;
|
|
1800
|
+
var OmTopologyNodeKindSchema = z.enum([
|
|
1801
|
+
"system",
|
|
1802
|
+
"resource",
|
|
1803
|
+
"ontology",
|
|
1804
|
+
"policy",
|
|
1805
|
+
"role",
|
|
1806
|
+
"trigger",
|
|
1807
|
+
"humanCheckpoint",
|
|
1808
|
+
"externalResource"
|
|
1809
|
+
]);
|
|
1810
|
+
var OmTopologyRelationshipKindSchema = z.enum(["triggers", "uses", "approval"]);
|
|
1811
|
+
var OmTopologyNodeRefSchema = z.discriminatedUnion("kind", [
|
|
1812
|
+
z.object({ kind: z.literal("system"), id: ModelIdSchema }),
|
|
1813
|
+
z.object({ kind: z.literal("resource"), id: ResourceIdSchema }),
|
|
1814
|
+
z.object({ kind: z.literal("ontology"), id: OntologyIdSchema }),
|
|
1815
|
+
z.object({ kind: z.literal("policy"), id: ModelIdSchema }),
|
|
1816
|
+
z.object({ kind: z.literal("role"), id: ModelIdSchema }),
|
|
1817
|
+
z.object({ kind: z.literal("trigger"), id: ResourceIdSchema }),
|
|
1818
|
+
z.object({ kind: z.literal("humanCheckpoint"), id: ResourceIdSchema }),
|
|
1819
|
+
z.object({ kind: z.literal("externalResource"), id: ResourceIdSchema })
|
|
1820
|
+
]);
|
|
1821
|
+
var OmTopologyMetadataSchema = z.record(z.string().trim().min(1).max(120), JsonValueSchema).superRefine((metadata, ctx) => {
|
|
1822
|
+
function visit(value, path) {
|
|
1823
|
+
if (typeof value === "string" && SecretLikeMetadataValueSchema.test(value)) {
|
|
1824
|
+
ctx.addIssue({
|
|
1825
|
+
code: z.ZodIssueCode.custom,
|
|
1826
|
+
path,
|
|
1827
|
+
message: "Topology metadata must not contain secret-like values"
|
|
1828
|
+
});
|
|
1829
|
+
return;
|
|
1830
|
+
}
|
|
1831
|
+
if (Array.isArray(value)) {
|
|
1832
|
+
value.forEach((entry, index) => visit(entry, [...path, index]));
|
|
1833
|
+
return;
|
|
1834
|
+
}
|
|
1835
|
+
if (typeof value !== "object" || value === null) return;
|
|
1836
|
+
Object.entries(value).forEach(([key, entry]) => {
|
|
1837
|
+
if (SecretLikeMetadataKeySchema.test(key)) {
|
|
1838
|
+
ctx.addIssue({
|
|
1839
|
+
code: z.ZodIssueCode.custom,
|
|
1840
|
+
path: [...path, key],
|
|
1841
|
+
message: `Topology metadata key "${key}" looks secret-like`
|
|
1842
|
+
});
|
|
1843
|
+
}
|
|
1844
|
+
visit(entry, [...path, key]);
|
|
1845
|
+
});
|
|
1846
|
+
}
|
|
1847
|
+
visit(metadata, []);
|
|
1848
|
+
});
|
|
1849
|
+
var OmTopologyRelationshipSchema = z.object({
|
|
1850
|
+
from: OmTopologyNodeRefSchema,
|
|
1851
|
+
kind: OmTopologyRelationshipKindSchema,
|
|
1852
|
+
to: OmTopologyNodeRefSchema,
|
|
1853
|
+
systemPath: SystemPathSchema.optional(),
|
|
1854
|
+
required: z.boolean().optional(),
|
|
1855
|
+
metadata: OmTopologyMetadataSchema.optional()
|
|
1856
|
+
});
|
|
1857
|
+
var OmTopologyDomainSchema = z.object({
|
|
1858
|
+
version: z.literal(1).default(1),
|
|
1859
|
+
relationships: z.record(z.string().trim().min(1).max(255), OmTopologyRelationshipSchema).default({})
|
|
1860
|
+
}).default({ version: 1, relationships: {} });
|
|
1861
|
+
var DEFAULT_ORGANIZATION_MODEL_TOPOLOGY = {
|
|
1862
|
+
version: 1,
|
|
1863
|
+
relationships: {}
|
|
1864
|
+
};
|
|
1865
|
+
function idFrom(input) {
|
|
1866
|
+
return typeof input === "string" ? input : input.id;
|
|
1867
|
+
}
|
|
1868
|
+
function parseRef(kind, id) {
|
|
1869
|
+
return OmTopologyNodeRefSchema.parse({ kind, id });
|
|
1870
|
+
}
|
|
1871
|
+
function isNodeRef(input) {
|
|
1872
|
+
return OmTopologyNodeRefSchema.safeParse(input).success;
|
|
1873
|
+
}
|
|
1874
|
+
function isResourceEntry(input) {
|
|
1875
|
+
if (typeof input !== "object" || input === null) return false;
|
|
1876
|
+
const candidate = input;
|
|
1877
|
+
return typeof candidate.id === "string" && typeof candidate.systemPath === "string" && typeof candidate.status === "string" && ["workflow", "agent", "integration", "script"].includes(String(candidate.kind));
|
|
1878
|
+
}
|
|
1879
|
+
var topologyRef = {
|
|
1880
|
+
system: (system) => parseRef("system", idFrom(system)),
|
|
1881
|
+
resource: (resource) => parseRef("resource", idFrom(resource)),
|
|
1882
|
+
ontology: (record) => parseRef("ontology", idFrom(record)),
|
|
1883
|
+
policy: (policy) => parseRef("policy", idFrom(policy)),
|
|
1884
|
+
role: (role) => parseRef("role", idFrom(role)),
|
|
1885
|
+
trigger: (trigger) => parseRef("trigger", idFrom(trigger)),
|
|
1886
|
+
humanCheckpoint: (checkpoint) => parseRef("humanCheckpoint", idFrom(checkpoint)),
|
|
1887
|
+
externalResource: (externalResource) => parseRef("externalResource", idFrom(externalResource))
|
|
1888
|
+
};
|
|
1889
|
+
var topologyRelationship = {
|
|
1890
|
+
triggers: (from, to, options = {}) => defineTopologyRelationship({
|
|
1891
|
+
...options,
|
|
1892
|
+
from,
|
|
1893
|
+
kind: "triggers",
|
|
1894
|
+
to
|
|
1895
|
+
}),
|
|
1896
|
+
uses: (from, to, options = {}) => defineTopologyRelationship({
|
|
1897
|
+
...options,
|
|
1898
|
+
from,
|
|
1899
|
+
kind: "uses",
|
|
1900
|
+
to
|
|
1901
|
+
}),
|
|
1902
|
+
approval: (from, to, options = {}) => defineTopologyRelationship({
|
|
1903
|
+
...options,
|
|
1904
|
+
from,
|
|
1905
|
+
kind: "approval",
|
|
1906
|
+
to
|
|
1907
|
+
}),
|
|
1908
|
+
usesIntegration: (from, integration, options = {}) => defineTopologyRelationship({
|
|
1909
|
+
required: true,
|
|
1910
|
+
...options,
|
|
1911
|
+
from,
|
|
1912
|
+
kind: "uses",
|
|
1913
|
+
to: integration
|
|
1914
|
+
}),
|
|
1915
|
+
requestsApproval: (from, checkpoint, options = {}) => defineTopologyRelationship({
|
|
1916
|
+
required: true,
|
|
1917
|
+
...options,
|
|
1918
|
+
from,
|
|
1919
|
+
kind: "approval",
|
|
1920
|
+
to: topologyRef.humanCheckpoint(checkpoint)
|
|
1921
|
+
}),
|
|
1922
|
+
checkpointRoutesTo: (checkpoint, to, options = {}) => defineTopologyRelationship({
|
|
1923
|
+
required: true,
|
|
1924
|
+
...options,
|
|
1925
|
+
from: topologyRef.humanCheckpoint(checkpoint),
|
|
1926
|
+
kind: "triggers",
|
|
1927
|
+
to
|
|
1928
|
+
})
|
|
1929
|
+
};
|
|
1930
|
+
function compileTopologyNodeRef(input) {
|
|
1931
|
+
if (isNodeRef(input)) return input;
|
|
1932
|
+
if (isResourceEntry(input)) return topologyRef.resource(input);
|
|
1933
|
+
throw new Error("Topology node refs must be typed node objects or serializable { kind, id } refs");
|
|
1934
|
+
}
|
|
1935
|
+
function parseTopologyNodeRef(input) {
|
|
1936
|
+
if (typeof input !== "string") return OmTopologyNodeRefSchema.parse(input);
|
|
1937
|
+
const separatorIndex = input.indexOf(":");
|
|
1938
|
+
if (separatorIndex === -1) {
|
|
1939
|
+
throw new Error(`Topology node ref "${input}" must use <kind>:<id>`);
|
|
1940
|
+
}
|
|
1941
|
+
const kind = input.slice(0, separatorIndex);
|
|
1942
|
+
const id = input.slice(separatorIndex + 1);
|
|
1943
|
+
if (!OmTopologyNodeKindSchema.safeParse(kind).success) {
|
|
1944
|
+
throw new Error(`Topology node ref "${input}" has unsupported kind "${kind}"`);
|
|
1945
|
+
}
|
|
1946
|
+
return OmTopologyNodeRefSchema.parse({ kind, id });
|
|
1947
|
+
}
|
|
1948
|
+
function defineTopologyRelationship(input) {
|
|
1949
|
+
return OmTopologyRelationshipSchema.parse({
|
|
1950
|
+
...input,
|
|
1951
|
+
from: compileTopologyNodeRef(input.from),
|
|
1952
|
+
to: compileTopologyNodeRef(input.to)
|
|
1953
|
+
});
|
|
1954
|
+
}
|
|
1955
|
+
function defineTopology(relationships) {
|
|
1956
|
+
const entries = Array.isArray(relationships) ? relationships.map((relationship, index) => [`relationship-${index + 1}`, relationship]) : Object.entries(relationships);
|
|
1957
|
+
return OmTopologyDomainSchema.parse({
|
|
1958
|
+
version: 1,
|
|
1959
|
+
relationships: Object.fromEntries(entries.map(([key, relationship]) => [key, defineTopologyRelationship(relationship)]))
|
|
1960
|
+
});
|
|
1961
|
+
}
|
|
1962
|
+
function isOntologyTopologyRef(value) {
|
|
1963
|
+
if (!isNodeRef(value) || value.kind !== "ontology") return false;
|
|
1964
|
+
try {
|
|
1965
|
+
parseOntologyId(value.id);
|
|
1966
|
+
return true;
|
|
1967
|
+
} catch {
|
|
1968
|
+
return false;
|
|
1969
|
+
}
|
|
1970
|
+
}
|
|
1773
1971
|
var PolicyIdSchema = ModelIdSchema;
|
|
1774
1972
|
var PolicyApplicabilitySchema = z.object({
|
|
1775
1973
|
systemIds: z.array(ModelIdSchema.meta({ ref: "system" })).default([]),
|
|
@@ -1859,6 +2057,7 @@ var OrganizationModelDomainKeySchema = z.enum([
|
|
|
1859
2057
|
"systems",
|
|
1860
2058
|
"ontology",
|
|
1861
2059
|
"resources",
|
|
2060
|
+
"topology",
|
|
1862
2061
|
"actions",
|
|
1863
2062
|
"entities",
|
|
1864
2063
|
"policies",
|
|
@@ -1878,6 +2077,7 @@ var DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA = {
|
|
|
1878
2077
|
systems: { version: 1, lastModified: "2026-05-10" },
|
|
1879
2078
|
ontology: { version: 1, lastModified: "2026-05-14" },
|
|
1880
2079
|
resources: { version: 1, lastModified: "2026-05-10" },
|
|
2080
|
+
topology: { version: 1, lastModified: "2026-05-14" },
|
|
1881
2081
|
actions: { version: 1, lastModified: "2026-05-10" },
|
|
1882
2082
|
entities: { version: 1, lastModified: "2026-05-10" },
|
|
1883
2083
|
policies: { version: 1, lastModified: "2026-05-10" },
|
|
@@ -1893,6 +2093,7 @@ var OrganizationModelDomainMetadataByDomainSchema = z.object({
|
|
|
1893
2093
|
systems: OrganizationModelDomainMetadataSchema,
|
|
1894
2094
|
ontology: OrganizationModelDomainMetadataSchema,
|
|
1895
2095
|
resources: OrganizationModelDomainMetadataSchema,
|
|
2096
|
+
topology: OrganizationModelDomainMetadataSchema,
|
|
1896
2097
|
actions: OrganizationModelDomainMetadataSchema,
|
|
1897
2098
|
entities: OrganizationModelDomainMetadataSchema,
|
|
1898
2099
|
policies: OrganizationModelDomainMetadataSchema,
|
|
@@ -1911,6 +2112,7 @@ var OrganizationModelSchemaBase = z.object({
|
|
|
1911
2112
|
systems: SystemsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_SYSTEMS),
|
|
1912
2113
|
ontology: OntologyScopeSchema.default(DEFAULT_ONTOLOGY_SCOPE),
|
|
1913
2114
|
resources: ResourcesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_RESOURCES),
|
|
2115
|
+
topology: OmTopologyDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_TOPOLOGY),
|
|
1914
2116
|
actions: ActionsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_ACTIONS),
|
|
1915
2117
|
entities: EntitiesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_ENTITIES),
|
|
1916
2118
|
policies: PoliciesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_POLICIES),
|
|
@@ -2253,6 +2455,25 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
|
|
|
2253
2455
|
surface: ontologyCompilation.ontology.surfaces
|
|
2254
2456
|
};
|
|
2255
2457
|
const ontologyIds = new Set(Object.values(ontologyIndexByKind).flatMap((index) => Object.keys(index)));
|
|
2458
|
+
function topologyTargetExists(ref) {
|
|
2459
|
+
if (ref.kind === "system") return systemsById.has(ref.id);
|
|
2460
|
+
if (ref.kind === "resource") return resourcesById.has(ref.id);
|
|
2461
|
+
if (ref.kind === "ontology") return ontologyIds.has(ref.id);
|
|
2462
|
+
if (ref.kind === "policy") return policiesById.has(ref.id);
|
|
2463
|
+
if (ref.kind === "role") return rolesById.has(ref.id);
|
|
2464
|
+
return true;
|
|
2465
|
+
}
|
|
2466
|
+
Object.entries(model.topology.relationships).forEach(([relationshipId, relationship]) => {
|
|
2467
|
+
["from", "to"].forEach((side) => {
|
|
2468
|
+
const ref = relationship[side];
|
|
2469
|
+
if (topologyTargetExists(ref)) return;
|
|
2470
|
+
addIssue(
|
|
2471
|
+
ctx,
|
|
2472
|
+
["topology", "relationships", relationshipId, side],
|
|
2473
|
+
`Topology relationship "${relationshipId}" ${side} references unknown ${ref.kind} "${ref.id}"`
|
|
2474
|
+
);
|
|
2475
|
+
});
|
|
2476
|
+
});
|
|
2256
2477
|
const ontologyReferenceKeyKinds = {
|
|
2257
2478
|
valueType: "value-type",
|
|
2258
2479
|
catalogType: "catalog",
|
|
@@ -2391,11 +2612,18 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
|
|
|
2391
2612
|
}
|
|
2392
2613
|
});
|
|
2393
2614
|
function validateResourceOntologyBinding(resourceId, bindingKey, expectedKind, ids) {
|
|
2394
|
-
ids
|
|
2615
|
+
const ontologyIds2 = ids === void 0 ? [] : Array.isArray(ids) ? ids : [ids];
|
|
2616
|
+
ontologyIds2.forEach((ontologyId, ontologyIndex) => {
|
|
2395
2617
|
if (ontologyIndexByKind[expectedKind][ontologyId] === void 0) {
|
|
2396
2618
|
addIssue(
|
|
2397
2619
|
ctx,
|
|
2398
|
-
[
|
|
2620
|
+
[
|
|
2621
|
+
"resources",
|
|
2622
|
+
resourceId,
|
|
2623
|
+
"ontology",
|
|
2624
|
+
bindingKey,
|
|
2625
|
+
...Array.isArray(ids) ? [ontologyIndex] : []
|
|
2626
|
+
],
|
|
2399
2627
|
`Resource "${resourceId}" ontology binding "${bindingKey}" references unknown ${expectedKind} ontology ID "${ontologyId}"`
|
|
2400
2628
|
);
|
|
2401
2629
|
}
|
|
@@ -2404,7 +2632,8 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
|
|
|
2404
2632
|
Object.values(model.resources).forEach((resource) => {
|
|
2405
2633
|
const binding = resource.ontology;
|
|
2406
2634
|
if (binding === void 0) return;
|
|
2407
|
-
validateResourceOntologyBinding(resource.id, "
|
|
2635
|
+
validateResourceOntologyBinding(resource.id, "actions", "action", binding.actions);
|
|
2636
|
+
validateResourceOntologyBinding(resource.id, "primaryAction", "action", binding.primaryAction);
|
|
2408
2637
|
validateResourceOntologyBinding(resource.id, "reads", "object", binding.reads);
|
|
2409
2638
|
validateResourceOntologyBinding(resource.id, "writes", "object", binding.writes);
|
|
2410
2639
|
validateResourceOntologyBinding(resource.id, "usesCatalogs", "catalog", binding.usesCatalogs);
|
|
@@ -2550,9 +2779,10 @@ var OrganizationGraphEdgeKindSchema = z.enum([
|
|
|
2550
2779
|
"emits",
|
|
2551
2780
|
"originates_from",
|
|
2552
2781
|
"triggers",
|
|
2782
|
+
"approval",
|
|
2553
2783
|
"applies_to",
|
|
2554
2784
|
"effects",
|
|
2555
|
-
"
|
|
2785
|
+
"actions",
|
|
2556
2786
|
"reads",
|
|
2557
2787
|
"writes",
|
|
2558
2788
|
"uses_catalog"
|
|
@@ -2635,7 +2865,7 @@ var DEFAULT_ORGANIZATION_MODEL_NAVIGATION2 = {
|
|
|
2635
2865
|
business: {
|
|
2636
2866
|
type: "group",
|
|
2637
2867
|
label: "Business",
|
|
2638
|
-
icon: "
|
|
2868
|
+
icon: "briefcase",
|
|
2639
2869
|
order: 20,
|
|
2640
2870
|
children: {
|
|
2641
2871
|
sales: {
|
|
@@ -2652,7 +2882,7 @@ var DEFAULT_ORGANIZATION_MODEL_NAVIGATION2 = {
|
|
|
2652
2882
|
label: "Clients",
|
|
2653
2883
|
path: "/clients",
|
|
2654
2884
|
surfaceType: "list",
|
|
2655
|
-
icon: "
|
|
2885
|
+
icon: "clients",
|
|
2656
2886
|
order: 20,
|
|
2657
2887
|
targets: { systems: ["clients"] }
|
|
2658
2888
|
},
|
|
@@ -3026,7 +3256,7 @@ var DEFAULT_ORGANIZATION_MODEL = {
|
|
|
3026
3256
|
enabled: true,
|
|
3027
3257
|
lifecycle: "active",
|
|
3028
3258
|
color: "orange",
|
|
3029
|
-
icon: "
|
|
3259
|
+
icon: "clients",
|
|
3030
3260
|
path: "/clients"
|
|
3031
3261
|
},
|
|
3032
3262
|
operations: {
|
|
@@ -3330,6 +3560,7 @@ var DEFAULT_ORGANIZATION_MODEL = {
|
|
|
3330
3560
|
},
|
|
3331
3561
|
ontology: DEFAULT_ONTOLOGY_SCOPE,
|
|
3332
3562
|
resources: DEFAULT_ORGANIZATION_MODEL_RESOURCES,
|
|
3563
|
+
topology: DEFAULT_ORGANIZATION_MODEL_TOPOLOGY,
|
|
3333
3564
|
actions: DEFAULT_ORGANIZATION_MODEL_ACTIONS,
|
|
3334
3565
|
entities: DEFAULT_ORGANIZATION_MODEL_ENTITIES2,
|
|
3335
3566
|
policies: DEFAULT_ORGANIZATION_MODEL_POLICIES,
|
|
@@ -3978,4 +4209,331 @@ function createFoundationOrganizationModel(override) {
|
|
|
3978
4209
|
};
|
|
3979
4210
|
}
|
|
3980
4211
|
|
|
3981
|
-
|
|
4212
|
+
// src/organization-model/scaffolders/helpers.ts
|
|
4213
|
+
function slugify(input) {
|
|
4214
|
+
return input.trim().replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
4215
|
+
}
|
|
4216
|
+
function titleize(input) {
|
|
4217
|
+
return input.split(/[-._\s]+/).filter(Boolean).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
|
|
4218
|
+
}
|
|
4219
|
+
function assertSystemPathAvailable(model, path) {
|
|
4220
|
+
if (getSystem(model, path) !== void 0) {
|
|
4221
|
+
throw new Error(`system already exists: ${path}`);
|
|
4222
|
+
}
|
|
4223
|
+
const parent = parentPathOf(path);
|
|
4224
|
+
if (parent !== void 0 && getSystem(model, parent) === void 0) {
|
|
4225
|
+
throw new Error(`parent system does not exist: ${parent}`);
|
|
4226
|
+
}
|
|
4227
|
+
}
|
|
4228
|
+
function assertSystemExists(model, path) {
|
|
4229
|
+
if (getSystem(model, path) === void 0) {
|
|
4230
|
+
throw new Error(`system does not exist: ${path}`);
|
|
4231
|
+
}
|
|
4232
|
+
}
|
|
4233
|
+
function parentPathOf(path) {
|
|
4234
|
+
const index = path.lastIndexOf(".");
|
|
4235
|
+
return index === -1 ? void 0 : path.slice(0, index);
|
|
4236
|
+
}
|
|
4237
|
+
function localIdOf(path) {
|
|
4238
|
+
return path.split(".").at(-1) ?? path;
|
|
4239
|
+
}
|
|
4240
|
+
function nextSystemOrder(model, parentPath) {
|
|
4241
|
+
const siblings = parentPath === void 0 ? listAllSystems(model).filter(({ path }) => !path.includes(".")) : listAllSystems(model).filter(({ path }) => parentPathOf(path) === parentPath);
|
|
4242
|
+
const maxOrder = siblings.reduce((max, { system }) => Math.max(max, system.order), 0);
|
|
4243
|
+
return Math.ceil((maxOrder + 10) / 10) * 10;
|
|
4244
|
+
}
|
|
4245
|
+
function ontologyMapName(kind) {
|
|
4246
|
+
const map = {
|
|
4247
|
+
object: "objectTypes",
|
|
4248
|
+
link: "linkTypes",
|
|
4249
|
+
action: "actionTypes",
|
|
4250
|
+
catalog: "catalogTypes",
|
|
4251
|
+
event: "eventTypes",
|
|
4252
|
+
interface: "interfaceTypes",
|
|
4253
|
+
"value-type": "valueTypes",
|
|
4254
|
+
property: "sharedProperties",
|
|
4255
|
+
group: "groups",
|
|
4256
|
+
surface: "surfaces"
|
|
4257
|
+
};
|
|
4258
|
+
return map[kind];
|
|
4259
|
+
}
|
|
4260
|
+
function makeOntologyId(systemPath, kind, localId) {
|
|
4261
|
+
return formatOntologyId({ scope: systemPath, kind, localId: slugify(localId) });
|
|
4262
|
+
}
|
|
4263
|
+
function addProjectNextStep(plan, enabled, command) {
|
|
4264
|
+
if (!enabled) return plan;
|
|
4265
|
+
return {
|
|
4266
|
+
...plan,
|
|
4267
|
+
projectCommand: command,
|
|
4268
|
+
nextSteps: [...plan.nextSteps, `Run project handoff: ${command}`]
|
|
4269
|
+
};
|
|
4270
|
+
}
|
|
4271
|
+
|
|
4272
|
+
// src/organization-model/scaffolders/scaffoldKnowledgeNode.ts
|
|
4273
|
+
function scaffoldKnowledgeNode(model, spec) {
|
|
4274
|
+
if (spec.systemPath !== void 0) assertSystemExists(model, spec.systemPath);
|
|
4275
|
+
if (model.knowledge?.[spec.id] !== void 0) {
|
|
4276
|
+
throw new Error(`knowledge node already exists: ${spec.id}`);
|
|
4277
|
+
}
|
|
4278
|
+
const title = spec.label ?? titleize(spec.id.replace(/^knowledge\./, ""));
|
|
4279
|
+
const slug = slugify(spec.id.replace(/^knowledge\./, ""));
|
|
4280
|
+
const kind = spec.kind ?? "reference";
|
|
4281
|
+
const links = spec.systemPath === void 0 ? "" : `links:
|
|
4282
|
+
- system:${spec.systemPath}
|
|
4283
|
+
`;
|
|
4284
|
+
const ownerIds = spec.ownerRoleId === void 0 ? "" : `ownerIds:
|
|
4285
|
+
- ${spec.ownerRoleId}
|
|
4286
|
+
`;
|
|
4287
|
+
return {
|
|
4288
|
+
intent: "knowledge",
|
|
4289
|
+
id: spec.id,
|
|
4290
|
+
summary: `Scaffold ${kind} knowledge node "${spec.id}".`,
|
|
4291
|
+
writes: [
|
|
4292
|
+
{
|
|
4293
|
+
path: `packages/elevasis-core/src/knowledge/nodes/${slug}.mdx.stub`,
|
|
4294
|
+
mode: "create",
|
|
4295
|
+
description: "Knowledge node MDX skeleton.",
|
|
4296
|
+
content: `---
|
|
4297
|
+
id: ${spec.id}
|
|
4298
|
+
kind: ${kind}
|
|
4299
|
+
title: ${JSON.stringify(title)}
|
|
4300
|
+
summary: ${JSON.stringify(spec.description ?? `${title} knowledge node.`)}
|
|
4301
|
+
${links}${ownerIds}updatedAt: 2026-05-15
|
|
4302
|
+
---
|
|
4303
|
+
|
|
4304
|
+
## Overview
|
|
4305
|
+
|
|
4306
|
+
Capture the durable operating knowledge here.
|
|
4307
|
+
`
|
|
4308
|
+
}
|
|
4309
|
+
],
|
|
4310
|
+
edits: [
|
|
4311
|
+
{
|
|
4312
|
+
path: "packages/elevasis-core/src/organization-model/knowledge.ts",
|
|
4313
|
+
description: "Register this generated node after replacing the .stub suffix.",
|
|
4314
|
+
snippet: `${JSON.stringify(spec.id)}`
|
|
4315
|
+
}
|
|
4316
|
+
],
|
|
4317
|
+
warnings: [],
|
|
4318
|
+
nextSteps: [
|
|
4319
|
+
"Replace the .stub suffix after the node is ready to become canonical.",
|
|
4320
|
+
spec.systemPath === void 0 ? "Add links to the OM nodes this knowledge governs." : `Run pnpm exec elevasis om:verify --scope ${spec.systemPath}.`
|
|
4321
|
+
],
|
|
4322
|
+
projectCommand: spec.withProject && spec.systemPath !== void 0 ? `pnpm exec elevasis project:create --link-om ${spec.systemPath} --title "Add ${title} knowledge" --kind om-change` : void 0
|
|
4323
|
+
};
|
|
4324
|
+
}
|
|
4325
|
+
|
|
4326
|
+
// src/organization-model/scaffolders/scaffoldOntologyRecord.ts
|
|
4327
|
+
function scaffoldOntologyRecord(model, spec) {
|
|
4328
|
+
assertSystemExists(model, spec.systemPath);
|
|
4329
|
+
const localId = spec.localId ?? spec.id;
|
|
4330
|
+
const ontologyId = makeOntologyId(spec.systemPath, spec.kind, localId);
|
|
4331
|
+
const label = spec.label ?? titleize(localId);
|
|
4332
|
+
const mapName = ontologyMapName(spec.kind);
|
|
4333
|
+
return {
|
|
4334
|
+
intent: "ontology",
|
|
4335
|
+
id: ontologyId,
|
|
4336
|
+
summary: `Scaffold ${spec.kind} ontology record "${ontologyId}".`,
|
|
4337
|
+
writes: [],
|
|
4338
|
+
edits: [
|
|
4339
|
+
{
|
|
4340
|
+
path: "packages/elevasis-core/src/organization-model/systems.ts",
|
|
4341
|
+
description: `Add this record under ${spec.systemPath}.ontology.${mapName}.`,
|
|
4342
|
+
snippet: `${JSON.stringify(ontologyId)}: {
|
|
4343
|
+
id: ${JSON.stringify(ontologyId)},
|
|
4344
|
+
label: ${JSON.stringify(label)},
|
|
4345
|
+
ownerSystemId: ${JSON.stringify(spec.systemPath)}${spec.description === void 0 ? "" : `,
|
|
4346
|
+
description: ${JSON.stringify(spec.description)}`}
|
|
4347
|
+
}`
|
|
4348
|
+
}
|
|
4349
|
+
],
|
|
4350
|
+
warnings: [],
|
|
4351
|
+
nextSteps: [
|
|
4352
|
+
"Wire any cross-references using canonical ontology IDs.",
|
|
4353
|
+
`Run pnpm exec elevasis om:verify --scope ${spec.systemPath}.`
|
|
4354
|
+
],
|
|
4355
|
+
projectCommand: spec.withProject ? `pnpm exec elevasis project:create --link-om ${spec.systemPath} --title "Add ${label} ontology" --kind om-change` : void 0
|
|
4356
|
+
};
|
|
4357
|
+
}
|
|
4358
|
+
|
|
4359
|
+
// src/organization-model/scaffolders/scaffoldResource.ts
|
|
4360
|
+
function scaffoldResource(model, spec) {
|
|
4361
|
+
assertSystemExists(model, spec.systemPath);
|
|
4362
|
+
if (model.resources?.[spec.id] !== void 0) {
|
|
4363
|
+
throw new Error(`resource already exists: ${spec.id}`);
|
|
4364
|
+
}
|
|
4365
|
+
const label = spec.label ?? titleize(spec.id);
|
|
4366
|
+
const kind = spec.kind ?? "workflow";
|
|
4367
|
+
const slug = slugify(spec.id);
|
|
4368
|
+
const writes = spec.withStubWorkflow ? [
|
|
4369
|
+
{
|
|
4370
|
+
path: `packages/elevasis-core/src/workflows/${slug}.stub.ts`,
|
|
4371
|
+
mode: "create",
|
|
4372
|
+
description: "Optional workflow implementation stub. Runtime wiring remains manual.",
|
|
4373
|
+
content: `// Stub only. Replace with a real workflow implementation before registering the resource.
|
|
4374
|
+
export const ${slug.replaceAll("-", "_")}Workflow = {
|
|
4375
|
+
id: ${JSON.stringify(spec.id)}
|
|
4376
|
+
}
|
|
4377
|
+
`
|
|
4378
|
+
}
|
|
4379
|
+
] : [];
|
|
4380
|
+
return {
|
|
4381
|
+
intent: "resource",
|
|
4382
|
+
id: spec.id,
|
|
4383
|
+
summary: `Scaffold ${kind} Resource "${spec.id}" for System "${spec.systemPath}".`,
|
|
4384
|
+
writes,
|
|
4385
|
+
edits: [
|
|
4386
|
+
{
|
|
4387
|
+
path: "packages/elevasis-core/src/organization-model/resources.ts",
|
|
4388
|
+
description: "Add this descriptor to platformResources/platformResourceDescriptors.",
|
|
4389
|
+
snippet: `${JSON.stringify(spec.id)}: {
|
|
4390
|
+
id: ${JSON.stringify(spec.id)},
|
|
4391
|
+
order: 0,
|
|
4392
|
+
kind: ${JSON.stringify(kind)},
|
|
4393
|
+
systemPath: ${JSON.stringify(spec.systemPath)},
|
|
4394
|
+
title: ${JSON.stringify(label)},
|
|
4395
|
+
${spec.description === void 0 ? "" : `description: ${JSON.stringify(spec.description)},
|
|
4396
|
+
`}${spec.ownerRoleId === void 0 ? "" : `ownerRoleId: ${JSON.stringify(spec.ownerRoleId)},
|
|
4397
|
+
`}status: 'active',
|
|
4398
|
+
codeRefs: []
|
|
4399
|
+
}`
|
|
4400
|
+
},
|
|
4401
|
+
{
|
|
4402
|
+
path: "packages/elevasis-core/src/organization-model/topology.ts",
|
|
4403
|
+
description: "Add topology relationships only when this resource triggers, uses, or requires approval from another OM node.",
|
|
4404
|
+
snippet: `// topologyRelationship({ from: topologyRef('resource', ${JSON.stringify(spec.id)}), kind: 'uses', to: ... })`
|
|
4405
|
+
}
|
|
4406
|
+
],
|
|
4407
|
+
warnings: ["Resource ontology bindings are intentionally omitted until action/read/write contracts are known."],
|
|
4408
|
+
nextSteps: [
|
|
4409
|
+
"Bind resource.ontology.actions/reads/writes after the ontology records exist.",
|
|
4410
|
+
`Run pnpm exec elevasis om:verify --scope ${spec.systemPath}.`
|
|
4411
|
+
],
|
|
4412
|
+
projectCommand: spec.withProject ? `pnpm exec elevasis project:create --link-om ${spec.systemPath} --title "Add ${label} resource" --kind om-change` : void 0
|
|
4413
|
+
};
|
|
4414
|
+
}
|
|
4415
|
+
|
|
4416
|
+
// src/organization-model/scaffolders/scaffoldSystem.ts
|
|
4417
|
+
function scaffoldSystem(model, spec) {
|
|
4418
|
+
const systemPath = spec.parent !== void 0 && !spec.id.includes(".") ? `${spec.parent}.${spec.id}` : spec.id;
|
|
4419
|
+
assertSystemPathAvailable(model, systemPath);
|
|
4420
|
+
const parentPath = parentPathOf(systemPath);
|
|
4421
|
+
const localId = localIdOf(systemPath);
|
|
4422
|
+
const label = spec.label ?? titleize(localId);
|
|
4423
|
+
const roleId = spec.role ?? "role.ops-lead";
|
|
4424
|
+
const uiPath = spec.uiPath ?? `/${localId}`;
|
|
4425
|
+
const featureSlug = slugify(systemPath.replaceAll(".", "-"));
|
|
4426
|
+
const knowledgeId = `knowledge.${featureSlug}-system-overview`;
|
|
4427
|
+
const order = nextSystemOrder(model, parentPath);
|
|
4428
|
+
const withProject = spec.withProject ?? !spec.noProject;
|
|
4429
|
+
const systemEntry = ` ${JSON.stringify(localId)}: {
|
|
4430
|
+
id: ${JSON.stringify(systemPath)},
|
|
4431
|
+
order: ${order},
|
|
4432
|
+
label: ${JSON.stringify(label)},
|
|
4433
|
+
description: ${JSON.stringify(spec.description ?? `${label} bounded context.`)},
|
|
4434
|
+
kind: ${JSON.stringify(spec.kind ?? "operational")},
|
|
4435
|
+
${parentPath === void 0 ? "" : `parentSystemId: ${JSON.stringify(parentPath)},
|
|
4436
|
+
`}responsibleRoleId: ${JSON.stringify(roleId)},
|
|
4437
|
+
governedByKnowledge: [${JSON.stringify(knowledgeId)}],
|
|
4438
|
+
drivesGoals: [],
|
|
4439
|
+
lifecycle: 'draft',
|
|
4440
|
+
ui: {
|
|
4441
|
+
path: ${JSON.stringify(uiPath)},
|
|
4442
|
+
surfaces: [],
|
|
4443
|
+
${spec.icon === void 0 ? "" : `icon: ${JSON.stringify(spec.icon)},`}
|
|
4444
|
+
}${spec.withOntology ? `,
|
|
4445
|
+
ontology: {
|
|
4446
|
+
objectTypes: {}
|
|
4447
|
+
}` : ""}
|
|
4448
|
+
}`;
|
|
4449
|
+
const plan = {
|
|
4450
|
+
intent: "system",
|
|
4451
|
+
id: systemPath,
|
|
4452
|
+
summary: `Scaffold System "${systemPath}" with nav, role wiring, governing knowledge, and a UI manifest stub.`,
|
|
4453
|
+
writes: [
|
|
4454
|
+
{
|
|
4455
|
+
path: `packages/ui/src/features/${featureSlug}/manifest.stub.ts`,
|
|
4456
|
+
mode: "create",
|
|
4457
|
+
description: "SystemModule manifest stub. Route files are intentionally not generated.",
|
|
4458
|
+
content: `import type { SystemModule } from '@repo/ui'
|
|
4459
|
+
|
|
4460
|
+
export const ${featureSlug.replaceAll("-", "_")}Manifest: SystemModule = {
|
|
4461
|
+
systemId: ${JSON.stringify(systemPath)},
|
|
4462
|
+
label: ${JSON.stringify(label)},
|
|
4463
|
+
routes: []
|
|
4464
|
+
}
|
|
4465
|
+
`
|
|
4466
|
+
},
|
|
4467
|
+
{
|
|
4468
|
+
path: `packages/elevasis-core/src/knowledge/nodes/${featureSlug}-system-overview.mdx.stub`,
|
|
4469
|
+
mode: "create",
|
|
4470
|
+
description: "Governing knowledge skeleton for the new System.",
|
|
4471
|
+
content: `---
|
|
4472
|
+
id: ${knowledgeId}
|
|
4473
|
+
kind: reference
|
|
4474
|
+
title: ${JSON.stringify(`${label} System Overview`)}
|
|
4475
|
+
summary: ${JSON.stringify(`Governing context for the ${label} System.`)}
|
|
4476
|
+
links:
|
|
4477
|
+
- system:${systemPath}
|
|
4478
|
+
ownerIds:
|
|
4479
|
+
- ${roleId}
|
|
4480
|
+
updatedAt: 2026-05-15
|
|
4481
|
+
---
|
|
4482
|
+
|
|
4483
|
+
## Purpose
|
|
4484
|
+
|
|
4485
|
+
Document the operating boundaries, decisions, and ownership for ${label}.
|
|
4486
|
+
`
|
|
4487
|
+
}
|
|
4488
|
+
],
|
|
4489
|
+
edits: [
|
|
4490
|
+
{
|
|
4491
|
+
path: "packages/elevasis-core/src/organization-model/systems.ts",
|
|
4492
|
+
description: parentPath === void 0 ? "Add this entry to platformSystems." : `Add this entry under platformSystems ${parentPath}.systems.`,
|
|
4493
|
+
snippet: systemEntry
|
|
4494
|
+
},
|
|
4495
|
+
{
|
|
4496
|
+
path: "packages/elevasis-core/src/organization-model/navigation.ts",
|
|
4497
|
+
description: "Confirm sidebar placement derives from ui.path or add explicit surface targeting if needed.",
|
|
4498
|
+
snippet: `// System "${systemPath}" declares ui.path ${JSON.stringify(uiPath)}. Do not add route files in /om create.`
|
|
4499
|
+
},
|
|
4500
|
+
{
|
|
4501
|
+
path: "packages/elevasis-core/src/organization-model/roles.ts",
|
|
4502
|
+
description: `Confirm ${roleId} exists or add the owning role before merging.`,
|
|
4503
|
+
snippet: `// responsibleRoleId: ${JSON.stringify(roleId)}`
|
|
4504
|
+
},
|
|
4505
|
+
{
|
|
4506
|
+
path: "packages/elevasis-core/src/organization-model/assembly.ts",
|
|
4507
|
+
description: "Confirm roleFor()/owner routing covers the new System.",
|
|
4508
|
+
snippet: `case ${JSON.stringify(systemPath)}:
|
|
4509
|
+
return ${JSON.stringify(roleId)}`
|
|
4510
|
+
},
|
|
4511
|
+
{
|
|
4512
|
+
path: "packages/elevasis-core/src/organization-model/knowledge.ts",
|
|
4513
|
+
description: "Register the generated governing knowledge node after replacing the .stub suffix.",
|
|
4514
|
+
snippet: `${JSON.stringify(knowledgeId)}`
|
|
4515
|
+
}
|
|
4516
|
+
],
|
|
4517
|
+
warnings: spec.withOntology ? ["Ontology was requested; the default objectTypes block is intentionally empty until the domain language is known."] : ["Ontology is opt-in. Re-run with --with-ontology when the object/action/catalog language is known."],
|
|
4518
|
+
nextSteps: [
|
|
4519
|
+
"Review the planned OM edits and apply them in the listed source files.",
|
|
4520
|
+
"Replace .stub suffixes only after the System entry is merged.",
|
|
4521
|
+
`Run pnpm exec elevasis om:verify --scope ${systemPath}.`
|
|
4522
|
+
]
|
|
4523
|
+
};
|
|
4524
|
+
return addProjectNextStep(
|
|
4525
|
+
plan,
|
|
4526
|
+
withProject,
|
|
4527
|
+
`pnpm exec elevasis project:create --link-om ${systemPath} --title "Build ${label} System" --kind system-build`
|
|
4528
|
+
);
|
|
4529
|
+
}
|
|
4530
|
+
|
|
4531
|
+
// src/organization-model/scaffolders/index.ts
|
|
4532
|
+
function scaffoldOrganizationModel(model, spec) {
|
|
4533
|
+
if (spec.intent === "system") return scaffoldSystem(model, spec);
|
|
4534
|
+
if (spec.intent === "ontology") return scaffoldOntologyRecord(model, spec);
|
|
4535
|
+
if (spec.intent === "resource") return scaffoldResource(model, spec);
|
|
4536
|
+
return scaffoldKnowledgeNode(model, spec);
|
|
4537
|
+
}
|
|
4538
|
+
|
|
4539
|
+
export { ActionIdSchema, ActionInvocationKindSchema, ActionInvocationSchema, ActionRefSchema, ActionSchema, ActionScopeSchema, ActionsDomainSchema, AgentKindSchema, AgentResourceEntrySchema, AgentRoleHolderSchema, ApiEndpointInvocationSchema, CRM_ACTION_ENTRIES, CodeReferenceRoleSchema, CodeReferenceSchema, CustomerSegmentSchema, CustomersDomainSchema, DEFAULT_ONTOLOGY_SCOPE, DEFAULT_ORGANIZATION_MODEL, DEFAULT_ORGANIZATION_MODEL_ACTIONS, DEFAULT_ORGANIZATION_MODEL_CUSTOMERS, DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA, DEFAULT_ORGANIZATION_MODEL_ENTITIES, 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, LEAD_GEN_ACTION_ENTRIES, LEAD_GEN_STAGE_CATALOG, 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, 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, ScriptExecutionInvocationSchema, ScriptResourceEntrySchema, ScriptResourceLanguageSchema, ScriptResourceSourceSchema, SidebarNavigationSchema, SidebarNodeSchema, SidebarSectionSchema, SidebarSurfaceTargetsSchema, SlashCommandInvocationSchema, StatusEntrySchema, StatusSemanticClassSchema, StatusesDomainSchema, SurfaceDefinitionSchema, SurfaceTypeSchema, SystemEntrySchema, SystemIdSchema, SystemKindSchema, SystemLifecycleSchema, SystemPathSchema, SystemStatusSchema, SystemUiSchema, SystemsDomainSchema, TeamRoleHolderSchema, TechStackEntrySchema, UiPositionSchema, WorkflowResourceEntrySchema, compileOrganizationOntology, compileTopologyNodeRef, createFoundationOrganizationModel, defineOrganizationModel, defineResource, defineResourceOntology, defineResources, defineTopology, defineTopologyRelationship, findOrganizationActionById, formatOntologyId, getOntologyDiagnostics, getSortedSidebarEntries, isOntologyGraphNodeId, isOntologyTopologyRef, listResolvedOntologyRecords, ontologyGraphNodeId, ontologyIdFromGraphNodeId, parseOntologyId, parseTopologyNodeRef, resolveOrganizationModel, resolveOrganizationModelWithResources, scaffoldOrganizationModel, topologyRef, topologyRelationship };
|