mcp-event-intelligence 0.4.0 → 0.6.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/CHANGELOG.md +100 -0
- package/README.md +107 -26
- package/SECURITY.md +4 -4
- package/bin/mcp-event-intelligence.mjs +3 -3
- package/dist/src/composite/engine.d.ts +14 -4
- package/dist/src/composite/engine.js +533 -208
- package/dist/src/composite/matching.d.ts +1 -5
- package/dist/src/composite/matching.js +45 -54
- package/dist/src/composite/runtimeSupport.js +10 -6
- package/dist/src/composite/store.d.ts +38 -4
- package/dist/src/composite/temporal.d.ts +0 -17
- package/dist/src/composite/temporal.js +0 -266
- package/dist/src/intelligenceProtocol/activationSchemas.d.ts +38 -3
- package/dist/src/intelligenceProtocol/activationSchemas.js +5 -3
- package/dist/src/intelligenceProtocol/index.d.ts +12 -9
- package/dist/src/intelligenceProtocol/index.js +6 -5
- package/dist/src/intelligenceProtocol/lifecycle.js +2 -10
- package/dist/src/intelligenceProtocol/operatorRegistry.d.ts +300 -0
- package/dist/src/intelligenceProtocol/operatorRegistry.js +338 -0
- package/dist/src/intelligenceProtocol/patternV2Schemas.d.ts +188 -0
- package/dist/src/intelligenceProtocol/patternV2Schemas.js +801 -0
- package/dist/src/intelligenceProtocol/schemas.d.ts +4 -189
- package/dist/src/intelligenceProtocol/schemas.js +3 -97
- package/dist/src/intelligenceProtocol/triggerPlanSchemas.d.ts +114 -38
- package/dist/src/intelligenceProtocol/triggerPlanSchemas.js +27 -18
- package/dist/src/intelligenceProtocol/triggerSchemas.d.ts +268 -213
- package/dist/src/intelligenceProtocol/triggerSchemas.js +155 -169
- package/dist/src/intelligenceProtocol/version.d.ts +2 -2
- package/dist/src/intelligenceProtocol/version.js +2 -2
- package/dist/src/mcpEvents/consumer.d.ts +1 -0
- package/dist/src/mcpEvents/consumer.js +1 -0
- package/dist/src/patternV2/evaluator.d.ts +51 -0
- package/dist/src/patternV2/evaluator.js +986 -0
- package/dist/src/semantic/types.d.ts +6 -0
- package/dist/src/semantic/typesafeJevEvaluator.d.ts +1 -0
- package/dist/src/semantic/typesafeJevEvaluator.js +6 -0
- package/package.json +9 -3
- package/scripts/host-integration.d.mts +54 -4
- package/scripts/host-integration.mjs +25 -4
- package/scripts/lib/activation-hydrator.mjs +13 -12
- package/scripts/lib/composite-event-consumer.mjs +10 -28
- package/scripts/lib/composite-wake-coordinator.mjs +19 -19
- package/scripts/lib/derived-contract-registry.mjs +4 -4
- package/scripts/lib/derived-event-coordinator.mjs +69 -6
- package/scripts/lib/local-event-intelligence-runtime.mjs +35 -3
- package/scripts/lib/mcp-events-client.mjs +97 -55
- package/scripts/lib/mcp-events-compatibility.mjs +54 -0
- package/scripts/lib/persistent-event-store.mjs +228 -61
- package/scripts/lib/store-capabilities.mjs +88 -0
- package/scripts/lib/store-conformance.mjs +127 -0
- package/scripts/lib/temporal-deadline-scheduler.mjs +3 -3
- package/scripts/lib/trigger-control-plane.mjs +202 -53
- package/scripts/lib/trigger-inspector.mjs +50 -147
- package/scripts/lib/trigger-planner.mjs +141 -52
- package/scripts/lib/wake-retry-scheduler.mjs +2 -19
- package/scripts/mcp-stdio-server.mjs +46 -61
- package/scripts/service.mjs +19 -138
- package/server.json +4 -4
- package/dist/src/intelligenceProtocol/invariants.d.ts +0 -3
- package/dist/src/intelligenceProtocol/invariants.js +0 -36
- package/dist/src/intelligenceProtocol/mapper.d.ts +0 -14
- package/dist/src/intelligenceProtocol/mapper.js +0 -28
- package/scripts/lib/event-processor.mjs +0 -624
- package/scripts/lib/http-wake-deliverer.mjs +0 -31
|
@@ -10,91 +10,6 @@ export declare const RuntimeTargetSchema: z.ZodObject<{
|
|
|
10
10
|
}>;
|
|
11
11
|
id: z.ZodString;
|
|
12
12
|
}, z.core.$strip>;
|
|
13
|
-
export declare const EventSourceSchema: z.ZodObject<{
|
|
14
|
-
serverId: z.ZodString;
|
|
15
|
-
transport: z.ZodEnum<{
|
|
16
|
-
stdio: "stdio";
|
|
17
|
-
streamable_http: "streamable_http";
|
|
18
|
-
webhook: "webhook";
|
|
19
|
-
poll: "poll";
|
|
20
|
-
internal: "internal";
|
|
21
|
-
}>;
|
|
22
|
-
provider: z.ZodOptional<z.ZodString>;
|
|
23
|
-
cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
24
|
-
}, z.core.$strip>;
|
|
25
|
-
export declare const EventLineageSchema: z.ZodObject<{
|
|
26
|
-
protocol: z.ZodLiteral<"mcp-event-intelligence">;
|
|
27
|
-
protocolVersion: z.ZodLiteral<"0.1.0">;
|
|
28
|
-
schemaVersion: z.ZodLiteral<"ei.v0.1">;
|
|
29
|
-
traceId: z.ZodString;
|
|
30
|
-
environmentId: z.ZodString;
|
|
31
|
-
subscriptionId: z.ZodString;
|
|
32
|
-
sourceEventId: z.ZodString;
|
|
33
|
-
observedAt: z.ZodString;
|
|
34
|
-
source: z.ZodObject<{
|
|
35
|
-
serverId: z.ZodString;
|
|
36
|
-
transport: z.ZodEnum<{
|
|
37
|
-
stdio: "stdio";
|
|
38
|
-
streamable_http: "streamable_http";
|
|
39
|
-
webhook: "webhook";
|
|
40
|
-
poll: "poll";
|
|
41
|
-
internal: "internal";
|
|
42
|
-
}>;
|
|
43
|
-
provider: z.ZodOptional<z.ZodString>;
|
|
44
|
-
cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
45
|
-
}, z.core.$strip>;
|
|
46
|
-
target: z.ZodObject<{
|
|
47
|
-
runtime: z.ZodString;
|
|
48
|
-
kind: z.ZodEnum<{
|
|
49
|
-
goal: "goal";
|
|
50
|
-
session: "session";
|
|
51
|
-
conversation: "conversation";
|
|
52
|
-
task: "task";
|
|
53
|
-
spawn_template: "spawn_template";
|
|
54
|
-
}>;
|
|
55
|
-
id: z.ZodString;
|
|
56
|
-
}, z.core.$strip>;
|
|
57
|
-
event: z.ZodObject<{
|
|
58
|
-
name: z.ZodString;
|
|
59
|
-
occurredAt: z.ZodString;
|
|
60
|
-
payloadHash: z.ZodString;
|
|
61
|
-
}, z.core.$strip>;
|
|
62
|
-
}, z.core.$strip>;
|
|
63
|
-
export declare const SemanticDecisionRecordSchema: z.ZodObject<{
|
|
64
|
-
decisionId: z.ZodString;
|
|
65
|
-
traceId: z.ZodString;
|
|
66
|
-
subscriptionId: z.ZodString;
|
|
67
|
-
sourceEventId: z.ZodString;
|
|
68
|
-
createdAt: z.ZodString;
|
|
69
|
-
evaluator: z.ZodString;
|
|
70
|
-
outcome: z.ZodEnum<{
|
|
71
|
-
match: "match";
|
|
72
|
-
reject: "reject";
|
|
73
|
-
uncertain: "uncertain";
|
|
74
|
-
}>;
|
|
75
|
-
probability: z.ZodNumber;
|
|
76
|
-
matched: z.ZodBoolean;
|
|
77
|
-
shouldEscalate: z.ZodBoolean;
|
|
78
|
-
policy: z.ZodObject<{
|
|
79
|
-
matchThreshold: z.ZodNumber;
|
|
80
|
-
rejectThreshold: z.ZodNumber;
|
|
81
|
-
uncertain: z.ZodEnum<{
|
|
82
|
-
match: "match";
|
|
83
|
-
reject: "reject";
|
|
84
|
-
escalate: "escalate";
|
|
85
|
-
}>;
|
|
86
|
-
}, z.core.$strip>;
|
|
87
|
-
inputFields: z.ZodArray<z.ZodString>;
|
|
88
|
-
providerEvidence: z.ZodOptional<z.ZodObject<{
|
|
89
|
-
requestedModel: z.ZodOptional<z.ZodString>;
|
|
90
|
-
resolvedModel: z.ZodOptional<z.ZodString>;
|
|
91
|
-
requestId: z.ZodOptional<z.ZodString>;
|
|
92
|
-
httpStatus: z.ZodOptional<z.ZodNumber>;
|
|
93
|
-
inputTokens: z.ZodOptional<z.ZodNumber>;
|
|
94
|
-
outputTokens: z.ZodOptional<z.ZodNumber>;
|
|
95
|
-
providerReportedCost: z.ZodOptional<z.ZodNumber>;
|
|
96
|
-
}, z.core.$strip>>;
|
|
97
|
-
}, z.core.$strip>;
|
|
98
13
|
export declare const WakeRecordSchema: z.ZodObject<{
|
|
99
14
|
wakeId: z.ZodString;
|
|
100
15
|
traceId: z.ZodString;
|
|
@@ -116,8 +31,6 @@ export declare const WakeRecordSchema: z.ZodObject<{
|
|
|
116
31
|
status: z.ZodEnum<{
|
|
117
32
|
queued: "queued";
|
|
118
33
|
delivered: "delivered";
|
|
119
|
-
handled: "handled";
|
|
120
|
-
duplicate: "duplicate";
|
|
121
34
|
dead_letter: "dead_letter";
|
|
122
35
|
}>;
|
|
123
36
|
runtimeReceiptId: z.ZodOptional<z.ZodString>;
|
|
@@ -130,89 +43,18 @@ export declare const McpEventOccurrenceSchema: z.ZodObject<{
|
|
|
130
43
|
cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
131
44
|
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
132
45
|
}, z.core.$strip>;
|
|
133
|
-
export declare const SemanticConditionWireSchema: z.ZodObject<{
|
|
134
|
-
type: z.ZodLiteral<"semantic_boolean">;
|
|
135
|
-
instruction: z.ZodString;
|
|
136
|
-
input: z.ZodArray<z.ZodString>;
|
|
137
|
-
matchThreshold: z.ZodNumber;
|
|
138
|
-
rejectThreshold: z.ZodNumber;
|
|
139
|
-
uncertain: z.ZodEnum<{
|
|
140
|
-
match: "match";
|
|
141
|
-
reject: "reject";
|
|
142
|
-
escalate: "escalate";
|
|
143
|
-
}>;
|
|
144
|
-
}, z.core.$strip>;
|
|
145
|
-
export declare const EventIngestRequestSchema: z.ZodObject<{
|
|
146
|
-
event: z.ZodObject<{
|
|
147
|
-
eventId: z.ZodString;
|
|
148
|
-
name: z.ZodString;
|
|
149
|
-
timestamp: z.ZodString;
|
|
150
|
-
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
151
|
-
cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
152
|
-
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
153
|
-
}, z.core.$strip>;
|
|
154
|
-
context: z.ZodObject<{
|
|
155
|
-
traceId: z.ZodOptional<z.ZodString>;
|
|
156
|
-
environmentId: z.ZodString;
|
|
157
|
-
subscriptionId: z.ZodString;
|
|
158
|
-
serverId: z.ZodString;
|
|
159
|
-
transport: z.ZodEnum<{
|
|
160
|
-
stdio: "stdio";
|
|
161
|
-
streamable_http: "streamable_http";
|
|
162
|
-
webhook: "webhook";
|
|
163
|
-
poll: "poll";
|
|
164
|
-
internal: "internal";
|
|
165
|
-
}>;
|
|
166
|
-
provider: z.ZodOptional<z.ZodString>;
|
|
167
|
-
target: z.ZodObject<{
|
|
168
|
-
runtime: z.ZodString;
|
|
169
|
-
kind: z.ZodEnum<{
|
|
170
|
-
goal: "goal";
|
|
171
|
-
session: "session";
|
|
172
|
-
conversation: "conversation";
|
|
173
|
-
task: "task";
|
|
174
|
-
spawn_template: "spawn_template";
|
|
175
|
-
}>;
|
|
176
|
-
id: z.ZodString;
|
|
177
|
-
}, z.core.$strip>;
|
|
178
|
-
}, z.core.$strip>;
|
|
179
|
-
semanticCondition: z.ZodOptional<z.ZodObject<{
|
|
180
|
-
type: z.ZodLiteral<"semantic_boolean">;
|
|
181
|
-
instruction: z.ZodString;
|
|
182
|
-
input: z.ZodArray<z.ZodString>;
|
|
183
|
-
matchThreshold: z.ZodNumber;
|
|
184
|
-
rejectThreshold: z.ZodNumber;
|
|
185
|
-
uncertain: z.ZodEnum<{
|
|
186
|
-
match: "match";
|
|
187
|
-
reject: "reject";
|
|
188
|
-
escalate: "escalate";
|
|
189
|
-
}>;
|
|
190
|
-
}, z.core.$strip>>;
|
|
191
|
-
wakeOnEscalation: z.ZodDefault<z.ZodBoolean>;
|
|
192
|
-
}, z.core.$strip>;
|
|
193
46
|
export declare const LifecycleStateSchema: z.ZodEnum<{
|
|
194
|
-
matched: "matched";
|
|
195
|
-
handled: "handled";
|
|
196
|
-
duplicate: "duplicate";
|
|
197
47
|
dead_letter: "dead_letter";
|
|
198
|
-
received: "received";
|
|
199
|
-
evaluating: "evaluating";
|
|
200
|
-
rejected: "rejected";
|
|
201
|
-
escalated: "escalated";
|
|
202
48
|
wake_queued: "wake_queued";
|
|
203
49
|
wake_delivered: "wake_delivered";
|
|
204
|
-
failed: "failed";
|
|
205
50
|
}>;
|
|
206
51
|
export declare const AuditKindSchema: z.ZodEnum<{
|
|
207
52
|
error: "error";
|
|
208
|
-
"event.
|
|
209
|
-
"event.
|
|
210
|
-
"decision.evaluated": "decision.evaluated";
|
|
211
|
-
"lifecycle.transition": "lifecycle.transition";
|
|
53
|
+
"event.late_dropped": "event.late_dropped";
|
|
54
|
+
"event.buffer_overflow": "event.buffer_overflow";
|
|
212
55
|
"wake.queued": "wake.queued";
|
|
213
56
|
"wake.delivered": "wake.delivered";
|
|
214
57
|
"wake.retry_scheduled": "wake.retry_scheduled";
|
|
215
|
-
"wake.handled": "wake.handled";
|
|
216
58
|
"wake.dead_letter": "wake.dead_letter";
|
|
217
59
|
"trigger.partial": "trigger.partial";
|
|
218
60
|
"trigger.correlation": "trigger.correlation";
|
|
@@ -241,14 +83,11 @@ export declare const AuditRecordSchema: z.ZodObject<{
|
|
|
241
83
|
timestamp: z.ZodString;
|
|
242
84
|
kind: z.ZodEnum<{
|
|
243
85
|
error: "error";
|
|
244
|
-
"event.
|
|
245
|
-
"event.
|
|
246
|
-
"decision.evaluated": "decision.evaluated";
|
|
247
|
-
"lifecycle.transition": "lifecycle.transition";
|
|
86
|
+
"event.late_dropped": "event.late_dropped";
|
|
87
|
+
"event.buffer_overflow": "event.buffer_overflow";
|
|
248
88
|
"wake.queued": "wake.queued";
|
|
249
89
|
"wake.delivered": "wake.delivered";
|
|
250
90
|
"wake.retry_scheduled": "wake.retry_scheduled";
|
|
251
|
-
"wake.handled": "wake.handled";
|
|
252
91
|
"wake.dead_letter": "wake.dead_letter";
|
|
253
92
|
"trigger.partial": "trigger.partial";
|
|
254
93
|
"trigger.correlation": "trigger.correlation";
|
|
@@ -273,7 +112,6 @@ export declare const AuditRecordSchema: z.ZodObject<{
|
|
|
273
112
|
entityType: z.ZodEnum<{
|
|
274
113
|
runtime: "runtime";
|
|
275
114
|
event: "event";
|
|
276
|
-
decision: "decision";
|
|
277
115
|
wake: "wake";
|
|
278
116
|
subscription: "subscription";
|
|
279
117
|
trigger_match: "trigger_match";
|
|
@@ -284,30 +122,14 @@ export declare const AuditRecordSchema: z.ZodObject<{
|
|
|
284
122
|
}>;
|
|
285
123
|
entityId: z.ZodString;
|
|
286
124
|
fromState: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
287
|
-
matched: "matched";
|
|
288
|
-
handled: "handled";
|
|
289
|
-
duplicate: "duplicate";
|
|
290
125
|
dead_letter: "dead_letter";
|
|
291
|
-
received: "received";
|
|
292
|
-
evaluating: "evaluating";
|
|
293
|
-
rejected: "rejected";
|
|
294
|
-
escalated: "escalated";
|
|
295
126
|
wake_queued: "wake_queued";
|
|
296
127
|
wake_delivered: "wake_delivered";
|
|
297
|
-
failed: "failed";
|
|
298
128
|
}>>>;
|
|
299
129
|
toState: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
300
|
-
matched: "matched";
|
|
301
|
-
handled: "handled";
|
|
302
|
-
duplicate: "duplicate";
|
|
303
130
|
dead_letter: "dead_letter";
|
|
304
|
-
received: "received";
|
|
305
|
-
evaluating: "evaluating";
|
|
306
|
-
rejected: "rejected";
|
|
307
|
-
escalated: "escalated";
|
|
308
131
|
wake_queued: "wake_queued";
|
|
309
132
|
wake_delivered: "wake_delivered";
|
|
310
|
-
failed: "failed";
|
|
311
133
|
}>>>;
|
|
312
134
|
details: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
313
135
|
previousHash: z.ZodNullable<z.ZodString>;
|
|
@@ -315,15 +137,8 @@ export declare const AuditRecordSchema: z.ZodObject<{
|
|
|
315
137
|
}, z.core.$strip>;
|
|
316
138
|
export type RuntimeTarget = z.infer<typeof RuntimeTargetSchema>;
|
|
317
139
|
export type McpEventOccurrence = z.infer<typeof McpEventOccurrenceSchema>;
|
|
318
|
-
export type SemanticConditionWire = z.infer<typeof SemanticConditionWireSchema>;
|
|
319
|
-
export type EventIngestRequest = z.infer<typeof EventIngestRequestSchema>;
|
|
320
|
-
export type EventLineage = z.infer<typeof EventLineageSchema>;
|
|
321
|
-
export type SemanticDecisionRecord = z.infer<typeof SemanticDecisionRecordSchema>;
|
|
322
140
|
export type WakeRecord = z.infer<typeof WakeRecordSchema>;
|
|
323
141
|
export type LifecycleState = z.infer<typeof LifecycleStateSchema>;
|
|
324
142
|
export type AuditRecord = z.infer<typeof AuditRecordSchema>;
|
|
325
|
-
export declare function parseEventIngestRequest(value: unknown): EventIngestRequest;
|
|
326
|
-
export declare function parseEventLineage(value: unknown): EventLineage;
|
|
327
|
-
export declare function parseSemanticDecisionRecord(value: unknown): SemanticDecisionRecord;
|
|
328
143
|
export declare function parseWakeRecord(value: unknown): WakeRecord;
|
|
329
144
|
export declare function parseAuditRecord(value: unknown): AuditRecord;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { EVENT_INTELLIGENCE_PROTOCOL, EVENT_INTELLIGENCE_PROTOCOL_VERSION, EVENT_INTELLIGENCE_SCHEMA_VERSION, } from './version.js';
|
|
3
2
|
const Id = z.string().min(1).max(200);
|
|
4
3
|
const Timestamp = z.string().datetime({ offset: true });
|
|
5
4
|
export const RuntimeTargetSchema = z.object({
|
|
@@ -7,56 +6,6 @@ export const RuntimeTargetSchema = z.object({
|
|
|
7
6
|
kind: z.enum(['goal', 'session', 'conversation', 'task', 'spawn_template']),
|
|
8
7
|
id: Id,
|
|
9
8
|
});
|
|
10
|
-
export const EventSourceSchema = z.object({
|
|
11
|
-
serverId: Id,
|
|
12
|
-
transport: z.enum(['stdio', 'streamable_http', 'webhook', 'poll', 'internal']),
|
|
13
|
-
provider: z.string().min(1).optional(),
|
|
14
|
-
cursor: z.string().nullable().optional(),
|
|
15
|
-
});
|
|
16
|
-
export const EventLineageSchema = z.object({
|
|
17
|
-
protocol: z.literal(EVENT_INTELLIGENCE_PROTOCOL),
|
|
18
|
-
protocolVersion: z.literal(EVENT_INTELLIGENCE_PROTOCOL_VERSION),
|
|
19
|
-
schemaVersion: z.literal(EVENT_INTELLIGENCE_SCHEMA_VERSION),
|
|
20
|
-
traceId: Id,
|
|
21
|
-
environmentId: Id,
|
|
22
|
-
subscriptionId: Id,
|
|
23
|
-
sourceEventId: Id,
|
|
24
|
-
observedAt: Timestamp,
|
|
25
|
-
source: EventSourceSchema,
|
|
26
|
-
target: RuntimeTargetSchema,
|
|
27
|
-
event: z.object({
|
|
28
|
-
name: z.string().min(1),
|
|
29
|
-
occurredAt: Timestamp,
|
|
30
|
-
payloadHash: z.string().regex(/^[a-f0-9]{64}$/),
|
|
31
|
-
}),
|
|
32
|
-
});
|
|
33
|
-
export const SemanticDecisionRecordSchema = z.object({
|
|
34
|
-
decisionId: Id,
|
|
35
|
-
traceId: Id,
|
|
36
|
-
subscriptionId: Id,
|
|
37
|
-
sourceEventId: Id,
|
|
38
|
-
createdAt: Timestamp,
|
|
39
|
-
evaluator: z.string().min(1),
|
|
40
|
-
outcome: z.enum(['match', 'reject', 'uncertain']),
|
|
41
|
-
probability: z.number().min(0).max(1),
|
|
42
|
-
matched: z.boolean(),
|
|
43
|
-
shouldEscalate: z.boolean(),
|
|
44
|
-
policy: z.object({
|
|
45
|
-
matchThreshold: z.number().min(0).max(1),
|
|
46
|
-
rejectThreshold: z.number().min(0).max(1),
|
|
47
|
-
uncertain: z.enum(['escalate', 'reject', 'match']),
|
|
48
|
-
}),
|
|
49
|
-
inputFields: z.array(z.string().min(1)),
|
|
50
|
-
providerEvidence: z.object({
|
|
51
|
-
requestedModel: z.string().min(1).optional(),
|
|
52
|
-
resolvedModel: z.string().min(1).optional(),
|
|
53
|
-
requestId: z.string().min(1).optional(),
|
|
54
|
-
httpStatus: z.number().int().min(100).max(599).optional(),
|
|
55
|
-
inputTokens: z.number().int().nonnegative().optional(),
|
|
56
|
-
outputTokens: z.number().int().nonnegative().optional(),
|
|
57
|
-
providerReportedCost: z.number().nonnegative().optional(),
|
|
58
|
-
}).optional(),
|
|
59
|
-
});
|
|
60
9
|
export const WakeRecordSchema = z.object({
|
|
61
10
|
wakeId: Id,
|
|
62
11
|
traceId: Id,
|
|
@@ -65,7 +14,7 @@ export const WakeRecordSchema = z.object({
|
|
|
65
14
|
sourceEventId: Id,
|
|
66
15
|
createdAt: Timestamp,
|
|
67
16
|
target: RuntimeTargetSchema,
|
|
68
|
-
status: z.enum(['queued', 'delivered', '
|
|
17
|
+
status: z.enum(['queued', 'delivered', 'dead_letter']),
|
|
69
18
|
runtimeReceiptId: Id.optional(),
|
|
70
19
|
});
|
|
71
20
|
export const McpEventOccurrenceSchema = z.object({
|
|
@@ -76,50 +25,17 @@ export const McpEventOccurrenceSchema = z.object({
|
|
|
76
25
|
cursor: z.string().nullable().optional(),
|
|
77
26
|
_meta: z.record(z.string(), z.unknown()).optional(),
|
|
78
27
|
});
|
|
79
|
-
export const SemanticConditionWireSchema = z.object({
|
|
80
|
-
type: z.literal('semantic_boolean'),
|
|
81
|
-
instruction: z.string().min(1),
|
|
82
|
-
input: z.array(z.string().min(1)).min(1),
|
|
83
|
-
matchThreshold: z.number().min(0).max(1),
|
|
84
|
-
rejectThreshold: z.number().min(0).max(1),
|
|
85
|
-
uncertain: z.enum(['escalate', 'reject', 'match']),
|
|
86
|
-
});
|
|
87
|
-
export const EventIngestRequestSchema = z.object({
|
|
88
|
-
event: McpEventOccurrenceSchema,
|
|
89
|
-
context: z.object({
|
|
90
|
-
traceId: Id.optional(),
|
|
91
|
-
environmentId: Id,
|
|
92
|
-
subscriptionId: Id,
|
|
93
|
-
serverId: Id,
|
|
94
|
-
transport: z.enum(['stdio', 'streamable_http', 'webhook', 'poll', 'internal']),
|
|
95
|
-
provider: z.string().min(1).optional(),
|
|
96
|
-
target: RuntimeTargetSchema,
|
|
97
|
-
}),
|
|
98
|
-
semanticCondition: SemanticConditionWireSchema.optional(),
|
|
99
|
-
wakeOnEscalation: z.boolean().default(false),
|
|
100
|
-
});
|
|
101
28
|
export const LifecycleStateSchema = z.enum([
|
|
102
|
-
'received',
|
|
103
|
-
'duplicate',
|
|
104
|
-
'evaluating',
|
|
105
|
-
'matched',
|
|
106
|
-
'rejected',
|
|
107
|
-
'escalated',
|
|
108
29
|
'wake_queued',
|
|
109
30
|
'wake_delivered',
|
|
110
|
-
'handled',
|
|
111
|
-
'failed',
|
|
112
31
|
'dead_letter',
|
|
113
32
|
]);
|
|
114
33
|
export const AuditKindSchema = z.enum([
|
|
115
|
-
'event.
|
|
116
|
-
'event.
|
|
117
|
-
'decision.evaluated',
|
|
118
|
-
'lifecycle.transition',
|
|
34
|
+
'event.late_dropped',
|
|
35
|
+
'event.buffer_overflow',
|
|
119
36
|
'wake.queued',
|
|
120
37
|
'wake.delivered',
|
|
121
38
|
'wake.retry_scheduled',
|
|
122
|
-
'wake.handled',
|
|
123
39
|
'wake.dead_letter',
|
|
124
40
|
'trigger.partial',
|
|
125
41
|
'trigger.correlation',
|
|
@@ -150,7 +66,6 @@ export const AuditRecordSchema = z.object({
|
|
|
150
66
|
kind: AuditKindSchema,
|
|
151
67
|
entityType: z.enum([
|
|
152
68
|
'event',
|
|
153
|
-
'decision',
|
|
154
69
|
'wake',
|
|
155
70
|
'subscription',
|
|
156
71
|
'runtime',
|
|
@@ -167,15 +82,6 @@ export const AuditRecordSchema = z.object({
|
|
|
167
82
|
previousHash: z.string().regex(/^[a-f0-9]{64}$/).nullable(),
|
|
168
83
|
hash: z.string().regex(/^[a-f0-9]{64}$/),
|
|
169
84
|
});
|
|
170
|
-
export function parseEventIngestRequest(value) {
|
|
171
|
-
return EventIngestRequestSchema.parse(value);
|
|
172
|
-
}
|
|
173
|
-
export function parseEventLineage(value) {
|
|
174
|
-
return EventLineageSchema.parse(value);
|
|
175
|
-
}
|
|
176
|
-
export function parseSemanticDecisionRecord(value) {
|
|
177
|
-
return SemanticDecisionRecordSchema.parse(value);
|
|
178
|
-
}
|
|
179
85
|
export function parseWakeRecord(value) {
|
|
180
86
|
return WakeRecordSchema.parse(value);
|
|
181
87
|
}
|
|
@@ -16,14 +16,50 @@ export declare const TriggerPlanEventSchema: z.ZodObject<{
|
|
|
16
16
|
path: z.ZodString;
|
|
17
17
|
op: z.ZodLiteral<"contains">;
|
|
18
18
|
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
19
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
20
|
+
path: z.ZodString;
|
|
21
|
+
op: z.ZodLiteral<"startsWith">;
|
|
22
|
+
value: z.ZodString;
|
|
23
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
24
|
+
path: z.ZodString;
|
|
25
|
+
op: z.ZodLiteral<"endsWith">;
|
|
26
|
+
value: z.ZodString;
|
|
27
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
28
|
+
path: z.ZodString;
|
|
29
|
+
op: z.ZodLiteral<"regex">;
|
|
30
|
+
value: z.ZodString;
|
|
31
|
+
flags: z.ZodOptional<z.ZodString>;
|
|
19
32
|
}, z.core.$strip>, z.ZodObject<{
|
|
20
33
|
path: z.ZodString;
|
|
21
34
|
op: z.ZodLiteral<"in">;
|
|
22
35
|
value: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
36
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
37
|
+
path: z.ZodString;
|
|
38
|
+
op: z.ZodLiteral<"notIn">;
|
|
39
|
+
value: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
40
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
41
|
+
path: z.ZodString;
|
|
42
|
+
op: z.ZodLiteral<"between">;
|
|
43
|
+
value: z.ZodTuple<[z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>], null>;
|
|
23
44
|
}, z.core.$strip>, z.ZodObject<{
|
|
24
45
|
path: z.ZodString;
|
|
25
46
|
op: z.ZodLiteral<"exists">;
|
|
26
47
|
value: z.ZodDefault<z.ZodBoolean>;
|
|
48
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
49
|
+
path: z.ZodString;
|
|
50
|
+
op: z.ZodLiteral<"isNull">;
|
|
51
|
+
value: z.ZodDefault<z.ZodBoolean>;
|
|
52
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
53
|
+
path: z.ZodString;
|
|
54
|
+
op: z.ZodLiteral<"type">;
|
|
55
|
+
value: z.ZodEnum<{
|
|
56
|
+
string: "string";
|
|
57
|
+
number: "number";
|
|
58
|
+
boolean: "boolean";
|
|
59
|
+
object: "object";
|
|
60
|
+
null: "null";
|
|
61
|
+
array: "array";
|
|
62
|
+
}>;
|
|
27
63
|
}, z.core.$strip>, z.ZodObject<{
|
|
28
64
|
path: z.ZodString;
|
|
29
65
|
op: z.ZodLiteral<"gt">;
|
|
@@ -42,15 +78,6 @@ export declare const TriggerPlanEventSchema: z.ZodObject<{
|
|
|
42
78
|
value: z.ZodNumber;
|
|
43
79
|
}, z.core.$strip>], "op">>>;
|
|
44
80
|
}, z.core.$strict>;
|
|
45
|
-
export declare const TriggerPlanMatchSchema: z.ZodUnion<readonly [z.ZodEnum<{
|
|
46
|
-
any: "any";
|
|
47
|
-
sequence: "sequence";
|
|
48
|
-
all: "all";
|
|
49
|
-
}>, z.ZodObject<{
|
|
50
|
-
kind: z.ZodLiteral<"count">;
|
|
51
|
-
eventId: z.ZodString;
|
|
52
|
-
atLeast: z.ZodNumber;
|
|
53
|
-
}, z.core.$strict>]>;
|
|
54
81
|
export declare const TriggerPlanInputSchema: z.ZodObject<{
|
|
55
82
|
triggerId: z.ZodOptional<z.ZodString>;
|
|
56
83
|
version: z.ZodDefault<z.ZodString>;
|
|
@@ -72,14 +99,50 @@ export declare const TriggerPlanInputSchema: z.ZodObject<{
|
|
|
72
99
|
path: z.ZodString;
|
|
73
100
|
op: z.ZodLiteral<"contains">;
|
|
74
101
|
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
102
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
103
|
+
path: z.ZodString;
|
|
104
|
+
op: z.ZodLiteral<"startsWith">;
|
|
105
|
+
value: z.ZodString;
|
|
106
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
107
|
+
path: z.ZodString;
|
|
108
|
+
op: z.ZodLiteral<"endsWith">;
|
|
109
|
+
value: z.ZodString;
|
|
110
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
111
|
+
path: z.ZodString;
|
|
112
|
+
op: z.ZodLiteral<"regex">;
|
|
113
|
+
value: z.ZodString;
|
|
114
|
+
flags: z.ZodOptional<z.ZodString>;
|
|
75
115
|
}, z.core.$strip>, z.ZodObject<{
|
|
76
116
|
path: z.ZodString;
|
|
77
117
|
op: z.ZodLiteral<"in">;
|
|
78
118
|
value: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
119
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
120
|
+
path: z.ZodString;
|
|
121
|
+
op: z.ZodLiteral<"notIn">;
|
|
122
|
+
value: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
123
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
124
|
+
path: z.ZodString;
|
|
125
|
+
op: z.ZodLiteral<"between">;
|
|
126
|
+
value: z.ZodTuple<[z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>], null>;
|
|
79
127
|
}, z.core.$strip>, z.ZodObject<{
|
|
80
128
|
path: z.ZodString;
|
|
81
129
|
op: z.ZodLiteral<"exists">;
|
|
82
130
|
value: z.ZodDefault<z.ZodBoolean>;
|
|
131
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
132
|
+
path: z.ZodString;
|
|
133
|
+
op: z.ZodLiteral<"isNull">;
|
|
134
|
+
value: z.ZodDefault<z.ZodBoolean>;
|
|
135
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
136
|
+
path: z.ZodString;
|
|
137
|
+
op: z.ZodLiteral<"type">;
|
|
138
|
+
value: z.ZodEnum<{
|
|
139
|
+
string: "string";
|
|
140
|
+
number: "number";
|
|
141
|
+
boolean: "boolean";
|
|
142
|
+
object: "object";
|
|
143
|
+
null: "null";
|
|
144
|
+
array: "array";
|
|
145
|
+
}>;
|
|
83
146
|
}, z.core.$strip>, z.ZodObject<{
|
|
84
147
|
path: z.ZodString;
|
|
85
148
|
op: z.ZodLiteral<"gt">;
|
|
@@ -98,16 +161,44 @@ export declare const TriggerPlanInputSchema: z.ZodObject<{
|
|
|
98
161
|
value: z.ZodNumber;
|
|
99
162
|
}, z.core.$strip>], "op">>>;
|
|
100
163
|
}, z.core.$strict>>;
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
164
|
+
pattern: z.ZodOptional<z.ZodObject<{
|
|
165
|
+
version: z.ZodDefault<z.ZodLiteral<"2">>;
|
|
166
|
+
root: z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>;
|
|
167
|
+
partitionBy: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
168
|
+
key: z.ZodString;
|
|
169
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
170
|
+
ref: z.ZodString;
|
|
171
|
+
path: z.ZodString;
|
|
172
|
+
}, z.core.$strict>>;
|
|
173
|
+
}, z.core.$strict>>>;
|
|
174
|
+
selection: z.ZodDefault<z.ZodObject<{
|
|
175
|
+
overlap: z.ZodDefault<z.ZodEnum<{
|
|
176
|
+
allow: "allow";
|
|
177
|
+
disallow: "disallow";
|
|
178
|
+
}>>;
|
|
179
|
+
afterMatch: z.ZodDefault<z.ZodUnion<readonly [z.ZodEnum<{
|
|
180
|
+
skipPastLast: "skipPastLast";
|
|
181
|
+
skipToNext: "skipToNext";
|
|
182
|
+
keepAll: "keepAll";
|
|
183
|
+
}>, z.ZodObject<{
|
|
184
|
+
kind: z.ZodEnum<{
|
|
185
|
+
skipToFirst: "skipToFirst";
|
|
186
|
+
skipToLast: "skipToLast";
|
|
187
|
+
}>;
|
|
188
|
+
ref: z.ZodString;
|
|
189
|
+
}, z.core.$strict>]>>;
|
|
190
|
+
maxMatchesPerEvent: z.ZodDefault<z.ZodNumber>;
|
|
191
|
+
}, z.core.$strict>>;
|
|
192
|
+
execution: z.ZodDefault<z.ZodObject<{
|
|
193
|
+
maxCandidates: z.ZodDefault<z.ZodNumber>;
|
|
194
|
+
maxSemanticEvaluations: z.ZodDefault<z.ZodNumber>;
|
|
195
|
+
maxBufferedEvents: z.ZodDefault<z.ZodNumber>;
|
|
196
|
+
}, z.core.$strict>>;
|
|
197
|
+
}, z.core.$strict>>;
|
|
110
198
|
withinMs: z.ZodDefault<z.ZodNumber>;
|
|
199
|
+
eventTime: z.ZodOptional<z.ZodObject<{
|
|
200
|
+
allowedLatenessMs: z.ZodNumber;
|
|
201
|
+
}, z.core.$strict>>;
|
|
111
202
|
lifecycle: z.ZodOptional<z.ZodObject<{
|
|
112
203
|
oneShot: z.ZodOptional<z.ZodBoolean>;
|
|
113
204
|
maxFirings: z.ZodOptional<z.ZodNumber>;
|
|
@@ -116,7 +207,8 @@ export declare const TriggerPlanInputSchema: z.ZodObject<{
|
|
|
116
207
|
leaseUntil: z.ZodOptional<z.ZodString>;
|
|
117
208
|
completeOnGoal: z.ZodOptional<z.ZodBoolean>;
|
|
118
209
|
}, z.core.$strict>>;
|
|
119
|
-
|
|
210
|
+
conditionOnly: z.ZodDefault<z.ZodBoolean>;
|
|
211
|
+
target: z.ZodOptional<z.ZodObject<{
|
|
120
212
|
runtime: z.ZodString;
|
|
121
213
|
kind: z.ZodEnum<{
|
|
122
214
|
goal: "goal";
|
|
@@ -126,8 +218,8 @@ export declare const TriggerPlanInputSchema: z.ZodObject<{
|
|
|
126
218
|
spawn_template: "spawn_template";
|
|
127
219
|
}>;
|
|
128
220
|
id: z.ZodString;
|
|
129
|
-
}, z.core.$strip
|
|
130
|
-
continuation: z.ZodObject<{
|
|
221
|
+
}, z.core.$strip>>;
|
|
222
|
+
continuation: z.ZodOptional<z.ZodObject<{
|
|
131
223
|
instruction: z.ZodString;
|
|
132
224
|
contextPolicy: z.ZodDefault<z.ZodObject<{
|
|
133
225
|
evidence: z.ZodDefault<z.ZodEnum<{
|
|
@@ -137,24 +229,8 @@ export declare const TriggerPlanInputSchema: z.ZodObject<{
|
|
|
137
229
|
maxEvents: z.ZodDefault<z.ZodNumber>;
|
|
138
230
|
includeData: z.ZodDefault<z.ZodBoolean>;
|
|
139
231
|
}, z.core.$strict>>;
|
|
140
|
-
}, z.core.$strict
|
|
141
|
-
correlateBy: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
142
|
-
eventId: z.ZodString;
|
|
143
|
-
path: z.ZodString;
|
|
144
|
-
}, z.core.$strict>>>;
|
|
145
|
-
semanticCorrelation: z.ZodOptional<z.ZodObject<{
|
|
146
|
-
instruction: z.ZodString;
|
|
147
|
-
input: z.ZodArray<z.ZodString>;
|
|
148
|
-
matchThreshold: z.ZodNumber;
|
|
149
|
-
rejectThreshold: z.ZodNumber;
|
|
150
|
-
uncertain: z.ZodDefault<z.ZodEnum<{
|
|
151
|
-
match: "match";
|
|
152
|
-
reject: "reject";
|
|
153
|
-
escalate: "escalate";
|
|
154
|
-
}>>;
|
|
155
|
-
}, z.core.$strip>>;
|
|
232
|
+
}, z.core.$strict>>;
|
|
156
233
|
}, z.core.$strict>;
|
|
157
234
|
export type TriggerPlanEvent = z.infer<typeof TriggerPlanEventSchema>;
|
|
158
|
-
export type TriggerPlanMatch = z.infer<typeof TriggerPlanMatchSchema>;
|
|
159
235
|
export type TriggerPlanInput = z.infer<typeof TriggerPlanInputSchema>;
|
|
160
236
|
export declare function parseTriggerPlanInput(value: unknown): TriggerPlanInput;
|