@elevasis/sdk 1.23.0 → 1.24.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 +5408 -6605
- package/dist/index.d.ts +183 -242
- package/dist/index.js +1829 -2912
- package/dist/node/index.d.ts +3722 -2
- package/dist/node/index.js +163 -1
- package/dist/test-utils/index.d.ts +60 -72
- package/dist/test-utils/index.js +239 -1479
- package/dist/types/worker/index.d.ts +2 -0
- package/dist/types/worker/utils.d.ts +9 -0
- package/dist/worker/index.js +260 -1487
- 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/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/reference/contracts.md +14 -2
package/dist/node/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
1
3
|
type KnowledgeKind = 'playbook' | 'strategy' | 'reference';
|
|
2
4
|
interface KnowledgeCodegenNode {
|
|
3
5
|
id: string;
|
|
@@ -35,6 +37,2980 @@ declare function generateKnowledgeNodesTs(options: {
|
|
|
35
37
|
}): string;
|
|
36
38
|
declare function generateKnowledgeNodes(options: GenerateKnowledgeNodesOptions): GenerateKnowledgeNodesResult;
|
|
37
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Workflow-specific logging types and utilities
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
interface WorkflowExecutionContext {
|
|
45
|
+
type: 'workflow';
|
|
46
|
+
contextType: 'workflow-execution';
|
|
47
|
+
executionId: string;
|
|
48
|
+
workflowId: string;
|
|
49
|
+
workflowName?: string;
|
|
50
|
+
organizationId: string;
|
|
51
|
+
executionPath?: string[];
|
|
52
|
+
}
|
|
53
|
+
interface WorkflowFailureContext {
|
|
54
|
+
type: 'workflow';
|
|
55
|
+
contextType: 'workflow-failure';
|
|
56
|
+
executionId: string;
|
|
57
|
+
workflowId: string;
|
|
58
|
+
error: string;
|
|
59
|
+
}
|
|
60
|
+
interface StepStartedContext {
|
|
61
|
+
type: 'workflow';
|
|
62
|
+
contextType: 'step-started';
|
|
63
|
+
stepId: string;
|
|
64
|
+
stepStatus: 'started';
|
|
65
|
+
input: unknown;
|
|
66
|
+
startTime: number;
|
|
67
|
+
}
|
|
68
|
+
interface StepCompletedContext {
|
|
69
|
+
type: 'workflow';
|
|
70
|
+
contextType: 'step-completed';
|
|
71
|
+
stepId: string;
|
|
72
|
+
stepStatus: 'completed';
|
|
73
|
+
output: unknown;
|
|
74
|
+
duration: number;
|
|
75
|
+
isTerminal: boolean;
|
|
76
|
+
startTime: number;
|
|
77
|
+
endTime: number;
|
|
78
|
+
}
|
|
79
|
+
interface StepFailedContext {
|
|
80
|
+
type: 'workflow';
|
|
81
|
+
contextType: 'step-failed';
|
|
82
|
+
stepId: string;
|
|
83
|
+
stepStatus: 'failed';
|
|
84
|
+
error: string;
|
|
85
|
+
duration: number;
|
|
86
|
+
startTime: number;
|
|
87
|
+
endTime: number;
|
|
88
|
+
}
|
|
89
|
+
interface ConditionalRouteContext {
|
|
90
|
+
type: 'workflow';
|
|
91
|
+
contextType: 'conditional-route';
|
|
92
|
+
stepId: string;
|
|
93
|
+
target: string;
|
|
94
|
+
error?: string;
|
|
95
|
+
}
|
|
96
|
+
interface ExecutionPathContext {
|
|
97
|
+
type: 'workflow';
|
|
98
|
+
contextType: 'execution-path';
|
|
99
|
+
executionPath: string[];
|
|
100
|
+
}
|
|
101
|
+
type WorkflowLogContext = WorkflowExecutionContext | WorkflowFailureContext | StepStartedContext | StepCompletedContext | StepFailedContext | ConditionalRouteContext | ExecutionPathContext;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Agent-specific logging types
|
|
105
|
+
* Simplified 2-event model: lifecycle, iteration
|
|
106
|
+
*
|
|
107
|
+
* Design Philosophy:
|
|
108
|
+
* - LIFECYCLE EVENTS: Structural checkpoints (initialization, iteration, completion)
|
|
109
|
+
* - ITERATION EVENTS: Execution activities (reasoning, actions during iterations)
|
|
110
|
+
*/
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Agent lifecycle stages
|
|
114
|
+
* Universal checkpoints that apply to all agent executions
|
|
115
|
+
*/
|
|
116
|
+
type AgentLifecycle = 'initialization' | 'iteration' | 'completion';
|
|
117
|
+
/**
|
|
118
|
+
* Iteration event types
|
|
119
|
+
* Activities that occur during agent iterations
|
|
120
|
+
*/
|
|
121
|
+
type IterationEventType = 'reasoning' | 'action' | 'tool-call';
|
|
122
|
+
/**
|
|
123
|
+
* Base fields shared by all lifecycle events
|
|
124
|
+
*/
|
|
125
|
+
interface AgentLifecycleEventBase {
|
|
126
|
+
type: 'agent';
|
|
127
|
+
agentId: string;
|
|
128
|
+
lifecycle: AgentLifecycle;
|
|
129
|
+
sessionId?: string;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Lifecycle started event - emitted when a phase begins
|
|
133
|
+
* REQUIRED: startTime (phase has started, no end yet)
|
|
134
|
+
*/
|
|
135
|
+
interface AgentLifecycleStartedEvent extends AgentLifecycleEventBase {
|
|
136
|
+
stage: 'started';
|
|
137
|
+
startTime: number;
|
|
138
|
+
iteration?: number;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Lifecycle completed event - emitted when a phase succeeds
|
|
142
|
+
* REQUIRED: startTime, endTime, duration (phase has finished successfully)
|
|
143
|
+
*/
|
|
144
|
+
interface AgentLifecycleCompletedEvent extends AgentLifecycleEventBase {
|
|
145
|
+
stage: 'completed';
|
|
146
|
+
startTime: number;
|
|
147
|
+
endTime: number;
|
|
148
|
+
duration: number;
|
|
149
|
+
iteration?: number;
|
|
150
|
+
attempts?: number;
|
|
151
|
+
memorySize?: {
|
|
152
|
+
sessionMemoryKeys: number;
|
|
153
|
+
historyEntries: number;
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Lifecycle failed event - emitted when a phase fails
|
|
158
|
+
* REQUIRED: startTime, endTime, duration, error (phase has finished with error)
|
|
159
|
+
*/
|
|
160
|
+
interface AgentLifecycleFailedEvent extends AgentLifecycleEventBase {
|
|
161
|
+
stage: 'failed';
|
|
162
|
+
startTime: number;
|
|
163
|
+
endTime: number;
|
|
164
|
+
duration: number;
|
|
165
|
+
error: string;
|
|
166
|
+
iteration?: number;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Union type for all lifecycle events
|
|
170
|
+
* Discriminated by 'stage' field for type narrowing
|
|
171
|
+
*/
|
|
172
|
+
type AgentLifecycleEvent = AgentLifecycleStartedEvent | AgentLifecycleCompletedEvent | AgentLifecycleFailedEvent;
|
|
173
|
+
/**
|
|
174
|
+
* Placeholder data for MVP
|
|
175
|
+
* Will be typed per actionType in future
|
|
176
|
+
*/
|
|
177
|
+
interface ActionPlaceholderData {
|
|
178
|
+
message: string;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Iteration event - captures activities during agent iterations
|
|
182
|
+
* Consolidates reasoning (LLM thought process) and actions (tool use, memory ops, etc.)
|
|
183
|
+
*/
|
|
184
|
+
interface AgentIterationEvent {
|
|
185
|
+
type: 'agent';
|
|
186
|
+
agentId: string;
|
|
187
|
+
lifecycle: 'iteration';
|
|
188
|
+
eventType: IterationEventType;
|
|
189
|
+
iteration: number;
|
|
190
|
+
sessionId?: string;
|
|
191
|
+
startTime: number;
|
|
192
|
+
endTime: number;
|
|
193
|
+
duration: number;
|
|
194
|
+
output?: string;
|
|
195
|
+
actionType?: string;
|
|
196
|
+
data?: ActionPlaceholderData;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Tool call event - captures individual tool executions during iterations
|
|
200
|
+
* Provides granular timing for each tool invocation
|
|
201
|
+
*/
|
|
202
|
+
interface AgentToolCallEvent {
|
|
203
|
+
type: 'agent';
|
|
204
|
+
agentId: string;
|
|
205
|
+
lifecycle: 'iteration';
|
|
206
|
+
eventType: 'tool-call';
|
|
207
|
+
iteration: number;
|
|
208
|
+
sessionId?: string;
|
|
209
|
+
toolName: string;
|
|
210
|
+
startTime: number;
|
|
211
|
+
endTime: number;
|
|
212
|
+
duration: number;
|
|
213
|
+
success: boolean;
|
|
214
|
+
error?: string;
|
|
215
|
+
input?: Record<string, unknown>;
|
|
216
|
+
output?: unknown;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Union type for all agent log contexts
|
|
220
|
+
* 3 event types total (lifecycle, iteration, tool-call)
|
|
221
|
+
*/
|
|
222
|
+
type AgentLogContext = AgentLifecycleEvent | AgentIterationEvent | AgentToolCallEvent;
|
|
223
|
+
/**
|
|
224
|
+
* Data for lifecycle 'started' events
|
|
225
|
+
*/
|
|
226
|
+
interface AgentLifecycleStartedData {
|
|
227
|
+
startTime: number;
|
|
228
|
+
iteration?: number;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Data for lifecycle 'completed' events
|
|
232
|
+
*/
|
|
233
|
+
interface AgentLifecycleCompletedData {
|
|
234
|
+
startTime: number;
|
|
235
|
+
endTime: number;
|
|
236
|
+
duration: number;
|
|
237
|
+
iteration?: number;
|
|
238
|
+
attempts?: number;
|
|
239
|
+
memorySize?: {
|
|
240
|
+
sessionMemoryKeys: number;
|
|
241
|
+
historyEntries: number;
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Data for lifecycle 'failed' events
|
|
246
|
+
*/
|
|
247
|
+
interface AgentLifecycleFailedData {
|
|
248
|
+
startTime: number;
|
|
249
|
+
endTime: number;
|
|
250
|
+
duration: number;
|
|
251
|
+
error: string;
|
|
252
|
+
iteration?: number;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Scoped logger for agent execution
|
|
256
|
+
* Captures logger and agentId to eliminate repetitive parameter passing
|
|
257
|
+
*
|
|
258
|
+
* Type-safe lifecycle logging with stage-specific required fields
|
|
259
|
+
*/
|
|
260
|
+
interface AgentScopedLogger {
|
|
261
|
+
lifecycle(lifecycle: AgentLifecycle, stage: 'started', data: AgentLifecycleStartedData): void;
|
|
262
|
+
lifecycle(lifecycle: AgentLifecycle, stage: 'completed', data: AgentLifecycleCompletedData): void;
|
|
263
|
+
lifecycle(lifecycle: AgentLifecycle, stage: 'failed', data: AgentLifecycleFailedData): void;
|
|
264
|
+
reasoning(output: string, iteration: number, startTime: number, endTime: number, duration: number): void;
|
|
265
|
+
action(actionType: string, message: string, iteration: number, startTime: number, endTime: number, duration: number): void;
|
|
266
|
+
toolCall(toolName: string, iteration: number, startTime: number, endTime: number, duration: number, success: boolean, error?: string, input?: unknown, output?: unknown): void;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
type LogContext = WorkflowLogContext | AgentLogContext;
|
|
270
|
+
interface IExecutionLogger {
|
|
271
|
+
debug(message: string, context?: LogContext): void;
|
|
272
|
+
info(message: string, context?: LogContext): void;
|
|
273
|
+
warn(message: string, context?: LogContext): void;
|
|
274
|
+
error(message: string, context?: LogContext): void;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Model Configuration
|
|
279
|
+
* Centralized model information, configuration, options, constraints, and validation
|
|
280
|
+
* Single source of truth for all model-related definitions
|
|
281
|
+
* Update manually when pricing changes or new models are added
|
|
282
|
+
*/
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Supported Open AI models (direct SDK access)
|
|
286
|
+
*/
|
|
287
|
+
type OpenAIModel = 'gpt-5' | 'gpt-5.4-mini' | 'gpt-5.4-nano';
|
|
288
|
+
/**
|
|
289
|
+
* Supported OpenRouter models (explicit union for type safety)
|
|
290
|
+
*/
|
|
291
|
+
type OpenRouterModel = 'openrouter/z-ai/glm-5';
|
|
292
|
+
/**
|
|
293
|
+
* Supported Google models (direct SDK access)
|
|
294
|
+
*/
|
|
295
|
+
type GoogleModel = 'gemini-3-flash-preview' | 'gemini-3.1-flash-lite-preview';
|
|
296
|
+
/**
|
|
297
|
+
* Supported Anthropic models (direct SDK access via @anthropic-ai/sdk)
|
|
298
|
+
*/
|
|
299
|
+
type AnthropicModel = 'claude-sonnet-4-5';
|
|
300
|
+
/** Supported LLM models */
|
|
301
|
+
type LLMModel = OpenAIModel | OpenRouterModel | GoogleModel | AnthropicModel | 'mock';
|
|
302
|
+
/**
|
|
303
|
+
* GPT-5 model options schema
|
|
304
|
+
*/
|
|
305
|
+
declare const GPT5OptionsSchema: z.ZodObject<{
|
|
306
|
+
reasoning_effort: z.ZodOptional<z.ZodEnum<{
|
|
307
|
+
minimal: "minimal";
|
|
308
|
+
low: "low";
|
|
309
|
+
medium: "medium";
|
|
310
|
+
high: "high";
|
|
311
|
+
}>>;
|
|
312
|
+
verbosity: z.ZodOptional<z.ZodEnum<{
|
|
313
|
+
low: "low";
|
|
314
|
+
medium: "medium";
|
|
315
|
+
high: "high";
|
|
316
|
+
}>>;
|
|
317
|
+
}, z.core.$strip>;
|
|
318
|
+
/**
|
|
319
|
+
* OpenRouter model options schema
|
|
320
|
+
* OpenRouter-specific options for routing and transforms
|
|
321
|
+
*/
|
|
322
|
+
declare const OpenRouterOptionsSchema: z.ZodObject<{
|
|
323
|
+
transforms: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
324
|
+
route: z.ZodOptional<z.ZodEnum<{
|
|
325
|
+
fallback: "fallback";
|
|
326
|
+
}>>;
|
|
327
|
+
}, z.core.$strip>;
|
|
328
|
+
/**
|
|
329
|
+
* Google model options schema
|
|
330
|
+
* Gemini 3 specific options for thinking depth control
|
|
331
|
+
*/
|
|
332
|
+
declare const GoogleOptionsSchema: z.ZodObject<{
|
|
333
|
+
thinkingLevel: z.ZodOptional<z.ZodEnum<{
|
|
334
|
+
minimal: "minimal";
|
|
335
|
+
low: "low";
|
|
336
|
+
medium: "medium";
|
|
337
|
+
high: "high";
|
|
338
|
+
}>>;
|
|
339
|
+
}, z.core.$strip>;
|
|
340
|
+
/**
|
|
341
|
+
* Anthropic model options schema
|
|
342
|
+
* Currently empty - future options: budget_tokens for extended thinking
|
|
343
|
+
*/
|
|
344
|
+
declare const AnthropicOptionsSchema: z.ZodObject<{}, z.core.$strip>;
|
|
345
|
+
/**
|
|
346
|
+
* Infer TypeScript types from schemas
|
|
347
|
+
*/
|
|
348
|
+
type GPT5Options = z.infer<typeof GPT5OptionsSchema>;
|
|
349
|
+
type MockOptions = Record<string, never>;
|
|
350
|
+
type OpenRouterOptions = z.infer<typeof OpenRouterOptionsSchema>;
|
|
351
|
+
type GoogleOptions = z.infer<typeof GoogleOptionsSchema>;
|
|
352
|
+
type AnthropicOptions = z.infer<typeof AnthropicOptionsSchema>;
|
|
353
|
+
type ModelSpecificOptions = GPT5Options | MockOptions | OpenRouterOptions | GoogleOptions | AnthropicOptions;
|
|
354
|
+
/**
|
|
355
|
+
* Model configuration for LLM execution
|
|
356
|
+
* Belongs in resource definition (AgentDefinition, WorkflowDefinition, etc.)
|
|
357
|
+
*/
|
|
358
|
+
interface ModelConfig {
|
|
359
|
+
model: LLMModel;
|
|
360
|
+
provider: 'openai' | 'anthropic' | 'openrouter' | 'google' | 'mock';
|
|
361
|
+
apiKey: string;
|
|
362
|
+
temperature?: number;
|
|
363
|
+
/** Maximum output tokens per LLM call. NOT the model's context window — see ModelInfo.maxTokens for that. */
|
|
364
|
+
maxOutputTokens?: number;
|
|
365
|
+
topP?: number;
|
|
366
|
+
/**
|
|
367
|
+
* Model-specific options (flat structure)
|
|
368
|
+
* Options are model-specific, not vendor-specific
|
|
369
|
+
* Available options defined in MODEL_INFO per model
|
|
370
|
+
* Validated at build time via validateModelOptions()
|
|
371
|
+
*/
|
|
372
|
+
modelOptions?: ModelSpecificOptions;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
declare const ResourceGovernanceStatusSchema: z.ZodEnum<{
|
|
376
|
+
deprecated: "deprecated";
|
|
377
|
+
active: "active";
|
|
378
|
+
archived: "archived";
|
|
379
|
+
}>;
|
|
380
|
+
declare const WorkflowResourceEntrySchema$1: z.ZodObject<{
|
|
381
|
+
id: z.ZodString;
|
|
382
|
+
order: z.ZodDefault<z.ZodNumber>;
|
|
383
|
+
systemPath: z.ZodString;
|
|
384
|
+
title: z.ZodOptional<z.ZodString>;
|
|
385
|
+
description: z.ZodOptional<z.ZodString>;
|
|
386
|
+
ownerRoleId: z.ZodOptional<z.ZodString>;
|
|
387
|
+
status: z.ZodEnum<{
|
|
388
|
+
deprecated: "deprecated";
|
|
389
|
+
active: "active";
|
|
390
|
+
archived: "archived";
|
|
391
|
+
}>;
|
|
392
|
+
ontology: z.ZodOptional<z.ZodObject<{
|
|
393
|
+
actions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
394
|
+
primaryAction: z.ZodOptional<z.ZodString>;
|
|
395
|
+
reads: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
396
|
+
writes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
397
|
+
usesCatalogs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
398
|
+
emits: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
399
|
+
contract: z.ZodOptional<z.ZodObject<{
|
|
400
|
+
input: z.ZodOptional<z.ZodString>;
|
|
401
|
+
output: z.ZodOptional<z.ZodString>;
|
|
402
|
+
}, z.core.$strip>>;
|
|
403
|
+
}, z.core.$strip>>;
|
|
404
|
+
codeRefs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
405
|
+
path: z.ZodString;
|
|
406
|
+
role: z.ZodEnum<{
|
|
407
|
+
config: "config";
|
|
408
|
+
entrypoint: "entrypoint";
|
|
409
|
+
handler: "handler";
|
|
410
|
+
schema: "schema";
|
|
411
|
+
test: "test";
|
|
412
|
+
docs: "docs";
|
|
413
|
+
}>;
|
|
414
|
+
symbol: z.ZodOptional<z.ZodString>;
|
|
415
|
+
description: z.ZodOptional<z.ZodString>;
|
|
416
|
+
}, z.core.$strip>>>;
|
|
417
|
+
kind: z.ZodLiteral<"workflow">;
|
|
418
|
+
emits: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
419
|
+
eventKey: z.ZodString;
|
|
420
|
+
label: z.ZodString;
|
|
421
|
+
payloadSchema: z.ZodOptional<z.ZodString>;
|
|
422
|
+
lifecycle: z.ZodOptional<z.ZodEnum<{
|
|
423
|
+
deprecated: "deprecated";
|
|
424
|
+
draft: "draft";
|
|
425
|
+
beta: "beta";
|
|
426
|
+
active: "active";
|
|
427
|
+
archived: "archived";
|
|
428
|
+
}>>;
|
|
429
|
+
}, z.core.$strip>>>;
|
|
430
|
+
}, z.core.$strip>;
|
|
431
|
+
declare const AgentResourceEntrySchema: z.ZodObject<{
|
|
432
|
+
id: z.ZodString;
|
|
433
|
+
order: z.ZodDefault<z.ZodNumber>;
|
|
434
|
+
systemPath: z.ZodString;
|
|
435
|
+
title: z.ZodOptional<z.ZodString>;
|
|
436
|
+
description: z.ZodOptional<z.ZodString>;
|
|
437
|
+
ownerRoleId: z.ZodOptional<z.ZodString>;
|
|
438
|
+
status: z.ZodEnum<{
|
|
439
|
+
deprecated: "deprecated";
|
|
440
|
+
active: "active";
|
|
441
|
+
archived: "archived";
|
|
442
|
+
}>;
|
|
443
|
+
ontology: z.ZodOptional<z.ZodObject<{
|
|
444
|
+
actions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
445
|
+
primaryAction: z.ZodOptional<z.ZodString>;
|
|
446
|
+
reads: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
447
|
+
writes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
448
|
+
usesCatalogs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
449
|
+
emits: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
450
|
+
contract: z.ZodOptional<z.ZodObject<{
|
|
451
|
+
input: z.ZodOptional<z.ZodString>;
|
|
452
|
+
output: z.ZodOptional<z.ZodString>;
|
|
453
|
+
}, z.core.$strip>>;
|
|
454
|
+
}, z.core.$strip>>;
|
|
455
|
+
codeRefs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
456
|
+
path: z.ZodString;
|
|
457
|
+
role: z.ZodEnum<{
|
|
458
|
+
config: "config";
|
|
459
|
+
entrypoint: "entrypoint";
|
|
460
|
+
handler: "handler";
|
|
461
|
+
schema: "schema";
|
|
462
|
+
test: "test";
|
|
463
|
+
docs: "docs";
|
|
464
|
+
}>;
|
|
465
|
+
symbol: z.ZodOptional<z.ZodString>;
|
|
466
|
+
description: z.ZodOptional<z.ZodString>;
|
|
467
|
+
}, z.core.$strip>>>;
|
|
468
|
+
kind: z.ZodLiteral<"agent">;
|
|
469
|
+
agentKind: z.ZodEnum<{
|
|
470
|
+
platform: "platform";
|
|
471
|
+
orchestrator: "orchestrator";
|
|
472
|
+
specialist: "specialist";
|
|
473
|
+
utility: "utility";
|
|
474
|
+
}>;
|
|
475
|
+
actsAsRoleId: z.ZodOptional<z.ZodString>;
|
|
476
|
+
sessionCapable: z.ZodBoolean;
|
|
477
|
+
invocations: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
478
|
+
kind: z.ZodLiteral<"slash-command">;
|
|
479
|
+
command: z.ZodString;
|
|
480
|
+
toolFactory: z.ZodOptional<z.ZodString>;
|
|
481
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
482
|
+
kind: z.ZodLiteral<"mcp-tool">;
|
|
483
|
+
server: z.ZodString;
|
|
484
|
+
name: z.ZodString;
|
|
485
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
486
|
+
kind: z.ZodLiteral<"api-endpoint">;
|
|
487
|
+
method: z.ZodEnum<{
|
|
488
|
+
GET: "GET";
|
|
489
|
+
POST: "POST";
|
|
490
|
+
PATCH: "PATCH";
|
|
491
|
+
DELETE: "DELETE";
|
|
492
|
+
}>;
|
|
493
|
+
path: z.ZodString;
|
|
494
|
+
requestSchema: z.ZodOptional<z.ZodString>;
|
|
495
|
+
responseSchema: z.ZodOptional<z.ZodString>;
|
|
496
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
497
|
+
kind: z.ZodLiteral<"script-execution">;
|
|
498
|
+
resourceId: z.ZodString;
|
|
499
|
+
}, z.core.$strip>], "kind">>>;
|
|
500
|
+
emits: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
501
|
+
eventKey: z.ZodString;
|
|
502
|
+
label: z.ZodString;
|
|
503
|
+
payloadSchema: z.ZodOptional<z.ZodString>;
|
|
504
|
+
lifecycle: z.ZodOptional<z.ZodEnum<{
|
|
505
|
+
deprecated: "deprecated";
|
|
506
|
+
draft: "draft";
|
|
507
|
+
beta: "beta";
|
|
508
|
+
active: "active";
|
|
509
|
+
archived: "archived";
|
|
510
|
+
}>>;
|
|
511
|
+
}, z.core.$strip>>>;
|
|
512
|
+
}, z.core.$strip>;
|
|
513
|
+
declare const ResourceEntrySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
514
|
+
id: z.ZodString;
|
|
515
|
+
order: z.ZodDefault<z.ZodNumber>;
|
|
516
|
+
systemPath: z.ZodString;
|
|
517
|
+
title: z.ZodOptional<z.ZodString>;
|
|
518
|
+
description: z.ZodOptional<z.ZodString>;
|
|
519
|
+
ownerRoleId: z.ZodOptional<z.ZodString>;
|
|
520
|
+
status: z.ZodEnum<{
|
|
521
|
+
deprecated: "deprecated";
|
|
522
|
+
active: "active";
|
|
523
|
+
archived: "archived";
|
|
524
|
+
}>;
|
|
525
|
+
ontology: z.ZodOptional<z.ZodObject<{
|
|
526
|
+
actions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
527
|
+
primaryAction: z.ZodOptional<z.ZodString>;
|
|
528
|
+
reads: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
529
|
+
writes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
530
|
+
usesCatalogs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
531
|
+
emits: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
532
|
+
contract: z.ZodOptional<z.ZodObject<{
|
|
533
|
+
input: z.ZodOptional<z.ZodString>;
|
|
534
|
+
output: z.ZodOptional<z.ZodString>;
|
|
535
|
+
}, z.core.$strip>>;
|
|
536
|
+
}, z.core.$strip>>;
|
|
537
|
+
codeRefs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
538
|
+
path: z.ZodString;
|
|
539
|
+
role: z.ZodEnum<{
|
|
540
|
+
config: "config";
|
|
541
|
+
entrypoint: "entrypoint";
|
|
542
|
+
handler: "handler";
|
|
543
|
+
schema: "schema";
|
|
544
|
+
test: "test";
|
|
545
|
+
docs: "docs";
|
|
546
|
+
}>;
|
|
547
|
+
symbol: z.ZodOptional<z.ZodString>;
|
|
548
|
+
description: z.ZodOptional<z.ZodString>;
|
|
549
|
+
}, z.core.$strip>>>;
|
|
550
|
+
kind: z.ZodLiteral<"workflow">;
|
|
551
|
+
emits: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
552
|
+
eventKey: z.ZodString;
|
|
553
|
+
label: z.ZodString;
|
|
554
|
+
payloadSchema: z.ZodOptional<z.ZodString>;
|
|
555
|
+
lifecycle: z.ZodOptional<z.ZodEnum<{
|
|
556
|
+
deprecated: "deprecated";
|
|
557
|
+
draft: "draft";
|
|
558
|
+
beta: "beta";
|
|
559
|
+
active: "active";
|
|
560
|
+
archived: "archived";
|
|
561
|
+
}>>;
|
|
562
|
+
}, z.core.$strip>>>;
|
|
563
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
564
|
+
id: z.ZodString;
|
|
565
|
+
order: z.ZodDefault<z.ZodNumber>;
|
|
566
|
+
systemPath: z.ZodString;
|
|
567
|
+
title: z.ZodOptional<z.ZodString>;
|
|
568
|
+
description: z.ZodOptional<z.ZodString>;
|
|
569
|
+
ownerRoleId: z.ZodOptional<z.ZodString>;
|
|
570
|
+
status: z.ZodEnum<{
|
|
571
|
+
deprecated: "deprecated";
|
|
572
|
+
active: "active";
|
|
573
|
+
archived: "archived";
|
|
574
|
+
}>;
|
|
575
|
+
ontology: z.ZodOptional<z.ZodObject<{
|
|
576
|
+
actions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
577
|
+
primaryAction: z.ZodOptional<z.ZodString>;
|
|
578
|
+
reads: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
579
|
+
writes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
580
|
+
usesCatalogs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
581
|
+
emits: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
582
|
+
contract: z.ZodOptional<z.ZodObject<{
|
|
583
|
+
input: z.ZodOptional<z.ZodString>;
|
|
584
|
+
output: z.ZodOptional<z.ZodString>;
|
|
585
|
+
}, z.core.$strip>>;
|
|
586
|
+
}, z.core.$strip>>;
|
|
587
|
+
codeRefs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
588
|
+
path: z.ZodString;
|
|
589
|
+
role: z.ZodEnum<{
|
|
590
|
+
config: "config";
|
|
591
|
+
entrypoint: "entrypoint";
|
|
592
|
+
handler: "handler";
|
|
593
|
+
schema: "schema";
|
|
594
|
+
test: "test";
|
|
595
|
+
docs: "docs";
|
|
596
|
+
}>;
|
|
597
|
+
symbol: z.ZodOptional<z.ZodString>;
|
|
598
|
+
description: z.ZodOptional<z.ZodString>;
|
|
599
|
+
}, z.core.$strip>>>;
|
|
600
|
+
kind: z.ZodLiteral<"agent">;
|
|
601
|
+
agentKind: z.ZodEnum<{
|
|
602
|
+
platform: "platform";
|
|
603
|
+
orchestrator: "orchestrator";
|
|
604
|
+
specialist: "specialist";
|
|
605
|
+
utility: "utility";
|
|
606
|
+
}>;
|
|
607
|
+
actsAsRoleId: z.ZodOptional<z.ZodString>;
|
|
608
|
+
sessionCapable: z.ZodBoolean;
|
|
609
|
+
invocations: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
610
|
+
kind: z.ZodLiteral<"slash-command">;
|
|
611
|
+
command: z.ZodString;
|
|
612
|
+
toolFactory: z.ZodOptional<z.ZodString>;
|
|
613
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
614
|
+
kind: z.ZodLiteral<"mcp-tool">;
|
|
615
|
+
server: z.ZodString;
|
|
616
|
+
name: z.ZodString;
|
|
617
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
618
|
+
kind: z.ZodLiteral<"api-endpoint">;
|
|
619
|
+
method: z.ZodEnum<{
|
|
620
|
+
GET: "GET";
|
|
621
|
+
POST: "POST";
|
|
622
|
+
PATCH: "PATCH";
|
|
623
|
+
DELETE: "DELETE";
|
|
624
|
+
}>;
|
|
625
|
+
path: z.ZodString;
|
|
626
|
+
requestSchema: z.ZodOptional<z.ZodString>;
|
|
627
|
+
responseSchema: z.ZodOptional<z.ZodString>;
|
|
628
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
629
|
+
kind: z.ZodLiteral<"script-execution">;
|
|
630
|
+
resourceId: z.ZodString;
|
|
631
|
+
}, z.core.$strip>], "kind">>>;
|
|
632
|
+
emits: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
633
|
+
eventKey: z.ZodString;
|
|
634
|
+
label: z.ZodString;
|
|
635
|
+
payloadSchema: z.ZodOptional<z.ZodString>;
|
|
636
|
+
lifecycle: z.ZodOptional<z.ZodEnum<{
|
|
637
|
+
deprecated: "deprecated";
|
|
638
|
+
draft: "draft";
|
|
639
|
+
beta: "beta";
|
|
640
|
+
active: "active";
|
|
641
|
+
archived: "archived";
|
|
642
|
+
}>>;
|
|
643
|
+
}, z.core.$strip>>>;
|
|
644
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
645
|
+
id: z.ZodString;
|
|
646
|
+
order: z.ZodDefault<z.ZodNumber>;
|
|
647
|
+
systemPath: z.ZodString;
|
|
648
|
+
title: z.ZodOptional<z.ZodString>;
|
|
649
|
+
description: z.ZodOptional<z.ZodString>;
|
|
650
|
+
ownerRoleId: z.ZodOptional<z.ZodString>;
|
|
651
|
+
status: z.ZodEnum<{
|
|
652
|
+
deprecated: "deprecated";
|
|
653
|
+
active: "active";
|
|
654
|
+
archived: "archived";
|
|
655
|
+
}>;
|
|
656
|
+
ontology: z.ZodOptional<z.ZodObject<{
|
|
657
|
+
actions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
658
|
+
primaryAction: z.ZodOptional<z.ZodString>;
|
|
659
|
+
reads: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
660
|
+
writes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
661
|
+
usesCatalogs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
662
|
+
emits: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
663
|
+
contract: z.ZodOptional<z.ZodObject<{
|
|
664
|
+
input: z.ZodOptional<z.ZodString>;
|
|
665
|
+
output: z.ZodOptional<z.ZodString>;
|
|
666
|
+
}, z.core.$strip>>;
|
|
667
|
+
}, z.core.$strip>>;
|
|
668
|
+
codeRefs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
669
|
+
path: z.ZodString;
|
|
670
|
+
role: z.ZodEnum<{
|
|
671
|
+
config: "config";
|
|
672
|
+
entrypoint: "entrypoint";
|
|
673
|
+
handler: "handler";
|
|
674
|
+
schema: "schema";
|
|
675
|
+
test: "test";
|
|
676
|
+
docs: "docs";
|
|
677
|
+
}>;
|
|
678
|
+
symbol: z.ZodOptional<z.ZodString>;
|
|
679
|
+
description: z.ZodOptional<z.ZodString>;
|
|
680
|
+
}, z.core.$strip>>>;
|
|
681
|
+
kind: z.ZodLiteral<"integration">;
|
|
682
|
+
provider: z.ZodString;
|
|
683
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
684
|
+
id: z.ZodString;
|
|
685
|
+
order: z.ZodDefault<z.ZodNumber>;
|
|
686
|
+
systemPath: z.ZodString;
|
|
687
|
+
title: z.ZodOptional<z.ZodString>;
|
|
688
|
+
description: z.ZodOptional<z.ZodString>;
|
|
689
|
+
ownerRoleId: z.ZodOptional<z.ZodString>;
|
|
690
|
+
status: z.ZodEnum<{
|
|
691
|
+
deprecated: "deprecated";
|
|
692
|
+
active: "active";
|
|
693
|
+
archived: "archived";
|
|
694
|
+
}>;
|
|
695
|
+
ontology: z.ZodOptional<z.ZodObject<{
|
|
696
|
+
actions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
697
|
+
primaryAction: z.ZodOptional<z.ZodString>;
|
|
698
|
+
reads: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
699
|
+
writes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
700
|
+
usesCatalogs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
701
|
+
emits: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
702
|
+
contract: z.ZodOptional<z.ZodObject<{
|
|
703
|
+
input: z.ZodOptional<z.ZodString>;
|
|
704
|
+
output: z.ZodOptional<z.ZodString>;
|
|
705
|
+
}, z.core.$strip>>;
|
|
706
|
+
}, z.core.$strip>>;
|
|
707
|
+
codeRefs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
708
|
+
path: z.ZodString;
|
|
709
|
+
role: z.ZodEnum<{
|
|
710
|
+
config: "config";
|
|
711
|
+
entrypoint: "entrypoint";
|
|
712
|
+
handler: "handler";
|
|
713
|
+
schema: "schema";
|
|
714
|
+
test: "test";
|
|
715
|
+
docs: "docs";
|
|
716
|
+
}>;
|
|
717
|
+
symbol: z.ZodOptional<z.ZodString>;
|
|
718
|
+
description: z.ZodOptional<z.ZodString>;
|
|
719
|
+
}, z.core.$strip>>>;
|
|
720
|
+
kind: z.ZodLiteral<"script">;
|
|
721
|
+
language: z.ZodEnum<{
|
|
722
|
+
shell: "shell";
|
|
723
|
+
sql: "sql";
|
|
724
|
+
typescript: "typescript";
|
|
725
|
+
python: "python";
|
|
726
|
+
}>;
|
|
727
|
+
source: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
728
|
+
file: z.ZodString;
|
|
729
|
+
}, z.core.$strip>]>;
|
|
730
|
+
}, z.core.$strip>], "kind">;
|
|
731
|
+
type ResourceGovernanceStatus = z.infer<typeof ResourceGovernanceStatusSchema>;
|
|
732
|
+
type WorkflowResourceEntry = z.infer<typeof WorkflowResourceEntrySchema$1>;
|
|
733
|
+
type AgentResourceEntry = z.infer<typeof AgentResourceEntrySchema>;
|
|
734
|
+
type ResourceEntry = z.infer<typeof ResourceEntrySchema>;
|
|
735
|
+
|
|
736
|
+
/**
|
|
737
|
+
* Shared form field types for dynamic form generation
|
|
738
|
+
* Used by: Command Queue, Execution Runner UI, future form-based features
|
|
739
|
+
*/
|
|
740
|
+
/**
|
|
741
|
+
* Supported form field types for action payloads
|
|
742
|
+
* Maps to Mantine form components
|
|
743
|
+
*/
|
|
744
|
+
type FormFieldType = 'text' | 'textarea' | 'number' | 'select' | 'checkbox' | 'radio' | 'richtext';
|
|
745
|
+
/**
|
|
746
|
+
* Form field definition
|
|
747
|
+
*/
|
|
748
|
+
interface FormField {
|
|
749
|
+
/** Field key in payload object */
|
|
750
|
+
name: string;
|
|
751
|
+
/** Field label for UI */
|
|
752
|
+
label: string;
|
|
753
|
+
/** Field type (determines UI component) */
|
|
754
|
+
type: FormFieldType;
|
|
755
|
+
/** Default value */
|
|
756
|
+
defaultValue?: unknown;
|
|
757
|
+
/** Required field */
|
|
758
|
+
required?: boolean;
|
|
759
|
+
/** Placeholder text */
|
|
760
|
+
placeholder?: string;
|
|
761
|
+
/** Help text */
|
|
762
|
+
description?: string;
|
|
763
|
+
/** Options for select/radio */
|
|
764
|
+
options?: Array<{
|
|
765
|
+
label: string;
|
|
766
|
+
value: string | number;
|
|
767
|
+
}>;
|
|
768
|
+
/** Min/max for number */
|
|
769
|
+
min?: number;
|
|
770
|
+
max?: number;
|
|
771
|
+
/** Path to context value for pre-filling (dot notation, e.g., 'proposal.summary') */
|
|
772
|
+
defaultValueFromContext?: string;
|
|
773
|
+
}
|
|
774
|
+
/**
|
|
775
|
+
* Form schema for action payload collection
|
|
776
|
+
*/
|
|
777
|
+
interface FormSchema {
|
|
778
|
+
/** Form title */
|
|
779
|
+
title?: string;
|
|
780
|
+
/** Form description */
|
|
781
|
+
description?: string;
|
|
782
|
+
/** Form fields */
|
|
783
|
+
fields: FormField[];
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
/**
|
|
787
|
+
* Execution interface configuration
|
|
788
|
+
* Defines how a resource is executed via the UI (forms, scheduling, webhooks)
|
|
789
|
+
* Applies to both agents and workflows
|
|
790
|
+
*/
|
|
791
|
+
interface ExecutionInterface {
|
|
792
|
+
/** Form configuration for execution inputs */
|
|
793
|
+
form: ExecutionFormSchema;
|
|
794
|
+
/** Optional: Schedule configuration */
|
|
795
|
+
schedule?: ScheduleConfig;
|
|
796
|
+
/** Optional: Webhook trigger configuration */
|
|
797
|
+
webhook?: WebhookConfig;
|
|
798
|
+
}
|
|
799
|
+
/**
|
|
800
|
+
* Execution form schema
|
|
801
|
+
* Extends FormSchema with execution-specific fields
|
|
802
|
+
*/
|
|
803
|
+
interface ExecutionFormSchema extends FormSchema {
|
|
804
|
+
/**
|
|
805
|
+
* Field mappings to resource input schema
|
|
806
|
+
* Maps form field names to contract input paths
|
|
807
|
+
* If omitted, field names must match contract input keys exactly
|
|
808
|
+
*/
|
|
809
|
+
fieldMappings?: Record<string, string>;
|
|
810
|
+
/**
|
|
811
|
+
* Submit button configuration
|
|
812
|
+
* Default: { label: 'Run', loadingLabel: 'Running...' }
|
|
813
|
+
*/
|
|
814
|
+
submitButton?: {
|
|
815
|
+
label?: string;
|
|
816
|
+
loadingLabel?: string;
|
|
817
|
+
confirmMessage?: string;
|
|
818
|
+
};
|
|
819
|
+
}
|
|
820
|
+
/**
|
|
821
|
+
* Schedule configuration for automated execution
|
|
822
|
+
*/
|
|
823
|
+
interface ScheduleConfig {
|
|
824
|
+
/** Whether scheduling is enabled for this resource */
|
|
825
|
+
enabled: boolean;
|
|
826
|
+
/** Default schedule (cron expression) */
|
|
827
|
+
defaultSchedule?: string;
|
|
828
|
+
/** Allowed schedule patterns (if restricted) */
|
|
829
|
+
allowedPatterns?: string[];
|
|
830
|
+
}
|
|
831
|
+
/**
|
|
832
|
+
* Webhook configuration for external triggers
|
|
833
|
+
*/
|
|
834
|
+
interface WebhookConfig {
|
|
835
|
+
/** Whether webhook trigger is enabled */
|
|
836
|
+
enabled: boolean;
|
|
837
|
+
/** Expected payload schema (for documentation) */
|
|
838
|
+
payloadSchema?: unknown;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
interface WorkflowConfig extends ResourceDefinition {
|
|
842
|
+
type: 'workflow';
|
|
843
|
+
/** OM descriptor backing canonical identity and governance metadata. */
|
|
844
|
+
resource?: WorkflowResourceEntry;
|
|
845
|
+
}
|
|
846
|
+
interface WorkflowStepDefinition {
|
|
847
|
+
id: string;
|
|
848
|
+
name: string;
|
|
849
|
+
description: string;
|
|
850
|
+
}
|
|
851
|
+
type StepHandler = (input: unknown, context: ExecutionContext) => Promise<unknown>;
|
|
852
|
+
interface LinearNext {
|
|
853
|
+
type: 'linear';
|
|
854
|
+
target: string;
|
|
855
|
+
}
|
|
856
|
+
interface ConditionalNext {
|
|
857
|
+
type: 'conditional';
|
|
858
|
+
routes: Array<{
|
|
859
|
+
condition: (data: unknown) => boolean;
|
|
860
|
+
target: string;
|
|
861
|
+
}>;
|
|
862
|
+
default: string;
|
|
863
|
+
}
|
|
864
|
+
type NextConfig = LinearNext | ConditionalNext | null;
|
|
865
|
+
interface WorkflowStep extends WorkflowStepDefinition {
|
|
866
|
+
handler: StepHandler;
|
|
867
|
+
inputSchema: z.ZodSchema;
|
|
868
|
+
outputSchema: z.ZodSchema;
|
|
869
|
+
next: NextConfig;
|
|
870
|
+
}
|
|
871
|
+
interface WorkflowDefinition {
|
|
872
|
+
config: WorkflowConfig;
|
|
873
|
+
contract: Contract;
|
|
874
|
+
steps: Record<string, WorkflowStep>;
|
|
875
|
+
entryPoint: string;
|
|
876
|
+
/**
|
|
877
|
+
* Metrics configuration for ROI calculations
|
|
878
|
+
* Optional: Only needed if tracking automation savings
|
|
879
|
+
*/
|
|
880
|
+
metricsConfig?: ResourceMetricsConfig;
|
|
881
|
+
/**
|
|
882
|
+
* Execution interface configuration (optional)
|
|
883
|
+
* If provided, workflow appears in Execution Runner UI
|
|
884
|
+
*/
|
|
885
|
+
interface?: ExecutionInterface;
|
|
886
|
+
/**
|
|
887
|
+
* Lead-gen processing stage this workflow implements (optional).
|
|
888
|
+
* Must match a key in the platform lead-gen stage catalog.
|
|
889
|
+
* Used by org-os graph derivation to surface workflow→stage edges and
|
|
890
|
+
* by pipeline_config validation to confirm each catalog stage has an
|
|
891
|
+
* implementing workflow before a list is activated.
|
|
892
|
+
*
|
|
893
|
+
* Example: stageImplemented: 'verified' on the email-verification workflow.
|
|
894
|
+
*/
|
|
895
|
+
stageImplemented?: string;
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
/**
|
|
899
|
+
* Generic LLM Types
|
|
900
|
+
* Universal interfaces for LLM interaction across all resource types
|
|
901
|
+
*/
|
|
902
|
+
/**
|
|
903
|
+
* Standard chat message format
|
|
904
|
+
* Compatible with OpenAI, Anthropic, and other providers
|
|
905
|
+
*/
|
|
906
|
+
interface LLMMessage {
|
|
907
|
+
role: 'system' | 'user' | 'assistant';
|
|
908
|
+
content: string;
|
|
909
|
+
}
|
|
910
|
+
/**
|
|
911
|
+
* Generic LLM generation request
|
|
912
|
+
* Usable by agents, workflows, tools, etc.
|
|
913
|
+
*/
|
|
914
|
+
interface LLMGenerateRequest {
|
|
915
|
+
messages: LLMMessage[];
|
|
916
|
+
responseSchema: unknown;
|
|
917
|
+
/** Maximum output tokens per LLM call. NOT the model's context window — see ModelInfo.maxTokens for that. */
|
|
918
|
+
maxOutputTokens?: number;
|
|
919
|
+
temperature?: number;
|
|
920
|
+
topP?: number;
|
|
921
|
+
signal?: AbortSignal;
|
|
922
|
+
}
|
|
923
|
+
/**
|
|
924
|
+
* Generic LLM generation response
|
|
925
|
+
* Usage field is internal-only (stripped by UniversalLLMAdapter wrapper)
|
|
926
|
+
*/
|
|
927
|
+
interface LLMGenerateResponse<T = unknown> {
|
|
928
|
+
output: T;
|
|
929
|
+
usage?: {
|
|
930
|
+
inputTokens: number;
|
|
931
|
+
outputTokens: number;
|
|
932
|
+
totalTokens: number;
|
|
933
|
+
};
|
|
934
|
+
cost?: number;
|
|
935
|
+
}
|
|
936
|
+
/**
|
|
937
|
+
* LLM Adapter interface
|
|
938
|
+
* Generic primitive for all resource types (agents, workflows, tools)
|
|
939
|
+
*
|
|
940
|
+
* Design principles:
|
|
941
|
+
* - Single method: generate() - the core LLM primitive
|
|
942
|
+
* - Generic return type for type safety
|
|
943
|
+
* - Universal format (not agent-specific)
|
|
944
|
+
* - Standard message-based input (OpenAI-compatible)
|
|
945
|
+
*/
|
|
946
|
+
interface LLMAdapter {
|
|
947
|
+
/**
|
|
948
|
+
* Generate structured output from prompt using LLM
|
|
949
|
+
*
|
|
950
|
+
* @param request - Generation request with messages and response schema
|
|
951
|
+
* @returns Generated output (typed) with optional usage metadata
|
|
952
|
+
*/
|
|
953
|
+
generate<T = unknown>(request: LLMGenerateRequest): Promise<LLMGenerateResponse<T>>;
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
/**
|
|
957
|
+
* Memory type definitions
|
|
958
|
+
* Types for agent memory management with semantic entry types
|
|
959
|
+
*/
|
|
960
|
+
/**
|
|
961
|
+
* Semantic memory entry types
|
|
962
|
+
* Use-case agnostic types that describe the purpose of each entry
|
|
963
|
+
* Memory types mirror action types for clarity and filtering
|
|
964
|
+
*/
|
|
965
|
+
type MemoryEntryType = 'context' | 'input' | 'reasoning' | 'tool-result' | 'delegation-result' | 'error';
|
|
966
|
+
/**
|
|
967
|
+
* Memory entry - represents a single entry in agent memory
|
|
968
|
+
* Stored in agent memory, translated by adapters to vendor-specific formats
|
|
969
|
+
*/
|
|
970
|
+
interface MemoryEntry {
|
|
971
|
+
type: MemoryEntryType;
|
|
972
|
+
content: string;
|
|
973
|
+
timestamp: number;
|
|
974
|
+
turnNumber: number | null;
|
|
975
|
+
iterationNumber: number | null;
|
|
976
|
+
}
|
|
977
|
+
/**
|
|
978
|
+
* Agent memory - Self-orchestrated memory with session + working storage
|
|
979
|
+
* Agent has full control over what persists, framework handles auto-compaction
|
|
980
|
+
*/
|
|
981
|
+
interface AgentMemory {
|
|
982
|
+
/**
|
|
983
|
+
* Session memory - Persists for session/conversation duration
|
|
984
|
+
* Never auto-trimmed by framework
|
|
985
|
+
* Agent-managed key-value store for critical information
|
|
986
|
+
* Agent provides strings, framework wraps in MemoryEntry
|
|
987
|
+
*/
|
|
988
|
+
sessionMemory: Record<string, MemoryEntry>;
|
|
989
|
+
/**
|
|
990
|
+
* Working memory - Execution history
|
|
991
|
+
* Automatically compacted by framework when needed
|
|
992
|
+
* Agent doesn't control compaction
|
|
993
|
+
*/
|
|
994
|
+
history: MemoryEntry[];
|
|
995
|
+
}
|
|
996
|
+
/**
|
|
997
|
+
* Memory status for agent awareness
|
|
998
|
+
*/
|
|
999
|
+
interface MemoryStatus {
|
|
1000
|
+
sessionMemoryKeys: number;
|
|
1001
|
+
sessionMemoryLimit: number;
|
|
1002
|
+
currentKeys: string[];
|
|
1003
|
+
historyPercent: number;
|
|
1004
|
+
historyTokens: number;
|
|
1005
|
+
tokenBudget: number;
|
|
1006
|
+
}
|
|
1007
|
+
/**
|
|
1008
|
+
* Memory constraints (optional limits)
|
|
1009
|
+
*/
|
|
1010
|
+
interface MemoryConstraints {
|
|
1011
|
+
maxSessionMemoryKeys?: number;
|
|
1012
|
+
maxMemoryTokens?: number;
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
/**
|
|
1016
|
+
* Memory Manager
|
|
1017
|
+
* Encapsulates all memory operations with ultra-simple agent API
|
|
1018
|
+
* Agent provides strings, framework handles wrapping and auto-compaction
|
|
1019
|
+
*/
|
|
1020
|
+
|
|
1021
|
+
/**
|
|
1022
|
+
* Memory Manager - Agent memory orchestration
|
|
1023
|
+
* Provides ultra-simple API for agents (strings only)
|
|
1024
|
+
* Handles automatic compaction and token management
|
|
1025
|
+
*/
|
|
1026
|
+
declare class MemoryManager {
|
|
1027
|
+
private memory;
|
|
1028
|
+
private constraints;
|
|
1029
|
+
private logger?;
|
|
1030
|
+
private cachedSnapshot?;
|
|
1031
|
+
constructor(memory: AgentMemory, constraints?: MemoryConstraints, logger?: AgentScopedLogger | undefined);
|
|
1032
|
+
/**
|
|
1033
|
+
* Set session memory entry (agent provides string, framework wraps it)
|
|
1034
|
+
* @param key - Session memory key
|
|
1035
|
+
* @param content - String content from agent
|
|
1036
|
+
*/
|
|
1037
|
+
set(key: string, content: string): void;
|
|
1038
|
+
/**
|
|
1039
|
+
* Get session memory entry content
|
|
1040
|
+
* @param key - Session memory key
|
|
1041
|
+
* @returns String content if exists, undefined otherwise
|
|
1042
|
+
*/
|
|
1043
|
+
get(key: string): string | undefined;
|
|
1044
|
+
/**
|
|
1045
|
+
* Delete session memory entry
|
|
1046
|
+
* @param key - Key to delete
|
|
1047
|
+
* @returns True if key existed and was deleted
|
|
1048
|
+
*/
|
|
1049
|
+
delete(key: string): boolean;
|
|
1050
|
+
/**
|
|
1051
|
+
* Add entry to history (called by framework after tool results, reasoning, etc.)
|
|
1052
|
+
* Automatically sets timestamp to current time
|
|
1053
|
+
* @param entry - Memory entry to add (without timestamp - auto-generated)
|
|
1054
|
+
*/
|
|
1055
|
+
addToHistory(entry: Omit<MemoryEntry, 'timestamp'>): void;
|
|
1056
|
+
/**
|
|
1057
|
+
* Auto-compact history if approaching token budget
|
|
1058
|
+
* Uses preserve-anchors strategy: keep first + recent entries
|
|
1059
|
+
*/
|
|
1060
|
+
autoCompact(): void;
|
|
1061
|
+
/**
|
|
1062
|
+
* Enforce hard limits (called before LLM request)
|
|
1063
|
+
* Emergency fallback if agent exceeds limits
|
|
1064
|
+
*/
|
|
1065
|
+
enforceHardLimits(): void;
|
|
1066
|
+
/**
|
|
1067
|
+
* Get history length (for logging and introspection)
|
|
1068
|
+
* @returns Number of entries in history
|
|
1069
|
+
*/
|
|
1070
|
+
getHistoryLength(): number;
|
|
1071
|
+
/**
|
|
1072
|
+
* Get memory status for agent awareness
|
|
1073
|
+
* @returns Memory status with token usage and key counts
|
|
1074
|
+
*/
|
|
1075
|
+
getStatus(): MemoryStatus;
|
|
1076
|
+
/**
|
|
1077
|
+
* Create memory snapshot for persistence
|
|
1078
|
+
* Caches snapshot internally for later retrieval
|
|
1079
|
+
* @returns Deep copy of current memory state
|
|
1080
|
+
*/
|
|
1081
|
+
toSnapshot(): AgentMemory;
|
|
1082
|
+
/**
|
|
1083
|
+
* Get cached memory snapshot
|
|
1084
|
+
* Returns snapshot created by toSnapshot()
|
|
1085
|
+
* @returns Cached snapshot (undefined if toSnapshot() not called yet)
|
|
1086
|
+
*/
|
|
1087
|
+
getSnapshot(): AgentMemory | undefined;
|
|
1088
|
+
/**
|
|
1089
|
+
* Build context string for LLM
|
|
1090
|
+
* Serializes sessionmemory + history memory with clear sections
|
|
1091
|
+
* Shows current iteration entries FIRST (reverse chronological) for LLM attention
|
|
1092
|
+
* @param currentIteration - Current iteration number (0 = pre-iteration)
|
|
1093
|
+
* @param currentTurn - Current turn number (optional, for session context filtering)
|
|
1094
|
+
* @returns Formatted memory context for LLM prompt
|
|
1095
|
+
*/
|
|
1096
|
+
toContext(currentIteration: number, currentTurn?: number): string;
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
/**
|
|
1100
|
+
* Knowledge Map Types
|
|
1101
|
+
*
|
|
1102
|
+
* Enables agents to navigate organizational knowledge through a lightweight
|
|
1103
|
+
* graph that lazy-loads capabilities on-demand.
|
|
1104
|
+
*
|
|
1105
|
+
* @module agent/knowledge-map
|
|
1106
|
+
*/
|
|
1107
|
+
|
|
1108
|
+
/**
|
|
1109
|
+
* Lightweight knowledge map (passed as agent property)
|
|
1110
|
+
*
|
|
1111
|
+
* Contains metadata about available knowledge nodes without loading
|
|
1112
|
+
* the full content upfront. Total size: ~300-500 tokens.
|
|
1113
|
+
*
|
|
1114
|
+
* Multi-tenancy is enforced via:
|
|
1115
|
+
* - File-scoped maps (organizations/{org-name}/knowledge/)
|
|
1116
|
+
* - ExecutionContext.organizationId passed to node.load()
|
|
1117
|
+
*/
|
|
1118
|
+
interface KnowledgeMap {
|
|
1119
|
+
/** Available knowledge nodes indexed by ID */
|
|
1120
|
+
nodes: Record<string, KnowledgeNode>;
|
|
1121
|
+
}
|
|
1122
|
+
/**
|
|
1123
|
+
* Single knowledge source
|
|
1124
|
+
*
|
|
1125
|
+
* Represents a domain knowledge area (CRM, brand guidelines, Excel tools)
|
|
1126
|
+
* that can be lazy-loaded to provide instructions and tools to agents.
|
|
1127
|
+
*/
|
|
1128
|
+
interface KnowledgeNode {
|
|
1129
|
+
/** Unique identifier for this node (e.g., "crm", "brand-guidelines") */
|
|
1130
|
+
id: string;
|
|
1131
|
+
/**
|
|
1132
|
+
* Description of when to use this knowledge
|
|
1133
|
+
* Used for semantic matching against user intent
|
|
1134
|
+
*/
|
|
1135
|
+
description: string;
|
|
1136
|
+
/**
|
|
1137
|
+
* Load knowledge content on-demand
|
|
1138
|
+
*
|
|
1139
|
+
* @param context - Execution context with organizationId for multi-tenancy
|
|
1140
|
+
* @returns Promise resolving to knowledge content (prompt + optional tools)
|
|
1141
|
+
*/
|
|
1142
|
+
load(context: ExecutionContext): Promise<KnowledgeContent>;
|
|
1143
|
+
/**
|
|
1144
|
+
* Loaded state flag
|
|
1145
|
+
* Set to true after load() is called
|
|
1146
|
+
*/
|
|
1147
|
+
loaded?: boolean;
|
|
1148
|
+
/**
|
|
1149
|
+
* Cached prompt (for system prompt serialization)
|
|
1150
|
+
* Only the prompt is cached - tools go to toolRegistry, children flattened to nodes
|
|
1151
|
+
*/
|
|
1152
|
+
prompt?: string;
|
|
1153
|
+
}
|
|
1154
|
+
/**
|
|
1155
|
+
* Content returned by knowledge node
|
|
1156
|
+
*
|
|
1157
|
+
* Separates instructions (prompt) from capabilities (tools).
|
|
1158
|
+
* Tools are optional - some nodes only provide context.
|
|
1159
|
+
*
|
|
1160
|
+
* Supports recursive navigation - nodes can contain child nodes
|
|
1161
|
+
* that are discovered when the parent node is loaded.
|
|
1162
|
+
*/
|
|
1163
|
+
interface KnowledgeContent {
|
|
1164
|
+
/** Instructions and context (markdown format) */
|
|
1165
|
+
prompt: string;
|
|
1166
|
+
/** Tool implementations (optional) */
|
|
1167
|
+
tools?: Tool[];
|
|
1168
|
+
/**
|
|
1169
|
+
* Child knowledge nodes (optional, recursive)
|
|
1170
|
+
*
|
|
1171
|
+
* Enables hierarchical navigation: base → specialized → deep expertise.
|
|
1172
|
+
* Child nodes are flattened into the main knowledge map when parent loads,
|
|
1173
|
+
* making them available for subsequent navigate-knowledge actions.
|
|
1174
|
+
*
|
|
1175
|
+
* Example: CRM base node returns crm-customers and crm-deals as children
|
|
1176
|
+
*/
|
|
1177
|
+
nodes?: Record<string, KnowledgeNode>;
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
/**
|
|
1181
|
+
* Agent-specific type definitions
|
|
1182
|
+
* Types for autonomous agents with tools, memory, and constraints
|
|
1183
|
+
*/
|
|
1184
|
+
|
|
1185
|
+
/**
|
|
1186
|
+
* Factory function for creating LLM adapters.
|
|
1187
|
+
* Injected into the Agent class to decouple the engine from server-only provider SDKs.
|
|
1188
|
+
* - API process: provides createLLMAdapter (real SDKs + process.env API keys)
|
|
1189
|
+
* - SDK worker: provides PostMessageLLMAdapter (proxies via platform.call)
|
|
1190
|
+
*
|
|
1191
|
+
* Uses `any` for optional params so both the real createLLMAdapter (with typed
|
|
1192
|
+
* AIUsageCollector/AICallContext) and the worker proxy (which ignores them) satisfy the type.
|
|
1193
|
+
*/
|
|
1194
|
+
type LLMAdapterFactory = (config: ModelConfig, ...args: any[]) => LLMAdapter;
|
|
1195
|
+
type AgentKind = 'orchestrator' | 'specialist' | 'utility' | 'platform';
|
|
1196
|
+
interface AgentConfig extends ResourceDefinition {
|
|
1197
|
+
type: 'agent';
|
|
1198
|
+
/** OM descriptor backing canonical identity and governance metadata. */
|
|
1199
|
+
resource?: AgentResourceEntry;
|
|
1200
|
+
kind: AgentKind;
|
|
1201
|
+
systemPrompt: string;
|
|
1202
|
+
constraints?: AgentConstraints;
|
|
1203
|
+
/**
|
|
1204
|
+
* Session capability declaration (opt-in)
|
|
1205
|
+
* If true, agent is designed for multi-turn session interactions
|
|
1206
|
+
* Controls whether agent can use message action and appears in Sessions UI
|
|
1207
|
+
*
|
|
1208
|
+
* Use for:
|
|
1209
|
+
* - Conversational agents with multi-turn interactions
|
|
1210
|
+
* - Agents requiring persistent context across turns
|
|
1211
|
+
* - Agents that need human-in-the-loop communication
|
|
1212
|
+
*/
|
|
1213
|
+
sessionCapable?: boolean;
|
|
1214
|
+
/**
|
|
1215
|
+
* Security level for system prompt hardening (auto-derived if omitted)
|
|
1216
|
+
*
|
|
1217
|
+
* - 'standard': Lightweight defense (3 rules) - default for non-session agents
|
|
1218
|
+
* - 'hardened': Comprehensive defense (6 rules) - default for session-capable agents
|
|
1219
|
+
* - 'none': No security prompt - for pure internal agents with no external input
|
|
1220
|
+
*
|
|
1221
|
+
* If omitted, derived from sessionCapable:
|
|
1222
|
+
* sessionCapable: true -> 'hardened'
|
|
1223
|
+
* sessionCapable: false -> 'standard'
|
|
1224
|
+
*/
|
|
1225
|
+
securityLevel?: 'standard' | 'hardened' | 'none';
|
|
1226
|
+
/**
|
|
1227
|
+
* Memory management preferences (opt-in)
|
|
1228
|
+
* If provided, agent can use memoryOps to manage session memory
|
|
1229
|
+
* If omitted, agent has no memory management capabilities
|
|
1230
|
+
*
|
|
1231
|
+
* Agent-specific guidance on what to preserve, when to persist, and what to clean up.
|
|
1232
|
+
* This guidance is injected into the system prompt when memory management is enabled.
|
|
1233
|
+
*
|
|
1234
|
+
* Use for:
|
|
1235
|
+
* - Conversational agents needing cross-turn context
|
|
1236
|
+
* - Agents managing complex user preferences
|
|
1237
|
+
* - Agents tracking decisions over multiple iterations
|
|
1238
|
+
*/
|
|
1239
|
+
memoryPreferences?: string;
|
|
1240
|
+
}
|
|
1241
|
+
interface AgentConstraints {
|
|
1242
|
+
maxIterations?: number;
|
|
1243
|
+
timeout?: number;
|
|
1244
|
+
maxSessionMemoryKeys?: number;
|
|
1245
|
+
maxMemoryTokens?: number;
|
|
1246
|
+
}
|
|
1247
|
+
interface AgentDefinition {
|
|
1248
|
+
config: AgentConfig;
|
|
1249
|
+
contract: Contract;
|
|
1250
|
+
tools: Tool[];
|
|
1251
|
+
/**
|
|
1252
|
+
* Model configuration for LLM execution
|
|
1253
|
+
* Specifies provider, API key, and model-specific options
|
|
1254
|
+
*/
|
|
1255
|
+
modelConfig: ModelConfig;
|
|
1256
|
+
/**
|
|
1257
|
+
* Optional knowledge map for lazy-loading capabilities
|
|
1258
|
+
* Enables agents to navigate organizational knowledge on-demand
|
|
1259
|
+
*/
|
|
1260
|
+
knowledgeMap?: KnowledgeMap;
|
|
1261
|
+
/**
|
|
1262
|
+
* Preload memory before execution starts
|
|
1263
|
+
* Handles BOTH context loading AND session restoration
|
|
1264
|
+
*
|
|
1265
|
+
* @param context - Execution context (includes sessionId if session turn)
|
|
1266
|
+
* @returns Initial AgentMemory state (sessionMemory entries + optionally history)
|
|
1267
|
+
*/
|
|
1268
|
+
preloadMemory?: (context: ExecutionContext) => Promise<AgentMemory> | AgentMemory;
|
|
1269
|
+
/**
|
|
1270
|
+
* Metrics configuration for ROI calculations
|
|
1271
|
+
* Optional: Only needed if tracking automation savings
|
|
1272
|
+
*/
|
|
1273
|
+
metricsConfig?: ResourceMetricsConfig;
|
|
1274
|
+
/**
|
|
1275
|
+
* Execution interface configuration (optional)
|
|
1276
|
+
* If provided, agent appears in Execution Runner UI
|
|
1277
|
+
*/
|
|
1278
|
+
interface?: ExecutionInterface;
|
|
1279
|
+
}
|
|
1280
|
+
/**
|
|
1281
|
+
* Agent execution context
|
|
1282
|
+
* Groups all state needed for agent execution phases
|
|
1283
|
+
*/
|
|
1284
|
+
interface IterationContext {
|
|
1285
|
+
config: AgentConfig;
|
|
1286
|
+
contract: Contract;
|
|
1287
|
+
toolRegistry: Map<string, Tool>;
|
|
1288
|
+
memoryManager: MemoryManager;
|
|
1289
|
+
executionContext: ExecutionContext;
|
|
1290
|
+
iteration: number;
|
|
1291
|
+
logger: AgentScopedLogger;
|
|
1292
|
+
modelConfig: ModelConfig;
|
|
1293
|
+
adapterFactory: LLMAdapterFactory;
|
|
1294
|
+
knowledgeMap?: KnowledgeMap;
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
declare const OntologyScopeSchema: z.ZodDefault<z.ZodObject<{
|
|
1298
|
+
objectTypes: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1299
|
+
id: z.ZodString;
|
|
1300
|
+
label: z.ZodOptional<z.ZodString>;
|
|
1301
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1302
|
+
ownerSystemId: z.ZodOptional<z.ZodString>;
|
|
1303
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1304
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1305
|
+
storage: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1306
|
+
}, z.core.$loose>>>>;
|
|
1307
|
+
linkTypes: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1308
|
+
id: z.ZodString;
|
|
1309
|
+
label: z.ZodOptional<z.ZodString>;
|
|
1310
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1311
|
+
ownerSystemId: z.ZodOptional<z.ZodString>;
|
|
1312
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1313
|
+
from: z.ZodString;
|
|
1314
|
+
to: z.ZodString;
|
|
1315
|
+
cardinality: z.ZodOptional<z.ZodString>;
|
|
1316
|
+
via: z.ZodOptional<z.ZodString>;
|
|
1317
|
+
}, z.core.$loose>>>>;
|
|
1318
|
+
actionTypes: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1319
|
+
id: z.ZodString;
|
|
1320
|
+
label: z.ZodOptional<z.ZodString>;
|
|
1321
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1322
|
+
ownerSystemId: z.ZodOptional<z.ZodString>;
|
|
1323
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1324
|
+
actsOn: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
|
|
1325
|
+
input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1326
|
+
effects: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
1327
|
+
}, z.core.$loose>>>>;
|
|
1328
|
+
catalogTypes: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1329
|
+
id: z.ZodString;
|
|
1330
|
+
label: z.ZodOptional<z.ZodString>;
|
|
1331
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1332
|
+
ownerSystemId: z.ZodOptional<z.ZodString>;
|
|
1333
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1334
|
+
kind: z.ZodOptional<z.ZodString>;
|
|
1335
|
+
appliesTo: z.ZodOptional<z.ZodString>;
|
|
1336
|
+
entries: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1337
|
+
}, z.core.$loose>>>>;
|
|
1338
|
+
eventTypes: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1339
|
+
id: z.ZodString;
|
|
1340
|
+
label: z.ZodOptional<z.ZodString>;
|
|
1341
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1342
|
+
ownerSystemId: z.ZodOptional<z.ZodString>;
|
|
1343
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1344
|
+
payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1345
|
+
}, z.core.$loose>>>>;
|
|
1346
|
+
interfaceTypes: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1347
|
+
id: z.ZodString;
|
|
1348
|
+
label: z.ZodOptional<z.ZodString>;
|
|
1349
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1350
|
+
ownerSystemId: z.ZodOptional<z.ZodString>;
|
|
1351
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1352
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1353
|
+
}, z.core.$loose>>>>;
|
|
1354
|
+
valueTypes: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1355
|
+
id: z.ZodString;
|
|
1356
|
+
label: z.ZodOptional<z.ZodString>;
|
|
1357
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1358
|
+
ownerSystemId: z.ZodOptional<z.ZodString>;
|
|
1359
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1360
|
+
primitive: z.ZodOptional<z.ZodString>;
|
|
1361
|
+
}, z.core.$loose>>>>;
|
|
1362
|
+
sharedProperties: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1363
|
+
id: z.ZodString;
|
|
1364
|
+
label: z.ZodOptional<z.ZodString>;
|
|
1365
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1366
|
+
ownerSystemId: z.ZodOptional<z.ZodString>;
|
|
1367
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1368
|
+
valueType: z.ZodOptional<z.ZodString>;
|
|
1369
|
+
searchable: z.ZodOptional<z.ZodBoolean>;
|
|
1370
|
+
pii: z.ZodOptional<z.ZodBoolean>;
|
|
1371
|
+
}, z.core.$loose>>>>;
|
|
1372
|
+
groups: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1373
|
+
id: z.ZodString;
|
|
1374
|
+
label: z.ZodOptional<z.ZodString>;
|
|
1375
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1376
|
+
ownerSystemId: z.ZodOptional<z.ZodString>;
|
|
1377
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1378
|
+
members: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
|
|
1379
|
+
}, z.core.$loose>>>>;
|
|
1380
|
+
surfaces: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1381
|
+
id: z.ZodString;
|
|
1382
|
+
label: z.ZodOptional<z.ZodString>;
|
|
1383
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1384
|
+
ownerSystemId: z.ZodOptional<z.ZodString>;
|
|
1385
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1386
|
+
route: z.ZodOptional<z.ZodString>;
|
|
1387
|
+
}, z.core.$loose>>>>;
|
|
1388
|
+
}, z.core.$strip>>;
|
|
1389
|
+
type OntologyScope = z.infer<typeof OntologyScopeSchema>;
|
|
1390
|
+
|
|
1391
|
+
/**
|
|
1392
|
+
* MetricsCollector
|
|
1393
|
+
* Tracks execution timing and ROI metrics
|
|
1394
|
+
*/
|
|
1395
|
+
declare class MetricsCollector {
|
|
1396
|
+
private timings;
|
|
1397
|
+
private durationMs?;
|
|
1398
|
+
/**
|
|
1399
|
+
* Start a timer with a label
|
|
1400
|
+
*/
|
|
1401
|
+
startTimer(label: string): void;
|
|
1402
|
+
/**
|
|
1403
|
+
* End a timer and calculate duration
|
|
1404
|
+
* If label is 'execution', stores duration for metrics summary
|
|
1405
|
+
*/
|
|
1406
|
+
endTimer(label: string): number | null;
|
|
1407
|
+
/**
|
|
1408
|
+
* Build execution metrics summary with optional ROI calculation
|
|
1409
|
+
*/
|
|
1410
|
+
buildExecutionMetrics(metricsConfig?: ResourceMetricsConfig): ExecutionMetricsSummary;
|
|
1411
|
+
}
|
|
1412
|
+
|
|
1413
|
+
interface BaseAICall {
|
|
1414
|
+
callSequence: number;
|
|
1415
|
+
callType: 'agent-reasoning' | 'agent-completion' | 'workflow-step' | 'tool' | 'other';
|
|
1416
|
+
model: LLMModel;
|
|
1417
|
+
inputTokens: number;
|
|
1418
|
+
outputTokens: number;
|
|
1419
|
+
costUsd: number;
|
|
1420
|
+
latencyMs: number;
|
|
1421
|
+
context?: AICallContext;
|
|
1422
|
+
}
|
|
1423
|
+
type AICallContext = AgentReasoningContext | AgentCompletionContext | WorkflowStepContext | ToolCallContext | OtherCallContext;
|
|
1424
|
+
interface AgentReasoningContext {
|
|
1425
|
+
type: 'agent-reasoning';
|
|
1426
|
+
iteration: number;
|
|
1427
|
+
actionsPlanned?: string[];
|
|
1428
|
+
sessionId?: string;
|
|
1429
|
+
turnNumber?: number;
|
|
1430
|
+
}
|
|
1431
|
+
interface AgentCompletionContext {
|
|
1432
|
+
type: 'agent-completion';
|
|
1433
|
+
attempt: 1 | 2;
|
|
1434
|
+
validationFailed?: boolean;
|
|
1435
|
+
sessionId?: string;
|
|
1436
|
+
turnNumber?: number;
|
|
1437
|
+
}
|
|
1438
|
+
interface WorkflowStepContext {
|
|
1439
|
+
type: 'workflow-step';
|
|
1440
|
+
stepId: string;
|
|
1441
|
+
stepName?: string;
|
|
1442
|
+
stepSequence?: number;
|
|
1443
|
+
}
|
|
1444
|
+
interface ToolCallContext {
|
|
1445
|
+
type: 'tool';
|
|
1446
|
+
toolName: string;
|
|
1447
|
+
parentIteration?: number;
|
|
1448
|
+
parentStepId?: string;
|
|
1449
|
+
}
|
|
1450
|
+
interface OtherCallContext {
|
|
1451
|
+
type: 'other';
|
|
1452
|
+
description?: string;
|
|
1453
|
+
metadata?: Record<string, unknown>;
|
|
1454
|
+
}
|
|
1455
|
+
type AICallRecord = BaseAICall;
|
|
1456
|
+
/**
|
|
1457
|
+
* Raw LLM usage data returned by adapters
|
|
1458
|
+
* Used as input to AIUsageCollector.record()
|
|
1459
|
+
*/
|
|
1460
|
+
interface LLMUsageData {
|
|
1461
|
+
model: LLMModel;
|
|
1462
|
+
inputTokens: number;
|
|
1463
|
+
outputTokens: number;
|
|
1464
|
+
latencyMs: number;
|
|
1465
|
+
/** Actual cost from provider in USD (when available, e.g., OpenRouter) */
|
|
1466
|
+
cost?: number;
|
|
1467
|
+
}
|
|
1468
|
+
interface AIUsageSummary {
|
|
1469
|
+
model: LLMModel;
|
|
1470
|
+
totalInputTokens: number;
|
|
1471
|
+
totalOutputTokens: number;
|
|
1472
|
+
totalTokens: number;
|
|
1473
|
+
totalCostUsd: number;
|
|
1474
|
+
callCount: number;
|
|
1475
|
+
calls: AICallRecord[];
|
|
1476
|
+
}
|
|
1477
|
+
interface ExecutionMetricsSummary {
|
|
1478
|
+
durationMs?: number;
|
|
1479
|
+
automationSavingsUsd?: number;
|
|
1480
|
+
}
|
|
1481
|
+
interface ResourceMetricsConfig {
|
|
1482
|
+
estimatedManualMinutes: number;
|
|
1483
|
+
hourlyLaborRateUsd: number;
|
|
1484
|
+
confidenceLevel?: 'low' | 'medium' | 'high';
|
|
1485
|
+
notes?: string;
|
|
1486
|
+
}
|
|
1487
|
+
|
|
1488
|
+
/**
|
|
1489
|
+
* AIUsageCollector
|
|
1490
|
+
* Centralized token tracking that aggregates usage across all LLM calls in an execution
|
|
1491
|
+
*/
|
|
1492
|
+
declare class AIUsageCollector {
|
|
1493
|
+
private model;
|
|
1494
|
+
private calls;
|
|
1495
|
+
private callSequence;
|
|
1496
|
+
/**
|
|
1497
|
+
* Record a single AI call with usage metrics
|
|
1498
|
+
*
|
|
1499
|
+
* @param usage - Token usage and latency data from LLM adapter
|
|
1500
|
+
* @param callType - Type discriminator (agent-reasoning, tool, etc.)
|
|
1501
|
+
* @param context - Optional typed context specific to callType
|
|
1502
|
+
*/
|
|
1503
|
+
record(usage: LLMUsageData, callType?: BaseAICall['callType'], context?: AICallContext): void;
|
|
1504
|
+
/**
|
|
1505
|
+
* Get aggregated summary of all AI calls
|
|
1506
|
+
*/
|
|
1507
|
+
getSummary(): AIUsageSummary;
|
|
1508
|
+
/**
|
|
1509
|
+
* Check if any usage has been recorded
|
|
1510
|
+
*/
|
|
1511
|
+
hasUsage(): boolean;
|
|
1512
|
+
}
|
|
1513
|
+
|
|
1514
|
+
/**
|
|
1515
|
+
* Base Execution Engine type definitions
|
|
1516
|
+
* Core types shared across all Execution Engine resources
|
|
1517
|
+
*/
|
|
1518
|
+
|
|
1519
|
+
/**
|
|
1520
|
+
* Immutable execution metadata
|
|
1521
|
+
* Represents complete execution identity (who, what, when, where)
|
|
1522
|
+
* Shared across ExecutionContext and ExecutionLoggerContext to eliminate field duplication
|
|
1523
|
+
*/
|
|
1524
|
+
interface ExecutionMetadata {
|
|
1525
|
+
executionId: string;
|
|
1526
|
+
organizationId: string;
|
|
1527
|
+
organizationName: string;
|
|
1528
|
+
resourceId: string;
|
|
1529
|
+
userId?: string;
|
|
1530
|
+
sessionId?: string;
|
|
1531
|
+
sessionTurnNumber?: number;
|
|
1532
|
+
}
|
|
1533
|
+
/**
|
|
1534
|
+
* Unified message event type - covers all message types in sessions
|
|
1535
|
+
* Replaces separate SessionTurnMessages and AgentActivityEvent mechanisms
|
|
1536
|
+
*/
|
|
1537
|
+
/**
|
|
1538
|
+
* Structured action metadata attached to assistant messages.
|
|
1539
|
+
* Frontend reads this instead of parsing text prefixes.
|
|
1540
|
+
*/
|
|
1541
|
+
type AssistantAction = {
|
|
1542
|
+
kind: 'navigate';
|
|
1543
|
+
path: string;
|
|
1544
|
+
reason: string;
|
|
1545
|
+
} | {
|
|
1546
|
+
kind: 'update_filters';
|
|
1547
|
+
timeRange: string | null;
|
|
1548
|
+
statusFilter: string | null;
|
|
1549
|
+
searchQuery: string | null;
|
|
1550
|
+
};
|
|
1551
|
+
type MessageEvent = {
|
|
1552
|
+
type: 'user_message';
|
|
1553
|
+
text: string;
|
|
1554
|
+
} | {
|
|
1555
|
+
type: 'assistant_message';
|
|
1556
|
+
text: string;
|
|
1557
|
+
_action?: AssistantAction;
|
|
1558
|
+
} | {
|
|
1559
|
+
type: 'agent:started';
|
|
1560
|
+
} | {
|
|
1561
|
+
type: 'agent:completed';
|
|
1562
|
+
} | {
|
|
1563
|
+
type: 'agent:error';
|
|
1564
|
+
error: string;
|
|
1565
|
+
} | {
|
|
1566
|
+
type: 'agent:reasoning';
|
|
1567
|
+
iteration: number;
|
|
1568
|
+
reasoning: string;
|
|
1569
|
+
} | {
|
|
1570
|
+
type: 'agent:tool_call';
|
|
1571
|
+
toolName: string;
|
|
1572
|
+
args: Record<string, unknown>;
|
|
1573
|
+
} | {
|
|
1574
|
+
type: 'agent:tool_result';
|
|
1575
|
+
toolName: string;
|
|
1576
|
+
success: boolean;
|
|
1577
|
+
result?: unknown;
|
|
1578
|
+
error?: string;
|
|
1579
|
+
};
|
|
1580
|
+
/**
|
|
1581
|
+
* Execution context for all resources
|
|
1582
|
+
* Unified callback replaces SessionTurnMessages (removed)
|
|
1583
|
+
*/
|
|
1584
|
+
interface ExecutionContext extends ExecutionMetadata {
|
|
1585
|
+
logger: IExecutionLogger;
|
|
1586
|
+
signal?: AbortSignal;
|
|
1587
|
+
onMessageEvent?: (event: MessageEvent) => Promise<void>;
|
|
1588
|
+
/** Called per iteration to write heartbeat + check stall status. Non-fatal if it throws. */
|
|
1589
|
+
onHeartbeat?: () => Promise<void>;
|
|
1590
|
+
aiUsageCollector?: AIUsageCollector;
|
|
1591
|
+
metricsCollector?: MetricsCollector;
|
|
1592
|
+
parentExecutionId?: string;
|
|
1593
|
+
executionDepth: number;
|
|
1594
|
+
credentialName?: string;
|
|
1595
|
+
store: Map<string, unknown>;
|
|
1596
|
+
}
|
|
1597
|
+
interface Contract {
|
|
1598
|
+
inputSchema: z.ZodSchema;
|
|
1599
|
+
outputSchema?: z.ZodSchema;
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1602
|
+
/**
|
|
1603
|
+
* Tool definitions
|
|
1604
|
+
*
|
|
1605
|
+
* Tool interface used by agents and workflows.
|
|
1606
|
+
* Provides a universal interface for AI systems to interact with tools.
|
|
1607
|
+
*/
|
|
1608
|
+
|
|
1609
|
+
/**
|
|
1610
|
+
* Options for tool execution
|
|
1611
|
+
* Provides named parameters for better API clarity and extensibility
|
|
1612
|
+
*/
|
|
1613
|
+
interface ToolExecutionOptions {
|
|
1614
|
+
/** Tool input (validated against inputSchema before execution) */
|
|
1615
|
+
input: unknown;
|
|
1616
|
+
/** Execution context with multi-tenant isolation and observability (optional for simple tools, required for platform/integration tools) */
|
|
1617
|
+
executionContext?: ExecutionContext;
|
|
1618
|
+
/** Full iteration context for advanced tools (provides access to memoryManager, toolRegistry, logger, etc.) */
|
|
1619
|
+
iterationContext?: IterationContext;
|
|
1620
|
+
/** Abort signal for timeout/cancellation -- forward to fetch() calls for clean cancellation */
|
|
1621
|
+
signal?: AbortSignal;
|
|
1622
|
+
}
|
|
1623
|
+
/**
|
|
1624
|
+
* Tool interface for AI systems
|
|
1625
|
+
*
|
|
1626
|
+
* Used by:
|
|
1627
|
+
* - Agents: For agentic tool use (reasoning loop selects and executes tools)
|
|
1628
|
+
* - Workflows: For workflow step tool invocation (future)
|
|
1629
|
+
* - Platform tools: createApprovalTool(), createSchedulerTool()
|
|
1630
|
+
* - Integration tools: External API calls (Gmail, Slack, etc.)
|
|
1631
|
+
*/
|
|
1632
|
+
interface Tool {
|
|
1633
|
+
name: string;
|
|
1634
|
+
description: string;
|
|
1635
|
+
inputSchema: z.ZodSchema;
|
|
1636
|
+
outputSchema: z.ZodSchema;
|
|
1637
|
+
execute: (options: ToolExecutionOptions) => Promise<unknown>;
|
|
1638
|
+
timeout?: number;
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
/**
|
|
1642
|
+
* Supported integration types
|
|
1643
|
+
*
|
|
1644
|
+
* These represent the available integration adapters that can be used with tools.
|
|
1645
|
+
* Each integration type corresponds to an adapter implementation.
|
|
1646
|
+
*
|
|
1647
|
+
* Note: Concrete adapter implementations are deferred until needed.
|
|
1648
|
+
* This type provides compile-time safety and auto-completion for tool definitions.
|
|
1649
|
+
*/
|
|
1650
|
+
type IntegrationType = 'gmail' | 'google-sheets' | 'slack' | 'github' | 'linear' | 'attio' | 'airtable' | 'salesforce' | 'hubspot' | 'stripe' | 'twilio' | 'sendgrid' | 'mailgun' | 'zapier' | 'webhook' | 'apify' | 'instantly' | 'resend' | 'signature-api' | 'dropbox' | 'anymailfinder' | 'tomba' | 'millionverifier';
|
|
1651
|
+
|
|
1652
|
+
type JsonPrimitive = string | number | boolean | null;
|
|
1653
|
+
type JsonValue = JsonPrimitive | JsonValue[] | {
|
|
1654
|
+
[key: string]: JsonValue;
|
|
1655
|
+
};
|
|
1656
|
+
/** Explicit interface needed to annotate the recursive SystemEntrySchema. */
|
|
1657
|
+
interface SystemEntry {
|
|
1658
|
+
id: string;
|
|
1659
|
+
label?: string;
|
|
1660
|
+
title?: string;
|
|
1661
|
+
description?: string;
|
|
1662
|
+
kind?: 'product' | 'operational' | 'platform' | 'diagnostic';
|
|
1663
|
+
parentSystemId?: string;
|
|
1664
|
+
ui?: {
|
|
1665
|
+
path: string;
|
|
1666
|
+
surfaces: string[];
|
|
1667
|
+
icon?: string;
|
|
1668
|
+
order?: number;
|
|
1669
|
+
};
|
|
1670
|
+
lifecycle?: 'draft' | 'beta' | 'active' | 'deprecated' | 'archived';
|
|
1671
|
+
responsibleRoleId?: string;
|
|
1672
|
+
governedByKnowledge?: string[];
|
|
1673
|
+
actions?: {
|
|
1674
|
+
actionId: string;
|
|
1675
|
+
intent: 'exposes' | 'consumes';
|
|
1676
|
+
invocation?: unknown;
|
|
1677
|
+
}[];
|
|
1678
|
+
policies?: string[];
|
|
1679
|
+
drivesGoals?: string[];
|
|
1680
|
+
/** @deprecated Use lifecycle. Accepted for one publish cycle. */
|
|
1681
|
+
status?: 'active' | 'deprecated' | 'archived';
|
|
1682
|
+
path?: string;
|
|
1683
|
+
icon?: string;
|
|
1684
|
+
color?: string;
|
|
1685
|
+
uiPosition?: 'sidebar-primary' | 'sidebar-bottom';
|
|
1686
|
+
enabled?: boolean;
|
|
1687
|
+
devOnly?: boolean;
|
|
1688
|
+
requiresAdmin?: boolean;
|
|
1689
|
+
order: number;
|
|
1690
|
+
config?: Record<string, JsonValue>;
|
|
1691
|
+
ontology?: OntologyScope;
|
|
1692
|
+
systems?: Record<string, SystemEntry>;
|
|
1693
|
+
subsystems?: Record<string, SystemEntry>;
|
|
1694
|
+
}
|
|
1695
|
+
|
|
1696
|
+
/**
|
|
1697
|
+
* Resource Registry type definitions
|
|
1698
|
+
*/
|
|
1699
|
+
|
|
1700
|
+
/**
|
|
1701
|
+
* Environment/deployment status for resources
|
|
1702
|
+
*/
|
|
1703
|
+
type ResourceStatus = 'dev' | 'prod';
|
|
1704
|
+
/**
|
|
1705
|
+
* All resource types in the platform
|
|
1706
|
+
* Used as the discriminator field in ResourceDefinition
|
|
1707
|
+
*/
|
|
1708
|
+
type ResourceType = 'agent' | 'workflow' | 'trigger' | 'integration' | 'external' | 'human';
|
|
1709
|
+
type ResourceSystemSummary = Pick<SystemEntry, 'id' | 'title' | 'description' | 'kind' | 'lifecycle'>;
|
|
1710
|
+
/**
|
|
1711
|
+
* Base interface for ALL platform resources
|
|
1712
|
+
* Shared by both executable (agents, workflows) and non-executable (triggers, integrations, etc.) resources
|
|
1713
|
+
*/
|
|
1714
|
+
interface ResourceDefinition {
|
|
1715
|
+
/** Unique resource identifier */
|
|
1716
|
+
resourceId: string;
|
|
1717
|
+
/** Display name */
|
|
1718
|
+
name: string;
|
|
1719
|
+
/** Purpose and functionality description */
|
|
1720
|
+
description: string;
|
|
1721
|
+
/** Version for change tracking and evolution */
|
|
1722
|
+
version: string;
|
|
1723
|
+
/** Resource type discriminator */
|
|
1724
|
+
type: ResourceType;
|
|
1725
|
+
/** Environment/deployment status */
|
|
1726
|
+
status: ResourceStatus;
|
|
1727
|
+
/** Graph links to Organization Model nodes */
|
|
1728
|
+
links?: ResourceLink[];
|
|
1729
|
+
/** Infrastructure category for filtering */
|
|
1730
|
+
category?: ResourceCategory;
|
|
1731
|
+
/** Whether the agent supports multi-turn sessions (agents only) */
|
|
1732
|
+
sessionCapable?: boolean;
|
|
1733
|
+
/** Whether the resource is local (monorepo) or remote (externally deployed) */
|
|
1734
|
+
origin?: 'local' | 'remote';
|
|
1735
|
+
/** OM System membership — dot-separated system path (e.g. "sys.lead-gen"), when backed by a Resource descriptor */
|
|
1736
|
+
systemPath?: string;
|
|
1737
|
+
/** Display metadata for the owning OM System */
|
|
1738
|
+
system?: ResourceSystemSummary;
|
|
1739
|
+
/** Governance lifecycle status from the OM Resource descriptor */
|
|
1740
|
+
governanceStatus?: ResourceGovernanceStatus;
|
|
1741
|
+
/** Whether this resource is archived and should be excluded from registration and deployment */
|
|
1742
|
+
archived?: boolean;
|
|
1743
|
+
}
|
|
1744
|
+
/** Webhook provider identifiers */
|
|
1745
|
+
type WebhookProviderType = 'cal-com' | 'stripe' | 'signature-api' | 'instantly' | 'apify' | 'test';
|
|
1746
|
+
/** Webhook trigger configuration */
|
|
1747
|
+
interface WebhookTriggerConfig {
|
|
1748
|
+
/** Provider identifier */
|
|
1749
|
+
provider: WebhookProviderType;
|
|
1750
|
+
/** Event type for documentation (not used for matching - workflow handles routing) */
|
|
1751
|
+
event?: string;
|
|
1752
|
+
/** Optional filtering (e.g., specific form ID for Fillout) */
|
|
1753
|
+
filter?: Record<string, string>;
|
|
1754
|
+
/** References credential in credentials table for per-org webhook secrets */
|
|
1755
|
+
credentialName?: string;
|
|
1756
|
+
}
|
|
1757
|
+
/** Schedule trigger configuration */
|
|
1758
|
+
interface ScheduleTriggerConfig {
|
|
1759
|
+
/** Cron expression (e.g., '0 6 * * *') */
|
|
1760
|
+
cron: string;
|
|
1761
|
+
/** Optional timezone (default: UTC) */
|
|
1762
|
+
timezone?: string;
|
|
1763
|
+
}
|
|
1764
|
+
/** Event trigger configuration */
|
|
1765
|
+
interface EventTriggerConfig {
|
|
1766
|
+
/** Internal event type */
|
|
1767
|
+
eventType: string;
|
|
1768
|
+
/** Event source */
|
|
1769
|
+
source?: string;
|
|
1770
|
+
}
|
|
1771
|
+
/** Union of all trigger configs */
|
|
1772
|
+
type TriggerConfig = WebhookTriggerConfig | ScheduleTriggerConfig | EventTriggerConfig;
|
|
1773
|
+
/**
|
|
1774
|
+
* Trigger metadata - entry points that initiate resource execution
|
|
1775
|
+
*
|
|
1776
|
+
* Triggers represent how executions start: webhooks from external services,
|
|
1777
|
+
* scheduled cron jobs, platform events, or manual user actions.
|
|
1778
|
+
*
|
|
1779
|
+
* BREAKING CHANGES (2025-11-30):
|
|
1780
|
+
* - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
|
|
1781
|
+
* - Field renames: `id` -> `resourceId` (inherited), `type` -> `triggerType`
|
|
1782
|
+
* - Relationship rename: `invokes` -> `triggers` (unified vocabulary)
|
|
1783
|
+
* - New required fields: `version` (inherited), `type: 'trigger'` (inherited)
|
|
1784
|
+
* - triggers object now includes `externalResources` option
|
|
1785
|
+
*
|
|
1786
|
+
* @example
|
|
1787
|
+
* // TriggerDefinition - metadata only
|
|
1788
|
+
* {
|
|
1789
|
+
* resourceId: 'trigger-new-order',
|
|
1790
|
+
* type: 'trigger',
|
|
1791
|
+
* triggerType: 'webhook',
|
|
1792
|
+
* name: 'New Order',
|
|
1793
|
+
* description: 'Webhook from Shopify on new orders',
|
|
1794
|
+
* version: '1.0.0',
|
|
1795
|
+
* status: 'prod',
|
|
1796
|
+
* webhookPath: '/webhooks/shopify/orders'
|
|
1797
|
+
* }
|
|
1798
|
+
*
|
|
1799
|
+
* // Relationships declared in ResourceRelationships (not on TriggerDefinition):
|
|
1800
|
+
* // relationships: {
|
|
1801
|
+
* // 'trigger-new-order': { triggers: { workflows: ['order-fulfillment-workflow'] } }
|
|
1802
|
+
* // }
|
|
1803
|
+
*/
|
|
1804
|
+
interface TriggerDefinition extends ResourceDefinition {
|
|
1805
|
+
/** Resource type discriminator (narrowed from base union) */
|
|
1806
|
+
type: 'trigger';
|
|
1807
|
+
/** Trigger mechanism type (renamed from 'type' to avoid collision with base type discriminator) */
|
|
1808
|
+
triggerType: 'webhook' | 'schedule' | 'manual' | 'event';
|
|
1809
|
+
/** Type-specific configuration */
|
|
1810
|
+
config?: TriggerConfig;
|
|
1811
|
+
/** For webhook triggers: path like '/webhooks/shopify/orders' */
|
|
1812
|
+
webhookPath?: string;
|
|
1813
|
+
/** For schedule triggers: cron expression like '0 6 * * *' */
|
|
1814
|
+
schedule?: string;
|
|
1815
|
+
/** For event triggers: event type like 'low-stock-alert' */
|
|
1816
|
+
eventType?: string;
|
|
1817
|
+
}
|
|
1818
|
+
/**
|
|
1819
|
+
* Integration metadata - external service connections
|
|
1820
|
+
*
|
|
1821
|
+
* References credentials table for actual connection. No connection status
|
|
1822
|
+
* stored here (queried at runtime from credentials table).
|
|
1823
|
+
*
|
|
1824
|
+
* BREAKING CHANGES (2025-11-30):
|
|
1825
|
+
* - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
|
|
1826
|
+
* - Field renames: `id` -> `resourceId` (inherited)
|
|
1827
|
+
* - New required field: `status` (inherited) - organizations must add status to all integrations
|
|
1828
|
+
* - New required field: `version` (inherited) - organizations must add version to all integrations
|
|
1829
|
+
* - New required field: `type: 'integration'` (inherited) - resource type discriminator
|
|
1830
|
+
*
|
|
1831
|
+
* @example
|
|
1832
|
+
* {
|
|
1833
|
+
* resourceId: 'integration-shopify-prod',
|
|
1834
|
+
* type: 'integration',
|
|
1835
|
+
* provider: 'shopify',
|
|
1836
|
+
* credentialName: 'shopify-prod',
|
|
1837
|
+
* name: 'Shopify Production',
|
|
1838
|
+
* description: 'E-commerce platform',
|
|
1839
|
+
* version: '1.0.0',
|
|
1840
|
+
* status: 'prod'
|
|
1841
|
+
* }
|
|
1842
|
+
*/
|
|
1843
|
+
interface IntegrationDefinition extends ResourceDefinition {
|
|
1844
|
+
/** Resource type discriminator (narrowed from base union) */
|
|
1845
|
+
type: 'integration';
|
|
1846
|
+
/** OM descriptor that owns canonical identity and governance metadata. */
|
|
1847
|
+
resource?: Extract<ResourceEntry, {
|
|
1848
|
+
kind: 'integration';
|
|
1849
|
+
}>;
|
|
1850
|
+
/** Integration provider type */
|
|
1851
|
+
provider: IntegrationType;
|
|
1852
|
+
/** References credentials table (e.g., 'shopify-prod', 'zendesk-api') */
|
|
1853
|
+
credentialName: string;
|
|
1854
|
+
}
|
|
1855
|
+
/**
|
|
1856
|
+
* Explicit resource relationship declaration
|
|
1857
|
+
*
|
|
1858
|
+
* Single-direction only - Command View derives reverse relationships.
|
|
1859
|
+
* Agents/workflows declare what they trigger and use.
|
|
1860
|
+
*
|
|
1861
|
+
* @example
|
|
1862
|
+
* {
|
|
1863
|
+
* triggers: { workflows: ['order-fulfillment-workflow'] },
|
|
1864
|
+
* uses: { integrations: ['integration-shopify-prod', 'integration-postgres'] }
|
|
1865
|
+
* }
|
|
1866
|
+
*/
|
|
1867
|
+
interface RelationshipDeclaration {
|
|
1868
|
+
/** Resources this resource triggers */
|
|
1869
|
+
triggers?: {
|
|
1870
|
+
/** Agent resourceIds this resource triggers */
|
|
1871
|
+
agents?: string[];
|
|
1872
|
+
/** Workflow resourceIds this resource triggers */
|
|
1873
|
+
workflows?: string[];
|
|
1874
|
+
};
|
|
1875
|
+
/** Integrations this resource uses */
|
|
1876
|
+
uses?: {
|
|
1877
|
+
/** Integration IDs this resource uses */
|
|
1878
|
+
integrations?: string[];
|
|
1879
|
+
};
|
|
1880
|
+
}
|
|
1881
|
+
/**
|
|
1882
|
+
* Resource relationships map
|
|
1883
|
+
* Maps resourceId to its relationship declarations
|
|
1884
|
+
*
|
|
1885
|
+
* @example
|
|
1886
|
+
* {
|
|
1887
|
+
* 'order-processor-agent': {
|
|
1888
|
+
* triggers: { workflows: ['order-fulfillment-workflow'] },
|
|
1889
|
+
* uses: { integrations: ['integration-shopify-prod'] }
|
|
1890
|
+
* }
|
|
1891
|
+
* }
|
|
1892
|
+
*/
|
|
1893
|
+
type ResourceRelationships = Record<string, RelationshipDeclaration>;
|
|
1894
|
+
/**
|
|
1895
|
+
* External platform type
|
|
1896
|
+
* Supported third-party automation platforms
|
|
1897
|
+
*/
|
|
1898
|
+
type ExternalPlatform = 'n8n' | 'make' | 'zapier' | 'other';
|
|
1899
|
+
/**
|
|
1900
|
+
* External automation resource metadata
|
|
1901
|
+
*
|
|
1902
|
+
* Represents workflows/automations running on third-party platforms
|
|
1903
|
+
* (n8n, Make, Zapier, etc.) for visualization in Command View.
|
|
1904
|
+
*
|
|
1905
|
+
* NOTE: This is metadata ONLY for visualization. No execution logic,
|
|
1906
|
+
* no API integration with external platforms, no status syncing.
|
|
1907
|
+
*
|
|
1908
|
+
* BREAKING CHANGES (2025-11-30):
|
|
1909
|
+
* - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
|
|
1910
|
+
* - Field renames: `id` -> `resourceId` (inherited)
|
|
1911
|
+
* - New required field: `version` (inherited) - organizations must add version to all external resources
|
|
1912
|
+
* - New required field: `type: 'external'` (inherited) - resource type discriminator
|
|
1913
|
+
* - REMOVED FIELD: `triggeredBy` - per relationship-consolidation design, all relationships are forward-only declarations
|
|
1914
|
+
*
|
|
1915
|
+
* @example
|
|
1916
|
+
* {
|
|
1917
|
+
* resourceId: 'external-n8n-order-sync',
|
|
1918
|
+
* type: 'external',
|
|
1919
|
+
* version: '1.0.0',
|
|
1920
|
+
* platform: 'n8n',
|
|
1921
|
+
* name: 'Shopify Order Sync',
|
|
1922
|
+
* description: 'Legacy n8n workflow for syncing Shopify orders',
|
|
1923
|
+
* status: 'prod',
|
|
1924
|
+
* platformUrl: 'https://n8n.client.com/workflow/123',
|
|
1925
|
+
* triggers: { workflows: ['order-fulfillment-workflow'] },
|
|
1926
|
+
* uses: { integrations: ['integration-shopify-prod'] }
|
|
1927
|
+
* }
|
|
1928
|
+
*/
|
|
1929
|
+
interface ExternalResourceDefinition extends ResourceDefinition {
|
|
1930
|
+
/** Resource type discriminator (narrowed from base union) */
|
|
1931
|
+
type: 'external';
|
|
1932
|
+
/** Platform type */
|
|
1933
|
+
platform: ExternalPlatform;
|
|
1934
|
+
/** Link to external platform (e.g., n8n workflow editor URL) */
|
|
1935
|
+
platformUrl?: string;
|
|
1936
|
+
/** Platform's internal ID/reference */
|
|
1937
|
+
externalId?: string;
|
|
1938
|
+
/** What this external resource triggers (external -> internal) */
|
|
1939
|
+
triggers?: {
|
|
1940
|
+
/** Elevasis workflow resourceIds this external automation triggers */
|
|
1941
|
+
workflows?: string[];
|
|
1942
|
+
/** Elevasis agent resourceIds this external automation triggers */
|
|
1943
|
+
agents?: string[];
|
|
1944
|
+
};
|
|
1945
|
+
/** Integrations this external resource uses (shared credentials) */
|
|
1946
|
+
uses?: {
|
|
1947
|
+
/** Integration IDs this external automation uses */
|
|
1948
|
+
integrations?: string[];
|
|
1949
|
+
};
|
|
1950
|
+
}
|
|
1951
|
+
/**
|
|
1952
|
+
* Human Checkpoint definition - human decision points in automation
|
|
1953
|
+
*
|
|
1954
|
+
* Represents where human judgment is deployed in the automation landscape.
|
|
1955
|
+
* Tasks with matching command_queue_group are routed to this checkpoint.
|
|
1956
|
+
*
|
|
1957
|
+
* BREAKING CHANGES (2025-11-30):
|
|
1958
|
+
* - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
|
|
1959
|
+
* - Field renames: `id` -> `resourceId` (inherited)
|
|
1960
|
+
* - description is now REQUIRED (was optional) - organizations must add description to all human checkpoints
|
|
1961
|
+
* - New required field: `version` (inherited) - organizations must add version to all human checkpoints
|
|
1962
|
+
* - New required field: `type: 'human'` (inherited) - resource type discriminator
|
|
1963
|
+
*
|
|
1964
|
+
* @example
|
|
1965
|
+
* {
|
|
1966
|
+
* resourceId: 'sales-approval',
|
|
1967
|
+
* type: 'human',
|
|
1968
|
+
* name: 'Sales Approval Queue',
|
|
1969
|
+
* description: 'High-value order approvals for sales team',
|
|
1970
|
+
* version: '1.0.0',
|
|
1971
|
+
* status: 'prod',
|
|
1972
|
+
* requestedBy: { agents: ['order-processor-agent'] },
|
|
1973
|
+
* routesTo: { agents: ['order-fulfillment-agent'] }
|
|
1974
|
+
* }
|
|
1975
|
+
*/
|
|
1976
|
+
interface HumanCheckpointDefinition extends ResourceDefinition {
|
|
1977
|
+
/** Resource type discriminator (narrowed from base union) */
|
|
1978
|
+
type: 'human';
|
|
1979
|
+
/** Resources that create tasks for this checkpoint */
|
|
1980
|
+
requestedBy?: {
|
|
1981
|
+
/** Agent resourceIds that request approval here */
|
|
1982
|
+
agents?: string[];
|
|
1983
|
+
/** Workflow resourceIds that request approval here */
|
|
1984
|
+
workflows?: string[];
|
|
1985
|
+
};
|
|
1986
|
+
/** Resources that receive approved decisions */
|
|
1987
|
+
routesTo?: {
|
|
1988
|
+
/** Agent resourceIds that handle approved tasks */
|
|
1989
|
+
agents?: string[];
|
|
1990
|
+
/** Workflow resourceIds that handle approved tasks */
|
|
1991
|
+
workflows?: string[];
|
|
1992
|
+
};
|
|
1993
|
+
}
|
|
1994
|
+
|
|
1995
|
+
declare const SurfaceTypeSchema: z.ZodEnum<{
|
|
1996
|
+
dashboard: "dashboard";
|
|
1997
|
+
settings: "settings";
|
|
1998
|
+
graph: "graph";
|
|
1999
|
+
list: "list";
|
|
2000
|
+
page: "page";
|
|
2001
|
+
detail: "detail";
|
|
2002
|
+
}>;
|
|
2003
|
+
interface SidebarSurfaceNode {
|
|
2004
|
+
type: 'surface';
|
|
2005
|
+
label: string;
|
|
2006
|
+
path: string;
|
|
2007
|
+
surfaceType: z.infer<typeof SurfaceTypeSchema>;
|
|
2008
|
+
description?: string;
|
|
2009
|
+
icon?: string;
|
|
2010
|
+
order?: number;
|
|
2011
|
+
targets?: {
|
|
2012
|
+
systems?: string[];
|
|
2013
|
+
entities?: string[];
|
|
2014
|
+
resources?: string[];
|
|
2015
|
+
actions?: string[];
|
|
2016
|
+
};
|
|
2017
|
+
devOnly?: boolean;
|
|
2018
|
+
requiresAdmin?: boolean;
|
|
2019
|
+
}
|
|
2020
|
+
interface SidebarGroupNode {
|
|
2021
|
+
type: 'group';
|
|
2022
|
+
label: string;
|
|
2023
|
+
description?: string;
|
|
2024
|
+
icon?: string;
|
|
2025
|
+
order?: number;
|
|
2026
|
+
children: Record<string, SidebarNode>;
|
|
2027
|
+
}
|
|
2028
|
+
type SidebarNode = SidebarSurfaceNode | SidebarGroupNode;
|
|
2029
|
+
|
|
2030
|
+
declare const LinkSchema: z.ZodObject<{
|
|
2031
|
+
nodeId: z.ZodString;
|
|
2032
|
+
kind: z.ZodEnum<{
|
|
2033
|
+
links: "links";
|
|
2034
|
+
affects: "affects";
|
|
2035
|
+
effects: "effects";
|
|
2036
|
+
actions: "actions";
|
|
2037
|
+
reads: "reads";
|
|
2038
|
+
writes: "writes";
|
|
2039
|
+
emits: "emits";
|
|
2040
|
+
triggers: "triggers";
|
|
2041
|
+
uses: "uses";
|
|
2042
|
+
approval: "approval";
|
|
2043
|
+
contains: "contains";
|
|
2044
|
+
references: "references";
|
|
2045
|
+
maps_to: "maps_to";
|
|
2046
|
+
governs: "governs";
|
|
2047
|
+
originates_from: "originates_from";
|
|
2048
|
+
applies_to: "applies_to";
|
|
2049
|
+
uses_catalog: "uses_catalog";
|
|
2050
|
+
}>;
|
|
2051
|
+
}, z.core.$strip>;
|
|
2052
|
+
type Link = z.infer<typeof LinkSchema>;
|
|
2053
|
+
|
|
2054
|
+
declare const OrganizationModelSchema$1: z.ZodObject<{
|
|
2055
|
+
version: z.ZodDefault<z.ZodLiteral<1>>;
|
|
2056
|
+
domainMetadata: z.ZodPipe<z.ZodDefault<z.ZodObject<{
|
|
2057
|
+
branding: z.ZodOptional<z.ZodObject<{
|
|
2058
|
+
version: z.ZodDefault<z.ZodLiteral<1>>;
|
|
2059
|
+
lastModified: z.ZodString;
|
|
2060
|
+
}, z.core.$strip>>;
|
|
2061
|
+
identity: z.ZodOptional<z.ZodObject<{
|
|
2062
|
+
version: z.ZodDefault<z.ZodLiteral<1>>;
|
|
2063
|
+
lastModified: z.ZodString;
|
|
2064
|
+
}, z.core.$strip>>;
|
|
2065
|
+
customers: z.ZodOptional<z.ZodObject<{
|
|
2066
|
+
version: z.ZodDefault<z.ZodLiteral<1>>;
|
|
2067
|
+
lastModified: z.ZodString;
|
|
2068
|
+
}, z.core.$strip>>;
|
|
2069
|
+
offerings: z.ZodOptional<z.ZodObject<{
|
|
2070
|
+
version: z.ZodDefault<z.ZodLiteral<1>>;
|
|
2071
|
+
lastModified: z.ZodString;
|
|
2072
|
+
}, z.core.$strip>>;
|
|
2073
|
+
roles: z.ZodOptional<z.ZodObject<{
|
|
2074
|
+
version: z.ZodDefault<z.ZodLiteral<1>>;
|
|
2075
|
+
lastModified: z.ZodString;
|
|
2076
|
+
}, z.core.$strip>>;
|
|
2077
|
+
goals: z.ZodOptional<z.ZodObject<{
|
|
2078
|
+
version: z.ZodDefault<z.ZodLiteral<1>>;
|
|
2079
|
+
lastModified: z.ZodString;
|
|
2080
|
+
}, z.core.$strip>>;
|
|
2081
|
+
systems: z.ZodOptional<z.ZodObject<{
|
|
2082
|
+
version: z.ZodDefault<z.ZodLiteral<1>>;
|
|
2083
|
+
lastModified: z.ZodString;
|
|
2084
|
+
}, z.core.$strip>>;
|
|
2085
|
+
ontology: z.ZodOptional<z.ZodObject<{
|
|
2086
|
+
version: z.ZodDefault<z.ZodLiteral<1>>;
|
|
2087
|
+
lastModified: z.ZodString;
|
|
2088
|
+
}, z.core.$strip>>;
|
|
2089
|
+
resources: z.ZodOptional<z.ZodObject<{
|
|
2090
|
+
version: z.ZodDefault<z.ZodLiteral<1>>;
|
|
2091
|
+
lastModified: z.ZodString;
|
|
2092
|
+
}, z.core.$strip>>;
|
|
2093
|
+
topology: z.ZodOptional<z.ZodObject<{
|
|
2094
|
+
version: z.ZodDefault<z.ZodLiteral<1>>;
|
|
2095
|
+
lastModified: z.ZodString;
|
|
2096
|
+
}, z.core.$strip>>;
|
|
2097
|
+
actions: z.ZodOptional<z.ZodObject<{
|
|
2098
|
+
version: z.ZodDefault<z.ZodLiteral<1>>;
|
|
2099
|
+
lastModified: z.ZodString;
|
|
2100
|
+
}, z.core.$strip>>;
|
|
2101
|
+
entities: z.ZodOptional<z.ZodObject<{
|
|
2102
|
+
version: z.ZodDefault<z.ZodLiteral<1>>;
|
|
2103
|
+
lastModified: z.ZodString;
|
|
2104
|
+
}, z.core.$strip>>;
|
|
2105
|
+
policies: z.ZodOptional<z.ZodObject<{
|
|
2106
|
+
version: z.ZodDefault<z.ZodLiteral<1>>;
|
|
2107
|
+
lastModified: z.ZodString;
|
|
2108
|
+
}, z.core.$strip>>;
|
|
2109
|
+
knowledge: z.ZodOptional<z.ZodObject<{
|
|
2110
|
+
version: z.ZodDefault<z.ZodLiteral<1>>;
|
|
2111
|
+
lastModified: z.ZodString;
|
|
2112
|
+
}, z.core.$strip>>;
|
|
2113
|
+
}, z.core.$strip>>, z.ZodTransform<{
|
|
2114
|
+
branding: {
|
|
2115
|
+
version: 1;
|
|
2116
|
+
lastModified: string;
|
|
2117
|
+
};
|
|
2118
|
+
identity: {
|
|
2119
|
+
version: 1;
|
|
2120
|
+
lastModified: string;
|
|
2121
|
+
};
|
|
2122
|
+
customers: {
|
|
2123
|
+
version: 1;
|
|
2124
|
+
lastModified: string;
|
|
2125
|
+
};
|
|
2126
|
+
offerings: {
|
|
2127
|
+
version: 1;
|
|
2128
|
+
lastModified: string;
|
|
2129
|
+
};
|
|
2130
|
+
roles: {
|
|
2131
|
+
version: 1;
|
|
2132
|
+
lastModified: string;
|
|
2133
|
+
};
|
|
2134
|
+
goals: {
|
|
2135
|
+
version: 1;
|
|
2136
|
+
lastModified: string;
|
|
2137
|
+
};
|
|
2138
|
+
systems: {
|
|
2139
|
+
version: 1;
|
|
2140
|
+
lastModified: string;
|
|
2141
|
+
};
|
|
2142
|
+
ontology: {
|
|
2143
|
+
version: 1;
|
|
2144
|
+
lastModified: string;
|
|
2145
|
+
};
|
|
2146
|
+
resources: {
|
|
2147
|
+
version: 1;
|
|
2148
|
+
lastModified: string;
|
|
2149
|
+
};
|
|
2150
|
+
topology: {
|
|
2151
|
+
version: 1;
|
|
2152
|
+
lastModified: string;
|
|
2153
|
+
};
|
|
2154
|
+
actions: {
|
|
2155
|
+
version: 1;
|
|
2156
|
+
lastModified: string;
|
|
2157
|
+
};
|
|
2158
|
+
entities: {
|
|
2159
|
+
version: 1;
|
|
2160
|
+
lastModified: string;
|
|
2161
|
+
};
|
|
2162
|
+
policies: {
|
|
2163
|
+
version: 1;
|
|
2164
|
+
lastModified: string;
|
|
2165
|
+
};
|
|
2166
|
+
knowledge: {
|
|
2167
|
+
version: 1;
|
|
2168
|
+
lastModified: string;
|
|
2169
|
+
};
|
|
2170
|
+
}, {
|
|
2171
|
+
branding?: {
|
|
2172
|
+
version: 1;
|
|
2173
|
+
lastModified: string;
|
|
2174
|
+
} | undefined;
|
|
2175
|
+
identity?: {
|
|
2176
|
+
version: 1;
|
|
2177
|
+
lastModified: string;
|
|
2178
|
+
} | undefined;
|
|
2179
|
+
customers?: {
|
|
2180
|
+
version: 1;
|
|
2181
|
+
lastModified: string;
|
|
2182
|
+
} | undefined;
|
|
2183
|
+
offerings?: {
|
|
2184
|
+
version: 1;
|
|
2185
|
+
lastModified: string;
|
|
2186
|
+
} | undefined;
|
|
2187
|
+
roles?: {
|
|
2188
|
+
version: 1;
|
|
2189
|
+
lastModified: string;
|
|
2190
|
+
} | undefined;
|
|
2191
|
+
goals?: {
|
|
2192
|
+
version: 1;
|
|
2193
|
+
lastModified: string;
|
|
2194
|
+
} | undefined;
|
|
2195
|
+
systems?: {
|
|
2196
|
+
version: 1;
|
|
2197
|
+
lastModified: string;
|
|
2198
|
+
} | undefined;
|
|
2199
|
+
ontology?: {
|
|
2200
|
+
version: 1;
|
|
2201
|
+
lastModified: string;
|
|
2202
|
+
} | undefined;
|
|
2203
|
+
resources?: {
|
|
2204
|
+
version: 1;
|
|
2205
|
+
lastModified: string;
|
|
2206
|
+
} | undefined;
|
|
2207
|
+
topology?: {
|
|
2208
|
+
version: 1;
|
|
2209
|
+
lastModified: string;
|
|
2210
|
+
} | undefined;
|
|
2211
|
+
actions?: {
|
|
2212
|
+
version: 1;
|
|
2213
|
+
lastModified: string;
|
|
2214
|
+
} | undefined;
|
|
2215
|
+
entities?: {
|
|
2216
|
+
version: 1;
|
|
2217
|
+
lastModified: string;
|
|
2218
|
+
} | undefined;
|
|
2219
|
+
policies?: {
|
|
2220
|
+
version: 1;
|
|
2221
|
+
lastModified: string;
|
|
2222
|
+
} | undefined;
|
|
2223
|
+
knowledge?: {
|
|
2224
|
+
version: 1;
|
|
2225
|
+
lastModified: string;
|
|
2226
|
+
} | undefined;
|
|
2227
|
+
}>>;
|
|
2228
|
+
branding: z.ZodObject<{
|
|
2229
|
+
organizationName: z.ZodString;
|
|
2230
|
+
productName: z.ZodString;
|
|
2231
|
+
shortName: z.ZodString;
|
|
2232
|
+
description: z.ZodOptional<z.ZodString>;
|
|
2233
|
+
logos: z.ZodDefault<z.ZodObject<{
|
|
2234
|
+
light: z.ZodOptional<z.ZodString>;
|
|
2235
|
+
dark: z.ZodOptional<z.ZodString>;
|
|
2236
|
+
}, z.core.$strip>>;
|
|
2237
|
+
}, z.core.$strip>;
|
|
2238
|
+
navigation: z.ZodDefault<z.ZodObject<{
|
|
2239
|
+
sidebar: z.ZodDefault<z.ZodObject<{
|
|
2240
|
+
primary: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodType<SidebarNode, unknown, z.core.$ZodTypeInternals<SidebarNode, unknown>>>>;
|
|
2241
|
+
bottom: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodType<SidebarNode, unknown, z.core.$ZodTypeInternals<SidebarNode, unknown>>>>;
|
|
2242
|
+
}, z.core.$strip>>;
|
|
2243
|
+
}, z.core.$strip>>;
|
|
2244
|
+
identity: z.ZodDefault<z.ZodObject<{
|
|
2245
|
+
mission: z.ZodDefault<z.ZodString>;
|
|
2246
|
+
vision: z.ZodDefault<z.ZodString>;
|
|
2247
|
+
legalName: z.ZodDefault<z.ZodString>;
|
|
2248
|
+
entityType: z.ZodDefault<z.ZodString>;
|
|
2249
|
+
jurisdiction: z.ZodDefault<z.ZodString>;
|
|
2250
|
+
industryCategory: z.ZodDefault<z.ZodString>;
|
|
2251
|
+
geographicFocus: z.ZodDefault<z.ZodString>;
|
|
2252
|
+
timeZone: z.ZodDefault<z.ZodString>;
|
|
2253
|
+
businessHours: z.ZodDefault<z.ZodObject<{
|
|
2254
|
+
monday: z.ZodOptional<z.ZodObject<{
|
|
2255
|
+
open: z.ZodString;
|
|
2256
|
+
close: z.ZodString;
|
|
2257
|
+
}, z.core.$strip>>;
|
|
2258
|
+
tuesday: z.ZodOptional<z.ZodObject<{
|
|
2259
|
+
open: z.ZodString;
|
|
2260
|
+
close: z.ZodString;
|
|
2261
|
+
}, z.core.$strip>>;
|
|
2262
|
+
wednesday: z.ZodOptional<z.ZodObject<{
|
|
2263
|
+
open: z.ZodString;
|
|
2264
|
+
close: z.ZodString;
|
|
2265
|
+
}, z.core.$strip>>;
|
|
2266
|
+
thursday: z.ZodOptional<z.ZodObject<{
|
|
2267
|
+
open: z.ZodString;
|
|
2268
|
+
close: z.ZodString;
|
|
2269
|
+
}, z.core.$strip>>;
|
|
2270
|
+
friday: z.ZodOptional<z.ZodObject<{
|
|
2271
|
+
open: z.ZodString;
|
|
2272
|
+
close: z.ZodString;
|
|
2273
|
+
}, z.core.$strip>>;
|
|
2274
|
+
saturday: z.ZodOptional<z.ZodObject<{
|
|
2275
|
+
open: z.ZodString;
|
|
2276
|
+
close: z.ZodString;
|
|
2277
|
+
}, z.core.$strip>>;
|
|
2278
|
+
sunday: z.ZodOptional<z.ZodObject<{
|
|
2279
|
+
open: z.ZodString;
|
|
2280
|
+
close: z.ZodString;
|
|
2281
|
+
}, z.core.$strip>>;
|
|
2282
|
+
}, z.core.$strip>>;
|
|
2283
|
+
clientBrief: z.ZodDefault<z.ZodString>;
|
|
2284
|
+
}, z.core.$strip>>;
|
|
2285
|
+
customers: z.ZodDefault<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
2286
|
+
id: z.ZodString;
|
|
2287
|
+
order: z.ZodNumber;
|
|
2288
|
+
name: z.ZodDefault<z.ZodString>;
|
|
2289
|
+
description: z.ZodDefault<z.ZodString>;
|
|
2290
|
+
jobsToBeDone: z.ZodDefault<z.ZodString>;
|
|
2291
|
+
pains: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
2292
|
+
gains: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
2293
|
+
firmographics: z.ZodDefault<z.ZodObject<{
|
|
2294
|
+
industry: z.ZodOptional<z.ZodString>;
|
|
2295
|
+
companySize: z.ZodOptional<z.ZodString>;
|
|
2296
|
+
region: z.ZodOptional<z.ZodString>;
|
|
2297
|
+
}, z.core.$strip>>;
|
|
2298
|
+
valueProp: z.ZodDefault<z.ZodString>;
|
|
2299
|
+
}, z.core.$strip>>>>;
|
|
2300
|
+
offerings: z.ZodDefault<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
2301
|
+
id: z.ZodString;
|
|
2302
|
+
order: z.ZodNumber;
|
|
2303
|
+
name: z.ZodDefault<z.ZodString>;
|
|
2304
|
+
description: z.ZodDefault<z.ZodString>;
|
|
2305
|
+
pricingModel: z.ZodDefault<z.ZodEnum<{
|
|
2306
|
+
custom: "custom";
|
|
2307
|
+
"one-time": "one-time";
|
|
2308
|
+
subscription: "subscription";
|
|
2309
|
+
"usage-based": "usage-based";
|
|
2310
|
+
}>>;
|
|
2311
|
+
price: z.ZodDefault<z.ZodNumber>;
|
|
2312
|
+
currency: z.ZodDefault<z.ZodString>;
|
|
2313
|
+
targetSegmentIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
2314
|
+
deliveryFeatureId: z.ZodOptional<z.ZodString>;
|
|
2315
|
+
}, z.core.$strip>>>>;
|
|
2316
|
+
roles: z.ZodDefault<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
2317
|
+
id: z.ZodString;
|
|
2318
|
+
order: z.ZodNumber;
|
|
2319
|
+
title: z.ZodString;
|
|
2320
|
+
responsibilities: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
2321
|
+
reportsToId: z.ZodOptional<z.ZodString>;
|
|
2322
|
+
heldBy: z.ZodOptional<z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2323
|
+
kind: z.ZodLiteral<"human">;
|
|
2324
|
+
userId: z.ZodString;
|
|
2325
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2326
|
+
kind: z.ZodLiteral<"agent">;
|
|
2327
|
+
agentId: z.ZodString;
|
|
2328
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2329
|
+
kind: z.ZodLiteral<"team">;
|
|
2330
|
+
memberIds: z.ZodArray<z.ZodString>;
|
|
2331
|
+
}, z.core.$strip>], "kind">, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2332
|
+
kind: z.ZodLiteral<"human">;
|
|
2333
|
+
userId: z.ZodString;
|
|
2334
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2335
|
+
kind: z.ZodLiteral<"agent">;
|
|
2336
|
+
agentId: z.ZodString;
|
|
2337
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2338
|
+
kind: z.ZodLiteral<"team">;
|
|
2339
|
+
memberIds: z.ZodArray<z.ZodString>;
|
|
2340
|
+
}, z.core.$strip>], "kind">>]>>;
|
|
2341
|
+
responsibleFor: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2342
|
+
}, z.core.$strip>>>>;
|
|
2343
|
+
goals: z.ZodDefault<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
2344
|
+
id: z.ZodString;
|
|
2345
|
+
order: z.ZodNumber;
|
|
2346
|
+
description: z.ZodString;
|
|
2347
|
+
periodStart: z.ZodString;
|
|
2348
|
+
periodEnd: z.ZodString;
|
|
2349
|
+
keyResults: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
2350
|
+
id: z.ZodString;
|
|
2351
|
+
description: z.ZodString;
|
|
2352
|
+
targetMetric: z.ZodString;
|
|
2353
|
+
currentValue: z.ZodDefault<z.ZodNumber>;
|
|
2354
|
+
targetValue: z.ZodOptional<z.ZodNumber>;
|
|
2355
|
+
}, z.core.$strip>>>;
|
|
2356
|
+
}, z.core.$strip>>>>;
|
|
2357
|
+
systems: z.ZodDefault<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodType<SystemEntry, unknown, z.core.$ZodTypeInternals<SystemEntry, unknown>>>>>;
|
|
2358
|
+
ontology: z.ZodDefault<z.ZodDefault<z.ZodObject<{
|
|
2359
|
+
objectTypes: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
2360
|
+
id: z.ZodString;
|
|
2361
|
+
label: z.ZodOptional<z.ZodString>;
|
|
2362
|
+
description: z.ZodOptional<z.ZodString>;
|
|
2363
|
+
ownerSystemId: z.ZodOptional<z.ZodString>;
|
|
2364
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2365
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
2366
|
+
storage: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
2367
|
+
}, z.core.$loose>>>>;
|
|
2368
|
+
linkTypes: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
2369
|
+
id: z.ZodString;
|
|
2370
|
+
label: z.ZodOptional<z.ZodString>;
|
|
2371
|
+
description: z.ZodOptional<z.ZodString>;
|
|
2372
|
+
ownerSystemId: z.ZodOptional<z.ZodString>;
|
|
2373
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2374
|
+
from: z.ZodString;
|
|
2375
|
+
to: z.ZodString;
|
|
2376
|
+
cardinality: z.ZodOptional<z.ZodString>;
|
|
2377
|
+
via: z.ZodOptional<z.ZodString>;
|
|
2378
|
+
}, z.core.$loose>>>>;
|
|
2379
|
+
actionTypes: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
2380
|
+
id: z.ZodString;
|
|
2381
|
+
label: z.ZodOptional<z.ZodString>;
|
|
2382
|
+
description: z.ZodOptional<z.ZodString>;
|
|
2383
|
+
ownerSystemId: z.ZodOptional<z.ZodString>;
|
|
2384
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2385
|
+
actsOn: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
|
|
2386
|
+
input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
2387
|
+
effects: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
2388
|
+
}, z.core.$loose>>>>;
|
|
2389
|
+
catalogTypes: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
2390
|
+
id: z.ZodString;
|
|
2391
|
+
label: z.ZodOptional<z.ZodString>;
|
|
2392
|
+
description: z.ZodOptional<z.ZodString>;
|
|
2393
|
+
ownerSystemId: z.ZodOptional<z.ZodString>;
|
|
2394
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2395
|
+
kind: z.ZodOptional<z.ZodString>;
|
|
2396
|
+
appliesTo: z.ZodOptional<z.ZodString>;
|
|
2397
|
+
entries: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
2398
|
+
}, z.core.$loose>>>>;
|
|
2399
|
+
eventTypes: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
2400
|
+
id: z.ZodString;
|
|
2401
|
+
label: z.ZodOptional<z.ZodString>;
|
|
2402
|
+
description: z.ZodOptional<z.ZodString>;
|
|
2403
|
+
ownerSystemId: z.ZodOptional<z.ZodString>;
|
|
2404
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2405
|
+
payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
2406
|
+
}, z.core.$loose>>>>;
|
|
2407
|
+
interfaceTypes: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
2408
|
+
id: z.ZodString;
|
|
2409
|
+
label: z.ZodOptional<z.ZodString>;
|
|
2410
|
+
description: z.ZodOptional<z.ZodString>;
|
|
2411
|
+
ownerSystemId: z.ZodOptional<z.ZodString>;
|
|
2412
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2413
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
2414
|
+
}, z.core.$loose>>>>;
|
|
2415
|
+
valueTypes: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
2416
|
+
id: z.ZodString;
|
|
2417
|
+
label: z.ZodOptional<z.ZodString>;
|
|
2418
|
+
description: z.ZodOptional<z.ZodString>;
|
|
2419
|
+
ownerSystemId: z.ZodOptional<z.ZodString>;
|
|
2420
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2421
|
+
primitive: z.ZodOptional<z.ZodString>;
|
|
2422
|
+
}, z.core.$loose>>>>;
|
|
2423
|
+
sharedProperties: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
2424
|
+
id: z.ZodString;
|
|
2425
|
+
label: z.ZodOptional<z.ZodString>;
|
|
2426
|
+
description: z.ZodOptional<z.ZodString>;
|
|
2427
|
+
ownerSystemId: z.ZodOptional<z.ZodString>;
|
|
2428
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2429
|
+
valueType: z.ZodOptional<z.ZodString>;
|
|
2430
|
+
searchable: z.ZodOptional<z.ZodBoolean>;
|
|
2431
|
+
pii: z.ZodOptional<z.ZodBoolean>;
|
|
2432
|
+
}, z.core.$loose>>>>;
|
|
2433
|
+
groups: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
2434
|
+
id: z.ZodString;
|
|
2435
|
+
label: z.ZodOptional<z.ZodString>;
|
|
2436
|
+
description: z.ZodOptional<z.ZodString>;
|
|
2437
|
+
ownerSystemId: z.ZodOptional<z.ZodString>;
|
|
2438
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2439
|
+
members: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
|
|
2440
|
+
}, z.core.$loose>>>>;
|
|
2441
|
+
surfaces: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
2442
|
+
id: z.ZodString;
|
|
2443
|
+
label: z.ZodOptional<z.ZodString>;
|
|
2444
|
+
description: z.ZodOptional<z.ZodString>;
|
|
2445
|
+
ownerSystemId: z.ZodOptional<z.ZodString>;
|
|
2446
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2447
|
+
route: z.ZodOptional<z.ZodString>;
|
|
2448
|
+
}, z.core.$loose>>>>;
|
|
2449
|
+
}, z.core.$strip>>>;
|
|
2450
|
+
resources: z.ZodDefault<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2451
|
+
id: z.ZodString;
|
|
2452
|
+
order: z.ZodDefault<z.ZodNumber>;
|
|
2453
|
+
systemPath: z.ZodString;
|
|
2454
|
+
title: z.ZodOptional<z.ZodString>;
|
|
2455
|
+
description: z.ZodOptional<z.ZodString>;
|
|
2456
|
+
ownerRoleId: z.ZodOptional<z.ZodString>;
|
|
2457
|
+
status: z.ZodEnum<{
|
|
2458
|
+
deprecated: "deprecated";
|
|
2459
|
+
active: "active";
|
|
2460
|
+
archived: "archived";
|
|
2461
|
+
}>;
|
|
2462
|
+
ontology: z.ZodOptional<z.ZodObject<{
|
|
2463
|
+
actions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2464
|
+
primaryAction: z.ZodOptional<z.ZodString>;
|
|
2465
|
+
reads: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2466
|
+
writes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2467
|
+
usesCatalogs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2468
|
+
emits: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2469
|
+
contract: z.ZodOptional<z.ZodObject<{
|
|
2470
|
+
input: z.ZodOptional<z.ZodString>;
|
|
2471
|
+
output: z.ZodOptional<z.ZodString>;
|
|
2472
|
+
}, z.core.$strip>>;
|
|
2473
|
+
}, z.core.$strip>>;
|
|
2474
|
+
codeRefs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
2475
|
+
path: z.ZodString;
|
|
2476
|
+
role: z.ZodEnum<{
|
|
2477
|
+
config: "config";
|
|
2478
|
+
entrypoint: "entrypoint";
|
|
2479
|
+
handler: "handler";
|
|
2480
|
+
schema: "schema";
|
|
2481
|
+
test: "test";
|
|
2482
|
+
docs: "docs";
|
|
2483
|
+
}>;
|
|
2484
|
+
symbol: z.ZodOptional<z.ZodString>;
|
|
2485
|
+
description: z.ZodOptional<z.ZodString>;
|
|
2486
|
+
}, z.core.$strip>>>;
|
|
2487
|
+
kind: z.ZodLiteral<"workflow">;
|
|
2488
|
+
emits: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2489
|
+
eventKey: z.ZodString;
|
|
2490
|
+
label: z.ZodString;
|
|
2491
|
+
payloadSchema: z.ZodOptional<z.ZodString>;
|
|
2492
|
+
lifecycle: z.ZodOptional<z.ZodEnum<{
|
|
2493
|
+
deprecated: "deprecated";
|
|
2494
|
+
draft: "draft";
|
|
2495
|
+
beta: "beta";
|
|
2496
|
+
active: "active";
|
|
2497
|
+
archived: "archived";
|
|
2498
|
+
}>>;
|
|
2499
|
+
}, z.core.$strip>>>;
|
|
2500
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2501
|
+
id: z.ZodString;
|
|
2502
|
+
order: z.ZodDefault<z.ZodNumber>;
|
|
2503
|
+
systemPath: z.ZodString;
|
|
2504
|
+
title: z.ZodOptional<z.ZodString>;
|
|
2505
|
+
description: z.ZodOptional<z.ZodString>;
|
|
2506
|
+
ownerRoleId: z.ZodOptional<z.ZodString>;
|
|
2507
|
+
status: z.ZodEnum<{
|
|
2508
|
+
deprecated: "deprecated";
|
|
2509
|
+
active: "active";
|
|
2510
|
+
archived: "archived";
|
|
2511
|
+
}>;
|
|
2512
|
+
ontology: z.ZodOptional<z.ZodObject<{
|
|
2513
|
+
actions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2514
|
+
primaryAction: z.ZodOptional<z.ZodString>;
|
|
2515
|
+
reads: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2516
|
+
writes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2517
|
+
usesCatalogs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2518
|
+
emits: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2519
|
+
contract: z.ZodOptional<z.ZodObject<{
|
|
2520
|
+
input: z.ZodOptional<z.ZodString>;
|
|
2521
|
+
output: z.ZodOptional<z.ZodString>;
|
|
2522
|
+
}, z.core.$strip>>;
|
|
2523
|
+
}, z.core.$strip>>;
|
|
2524
|
+
codeRefs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
2525
|
+
path: z.ZodString;
|
|
2526
|
+
role: z.ZodEnum<{
|
|
2527
|
+
config: "config";
|
|
2528
|
+
entrypoint: "entrypoint";
|
|
2529
|
+
handler: "handler";
|
|
2530
|
+
schema: "schema";
|
|
2531
|
+
test: "test";
|
|
2532
|
+
docs: "docs";
|
|
2533
|
+
}>;
|
|
2534
|
+
symbol: z.ZodOptional<z.ZodString>;
|
|
2535
|
+
description: z.ZodOptional<z.ZodString>;
|
|
2536
|
+
}, z.core.$strip>>>;
|
|
2537
|
+
kind: z.ZodLiteral<"agent">;
|
|
2538
|
+
agentKind: z.ZodEnum<{
|
|
2539
|
+
platform: "platform";
|
|
2540
|
+
orchestrator: "orchestrator";
|
|
2541
|
+
specialist: "specialist";
|
|
2542
|
+
utility: "utility";
|
|
2543
|
+
}>;
|
|
2544
|
+
actsAsRoleId: z.ZodOptional<z.ZodString>;
|
|
2545
|
+
sessionCapable: z.ZodBoolean;
|
|
2546
|
+
invocations: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2547
|
+
kind: z.ZodLiteral<"slash-command">;
|
|
2548
|
+
command: z.ZodString;
|
|
2549
|
+
toolFactory: z.ZodOptional<z.ZodString>;
|
|
2550
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2551
|
+
kind: z.ZodLiteral<"mcp-tool">;
|
|
2552
|
+
server: z.ZodString;
|
|
2553
|
+
name: z.ZodString;
|
|
2554
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2555
|
+
kind: z.ZodLiteral<"api-endpoint">;
|
|
2556
|
+
method: z.ZodEnum<{
|
|
2557
|
+
GET: "GET";
|
|
2558
|
+
POST: "POST";
|
|
2559
|
+
PATCH: "PATCH";
|
|
2560
|
+
DELETE: "DELETE";
|
|
2561
|
+
}>;
|
|
2562
|
+
path: z.ZodString;
|
|
2563
|
+
requestSchema: z.ZodOptional<z.ZodString>;
|
|
2564
|
+
responseSchema: z.ZodOptional<z.ZodString>;
|
|
2565
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2566
|
+
kind: z.ZodLiteral<"script-execution">;
|
|
2567
|
+
resourceId: z.ZodString;
|
|
2568
|
+
}, z.core.$strip>], "kind">>>;
|
|
2569
|
+
emits: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2570
|
+
eventKey: z.ZodString;
|
|
2571
|
+
label: z.ZodString;
|
|
2572
|
+
payloadSchema: z.ZodOptional<z.ZodString>;
|
|
2573
|
+
lifecycle: z.ZodOptional<z.ZodEnum<{
|
|
2574
|
+
deprecated: "deprecated";
|
|
2575
|
+
draft: "draft";
|
|
2576
|
+
beta: "beta";
|
|
2577
|
+
active: "active";
|
|
2578
|
+
archived: "archived";
|
|
2579
|
+
}>>;
|
|
2580
|
+
}, z.core.$strip>>>;
|
|
2581
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2582
|
+
id: z.ZodString;
|
|
2583
|
+
order: z.ZodDefault<z.ZodNumber>;
|
|
2584
|
+
systemPath: z.ZodString;
|
|
2585
|
+
title: z.ZodOptional<z.ZodString>;
|
|
2586
|
+
description: z.ZodOptional<z.ZodString>;
|
|
2587
|
+
ownerRoleId: z.ZodOptional<z.ZodString>;
|
|
2588
|
+
status: z.ZodEnum<{
|
|
2589
|
+
deprecated: "deprecated";
|
|
2590
|
+
active: "active";
|
|
2591
|
+
archived: "archived";
|
|
2592
|
+
}>;
|
|
2593
|
+
ontology: z.ZodOptional<z.ZodObject<{
|
|
2594
|
+
actions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2595
|
+
primaryAction: z.ZodOptional<z.ZodString>;
|
|
2596
|
+
reads: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2597
|
+
writes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2598
|
+
usesCatalogs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2599
|
+
emits: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2600
|
+
contract: z.ZodOptional<z.ZodObject<{
|
|
2601
|
+
input: z.ZodOptional<z.ZodString>;
|
|
2602
|
+
output: z.ZodOptional<z.ZodString>;
|
|
2603
|
+
}, z.core.$strip>>;
|
|
2604
|
+
}, z.core.$strip>>;
|
|
2605
|
+
codeRefs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
2606
|
+
path: z.ZodString;
|
|
2607
|
+
role: z.ZodEnum<{
|
|
2608
|
+
config: "config";
|
|
2609
|
+
entrypoint: "entrypoint";
|
|
2610
|
+
handler: "handler";
|
|
2611
|
+
schema: "schema";
|
|
2612
|
+
test: "test";
|
|
2613
|
+
docs: "docs";
|
|
2614
|
+
}>;
|
|
2615
|
+
symbol: z.ZodOptional<z.ZodString>;
|
|
2616
|
+
description: z.ZodOptional<z.ZodString>;
|
|
2617
|
+
}, z.core.$strip>>>;
|
|
2618
|
+
kind: z.ZodLiteral<"integration">;
|
|
2619
|
+
provider: z.ZodString;
|
|
2620
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2621
|
+
id: z.ZodString;
|
|
2622
|
+
order: z.ZodDefault<z.ZodNumber>;
|
|
2623
|
+
systemPath: z.ZodString;
|
|
2624
|
+
title: z.ZodOptional<z.ZodString>;
|
|
2625
|
+
description: z.ZodOptional<z.ZodString>;
|
|
2626
|
+
ownerRoleId: z.ZodOptional<z.ZodString>;
|
|
2627
|
+
status: z.ZodEnum<{
|
|
2628
|
+
deprecated: "deprecated";
|
|
2629
|
+
active: "active";
|
|
2630
|
+
archived: "archived";
|
|
2631
|
+
}>;
|
|
2632
|
+
ontology: z.ZodOptional<z.ZodObject<{
|
|
2633
|
+
actions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2634
|
+
primaryAction: z.ZodOptional<z.ZodString>;
|
|
2635
|
+
reads: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2636
|
+
writes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2637
|
+
usesCatalogs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2638
|
+
emits: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2639
|
+
contract: z.ZodOptional<z.ZodObject<{
|
|
2640
|
+
input: z.ZodOptional<z.ZodString>;
|
|
2641
|
+
output: z.ZodOptional<z.ZodString>;
|
|
2642
|
+
}, z.core.$strip>>;
|
|
2643
|
+
}, z.core.$strip>>;
|
|
2644
|
+
codeRefs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
2645
|
+
path: z.ZodString;
|
|
2646
|
+
role: z.ZodEnum<{
|
|
2647
|
+
config: "config";
|
|
2648
|
+
entrypoint: "entrypoint";
|
|
2649
|
+
handler: "handler";
|
|
2650
|
+
schema: "schema";
|
|
2651
|
+
test: "test";
|
|
2652
|
+
docs: "docs";
|
|
2653
|
+
}>;
|
|
2654
|
+
symbol: z.ZodOptional<z.ZodString>;
|
|
2655
|
+
description: z.ZodOptional<z.ZodString>;
|
|
2656
|
+
}, z.core.$strip>>>;
|
|
2657
|
+
kind: z.ZodLiteral<"script">;
|
|
2658
|
+
language: z.ZodEnum<{
|
|
2659
|
+
shell: "shell";
|
|
2660
|
+
sql: "sql";
|
|
2661
|
+
typescript: "typescript";
|
|
2662
|
+
python: "python";
|
|
2663
|
+
}>;
|
|
2664
|
+
source: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
2665
|
+
file: z.ZodString;
|
|
2666
|
+
}, z.core.$strip>]>;
|
|
2667
|
+
}, z.core.$strip>], "kind">>>>;
|
|
2668
|
+
topology: z.ZodDefault<z.ZodDefault<z.ZodObject<{
|
|
2669
|
+
version: z.ZodDefault<z.ZodLiteral<1>>;
|
|
2670
|
+
relationships: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
2671
|
+
from: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2672
|
+
kind: z.ZodLiteral<"system">;
|
|
2673
|
+
id: z.ZodString;
|
|
2674
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2675
|
+
kind: z.ZodLiteral<"resource">;
|
|
2676
|
+
id: z.ZodString;
|
|
2677
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2678
|
+
kind: z.ZodLiteral<"ontology">;
|
|
2679
|
+
id: z.ZodString;
|
|
2680
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2681
|
+
kind: z.ZodLiteral<"policy">;
|
|
2682
|
+
id: z.ZodString;
|
|
2683
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2684
|
+
kind: z.ZodLiteral<"role">;
|
|
2685
|
+
id: z.ZodString;
|
|
2686
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2687
|
+
kind: z.ZodLiteral<"trigger">;
|
|
2688
|
+
id: z.ZodString;
|
|
2689
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2690
|
+
kind: z.ZodLiteral<"humanCheckpoint">;
|
|
2691
|
+
id: z.ZodString;
|
|
2692
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2693
|
+
kind: z.ZodLiteral<"externalResource">;
|
|
2694
|
+
id: z.ZodString;
|
|
2695
|
+
}, z.core.$strip>], "kind">;
|
|
2696
|
+
kind: z.ZodEnum<{
|
|
2697
|
+
triggers: "triggers";
|
|
2698
|
+
uses: "uses";
|
|
2699
|
+
approval: "approval";
|
|
2700
|
+
}>;
|
|
2701
|
+
to: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2702
|
+
kind: z.ZodLiteral<"system">;
|
|
2703
|
+
id: z.ZodString;
|
|
2704
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2705
|
+
kind: z.ZodLiteral<"resource">;
|
|
2706
|
+
id: z.ZodString;
|
|
2707
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2708
|
+
kind: z.ZodLiteral<"ontology">;
|
|
2709
|
+
id: z.ZodString;
|
|
2710
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2711
|
+
kind: z.ZodLiteral<"policy">;
|
|
2712
|
+
id: z.ZodString;
|
|
2713
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2714
|
+
kind: z.ZodLiteral<"role">;
|
|
2715
|
+
id: z.ZodString;
|
|
2716
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2717
|
+
kind: z.ZodLiteral<"trigger">;
|
|
2718
|
+
id: z.ZodString;
|
|
2719
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2720
|
+
kind: z.ZodLiteral<"humanCheckpoint">;
|
|
2721
|
+
id: z.ZodString;
|
|
2722
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2723
|
+
kind: z.ZodLiteral<"externalResource">;
|
|
2724
|
+
id: z.ZodString;
|
|
2725
|
+
}, z.core.$strip>], "kind">;
|
|
2726
|
+
systemPath: z.ZodOptional<z.ZodString>;
|
|
2727
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
2728
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
2729
|
+
}, z.core.$strip>>>;
|
|
2730
|
+
}, z.core.$strip>>>;
|
|
2731
|
+
actions: z.ZodDefault<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
2732
|
+
id: z.ZodString;
|
|
2733
|
+
order: z.ZodNumber;
|
|
2734
|
+
label: z.ZodString;
|
|
2735
|
+
description: z.ZodOptional<z.ZodString>;
|
|
2736
|
+
scope: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<"global">, z.ZodObject<{
|
|
2737
|
+
domain: z.ZodString;
|
|
2738
|
+
}, z.core.$strip>]>>;
|
|
2739
|
+
resourceId: z.ZodOptional<z.ZodString>;
|
|
2740
|
+
affects: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2741
|
+
invocations: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2742
|
+
kind: z.ZodLiteral<"slash-command">;
|
|
2743
|
+
command: z.ZodString;
|
|
2744
|
+
toolFactory: z.ZodOptional<z.ZodString>;
|
|
2745
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2746
|
+
kind: z.ZodLiteral<"mcp-tool">;
|
|
2747
|
+
server: z.ZodString;
|
|
2748
|
+
name: z.ZodString;
|
|
2749
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2750
|
+
kind: z.ZodLiteral<"api-endpoint">;
|
|
2751
|
+
method: z.ZodEnum<{
|
|
2752
|
+
GET: "GET";
|
|
2753
|
+
POST: "POST";
|
|
2754
|
+
PATCH: "PATCH";
|
|
2755
|
+
DELETE: "DELETE";
|
|
2756
|
+
}>;
|
|
2757
|
+
path: z.ZodString;
|
|
2758
|
+
requestSchema: z.ZodOptional<z.ZodString>;
|
|
2759
|
+
responseSchema: z.ZodOptional<z.ZodString>;
|
|
2760
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2761
|
+
kind: z.ZodLiteral<"script-execution">;
|
|
2762
|
+
resourceId: z.ZodString;
|
|
2763
|
+
}, z.core.$strip>], "kind">>>;
|
|
2764
|
+
knowledge: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
|
|
2765
|
+
lifecycle: z.ZodDefault<z.ZodEnum<{
|
|
2766
|
+
deprecated: "deprecated";
|
|
2767
|
+
draft: "draft";
|
|
2768
|
+
beta: "beta";
|
|
2769
|
+
active: "active";
|
|
2770
|
+
archived: "archived";
|
|
2771
|
+
}>>;
|
|
2772
|
+
}, z.core.$strip>>>>;
|
|
2773
|
+
entities: z.ZodDefault<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
2774
|
+
id: z.ZodString;
|
|
2775
|
+
order: z.ZodNumber;
|
|
2776
|
+
label: z.ZodString;
|
|
2777
|
+
description: z.ZodOptional<z.ZodString>;
|
|
2778
|
+
ownedBySystemId: z.ZodString;
|
|
2779
|
+
table: z.ZodOptional<z.ZodString>;
|
|
2780
|
+
rowSchema: z.ZodOptional<z.ZodString>;
|
|
2781
|
+
stateCatalogId: z.ZodOptional<z.ZodString>;
|
|
2782
|
+
links: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2783
|
+
toEntity: z.ZodString;
|
|
2784
|
+
kind: z.ZodEnum<{
|
|
2785
|
+
"belongs-to": "belongs-to";
|
|
2786
|
+
"has-many": "has-many";
|
|
2787
|
+
"has-one": "has-one";
|
|
2788
|
+
"many-to-many": "many-to-many";
|
|
2789
|
+
}>;
|
|
2790
|
+
via: z.ZodOptional<z.ZodString>;
|
|
2791
|
+
label: z.ZodOptional<z.ZodString>;
|
|
2792
|
+
}, z.core.$strip>>>;
|
|
2793
|
+
}, z.core.$strip>>>>;
|
|
2794
|
+
policies: z.ZodDefault<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
2795
|
+
id: z.ZodString;
|
|
2796
|
+
order: z.ZodNumber;
|
|
2797
|
+
label: z.ZodString;
|
|
2798
|
+
description: z.ZodOptional<z.ZodString>;
|
|
2799
|
+
trigger: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2800
|
+
kind: z.ZodLiteral<"event">;
|
|
2801
|
+
eventId: z.ZodString;
|
|
2802
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2803
|
+
kind: z.ZodLiteral<"action-invocation">;
|
|
2804
|
+
actionId: z.ZodString;
|
|
2805
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2806
|
+
kind: z.ZodLiteral<"schedule">;
|
|
2807
|
+
cron: z.ZodString;
|
|
2808
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2809
|
+
kind: z.ZodLiteral<"manual">;
|
|
2810
|
+
}, z.core.$strip>], "kind">;
|
|
2811
|
+
predicate: z.ZodDefault<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2812
|
+
kind: z.ZodLiteral<"always">;
|
|
2813
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2814
|
+
kind: z.ZodLiteral<"expression">;
|
|
2815
|
+
expression: z.ZodString;
|
|
2816
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2817
|
+
kind: z.ZodLiteral<"threshold">;
|
|
2818
|
+
metric: z.ZodString;
|
|
2819
|
+
operator: z.ZodEnum<{
|
|
2820
|
+
lt: "lt";
|
|
2821
|
+
lte: "lte";
|
|
2822
|
+
eq: "eq";
|
|
2823
|
+
gte: "gte";
|
|
2824
|
+
gt: "gt";
|
|
2825
|
+
}>;
|
|
2826
|
+
value: z.ZodNumber;
|
|
2827
|
+
}, z.core.$strip>], "kind">>;
|
|
2828
|
+
actions: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2829
|
+
kind: z.ZodLiteral<"require-approval">;
|
|
2830
|
+
roleId: z.ZodOptional<z.ZodString>;
|
|
2831
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2832
|
+
kind: z.ZodLiteral<"invoke-action">;
|
|
2833
|
+
actionId: z.ZodString;
|
|
2834
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2835
|
+
kind: z.ZodLiteral<"notify-role">;
|
|
2836
|
+
roleId: z.ZodString;
|
|
2837
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2838
|
+
kind: z.ZodLiteral<"block">;
|
|
2839
|
+
}, z.core.$strip>], "kind">>;
|
|
2840
|
+
appliesTo: z.ZodDefault<z.ZodObject<{
|
|
2841
|
+
systemIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
2842
|
+
actionIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
2843
|
+
resourceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
2844
|
+
roleIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
2845
|
+
}, z.core.$strip>>;
|
|
2846
|
+
lifecycle: z.ZodDefault<z.ZodEnum<{
|
|
2847
|
+
deprecated: "deprecated";
|
|
2848
|
+
draft: "draft";
|
|
2849
|
+
beta: "beta";
|
|
2850
|
+
active: "active";
|
|
2851
|
+
archived: "archived";
|
|
2852
|
+
}>>;
|
|
2853
|
+
}, z.core.$strip>>>>;
|
|
2854
|
+
knowledge: z.ZodDefault<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
2855
|
+
id: z.ZodString;
|
|
2856
|
+
kind: z.ZodEnum<{
|
|
2857
|
+
playbook: "playbook";
|
|
2858
|
+
strategy: "strategy";
|
|
2859
|
+
reference: "reference";
|
|
2860
|
+
}>;
|
|
2861
|
+
title: z.ZodString;
|
|
2862
|
+
summary: z.ZodString;
|
|
2863
|
+
icon: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
2864
|
+
message: "message";
|
|
2865
|
+
error: "error";
|
|
2866
|
+
agent: "agent";
|
|
2867
|
+
workflow: "workflow";
|
|
2868
|
+
"google-sheets": "google-sheets";
|
|
2869
|
+
dashboard: "dashboard";
|
|
2870
|
+
calendar: "calendar";
|
|
2871
|
+
sales: "sales";
|
|
2872
|
+
crm: "crm";
|
|
2873
|
+
"lead-gen": "lead-gen";
|
|
2874
|
+
projects: "projects";
|
|
2875
|
+
clients: "clients";
|
|
2876
|
+
operations: "operations";
|
|
2877
|
+
monitoring: "monitoring";
|
|
2878
|
+
knowledge: "knowledge";
|
|
2879
|
+
settings: "settings";
|
|
2880
|
+
admin: "admin";
|
|
2881
|
+
archive: "archive";
|
|
2882
|
+
business: "business";
|
|
2883
|
+
finance: "finance";
|
|
2884
|
+
platform: "platform";
|
|
2885
|
+
seo: "seo";
|
|
2886
|
+
playbook: "playbook";
|
|
2887
|
+
strategy: "strategy";
|
|
2888
|
+
reference: "reference";
|
|
2889
|
+
integration: "integration";
|
|
2890
|
+
database: "database";
|
|
2891
|
+
user: "user";
|
|
2892
|
+
team: "team";
|
|
2893
|
+
gmail: "gmail";
|
|
2894
|
+
attio: "attio";
|
|
2895
|
+
overview: "overview";
|
|
2896
|
+
"command-view": "command-view";
|
|
2897
|
+
"command-queue": "command-queue";
|
|
2898
|
+
pipeline: "pipeline";
|
|
2899
|
+
lists: "lists";
|
|
2900
|
+
resources: "resources";
|
|
2901
|
+
approve: "approve";
|
|
2902
|
+
reject: "reject";
|
|
2903
|
+
retry: "retry";
|
|
2904
|
+
edit: "edit";
|
|
2905
|
+
view: "view";
|
|
2906
|
+
launch: "launch";
|
|
2907
|
+
escalate: "escalate";
|
|
2908
|
+
promote: "promote";
|
|
2909
|
+
submit: "submit";
|
|
2910
|
+
email: "email";
|
|
2911
|
+
success: "success";
|
|
2912
|
+
warning: "warning";
|
|
2913
|
+
info: "info";
|
|
2914
|
+
pending: "pending";
|
|
2915
|
+
bolt: "bolt";
|
|
2916
|
+
building: "building";
|
|
2917
|
+
briefcase: "briefcase";
|
|
2918
|
+
apps: "apps";
|
|
2919
|
+
graph: "graph";
|
|
2920
|
+
shield: "shield";
|
|
2921
|
+
users: "users";
|
|
2922
|
+
"chart-bar": "chart-bar";
|
|
2923
|
+
search: "search";
|
|
2924
|
+
}>, z.ZodString]>>;
|
|
2925
|
+
externalUrl: z.ZodOptional<z.ZodString>;
|
|
2926
|
+
sourceFilePath: z.ZodOptional<z.ZodString>;
|
|
2927
|
+
body: z.ZodString;
|
|
2928
|
+
links: z.ZodDefault<z.ZodArray<z.ZodPipe<z.ZodUnion<readonly [z.ZodObject<{
|
|
2929
|
+
target: z.ZodObject<{
|
|
2930
|
+
kind: z.ZodEnum<{
|
|
2931
|
+
knowledge: "knowledge";
|
|
2932
|
+
system: "system";
|
|
2933
|
+
action: "action";
|
|
2934
|
+
ontology: "ontology";
|
|
2935
|
+
role: "role";
|
|
2936
|
+
goal: "goal";
|
|
2937
|
+
resource: "resource";
|
|
2938
|
+
stage: "stage";
|
|
2939
|
+
"customer-segment": "customer-segment";
|
|
2940
|
+
offering: "offering";
|
|
2941
|
+
}>;
|
|
2942
|
+
id: z.ZodString;
|
|
2943
|
+
}, z.core.$strip>;
|
|
2944
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2945
|
+
nodeId: z.ZodUnion<readonly [z.ZodString, z.ZodTemplateLiteral<`ontology:${string}`>]>;
|
|
2946
|
+
}, z.core.$strip>]>, z.ZodTransform<{
|
|
2947
|
+
target: {
|
|
2948
|
+
kind: "knowledge" | "system" | "action" | "ontology" | "role" | "goal" | "resource" | "stage" | "customer-segment" | "offering";
|
|
2949
|
+
id: string;
|
|
2950
|
+
};
|
|
2951
|
+
nodeId: string;
|
|
2952
|
+
}, {
|
|
2953
|
+
nodeId: string;
|
|
2954
|
+
} | {
|
|
2955
|
+
target: {
|
|
2956
|
+
kind: "knowledge" | "system" | "action" | "ontology" | "role" | "goal" | "resource" | "stage" | "customer-segment" | "offering";
|
|
2957
|
+
id: string;
|
|
2958
|
+
};
|
|
2959
|
+
}>>>>;
|
|
2960
|
+
ownerIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
2961
|
+
updatedAt: z.ZodString;
|
|
2962
|
+
}, z.core.$strip>>>>;
|
|
2963
|
+
}, z.core.$strip>;
|
|
2964
|
+
|
|
2965
|
+
type OrganizationModel$1 = z.infer<typeof OrganizationModelSchema$1>;
|
|
2966
|
+
|
|
2967
|
+
declare const ResourceCategorySchema: z.ZodEnum<{
|
|
2968
|
+
diagnostic: "diagnostic";
|
|
2969
|
+
production: "production";
|
|
2970
|
+
internal: "internal";
|
|
2971
|
+
testing: "testing";
|
|
2972
|
+
}>;
|
|
2973
|
+
type ResourceCategory = z.infer<typeof ResourceCategorySchema>;
|
|
2974
|
+
type ResourceLink = Link;
|
|
2975
|
+
|
|
2976
|
+
/**
|
|
2977
|
+
* ResourceRegistry - Resource discovery and lookup
|
|
2978
|
+
* Handles resource definitions from OrganizationRegistry
|
|
2979
|
+
*
|
|
2980
|
+
* Features:
|
|
2981
|
+
* - Resource discovery by organization
|
|
2982
|
+
* - Startup validation (duplicate IDs, model configs, relationships, interface-schema alignment)
|
|
2983
|
+
* - Pre-serialization cache for instant API responses
|
|
2984
|
+
* - Command View data generation
|
|
2985
|
+
*/
|
|
2986
|
+
|
|
2987
|
+
/**
|
|
2988
|
+
* Organization-specific resource collection
|
|
2989
|
+
*
|
|
2990
|
+
* Complete manifest of all automation resources for an organization.
|
|
2991
|
+
* Used by ResourceRegistry for discovery and Command View for visualization.
|
|
2992
|
+
*/
|
|
2993
|
+
interface DeploymentSpec {
|
|
2994
|
+
/** Deployment version (semver) */
|
|
2995
|
+
version: string;
|
|
2996
|
+
/** Optional Organization Model governance catalog used for OM-code validation */
|
|
2997
|
+
organizationModel?: Partial<Pick<OrganizationModel$1, 'systems' | 'resources' | 'ontology' | 'topology' | 'roles' | 'policies' | 'entities' | 'actions'>>;
|
|
2998
|
+
/** Workflow definitions */
|
|
2999
|
+
workflows?: WorkflowDefinition[];
|
|
3000
|
+
/** Agent definitions */
|
|
3001
|
+
agents?: AgentDefinition[];
|
|
3002
|
+
/** Trigger definitions - entry points that initiate executions */
|
|
3003
|
+
triggers?: TriggerDefinition[];
|
|
3004
|
+
/** Integration definitions - external service connections */
|
|
3005
|
+
integrations?: IntegrationDefinition[];
|
|
3006
|
+
/** Explicit relationship declarations between resources */
|
|
3007
|
+
relationships?: ResourceRelationships;
|
|
3008
|
+
/** External automation resources (n8n, Make, Zapier, etc.) */
|
|
3009
|
+
externalResources?: ExternalResourceDefinition[];
|
|
3010
|
+
/** Human checkpoint definitions - human decision points in automation */
|
|
3011
|
+
humanCheckpoints?: HumanCheckpointDefinition[];
|
|
3012
|
+
}
|
|
3013
|
+
|
|
38
3014
|
interface KnowledgeNodeInput {
|
|
39
3015
|
id: string;
|
|
40
3016
|
kind: string;
|
|
@@ -68,5 +3044,749 @@ interface ResolvedKnowledgeLayout {
|
|
|
68
3044
|
}
|
|
69
3045
|
declare function runKnowledgeCodegen(layout: ResolvedKnowledgeLayout): Promise<void>;
|
|
70
3046
|
|
|
71
|
-
|
|
72
|
-
|
|
3047
|
+
declare const ResourceOntologyBindingSchema = z
|
|
3048
|
+
.object({
|
|
3049
|
+
actions: z.array(OntologyIdSchema).optional(),
|
|
3050
|
+
primaryAction: OntologyIdSchema.optional(),
|
|
3051
|
+
reads: z.array(OntologyIdSchema).optional(),
|
|
3052
|
+
writes: z.array(OntologyIdSchema).optional(),
|
|
3053
|
+
usesCatalogs: z.array(OntologyIdSchema).optional(),
|
|
3054
|
+
emits: z.array(OntologyIdSchema).optional(),
|
|
3055
|
+
/**
|
|
3056
|
+
* Optional typed contract binding for this resource's workflow I/O.
|
|
3057
|
+
* Each ref is a `package/subpath#ExportName` string that resolves to a
|
|
3058
|
+
* Zod schema in `@repo/elevasis-core` (or the consumer's equivalent package).
|
|
3059
|
+
*
|
|
3060
|
+
* Absence of this field preserves all existing behavior — it is additive + optional.
|
|
3061
|
+
* Tier-1 validation (schema.ts): ref-string shape only (browser-safe, no imports).
|
|
3062
|
+
* Tier-2 validation (om:verify): intra-package typed-map resolution asserts ZodType.
|
|
3063
|
+
*/
|
|
3064
|
+
contract: z
|
|
3065
|
+
.object({
|
|
3066
|
+
input: ContractRefSchema.optional(),
|
|
3067
|
+
output: ContractRefSchema.optional()
|
|
3068
|
+
})
|
|
3069
|
+
.optional()
|
|
3070
|
+
})
|
|
3071
|
+
.superRefine((binding, ctx) => {
|
|
3072
|
+
if (binding.primaryAction === undefined) return
|
|
3073
|
+
if (binding.actions?.includes(binding.primaryAction)) return
|
|
3074
|
+
|
|
3075
|
+
ctx.addIssue({
|
|
3076
|
+
code: z.ZodIssueCode.custom,
|
|
3077
|
+
path: ['primaryAction'],
|
|
3078
|
+
message: 'Resource ontology primaryAction must be included in actions'
|
|
3079
|
+
})
|
|
3080
|
+
})
|
|
3081
|
+
|
|
3082
|
+
declare const WorkflowResourceEntrySchema = ResourceEntryBaseSchema.extend({
|
|
3083
|
+
kind: z.literal('workflow'),
|
|
3084
|
+
emits: z.array(EventEmissionDescriptorSchema).optional()
|
|
3085
|
+
})
|
|
3086
|
+
|
|
3087
|
+
declare const IntegrationResourceEntrySchema = ResourceEntryBaseSchema.extend({
|
|
3088
|
+
kind: z.literal('integration'),
|
|
3089
|
+
provider: z.string().trim().min(1).max(100)
|
|
3090
|
+
})
|
|
3091
|
+
|
|
3092
|
+
declare const OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ctx) => {
|
|
3093
|
+
// Collect ALL system entries recursively — top-level systems plus any nested subsystems.
|
|
3094
|
+
// Wave 2 canonical OM authors nested subsystems (e.g. sys → subsystems → 'lead-gen' with id
|
|
3095
|
+
// 'sys.lead-gen'). Resource systemPath cross-refs must resolve against the full flattened set.
|
|
3096
|
+
type SystemWithPath = { path: string; schemaPath: Array<string | number>; system: SystemEntry }
|
|
3097
|
+
|
|
3098
|
+
function collectAllSystems(
|
|
3099
|
+
systems: Record<string, SystemEntry>,
|
|
3100
|
+
prefix = '',
|
|
3101
|
+
schemaPath: Array<string | number> = ['systems']
|
|
3102
|
+
): SystemWithPath[] {
|
|
3103
|
+
const result: SystemWithPath[] = []
|
|
3104
|
+
for (const [key, system] of Object.entries(systems)) {
|
|
3105
|
+
const path = prefix ? `${prefix}.${key}` : key
|
|
3106
|
+
const currentSchemaPath = [...schemaPath, key]
|
|
3107
|
+
result.push({ path, schemaPath: currentSchemaPath, system })
|
|
3108
|
+
const childSystems = system.systems ?? system.subsystems
|
|
3109
|
+
if (childSystems !== undefined) {
|
|
3110
|
+
result.push(
|
|
3111
|
+
...collectAllSystems(childSystems, path, [
|
|
3112
|
+
...currentSchemaPath,
|
|
3113
|
+
system.systems !== undefined ? 'systems' : 'subsystems'
|
|
3114
|
+
])
|
|
3115
|
+
)
|
|
3116
|
+
}
|
|
3117
|
+
}
|
|
3118
|
+
return result
|
|
3119
|
+
}
|
|
3120
|
+
|
|
3121
|
+
const allSystems = collectAllSystems(model.systems)
|
|
3122
|
+
const systemsById = new Map<string, SystemEntry>()
|
|
3123
|
+
for (const { path, system } of allSystems) {
|
|
3124
|
+
systemsById.set(path, system)
|
|
3125
|
+
systemsById.set(system.id, system)
|
|
3126
|
+
}
|
|
3127
|
+
|
|
3128
|
+
const systemIdsByEffectivePath = new Map<string, string>()
|
|
3129
|
+
allSystems.forEach(({ path, schemaPath, system }) => {
|
|
3130
|
+
if (system.parentSystemId !== undefined && !systemsById.has(system.parentSystemId)) {
|
|
3131
|
+
addIssue(
|
|
3132
|
+
ctx,
|
|
3133
|
+
[...schemaPath, 'parentSystemId'],
|
|
3134
|
+
`System "${system.id}" references unknown parent "${system.parentSystemId}"`
|
|
3135
|
+
)
|
|
3136
|
+
}
|
|
3137
|
+
|
|
3138
|
+
const hasChildren =
|
|
3139
|
+
Object.keys(system.systems ?? system.subsystems ?? {}).length > 0 ||
|
|
3140
|
+
allSystems.some(
|
|
3141
|
+
(candidate) => candidate.path.startsWith(`${path}.`) && !candidate.path.slice(path.length + 1).includes('.')
|
|
3142
|
+
)
|
|
3143
|
+
const contributesRoutePath = system.ui?.path !== undefined || system.path !== undefined || !hasChildren
|
|
3144
|
+
if (contributesRoutePath) {
|
|
3145
|
+
const effectivePath = system.ui?.path ?? system.path ?? defaultSystemPathFor(path)
|
|
3146
|
+
const existingSystemId = systemIdsByEffectivePath.get(effectivePath)
|
|
3147
|
+
if (existingSystemId !== undefined) {
|
|
3148
|
+
addIssue(
|
|
3149
|
+
ctx,
|
|
3150
|
+
[...schemaPath, system.ui?.path !== undefined ? 'ui' : 'path'],
|
|
3151
|
+
`System "${path}" effective path "${effectivePath}" duplicates system "${existingSystemId}"`
|
|
3152
|
+
)
|
|
3153
|
+
} else {
|
|
3154
|
+
systemIdsByEffectivePath.set(effectivePath, path)
|
|
3155
|
+
}
|
|
3156
|
+
}
|
|
3157
|
+
|
|
3158
|
+
if (hasChildren && isLifecycleEnabled(system.lifecycle, system.enabled)) {
|
|
3159
|
+
const hasEnabledDescendant =
|
|
3160
|
+
Object.values(system.systems ?? system.subsystems ?? {}).some((candidate) =>
|
|
3161
|
+
isLifecycleEnabled(candidate.lifecycle, candidate.enabled)
|
|
3162
|
+
) ||
|
|
3163
|
+
allSystems.some(
|
|
3164
|
+
(candidate) =>
|
|
3165
|
+
candidate.path.startsWith(`${path}.`) &&
|
|
3166
|
+
!candidate.path.slice(path.length + 1).includes('.') &&
|
|
3167
|
+
isLifecycleEnabled(candidate.system.lifecycle, candidate.system.enabled)
|
|
3168
|
+
)
|
|
3169
|
+
if (!hasEnabledDescendant) {
|
|
3170
|
+
addIssue(ctx, [...schemaPath, 'lifecycle'], `System "${path}" is active but has no active descendants`)
|
|
3171
|
+
}
|
|
3172
|
+
}
|
|
3173
|
+
})
|
|
3174
|
+
|
|
3175
|
+
allSystems.forEach(({ schemaPath, system }) => {
|
|
3176
|
+
const visited = new Set<string>()
|
|
3177
|
+
let currentParentId = system.parentSystemId
|
|
3178
|
+
|
|
3179
|
+
while (currentParentId !== undefined) {
|
|
3180
|
+
if (currentParentId === system.id || visited.has(currentParentId)) {
|
|
3181
|
+
addIssue(ctx, [...schemaPath, 'parentSystemId'], `System "${system.id}" has a parent cycle`)
|
|
3182
|
+
return
|
|
3183
|
+
}
|
|
3184
|
+
|
|
3185
|
+
visited.add(currentParentId)
|
|
3186
|
+
currentParentId = systemsById.get(currentParentId)?.parentSystemId
|
|
3187
|
+
}
|
|
3188
|
+
})
|
|
3189
|
+
|
|
3190
|
+
type CollectedSidebarSurface = {
|
|
3191
|
+
id: string
|
|
3192
|
+
node: Extract<SidebarNode, { type: 'surface' }>
|
|
3193
|
+
path: Array<string | number>
|
|
3194
|
+
}
|
|
3195
|
+
|
|
3196
|
+
function normalizeRoutePath(path: string): string {
|
|
3197
|
+
return path.length > 1 ? path.replace(/\/+$/, '') : path
|
|
3198
|
+
}
|
|
3199
|
+
|
|
3200
|
+
const sidebarNodeIds = new Map<string, Array<string | number>>()
|
|
3201
|
+
const sidebarSurfacePaths = new Map<string, string>()
|
|
3202
|
+
const sidebarSurfaces: CollectedSidebarSurface[] = []
|
|
3203
|
+
|
|
3204
|
+
function collectSidebarNodes(nodes: Record<string, SidebarNode>, schemaPath: Array<string | number>): void {
|
|
3205
|
+
Object.entries(nodes).forEach(([nodeId, node]) => {
|
|
3206
|
+
const nodePath = [...schemaPath, nodeId]
|
|
3207
|
+
const existingNodePath = sidebarNodeIds.get(nodeId)
|
|
3208
|
+
if (existingNodePath !== undefined) {
|
|
3209
|
+
addIssue(ctx, nodePath, `Sidebar node id "${nodeId}" duplicates another sidebar node`)
|
|
3210
|
+
} else {
|
|
3211
|
+
sidebarNodeIds.set(nodeId, nodePath)
|
|
3212
|
+
}
|
|
3213
|
+
|
|
3214
|
+
if (node.type === 'group') {
|
|
3215
|
+
collectSidebarNodes(node.children, [...nodePath, 'children'])
|
|
3216
|
+
return
|
|
3217
|
+
}
|
|
3218
|
+
|
|
3219
|
+
sidebarSurfaces.push({ id: nodeId, node, path: nodePath })
|
|
3220
|
+
const normalizedPath = normalizeRoutePath(node.path)
|
|
3221
|
+
const existingSurfaceId = sidebarSurfacePaths.get(normalizedPath)
|
|
3222
|
+
if (existingSurfaceId !== undefined) {
|
|
3223
|
+
addIssue(
|
|
3224
|
+
ctx,
|
|
3225
|
+
[...nodePath, 'path'],
|
|
3226
|
+
`Sidebar surface path "${node.path}" duplicates surface "${existingSurfaceId}"`
|
|
3227
|
+
)
|
|
3228
|
+
} else {
|
|
3229
|
+
sidebarSurfacePaths.set(normalizedPath, nodeId)
|
|
3230
|
+
}
|
|
3231
|
+
|
|
3232
|
+
node.targets?.systems?.forEach((systemId, systemIndex) => {
|
|
3233
|
+
if (!systemsById.has(systemId)) {
|
|
3234
|
+
addIssue(
|
|
3235
|
+
ctx,
|
|
3236
|
+
[...nodePath, 'targets', 'systems', systemIndex],
|
|
3237
|
+
`Sidebar surface "${nodeId}" references unknown system "${systemId}"`
|
|
3238
|
+
)
|
|
3239
|
+
}
|
|
3240
|
+
})
|
|
3241
|
+
})
|
|
3242
|
+
}
|
|
3243
|
+
|
|
3244
|
+
collectSidebarNodes(model.navigation.sidebar.primary, ['navigation', 'sidebar', 'primary'])
|
|
3245
|
+
collectSidebarNodes(model.navigation.sidebar.bottom, ['navigation', 'sidebar', 'bottom'])
|
|
3246
|
+
|
|
3247
|
+
// Offerings -> CustomerSegment cross-ref: targetSegmentIds must resolve
|
|
3248
|
+
const segmentsById = new Map(Object.entries(model.customers))
|
|
3249
|
+
Object.values(model.offerings).forEach((product) => {
|
|
3250
|
+
product.targetSegmentIds.forEach((segmentId, segmentIndex) => {
|
|
3251
|
+
if (!segmentsById.has(segmentId)) {
|
|
3252
|
+
addIssue(
|
|
3253
|
+
ctx,
|
|
3254
|
+
['offerings', product.id, 'targetSegmentIds', segmentIndex],
|
|
3255
|
+
`Product "${product.id}" references unknown customer segment "${segmentId}"`
|
|
3256
|
+
)
|
|
3257
|
+
}
|
|
3258
|
+
})
|
|
3259
|
+
|
|
3260
|
+
// Offerings -> System cross-ref: deliveryFeatureId must resolve (when present)
|
|
3261
|
+
if (product.deliveryFeatureId !== undefined && !systemsById.has(product.deliveryFeatureId)) {
|
|
3262
|
+
addIssue(
|
|
3263
|
+
ctx,
|
|
3264
|
+
['offerings', product.id, 'deliveryFeatureId'],
|
|
3265
|
+
`Product "${product.id}" references unknown delivery system "${product.deliveryFeatureId}"`
|
|
3266
|
+
)
|
|
3267
|
+
}
|
|
3268
|
+
})
|
|
3269
|
+
|
|
3270
|
+
// Goals -> period-range validation: periodEnd must be strictly after periodStart
|
|
3271
|
+
Object.values(model.goals).forEach((objective) => {
|
|
3272
|
+
if (objective.periodEnd <= objective.periodStart) {
|
|
3273
|
+
addIssue(
|
|
3274
|
+
ctx,
|
|
3275
|
+
['goals', objective.id, 'periodEnd'],
|
|
3276
|
+
`Goal "${objective.id}" has periodEnd "${objective.periodEnd}" which must be strictly after periodStart "${objective.periodStart}"`
|
|
3277
|
+
)
|
|
3278
|
+
}
|
|
3279
|
+
})
|
|
3280
|
+
|
|
3281
|
+
const goalsById = new Map(Object.entries(model.goals))
|
|
3282
|
+
// Phase 4: knowledge is now a flat Record<id, OrgKnowledgeNode> — no .nodes array
|
|
3283
|
+
const knowledgeById = new Map(Object.entries(model.knowledge))
|
|
3284
|
+
const actionsById = new Map(Object.entries(model.actions))
|
|
3285
|
+
const entitiesById = new Map(Object.entries(model.entities))
|
|
3286
|
+
const policiesById = new Map(Object.entries(model.policies))
|
|
3287
|
+
|
|
3288
|
+
sidebarSurfaces.forEach(({ id, node, path }) => {
|
|
3289
|
+
node.targets?.entities?.forEach((entityId, entityIndex) => {
|
|
3290
|
+
if (!entitiesById.has(entityId)) {
|
|
3291
|
+
addIssue(
|
|
3292
|
+
ctx,
|
|
3293
|
+
[...path, 'targets', 'entities', entityIndex],
|
|
3294
|
+
`Sidebar surface "${id}" references unknown entity "${entityId}"`
|
|
3295
|
+
)
|
|
3296
|
+
}
|
|
3297
|
+
})
|
|
3298
|
+
|
|
3299
|
+
node.targets?.actions?.forEach((actionId, actionIndex) => {
|
|
3300
|
+
if (!actionsById.has(actionId)) {
|
|
3301
|
+
addIssue(
|
|
3302
|
+
ctx,
|
|
3303
|
+
[...path, 'targets', 'actions', actionIndex],
|
|
3304
|
+
`Sidebar surface "${id}" references unknown action "${actionId}"`
|
|
3305
|
+
)
|
|
3306
|
+
}
|
|
3307
|
+
})
|
|
3308
|
+
})
|
|
3309
|
+
|
|
3310
|
+
Object.values(model.entities).forEach((entity) => {
|
|
3311
|
+
if (!systemsById.has(entity.ownedBySystemId)) {
|
|
3312
|
+
addIssue(
|
|
3313
|
+
ctx,
|
|
3314
|
+
['entities', entity.id, 'ownedBySystemId'],
|
|
3315
|
+
`Entity "${entity.id}" references unknown ownedBySystemId "${entity.ownedBySystemId}"`
|
|
3316
|
+
)
|
|
3317
|
+
}
|
|
3318
|
+
|
|
3319
|
+
entity.links?.forEach((link, linkIndex) => {
|
|
3320
|
+
if (!entitiesById.has(link.toEntity)) {
|
|
3321
|
+
addIssue(
|
|
3322
|
+
ctx,
|
|
3323
|
+
['entities', entity.id, 'links', linkIndex, 'toEntity'],
|
|
3324
|
+
`Entity "${entity.id}" links to unknown entity "${link.toEntity}"`
|
|
3325
|
+
)
|
|
3326
|
+
}
|
|
3327
|
+
})
|
|
3328
|
+
})
|
|
3329
|
+
|
|
3330
|
+
// Roles -> reportsToId cross-ref: each reportsToId must resolve to another role in the same collection
|
|
3331
|
+
const rolesById = new Map(Object.entries(model.roles))
|
|
3332
|
+
Object.values(model.roles).forEach((role) => {
|
|
3333
|
+
if (role.reportsToId !== undefined && !rolesById.has(role.reportsToId)) {
|
|
3334
|
+
addIssue(
|
|
3335
|
+
ctx,
|
|
3336
|
+
['roles', role.id, 'reportsToId'],
|
|
3337
|
+
`Role "${role.id}" references unknown reportsToId "${role.reportsToId}"`
|
|
3338
|
+
)
|
|
3339
|
+
}
|
|
3340
|
+
})
|
|
3341
|
+
|
|
3342
|
+
Object.values(model.roles).forEach((role) => {
|
|
3343
|
+
const visited = new Set<string>()
|
|
3344
|
+
let currentReportsToId = role.reportsToId
|
|
3345
|
+
|
|
3346
|
+
while (currentReportsToId !== undefined) {
|
|
3347
|
+
if (currentReportsToId === role.id || visited.has(currentReportsToId)) {
|
|
3348
|
+
addIssue(ctx, ['roles', role.id, 'reportsToId'], `Role "${role.id}" has a reportsToId cycle`)
|
|
3349
|
+
return
|
|
3350
|
+
}
|
|
3351
|
+
|
|
3352
|
+
visited.add(currentReportsToId)
|
|
3353
|
+
currentReportsToId = rolesById.get(currentReportsToId)?.reportsToId
|
|
3354
|
+
}
|
|
3355
|
+
})
|
|
3356
|
+
|
|
3357
|
+
Object.values(model.roles).forEach((role) => {
|
|
3358
|
+
role.responsibleFor?.forEach((systemId, systemIndex) => {
|
|
3359
|
+
if (!systemsById.has(systemId)) {
|
|
3360
|
+
addIssue(
|
|
3361
|
+
ctx,
|
|
3362
|
+
['roles', role.id, 'responsibleFor', systemIndex],
|
|
3363
|
+
`Role "${role.id}" references unknown responsibleFor system "${systemId}"`
|
|
3364
|
+
)
|
|
3365
|
+
}
|
|
3366
|
+
})
|
|
3367
|
+
})
|
|
3368
|
+
|
|
3369
|
+
allSystems.forEach(({ schemaPath, system }) => {
|
|
3370
|
+
if (system.responsibleRoleId !== undefined && !rolesById.has(system.responsibleRoleId)) {
|
|
3371
|
+
addIssue(
|
|
3372
|
+
ctx,
|
|
3373
|
+
[...schemaPath, 'responsibleRoleId'],
|
|
3374
|
+
`System "${system.id}" references unknown responsibleRoleId "${system.responsibleRoleId}"`
|
|
3375
|
+
)
|
|
3376
|
+
}
|
|
3377
|
+
|
|
3378
|
+
system.governedByKnowledge?.forEach((nodeId, nodeIndex) => {
|
|
3379
|
+
if (!knowledgeById.has(nodeId)) {
|
|
3380
|
+
addIssue(
|
|
3381
|
+
ctx,
|
|
3382
|
+
[...schemaPath, 'governedByKnowledge', nodeIndex],
|
|
3383
|
+
`System "${system.id}" references unknown knowledge node "${nodeId}"`
|
|
3384
|
+
)
|
|
3385
|
+
}
|
|
3386
|
+
})
|
|
3387
|
+
|
|
3388
|
+
system.drivesGoals?.forEach((goalId, goalIndex) => {
|
|
3389
|
+
if (!goalsById.has(goalId)) {
|
|
3390
|
+
addIssue(
|
|
3391
|
+
ctx,
|
|
3392
|
+
[...schemaPath, 'drivesGoals', goalIndex],
|
|
3393
|
+
`System "${system.id}" references unknown goal "${goalId}"`
|
|
3394
|
+
)
|
|
3395
|
+
}
|
|
3396
|
+
})
|
|
3397
|
+
|
|
3398
|
+
system.actions?.forEach((actionRef, actionIndex) => {
|
|
3399
|
+
if (!actionsById.has(actionRef.actionId)) {
|
|
3400
|
+
addIssue(
|
|
3401
|
+
ctx,
|
|
3402
|
+
[...schemaPath, 'actions', actionIndex, 'actionId'],
|
|
3403
|
+
`System "${system.id}" references unknown action "${actionRef.actionId}"`
|
|
3404
|
+
)
|
|
3405
|
+
}
|
|
3406
|
+
})
|
|
3407
|
+
|
|
3408
|
+
system.policies?.forEach((policyId, policyIndex) => {
|
|
3409
|
+
if (!policiesById.has(policyId)) {
|
|
3410
|
+
addIssue(
|
|
3411
|
+
ctx,
|
|
3412
|
+
[...schemaPath, 'policies', policyIndex],
|
|
3413
|
+
`System "${system.id}" references unknown policy "${policyId}"`
|
|
3414
|
+
)
|
|
3415
|
+
}
|
|
3416
|
+
})
|
|
3417
|
+
})
|
|
3418
|
+
|
|
3419
|
+
Object.values(model.actions).forEach((action) => {
|
|
3420
|
+
action.affects?.forEach((entityId, entityIndex) => {
|
|
3421
|
+
if (!entitiesById.has(entityId)) {
|
|
3422
|
+
addIssue(
|
|
3423
|
+
ctx,
|
|
3424
|
+
['actions', action.id, 'affects', entityIndex],
|
|
3425
|
+
`Action "${action.id}" affects unknown entity "${entityId}"`
|
|
3426
|
+
)
|
|
3427
|
+
}
|
|
3428
|
+
})
|
|
3429
|
+
})
|
|
3430
|
+
|
|
3431
|
+
// Phase 4: sales / prospecting / projects compound-domain entity cross-ref checks removed.
|
|
3432
|
+
// Those entity bindings now live in System.ontology catalog scopes.
|
|
3433
|
+
|
|
3434
|
+
const resourcesById = new Map(Object.entries(model.resources))
|
|
3435
|
+
sidebarSurfaces.forEach(({ id, node, path }) => {
|
|
3436
|
+
node.targets?.resources?.forEach((resourceId, resourceIndex) => {
|
|
3437
|
+
if (!resourcesById.has(resourceId)) {
|
|
3438
|
+
addIssue(
|
|
3439
|
+
ctx,
|
|
3440
|
+
[...path, 'targets', 'resources', resourceIndex],
|
|
3441
|
+
`Sidebar surface "${id}" references unknown resource "${resourceId}"`
|
|
3442
|
+
)
|
|
3443
|
+
}
|
|
3444
|
+
})
|
|
3445
|
+
})
|
|
3446
|
+
const actionIds = new Set(Object.keys(model.actions))
|
|
3447
|
+
const offeringsById = new Map(Object.entries(model.offerings))
|
|
3448
|
+
const ontologyCompilation = compileOrganizationOntology(model)
|
|
3449
|
+
const stageIds = new Set<string>()
|
|
3450
|
+
for (const catalog of Object.values(ontologyCompilation.ontology.catalogTypes)) {
|
|
3451
|
+
if (catalog.kind !== 'stage') continue
|
|
3452
|
+
for (const stageId of Object.keys(catalog.entries ?? {})) {
|
|
3453
|
+
stageIds.add(stageId)
|
|
3454
|
+
}
|
|
3455
|
+
}
|
|
3456
|
+
const ontologyIndexByKind = {
|
|
3457
|
+
object: ontologyCompilation.ontology.objectTypes,
|
|
3458
|
+
link: ontologyCompilation.ontology.linkTypes,
|
|
3459
|
+
action: ontologyCompilation.ontology.actionTypes,
|
|
3460
|
+
catalog: ontologyCompilation.ontology.catalogTypes,
|
|
3461
|
+
event: ontologyCompilation.ontology.eventTypes,
|
|
3462
|
+
interface: ontologyCompilation.ontology.interfaceTypes,
|
|
3463
|
+
'value-type': ontologyCompilation.ontology.valueTypes,
|
|
3464
|
+
property: ontologyCompilation.ontology.sharedProperties,
|
|
3465
|
+
group: ontologyCompilation.ontology.groups,
|
|
3466
|
+
surface: ontologyCompilation.ontology.surfaces
|
|
3467
|
+
} satisfies Record<OntologyKind, Record<string, unknown>>
|
|
3468
|
+
const ontologyIds = new Set(Object.values(ontologyIndexByKind).flatMap((index) => Object.keys(index)))
|
|
3469
|
+
|
|
3470
|
+
function topologyTargetExists(ref: OmTopologyNodeRef): boolean {
|
|
3471
|
+
if (ref.kind === 'system') return systemsById.has(ref.id)
|
|
3472
|
+
if (ref.kind === 'resource') return resourcesById.has(ref.id)
|
|
3473
|
+
if (ref.kind === 'ontology') return ontologyIds.has(ref.id)
|
|
3474
|
+
if (ref.kind === 'policy') return policiesById.has(ref.id)
|
|
3475
|
+
if (ref.kind === 'role') return rolesById.has(ref.id)
|
|
3476
|
+
|
|
3477
|
+
// Trigger, human checkpoint, and external resource refs are projected
|
|
3478
|
+
// topology nodes during the bridge period; their owning runtime indexes are
|
|
3479
|
+
// validated by deployment projection in later waves.
|
|
3480
|
+
return true
|
|
3481
|
+
}
|
|
3482
|
+
|
|
3483
|
+
Object.entries(model.topology.relationships).forEach(([relationshipId, relationship]) => {
|
|
3484
|
+
;(['from', 'to'] as const).forEach((side) => {
|
|
3485
|
+
const ref = relationship[side]
|
|
3486
|
+
if (topologyTargetExists(ref)) return
|
|
3487
|
+
|
|
3488
|
+
addIssue(
|
|
3489
|
+
ctx,
|
|
3490
|
+
['topology', 'relationships', relationshipId, side],
|
|
3491
|
+
`Topology relationship "${relationshipId}" ${side} references unknown ${ref.kind} "${ref.id}"`
|
|
3492
|
+
)
|
|
3493
|
+
})
|
|
3494
|
+
})
|
|
3495
|
+
|
|
3496
|
+
const ontologyReferenceKeyKinds = {
|
|
3497
|
+
valueType: 'value-type',
|
|
3498
|
+
catalogType: 'catalog',
|
|
3499
|
+
objectType: 'object',
|
|
3500
|
+
eventType: 'event',
|
|
3501
|
+
actionType: 'action',
|
|
3502
|
+
linkType: 'link',
|
|
3503
|
+
interfaceType: 'interface',
|
|
3504
|
+
propertyType: 'property',
|
|
3505
|
+
groupType: 'group',
|
|
3506
|
+
surfaceType: 'surface',
|
|
3507
|
+
stepCatalog: 'catalog'
|
|
3508
|
+
} satisfies Record<string, OntologyKind>
|
|
3509
|
+
|
|
3510
|
+
function validateKnownOntologyReferences(
|
|
3511
|
+
ownerId: string,
|
|
3512
|
+
value: unknown,
|
|
3513
|
+
path: Array<string | number>,
|
|
3514
|
+
seen = new WeakSet<object>()
|
|
3515
|
+
): void {
|
|
3516
|
+
if (Array.isArray(value)) {
|
|
3517
|
+
value.forEach((entry, index) => validateKnownOntologyReferences(ownerId, entry, [...path, index], seen))
|
|
3518
|
+
return
|
|
3519
|
+
}
|
|
3520
|
+
|
|
3521
|
+
if (!isRecord(value)) return
|
|
3522
|
+
if (seen.has(value)) return
|
|
3523
|
+
seen.add(value)
|
|
3524
|
+
|
|
3525
|
+
Object.entries(value).forEach(([key, entry]) => {
|
|
3526
|
+
const expectedKind = ontologyReferenceKeyKinds[key as keyof typeof ontologyReferenceKeyKinds]
|
|
3527
|
+
if (expectedKind !== undefined) {
|
|
3528
|
+
if (typeof entry !== 'string') {
|
|
3529
|
+
addIssue(ctx, [...path, key], `Ontology record "${ownerId}" ${key} must be an ontology ID string`)
|
|
3530
|
+
} else if (ontologyIndexByKind[expectedKind][entry] === undefined) {
|
|
3531
|
+
addIssue(
|
|
3532
|
+
ctx,
|
|
3533
|
+
[...path, key],
|
|
3534
|
+
`Ontology record "${ownerId}" ${key} references unknown ${expectedKind} ontology ID "${entry}"`
|
|
3535
|
+
)
|
|
3536
|
+
}
|
|
3537
|
+
}
|
|
3538
|
+
|
|
3539
|
+
validateKnownOntologyReferences(ownerId, entry, [...path, key], seen)
|
|
3540
|
+
})
|
|
3541
|
+
}
|
|
3542
|
+
|
|
3543
|
+
for (const { id, record } of listResolvedOntologyRecords(ontologyCompilation.ontology)) {
|
|
3544
|
+
validateKnownOntologyReferences(id, record, record.origin.path)
|
|
3545
|
+
}
|
|
3546
|
+
|
|
3547
|
+
Object.values(model.policies).forEach((policy) => {
|
|
3548
|
+
policy.appliesTo.systemIds.forEach((systemId, systemIndex) => {
|
|
3549
|
+
if (!systemsById.has(systemId)) {
|
|
3550
|
+
addIssue(
|
|
3551
|
+
ctx,
|
|
3552
|
+
['policies', policy.id, 'appliesTo', 'systemIds', systemIndex],
|
|
3553
|
+
`Policy "${policy.id}" applies to unknown system "${systemId}"`
|
|
3554
|
+
)
|
|
3555
|
+
}
|
|
3556
|
+
})
|
|
3557
|
+
|
|
3558
|
+
policy.appliesTo.actionIds.forEach((actionId, actionIndex) => {
|
|
3559
|
+
if (!actionsById.has(actionId)) {
|
|
3560
|
+
addIssue(
|
|
3561
|
+
ctx,
|
|
3562
|
+
['policies', policy.id, 'appliesTo', 'actionIds', actionIndex],
|
|
3563
|
+
`Policy "${policy.id}" applies to unknown action "${actionId}"`
|
|
3564
|
+
)
|
|
3565
|
+
}
|
|
3566
|
+
})
|
|
3567
|
+
|
|
3568
|
+
policy.actions.forEach((action, actionIndex) => {
|
|
3569
|
+
if (action.kind === 'invoke-action' && !actionsById.has(action.actionId)) {
|
|
3570
|
+
addIssue(
|
|
3571
|
+
ctx,
|
|
3572
|
+
['policies', policy.id, 'actions', actionIndex, 'actionId'],
|
|
3573
|
+
`Policy "${policy.id}" invokes unknown action "${action.actionId}"`
|
|
3574
|
+
)
|
|
3575
|
+
}
|
|
3576
|
+
if (
|
|
3577
|
+
(action.kind === 'notify-role' || action.kind === 'require-approval') &&
|
|
3578
|
+
action.roleId !== undefined &&
|
|
3579
|
+
!rolesById.has(action.roleId)
|
|
3580
|
+
) {
|
|
3581
|
+
addIssue(
|
|
3582
|
+
ctx,
|
|
3583
|
+
['policies', policy.id, 'actions', actionIndex, 'roleId'],
|
|
3584
|
+
`Policy "${policy.id}" references unknown role "${action.roleId}"`
|
|
3585
|
+
)
|
|
3586
|
+
}
|
|
3587
|
+
})
|
|
3588
|
+
|
|
3589
|
+
if (policy.trigger.kind === 'action-invocation' && !actionsById.has(policy.trigger.actionId)) {
|
|
3590
|
+
addIssue(
|
|
3591
|
+
ctx,
|
|
3592
|
+
['policies', policy.id, 'trigger', 'actionId'],
|
|
3593
|
+
`Policy "${policy.id}" references unknown trigger action "${policy.trigger.actionId}"`
|
|
3594
|
+
)
|
|
3595
|
+
}
|
|
3596
|
+
})
|
|
3597
|
+
|
|
3598
|
+
function knowledgeTargetExists(kind: string, id: string): boolean {
|
|
3599
|
+
if (kind === 'system') return systemsById.has(id)
|
|
3600
|
+
if (kind === 'resource') return resourcesById.has(id)
|
|
3601
|
+
if (kind === 'knowledge') return knowledgeById.has(id)
|
|
3602
|
+
if (kind === 'stage') return stageIds.has(id)
|
|
3603
|
+
if (kind === 'action') return actionIds.has(id)
|
|
3604
|
+
if (kind === 'role') return rolesById.has(id)
|
|
3605
|
+
if (kind === 'goal') return goalsById.has(id)
|
|
3606
|
+
if (kind === 'customer-segment') return segmentsById.has(id)
|
|
3607
|
+
if (kind === 'offering') return offeringsById.has(id)
|
|
3608
|
+
if (kind === 'ontology') return ontologyIds.has(id)
|
|
3609
|
+
return false
|
|
3610
|
+
}
|
|
3611
|
+
|
|
3612
|
+
// Phase 4: model.knowledge is now Record<id, OrgKnowledgeNode> — iterate Object.values
|
|
3613
|
+
Object.entries(model.knowledge).forEach(([nodeId, node]) => {
|
|
3614
|
+
node.links.forEach((link, linkIndex) => {
|
|
3615
|
+
if (!knowledgeTargetExists(link.target.kind, link.target.id)) {
|
|
3616
|
+
addIssue(
|
|
3617
|
+
ctx,
|
|
3618
|
+
['knowledge', nodeId, 'links', linkIndex, 'target'],
|
|
3619
|
+
`Knowledge node "${node.id}" references unknown ${link.target.kind} target "${link.target.id}"`
|
|
3620
|
+
)
|
|
3621
|
+
}
|
|
3622
|
+
|
|
3623
|
+
if (!isKnowledgeKindCompatibleWithTarget(node.kind, link.target.kind)) {
|
|
3624
|
+
addIssue(
|
|
3625
|
+
ctx,
|
|
3626
|
+
['knowledge', nodeId, 'links', linkIndex, 'target', 'kind'],
|
|
3627
|
+
`Knowledge node "${node.id}" kind "${node.kind}" cannot govern ${link.target.kind} targets`
|
|
3628
|
+
)
|
|
3629
|
+
}
|
|
3630
|
+
|
|
3631
|
+
// `governedByKnowledge` is validated one-way on target nodes above. Knowledge
|
|
3632
|
+
// links may be authored first and remain valid as forward references.
|
|
3633
|
+
})
|
|
3634
|
+
})
|
|
3635
|
+
|
|
3636
|
+
Object.values(model.resources).forEach((resource) => {
|
|
3637
|
+
if (!systemsById.has(resource.systemPath)) {
|
|
3638
|
+
addIssue(
|
|
3639
|
+
ctx,
|
|
3640
|
+
['resources', resource.id, 'systemPath'],
|
|
3641
|
+
`Resource "${resource.id}" references unknown system path "${resource.systemPath}"`
|
|
3642
|
+
)
|
|
3643
|
+
}
|
|
3644
|
+
|
|
3645
|
+
if (resource.ownerRoleId !== undefined && !rolesById.has(resource.ownerRoleId)) {
|
|
3646
|
+
addIssue(
|
|
3647
|
+
ctx,
|
|
3648
|
+
['resources', resource.id, 'ownerRoleId'],
|
|
3649
|
+
`Resource "${resource.id}" references unknown ownerRoleId "${resource.ownerRoleId}"`
|
|
3650
|
+
)
|
|
3651
|
+
}
|
|
3652
|
+
|
|
3653
|
+
if (resource.kind === 'agent' && resource.actsAsRoleId !== undefined && !rolesById.has(resource.actsAsRoleId)) {
|
|
3654
|
+
addIssue(
|
|
3655
|
+
ctx,
|
|
3656
|
+
['resources', resource.id, 'actsAsRoleId'],
|
|
3657
|
+
`Agent resource "${resource.id}" references unknown actsAsRoleId "${resource.actsAsRoleId}"`
|
|
3658
|
+
)
|
|
3659
|
+
}
|
|
3660
|
+
})
|
|
3661
|
+
|
|
3662
|
+
function validateResourceOntologyBinding(
|
|
3663
|
+
resourceId: string,
|
|
3664
|
+
bindingKey: 'actions' | 'primaryAction' | 'reads' | 'writes' | 'usesCatalogs' | 'emits',
|
|
3665
|
+
expectedKind: OntologyKind,
|
|
3666
|
+
ids: string[] | string | undefined
|
|
3667
|
+
): void {
|
|
3668
|
+
const ontologyIds = ids === undefined ? [] : Array.isArray(ids) ? ids : [ids]
|
|
3669
|
+
|
|
3670
|
+
ontologyIds.forEach((ontologyId, ontologyIndex) => {
|
|
3671
|
+
if (ontologyIndexByKind[expectedKind][ontologyId] === undefined) {
|
|
3672
|
+
addIssue(
|
|
3673
|
+
ctx,
|
|
3674
|
+
['resources', resourceId, 'ontology', bindingKey, ...(Array.isArray(ids) ? [ontologyIndex] : [])],
|
|
3675
|
+
`Resource "${resourceId}" ontology binding "${bindingKey}" references unknown ${expectedKind} ontology ID "${ontologyId}"`
|
|
3676
|
+
)
|
|
3677
|
+
}
|
|
3678
|
+
})
|
|
3679
|
+
}
|
|
3680
|
+
|
|
3681
|
+
Object.values(model.resources).forEach((resource) => {
|
|
3682
|
+
const binding = resource.ontology
|
|
3683
|
+
if (binding === undefined) return
|
|
3684
|
+
|
|
3685
|
+
validateResourceOntologyBinding(resource.id, 'actions', 'action', binding.actions)
|
|
3686
|
+
validateResourceOntologyBinding(resource.id, 'primaryAction', 'action', binding.primaryAction)
|
|
3687
|
+
validateResourceOntologyBinding(resource.id, 'reads', 'object', binding.reads)
|
|
3688
|
+
validateResourceOntologyBinding(resource.id, 'writes', 'object', binding.writes)
|
|
3689
|
+
validateResourceOntologyBinding(resource.id, 'usesCatalogs', 'catalog', binding.usesCatalogs)
|
|
3690
|
+
validateResourceOntologyBinding(resource.id, 'emits', 'event', binding.emits)
|
|
3691
|
+
|
|
3692
|
+
// Tier-1: validate contract ref SHAPE only — no module resolution (browser-safe).
|
|
3693
|
+
// Tier-2 intra-package resolution runs in om:verify (packages/cli/src/knowledge/verify.ts).
|
|
3694
|
+
if (binding.contract !== undefined) {
|
|
3695
|
+
const contractEntries = [
|
|
3696
|
+
['input', binding.contract.input],
|
|
3697
|
+
['output', binding.contract.output]
|
|
3698
|
+
] as const
|
|
3699
|
+
for (const [side, ref] of contractEntries) {
|
|
3700
|
+
if (ref === undefined) continue
|
|
3701
|
+
const result = ContractRefSchema.safeParse(ref)
|
|
3702
|
+
if (!result.success) {
|
|
3703
|
+
addIssue(
|
|
3704
|
+
ctx,
|
|
3705
|
+
['resources', resource.id, 'ontology', 'contract', side],
|
|
3706
|
+
`Resource "${resource.id}" contract.${side} "${ref}" is not a valid ContractRef (expected "package/subpath#ExportName")`
|
|
3707
|
+
)
|
|
3708
|
+
}
|
|
3709
|
+
}
|
|
3710
|
+
}
|
|
3711
|
+
})
|
|
3712
|
+
|
|
3713
|
+
Object.values(model.roles).forEach((role) => {
|
|
3714
|
+
if (role.heldBy === undefined) return
|
|
3715
|
+
|
|
3716
|
+
asRoleHolderArray(role.heldBy).forEach((holder, holderIndex) => {
|
|
3717
|
+
if (holder.kind !== 'agent') return
|
|
3718
|
+
|
|
3719
|
+
const resource = resourcesById.get(holder.agentId)
|
|
3720
|
+
if (resource === undefined) {
|
|
3721
|
+
addIssue(
|
|
3722
|
+
ctx,
|
|
3723
|
+
['roles', role.id, 'heldBy', Array.isArray(role.heldBy) ? holderIndex : 'agentId'],
|
|
3724
|
+
`Role "${role.id}" references unknown agent holder resource "${holder.agentId}"`
|
|
3725
|
+
)
|
|
3726
|
+
return
|
|
3727
|
+
}
|
|
3728
|
+
|
|
3729
|
+
if (resource.kind !== 'agent') {
|
|
3730
|
+
addIssue(
|
|
3731
|
+
ctx,
|
|
3732
|
+
['roles', role.id, 'heldBy', Array.isArray(role.heldBy) ? holderIndex : 'agentId'],
|
|
3733
|
+
`Role "${role.id}" agent holder "${holder.agentId}" must reference an agent resource`
|
|
3734
|
+
)
|
|
3735
|
+
}
|
|
3736
|
+
})
|
|
3737
|
+
})
|
|
3738
|
+
|
|
3739
|
+
// Phase 4: model.knowledge is now Record<id, OrgKnowledgeNode>
|
|
3740
|
+
Object.entries(model.knowledge).forEach(([nodeId, node]) => {
|
|
3741
|
+
node.ownerIds.forEach((roleId, ownerIndex) => {
|
|
3742
|
+
if (!rolesById.has(roleId)) {
|
|
3743
|
+
addIssue(
|
|
3744
|
+
ctx,
|
|
3745
|
+
['knowledge', nodeId, 'ownerIds', ownerIndex],
|
|
3746
|
+
`Knowledge node "${node.id}" references unknown owner role "${roleId}"`
|
|
3747
|
+
)
|
|
3748
|
+
}
|
|
3749
|
+
})
|
|
3750
|
+
})
|
|
3751
|
+
|
|
3752
|
+
for (const diagnostic of ontologyCompilation.diagnostics) {
|
|
3753
|
+
addIssue(ctx, diagnostic.path, diagnostic.message)
|
|
3754
|
+
}
|
|
3755
|
+
})
|
|
3756
|
+
|
|
3757
|
+
type OrganizationModel = z.infer<typeof OrganizationModelSchema>
|
|
3758
|
+
type OrganizationModelResourceOntologyBinding = z.infer<typeof ResourceOntologyBindingSchema>
|
|
3759
|
+
type OrganizationModelWorkflowResourceEntry = z.infer<typeof WorkflowResourceEntrySchema>
|
|
3760
|
+
type OrganizationModelIntegrationResourceEntry = z.infer<typeof IntegrationResourceEntrySchema>
|
|
3761
|
+
|
|
3762
|
+
type ResourceOntologyBindingResolver = (resourceId: string) => OrganizationModelResourceOntologyBinding | undefined;
|
|
3763
|
+
type WorkflowResourceDescriptorResolver = (resourceId: string) => OrganizationModelWorkflowResourceEntry;
|
|
3764
|
+
type IntegrationResourceDescriptorResolver = (resourceId: string) => OrganizationModelIntegrationResourceEntry;
|
|
3765
|
+
interface ProjectDeploymentSpecOptions {
|
|
3766
|
+
version: string;
|
|
3767
|
+
organizationModel: OrganizationModel;
|
|
3768
|
+
workflows: WorkflowDefinition[];
|
|
3769
|
+
integrations?: IntegrationDefinition[];
|
|
3770
|
+
agents?: DeploymentSpec['agents'];
|
|
3771
|
+
triggers?: DeploymentSpec['triggers'];
|
|
3772
|
+
externalResources?: DeploymentSpec['externalResources'];
|
|
3773
|
+
humanCheckpoints?: DeploymentSpec['humanCheckpoints'];
|
|
3774
|
+
getWorkflowResourceDescriptor: WorkflowResourceDescriptorResolver;
|
|
3775
|
+
getIntegrationResourceDescriptor: IntegrationResourceDescriptorResolver;
|
|
3776
|
+
getResourceOntologyBinding?: ResourceOntologyBindingResolver;
|
|
3777
|
+
}
|
|
3778
|
+
declare function toSdkResourceDescriptor<TResource extends {
|
|
3779
|
+
id: string;
|
|
3780
|
+
systemPath: string;
|
|
3781
|
+
}>(resource: TResource, getResourceOntologyBinding?: ResourceOntologyBindingResolver): TResource & Partial<OrganizationModelResourceOntologyBinding> & {
|
|
3782
|
+
systemId: string;
|
|
3783
|
+
};
|
|
3784
|
+
declare function withPlatformResourceDescriptor(workflow: WorkflowDefinition, getWorkflowResourceDescriptor: WorkflowResourceDescriptorResolver, getResourceOntologyBinding?: ResourceOntologyBindingResolver): WorkflowDefinition;
|
|
3785
|
+
declare function withPlatformResourceDescriptors(workflows: WorkflowDefinition[], getWorkflowResourceDescriptor: WorkflowResourceDescriptorResolver, getResourceOntologyBinding?: ResourceOntologyBindingResolver): WorkflowDefinition[];
|
|
3786
|
+
declare function withPlatformIntegrationResourceDescriptor(integration: IntegrationDefinition, getIntegrationResourceDescriptor: IntegrationResourceDescriptorResolver, getResourceOntologyBinding?: ResourceOntologyBindingResolver): IntegrationDefinition;
|
|
3787
|
+
declare function withPlatformIntegrationResourceDescriptors(integrations: IntegrationDefinition[], getIntegrationResourceDescriptor: IntegrationResourceDescriptorResolver, getResourceOntologyBinding?: ResourceOntologyBindingResolver): IntegrationDefinition[];
|
|
3788
|
+
declare function projectTopologyRelationships(model: Pick<OrganizationModel, 'resources' | 'topology'>): ResourceRelationships;
|
|
3789
|
+
declare function projectDeploymentSpec(options: ProjectDeploymentSpecOptions): DeploymentSpec;
|
|
3790
|
+
|
|
3791
|
+
export { generateKnowledgeBodies, generateKnowledgeNodes, generateKnowledgeNodesTs, projectDeploymentSpec, projectTopologyRelationships, readKnowledgeNodeMdx, runKnowledgeCodegen, toSdkResourceDescriptor, withPlatformIntegrationResourceDescriptor, withPlatformIntegrationResourceDescriptors, withPlatformResourceDescriptor, withPlatformResourceDescriptors };
|
|
3792
|
+
export type { CodegenResult, DeploymentSpec, GenerateKnowledgeNodesOptions, GenerateKnowledgeNodesResult, IntegrationDefinition, IntegrationResourceDescriptorResolver, KnowledgeCodegenNode, KnowledgeKind, KnowledgeNodeInput, KnowledgeSearchEntry, ProjectDeploymentSpecOptions, ResolvedKnowledgeLayout, ResourceOntologyBindingResolver, ResourceRelationships, WorkflowDefinition, WorkflowResourceDescriptorResolver };
|