@elevasis/core 0.23.0 → 0.24.1
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 +4343 -2690
- package/dist/index.js +1101 -156
- package/dist/knowledge/index.d.ts +574 -210
- package/dist/knowledge/index.js +104 -1
- package/dist/organization-model/index.d.ts +4343 -2690
- package/dist/organization-model/index.js +1101 -156
- package/dist/test-utils/index.d.ts +483 -109
- package/dist/test-utils/index.js +904 -144
- package/package.json +3 -3
- package/src/README.md +14 -14
- package/src/__tests__/publish.test.ts +24 -24
- package/src/__tests__/template-core-compatibility.test.ts +9 -12
- package/src/_gen/__tests__/__snapshots__/contracts.md.snap +2137 -2093
- package/src/_gen/__tests__/scaffold-contracts.test.ts +30 -30
- package/src/auth/multi-tenancy/credentials/__tests__/encryption.test.ts +217 -217
- package/src/auth/multi-tenancy/credentials/server/encryption.ts +69 -69
- package/src/auth/multi-tenancy/credentials/server/kek-loader.ts +37 -37
- package/src/auth/multi-tenancy/index.ts +26 -26
- package/src/auth/multi-tenancy/invitations/api-schemas.ts +104 -104
- package/src/auth/multi-tenancy/memberships/api-schemas.ts +143 -143
- package/src/auth/multi-tenancy/memberships/index.ts +26 -26
- package/src/auth/multi-tenancy/memberships/membership.ts +130 -130
- package/src/auth/multi-tenancy/organizations/__tests__/api-schemas.test.ts +194 -194
- package/src/auth/multi-tenancy/organizations/api-schemas.ts +136 -136
- package/src/auth/multi-tenancy/permissions.test.ts +42 -42
- package/src/auth/multi-tenancy/permissions.ts +123 -123
- package/src/auth/multi-tenancy/role-management/api-schemas.ts +78 -78
- package/src/auth/multi-tenancy/role-management/index.ts +16 -16
- package/src/auth/multi-tenancy/theme-presets.ts +45 -45
- package/src/auth/multi-tenancy/types.ts +57 -57
- package/src/auth/multi-tenancy/users/api-schemas.ts +165 -165
- package/src/business/README.md +2 -2
- package/src/business/acquisition/activity-events.test.ts +250 -250
- package/src/business/acquisition/activity-events.ts +93 -93
- package/src/business/acquisition/api-schemas.test.ts +1883 -1843
- package/src/business/acquisition/api-schemas.ts +1492 -1497
- package/src/business/acquisition/build-templates.test.ts +240 -240
- package/src/business/acquisition/build-templates.ts +98 -98
- package/src/business/acquisition/crm-next-action.test.ts +262 -262
- package/src/business/acquisition/crm-next-action.ts +220 -220
- package/src/business/acquisition/crm-priority.test.ts +216 -216
- package/src/business/acquisition/crm-priority.ts +349 -349
- package/src/business/acquisition/crm-state-actions.test.ts +153 -153
- package/src/business/acquisition/deal-ownership.test.ts +351 -351
- package/src/business/acquisition/deal-ownership.ts +120 -120
- package/src/business/acquisition/derive-actions.test.ts +129 -104
- package/src/business/acquisition/derive-actions.ts +74 -84
- package/src/business/acquisition/index.ts +171 -170
- package/src/business/acquisition/ontology-validation.ts +309 -0
- package/src/business/acquisition/stateful.ts +30 -30
- package/src/business/acquisition/types.ts +396 -396
- package/src/business/clients/api-schemas.test.ts +115 -115
- package/src/business/clients/api-schemas.ts +158 -158
- package/src/business/clients/index.ts +1 -1
- package/src/business/crm/api-schemas.ts +40 -40
- package/src/business/crm/index.ts +1 -1
- package/src/business/deals/api-schemas.ts +87 -87
- package/src/business/deals/index.ts +1 -1
- package/src/business/index.ts +5 -5
- package/src/business/projects/types.ts +144 -144
- package/src/commands/queue/types/task.ts +15 -15
- package/src/execution/core/runner-types.ts +61 -61
- package/src/execution/core/sse-executions.ts +7 -7
- package/src/execution/engine/__tests__/fixtures/test-agents.ts +10 -10
- package/src/execution/engine/agent/core/__tests__/agent.test.ts +16 -16
- package/src/execution/engine/agent/core/__tests__/error-passthrough.test.ts +4 -4
- package/src/execution/engine/agent/core/types.ts +25 -25
- package/src/execution/engine/agent/index.ts +6 -6
- package/src/execution/engine/agent/reasoning/__tests__/request-builder.test.ts +24 -24
- package/src/execution/engine/index.ts +443 -443
- package/src/execution/engine/tools/integration/server/adapters/apify/__tests__/apify-run-actor.integration.test.ts +298 -298
- package/src/execution/engine/tools/integration/server/adapters/apify/apify-adapter.test.ts +55 -55
- package/src/execution/engine/tools/integration/server/adapters/apify/apify-adapter.ts +107 -107
- package/src/execution/engine/tools/integration/server/adapters/apollo/apollo-adapter.test.ts +48 -48
- package/src/execution/engine/tools/integration/server/adapters/apollo/apollo-adapter.ts +99 -99
- package/src/execution/engine/tools/integration/server/adapters/apollo/index.ts +1 -1
- package/src/execution/engine/tools/integration/server/adapters/attio/__tests__/attio-crud.integration.test.ts +363 -363
- package/src/execution/engine/tools/integration/server/adapters/attio/fetch/get-record/index.test.ts +162 -162
- package/src/execution/engine/tools/integration/server/adapters/attio/fetch/list-records/index.test.ts +316 -316
- package/src/execution/engine/tools/integration/server/adapters/clickup/clickup-adapter.test.ts +18 -18
- package/src/execution/engine/tools/integration/server/adapters/clickup/clickup-adapter.ts +194 -194
- package/src/execution/engine/tools/integration/server/adapters/clickup/index.ts +7 -7
- package/src/execution/engine/tools/integration/server/adapters/gmail/gmail-adapter.ts +204 -204
- package/src/execution/engine/tools/integration/server/adapters/gmail/gmail-tools.ts +105 -105
- package/src/execution/engine/tools/integration/server/adapters/google-calendar/google-calendar-adapter.ts +428 -428
- package/src/execution/engine/tools/integration/server/adapters/google-calendar/index.ts +2 -2
- package/src/execution/engine/tools/integration/server/adapters/google-sheets/__tests__/google-sheets.integration.test.ts +261 -261
- package/src/execution/engine/tools/integration/server/adapters/instantly/instantly-tools.ts +1474 -1474
- package/src/execution/engine/tools/integration/server/adapters/millionverifier/millionverifier-tools.ts +103 -103
- package/src/execution/engine/tools/integration/server/adapters/resend/fetch/send-email/index.test.ts +88 -88
- package/src/execution/engine/tools/integration/server/adapters/resend/fetch/send-email/index.ts +141 -141
- package/src/execution/engine/tools/integration/server/adapters/resend/fetch/utils/types.ts +76 -76
- package/src/execution/engine/tools/integration/server/adapters/signature-api/signature-api-tools.ts +182 -182
- package/src/execution/engine/tools/integration/server/adapters/stripe/stripe-tools.ts +310 -310
- package/src/execution/engine/tools/integration/service.test.ts +239 -239
- package/src/execution/engine/tools/integration/service.ts +172 -172
- package/src/execution/engine/tools/integration/tool.ts +255 -255
- package/src/execution/engine/tools/lead-service-types.ts +1005 -1005
- package/src/execution/engine/tools/messages.ts +43 -43
- package/src/execution/engine/tools/platform/acquisition/company-tools.ts +7 -7
- package/src/execution/engine/tools/platform/acquisition/contact-tools.ts +6 -6
- package/src/execution/engine/tools/platform/acquisition/list-tools.ts +6 -6
- package/src/execution/engine/tools/platform/acquisition/types.ts +280 -280
- package/src/execution/engine/tools/platform/email/types.ts +97 -97
- package/src/execution/engine/tools/registry.ts +704 -704
- package/src/execution/engine/tools/tool-maps.ts +831 -831
- package/src/execution/engine/tools/types.ts +234 -234
- package/src/execution/engine/workflow/types.ts +195 -197
- package/src/execution/external/__tests__/api-schemas.test.ts +127 -127
- package/src/execution/external/api-schemas.ts +40 -40
- package/src/execution/external/index.ts +1 -1
- package/src/index.ts +18 -18
- package/src/integrations/credentials/__tests__/api-schemas.test.ts +420 -420
- package/src/integrations/credentials/api-schemas.ts +146 -146
- package/src/integrations/credentials/schemas.ts +200 -200
- package/src/integrations/oauth/__tests__/provider-registry.test.ts +7 -7
- package/src/integrations/oauth/provider-registry.ts +74 -74
- package/src/integrations/oauth/server/credentials.ts +43 -43
- package/src/integrations/webhook-endpoints/__tests__/api-schemas.test.ts +327 -327
- package/src/integrations/webhook-endpoints/api-schemas.ts +103 -103
- package/src/integrations/webhook-endpoints/types.ts +58 -58
- package/src/knowledge/README.md +32 -32
- package/src/knowledge/__tests__/queries.test.ts +626 -535
- package/src/knowledge/format.ts +99 -99
- package/src/knowledge/index.ts +5 -5
- package/src/knowledge/published.ts +5 -5
- package/src/knowledge/queries.ts +269 -218
- package/src/operations/activities/api-schemas.ts +80 -80
- package/src/operations/activities/types.ts +64 -64
- package/src/organization-model/README.md +149 -149
- package/src/organization-model/__tests__/content-kinds-registry.test.ts +210 -210
- package/src/organization-model/__tests__/defaults.test.ts +168 -168
- package/src/organization-model/__tests__/domains/actions.test.ts +78 -56
- package/src/organization-model/__tests__/domains/customers.test.ts +299 -299
- package/src/organization-model/__tests__/domains/entities.test.ts +56 -56
- package/src/organization-model/__tests__/domains/goals.test.ts +493 -493
- package/src/organization-model/__tests__/domains/identity.test.ts +280 -280
- package/src/organization-model/__tests__/domains/navigation.test.ts +268 -268
- package/src/organization-model/__tests__/domains/offerings.test.ts +414 -414
- package/src/organization-model/__tests__/domains/policies.test.ts +323 -323
- package/src/organization-model/__tests__/domains/resource-mappings.test.ts +293 -293
- package/src/organization-model/__tests__/domains/resources.test.ts +387 -277
- package/src/organization-model/__tests__/domains/roles.test.ts +463 -463
- package/src/organization-model/__tests__/domains/statuses.test.ts +246 -246
- package/src/organization-model/__tests__/domains/systems.test.ts +209 -209
- package/src/organization-model/__tests__/domains/topology.test.ts +188 -0
- package/src/organization-model/__tests__/flatten-additive-merge.test.ts +362 -361
- package/src/organization-model/__tests__/foundation.test.ts +77 -77
- package/src/organization-model/__tests__/get-resources-for-system.test.ts +144 -144
- package/src/organization-model/__tests__/graph.test.ts +1312 -862
- package/src/organization-model/__tests__/icons.test.ts +10 -1
- package/src/organization-model/__tests__/knowledge.test.ts +251 -15
- package/src/organization-model/__tests__/lookup-helpers.test.ts +438 -438
- package/src/organization-model/__tests__/migration-helpers.test.ts +591 -591
- package/src/organization-model/__tests__/prospecting-ssot.test.ts +103 -103
- package/src/organization-model/__tests__/recursive-system-schema.test.ts +535 -506
- package/src/organization-model/__tests__/resolve.test.ts +274 -164
- package/src/organization-model/__tests__/schema.test.ts +844 -301
- package/src/organization-model/__tests__/surface-projection.test.ts +284 -284
- package/src/organization-model/catalogs/lead-gen.ts +144 -144
- package/src/organization-model/content-kinds/config.ts +36 -36
- package/src/organization-model/content-kinds/index.ts +76 -72
- package/src/organization-model/content-kinds/pipeline.ts +68 -68
- package/src/organization-model/content-kinds/registry.ts +44 -44
- package/src/organization-model/content-kinds/status.ts +71 -71
- package/src/organization-model/content-kinds/template.ts +83 -83
- package/src/organization-model/content-kinds/types.ts +117 -117
- package/src/organization-model/contracts.ts +27 -27
- package/src/organization-model/defaults.ts +42 -50
- package/src/organization-model/domains/actions.ts +333 -239
- package/src/organization-model/domains/customers.ts +78 -78
- package/src/organization-model/domains/entities.ts +144 -144
- package/src/organization-model/domains/goals.ts +83 -83
- package/src/organization-model/domains/knowledge.ts +117 -101
- package/src/organization-model/domains/navigation.ts +139 -139
- package/src/organization-model/domains/offerings.ts +71 -71
- package/src/organization-model/domains/policies.ts +102 -102
- package/src/organization-model/domains/projects.ts +14 -14
- package/src/organization-model/domains/prospecting.ts +395 -395
- package/src/organization-model/domains/resources.ts +202 -124
- package/src/organization-model/domains/roles.ts +96 -96
- package/src/organization-model/domains/sales.test.ts +218 -218
- package/src/organization-model/domains/sales.ts +380 -380
- package/src/organization-model/domains/shared.ts +63 -63
- package/src/organization-model/domains/statuses.ts +339 -339
- package/src/organization-model/domains/systems.ts +217 -172
- package/src/organization-model/domains/topology.ts +261 -0
- package/src/organization-model/foundation.ts +75 -75
- package/src/organization-model/graph/build.ts +1043 -867
- package/src/organization-model/graph/index.ts +4 -4
- package/src/organization-model/graph/link.ts +10 -10
- package/src/organization-model/graph/schema.ts +75 -68
- package/src/organization-model/graph/types.ts +71 -64
- package/src/organization-model/helpers.ts +289 -241
- package/src/organization-model/icons.ts +78 -66
- package/src/organization-model/index.ts +128 -125
- package/src/organization-model/migration-helpers.ts +247 -244
- package/src/organization-model/ontology.ts +658 -0
- package/src/organization-model/organization-graph.mdx +110 -90
- package/src/organization-model/organization-model.mdx +225 -213
- package/src/organization-model/published.ts +299 -222
- package/src/organization-model/resolve.ts +146 -91
- package/src/organization-model/schema.ts +818 -659
- package/src/organization-model/surface-projection.ts +212 -212
- package/src/organization-model/types.ts +179 -155
- package/src/platform/api/types.ts +38 -38
- package/src/platform/constants/versions.ts +3 -3
- package/src/platform/index.ts +23 -23
- package/src/platform/registry/__tests__/command-view.test.ts +10 -10
- package/src/platform/registry/__tests__/resource-link.test.ts +35 -35
- package/src/platform/registry/__tests__/resource-registry.integration.test.ts +20 -20
- package/src/platform/registry/__tests__/resource-registry.nested-systems.test.ts +245 -245
- package/src/platform/registry/__tests__/resource-registry.test.ts +2053 -2053
- package/src/platform/registry/__tests__/validation.test.ts +1444 -1259
- package/src/platform/registry/command-view.ts +10 -10
- package/src/platform/registry/index.ts +103 -103
- package/src/platform/registry/resource-link.ts +32 -32
- package/src/platform/registry/resource-registry.ts +886 -886
- package/src/platform/registry/serialization.ts +295 -295
- package/src/platform/registry/serialized-types.ts +166 -166
- package/src/platform/registry/stats-types.ts +68 -68
- package/src/platform/registry/types.ts +425 -425
- package/src/platform/registry/validation.ts +876 -684
- package/src/platform/utils/__tests__/validation.test.ts +1084 -1084
- package/src/platform/utils/validation.ts +425 -425
- package/src/projects/api-schemas.test.ts +39 -39
- package/src/projects/api-schemas.ts +291 -291
- package/src/reference/_generated/contracts.md +2136 -2093
- package/src/reference/glossary.md +76 -76
- package/src/scaffold-registry/__tests__/index.test.ts +206 -206
- package/src/scaffold-registry/__tests__/schema.test.ts +166 -166
- package/src/scaffold-registry/index.ts +392 -392
- package/src/scaffold-registry/schema.ts +243 -243
- package/src/server.ts +289 -289
- package/src/supabase/database.types.ts +3 -0
- package/src/test-utils/README.md +37 -37
- package/src/test-utils/entities.ts +108 -108
- package/src/test-utils/fixtures/memberships.ts +82 -82
- package/src/test-utils/index.ts +12 -12
- package/src/test-utils/organization-model.ts +65 -65
- package/src/test-utils/published.ts +6 -6
- package/src/test-utils/rls/RLSTestContext.ts +588 -588
- package/src/test-utils/test-utils.test.ts +44 -44
package/dist/test-utils/index.js
CHANGED
|
@@ -19416,6 +19416,393 @@ function makeTask(overrides = {}) {
|
|
|
19416
19416
|
...overrides
|
|
19417
19417
|
});
|
|
19418
19418
|
}
|
|
19419
|
+
var OntologyKindSchema = z.enum([
|
|
19420
|
+
"object",
|
|
19421
|
+
"link",
|
|
19422
|
+
"action",
|
|
19423
|
+
"catalog",
|
|
19424
|
+
"event",
|
|
19425
|
+
"interface",
|
|
19426
|
+
"value-type",
|
|
19427
|
+
"property",
|
|
19428
|
+
"group",
|
|
19429
|
+
"surface"
|
|
19430
|
+
]);
|
|
19431
|
+
var SYSTEM_PATH_PATTERN = "[a-z0-9][a-z0-9-]*(?:\\.[a-z0-9][a-z0-9-]*)*";
|
|
19432
|
+
var LOCAL_ID_PATTERN = "[a-z0-9][a-z0-9._-]*";
|
|
19433
|
+
var ONTOLOGY_ID_PATTERN = `^(global|${SYSTEM_PATH_PATTERN}):(${OntologyKindSchema.options.join("|")})\\/(${LOCAL_ID_PATTERN})$`;
|
|
19434
|
+
var ONTOLOGY_ID_REGEX = new RegExp(ONTOLOGY_ID_PATTERN);
|
|
19435
|
+
var OntologyIdSchema = z.string().trim().min(1).max(300).regex(
|
|
19436
|
+
ONTOLOGY_ID_REGEX,
|
|
19437
|
+
"Ontology IDs must use <system-path>:<kind>/<local-id> or global:<kind>/<local-id>"
|
|
19438
|
+
);
|
|
19439
|
+
function parseOntologyId(id) {
|
|
19440
|
+
const normalized = OntologyIdSchema.parse(id);
|
|
19441
|
+
const match = ONTOLOGY_ID_REGEX.exec(normalized);
|
|
19442
|
+
if (match === null) {
|
|
19443
|
+
throw new Error(`Invalid ontology ID "${id}"`);
|
|
19444
|
+
}
|
|
19445
|
+
return {
|
|
19446
|
+
id: normalized,
|
|
19447
|
+
scope: match[1],
|
|
19448
|
+
kind: match[2],
|
|
19449
|
+
localId: match[3],
|
|
19450
|
+
isGlobal: match[1] === "global"
|
|
19451
|
+
};
|
|
19452
|
+
}
|
|
19453
|
+
function formatOntologyId(input) {
|
|
19454
|
+
return OntologyIdSchema.parse(`${input.scope}:${input.kind}/${input.localId}`);
|
|
19455
|
+
}
|
|
19456
|
+
var OntologyReferenceListSchema = z.array(OntologyIdSchema).default([]).optional();
|
|
19457
|
+
var OntologyRecordBaseSchema = z.object({
|
|
19458
|
+
id: OntologyIdSchema,
|
|
19459
|
+
label: z.string().trim().min(1).max(160).optional(),
|
|
19460
|
+
description: z.string().trim().min(1).max(2e3).optional(),
|
|
19461
|
+
ownerSystemId: z.string().trim().min(1).max(200).optional(),
|
|
19462
|
+
aliases: z.array(OntologyIdSchema).optional()
|
|
19463
|
+
}).passthrough();
|
|
19464
|
+
var OntologyObjectTypeSchema = OntologyRecordBaseSchema.extend({
|
|
19465
|
+
properties: z.record(z.string().trim().min(1).max(200), z.unknown()).optional(),
|
|
19466
|
+
storage: z.record(z.string(), z.unknown()).optional()
|
|
19467
|
+
});
|
|
19468
|
+
var OntologyLinkTypeSchema = OntologyRecordBaseSchema.extend({
|
|
19469
|
+
from: OntologyIdSchema,
|
|
19470
|
+
to: OntologyIdSchema,
|
|
19471
|
+
cardinality: z.string().trim().min(1).max(80).optional(),
|
|
19472
|
+
via: z.string().trim().min(1).max(255).optional()
|
|
19473
|
+
});
|
|
19474
|
+
var OntologyActionTypeSchema = OntologyRecordBaseSchema.extend({
|
|
19475
|
+
actsOn: OntologyReferenceListSchema,
|
|
19476
|
+
input: z.record(z.string().trim().min(1).max(200), z.unknown()).optional(),
|
|
19477
|
+
effects: z.array(z.record(z.string(), z.unknown())).optional()
|
|
19478
|
+
});
|
|
19479
|
+
var OntologyCatalogTypeSchema = OntologyRecordBaseSchema.extend({
|
|
19480
|
+
kind: z.string().trim().min(1).max(120).optional(),
|
|
19481
|
+
appliesTo: OntologyIdSchema.optional(),
|
|
19482
|
+
entries: z.record(z.string().trim().min(1).max(200), z.unknown()).optional()
|
|
19483
|
+
});
|
|
19484
|
+
var OntologyEventTypeSchema = OntologyRecordBaseSchema.extend({
|
|
19485
|
+
payload: z.record(z.string().trim().min(1).max(200), z.unknown()).optional()
|
|
19486
|
+
});
|
|
19487
|
+
var OntologyInterfaceTypeSchema = OntologyRecordBaseSchema.extend({
|
|
19488
|
+
properties: z.record(z.string().trim().min(1).max(200), z.unknown()).optional()
|
|
19489
|
+
});
|
|
19490
|
+
var OntologyValueTypeSchema = OntologyRecordBaseSchema.extend({
|
|
19491
|
+
primitive: z.string().trim().min(1).max(120).optional()
|
|
19492
|
+
});
|
|
19493
|
+
var OntologySharedPropertySchema = OntologyRecordBaseSchema.extend({
|
|
19494
|
+
valueType: OntologyIdSchema.optional(),
|
|
19495
|
+
searchable: z.boolean().optional(),
|
|
19496
|
+
pii: z.boolean().optional()
|
|
19497
|
+
});
|
|
19498
|
+
var OntologyGroupSchema = OntologyRecordBaseSchema.extend({
|
|
19499
|
+
members: OntologyReferenceListSchema
|
|
19500
|
+
});
|
|
19501
|
+
var OntologySurfaceTypeSchema = OntologyRecordBaseSchema.extend({
|
|
19502
|
+
route: z.string().trim().min(1).max(500).optional()
|
|
19503
|
+
});
|
|
19504
|
+
var OntologyScopeSchema = z.object({
|
|
19505
|
+
objectTypes: z.record(OntologyIdSchema, OntologyObjectTypeSchema).default({}).optional(),
|
|
19506
|
+
linkTypes: z.record(OntologyIdSchema, OntologyLinkTypeSchema).default({}).optional(),
|
|
19507
|
+
actionTypes: z.record(OntologyIdSchema, OntologyActionTypeSchema).default({}).optional(),
|
|
19508
|
+
catalogTypes: z.record(OntologyIdSchema, OntologyCatalogTypeSchema).default({}).optional(),
|
|
19509
|
+
eventTypes: z.record(OntologyIdSchema, OntologyEventTypeSchema).default({}).optional(),
|
|
19510
|
+
interfaceTypes: z.record(OntologyIdSchema, OntologyInterfaceTypeSchema).default({}).optional(),
|
|
19511
|
+
valueTypes: z.record(OntologyIdSchema, OntologyValueTypeSchema).default({}).optional(),
|
|
19512
|
+
sharedProperties: z.record(OntologyIdSchema, OntologySharedPropertySchema).default({}).optional(),
|
|
19513
|
+
groups: z.record(OntologyIdSchema, OntologyGroupSchema).default({}).optional(),
|
|
19514
|
+
surfaces: z.record(OntologyIdSchema, OntologySurfaceTypeSchema).default({}).optional()
|
|
19515
|
+
}).default({});
|
|
19516
|
+
var DEFAULT_ONTOLOGY_SCOPE = {
|
|
19517
|
+
valueTypes: {
|
|
19518
|
+
"global:value-type/uuid": {
|
|
19519
|
+
id: "global:value-type/uuid",
|
|
19520
|
+
label: "UUID",
|
|
19521
|
+
primitive: "string"
|
|
19522
|
+
},
|
|
19523
|
+
"global:value-type/text": {
|
|
19524
|
+
id: "global:value-type/text",
|
|
19525
|
+
label: "Text",
|
|
19526
|
+
primitive: "string"
|
|
19527
|
+
},
|
|
19528
|
+
"global:value-type/url": {
|
|
19529
|
+
id: "global:value-type/url",
|
|
19530
|
+
label: "URL",
|
|
19531
|
+
primitive: "string"
|
|
19532
|
+
},
|
|
19533
|
+
"global:value-type/email": {
|
|
19534
|
+
id: "global:value-type/email",
|
|
19535
|
+
label: "Email",
|
|
19536
|
+
primitive: "string"
|
|
19537
|
+
}
|
|
19538
|
+
}
|
|
19539
|
+
};
|
|
19540
|
+
var SCOPE_KIND = {
|
|
19541
|
+
objectTypes: "object",
|
|
19542
|
+
linkTypes: "link",
|
|
19543
|
+
actionTypes: "action",
|
|
19544
|
+
catalogTypes: "catalog",
|
|
19545
|
+
eventTypes: "event",
|
|
19546
|
+
interfaceTypes: "interface",
|
|
19547
|
+
valueTypes: "value-type",
|
|
19548
|
+
sharedProperties: "property",
|
|
19549
|
+
groups: "group",
|
|
19550
|
+
surfaces: "surface"
|
|
19551
|
+
};
|
|
19552
|
+
var SCOPE_KEYS = Object.keys(SCOPE_KIND);
|
|
19553
|
+
function listResolvedOntologyRecords(index2) {
|
|
19554
|
+
return SCOPE_KEYS.flatMap((scopeKey) => {
|
|
19555
|
+
const kind = SCOPE_KIND[scopeKey];
|
|
19556
|
+
return Object.entries(index2[scopeKey]).sort(([leftId], [rightId]) => leftId.localeCompare(rightId)).map(([id, record]) => ({
|
|
19557
|
+
id,
|
|
19558
|
+
kind,
|
|
19559
|
+
record
|
|
19560
|
+
}));
|
|
19561
|
+
});
|
|
19562
|
+
}
|
|
19563
|
+
function originFromContext(context) {
|
|
19564
|
+
return {
|
|
19565
|
+
kind: context.kind,
|
|
19566
|
+
source: context.source,
|
|
19567
|
+
path: context.path,
|
|
19568
|
+
...context.systemPath !== void 0 ? { systemPath: context.systemPath } : {},
|
|
19569
|
+
...context.legacyId !== void 0 ? { legacyId: context.legacyId } : {}
|
|
19570
|
+
};
|
|
19571
|
+
}
|
|
19572
|
+
function createEmptyIndex() {
|
|
19573
|
+
return {
|
|
19574
|
+
objectTypes: {},
|
|
19575
|
+
linkTypes: {},
|
|
19576
|
+
actionTypes: {},
|
|
19577
|
+
catalogTypes: {},
|
|
19578
|
+
eventTypes: {},
|
|
19579
|
+
interfaceTypes: {},
|
|
19580
|
+
valueTypes: {},
|
|
19581
|
+
sharedProperties: {},
|
|
19582
|
+
groups: {},
|
|
19583
|
+
surfaces: {}
|
|
19584
|
+
};
|
|
19585
|
+
}
|
|
19586
|
+
function sortResolvedOntologyIndex(index2) {
|
|
19587
|
+
const sorted = createEmptyIndex();
|
|
19588
|
+
for (const scopeKey of SCOPE_KEYS) {
|
|
19589
|
+
const target = sorted[scopeKey];
|
|
19590
|
+
for (const [id, record] of Object.entries(index2[scopeKey]).sort(
|
|
19591
|
+
([leftId], [rightId]) => leftId.localeCompare(rightId)
|
|
19592
|
+
)) {
|
|
19593
|
+
target[id] = record;
|
|
19594
|
+
}
|
|
19595
|
+
}
|
|
19596
|
+
return sorted;
|
|
19597
|
+
}
|
|
19598
|
+
function childSystemsOf(system) {
|
|
19599
|
+
return system.systems ?? system.subsystems ?? {};
|
|
19600
|
+
}
|
|
19601
|
+
function addRecord(index2, diagnostics, sourcesById, scopeKey, record, context) {
|
|
19602
|
+
let parsed;
|
|
19603
|
+
try {
|
|
19604
|
+
parsed = parseOntologyId(record.id);
|
|
19605
|
+
} catch {
|
|
19606
|
+
diagnostics.push({
|
|
19607
|
+
code: "invalid_ontology_id",
|
|
19608
|
+
message: `Invalid ontology ID "${record.id}" from ${context.source} at ${context.path.join(".")}`,
|
|
19609
|
+
id: record.id,
|
|
19610
|
+
path: context.path,
|
|
19611
|
+
source: context.source,
|
|
19612
|
+
origin: originFromContext(context)
|
|
19613
|
+
});
|
|
19614
|
+
return;
|
|
19615
|
+
}
|
|
19616
|
+
const expectedKind = SCOPE_KIND[scopeKey];
|
|
19617
|
+
if (parsed.kind !== expectedKind) {
|
|
19618
|
+
diagnostics.push({
|
|
19619
|
+
code: "ontology_kind_mismatch",
|
|
19620
|
+
message: `Ontology ID "${record.id}" has kind "${parsed.kind}" but was authored in ${scopeKey} (${expectedKind}) at ${context.path.join(".")}`,
|
|
19621
|
+
id: record.id,
|
|
19622
|
+
path: context.path,
|
|
19623
|
+
source: context.source,
|
|
19624
|
+
origin: originFromContext(context)
|
|
19625
|
+
});
|
|
19626
|
+
return;
|
|
19627
|
+
}
|
|
19628
|
+
const existing = sourcesById.get(parsed.id);
|
|
19629
|
+
if (existing !== void 0) {
|
|
19630
|
+
diagnostics.push({
|
|
19631
|
+
code: "duplicate_ontology_id",
|
|
19632
|
+
message: `Duplicate ontology ID "${parsed.id}" from ${context.source} at ${context.path.join(".")} conflicts with ${existing.source} at ${existing.path.join(".")}`,
|
|
19633
|
+
id: parsed.id,
|
|
19634
|
+
path: context.path,
|
|
19635
|
+
source: context.source,
|
|
19636
|
+
origin: originFromContext(context),
|
|
19637
|
+
existingSource: existing.source,
|
|
19638
|
+
existingOrigin: originFromContext(existing)
|
|
19639
|
+
});
|
|
19640
|
+
return;
|
|
19641
|
+
}
|
|
19642
|
+
sourcesById.set(parsed.id, context);
|
|
19643
|
+
index2[scopeKey][parsed.id] = {
|
|
19644
|
+
...record,
|
|
19645
|
+
origin: originFromContext(context)
|
|
19646
|
+
};
|
|
19647
|
+
}
|
|
19648
|
+
function addScope(index2, diagnostics, sourcesById, scope, source, path) {
|
|
19649
|
+
if (scope === void 0) return;
|
|
19650
|
+
for (const scopeKey of SCOPE_KEYS) {
|
|
19651
|
+
const records = scope[scopeKey] ?? {};
|
|
19652
|
+
for (const [key, record] of Object.entries(records)) {
|
|
19653
|
+
addRecord(index2, diagnostics, sourcesById, scopeKey, record, {
|
|
19654
|
+
source,
|
|
19655
|
+
path: [...path, scopeKey, key],
|
|
19656
|
+
kind: "authored",
|
|
19657
|
+
systemPath: source.startsWith("system:") ? source.slice("system:".length, -".ontology".length) : void 0
|
|
19658
|
+
});
|
|
19659
|
+
}
|
|
19660
|
+
}
|
|
19661
|
+
}
|
|
19662
|
+
function legacyObjectId(entity) {
|
|
19663
|
+
return formatOntologyId({ scope: entity.ownedBySystemId, kind: "object", localId: entity.id });
|
|
19664
|
+
}
|
|
19665
|
+
function legacyActionOwner(action, entities) {
|
|
19666
|
+
const firstAffectedEntityId = action.affects?.find((entityId) => entities[entityId] !== void 0);
|
|
19667
|
+
if (firstAffectedEntityId !== void 0) {
|
|
19668
|
+
return entities[firstAffectedEntityId].ownedBySystemId;
|
|
19669
|
+
}
|
|
19670
|
+
if (typeof action.scope === "object") {
|
|
19671
|
+
return action.scope.domain;
|
|
19672
|
+
}
|
|
19673
|
+
return "global";
|
|
19674
|
+
}
|
|
19675
|
+
function addLegacyEntityProjections(index2, diagnostics, sourcesById, entities) {
|
|
19676
|
+
for (const entity of Object.values(entities)) {
|
|
19677
|
+
const objectType = {
|
|
19678
|
+
id: legacyObjectId(entity),
|
|
19679
|
+
label: entity.label,
|
|
19680
|
+
description: entity.description,
|
|
19681
|
+
ownerSystemId: entity.ownedBySystemId,
|
|
19682
|
+
...entity.table !== void 0 ? {
|
|
19683
|
+
storage: {
|
|
19684
|
+
kind: "table",
|
|
19685
|
+
table: entity.table
|
|
19686
|
+
}
|
|
19687
|
+
} : {},
|
|
19688
|
+
...entity.rowSchema !== void 0 ? { rowSchema: entity.rowSchema } : {},
|
|
19689
|
+
...entity.stateCatalogId !== void 0 ? { stateCatalogId: entity.stateCatalogId } : {}
|
|
19690
|
+
};
|
|
19691
|
+
addRecord(index2, diagnostics, sourcesById, "objectTypes", objectType, {
|
|
19692
|
+
source: "legacy.entities",
|
|
19693
|
+
path: ["entities", entity.id],
|
|
19694
|
+
kind: "projected",
|
|
19695
|
+
systemPath: entity.ownedBySystemId,
|
|
19696
|
+
legacyId: entity.id
|
|
19697
|
+
});
|
|
19698
|
+
entity.links?.forEach((link, linkIndex) => {
|
|
19699
|
+
const targetEntity = entities[link.toEntity];
|
|
19700
|
+
if (targetEntity === void 0) return;
|
|
19701
|
+
const linkType = {
|
|
19702
|
+
id: formatOntologyId({
|
|
19703
|
+
scope: entity.ownedBySystemId,
|
|
19704
|
+
kind: "link",
|
|
19705
|
+
localId: `${entity.id}-${link.toEntity}-${linkIndex}`
|
|
19706
|
+
}),
|
|
19707
|
+
label: link.label ?? link.kind,
|
|
19708
|
+
ownerSystemId: entity.ownedBySystemId,
|
|
19709
|
+
from: legacyObjectId(entity),
|
|
19710
|
+
to: legacyObjectId(targetEntity),
|
|
19711
|
+
cardinality: link.kind,
|
|
19712
|
+
...link.via !== void 0 ? { via: link.via } : {}
|
|
19713
|
+
};
|
|
19714
|
+
addRecord(index2, diagnostics, sourcesById, "linkTypes", linkType, {
|
|
19715
|
+
source: "legacy.entities.links",
|
|
19716
|
+
path: ["entities", entity.id, "links", linkIndex],
|
|
19717
|
+
kind: "projected",
|
|
19718
|
+
systemPath: entity.ownedBySystemId,
|
|
19719
|
+
legacyId: `${entity.id}.links.${linkIndex}`
|
|
19720
|
+
});
|
|
19721
|
+
});
|
|
19722
|
+
}
|
|
19723
|
+
}
|
|
19724
|
+
function addLegacyActionProjections(index2, diagnostics, sourcesById, actions, entities) {
|
|
19725
|
+
for (const action of Object.values(actions)) {
|
|
19726
|
+
const ownerSystemId = legacyActionOwner(action, entities);
|
|
19727
|
+
const actionType = {
|
|
19728
|
+
id: formatOntologyId({ scope: ownerSystemId, kind: "action", localId: action.id }),
|
|
19729
|
+
label: action.label,
|
|
19730
|
+
description: action.description,
|
|
19731
|
+
ownerSystemId,
|
|
19732
|
+
actsOn: action.affects?.map((entityId) => entities[entityId] ? legacyObjectId(entities[entityId]) : void 0).filter((id) => id !== void 0),
|
|
19733
|
+
...action.resourceId !== void 0 ? { resourceId: action.resourceId } : {},
|
|
19734
|
+
...action.invocations !== void 0 ? { invocations: action.invocations } : {},
|
|
19735
|
+
...action.lifecycle !== void 0 ? { lifecycle: action.lifecycle } : {},
|
|
19736
|
+
legacyActionId: action.id
|
|
19737
|
+
};
|
|
19738
|
+
addRecord(index2, diagnostics, sourcesById, "actionTypes", actionType, {
|
|
19739
|
+
source: "legacy.actions",
|
|
19740
|
+
path: ["actions", action.id],
|
|
19741
|
+
kind: "projected",
|
|
19742
|
+
systemPath: ownerSystemId,
|
|
19743
|
+
legacyId: action.id
|
|
19744
|
+
});
|
|
19745
|
+
}
|
|
19746
|
+
}
|
|
19747
|
+
function addSystemContentProjections(index2, diagnostics, sourcesById, systemPath, system, schemaPath) {
|
|
19748
|
+
const content = system.content ?? {};
|
|
19749
|
+
for (const [localId, node] of Object.entries(content)) {
|
|
19750
|
+
if (node.kind !== "schema") continue;
|
|
19751
|
+
const entries = Object.fromEntries(
|
|
19752
|
+
Object.entries(content).filter(([, candidate]) => candidate.parentContentId === localId).map(([entryId, candidate]) => [
|
|
19753
|
+
entryId,
|
|
19754
|
+
{
|
|
19755
|
+
label: candidate.label ?? entryId,
|
|
19756
|
+
type: candidate.type,
|
|
19757
|
+
...candidate.description !== void 0 ? { description: candidate.description } : {},
|
|
19758
|
+
...candidate.data !== void 0 ? candidate.data : {}
|
|
19759
|
+
}
|
|
19760
|
+
])
|
|
19761
|
+
);
|
|
19762
|
+
const catalogType = {
|
|
19763
|
+
id: formatOntologyId({ scope: systemPath, kind: "catalog", localId }),
|
|
19764
|
+
label: node.label ?? localId,
|
|
19765
|
+
description: node.description,
|
|
19766
|
+
ownerSystemId: systemPath,
|
|
19767
|
+
kind: node.type,
|
|
19768
|
+
...typeof node.data?.["entityId"] === "string" ? { appliesTo: formatOntologyId({ scope: systemPath, kind: "object", localId: node.data["entityId"] }) } : {},
|
|
19769
|
+
...Object.keys(entries).length > 0 ? { entries } : {},
|
|
19770
|
+
...node.data !== void 0 ? { data: node.data } : {}
|
|
19771
|
+
};
|
|
19772
|
+
addRecord(index2, diagnostics, sourcesById, "catalogTypes", catalogType, {
|
|
19773
|
+
source: "legacy.system.content",
|
|
19774
|
+
path: [...schemaPath, "content", localId],
|
|
19775
|
+
kind: "projected",
|
|
19776
|
+
systemPath,
|
|
19777
|
+
legacyId: `${systemPath}:${localId}`
|
|
19778
|
+
});
|
|
19779
|
+
}
|
|
19780
|
+
}
|
|
19781
|
+
function addSystemScopes(index2, diagnostics, sourcesById, systems, prefix, schemaPath) {
|
|
19782
|
+
for (const [key, system] of Object.entries(systems)) {
|
|
19783
|
+
const systemPath = prefix ? `${prefix}.${key}` : key;
|
|
19784
|
+
const currentPath = [...schemaPath, key];
|
|
19785
|
+
addScope(index2, diagnostics, sourcesById, system.ontology, `system:${systemPath}.ontology`, [
|
|
19786
|
+
...currentPath,
|
|
19787
|
+
"ontology"
|
|
19788
|
+
]);
|
|
19789
|
+
addSystemContentProjections(index2, diagnostics, sourcesById, systemPath, system, currentPath);
|
|
19790
|
+
addSystemScopes(index2, diagnostics, sourcesById, childSystemsOf(system), systemPath, [
|
|
19791
|
+
...currentPath,
|
|
19792
|
+
system.systems !== void 0 ? "systems" : "subsystems"
|
|
19793
|
+
]);
|
|
19794
|
+
}
|
|
19795
|
+
}
|
|
19796
|
+
function compileOrganizationOntology(model) {
|
|
19797
|
+
const ontology = createEmptyIndex();
|
|
19798
|
+
const diagnostics = [];
|
|
19799
|
+
const sourcesById = /* @__PURE__ */ new Map();
|
|
19800
|
+
addScope(ontology, diagnostics, sourcesById, model.ontology, "organization.ontology", ["ontology"]);
|
|
19801
|
+
addSystemScopes(ontology, diagnostics, sourcesById, model.systems ?? {}, "", ["systems"]);
|
|
19802
|
+
addLegacyEntityProjections(ontology, diagnostics, sourcesById, model.entities ?? {});
|
|
19803
|
+
addLegacyActionProjections(ontology, diagnostics, sourcesById, model.actions ?? {}, model.entities ?? {});
|
|
19804
|
+
return { ontology: sortResolvedOntologyIndex(ontology), diagnostics };
|
|
19805
|
+
}
|
|
19419
19806
|
|
|
19420
19807
|
// src/organization-model/content-kinds/registry.ts
|
|
19421
19808
|
function defineContentType(def) {
|
|
@@ -19601,73 +19988,78 @@ function lookupContentType(kind, type3) {
|
|
|
19601
19988
|
return CONTENT_KIND_REGISTRY[key];
|
|
19602
19989
|
}
|
|
19603
19990
|
var ORGANIZATION_MODEL_ICON_TOKENS = [
|
|
19604
|
-
|
|
19605
|
-
"
|
|
19606
|
-
"
|
|
19607
|
-
"
|
|
19608
|
-
"
|
|
19609
|
-
"
|
|
19610
|
-
"
|
|
19611
|
-
"
|
|
19612
|
-
"
|
|
19613
|
-
"
|
|
19614
|
-
"
|
|
19615
|
-
"
|
|
19616
|
-
"
|
|
19617
|
-
"
|
|
19618
|
-
"
|
|
19619
|
-
"
|
|
19620
|
-
"
|
|
19621
|
-
|
|
19622
|
-
"
|
|
19623
|
-
"
|
|
19624
|
-
"
|
|
19625
|
-
|
|
19626
|
-
"
|
|
19627
|
-
"
|
|
19628
|
-
"
|
|
19629
|
-
"
|
|
19630
|
-
"
|
|
19631
|
-
"
|
|
19632
|
-
|
|
19633
|
-
"
|
|
19634
|
-
"
|
|
19635
|
-
"
|
|
19636
|
-
|
|
19637
|
-
"
|
|
19638
|
-
"
|
|
19639
|
-
"
|
|
19640
|
-
"
|
|
19641
|
-
"
|
|
19642
|
-
"
|
|
19643
|
-
|
|
19644
|
-
"
|
|
19645
|
-
"
|
|
19646
|
-
"
|
|
19647
|
-
"
|
|
19648
|
-
"
|
|
19649
|
-
"
|
|
19650
|
-
"
|
|
19651
|
-
"
|
|
19652
|
-
"
|
|
19653
|
-
"
|
|
19654
|
-
"
|
|
19655
|
-
|
|
19656
|
-
"
|
|
19657
|
-
"
|
|
19658
|
-
"
|
|
19659
|
-
"
|
|
19660
|
-
"
|
|
19661
|
-
|
|
19662
|
-
"
|
|
19663
|
-
"
|
|
19664
|
-
"
|
|
19665
|
-
"
|
|
19666
|
-
"
|
|
19667
|
-
"
|
|
19668
|
-
"
|
|
19991
|
+
// Navigation / app areas
|
|
19992
|
+
"dashboard",
|
|
19993
|
+
"calendar",
|
|
19994
|
+
"sales",
|
|
19995
|
+
"crm",
|
|
19996
|
+
"lead-gen",
|
|
19997
|
+
"projects",
|
|
19998
|
+
"operations",
|
|
19999
|
+
"monitoring",
|
|
20000
|
+
"knowledge",
|
|
20001
|
+
"settings",
|
|
20002
|
+
"admin",
|
|
20003
|
+
"archive",
|
|
20004
|
+
"business",
|
|
20005
|
+
"finance",
|
|
20006
|
+
"platform",
|
|
20007
|
+
"seo",
|
|
20008
|
+
// Knowledge kinds
|
|
20009
|
+
"playbook",
|
|
20010
|
+
"strategy",
|
|
20011
|
+
"reference",
|
|
20012
|
+
// Resource kinds
|
|
20013
|
+
"agent",
|
|
20014
|
+
"workflow",
|
|
20015
|
+
"integration",
|
|
20016
|
+
"database",
|
|
20017
|
+
"user",
|
|
20018
|
+
"team",
|
|
20019
|
+
// Integration specifics
|
|
20020
|
+
"gmail",
|
|
20021
|
+
"google-sheets",
|
|
20022
|
+
"attio",
|
|
20023
|
+
// Surface / UI views
|
|
20024
|
+
"overview",
|
|
20025
|
+
"command-view",
|
|
20026
|
+
"command-queue",
|
|
20027
|
+
"pipeline",
|
|
20028
|
+
"lists",
|
|
20029
|
+
"resources",
|
|
20030
|
+
// Actions
|
|
20031
|
+
"approve",
|
|
20032
|
+
"reject",
|
|
20033
|
+
"retry",
|
|
20034
|
+
"edit",
|
|
20035
|
+
"view",
|
|
20036
|
+
"launch",
|
|
20037
|
+
"message",
|
|
20038
|
+
"escalate",
|
|
20039
|
+
"promote",
|
|
20040
|
+
"submit",
|
|
20041
|
+
"email",
|
|
20042
|
+
// Status
|
|
20043
|
+
"success",
|
|
20044
|
+
"error",
|
|
20045
|
+
"warning",
|
|
20046
|
+
"info",
|
|
20047
|
+
"pending",
|
|
20048
|
+
// OM / UI group icons
|
|
20049
|
+
"bolt",
|
|
20050
|
+
"building",
|
|
20051
|
+
"briefcase",
|
|
20052
|
+
"apps",
|
|
20053
|
+
"graph",
|
|
20054
|
+
"shield",
|
|
20055
|
+
"users",
|
|
20056
|
+
"chart-bar",
|
|
20057
|
+
"search"
|
|
19669
20058
|
];
|
|
19670
|
-
var CustomIconTokenSchema = z.string().trim().max(80).regex(
|
|
20059
|
+
var CustomIconTokenSchema = z.string().trim().max(80).regex(
|
|
20060
|
+
/^custom\.[a-z0-9]+(?:[-._][a-z0-9]+)*$/,
|
|
20061
|
+
'Custom icon tokens must start with "custom." followed by lowercase alphanumeric segments'
|
|
20062
|
+
);
|
|
19671
20063
|
var OrganizationModelBuiltinIconTokenSchema = z.enum(ORGANIZATION_MODEL_ICON_TOKENS);
|
|
19672
20064
|
var OrganizationModelIconTokenSchema = z.union([
|
|
19673
20065
|
OrganizationModelBuiltinIconTokenSchema,
|
|
@@ -20263,7 +20655,99 @@ var LEAD_GEN_ACTION_ENTRIES = Object.fromEntries(
|
|
|
20263
20655
|
return [parsed.id, parsed];
|
|
20264
20656
|
})
|
|
20265
20657
|
);
|
|
20266
|
-
var
|
|
20658
|
+
var CRM_ACTION_ENTRY_INPUTS = [
|
|
20659
|
+
{
|
|
20660
|
+
id: "send_reply",
|
|
20661
|
+
order: 210,
|
|
20662
|
+
label: "Send Reply",
|
|
20663
|
+
description: "Send a contextual reply for an active CRM deal.",
|
|
20664
|
+
scope: { domain: "sales" },
|
|
20665
|
+
resourceId: "crm-send-reply-workflow",
|
|
20666
|
+
affects: ["crm.deal"]
|
|
20667
|
+
},
|
|
20668
|
+
{
|
|
20669
|
+
id: "send_link",
|
|
20670
|
+
order: 220,
|
|
20671
|
+
label: "Send Booking Link",
|
|
20672
|
+
description: "Send a booking link to move a deal toward a scheduled call.",
|
|
20673
|
+
scope: { domain: "sales" },
|
|
20674
|
+
resourceId: "crm-send-booking-link-workflow",
|
|
20675
|
+
affects: ["crm.deal"]
|
|
20676
|
+
},
|
|
20677
|
+
{
|
|
20678
|
+
id: "send_nudge",
|
|
20679
|
+
order: 230,
|
|
20680
|
+
label: "Send Nudge",
|
|
20681
|
+
description: "Send a follow-up nudge for a stalled CRM deal.",
|
|
20682
|
+
scope: { domain: "sales" },
|
|
20683
|
+
resourceId: "crm-send-nudge-workflow",
|
|
20684
|
+
affects: ["crm.deal"]
|
|
20685
|
+
},
|
|
20686
|
+
{
|
|
20687
|
+
id: "rebook",
|
|
20688
|
+
order: 240,
|
|
20689
|
+
label: "Rebook",
|
|
20690
|
+
description: "Rebook a missed or rescheduled CRM appointment.",
|
|
20691
|
+
scope: { domain: "sales" },
|
|
20692
|
+
resourceId: "crm-rebook-workflow",
|
|
20693
|
+
affects: ["crm.deal"]
|
|
20694
|
+
},
|
|
20695
|
+
{
|
|
20696
|
+
id: "move_to_proposal",
|
|
20697
|
+
order: 250,
|
|
20698
|
+
label: "Move to Proposal",
|
|
20699
|
+
description: "Advance a qualified CRM deal into the proposal stage.",
|
|
20700
|
+
scope: { domain: "sales" },
|
|
20701
|
+
resourceId: "move_to_proposal-workflow",
|
|
20702
|
+
affects: ["crm.deal"]
|
|
20703
|
+
},
|
|
20704
|
+
{
|
|
20705
|
+
id: "move_to_closing",
|
|
20706
|
+
order: 260,
|
|
20707
|
+
label: "Move to Closing",
|
|
20708
|
+
description: "Advance a proposal-stage CRM deal into closing.",
|
|
20709
|
+
scope: { domain: "sales" },
|
|
20710
|
+
resourceId: "move_to_closing-workflow",
|
|
20711
|
+
affects: ["crm.deal"]
|
|
20712
|
+
},
|
|
20713
|
+
{
|
|
20714
|
+
id: "move_to_closed_won",
|
|
20715
|
+
order: 270,
|
|
20716
|
+
label: "Close Won",
|
|
20717
|
+
description: "Mark a CRM deal as closed won.",
|
|
20718
|
+
scope: { domain: "sales" },
|
|
20719
|
+
resourceId: "move_to_closed_won-workflow",
|
|
20720
|
+
affects: ["crm.deal"]
|
|
20721
|
+
},
|
|
20722
|
+
{
|
|
20723
|
+
id: "move_to_closed_lost",
|
|
20724
|
+
order: 280,
|
|
20725
|
+
label: "Close Lost",
|
|
20726
|
+
description: "Mark a CRM deal as closed lost.",
|
|
20727
|
+
scope: { domain: "sales" },
|
|
20728
|
+
resourceId: "move_to_closed_lost-workflow",
|
|
20729
|
+
affects: ["crm.deal"]
|
|
20730
|
+
},
|
|
20731
|
+
{
|
|
20732
|
+
id: "move_to_nurturing",
|
|
20733
|
+
order: 290,
|
|
20734
|
+
label: "Move to Nurturing",
|
|
20735
|
+
description: "Move a CRM deal into nurturing for future follow-up.",
|
|
20736
|
+
scope: { domain: "sales" },
|
|
20737
|
+
resourceId: "move_to_nurturing-workflow",
|
|
20738
|
+
affects: ["crm.deal"]
|
|
20739
|
+
}
|
|
20740
|
+
];
|
|
20741
|
+
var CRM_ACTION_ENTRIES = Object.fromEntries(
|
|
20742
|
+
CRM_ACTION_ENTRY_INPUTS.map((action) => {
|
|
20743
|
+
const parsed = ActionSchema.parse(action);
|
|
20744
|
+
return [parsed.id, parsed];
|
|
20745
|
+
})
|
|
20746
|
+
);
|
|
20747
|
+
var DEFAULT_ORGANIZATION_MODEL_ACTIONS = {
|
|
20748
|
+
...LEAD_GEN_ACTION_ENTRIES,
|
|
20749
|
+
...CRM_ACTION_ENTRIES
|
|
20750
|
+
};
|
|
20267
20751
|
|
|
20268
20752
|
// src/organization-model/domains/systems.ts
|
|
20269
20753
|
var SystemKindSchema = z.enum(["product", "operational", "platform", "diagnostic"]).meta({ label: "System kind", color: "blue" });
|
|
@@ -20285,6 +20769,17 @@ var SystemUiSchema = z.object({
|
|
|
20285
20769
|
icon: IconNameSchema.optional(),
|
|
20286
20770
|
order: z.number().int().optional()
|
|
20287
20771
|
});
|
|
20772
|
+
var JsonValueSchema = z.lazy(
|
|
20773
|
+
() => z.union([
|
|
20774
|
+
z.string(),
|
|
20775
|
+
z.number(),
|
|
20776
|
+
z.boolean(),
|
|
20777
|
+
z.null(),
|
|
20778
|
+
z.array(JsonValueSchema),
|
|
20779
|
+
z.record(z.string(), JsonValueSchema)
|
|
20780
|
+
])
|
|
20781
|
+
);
|
|
20782
|
+
var SystemConfigSchema = z.record(z.string().trim().min(1).max(200), JsonValueSchema).default({}).optional();
|
|
20288
20783
|
var SystemEntrySchema = z.object({
|
|
20289
20784
|
/** Stable tenant-defined system id (e.g. "sys.lead-gen" or "sales.crm"). */
|
|
20290
20785
|
id: SystemIdSchema,
|
|
@@ -20330,11 +20825,21 @@ var SystemEntrySchema = z.object({
|
|
|
20330
20825
|
/** Domain-map iteration order. Convention: multiples of 10 (10, 20, 30, ...) to allow easy insertion. */
|
|
20331
20826
|
order: z.number(),
|
|
20332
20827
|
/**
|
|
20333
|
-
* System-
|
|
20334
|
-
*
|
|
20335
|
-
|
|
20336
|
-
|
|
20337
|
-
|
|
20828
|
+
* System-local JSON settings and defaults. Strongly typed OM fields,
|
|
20829
|
+
* secrets, credentials, and runtime state stay outside this bucket.
|
|
20830
|
+
*/
|
|
20831
|
+
config: SystemConfigSchema,
|
|
20832
|
+
/**
|
|
20833
|
+
* System-owned ontology declarations. `systems` is now the canonical child
|
|
20834
|
+
* key; this scope holds the object, action, catalog, link, event, and
|
|
20835
|
+
* shared contract records owned by this system.
|
|
20836
|
+
*/
|
|
20837
|
+
ontology: OntologyScopeSchema.optional(),
|
|
20838
|
+
/**
|
|
20839
|
+
* @deprecated Compatibility-only bridge for old tenant content nodes and
|
|
20840
|
+
* migration readers. New schema/catalog authoring belongs in ontology;
|
|
20841
|
+
* new system-local settings belong in config. Bridge nodes are keyed by
|
|
20842
|
+
* local NodeId and may still project to content-node:* graph IDs.
|
|
20338
20843
|
*/
|
|
20339
20844
|
content: z.record(z.string().trim().min(1).max(200), ContentNodeSchema).optional(),
|
|
20340
20845
|
/**
|
|
@@ -20344,14 +20849,17 @@ var SystemEntrySchema = z.object({
|
|
|
20344
20849
|
* Per Phase 4: `id` and `parentSystemId` fields will be removed in favour of
|
|
20345
20850
|
* position-derived paths. Both still exist on this schema for backward compat.
|
|
20346
20851
|
*/
|
|
20852
|
+
systems: z.lazy(() => z.record(z.string().trim().min(1).max(100), SystemEntrySchema)).optional(),
|
|
20853
|
+
/** @deprecated Use systems. Accepted as a compatibility alias during the ontology bridge. */
|
|
20347
20854
|
subsystems: z.lazy(() => z.record(z.string().trim().min(1).max(100), SystemEntrySchema)).optional()
|
|
20348
20855
|
}).refine((system) => system.label !== void 0 || system.title !== void 0, {
|
|
20349
20856
|
path: ["label"],
|
|
20350
20857
|
message: "System must provide label or title"
|
|
20351
20858
|
}).transform((system) => {
|
|
20352
|
-
|
|
20859
|
+
const normalizedSystem = system.systems !== void 0 && system.subsystems === void 0 ? { ...system, subsystems: system.systems } : system;
|
|
20860
|
+
if (normalizedSystem.status === void 0) return normalizedSystem;
|
|
20353
20861
|
console.warn("[organization-model] System.status is deprecated; use System.lifecycle instead.");
|
|
20354
|
-
return
|
|
20862
|
+
return normalizedSystem.lifecycle === void 0 ? { ...normalizedSystem, lifecycle: normalizedSystem.status } : normalizedSystem;
|
|
20355
20863
|
});
|
|
20356
20864
|
var SystemsDomainSchema = z.record(z.string(), SystemEntrySchema).refine((record) => Object.entries(record).every(([key, entry]) => entry.id === key), {
|
|
20357
20865
|
message: "Each system entry id must match its map key"
|
|
@@ -20363,6 +20871,7 @@ z.enum(["workflow", "agent", "integration", "script"]).meta({ label: "Resource k
|
|
|
20363
20871
|
var ResourceGovernanceStatusSchema = z.enum(["active", "deprecated", "archived"]).meta({ label: "Governance status", color: "teal" });
|
|
20364
20872
|
var AgentKindSchema = z.enum(["orchestrator", "specialist", "utility", "platform"]).meta({ label: "Agent kind", color: "violet" });
|
|
20365
20873
|
var ScriptResourceLanguageSchema = z.enum(["shell", "sql", "typescript", "python"]).meta({ label: "Language" });
|
|
20874
|
+
var CodeReferenceRoleSchema = z.enum(["entrypoint", "handler", "schema", "test", "docs", "config"]).meta({ label: "Code reference role", color: "blue" });
|
|
20366
20875
|
var ResourceIdSchema = z.string().trim().min(1).max(255).regex(/^[A-Za-z0-9]+(?:[-._][A-Za-z0-9]+)*$/, "Resource IDs must use letters, numbers, -, _, or . separators");
|
|
20367
20876
|
var EventIdSchema = z.string().trim().min(1).max(300).regex(
|
|
20368
20877
|
/^[A-Za-z0-9]+(?:[-._][A-Za-z0-9]+)*:[a-z0-9]+(?:[-._][a-z0-9]+)*$/,
|
|
@@ -20380,6 +20889,28 @@ EventEmissionDescriptorSchema.extend({
|
|
|
20380
20889
|
ownerId: z.union([ResourceIdSchema, ModelIdSchema]),
|
|
20381
20890
|
ownerKind: z.enum(["resource", "entity"]).meta({ label: "Owner kind" })
|
|
20382
20891
|
});
|
|
20892
|
+
var ResourceOntologyBindingSchema = z.object({
|
|
20893
|
+
actions: z.array(OntologyIdSchema).optional(),
|
|
20894
|
+
primaryAction: OntologyIdSchema.optional(),
|
|
20895
|
+
reads: z.array(OntologyIdSchema).optional(),
|
|
20896
|
+
writes: z.array(OntologyIdSchema).optional(),
|
|
20897
|
+
usesCatalogs: z.array(OntologyIdSchema).optional(),
|
|
20898
|
+
emits: z.array(OntologyIdSchema).optional()
|
|
20899
|
+
}).superRefine((binding, ctx) => {
|
|
20900
|
+
if (binding.primaryAction === void 0) return;
|
|
20901
|
+
if (binding.actions?.includes(binding.primaryAction)) return;
|
|
20902
|
+
ctx.addIssue({
|
|
20903
|
+
code: z.ZodIssueCode.custom,
|
|
20904
|
+
path: ["primaryAction"],
|
|
20905
|
+
message: "Resource ontology primaryAction must be included in actions"
|
|
20906
|
+
});
|
|
20907
|
+
});
|
|
20908
|
+
var CodeReferenceSchema = z.object({
|
|
20909
|
+
path: z.string().trim().min(1).max(500).regex(/^[A-Za-z0-9_./$@()[\] -]+$/, "Code reference paths must be repo-relative paths"),
|
|
20910
|
+
role: CodeReferenceRoleSchema,
|
|
20911
|
+
symbol: z.string().trim().min(1).max(200).optional(),
|
|
20912
|
+
description: z.string().trim().min(1).max(300).optional()
|
|
20913
|
+
});
|
|
20383
20914
|
var ResourceEntryBaseSchema = z.object({
|
|
20384
20915
|
/** Canonical resource id; runtime resourceId derives from this value. */
|
|
20385
20916
|
id: ResourceIdSchema,
|
|
@@ -20387,14 +20918,24 @@ var ResourceEntryBaseSchema = z.object({
|
|
|
20387
20918
|
order: z.number().default(0),
|
|
20388
20919
|
/** Required single System membership — value is a dot-separated system path (e.g. "sales.lead-gen"). */
|
|
20389
20920
|
systemPath: SystemPathSchema.meta({ ref: "system" }),
|
|
20921
|
+
/** Executable display title owned by the OM Resource descriptor. */
|
|
20922
|
+
title: LabelSchema.optional(),
|
|
20923
|
+
/** Executable display description owned by the OM Resource descriptor. */
|
|
20924
|
+
description: DescriptionSchema.optional(),
|
|
20390
20925
|
/** Optional role responsible for maintaining this resource. */
|
|
20391
20926
|
ownerRoleId: ModelIdSchema.meta({ ref: "role" }).optional(),
|
|
20392
|
-
status: ResourceGovernanceStatusSchema
|
|
20927
|
+
status: ResourceGovernanceStatusSchema,
|
|
20928
|
+
/**
|
|
20929
|
+
* Ontology contract bindings for the semantic work this resource performs.
|
|
20930
|
+
* `emits` stays nested here so top-level resource emits descriptors remain
|
|
20931
|
+
* compatible with graph event projection during the bridge.
|
|
20932
|
+
*/
|
|
20933
|
+
ontology: ResourceOntologyBindingSchema.optional(),
|
|
20934
|
+
/** Repo-relative implementation breadcrumbs for agents and operators. */
|
|
20935
|
+
codeRefs: z.array(CodeReferenceSchema).default([])
|
|
20393
20936
|
});
|
|
20394
20937
|
var WorkflowResourceEntrySchema = ResourceEntryBaseSchema.extend({
|
|
20395
20938
|
kind: z.literal("workflow"),
|
|
20396
|
-
/** Mirrors WorkflowConfig.actionKey when the runtime workflow has one. */
|
|
20397
|
-
actionKey: z.string().trim().min(1).max(255).optional(),
|
|
20398
20939
|
emits: z.array(EventEmissionDescriptorSchema).optional()
|
|
20399
20940
|
});
|
|
20400
20941
|
var AgentResourceEntrySchema = ResourceEntryBaseSchema.extend({
|
|
@@ -20546,19 +21087,29 @@ var KnowledgeTargetKindSchema = z.enum([
|
|
|
20546
21087
|
"goal",
|
|
20547
21088
|
"customer-segment",
|
|
20548
21089
|
"offering",
|
|
21090
|
+
"ontology",
|
|
20549
21091
|
// D4: content nodes are a valid knowledge target after compound-domain data moved into system.content
|
|
20550
21092
|
"content-node"
|
|
20551
21093
|
]).meta({ label: "Target kind" });
|
|
20552
21094
|
var KnowledgeTargetRefSchema = z.object({
|
|
20553
21095
|
kind: KnowledgeTargetKindSchema,
|
|
20554
|
-
// D4: content-node targets use a qualified id format '<system-path>:<local-content-id>'
|
|
20555
|
-
//
|
|
20556
|
-
//
|
|
20557
|
-
// OrganizationModelSchema.superRefine (knowledgeTargetExists).
|
|
21096
|
+
// D4: content-node targets use a qualified id format '<system-path>:<local-content-id>'.
|
|
21097
|
+
// Ontology targets use the canonical '<scope>:<kind>/<local-id>' ontology id format.
|
|
21098
|
+
// Business-logic validation of target existence is done in OrganizationModelSchema.superRefine.
|
|
20558
21099
|
id: z.string().trim().min(1).max(300)
|
|
21100
|
+
}).superRefine((target, ctx) => {
|
|
21101
|
+
if (target.kind !== "ontology") return;
|
|
21102
|
+
const result = OntologyIdSchema.safeParse(target.id);
|
|
21103
|
+
if (!result.success) {
|
|
21104
|
+
ctx.addIssue({
|
|
21105
|
+
code: z.ZodIssueCode.custom,
|
|
21106
|
+
path: ["id"],
|
|
21107
|
+
message: "Ontology knowledge targets must use <system-path>:<kind>/<local-id> or global:<kind>/<local-id>"
|
|
21108
|
+
});
|
|
21109
|
+
}
|
|
20559
21110
|
});
|
|
20560
21111
|
var LegacyKnowledgeLinkSchema = z.object({
|
|
20561
|
-
nodeId: NodeIdStringSchema
|
|
21112
|
+
nodeId: z.union([NodeIdStringSchema, z.templateLiteral(["ontology:", OntologyIdSchema])])
|
|
20562
21113
|
});
|
|
20563
21114
|
var CanonicalKnowledgeLinkSchema = z.object({
|
|
20564
21115
|
target: KnowledgeTargetRefSchema
|
|
@@ -20589,6 +21140,8 @@ var OrgKnowledgeNodeSchema = z.object({
|
|
|
20589
21140
|
icon: IconNameSchema.optional(),
|
|
20590
21141
|
/** Canonical documentation URL when body content is a local summary. */
|
|
20591
21142
|
externalUrl: z.string().trim().url().max(500).optional(),
|
|
21143
|
+
/** Optional generated source file path for local MDX-backed knowledge nodes. */
|
|
21144
|
+
sourceFilePath: z.string().trim().min(1).max(500).optional(),
|
|
20592
21145
|
/** Raw MDX string. Phase 2 will introduce a structured block format. */
|
|
20593
21146
|
body: z.string().trim().min(1),
|
|
20594
21147
|
/**
|
|
@@ -20602,6 +21155,73 @@ var OrgKnowledgeNodeSchema = z.object({
|
|
|
20602
21155
|
updatedAt: z.string().trim().min(1).max(50)
|
|
20603
21156
|
});
|
|
20604
21157
|
var KnowledgeDomainSchema = z.record(ModelIdSchema, OrgKnowledgeNodeSchema).default({});
|
|
21158
|
+
var SecretLikeMetadataKeySchema = /(?:secret|password|passwd|token|api[-_]?key|credential|private[-_]?key)/i;
|
|
21159
|
+
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-----)/;
|
|
21160
|
+
z.enum([
|
|
21161
|
+
"system",
|
|
21162
|
+
"resource",
|
|
21163
|
+
"ontology",
|
|
21164
|
+
"policy",
|
|
21165
|
+
"role",
|
|
21166
|
+
"trigger",
|
|
21167
|
+
"humanCheckpoint",
|
|
21168
|
+
"externalResource"
|
|
21169
|
+
]);
|
|
21170
|
+
var OmTopologyRelationshipKindSchema = z.enum(["triggers", "uses", "approval"]);
|
|
21171
|
+
var OmTopologyNodeRefSchema = z.discriminatedUnion("kind", [
|
|
21172
|
+
z.object({ kind: z.literal("system"), id: ModelIdSchema }),
|
|
21173
|
+
z.object({ kind: z.literal("resource"), id: ResourceIdSchema }),
|
|
21174
|
+
z.object({ kind: z.literal("ontology"), id: OntologyIdSchema }),
|
|
21175
|
+
z.object({ kind: z.literal("policy"), id: ModelIdSchema }),
|
|
21176
|
+
z.object({ kind: z.literal("role"), id: ModelIdSchema }),
|
|
21177
|
+
z.object({ kind: z.literal("trigger"), id: ResourceIdSchema }),
|
|
21178
|
+
z.object({ kind: z.literal("humanCheckpoint"), id: ResourceIdSchema }),
|
|
21179
|
+
z.object({ kind: z.literal("externalResource"), id: ResourceIdSchema })
|
|
21180
|
+
]);
|
|
21181
|
+
var OmTopologyMetadataSchema = z.record(z.string().trim().min(1).max(120), JsonValueSchema).superRefine((metadata, ctx) => {
|
|
21182
|
+
function visit(value, path) {
|
|
21183
|
+
if (typeof value === "string" && SecretLikeMetadataValueSchema.test(value)) {
|
|
21184
|
+
ctx.addIssue({
|
|
21185
|
+
code: z.ZodIssueCode.custom,
|
|
21186
|
+
path,
|
|
21187
|
+
message: "Topology metadata must not contain secret-like values"
|
|
21188
|
+
});
|
|
21189
|
+
return;
|
|
21190
|
+
}
|
|
21191
|
+
if (Array.isArray(value)) {
|
|
21192
|
+
value.forEach((entry, index2) => visit(entry, [...path, index2]));
|
|
21193
|
+
return;
|
|
21194
|
+
}
|
|
21195
|
+
if (typeof value !== "object" || value === null) return;
|
|
21196
|
+
Object.entries(value).forEach(([key, entry]) => {
|
|
21197
|
+
if (SecretLikeMetadataKeySchema.test(key)) {
|
|
21198
|
+
ctx.addIssue({
|
|
21199
|
+
code: z.ZodIssueCode.custom,
|
|
21200
|
+
path: [...path, key],
|
|
21201
|
+
message: `Topology metadata key "${key}" looks secret-like`
|
|
21202
|
+
});
|
|
21203
|
+
}
|
|
21204
|
+
visit(entry, [...path, key]);
|
|
21205
|
+
});
|
|
21206
|
+
}
|
|
21207
|
+
visit(metadata, []);
|
|
21208
|
+
});
|
|
21209
|
+
var OmTopologyRelationshipSchema = z.object({
|
|
21210
|
+
from: OmTopologyNodeRefSchema,
|
|
21211
|
+
kind: OmTopologyRelationshipKindSchema,
|
|
21212
|
+
to: OmTopologyNodeRefSchema,
|
|
21213
|
+
systemPath: SystemPathSchema.optional(),
|
|
21214
|
+
required: z.boolean().optional(),
|
|
21215
|
+
metadata: OmTopologyMetadataSchema.optional()
|
|
21216
|
+
});
|
|
21217
|
+
var OmTopologyDomainSchema = z.object({
|
|
21218
|
+
version: z.literal(1).default(1),
|
|
21219
|
+
relationships: z.record(z.string().trim().min(1).max(255), OmTopologyRelationshipSchema).default({})
|
|
21220
|
+
}).default({ version: 1, relationships: {} });
|
|
21221
|
+
var DEFAULT_ORGANIZATION_MODEL_TOPOLOGY = {
|
|
21222
|
+
version: 1,
|
|
21223
|
+
relationships: {}
|
|
21224
|
+
};
|
|
20605
21225
|
var PolicyIdSchema = ModelIdSchema;
|
|
20606
21226
|
var PolicyApplicabilitySchema = z.object({
|
|
20607
21227
|
systemIds: z.array(ModelIdSchema.meta({ ref: "system" })).default([]),
|
|
@@ -20689,7 +21309,9 @@ z.enum([
|
|
|
20689
21309
|
"roles",
|
|
20690
21310
|
"goals",
|
|
20691
21311
|
"systems",
|
|
21312
|
+
"ontology",
|
|
20692
21313
|
"resources",
|
|
21314
|
+
"topology",
|
|
20693
21315
|
"actions",
|
|
20694
21316
|
"entities",
|
|
20695
21317
|
"policies",
|
|
@@ -20707,7 +21329,9 @@ var DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA = {
|
|
|
20707
21329
|
roles: { version: 1, lastModified: "2026-05-10" },
|
|
20708
21330
|
goals: { version: 1, lastModified: "2026-05-10" },
|
|
20709
21331
|
systems: { version: 1, lastModified: "2026-05-10" },
|
|
21332
|
+
ontology: { version: 1, lastModified: "2026-05-14" },
|
|
20710
21333
|
resources: { version: 1, lastModified: "2026-05-10" },
|
|
21334
|
+
topology: { version: 1, lastModified: "2026-05-14" },
|
|
20711
21335
|
actions: { version: 1, lastModified: "2026-05-10" },
|
|
20712
21336
|
entities: { version: 1, lastModified: "2026-05-10" },
|
|
20713
21337
|
policies: { version: 1, lastModified: "2026-05-10" },
|
|
@@ -20721,7 +21345,9 @@ var OrganizationModelDomainMetadataByDomainSchema = z.object({
|
|
|
20721
21345
|
roles: OrganizationModelDomainMetadataSchema,
|
|
20722
21346
|
goals: OrganizationModelDomainMetadataSchema,
|
|
20723
21347
|
systems: OrganizationModelDomainMetadataSchema,
|
|
21348
|
+
ontology: OrganizationModelDomainMetadataSchema,
|
|
20724
21349
|
resources: OrganizationModelDomainMetadataSchema,
|
|
21350
|
+
topology: OrganizationModelDomainMetadataSchema,
|
|
20725
21351
|
actions: OrganizationModelDomainMetadataSchema,
|
|
20726
21352
|
entities: OrganizationModelDomainMetadataSchema,
|
|
20727
21353
|
policies: OrganizationModelDomainMetadataSchema,
|
|
@@ -20738,7 +21364,9 @@ var OrganizationModelSchemaBase = z.object({
|
|
|
20738
21364
|
roles: RolesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_ROLES),
|
|
20739
21365
|
goals: GoalsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_GOALS),
|
|
20740
21366
|
systems: SystemsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_SYSTEMS),
|
|
21367
|
+
ontology: OntologyScopeSchema.default(DEFAULT_ONTOLOGY_SCOPE),
|
|
20741
21368
|
resources: ResourcesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_RESOURCES),
|
|
21369
|
+
topology: OmTopologyDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_TOPOLOGY),
|
|
20742
21370
|
actions: ActionsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_ACTIONS),
|
|
20743
21371
|
entities: EntitiesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_ENTITIES),
|
|
20744
21372
|
policies: PoliciesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_POLICIES),
|
|
@@ -20765,13 +21393,16 @@ function asRoleHolderArray(heldBy) {
|
|
|
20765
21393
|
function isKnowledgeKindCompatibleWithTarget(knowledgeKind, targetKind) {
|
|
20766
21394
|
if (knowledgeKind === "reference") return true;
|
|
20767
21395
|
if (knowledgeKind === "playbook") {
|
|
20768
|
-
return ["system", "resource", "stage", "action"].includes(targetKind);
|
|
21396
|
+
return ["system", "resource", "stage", "action", "ontology"].includes(targetKind);
|
|
20769
21397
|
}
|
|
20770
21398
|
if (knowledgeKind === "strategy") {
|
|
20771
|
-
return ["system", "goal", "offering", "customer-segment"].includes(targetKind);
|
|
21399
|
+
return ["system", "goal", "offering", "customer-segment", "ontology"].includes(targetKind);
|
|
20772
21400
|
}
|
|
20773
21401
|
return false;
|
|
20774
21402
|
}
|
|
21403
|
+
function isRecord(value) {
|
|
21404
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
21405
|
+
}
|
|
20775
21406
|
var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ctx) => {
|
|
20776
21407
|
function collectAllSystems(systems, prefix = "", schemaPath = ["systems"]) {
|
|
20777
21408
|
const result = [];
|
|
@@ -20779,8 +21410,11 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
|
|
|
20779
21410
|
const path = prefix ? `${prefix}.${key}` : key;
|
|
20780
21411
|
const currentSchemaPath = [...schemaPath, key];
|
|
20781
21412
|
result.push({ path, schemaPath: currentSchemaPath, system });
|
|
20782
|
-
|
|
20783
|
-
|
|
21413
|
+
const childSystems = system.systems ?? system.subsystems;
|
|
21414
|
+
if (childSystems !== void 0) {
|
|
21415
|
+
result.push(
|
|
21416
|
+
...collectAllSystems(childSystems, path, [...currentSchemaPath, system.systems !== void 0 ? "systems" : "subsystems"])
|
|
21417
|
+
);
|
|
20784
21418
|
}
|
|
20785
21419
|
}
|
|
20786
21420
|
return result;
|
|
@@ -20800,7 +21434,7 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
|
|
|
20800
21434
|
`System "${system.id}" references unknown parent "${system.parentSystemId}"`
|
|
20801
21435
|
);
|
|
20802
21436
|
}
|
|
20803
|
-
const hasChildren = Object.keys(system.subsystems ?? {}).length > 0 || allSystems.some((candidate) => candidate.path.startsWith(`${path}.`) && !candidate.path.slice(path.length + 1).includes("."));
|
|
21437
|
+
const hasChildren = Object.keys(system.systems ?? system.subsystems ?? {}).length > 0 || allSystems.some((candidate) => candidate.path.startsWith(`${path}.`) && !candidate.path.slice(path.length + 1).includes("."));
|
|
20804
21438
|
const contributesRoutePath = system.ui?.path !== void 0 || system.path !== void 0 || !hasChildren;
|
|
20805
21439
|
if (contributesRoutePath) {
|
|
20806
21440
|
const effectivePath = system.ui?.path ?? system.path ?? defaultSystemPathFor(path);
|
|
@@ -20816,7 +21450,7 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
|
|
|
20816
21450
|
}
|
|
20817
21451
|
}
|
|
20818
21452
|
if (hasChildren && isLifecycleEnabled(system.lifecycle, system.enabled)) {
|
|
20819
|
-
const hasEnabledDescendant = Object.values(system.subsystems ?? {}).some(
|
|
21453
|
+
const hasEnabledDescendant = Object.values(system.systems ?? system.subsystems ?? {}).some(
|
|
20820
21454
|
(candidate) => isLifecycleEnabled(candidate.lifecycle, candidate.enabled)
|
|
20821
21455
|
) || allSystems.some(
|
|
20822
21456
|
(candidate) => candidate.path.startsWith(`${path}.`) && !candidate.path.slice(path.length + 1).includes(".") && isLifecycleEnabled(candidate.system.lifecycle, candidate.system.enabled)
|
|
@@ -21061,6 +21695,79 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
|
|
|
21061
21695
|
const stageIds = /* @__PURE__ */ new Set();
|
|
21062
21696
|
const actionIds = new Set(Object.keys(model.actions));
|
|
21063
21697
|
const offeringsById = new Map(Object.entries(model.offerings));
|
|
21698
|
+
const ontologyCompilation = compileOrganizationOntology(model);
|
|
21699
|
+
const ontologyIndexByKind = {
|
|
21700
|
+
object: ontologyCompilation.ontology.objectTypes,
|
|
21701
|
+
link: ontologyCompilation.ontology.linkTypes,
|
|
21702
|
+
action: ontologyCompilation.ontology.actionTypes,
|
|
21703
|
+
catalog: ontologyCompilation.ontology.catalogTypes,
|
|
21704
|
+
event: ontologyCompilation.ontology.eventTypes,
|
|
21705
|
+
interface: ontologyCompilation.ontology.interfaceTypes,
|
|
21706
|
+
"value-type": ontologyCompilation.ontology.valueTypes,
|
|
21707
|
+
property: ontologyCompilation.ontology.sharedProperties,
|
|
21708
|
+
group: ontologyCompilation.ontology.groups,
|
|
21709
|
+
surface: ontologyCompilation.ontology.surfaces
|
|
21710
|
+
};
|
|
21711
|
+
const ontologyIds = new Set(Object.values(ontologyIndexByKind).flatMap((index2) => Object.keys(index2)));
|
|
21712
|
+
function topologyTargetExists(ref) {
|
|
21713
|
+
if (ref.kind === "system") return systemsById.has(ref.id);
|
|
21714
|
+
if (ref.kind === "resource") return resourcesById.has(ref.id);
|
|
21715
|
+
if (ref.kind === "ontology") return ontologyIds.has(ref.id);
|
|
21716
|
+
if (ref.kind === "policy") return policiesById.has(ref.id);
|
|
21717
|
+
if (ref.kind === "role") return rolesById.has(ref.id);
|
|
21718
|
+
return true;
|
|
21719
|
+
}
|
|
21720
|
+
Object.entries(model.topology.relationships).forEach(([relationshipId, relationship]) => {
|
|
21721
|
+
["from", "to"].forEach((side) => {
|
|
21722
|
+
const ref = relationship[side];
|
|
21723
|
+
if (topologyTargetExists(ref)) return;
|
|
21724
|
+
addIssue(
|
|
21725
|
+
ctx,
|
|
21726
|
+
["topology", "relationships", relationshipId, side],
|
|
21727
|
+
`Topology relationship "${relationshipId}" ${side} references unknown ${ref.kind} "${ref.id}"`
|
|
21728
|
+
);
|
|
21729
|
+
});
|
|
21730
|
+
});
|
|
21731
|
+
const ontologyReferenceKeyKinds = {
|
|
21732
|
+
valueType: "value-type",
|
|
21733
|
+
catalogType: "catalog",
|
|
21734
|
+
objectType: "object",
|
|
21735
|
+
eventType: "event",
|
|
21736
|
+
actionType: "action",
|
|
21737
|
+
linkType: "link",
|
|
21738
|
+
interfaceType: "interface",
|
|
21739
|
+
propertyType: "property",
|
|
21740
|
+
groupType: "group",
|
|
21741
|
+
surfaceType: "surface",
|
|
21742
|
+
stepCatalog: "catalog"
|
|
21743
|
+
};
|
|
21744
|
+
function validateKnownOntologyReferences(ownerId, value, path, seen = /* @__PURE__ */ new WeakSet()) {
|
|
21745
|
+
if (Array.isArray(value)) {
|
|
21746
|
+
value.forEach((entry, index2) => validateKnownOntologyReferences(ownerId, entry, [...path, index2], seen));
|
|
21747
|
+
return;
|
|
21748
|
+
}
|
|
21749
|
+
if (!isRecord(value)) return;
|
|
21750
|
+
if (seen.has(value)) return;
|
|
21751
|
+
seen.add(value);
|
|
21752
|
+
Object.entries(value).forEach(([key, entry]) => {
|
|
21753
|
+
const expectedKind = ontologyReferenceKeyKinds[key];
|
|
21754
|
+
if (expectedKind !== void 0) {
|
|
21755
|
+
if (typeof entry !== "string") {
|
|
21756
|
+
addIssue(ctx, [...path, key], `Ontology record "${ownerId}" ${key} must be an ontology ID string`);
|
|
21757
|
+
} else if (ontologyIndexByKind[expectedKind][entry] === void 0) {
|
|
21758
|
+
addIssue(
|
|
21759
|
+
ctx,
|
|
21760
|
+
[...path, key],
|
|
21761
|
+
`Ontology record "${ownerId}" ${key} references unknown ${expectedKind} ontology ID "${entry}"`
|
|
21762
|
+
);
|
|
21763
|
+
}
|
|
21764
|
+
}
|
|
21765
|
+
validateKnownOntologyReferences(ownerId, entry, [...path, key], seen);
|
|
21766
|
+
});
|
|
21767
|
+
}
|
|
21768
|
+
for (const { id, record } of listResolvedOntologyRecords(ontologyCompilation.ontology)) {
|
|
21769
|
+
validateKnownOntologyReferences(id, record, record.origin.path);
|
|
21770
|
+
}
|
|
21064
21771
|
Object.values(model.policies).forEach((policy) => {
|
|
21065
21772
|
policy.appliesTo.systemIds.forEach((systemId, systemIndex) => {
|
|
21066
21773
|
if (!systemsById.has(systemId)) {
|
|
@@ -21114,6 +21821,7 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
|
|
|
21114
21821
|
if (kind === "goal") return goalsById.has(id);
|
|
21115
21822
|
if (kind === "customer-segment") return segmentsById.has(id);
|
|
21116
21823
|
if (kind === "offering") return offeringsById.has(id);
|
|
21824
|
+
if (kind === "ontology") return ontologyIds.has(id);
|
|
21117
21825
|
return false;
|
|
21118
21826
|
}
|
|
21119
21827
|
Object.entries(model.knowledge).forEach(([nodeId, node]) => {
|
|
@@ -21157,6 +21865,34 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
|
|
|
21157
21865
|
);
|
|
21158
21866
|
}
|
|
21159
21867
|
});
|
|
21868
|
+
function validateResourceOntologyBinding(resourceId, bindingKey, expectedKind, ids) {
|
|
21869
|
+
const ontologyIds2 = ids === void 0 ? [] : Array.isArray(ids) ? ids : [ids];
|
|
21870
|
+
ontologyIds2.forEach((ontologyId, ontologyIndex) => {
|
|
21871
|
+
if (ontologyIndexByKind[expectedKind][ontologyId] === void 0) {
|
|
21872
|
+
addIssue(
|
|
21873
|
+
ctx,
|
|
21874
|
+
[
|
|
21875
|
+
"resources",
|
|
21876
|
+
resourceId,
|
|
21877
|
+
"ontology",
|
|
21878
|
+
bindingKey,
|
|
21879
|
+
...Array.isArray(ids) ? [ontologyIndex] : []
|
|
21880
|
+
],
|
|
21881
|
+
`Resource "${resourceId}" ontology binding "${bindingKey}" references unknown ${expectedKind} ontology ID "${ontologyId}"`
|
|
21882
|
+
);
|
|
21883
|
+
}
|
|
21884
|
+
});
|
|
21885
|
+
}
|
|
21886
|
+
Object.values(model.resources).forEach((resource) => {
|
|
21887
|
+
const binding = resource.ontology;
|
|
21888
|
+
if (binding === void 0) return;
|
|
21889
|
+
validateResourceOntologyBinding(resource.id, "actions", "action", binding.actions);
|
|
21890
|
+
validateResourceOntologyBinding(resource.id, "primaryAction", "action", binding.primaryAction);
|
|
21891
|
+
validateResourceOntologyBinding(resource.id, "reads", "object", binding.reads);
|
|
21892
|
+
validateResourceOntologyBinding(resource.id, "writes", "object", binding.writes);
|
|
21893
|
+
validateResourceOntologyBinding(resource.id, "usesCatalogs", "catalog", binding.usesCatalogs);
|
|
21894
|
+
validateResourceOntologyBinding(resource.id, "emits", "event", binding.emits);
|
|
21895
|
+
});
|
|
21160
21896
|
Object.values(model.roles).forEach((role) => {
|
|
21161
21897
|
if (role.heldBy === void 0) return;
|
|
21162
21898
|
asRoleHolderArray(role.heldBy).forEach((holder, holderIndex) => {
|
|
@@ -21191,11 +21927,13 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
|
|
|
21191
21927
|
});
|
|
21192
21928
|
});
|
|
21193
21929
|
function validateSystemContent(system, systemPath) {
|
|
21930
|
+
const childSystems = system.systems ?? system.subsystems;
|
|
21931
|
+
const childKey = system.systems !== void 0 ? "systems" : "subsystems";
|
|
21194
21932
|
const content = system.content;
|
|
21195
21933
|
if (content === void 0 || Object.keys(content).length === 0) {
|
|
21196
|
-
if (
|
|
21197
|
-
Object.entries(
|
|
21198
|
-
validateSystemContent(child, [...systemPath,
|
|
21934
|
+
if (childSystems !== void 0) {
|
|
21935
|
+
Object.entries(childSystems).forEach(([childLocalId, child]) => {
|
|
21936
|
+
validateSystemContent(child, [...systemPath, childKey, childLocalId]);
|
|
21199
21937
|
});
|
|
21200
21938
|
}
|
|
21201
21939
|
return;
|
|
@@ -21251,15 +21989,18 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
|
|
|
21251
21989
|
}
|
|
21252
21990
|
}
|
|
21253
21991
|
});
|
|
21254
|
-
if (
|
|
21255
|
-
Object.entries(
|
|
21256
|
-
validateSystemContent(child, [...systemPath,
|
|
21992
|
+
if (childSystems !== void 0) {
|
|
21993
|
+
Object.entries(childSystems).forEach(([childLocalId, child]) => {
|
|
21994
|
+
validateSystemContent(child, [...systemPath, childKey, childLocalId]);
|
|
21257
21995
|
});
|
|
21258
21996
|
}
|
|
21259
21997
|
}
|
|
21260
21998
|
Object.entries(model.systems).forEach(([systemKey, system]) => {
|
|
21261
21999
|
validateSystemContent(system, ["systems", systemKey]);
|
|
21262
22000
|
});
|
|
22001
|
+
for (const diagnostic of ontologyCompilation.diagnostics) {
|
|
22002
|
+
addIssue(ctx, diagnostic.path, diagnostic.message);
|
|
22003
|
+
}
|
|
21263
22004
|
});
|
|
21264
22005
|
|
|
21265
22006
|
// src/organization-model/defaults.ts
|
|
@@ -21273,14 +22014,14 @@ var DEFAULT_ORGANIZATION_MODEL_NAVIGATION = {
|
|
|
21273
22014
|
label: "Dashboard",
|
|
21274
22015
|
path: "/",
|
|
21275
22016
|
surfaceType: "dashboard",
|
|
21276
|
-
icon: "
|
|
22017
|
+
icon: "dashboard",
|
|
21277
22018
|
order: 10,
|
|
21278
22019
|
targets: { systems: ["dashboard"] }
|
|
21279
22020
|
},
|
|
21280
22021
|
business: {
|
|
21281
22022
|
type: "group",
|
|
21282
22023
|
label: "Business",
|
|
21283
|
-
icon: "
|
|
22024
|
+
icon: "business",
|
|
21284
22025
|
order: 20,
|
|
21285
22026
|
children: {
|
|
21286
22027
|
sales: {
|
|
@@ -21288,7 +22029,7 @@ var DEFAULT_ORGANIZATION_MODEL_NAVIGATION = {
|
|
|
21288
22029
|
label: "Sales",
|
|
21289
22030
|
path: "/sales",
|
|
21290
22031
|
surfaceType: "page",
|
|
21291
|
-
icon: "
|
|
22032
|
+
icon: "sales",
|
|
21292
22033
|
order: 10,
|
|
21293
22034
|
targets: { systems: ["sales"] }
|
|
21294
22035
|
},
|
|
@@ -21297,7 +22038,7 @@ var DEFAULT_ORGANIZATION_MODEL_NAVIGATION = {
|
|
|
21297
22038
|
label: "Clients",
|
|
21298
22039
|
path: "/clients",
|
|
21299
22040
|
surfaceType: "list",
|
|
21300
|
-
icon: "
|
|
22041
|
+
icon: "projects",
|
|
21301
22042
|
order: 20,
|
|
21302
22043
|
targets: { systems: ["clients"] }
|
|
21303
22044
|
},
|
|
@@ -21306,7 +22047,7 @@ var DEFAULT_ORGANIZATION_MODEL_NAVIGATION = {
|
|
|
21306
22047
|
label: "Projects",
|
|
21307
22048
|
path: "/projects",
|
|
21308
22049
|
surfaceType: "page",
|
|
21309
|
-
icon: "
|
|
22050
|
+
icon: "projects",
|
|
21310
22051
|
order: 30,
|
|
21311
22052
|
targets: { systems: ["projects"] }
|
|
21312
22053
|
}
|
|
@@ -21315,7 +22056,7 @@ var DEFAULT_ORGANIZATION_MODEL_NAVIGATION = {
|
|
|
21315
22056
|
operations: {
|
|
21316
22057
|
type: "group",
|
|
21317
22058
|
label: "Operations",
|
|
21318
|
-
icon: "
|
|
22059
|
+
icon: "operations",
|
|
21319
22060
|
order: 30,
|
|
21320
22061
|
children: {
|
|
21321
22062
|
"operations-overview": {
|
|
@@ -21363,7 +22104,7 @@ var DEFAULT_ORGANIZATION_MODEL_NAVIGATION = {
|
|
|
21363
22104
|
monitoring: {
|
|
21364
22105
|
type: "group",
|
|
21365
22106
|
label: "Monitoring",
|
|
21366
|
-
icon: "
|
|
22107
|
+
icon: "monitoring",
|
|
21367
22108
|
order: 40,
|
|
21368
22109
|
children: {
|
|
21369
22110
|
"monitoring-overview": {
|
|
@@ -21425,36 +22166,19 @@ var DEFAULT_ORGANIZATION_MODEL_NAVIGATION = {
|
|
|
21425
22166
|
}
|
|
21426
22167
|
},
|
|
21427
22168
|
knowledge: {
|
|
21428
|
-
type: "
|
|
21429
|
-
label: "Knowledge",
|
|
21430
|
-
|
|
21431
|
-
|
|
21432
|
-
|
|
21433
|
-
|
|
21434
|
-
type: "surface",
|
|
21435
|
-
label: "Knowledge Base",
|
|
21436
|
-
path: "/knowledge",
|
|
21437
|
-
surfaceType: "page",
|
|
21438
|
-
order: 10,
|
|
21439
|
-
targets: { systems: ["knowledge.base"] }
|
|
21440
|
-
},
|
|
21441
|
-
"knowledge-command-view": {
|
|
21442
|
-
type: "surface",
|
|
21443
|
-
label: "Command View",
|
|
21444
|
-
path: "/knowledge/command-view",
|
|
21445
|
-
surfaceType: "graph",
|
|
21446
|
-
order: 20,
|
|
21447
|
-
targets: { systems: ["knowledge.command-view"] },
|
|
21448
|
-
devOnly: true
|
|
21449
|
-
}
|
|
21450
|
-
}
|
|
22169
|
+
type: "surface",
|
|
22170
|
+
label: "Knowledge Base",
|
|
22171
|
+
path: "/knowledge",
|
|
22172
|
+
surfaceType: "page",
|
|
22173
|
+
icon: "knowledge",
|
|
22174
|
+
order: 50
|
|
21451
22175
|
}
|
|
21452
22176
|
},
|
|
21453
22177
|
bottom: {
|
|
21454
22178
|
settings: {
|
|
21455
22179
|
type: "group",
|
|
21456
22180
|
label: "Settings",
|
|
21457
|
-
icon: "
|
|
22181
|
+
icon: "settings",
|
|
21458
22182
|
order: 10,
|
|
21459
22183
|
children: {
|
|
21460
22184
|
"settings-account": {
|
|
@@ -21526,7 +22250,7 @@ var DEFAULT_ORGANIZATION_MODEL_NAVIGATION = {
|
|
|
21526
22250
|
admin: {
|
|
21527
22251
|
type: "group",
|
|
21528
22252
|
label: "Admin",
|
|
21529
|
-
icon: "
|
|
22253
|
+
icon: "admin",
|
|
21530
22254
|
order: 20,
|
|
21531
22255
|
children: {
|
|
21532
22256
|
"admin-dashboard": {
|
|
@@ -21606,7 +22330,7 @@ var DEFAULT_ORGANIZATION_MODEL = {
|
|
|
21606
22330
|
enabled: true,
|
|
21607
22331
|
lifecycle: "active",
|
|
21608
22332
|
path: "/",
|
|
21609
|
-
icon: "
|
|
22333
|
+
icon: "dashboard"
|
|
21610
22334
|
},
|
|
21611
22335
|
platform: {
|
|
21612
22336
|
id: "platform",
|
|
@@ -21616,7 +22340,7 @@ var DEFAULT_ORGANIZATION_MODEL = {
|
|
|
21616
22340
|
enabled: true,
|
|
21617
22341
|
lifecycle: "active",
|
|
21618
22342
|
color: "cyan",
|
|
21619
|
-
icon: "
|
|
22343
|
+
icon: "platform"
|
|
21620
22344
|
},
|
|
21621
22345
|
finance: {
|
|
21622
22346
|
id: "finance",
|
|
@@ -21626,7 +22350,7 @@ var DEFAULT_ORGANIZATION_MODEL = {
|
|
|
21626
22350
|
enabled: true,
|
|
21627
22351
|
lifecycle: "active",
|
|
21628
22352
|
color: "green",
|
|
21629
|
-
icon: "
|
|
22353
|
+
icon: "finance"
|
|
21630
22354
|
},
|
|
21631
22355
|
sales: {
|
|
21632
22356
|
id: "sales",
|
|
@@ -21636,7 +22360,7 @@ var DEFAULT_ORGANIZATION_MODEL = {
|
|
|
21636
22360
|
enabled: true,
|
|
21637
22361
|
lifecycle: "active",
|
|
21638
22362
|
color: "blue",
|
|
21639
|
-
icon: "
|
|
22363
|
+
icon: "sales",
|
|
21640
22364
|
path: "/sales"
|
|
21641
22365
|
},
|
|
21642
22366
|
"sales.crm": {
|
|
@@ -21646,8 +22370,12 @@ var DEFAULT_ORGANIZATION_MODEL = {
|
|
|
21646
22370
|
description: "Relationship pipeline and deal management",
|
|
21647
22371
|
enabled: true,
|
|
21648
22372
|
lifecycle: "active",
|
|
22373
|
+
actions: Object.values(CRM_ACTION_ENTRIES).map((action) => ({
|
|
22374
|
+
actionId: action.id,
|
|
22375
|
+
intent: "exposes"
|
|
22376
|
+
})),
|
|
21649
22377
|
color: "blue",
|
|
21650
|
-
icon: "
|
|
22378
|
+
icon: "crm",
|
|
21651
22379
|
path: "/crm"
|
|
21652
22380
|
},
|
|
21653
22381
|
"sales.lead-gen": {
|
|
@@ -21657,12 +22385,12 @@ var DEFAULT_ORGANIZATION_MODEL = {
|
|
|
21657
22385
|
description: "Prospecting, qualification, and outreach preparation",
|
|
21658
22386
|
enabled: true,
|
|
21659
22387
|
lifecycle: "active",
|
|
21660
|
-
actions: Object.values(
|
|
22388
|
+
actions: Object.values(LEAD_GEN_ACTION_ENTRIES).map((action) => ({
|
|
21661
22389
|
actionId: action.id,
|
|
21662
22390
|
intent: "exposes"
|
|
21663
22391
|
})),
|
|
21664
22392
|
color: "cyan",
|
|
21665
|
-
icon: "
|
|
22393
|
+
icon: "lead-gen",
|
|
21666
22394
|
path: "/lead-gen"
|
|
21667
22395
|
},
|
|
21668
22396
|
projects: {
|
|
@@ -21673,7 +22401,7 @@ var DEFAULT_ORGANIZATION_MODEL = {
|
|
|
21673
22401
|
enabled: true,
|
|
21674
22402
|
lifecycle: "active",
|
|
21675
22403
|
color: "orange",
|
|
21676
|
-
icon: "
|
|
22404
|
+
icon: "projects",
|
|
21677
22405
|
path: "/projects"
|
|
21678
22406
|
},
|
|
21679
22407
|
clients: {
|
|
@@ -21684,7 +22412,7 @@ var DEFAULT_ORGANIZATION_MODEL = {
|
|
|
21684
22412
|
enabled: true,
|
|
21685
22413
|
lifecycle: "active",
|
|
21686
22414
|
color: "orange",
|
|
21687
|
-
icon: "
|
|
22415
|
+
icon: "projects",
|
|
21688
22416
|
path: "/clients"
|
|
21689
22417
|
},
|
|
21690
22418
|
operations: {
|
|
@@ -21695,7 +22423,7 @@ var DEFAULT_ORGANIZATION_MODEL = {
|
|
|
21695
22423
|
enabled: true,
|
|
21696
22424
|
lifecycle: "active",
|
|
21697
22425
|
color: "violet",
|
|
21698
|
-
icon: "
|
|
22426
|
+
icon: "operations"
|
|
21699
22427
|
},
|
|
21700
22428
|
"knowledge.command-view": {
|
|
21701
22429
|
id: "knowledge.command-view",
|
|
@@ -21761,7 +22489,7 @@ var DEFAULT_ORGANIZATION_MODEL = {
|
|
|
21761
22489
|
enabled: true,
|
|
21762
22490
|
lifecycle: "active",
|
|
21763
22491
|
path: "/monitoring/calendar",
|
|
21764
|
-
icon: "
|
|
22492
|
+
icon: "calendar"
|
|
21765
22493
|
},
|
|
21766
22494
|
"monitoring.activity-log": {
|
|
21767
22495
|
id: "monitoring.activity-log",
|
|
@@ -21817,7 +22545,7 @@ var DEFAULT_ORGANIZATION_MODEL = {
|
|
|
21817
22545
|
label: "Settings",
|
|
21818
22546
|
enabled: true,
|
|
21819
22547
|
lifecycle: "active",
|
|
21820
|
-
icon: "
|
|
22548
|
+
icon: "settings"
|
|
21821
22549
|
},
|
|
21822
22550
|
"settings.account": {
|
|
21823
22551
|
id: "settings.account",
|
|
@@ -21890,7 +22618,7 @@ var DEFAULT_ORGANIZATION_MODEL = {
|
|
|
21890
22618
|
enabled: true,
|
|
21891
22619
|
lifecycle: "active",
|
|
21892
22620
|
path: "/admin",
|
|
21893
|
-
icon: "
|
|
22621
|
+
icon: "admin",
|
|
21894
22622
|
requiresAdmin: true
|
|
21895
22623
|
},
|
|
21896
22624
|
"admin.system-health": {
|
|
@@ -21940,7 +22668,7 @@ var DEFAULT_ORGANIZATION_MODEL = {
|
|
|
21940
22668
|
enabled: true,
|
|
21941
22669
|
lifecycle: "active",
|
|
21942
22670
|
path: "/archive",
|
|
21943
|
-
icon: "
|
|
22671
|
+
icon: "archive",
|
|
21944
22672
|
devOnly: true
|
|
21945
22673
|
},
|
|
21946
22674
|
"archive.agent-chat": {
|
|
@@ -21975,7 +22703,7 @@ var DEFAULT_ORGANIZATION_MODEL = {
|
|
|
21975
22703
|
enabled: true,
|
|
21976
22704
|
lifecycle: "active",
|
|
21977
22705
|
color: "teal",
|
|
21978
|
-
icon: "
|
|
22706
|
+
icon: "knowledge"
|
|
21979
22707
|
},
|
|
21980
22708
|
"knowledge.base": {
|
|
21981
22709
|
id: "knowledge.base",
|
|
@@ -21986,11 +22714,14 @@ var DEFAULT_ORGANIZATION_MODEL = {
|
|
|
21986
22714
|
path: "/knowledge"
|
|
21987
22715
|
}
|
|
21988
22716
|
},
|
|
22717
|
+
ontology: DEFAULT_ONTOLOGY_SCOPE,
|
|
21989
22718
|
resources: DEFAULT_ORGANIZATION_MODEL_RESOURCES,
|
|
22719
|
+
topology: DEFAULT_ORGANIZATION_MODEL_TOPOLOGY,
|
|
21990
22720
|
actions: DEFAULT_ORGANIZATION_MODEL_ACTIONS,
|
|
21991
22721
|
entities: DEFAULT_ORGANIZATION_MODEL_ENTITIES2,
|
|
21992
22722
|
policies: DEFAULT_ORGANIZATION_MODEL_POLICIES,
|
|
21993
|
-
// Phase 4 (D1): statuses top-level field removed; status
|
|
22723
|
+
// Phase 4 (D1): statuses top-level field removed; bridge status mirrors may
|
|
22724
|
+
// still project from System.content, but primary authoring belongs in ontology.
|
|
21994
22725
|
knowledge: DEFAULT_ORGANIZATION_MODEL_KNOWLEDGE
|
|
21995
22726
|
};
|
|
21996
22727
|
|
|
@@ -21998,6 +22729,31 @@ var DEFAULT_ORGANIZATION_MODEL = {
|
|
|
21998
22729
|
function isPlainObject(value) {
|
|
21999
22730
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
22000
22731
|
}
|
|
22732
|
+
function collectNestedSystemPaths(systems, prefix = "") {
|
|
22733
|
+
const paths = /* @__PURE__ */ new Set();
|
|
22734
|
+
for (const [key, value] of Object.entries(systems)) {
|
|
22735
|
+
if (!isPlainObject(value)) continue;
|
|
22736
|
+
const path = prefix ? `${prefix}.${key}` : key;
|
|
22737
|
+
for (const childKey of ["systems", "subsystems"]) {
|
|
22738
|
+
const childSystems = value[childKey];
|
|
22739
|
+
if (!isPlainObject(childSystems)) continue;
|
|
22740
|
+
for (const childPath of collectNestedSystemPaths(childSystems, path)) {
|
|
22741
|
+
paths.add(childPath);
|
|
22742
|
+
}
|
|
22743
|
+
}
|
|
22744
|
+
if (prefix !== "") {
|
|
22745
|
+
paths.add(path);
|
|
22746
|
+
}
|
|
22747
|
+
}
|
|
22748
|
+
return paths;
|
|
22749
|
+
}
|
|
22750
|
+
function pruneFlatSystemDescendantCollisions(base, override) {
|
|
22751
|
+
const result = { ...base };
|
|
22752
|
+
for (const nestedPath of collectNestedSystemPaths(override)) {
|
|
22753
|
+
delete result[nestedPath];
|
|
22754
|
+
}
|
|
22755
|
+
return result;
|
|
22756
|
+
}
|
|
22001
22757
|
function deepMerge2(base, override) {
|
|
22002
22758
|
if (override === void 0) {
|
|
22003
22759
|
return base;
|
|
@@ -22012,12 +22768,16 @@ function deepMerge2(base, override) {
|
|
|
22012
22768
|
for (const [key, value] of Object.entries(override)) {
|
|
22013
22769
|
if (value === void 0) continue;
|
|
22014
22770
|
const existing = result[key];
|
|
22771
|
+
if (key === "systems" && isPlainObject(existing) && isPlainObject(value)) {
|
|
22772
|
+
result[key] = deepMerge2(pruneFlatSystemDescendantCollisions(existing, value), value);
|
|
22773
|
+
continue;
|
|
22774
|
+
}
|
|
22015
22775
|
result[key] = isPlainObject(existing) && isPlainObject(value) ? deepMerge2(existing, value) : value;
|
|
22016
22776
|
}
|
|
22017
22777
|
return result;
|
|
22018
22778
|
}
|
|
22019
|
-
function resolveOrganizationModel(override,
|
|
22020
|
-
const merged = deepMerge2(DEFAULT_ORGANIZATION_MODEL, override);
|
|
22779
|
+
function resolveOrganizationModel(override, organizationIdOrOptions, options) {
|
|
22780
|
+
const merged = deepMerge2(DEFAULT_ORGANIZATION_MODEL, override) ;
|
|
22021
22781
|
return OrganizationModelSchema.parse(merged);
|
|
22022
22782
|
}
|
|
22023
22783
|
|