@mdxui/do 4.0.0 → 4.0.8

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.
Files changed (125) hide show
  1. package/dist/app/index.d.ts +32 -186
  2. package/dist/app/index.js +19 -11
  3. package/dist/auth/index.d.ts +48 -0
  4. package/dist/auth/index.js +4 -0
  5. package/dist/{breadcrumbs-C9Qn3S7d.d.ts → breadcrumbs-DltlCiHt.d.ts} +3 -3
  6. package/dist/chunk-2FWXT4HH.js +576 -0
  7. package/dist/chunk-2FWXT4HH.js.map +1 -0
  8. package/dist/chunk-5PC6U46L.js +604 -0
  9. package/dist/chunk-5PC6U46L.js.map +1 -0
  10. package/dist/chunk-63VCRTDQ.js +2505 -0
  11. package/dist/chunk-63VCRTDQ.js.map +1 -0
  12. package/dist/chunk-7J3RSIG4.js +178 -0
  13. package/dist/chunk-7J3RSIG4.js.map +1 -0
  14. package/dist/chunk-7QCTRNEJ.js +173 -0
  15. package/dist/chunk-7QCTRNEJ.js.map +1 -0
  16. package/dist/chunk-7TFHUKS7.js +66 -0
  17. package/dist/chunk-7TFHUKS7.js.map +1 -0
  18. package/dist/{chunk-LJIWB7KE.js → chunk-BU5HMHGQ.js} +3 -3
  19. package/dist/chunk-BU5HMHGQ.js.map +1 -0
  20. package/dist/{chunk-GGO5GW72.js → chunk-BZURBNFD.js} +305 -51
  21. package/dist/chunk-BZURBNFD.js.map +1 -0
  22. package/dist/{chunk-NA652ART.js → chunk-FM2RTAHV.js} +5 -65
  23. package/dist/chunk-FM2RTAHV.js.map +1 -0
  24. package/dist/{chunk-WMNT4OIE.js → chunk-HC4PBXV4.js} +131 -58
  25. package/dist/chunk-HC4PBXV4.js.map +1 -0
  26. package/dist/{chunk-Y52IEYVM.js → chunk-JPZ6RZJE.js} +78 -45
  27. package/dist/chunk-JPZ6RZJE.js.map +1 -0
  28. package/dist/{chunk-OVLO7UOH.js → chunk-KLN5OTQH.js} +168 -361
  29. package/dist/chunk-KLN5OTQH.js.map +1 -0
  30. package/dist/chunk-LCYBQR35.js +79 -0
  31. package/dist/chunk-LCYBQR35.js.map +1 -0
  32. package/dist/chunk-PJYGRD7N.js +216 -0
  33. package/dist/chunk-PJYGRD7N.js.map +1 -0
  34. package/dist/chunk-QEXY4FZV.js +292 -0
  35. package/dist/chunk-QEXY4FZV.js.map +1 -0
  36. package/dist/chunk-SX4IIE2R.js +53 -0
  37. package/dist/chunk-SX4IIE2R.js.map +1 -0
  38. package/dist/chunk-UCWMSKCW.js +901 -0
  39. package/dist/chunk-UCWMSKCW.js.map +1 -0
  40. package/dist/{chunk-5SHZZC7L.js → chunk-WC6SFBAF.js} +59 -6
  41. package/dist/chunk-WC6SFBAF.js.map +1 -0
  42. package/dist/chunk-WIKU77ZY.js +18 -0
  43. package/dist/chunk-WIKU77ZY.js.map +1 -0
  44. package/dist/chunk-X3AWNFBF.js +47 -0
  45. package/dist/chunk-X3AWNFBF.js.map +1 -0
  46. package/dist/chunk-ZZTQGMLX.js +23 -0
  47. package/dist/chunk-ZZTQGMLX.js.map +1 -0
  48. package/dist/{lib → client}/index.d.ts +97 -345
  49. package/dist/client/index.js +3 -0
  50. package/dist/common-DW_JM2dW.d.ts +454 -0
  51. package/dist/components/index.d.ts +11 -2
  52. package/dist/components/index.js +8 -3
  53. package/dist/{config-CxvpD8Y6.d.ts → config-DB14_LhF.d.ts} +1 -1
  54. package/dist/{do-D27i5bU0.d.ts → do-D37hbmL9.d.ts} +6 -14
  55. package/dist/dotdo-client-2DkwXHM2.d.ts +344 -0
  56. package/dist/errors-BOY11CJs.d.ts +373 -0
  57. package/dist/features/data-browser/index.d.ts +51 -0
  58. package/dist/features/data-browser/index.js +12 -0
  59. package/dist/features/data-browser/index.js.map +1 -0
  60. package/dist/features/data-grid/index.d.ts +22 -0
  61. package/dist/features/data-grid/index.js +12 -0
  62. package/dist/features/data-grid/index.js.map +1 -0
  63. package/dist/features/document-editor/index.d.ts +26 -0
  64. package/dist/features/document-editor/index.js +12 -0
  65. package/dist/features/document-editor/index.js.map +1 -0
  66. package/dist/features/function-editor/index.d.ts +215 -0
  67. package/dist/features/function-editor/index.js +7 -0
  68. package/dist/features/function-editor/index.js.map +1 -0
  69. package/dist/hooks/index.d.ts +64 -7
  70. package/dist/hooks/index.js +8 -7
  71. package/dist/hooks/things/index.d.ts +5 -297
  72. package/dist/hooks/things/index.js +6 -6
  73. package/dist/index-C0m9UI6W.d.ts +444 -0
  74. package/dist/index.d.ts +42 -32
  75. package/dist/index.js +21 -13
  76. package/dist/providers/index.d.ts +16 -28
  77. package/dist/providers/index.js +3 -3
  78. package/dist/schemas/index.d.ts +4551 -109
  79. package/dist/schemas/index.js +2 -260
  80. package/dist/schemas/index.js.map +1 -1
  81. package/dist/shell/index.d.ts +92 -0
  82. package/dist/shell/index.js +6 -0
  83. package/dist/shell/index.js.map +1 -0
  84. package/dist/{thing-BF25aUtJ.d.ts → thing-Dc3AE2XI.d.ts} +22 -22
  85. package/dist/thing-adapters-aMjF0h9u.d.ts +1214 -0
  86. package/dist/types/index.d.ts +954 -7521
  87. package/dist/types/index.js +2 -2
  88. package/dist/ui-filters-BvrjMP_U.d.ts +108 -0
  89. package/dist/{errors-DratdVIz.d.ts → utils/index.d.ts} +38 -77
  90. package/dist/utils/index.js +4 -0
  91. package/dist/utils/index.js.map +1 -0
  92. package/dist-app/assets/index-DWX3479M.js +7 -0
  93. package/dist-app/assets/index-DWX3479M.js.map +1 -0
  94. package/dist-app/assets/main-BptePr_C.js +318 -0
  95. package/dist-app/assets/main-BptePr_C.js.map +1 -0
  96. package/dist-app/assets/main-CS9jgKzj.css +1 -0
  97. package/dist-app/index.html +38 -0
  98. package/package.json +32 -19
  99. package/dist/agents-2_r9e9i7.d.ts +0 -1043
  100. package/dist/capnweb-client-Bq78FtEA.d.ts +0 -229
  101. package/dist/chunk-3XKYQRXY.js +0 -192
  102. package/dist/chunk-3XKYQRXY.js.map +0 -1
  103. package/dist/chunk-4KXVN3EQ.js +0 -56
  104. package/dist/chunk-4KXVN3EQ.js.map +0 -1
  105. package/dist/chunk-5SHZZC7L.js.map +0 -1
  106. package/dist/chunk-7UFINK3Q.js +0 -1994
  107. package/dist/chunk-7UFINK3Q.js.map +0 -1
  108. package/dist/chunk-GGO5GW72.js.map +0 -1
  109. package/dist/chunk-JJLAES6W.js +0 -76
  110. package/dist/chunk-JJLAES6W.js.map +0 -1
  111. package/dist/chunk-KT52UU3U.js +0 -985
  112. package/dist/chunk-KT52UU3U.js.map +0 -1
  113. package/dist/chunk-LJIWB7KE.js.map +0 -1
  114. package/dist/chunk-NA652ART.js.map +0 -1
  115. package/dist/chunk-OVLO7UOH.js.map +0 -1
  116. package/dist/chunk-VRLUXCLD.js +0 -31
  117. package/dist/chunk-VRLUXCLD.js.map +0 -1
  118. package/dist/chunk-WMNT4OIE.js.map +0 -1
  119. package/dist/chunk-Y52IEYVM.js.map +0 -1
  120. package/dist/lib/index.js +0 -6
  121. package/dist/query-keys-CZNFikIi.d.ts +0 -153
  122. package/dist/views/index.d.ts +0 -131
  123. package/dist/views/index.js +0 -11
  124. /package/dist/{lib → auth}/index.js.map +0 -0
  125. /package/dist/{views → client}/index.js.map +0 -0
