@sequenceholdings/managed-functions 0.4.0 → 0.4.2
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 +444 -2
- package/dist/abrigo-contract.d.ts +92 -0
- package/dist/abrigo-contract.js +55 -0
- package/dist/abrigo-response.d.ts +6 -0
- package/dist/abrigo-response.js +27 -0
- package/dist/abrigo.d.ts +14 -0
- package/dist/abrigo.js +150 -0
- package/dist/agent-evidence.d.ts +9 -0
- package/dist/agent-evidence.js +84 -0
- package/dist/agent-source-evidence-contract.d.ts +1197 -0
- package/dist/agent-source-evidence-contract.js +96 -0
- package/dist/agents-contract.d.ts +99 -0
- package/dist/agents-contract.js +69 -0
- package/dist/agents.d.ts +15 -0
- package/dist/agents.js +121 -0
- package/dist/capabilities.d.ts +165 -0
- package/dist/capabilities.js +61 -1
- package/dist/config.d.ts +18 -2
- package/dist/config.js +62 -1
- package/dist/deployed-policy.js +102 -0
- package/dist/directory-config.d.ts +23 -0
- package/dist/directory-config.js +22 -0
- package/dist/directory-contract.d.ts +68 -0
- package/dist/directory-contract.js +57 -0
- package/dist/directory-manifest.d.ts +5 -0
- package/dist/directory-manifest.js +10 -0
- package/dist/directory.d.ts +15 -0
- package/dist/directory.js +65 -0
- package/dist/http-tracing.js +3 -0
- package/dist/immutable-release-contract.d.ts +3 -0
- package/dist/immutable-release-contract.js +12 -0
- package/dist/index.d.ts +40 -1
- package/dist/index.js +75 -1
- package/dist/invocation-client.d.ts +45 -0
- package/dist/invocation-client.js +90 -0
- package/dist/invocation-contract.d.ts +36 -0
- package/dist/invocation-contract.js +48 -0
- package/dist/invocation.d.ts +8 -0
- package/dist/invocation.js +134 -0
- package/dist/lattice-capability.d.ts +5 -0
- package/dist/lattice-capability.js +16 -0
- package/dist/lattice-provenance-contract.d.ts +519 -0
- package/dist/lattice-provenance-contract.js +148 -0
- package/dist/lattice-provenance.d.ts +16 -0
- package/dist/lattice-provenance.js +167 -0
- package/dist/monitoring-annotations.d.ts +53 -0
- package/dist/monitoring-annotations.js +54 -0
- package/dist/monitoring-contract.d.ts +463 -0
- package/dist/monitoring-contract.js +89 -0
- package/dist/monitoring-events.d.ts +257 -0
- package/dist/monitoring-events.js +136 -0
- package/dist/monitoring.d.ts +14 -0
- package/dist/monitoring.js +78 -0
- package/dist/orm-contract.d.ts +1 -0
- package/dist/orm-contract.js +4 -0
- package/dist/orm.d.ts +19 -3
- package/dist/orm.js +93 -13
- package/dist/preflight-abrigo.d.ts +10 -0
- package/dist/preflight-abrigo.js +26 -0
- package/dist/preflight-agents.d.ts +10 -0
- package/dist/preflight-agents.js +51 -0
- package/dist/preflight-directory.d.ts +10 -0
- package/dist/preflight-directory.js +36 -0
- package/dist/preflight-immutable-release.d.ts +10 -0
- package/dist/preflight-immutable-release.js +34 -0
- package/dist/preflight-invocation.d.ts +10 -0
- package/dist/preflight-invocation.js +40 -0
- package/dist/preflight-lattice.d.ts +10 -0
- package/dist/preflight-lattice.js +40 -0
- package/dist/preflight-monitoring.d.ts +10 -0
- package/dist/preflight-monitoring.js +46 -0
- package/dist/preflight-service-directory.d.ts +10 -0
- package/dist/preflight-service-directory.js +26 -0
- package/dist/preflight-workflows.d.ts +10 -0
- package/dist/preflight-workflows.js +38 -0
- package/dist/preflight.js +50 -2
- package/dist/processes-contract.d.ts +20 -0
- package/dist/processes-contract.js +8 -1
- package/dist/processes.d.ts +4 -8
- package/dist/processes.js +52 -83
- package/dist/runtime.cjs +3387 -259
- package/dist/sdk-range.d.ts +1 -0
- package/dist/sdk-range.js +25 -0
- package/dist/service-directory.d.ts +12 -0
- package/dist/service-directory.js +72 -0
- package/dist/workflow-scopes-contract.d.ts +8 -0
- package/dist/workflow-scopes-contract.js +29 -0
- package/dist/workflow-source-contract.d.ts +524 -0
- package/dist/workflow-source-contract.js +59 -0
- package/dist/workflow-source.d.ts +12 -0
- package/dist/workflow-source.js +93 -0
- package/package.json +2 -2
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.createFunctionLatticeClient = createFunctionLatticeClient;
|
|
18
|
+
const zod_1 = require("zod");
|
|
19
|
+
const lattice_provenance_contract_1 = require("./lattice-provenance-contract");
|
|
20
|
+
__exportStar(require("./lattice-provenance-contract"), exports);
|
|
21
|
+
const tokenClaimsSchema = zod_1.z.object({
|
|
22
|
+
audience: zod_1.z.literal('atlas-managed-function-lattice-execution'),
|
|
23
|
+
functionId: zod_1.z.string().min(1).max(255),
|
|
24
|
+
versionId: zod_1.z.string().min(1).max(255),
|
|
25
|
+
invocationId: zod_1.z.string().min(1).max(255),
|
|
26
|
+
org: zod_1.z.string().min(1).max(255),
|
|
27
|
+
runId: zod_1.z.string().min(1).max(255),
|
|
28
|
+
processId: zod_1.z.string().min(1).max(255),
|
|
29
|
+
processVersion: zod_1.z.string().min(1).max(255),
|
|
30
|
+
bundleHash: zod_1.z.string().min(1).max(255),
|
|
31
|
+
stepId: zod_1.z.string().min(1).max(255),
|
|
32
|
+
nodeId: zod_1.z.string().min(1).max(255),
|
|
33
|
+
stepAttempt: zod_1.z.number().int().positive(),
|
|
34
|
+
serviceAccountId: zod_1.z.string().min(1).max(255),
|
|
35
|
+
callerSub: zod_1.z.string().min(1).max(512), callerKind: zod_1.z.string().min(1).max(64), callerAuthenticationMethod: zod_1.z.string().min(1).max(64),
|
|
36
|
+
exp: zod_1.z.number().int().positive().max(Number.MAX_SAFE_INTEGER),
|
|
37
|
+
});
|
|
38
|
+
const invalidContext = () => new lattice_provenance_contract_1.FunctionLatticeContextError(401, 'invalid_context', 'This invocation has no valid Lattice execution credential');
|
|
39
|
+
function readCredential({ request, }) {
|
|
40
|
+
const { headers } = request;
|
|
41
|
+
const matches = typeof headers.get === 'function'
|
|
42
|
+
? [headers.get(lattice_provenance_contract_1.FUNCTION_LATTICE_EXECUTION_TOKEN_HEADER)]
|
|
43
|
+
: Object.entries(headers)
|
|
44
|
+
.filter(([name]) => name.toLowerCase() === lattice_provenance_contract_1.FUNCTION_LATTICE_EXECUTION_TOKEN_HEADER)
|
|
45
|
+
.map(([, value]) => value);
|
|
46
|
+
const token = matches[0];
|
|
47
|
+
if (matches.length !== 1 || typeof token !== 'string' || token.length > 16_384)
|
|
48
|
+
throw invalidContext();
|
|
49
|
+
const envelope = /^([A-Za-z0-9_-]+)\.([A-Za-z0-9_-]{43})$/.exec(token);
|
|
50
|
+
if (!envelope?.[1])
|
|
51
|
+
throw invalidContext();
|
|
52
|
+
let value;
|
|
53
|
+
try {
|
|
54
|
+
const decoded = Buffer.from(envelope[1], 'base64url');
|
|
55
|
+
if (decoded.toString('base64url') !== envelope[1])
|
|
56
|
+
throw invalidContext();
|
|
57
|
+
value = JSON.parse(new TextDecoder('utf-8', { fatal: true }).decode(decoded));
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
throw invalidContext();
|
|
61
|
+
}
|
|
62
|
+
const parsed = tokenClaimsSchema.safeParse(value);
|
|
63
|
+
if (!parsed.success)
|
|
64
|
+
throw invalidContext();
|
|
65
|
+
return { token, claims: parsed.data };
|
|
66
|
+
}
|
|
67
|
+
function trustedOrigin(baseUrl) {
|
|
68
|
+
const invalid = () => new lattice_provenance_contract_1.FunctionLatticeContextError(400, 'invalid_configuration', 'Configure a trusted HTTPS Atlas origin without credentials, path, query or fragment');
|
|
69
|
+
let url;
|
|
70
|
+
try {
|
|
71
|
+
url = new URL(baseUrl);
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
throw invalid();
|
|
75
|
+
}
|
|
76
|
+
const loopback = url.protocol === 'http:' &&
|
|
77
|
+
['localhost', '127.0.0.1', '[::1]'].includes(url.hostname);
|
|
78
|
+
if ((!loopback && url.protocol !== 'https:') || url.username || url.password ||
|
|
79
|
+
url.pathname !== '/' || url.search || url.hash)
|
|
80
|
+
throw invalid();
|
|
81
|
+
return url.origin;
|
|
82
|
+
}
|
|
83
|
+
function matchesExecution({ execution, claims, }) {
|
|
84
|
+
return execution.receiver.functionId === claims.functionId &&
|
|
85
|
+
execution.receiver.versionId === claims.versionId &&
|
|
86
|
+
execution.receiver.invocationId === claims.invocationId &&
|
|
87
|
+
execution.receiverFunctionOrgId === claims.org &&
|
|
88
|
+
execution.run.id === claims.runId && execution.run.processId === claims.processId &&
|
|
89
|
+
execution.run.processVersion === claims.processVersion && execution.run.bundleHash === claims.bundleHash &&
|
|
90
|
+
execution.step.id === claims.stepId && execution.step.nodeId === claims.nodeId &&
|
|
91
|
+
execution.step.attempt === claims.stepAttempt && execution.receiver.invoker.sub === claims.callerSub &&
|
|
92
|
+
execution.receiver.invoker.kind === claims.callerKind && execution.receiver.invoker.authenticationMethod === claims.callerAuthenticationMethod &&
|
|
93
|
+
execution.receiver.attachedServiceAccountSub === `service-account|${claims.serviceAccountId}`;
|
|
94
|
+
}
|
|
95
|
+
function validateHumanSelection({ completion, query, }) {
|
|
96
|
+
if (completion.human.nodeId !== query.nodeId ||
|
|
97
|
+
(query.stepId !== undefined && completion.human.stepId !== query.stepId) ||
|
|
98
|
+
(query.ancestorNodeId !== undefined && completion.human.ancestor?.nodeId !== query.ancestorNodeId))
|
|
99
|
+
throw new lattice_provenance_contract_1.FunctionLatticeContextError(502, 'malformed_response', 'Atlas returned a different completed human step');
|
|
100
|
+
}
|
|
101
|
+
function createFunctionLatticeClient({ request, baseUrl, fetchImpl = globalThis.fetch, }) {
|
|
102
|
+
const url = `${trustedOrigin(baseUrl)}${lattice_provenance_contract_1.FUNCTION_LATTICE_CONTEXT_PATH}`;
|
|
103
|
+
const { token, claims } = readCredential({ request });
|
|
104
|
+
async function read({ body, schema, executions, }) {
|
|
105
|
+
if (claims.exp <= Date.now() / 1000)
|
|
106
|
+
throw new lattice_provenance_contract_1.FunctionLatticeContextError(401, 'expired_context', 'The execution credential expired; start a new invocation');
|
|
107
|
+
const parsed = lattice_provenance_contract_1.functionLatticeContextRequestSchema.safeParse(body);
|
|
108
|
+
if (!parsed.success)
|
|
109
|
+
throw new lattice_provenance_contract_1.FunctionLatticeContextError(400, 'invalid_request', 'Select a valid Lattice context operation and human step');
|
|
110
|
+
let response;
|
|
111
|
+
try {
|
|
112
|
+
response = await fetchImpl(url, {
|
|
113
|
+
method: 'POST',
|
|
114
|
+
headers: {
|
|
115
|
+
'content-type': 'application/json',
|
|
116
|
+
[lattice_provenance_contract_1.FUNCTION_LATTICE_EXECUTION_TOKEN_HEADER]: token,
|
|
117
|
+
},
|
|
118
|
+
body: JSON.stringify(parsed.data),
|
|
119
|
+
redirect: 'error',
|
|
120
|
+
signal: AbortSignal.timeout(30_000),
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
catch {
|
|
124
|
+
throw new lattice_provenance_contract_1.FunctionLatticeContextError(502, 'context_request_failed', 'The Lattice context request failed');
|
|
125
|
+
}
|
|
126
|
+
if (response.redirected || (response.status >= 300 && response.status < 400))
|
|
127
|
+
throw new lattice_provenance_contract_1.FunctionLatticeContextError(502, 'redirect_refused', 'The Lattice context request must not redirect');
|
|
128
|
+
const result = await response.json().catch(() => null);
|
|
129
|
+
if (!response.ok) {
|
|
130
|
+
const error = zod_1.z.object({ code: zod_1.z.string().min(1).max(128), detail: zod_1.z.string().min(1).max(2000) }).safeParse(result);
|
|
131
|
+
throw new lattice_provenance_contract_1.FunctionLatticeContextError(response.status, error.success ? error.data.code : 'context_read_failed', error.success ? error.data.detail : 'Lattice context read failed');
|
|
132
|
+
}
|
|
133
|
+
const validated = schema.safeParse(result);
|
|
134
|
+
if (!validated.success || executions(validated.data).some((execution) => !matchesExecution({ execution, claims })))
|
|
135
|
+
throw new lattice_provenance_contract_1.FunctionLatticeContextError(502, 'malformed_response', 'Atlas returned an invalid Lattice context response');
|
|
136
|
+
return validated.data;
|
|
137
|
+
}
|
|
138
|
+
return {
|
|
139
|
+
getExecutionContext() {
|
|
140
|
+
return read({ body: { operation: 'getExecutionContext' }, schema: lattice_provenance_contract_1.functionLatticeExecutionContextSchema, executions: (value) => [value] });
|
|
141
|
+
},
|
|
142
|
+
async getHumanCompletion(query) {
|
|
143
|
+
const completion = await read({
|
|
144
|
+
body: { ...query, operation: 'getHumanCompletion' },
|
|
145
|
+
schema: lattice_provenance_contract_1.functionLatticeHumanCompletionSchema,
|
|
146
|
+
executions: (value) => [value],
|
|
147
|
+
});
|
|
148
|
+
validateHumanSelection({ completion, query });
|
|
149
|
+
return completion;
|
|
150
|
+
},
|
|
151
|
+
async getHumanCompletions(query) {
|
|
152
|
+
const page = await read({
|
|
153
|
+
body: { ...query, operation: 'getHumanCompletions' },
|
|
154
|
+
schema: lattice_provenance_contract_1.functionLatticeHumanCompletionsPageSchema,
|
|
155
|
+
executions: (value) => value.completions,
|
|
156
|
+
});
|
|
157
|
+
page.completions.forEach((completion) => validateHumanSelection({ completion, query }));
|
|
158
|
+
return page;
|
|
159
|
+
},
|
|
160
|
+
async getParallelSnapshot(query) {
|
|
161
|
+
const snapshot = await read({ body: { ...query, operation: 'getParallelSnapshot' }, schema: lattice_provenance_contract_1.functionLatticeParallelSnapshotSchema, executions: (value) => [value] });
|
|
162
|
+
if (snapshot.parallel.nodeId !== query.nodeId || snapshot.parallel.ancestor.nodeId !== query.ancestorNodeId)
|
|
163
|
+
throw new lattice_provenance_contract_1.FunctionLatticeContextError(502, 'malformed_response', 'Atlas returned a different causal parallel execution');
|
|
164
|
+
return snapshot;
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export type MonitoringJson = string | number | boolean | null | MonitoringJson[] | {
|
|
3
|
+
[key: string]: MonitoringJson;
|
|
4
|
+
};
|
|
5
|
+
export declare const functionMonitoringAnnotationSchema: z.ZodObject<{
|
|
6
|
+
sourceType: z.ZodString;
|
|
7
|
+
sourceRef: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
8
|
+
generatingSubject: z.ZodObject<{
|
|
9
|
+
subjectId: z.ZodString;
|
|
10
|
+
subjectKind: z.ZodEnum<{
|
|
11
|
+
workflow: "workflow";
|
|
12
|
+
agent: "agent";
|
|
13
|
+
}>;
|
|
14
|
+
}, z.core.$strict>;
|
|
15
|
+
occurredAt: z.ZodISODateTime;
|
|
16
|
+
summary: z.ZodNullable<z.ZodString>;
|
|
17
|
+
metrics: z.ZodCustom<MonitoringJson, MonitoringJson>;
|
|
18
|
+
conversationFindings: z.ZodArray<z.ZodObject<{
|
|
19
|
+
type: z.ZodString;
|
|
20
|
+
description: z.ZodString;
|
|
21
|
+
excerpt: z.ZodString;
|
|
22
|
+
severity: z.ZodEnum<{
|
|
23
|
+
high: "high";
|
|
24
|
+
medium: "medium";
|
|
25
|
+
low: "low";
|
|
26
|
+
}>;
|
|
27
|
+
}, z.core.$strict>>;
|
|
28
|
+
classifications: z.ZodArray<z.ZodObject<{
|
|
29
|
+
matchedBucketSlug: z.ZodNullable<z.ZodString>;
|
|
30
|
+
newBucketProposal: z.ZodNullable<z.ZodObject<{
|
|
31
|
+
name: z.ZodString;
|
|
32
|
+
description: z.ZodString;
|
|
33
|
+
severity: z.ZodEnum<{
|
|
34
|
+
critical: "critical";
|
|
35
|
+
high: "high";
|
|
36
|
+
medium: "medium";
|
|
37
|
+
low: "low";
|
|
38
|
+
}>;
|
|
39
|
+
category: z.ZodString;
|
|
40
|
+
}, z.core.$strict>>;
|
|
41
|
+
excerpt: z.ZodString;
|
|
42
|
+
inputTags: z.ZodArray<z.ZodObject<{
|
|
43
|
+
type: z.ZodString;
|
|
44
|
+
value: z.ZodString;
|
|
45
|
+
}, z.core.$strict>>;
|
|
46
|
+
}, z.core.$strict>>;
|
|
47
|
+
coarseFallbacks: z.ZodArray<z.ZodObject<{
|
|
48
|
+
bucketSlug: z.ZodString;
|
|
49
|
+
excerpt: z.ZodString;
|
|
50
|
+
coarseCategory: z.ZodString;
|
|
51
|
+
}, z.core.$strict>>;
|
|
52
|
+
}, z.core.$strict>;
|
|
53
|
+
export type FunctionMonitoringAnnotation = z.infer<typeof functionMonitoringAnnotationSchema>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.functionMonitoringAnnotationSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
function boundedJson(value, depth = 0) {
|
|
6
|
+
if (depth > 6)
|
|
7
|
+
return false;
|
|
8
|
+
if (value === null || typeof value === 'boolean')
|
|
9
|
+
return true;
|
|
10
|
+
if (typeof value === 'number')
|
|
11
|
+
return Number.isFinite(value);
|
|
12
|
+
if (typeof value === 'string')
|
|
13
|
+
return value.length <= 50_000;
|
|
14
|
+
if (Array.isArray(value)) {
|
|
15
|
+
if (Object.getPrototypeOf(value) !== Array.prototype || value.length > 100 || Object.getOwnPropertyNames(value).length !== value.length + 1 || Object.getOwnPropertySymbols(value).length > 0)
|
|
16
|
+
return false;
|
|
17
|
+
for (let index = 0; index < value.length; index++) {
|
|
18
|
+
const entry = Object.getOwnPropertyDescriptor(value, String(index));
|
|
19
|
+
if (!entry?.enumerable || !('value' in entry) || !boundedJson(entry.value, depth + 1))
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
if (typeof value !== 'object')
|
|
25
|
+
return false;
|
|
26
|
+
const prototype = Object.getPrototypeOf(value);
|
|
27
|
+
if ((prototype !== Object.prototype && prototype !== null) || Object.getOwnPropertySymbols(value).length > 0)
|
|
28
|
+
return false;
|
|
29
|
+
const entries = Object.entries(Object.getOwnPropertyDescriptors(value));
|
|
30
|
+
return entries.length <= 64 && entries.every(([key, entry]) => key.length <= 128 && entry.enumerable && 'value' in entry && boundedJson(entry.value, depth + 1));
|
|
31
|
+
}
|
|
32
|
+
const json = zod_1.z.custom(value => boundedJson(value) && Buffer.byteLength(JSON.stringify(value), 'utf8') <= 100_000, 'Expected bounded JSON metrics');
|
|
33
|
+
const text = zod_1.z.string().max(50_000);
|
|
34
|
+
const id = zod_1.z.string().min(1).max(512);
|
|
35
|
+
const severity = zod_1.z.enum(['critical', 'high', 'medium', 'low']);
|
|
36
|
+
const inputTag = zod_1.z.strictObject({ type: zod_1.z.string().min(1).max(128), value: zod_1.z.string().max(8_000) });
|
|
37
|
+
exports.functionMonitoringAnnotationSchema = zod_1.z.strictObject({
|
|
38
|
+
sourceType: id,
|
|
39
|
+
sourceRef: zod_1.z.record(zod_1.z.string().min(1).max(128), zod_1.z.union([zod_1.z.string().max(8_000), zod_1.z.number().finite()])).refine(ref => Object.keys(ref).length > 0 && Object.keys(ref).length <= 64, 'Source references must be bounded and nonempty'),
|
|
40
|
+
generatingSubject: zod_1.z.strictObject({ subjectId: id, subjectKind: zod_1.z.enum(['agent', 'workflow']) }),
|
|
41
|
+
occurredAt: zod_1.z.iso.datetime({ offset: true }),
|
|
42
|
+
summary: text.nullable(),
|
|
43
|
+
metrics: json,
|
|
44
|
+
conversationFindings: zod_1.z.array(zod_1.z.strictObject({ type: id, description: text, excerpt: text, severity: zod_1.z.enum(['high', 'medium', 'low']) })).max(100),
|
|
45
|
+
classifications: zod_1.z.array(zod_1.z.strictObject({
|
|
46
|
+
matchedBucketSlug: id.nullable(),
|
|
47
|
+
newBucketProposal: zod_1.z.strictObject({ name: id, description: text, severity, category: id }).nullable(),
|
|
48
|
+
excerpt: text, inputTags: zod_1.z.array(inputTag).max(64),
|
|
49
|
+
}).refine(classification => (classification.matchedBucketSlug === null) !== (classification.newBucketProposal === null), 'Name exactly one matched bucket or proposal')).max(100),
|
|
50
|
+
coarseFallbacks: zod_1.z.array(zod_1.z.strictObject({ bucketSlug: id, excerpt: text, coarseCategory: id })).max(100),
|
|
51
|
+
}).superRefine((annotation, context) => {
|
|
52
|
+
if (Buffer.byteLength(JSON.stringify(annotation), 'utf8') > 256 * 1024)
|
|
53
|
+
context.addIssue({ code: 'custom', message: 'Monitoring annotations exceed the size limit' });
|
|
54
|
+
});
|