@sequenceholdings/managed-functions 0.4.5 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +147 -12
- package/dist/abrigo-contract.d.ts +2 -92
- package/dist/abrigo-contract.js +12 -53
- package/dist/abrigo-response.d.ts +1 -6
- package/dist/abrigo-response.js +3 -25
- package/dist/abrigo.d.ts +5 -5
- package/dist/abrigo.js +66 -92
- package/dist/agent-evidence.d.ts +5 -5
- package/dist/agent-evidence.js +58 -48
- package/dist/agent-source-evidence-contract.d.ts +2 -1197
- package/dist/agent-source-evidence-contract.js +24 -94
- package/dist/agents-contract.d.ts +2 -99
- package/dist/agents-contract.js +13 -67
- package/dist/agents.d.ts +5 -5
- package/dist/agents.js +79 -44
- package/dist/capabilities.d.ts +1 -1
- package/dist/capabilities.js +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.js +4 -1
- package/dist/directory-config.d.ts +1 -23
- package/dist/directory-config.js +8 -20
- package/dist/directory-contract.d.ts +2 -68
- package/dist/directory-contract.js +13 -55
- package/dist/directory-roster-contract.d.ts +2 -22
- package/dist/directory-roster-contract.js +7 -22
- package/dist/directory.d.ts +4 -8
- package/dist/directory.js +15 -33
- package/dist/group-roster-access.d.ts +7 -0
- package/dist/group-roster-access.js +8 -0
- package/dist/index.d.ts +49 -46
- package/dist/index.js +8 -1
- package/dist/invocation-client.d.ts +4 -4
- package/dist/invocation-client.js +32 -60
- package/dist/invocation-contract.d.ts +2 -59
- package/dist/invocation-contract.js +10 -61
- package/dist/invocation.d.ts +4 -4
- package/dist/invocation.js +42 -63
- package/dist/lattice-provenance-contract.d.ts +2 -607
- package/dist/lattice-provenance-contract.js +14 -154
- package/dist/lattice-provenance.d.ts +3 -3
- package/dist/lattice-provenance.js +46 -97
- package/dist/monitoring-annotations.d.ts +2 -53
- package/dist/monitoring-annotations.js +2 -51
- package/dist/monitoring-contract.d.ts +5 -460
- package/dist/monitoring-contract.js +37 -77
- package/dist/monitoring-events.d.ts +2 -252
- package/dist/monitoring-events.js +15 -125
- package/dist/monitoring.d.ts +3 -3
- package/dist/monitoring.js +41 -41
- package/dist/orm.d.ts +10 -1
- package/dist/orm.js +27 -7
- package/dist/platform-client.d.ts +27 -0
- package/dist/platform-client.js +79 -0
- package/dist/platform-domains.d.ts +1671 -0
- package/dist/platform-domains.js +77 -0
- package/dist/processes-contract.d.ts +2 -149
- package/dist/processes-contract.js +17 -100
- package/dist/processes.d.ts +3 -3
- package/dist/processes.js +64 -49
- package/dist/runtime.cjs +4251 -1666
- package/dist/service-directory-roster.d.ts +12 -3
- package/dist/service-directory-roster.js +11 -17
- package/dist/service-directory.d.ts +4 -8
- package/dist/service-directory.js +16 -67
- package/dist/storage.d.ts +36 -35
- package/dist/storage.js +12 -5
- package/dist/workflow-source-contract.d.ts +2 -524
- package/dist/workflow-source-contract.js +16 -56
- package/dist/workflow-source.d.ts +3 -3
- package/dist/workflow-source.js +106 -43
- package/package.json +4 -3
|
@@ -1,463 +1,8 @@
|
|
|
1
|
-
import { z } from
|
|
2
|
-
import { functionMonitoringAnnotationSchema } from
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export declare
|
|
6
|
-
export declare const MONITORING_PRODUCER_CAPABILITY = "emit-monitoring";
|
|
7
|
-
export declare const MONITORING_CATALOG_CAPABILITY = "read-monitoring-catalog";
|
|
8
|
-
export declare const MAX_MONITORING_DELIVERY_BYTES: number;
|
|
9
|
-
export declare const functionMonitoringScopesSchema: z.ZodObject<{
|
|
10
|
-
producers: z.ZodArray<z.ZodString>;
|
|
11
|
-
}, z.core.$strict>;
|
|
12
|
-
export declare function readFunctionMonitoringScopes(manifest: unknown): string[];
|
|
13
|
-
export declare const monitoringEventsSchema: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
14
|
-
contextType: z.ZodLiteral<"artifact_delta">;
|
|
15
|
-
context: z.ZodObject<{
|
|
16
|
-
artifactKind: z.ZodString;
|
|
17
|
-
sectionPath: z.ZodString;
|
|
18
|
-
before: z.ZodString;
|
|
19
|
-
after: z.ZodString;
|
|
20
|
-
changeKind: z.ZodEnum<{
|
|
21
|
-
added: "added";
|
|
22
|
-
removed: "removed";
|
|
23
|
-
modified: "modified";
|
|
24
|
-
}>;
|
|
25
|
-
category: z.ZodOptional<z.ZodString>;
|
|
26
|
-
sourceRefs: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
27
|
-
workflowId: z.ZodOptional<z.ZodString>;
|
|
28
|
-
}, z.core.$strict>;
|
|
29
|
-
idempotencyKey: z.ZodString;
|
|
30
|
-
subjectId: z.ZodString;
|
|
31
|
-
subjectKind: z.ZodEnum<{
|
|
32
|
-
workflow: "workflow";
|
|
33
|
-
agent: "agent";
|
|
34
|
-
}>;
|
|
35
|
-
occurredAt: z.ZodString;
|
|
36
|
-
deltaReason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
37
|
-
deltaSource: z.ZodDefault<z.ZodEnum<{
|
|
38
|
-
unknown: "unknown";
|
|
39
|
-
human: "human";
|
|
40
|
-
llm: "llm";
|
|
41
|
-
}>>;
|
|
42
|
-
actionability: z.ZodDefault<z.ZodLiteral<"unknown">>;
|
|
43
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
44
|
-
contextType: z.ZodLiteral<"dti_delta">;
|
|
45
|
-
context: z.ZodObject<{
|
|
46
|
-
stageId: z.ZodString;
|
|
47
|
-
loanId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
48
|
-
fieldPath: z.ZodString;
|
|
49
|
-
before: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
|
|
50
|
-
after: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
|
|
51
|
-
section: z.ZodOptional<z.ZodEnum<{
|
|
52
|
-
debt: "debt";
|
|
53
|
-
income: "income";
|
|
54
|
-
other: "other";
|
|
55
|
-
}>>;
|
|
56
|
-
itemLabel: z.ZodOptional<z.ZodString>;
|
|
57
|
-
calculatorType: z.ZodOptional<z.ZodEnum<{
|
|
58
|
-
basic: "basic";
|
|
59
|
-
advanced: "advanced";
|
|
60
|
-
}>>;
|
|
61
|
-
workflowId: z.ZodOptional<z.ZodString>;
|
|
62
|
-
sourceDocRefs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
63
|
-
}, z.core.$strict>;
|
|
64
|
-
idempotencyKey: z.ZodString;
|
|
65
|
-
subjectId: z.ZodString;
|
|
66
|
-
subjectKind: z.ZodEnum<{
|
|
67
|
-
workflow: "workflow";
|
|
68
|
-
agent: "agent";
|
|
69
|
-
}>;
|
|
70
|
-
occurredAt: z.ZodString;
|
|
71
|
-
deltaReason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
72
|
-
deltaSource: z.ZodDefault<z.ZodEnum<{
|
|
73
|
-
unknown: "unknown";
|
|
74
|
-
human: "human";
|
|
75
|
-
llm: "llm";
|
|
76
|
-
}>>;
|
|
77
|
-
actionability: z.ZodDefault<z.ZodLiteral<"unknown">>;
|
|
78
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
79
|
-
contextType: z.ZodLiteral<"doc_extract_edit">;
|
|
80
|
-
context: z.ZodObject<{
|
|
81
|
-
documentId: z.ZodString;
|
|
82
|
-
docType: z.ZodString;
|
|
83
|
-
fieldPath: z.ZodString;
|
|
84
|
-
oldValue: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
|
|
85
|
-
newValue: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
|
|
86
|
-
rowKey: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
|
|
87
|
-
stageId: z.ZodOptional<z.ZodString>;
|
|
88
|
-
workflowId: z.ZodOptional<z.ZodString>;
|
|
89
|
-
citation: z.ZodOptional<z.ZodObject<{
|
|
90
|
-
page: z.ZodNumber;
|
|
91
|
-
region: z.ZodOptional<z.ZodString>;
|
|
92
|
-
}, z.core.$strict>>;
|
|
93
|
-
}, z.core.$strict>;
|
|
94
|
-
idempotencyKey: z.ZodString;
|
|
95
|
-
subjectId: z.ZodString;
|
|
96
|
-
subjectKind: z.ZodEnum<{
|
|
97
|
-
workflow: "workflow";
|
|
98
|
-
agent: "agent";
|
|
99
|
-
}>;
|
|
100
|
-
occurredAt: z.ZodString;
|
|
101
|
-
deltaReason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
102
|
-
deltaSource: z.ZodDefault<z.ZodEnum<{
|
|
103
|
-
unknown: "unknown";
|
|
104
|
-
human: "human";
|
|
105
|
-
llm: "llm";
|
|
106
|
-
}>>;
|
|
107
|
-
actionability: z.ZodDefault<z.ZodLiteral<"unknown">>;
|
|
108
|
-
}, z.core.$strict>], "contextType">>;
|
|
109
|
-
export declare function monitoringPayloadHash({ events, observation }: {
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { monitoringEventsSchema, functionMonitoringAnnotationSchema } from "@sequenceholdings/platform/contracts";
|
|
3
|
+
export { FUNCTION_MONITORING_TOKEN_HEADER, FUNCTION_MONITORING_DELIVERIES_PATH, MONITORING_PRODUCER_CAPABILITY, MONITORING_CATALOG_CAPABILITY, MAX_MONITORING_DELIVERY_BYTES, functionMonitoringScopesSchema, readFunctionMonitoringScopes, monitoringEventsSchema, monitoringDeliveryKeySchema, monitoringCatalogQuerySchema, monitoringBucketCatalogSchema, monitoringPublishSchema, functionMonitoringRequestSchema, monitoringDeliveryReceiptSchema, FunctionMonitoringError, } from "@sequenceholdings/platform/contracts";
|
|
4
|
+
export type { MonitoringCatalogQuery, MonitoringBucketCatalog, MonitoringPublish, MonitoringDeliveryKey, FunctionMonitoringRequest, MonitoringDeliveryReceipt, MonitoringDeltaEvent, } from "@sequenceholdings/platform/contracts";
|
|
5
|
+
export declare function monitoringPayloadHash({ events, observation, }: {
|
|
110
6
|
events: z.input<typeof monitoringEventsSchema>;
|
|
111
7
|
observation?: z.input<typeof functionMonitoringAnnotationSchema>;
|
|
112
8
|
}): string;
|
|
113
|
-
export declare const monitoringDeliveryKeySchema: z.ZodObject<{
|
|
114
|
-
producer: z.ZodString;
|
|
115
|
-
businessKey: z.ZodString;
|
|
116
|
-
}, z.core.$strict>;
|
|
117
|
-
export declare const monitoringCatalogQuerySchema: z.ZodObject<{
|
|
118
|
-
producer: z.ZodString;
|
|
119
|
-
}, z.core.$strict>;
|
|
120
|
-
export declare const monitoringBucketCatalogSchema: z.ZodObject<{
|
|
121
|
-
producer: z.ZodString;
|
|
122
|
-
complete: z.ZodLiteral<true>;
|
|
123
|
-
buckets: z.ZodArray<z.ZodObject<{
|
|
124
|
-
slug: z.ZodString;
|
|
125
|
-
name: z.ZodString;
|
|
126
|
-
description: z.ZodString;
|
|
127
|
-
severity: z.ZodEnum<{
|
|
128
|
-
critical: "critical";
|
|
129
|
-
high: "high";
|
|
130
|
-
medium: "medium";
|
|
131
|
-
low: "low";
|
|
132
|
-
}>;
|
|
133
|
-
category: z.ZodString;
|
|
134
|
-
}, z.core.$strict>>;
|
|
135
|
-
}, z.core.$strict>;
|
|
136
|
-
export type MonitoringCatalogQuery = z.infer<typeof monitoringCatalogQuerySchema>;
|
|
137
|
-
export type MonitoringBucketCatalog = z.infer<typeof monitoringBucketCatalogSchema>;
|
|
138
|
-
export declare const monitoringPublishSchema: z.ZodObject<{
|
|
139
|
-
producer: z.ZodString;
|
|
140
|
-
businessKey: z.ZodString;
|
|
141
|
-
payloadHash: z.ZodString;
|
|
142
|
-
events: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
143
|
-
contextType: z.ZodLiteral<"artifact_delta">;
|
|
144
|
-
context: z.ZodObject<{
|
|
145
|
-
artifactKind: z.ZodString;
|
|
146
|
-
sectionPath: z.ZodString;
|
|
147
|
-
before: z.ZodString;
|
|
148
|
-
after: z.ZodString;
|
|
149
|
-
changeKind: z.ZodEnum<{
|
|
150
|
-
added: "added";
|
|
151
|
-
removed: "removed";
|
|
152
|
-
modified: "modified";
|
|
153
|
-
}>;
|
|
154
|
-
category: z.ZodOptional<z.ZodString>;
|
|
155
|
-
sourceRefs: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
156
|
-
workflowId: z.ZodOptional<z.ZodString>;
|
|
157
|
-
}, z.core.$strict>;
|
|
158
|
-
idempotencyKey: z.ZodString;
|
|
159
|
-
subjectId: z.ZodString;
|
|
160
|
-
subjectKind: z.ZodEnum<{
|
|
161
|
-
workflow: "workflow";
|
|
162
|
-
agent: "agent";
|
|
163
|
-
}>;
|
|
164
|
-
occurredAt: z.ZodString;
|
|
165
|
-
deltaReason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
166
|
-
deltaSource: z.ZodDefault<z.ZodEnum<{
|
|
167
|
-
unknown: "unknown";
|
|
168
|
-
human: "human";
|
|
169
|
-
llm: "llm";
|
|
170
|
-
}>>;
|
|
171
|
-
actionability: z.ZodDefault<z.ZodLiteral<"unknown">>;
|
|
172
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
173
|
-
contextType: z.ZodLiteral<"dti_delta">;
|
|
174
|
-
context: z.ZodObject<{
|
|
175
|
-
stageId: z.ZodString;
|
|
176
|
-
loanId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
177
|
-
fieldPath: z.ZodString;
|
|
178
|
-
before: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
|
|
179
|
-
after: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
|
|
180
|
-
section: z.ZodOptional<z.ZodEnum<{
|
|
181
|
-
debt: "debt";
|
|
182
|
-
income: "income";
|
|
183
|
-
other: "other";
|
|
184
|
-
}>>;
|
|
185
|
-
itemLabel: z.ZodOptional<z.ZodString>;
|
|
186
|
-
calculatorType: z.ZodOptional<z.ZodEnum<{
|
|
187
|
-
basic: "basic";
|
|
188
|
-
advanced: "advanced";
|
|
189
|
-
}>>;
|
|
190
|
-
workflowId: z.ZodOptional<z.ZodString>;
|
|
191
|
-
sourceDocRefs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
192
|
-
}, z.core.$strict>;
|
|
193
|
-
idempotencyKey: z.ZodString;
|
|
194
|
-
subjectId: z.ZodString;
|
|
195
|
-
subjectKind: z.ZodEnum<{
|
|
196
|
-
workflow: "workflow";
|
|
197
|
-
agent: "agent";
|
|
198
|
-
}>;
|
|
199
|
-
occurredAt: z.ZodString;
|
|
200
|
-
deltaReason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
201
|
-
deltaSource: z.ZodDefault<z.ZodEnum<{
|
|
202
|
-
unknown: "unknown";
|
|
203
|
-
human: "human";
|
|
204
|
-
llm: "llm";
|
|
205
|
-
}>>;
|
|
206
|
-
actionability: z.ZodDefault<z.ZodLiteral<"unknown">>;
|
|
207
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
208
|
-
contextType: z.ZodLiteral<"doc_extract_edit">;
|
|
209
|
-
context: z.ZodObject<{
|
|
210
|
-
documentId: z.ZodString;
|
|
211
|
-
docType: z.ZodString;
|
|
212
|
-
fieldPath: z.ZodString;
|
|
213
|
-
oldValue: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
|
|
214
|
-
newValue: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
|
|
215
|
-
rowKey: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
|
|
216
|
-
stageId: z.ZodOptional<z.ZodString>;
|
|
217
|
-
workflowId: z.ZodOptional<z.ZodString>;
|
|
218
|
-
citation: z.ZodOptional<z.ZodObject<{
|
|
219
|
-
page: z.ZodNumber;
|
|
220
|
-
region: z.ZodOptional<z.ZodString>;
|
|
221
|
-
}, z.core.$strict>>;
|
|
222
|
-
}, z.core.$strict>;
|
|
223
|
-
idempotencyKey: z.ZodString;
|
|
224
|
-
subjectId: z.ZodString;
|
|
225
|
-
subjectKind: z.ZodEnum<{
|
|
226
|
-
workflow: "workflow";
|
|
227
|
-
agent: "agent";
|
|
228
|
-
}>;
|
|
229
|
-
occurredAt: z.ZodString;
|
|
230
|
-
deltaReason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
231
|
-
deltaSource: z.ZodDefault<z.ZodEnum<{
|
|
232
|
-
unknown: "unknown";
|
|
233
|
-
human: "human";
|
|
234
|
-
llm: "llm";
|
|
235
|
-
}>>;
|
|
236
|
-
actionability: z.ZodDefault<z.ZodLiteral<"unknown">>;
|
|
237
|
-
}, z.core.$strict>], "contextType">>;
|
|
238
|
-
observation: z.ZodOptional<z.ZodObject<{
|
|
239
|
-
sourceType: z.ZodString;
|
|
240
|
-
sourceRef: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
241
|
-
generatingSubject: z.ZodObject<{
|
|
242
|
-
subjectId: z.ZodString;
|
|
243
|
-
subjectKind: z.ZodEnum<{
|
|
244
|
-
workflow: "workflow";
|
|
245
|
-
agent: "agent";
|
|
246
|
-
}>;
|
|
247
|
-
}, z.core.$strict>;
|
|
248
|
-
occurredAt: z.ZodISODateTime;
|
|
249
|
-
summary: z.ZodNullable<z.ZodString>;
|
|
250
|
-
metrics: z.ZodCustom<import("./monitoring-annotations").MonitoringJson, import("./monitoring-annotations").MonitoringJson>;
|
|
251
|
-
conversationFindings: z.ZodArray<z.ZodObject<{
|
|
252
|
-
type: z.ZodString;
|
|
253
|
-
description: z.ZodString;
|
|
254
|
-
excerpt: z.ZodString;
|
|
255
|
-
severity: z.ZodEnum<{
|
|
256
|
-
high: "high";
|
|
257
|
-
medium: "medium";
|
|
258
|
-
low: "low";
|
|
259
|
-
}>;
|
|
260
|
-
}, z.core.$strict>>;
|
|
261
|
-
classifications: z.ZodArray<z.ZodObject<{
|
|
262
|
-
matchedBucketSlug: z.ZodNullable<z.ZodString>;
|
|
263
|
-
newBucketProposal: z.ZodNullable<z.ZodObject<{
|
|
264
|
-
name: z.ZodString;
|
|
265
|
-
description: z.ZodString;
|
|
266
|
-
severity: z.ZodEnum<{
|
|
267
|
-
critical: "critical";
|
|
268
|
-
high: "high";
|
|
269
|
-
medium: "medium";
|
|
270
|
-
low: "low";
|
|
271
|
-
}>;
|
|
272
|
-
category: z.ZodString;
|
|
273
|
-
}, z.core.$strict>>;
|
|
274
|
-
excerpt: z.ZodString;
|
|
275
|
-
inputTags: z.ZodArray<z.ZodObject<{
|
|
276
|
-
type: z.ZodString;
|
|
277
|
-
value: z.ZodString;
|
|
278
|
-
}, z.core.$strict>>;
|
|
279
|
-
}, z.core.$strict>>;
|
|
280
|
-
coarseFallbacks: z.ZodArray<z.ZodObject<{
|
|
281
|
-
bucketSlug: z.ZodString;
|
|
282
|
-
excerpt: z.ZodString;
|
|
283
|
-
coarseCategory: z.ZodString;
|
|
284
|
-
}, z.core.$strict>>;
|
|
285
|
-
}, z.core.$strict>>;
|
|
286
|
-
}, z.core.$strict>;
|
|
287
|
-
export declare const functionMonitoringRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
288
|
-
producer: z.ZodString;
|
|
289
|
-
businessKey: z.ZodString;
|
|
290
|
-
payloadHash: z.ZodString;
|
|
291
|
-
events: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
292
|
-
contextType: z.ZodLiteral<"artifact_delta">;
|
|
293
|
-
context: z.ZodObject<{
|
|
294
|
-
artifactKind: z.ZodString;
|
|
295
|
-
sectionPath: z.ZodString;
|
|
296
|
-
before: z.ZodString;
|
|
297
|
-
after: z.ZodString;
|
|
298
|
-
changeKind: z.ZodEnum<{
|
|
299
|
-
added: "added";
|
|
300
|
-
removed: "removed";
|
|
301
|
-
modified: "modified";
|
|
302
|
-
}>;
|
|
303
|
-
category: z.ZodOptional<z.ZodString>;
|
|
304
|
-
sourceRefs: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
305
|
-
workflowId: z.ZodOptional<z.ZodString>;
|
|
306
|
-
}, z.core.$strict>;
|
|
307
|
-
idempotencyKey: z.ZodString;
|
|
308
|
-
subjectId: z.ZodString;
|
|
309
|
-
subjectKind: z.ZodEnum<{
|
|
310
|
-
workflow: "workflow";
|
|
311
|
-
agent: "agent";
|
|
312
|
-
}>;
|
|
313
|
-
occurredAt: z.ZodString;
|
|
314
|
-
deltaReason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
315
|
-
deltaSource: z.ZodDefault<z.ZodEnum<{
|
|
316
|
-
unknown: "unknown";
|
|
317
|
-
human: "human";
|
|
318
|
-
llm: "llm";
|
|
319
|
-
}>>;
|
|
320
|
-
actionability: z.ZodDefault<z.ZodLiteral<"unknown">>;
|
|
321
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
322
|
-
contextType: z.ZodLiteral<"dti_delta">;
|
|
323
|
-
context: z.ZodObject<{
|
|
324
|
-
stageId: z.ZodString;
|
|
325
|
-
loanId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
326
|
-
fieldPath: z.ZodString;
|
|
327
|
-
before: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
|
|
328
|
-
after: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
|
|
329
|
-
section: z.ZodOptional<z.ZodEnum<{
|
|
330
|
-
debt: "debt";
|
|
331
|
-
income: "income";
|
|
332
|
-
other: "other";
|
|
333
|
-
}>>;
|
|
334
|
-
itemLabel: z.ZodOptional<z.ZodString>;
|
|
335
|
-
calculatorType: z.ZodOptional<z.ZodEnum<{
|
|
336
|
-
basic: "basic";
|
|
337
|
-
advanced: "advanced";
|
|
338
|
-
}>>;
|
|
339
|
-
workflowId: z.ZodOptional<z.ZodString>;
|
|
340
|
-
sourceDocRefs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
341
|
-
}, z.core.$strict>;
|
|
342
|
-
idempotencyKey: z.ZodString;
|
|
343
|
-
subjectId: z.ZodString;
|
|
344
|
-
subjectKind: z.ZodEnum<{
|
|
345
|
-
workflow: "workflow";
|
|
346
|
-
agent: "agent";
|
|
347
|
-
}>;
|
|
348
|
-
occurredAt: z.ZodString;
|
|
349
|
-
deltaReason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
350
|
-
deltaSource: z.ZodDefault<z.ZodEnum<{
|
|
351
|
-
unknown: "unknown";
|
|
352
|
-
human: "human";
|
|
353
|
-
llm: "llm";
|
|
354
|
-
}>>;
|
|
355
|
-
actionability: z.ZodDefault<z.ZodLiteral<"unknown">>;
|
|
356
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
357
|
-
contextType: z.ZodLiteral<"doc_extract_edit">;
|
|
358
|
-
context: z.ZodObject<{
|
|
359
|
-
documentId: z.ZodString;
|
|
360
|
-
docType: z.ZodString;
|
|
361
|
-
fieldPath: z.ZodString;
|
|
362
|
-
oldValue: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
|
|
363
|
-
newValue: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
|
|
364
|
-
rowKey: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
|
|
365
|
-
stageId: z.ZodOptional<z.ZodString>;
|
|
366
|
-
workflowId: z.ZodOptional<z.ZodString>;
|
|
367
|
-
citation: z.ZodOptional<z.ZodObject<{
|
|
368
|
-
page: z.ZodNumber;
|
|
369
|
-
region: z.ZodOptional<z.ZodString>;
|
|
370
|
-
}, z.core.$strict>>;
|
|
371
|
-
}, z.core.$strict>;
|
|
372
|
-
idempotencyKey: z.ZodString;
|
|
373
|
-
subjectId: z.ZodString;
|
|
374
|
-
subjectKind: z.ZodEnum<{
|
|
375
|
-
workflow: "workflow";
|
|
376
|
-
agent: "agent";
|
|
377
|
-
}>;
|
|
378
|
-
occurredAt: z.ZodString;
|
|
379
|
-
deltaReason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
380
|
-
deltaSource: z.ZodDefault<z.ZodEnum<{
|
|
381
|
-
unknown: "unknown";
|
|
382
|
-
human: "human";
|
|
383
|
-
llm: "llm";
|
|
384
|
-
}>>;
|
|
385
|
-
actionability: z.ZodDefault<z.ZodLiteral<"unknown">>;
|
|
386
|
-
}, z.core.$strict>], "contextType">>;
|
|
387
|
-
observation: z.ZodOptional<z.ZodObject<{
|
|
388
|
-
sourceType: z.ZodString;
|
|
389
|
-
sourceRef: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
390
|
-
generatingSubject: z.ZodObject<{
|
|
391
|
-
subjectId: z.ZodString;
|
|
392
|
-
subjectKind: z.ZodEnum<{
|
|
393
|
-
workflow: "workflow";
|
|
394
|
-
agent: "agent";
|
|
395
|
-
}>;
|
|
396
|
-
}, z.core.$strict>;
|
|
397
|
-
occurredAt: z.ZodISODateTime;
|
|
398
|
-
summary: z.ZodNullable<z.ZodString>;
|
|
399
|
-
metrics: z.ZodCustom<import("./monitoring-annotations").MonitoringJson, import("./monitoring-annotations").MonitoringJson>;
|
|
400
|
-
conversationFindings: z.ZodArray<z.ZodObject<{
|
|
401
|
-
type: z.ZodString;
|
|
402
|
-
description: z.ZodString;
|
|
403
|
-
excerpt: z.ZodString;
|
|
404
|
-
severity: z.ZodEnum<{
|
|
405
|
-
high: "high";
|
|
406
|
-
medium: "medium";
|
|
407
|
-
low: "low";
|
|
408
|
-
}>;
|
|
409
|
-
}, z.core.$strict>>;
|
|
410
|
-
classifications: z.ZodArray<z.ZodObject<{
|
|
411
|
-
matchedBucketSlug: z.ZodNullable<z.ZodString>;
|
|
412
|
-
newBucketProposal: z.ZodNullable<z.ZodObject<{
|
|
413
|
-
name: z.ZodString;
|
|
414
|
-
description: z.ZodString;
|
|
415
|
-
severity: z.ZodEnum<{
|
|
416
|
-
critical: "critical";
|
|
417
|
-
high: "high";
|
|
418
|
-
medium: "medium";
|
|
419
|
-
low: "low";
|
|
420
|
-
}>;
|
|
421
|
-
category: z.ZodString;
|
|
422
|
-
}, z.core.$strict>>;
|
|
423
|
-
excerpt: z.ZodString;
|
|
424
|
-
inputTags: z.ZodArray<z.ZodObject<{
|
|
425
|
-
type: z.ZodString;
|
|
426
|
-
value: z.ZodString;
|
|
427
|
-
}, z.core.$strict>>;
|
|
428
|
-
}, z.core.$strict>>;
|
|
429
|
-
coarseFallbacks: z.ZodArray<z.ZodObject<{
|
|
430
|
-
bucketSlug: z.ZodString;
|
|
431
|
-
excerpt: z.ZodString;
|
|
432
|
-
coarseCategory: z.ZodString;
|
|
433
|
-
}, z.core.$strict>>;
|
|
434
|
-
}, z.core.$strict>>;
|
|
435
|
-
operation: z.ZodLiteral<"publish">;
|
|
436
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
437
|
-
producer: z.ZodString;
|
|
438
|
-
businessKey: z.ZodString;
|
|
439
|
-
operation: z.ZodLiteral<"get">;
|
|
440
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
441
|
-
producer: z.ZodString;
|
|
442
|
-
operation: z.ZodLiteral<"getBucketCatalog">;
|
|
443
|
-
}, z.core.$strict>], "operation">;
|
|
444
|
-
export type MonitoringPublish = z.input<typeof monitoringPublishSchema>;
|
|
445
|
-
export type MonitoringDeliveryKey = z.infer<typeof monitoringDeliveryKeySchema>;
|
|
446
|
-
export type FunctionMonitoringRequest = z.infer<typeof functionMonitoringRequestSchema>;
|
|
447
|
-
export declare const monitoringDeliveryReceiptSchema: z.ZodObject<{
|
|
448
|
-
id: z.ZodUUID;
|
|
449
|
-
producer: z.ZodString;
|
|
450
|
-
businessKey: z.ZodString;
|
|
451
|
-
payloadHash: z.ZodString;
|
|
452
|
-
status: z.ZodLiteral<"confirmed">;
|
|
453
|
-
eventCount: z.ZodNumber;
|
|
454
|
-
confirmedAt: z.ZodISODateTime;
|
|
455
|
-
eventIds: z.ZodArray<z.ZodUUID>;
|
|
456
|
-
}, z.core.$strict>;
|
|
457
|
-
export type MonitoringDeliveryReceipt = z.infer<typeof monitoringDeliveryReceiptSchema>;
|
|
458
|
-
export declare class FunctionMonitoringError extends Error {
|
|
459
|
-
readonly status: number;
|
|
460
|
-
readonly code: string;
|
|
461
|
-
readonly name = "FunctionMonitoringError";
|
|
462
|
-
constructor(status: number, code: string, message: string);
|
|
463
|
-
}
|
|
@@ -1,89 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FunctionMonitoringError = exports.monitoringDeliveryReceiptSchema = exports.functionMonitoringRequestSchema = exports.monitoringPublishSchema = exports.monitoringBucketCatalogSchema = exports.monitoringCatalogQuerySchema = exports.monitoringDeliveryKeySchema = exports.monitoringEventsSchema = exports.functionMonitoringScopesSchema = exports.MAX_MONITORING_DELIVERY_BYTES = exports.MONITORING_CATALOG_CAPABILITY = exports.MONITORING_PRODUCER_CAPABILITY = exports.FUNCTION_MONITORING_DELIVERIES_PATH = exports.FUNCTION_MONITORING_TOKEN_HEADER = void 0;
|
|
4
|
-
exports.readFunctionMonitoringScopes = readFunctionMonitoringScopes;
|
|
3
|
+
exports.FunctionMonitoringError = exports.monitoringDeliveryReceiptSchema = exports.functionMonitoringRequestSchema = exports.monitoringPublishSchema = exports.monitoringBucketCatalogSchema = exports.monitoringCatalogQuerySchema = exports.monitoringDeliveryKeySchema = exports.monitoringEventsSchema = exports.readFunctionMonitoringScopes = exports.functionMonitoringScopesSchema = exports.MAX_MONITORING_DELIVERY_BYTES = exports.MONITORING_CATALOG_CAPABILITY = exports.MONITORING_PRODUCER_CAPABILITY = exports.FUNCTION_MONITORING_DELIVERIES_PATH = exports.FUNCTION_MONITORING_TOKEN_HEADER = void 0;
|
|
5
4
|
exports.monitoringPayloadHash = monitoringPayloadHash;
|
|
6
5
|
const node_crypto_1 = require("node:crypto");
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
exports.
|
|
11
|
-
exports.
|
|
12
|
-
exports.
|
|
13
|
-
exports.
|
|
14
|
-
exports
|
|
15
|
-
|
|
16
|
-
exports
|
|
17
|
-
|
|
18
|
-
});
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return [];
|
|
25
|
-
const monitoring = Reflect.get(capabilities, 'monitoring');
|
|
26
|
-
return monitoring === undefined ? [] : exports.functionMonitoringScopesSchema.parse(monitoring).producers;
|
|
27
|
-
}
|
|
28
|
-
exports.monitoringEventsSchema = zod_1.z.array(monitoring_events_1.deltaEventSchema).max(monitoring_events_1.MAX_DELTA_EVENTS_PER_REQUEST).superRefine((events, context) => {
|
|
29
|
-
const seen = new Set();
|
|
30
|
-
for (const [index, event] of events.entries()) {
|
|
31
|
-
if (seen.has(event.idempotencyKey))
|
|
32
|
-
context.addIssue({ code: 'custom', path: [index, 'idempotencyKey'], message: 'Event keys must be distinct within a delivery' });
|
|
33
|
-
seen.add(event.idempotencyKey);
|
|
34
|
-
}
|
|
35
|
-
if (Buffer.byteLength(JSON.stringify(events), 'utf8') > exports.MAX_MONITORING_DELIVERY_BYTES) {
|
|
36
|
-
context.addIssue({ code: 'custom', message: 'Monitoring events exceed the delivery size limit' });
|
|
37
|
-
}
|
|
38
|
-
});
|
|
6
|
+
const contracts_1 = require("@sequenceholdings/platform/contracts");
|
|
7
|
+
var contracts_2 = require("@sequenceholdings/platform/contracts");
|
|
8
|
+
Object.defineProperty(exports, "FUNCTION_MONITORING_TOKEN_HEADER", { enumerable: true, get: function () { return contracts_2.FUNCTION_MONITORING_TOKEN_HEADER; } });
|
|
9
|
+
Object.defineProperty(exports, "FUNCTION_MONITORING_DELIVERIES_PATH", { enumerable: true, get: function () { return contracts_2.FUNCTION_MONITORING_DELIVERIES_PATH; } });
|
|
10
|
+
Object.defineProperty(exports, "MONITORING_PRODUCER_CAPABILITY", { enumerable: true, get: function () { return contracts_2.MONITORING_PRODUCER_CAPABILITY; } });
|
|
11
|
+
Object.defineProperty(exports, "MONITORING_CATALOG_CAPABILITY", { enumerable: true, get: function () { return contracts_2.MONITORING_CATALOG_CAPABILITY; } });
|
|
12
|
+
Object.defineProperty(exports, "MAX_MONITORING_DELIVERY_BYTES", { enumerable: true, get: function () { return contracts_2.MAX_MONITORING_DELIVERY_BYTES; } });
|
|
13
|
+
Object.defineProperty(exports, "functionMonitoringScopesSchema", { enumerable: true, get: function () { return contracts_2.functionMonitoringScopesSchema; } });
|
|
14
|
+
Object.defineProperty(exports, "readFunctionMonitoringScopes", { enumerable: true, get: function () { return contracts_2.readFunctionMonitoringScopes; } });
|
|
15
|
+
Object.defineProperty(exports, "monitoringEventsSchema", { enumerable: true, get: function () { return contracts_2.monitoringEventsSchema; } });
|
|
16
|
+
Object.defineProperty(exports, "monitoringDeliveryKeySchema", { enumerable: true, get: function () { return contracts_2.monitoringDeliveryKeySchema; } });
|
|
17
|
+
Object.defineProperty(exports, "monitoringCatalogQuerySchema", { enumerable: true, get: function () { return contracts_2.monitoringCatalogQuerySchema; } });
|
|
18
|
+
Object.defineProperty(exports, "monitoringBucketCatalogSchema", { enumerable: true, get: function () { return contracts_2.monitoringBucketCatalogSchema; } });
|
|
19
|
+
Object.defineProperty(exports, "monitoringPublishSchema", { enumerable: true, get: function () { return contracts_2.monitoringPublishSchema; } });
|
|
20
|
+
Object.defineProperty(exports, "functionMonitoringRequestSchema", { enumerable: true, get: function () { return contracts_2.functionMonitoringRequestSchema; } });
|
|
21
|
+
Object.defineProperty(exports, "monitoringDeliveryReceiptSchema", { enumerable: true, get: function () { return contracts_2.monitoringDeliveryReceiptSchema; } });
|
|
22
|
+
Object.defineProperty(exports, "FunctionMonitoringError", { enumerable: true, get: function () { return contracts_2.FunctionMonitoringError; } });
|
|
39
23
|
function canonical(value) {
|
|
40
24
|
if (Array.isArray(value))
|
|
41
|
-
return `[${value.map(canonical).join(
|
|
42
|
-
if (typeof value ===
|
|
43
|
-
return `{${Object.entries(value)
|
|
25
|
+
return `[${value.map(canonical).join(",")}]`;
|
|
26
|
+
if (typeof value === "object" && value !== null) {
|
|
27
|
+
return `{${Object.entries(value)
|
|
28
|
+
.filter(([, entry]) => entry !== undefined)
|
|
29
|
+
.sort(([left], [right]) => (left < right ? -1 : left > right ? 1 : 0))
|
|
30
|
+
.map(([key, entry]) => `${JSON.stringify(key)}:${canonical(entry)}`)
|
|
31
|
+
.join(",")}}`;
|
|
44
32
|
}
|
|
45
33
|
const serialized = JSON.stringify(value);
|
|
46
34
|
if (serialized === undefined)
|
|
47
|
-
throw new Error(
|
|
35
|
+
throw new Error("Monitoring payload is not JSON");
|
|
48
36
|
return serialized;
|
|
49
37
|
}
|
|
50
|
-
function monitoringPayloadHash({ events, observation }) {
|
|
51
|
-
return (0, node_crypto_1.createHash)(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
});
|
|
62
|
-
exports.monitoringPublishSchema = exports.monitoringDeliveryKeySchema.extend({
|
|
63
|
-
payloadHash: zod_1.z.string().regex(/^[a-f0-9]{64}$/), events: exports.monitoringEventsSchema,
|
|
64
|
-
observation: monitoring_annotations_1.functionMonitoringAnnotationSchema.optional(),
|
|
65
|
-
});
|
|
66
|
-
exports.functionMonitoringRequestSchema = zod_1.z.discriminatedUnion('operation', [
|
|
67
|
-
exports.monitoringPublishSchema.extend({ operation: zod_1.z.literal('publish') }),
|
|
68
|
-
exports.monitoringDeliveryKeySchema.extend({ operation: zod_1.z.literal('get') }),
|
|
69
|
-
exports.monitoringCatalogQuerySchema.extend({ operation: zod_1.z.literal('getBucketCatalog') }),
|
|
70
|
-
]).superRefine((request, context) => {
|
|
71
|
-
if (Buffer.byteLength(JSON.stringify(request), 'utf8') > exports.MAX_MONITORING_DELIVERY_BYTES)
|
|
72
|
-
context.addIssue({ code: 'custom', message: 'Monitoring delivery exceeds the size limit' });
|
|
73
|
-
});
|
|
74
|
-
exports.monitoringDeliveryReceiptSchema = zod_1.z.strictObject({
|
|
75
|
-
id: zod_1.z.uuid(), producer, businessKey: key, payloadHash: zod_1.z.string().regex(/^[a-f0-9]{64}$/),
|
|
76
|
-
status: zod_1.z.literal('confirmed'), eventCount: zod_1.z.number().int().min(0).max(monitoring_events_1.MAX_DELTA_EVENTS_PER_REQUEST),
|
|
77
|
-
confirmedAt: zod_1.z.iso.datetime({ offset: true }), eventIds: zod_1.z.array(zod_1.z.uuid()).max(monitoring_events_1.MAX_DELTA_EVENTS_PER_REQUEST),
|
|
78
|
-
}).refine(receipt => receipt.eventCount === receipt.eventIds.length && new Set(receipt.eventIds).size === receipt.eventIds.length, 'Receipt count must match distinct event ids');
|
|
79
|
-
class FunctionMonitoringError extends Error {
|
|
80
|
-
status;
|
|
81
|
-
code;
|
|
82
|
-
name = 'FunctionMonitoringError';
|
|
83
|
-
constructor(status, code, message) {
|
|
84
|
-
super(message);
|
|
85
|
-
this.status = status;
|
|
86
|
-
this.code = code;
|
|
87
|
-
}
|
|
38
|
+
function monitoringPayloadHash({ events, observation, }) {
|
|
39
|
+
return (0, node_crypto_1.createHash)("sha256")
|
|
40
|
+
.update(canonical({
|
|
41
|
+
events: contracts_1.monitoringEventsSchema.parse(events),
|
|
42
|
+
...(observation === undefined
|
|
43
|
+
? {}
|
|
44
|
+
: {
|
|
45
|
+
observation: contracts_1.functionMonitoringAnnotationSchema.parse(observation),
|
|
46
|
+
}),
|
|
47
|
+
}))
|
|
48
|
+
.digest("hex");
|
|
88
49
|
}
|
|
89
|
-
exports.FunctionMonitoringError = FunctionMonitoringError;
|