@@ -1,1043 +0,0 @@
1
- import { EntityReference, ExecutionError, TokenUsage } from './schemas/index.js';
2
-
3
- /**
4
- * Relationship Types - Semantic Graph Connections
5
- *
6
- * Relationships form a semantic knowledge graph connecting Things.
7
- * Uses the $.Subject.predicate.Object pattern throughout.
8
- *
9
- * @remarks
10
- * The Relationships table uses MergeTree with ORDER BY (toNs, toId, fromNs, fromId)
11
- * optimized for reverse lookups ("who references me?").
12
- *
13
- * 64+ semantic predicates across categories:
14
- * - Temporal: before, after, during, since, until...
15
- * - Spatial: above, below, near, between, within...
16
- * - Directional: through, toward, from, into, across...
17
- * - Relational: of, about, for, including, regarding...
18
- * - Causal: because, considering, but
19
- */
20
-
21
- /**
22
- * Core relationship record from database
23
- */
24
- interface Relationship {
25
- /** Unique relationship identifier */
26
- relationshipId: string;
27
- /** Semantic predicate type */
28
- relationshipType: SemanticPredicate;
29
- /** Source entity namespace */
30
- fromNs: string;
31
- /** Source entity type */
32
- fromType: string;
33
- /** Source entity ID */
34
- fromId: string;
35
- /** Target entity namespace */
36
- toNs: string;
37
- /** Target entity type */
38
- toType: string;
39
- /** Target entity ID */
40
- toId: string;
41
- /** Creation timestamp */
42
- createdAt: Date;
43
- /** Creator user ID */
44
- createdBy: string;
45
- /** Soft delete timestamp */
46
- deletedAt?: Date | null;
47
- /** Deleter user ID */
48
- deletedBy?: string;
49
- /** Additional relationship metadata */
50
- metadata: RelationshipMetadata;
51
- }
52
- /**
53
- * Semantic predicate categories
54
- */
55
- type SemanticPredicateCategory = 'temporal' | 'spatial' | 'directional' | 'relational' | 'causal' | 'ownership' | 'membership' | 'dependency' | 'custom';
56
- /**
57
- * Built-in semantic predicates
58
- */
59
- type SemanticPredicate = 'before' | 'after' | 'during' | 'since' | 'until' | 'by' | 'at' | 'in' | 'on' | 'past' | 'throughout' | 'till' | 'above' | 'below' | 'under' | 'near' | 'between' | 'among' | 'beside' | 'within' | 'amid' | 'around' | 'behind' | 'beneath' | 'beyond' | 'inside' | 'upon' | 'outside' | 'over' | 'opposite' | 'underneath' | 'round' | 'through' | 'toward' | 'to' | 'from' | 'into' | 'across' | 'along' | 'against' | 'down' | 'off' | 'onto' | 'up' | 'via' | 'out' | 'with' | 'of' | 'about' | 'concerning' | 'for' | 'including' | 'regarding' | 'like' | 'as' | 'than' | 'unlike' | 'besides' | 'except' | 'despite' | 'without' | 'per' | 'because' | 'considering' | 'but' | 'owns' | 'worksFor' | 'contains' | 'belongsTo' | 'employs' | 'locatedAt' | 'handoff' | 'uses' | 'validates' | 'blocks' | 'dependsOn' | 'references' | 'parentOf' | 'childOf' | 'siblingOf' | string;
60
- /**
61
- * Predicate definition with metadata
62
- */
63
- interface PredicateDefinition {
64
- /** Predicate name */
65
- name: SemanticPredicate;
66
- /** Category */
67
- category: SemanticPredicateCategory;
68
- /** Human-readable label */
69
- label: string;
70
- /** Description */
71
- description: string;
72
- /** Inverse predicate (e.g., 'owns' -> 'ownedBy') */
73
- inverse?: SemanticPredicate;
74
- /** Is this predicate symmetric? */
75
- symmetric: boolean;
76
- /** Is this predicate transitive? */
77
- transitive: boolean;
78
- /** Valid source types (empty = any) */
79
- validFromTypes: string[];
80
- /** Valid target types (empty = any) */
81
- validToTypes: string[];
82
- }
83
- /**
84
- * Additional metadata for relationships
85
- */
86
- interface RelationshipMetadata {
87
- /** Relationship strength/weight (0-1) */
88
- weight?: number;
89
- /** Confidence score (0-1) */
90
- confidence?: number;
91
- /** Source of the relationship (manual, inferred, imported) */
92
- source?: 'manual' | 'inferred' | 'imported' | 'system';
93
- /** Start date (for temporal relationships) */
94
- startDate?: Date;
95
- /** End date (for temporal relationships) */
96
- endDate?: Date;
97
- /** Additional properties */
98
- [key: string]: unknown;
99
- }
100
- /**
101
- * Semantic triple representation ($.Subject.predicate.Object)
102
- */
103
- interface SemanticTriple {
104
- /** Subject (from) entity reference */
105
- subject: EntityReference;
106
- /** Predicate (relationship type) */
107
- predicate: SemanticPredicate;
108
- /** Object (to) entity reference */
109
- object: EntityReference;
110
- }
111
- /**
112
- * Graph query pattern for finding relationships
113
- */
114
- interface GraphPattern {
115
- /** Subject pattern (supports wildcards) */
116
- subject?: Partial<EntityReference> & {
117
- pattern?: string;
118
- };
119
- /** Predicate filter */
120
- predicate?: SemanticPredicate | SemanticPredicate[];
121
- /** Object pattern (supports wildcards) */
122
- object?: Partial<EntityReference> & {
123
- pattern?: string;
124
- };
125
- /** Maximum depth for traversal */
126
- depth?: number;
127
- /** Direction of traversal */
128
- direction?: 'outgoing' | 'incoming' | 'both';
129
- }
130
- /**
131
- * Relationship creation payload
132
- */
133
- interface RelationshipCreateInput {
134
- /** Predicate type */
135
- relationshipType: SemanticPredicate;
136
- /** Source entity */
137
- from: EntityReference;
138
- /** Target entity */
139
- to: EntityReference;
140
- /** Metadata */
141
- metadata?: RelationshipMetadata;
142
- }
143
- /**
144
- * Query filters for relationships
145
- */
146
- interface RelationshipFilter {
147
- /** Filter by predicate type */
148
- predicates?: SemanticPredicate[];
149
- /** Filter by source entity */
150
- from?: Partial<EntityReference>;
151
- /** Filter by target entity */
152
- to?: Partial<EntityReference>;
153
- /** Filter by category */
154
- categories?: SemanticPredicateCategory[];
155
- /** Include deleted */
156
- includeDeleted?: boolean;
157
- /** Filter by metadata */
158
- metadata?: Partial<RelationshipMetadata>;
159
- /** Date range */
160
- createdAfter?: Date;
161
- createdBefore?: Date;
162
- }
163
- /**
164
- * Graph traversal result
165
- */
166
- interface GraphTraversalResult {
167
- /** Root entity */
168
- root: EntityReference;
169
- /** All nodes found */
170
- nodes: EntityReference[];
171
- /** All edges (relationships) found */
172
- edges: Relationship[];
173
- /** Traversal depth reached */
174
- depth: number;
175
- /** Paths from root to each node */
176
- paths: GraphPath[];
177
- }
178
- /**
179
- * A path in the graph
180
- */
181
- interface GraphPath {
182
- /** Starting node */
183
- start: EntityReference;
184
- /** Ending node */
185
- end: EntityReference;
186
- /** Edges traversed */
187
- edges: Relationship[];
188
- /** Total weight (sum of edge weights) */
189
- totalWeight: number;
190
- /** Path length (number of edges) */
191
- length: number;
192
- }
193
- /**
194
- * Statistics for the relationship graph
195
- */
196
- interface GraphStats {
197
- /** Total relationships */
198
- totalRelationships: number;
199
- /** Active relationships (not deleted) */
200
- activeRelationships: number;
201
- /** Count by predicate type */
202
- byPredicate: Record<string, number>;
203
- /** Count by category */
204
- byCategory: Record<SemanticPredicateCategory, number>;
205
- /** Average degree (connections per node) */
206
- averageDegree: number;
207
- /** Most connected nodes */
208
- topConnectedNodes: Array<{
209
- entity: EntityReference;
210
- degree: number;
211
- }>;
212
- }
213
-
214
- /**
215
- * Workflow Types - Business Process Orchestration
216
- *
217
- * Workflows orchestrate multi-step business processes using:
218
- * - Event, schedule, manual, or webhook triggers
219
- * - Function steps (Code, Generative, Agentic, Human)
220
- * - Conditional branching and parallel execution
221
- * - Saga pattern for compensation/rollback
222
- *
223
- * @remarks
224
- * Workflows are implemented via the StateMachine DO using XState v5.
225
- * Each execution maintains its own state with full audit trail.
226
- */
227
-
228
- /**
229
- * Workflow status
230
- */
231
- type WorkflowStatus = 'draft' | 'active' | 'deprecated' | 'archived';
232
- /**
233
- * Core workflow definition
234
- */
235
- interface Workflow {
236
- /** Unique workflow identifier */
237
- id: string;
238
- /** URL-friendly slug */
239
- slug: string;
240
- /** Workflow name */
241
- name: string;
242
- /** Description */
243
- description: string;
244
- /** Namespace */
245
- ns: string;
246
- /** Version */
247
- version: string;
248
- /** Workflow status */
249
- status: WorkflowStatus;
250
- /** Trigger configuration */
251
- trigger: WorkflowTrigger;
252
- /** Workflow steps */
253
- steps: WorkflowStep[];
254
- /** Error handling configuration */
255
- errorHandling: ErrorHandlingConfig;
256
- /** Compensation steps (saga pattern) */
257
- compensation?: CompensationConfig;
258
- /** Workflow configuration */
259
- config: WorkflowConfig;
260
- /** Tags */
261
- tags: string[];
262
- /** Owner user ID */
263
- owner: string;
264
- /** Creation timestamp */
265
- createdAt: Date;
266
- /** Last update timestamp */
267
- updatedAt: Date;
268
- }
269
- /**
270
- * Trigger types
271
- */
272
- type TriggerType = 'event' | 'schedule' | 'manual' | 'webhook';
273
- /**
274
- * Base trigger configuration
275
- */
276
- interface TriggerBase {
277
- /** Trigger type */
278
- type: TriggerType;
279
- /** Trigger name */
280
- name: string;
281
- /** Is this trigger enabled? */
282
- enabled: boolean;
283
- }
284
- /**
285
- * Event trigger - $.Subject.predicate pattern
286
- */
287
- interface EventTrigger extends TriggerBase {
288
- type: 'event';
289
- /** Event pattern to match ($.Subject.predicate) */
290
- pattern: string;
291
- /** Additional filter conditions */
292
- filter?: Record<string, unknown>;
293
- /** Batch events */
294
- batch?: {
295
- maxSize: number;
296
- maxWaitMs: number;
297
- };
298
- }
299
- /**
300
- * Schedule trigger - Cron or interval
301
- */
302
- interface ScheduleTrigger extends TriggerBase {
303
- type: 'schedule';
304
- /** Cron expression */
305
- cron?: string;
306
- /** Interval in seconds */
307
- intervalSeconds?: number;
308
- /** Timezone */
309
- timezone?: string;
310
- }
311
- /**
312
- * Manual trigger - User-initiated
313
- */
314
- interface ManualTrigger extends TriggerBase {
315
- type: 'manual';
316
- /** Input schema for manual trigger */
317
- inputSchema?: Record<string, unknown>;
318
- /** Require approval before execution */
319
- requireApproval?: boolean;
320
- /** Allowed users/roles */
321
- allowedBy?: string[];
322
- }
323
- /**
324
- * Webhook trigger - HTTP endpoint
325
- */
326
- interface WebhookTrigger extends TriggerBase {
327
- type: 'webhook';
328
- /** Webhook path */
329
- path: string;
330
- /** HTTP methods allowed */
331
- methods: ('GET' | 'POST' | 'PUT' | 'DELETE')[];
332
- /** Authentication required */
333
- authentication?: 'none' | 'api-key' | 'jwt' | 'hmac';
334
- /** Secret for HMAC validation */
335
- hmacSecret?: string;
336
- }
337
- /**
338
- * Union of all trigger types
339
- */
340
- type WorkflowTrigger = EventTrigger | ScheduleTrigger | ManualTrigger | WebhookTrigger;
341
- /**
342
- * Step types
343
- */
344
- type StepType = 'function' | 'workflow' | 'task' | 'wait' | 'parallel' | 'choice' | 'foreach' | 'http' | 'database' | 'ai' | 'event';
345
- /**
346
- * Workflow step definition
347
- */
348
- interface WorkflowStep {
349
- /** Step ID (unique within workflow) */
350
- id: string;
351
- /** Step name */
352
- name: string;
353
- /** Step type */
354
- type: StepType;
355
- /** Step configuration */
356
- config: StepConfig;
357
- /** Dependencies (step IDs that must complete first) */
358
- dependsOn?: string[];
359
- /** Chain after (for RPC optimization) */
360
- chainAfter?: string;
361
- /** Condition (JSONLogic) for conditional execution */
362
- condition?: Record<string, unknown>;
363
- /** Retry configuration */
364
- retry?: RetryConfig;
365
- /** Timeout in ms */
366
- timeout?: number;
367
- /** Output mapping */
368
- outputMapping?: Record<string, string>;
369
- }
370
- /**
371
- * Step configuration by type
372
- */
373
- interface StepConfig {
374
- /** Function ID (for function steps) */
375
- functionId?: string;
376
- /** Workflow ID (for workflow steps) */
377
- workflowId?: string;
378
- /** Wait duration in ms (for wait steps) */
379
- waitMs?: number;
380
- /** Wait until date/time (for wait steps) */
381
- waitUntil?: string;
382
- /** Parallel branches (for parallel steps) */
383
- branches?: WorkflowStep[][];
384
- /** Choice conditions (for choice steps) */
385
- choices?: ChoiceCondition[];
386
- /** Default branch (for choice steps) */
387
- default?: WorkflowStep[];
388
- /** Iterator expression (for foreach steps) */
389
- iterator?: string;
390
- /** Loop body (for foreach steps) */
391
- body?: WorkflowStep[];
392
- /** HTTP request config (for http steps) */
393
- http?: HttpStepConfig;
394
- /** Database query config (for database steps) */
395
- database?: DatabaseStepConfig;
396
- /** AI config (for ai steps) */
397
- ai?: AIStepConfig;
398
- /** Event config (for event steps) */
399
- event?: EventStepConfig;
400
- /** Input mapping (template expressions) */
401
- input?: Record<string, string>;
402
- }
403
- /**
404
- * Choice condition for branching
405
- */
406
- interface ChoiceCondition {
407
- /** Condition (JSONLogic) */
408
- condition: Record<string, unknown>;
409
- /** Steps to execute if condition is true */
410
- steps: WorkflowStep[];
411
- }
412
- /**
413
- * HTTP step configuration
414
- */
415
- interface HttpStepConfig {
416
- /** URL (supports template expressions) */
417
- url: string;
418
- /** HTTP method */
419
- method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
420
- /** Headers */
421
- headers?: Record<string, string>;
422
- /** Request body */
423
- body?: unknown;
424
- /** Response handling */
425
- responseType?: 'json' | 'text' | 'binary';
426
- }
427
- /**
428
- * Database step configuration
429
- */
430
- interface DatabaseStepConfig {
431
- /** Operation type */
432
- operation: 'query' | 'insert' | 'update' | 'delete';
433
- /** Collection/table name */
434
- collection: string;
435
- /** Query filter */
436
- filter?: Record<string, unknown>;
437
- /** Data for insert/update */
438
- data?: Record<string, unknown>;
439
- }
440
- /**
441
- * AI step configuration
442
- */
443
- interface AIStepConfig {
444
- /** Prompt (supports template expressions) */
445
- prompt: string;
446
- /** Model */
447
- model: string;
448
- /** Output schema for structured output */
449
- outputSchema?: Record<string, unknown>;
450
- /** Temperature */
451
- temperature?: number;
452
- /** Max tokens */
453
- maxTokens?: number;
454
- }
455
- /**
456
- * Event step configuration (emit event)
457
- */
458
- interface EventStepConfig {
459
- /** Event type/pattern */
460
- eventType: string;
461
- /** Event payload (supports template expressions) */
462
- payload: Record<string, unknown>;
463
- }
464
- /**
465
- * Retry configuration
466
- */
467
- interface RetryConfig {
468
- /** Maximum retry attempts */
469
- maxAttempts: number;
470
- /** Backoff strategy */
471
- backoff: 'exponential' | 'linear' | 'fixed';
472
- /** Initial delay in ms */
473
- initialDelayMs: number;
474
- /** Maximum delay in ms */
475
- maxDelayMs: number;
476
- /** Retry on specific errors */
477
- retryOn?: string[];
478
- }
479
- /**
480
- * Error handling configuration
481
- */
482
- interface ErrorHandlingConfig {
483
- /** Global error strategy */
484
- strategy: 'retry' | 'compensate' | 'ignore' | 'fail';
485
- /** Retry config (if strategy is retry) */
486
- retry?: RetryConfig;
487
- /** Notification on error */
488
- notify?: NotificationConfig;
489
- /** Custom error handler function */
490
- errorHandler?: string;
491
- }
492
- /**
493
- * Compensation configuration (saga pattern)
494
- */
495
- interface CompensationConfig {
496
- /** Compensation steps (run in reverse order) */
497
- steps: WorkflowStep[];
498
- /** Strategy */
499
- strategy: 'sequential' | 'parallel';
500
- /** Continue on compensation failure? */
501
- continueOnFailure: boolean;
502
- }
503
- /**
504
- * Workflow configuration
505
- */
506
- interface WorkflowConfig {
507
- /** Global timeout in ms */
508
- timeout: number;
509
- /** Maximum concurrent executions */
510
- maxConcurrency?: number;
511
- /** Rate limiting */
512
- rateLimit?: {
513
- maxPerMinute: number;
514
- strategy: 'sliding' | 'fixed';
515
- };
516
- /** Execution mode */
517
- executionMode: 'async' | 'sync';
518
- /** Store execution history */
519
- storeHistory: boolean;
520
- /** Retention period for history in days */
521
- historyRetentionDays: number;
522
- }
523
- /**
524
- * Notification configuration
525
- */
526
- interface NotificationConfig {
527
- /** Notification channels */
528
- channels: ('email' | 'slack' | 'webhook')[];
529
- /** Recipients */
530
- recipients: string[];
531
- /** Custom message template */
532
- messageTemplate?: string;
533
- }
534
- /**
535
- * Execution status
536
- */
537
- type ExecutionStatus = 'pending' | 'running' | 'completed' | 'failed' | 'cancelled' | 'compensating' | 'compensated';
538
- /**
539
- * Workflow execution record
540
- */
541
- interface WorkflowExecution {
542
- /** Execution ID */
543
- id: string;
544
- /** Workflow ID */
545
- workflowId: string;
546
- /** Workflow version at execution time */
547
- workflowVersion: string;
548
- /** Execution status */
549
- status: ExecutionStatus;
550
- /** Trigger data */
551
- trigger: TriggerData;
552
- /** Execution context */
553
- context: ExecutionContext;
554
- /** Step executions */
555
- steps: StepExecution[];
556
- /** Start time */
557
- startedAt: Date;
558
- /** End time */
559
- completedAt?: Date;
560
- /** Duration in ms */
561
- durationMs?: number;
562
- /** Error if failed */
563
- error?: ExecutionError;
564
- /** Namespace */
565
- ns: string;
566
- }
567
- /**
568
- * Trigger data (what triggered the execution)
569
- */
570
- interface TriggerData {
571
- /** Trigger type */
572
- type: TriggerType;
573
- /** Trigger payload */
574
- data: Record<string, unknown>;
575
- /** Trigger timestamp */
576
- triggeredAt: Date;
577
- /** Trigger source (user, event, schedule) */
578
- source: string;
579
- }
580
- /**
581
- * Execution context
582
- */
583
- interface ExecutionContext {
584
- /** Variables (workflow-scoped state) */
585
- variables: Record<string, unknown>;
586
- /** Step outputs (step_id -> output) */
587
- stepOutputs: Record<string, unknown>;
588
- /** Metadata */
589
- metadata: Record<string, unknown>;
590
- }
591
- /**
592
- * Step execution record
593
- */
594
- interface StepExecution {
595
- /** Step ID */
596
- stepId: string;
597
- /** Step name */
598
- stepName: string;
599
- /** Execution status */
600
- status: ExecutionStatus;
601
- /** Input provided */
602
- input: Record<string, unknown>;
603
- /** Output produced */
604
- output?: Record<string, unknown>;
605
- /** Error if failed */
606
- error?: ExecutionError;
607
- /** Start time */
608
- startedAt: Date;
609
- /** End time */
610
- completedAt?: Date;
611
- /** Duration in ms */
612
- durationMs?: number;
613
- /** Retry count */
614
- retryCount: number;
615
- }
616
- /**
617
- * Workflow filter for queries
618
- */
619
- interface WorkflowFilter {
620
- /** Filter by status */
621
- status?: WorkflowStatus[];
622
- /** Filter by namespace */
623
- ns?: string;
624
- /** Filter by tags */
625
- tags?: string[];
626
- /** Filter by trigger type */
627
- triggerType?: TriggerType[];
628
- /** Search by name */
629
- nameSearch?: string;
630
- /** Filter by owner */
631
- owner?: string;
632
- }
633
- /**
634
- * Execution filter for queries
635
- */
636
- interface ExecutionFilter {
637
- /** Filter by workflow ID */
638
- workflowId?: string;
639
- /** Filter by status */
640
- status?: ExecutionStatus[];
641
- /** Filter by trigger type */
642
- triggerType?: TriggerType[];
643
- /** Filter by date range */
644
- startedAfter?: Date;
645
- startedBefore?: Date;
646
- /** Filter by namespace */
647
- ns?: string;
648
- }
649
-
650
- /**
651
- * Agent Types - Autonomous AI Workers
652
- *
653
- * Agents are autonomous AI workers derived from:
654
- * - O*NET occupations (1,459 occupations)
655
- * - NAICS industries (68 industries)
656
- * - Task × Tool × Operation combinations
657
- *
658
- * This creates 40,000+ potential agent types that can perform
659
- * specialized work autonomously or semi-autonomously.
660
- *
661
- * @remarks
662
- * Agent classifications:
663
- * - Digital-first (22%): Remote-only operations
664
- * - Hybrid (60%): Mix of digital and physical
665
- * - Embodiment-required (18%): Physical work
666
- */
667
-
668
- /**
669
- * Agent definition
670
- */
671
- interface Agent {
672
- /** Unique agent identifier */
673
- id: string;
674
- /** Agent name */
675
- name: string;
676
- /** Agent slug (URL-friendly) */
677
- slug: string;
678
- /** Agent description */
679
- description: string;
680
- /** Namespace */
681
- ns: string;
682
- /** Agent type/role */
683
- type: AgentType;
684
- /** Classification */
685
- classification: AgentClassification;
686
- /** System prompt */
687
- systemPrompt: string;
688
- /** Character description (for persona) */
689
- characterBible?: CharacterBible;
690
- /** Available tools */
691
- tools: string[];
692
- /** AI model to use */
693
- model: string;
694
- /** Maximum iterations per execution */
695
- maxIterations: number;
696
- /** Thinking budget (for reasoning) */
697
- thinkingBudget?: number;
698
- /** Guardrails */
699
- guardrails: AgentGuardrail[];
700
- /** Handoff rules */
701
- handoffRules: HandoffRule[];
702
- /** Status */
703
- status: AgentStatus;
704
- /** Performance metrics */
705
- metrics?: AgentMetrics;
706
- /** Creation timestamp */
707
- createdAt: Date;
708
- /** Last update timestamp */
709
- updatedAt: Date;
710
- /** Creator */
711
- createdBy: string;
712
- }
713
- /**
714
- * Agent type derived from O*NET + NAICS
715
- */
716
- interface AgentType {
717
- /** O*NET occupation code (e.g., "15-1252.00") */
718
- onetCode?: string;
719
- /** O*NET occupation title */
720
- onetTitle?: string;
721
- /** NAICS industry code */
722
- naicsCode?: string;
723
- /** NAICS industry title */
724
- naicsTitle?: string;
725
- /** Custom type name */
726
- customType?: string;
727
- /** Role category */
728
- roleCategory: RoleCategory;
729
- }
730
- /**
731
- * Role categories
732
- */
733
- type RoleCategory = 'sdr' | 'csm' | 'engineer' | 'devops' | 'content' | 'design' | 'security' | 'compliance' | 'finance' | 'hr' | 'legal' | 'support' | 'analyst' | 'researcher' | 'manager' | 'executive' | 'specialist' | 'custom';
734
- /**
735
- * Agent classification
736
- */
737
- interface AgentClassification {
738
- /** Work mode */
739
- workMode: 'digital-first' | 'hybrid' | 'embodiment-required';
740
- /** Role type */
741
- roleType: 'leadership' | 'analytical' | 'creative' | 'customer-facing' | 'operational';
742
- /** Autonomy level (0-1) */
743
- autonomyLevel: number;
744
- /** Automation score (from O*NET) */
745
- automationScore?: number;
746
- /** Job zone (1-5, complexity) */
747
- jobZone?: number;
748
- /** Required skills */
749
- requiredSkills: string[];
750
- /** Required knowledge */
751
- requiredKnowledge: string[];
752
- }
753
- /**
754
- * Character bible for agent persona
755
- */
756
- interface CharacterBible {
757
- /** Full name */
758
- fullName: string;
759
- /** Pronouns */
760
- pronouns: string;
761
- /** Age */
762
- age?: number;
763
- /** Background story */
764
- background: string;
765
- /** Personality traits */
766
- traits: string[];
767
- /** Communication style */
768
- communicationStyle: string;
769
- /** Expertise areas */
770
- expertise: string[];
771
- /** Limitations/boundaries */
772
- limitations: string[];
773
- /** Avatar/headshot URL */
774
- avatarUrl?: string;
775
- /** Voice characteristics (for audio) */
776
- voiceCharacteristics?: string;
777
- }
778
- /**
779
- * Agent guardrail
780
- */
781
- interface AgentGuardrail {
782
- /** Guardrail ID */
783
- id: string;
784
- /** Guardrail type */
785
- type: 'input' | 'output' | 'action' | 'content' | 'safety';
786
- /** Check to perform */
787
- check: string;
788
- /** Action on violation */
789
- onViolation: 'block' | 'warn' | 'log' | 'escalate';
790
- /** Custom validator function */
791
- validator?: string;
792
- /** Severity */
793
- severity: 'low' | 'medium' | 'high' | 'critical';
794
- }
795
- /**
796
- * Handoff rule for agent coordination
797
- */
798
- interface HandoffRule {
799
- /** Rule ID */
800
- id: string;
801
- /** Condition for handoff (natural language or JSONLogic) */
802
- condition: string;
803
- /** Target agent or workflow */
804
- target: string;
805
- /** Target type */
806
- targetType: 'agent' | 'workflow' | 'human';
807
- /** Context to pass */
808
- context: string[];
809
- /** Is this handoff required? */
810
- required: boolean;
811
- /** Priority */
812
- priority: number;
813
- }
814
- /**
815
- * Agent status
816
- */
817
- type AgentStatus = 'draft' | 'active' | 'paused' | 'deprecated' | 'archived';
818
- /**
819
- * Agent performance metrics
820
- */
821
- interface AgentMetrics {
822
- /** Total executions */
823
- totalExecutions: number;
824
- /** Successful executions */
825
- successfulExecutions: number;
826
- /** Failed executions */
827
- failedExecutions: number;
828
- /** Success rate (0-1) */
829
- successRate: number;
830
- /** Average duration in ms */
831
- avgDurationMs: number;
832
- /** Average iterations */
833
- avgIterations: number;
834
- /** Average token usage */
835
- avgTokenUsage: number;
836
- /** Average cost in USD */
837
- avgCostUsd: number;
838
- /** User satisfaction (0-5) */
839
- userSatisfaction?: number;
840
- /** Last execution time */
841
- lastExecutedAt?: Date;
842
- /** Period start */
843
- periodStart: Date;
844
- /** Period end */
845
- periodEnd: Date;
846
- }
847
- /**
848
- * Agent execution record
849
- */
850
- interface AgentExecution {
851
- /** Execution ID */
852
- id: string;
853
- /** Agent ID */
854
- agentId: string;
855
- /** Execution status */
856
- status: AgentExecutionStatus;
857
- /** Input/task provided */
858
- input: AgentInput;
859
- /** Output produced */
860
- output?: AgentOutput;
861
- /** Execution trace */
862
- trace: AgentTrace[];
863
- /** Handoffs that occurred */
864
- handoffs: AgentHandoff[];
865
- /** Guardrail violations */
866
- violations: GuardrailViolation[];
867
- /** Start time */
868
- startedAt: Date;
869
- /** End time */
870
- completedAt?: Date;
871
- /** Duration in ms */
872
- durationMs?: number;
873
- /** Total iterations */
874
- iterations: number;
875
- /** Token usage */
876
- tokenUsage: TokenUsage;
877
- /** Cost in USD */
878
- costUsd: number;
879
- /** User feedback */
880
- feedback?: AgentFeedback;
881
- /** Namespace */
882
- ns: string;
883
- /** Triggered by */
884
- triggeredBy: string;
885
- }
886
- /**
887
- * Execution status
888
- */
889
- type AgentExecutionStatus = 'pending' | 'running' | 'completed' | 'failed' | 'cancelled' | 'handed-off' | 'awaiting-human';
890
- /**
891
- * Agent input
892
- */
893
- interface AgentInput {
894
- /** Task description */
895
- task: string;
896
- /** Context information */
897
- context?: Record<string, unknown>;
898
- /** Constraints */
899
- constraints?: string[];
900
- /** Expected output format */
901
- outputFormat?: string;
902
- }
903
- /**
904
- * Agent output
905
- */
906
- interface AgentOutput {
907
- /** Result/response */
908
- result: unknown;
909
- /** Summary */
910
- summary: string;
911
- /** Confidence score (0-1) */
912
- confidence?: number;
913
- /** Artifacts produced */
914
- artifacts?: AgentArtifact[];
915
- /** Recommendations */
916
- recommendations?: string[];
917
- }
918
- /**
919
- * Agent artifact (file, code, etc.)
920
- */
921
- interface AgentArtifact {
922
- /** Artifact type */
923
- type: 'file' | 'code' | 'image' | 'document' | 'data';
924
- /** Artifact name */
925
- name: string;
926
- /** Content or URL */
927
- content: string;
928
- /** MIME type */
929
- mimeType?: string;
930
- }
931
- /**
932
- * Agent execution trace (step-by-step)
933
- */
934
- interface AgentTrace {
935
- /** Iteration number */
936
- iteration: number;
937
- /** Timestamp */
938
- timestamp: Date;
939
- /** Action type */
940
- type: 'thought' | 'action' | 'observation' | 'decision';
941
- /** Content */
942
- content: string;
943
- /** Tool used (if action) */
944
- tool?: string;
945
- /** Tool input (if action) */
946
- toolInput?: Record<string, unknown>;
947
- /** Tool output (if observation) */
948
- toolOutput?: unknown;
949
- /** Token usage for this step */
950
- tokenUsage?: TokenUsage;
951
- }
952
- /**
953
- * Agent handoff record
954
- */
955
- interface AgentHandoff {
956
- /** Handoff timestamp */
957
- timestamp: Date;
958
- /** Rule that triggered handoff */
959
- ruleId: string;
960
- /** Source agent */
961
- fromAgent: string;
962
- /** Target agent/workflow/human */
963
- toTarget: string;
964
- /** Target type */
965
- targetType: 'agent' | 'workflow' | 'human';
966
- /** Context passed */
967
- context: Record<string, unknown>;
968
- /** Handoff successful? */
969
- successful: boolean;
970
- }
971
- /**
972
- * Guardrail violation record
973
- */
974
- interface GuardrailViolation {
975
- /** Timestamp */
976
- timestamp: Date;
977
- /** Guardrail ID */
978
- guardrailId: string;
979
- /** Violation type */
980
- type: string;
981
- /** Details */
982
- details: string;
983
- /** Action taken */
984
- actionTaken: 'blocked' | 'warned' | 'logged' | 'escalated';
985
- /** Severity */
986
- severity: 'low' | 'medium' | 'high' | 'critical';
987
- }
988
- /**
989
- * User feedback on agent execution
990
- */
991
- interface AgentFeedback {
992
- /** Rating (1-5) */
993
- rating: number;
994
- /** Comment */
995
- comment?: string;
996
- /** Feedback categories */
997
- categories?: ('accurate' | 'helpful' | 'fast' | 'clear' | 'wrong' | 'slow' | 'confusing')[];
998
- /** Timestamp */
999
- submittedAt: Date;
1000
- /** User who submitted */
1001
- submittedBy: string;
1002
- }
1003
- /**
1004
- * Agent filter for queries
1005
- */
1006
- interface AgentFilter {
1007
- /** Filter by status */
1008
- status?: AgentStatus[];
1009
- /** Filter by role category */
1010
- roleCategory?: RoleCategory[];
1011
- /** Filter by work mode */
1012
- workMode?: ('digital-first' | 'hybrid' | 'embodiment-required')[];
1013
- /** Filter by namespace */
1014
- ns?: string;
1015
- /** Search by name */
1016
- nameSearch?: string;
1017
- /** Filter by tools */
1018
- tools?: string[];
1019
- /** Minimum autonomy level */
1020
- minAutonomyLevel?: number;
1021
- }
1022
- /**
1023
- * Execution filter for queries
1024
- */
1025
- interface AgentExecutionFilter {
1026
- /** Filter by agent ID */
1027
- agentId?: string;
1028
- /** Filter by status */
1029
- status?: AgentExecutionStatus[];
1030
- /** Filter by date range */
1031
- startedAfter?: Date;
1032
- startedBefore?: Date;
1033
- /** Filter by namespace */
1034
- ns?: string;
1035
- /** Filter by triggered by */
1036
- triggeredBy?: string;
1037
- /** Has feedback */
1038
- hasFeedback?: boolean;
1039
- /** Minimum rating */
1040
- minRating?: number;
1041
- }
1042
-
1043
- export type { AgentOutput as $, AIStepConfig as A, WorkflowFilter as B, ChoiceCondition as C, DatabaseStepConfig as D, EventTrigger as E, ExecutionFilter as F, GraphPattern as G, HttpStepConfig as H, Agent as I, AgentType as J, RoleCategory as K, AgentClassification as L, ManualTrigger as M, NotificationConfig as N, CharacterBible as O, PredicateDefinition as P, AgentGuardrail as Q, Relationship as R, SemanticPredicateCategory as S, TriggerType as T, HandoffRule as U, AgentStatus as V, WorkflowStatus as W, AgentMetrics as X, AgentExecution as Y, AgentExecutionStatus as Z, AgentInput as _, SemanticPredicate as a, AgentArtifact as a0, AgentTrace as a1, AgentHandoff as a2, GuardrailViolation as a3, AgentFeedback as a4, AgentFilter as a5, AgentExecutionFilter as a6, RelationshipMetadata as b, SemanticTriple as c, RelationshipCreateInput as d, RelationshipFilter as e, GraphTraversalResult as f, GraphPath as g, GraphStats as h, Workflow as i, TriggerBase as j, ScheduleTrigger as k, WebhookTrigger as l, WorkflowTrigger as m, StepType as n, WorkflowStep as o, StepConfig as p, EventStepConfig as q, RetryConfig as r, ErrorHandlingConfig as s, CompensationConfig as t, WorkflowConfig as u, ExecutionStatus as v, WorkflowExecution as w, TriggerData as x, ExecutionContext as y, StepExecution as z };