@elevasis/sdk 1.23.0 → 1.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/cli.cjs +5927 -6985
- package/dist/index.d.ts +4893 -4759
- package/dist/index.js +1444 -3870
- package/dist/node/index.d.ts +3059 -2
- package/dist/node/index.js +163 -1
- package/dist/test-utils/index.d.ts +4413 -4439
- package/dist/test-utils/index.js +1766 -4753
- package/dist/types/worker/index.d.ts +5 -2
- package/dist/types/worker/platform.d.ts +2 -2
- package/dist/types/worker/utils.d.ts +9 -0
- package/dist/worker/index.js +427 -3708
- package/package.json +5 -4
- package/reference/_navigation.md +1 -0
- package/reference/claude-config/rules/active-change-index.md +11 -80
- package/reference/claude-config/rules/agent-start-here.md +11 -277
- package/reference/claude-config/rules/deployment.md +11 -57
- package/reference/claude-config/rules/error-handling.md +11 -56
- package/reference/claude-config/rules/execution.md +11 -40
- package/reference/claude-config/rules/frontend.md +11 -43
- package/reference/claude-config/rules/observability.md +11 -31
- package/reference/claude-config/rules/operations.md +11 -80
- package/reference/claude-config/rules/organization-model.md +5 -110
- package/reference/claude-config/rules/organization-os.md +7 -111
- package/reference/claude-config/rules/package-taxonomy.md +11 -33
- package/reference/claude-config/rules/platform.md +11 -42
- package/reference/claude-config/rules/shared-types.md +10 -48
- package/reference/claude-config/rules/task-tracking.md +11 -47
- package/reference/claude-config/rules/ui.md +11 -200
- package/reference/claude-config/rules/vibe.md +5 -229
- package/reference/claude-config/sync-notes/2026-05-04-knowledge-bundle.md +83 -83
- package/reference/claude-config/sync-notes/2026-05-15-om-skill-rename-and-write-family.md +2 -2
- package/reference/claude-config/sync-notes/2026-05-17-sdk-boundary-consolidation.md +33 -0
- package/reference/cli.mdx +1107 -808
- package/reference/rules/active-change-index.md +83 -0
- package/reference/rules/agent-start-here.md +280 -0
- package/reference/rules/deployment.md +60 -0
- package/reference/rules/error-handling.md +59 -0
- package/reference/rules/execution.md +43 -0
- package/reference/rules/frontend.md +46 -0
- package/reference/rules/observability.md +34 -0
- package/reference/rules/operations.md +85 -0
- package/reference/rules/organization-model.md +119 -0
- package/reference/rules/organization-os.md +118 -0
- package/reference/rules/package-taxonomy.md +36 -0
- package/reference/rules/platform.md +45 -0
- package/reference/rules/shared-types.md +52 -0
- package/reference/rules/task-tracking.md +50 -0
- package/reference/rules/ui.md +203 -0
- package/reference/rules/vibe.md +238 -0
- package/reference/scaffold/core/organization-graph.mdx +4 -5
- package/reference/scaffold/core/organization-model.mdx +1 -1
- package/reference/scaffold/recipes/customize-crm-actions.md +45 -46
- package/reference/scaffold/recipes/extend-crm.md +253 -255
- package/reference/scaffold/recipes/index.md +43 -44
- package/reference/scaffold/reference/contracts.md +990 -1065
package/dist/worker/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { workerData, parentPort } from 'worker_threads';
|
|
2
2
|
import { z, ZodError } from 'zod';
|
|
3
|
+
import { createHmac } from 'crypto';
|
|
3
4
|
|
|
4
5
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
5
6
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
@@ -2059,6 +2060,12 @@ var zodToJsonSchema = (schema, options) => {
|
|
|
2059
2060
|
}
|
|
2060
2061
|
return combined;
|
|
2061
2062
|
};
|
|
2063
|
+
|
|
2064
|
+
// ../core/src/execution/engine/workflow/types.ts
|
|
2065
|
+
var StepType = {
|
|
2066
|
+
LINEAR: "linear",
|
|
2067
|
+
CONDITIONAL: "conditional"
|
|
2068
|
+
};
|
|
2062
2069
|
function errorToString(error) {
|
|
2063
2070
|
if (error instanceof ZodError) {
|
|
2064
2071
|
return JSON.stringify(error.issues, null, 2);
|
|
@@ -2080,6 +2087,26 @@ function getErrorDetails(error) {
|
|
|
2080
2087
|
return details;
|
|
2081
2088
|
}
|
|
2082
2089
|
|
|
2090
|
+
// ../core/src/execution/engine/workflow/log-truncate.ts
|
|
2091
|
+
var LOG_STRING_TRUNCATE_LIMIT = 200;
|
|
2092
|
+
function truncateForLogging(value) {
|
|
2093
|
+
if (value === null || value === void 0) return value;
|
|
2094
|
+
if (typeof value === "string") {
|
|
2095
|
+
return value.length > LOG_STRING_TRUNCATE_LIMIT ? value.slice(0, LOG_STRING_TRUNCATE_LIMIT) + `\u2026 [${value.length} chars]` : value;
|
|
2096
|
+
}
|
|
2097
|
+
if (Array.isArray(value)) {
|
|
2098
|
+
return value.map(truncateForLogging);
|
|
2099
|
+
}
|
|
2100
|
+
if (typeof value === "object") {
|
|
2101
|
+
const result = {};
|
|
2102
|
+
for (const [k, v] of Object.entries(value)) {
|
|
2103
|
+
result[k] = truncateForLogging(v);
|
|
2104
|
+
}
|
|
2105
|
+
return result;
|
|
2106
|
+
}
|
|
2107
|
+
return value;
|
|
2108
|
+
}
|
|
2109
|
+
|
|
2083
2110
|
// ../core/src/execution/engine/base/errors.ts
|
|
2084
2111
|
var ExecutionError = class extends Error {
|
|
2085
2112
|
/**
|
|
@@ -2120,6 +2147,305 @@ var ExecutionError = class extends Error {
|
|
|
2120
2147
|
}
|
|
2121
2148
|
};
|
|
2122
2149
|
|
|
2150
|
+
// ../core/src/execution/engine/workflow/errors.ts
|
|
2151
|
+
var WorkflowStepError = class extends ExecutionError {
|
|
2152
|
+
type = "workflow_step_error";
|
|
2153
|
+
severity = "critical";
|
|
2154
|
+
category = "workflow";
|
|
2155
|
+
constructor(message, context) {
|
|
2156
|
+
super(message, context);
|
|
2157
|
+
}
|
|
2158
|
+
};
|
|
2159
|
+
var WorkflowValidationError = class extends ExecutionError {
|
|
2160
|
+
type = "workflow_validation_error";
|
|
2161
|
+
severity = "info";
|
|
2162
|
+
category = "validation";
|
|
2163
|
+
constructor(message, context) {
|
|
2164
|
+
super(message, context);
|
|
2165
|
+
}
|
|
2166
|
+
};
|
|
2167
|
+
|
|
2168
|
+
// ../core/src/execution/engine/workflow/utils.ts
|
|
2169
|
+
function validateEntryPoint(steps, entryPoint) {
|
|
2170
|
+
if (!(entryPoint in steps)) {
|
|
2171
|
+
throw new WorkflowValidationError(`Entry point step '${entryPoint}' not found in workflow`, {
|
|
2172
|
+
entryPoint
|
|
2173
|
+
});
|
|
2174
|
+
}
|
|
2175
|
+
}
|
|
2176
|
+
function findTerminalSteps(steps) {
|
|
2177
|
+
return Object.values(steps).filter((step) => step.next === null);
|
|
2178
|
+
}
|
|
2179
|
+
function validateTerminalSteps(steps, workflowId) {
|
|
2180
|
+
const terminalSteps = findTerminalSteps(steps);
|
|
2181
|
+
if (terminalSteps.length === 0) {
|
|
2182
|
+
throw new WorkflowValidationError(`Workflow '${workflowId}' must have at least one terminal step (next: null)`, {
|
|
2183
|
+
workflowId
|
|
2184
|
+
});
|
|
2185
|
+
}
|
|
2186
|
+
}
|
|
2187
|
+
function validateStepReferences(steps) {
|
|
2188
|
+
for (const [id, step] of Object.entries(steps)) {
|
|
2189
|
+
if (step.next === null) {
|
|
2190
|
+
continue;
|
|
2191
|
+
}
|
|
2192
|
+
if (step.next.type === StepType.LINEAR) {
|
|
2193
|
+
if (!(step.next.target in steps)) {
|
|
2194
|
+
throw new WorkflowValidationError(`Step '${id}' references non-existent target '${step.next.target}'`, {
|
|
2195
|
+
stepId: id,
|
|
2196
|
+
target: step.next.target
|
|
2197
|
+
});
|
|
2198
|
+
}
|
|
2199
|
+
} else if (step.next.type === StepType.CONDITIONAL) {
|
|
2200
|
+
const targets = [...step.next.routes.map((r) => r.target), step.next.default];
|
|
2201
|
+
for (const target of targets) {
|
|
2202
|
+
if (!(target in steps)) {
|
|
2203
|
+
throw new WorkflowValidationError(`Step '${id}' references non-existent target '${target}'`, {
|
|
2204
|
+
stepId: id,
|
|
2205
|
+
target
|
|
2206
|
+
});
|
|
2207
|
+
}
|
|
2208
|
+
}
|
|
2209
|
+
}
|
|
2210
|
+
}
|
|
2211
|
+
}
|
|
2212
|
+
function detectCycle(visited, executionPath, currentStepId) {
|
|
2213
|
+
if (visited.has(currentStepId)) {
|
|
2214
|
+
const cycle = executionPath.slice(executionPath.indexOf(currentStepId));
|
|
2215
|
+
throw new WorkflowStepError(`Cycle detected in workflow: ${cycle.join(" -> ")} -> ${currentStepId}`, {
|
|
2216
|
+
stepId: currentStepId,
|
|
2217
|
+
cycle: [...cycle, currentStepId]
|
|
2218
|
+
});
|
|
2219
|
+
}
|
|
2220
|
+
}
|
|
2221
|
+
function validateTerminalOutput(stepId, output, outputSchema) {
|
|
2222
|
+
if (!outputSchema) {
|
|
2223
|
+
return;
|
|
2224
|
+
}
|
|
2225
|
+
try {
|
|
2226
|
+
outputSchema.parse(output);
|
|
2227
|
+
} catch (error) {
|
|
2228
|
+
throw new WorkflowValidationError(
|
|
2229
|
+
`Terminal step '${stepId}' produced invalid output: ${error instanceof Error ? error.message : String(error)}`,
|
|
2230
|
+
{ stepId, validationError: error instanceof Error ? error.message : String(error) }
|
|
2231
|
+
);
|
|
2232
|
+
}
|
|
2233
|
+
}
|
|
2234
|
+
async function determineNextStep(step, currentData, context) {
|
|
2235
|
+
const { next } = step;
|
|
2236
|
+
if (next === null) {
|
|
2237
|
+
return null;
|
|
2238
|
+
}
|
|
2239
|
+
if (next.type === StepType.LINEAR) {
|
|
2240
|
+
return next.target;
|
|
2241
|
+
}
|
|
2242
|
+
if (next.type === StepType.CONDITIONAL) {
|
|
2243
|
+
return evaluateConditionalRoutes(step.id, next, currentData, context);
|
|
2244
|
+
}
|
|
2245
|
+
throw new WorkflowStepError(`Unknown next configuration type in step ${step.id}`, {
|
|
2246
|
+
stepId: step.id
|
|
2247
|
+
});
|
|
2248
|
+
}
|
|
2249
|
+
async function evaluateConditionalRoutes(stepId, next, currentData, context) {
|
|
2250
|
+
for (const route of next.routes) {
|
|
2251
|
+
try {
|
|
2252
|
+
if (route.condition(currentData)) {
|
|
2253
|
+
context.logger.debug(`Conditional route taken: ${stepId} -> ${route.target}`, {
|
|
2254
|
+
type: "workflow",
|
|
2255
|
+
contextType: "conditional-route",
|
|
2256
|
+
stepId,
|
|
2257
|
+
target: route.target
|
|
2258
|
+
});
|
|
2259
|
+
return route.target;
|
|
2260
|
+
}
|
|
2261
|
+
} catch (error) {
|
|
2262
|
+
context.logger.warn(`Error evaluating condition in step ${stepId}: ${error}`, {
|
|
2263
|
+
type: "workflow",
|
|
2264
|
+
contextType: "conditional-route",
|
|
2265
|
+
stepId,
|
|
2266
|
+
target: "",
|
|
2267
|
+
error: errorToString(error)
|
|
2268
|
+
});
|
|
2269
|
+
}
|
|
2270
|
+
}
|
|
2271
|
+
context.logger.debug(`Using default route: ${stepId} -> ${next.default}`, {
|
|
2272
|
+
type: "workflow",
|
|
2273
|
+
contextType: "conditional-route",
|
|
2274
|
+
stepId,
|
|
2275
|
+
target: next.default
|
|
2276
|
+
});
|
|
2277
|
+
return next.default;
|
|
2278
|
+
}
|
|
2279
|
+
function logWorkflowStart(context, workflowId, workflowName) {
|
|
2280
|
+
context.logger.info(`Executing workflow: ${workflowId}`, {
|
|
2281
|
+
type: "workflow",
|
|
2282
|
+
contextType: "workflow-execution",
|
|
2283
|
+
executionId: context.executionId,
|
|
2284
|
+
workflowId,
|
|
2285
|
+
workflowName,
|
|
2286
|
+
organizationId: context.organizationId
|
|
2287
|
+
});
|
|
2288
|
+
}
|
|
2289
|
+
function logWorkflowSuccess(context, workflowId, executionPath) {
|
|
2290
|
+
context.logger.info(`Workflow completed successfully: ${workflowId}`, {
|
|
2291
|
+
type: "workflow",
|
|
2292
|
+
contextType: "workflow-execution",
|
|
2293
|
+
executionId: context.executionId,
|
|
2294
|
+
workflowId,
|
|
2295
|
+
organizationId: context.organizationId,
|
|
2296
|
+
executionPath
|
|
2297
|
+
});
|
|
2298
|
+
}
|
|
2299
|
+
function logWorkflowFailure(context, workflowId, error) {
|
|
2300
|
+
context.logger.error(`Execution failed: workflow/${workflowId}`, {
|
|
2301
|
+
type: "workflow",
|
|
2302
|
+
contextType: "workflow-failure",
|
|
2303
|
+
executionId: context.executionId,
|
|
2304
|
+
workflowId,
|
|
2305
|
+
error: errorToString(error)
|
|
2306
|
+
});
|
|
2307
|
+
}
|
|
2308
|
+
function logStepStart(context, stepId, stepName, input, startTime) {
|
|
2309
|
+
context.logger.info(`Step started: ${stepName}`, {
|
|
2310
|
+
type: "workflow",
|
|
2311
|
+
contextType: "step-started",
|
|
2312
|
+
stepId,
|
|
2313
|
+
stepStatus: "started",
|
|
2314
|
+
input: truncateForLogging(input),
|
|
2315
|
+
startTime
|
|
2316
|
+
});
|
|
2317
|
+
}
|
|
2318
|
+
function logStepSuccess(context, stepId, stepName, output, duration, isTerminal, startTime, endTime) {
|
|
2319
|
+
context.logger.info(`Step completed: ${stepName}`, {
|
|
2320
|
+
type: "workflow",
|
|
2321
|
+
contextType: "step-completed",
|
|
2322
|
+
stepId,
|
|
2323
|
+
stepStatus: "completed",
|
|
2324
|
+
output: truncateForLogging(output),
|
|
2325
|
+
duration,
|
|
2326
|
+
isTerminal,
|
|
2327
|
+
startTime,
|
|
2328
|
+
endTime
|
|
2329
|
+
});
|
|
2330
|
+
}
|
|
2331
|
+
function logStepFailure(context, stepId, stepName, error, duration, startTime, endTime) {
|
|
2332
|
+
context.logger.error(`Step failed: ${stepName}`, {
|
|
2333
|
+
type: "workflow",
|
|
2334
|
+
contextType: "step-failed",
|
|
2335
|
+
stepId,
|
|
2336
|
+
stepStatus: "failed",
|
|
2337
|
+
error: errorToString(error),
|
|
2338
|
+
duration,
|
|
2339
|
+
startTime,
|
|
2340
|
+
endTime
|
|
2341
|
+
});
|
|
2342
|
+
}
|
|
2343
|
+
function logExecutionPath(context, executionPath) {
|
|
2344
|
+
context.logger.info(`Workflow completed. Execution path: ${executionPath.join(" -> ")}`, {
|
|
2345
|
+
type: "workflow",
|
|
2346
|
+
contextType: "execution-path",
|
|
2347
|
+
executionPath
|
|
2348
|
+
});
|
|
2349
|
+
}
|
|
2350
|
+
|
|
2351
|
+
// ../core/src/execution/engine/workflow/workflow.ts
|
|
2352
|
+
var Workflow = class {
|
|
2353
|
+
config;
|
|
2354
|
+
contract;
|
|
2355
|
+
steps;
|
|
2356
|
+
entryPoint;
|
|
2357
|
+
// Derived properties (computed from definition)
|
|
2358
|
+
shouldGenerateOutput;
|
|
2359
|
+
/**
|
|
2360
|
+
* Create a new workflow instance from definition
|
|
2361
|
+
*
|
|
2362
|
+
* @param definition - Workflow definition with config, contract, steps, and entryPoint
|
|
2363
|
+
*/
|
|
2364
|
+
constructor(definition) {
|
|
2365
|
+
this.config = definition.config;
|
|
2366
|
+
this.contract = definition.contract;
|
|
2367
|
+
this.steps = definition.steps;
|
|
2368
|
+
this.entryPoint = definition.entryPoint;
|
|
2369
|
+
this.shouldGenerateOutput = !!definition.contract.outputSchema;
|
|
2370
|
+
validateEntryPoint(this.steps, this.entryPoint);
|
|
2371
|
+
validateTerminalSteps(this.steps, this.config.resourceId);
|
|
2372
|
+
validateStepReferences(this.steps);
|
|
2373
|
+
}
|
|
2374
|
+
/**
|
|
2375
|
+
* Execute the workflow with graph-based flow control
|
|
2376
|
+
* Context is required for execution tracking, logging, and organization isolation
|
|
2377
|
+
* @returns Validated output matching contract.outputSchema, or null if no output schema
|
|
2378
|
+
*/
|
|
2379
|
+
async execute(input, context) {
|
|
2380
|
+
logWorkflowStart(context, this.config.resourceId, this.config.name);
|
|
2381
|
+
try {
|
|
2382
|
+
const validated = this.contract.inputSchema.parse(input);
|
|
2383
|
+
const visited = /* @__PURE__ */ new Set();
|
|
2384
|
+
const executionPath = [];
|
|
2385
|
+
let currentData = validated;
|
|
2386
|
+
let currentStepId = this.entryPoint;
|
|
2387
|
+
while (currentStepId !== null) {
|
|
2388
|
+
detectCycle(visited, executionPath, currentStepId);
|
|
2389
|
+
visited.add(currentStepId);
|
|
2390
|
+
executionPath.push(currentStepId);
|
|
2391
|
+
const step = this.steps[currentStepId];
|
|
2392
|
+
if (!step) {
|
|
2393
|
+
throw new WorkflowStepError(`Step '${currentStepId}' not found in workflow`, {
|
|
2394
|
+
stepId: currentStepId,
|
|
2395
|
+
workflowId: this.config.resourceId,
|
|
2396
|
+
executionId: context.executionId,
|
|
2397
|
+
organizationId: context.organizationId,
|
|
2398
|
+
executionPath
|
|
2399
|
+
});
|
|
2400
|
+
}
|
|
2401
|
+
const stepStartTime = Date.now();
|
|
2402
|
+
logStepStart(context, step.id, step.name, currentData, stepStartTime);
|
|
2403
|
+
try {
|
|
2404
|
+
const validatedInput = step.inputSchema.parse(currentData);
|
|
2405
|
+
const rawOutput = await step.handler(validatedInput, context);
|
|
2406
|
+
currentData = step.outputSchema.parse(rawOutput);
|
|
2407
|
+
if (step.next === null && this.shouldGenerateOutput) {
|
|
2408
|
+
validateTerminalOutput(step.id, currentData, this.contract.outputSchema);
|
|
2409
|
+
}
|
|
2410
|
+
const stepEndTime = Date.now();
|
|
2411
|
+
const duration = stepEndTime - stepStartTime;
|
|
2412
|
+
logStepSuccess(
|
|
2413
|
+
context,
|
|
2414
|
+
step.id,
|
|
2415
|
+
step.name,
|
|
2416
|
+
currentData,
|
|
2417
|
+
duration,
|
|
2418
|
+
step.next === null,
|
|
2419
|
+
stepStartTime,
|
|
2420
|
+
stepEndTime
|
|
2421
|
+
);
|
|
2422
|
+
currentStepId = await determineNextStep(step, currentData, context);
|
|
2423
|
+
} catch (error) {
|
|
2424
|
+
const stepEndTime = Date.now();
|
|
2425
|
+
const duration = stepEndTime - stepStartTime;
|
|
2426
|
+
logStepFailure(context, step.id, step.name, error, duration, stepStartTime, stepEndTime);
|
|
2427
|
+
throw new WorkflowStepError(`Step failed [${step.id}:${step.name}]: ${errorToString(error)}`, {
|
|
2428
|
+
stepId: step.id,
|
|
2429
|
+
stepName: step.name,
|
|
2430
|
+
workflowId: this.config.resourceId,
|
|
2431
|
+
executionId: context.executionId,
|
|
2432
|
+
duration: stepEndTime - stepStartTime
|
|
2433
|
+
});
|
|
2434
|
+
}
|
|
2435
|
+
}
|
|
2436
|
+
logExecutionPath(context, executionPath);
|
|
2437
|
+
logWorkflowSuccess(context, this.config.resourceId, executionPath);
|
|
2438
|
+
if (!this.shouldGenerateOutput) {
|
|
2439
|
+
return null;
|
|
2440
|
+
}
|
|
2441
|
+
return currentData;
|
|
2442
|
+
} catch (error) {
|
|
2443
|
+
logWorkflowFailure(context, this.config.resourceId, error);
|
|
2444
|
+
throw error;
|
|
2445
|
+
}
|
|
2446
|
+
}
|
|
2447
|
+
};
|
|
2448
|
+
|
|
2123
2449
|
// ../core/src/execution/engine/agent/observability/logging.ts
|
|
2124
2450
|
function createAgentLogger(logger, agentId, sessionId) {
|
|
2125
2451
|
return {
|
|
@@ -4689,7 +5015,7 @@ var LabelSchema = z.string().trim().min(1).max(120);
|
|
|
4689
5015
|
var DescriptionSchema = z.string().trim().min(1).max(2e3);
|
|
4690
5016
|
var ColorTokenSchema = z.string().trim().min(1).max(50);
|
|
4691
5017
|
var IconNameSchema = OrganizationModelIconTokenSchema;
|
|
4692
|
-
|
|
5018
|
+
z.string().trim().startsWith("/").max(300);
|
|
4693
5019
|
var ReferenceIdsSchema = z.array(ModelIdSchema).default([]);
|
|
4694
5020
|
var DisplayMetadataSchema = z.object({
|
|
4695
5021
|
label: LabelSchema,
|
|
@@ -4728,410 +5054,6 @@ DisplayMetadataSchema.extend({
|
|
|
4728
5054
|
techStack: TechStackEntrySchema.optional()
|
|
4729
5055
|
});
|
|
4730
5056
|
|
|
4731
|
-
// ../core/src/organization-model/domains/entities.ts
|
|
4732
|
-
var EntityIdSchema = ModelIdSchema;
|
|
4733
|
-
var EntityLinkKindSchema = z.enum(["belongs-to", "has-many", "has-one", "many-to-many"]).meta({ label: "Link kind" });
|
|
4734
|
-
var EntityLinkSchema = z.object({
|
|
4735
|
-
toEntity: EntityIdSchema.meta({ ref: "entity" }),
|
|
4736
|
-
kind: EntityLinkKindSchema,
|
|
4737
|
-
via: z.string().trim().min(1).max(255).optional(),
|
|
4738
|
-
label: LabelSchema.optional()
|
|
4739
|
-
});
|
|
4740
|
-
var EntitySchema = z.object({
|
|
4741
|
-
id: EntityIdSchema,
|
|
4742
|
-
/** Domain-map iteration order. Convention: multiples of 10 (10, 20, 30, ...) to allow easy insertion. */
|
|
4743
|
-
order: z.number(),
|
|
4744
|
-
label: LabelSchema,
|
|
4745
|
-
description: DescriptionSchema.optional(),
|
|
4746
|
-
ownedBySystemId: ModelIdSchema.meta({ ref: "system" }),
|
|
4747
|
-
table: z.string().trim().min(1).max(255).optional(),
|
|
4748
|
-
rowSchema: ModelIdSchema.optional(),
|
|
4749
|
-
stateCatalogId: ModelIdSchema.optional(),
|
|
4750
|
-
links: z.array(EntityLinkSchema).optional()
|
|
4751
|
-
});
|
|
4752
|
-
var EntitiesDomainSchema = z.record(z.string(), EntitySchema).refine((record) => Object.entries(record).every(([key, entry]) => entry.id === key), {
|
|
4753
|
-
message: "Each entity entry id must match its map key"
|
|
4754
|
-
}).default({});
|
|
4755
|
-
var ENTITY_ENTRY_INPUTS = [
|
|
4756
|
-
{
|
|
4757
|
-
id: "crm.deal",
|
|
4758
|
-
order: 10,
|
|
4759
|
-
label: "Deal",
|
|
4760
|
-
description: "A CRM opportunity or sales pipeline record.",
|
|
4761
|
-
ownedBySystemId: "sales.crm",
|
|
4762
|
-
table: "crm_deals",
|
|
4763
|
-
stateCatalogId: "crm.pipeline",
|
|
4764
|
-
links: [{ toEntity: "crm.contact", kind: "has-many", via: "deal_contacts", label: "contacts" }]
|
|
4765
|
-
},
|
|
4766
|
-
{
|
|
4767
|
-
id: "crm.contact",
|
|
4768
|
-
order: 20,
|
|
4769
|
-
label: "CRM Contact",
|
|
4770
|
-
description: "A person associated with a CRM relationship or deal.",
|
|
4771
|
-
ownedBySystemId: "sales.crm",
|
|
4772
|
-
table: "crm_contacts"
|
|
4773
|
-
},
|
|
4774
|
-
{
|
|
4775
|
-
id: "leadgen.list",
|
|
4776
|
-
order: 30,
|
|
4777
|
-
label: "Lead List",
|
|
4778
|
-
description: "A prospecting list that groups companies and contacts for acquisition workflows.",
|
|
4779
|
-
ownedBySystemId: "sales.lead-gen",
|
|
4780
|
-
table: "acq_lists",
|
|
4781
|
-
links: [
|
|
4782
|
-
{ toEntity: "leadgen.company", kind: "has-many", via: "acq_list_companies", label: "companies" },
|
|
4783
|
-
{ toEntity: "leadgen.contact", kind: "has-many", via: "acq_list_members", label: "contacts" }
|
|
4784
|
-
]
|
|
4785
|
-
},
|
|
4786
|
-
{
|
|
4787
|
-
id: "leadgen.company",
|
|
4788
|
-
order: 40,
|
|
4789
|
-
label: "Lead Company",
|
|
4790
|
-
description: "A company record sourced, enriched, and qualified during prospecting.",
|
|
4791
|
-
ownedBySystemId: "sales.lead-gen",
|
|
4792
|
-
table: "acq_list_companies",
|
|
4793
|
-
stateCatalogId: "lead-gen.company",
|
|
4794
|
-
links: [
|
|
4795
|
-
{ toEntity: "leadgen.list", kind: "belongs-to", via: "list_id", label: "list" },
|
|
4796
|
-
{ toEntity: "leadgen.contact", kind: "has-many", via: "company_id", label: "contacts" }
|
|
4797
|
-
]
|
|
4798
|
-
},
|
|
4799
|
-
{
|
|
4800
|
-
id: "leadgen.contact",
|
|
4801
|
-
order: 50,
|
|
4802
|
-
label: "Lead Contact",
|
|
4803
|
-
description: "A prospect contact discovered or enriched during lead generation.",
|
|
4804
|
-
ownedBySystemId: "sales.lead-gen",
|
|
4805
|
-
table: "acq_list_members",
|
|
4806
|
-
stateCatalogId: "lead-gen.contact",
|
|
4807
|
-
links: [
|
|
4808
|
-
{ toEntity: "leadgen.list", kind: "belongs-to", via: "list_id", label: "list" },
|
|
4809
|
-
{ toEntity: "leadgen.company", kind: "belongs-to", via: "company_id", label: "company" }
|
|
4810
|
-
]
|
|
4811
|
-
},
|
|
4812
|
-
{
|
|
4813
|
-
id: "delivery.project",
|
|
4814
|
-
order: 60,
|
|
4815
|
-
label: "Project",
|
|
4816
|
-
description: "A client delivery project.",
|
|
4817
|
-
ownedBySystemId: "projects",
|
|
4818
|
-
table: "projects",
|
|
4819
|
-
links: [
|
|
4820
|
-
{ toEntity: "delivery.milestone", kind: "has-many", via: "project_id", label: "milestones" },
|
|
4821
|
-
{ toEntity: "delivery.task", kind: "has-many", via: "project_id", label: "tasks" }
|
|
4822
|
-
]
|
|
4823
|
-
},
|
|
4824
|
-
{
|
|
4825
|
-
id: "delivery.milestone",
|
|
4826
|
-
order: 70,
|
|
4827
|
-
label: "Milestone",
|
|
4828
|
-
description: "A delivery checkpoint within a project.",
|
|
4829
|
-
ownedBySystemId: "projects",
|
|
4830
|
-
table: "project_milestones",
|
|
4831
|
-
links: [
|
|
4832
|
-
{ toEntity: "delivery.project", kind: "belongs-to", via: "project_id", label: "project" },
|
|
4833
|
-
{ toEntity: "delivery.task", kind: "has-many", via: "milestone_id", label: "tasks" }
|
|
4834
|
-
]
|
|
4835
|
-
},
|
|
4836
|
-
{
|
|
4837
|
-
id: "delivery.task",
|
|
4838
|
-
order: 80,
|
|
4839
|
-
label: "Task",
|
|
4840
|
-
description: "A delivery task that can move through the task status catalog.",
|
|
4841
|
-
ownedBySystemId: "projects",
|
|
4842
|
-
table: "project_tasks",
|
|
4843
|
-
stateCatalogId: "delivery.task",
|
|
4844
|
-
links: [
|
|
4845
|
-
{ toEntity: "delivery.project", kind: "belongs-to", via: "project_id", label: "project" },
|
|
4846
|
-
{ toEntity: "delivery.milestone", kind: "belongs-to", via: "milestone_id", label: "milestone" }
|
|
4847
|
-
]
|
|
4848
|
-
}
|
|
4849
|
-
];
|
|
4850
|
-
var DEFAULT_ORGANIZATION_MODEL_ENTITIES = Object.fromEntries(
|
|
4851
|
-
ENTITY_ENTRY_INPUTS.map((entity) => {
|
|
4852
|
-
const parsed = EntitySchema.parse(entity);
|
|
4853
|
-
return [parsed.id, parsed];
|
|
4854
|
-
})
|
|
4855
|
-
);
|
|
4856
|
-
|
|
4857
|
-
// ../core/src/organization-model/domains/actions.ts
|
|
4858
|
-
var ActionResourceIdSchema = z.string().trim().min(1).max(255).regex(/^[A-Za-z0-9]+(?:[-._][A-Za-z0-9]+)*$/, "Resource IDs must use letters, numbers, -, _, or . separators");
|
|
4859
|
-
z.enum(["slash-command", "mcp-tool", "api-endpoint", "script-execution"]).meta({ label: "Invocation kind" });
|
|
4860
|
-
var ActionIdSchema = ModelIdSchema;
|
|
4861
|
-
var ActionScopeSchema = z.union([
|
|
4862
|
-
z.literal("global"),
|
|
4863
|
-
z.object({
|
|
4864
|
-
domain: ModelIdSchema
|
|
4865
|
-
})
|
|
4866
|
-
]);
|
|
4867
|
-
var ActionRefSchema = z.object({
|
|
4868
|
-
actionId: ActionIdSchema.meta({ ref: "action" }),
|
|
4869
|
-
intent: z.enum(["exposes", "consumes"]).meta({ label: "Intent" })
|
|
4870
|
-
});
|
|
4871
|
-
var SlashCommandInvocationSchema = z.object({
|
|
4872
|
-
kind: z.literal("slash-command"),
|
|
4873
|
-
command: z.string().trim().min(1).max(200).regex(/^\/[^\s].*$/, "Slash commands must start with /"),
|
|
4874
|
-
toolFactory: ModelIdSchema.optional()
|
|
4875
|
-
});
|
|
4876
|
-
var McpToolInvocationSchema = z.object({
|
|
4877
|
-
kind: z.literal("mcp-tool"),
|
|
4878
|
-
server: ModelIdSchema,
|
|
4879
|
-
name: ModelIdSchema
|
|
4880
|
-
});
|
|
4881
|
-
var ApiEndpointInvocationSchema = z.object({
|
|
4882
|
-
kind: z.literal("api-endpoint"),
|
|
4883
|
-
method: z.enum(["GET", "POST", "PATCH", "DELETE"]).meta({ label: "HTTP method" }),
|
|
4884
|
-
path: z.string().trim().startsWith("/").max(500),
|
|
4885
|
-
requestSchema: ModelIdSchema.optional(),
|
|
4886
|
-
responseSchema: ModelIdSchema.optional()
|
|
4887
|
-
});
|
|
4888
|
-
var ScriptExecutionInvocationSchema = z.object({
|
|
4889
|
-
kind: z.literal("script-execution"),
|
|
4890
|
-
resourceId: ActionResourceIdSchema
|
|
4891
|
-
});
|
|
4892
|
-
var ActionInvocationSchema = z.discriminatedUnion("kind", [
|
|
4893
|
-
SlashCommandInvocationSchema,
|
|
4894
|
-
McpToolInvocationSchema,
|
|
4895
|
-
ApiEndpointInvocationSchema,
|
|
4896
|
-
ScriptExecutionInvocationSchema
|
|
4897
|
-
]);
|
|
4898
|
-
var ActionSchema = z.object({
|
|
4899
|
-
id: ActionIdSchema,
|
|
4900
|
-
/** Domain-map iteration order. Convention: multiples of 10 (10, 20, 30, ...) to allow easy insertion. */
|
|
4901
|
-
order: z.number(),
|
|
4902
|
-
label: LabelSchema,
|
|
4903
|
-
description: DescriptionSchema.optional(),
|
|
4904
|
-
scope: ActionScopeSchema.default("global"),
|
|
4905
|
-
resourceId: ActionResourceIdSchema.optional(),
|
|
4906
|
-
affects: z.array(EntityIdSchema.meta({ ref: "entity" })).optional(),
|
|
4907
|
-
invocations: z.array(ActionInvocationSchema).default([]),
|
|
4908
|
-
knowledge: z.array(ModelIdSchema.meta({ ref: "knowledge" })).default([]).optional(),
|
|
4909
|
-
lifecycle: z.enum(["draft", "beta", "active", "deprecated", "archived"]).meta({ label: "Lifecycle", color: "teal" }).default("active")
|
|
4910
|
-
});
|
|
4911
|
-
var ActionsDomainSchema = z.record(z.string(), ActionSchema).refine((record) => Object.entries(record).every(([key, entry]) => entry.id === key), {
|
|
4912
|
-
message: "Each action entry id must match its map key"
|
|
4913
|
-
}).default({});
|
|
4914
|
-
var LEAD_GEN_ACTION_ENTRY_INPUTS = [
|
|
4915
|
-
{
|
|
4916
|
-
id: "lead-gen.company.source",
|
|
4917
|
-
order: 10,
|
|
4918
|
-
label: "Source companies",
|
|
4919
|
-
description: "Import source companies from a list provider.",
|
|
4920
|
-
scope: { domain: "sales" },
|
|
4921
|
-
resourceId: "lgn-import-workflow",
|
|
4922
|
-
invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/companies/source" }]
|
|
4923
|
-
},
|
|
4924
|
-
{
|
|
4925
|
-
id: "lead-gen.company.apollo-import",
|
|
4926
|
-
order: 20,
|
|
4927
|
-
label: "Import from Apollo",
|
|
4928
|
-
description: "Pull companies and seed contact data from an Apollo search or list.",
|
|
4929
|
-
scope: { domain: "sales" },
|
|
4930
|
-
resourceId: "lgn-01c-apollo-import-workflow",
|
|
4931
|
-
invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/companies/apollo-import" }]
|
|
4932
|
-
},
|
|
4933
|
-
{
|
|
4934
|
-
id: "lead-gen.contact.discover",
|
|
4935
|
-
order: 30,
|
|
4936
|
-
label: "Discover contact emails",
|
|
4937
|
-
description: "Find email addresses for contacts at qualified companies.",
|
|
4938
|
-
scope: { domain: "sales" },
|
|
4939
|
-
resourceId: "lgn-04-email-discovery-workflow",
|
|
4940
|
-
invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/contacts/discover" }]
|
|
4941
|
-
},
|
|
4942
|
-
{
|
|
4943
|
-
id: "lead-gen.contact.verify-email",
|
|
4944
|
-
order: 40,
|
|
4945
|
-
label: "Verify emails",
|
|
4946
|
-
description: "Check email deliverability before outreach.",
|
|
4947
|
-
scope: { domain: "sales" },
|
|
4948
|
-
resourceId: "lgn-05-email-verification-workflow",
|
|
4949
|
-
invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/contacts/verify-email" }]
|
|
4950
|
-
},
|
|
4951
|
-
{
|
|
4952
|
-
id: "lead-gen.company.apify-crawl",
|
|
4953
|
-
order: 50,
|
|
4954
|
-
label: "Crawl websites",
|
|
4955
|
-
description: "Crawl company websites via Apify and store raw page markdown in enrichmentData.websiteCrawl.pages for downstream LLM analysis.",
|
|
4956
|
-
scope: { domain: "sales" },
|
|
4957
|
-
resourceId: "lgn-02a-apify-website-crawl-workflow",
|
|
4958
|
-
invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/companies/apify-crawl" }]
|
|
4959
|
-
},
|
|
4960
|
-
{
|
|
4961
|
-
id: "lead-gen.company.website-extract",
|
|
4962
|
-
order: 60,
|
|
4963
|
-
label: "Extract website signals",
|
|
4964
|
-
description: "Scrape and analyze company websites for qualification signals.",
|
|
4965
|
-
scope: { domain: "sales" },
|
|
4966
|
-
resourceId: "lgn-02-website-extract-workflow",
|
|
4967
|
-
invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/companies/website-extract" }]
|
|
4968
|
-
},
|
|
4969
|
-
{
|
|
4970
|
-
id: "lead-gen.company.qualify",
|
|
4971
|
-
order: 70,
|
|
4972
|
-
label: "Qualify companies",
|
|
4973
|
-
description: "Score and filter companies against the ICP rubric.",
|
|
4974
|
-
scope: { domain: "sales" },
|
|
4975
|
-
resourceId: "lgn-03-company-qualification-workflow",
|
|
4976
|
-
invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/companies/qualify" }]
|
|
4977
|
-
},
|
|
4978
|
-
{
|
|
4979
|
-
id: "lead-gen.company.dtc-subscription-qualify",
|
|
4980
|
-
order: 80,
|
|
4981
|
-
label: "Qualify DTC subscription fit",
|
|
4982
|
-
description: "Classify subscription potential and consumable-product fit for DTC brands.",
|
|
4983
|
-
scope: { domain: "sales" },
|
|
4984
|
-
resourceId: "lgn-03b-dtc-subscription-score-workflow",
|
|
4985
|
-
invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/companies/dtc-subscription-qualify" }]
|
|
4986
|
-
},
|
|
4987
|
-
{
|
|
4988
|
-
id: "lead-gen.contact.apollo-decision-maker-enrich",
|
|
4989
|
-
order: 90,
|
|
4990
|
-
label: "Enrich decision-makers",
|
|
4991
|
-
description: "Find and enrich qualified contacts at qualified companies via Apollo.",
|
|
4992
|
-
scope: { domain: "sales" },
|
|
4993
|
-
resourceId: "lgn-04b-apollo-decision-maker-enrich-workflow",
|
|
4994
|
-
invocations: [
|
|
4995
|
-
{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/contacts/apollo-decision-maker-enrich" }
|
|
4996
|
-
]
|
|
4997
|
-
},
|
|
4998
|
-
{
|
|
4999
|
-
id: "lead-gen.contact.personalize",
|
|
5000
|
-
order: 100,
|
|
5001
|
-
label: "Personalize outreach",
|
|
5002
|
-
description: "Generate personalized opening lines for each contact.",
|
|
5003
|
-
scope: { domain: "sales" },
|
|
5004
|
-
resourceId: "ist-personalization-workflow",
|
|
5005
|
-
invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/contacts/personalize" }]
|
|
5006
|
-
},
|
|
5007
|
-
{
|
|
5008
|
-
id: "lead-gen.review.outreach-ready",
|
|
5009
|
-
order: 110,
|
|
5010
|
-
label: "Upload to outreach",
|
|
5011
|
-
description: "Upload approved contacts to the outreach sequence after QC review.",
|
|
5012
|
-
scope: { domain: "sales" },
|
|
5013
|
-
resourceId: "ist-upload-contacts-workflow",
|
|
5014
|
-
invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/review/outreach-ready" }]
|
|
5015
|
-
},
|
|
5016
|
-
{
|
|
5017
|
-
id: "lead-gen.export.list",
|
|
5018
|
-
order: 120,
|
|
5019
|
-
label: "Export lead list",
|
|
5020
|
-
description: "Export approved leads as a downloadable lead list.",
|
|
5021
|
-
scope: { domain: "sales" },
|
|
5022
|
-
resourceId: "lgn-06-export-list-workflow",
|
|
5023
|
-
invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/export/list" }]
|
|
5024
|
-
},
|
|
5025
|
-
{
|
|
5026
|
-
id: "lead-gen.company.cleanup",
|
|
5027
|
-
order: 130,
|
|
5028
|
-
label: "Clean up companies",
|
|
5029
|
-
description: "Remove disqualified or duplicate companies from the list.",
|
|
5030
|
-
scope: { domain: "sales" },
|
|
5031
|
-
resourceId: "lgn-company-cleanup-workflow",
|
|
5032
|
-
invocations: [{ kind: "api-endpoint", method: "POST", path: "/api/prospecting/companies/cleanup" }]
|
|
5033
|
-
}
|
|
5034
|
-
];
|
|
5035
|
-
var LEAD_GEN_ACTION_ENTRIES = Object.fromEntries(
|
|
5036
|
-
LEAD_GEN_ACTION_ENTRY_INPUTS.map((action) => {
|
|
5037
|
-
const parsed = ActionSchema.parse(action);
|
|
5038
|
-
return [parsed.id, parsed];
|
|
5039
|
-
})
|
|
5040
|
-
);
|
|
5041
|
-
var CRM_ACTION_ENTRY_INPUTS = [
|
|
5042
|
-
{
|
|
5043
|
-
id: "send_reply",
|
|
5044
|
-
order: 210,
|
|
5045
|
-
label: "Send Reply",
|
|
5046
|
-
description: "Send a contextual reply for an active CRM deal.",
|
|
5047
|
-
scope: { domain: "sales" },
|
|
5048
|
-
resourceId: "crm-send-reply-workflow",
|
|
5049
|
-
affects: ["crm.deal"]
|
|
5050
|
-
},
|
|
5051
|
-
{
|
|
5052
|
-
id: "send_link",
|
|
5053
|
-
order: 220,
|
|
5054
|
-
label: "Send Booking Link",
|
|
5055
|
-
description: "Send a booking link to move a deal toward a scheduled call.",
|
|
5056
|
-
scope: { domain: "sales" },
|
|
5057
|
-
resourceId: "crm-send-booking-link-workflow",
|
|
5058
|
-
affects: ["crm.deal"]
|
|
5059
|
-
},
|
|
5060
|
-
{
|
|
5061
|
-
id: "send_nudge",
|
|
5062
|
-
order: 230,
|
|
5063
|
-
label: "Send Nudge",
|
|
5064
|
-
description: "Send a follow-up nudge for a stalled CRM deal.",
|
|
5065
|
-
scope: { domain: "sales" },
|
|
5066
|
-
resourceId: "crm-send-nudge-workflow",
|
|
5067
|
-
affects: ["crm.deal"]
|
|
5068
|
-
},
|
|
5069
|
-
{
|
|
5070
|
-
id: "rebook",
|
|
5071
|
-
order: 240,
|
|
5072
|
-
label: "Rebook",
|
|
5073
|
-
description: "Rebook a missed or rescheduled CRM appointment.",
|
|
5074
|
-
scope: { domain: "sales" },
|
|
5075
|
-
resourceId: "crm-rebook-workflow",
|
|
5076
|
-
affects: ["crm.deal"]
|
|
5077
|
-
},
|
|
5078
|
-
{
|
|
5079
|
-
id: "move_to_proposal",
|
|
5080
|
-
order: 250,
|
|
5081
|
-
label: "Move to Proposal",
|
|
5082
|
-
description: "Advance a qualified CRM deal into the proposal stage.",
|
|
5083
|
-
scope: { domain: "sales" },
|
|
5084
|
-
resourceId: "move_to_proposal-workflow",
|
|
5085
|
-
affects: ["crm.deal"]
|
|
5086
|
-
},
|
|
5087
|
-
{
|
|
5088
|
-
id: "move_to_closing",
|
|
5089
|
-
order: 260,
|
|
5090
|
-
label: "Move to Closing",
|
|
5091
|
-
description: "Advance a proposal-stage CRM deal into closing.",
|
|
5092
|
-
scope: { domain: "sales" },
|
|
5093
|
-
resourceId: "move_to_closing-workflow",
|
|
5094
|
-
affects: ["crm.deal"]
|
|
5095
|
-
},
|
|
5096
|
-
{
|
|
5097
|
-
id: "move_to_closed_won",
|
|
5098
|
-
order: 270,
|
|
5099
|
-
label: "Close Won",
|
|
5100
|
-
description: "Mark a CRM deal as closed won.",
|
|
5101
|
-
scope: { domain: "sales" },
|
|
5102
|
-
resourceId: "move_to_closed_won-workflow",
|
|
5103
|
-
affects: ["crm.deal"]
|
|
5104
|
-
},
|
|
5105
|
-
{
|
|
5106
|
-
id: "move_to_closed_lost",
|
|
5107
|
-
order: 280,
|
|
5108
|
-
label: "Close Lost",
|
|
5109
|
-
description: "Mark a CRM deal as closed lost.",
|
|
5110
|
-
scope: { domain: "sales" },
|
|
5111
|
-
resourceId: "move_to_closed_lost-workflow",
|
|
5112
|
-
affects: ["crm.deal"]
|
|
5113
|
-
},
|
|
5114
|
-
{
|
|
5115
|
-
id: "move_to_nurturing",
|
|
5116
|
-
order: 290,
|
|
5117
|
-
label: "Move to Nurturing",
|
|
5118
|
-
description: "Move a CRM deal into nurturing for future follow-up.",
|
|
5119
|
-
scope: { domain: "sales" },
|
|
5120
|
-
resourceId: "move_to_nurturing-workflow",
|
|
5121
|
-
affects: ["crm.deal"]
|
|
5122
|
-
}
|
|
5123
|
-
];
|
|
5124
|
-
var CRM_ACTION_ENTRIES = Object.fromEntries(
|
|
5125
|
-
CRM_ACTION_ENTRY_INPUTS.map((action) => {
|
|
5126
|
-
const parsed = ActionSchema.parse(action);
|
|
5127
|
-
return [parsed.id, parsed];
|
|
5128
|
-
})
|
|
5129
|
-
);
|
|
5130
|
-
var DEFAULT_ORGANIZATION_MODEL_ACTIONS = {
|
|
5131
|
-
...LEAD_GEN_ACTION_ENTRIES,
|
|
5132
|
-
...CRM_ACTION_ENTRIES
|
|
5133
|
-
};
|
|
5134
|
-
|
|
5135
5057
|
// ../core/src/organization-model/domains/prospecting.ts
|
|
5136
5058
|
DisplayMetadataSchema.extend({
|
|
5137
5059
|
id: ModelIdSchema,
|
|
@@ -5269,7 +5191,6 @@ var DTC_RECORD_COLUMNS = {
|
|
|
5269
5191
|
]
|
|
5270
5192
|
}
|
|
5271
5193
|
};
|
|
5272
|
-
Object.values(LEAD_GEN_ACTION_ENTRIES);
|
|
5273
5194
|
var PROSPECTING_STEPS = {
|
|
5274
5195
|
localServices: {
|
|
5275
5196
|
sourceCompanies: {
|
|
@@ -5515,3171 +5436,22 @@ var PROSPECTING_BUILD_TEMPLATE_OPTIONS = BUILD_TEMPLATE_CATALOG.map(({ id, label
|
|
|
5515
5436
|
function isProspectingBuildTemplateId(value) {
|
|
5516
5437
|
return PROSPECTING_BUILD_TEMPLATE_OPTIONS.some((template) => template.id === value);
|
|
5517
5438
|
}
|
|
5518
|
-
|
|
5519
|
-
|
|
5520
|
-
var
|
|
5521
|
-
|
|
5522
|
-
|
|
5523
|
-
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
5529
|
-
|
|
5530
|
-
|
|
5531
|
-
|
|
5532
|
-
|
|
5533
|
-
|
|
5534
|
-
entity: "company"
|
|
5535
|
-
},
|
|
5536
|
-
crawled: {
|
|
5537
|
-
key: "crawled",
|
|
5538
|
-
label: "Websites crawled",
|
|
5539
|
-
description: "Company websites have been crawled (e.g. via Apify) and raw page content stored for downstream LLM analysis.",
|
|
5540
|
-
order: 2.5,
|
|
5541
|
-
entity: "company"
|
|
5542
|
-
},
|
|
5543
|
-
extracted: {
|
|
5544
|
-
key: "extracted",
|
|
5545
|
-
label: "Websites analyzed",
|
|
5546
|
-
description: "Company websites have been analyzed for business signals.",
|
|
5547
|
-
order: 3,
|
|
5548
|
-
entity: "company"
|
|
5549
|
-
},
|
|
5550
|
-
enriched: {
|
|
5551
|
-
key: "enriched",
|
|
5552
|
-
label: "Enriched",
|
|
5553
|
-
description: "Company or contact enriched with third-party data (e.g. Tomba, Anymailfinder).",
|
|
5554
|
-
order: 4,
|
|
5555
|
-
entity: "company"
|
|
5556
|
-
},
|
|
5557
|
-
"decision-makers-enriched": {
|
|
5558
|
-
key: "decision-makers-enriched",
|
|
5559
|
-
label: "Decision-makers found",
|
|
5560
|
-
description: "Decision-maker contacts discovered and attached to a qualified company.",
|
|
5561
|
-
order: 6,
|
|
5562
|
-
entity: "company",
|
|
5563
|
-
recordEntity: "contact",
|
|
5564
|
-
recordStageKey: "discovered"
|
|
5565
|
-
},
|
|
5566
|
-
// Prospecting - contact discovery
|
|
5567
|
-
discovered: {
|
|
5568
|
-
key: "discovered",
|
|
5569
|
-
label: "Decision-makers found",
|
|
5570
|
-
description: "Decision-maker contact details have been found.",
|
|
5571
|
-
order: 5,
|
|
5572
|
-
entity: "contact"
|
|
5573
|
-
},
|
|
5574
|
-
verified: {
|
|
5575
|
-
key: "verified",
|
|
5576
|
-
label: "Emails verified",
|
|
5577
|
-
description: "Contact email addresses have been checked for deliverability.",
|
|
5578
|
-
order: 7,
|
|
5579
|
-
entity: "contact"
|
|
5580
|
-
},
|
|
5581
|
-
// Qualification
|
|
5582
|
-
qualified: {
|
|
5583
|
-
key: "qualified",
|
|
5584
|
-
label: "Companies qualified",
|
|
5585
|
-
description: "Companies have been scored against the qualification criteria.",
|
|
5586
|
-
order: 8,
|
|
5587
|
-
entity: "company"
|
|
5588
|
-
},
|
|
5589
|
-
// Outreach
|
|
5590
|
-
personalized: {
|
|
5591
|
-
key: "personalized",
|
|
5592
|
-
label: "Personalized",
|
|
5593
|
-
description: "Outreach message personalized for the contact (Instantly personalization workflow).",
|
|
5594
|
-
order: 9,
|
|
5595
|
-
entity: "contact"
|
|
5596
|
-
},
|
|
5597
|
-
uploaded: {
|
|
5598
|
-
key: "uploaded",
|
|
5599
|
-
label: "Reviewed and exported",
|
|
5600
|
-
description: "Approved records have been reviewed and exported for handoff.",
|
|
5601
|
-
order: 10,
|
|
5602
|
-
entity: "company",
|
|
5603
|
-
additionalEntities: ["contact"]
|
|
5604
|
-
},
|
|
5605
|
-
interested: {
|
|
5606
|
-
key: "interested",
|
|
5607
|
-
label: "Interested",
|
|
5608
|
-
description: "Contact replied with a positive signal (Instantly reply-handler transition).",
|
|
5609
|
-
order: 11,
|
|
5610
|
-
entity: "contact"
|
|
5611
|
-
}
|
|
5612
|
-
};
|
|
5613
|
-
|
|
5614
|
-
// ../core/src/organization-model/domains/sales.ts
|
|
5615
|
-
var SalesStageSemanticClassSchema = z.enum(["open", "active", "nurturing", "closed_won", "closed_lost"]);
|
|
5616
|
-
var SalesStageSchema = DisplayMetadataSchema.extend({
|
|
5617
|
-
id: ModelIdSchema,
|
|
5618
|
-
order: z.number().int().min(0),
|
|
5619
|
-
semanticClass: SalesStageSemanticClassSchema,
|
|
5620
|
-
surfaceIds: ReferenceIdsSchema,
|
|
5621
|
-
resourceIds: ReferenceIdsSchema
|
|
5622
|
-
});
|
|
5623
|
-
z.object({
|
|
5624
|
-
id: ModelIdSchema,
|
|
5625
|
-
label: z.string().trim().min(1).max(120),
|
|
5626
|
-
description: DescriptionSchema.optional(),
|
|
5627
|
-
entityId: ModelIdSchema,
|
|
5628
|
-
stages: z.array(SalesStageSchema).min(1)
|
|
5629
|
-
});
|
|
5630
|
-
var CRM_DISCOVERY_REPLIED_STATE = {
|
|
5631
|
-
stateKey: "discovery_replied",
|
|
5632
|
-
label: "Discovery Replied"
|
|
5633
|
-
};
|
|
5634
|
-
var CRM_DISCOVERY_LINK_SENT_STATE = {
|
|
5635
|
-
stateKey: "discovery_link_sent",
|
|
5636
|
-
label: "Discovery Link Sent"
|
|
5637
|
-
};
|
|
5638
|
-
var CRM_DISCOVERY_NUDGING_STATE = {
|
|
5639
|
-
stateKey: "discovery_nudging",
|
|
5640
|
-
label: "Discovery Nudging"
|
|
5641
|
-
};
|
|
5642
|
-
var CRM_DISCOVERY_BOOKING_CANCELLED_STATE = {
|
|
5643
|
-
stateKey: "discovery_booking_cancelled",
|
|
5644
|
-
label: "Discovery Booking Cancelled"
|
|
5645
|
-
};
|
|
5646
|
-
var CRM_REPLY_SENT_STATE = {
|
|
5647
|
-
stateKey: "reply_sent",
|
|
5648
|
-
label: "Reply Sent"
|
|
5649
|
-
};
|
|
5650
|
-
var CRM_FOLLOWUP_1_SENT_STATE = {
|
|
5651
|
-
stateKey: "followup_1_sent",
|
|
5652
|
-
label: "Follow-up 1 Sent"
|
|
5653
|
-
};
|
|
5654
|
-
var CRM_FOLLOWUP_2_SENT_STATE = {
|
|
5655
|
-
stateKey: "followup_2_sent",
|
|
5656
|
-
label: "Follow-up 2 Sent"
|
|
5657
|
-
};
|
|
5658
|
-
var CRM_FOLLOWUP_3_SENT_STATE = {
|
|
5659
|
-
stateKey: "followup_3_sent",
|
|
5660
|
-
label: "Follow-up 3 Sent"
|
|
5661
|
-
};
|
|
5662
|
-
var CRM_PIPELINE_DEFINITION = {
|
|
5663
|
-
pipelineKey: "crm",
|
|
5664
|
-
label: "CRM",
|
|
5665
|
-
entityKey: "crm.deal",
|
|
5666
|
-
stages: [
|
|
5667
|
-
{
|
|
5668
|
-
stageKey: "interested",
|
|
5669
|
-
label: "Interested",
|
|
5670
|
-
color: "blue",
|
|
5671
|
-
states: [
|
|
5672
|
-
CRM_DISCOVERY_REPLIED_STATE,
|
|
5673
|
-
CRM_DISCOVERY_LINK_SENT_STATE,
|
|
5674
|
-
CRM_DISCOVERY_NUDGING_STATE,
|
|
5675
|
-
CRM_DISCOVERY_BOOKING_CANCELLED_STATE,
|
|
5676
|
-
CRM_REPLY_SENT_STATE,
|
|
5677
|
-
CRM_FOLLOWUP_1_SENT_STATE,
|
|
5678
|
-
CRM_FOLLOWUP_2_SENT_STATE,
|
|
5679
|
-
CRM_FOLLOWUP_3_SENT_STATE
|
|
5680
|
-
]
|
|
5681
|
-
},
|
|
5682
|
-
{ stageKey: "proposal", label: "Proposal", color: "yellow", states: [] },
|
|
5683
|
-
{ stageKey: "closing", label: "Closing", color: "orange", states: [] },
|
|
5684
|
-
{ stageKey: "closed_won", label: "Closed Won", color: "green", states: [] },
|
|
5685
|
-
{ stageKey: "closed_lost", label: "Closed Lost", color: "red", states: [] },
|
|
5686
|
-
{ stageKey: "nurturing", label: "Nurturing", color: "grape", states: [] }
|
|
5687
|
-
]
|
|
5688
|
-
};
|
|
5689
|
-
var OrganizationModelBrandingSchema = z.object({
|
|
5690
|
-
organizationName: LabelSchema,
|
|
5691
|
-
productName: LabelSchema,
|
|
5692
|
-
shortName: z.string().trim().min(1).max(40),
|
|
5693
|
-
description: DescriptionSchema.optional(),
|
|
5694
|
-
logos: z.object({
|
|
5695
|
-
light: z.string().trim().min(1).max(2048).optional(),
|
|
5696
|
-
dark: z.string().trim().min(1).max(2048).optional()
|
|
5697
|
-
}).default({})
|
|
5698
|
-
});
|
|
5699
|
-
var DEFAULT_ORGANIZATION_MODEL_BRANDING = {
|
|
5700
|
-
organizationName: "Default Organization",
|
|
5701
|
-
productName: "Elevasis",
|
|
5702
|
-
shortName: "Elevasis",
|
|
5703
|
-
logos: {}
|
|
5704
|
-
};
|
|
5705
|
-
var BusinessHoursDaySchema = z.object({
|
|
5706
|
-
open: z.string().trim().regex(/^\d{2}:\d{2}$/, "Expected HH:MM format"),
|
|
5707
|
-
close: z.string().trim().regex(/^\d{2}:\d{2}$/, "Expected HH:MM format")
|
|
5708
|
-
});
|
|
5709
|
-
var BusinessHoursSchema = z.object({
|
|
5710
|
-
monday: BusinessHoursDaySchema.optional(),
|
|
5711
|
-
tuesday: BusinessHoursDaySchema.optional(),
|
|
5712
|
-
wednesday: BusinessHoursDaySchema.optional(),
|
|
5713
|
-
thursday: BusinessHoursDaySchema.optional(),
|
|
5714
|
-
friday: BusinessHoursDaySchema.optional(),
|
|
5715
|
-
saturday: BusinessHoursDaySchema.optional(),
|
|
5716
|
-
sunday: BusinessHoursDaySchema.optional()
|
|
5717
|
-
}).default({});
|
|
5718
|
-
var IdentityDomainSchema = z.object({
|
|
5719
|
-
/** Why the organization exists — one or two plain-language sentences. */
|
|
5720
|
-
mission: z.string().trim().max(1e3).default(""),
|
|
5721
|
-
/** Long-term direction the organization is moving toward. */
|
|
5722
|
-
vision: z.string().trim().max(1e3).default(""),
|
|
5723
|
-
/** Legal registered name of the entity. */
|
|
5724
|
-
legalName: z.string().trim().max(200).default(""),
|
|
5725
|
-
/**
|
|
5726
|
-
* Type of legal entity (e.g. "LLC", "Corporation", "Sole Proprietor",
|
|
5727
|
-
* "Non-profit"). Free-form string so it covers any jurisdiction.
|
|
5728
|
-
*/
|
|
5729
|
-
entityType: z.string().trim().max(100).default(""),
|
|
5730
|
-
/**
|
|
5731
|
-
* Primary jurisdiction of registration or operation
|
|
5732
|
-
* (e.g. "United States – Delaware", "Canada – Ontario").
|
|
5733
|
-
*/
|
|
5734
|
-
jurisdiction: z.string().trim().max(200).default(""),
|
|
5735
|
-
/**
|
|
5736
|
-
* Industry category — broad classification (e.g. "Marketing Agency",
|
|
5737
|
-
* "Software / SaaS", "Professional Services").
|
|
5738
|
-
*/
|
|
5739
|
-
industryCategory: z.string().trim().max(200).default(""),
|
|
5740
|
-
/**
|
|
5741
|
-
* Geographic focus — where the organization primarily operates or serves
|
|
5742
|
-
* (e.g. "North America", "Global", "Southeast Asia").
|
|
5743
|
-
*/
|
|
5744
|
-
geographicFocus: z.string().trim().max(200).default(""),
|
|
5745
|
-
/**
|
|
5746
|
-
* IANA timezone identifier for the organization's primary operating timezone
|
|
5747
|
-
* (e.g. "America/Los_Angeles", "Europe/London", "UTC").
|
|
5748
|
-
*/
|
|
5749
|
-
timeZone: z.string().trim().max(100).default("UTC"),
|
|
5750
|
-
/** Typical operating hours per day of week. Empty object means not configured. */
|
|
5751
|
-
businessHours: BusinessHoursSchema,
|
|
5752
|
-
/**
|
|
5753
|
-
* Long-form markdown capturing client context, problem narrative, and domain
|
|
5754
|
-
* background. Populated by /setup; surfaced to agents as organizational context.
|
|
5755
|
-
* Optional — many projects have no external client.
|
|
5756
|
-
*/
|
|
5757
|
-
clientBrief: z.string().trim().default("")
|
|
5758
|
-
});
|
|
5759
|
-
var DEFAULT_ORGANIZATION_MODEL_IDENTITY = {
|
|
5760
|
-
mission: "",
|
|
5761
|
-
vision: "",
|
|
5762
|
-
legalName: "",
|
|
5763
|
-
entityType: "",
|
|
5764
|
-
jurisdiction: "",
|
|
5765
|
-
industryCategory: "",
|
|
5766
|
-
geographicFocus: "",
|
|
5767
|
-
timeZone: "UTC",
|
|
5768
|
-
businessHours: {},
|
|
5769
|
-
clientBrief: ""
|
|
5770
|
-
};
|
|
5771
|
-
var FirmographicsSchema = z.object({
|
|
5772
|
-
/** Industry vertical (e.g. "Marketing Agency", "Legal", "Real Estate"). */
|
|
5773
|
-
industry: z.string().trim().max(200).optional(),
|
|
5774
|
-
/**
|
|
5775
|
-
* Company headcount band (e.g. "1–10", "11–50", "51–200", "200+").
|
|
5776
|
-
* Free-form string to accommodate any band notation.
|
|
5777
|
-
*/
|
|
5778
|
-
companySize: z.string().trim().max(100).optional(),
|
|
5779
|
-
/**
|
|
5780
|
-
* Primary geographic region the segment operates in or is targeted from
|
|
5781
|
-
* (e.g. "North America", "Europe", "Global").
|
|
5782
|
-
*/
|
|
5783
|
-
region: z.string().trim().max(200).optional()
|
|
5784
|
-
});
|
|
5785
|
-
var CustomerSegmentSchema = z.object({
|
|
5786
|
-
/** Stable unique identifier for the segment (e.g. "segment-smb-agencies"). */
|
|
5787
|
-
id: z.string().trim().min(1).max(100),
|
|
5788
|
-
/** Domain-map iteration order. Convention: multiples of 10 (10, 20, 30, ...) to allow easy insertion. */
|
|
5789
|
-
order: z.number(),
|
|
5790
|
-
/** Human-readable name shown to agents and in UI (e.g. "SMB Marketing Agencies"). */
|
|
5791
|
-
name: z.string().trim().max(200).default(""),
|
|
5792
|
-
/** One or two sentences describing who this segment is. */
|
|
5793
|
-
description: z.string().trim().max(2e3).default(""),
|
|
5794
|
-
/**
|
|
5795
|
-
* The primary job(s) this segment is trying to get done — the goal they hire
|
|
5796
|
-
* a product/service to accomplish. Plain-language narrative or bullet list.
|
|
5797
|
-
*/
|
|
5798
|
-
jobsToBeDone: z.string().trim().max(2e3).default(""),
|
|
5799
|
-
/**
|
|
5800
|
-
* Pains — frustrations, obstacles, and risks the segment experiences
|
|
5801
|
-
* when trying to accomplish their jobs-to-be-done.
|
|
5802
|
-
*/
|
|
5803
|
-
pains: z.array(z.string().trim().max(500)).default([]),
|
|
5804
|
-
/**
|
|
5805
|
-
* Gains — outcomes and benefits the segment desires; positive motivators
|
|
5806
|
-
* beyond merely resolving pains.
|
|
5807
|
-
*/
|
|
5808
|
-
gains: z.array(z.string().trim().max(500)).default([]),
|
|
5809
|
-
/** Firmographic profile for targeting and filtering. */
|
|
5810
|
-
firmographics: FirmographicsSchema.default({}),
|
|
5811
|
-
/**
|
|
5812
|
-
* Value proposition — one or two sentences stating why this organization's
|
|
5813
|
-
* offering is uniquely suited for this segment's needs.
|
|
5814
|
-
*/
|
|
5815
|
-
valueProp: z.string().trim().max(2e3).default("")
|
|
5816
|
-
});
|
|
5817
|
-
var CustomersDomainSchema = z.record(z.string(), CustomerSegmentSchema).refine((record) => Object.entries(record).every(([key, entry]) => entry.id === key), {
|
|
5818
|
-
message: "Each segment entry id must match its map key"
|
|
5819
|
-
}).default({});
|
|
5820
|
-
var DEFAULT_ORGANIZATION_MODEL_CUSTOMERS = {};
|
|
5821
|
-
var PricingModelSchema = z.enum(["one-time", "subscription", "usage-based", "custom"]).meta({ label: "Pricing model", color: "green" });
|
|
5822
|
-
var ProductSchema = z.object({
|
|
5823
|
-
/** Stable unique identifier for the product (e.g. "product-starter-plan"). */
|
|
5824
|
-
id: z.string().trim().min(1).max(100),
|
|
5825
|
-
/** Domain-map iteration order. Convention: multiples of 10 (10, 20, 30, ...) to allow easy insertion. */
|
|
5826
|
-
order: z.number(),
|
|
5827
|
-
/** Human-readable name shown to agents and in UI (e.g. "Starter Plan"). */
|
|
5828
|
-
name: z.string().trim().max(200).default(""),
|
|
5829
|
-
/** One or two sentences describing what this product/service delivers. */
|
|
5830
|
-
description: z.string().trim().max(2e3).default(""),
|
|
5831
|
-
/**
|
|
5832
|
-
* How this product is priced:
|
|
5833
|
-
* - "one-time" — single purchase (setup fee, project fee)
|
|
5834
|
-
* - "subscription" — recurring (monthly/annual SaaS, retainer)
|
|
5835
|
-
* - "usage-based" — metered by consumption (API calls, seats)
|
|
5836
|
-
* - "custom" — negotiated or bespoke pricing
|
|
5837
|
-
*/
|
|
5838
|
-
pricingModel: PricingModelSchema.default("custom"),
|
|
5839
|
-
/** Base price amount (≥ 0). Currency unit defined by `currency`. */
|
|
5840
|
-
price: z.number().min(0).default(0),
|
|
5841
|
-
/**
|
|
5842
|
-
* ISO 4217 currency code (e.g. "USD", "EUR", "GBP").
|
|
5843
|
-
* Free-form string to accommodate any currency; defaults to "USD".
|
|
5844
|
-
*/
|
|
5845
|
-
currency: z.string().trim().max(10).default("USD"),
|
|
5846
|
-
/**
|
|
5847
|
-
* IDs of customer segments this product targets.
|
|
5848
|
-
* Each id must reference a declared `customers.segments[].id`.
|
|
5849
|
-
* Cross-reference enforced in `OrganizationModelSchema.superRefine()`.
|
|
5850
|
-
*/
|
|
5851
|
-
targetSegmentIds: z.array(z.string().trim().min(1)).default([]),
|
|
5852
|
-
/**
|
|
5853
|
-
* Optional: ID of the platform system responsible for delivering this product.
|
|
5854
|
-
* When present, must reference a declared `systems.systems[].id`.
|
|
5855
|
-
* Cross-reference enforced in `OrganizationModelSchema.superRefine()`.
|
|
5856
|
-
*/
|
|
5857
|
-
deliveryFeatureId: z.string().trim().min(1).optional()
|
|
5858
|
-
});
|
|
5859
|
-
var OfferingsDomainSchema = z.record(z.string(), ProductSchema).refine((record) => Object.entries(record).every(([key, entry]) => entry.id === key), {
|
|
5860
|
-
message: "Each product entry id must match its map key"
|
|
5861
|
-
}).default({});
|
|
5862
|
-
var DEFAULT_ORGANIZATION_MODEL_OFFERINGS = {};
|
|
5863
|
-
var ContentNodeBaseSchema = z.object({
|
|
5864
|
-
/** Human-readable label for the content node. */
|
|
5865
|
-
label: z.string().trim().min(1).max(120).meta({ label: "Label" }),
|
|
5866
|
-
/** Optional one-paragraph description. */
|
|
5867
|
-
description: z.string().trim().min(1).max(2e3).optional().meta({ label: "Description" }),
|
|
5868
|
-
/** Optional display order within the system content map. */
|
|
5869
|
-
order: z.number().int().optional().meta({ label: "Order" }),
|
|
5870
|
-
/**
|
|
5871
|
-
* Local NodeId of the parent content node within the SAME system.
|
|
5872
|
-
* Per B4/L9: MUST resolve to a sibling in the same `system.content` map.
|
|
5873
|
-
* Per L19: parent and child MUST share the same `kind` (meta-category).
|
|
5874
|
-
*/
|
|
5875
|
-
parentContentId: z.string().trim().min(1).max(200).optional().meta({ label: "Parent content id" })
|
|
5876
|
-
});
|
|
5877
|
-
var ContentNodeSchema = ContentNodeBaseSchema.extend({
|
|
5878
|
-
/** Meta-category (e.g. 'schema', 'config', 'knowledge', tenant-defined). */
|
|
5879
|
-
kind: z.string().trim().min(1).max(100).meta({ label: "Kind" }),
|
|
5880
|
-
/** Specific family within the meta-category (e.g. 'pipeline', 'kv'). */
|
|
5881
|
-
type: z.string().trim().min(1).max(100).meta({ label: "Type" }),
|
|
5882
|
-
/** Payload data; validated against registered payloadSchema when (kind, type) is known. */
|
|
5883
|
-
data: z.record(z.string(), z.unknown()).optional().meta({ label: "Data" })
|
|
5884
|
-
});
|
|
5885
|
-
z.object({
|
|
5886
|
-
/** Meta-category (tenant-defined or registry-shipped). */
|
|
5887
|
-
kind: z.string().trim().min(1).max(100).meta({ label: "Kind" }),
|
|
5888
|
-
/** Specific family within the meta-category. */
|
|
5889
|
-
type: z.string().trim().min(1).max(100).meta({ label: "Type" }),
|
|
5890
|
-
/** Human-readable label shown in the KB tree and describe views. */
|
|
5891
|
-
label: z.string().trim().min(1).max(120).meta({ label: "Label" }),
|
|
5892
|
-
/** Optional description. */
|
|
5893
|
-
description: z.string().trim().min(1).max(2e3).optional().meta({ label: "Description" }),
|
|
5894
|
-
/**
|
|
5895
|
-
* Which KB tree group this extension renders in.
|
|
5896
|
-
* Per L6: 'business-model' places it alongside Customers / Offerings / Goals.
|
|
5897
|
-
*/
|
|
5898
|
-
treeGroup: z.union([z.enum(["profile", "business-model", "systems", "graph", "governance-wiring"]), z.string().min(1).max(100)]).meta({ label: "Tree group" }),
|
|
5899
|
-
/** Untyped payload; shape governed by the registered payloadSchema when available. */
|
|
5900
|
-
data: z.record(z.string(), z.unknown()).optional().meta({ label: "Data" })
|
|
5901
|
-
});
|
|
5902
|
-
var OntologyKindSchema = z.enum([
|
|
5903
|
-
"object",
|
|
5904
|
-
"link",
|
|
5905
|
-
"action",
|
|
5906
|
-
"catalog",
|
|
5907
|
-
"event",
|
|
5908
|
-
"interface",
|
|
5909
|
-
"value-type",
|
|
5910
|
-
"property",
|
|
5911
|
-
"group",
|
|
5912
|
-
"surface"
|
|
5913
|
-
]);
|
|
5914
|
-
var SYSTEM_PATH_PATTERN = "[a-z0-9][a-z0-9-]*(?:\\.[a-z0-9][a-z0-9-]*)*";
|
|
5915
|
-
var LOCAL_ID_PATTERN = "[a-z0-9][a-z0-9._-]*";
|
|
5916
|
-
var ONTOLOGY_ID_PATTERN = `^(global|${SYSTEM_PATH_PATTERN}):(${OntologyKindSchema.options.join("|")})\\/(${LOCAL_ID_PATTERN})$`;
|
|
5917
|
-
var ONTOLOGY_ID_REGEX = new RegExp(ONTOLOGY_ID_PATTERN);
|
|
5918
|
-
var OntologyIdSchema = z.string().trim().min(1).max(300).regex(
|
|
5919
|
-
ONTOLOGY_ID_REGEX,
|
|
5920
|
-
"Ontology IDs must use <system-path>:<kind>/<local-id> or global:<kind>/<local-id>"
|
|
5921
|
-
);
|
|
5922
|
-
function parseOntologyId(id) {
|
|
5923
|
-
const normalized = OntologyIdSchema.parse(id);
|
|
5924
|
-
const match = ONTOLOGY_ID_REGEX.exec(normalized);
|
|
5925
|
-
if (match === null) {
|
|
5926
|
-
throw new Error(`Invalid ontology ID "${id}"`);
|
|
5927
|
-
}
|
|
5928
|
-
return {
|
|
5929
|
-
id: normalized,
|
|
5930
|
-
scope: match[1],
|
|
5931
|
-
kind: match[2],
|
|
5932
|
-
localId: match[3],
|
|
5933
|
-
isGlobal: match[1] === "global"
|
|
5934
|
-
};
|
|
5935
|
-
}
|
|
5936
|
-
function formatOntologyId(input) {
|
|
5937
|
-
return OntologyIdSchema.parse(`${input.scope}:${input.kind}/${input.localId}`);
|
|
5938
|
-
}
|
|
5939
|
-
var OntologyReferenceListSchema = z.array(OntologyIdSchema).default([]).optional();
|
|
5940
|
-
var OntologyRecordBaseSchema = z.object({
|
|
5941
|
-
id: OntologyIdSchema,
|
|
5942
|
-
label: z.string().trim().min(1).max(160).optional(),
|
|
5943
|
-
description: z.string().trim().min(1).max(2e3).optional(),
|
|
5944
|
-
ownerSystemId: z.string().trim().min(1).max(200).optional(),
|
|
5945
|
-
aliases: z.array(OntologyIdSchema).optional()
|
|
5946
|
-
}).passthrough();
|
|
5947
|
-
var OntologyObjectTypeSchema = OntologyRecordBaseSchema.extend({
|
|
5948
|
-
properties: z.record(z.string().trim().min(1).max(200), z.unknown()).optional(),
|
|
5949
|
-
storage: z.record(z.string(), z.unknown()).optional()
|
|
5950
|
-
});
|
|
5951
|
-
var OntologyLinkTypeSchema = OntologyRecordBaseSchema.extend({
|
|
5952
|
-
from: OntologyIdSchema,
|
|
5953
|
-
to: OntologyIdSchema,
|
|
5954
|
-
cardinality: z.string().trim().min(1).max(80).optional(),
|
|
5955
|
-
via: z.string().trim().min(1).max(255).optional()
|
|
5956
|
-
});
|
|
5957
|
-
var OntologyActionTypeSchema = OntologyRecordBaseSchema.extend({
|
|
5958
|
-
actsOn: OntologyReferenceListSchema,
|
|
5959
|
-
input: z.record(z.string().trim().min(1).max(200), z.unknown()).optional(),
|
|
5960
|
-
effects: z.array(z.record(z.string(), z.unknown())).optional()
|
|
5961
|
-
});
|
|
5962
|
-
var OntologyCatalogTypeSchema = OntologyRecordBaseSchema.extend({
|
|
5963
|
-
kind: z.string().trim().min(1).max(120).optional(),
|
|
5964
|
-
appliesTo: OntologyIdSchema.optional(),
|
|
5965
|
-
entries: z.record(z.string().trim().min(1).max(200), z.unknown()).optional()
|
|
5966
|
-
});
|
|
5967
|
-
var OntologyEventTypeSchema = OntologyRecordBaseSchema.extend({
|
|
5968
|
-
payload: z.record(z.string().trim().min(1).max(200), z.unknown()).optional()
|
|
5969
|
-
});
|
|
5970
|
-
var OntologyInterfaceTypeSchema = OntologyRecordBaseSchema.extend({
|
|
5971
|
-
properties: z.record(z.string().trim().min(1).max(200), z.unknown()).optional()
|
|
5972
|
-
});
|
|
5973
|
-
var OntologyValueTypeSchema = OntologyRecordBaseSchema.extend({
|
|
5974
|
-
primitive: z.string().trim().min(1).max(120).optional()
|
|
5975
|
-
});
|
|
5976
|
-
var OntologySharedPropertySchema = OntologyRecordBaseSchema.extend({
|
|
5977
|
-
valueType: OntologyIdSchema.optional(),
|
|
5978
|
-
searchable: z.boolean().optional(),
|
|
5979
|
-
pii: z.boolean().optional()
|
|
5980
|
-
});
|
|
5981
|
-
var OntologyGroupSchema = OntologyRecordBaseSchema.extend({
|
|
5982
|
-
members: OntologyReferenceListSchema
|
|
5983
|
-
});
|
|
5984
|
-
var OntologySurfaceTypeSchema = OntologyRecordBaseSchema.extend({
|
|
5985
|
-
route: z.string().trim().min(1).max(500).optional()
|
|
5986
|
-
});
|
|
5987
|
-
var OntologyScopeSchema = z.object({
|
|
5988
|
-
objectTypes: z.record(OntologyIdSchema, OntologyObjectTypeSchema).default({}).optional(),
|
|
5989
|
-
linkTypes: z.record(OntologyIdSchema, OntologyLinkTypeSchema).default({}).optional(),
|
|
5990
|
-
actionTypes: z.record(OntologyIdSchema, OntologyActionTypeSchema).default({}).optional(),
|
|
5991
|
-
catalogTypes: z.record(OntologyIdSchema, OntologyCatalogTypeSchema).default({}).optional(),
|
|
5992
|
-
eventTypes: z.record(OntologyIdSchema, OntologyEventTypeSchema).default({}).optional(),
|
|
5993
|
-
interfaceTypes: z.record(OntologyIdSchema, OntologyInterfaceTypeSchema).default({}).optional(),
|
|
5994
|
-
valueTypes: z.record(OntologyIdSchema, OntologyValueTypeSchema).default({}).optional(),
|
|
5995
|
-
sharedProperties: z.record(OntologyIdSchema, OntologySharedPropertySchema).default({}).optional(),
|
|
5996
|
-
groups: z.record(OntologyIdSchema, OntologyGroupSchema).default({}).optional(),
|
|
5997
|
-
surfaces: z.record(OntologyIdSchema, OntologySurfaceTypeSchema).default({}).optional()
|
|
5998
|
-
}).default({});
|
|
5999
|
-
var DEFAULT_ONTOLOGY_SCOPE = {
|
|
6000
|
-
valueTypes: {
|
|
6001
|
-
"global:value-type/uuid": {
|
|
6002
|
-
id: "global:value-type/uuid",
|
|
6003
|
-
label: "UUID",
|
|
6004
|
-
primitive: "string"
|
|
6005
|
-
},
|
|
6006
|
-
"global:value-type/text": {
|
|
6007
|
-
id: "global:value-type/text",
|
|
6008
|
-
label: "Text",
|
|
6009
|
-
primitive: "string"
|
|
6010
|
-
},
|
|
6011
|
-
"global:value-type/url": {
|
|
6012
|
-
id: "global:value-type/url",
|
|
6013
|
-
label: "URL",
|
|
6014
|
-
primitive: "string"
|
|
6015
|
-
},
|
|
6016
|
-
"global:value-type/email": {
|
|
6017
|
-
id: "global:value-type/email",
|
|
6018
|
-
label: "Email",
|
|
6019
|
-
primitive: "string"
|
|
6020
|
-
}
|
|
6021
|
-
}
|
|
6022
|
-
};
|
|
6023
|
-
var SCOPE_KIND = {
|
|
6024
|
-
objectTypes: "object",
|
|
6025
|
-
linkTypes: "link",
|
|
6026
|
-
actionTypes: "action",
|
|
6027
|
-
catalogTypes: "catalog",
|
|
6028
|
-
eventTypes: "event",
|
|
6029
|
-
interfaceTypes: "interface",
|
|
6030
|
-
valueTypes: "value-type",
|
|
6031
|
-
sharedProperties: "property",
|
|
6032
|
-
groups: "group",
|
|
6033
|
-
surfaces: "surface"
|
|
6034
|
-
};
|
|
6035
|
-
var SCOPE_KEYS = Object.keys(SCOPE_KIND);
|
|
6036
|
-
function listResolvedOntologyRecords(index) {
|
|
6037
|
-
return SCOPE_KEYS.flatMap((scopeKey) => {
|
|
6038
|
-
const kind = SCOPE_KIND[scopeKey];
|
|
6039
|
-
return Object.entries(index[scopeKey]).sort(([leftId], [rightId]) => leftId.localeCompare(rightId)).map(([id, record]) => ({
|
|
6040
|
-
id,
|
|
6041
|
-
kind,
|
|
6042
|
-
record
|
|
6043
|
-
}));
|
|
6044
|
-
});
|
|
6045
|
-
}
|
|
6046
|
-
function originFromContext(context) {
|
|
6047
|
-
return {
|
|
6048
|
-
kind: context.kind,
|
|
6049
|
-
source: context.source,
|
|
6050
|
-
path: context.path,
|
|
6051
|
-
...context.systemPath !== void 0 ? { systemPath: context.systemPath } : {},
|
|
6052
|
-
...context.legacyId !== void 0 ? { legacyId: context.legacyId } : {}
|
|
6053
|
-
};
|
|
6054
|
-
}
|
|
6055
|
-
function createEmptyIndex() {
|
|
6056
|
-
return {
|
|
6057
|
-
objectTypes: {},
|
|
6058
|
-
linkTypes: {},
|
|
6059
|
-
actionTypes: {},
|
|
6060
|
-
catalogTypes: {},
|
|
6061
|
-
eventTypes: {},
|
|
6062
|
-
interfaceTypes: {},
|
|
6063
|
-
valueTypes: {},
|
|
6064
|
-
sharedProperties: {},
|
|
6065
|
-
groups: {},
|
|
6066
|
-
surfaces: {}
|
|
6067
|
-
};
|
|
6068
|
-
}
|
|
6069
|
-
function sortResolvedOntologyIndex(index) {
|
|
6070
|
-
const sorted = createEmptyIndex();
|
|
6071
|
-
for (const scopeKey of SCOPE_KEYS) {
|
|
6072
|
-
const target = sorted[scopeKey];
|
|
6073
|
-
for (const [id, record] of Object.entries(index[scopeKey]).sort(
|
|
6074
|
-
([leftId], [rightId]) => leftId.localeCompare(rightId)
|
|
6075
|
-
)) {
|
|
6076
|
-
target[id] = record;
|
|
6077
|
-
}
|
|
6078
|
-
}
|
|
6079
|
-
return sorted;
|
|
6080
|
-
}
|
|
6081
|
-
function childSystemsOf(system) {
|
|
6082
|
-
return system.systems ?? system.subsystems ?? {};
|
|
6083
|
-
}
|
|
6084
|
-
function addRecord(index, diagnostics, sourcesById, scopeKey, record, context) {
|
|
6085
|
-
let parsed;
|
|
6086
|
-
try {
|
|
6087
|
-
parsed = parseOntologyId(record.id);
|
|
6088
|
-
} catch {
|
|
6089
|
-
diagnostics.push({
|
|
6090
|
-
code: "invalid_ontology_id",
|
|
6091
|
-
message: `Invalid ontology ID "${record.id}" from ${context.source} at ${context.path.join(".")}`,
|
|
6092
|
-
id: record.id,
|
|
6093
|
-
path: context.path,
|
|
6094
|
-
source: context.source,
|
|
6095
|
-
origin: originFromContext(context)
|
|
6096
|
-
});
|
|
6097
|
-
return;
|
|
6098
|
-
}
|
|
6099
|
-
const expectedKind = SCOPE_KIND[scopeKey];
|
|
6100
|
-
if (parsed.kind !== expectedKind) {
|
|
6101
|
-
diagnostics.push({
|
|
6102
|
-
code: "ontology_kind_mismatch",
|
|
6103
|
-
message: `Ontology ID "${record.id}" has kind "${parsed.kind}" but was authored in ${scopeKey} (${expectedKind}) at ${context.path.join(".")}`,
|
|
6104
|
-
id: record.id,
|
|
6105
|
-
path: context.path,
|
|
6106
|
-
source: context.source,
|
|
6107
|
-
origin: originFromContext(context)
|
|
6108
|
-
});
|
|
6109
|
-
return;
|
|
6110
|
-
}
|
|
6111
|
-
const existing = sourcesById.get(parsed.id);
|
|
6112
|
-
if (existing !== void 0) {
|
|
6113
|
-
diagnostics.push({
|
|
6114
|
-
code: "duplicate_ontology_id",
|
|
6115
|
-
message: `Duplicate ontology ID "${parsed.id}" from ${context.source} at ${context.path.join(".")} conflicts with ${existing.source} at ${existing.path.join(".")}`,
|
|
6116
|
-
id: parsed.id,
|
|
6117
|
-
path: context.path,
|
|
6118
|
-
source: context.source,
|
|
6119
|
-
origin: originFromContext(context),
|
|
6120
|
-
existingSource: existing.source,
|
|
6121
|
-
existingOrigin: originFromContext(existing)
|
|
6122
|
-
});
|
|
6123
|
-
return;
|
|
6124
|
-
}
|
|
6125
|
-
sourcesById.set(parsed.id, context);
|
|
6126
|
-
index[scopeKey][parsed.id] = {
|
|
6127
|
-
...record,
|
|
6128
|
-
origin: originFromContext(context)
|
|
6129
|
-
};
|
|
6130
|
-
}
|
|
6131
|
-
function addScope(index, diagnostics, sourcesById, scope, source, path) {
|
|
6132
|
-
if (scope === void 0) return;
|
|
6133
|
-
for (const scopeKey of SCOPE_KEYS) {
|
|
6134
|
-
const records = scope[scopeKey] ?? {};
|
|
6135
|
-
for (const [key, record] of Object.entries(records)) {
|
|
6136
|
-
addRecord(index, diagnostics, sourcesById, scopeKey, record, {
|
|
6137
|
-
source,
|
|
6138
|
-
path: [...path, scopeKey, key],
|
|
6139
|
-
kind: "authored",
|
|
6140
|
-
systemPath: source.startsWith("system:") ? source.slice("system:".length, -".ontology".length) : void 0
|
|
6141
|
-
});
|
|
6142
|
-
}
|
|
6143
|
-
}
|
|
6144
|
-
}
|
|
6145
|
-
function legacyObjectId(entity) {
|
|
6146
|
-
return formatOntologyId({ scope: entity.ownedBySystemId, kind: "object", localId: entity.id });
|
|
6147
|
-
}
|
|
6148
|
-
function legacyActionOwner(action, entities) {
|
|
6149
|
-
const firstAffectedEntityId = action.affects?.find((entityId) => entities[entityId] !== void 0);
|
|
6150
|
-
if (firstAffectedEntityId !== void 0) {
|
|
6151
|
-
return entities[firstAffectedEntityId].ownedBySystemId;
|
|
6152
|
-
}
|
|
6153
|
-
if (typeof action.scope === "object") {
|
|
6154
|
-
return action.scope.domain;
|
|
6155
|
-
}
|
|
6156
|
-
return "global";
|
|
6157
|
-
}
|
|
6158
|
-
function addLegacyEntityProjections(index, diagnostics, sourcesById, entities) {
|
|
6159
|
-
for (const entity of Object.values(entities)) {
|
|
6160
|
-
const objectType = {
|
|
6161
|
-
id: legacyObjectId(entity),
|
|
6162
|
-
label: entity.label,
|
|
6163
|
-
description: entity.description,
|
|
6164
|
-
ownerSystemId: entity.ownedBySystemId,
|
|
6165
|
-
...entity.table !== void 0 ? {
|
|
6166
|
-
storage: {
|
|
6167
|
-
kind: "table",
|
|
6168
|
-
table: entity.table
|
|
6169
|
-
}
|
|
6170
|
-
} : {},
|
|
6171
|
-
...entity.rowSchema !== void 0 ? { rowSchema: entity.rowSchema } : {},
|
|
6172
|
-
...entity.stateCatalogId !== void 0 ? { stateCatalogId: entity.stateCatalogId } : {}
|
|
6173
|
-
};
|
|
6174
|
-
addRecord(index, diagnostics, sourcesById, "objectTypes", objectType, {
|
|
6175
|
-
source: "legacy.entities",
|
|
6176
|
-
path: ["entities", entity.id],
|
|
6177
|
-
kind: "projected",
|
|
6178
|
-
systemPath: entity.ownedBySystemId,
|
|
6179
|
-
legacyId: entity.id
|
|
6180
|
-
});
|
|
6181
|
-
entity.links?.forEach((link, linkIndex) => {
|
|
6182
|
-
const targetEntity = entities[link.toEntity];
|
|
6183
|
-
if (targetEntity === void 0) return;
|
|
6184
|
-
const linkType = {
|
|
6185
|
-
id: formatOntologyId({
|
|
6186
|
-
scope: entity.ownedBySystemId,
|
|
6187
|
-
kind: "link",
|
|
6188
|
-
localId: `${entity.id}-${link.toEntity}-${linkIndex}`
|
|
6189
|
-
}),
|
|
6190
|
-
label: link.label ?? link.kind,
|
|
6191
|
-
ownerSystemId: entity.ownedBySystemId,
|
|
6192
|
-
from: legacyObjectId(entity),
|
|
6193
|
-
to: legacyObjectId(targetEntity),
|
|
6194
|
-
cardinality: link.kind,
|
|
6195
|
-
...link.via !== void 0 ? { via: link.via } : {}
|
|
6196
|
-
};
|
|
6197
|
-
addRecord(index, diagnostics, sourcesById, "linkTypes", linkType, {
|
|
6198
|
-
source: "legacy.entities.links",
|
|
6199
|
-
path: ["entities", entity.id, "links", linkIndex],
|
|
6200
|
-
kind: "projected",
|
|
6201
|
-
systemPath: entity.ownedBySystemId,
|
|
6202
|
-
legacyId: `${entity.id}.links.${linkIndex}`
|
|
6203
|
-
});
|
|
6204
|
-
});
|
|
6205
|
-
}
|
|
6206
|
-
}
|
|
6207
|
-
function addLegacyActionProjections(index, diagnostics, sourcesById, actions, entities) {
|
|
6208
|
-
for (const action of Object.values(actions)) {
|
|
6209
|
-
const ownerSystemId = legacyActionOwner(action, entities);
|
|
6210
|
-
const actionType = {
|
|
6211
|
-
id: formatOntologyId({ scope: ownerSystemId, kind: "action", localId: action.id }),
|
|
6212
|
-
label: action.label,
|
|
6213
|
-
description: action.description,
|
|
6214
|
-
ownerSystemId,
|
|
6215
|
-
actsOn: action.affects?.map((entityId) => entities[entityId] ? legacyObjectId(entities[entityId]) : void 0).filter((id) => id !== void 0),
|
|
6216
|
-
...action.resourceId !== void 0 ? { resourceId: action.resourceId } : {},
|
|
6217
|
-
...action.invocations !== void 0 ? { invocations: action.invocations } : {},
|
|
6218
|
-
...action.lifecycle !== void 0 ? { lifecycle: action.lifecycle } : {},
|
|
6219
|
-
legacyActionId: action.id
|
|
6220
|
-
};
|
|
6221
|
-
addRecord(index, diagnostics, sourcesById, "actionTypes", actionType, {
|
|
6222
|
-
source: "legacy.actions",
|
|
6223
|
-
path: ["actions", action.id],
|
|
6224
|
-
kind: "projected",
|
|
6225
|
-
systemPath: ownerSystemId,
|
|
6226
|
-
legacyId: action.id
|
|
6227
|
-
});
|
|
6228
|
-
}
|
|
6229
|
-
}
|
|
6230
|
-
function addSystemContentProjections(index, diagnostics, sourcesById, systemPath, system, schemaPath) {
|
|
6231
|
-
const content = system.content ?? {};
|
|
6232
|
-
for (const [localId, node] of Object.entries(content)) {
|
|
6233
|
-
if (node.kind !== "schema") continue;
|
|
6234
|
-
const entries = Object.fromEntries(
|
|
6235
|
-
Object.entries(content).filter(([, candidate]) => candidate.parentContentId === localId).map(([entryId, candidate]) => [
|
|
6236
|
-
entryId,
|
|
6237
|
-
{
|
|
6238
|
-
label: candidate.label ?? entryId,
|
|
6239
|
-
type: candidate.type,
|
|
6240
|
-
...candidate.description !== void 0 ? { description: candidate.description } : {},
|
|
6241
|
-
...candidate.data !== void 0 ? candidate.data : {}
|
|
6242
|
-
}
|
|
6243
|
-
])
|
|
6244
|
-
);
|
|
6245
|
-
const catalogType = {
|
|
6246
|
-
id: formatOntologyId({ scope: systemPath, kind: "catalog", localId }),
|
|
6247
|
-
label: node.label ?? localId,
|
|
6248
|
-
description: node.description,
|
|
6249
|
-
ownerSystemId: systemPath,
|
|
6250
|
-
kind: node.type,
|
|
6251
|
-
...typeof node.data?.["entityId"] === "string" ? { appliesTo: formatOntologyId({ scope: systemPath, kind: "object", localId: node.data["entityId"] }) } : {},
|
|
6252
|
-
...Object.keys(entries).length > 0 ? { entries } : {},
|
|
6253
|
-
...node.data !== void 0 ? { data: node.data } : {}
|
|
6254
|
-
};
|
|
6255
|
-
addRecord(index, diagnostics, sourcesById, "catalogTypes", catalogType, {
|
|
6256
|
-
source: "legacy.system.content",
|
|
6257
|
-
path: [...schemaPath, "content", localId],
|
|
6258
|
-
kind: "projected",
|
|
6259
|
-
systemPath,
|
|
6260
|
-
legacyId: `${systemPath}:${localId}`
|
|
6261
|
-
});
|
|
6262
|
-
}
|
|
6263
|
-
}
|
|
6264
|
-
function addSystemScopes(index, diagnostics, sourcesById, systems, prefix, schemaPath) {
|
|
6265
|
-
for (const [key, system] of Object.entries(systems)) {
|
|
6266
|
-
const systemPath = prefix ? `${prefix}.${key}` : key;
|
|
6267
|
-
const currentPath = [...schemaPath, key];
|
|
6268
|
-
addScope(index, diagnostics, sourcesById, system.ontology, `system:${systemPath}.ontology`, [
|
|
6269
|
-
...currentPath,
|
|
6270
|
-
"ontology"
|
|
6271
|
-
]);
|
|
6272
|
-
addSystemContentProjections(index, diagnostics, sourcesById, systemPath, system, currentPath);
|
|
6273
|
-
addSystemScopes(index, diagnostics, sourcesById, childSystemsOf(system), systemPath, [
|
|
6274
|
-
...currentPath,
|
|
6275
|
-
system.systems !== void 0 ? "systems" : "subsystems"
|
|
6276
|
-
]);
|
|
6277
|
-
}
|
|
6278
|
-
}
|
|
6279
|
-
function compileOrganizationOntology(model) {
|
|
6280
|
-
const ontology = createEmptyIndex();
|
|
6281
|
-
const diagnostics = [];
|
|
6282
|
-
const sourcesById = /* @__PURE__ */ new Map();
|
|
6283
|
-
addScope(ontology, diagnostics, sourcesById, model.ontology, "organization.ontology", ["ontology"]);
|
|
6284
|
-
addSystemScopes(ontology, diagnostics, sourcesById, model.systems ?? {}, "", ["systems"]);
|
|
6285
|
-
addLegacyEntityProjections(ontology, diagnostics, sourcesById, model.entities ?? {});
|
|
6286
|
-
addLegacyActionProjections(ontology, diagnostics, sourcesById, model.actions ?? {}, model.entities ?? {});
|
|
6287
|
-
return { ontology: sortResolvedOntologyIndex(ontology), diagnostics };
|
|
6288
|
-
}
|
|
6289
|
-
|
|
6290
|
-
// ../core/src/organization-model/domains/systems.ts
|
|
6291
|
-
var SystemKindSchema = z.enum(["product", "operational", "platform", "diagnostic"]).meta({ label: "System kind", color: "blue" });
|
|
6292
|
-
var SystemLifecycleSchema = z.enum(["draft", "beta", "active", "deprecated", "archived"]).meta({ label: "Lifecycle", color: "teal" });
|
|
6293
|
-
var SystemStatusSchema = z.enum(["active", "deprecated", "archived"]).meta({ label: "Status", color: "teal" });
|
|
6294
|
-
var SystemIdSchema = ModelIdSchema;
|
|
6295
|
-
var SystemPathSchema = z.string().trim().min(1).regex(
|
|
6296
|
-
/^[a-z0-9][a-z0-9-]*(?:\.[a-z0-9][a-z0-9-]*)*$/,
|
|
6297
|
-
'must be a dotted lowercase path (e.g. "sales.lead-gen" or "sales.crm")'
|
|
6298
|
-
);
|
|
6299
|
-
var UiPositionSchema = z.enum(["sidebar-primary", "sidebar-bottom"]).meta({ label: "UI position" });
|
|
6300
|
-
var NodeIdStringSchema = z.string().trim().min(1).max(200).regex(
|
|
6301
|
-
/^[a-z][a-z-]*:([a-z0-9-]+)(\.[a-z0-9-]+)*(:[a-z0-9.-]+)*$/,
|
|
6302
|
-
"Node references must use kind:dotted-path (e.g. system:sales.crm or content-node:sales.crm:pipeline-id)"
|
|
6303
|
-
);
|
|
6304
|
-
var SystemUiSchema = z.object({
|
|
6305
|
-
path: PathSchema,
|
|
6306
|
-
surfaces: ReferenceIdsSchema,
|
|
6307
|
-
icon: IconNameSchema.optional(),
|
|
6308
|
-
order: z.number().int().optional()
|
|
6309
|
-
});
|
|
6310
|
-
var JsonValueSchema = z.lazy(
|
|
6311
|
-
() => z.union([
|
|
6312
|
-
z.string(),
|
|
6313
|
-
z.number(),
|
|
6314
|
-
z.boolean(),
|
|
6315
|
-
z.null(),
|
|
6316
|
-
z.array(JsonValueSchema),
|
|
6317
|
-
z.record(z.string(), JsonValueSchema)
|
|
6318
|
-
])
|
|
6319
|
-
);
|
|
6320
|
-
var SystemConfigSchema = z.record(z.string().trim().min(1).max(200), JsonValueSchema).default({}).optional();
|
|
6321
|
-
var SystemEntrySchema = z.object({
|
|
6322
|
-
/** Stable tenant-defined system id (e.g. "sys.lead-gen" or "sales.crm"). */
|
|
6323
|
-
id: SystemIdSchema,
|
|
6324
|
-
/** Human-readable system label shown in UI, governance, and operations surfaces. */
|
|
6325
|
-
label: LabelSchema.optional(),
|
|
6326
|
-
/** @deprecated Use label. Accepted for pre-consolidation System declarations. */
|
|
6327
|
-
title: LabelSchema.optional(),
|
|
6328
|
-
/** One-paragraph purpose statement for the bounded context. */
|
|
6329
|
-
description: DescriptionSchema.optional(),
|
|
6330
|
-
/** Closed system shape enum; catalog values remain tenant-defined. */
|
|
6331
|
-
kind: SystemKindSchema.optional(),
|
|
6332
|
-
/** Optional self-reference for System hierarchy. */
|
|
6333
|
-
parentSystemId: SystemIdSchema.optional(),
|
|
6334
|
-
/** Optional UI presence. Systems without UI omit this. */
|
|
6335
|
-
ui: SystemUiSchema.optional(),
|
|
6336
|
-
/** Canonical lifecycle state. Replaces Feature.enabled/devOnly and System.status. */
|
|
6337
|
-
lifecycle: SystemLifecycleSchema.optional(),
|
|
6338
|
-
/** Optional role responsible for this system. */
|
|
6339
|
-
responsibleRoleId: ModelIdSchema.meta({ ref: "role" }).optional(),
|
|
6340
|
-
/** Optional knowledge nodes that govern this system. */
|
|
6341
|
-
governedByKnowledge: z.array(ModelIdSchema.meta({ ref: "knowledge" })).default([]).optional(),
|
|
6342
|
-
/** Optional actions this system exposes or consumes. */
|
|
6343
|
-
actions: z.array(ActionRefSchema).optional(),
|
|
6344
|
-
/** Optional operational policies that apply to this system. */
|
|
6345
|
-
policies: z.array(ModelIdSchema.meta({ ref: "policy" })).default([]).optional(),
|
|
6346
|
-
/** Optional goals this system contributes to. */
|
|
6347
|
-
drivesGoals: z.array(ModelIdSchema.meta({ ref: "goal" })).default([]).optional(),
|
|
6348
|
-
/** @deprecated Use lifecycle. Accepted for one publish cycle. */
|
|
6349
|
-
status: SystemStatusSchema.optional(),
|
|
6350
|
-
/** @deprecated Use ui.path. Kept for one-cycle Feature compatibility. */
|
|
6351
|
-
path: PathSchema.optional(),
|
|
6352
|
-
/** @deprecated Use ui.icon. Kept for one-cycle Feature compatibility. */
|
|
6353
|
-
icon: IconNameSchema.optional(),
|
|
6354
|
-
/** @deprecated Feature color token, retained for one-cycle compatibility. */
|
|
6355
|
-
color: ColorTokenSchema.optional(),
|
|
6356
|
-
/** @deprecated UI placement hint, retained for one-cycle compatibility. */
|
|
6357
|
-
uiPosition: UiPositionSchema.optional(),
|
|
6358
|
-
/** @deprecated Use lifecycle. */
|
|
6359
|
-
enabled: z.boolean().optional(),
|
|
6360
|
-
/** @deprecated Use lifecycle: "beta". */
|
|
6361
|
-
devOnly: z.boolean().optional(),
|
|
6362
|
-
requiresAdmin: z.boolean().optional(),
|
|
6363
|
-
/** Domain-map iteration order. Convention: multiples of 10 (10, 20, 30, ...) to allow easy insertion. */
|
|
6364
|
-
order: z.number(),
|
|
6365
|
-
/**
|
|
6366
|
-
* System-local JSON settings and defaults. Strongly typed OM fields,
|
|
6367
|
-
* secrets, credentials, and runtime state stay outside this bucket.
|
|
6368
|
-
*/
|
|
6369
|
-
config: SystemConfigSchema,
|
|
6370
|
-
/**
|
|
6371
|
-
* System-owned ontology declarations. `systems` is now the canonical child
|
|
6372
|
-
* key; this scope holds the object, action, catalog, link, event, and
|
|
6373
|
-
* shared contract records owned by this system.
|
|
6374
|
-
*/
|
|
6375
|
-
ontology: OntologyScopeSchema.optional(),
|
|
6376
|
-
/**
|
|
6377
|
-
* @deprecated Compatibility-only bridge for old tenant content nodes and
|
|
6378
|
-
* migration readers. New schema/catalog authoring belongs in ontology;
|
|
6379
|
-
* new system-local settings belong in config. Bridge nodes are keyed by
|
|
6380
|
-
* local NodeId and may still project to content-node:* graph IDs.
|
|
6381
|
-
*/
|
|
6382
|
-
content: z.record(z.string().trim().min(1).max(200), ContentNodeSchema).optional(),
|
|
6383
|
-
/**
|
|
6384
|
-
* Recursive child systems, authored via nesting (per L11).
|
|
6385
|
-
* The key is the local system id; the full path is computed by joining
|
|
6386
|
-
* ancestor keys with `.` (e.g. parent key `'sales'` + child key `'crm'` → `'sales.crm'`).
|
|
6387
|
-
* Per Phase 4: `id` and `parentSystemId` fields will be removed in favour of
|
|
6388
|
-
* position-derived paths. Both still exist on this schema for backward compat.
|
|
6389
|
-
*/
|
|
6390
|
-
systems: z.lazy(() => z.record(z.string().trim().min(1).max(100), SystemEntrySchema)).optional(),
|
|
6391
|
-
/** @deprecated Use systems. Accepted as a compatibility alias during the ontology bridge. */
|
|
6392
|
-
subsystems: z.lazy(() => z.record(z.string().trim().min(1).max(100), SystemEntrySchema)).optional()
|
|
6393
|
-
}).refine((system) => system.label !== void 0 || system.title !== void 0, {
|
|
6394
|
-
path: ["label"],
|
|
6395
|
-
message: "System must provide label or title"
|
|
6396
|
-
}).transform((system) => {
|
|
6397
|
-
const normalizedSystem = system.systems !== void 0 && system.subsystems === void 0 ? { ...system, subsystems: system.systems } : system;
|
|
6398
|
-
if (normalizedSystem.status === void 0) return normalizedSystem;
|
|
6399
|
-
console.warn("[organization-model] System.status is deprecated; use System.lifecycle instead.");
|
|
6400
|
-
return normalizedSystem.lifecycle === void 0 ? { ...normalizedSystem, lifecycle: normalizedSystem.status } : normalizedSystem;
|
|
6401
|
-
});
|
|
6402
|
-
var SystemsDomainSchema = z.record(z.string(), SystemEntrySchema).refine((record) => Object.entries(record).every(([key, entry]) => entry.id === key), {
|
|
6403
|
-
message: "Each system entry id must match its map key"
|
|
6404
|
-
}).default({});
|
|
6405
|
-
var DEFAULT_ORGANIZATION_MODEL_SYSTEMS = {};
|
|
6406
|
-
|
|
6407
|
-
// ../core/src/organization-model/domains/resources.ts
|
|
6408
|
-
z.enum(["workflow", "agent", "integration", "script"]).meta({ label: "Resource kind", color: "orange" });
|
|
6409
|
-
var ResourceGovernanceStatusSchema = z.enum(["active", "deprecated", "archived"]).meta({ label: "Governance status", color: "teal" });
|
|
6410
|
-
var AgentKindSchema = z.enum(["orchestrator", "specialist", "utility", "platform"]).meta({ label: "Agent kind", color: "violet" });
|
|
6411
|
-
var ScriptResourceLanguageSchema = z.enum(["shell", "sql", "typescript", "python"]).meta({ label: "Language" });
|
|
6412
|
-
var CodeReferenceRoleSchema = z.enum(["entrypoint", "handler", "schema", "test", "docs", "config"]).meta({ label: "Code reference role", color: "blue" });
|
|
6413
|
-
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");
|
|
6414
|
-
var EventIdSchema = z.string().trim().min(1).max(300).regex(
|
|
6415
|
-
/^[A-Za-z0-9]+(?:[-._][A-Za-z0-9]+)*:[a-z0-9]+(?:[-._][a-z0-9]+)*$/,
|
|
6416
|
-
"Event IDs must use <owner-id>:<event-key>"
|
|
6417
|
-
);
|
|
6418
|
-
var EventKeySchema = ModelIdSchema;
|
|
6419
|
-
var EventEmissionDescriptorSchema = z.object({
|
|
6420
|
-
eventKey: EventKeySchema,
|
|
6421
|
-
label: z.string().trim().min(1).max(120),
|
|
6422
|
-
payloadSchema: ModelIdSchema.optional(),
|
|
6423
|
-
lifecycle: SystemLifecycleSchema.optional()
|
|
6424
|
-
});
|
|
6425
|
-
EventEmissionDescriptorSchema.extend({
|
|
6426
|
-
id: EventIdSchema,
|
|
6427
|
-
ownerId: z.union([ResourceIdSchema, ModelIdSchema]),
|
|
6428
|
-
ownerKind: z.enum(["resource", "entity"]).meta({ label: "Owner kind" })
|
|
6429
|
-
});
|
|
6430
|
-
var ResourceOntologyBindingSchema = z.object({
|
|
6431
|
-
actions: z.array(OntologyIdSchema).optional(),
|
|
6432
|
-
primaryAction: OntologyIdSchema.optional(),
|
|
6433
|
-
reads: z.array(OntologyIdSchema).optional(),
|
|
6434
|
-
writes: z.array(OntologyIdSchema).optional(),
|
|
6435
|
-
usesCatalogs: z.array(OntologyIdSchema).optional(),
|
|
6436
|
-
emits: z.array(OntologyIdSchema).optional()
|
|
6437
|
-
}).superRefine((binding, ctx) => {
|
|
6438
|
-
if (binding.primaryAction === void 0) return;
|
|
6439
|
-
if (binding.actions?.includes(binding.primaryAction)) return;
|
|
6440
|
-
ctx.addIssue({
|
|
6441
|
-
code: z.ZodIssueCode.custom,
|
|
6442
|
-
path: ["primaryAction"],
|
|
6443
|
-
message: "Resource ontology primaryAction must be included in actions"
|
|
6444
|
-
});
|
|
6445
|
-
});
|
|
6446
|
-
var CodeReferenceSchema = z.object({
|
|
6447
|
-
path: z.string().trim().min(1).max(500).regex(/^[A-Za-z0-9_./$@()[\] -]+$/, "Code reference paths must be repo-relative paths"),
|
|
6448
|
-
role: CodeReferenceRoleSchema,
|
|
6449
|
-
symbol: z.string().trim().min(1).max(200).optional(),
|
|
6450
|
-
description: z.string().trim().min(1).max(300).optional()
|
|
6451
|
-
});
|
|
6452
|
-
var ResourceEntryBaseSchema = z.object({
|
|
6453
|
-
/** Canonical resource id; runtime resourceId derives from this value. */
|
|
6454
|
-
id: ResourceIdSchema,
|
|
6455
|
-
/** Domain-map iteration order. Convention: multiples of 10 (10, 20, 30, ...) to allow easy insertion. */
|
|
6456
|
-
order: z.number().default(0),
|
|
6457
|
-
/** Required single System membership — value is a dot-separated system path (e.g. "sales.lead-gen"). */
|
|
6458
|
-
systemPath: SystemPathSchema.meta({ ref: "system" }),
|
|
6459
|
-
/** Executable display title owned by the OM Resource descriptor. */
|
|
6460
|
-
title: LabelSchema.optional(),
|
|
6461
|
-
/** Executable display description owned by the OM Resource descriptor. */
|
|
6462
|
-
description: DescriptionSchema.optional(),
|
|
6463
|
-
/** Optional role responsible for maintaining this resource. */
|
|
6464
|
-
ownerRoleId: ModelIdSchema.meta({ ref: "role" }).optional(),
|
|
6465
|
-
status: ResourceGovernanceStatusSchema,
|
|
6466
|
-
/**
|
|
6467
|
-
* Ontology contract bindings for the semantic work this resource performs.
|
|
6468
|
-
* `emits` stays nested here so top-level resource emits descriptors remain
|
|
6469
|
-
* compatible with graph event projection during the bridge.
|
|
6470
|
-
*/
|
|
6471
|
-
ontology: ResourceOntologyBindingSchema.optional(),
|
|
6472
|
-
/** Repo-relative implementation breadcrumbs for agents and operators. */
|
|
6473
|
-
codeRefs: z.array(CodeReferenceSchema).default([])
|
|
6474
|
-
});
|
|
6475
|
-
var WorkflowResourceEntrySchema = ResourceEntryBaseSchema.extend({
|
|
6476
|
-
kind: z.literal("workflow"),
|
|
6477
|
-
emits: z.array(EventEmissionDescriptorSchema).optional()
|
|
6478
|
-
});
|
|
6479
|
-
var AgentResourceEntrySchema = ResourceEntryBaseSchema.extend({
|
|
6480
|
-
kind: z.literal("agent"),
|
|
6481
|
-
/** Mirrors code-side AgentConfig.kind. */
|
|
6482
|
-
agentKind: AgentKindSchema,
|
|
6483
|
-
/** Role this agent embodies, if any. */
|
|
6484
|
-
actsAsRoleId: ModelIdSchema.meta({ ref: "role" }).optional(),
|
|
6485
|
-
/** Mirrors AgentConfig.sessionCapable. */
|
|
6486
|
-
sessionCapable: z.boolean(),
|
|
6487
|
-
/** Broad/composite callable entry points orchestrated by this agent. */
|
|
6488
|
-
invocations: z.array(ActionInvocationSchema).default([]),
|
|
6489
|
-
emits: z.array(EventEmissionDescriptorSchema).optional()
|
|
6490
|
-
});
|
|
6491
|
-
var IntegrationResourceEntrySchema = ResourceEntryBaseSchema.extend({
|
|
6492
|
-
kind: z.literal("integration"),
|
|
6493
|
-
provider: z.string().trim().min(1).max(100)
|
|
6494
|
-
});
|
|
6495
|
-
var ScriptResourceSourceSchema = z.union([
|
|
6496
|
-
z.string().trim().min(1).max(5e4),
|
|
6497
|
-
z.object({
|
|
6498
|
-
file: z.string().trim().min(1).max(500)
|
|
6499
|
-
})
|
|
6500
|
-
]);
|
|
6501
|
-
var ScriptResourceEntrySchema = ResourceEntryBaseSchema.extend({
|
|
6502
|
-
kind: z.literal("script"),
|
|
6503
|
-
language: ScriptResourceLanguageSchema,
|
|
6504
|
-
source: ScriptResourceSourceSchema
|
|
6505
|
-
});
|
|
6506
|
-
var ResourceEntrySchema = z.discriminatedUnion("kind", [
|
|
6507
|
-
WorkflowResourceEntrySchema,
|
|
6508
|
-
AgentResourceEntrySchema,
|
|
6509
|
-
IntegrationResourceEntrySchema,
|
|
6510
|
-
ScriptResourceEntrySchema
|
|
6511
|
-
]);
|
|
6512
|
-
var ResourcesDomainSchema = z.record(z.string(), ResourceEntrySchema).refine((record) => Object.entries(record).every(([key, entry]) => entry.id === key), {
|
|
6513
|
-
message: "Each resource entry id must match its map key"
|
|
6514
|
-
}).default({});
|
|
6515
|
-
var DEFAULT_ORGANIZATION_MODEL_RESOURCES = {};
|
|
6516
|
-
|
|
6517
|
-
// ../core/src/organization-model/domains/roles.ts
|
|
6518
|
-
var RoleIdSchema = ModelIdSchema;
|
|
6519
|
-
var HumanRoleHolderSchema = z.object({
|
|
6520
|
-
kind: z.literal("human"),
|
|
6521
|
-
userId: z.string().trim().min(1).max(200)
|
|
6522
|
-
});
|
|
6523
|
-
var AgentRoleHolderSchema = z.object({
|
|
6524
|
-
kind: z.literal("agent"),
|
|
6525
|
-
agentId: ResourceIdSchema.meta({ ref: "resource" })
|
|
6526
|
-
});
|
|
6527
|
-
var TeamRoleHolderSchema = z.object({
|
|
6528
|
-
kind: z.literal("team"),
|
|
6529
|
-
memberIds: z.array(z.string().trim().min(1).max(200)).min(1)
|
|
6530
|
-
});
|
|
6531
|
-
var RoleHolderSchema = z.discriminatedUnion("kind", [
|
|
6532
|
-
HumanRoleHolderSchema,
|
|
6533
|
-
AgentRoleHolderSchema,
|
|
6534
|
-
TeamRoleHolderSchema
|
|
6535
|
-
]);
|
|
6536
|
-
var RoleHoldersSchema = z.union([RoleHolderSchema, z.array(RoleHolderSchema).min(1)]);
|
|
6537
|
-
var RoleSchema = z.object({
|
|
6538
|
-
/** Stable unique identifier for the role (e.g. "role-ceo", "role-head-of-sales"). */
|
|
6539
|
-
id: RoleIdSchema,
|
|
6540
|
-
/** Domain-map iteration order. Convention: multiples of 10 (10, 20, 30, ...) to allow easy insertion. */
|
|
6541
|
-
order: z.number(),
|
|
6542
|
-
/** Human-readable title shown to agents and in UI (e.g. "CEO", "Head of Sales"). */
|
|
6543
|
-
title: z.string().trim().min(1).max(200),
|
|
6544
|
-
/**
|
|
6545
|
-
* List of responsibilities this role owns - plain-language descriptions of
|
|
6546
|
-
* what the person in this role is accountable for delivering.
|
|
6547
|
-
* Defaults to empty array so minimal role definitions stay concise.
|
|
6548
|
-
*/
|
|
6549
|
-
responsibilities: z.array(z.string().trim().max(500)).default([]),
|
|
6550
|
-
/**
|
|
6551
|
-
* Optional: ID of another role this role reports to.
|
|
6552
|
-
* When present, must reference another `roles[].id` in the same organization.
|
|
6553
|
-
*/
|
|
6554
|
-
reportsToId: RoleIdSchema.meta({ ref: "role" }).optional(),
|
|
6555
|
-
/**
|
|
6556
|
-
* Optional: human, agent, or team holder currently filling this role.
|
|
6557
|
-
* Agent holders reference OM Resource IDs and are validated at the model level.
|
|
6558
|
-
*/
|
|
6559
|
-
heldBy: RoleHoldersSchema.optional(),
|
|
6560
|
-
/**
|
|
6561
|
-
* Optional Systems this role is accountable for.
|
|
6562
|
-
* Cross-reference enforced in `OrganizationModelSchema.superRefine()`.
|
|
6563
|
-
*/
|
|
6564
|
-
responsibleFor: z.array(SystemIdSchema.meta({ ref: "system" })).optional()
|
|
6565
|
-
});
|
|
6566
|
-
var RolesDomainSchema = z.record(z.string(), RoleSchema).refine((record) => Object.entries(record).every(([key, entry]) => entry.id === key), {
|
|
6567
|
-
message: "Each role entry id must match its map key"
|
|
6568
|
-
}).default({});
|
|
6569
|
-
var DEFAULT_ORGANIZATION_MODEL_ROLES = {};
|
|
6570
|
-
var KeyResultSchema = z.object({
|
|
6571
|
-
/** Stable unique identifier for the measurable outcome (e.g. "kr-revenue-q1"). */
|
|
6572
|
-
id: z.string().trim().min(1).max(100),
|
|
6573
|
-
/** Plain-language description of this measurable outcome (e.g. "Increase trial-to-paid conversion"). */
|
|
6574
|
-
description: z.string().trim().min(1).max(500),
|
|
6575
|
-
/**
|
|
6576
|
-
* What is being measured — the metric name (e.g. "monthly revenue", "NPS score",
|
|
6577
|
-
* "trial-to-paid conversion rate"). Free-form string.
|
|
6578
|
-
*/
|
|
6579
|
-
targetMetric: z.string().trim().min(1).max(200),
|
|
6580
|
-
/** Current measured value. Defaults to 0 when not yet tracked. */
|
|
6581
|
-
currentValue: z.number().default(0),
|
|
6582
|
-
/**
|
|
6583
|
-
* Target value to reach for this measurable outcome to be considered achieved.
|
|
6584
|
-
* Optional — omit if the outcome is directional (e.g. "reduce churn") without
|
|
6585
|
-
* a hard numeric target.
|
|
6586
|
-
*/
|
|
6587
|
-
targetValue: z.number().optional()
|
|
6588
|
-
});
|
|
6589
|
-
var ISO_DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
6590
|
-
var ObjectiveSchema = z.object({
|
|
6591
|
-
/** Stable unique identifier for the goal (e.g. "goal-grow-arr-q1-2026"). */
|
|
6592
|
-
id: z.string().trim().min(1).max(100),
|
|
6593
|
-
/** Domain-map iteration order. Convention: multiples of 10 (10, 20, 30, ...) to allow easy insertion. */
|
|
6594
|
-
order: z.number(),
|
|
6595
|
-
/** Plain-language description of what the organization wants to achieve. */
|
|
6596
|
-
description: z.string().trim().min(1).max(1e3),
|
|
6597
|
-
/**
|
|
6598
|
-
* Start of the period this goal is active for — ISO 8601 date string (YYYY-MM-DD).
|
|
6599
|
-
* Must be strictly before `periodEnd`.
|
|
6600
|
-
*/
|
|
6601
|
-
periodStart: z.string().regex(ISO_DATE_REGEX, "periodStart must be an ISO date string (YYYY-MM-DD)"),
|
|
6602
|
-
/**
|
|
6603
|
-
* End of the period this goal is active for — ISO 8601 date string (YYYY-MM-DD).
|
|
6604
|
-
* Must be strictly after `periodStart`.
|
|
6605
|
-
* Enforced via `OrganizationModelSchema.superRefine()`.
|
|
6606
|
-
*/
|
|
6607
|
-
periodEnd: z.string().regex(ISO_DATE_REGEX, "periodEnd must be an ISO date string (YYYY-MM-DD)"),
|
|
6608
|
-
/**
|
|
6609
|
-
* List of measurable outcomes that define success for this goal.
|
|
6610
|
-
* Defaults to empty array so goals can be declared before outcomes are defined.
|
|
6611
|
-
*/
|
|
6612
|
-
keyResults: z.array(KeyResultSchema).default([])
|
|
6613
|
-
});
|
|
6614
|
-
var GoalsDomainSchema = z.record(z.string(), ObjectiveSchema).refine((record) => Object.entries(record).every(([key, entry]) => entry.id === key), {
|
|
6615
|
-
message: "Each objective entry id must match its map key"
|
|
6616
|
-
}).default({});
|
|
6617
|
-
var DEFAULT_ORGANIZATION_MODEL_GOALS = {};
|
|
6618
|
-
var SecretLikeMetadataKeySchema = /(?:secret|password|passwd|token|api[-_]?key|credential|private[-_]?key)/i;
|
|
6619
|
-
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-----)/;
|
|
6620
|
-
z.enum([
|
|
6621
|
-
"system",
|
|
6622
|
-
"resource",
|
|
6623
|
-
"ontology",
|
|
6624
|
-
"policy",
|
|
6625
|
-
"role",
|
|
6626
|
-
"trigger",
|
|
6627
|
-
"humanCheckpoint",
|
|
6628
|
-
"externalResource"
|
|
6629
|
-
]);
|
|
6630
|
-
var OmTopologyRelationshipKindSchema = z.enum(["triggers", "uses", "approval"]);
|
|
6631
|
-
var OmTopologyNodeRefSchema = z.discriminatedUnion("kind", [
|
|
6632
|
-
z.object({ kind: z.literal("system"), id: ModelIdSchema }),
|
|
6633
|
-
z.object({ kind: z.literal("resource"), id: ResourceIdSchema }),
|
|
6634
|
-
z.object({ kind: z.literal("ontology"), id: OntologyIdSchema }),
|
|
6635
|
-
z.object({ kind: z.literal("policy"), id: ModelIdSchema }),
|
|
6636
|
-
z.object({ kind: z.literal("role"), id: ModelIdSchema }),
|
|
6637
|
-
z.object({ kind: z.literal("trigger"), id: ResourceIdSchema }),
|
|
6638
|
-
z.object({ kind: z.literal("humanCheckpoint"), id: ResourceIdSchema }),
|
|
6639
|
-
z.object({ kind: z.literal("externalResource"), id: ResourceIdSchema })
|
|
6640
|
-
]);
|
|
6641
|
-
var OmTopologyMetadataSchema = z.record(z.string().trim().min(1).max(120), JsonValueSchema).superRefine((metadata, ctx) => {
|
|
6642
|
-
function visit(value, path) {
|
|
6643
|
-
if (typeof value === "string" && SecretLikeMetadataValueSchema.test(value)) {
|
|
6644
|
-
ctx.addIssue({
|
|
6645
|
-
code: z.ZodIssueCode.custom,
|
|
6646
|
-
path,
|
|
6647
|
-
message: "Topology metadata must not contain secret-like values"
|
|
6648
|
-
});
|
|
6649
|
-
return;
|
|
6650
|
-
}
|
|
6651
|
-
if (Array.isArray(value)) {
|
|
6652
|
-
value.forEach((entry, index) => visit(entry, [...path, index]));
|
|
6653
|
-
return;
|
|
6654
|
-
}
|
|
6655
|
-
if (typeof value !== "object" || value === null) return;
|
|
6656
|
-
Object.entries(value).forEach(([key, entry]) => {
|
|
6657
|
-
if (SecretLikeMetadataKeySchema.test(key)) {
|
|
6658
|
-
ctx.addIssue({
|
|
6659
|
-
code: z.ZodIssueCode.custom,
|
|
6660
|
-
path: [...path, key],
|
|
6661
|
-
message: `Topology metadata key "${key}" looks secret-like`
|
|
6662
|
-
});
|
|
6663
|
-
}
|
|
6664
|
-
visit(entry, [...path, key]);
|
|
6665
|
-
});
|
|
6666
|
-
}
|
|
6667
|
-
visit(metadata, []);
|
|
6668
|
-
});
|
|
6669
|
-
var OmTopologyRelationshipSchema = z.object({
|
|
6670
|
-
from: OmTopologyNodeRefSchema,
|
|
6671
|
-
kind: OmTopologyRelationshipKindSchema,
|
|
6672
|
-
to: OmTopologyNodeRefSchema,
|
|
6673
|
-
systemPath: SystemPathSchema.optional(),
|
|
6674
|
-
required: z.boolean().optional(),
|
|
6675
|
-
metadata: OmTopologyMetadataSchema.optional()
|
|
6676
|
-
});
|
|
6677
|
-
var OmTopologyDomainSchema = z.object({
|
|
6678
|
-
version: z.literal(1).default(1),
|
|
6679
|
-
relationships: z.record(z.string().trim().min(1).max(255), OmTopologyRelationshipSchema).default({})
|
|
6680
|
-
}).default({ version: 1, relationships: {} });
|
|
6681
|
-
var DEFAULT_ORGANIZATION_MODEL_TOPOLOGY = {
|
|
6682
|
-
version: 1,
|
|
6683
|
-
relationships: {}
|
|
6684
|
-
};
|
|
6685
|
-
var PolicyIdSchema = ModelIdSchema;
|
|
6686
|
-
var PolicyApplicabilitySchema = z.object({
|
|
6687
|
-
systemIds: z.array(ModelIdSchema.meta({ ref: "system" })).default([]),
|
|
6688
|
-
actionIds: z.array(ModelIdSchema.meta({ ref: "action" })).default([]),
|
|
6689
|
-
resourceIds: z.array(ModelIdSchema.meta({ ref: "resource" })).default([]),
|
|
6690
|
-
roleIds: z.array(ModelIdSchema.meta({ ref: "role" })).default([])
|
|
6691
|
-
});
|
|
6692
|
-
var PolicyTriggerSchema = z.discriminatedUnion("kind", [
|
|
6693
|
-
z.object({
|
|
6694
|
-
kind: z.literal("event"),
|
|
6695
|
-
eventId: EventIdSchema.meta({ ref: "event" })
|
|
6696
|
-
}),
|
|
6697
|
-
z.object({
|
|
6698
|
-
kind: z.literal("action-invocation"),
|
|
6699
|
-
actionId: ModelIdSchema.meta({ ref: "action" })
|
|
6700
|
-
}),
|
|
6701
|
-
z.object({
|
|
6702
|
-
kind: z.literal("schedule"),
|
|
6703
|
-
cron: z.string().trim().min(1).max(120)
|
|
6704
|
-
}),
|
|
6705
|
-
z.object({
|
|
6706
|
-
kind: z.literal("manual")
|
|
6707
|
-
})
|
|
6708
|
-
]);
|
|
6709
|
-
var PolicyPredicateSchema = z.discriminatedUnion("kind", [
|
|
6710
|
-
z.object({
|
|
6711
|
-
kind: z.literal("always")
|
|
6712
|
-
}),
|
|
6713
|
-
z.object({
|
|
6714
|
-
kind: z.literal("expression"),
|
|
6715
|
-
expression: z.string().trim().min(1).max(2e3)
|
|
6716
|
-
}),
|
|
6717
|
-
z.object({
|
|
6718
|
-
kind: z.literal("threshold"),
|
|
6719
|
-
metric: ModelIdSchema,
|
|
6720
|
-
operator: z.enum(["lt", "lte", "eq", "gte", "gt"]).meta({ label: "Operator" }),
|
|
6721
|
-
value: z.number()
|
|
6722
|
-
})
|
|
6723
|
-
]);
|
|
6724
|
-
var PolicyEffectSchema = z.discriminatedUnion("kind", [
|
|
6725
|
-
z.object({
|
|
6726
|
-
kind: z.literal("require-approval"),
|
|
6727
|
-
roleId: ModelIdSchema.meta({ ref: "role" }).optional()
|
|
6728
|
-
}),
|
|
6729
|
-
z.object({
|
|
6730
|
-
kind: z.literal("invoke-action"),
|
|
6731
|
-
actionId: ModelIdSchema.meta({ ref: "action" })
|
|
6732
|
-
}),
|
|
6733
|
-
z.object({
|
|
6734
|
-
kind: z.literal("notify-role"),
|
|
6735
|
-
roleId: ModelIdSchema.meta({ ref: "role" })
|
|
6736
|
-
}),
|
|
6737
|
-
z.object({
|
|
6738
|
-
kind: z.literal("block")
|
|
6739
|
-
})
|
|
6740
|
-
]);
|
|
6741
|
-
var PolicySchema = z.object({
|
|
6742
|
-
id: PolicyIdSchema,
|
|
6743
|
-
/** Domain-map iteration order. Convention: multiples of 10 (10, 20, 30, ...) to allow easy insertion. */
|
|
6744
|
-
order: z.number(),
|
|
6745
|
-
label: LabelSchema,
|
|
6746
|
-
description: DescriptionSchema.optional(),
|
|
6747
|
-
trigger: PolicyTriggerSchema,
|
|
6748
|
-
predicate: PolicyPredicateSchema.default({ kind: "always" }),
|
|
6749
|
-
actions: z.array(PolicyEffectSchema).min(1),
|
|
6750
|
-
appliesTo: PolicyApplicabilitySchema.default({
|
|
6751
|
-
systemIds: [],
|
|
6752
|
-
actionIds: [],
|
|
6753
|
-
resourceIds: [],
|
|
6754
|
-
roleIds: []
|
|
6755
|
-
}),
|
|
6756
|
-
lifecycle: z.enum(["draft", "beta", "active", "deprecated", "archived"]).meta({ label: "Lifecycle", color: "teal" }).default("active")
|
|
6757
|
-
});
|
|
6758
|
-
var PoliciesDomainSchema = z.record(z.string(), PolicySchema).refine((record) => Object.entries(record).every(([key, entry]) => entry.id === key), {
|
|
6759
|
-
message: "Each policy entry id must match its map key"
|
|
6760
|
-
}).default({});
|
|
6761
|
-
var DEFAULT_ORGANIZATION_MODEL_POLICIES = {};
|
|
6762
|
-
|
|
6763
|
-
// ../core/src/organization-model/content-kinds/registry.ts
|
|
6764
|
-
function defineContentType(def) {
|
|
6765
|
-
return def;
|
|
6766
|
-
}
|
|
6767
|
-
var PipelinePayloadSchema = z.object({
|
|
6768
|
-
/**
|
|
6769
|
-
* Local NodeId of the entity this pipeline applies to (e.g. 'crm.deal').
|
|
6770
|
-
* `.meta({ ref: 'entity' })` enables SchemaDrivenFieldList to render a
|
|
6771
|
-
* clickable graph link to the referenced entity node.
|
|
6772
|
-
*/
|
|
6773
|
-
entityId: z.string().trim().min(1).max(200).meta({ label: "Entity", ref: "entity", hint: "The entity type this pipeline tracks" }),
|
|
6774
|
-
/**
|
|
6775
|
-
* Optional Kanban column color token for UI rendering.
|
|
6776
|
-
*/
|
|
6777
|
-
kanbanColor: z.string().trim().min(1).max(40).optional().meta({ label: "Kanban color", hint: "UI color token" })
|
|
6778
|
-
});
|
|
6779
|
-
var pipelineKind = defineContentType({
|
|
6780
|
-
kind: "schema",
|
|
6781
|
-
type: "pipeline",
|
|
6782
|
-
label: "Pipeline",
|
|
6783
|
-
description: "A named progression pipeline that applies to a specific entity type.",
|
|
6784
|
-
payloadSchema: PipelinePayloadSchema,
|
|
6785
|
-
parentTypes: []
|
|
6786
|
-
});
|
|
6787
|
-
var StagePayloadSchema = z.object({
|
|
6788
|
-
/**
|
|
6789
|
-
* Semantic classification for this stage.
|
|
6790
|
-
* Drives color, icon, and CRM-priority logic in consuming views.
|
|
6791
|
-
* Optional — prospecting stages use data.entityKind instead.
|
|
6792
|
-
* Enum aligned with SalesStageSemanticClassSchema (sales.ts).
|
|
6793
|
-
*/
|
|
6794
|
-
semanticClass: z.enum(["open", "active", "nurturing", "closed_won", "closed_lost", "won", "lost", "closed"]).optional().meta({ label: "Semantic class", hint: "Semantic meaning of this stage", color: "blue" })
|
|
6795
|
-
});
|
|
6796
|
-
var stageKind = defineContentType({
|
|
6797
|
-
kind: "schema",
|
|
6798
|
-
type: "stage",
|
|
6799
|
-
label: "Stage",
|
|
6800
|
-
description: "A stage within a pipeline. Must be parented under a schema:pipeline content node.",
|
|
6801
|
-
payloadSchema: StagePayloadSchema,
|
|
6802
|
-
parentTypes: ["schema:pipeline"]
|
|
6803
|
-
});
|
|
6804
|
-
var TemplatePayloadSchema = z.object({
|
|
6805
|
-
/**
|
|
6806
|
-
* Optional description surfaced in the KB describe view and tooling.
|
|
6807
|
-
*/
|
|
6808
|
-
description: z.string().trim().min(1).max(2e3).optional().meta({ label: "Description", hint: "What this template is used for" })
|
|
6809
|
-
});
|
|
6810
|
-
var templateKind = defineContentType({
|
|
6811
|
-
kind: "schema",
|
|
6812
|
-
type: "template",
|
|
6813
|
-
label: "Template",
|
|
6814
|
-
description: "A named build template (e.g. a prospecting pipeline sequence).",
|
|
6815
|
-
payloadSchema: TemplatePayloadSchema,
|
|
6816
|
-
parentTypes: []
|
|
6817
|
-
});
|
|
6818
|
-
var TemplateStepPayloadSchema = z.object({
|
|
6819
|
-
/**
|
|
6820
|
-
* Which entity type this step primarily operates on.
|
|
6821
|
-
*/
|
|
6822
|
-
primaryEntity: z.enum(["company", "contact"]).meta({ label: "Primary entity", hint: "Entity type this step processes", color: "blue" }),
|
|
6823
|
-
/**
|
|
6824
|
-
* Action key identifying the workflow action executed by this step.
|
|
6825
|
-
* `.meta({ ref: 'action' })` enables SchemaDrivenFieldList to render a
|
|
6826
|
-
* clickable graph link.
|
|
6827
|
-
*/
|
|
6828
|
-
actionKey: z.string().trim().min(1).max(200).meta({ label: "Action", ref: "action", hint: "Workflow action executed by this step" }),
|
|
6829
|
-
/**
|
|
6830
|
-
* IDs of sibling step local NodeIds this step depends on.
|
|
6831
|
-
*/
|
|
6832
|
-
dependsOn: z.array(z.string().trim().min(1).max(200)).optional().meta({ label: "Depends on", hint: "Local NodeIds of prerequisite steps" })
|
|
6833
|
-
});
|
|
6834
|
-
var templateStepKind = defineContentType({
|
|
6835
|
-
kind: "schema",
|
|
6836
|
-
type: "template-step",
|
|
6837
|
-
label: "Template Step",
|
|
6838
|
-
description: "A step within a build template. Must be parented under a schema:template content node.",
|
|
6839
|
-
payloadSchema: TemplateStepPayloadSchema,
|
|
6840
|
-
parentTypes: ["schema:template"]
|
|
6841
|
-
});
|
|
6842
|
-
var StatusFlowPayloadSchema = z.object({
|
|
6843
|
-
/**
|
|
6844
|
-
* Which entity scope this status flow governs.
|
|
6845
|
-
*/
|
|
6846
|
-
appliesTo: z.enum(["project", "milestone", "task"]).meta({ label: "Applies to", hint: "Entity scope governed by this status flow", color: "blue" })
|
|
6847
|
-
});
|
|
6848
|
-
var statusFlowKind = defineContentType({
|
|
6849
|
-
kind: "schema",
|
|
6850
|
-
type: "status-flow",
|
|
6851
|
-
label: "Status Flow",
|
|
6852
|
-
description: "A named set of statuses governing a project, milestone, or task entity.",
|
|
6853
|
-
payloadSchema: StatusFlowPayloadSchema,
|
|
6854
|
-
parentTypes: []
|
|
6855
|
-
});
|
|
6856
|
-
var StatusPayloadSchema = z.object({
|
|
6857
|
-
/**
|
|
6858
|
-
* Semantic classification string for this status.
|
|
6859
|
-
* Free-form to allow tenant-defined classifications (e.g. 'active', 'blocked',
|
|
6860
|
-
* 'completed'). Used by UI to apply color and icon fallbacks.
|
|
6861
|
-
* Optional — status nodes may omit this when the label is self-descriptive.
|
|
6862
|
-
*/
|
|
6863
|
-
semanticClass: z.string().trim().min(1).max(100).optional().meta({ label: "Semantic class", hint: "Semantic meaning of this status (e.g. active, blocked, completed)" }),
|
|
6864
|
-
/**
|
|
6865
|
-
* Optional UI color token override for this status.
|
|
6866
|
-
*/
|
|
6867
|
-
color: z.string().trim().min(1).max(40).optional().meta({ label: "Color", hint: "UI color token" })
|
|
6868
|
-
});
|
|
6869
|
-
var statusKind = defineContentType({
|
|
6870
|
-
kind: "schema",
|
|
6871
|
-
type: "status",
|
|
6872
|
-
label: "Status",
|
|
6873
|
-
description: "A single status within a status flow. Must be parented under a schema:status-flow content node.",
|
|
6874
|
-
payloadSchema: StatusPayloadSchema,
|
|
6875
|
-
parentTypes: ["schema:status-flow"]
|
|
6876
|
-
});
|
|
6877
|
-
var ConfigKvPayloadSchema = z.object({
|
|
6878
|
-
/**
|
|
6879
|
-
* Flat key-value entries. Values are JSON primitives.
|
|
6880
|
-
* Keys are short identifiers (e.g. 'maxBatchSize', 'featureEnabled').
|
|
6881
|
-
*/
|
|
6882
|
-
entries: z.record(z.string().trim().min(1).max(200), z.union([z.string(), z.number(), z.boolean(), z.null()])).meta({ label: "Entries", hint: "Key-value configuration entries (string, number, boolean, or null values)" })
|
|
6883
|
-
});
|
|
6884
|
-
var configKvKind = defineContentType({
|
|
6885
|
-
kind: "config",
|
|
6886
|
-
type: "kv",
|
|
6887
|
-
label: "Key-Value Config",
|
|
6888
|
-
description: "A flat key-value configuration store co-located with a system. Values are JSON primitives.",
|
|
6889
|
-
payloadSchema: ConfigKvPayloadSchema,
|
|
6890
|
-
parentTypes: []
|
|
6891
|
-
});
|
|
6892
|
-
|
|
6893
|
-
// ../core/src/organization-model/content-kinds/index.ts
|
|
6894
|
-
var CONTENT_KIND_REGISTRY = {
|
|
6895
|
-
"schema:pipeline": pipelineKind,
|
|
6896
|
-
"schema:stage": stageKind,
|
|
6897
|
-
"schema:template": templateKind,
|
|
6898
|
-
"schema:template-step": templateStepKind,
|
|
6899
|
-
"schema:status-flow": statusFlowKind,
|
|
6900
|
-
"schema:status": statusKind,
|
|
6901
|
-
"config:kv": configKvKind
|
|
6902
|
-
};
|
|
6903
|
-
function lookupContentType(kind, type) {
|
|
6904
|
-
const key = `${kind}:${type}`;
|
|
6905
|
-
return CONTENT_KIND_REGISTRY[key];
|
|
6906
|
-
}
|
|
6907
|
-
var SurfaceTypeSchema = z.enum(["page", "dashboard", "graph", "detail", "list", "settings"]).meta({ label: "Surface type", color: "blue" });
|
|
6908
|
-
z.object({
|
|
6909
|
-
id: ModelIdSchema,
|
|
6910
|
-
label: LabelSchema,
|
|
6911
|
-
path: PathSchema,
|
|
6912
|
-
surfaceType: SurfaceTypeSchema,
|
|
6913
|
-
description: DescriptionSchema.optional(),
|
|
6914
|
-
enabled: z.boolean().default(true),
|
|
6915
|
-
devOnly: z.boolean().optional(),
|
|
6916
|
-
icon: IconNameSchema.optional(),
|
|
6917
|
-
systemIds: z.array(ModelIdSchema.meta({ ref: "system" })).default([]),
|
|
6918
|
-
entityIds: z.array(ModelIdSchema.meta({ ref: "entity" })).default([]),
|
|
6919
|
-
resourceIds: z.array(ModelIdSchema.meta({ ref: "resource" })).default([]),
|
|
6920
|
-
actionIds: z.array(ModelIdSchema.meta({ ref: "action" })).default([]),
|
|
6921
|
-
parentId: ModelIdSchema.meta({ ref: "surface" }).optional()
|
|
6922
|
-
});
|
|
6923
|
-
var SidebarSurfaceTargetsSchema = z.object({
|
|
6924
|
-
systems: z.array(ModelIdSchema.meta({ ref: "system" })).default([]).optional(),
|
|
6925
|
-
entities: z.array(ModelIdSchema.meta({ ref: "entity" })).default([]).optional(),
|
|
6926
|
-
resources: z.array(ModelIdSchema.meta({ ref: "resource" })).default([]).optional(),
|
|
6927
|
-
actions: z.array(ModelIdSchema.meta({ ref: "action" })).default([]).optional()
|
|
6928
|
-
}).default({});
|
|
6929
|
-
var SidebarNodeSchema = z.lazy(
|
|
6930
|
-
() => z.discriminatedUnion("type", [
|
|
6931
|
-
z.object({
|
|
6932
|
-
type: z.literal("group"),
|
|
6933
|
-
label: LabelSchema,
|
|
6934
|
-
description: DescriptionSchema.optional(),
|
|
6935
|
-
icon: IconNameSchema.optional(),
|
|
6936
|
-
order: z.number().int().optional(),
|
|
6937
|
-
children: z.record(z.string(), SidebarNodeSchema).default({})
|
|
6938
|
-
}),
|
|
6939
|
-
z.object({
|
|
6940
|
-
type: z.literal("surface"),
|
|
6941
|
-
label: LabelSchema,
|
|
6942
|
-
path: PathSchema,
|
|
6943
|
-
surfaceType: SurfaceTypeSchema,
|
|
6944
|
-
description: DescriptionSchema.optional(),
|
|
6945
|
-
icon: IconNameSchema.optional(),
|
|
6946
|
-
order: z.number().int().optional(),
|
|
6947
|
-
targets: SidebarSurfaceTargetsSchema.optional(),
|
|
6948
|
-
devOnly: z.boolean().optional(),
|
|
6949
|
-
requiresAdmin: z.boolean().optional()
|
|
6950
|
-
})
|
|
6951
|
-
])
|
|
6952
|
-
);
|
|
6953
|
-
var SidebarSectionSchema = z.record(z.string(), SidebarNodeSchema).default({});
|
|
6954
|
-
var SidebarNavigationSchema = z.object({
|
|
6955
|
-
primary: SidebarSectionSchema,
|
|
6956
|
-
bottom: SidebarSectionSchema
|
|
6957
|
-
}).default({ primary: {}, bottom: {} });
|
|
6958
|
-
var OrganizationModelNavigationSchema = z.object({
|
|
6959
|
-
sidebar: SidebarNavigationSchema
|
|
6960
|
-
}).default({ sidebar: { primary: {}, bottom: {} } });
|
|
6961
|
-
z.object({
|
|
6962
|
-
id: ModelIdSchema,
|
|
6963
|
-
label: LabelSchema,
|
|
6964
|
-
placement: z.string().trim().min(1).max(50),
|
|
6965
|
-
surfaceIds: z.array(ModelIdSchema.meta({ ref: "surface" })).default([])
|
|
6966
|
-
});
|
|
6967
|
-
var KnowledgeTargetKindSchema = z.enum([
|
|
6968
|
-
"system",
|
|
6969
|
-
"resource",
|
|
6970
|
-
"knowledge",
|
|
6971
|
-
"stage",
|
|
6972
|
-
"action",
|
|
6973
|
-
"role",
|
|
6974
|
-
"goal",
|
|
6975
|
-
"customer-segment",
|
|
6976
|
-
"offering",
|
|
6977
|
-
"ontology",
|
|
6978
|
-
// D4: content nodes are a valid knowledge target after compound-domain data moved into system.content
|
|
6979
|
-
"content-node"
|
|
6980
|
-
]).meta({ label: "Target kind" });
|
|
6981
|
-
var KnowledgeTargetRefSchema = z.object({
|
|
6982
|
-
kind: KnowledgeTargetKindSchema,
|
|
6983
|
-
// D4: content-node targets use a qualified id format '<system-path>:<local-content-id>'.
|
|
6984
|
-
// Ontology targets use the canonical '<scope>:<kind>/<local-id>' ontology id format.
|
|
6985
|
-
// Business-logic validation of target existence is done in OrganizationModelSchema.superRefine.
|
|
6986
|
-
id: z.string().trim().min(1).max(300)
|
|
6987
|
-
}).superRefine((target, ctx) => {
|
|
6988
|
-
if (target.kind !== "ontology") return;
|
|
6989
|
-
const result = OntologyIdSchema.safeParse(target.id);
|
|
6990
|
-
if (!result.success) {
|
|
6991
|
-
ctx.addIssue({
|
|
6992
|
-
code: z.ZodIssueCode.custom,
|
|
6993
|
-
path: ["id"],
|
|
6994
|
-
message: "Ontology knowledge targets must use <system-path>:<kind>/<local-id> or global:<kind>/<local-id>"
|
|
6995
|
-
});
|
|
6996
|
-
}
|
|
6997
|
-
});
|
|
6998
|
-
var LegacyKnowledgeLinkSchema = z.object({
|
|
6999
|
-
nodeId: z.union([NodeIdStringSchema, z.templateLiteral(["ontology:", OntologyIdSchema])])
|
|
7000
|
-
});
|
|
7001
|
-
var CanonicalKnowledgeLinkSchema = z.object({
|
|
7002
|
-
target: KnowledgeTargetRefSchema
|
|
7003
|
-
});
|
|
7004
|
-
function nodeIdFromTarget(target) {
|
|
7005
|
-
return `${target.kind}:${target.id}`;
|
|
7006
|
-
}
|
|
7007
|
-
function targetFromNodeId(nodeId) {
|
|
7008
|
-
const [kind, ...idParts] = nodeId.split(":");
|
|
7009
|
-
return {
|
|
7010
|
-
kind: KnowledgeTargetKindSchema.parse(kind),
|
|
7011
|
-
id: idParts.join(":")
|
|
7012
|
-
};
|
|
7013
|
-
}
|
|
7014
|
-
var KnowledgeLinkSchema = z.union([CanonicalKnowledgeLinkSchema, LegacyKnowledgeLinkSchema]).transform((link) => {
|
|
7015
|
-
const target = "target" in link ? link.target : targetFromNodeId(link.nodeId);
|
|
7016
|
-
return {
|
|
7017
|
-
target,
|
|
7018
|
-
nodeId: nodeIdFromTarget(target)
|
|
7019
|
-
};
|
|
7020
|
-
});
|
|
7021
|
-
var OrgKnowledgeKindSchema = z.enum(["playbook", "strategy", "reference"]).meta({ label: "Knowledge kind", color: "grape" });
|
|
7022
|
-
var OrgKnowledgeNodeSchema = z.object({
|
|
7023
|
-
id: ModelIdSchema,
|
|
7024
|
-
kind: OrgKnowledgeKindSchema,
|
|
7025
|
-
title: z.string().trim().min(1).max(200),
|
|
7026
|
-
summary: z.string().trim().min(1).max(1e3),
|
|
7027
|
-
icon: IconNameSchema.optional(),
|
|
7028
|
-
/** Canonical documentation URL when body content is a local summary. */
|
|
7029
|
-
externalUrl: z.string().trim().url().max(500).optional(),
|
|
7030
|
-
/** Optional generated source file path for local MDX-backed knowledge nodes. */
|
|
7031
|
-
sourceFilePath: z.string().trim().min(1).max(500).optional(),
|
|
7032
|
-
/** Raw MDX string. Phase 2 will introduce a structured block format. */
|
|
7033
|
-
body: z.string().trim().min(1),
|
|
7034
|
-
/**
|
|
7035
|
-
* Graph links to other OM nodes this knowledge node governs.
|
|
7036
|
-
* Each link emits a `governs` edge: knowledge-node -> target node.
|
|
7037
|
-
*/
|
|
7038
|
-
links: z.array(KnowledgeLinkSchema).default([]),
|
|
7039
|
-
/** Role identifiers that own this knowledge node. */
|
|
7040
|
-
ownerIds: z.array(RoleIdSchema.meta({ ref: "role" })).default([]),
|
|
7041
|
-
/** ISO date string (YYYY-MM-DD or full ISO 8601) of last meaningful update. */
|
|
7042
|
-
updatedAt: z.string().trim().min(1).max(50)
|
|
7043
|
-
});
|
|
7044
|
-
var KnowledgeDomainSchema = z.record(ModelIdSchema, OrgKnowledgeNodeSchema).default({});
|
|
7045
|
-
|
|
7046
|
-
// ../core/src/organization-model/schema.ts
|
|
7047
|
-
z.enum([
|
|
7048
|
-
"branding",
|
|
7049
|
-
"identity",
|
|
7050
|
-
"customers",
|
|
7051
|
-
"offerings",
|
|
7052
|
-
"roles",
|
|
7053
|
-
"goals",
|
|
7054
|
-
"systems",
|
|
7055
|
-
"ontology",
|
|
7056
|
-
"resources",
|
|
7057
|
-
"topology",
|
|
7058
|
-
"actions",
|
|
7059
|
-
"entities",
|
|
7060
|
-
"policies",
|
|
7061
|
-
"knowledge"
|
|
7062
|
-
]);
|
|
7063
|
-
var OrganizationModelDomainMetadataSchema = z.object({
|
|
7064
|
-
version: z.literal(1).default(1),
|
|
7065
|
-
lastModified: z.string().regex(/^\d{4}-\d{2}-\d{2}$/, "lastModified must be an ISO date string (YYYY-MM-DD)")
|
|
7066
|
-
});
|
|
7067
|
-
var DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA = {
|
|
7068
|
-
branding: { version: 1, lastModified: "2026-05-10" },
|
|
7069
|
-
identity: { version: 1, lastModified: "2026-05-10" },
|
|
7070
|
-
customers: { version: 1, lastModified: "2026-05-10" },
|
|
7071
|
-
offerings: { version: 1, lastModified: "2026-05-10" },
|
|
7072
|
-
roles: { version: 1, lastModified: "2026-05-10" },
|
|
7073
|
-
goals: { version: 1, lastModified: "2026-05-10" },
|
|
7074
|
-
systems: { version: 1, lastModified: "2026-05-10" },
|
|
7075
|
-
ontology: { version: 1, lastModified: "2026-05-14" },
|
|
7076
|
-
resources: { version: 1, lastModified: "2026-05-10" },
|
|
7077
|
-
topology: { version: 1, lastModified: "2026-05-14" },
|
|
7078
|
-
actions: { version: 1, lastModified: "2026-05-10" },
|
|
7079
|
-
entities: { version: 1, lastModified: "2026-05-10" },
|
|
7080
|
-
policies: { version: 1, lastModified: "2026-05-10" },
|
|
7081
|
-
knowledge: { version: 1, lastModified: "2026-05-10" }
|
|
7082
|
-
};
|
|
7083
|
-
var OrganizationModelDomainMetadataByDomainSchema = z.object({
|
|
7084
|
-
branding: OrganizationModelDomainMetadataSchema,
|
|
7085
|
-
identity: OrganizationModelDomainMetadataSchema,
|
|
7086
|
-
customers: OrganizationModelDomainMetadataSchema,
|
|
7087
|
-
offerings: OrganizationModelDomainMetadataSchema,
|
|
7088
|
-
roles: OrganizationModelDomainMetadataSchema,
|
|
7089
|
-
goals: OrganizationModelDomainMetadataSchema,
|
|
7090
|
-
systems: OrganizationModelDomainMetadataSchema,
|
|
7091
|
-
ontology: OrganizationModelDomainMetadataSchema,
|
|
7092
|
-
resources: OrganizationModelDomainMetadataSchema,
|
|
7093
|
-
topology: OrganizationModelDomainMetadataSchema,
|
|
7094
|
-
actions: OrganizationModelDomainMetadataSchema,
|
|
7095
|
-
entities: OrganizationModelDomainMetadataSchema,
|
|
7096
|
-
policies: OrganizationModelDomainMetadataSchema,
|
|
7097
|
-
knowledge: OrganizationModelDomainMetadataSchema
|
|
7098
|
-
}).partial().default(DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA).transform((metadata) => ({ ...DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA, ...metadata }));
|
|
7099
|
-
var OrganizationModelSchemaBase = z.object({
|
|
7100
|
-
version: z.literal(1).default(1),
|
|
7101
|
-
domainMetadata: OrganizationModelDomainMetadataByDomainSchema,
|
|
7102
|
-
branding: OrganizationModelBrandingSchema,
|
|
7103
|
-
navigation: OrganizationModelNavigationSchema,
|
|
7104
|
-
identity: IdentityDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_IDENTITY),
|
|
7105
|
-
customers: CustomersDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_CUSTOMERS),
|
|
7106
|
-
offerings: OfferingsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_OFFERINGS),
|
|
7107
|
-
roles: RolesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_ROLES),
|
|
7108
|
-
goals: GoalsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_GOALS),
|
|
7109
|
-
systems: SystemsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_SYSTEMS),
|
|
7110
|
-
ontology: OntologyScopeSchema.default(DEFAULT_ONTOLOGY_SCOPE),
|
|
7111
|
-
resources: ResourcesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_RESOURCES),
|
|
7112
|
-
topology: OmTopologyDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_TOPOLOGY),
|
|
7113
|
-
actions: ActionsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_ACTIONS),
|
|
7114
|
-
entities: EntitiesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_ENTITIES),
|
|
7115
|
-
policies: PoliciesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_POLICIES),
|
|
7116
|
-
// D3: flat Record<id, OrgKnowledgeNode> — no wrapper object
|
|
7117
|
-
knowledge: KnowledgeDomainSchema.default({})
|
|
7118
|
-
});
|
|
7119
|
-
function addIssue(ctx, path, message) {
|
|
7120
|
-
ctx.addIssue({
|
|
7121
|
-
code: z.ZodIssueCode.custom,
|
|
7122
|
-
path,
|
|
7123
|
-
message
|
|
7124
|
-
});
|
|
7125
|
-
}
|
|
7126
|
-
function isLifecycleEnabled(lifecycle, enabled) {
|
|
7127
|
-
if (enabled === false) return false;
|
|
7128
|
-
return lifecycle !== "deprecated" && lifecycle !== "archived";
|
|
7129
|
-
}
|
|
7130
|
-
function defaultSystemPathFor(id) {
|
|
7131
|
-
return `/${id.replaceAll(".", "/")}`;
|
|
7132
|
-
}
|
|
7133
|
-
function asRoleHolderArray(heldBy) {
|
|
7134
|
-
return Array.isArray(heldBy) ? heldBy : [heldBy];
|
|
7135
|
-
}
|
|
7136
|
-
function isKnowledgeKindCompatibleWithTarget(knowledgeKind, targetKind) {
|
|
7137
|
-
if (knowledgeKind === "reference") return true;
|
|
7138
|
-
if (knowledgeKind === "playbook") {
|
|
7139
|
-
return ["system", "resource", "stage", "action", "ontology"].includes(targetKind);
|
|
7140
|
-
}
|
|
7141
|
-
if (knowledgeKind === "strategy") {
|
|
7142
|
-
return ["system", "goal", "offering", "customer-segment", "ontology"].includes(targetKind);
|
|
7143
|
-
}
|
|
7144
|
-
return false;
|
|
7145
|
-
}
|
|
7146
|
-
function isRecord(value) {
|
|
7147
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7148
|
-
}
|
|
7149
|
-
OrganizationModelSchemaBase.superRefine((model, ctx) => {
|
|
7150
|
-
function collectAllSystems(systems, prefix = "", schemaPath = ["systems"]) {
|
|
7151
|
-
const result = [];
|
|
7152
|
-
for (const [key, system] of Object.entries(systems)) {
|
|
7153
|
-
const path = prefix ? `${prefix}.${key}` : key;
|
|
7154
|
-
const currentSchemaPath = [...schemaPath, key];
|
|
7155
|
-
result.push({ path, schemaPath: currentSchemaPath, system });
|
|
7156
|
-
const childSystems = system.systems ?? system.subsystems;
|
|
7157
|
-
if (childSystems !== void 0) {
|
|
7158
|
-
result.push(
|
|
7159
|
-
...collectAllSystems(childSystems, path, [...currentSchemaPath, system.systems !== void 0 ? "systems" : "subsystems"])
|
|
7160
|
-
);
|
|
7161
|
-
}
|
|
7162
|
-
}
|
|
7163
|
-
return result;
|
|
7164
|
-
}
|
|
7165
|
-
const allSystems = collectAllSystems(model.systems);
|
|
7166
|
-
const systemsById = /* @__PURE__ */ new Map();
|
|
7167
|
-
for (const { path, system } of allSystems) {
|
|
7168
|
-
systemsById.set(path, system);
|
|
7169
|
-
systemsById.set(system.id, system);
|
|
7170
|
-
}
|
|
7171
|
-
const systemIdsByEffectivePath = /* @__PURE__ */ new Map();
|
|
7172
|
-
allSystems.forEach(({ path, schemaPath, system }) => {
|
|
7173
|
-
if (system.parentSystemId !== void 0 && !systemsById.has(system.parentSystemId)) {
|
|
7174
|
-
addIssue(
|
|
7175
|
-
ctx,
|
|
7176
|
-
[...schemaPath, "parentSystemId"],
|
|
7177
|
-
`System "${system.id}" references unknown parent "${system.parentSystemId}"`
|
|
7178
|
-
);
|
|
7179
|
-
}
|
|
7180
|
-
const hasChildren = Object.keys(system.systems ?? system.subsystems ?? {}).length > 0 || allSystems.some((candidate) => candidate.path.startsWith(`${path}.`) && !candidate.path.slice(path.length + 1).includes("."));
|
|
7181
|
-
const contributesRoutePath = system.ui?.path !== void 0 || system.path !== void 0 || !hasChildren;
|
|
7182
|
-
if (contributesRoutePath) {
|
|
7183
|
-
const effectivePath = system.ui?.path ?? system.path ?? defaultSystemPathFor(path);
|
|
7184
|
-
const existingSystemId = systemIdsByEffectivePath.get(effectivePath);
|
|
7185
|
-
if (existingSystemId !== void 0) {
|
|
7186
|
-
addIssue(
|
|
7187
|
-
ctx,
|
|
7188
|
-
[...schemaPath, system.ui?.path !== void 0 ? "ui" : "path"],
|
|
7189
|
-
`System "${path}" effective path "${effectivePath}" duplicates system "${existingSystemId}"`
|
|
7190
|
-
);
|
|
7191
|
-
} else {
|
|
7192
|
-
systemIdsByEffectivePath.set(effectivePath, path);
|
|
7193
|
-
}
|
|
7194
|
-
}
|
|
7195
|
-
if (hasChildren && isLifecycleEnabled(system.lifecycle, system.enabled)) {
|
|
7196
|
-
const hasEnabledDescendant = Object.values(system.systems ?? system.subsystems ?? {}).some(
|
|
7197
|
-
(candidate) => isLifecycleEnabled(candidate.lifecycle, candidate.enabled)
|
|
7198
|
-
) || allSystems.some(
|
|
7199
|
-
(candidate) => candidate.path.startsWith(`${path}.`) && !candidate.path.slice(path.length + 1).includes(".") && isLifecycleEnabled(candidate.system.lifecycle, candidate.system.enabled)
|
|
7200
|
-
);
|
|
7201
|
-
if (!hasEnabledDescendant) {
|
|
7202
|
-
addIssue(
|
|
7203
|
-
ctx,
|
|
7204
|
-
[...schemaPath, "lifecycle"],
|
|
7205
|
-
`System "${path}" is active but has no active descendants`
|
|
7206
|
-
);
|
|
7207
|
-
}
|
|
7208
|
-
}
|
|
7209
|
-
});
|
|
7210
|
-
allSystems.forEach(({ schemaPath, system }) => {
|
|
7211
|
-
const visited = /* @__PURE__ */ new Set();
|
|
7212
|
-
let currentParentId = system.parentSystemId;
|
|
7213
|
-
while (currentParentId !== void 0) {
|
|
7214
|
-
if (currentParentId === system.id || visited.has(currentParentId)) {
|
|
7215
|
-
addIssue(ctx, [...schemaPath, "parentSystemId"], `System "${system.id}" has a parent cycle`);
|
|
7216
|
-
return;
|
|
7217
|
-
}
|
|
7218
|
-
visited.add(currentParentId);
|
|
7219
|
-
currentParentId = systemsById.get(currentParentId)?.parentSystemId;
|
|
7220
|
-
}
|
|
7221
|
-
});
|
|
7222
|
-
function normalizeRoutePath(path) {
|
|
7223
|
-
return path.length > 1 ? path.replace(/\/+$/, "") : path;
|
|
7224
|
-
}
|
|
7225
|
-
const sidebarNodeIds = /* @__PURE__ */ new Map();
|
|
7226
|
-
const sidebarSurfacePaths = /* @__PURE__ */ new Map();
|
|
7227
|
-
const sidebarSurfaces = [];
|
|
7228
|
-
function collectSidebarNodes(nodes, schemaPath) {
|
|
7229
|
-
Object.entries(nodes).forEach(([nodeId, node]) => {
|
|
7230
|
-
const nodePath = [...schemaPath, nodeId];
|
|
7231
|
-
const existingNodePath = sidebarNodeIds.get(nodeId);
|
|
7232
|
-
if (existingNodePath !== void 0) {
|
|
7233
|
-
addIssue(ctx, nodePath, `Sidebar node id "${nodeId}" duplicates another sidebar node`);
|
|
7234
|
-
} else {
|
|
7235
|
-
sidebarNodeIds.set(nodeId, nodePath);
|
|
7236
|
-
}
|
|
7237
|
-
if (node.type === "group") {
|
|
7238
|
-
collectSidebarNodes(node.children, [...nodePath, "children"]);
|
|
7239
|
-
return;
|
|
7240
|
-
}
|
|
7241
|
-
sidebarSurfaces.push({ id: nodeId, node, path: nodePath });
|
|
7242
|
-
const normalizedPath = normalizeRoutePath(node.path);
|
|
7243
|
-
const existingSurfaceId = sidebarSurfacePaths.get(normalizedPath);
|
|
7244
|
-
if (existingSurfaceId !== void 0) {
|
|
7245
|
-
addIssue(
|
|
7246
|
-
ctx,
|
|
7247
|
-
[...nodePath, "path"],
|
|
7248
|
-
`Sidebar surface path "${node.path}" duplicates surface "${existingSurfaceId}"`
|
|
7249
|
-
);
|
|
7250
|
-
} else {
|
|
7251
|
-
sidebarSurfacePaths.set(normalizedPath, nodeId);
|
|
7252
|
-
}
|
|
7253
|
-
node.targets?.systems?.forEach((systemId, systemIndex) => {
|
|
7254
|
-
if (!systemsById.has(systemId)) {
|
|
7255
|
-
addIssue(
|
|
7256
|
-
ctx,
|
|
7257
|
-
[...nodePath, "targets", "systems", systemIndex],
|
|
7258
|
-
`Sidebar surface "${nodeId}" references unknown system "${systemId}"`
|
|
7259
|
-
);
|
|
7260
|
-
}
|
|
7261
|
-
});
|
|
7262
|
-
});
|
|
7263
|
-
}
|
|
7264
|
-
collectSidebarNodes(model.navigation.sidebar.primary, ["navigation", "sidebar", "primary"]);
|
|
7265
|
-
collectSidebarNodes(model.navigation.sidebar.bottom, ["navigation", "sidebar", "bottom"]);
|
|
7266
|
-
const segmentsById = new Map(Object.entries(model.customers));
|
|
7267
|
-
Object.values(model.offerings).forEach((product) => {
|
|
7268
|
-
product.targetSegmentIds.forEach((segmentId, segmentIndex) => {
|
|
7269
|
-
if (!segmentsById.has(segmentId)) {
|
|
7270
|
-
addIssue(
|
|
7271
|
-
ctx,
|
|
7272
|
-
["offerings", product.id, "targetSegmentIds", segmentIndex],
|
|
7273
|
-
`Product "${product.id}" references unknown customer segment "${segmentId}"`
|
|
7274
|
-
);
|
|
7275
|
-
}
|
|
7276
|
-
});
|
|
7277
|
-
if (product.deliveryFeatureId !== void 0 && !systemsById.has(product.deliveryFeatureId)) {
|
|
7278
|
-
addIssue(
|
|
7279
|
-
ctx,
|
|
7280
|
-
["offerings", product.id, "deliveryFeatureId"],
|
|
7281
|
-
`Product "${product.id}" references unknown delivery system "${product.deliveryFeatureId}"`
|
|
7282
|
-
);
|
|
7283
|
-
}
|
|
7284
|
-
});
|
|
7285
|
-
Object.values(model.goals).forEach((objective) => {
|
|
7286
|
-
if (objective.periodEnd <= objective.periodStart) {
|
|
7287
|
-
addIssue(
|
|
7288
|
-
ctx,
|
|
7289
|
-
["goals", objective.id, "periodEnd"],
|
|
7290
|
-
`Goal "${objective.id}" has periodEnd "${objective.periodEnd}" which must be strictly after periodStart "${objective.periodStart}"`
|
|
7291
|
-
);
|
|
7292
|
-
}
|
|
7293
|
-
});
|
|
7294
|
-
const goalsById = new Map(Object.entries(model.goals));
|
|
7295
|
-
const knowledgeById = new Map(Object.entries(model.knowledge));
|
|
7296
|
-
const actionsById = new Map(Object.entries(model.actions));
|
|
7297
|
-
const entitiesById = new Map(Object.entries(model.entities));
|
|
7298
|
-
const policiesById = new Map(Object.entries(model.policies));
|
|
7299
|
-
sidebarSurfaces.forEach(({ id, node, path }) => {
|
|
7300
|
-
node.targets?.entities?.forEach((entityId, entityIndex) => {
|
|
7301
|
-
if (!entitiesById.has(entityId)) {
|
|
7302
|
-
addIssue(
|
|
7303
|
-
ctx,
|
|
7304
|
-
[...path, "targets", "entities", entityIndex],
|
|
7305
|
-
`Sidebar surface "${id}" references unknown entity "${entityId}"`
|
|
7306
|
-
);
|
|
7307
|
-
}
|
|
7308
|
-
});
|
|
7309
|
-
node.targets?.actions?.forEach((actionId, actionIndex) => {
|
|
7310
|
-
if (!actionsById.has(actionId)) {
|
|
7311
|
-
addIssue(
|
|
7312
|
-
ctx,
|
|
7313
|
-
[...path, "targets", "actions", actionIndex],
|
|
7314
|
-
`Sidebar surface "${id}" references unknown action "${actionId}"`
|
|
7315
|
-
);
|
|
7316
|
-
}
|
|
7317
|
-
});
|
|
7318
|
-
});
|
|
7319
|
-
Object.values(model.entities).forEach((entity) => {
|
|
7320
|
-
if (!systemsById.has(entity.ownedBySystemId)) {
|
|
7321
|
-
addIssue(
|
|
7322
|
-
ctx,
|
|
7323
|
-
["entities", entity.id, "ownedBySystemId"],
|
|
7324
|
-
`Entity "${entity.id}" references unknown ownedBySystemId "${entity.ownedBySystemId}"`
|
|
7325
|
-
);
|
|
7326
|
-
}
|
|
7327
|
-
entity.links?.forEach((link, linkIndex) => {
|
|
7328
|
-
if (!entitiesById.has(link.toEntity)) {
|
|
7329
|
-
addIssue(
|
|
7330
|
-
ctx,
|
|
7331
|
-
["entities", entity.id, "links", linkIndex, "toEntity"],
|
|
7332
|
-
`Entity "${entity.id}" links to unknown entity "${link.toEntity}"`
|
|
7333
|
-
);
|
|
7334
|
-
}
|
|
7335
|
-
});
|
|
7336
|
-
});
|
|
7337
|
-
const rolesById = new Map(Object.entries(model.roles));
|
|
7338
|
-
Object.values(model.roles).forEach((role) => {
|
|
7339
|
-
if (role.reportsToId !== void 0 && !rolesById.has(role.reportsToId)) {
|
|
7340
|
-
addIssue(
|
|
7341
|
-
ctx,
|
|
7342
|
-
["roles", role.id, "reportsToId"],
|
|
7343
|
-
`Role "${role.id}" references unknown reportsToId "${role.reportsToId}"`
|
|
7344
|
-
);
|
|
7345
|
-
}
|
|
7346
|
-
});
|
|
7347
|
-
Object.values(model.roles).forEach((role) => {
|
|
7348
|
-
const visited = /* @__PURE__ */ new Set();
|
|
7349
|
-
let currentReportsToId = role.reportsToId;
|
|
7350
|
-
while (currentReportsToId !== void 0) {
|
|
7351
|
-
if (currentReportsToId === role.id || visited.has(currentReportsToId)) {
|
|
7352
|
-
addIssue(ctx, ["roles", role.id, "reportsToId"], `Role "${role.id}" has a reportsToId cycle`);
|
|
7353
|
-
return;
|
|
7354
|
-
}
|
|
7355
|
-
visited.add(currentReportsToId);
|
|
7356
|
-
currentReportsToId = rolesById.get(currentReportsToId)?.reportsToId;
|
|
7357
|
-
}
|
|
7358
|
-
});
|
|
7359
|
-
Object.values(model.roles).forEach((role) => {
|
|
7360
|
-
role.responsibleFor?.forEach((systemId, systemIndex) => {
|
|
7361
|
-
if (!systemsById.has(systemId)) {
|
|
7362
|
-
addIssue(
|
|
7363
|
-
ctx,
|
|
7364
|
-
["roles", role.id, "responsibleFor", systemIndex],
|
|
7365
|
-
`Role "${role.id}" references unknown responsibleFor system "${systemId}"`
|
|
7366
|
-
);
|
|
7367
|
-
}
|
|
7368
|
-
});
|
|
7369
|
-
});
|
|
7370
|
-
allSystems.forEach(({ schemaPath, system }) => {
|
|
7371
|
-
if (system.responsibleRoleId !== void 0 && !rolesById.has(system.responsibleRoleId)) {
|
|
7372
|
-
addIssue(
|
|
7373
|
-
ctx,
|
|
7374
|
-
[...schemaPath, "responsibleRoleId"],
|
|
7375
|
-
`System "${system.id}" references unknown responsibleRoleId "${system.responsibleRoleId}"`
|
|
7376
|
-
);
|
|
7377
|
-
}
|
|
7378
|
-
system.governedByKnowledge?.forEach((nodeId, nodeIndex) => {
|
|
7379
|
-
if (!knowledgeById.has(nodeId)) {
|
|
7380
|
-
addIssue(
|
|
7381
|
-
ctx,
|
|
7382
|
-
[...schemaPath, "governedByKnowledge", nodeIndex],
|
|
7383
|
-
`System "${system.id}" references unknown knowledge node "${nodeId}"`
|
|
7384
|
-
);
|
|
7385
|
-
}
|
|
7386
|
-
});
|
|
7387
|
-
system.drivesGoals?.forEach((goalId, goalIndex) => {
|
|
7388
|
-
if (!goalsById.has(goalId)) {
|
|
7389
|
-
addIssue(
|
|
7390
|
-
ctx,
|
|
7391
|
-
[...schemaPath, "drivesGoals", goalIndex],
|
|
7392
|
-
`System "${system.id}" references unknown goal "${goalId}"`
|
|
7393
|
-
);
|
|
7394
|
-
}
|
|
7395
|
-
});
|
|
7396
|
-
system.actions?.forEach((actionRef, actionIndex) => {
|
|
7397
|
-
if (!actionsById.has(actionRef.actionId)) {
|
|
7398
|
-
addIssue(
|
|
7399
|
-
ctx,
|
|
7400
|
-
[...schemaPath, "actions", actionIndex, "actionId"],
|
|
7401
|
-
`System "${system.id}" references unknown action "${actionRef.actionId}"`
|
|
7402
|
-
);
|
|
7403
|
-
}
|
|
7404
|
-
});
|
|
7405
|
-
system.policies?.forEach((policyId, policyIndex) => {
|
|
7406
|
-
if (!policiesById.has(policyId)) {
|
|
7407
|
-
addIssue(
|
|
7408
|
-
ctx,
|
|
7409
|
-
[...schemaPath, "policies", policyIndex],
|
|
7410
|
-
`System "${system.id}" references unknown policy "${policyId}"`
|
|
7411
|
-
);
|
|
7412
|
-
}
|
|
7413
|
-
});
|
|
7414
|
-
});
|
|
7415
|
-
Object.values(model.actions).forEach((action) => {
|
|
7416
|
-
action.affects?.forEach((entityId, entityIndex) => {
|
|
7417
|
-
if (!entitiesById.has(entityId)) {
|
|
7418
|
-
addIssue(
|
|
7419
|
-
ctx,
|
|
7420
|
-
["actions", action.id, "affects", entityIndex],
|
|
7421
|
-
`Action "${action.id}" affects unknown entity "${entityId}"`
|
|
7422
|
-
);
|
|
7423
|
-
}
|
|
7424
|
-
});
|
|
7425
|
-
});
|
|
7426
|
-
const resourcesById = new Map(Object.entries(model.resources));
|
|
7427
|
-
sidebarSurfaces.forEach(({ id, node, path }) => {
|
|
7428
|
-
node.targets?.resources?.forEach((resourceId, resourceIndex) => {
|
|
7429
|
-
if (!resourcesById.has(resourceId)) {
|
|
7430
|
-
addIssue(
|
|
7431
|
-
ctx,
|
|
7432
|
-
[...path, "targets", "resources", resourceIndex],
|
|
7433
|
-
`Sidebar surface "${id}" references unknown resource "${resourceId}"`
|
|
7434
|
-
);
|
|
7435
|
-
}
|
|
7436
|
-
});
|
|
7437
|
-
});
|
|
7438
|
-
const stageIds = /* @__PURE__ */ new Set();
|
|
7439
|
-
const actionIds = new Set(Object.keys(model.actions));
|
|
7440
|
-
const offeringsById = new Map(Object.entries(model.offerings));
|
|
7441
|
-
const ontologyCompilation = compileOrganizationOntology(model);
|
|
7442
|
-
const ontologyIndexByKind = {
|
|
7443
|
-
object: ontologyCompilation.ontology.objectTypes,
|
|
7444
|
-
link: ontologyCompilation.ontology.linkTypes,
|
|
7445
|
-
action: ontologyCompilation.ontology.actionTypes,
|
|
7446
|
-
catalog: ontologyCompilation.ontology.catalogTypes,
|
|
7447
|
-
event: ontologyCompilation.ontology.eventTypes,
|
|
7448
|
-
interface: ontologyCompilation.ontology.interfaceTypes,
|
|
7449
|
-
"value-type": ontologyCompilation.ontology.valueTypes,
|
|
7450
|
-
property: ontologyCompilation.ontology.sharedProperties,
|
|
7451
|
-
group: ontologyCompilation.ontology.groups,
|
|
7452
|
-
surface: ontologyCompilation.ontology.surfaces
|
|
7453
|
-
};
|
|
7454
|
-
const ontologyIds = new Set(Object.values(ontologyIndexByKind).flatMap((index) => Object.keys(index)));
|
|
7455
|
-
function topologyTargetExists(ref) {
|
|
7456
|
-
if (ref.kind === "system") return systemsById.has(ref.id);
|
|
7457
|
-
if (ref.kind === "resource") return resourcesById.has(ref.id);
|
|
7458
|
-
if (ref.kind === "ontology") return ontologyIds.has(ref.id);
|
|
7459
|
-
if (ref.kind === "policy") return policiesById.has(ref.id);
|
|
7460
|
-
if (ref.kind === "role") return rolesById.has(ref.id);
|
|
7461
|
-
return true;
|
|
7462
|
-
}
|
|
7463
|
-
Object.entries(model.topology.relationships).forEach(([relationshipId, relationship]) => {
|
|
7464
|
-
["from", "to"].forEach((side) => {
|
|
7465
|
-
const ref = relationship[side];
|
|
7466
|
-
if (topologyTargetExists(ref)) return;
|
|
7467
|
-
addIssue(
|
|
7468
|
-
ctx,
|
|
7469
|
-
["topology", "relationships", relationshipId, side],
|
|
7470
|
-
`Topology relationship "${relationshipId}" ${side} references unknown ${ref.kind} "${ref.id}"`
|
|
7471
|
-
);
|
|
7472
|
-
});
|
|
7473
|
-
});
|
|
7474
|
-
const ontologyReferenceKeyKinds = {
|
|
7475
|
-
valueType: "value-type",
|
|
7476
|
-
catalogType: "catalog",
|
|
7477
|
-
objectType: "object",
|
|
7478
|
-
eventType: "event",
|
|
7479
|
-
actionType: "action",
|
|
7480
|
-
linkType: "link",
|
|
7481
|
-
interfaceType: "interface",
|
|
7482
|
-
propertyType: "property",
|
|
7483
|
-
groupType: "group",
|
|
7484
|
-
surfaceType: "surface",
|
|
7485
|
-
stepCatalog: "catalog"
|
|
7486
|
-
};
|
|
7487
|
-
function validateKnownOntologyReferences(ownerId, value, path, seen = /* @__PURE__ */ new WeakSet()) {
|
|
7488
|
-
if (Array.isArray(value)) {
|
|
7489
|
-
value.forEach((entry, index) => validateKnownOntologyReferences(ownerId, entry, [...path, index], seen));
|
|
7490
|
-
return;
|
|
7491
|
-
}
|
|
7492
|
-
if (!isRecord(value)) return;
|
|
7493
|
-
if (seen.has(value)) return;
|
|
7494
|
-
seen.add(value);
|
|
7495
|
-
Object.entries(value).forEach(([key, entry]) => {
|
|
7496
|
-
const expectedKind = ontologyReferenceKeyKinds[key];
|
|
7497
|
-
if (expectedKind !== void 0) {
|
|
7498
|
-
if (typeof entry !== "string") {
|
|
7499
|
-
addIssue(ctx, [...path, key], `Ontology record "${ownerId}" ${key} must be an ontology ID string`);
|
|
7500
|
-
} else if (ontologyIndexByKind[expectedKind][entry] === void 0) {
|
|
7501
|
-
addIssue(
|
|
7502
|
-
ctx,
|
|
7503
|
-
[...path, key],
|
|
7504
|
-
`Ontology record "${ownerId}" ${key} references unknown ${expectedKind} ontology ID "${entry}"`
|
|
7505
|
-
);
|
|
7506
|
-
}
|
|
7507
|
-
}
|
|
7508
|
-
validateKnownOntologyReferences(ownerId, entry, [...path, key], seen);
|
|
7509
|
-
});
|
|
7510
|
-
}
|
|
7511
|
-
for (const { id, record } of listResolvedOntologyRecords(ontologyCompilation.ontology)) {
|
|
7512
|
-
validateKnownOntologyReferences(id, record, record.origin.path);
|
|
7513
|
-
}
|
|
7514
|
-
Object.values(model.policies).forEach((policy) => {
|
|
7515
|
-
policy.appliesTo.systemIds.forEach((systemId, systemIndex) => {
|
|
7516
|
-
if (!systemsById.has(systemId)) {
|
|
7517
|
-
addIssue(
|
|
7518
|
-
ctx,
|
|
7519
|
-
["policies", policy.id, "appliesTo", "systemIds", systemIndex],
|
|
7520
|
-
`Policy "${policy.id}" applies to unknown system "${systemId}"`
|
|
7521
|
-
);
|
|
7522
|
-
}
|
|
7523
|
-
});
|
|
7524
|
-
policy.appliesTo.actionIds.forEach((actionId, actionIndex) => {
|
|
7525
|
-
if (!actionsById.has(actionId)) {
|
|
7526
|
-
addIssue(
|
|
7527
|
-
ctx,
|
|
7528
|
-
["policies", policy.id, "appliesTo", "actionIds", actionIndex],
|
|
7529
|
-
`Policy "${policy.id}" applies to unknown action "${actionId}"`
|
|
7530
|
-
);
|
|
7531
|
-
}
|
|
7532
|
-
});
|
|
7533
|
-
policy.actions.forEach((action, actionIndex) => {
|
|
7534
|
-
if (action.kind === "invoke-action" && !actionsById.has(action.actionId)) {
|
|
7535
|
-
addIssue(
|
|
7536
|
-
ctx,
|
|
7537
|
-
["policies", policy.id, "actions", actionIndex, "actionId"],
|
|
7538
|
-
`Policy "${policy.id}" invokes unknown action "${action.actionId}"`
|
|
7539
|
-
);
|
|
7540
|
-
}
|
|
7541
|
-
if ((action.kind === "notify-role" || action.kind === "require-approval") && action.roleId !== void 0 && !rolesById.has(action.roleId)) {
|
|
7542
|
-
addIssue(
|
|
7543
|
-
ctx,
|
|
7544
|
-
["policies", policy.id, "actions", actionIndex, "roleId"],
|
|
7545
|
-
`Policy "${policy.id}" references unknown role "${action.roleId}"`
|
|
7546
|
-
);
|
|
7547
|
-
}
|
|
7548
|
-
});
|
|
7549
|
-
if (policy.trigger.kind === "action-invocation" && !actionsById.has(policy.trigger.actionId)) {
|
|
7550
|
-
addIssue(
|
|
7551
|
-
ctx,
|
|
7552
|
-
["policies", policy.id, "trigger", "actionId"],
|
|
7553
|
-
`Policy "${policy.id}" references unknown trigger action "${policy.trigger.actionId}"`
|
|
7554
|
-
);
|
|
7555
|
-
}
|
|
7556
|
-
});
|
|
7557
|
-
function knowledgeTargetExists(kind, id) {
|
|
7558
|
-
if (kind === "system") return systemsById.has(id);
|
|
7559
|
-
if (kind === "resource") return resourcesById.has(id);
|
|
7560
|
-
if (kind === "knowledge") return knowledgeById.has(id);
|
|
7561
|
-
if (kind === "stage") return stageIds.has(id);
|
|
7562
|
-
if (kind === "action") return actionIds.has(id);
|
|
7563
|
-
if (kind === "role") return rolesById.has(id);
|
|
7564
|
-
if (kind === "goal") return goalsById.has(id);
|
|
7565
|
-
if (kind === "customer-segment") return segmentsById.has(id);
|
|
7566
|
-
if (kind === "offering") return offeringsById.has(id);
|
|
7567
|
-
if (kind === "ontology") return ontologyIds.has(id);
|
|
7568
|
-
return false;
|
|
7569
|
-
}
|
|
7570
|
-
Object.entries(model.knowledge).forEach(([nodeId, node]) => {
|
|
7571
|
-
node.links.forEach((link, linkIndex) => {
|
|
7572
|
-
if (!knowledgeTargetExists(link.target.kind, link.target.id)) {
|
|
7573
|
-
addIssue(
|
|
7574
|
-
ctx,
|
|
7575
|
-
["knowledge", nodeId, "links", linkIndex, "target"],
|
|
7576
|
-
`Knowledge node "${node.id}" references unknown ${link.target.kind} target "${link.target.id}"`
|
|
7577
|
-
);
|
|
7578
|
-
}
|
|
7579
|
-
if (!isKnowledgeKindCompatibleWithTarget(node.kind, link.target.kind)) {
|
|
7580
|
-
addIssue(
|
|
7581
|
-
ctx,
|
|
7582
|
-
["knowledge", nodeId, "links", linkIndex, "target", "kind"],
|
|
7583
|
-
`Knowledge node "${node.id}" kind "${node.kind}" cannot govern ${link.target.kind} targets`
|
|
7584
|
-
);
|
|
7585
|
-
}
|
|
7586
|
-
});
|
|
7587
|
-
});
|
|
7588
|
-
Object.values(model.resources).forEach((resource) => {
|
|
7589
|
-
if (!systemsById.has(resource.systemPath)) {
|
|
7590
|
-
addIssue(
|
|
7591
|
-
ctx,
|
|
7592
|
-
["resources", resource.id, "systemPath"],
|
|
7593
|
-
`Resource "${resource.id}" references unknown system path "${resource.systemPath}"`
|
|
7594
|
-
);
|
|
7595
|
-
}
|
|
7596
|
-
if (resource.ownerRoleId !== void 0 && !rolesById.has(resource.ownerRoleId)) {
|
|
7597
|
-
addIssue(
|
|
7598
|
-
ctx,
|
|
7599
|
-
["resources", resource.id, "ownerRoleId"],
|
|
7600
|
-
`Resource "${resource.id}" references unknown ownerRoleId "${resource.ownerRoleId}"`
|
|
7601
|
-
);
|
|
7602
|
-
}
|
|
7603
|
-
if (resource.kind === "agent" && resource.actsAsRoleId !== void 0 && !rolesById.has(resource.actsAsRoleId)) {
|
|
7604
|
-
addIssue(
|
|
7605
|
-
ctx,
|
|
7606
|
-
["resources", resource.id, "actsAsRoleId"],
|
|
7607
|
-
`Agent resource "${resource.id}" references unknown actsAsRoleId "${resource.actsAsRoleId}"`
|
|
7608
|
-
);
|
|
7609
|
-
}
|
|
7610
|
-
});
|
|
7611
|
-
function validateResourceOntologyBinding(resourceId, bindingKey, expectedKind, ids) {
|
|
7612
|
-
const ontologyIds2 = ids === void 0 ? [] : Array.isArray(ids) ? ids : [ids];
|
|
7613
|
-
ontologyIds2.forEach((ontologyId, ontologyIndex) => {
|
|
7614
|
-
if (ontologyIndexByKind[expectedKind][ontologyId] === void 0) {
|
|
7615
|
-
addIssue(
|
|
7616
|
-
ctx,
|
|
7617
|
-
[
|
|
7618
|
-
"resources",
|
|
7619
|
-
resourceId,
|
|
7620
|
-
"ontology",
|
|
7621
|
-
bindingKey,
|
|
7622
|
-
...Array.isArray(ids) ? [ontologyIndex] : []
|
|
7623
|
-
],
|
|
7624
|
-
`Resource "${resourceId}" ontology binding "${bindingKey}" references unknown ${expectedKind} ontology ID "${ontologyId}"`
|
|
7625
|
-
);
|
|
7626
|
-
}
|
|
7627
|
-
});
|
|
7628
|
-
}
|
|
7629
|
-
Object.values(model.resources).forEach((resource) => {
|
|
7630
|
-
const binding = resource.ontology;
|
|
7631
|
-
if (binding === void 0) return;
|
|
7632
|
-
validateResourceOntologyBinding(resource.id, "actions", "action", binding.actions);
|
|
7633
|
-
validateResourceOntologyBinding(resource.id, "primaryAction", "action", binding.primaryAction);
|
|
7634
|
-
validateResourceOntologyBinding(resource.id, "reads", "object", binding.reads);
|
|
7635
|
-
validateResourceOntologyBinding(resource.id, "writes", "object", binding.writes);
|
|
7636
|
-
validateResourceOntologyBinding(resource.id, "usesCatalogs", "catalog", binding.usesCatalogs);
|
|
7637
|
-
validateResourceOntologyBinding(resource.id, "emits", "event", binding.emits);
|
|
7638
|
-
});
|
|
7639
|
-
Object.values(model.roles).forEach((role) => {
|
|
7640
|
-
if (role.heldBy === void 0) return;
|
|
7641
|
-
asRoleHolderArray(role.heldBy).forEach((holder, holderIndex) => {
|
|
7642
|
-
if (holder.kind !== "agent") return;
|
|
7643
|
-
const resource = resourcesById.get(holder.agentId);
|
|
7644
|
-
if (resource === void 0) {
|
|
7645
|
-
addIssue(
|
|
7646
|
-
ctx,
|
|
7647
|
-
["roles", role.id, "heldBy", Array.isArray(role.heldBy) ? holderIndex : "agentId"],
|
|
7648
|
-
`Role "${role.id}" references unknown agent holder resource "${holder.agentId}"`
|
|
7649
|
-
);
|
|
7650
|
-
return;
|
|
7651
|
-
}
|
|
7652
|
-
if (resource.kind !== "agent") {
|
|
7653
|
-
addIssue(
|
|
7654
|
-
ctx,
|
|
7655
|
-
["roles", role.id, "heldBy", Array.isArray(role.heldBy) ? holderIndex : "agentId"],
|
|
7656
|
-
`Role "${role.id}" agent holder "${holder.agentId}" must reference an agent resource`
|
|
7657
|
-
);
|
|
7658
|
-
}
|
|
7659
|
-
});
|
|
7660
|
-
});
|
|
7661
|
-
Object.entries(model.knowledge).forEach(([nodeId, node]) => {
|
|
7662
|
-
node.ownerIds.forEach((roleId, ownerIndex) => {
|
|
7663
|
-
if (!rolesById.has(roleId)) {
|
|
7664
|
-
addIssue(
|
|
7665
|
-
ctx,
|
|
7666
|
-
["knowledge", nodeId, "ownerIds", ownerIndex],
|
|
7667
|
-
`Knowledge node "${node.id}" references unknown owner role "${roleId}"`
|
|
7668
|
-
);
|
|
7669
|
-
}
|
|
7670
|
-
});
|
|
7671
|
-
});
|
|
7672
|
-
function validateSystemContent(system, systemPath) {
|
|
7673
|
-
const childSystems = system.systems ?? system.subsystems;
|
|
7674
|
-
const childKey = system.systems !== void 0 ? "systems" : "subsystems";
|
|
7675
|
-
const content = system.content;
|
|
7676
|
-
if (content === void 0 || Object.keys(content).length === 0) {
|
|
7677
|
-
if (childSystems !== void 0) {
|
|
7678
|
-
Object.entries(childSystems).forEach(([childLocalId, child]) => {
|
|
7679
|
-
validateSystemContent(child, [...systemPath, childKey, childLocalId]);
|
|
7680
|
-
});
|
|
7681
|
-
}
|
|
7682
|
-
return;
|
|
7683
|
-
}
|
|
7684
|
-
Object.entries(content).forEach(([localId, node]) => {
|
|
7685
|
-
if (node.parentContentId !== void 0 && !(node.parentContentId in content)) {
|
|
7686
|
-
addIssue(
|
|
7687
|
-
ctx,
|
|
7688
|
-
[...systemPath, "content", localId, "parentContentId"],
|
|
7689
|
-
`Content node "${localId}" parentContentId "${node.parentContentId}" does not resolve within the same system`
|
|
7690
|
-
);
|
|
7691
|
-
}
|
|
7692
|
-
});
|
|
7693
|
-
Object.entries(content).forEach(([localId, node]) => {
|
|
7694
|
-
const visited = /* @__PURE__ */ new Set();
|
|
7695
|
-
let currentId = node.parentContentId;
|
|
7696
|
-
while (currentId !== void 0) {
|
|
7697
|
-
if (currentId === localId || visited.has(currentId)) {
|
|
7698
|
-
addIssue(
|
|
7699
|
-
ctx,
|
|
7700
|
-
[...systemPath, "content", localId, "parentContentId"],
|
|
7701
|
-
`Content node "${localId}" has a parentContentId cycle`
|
|
7702
|
-
);
|
|
7703
|
-
break;
|
|
7704
|
-
}
|
|
7705
|
-
visited.add(currentId);
|
|
7706
|
-
currentId = content[currentId]?.parentContentId;
|
|
7707
|
-
}
|
|
7708
|
-
});
|
|
7709
|
-
Object.entries(content).forEach(([localId, node]) => {
|
|
7710
|
-
const childDef = lookupContentType(node.kind, node.type);
|
|
7711
|
-
if (childDef !== void 0 && node.data !== void 0) {
|
|
7712
|
-
const result = childDef.payloadSchema.safeParse(node.data);
|
|
7713
|
-
if (!result.success) {
|
|
7714
|
-
addIssue(
|
|
7715
|
-
ctx,
|
|
7716
|
-
[...systemPath, "content", localId, "data"],
|
|
7717
|
-
`Content node "${localId}" (${node.kind}:${node.type}) data failed payload validation: ${result.error.message}`
|
|
7718
|
-
);
|
|
7719
|
-
}
|
|
7720
|
-
}
|
|
7721
|
-
if (node.parentContentId !== void 0 && childDef !== void 0) {
|
|
7722
|
-
const parentNode = content[node.parentContentId];
|
|
7723
|
-
if (parentNode !== void 0) {
|
|
7724
|
-
const parentDef = lookupContentType(parentNode.kind, parentNode.type);
|
|
7725
|
-
if (parentDef !== void 0 && childDef.kind !== parentDef.kind) {
|
|
7726
|
-
addIssue(
|
|
7727
|
-
ctx,
|
|
7728
|
-
[...systemPath, "content", localId, "parentContentId"],
|
|
7729
|
-
`Content node "${localId}" kind "${childDef.kind}" cannot parent under "${node.parentContentId}" kind "${parentDef.kind}": parentContentId must be same-meta-kind (per L19)`
|
|
7730
|
-
);
|
|
7731
|
-
}
|
|
7732
|
-
}
|
|
7733
|
-
}
|
|
7734
|
-
});
|
|
7735
|
-
if (childSystems !== void 0) {
|
|
7736
|
-
Object.entries(childSystems).forEach(([childLocalId, child]) => {
|
|
7737
|
-
validateSystemContent(child, [...systemPath, childKey, childLocalId]);
|
|
7738
|
-
});
|
|
7739
|
-
}
|
|
7740
|
-
}
|
|
7741
|
-
Object.entries(model.systems).forEach(([systemKey, system]) => {
|
|
7742
|
-
validateSystemContent(system, ["systems", systemKey]);
|
|
7743
|
-
});
|
|
7744
|
-
for (const diagnostic of ontologyCompilation.diagnostics) {
|
|
7745
|
-
addIssue(ctx, diagnostic.path, diagnostic.message);
|
|
7746
|
-
}
|
|
7747
|
-
});
|
|
7748
|
-
|
|
7749
|
-
// ../core/src/organization-model/defaults.ts
|
|
7750
|
-
var DEFAULT_ORGANIZATION_MODEL_KNOWLEDGE = {};
|
|
7751
|
-
var DEFAULT_ORGANIZATION_MODEL_ENTITIES2 = DEFAULT_ORGANIZATION_MODEL_ENTITIES;
|
|
7752
|
-
var DEFAULT_ORGANIZATION_MODEL_NAVIGATION = {
|
|
7753
|
-
sidebar: {
|
|
7754
|
-
primary: {
|
|
7755
|
-
dashboard: {
|
|
7756
|
-
type: "surface",
|
|
7757
|
-
label: "Dashboard",
|
|
7758
|
-
path: "/",
|
|
7759
|
-
surfaceType: "dashboard",
|
|
7760
|
-
icon: "dashboard",
|
|
7761
|
-
order: 10,
|
|
7762
|
-
targets: { systems: ["dashboard"] }
|
|
7763
|
-
},
|
|
7764
|
-
business: {
|
|
7765
|
-
type: "group",
|
|
7766
|
-
label: "Business",
|
|
7767
|
-
icon: "briefcase",
|
|
7768
|
-
order: 20,
|
|
7769
|
-
children: {
|
|
7770
|
-
sales: {
|
|
7771
|
-
type: "surface",
|
|
7772
|
-
label: "Sales",
|
|
7773
|
-
path: "/sales",
|
|
7774
|
-
surfaceType: "page",
|
|
7775
|
-
icon: "sales",
|
|
7776
|
-
order: 10,
|
|
7777
|
-
targets: { systems: ["sales"] }
|
|
7778
|
-
},
|
|
7779
|
-
clients: {
|
|
7780
|
-
type: "surface",
|
|
7781
|
-
label: "Clients",
|
|
7782
|
-
path: "/clients",
|
|
7783
|
-
surfaceType: "list",
|
|
7784
|
-
icon: "clients",
|
|
7785
|
-
order: 20,
|
|
7786
|
-
targets: { systems: ["clients"] }
|
|
7787
|
-
},
|
|
7788
|
-
projects: {
|
|
7789
|
-
type: "surface",
|
|
7790
|
-
label: "Projects",
|
|
7791
|
-
path: "/projects",
|
|
7792
|
-
surfaceType: "page",
|
|
7793
|
-
icon: "projects",
|
|
7794
|
-
order: 30,
|
|
7795
|
-
targets: { systems: ["projects"] }
|
|
7796
|
-
}
|
|
7797
|
-
}
|
|
7798
|
-
},
|
|
7799
|
-
operations: {
|
|
7800
|
-
type: "group",
|
|
7801
|
-
label: "Operations",
|
|
7802
|
-
icon: "operations",
|
|
7803
|
-
order: 30,
|
|
7804
|
-
children: {
|
|
7805
|
-
"operations-overview": {
|
|
7806
|
-
type: "surface",
|
|
7807
|
-
label: "Overview",
|
|
7808
|
-
path: "/operations",
|
|
7809
|
-
surfaceType: "page",
|
|
7810
|
-
order: 10,
|
|
7811
|
-
targets: { systems: ["operations.overview"] }
|
|
7812
|
-
},
|
|
7813
|
-
"operations-systems": {
|
|
7814
|
-
type: "surface",
|
|
7815
|
-
label: "Systems",
|
|
7816
|
-
path: "/operations/systems",
|
|
7817
|
-
surfaceType: "page",
|
|
7818
|
-
order: 20,
|
|
7819
|
-
targets: { systems: ["operations"] }
|
|
7820
|
-
},
|
|
7821
|
-
"operations-resources": {
|
|
7822
|
-
type: "surface",
|
|
7823
|
-
label: "Resources",
|
|
7824
|
-
path: "/operations/resources",
|
|
7825
|
-
surfaceType: "list",
|
|
7826
|
-
order: 30,
|
|
7827
|
-
targets: { systems: ["operations.resources"] }
|
|
7828
|
-
},
|
|
7829
|
-
"operations-command-queue": {
|
|
7830
|
-
type: "surface",
|
|
7831
|
-
label: "Command Queue",
|
|
7832
|
-
path: "/operations/command-queue",
|
|
7833
|
-
surfaceType: "list",
|
|
7834
|
-
order: 40,
|
|
7835
|
-
targets: { systems: ["operations.command-queue"] }
|
|
7836
|
-
},
|
|
7837
|
-
"operations-task-scheduler": {
|
|
7838
|
-
type: "surface",
|
|
7839
|
-
label: "Task Scheduler",
|
|
7840
|
-
path: "/operations/task-scheduler",
|
|
7841
|
-
surfaceType: "list",
|
|
7842
|
-
order: 50,
|
|
7843
|
-
targets: { systems: ["operations.task-scheduler"] }
|
|
7844
|
-
}
|
|
7845
|
-
}
|
|
7846
|
-
},
|
|
7847
|
-
monitoring: {
|
|
7848
|
-
type: "group",
|
|
7849
|
-
label: "Monitoring",
|
|
7850
|
-
icon: "monitoring",
|
|
7851
|
-
order: 40,
|
|
7852
|
-
children: {
|
|
7853
|
-
"monitoring-overview": {
|
|
7854
|
-
type: "surface",
|
|
7855
|
-
label: "Overview",
|
|
7856
|
-
path: "/monitoring",
|
|
7857
|
-
surfaceType: "page",
|
|
7858
|
-
order: 10,
|
|
7859
|
-
targets: { systems: ["monitoring"] }
|
|
7860
|
-
},
|
|
7861
|
-
"monitoring-calendar": {
|
|
7862
|
-
type: "surface",
|
|
7863
|
-
label: "Calendar",
|
|
7864
|
-
path: "/monitoring/calendar",
|
|
7865
|
-
surfaceType: "page",
|
|
7866
|
-
order: 20,
|
|
7867
|
-
targets: { systems: ["monitoring.calendar"] }
|
|
7868
|
-
},
|
|
7869
|
-
"monitoring-activity-log": {
|
|
7870
|
-
type: "surface",
|
|
7871
|
-
label: "Activity Log",
|
|
7872
|
-
path: "/monitoring/activity-log",
|
|
7873
|
-
surfaceType: "list",
|
|
7874
|
-
order: 30,
|
|
7875
|
-
targets: { systems: ["monitoring.activity-log"] }
|
|
7876
|
-
},
|
|
7877
|
-
"monitoring-execution-logs": {
|
|
7878
|
-
type: "surface",
|
|
7879
|
-
label: "Execution Logs",
|
|
7880
|
-
path: "/monitoring/execution-logs",
|
|
7881
|
-
surfaceType: "list",
|
|
7882
|
-
order: 40,
|
|
7883
|
-
targets: { systems: ["monitoring.execution-logs"] }
|
|
7884
|
-
},
|
|
7885
|
-
"monitoring-execution-health": {
|
|
7886
|
-
type: "surface",
|
|
7887
|
-
label: "Execution Health",
|
|
7888
|
-
path: "/monitoring/execution-health",
|
|
7889
|
-
surfaceType: "dashboard",
|
|
7890
|
-
order: 50,
|
|
7891
|
-
targets: { systems: ["monitoring.execution-health"] }
|
|
7892
|
-
},
|
|
7893
|
-
"monitoring-notifications": {
|
|
7894
|
-
type: "surface",
|
|
7895
|
-
label: "Notifications",
|
|
7896
|
-
path: "/monitoring/notifications",
|
|
7897
|
-
surfaceType: "list",
|
|
7898
|
-
order: 60,
|
|
7899
|
-
targets: { systems: ["monitoring.notifications"] }
|
|
7900
|
-
},
|
|
7901
|
-
"monitoring-requests": {
|
|
7902
|
-
type: "surface",
|
|
7903
|
-
label: "Requests",
|
|
7904
|
-
path: "/monitoring/requests",
|
|
7905
|
-
surfaceType: "list",
|
|
7906
|
-
order: 70,
|
|
7907
|
-
targets: { systems: ["monitoring.submitted-requests"] }
|
|
7908
|
-
}
|
|
7909
|
-
}
|
|
7910
|
-
},
|
|
7911
|
-
knowledge: {
|
|
7912
|
-
type: "surface",
|
|
7913
|
-
label: "Knowledge Base",
|
|
7914
|
-
path: "/knowledge",
|
|
7915
|
-
surfaceType: "page",
|
|
7916
|
-
icon: "knowledge",
|
|
7917
|
-
order: 50
|
|
7918
|
-
}
|
|
7919
|
-
},
|
|
7920
|
-
bottom: {
|
|
7921
|
-
settings: {
|
|
7922
|
-
type: "group",
|
|
7923
|
-
label: "Settings",
|
|
7924
|
-
icon: "settings",
|
|
7925
|
-
order: 10,
|
|
7926
|
-
children: {
|
|
7927
|
-
"settings-account": {
|
|
7928
|
-
type: "surface",
|
|
7929
|
-
label: "Account",
|
|
7930
|
-
path: "/settings/account",
|
|
7931
|
-
surfaceType: "settings",
|
|
7932
|
-
order: 10,
|
|
7933
|
-
targets: { systems: ["settings.account"] }
|
|
7934
|
-
},
|
|
7935
|
-
"settings-appearance": {
|
|
7936
|
-
type: "surface",
|
|
7937
|
-
label: "Appearance",
|
|
7938
|
-
path: "/settings/appearance",
|
|
7939
|
-
surfaceType: "settings",
|
|
7940
|
-
order: 20,
|
|
7941
|
-
targets: { systems: ["settings.appearance"] }
|
|
7942
|
-
},
|
|
7943
|
-
"settings-roles": {
|
|
7944
|
-
type: "surface",
|
|
7945
|
-
label: "My Roles",
|
|
7946
|
-
path: "/settings/roles",
|
|
7947
|
-
surfaceType: "settings",
|
|
7948
|
-
order: 30,
|
|
7949
|
-
targets: { systems: ["settings.roles"] }
|
|
7950
|
-
},
|
|
7951
|
-
"settings-organization": {
|
|
7952
|
-
type: "surface",
|
|
7953
|
-
label: "Organization",
|
|
7954
|
-
path: "/settings/organization",
|
|
7955
|
-
surfaceType: "settings",
|
|
7956
|
-
order: 40,
|
|
7957
|
-
targets: { systems: ["settings.organization"] }
|
|
7958
|
-
},
|
|
7959
|
-
"settings-credentials": {
|
|
7960
|
-
type: "surface",
|
|
7961
|
-
label: "Credentials",
|
|
7962
|
-
path: "/settings/credentials",
|
|
7963
|
-
surfaceType: "settings",
|
|
7964
|
-
order: 50,
|
|
7965
|
-
targets: { systems: ["settings.credentials"] }
|
|
7966
|
-
},
|
|
7967
|
-
"settings-api-keys": {
|
|
7968
|
-
type: "surface",
|
|
7969
|
-
label: "API Keys",
|
|
7970
|
-
path: "/settings/api-keys",
|
|
7971
|
-
surfaceType: "settings",
|
|
7972
|
-
order: 60,
|
|
7973
|
-
targets: { systems: ["settings.api-keys"] }
|
|
7974
|
-
},
|
|
7975
|
-
"settings-webhooks": {
|
|
7976
|
-
type: "surface",
|
|
7977
|
-
label: "Webhooks",
|
|
7978
|
-
path: "/settings/webhooks",
|
|
7979
|
-
surfaceType: "settings",
|
|
7980
|
-
order: 70,
|
|
7981
|
-
targets: { systems: ["settings.webhooks"] }
|
|
7982
|
-
},
|
|
7983
|
-
"settings-deployments": {
|
|
7984
|
-
type: "surface",
|
|
7985
|
-
label: "Deployments",
|
|
7986
|
-
path: "/settings/deployments",
|
|
7987
|
-
surfaceType: "settings",
|
|
7988
|
-
order: 80,
|
|
7989
|
-
targets: { systems: ["settings.deployments"] }
|
|
7990
|
-
}
|
|
7991
|
-
}
|
|
7992
|
-
},
|
|
7993
|
-
admin: {
|
|
7994
|
-
type: "group",
|
|
7995
|
-
label: "Admin",
|
|
7996
|
-
icon: "admin",
|
|
7997
|
-
order: 20,
|
|
7998
|
-
children: {
|
|
7999
|
-
"admin-dashboard": {
|
|
8000
|
-
type: "surface",
|
|
8001
|
-
label: "Dashboard",
|
|
8002
|
-
path: "/admin/dashboard",
|
|
8003
|
-
surfaceType: "dashboard",
|
|
8004
|
-
order: 10,
|
|
8005
|
-
targets: { systems: ["admin"] },
|
|
8006
|
-
requiresAdmin: true
|
|
8007
|
-
},
|
|
8008
|
-
"admin-system-health": {
|
|
8009
|
-
type: "surface",
|
|
8010
|
-
label: "System Health",
|
|
8011
|
-
path: "/admin/system-health",
|
|
8012
|
-
surfaceType: "dashboard",
|
|
8013
|
-
order: 20,
|
|
8014
|
-
targets: { systems: ["admin.system-health"] },
|
|
8015
|
-
requiresAdmin: true
|
|
8016
|
-
},
|
|
8017
|
-
"admin-organizations": {
|
|
8018
|
-
type: "surface",
|
|
8019
|
-
label: "Organizations",
|
|
8020
|
-
path: "/admin/organizations",
|
|
8021
|
-
surfaceType: "list",
|
|
8022
|
-
order: 30,
|
|
8023
|
-
targets: { systems: ["admin.organizations"] },
|
|
8024
|
-
requiresAdmin: true
|
|
8025
|
-
},
|
|
8026
|
-
"admin-users": {
|
|
8027
|
-
type: "surface",
|
|
8028
|
-
label: "Users",
|
|
8029
|
-
path: "/admin/users",
|
|
8030
|
-
surfaceType: "list",
|
|
8031
|
-
order: 40,
|
|
8032
|
-
targets: { systems: ["admin.users"] },
|
|
8033
|
-
requiresAdmin: true
|
|
8034
|
-
},
|
|
8035
|
-
"admin-design-showcase": {
|
|
8036
|
-
type: "surface",
|
|
8037
|
-
label: "Design Showcase",
|
|
8038
|
-
path: "/admin/design-showcase",
|
|
8039
|
-
surfaceType: "page",
|
|
8040
|
-
order: 50,
|
|
8041
|
-
targets: { systems: ["admin.design-showcase"] },
|
|
8042
|
-
requiresAdmin: true
|
|
8043
|
-
},
|
|
8044
|
-
"admin-debug": {
|
|
8045
|
-
type: "surface",
|
|
8046
|
-
label: "Debug",
|
|
8047
|
-
path: "/admin/debug",
|
|
8048
|
-
surfaceType: "page",
|
|
8049
|
-
order: 60,
|
|
8050
|
-
targets: { systems: ["admin.debug"] },
|
|
8051
|
-
requiresAdmin: true
|
|
8052
|
-
}
|
|
8053
|
-
}
|
|
8054
|
-
}
|
|
8055
|
-
}
|
|
8056
|
-
}
|
|
8057
|
-
};
|
|
8058
|
-
var DEFAULT_ORGANIZATION_MODEL = {
|
|
8059
|
-
version: 1,
|
|
8060
|
-
domainMetadata: DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA,
|
|
8061
|
-
branding: DEFAULT_ORGANIZATION_MODEL_BRANDING,
|
|
8062
|
-
navigation: DEFAULT_ORGANIZATION_MODEL_NAVIGATION,
|
|
8063
|
-
identity: DEFAULT_ORGANIZATION_MODEL_IDENTITY,
|
|
8064
|
-
customers: DEFAULT_ORGANIZATION_MODEL_CUSTOMERS,
|
|
8065
|
-
offerings: DEFAULT_ORGANIZATION_MODEL_OFFERINGS,
|
|
8066
|
-
roles: DEFAULT_ORGANIZATION_MODEL_ROLES,
|
|
8067
|
-
goals: DEFAULT_ORGANIZATION_MODEL_GOALS,
|
|
8068
|
-
systems: {
|
|
8069
|
-
dashboard: {
|
|
8070
|
-
id: "dashboard",
|
|
8071
|
-
order: 10,
|
|
8072
|
-
label: "Dashboard",
|
|
8073
|
-
enabled: true,
|
|
8074
|
-
lifecycle: "active",
|
|
8075
|
-
path: "/",
|
|
8076
|
-
icon: "dashboard"
|
|
8077
|
-
},
|
|
8078
|
-
platform: {
|
|
8079
|
-
id: "platform",
|
|
8080
|
-
order: 30,
|
|
8081
|
-
label: "Platform",
|
|
8082
|
-
description: "Elevasis platform architecture, capabilities, and implementation patterns",
|
|
8083
|
-
enabled: true,
|
|
8084
|
-
lifecycle: "active",
|
|
8085
|
-
color: "cyan",
|
|
8086
|
-
icon: "platform"
|
|
8087
|
-
},
|
|
8088
|
-
finance: {
|
|
8089
|
-
id: "finance",
|
|
8090
|
-
order: 40,
|
|
8091
|
-
label: "Finance",
|
|
8092
|
-
description: "Finance operations, accounting, billing, reconciliation, and tax prep",
|
|
8093
|
-
enabled: true,
|
|
8094
|
-
lifecycle: "active",
|
|
8095
|
-
color: "green",
|
|
8096
|
-
icon: "finance"
|
|
8097
|
-
},
|
|
8098
|
-
sales: {
|
|
8099
|
-
id: "sales",
|
|
8100
|
-
order: 60,
|
|
8101
|
-
label: "Sales",
|
|
8102
|
-
description: "Revenue workflows and customer acquisition",
|
|
8103
|
-
enabled: true,
|
|
8104
|
-
lifecycle: "active",
|
|
8105
|
-
color: "blue",
|
|
8106
|
-
icon: "sales",
|
|
8107
|
-
path: "/sales"
|
|
8108
|
-
},
|
|
8109
|
-
"sales.crm": {
|
|
8110
|
-
id: "sales.crm",
|
|
8111
|
-
order: 70,
|
|
8112
|
-
label: "CRM",
|
|
8113
|
-
description: "Relationship pipeline and deal management",
|
|
8114
|
-
enabled: true,
|
|
8115
|
-
lifecycle: "active",
|
|
8116
|
-
actions: Object.values(CRM_ACTION_ENTRIES).map((action) => ({
|
|
8117
|
-
actionId: action.id,
|
|
8118
|
-
intent: "exposes"
|
|
8119
|
-
})),
|
|
8120
|
-
color: "blue",
|
|
8121
|
-
icon: "crm",
|
|
8122
|
-
path: "/crm"
|
|
8123
|
-
},
|
|
8124
|
-
"sales.lead-gen": {
|
|
8125
|
-
id: "sales.lead-gen",
|
|
8126
|
-
order: 80,
|
|
8127
|
-
label: "Lead Gen",
|
|
8128
|
-
description: "Prospecting, qualification, and outreach preparation",
|
|
8129
|
-
enabled: true,
|
|
8130
|
-
lifecycle: "active",
|
|
8131
|
-
actions: Object.values(LEAD_GEN_ACTION_ENTRIES).map((action) => ({
|
|
8132
|
-
actionId: action.id,
|
|
8133
|
-
intent: "exposes"
|
|
8134
|
-
})),
|
|
8135
|
-
color: "cyan",
|
|
8136
|
-
icon: "lead-gen",
|
|
8137
|
-
path: "/lead-gen"
|
|
8138
|
-
},
|
|
8139
|
-
projects: {
|
|
8140
|
-
id: "projects",
|
|
8141
|
-
order: 90,
|
|
8142
|
-
label: "Projects",
|
|
8143
|
-
description: "Projects, milestones, and client work execution",
|
|
8144
|
-
enabled: true,
|
|
8145
|
-
lifecycle: "active",
|
|
8146
|
-
color: "orange",
|
|
8147
|
-
icon: "projects",
|
|
8148
|
-
path: "/projects"
|
|
8149
|
-
},
|
|
8150
|
-
clients: {
|
|
8151
|
-
id: "clients",
|
|
8152
|
-
order: 100,
|
|
8153
|
-
label: "Clients",
|
|
8154
|
-
description: "Client relationships, accounts, and business context",
|
|
8155
|
-
enabled: true,
|
|
8156
|
-
lifecycle: "active",
|
|
8157
|
-
color: "orange",
|
|
8158
|
-
icon: "clients",
|
|
8159
|
-
path: "/clients"
|
|
8160
|
-
},
|
|
8161
|
-
operations: {
|
|
8162
|
-
id: "operations",
|
|
8163
|
-
order: 110,
|
|
8164
|
-
label: "Operations",
|
|
8165
|
-
description: "Operational resources, topology, and orchestration visibility",
|
|
8166
|
-
enabled: true,
|
|
8167
|
-
lifecycle: "active",
|
|
8168
|
-
color: "violet",
|
|
8169
|
-
icon: "operations"
|
|
8170
|
-
},
|
|
8171
|
-
"knowledge.command-view": {
|
|
8172
|
-
id: "knowledge.command-view",
|
|
8173
|
-
order: 120,
|
|
8174
|
-
label: "Command View",
|
|
8175
|
-
enabled: true,
|
|
8176
|
-
lifecycle: "active",
|
|
8177
|
-
path: "/knowledge/command-view",
|
|
8178
|
-
devOnly: true
|
|
8179
|
-
},
|
|
8180
|
-
"operations.overview": {
|
|
8181
|
-
id: "operations.overview",
|
|
8182
|
-
order: 130,
|
|
8183
|
-
label: "Overview",
|
|
8184
|
-
enabled: true,
|
|
8185
|
-
lifecycle: "active",
|
|
8186
|
-
path: "/operations"
|
|
8187
|
-
},
|
|
8188
|
-
"operations.resources": {
|
|
8189
|
-
id: "operations.resources",
|
|
8190
|
-
order: 140,
|
|
8191
|
-
label: "Resources",
|
|
8192
|
-
enabled: true,
|
|
8193
|
-
lifecycle: "active",
|
|
8194
|
-
path: "/operations/resources"
|
|
8195
|
-
},
|
|
8196
|
-
"operations.command-queue": {
|
|
8197
|
-
id: "operations.command-queue",
|
|
8198
|
-
order: 150,
|
|
8199
|
-
label: "Command Queue",
|
|
8200
|
-
enabled: true,
|
|
8201
|
-
lifecycle: "active",
|
|
8202
|
-
path: "/operations/command-queue"
|
|
8203
|
-
},
|
|
8204
|
-
"operations.sessions": {
|
|
8205
|
-
id: "operations.sessions",
|
|
8206
|
-
order: 160,
|
|
8207
|
-
label: "Sessions",
|
|
8208
|
-
enabled: false,
|
|
8209
|
-
lifecycle: "deprecated",
|
|
8210
|
-
path: "/operations/sessions"
|
|
8211
|
-
},
|
|
8212
|
-
"operations.task-scheduler": {
|
|
8213
|
-
id: "operations.task-scheduler",
|
|
8214
|
-
order: 170,
|
|
8215
|
-
label: "Task Scheduler",
|
|
8216
|
-
enabled: true,
|
|
8217
|
-
lifecycle: "active",
|
|
8218
|
-
path: "/operations/task-scheduler"
|
|
8219
|
-
},
|
|
8220
|
-
monitoring: {
|
|
8221
|
-
id: "monitoring",
|
|
8222
|
-
order: 180,
|
|
8223
|
-
label: "Monitoring",
|
|
8224
|
-
enabled: true,
|
|
8225
|
-
lifecycle: "active"
|
|
8226
|
-
},
|
|
8227
|
-
"monitoring.calendar": {
|
|
8228
|
-
id: "monitoring.calendar",
|
|
8229
|
-
order: 190,
|
|
8230
|
-
label: "Calendar",
|
|
8231
|
-
description: "Google Calendar events and agenda views",
|
|
8232
|
-
enabled: true,
|
|
8233
|
-
lifecycle: "active",
|
|
8234
|
-
path: "/monitoring/calendar",
|
|
8235
|
-
icon: "calendar"
|
|
8236
|
-
},
|
|
8237
|
-
"monitoring.activity-log": {
|
|
8238
|
-
id: "monitoring.activity-log",
|
|
8239
|
-
order: 200,
|
|
8240
|
-
label: "Activity Log",
|
|
8241
|
-
enabled: true,
|
|
8242
|
-
lifecycle: "active",
|
|
8243
|
-
path: "/monitoring/activity-log"
|
|
8244
|
-
},
|
|
8245
|
-
"monitoring.execution-logs": {
|
|
8246
|
-
id: "monitoring.execution-logs",
|
|
8247
|
-
order: 210,
|
|
8248
|
-
label: "Execution Logs",
|
|
8249
|
-
enabled: true,
|
|
8250
|
-
lifecycle: "active",
|
|
8251
|
-
path: "/monitoring/execution-logs"
|
|
8252
|
-
},
|
|
8253
|
-
"monitoring.execution-health": {
|
|
8254
|
-
id: "monitoring.execution-health",
|
|
8255
|
-
order: 220,
|
|
8256
|
-
label: "Execution Health",
|
|
8257
|
-
enabled: true,
|
|
8258
|
-
lifecycle: "active",
|
|
8259
|
-
path: "/monitoring/execution-health"
|
|
8260
|
-
},
|
|
8261
|
-
"monitoring.cost-analytics": {
|
|
8262
|
-
id: "monitoring.cost-analytics",
|
|
8263
|
-
order: 230,
|
|
8264
|
-
label: "Cost Analytics",
|
|
8265
|
-
enabled: false,
|
|
8266
|
-
lifecycle: "deprecated",
|
|
8267
|
-
path: "/monitoring/cost-analytics"
|
|
8268
|
-
},
|
|
8269
|
-
"monitoring.notifications": {
|
|
8270
|
-
id: "monitoring.notifications",
|
|
8271
|
-
order: 240,
|
|
8272
|
-
label: "Notifications",
|
|
8273
|
-
enabled: true,
|
|
8274
|
-
lifecycle: "active",
|
|
8275
|
-
path: "/monitoring/notifications"
|
|
8276
|
-
},
|
|
8277
|
-
"monitoring.submitted-requests": {
|
|
8278
|
-
id: "monitoring.submitted-requests",
|
|
8279
|
-
order: 250,
|
|
8280
|
-
label: "Submitted Requests",
|
|
8281
|
-
enabled: true,
|
|
8282
|
-
lifecycle: "active",
|
|
8283
|
-
path: "/monitoring/requests"
|
|
8284
|
-
},
|
|
8285
|
-
settings: {
|
|
8286
|
-
id: "settings",
|
|
8287
|
-
order: 260,
|
|
8288
|
-
label: "Settings",
|
|
8289
|
-
enabled: true,
|
|
8290
|
-
lifecycle: "active",
|
|
8291
|
-
icon: "settings"
|
|
8292
|
-
},
|
|
8293
|
-
"settings.account": {
|
|
8294
|
-
id: "settings.account",
|
|
8295
|
-
order: 270,
|
|
8296
|
-
label: "Account",
|
|
8297
|
-
enabled: true,
|
|
8298
|
-
lifecycle: "active",
|
|
8299
|
-
path: "/settings/account"
|
|
8300
|
-
},
|
|
8301
|
-
"settings.appearance": {
|
|
8302
|
-
id: "settings.appearance",
|
|
8303
|
-
order: 280,
|
|
8304
|
-
label: "Appearance",
|
|
8305
|
-
enabled: true,
|
|
8306
|
-
lifecycle: "active",
|
|
8307
|
-
path: "/settings/appearance"
|
|
8308
|
-
},
|
|
8309
|
-
"settings.roles": {
|
|
8310
|
-
id: "settings.roles",
|
|
8311
|
-
order: 290,
|
|
8312
|
-
label: "My Roles",
|
|
8313
|
-
enabled: true,
|
|
8314
|
-
lifecycle: "active",
|
|
8315
|
-
path: "/settings/roles"
|
|
8316
|
-
},
|
|
8317
|
-
"settings.organization": {
|
|
8318
|
-
id: "settings.organization",
|
|
8319
|
-
order: 300,
|
|
8320
|
-
label: "Organization",
|
|
8321
|
-
enabled: true,
|
|
8322
|
-
lifecycle: "active",
|
|
8323
|
-
path: "/settings/organization"
|
|
8324
|
-
},
|
|
8325
|
-
"settings.credentials": {
|
|
8326
|
-
id: "settings.credentials",
|
|
8327
|
-
order: 310,
|
|
8328
|
-
label: "Credentials",
|
|
8329
|
-
enabled: true,
|
|
8330
|
-
lifecycle: "active",
|
|
8331
|
-
path: "/settings/credentials"
|
|
8332
|
-
},
|
|
8333
|
-
"settings.api-keys": {
|
|
8334
|
-
id: "settings.api-keys",
|
|
8335
|
-
order: 320,
|
|
8336
|
-
label: "API Keys",
|
|
8337
|
-
enabled: true,
|
|
8338
|
-
lifecycle: "active",
|
|
8339
|
-
path: "/settings/api-keys"
|
|
8340
|
-
},
|
|
8341
|
-
"settings.webhooks": {
|
|
8342
|
-
id: "settings.webhooks",
|
|
8343
|
-
order: 330,
|
|
8344
|
-
label: "Webhooks",
|
|
8345
|
-
enabled: true,
|
|
8346
|
-
lifecycle: "active",
|
|
8347
|
-
path: "/settings/webhooks"
|
|
8348
|
-
},
|
|
8349
|
-
"settings.deployments": {
|
|
8350
|
-
id: "settings.deployments",
|
|
8351
|
-
order: 340,
|
|
8352
|
-
label: "Deployments",
|
|
8353
|
-
enabled: true,
|
|
8354
|
-
lifecycle: "active",
|
|
8355
|
-
path: "/settings/deployments"
|
|
8356
|
-
},
|
|
8357
|
-
admin: {
|
|
8358
|
-
id: "admin",
|
|
8359
|
-
order: 350,
|
|
8360
|
-
label: "Admin",
|
|
8361
|
-
enabled: true,
|
|
8362
|
-
lifecycle: "active",
|
|
8363
|
-
path: "/admin",
|
|
8364
|
-
icon: "admin",
|
|
8365
|
-
requiresAdmin: true
|
|
8366
|
-
},
|
|
8367
|
-
"admin.system-health": {
|
|
8368
|
-
id: "admin.system-health",
|
|
8369
|
-
order: 360,
|
|
8370
|
-
label: "System Health",
|
|
8371
|
-
enabled: true,
|
|
8372
|
-
lifecycle: "active",
|
|
8373
|
-
path: "/admin/system-health"
|
|
8374
|
-
},
|
|
8375
|
-
"admin.organizations": {
|
|
8376
|
-
id: "admin.organizations",
|
|
8377
|
-
order: 370,
|
|
8378
|
-
label: "Organizations",
|
|
8379
|
-
enabled: true,
|
|
8380
|
-
lifecycle: "active",
|
|
8381
|
-
path: "/admin/organizations"
|
|
8382
|
-
},
|
|
8383
|
-
"admin.users": {
|
|
8384
|
-
id: "admin.users",
|
|
8385
|
-
order: 380,
|
|
8386
|
-
label: "Users",
|
|
8387
|
-
enabled: true,
|
|
8388
|
-
lifecycle: "active",
|
|
8389
|
-
path: "/admin/users"
|
|
8390
|
-
},
|
|
8391
|
-
"admin.design-showcase": {
|
|
8392
|
-
id: "admin.design-showcase",
|
|
8393
|
-
order: 390,
|
|
8394
|
-
label: "Design Showcase",
|
|
8395
|
-
enabled: true,
|
|
8396
|
-
lifecycle: "active",
|
|
8397
|
-
path: "/admin/design-showcase"
|
|
8398
|
-
},
|
|
8399
|
-
"admin.debug": {
|
|
8400
|
-
id: "admin.debug",
|
|
8401
|
-
order: 400,
|
|
8402
|
-
label: "Debug",
|
|
8403
|
-
enabled: true,
|
|
8404
|
-
lifecycle: "active",
|
|
8405
|
-
path: "/admin/debug"
|
|
8406
|
-
},
|
|
8407
|
-
archive: {
|
|
8408
|
-
id: "archive",
|
|
8409
|
-
order: 410,
|
|
8410
|
-
label: "Archive",
|
|
8411
|
-
enabled: true,
|
|
8412
|
-
lifecycle: "active",
|
|
8413
|
-
path: "/archive",
|
|
8414
|
-
icon: "archive",
|
|
8415
|
-
devOnly: true
|
|
8416
|
-
},
|
|
8417
|
-
"archive.agent-chat": {
|
|
8418
|
-
id: "archive.agent-chat",
|
|
8419
|
-
order: 420,
|
|
8420
|
-
label: "Agent Chat",
|
|
8421
|
-
enabled: true,
|
|
8422
|
-
lifecycle: "active",
|
|
8423
|
-
path: "/archive/agent-chat"
|
|
8424
|
-
},
|
|
8425
|
-
"archive.execution-runner": {
|
|
8426
|
-
id: "archive.execution-runner",
|
|
8427
|
-
order: 430,
|
|
8428
|
-
label: "Execution Runner",
|
|
8429
|
-
enabled: true,
|
|
8430
|
-
lifecycle: "active",
|
|
8431
|
-
path: "/archive/execution-runner"
|
|
8432
|
-
},
|
|
8433
|
-
seo: {
|
|
8434
|
-
id: "seo",
|
|
8435
|
-
order: 440,
|
|
8436
|
-
label: "SEO",
|
|
8437
|
-
enabled: false,
|
|
8438
|
-
lifecycle: "deprecated",
|
|
8439
|
-
path: "/seo"
|
|
8440
|
-
},
|
|
8441
|
-
knowledge: {
|
|
8442
|
-
id: "knowledge",
|
|
8443
|
-
order: 450,
|
|
8444
|
-
label: "Knowledge",
|
|
8445
|
-
description: "Operational knowledge, playbooks, and strategy docs",
|
|
8446
|
-
enabled: true,
|
|
8447
|
-
lifecycle: "active",
|
|
8448
|
-
color: "teal",
|
|
8449
|
-
icon: "knowledge"
|
|
8450
|
-
},
|
|
8451
|
-
"knowledge.base": {
|
|
8452
|
-
id: "knowledge.base",
|
|
8453
|
-
order: 460,
|
|
8454
|
-
label: "Knowledge Base",
|
|
8455
|
-
enabled: true,
|
|
8456
|
-
lifecycle: "active",
|
|
8457
|
-
path: "/knowledge"
|
|
8458
|
-
}
|
|
8459
|
-
},
|
|
8460
|
-
ontology: DEFAULT_ONTOLOGY_SCOPE,
|
|
8461
|
-
resources: DEFAULT_ORGANIZATION_MODEL_RESOURCES,
|
|
8462
|
-
topology: DEFAULT_ORGANIZATION_MODEL_TOPOLOGY,
|
|
8463
|
-
actions: DEFAULT_ORGANIZATION_MODEL_ACTIONS,
|
|
8464
|
-
entities: DEFAULT_ORGANIZATION_MODEL_ENTITIES2,
|
|
8465
|
-
policies: DEFAULT_ORGANIZATION_MODEL_POLICIES,
|
|
8466
|
-
// Phase 4 (D1): statuses top-level field removed; bridge status mirrors may
|
|
8467
|
-
// still project from System.content, but primary authoring belongs in ontology.
|
|
8468
|
-
knowledge: DEFAULT_ORGANIZATION_MODEL_KNOWLEDGE
|
|
8469
|
-
};
|
|
8470
|
-
|
|
8471
|
-
// ../core/src/business/acquisition/ontology-validation.ts
|
|
8472
|
-
var CRM_PIPELINE_CATALOG_ONTOLOGY_ID = formatOntologyId({
|
|
8473
|
-
scope: "sales.crm",
|
|
8474
|
-
kind: "catalog",
|
|
8475
|
-
localId: "crm.pipeline"
|
|
8476
|
-
});
|
|
8477
|
-
var LEAD_GEN_STAGE_CATALOG_ONTOLOGY_ID = formatOntologyId({
|
|
8478
|
-
scope: "sales.lead-gen",
|
|
8479
|
-
kind: "catalog",
|
|
8480
|
-
localId: "lead-gen.stage-catalog"
|
|
8481
|
-
});
|
|
8482
|
-
var CRM_DEAL_OBJECT_ONTOLOGY_ID = formatOntologyId({
|
|
8483
|
-
scope: "sales.crm",
|
|
8484
|
-
kind: "object",
|
|
8485
|
-
localId: "crm.deal"
|
|
8486
|
-
});
|
|
8487
|
-
function createCrmPipelineCatalog() {
|
|
8488
|
-
return {
|
|
8489
|
-
id: CRM_PIPELINE_CATALOG_ONTOLOGY_ID,
|
|
8490
|
-
label: CRM_PIPELINE_DEFINITION.label,
|
|
8491
|
-
ownerSystemId: "sales.crm",
|
|
8492
|
-
kind: "pipeline",
|
|
8493
|
-
appliesTo: CRM_DEAL_OBJECT_ONTOLOGY_ID,
|
|
8494
|
-
entries: Object.fromEntries(
|
|
8495
|
-
CRM_PIPELINE_DEFINITION.stages.map((stage, index) => [
|
|
8496
|
-
stage.stageKey,
|
|
8497
|
-
{
|
|
8498
|
-
key: stage.stageKey,
|
|
8499
|
-
label: stage.label,
|
|
8500
|
-
order: (index + 1) * 10,
|
|
8501
|
-
...stage.color !== void 0 ? { color: stage.color } : {},
|
|
8502
|
-
states: stage.states.map((state) => ({ ...state }))
|
|
8503
|
-
}
|
|
8504
|
-
])
|
|
8505
|
-
),
|
|
8506
|
-
legacyPipelineKey: CRM_PIPELINE_DEFINITION.pipelineKey,
|
|
8507
|
-
legacyEntityKey: CRM_PIPELINE_DEFINITION.entityKey
|
|
8508
|
-
};
|
|
8509
|
-
}
|
|
8510
|
-
function createLeadGenStageCatalog() {
|
|
8511
|
-
return {
|
|
8512
|
-
id: LEAD_GEN_STAGE_CATALOG_ONTOLOGY_ID,
|
|
8513
|
-
label: "Lead Gen Processing Stages",
|
|
8514
|
-
ownerSystemId: "sales.lead-gen",
|
|
8515
|
-
kind: "processing-stage-catalog",
|
|
8516
|
-
entries: Object.fromEntries(
|
|
8517
|
-
Object.entries(LEAD_GEN_STAGE_CATALOG).map(([key, entry]) => [
|
|
8518
|
-
key,
|
|
8519
|
-
{
|
|
8520
|
-
...entry
|
|
8521
|
-
}
|
|
8522
|
-
])
|
|
8523
|
-
),
|
|
8524
|
-
legacyCatalogKey: "LEAD_GEN_STAGE_CATALOG"
|
|
8525
|
-
};
|
|
8526
|
-
}
|
|
8527
|
-
function isPlainRecord(value) {
|
|
8528
|
-
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
8529
|
-
}
|
|
8530
|
-
function mergeBridgeCatalogs(model) {
|
|
8531
|
-
const baseCatalogTypes = model.ontology?.catalogTypes ?? {};
|
|
8532
|
-
const bridgeCatalogTypes = {};
|
|
8533
|
-
if (baseCatalogTypes[CRM_PIPELINE_CATALOG_ONTOLOGY_ID] === void 0) {
|
|
8534
|
-
bridgeCatalogTypes[CRM_PIPELINE_CATALOG_ONTOLOGY_ID] = createCrmPipelineCatalog();
|
|
8535
|
-
}
|
|
8536
|
-
if (baseCatalogTypes[LEAD_GEN_STAGE_CATALOG_ONTOLOGY_ID] === void 0) {
|
|
8537
|
-
bridgeCatalogTypes[LEAD_GEN_STAGE_CATALOG_ONTOLOGY_ID] = createLeadGenStageCatalog();
|
|
8538
|
-
}
|
|
8539
|
-
if (Object.keys(bridgeCatalogTypes).length === 0) return model;
|
|
8540
|
-
return {
|
|
8541
|
-
...model,
|
|
8542
|
-
ontology: {
|
|
8543
|
-
...model.ontology ?? {},
|
|
8544
|
-
catalogTypes: {
|
|
8545
|
-
...baseCatalogTypes,
|
|
8546
|
-
...bridgeCatalogTypes
|
|
8547
|
-
}
|
|
8548
|
-
}
|
|
8549
|
-
};
|
|
8550
|
-
}
|
|
8551
|
-
function compileBusinessOntologyValidationIndex(model = DEFAULT_ORGANIZATION_MODEL) {
|
|
8552
|
-
const compilation = compileOrganizationOntology(mergeBridgeCatalogs(model));
|
|
8553
|
-
if (compilation.diagnostics.length > 0) {
|
|
8554
|
-
const summary = compilation.diagnostics.map((diagnostic) => diagnostic.message).join("; ");
|
|
8555
|
-
throw new Error(`Business ontology validation index failed to compile: ${summary}`);
|
|
8556
|
-
}
|
|
8557
|
-
const crmPipelineCatalog = compilation.ontology.catalogTypes[CRM_PIPELINE_CATALOG_ONTOLOGY_ID];
|
|
8558
|
-
const leadGenStageCatalog = compilation.ontology.catalogTypes[LEAD_GEN_STAGE_CATALOG_ONTOLOGY_ID];
|
|
8559
|
-
if (crmPipelineCatalog === void 0 || leadGenStageCatalog === void 0) {
|
|
8560
|
-
throw new Error("Business ontology validation index is missing CRM or lead-gen catalog bridge records");
|
|
8561
|
-
}
|
|
8562
|
-
return {
|
|
8563
|
-
ontology: compilation.ontology,
|
|
8564
|
-
crmPipelineCatalog,
|
|
8565
|
-
leadGenStageCatalog,
|
|
8566
|
-
actionTypesByLegacyId: indexActionTypesByLegacyId(compilation.ontology.actionTypes)
|
|
8567
|
-
};
|
|
8568
|
-
}
|
|
8569
|
-
function indexActionTypesByLegacyId(actionTypes) {
|
|
8570
|
-
const byLegacyId = {};
|
|
8571
|
-
for (const actionType of Object.values(actionTypes)) {
|
|
8572
|
-
const legacyActionId = actionType["legacyActionId"];
|
|
8573
|
-
if (typeof legacyActionId === "string") {
|
|
8574
|
-
byLegacyId[legacyActionId] = actionType;
|
|
8575
|
-
}
|
|
8576
|
-
}
|
|
8577
|
-
return byLegacyId;
|
|
8578
|
-
}
|
|
8579
|
-
var BUSINESS_ONTOLOGY_VALIDATION_INDEX = compileBusinessOntologyValidationIndex();
|
|
8580
|
-
function getCatalogEntries(catalog) {
|
|
8581
|
-
return isPlainRecord(catalog.entries) ? catalog.entries : {};
|
|
8582
|
-
}
|
|
8583
|
-
function asCrmStageEntry(key, value) {
|
|
8584
|
-
const record = isPlainRecord(value) ? value : {};
|
|
8585
|
-
const label = typeof record.label === "string" ? record.label : key;
|
|
8586
|
-
const order = typeof record.order === "number" ? record.order : 0;
|
|
8587
|
-
const color = typeof record.color === "string" ? record.color : void 0;
|
|
8588
|
-
const rawStates = Array.isArray(record.states) ? record.states : [];
|
|
8589
|
-
const states = rawStates.flatMap((state) => {
|
|
8590
|
-
if (!isPlainRecord(state) || typeof state.stateKey !== "string") return [];
|
|
8591
|
-
return [
|
|
8592
|
-
{
|
|
8593
|
-
stateKey: state.stateKey,
|
|
8594
|
-
label: typeof state.label === "string" ? state.label : state.stateKey
|
|
8595
|
-
}
|
|
8596
|
-
];
|
|
8597
|
-
});
|
|
8598
|
-
return {
|
|
8599
|
-
key,
|
|
8600
|
-
label,
|
|
8601
|
-
order,
|
|
8602
|
-
...color !== void 0 ? { color } : {},
|
|
8603
|
-
states
|
|
8604
|
-
};
|
|
8605
|
-
}
|
|
8606
|
-
function asLeadGenStageEntry(key, value) {
|
|
8607
|
-
const record = isPlainRecord(value) ? value : {};
|
|
8608
|
-
const entity = record.entity === "contact" ? "contact" : "company";
|
|
8609
|
-
const additionalEntities = Array.isArray(record.additionalEntities) ? record.additionalEntities.filter(
|
|
8610
|
-
(item) => item === "company" || item === "contact"
|
|
8611
|
-
) : void 0;
|
|
8612
|
-
const recordEntity = record.recordEntity === "company" || record.recordEntity === "contact" ? record.recordEntity : void 0;
|
|
8613
|
-
const recordStageKey = typeof record.recordStageKey === "string" ? record.recordStageKey : void 0;
|
|
8614
|
-
return {
|
|
8615
|
-
key: typeof record.key === "string" ? record.key : key,
|
|
8616
|
-
label: typeof record.label === "string" ? record.label : key,
|
|
8617
|
-
description: typeof record.description === "string" ? record.description : "",
|
|
8618
|
-
order: typeof record.order === "number" ? record.order : 0,
|
|
8619
|
-
entity,
|
|
8620
|
-
...additionalEntities !== void 0 ? { additionalEntities } : {},
|
|
8621
|
-
...recordEntity !== void 0 ? { recordEntity } : {},
|
|
8622
|
-
...recordStageKey !== void 0 ? { recordStageKey } : {}
|
|
8623
|
-
};
|
|
8624
|
-
}
|
|
8625
|
-
var CRM_STAGE_KEYS_FROM_ONTOLOGY = Object.keys(
|
|
8626
|
-
getCatalogEntries(BUSINESS_ONTOLOGY_VALIDATION_INDEX.crmPipelineCatalog)
|
|
8627
|
-
);
|
|
8628
|
-
var CRM_STATE_KEYS_FROM_ONTOLOGY = Object.values(
|
|
8629
|
-
getCatalogEntries(BUSINESS_ONTOLOGY_VALIDATION_INDEX.crmPipelineCatalog)
|
|
8630
|
-
).flatMap((entry, index) => {
|
|
8631
|
-
const stageKey = CRM_STAGE_KEYS_FROM_ONTOLOGY[index];
|
|
8632
|
-
if (stageKey === void 0) return [];
|
|
8633
|
-
return asCrmStageEntry(stageKey, entry).states.map((state) => state.stateKey);
|
|
8634
|
-
});
|
|
8635
|
-
Object.keys(
|
|
8636
|
-
getCatalogEntries(BUSINESS_ONTOLOGY_VALIDATION_INDEX.leadGenStageCatalog)
|
|
8637
|
-
);
|
|
8638
|
-
function getLeadGenStageCatalogFromOntology() {
|
|
8639
|
-
return Object.fromEntries(
|
|
8640
|
-
Object.entries(getCatalogEntries(BUSINESS_ONTOLOGY_VALIDATION_INDEX.leadGenStageCatalog)).map(([key, value]) => [
|
|
8641
|
-
key,
|
|
8642
|
-
asLeadGenStageEntry(key, value)
|
|
8643
|
-
])
|
|
8644
|
-
);
|
|
8645
|
-
}
|
|
8646
|
-
function getLeadGenStageEntry(stageKey) {
|
|
8647
|
-
return getLeadGenStageCatalogFromOntology()[stageKey];
|
|
8648
|
-
}
|
|
8649
|
-
function isLeadGenStageKey(stageKey) {
|
|
8650
|
-
return getLeadGenStageEntry(stageKey) !== void 0;
|
|
8651
|
-
}
|
|
8652
|
-
function isLeadGenRecordStageValidForEntity(stageKey, entity) {
|
|
8653
|
-
const stage = getLeadGenStageEntry(stageKey);
|
|
8654
|
-
return stage !== void 0 && (stage.entity === entity || stage.additionalEntities?.includes(entity) === true || stage.recordEntity === entity);
|
|
8655
|
-
}
|
|
8656
|
-
function isLeadGenActionKey(actionKey) {
|
|
8657
|
-
return actionKey.startsWith("lead-gen.") && BUSINESS_ONTOLOGY_VALIDATION_INDEX.actionTypesByLegacyId[actionKey] !== void 0;
|
|
8658
|
-
}
|
|
8659
|
-
|
|
8660
|
-
// ../core/src/business/acquisition/api-schemas.ts
|
|
8661
|
-
var ProcessingStageStatusSchema = z.enum(["success", "no_result", "skipped", "error"]);
|
|
8662
|
-
var LeadGenStageKeySchema = z.string().refine((value) => isLeadGenStageKey(value), {
|
|
8663
|
-
message: "processing state key must match LEAD_GEN_STAGE_CATALOG"
|
|
8664
|
-
});
|
|
8665
|
-
var LeadGenActionKeySchema = z.string().refine((value) => isLeadGenActionKey(value), {
|
|
8666
|
-
message: "actionKey must match ACTION_REGISTRY"
|
|
8667
|
-
});
|
|
8668
|
-
var crmStageKeys = CRM_STAGE_KEYS_FROM_ONTOLOGY;
|
|
8669
|
-
var crmStateKeys = CRM_STATE_KEYS_FROM_ONTOLOGY;
|
|
8670
|
-
var CrmStageKeySchema = z.enum(crmStageKeys);
|
|
8671
|
-
var CrmStateKeySchema = z.enum(crmStateKeys);
|
|
8672
|
-
var ProcessingStateEntrySchema = z.object({
|
|
8673
|
-
status: ProcessingStageStatusSchema,
|
|
8674
|
-
data: z.unknown().optional()
|
|
8675
|
-
}).passthrough();
|
|
8676
|
-
var ProcessingStateSchema = z.record(LeadGenStageKeySchema, ProcessingStateEntrySchema);
|
|
8677
|
-
var CompanyProcessingStateSchema = ProcessingStateSchema;
|
|
8678
|
-
var ContactProcessingStateSchema = ProcessingStateSchema;
|
|
8679
|
-
var DealStageSchema = CrmStageKeySchema;
|
|
8680
|
-
var AcqDealTaskKindSchema = z.enum(["call", "email", "meeting", "other"]);
|
|
8681
|
-
z.object({
|
|
8682
|
-
dealId: UuidSchema
|
|
5439
|
+
var ProcessingStageStatusSchema = z.enum(["success", "no_result", "skipped", "error"]);
|
|
5440
|
+
var LeadGenStageKeySchema = z.string().trim().min(1);
|
|
5441
|
+
var LeadGenActionKeySchema = z.string().trim().min(1);
|
|
5442
|
+
var CrmStageKeySchema = z.string().trim().min(1);
|
|
5443
|
+
var CrmStateKeySchema = z.string().trim().min(1);
|
|
5444
|
+
var ProcessingStateEntrySchema = z.object({
|
|
5445
|
+
status: ProcessingStageStatusSchema,
|
|
5446
|
+
data: z.unknown().optional()
|
|
5447
|
+
}).passthrough();
|
|
5448
|
+
var ProcessingStateSchema = z.record(LeadGenStageKeySchema, ProcessingStateEntrySchema);
|
|
5449
|
+
var CompanyProcessingStateSchema = ProcessingStateSchema;
|
|
5450
|
+
var ContactProcessingStateSchema = ProcessingStateSchema;
|
|
5451
|
+
var DealStageSchema = CrmStageKeySchema;
|
|
5452
|
+
var AcqDealTaskKindSchema = z.enum(["call", "email", "meeting", "other"]);
|
|
5453
|
+
z.object({
|
|
5454
|
+
dealId: UuidSchema
|
|
8683
5455
|
});
|
|
8684
5456
|
z.object({
|
|
8685
5457
|
dealId: UuidSchema,
|
|
@@ -8720,7 +5492,7 @@ z.object({
|
|
|
8720
5492
|
expectedUpdatedAt: z.string().datetime().optional()
|
|
8721
5493
|
}).strict();
|
|
8722
5494
|
z.object({
|
|
8723
|
-
pipelineKey: z.
|
|
5495
|
+
pipelineKey: z.string().min(1),
|
|
8724
5496
|
stageKey: CrmStageKeySchema,
|
|
8725
5497
|
stateKey: CrmStateKeySchema.nullable().optional(),
|
|
8726
5498
|
reason: z.string().optional(),
|
|
@@ -8921,9 +5693,7 @@ var IcpRubricSchema = z.object({
|
|
|
8921
5693
|
customRules: z.string().optional()
|
|
8922
5694
|
});
|
|
8923
5695
|
var PipelineStageSchema = z.object({
|
|
8924
|
-
key:
|
|
8925
|
-
message: "pipeline stage key must match LEAD_GEN_STAGE_CATALOG"
|
|
8926
|
-
}),
|
|
5696
|
+
key: LeadGenStageKeySchema,
|
|
8927
5697
|
label: z.string().optional(),
|
|
8928
5698
|
enabled: z.boolean().optional(),
|
|
8929
5699
|
order: z.number().int().optional()
|
|
@@ -9391,16 +6161,7 @@ z.object({
|
|
|
9391
6161
|
stage: LeadGenStageKeySchema.optional(),
|
|
9392
6162
|
limit: z.coerce.number().int().min(1).max(500).default(50),
|
|
9393
6163
|
offset: z.coerce.number().int().min(0).default(0)
|
|
9394
|
-
}).strict()
|
|
9395
|
-
if (!query.stage) return;
|
|
9396
|
-
if (!isLeadGenRecordStageValidForEntity(query.stage, query.entity)) {
|
|
9397
|
-
ctx.addIssue({
|
|
9398
|
-
code: z.ZodIssueCode.custom,
|
|
9399
|
-
message: `stage "${query.stage}" is not valid for ${query.entity} records`,
|
|
9400
|
-
path: ["stage"]
|
|
9401
|
-
});
|
|
9402
|
-
}
|
|
9403
|
-
});
|
|
6164
|
+
}).strict();
|
|
9404
6165
|
z.object({
|
|
9405
6166
|
memberId: UuidSchema
|
|
9406
6167
|
});
|
|
@@ -9682,6 +6443,29 @@ var PostMessageLLMAdapter = class {
|
|
|
9682
6443
|
function createPostMessageAdapterFactory() {
|
|
9683
6444
|
return (config) => new PostMessageLLMAdapter(config.provider, config.model);
|
|
9684
6445
|
}
|
|
6446
|
+
function generateHmacToken(secret, data) {
|
|
6447
|
+
return createHmac("sha256", secret).update(data.toLowerCase().trim()).digest("hex").slice(0, 16);
|
|
6448
|
+
}
|
|
6449
|
+
function classifyPlatformToolError(err, options = {}) {
|
|
6450
|
+
const {
|
|
6451
|
+
timeoutMessages = [],
|
|
6452
|
+
rateLimitCodes = ["rate_limit_exceeded"],
|
|
6453
|
+
rateLimitMessageCodes = [],
|
|
6454
|
+
rateLimitMessageIncludes = []
|
|
6455
|
+
} = options;
|
|
6456
|
+
if (err instanceof Error && timeoutMessages.includes(err.message)) {
|
|
6457
|
+
return "timeout";
|
|
6458
|
+
}
|
|
6459
|
+
if (err instanceof PlatformToolError) {
|
|
6460
|
+
if (rateLimitCodes.includes(err.code)) {
|
|
6461
|
+
return "rate_limit";
|
|
6462
|
+
}
|
|
6463
|
+
if (rateLimitMessageCodes.includes(err.code) && rateLimitMessageIncludes.some((snippet) => err.message.includes(snippet))) {
|
|
6464
|
+
return "rate_limit";
|
|
6465
|
+
}
|
|
6466
|
+
}
|
|
6467
|
+
return "other";
|
|
6468
|
+
}
|
|
9685
6469
|
|
|
9686
6470
|
// src/worker/adapters/create-adapter.ts
|
|
9687
6471
|
function createAdapter(tool, methods, credential) {
|
|
@@ -10011,8 +6795,18 @@ var execution = createAdapter("execution", ["trigger", "triggerAsync"]);
|
|
|
10011
6795
|
|
|
10012
6796
|
// src/worker/adapters/email.ts
|
|
10013
6797
|
var email = createAdapter("email", ["send"]);
|
|
10014
|
-
|
|
10015
|
-
|
|
6798
|
+
z.object({
|
|
6799
|
+
success: z.boolean(),
|
|
6800
|
+
tool: z.string(),
|
|
6801
|
+
method: z.string(),
|
|
6802
|
+
result: z.unknown().optional(),
|
|
6803
|
+
error: z.string().optional(),
|
|
6804
|
+
durationMs: z.number().optional()
|
|
6805
|
+
});
|
|
6806
|
+
z.object({
|
|
6807
|
+
credential: z.string().describe("Credential name registered for this integration")
|
|
6808
|
+
});
|
|
6809
|
+
var ListBuilderStageKeySchema = z.string().min(1);
|
|
10016
6810
|
|
|
10017
6811
|
// src/worker/list-builder-workflow.ts
|
|
10018
6812
|
var ListBuilderResultSchema = z.object({
|
|
@@ -10037,7 +6831,9 @@ function assertNoReservedInputKeys(schema) {
|
|
|
10037
6831
|
}
|
|
10038
6832
|
const reservedKeys = ["params", "batch"].filter((key) => Object.prototype.hasOwnProperty.call(shape, key));
|
|
10039
6833
|
if (reservedKeys.length > 0) {
|
|
10040
|
-
throw new Error(
|
|
6834
|
+
throw new Error(
|
|
6835
|
+
`listBuilderWorkflow inputSchema cannot define reserved top-level key(s): ${reservedKeys.join(", ")}`
|
|
6836
|
+
);
|
|
10041
6837
|
}
|
|
10042
6838
|
}
|
|
10043
6839
|
function resolveListAdapter(context) {
|
|
@@ -10047,18 +6843,13 @@ function resolveListAdapter(context) {
|
|
|
10047
6843
|
function getRecordId(record) {
|
|
10048
6844
|
return record.id;
|
|
10049
6845
|
}
|
|
10050
|
-
function assertResultStageTarget(result, defaultStageKey) {
|
|
10051
|
-
|
|
10052
|
-
const catalogEntry = LEAD_GEN_STAGE_CATALOG[stageKey];
|
|
10053
|
-
if (!catalogEntry) {
|
|
10054
|
-
throw new Error(`listBuilderWorkflow result stageKey "${stageKey}" is not in LEAD_GEN_STAGE_CATALOG`);
|
|
10055
|
-
}
|
|
10056
|
-
if (catalogEntry.entity !== result.entity) {
|
|
6846
|
+
function assertResultStageTarget(result, defaultStageKey, primaryEntity) {
|
|
6847
|
+
if (result.entity !== primaryEntity && result.stageKey === void 0) {
|
|
10057
6848
|
throw new Error(
|
|
10058
|
-
`
|
|
6849
|
+
`[list-builder] cross-entity result for "${result.id}" is a ${result.entity} but the step's primary entity is ${primaryEntity}; set result.stageKey to a ${result.entity} stage.`
|
|
10059
6850
|
);
|
|
10060
6851
|
}
|
|
10061
|
-
return stageKey;
|
|
6852
|
+
return result.stageKey ?? defaultStageKey;
|
|
10062
6853
|
}
|
|
10063
6854
|
async function filterPendingRecords(records, params, context, options) {
|
|
10064
6855
|
if (params.forceRefresh) {
|
|
@@ -10078,7 +6869,7 @@ async function filterPendingRecords(records, params, context, options) {
|
|
|
10078
6869
|
const pending = new Set(pendingIds);
|
|
10079
6870
|
return records.filter((record) => pending.has(getRecordId(record)));
|
|
10080
6871
|
}
|
|
10081
|
-
async function dispatchResults(envelope, context) {
|
|
6872
|
+
async function dispatchResults(envelope, context, primaryEntity) {
|
|
10082
6873
|
if (!envelope.batch.listId) {
|
|
10083
6874
|
if (envelope.results.length > 0) {
|
|
10084
6875
|
context.logger.warn(
|
|
@@ -10089,7 +6880,7 @@ async function dispatchResults(envelope, context) {
|
|
|
10089
6880
|
}
|
|
10090
6881
|
const listAdapter = resolveListAdapter(context);
|
|
10091
6882
|
for (const result of envelope.results) {
|
|
10092
|
-
const stage = assertResultStageTarget(result, envelope.batch.stageKey);
|
|
6883
|
+
const stage = assertResultStageTarget(result, envelope.batch.stageKey, primaryEntity);
|
|
10093
6884
|
if (result.entity === "company") {
|
|
10094
6885
|
await listAdapter.updateCompanyStage({
|
|
10095
6886
|
listId: envelope.batch.listId,
|
|
@@ -10114,6 +6905,11 @@ async function dispatchResults(envelope, context) {
|
|
|
10114
6905
|
}
|
|
10115
6906
|
function listBuilderWorkflow(options) {
|
|
10116
6907
|
const stageKey = ListBuilderStageKeySchema.parse(options.buildStep.stageKey);
|
|
6908
|
+
if (options.stageValidators && !options.stageValidators.isLeadGenStageKey(stageKey)) {
|
|
6909
|
+
throw new Error(
|
|
6910
|
+
`[list-builder] invalid buildStep.stageKey "${stageKey}" \u2014 not a known lead-gen stage in the injected stage catalog.`
|
|
6911
|
+
);
|
|
6912
|
+
}
|
|
10117
6913
|
assertNoReservedInputKeys(options.inputSchema);
|
|
10118
6914
|
const outputSchema = options.outputSchema ?? ListBuilderResultsSchema;
|
|
10119
6915
|
const batchSchema = z.object({
|
|
@@ -10187,7 +6983,7 @@ function listBuilderWorkflow(options) {
|
|
|
10187
6983
|
outputSchema,
|
|
10188
6984
|
handler: async (rawInput, context) => {
|
|
10189
6985
|
const envelope = envelopeSchema.parse(rawInput);
|
|
10190
|
-
const results = await dispatchResults(envelope, context);
|
|
6986
|
+
const results = await dispatchResults(envelope, context, options.buildStep.primaryEntity);
|
|
10191
6987
|
return outputSchema.parse(results);
|
|
10192
6988
|
},
|
|
10193
6989
|
next: null
|
|
@@ -10227,34 +7023,11 @@ function captureConsole(executionId, logs) {
|
|
|
10227
7023
|
postLog
|
|
10228
7024
|
};
|
|
10229
7025
|
}
|
|
10230
|
-
|
|
10231
|
-
|
|
10232
|
-
if (value === null || value === void 0) return value;
|
|
10233
|
-
if (typeof value === "string") {
|
|
10234
|
-
return value.length > LOG_STRING_TRUNCATE_LIMIT ? value.slice(0, LOG_STRING_TRUNCATE_LIMIT) + `\u2026 [${value.length} chars]` : value;
|
|
10235
|
-
}
|
|
10236
|
-
if (Array.isArray(value)) {
|
|
10237
|
-
return value.map(truncateForLogging);
|
|
10238
|
-
}
|
|
10239
|
-
if (typeof value === "object") {
|
|
10240
|
-
const result = {};
|
|
10241
|
-
for (const [k, v] of Object.entries(value)) {
|
|
10242
|
-
result[k] = truncateForLogging(v);
|
|
10243
|
-
}
|
|
10244
|
-
return result;
|
|
10245
|
-
}
|
|
10246
|
-
return value;
|
|
10247
|
-
}
|
|
10248
|
-
function resolveNext(next, data) {
|
|
10249
|
-
if (next === null) return null;
|
|
10250
|
-
if (next.type === "linear") return next.target;
|
|
10251
|
-
for (const route of next.routes) {
|
|
10252
|
-
if (route.condition(data)) return route.target;
|
|
10253
|
-
}
|
|
10254
|
-
return next.default;
|
|
7026
|
+
function isZodSchema(schema) {
|
|
7027
|
+
return typeof schema === "object" && schema !== null && "parse" in schema && "_def" in schema;
|
|
10255
7028
|
}
|
|
10256
7029
|
function safeZodToJsonSchema(schema) {
|
|
10257
|
-
if (!
|
|
7030
|
+
if (!isZodSchema(schema)) return void 0;
|
|
10258
7031
|
try {
|
|
10259
7032
|
const result = zodToJsonSchema(schema, { $refStrategy: "none", errorMessages: true });
|
|
10260
7033
|
if (result && typeof result === "object" && Object.keys(result).some((k) => k !== "$schema")) {
|
|
@@ -10273,84 +7046,28 @@ async function executeWorkflow(workflow, input, context) {
|
|
|
10273
7046
|
const logs = [];
|
|
10274
7047
|
const { restore, postLog } = captureConsole(context.executionId, logs);
|
|
10275
7048
|
try {
|
|
10276
|
-
|
|
10277
|
-
|
|
10278
|
-
|
|
10279
|
-
|
|
10280
|
-
|
|
10281
|
-
|
|
10282
|
-
|
|
10283
|
-
|
|
10284
|
-
|
|
10285
|
-
|
|
10286
|
-
|
|
10287
|
-
|
|
10288
|
-
|
|
10289
|
-
|
|
10290
|
-
|
|
10291
|
-
|
|
10292
|
-
|
|
10293
|
-
|
|
10294
|
-
const rawOutput = await step.handler(stepInput, {
|
|
10295
|
-
executionId: context.executionId,
|
|
10296
|
-
organizationId: context.organizationId,
|
|
10297
|
-
organizationName: context.organizationName,
|
|
10298
|
-
resourceId: workflow.config.resourceId,
|
|
10299
|
-
sessionId: context.sessionId,
|
|
10300
|
-
sessionTurnNumber: context.sessionTurnNumber,
|
|
10301
|
-
parentExecutionId: context.parentExecutionId,
|
|
10302
|
-
executionDepth: context.executionDepth,
|
|
10303
|
-
adapters: context.adapters,
|
|
10304
|
-
store: /* @__PURE__ */ new Map(),
|
|
10305
|
-
logger: {
|
|
10306
|
-
debug: (msg) => console.log(`[debug] ${msg}`),
|
|
10307
|
-
info: (msg) => console.log(`[info] ${msg}`),
|
|
10308
|
-
warn: (msg) => console.warn(`[warn] ${msg}`),
|
|
10309
|
-
error: (msg) => console.error(`[error] ${msg}`)
|
|
10310
|
-
}
|
|
10311
|
-
});
|
|
10312
|
-
currentData = step.outputSchema.parse(rawOutput);
|
|
10313
|
-
const stepEndTime = Date.now();
|
|
10314
|
-
const nextStepId = resolveNext(step.next, currentData);
|
|
10315
|
-
postLog("info", `Step '${step.name}' completed (${stepEndTime - stepStartTime}ms)`, {
|
|
10316
|
-
type: "workflow",
|
|
10317
|
-
contextType: "step-completed",
|
|
10318
|
-
stepId: step.id,
|
|
10319
|
-
stepStatus: "completed",
|
|
10320
|
-
output: truncateForLogging(currentData),
|
|
10321
|
-
duration: stepEndTime - stepStartTime,
|
|
10322
|
-
isTerminal: nextStepId === null,
|
|
10323
|
-
startTime: stepStartTime,
|
|
10324
|
-
endTime: stepEndTime
|
|
10325
|
-
});
|
|
10326
|
-
if (step.next?.type === "conditional" && nextStepId !== null) {
|
|
10327
|
-
postLog("info", `Routing from '${step.name}' to '${nextStepId}'`, {
|
|
10328
|
-
type: "workflow",
|
|
10329
|
-
contextType: "conditional-route",
|
|
10330
|
-
stepId: step.id,
|
|
10331
|
-
target: nextStepId
|
|
10332
|
-
});
|
|
10333
|
-
}
|
|
10334
|
-
stepId = nextStepId;
|
|
10335
|
-
} catch (err) {
|
|
10336
|
-
const stepEndTime = Date.now();
|
|
10337
|
-
postLog("error", `Step '${step.name}' failed: ${String(err)}`, {
|
|
10338
|
-
type: "workflow",
|
|
10339
|
-
contextType: "step-failed",
|
|
10340
|
-
stepId: step.id,
|
|
10341
|
-
stepStatus: "failed",
|
|
10342
|
-
error: String(err),
|
|
10343
|
-
duration: stepEndTime - stepStartTime,
|
|
10344
|
-
startTime: stepStartTime,
|
|
10345
|
-
endTime: stepEndTime
|
|
10346
|
-
});
|
|
10347
|
-
throw err;
|
|
7049
|
+
const workflowInstance = new Workflow(workflow);
|
|
7050
|
+
const workerContext = {
|
|
7051
|
+
executionId: context.executionId,
|
|
7052
|
+
organizationId: context.organizationId,
|
|
7053
|
+
organizationName: context.organizationName,
|
|
7054
|
+
resourceId: workflow.config.resourceId,
|
|
7055
|
+
sessionId: context.sessionId,
|
|
7056
|
+
sessionTurnNumber: context.sessionTurnNumber,
|
|
7057
|
+
parentExecutionId: context.parentExecutionId,
|
|
7058
|
+
executionDepth: context.executionDepth,
|
|
7059
|
+
signal: context.signal,
|
|
7060
|
+
adapters: context.adapters,
|
|
7061
|
+
store: /* @__PURE__ */ new Map(),
|
|
7062
|
+
logger: {
|
|
7063
|
+
debug: (message, logContext) => postLog("debug", message, logContext),
|
|
7064
|
+
info: (message, logContext) => postLog("info", message, logContext),
|
|
7065
|
+
warn: (message, logContext) => postLog("warn", message, logContext),
|
|
7066
|
+
error: (message, logContext) => postLog("error", message, logContext)
|
|
10348
7067
|
}
|
|
10349
|
-
}
|
|
10350
|
-
|
|
10351
|
-
|
|
10352
|
-
}
|
|
10353
|
-
return { output: currentData, logs };
|
|
7068
|
+
};
|
|
7069
|
+
const output = await workflowInstance.execute(input, workerContext);
|
|
7070
|
+
return { output, logs };
|
|
10354
7071
|
} finally {
|
|
10355
7072
|
restore();
|
|
10356
7073
|
}
|
|
@@ -10489,7 +7206,8 @@ function startWorker(org) {
|
|
|
10489
7206
|
sessionId,
|
|
10490
7207
|
sessionTurnNumber,
|
|
10491
7208
|
parentExecutionId,
|
|
10492
|
-
executionDepth: executionDepth ?? 0
|
|
7209
|
+
executionDepth: executionDepth ?? 0,
|
|
7210
|
+
signal: localAbortController.signal
|
|
10493
7211
|
});
|
|
10494
7212
|
const durationMs = Date.now() - startTime;
|
|
10495
7213
|
console.log(`[SDK-WORKER] Workflow '${resourceId}' completed (${durationMs}ms)`);
|
|
@@ -10533,9 +7251,10 @@ function startWorker(org) {
|
|
|
10533
7251
|
parentPort.postMessage({ type: "result", status: "completed", output, logs, metrics: { durationMs } });
|
|
10534
7252
|
} catch (err) {
|
|
10535
7253
|
const durationMs = Date.now() - startTime;
|
|
10536
|
-
const
|
|
10537
|
-
|
|
10538
|
-
|
|
7254
|
+
const errorRecord = err instanceof Error ? err : void 0;
|
|
7255
|
+
const errorMessage = errorRecord?.message ?? String(err);
|
|
7256
|
+
err !== null && typeof err === "object" && "code" in err ? String(err.code) : "unknown";
|
|
7257
|
+
const errorName = errorRecord?.name ?? (err !== null && typeof err === "object" && err.constructor?.name ? err.constructor.name : "Error");
|
|
10539
7258
|
console.error(`[SDK-WORKER] Agent '${resourceId}' failed (${durationMs}ms): [${errorName}] ${errorMessage}`);
|
|
10540
7259
|
parentPort.postMessage({
|
|
10541
7260
|
type: "result",
|
|
@@ -10567,4 +7286,4 @@ if (workerData != null && workerData.kind === "static") {
|
|
|
10567
7286
|
})();
|
|
10568
7287
|
}
|
|
10569
7288
|
|
|
10570
|
-
export { ListBuilderResultSchema, ListBuilderResultsSchema, PlatformToolError, acqDb, approval, createAdapter, createAnymailfinderAdapter, createApifyAdapter, createAttioAdapter, createDropboxAdapter, createGmailAdapter, createGoogleSheetsAdapter, createInstantlyAdapter, createMillionVerifierAdapter, createResendAdapter, createSignatureApiAdapter, createStripeAdapter, createTombaAdapter, crm, email, executeWorkflow, execution, list, listBuilderWorkflow, llm, notifications, pdf, platform, projects, scheduler, startWorker, storage };
|
|
7289
|
+
export { ListBuilderResultSchema, ListBuilderResultsSchema, PlatformToolError, acqDb, approval, classifyPlatformToolError, createAdapter, createAnymailfinderAdapter, createApifyAdapter, createAttioAdapter, createDropboxAdapter, createGmailAdapter, createGoogleSheetsAdapter, createInstantlyAdapter, createMillionVerifierAdapter, createResendAdapter, createSignatureApiAdapter, createStripeAdapter, createTombaAdapter, crm, email, executeWorkflow, execution, generateHmacToken, list, listBuilderWorkflow, llm, notifications, pdf, platform, projects, scheduler, startWorker, storage };
|