@decionis/agent-safe-pipeline 0.3.7 → 0.4.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/README.md +31 -0
- package/dist/Index.d.ts +12 -0
- package/dist/Index.d.ts.map +1 -1
- package/dist/Index.js +12 -0
- package/dist/Index.js.map +1 -1
- package/dist/decision/DecionisGate.d.ts +6 -1
- package/dist/decision/DecionisGate.d.ts.map +1 -1
- package/dist/decision/DecionisGate.js +61 -11
- package/dist/decision/DecionisGate.js.map +1 -1
- package/dist/decision/DecisionAuthority.d.ts +16 -0
- package/dist/decision/DecisionAuthority.d.ts.map +1 -1
- package/dist/decision/DecisionAuthority.js.map +1 -1
- package/dist/execution/AuthorizationVerifier.d.ts +33 -4
- package/dist/execution/AuthorizationVerifier.d.ts.map +1 -1
- package/dist/execution/AuthorizationVerifier.js +74 -10
- package/dist/execution/AuthorizationVerifier.js.map +1 -1
- package/dist/execution/EffectAdapter.d.ts +117 -0
- package/dist/execution/EffectAdapter.d.ts.map +1 -0
- package/dist/execution/EffectAdapter.js +22 -0
- package/dist/execution/EffectAdapter.js.map +1 -0
- package/dist/execution/ExecutionDeadline.d.ts +35 -0
- package/dist/execution/ExecutionDeadline.d.ts.map +1 -0
- package/dist/execution/ExecutionDeadline.js +52 -0
- package/dist/execution/ExecutionDeadline.js.map +1 -0
- package/dist/execution/ExecutionJournal.d.ts +148 -0
- package/dist/execution/ExecutionJournal.d.ts.map +1 -0
- package/dist/execution/ExecutionJournal.js +157 -0
- package/dist/execution/ExecutionJournal.js.map +1 -0
- package/dist/execution/ExecutionOutcome.d.ts +186 -0
- package/dist/execution/ExecutionOutcome.d.ts.map +1 -0
- package/dist/execution/ExecutionOutcome.js +2 -0
- package/dist/execution/ExecutionOutcome.js.map +1 -0
- package/dist/execution/ExecutionPosture.d.ts +50 -0
- package/dist/execution/ExecutionPosture.d.ts.map +1 -0
- package/dist/execution/ExecutionPosture.js +20 -0
- package/dist/execution/ExecutionPosture.js.map +1 -0
- package/dist/execution/ExecutorEvidence.d.ts +64 -0
- package/dist/execution/ExecutorEvidence.d.ts.map +1 -0
- package/dist/execution/ExecutorEvidence.js +14 -0
- package/dist/execution/ExecutorEvidence.js.map +1 -0
- package/dist/execution/GovernedExecutionRunner.d.ts +309 -0
- package/dist/execution/GovernedExecutionRunner.d.ts.map +1 -0
- package/dist/execution/GovernedExecutionRunner.js +1341 -0
- package/dist/execution/GovernedExecutionRunner.js.map +1 -0
- package/dist/execution/NativeExecutor.d.ts +220 -0
- package/dist/execution/NativeExecutor.d.ts.map +1 -0
- package/dist/execution/NativeExecutor.js +22 -0
- package/dist/execution/NativeExecutor.js.map +1 -0
- package/dist/execution/NativeExecutorSchema.d.ts +387 -0
- package/dist/execution/NativeExecutorSchema.d.ts.map +1 -0
- package/dist/execution/NativeExecutorSchema.js +261 -0
- package/dist/execution/NativeExecutorSchema.js.map +1 -0
- package/dist/execution/PostgresExecutionJournal.d.ts +54 -0
- package/dist/execution/PostgresExecutionJournal.d.ts.map +1 -0
- package/dist/execution/PostgresExecutionJournal.js +131 -0
- package/dist/execution/PostgresExecutionJournal.js.map +1 -0
- package/dist/execution/RegistryExecutor.d.ts +35 -0
- package/dist/execution/RegistryExecutor.d.ts.map +1 -0
- package/dist/execution/RegistryExecutor.js +84 -0
- package/dist/execution/RegistryExecutor.js.map +1 -0
- package/dist/execution/SafeExecutor.d.ts +22 -193
- package/dist/execution/SafeExecutor.d.ts.map +1 -1
- package/dist/execution/SafeExecutor.js +49 -521
- package/dist/execution/SafeExecutor.js.map +1 -1
- package/dist/http/AuthorityPaths.d.ts +51 -0
- package/dist/http/AuthorityPaths.d.ts.map +1 -0
- package/dist/http/AuthorityPaths.js +84 -0
- package/dist/http/AuthorityPaths.js.map +1 -0
- package/dist/shadow/ShadowPipeline.d.ts +3 -1
- package/dist/shadow/ShadowPipeline.d.ts.map +1 -1
- package/dist/shadow/ShadowPipeline.js +3 -3
- package/dist/shadow/ShadowPipeline.js.map +1 -1
- package/dist/testing/Index.d.ts +2 -1
- package/dist/testing/Index.d.ts.map +1 -1
- package/dist/testing/Index.js +2 -1
- package/dist/testing/Index.js.map +1 -1
- package/dist/testing/LocalAuthority.d.ts +35 -1
- package/dist/testing/LocalAuthority.d.ts.map +1 -1
- package/dist/testing/LocalAuthority.js +122 -2
- package/dist/testing/LocalAuthority.js.map +1 -1
- package/dist/testing/SignedSignals.d.ts +150 -0
- package/dist/testing/SignedSignals.d.ts.map +1 -0
- package/dist/testing/SignedSignals.js +291 -0
- package/dist/testing/SignedSignals.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const NATIVE_EXECUTOR_SCHEMA_ID = "https://github.com/decionis/agent-safe-pipeline/blob/master/spec/executors/native/v1/schema.json";
|
|
3
|
+
export declare const ExecutionOutcomeSchema: z.ZodEnum<{
|
|
4
|
+
BLOCKED: "BLOCKED";
|
|
5
|
+
COMPLETED: "COMPLETED";
|
|
6
|
+
FAILED_BEFORE_DISPATCH: "FAILED_BEFORE_DISPATCH";
|
|
7
|
+
UNKNOWN_AFTER_DISPATCH: "UNKNOWN_AFTER_DISPATCH";
|
|
8
|
+
DEFINITELY_NOT_EXECUTED: "DEFINITELY_NOT_EXECUTED";
|
|
9
|
+
HELD: "HELD";
|
|
10
|
+
}>;
|
|
11
|
+
/** Who carries the action out, as `POST /v1/authority/grants` accepts it in `executor`. */
|
|
12
|
+
export declare const ExecutorIdentitySchema: z.ZodObject<{
|
|
13
|
+
platform: z.ZodString;
|
|
14
|
+
style: z.ZodEnum<{
|
|
15
|
+
dispatch: "dispatch";
|
|
16
|
+
permit: "permit";
|
|
17
|
+
}>;
|
|
18
|
+
version: z.ZodString;
|
|
19
|
+
}, z.core.$strict>;
|
|
20
|
+
/** What one executor can write for one action type: `ExecutionCapability`, on the wire. */
|
|
21
|
+
export declare const ExecutionCapabilitySchema: z.ZodObject<{
|
|
22
|
+
platform: z.ZodString;
|
|
23
|
+
action_type: z.ZodString;
|
|
24
|
+
enabled: z.ZodBoolean;
|
|
25
|
+
scope_granted: z.ZodBoolean;
|
|
26
|
+
connected: z.ZodBoolean;
|
|
27
|
+
requirement: z.ZodString;
|
|
28
|
+
}, z.core.$strict>;
|
|
29
|
+
/**
|
|
30
|
+
* Permit wire profile, step 1: `POST /v1/connections/{connectionId}/executions`.
|
|
31
|
+
* The connection, organisation and environment come from the authenticated
|
|
32
|
+
* connection, never from this body.
|
|
33
|
+
*/
|
|
34
|
+
export declare const ExecutionRequestSchema: z.ZodObject<{
|
|
35
|
+
executor: z.ZodObject<{
|
|
36
|
+
platform: z.ZodString;
|
|
37
|
+
style: z.ZodEnum<{
|
|
38
|
+
dispatch: "dispatch";
|
|
39
|
+
permit: "permit";
|
|
40
|
+
}>;
|
|
41
|
+
version: z.ZodString;
|
|
42
|
+
}, z.core.$strict>;
|
|
43
|
+
action_type: z.ZodString;
|
|
44
|
+
action: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
45
|
+
correlation_id: z.ZodOptional<z.ZodString>;
|
|
46
|
+
}, z.core.$strict>;
|
|
47
|
+
/**
|
|
48
|
+
* Permit wire profile, step 2: what the executor host answers. `permit_id`,
|
|
49
|
+
* `intent_sha256` and `expires_at` are present only when the outcome is
|
|
50
|
+
* `HELD`: there is a permit to present.
|
|
51
|
+
*/
|
|
52
|
+
export declare const ExecutionResponseSchema: z.ZodObject<{
|
|
53
|
+
execution_id: z.ZodString;
|
|
54
|
+
outcome: z.ZodEnum<{
|
|
55
|
+
BLOCKED: "BLOCKED";
|
|
56
|
+
HELD: "HELD";
|
|
57
|
+
}>;
|
|
58
|
+
decision: z.ZodString;
|
|
59
|
+
reason_codes: z.ZodArray<z.ZodString>;
|
|
60
|
+
dossier_id: z.ZodNullable<z.ZodString>;
|
|
61
|
+
permit_id: z.ZodNullable<z.ZodString>;
|
|
62
|
+
intent_sha256: z.ZodNullable<z.ZodString>;
|
|
63
|
+
expires_at: z.ZodNullable<z.ZodISODateTime>;
|
|
64
|
+
}, z.core.$strict>;
|
|
65
|
+
/**
|
|
66
|
+
* Permit wire profile, step 4: `POST …/executions/{executionId}/receipts`.
|
|
67
|
+
* The platform's native receipt, verbatim in its own vocabulary; the
|
|
68
|
+
* executor's `observe` reads it into an outcome.
|
|
69
|
+
*/
|
|
70
|
+
export declare const NativeReceiptSchema: z.ZodObject<{
|
|
71
|
+
permit_id: z.ZodString;
|
|
72
|
+
native_receipt: z.ZodObject<{
|
|
73
|
+
platform: z.ZodString;
|
|
74
|
+
kind: z.ZodString;
|
|
75
|
+
reference: z.ZodString;
|
|
76
|
+
status: z.ZodString;
|
|
77
|
+
observed_at: z.ZodISODateTime;
|
|
78
|
+
digest: z.ZodOptional<z.ZodString>;
|
|
79
|
+
}, z.core.$strict>;
|
|
80
|
+
signed_receipt: z.ZodOptional<z.ZodString>;
|
|
81
|
+
}, z.core.$strict>;
|
|
82
|
+
/** How a receipt settled the execution, or why it was refused. */
|
|
83
|
+
export declare const ReceiptResponseSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
84
|
+
execution_id: z.ZodString;
|
|
85
|
+
status: z.ZodLiteral<"SETTLED">;
|
|
86
|
+
outcome: z.ZodEnum<{
|
|
87
|
+
COMPLETED: "COMPLETED";
|
|
88
|
+
UNKNOWN_AFTER_DISPATCH: "UNKNOWN_AFTER_DISPATCH";
|
|
89
|
+
DEFINITELY_NOT_EXECUTED: "DEFINITELY_NOT_EXECUTED";
|
|
90
|
+
}>;
|
|
91
|
+
finalization: z.ZodEnum<{
|
|
92
|
+
RECORDED: "RECORDED";
|
|
93
|
+
PENDING: "PENDING";
|
|
94
|
+
UNSUPPORTED: "UNSUPPORTED";
|
|
95
|
+
}>;
|
|
96
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
97
|
+
execution_id: z.ZodString;
|
|
98
|
+
status: z.ZodLiteral<"REFUSED">;
|
|
99
|
+
reason: z.ZodEnum<{
|
|
100
|
+
RECEIPT_DUPLICATE: "RECEIPT_DUPLICATE";
|
|
101
|
+
PERMIT_NOT_PRESENTED: "PERMIT_NOT_PRESENTED";
|
|
102
|
+
}>;
|
|
103
|
+
}, z.core.$strict>]>;
|
|
104
|
+
/** `POST …/executions/{executionId}/reconciliations`: ask the executor what happened, read-only. */
|
|
105
|
+
export declare const ReconciliationRequestSchema: z.ZodObject<{
|
|
106
|
+
permit_id: z.ZodString;
|
|
107
|
+
}, z.core.$strict>;
|
|
108
|
+
export declare const ReconciliationResponseSchema: z.ZodObject<{
|
|
109
|
+
execution_id: z.ZodString;
|
|
110
|
+
outcome: z.ZodEnum<{
|
|
111
|
+
BLOCKED: "BLOCKED";
|
|
112
|
+
COMPLETED: "COMPLETED";
|
|
113
|
+
UNKNOWN_AFTER_DISPATCH: "UNKNOWN_AFTER_DISPATCH";
|
|
114
|
+
DEFINITELY_NOT_EXECUTED: "DEFINITELY_NOT_EXECUTED";
|
|
115
|
+
}>;
|
|
116
|
+
}, z.core.$strict>;
|
|
117
|
+
/** One `agent-safe.executor-evidence/1` line, as the runner writes it. */
|
|
118
|
+
export declare const ExecutorEvidenceLineSchema: z.ZodObject<{
|
|
119
|
+
version: z.ZodLiteral<"agent-safe.executor-evidence/1">;
|
|
120
|
+
contract: z.ZodLiteral<"agent-safe.executors.native/1">;
|
|
121
|
+
at: z.ZodISODateTime;
|
|
122
|
+
stage: z.ZodEnum<{
|
|
123
|
+
RUN: "RUN";
|
|
124
|
+
PRESENTATION: "PRESENTATION";
|
|
125
|
+
SETTLEMENT: "SETTLEMENT";
|
|
126
|
+
RECONCILIATION: "RECONCILIATION";
|
|
127
|
+
}>;
|
|
128
|
+
executor: z.ZodObject<{
|
|
129
|
+
platform: z.ZodString;
|
|
130
|
+
style: z.ZodEnum<{
|
|
131
|
+
dispatch: "dispatch";
|
|
132
|
+
permit: "permit";
|
|
133
|
+
}>;
|
|
134
|
+
version: z.ZodString;
|
|
135
|
+
}, z.core.$strict>;
|
|
136
|
+
action_type: z.ZodString;
|
|
137
|
+
intent_id: z.ZodString;
|
|
138
|
+
intent_hash: z.ZodString;
|
|
139
|
+
decision_id: z.ZodNullable<z.ZodString>;
|
|
140
|
+
dossier_id: z.ZodNullable<z.ZodString>;
|
|
141
|
+
verdict: z.ZodNullable<z.ZodString>;
|
|
142
|
+
grant_id: z.ZodNullable<z.ZodString>;
|
|
143
|
+
outcome: z.ZodEnum<{
|
|
144
|
+
BLOCKED: "BLOCKED";
|
|
145
|
+
COMPLETED: "COMPLETED";
|
|
146
|
+
FAILED_BEFORE_DISPATCH: "FAILED_BEFORE_DISPATCH";
|
|
147
|
+
UNKNOWN_AFTER_DISPATCH: "UNKNOWN_AFTER_DISPATCH";
|
|
148
|
+
DEFINITELY_NOT_EXECUTED: "DEFINITELY_NOT_EXECUTED";
|
|
149
|
+
CLAIMED: "CLAIMED";
|
|
150
|
+
HELD: "HELD";
|
|
151
|
+
}>;
|
|
152
|
+
executed: z.ZodNullable<z.ZodBoolean>;
|
|
153
|
+
reason: z.ZodNullable<z.ZodString>;
|
|
154
|
+
code: z.ZodNullable<z.ZodString>;
|
|
155
|
+
governed: z.ZodBoolean;
|
|
156
|
+
authority_state: z.ZodEnum<{
|
|
157
|
+
AUTHORITY_UNAVAILABLE: "AUTHORITY_UNAVAILABLE";
|
|
158
|
+
DECIDED: "DECIDED";
|
|
159
|
+
}>;
|
|
160
|
+
posture: z.ZodEnum<{
|
|
161
|
+
BOUNDED_CONTINUITY: "BOUNDED_CONTINUITY";
|
|
162
|
+
CUSTOM: "CUSTOM";
|
|
163
|
+
STRICT: "STRICT";
|
|
164
|
+
}>;
|
|
165
|
+
disposition: z.ZodNullable<z.ZodEnum<{
|
|
166
|
+
HELD: "HELD";
|
|
167
|
+
NOT_FORWARDED: "NOT_FORWARDED";
|
|
168
|
+
FORWARDED_UNGOVERNED: "FORWARDED_UNGOVERNED";
|
|
169
|
+
}>>;
|
|
170
|
+
finalization: z.ZodNullable<z.ZodEnum<{
|
|
171
|
+
RECORDED: "RECORDED";
|
|
172
|
+
PENDING: "PENDING";
|
|
173
|
+
UNSUPPORTED: "UNSUPPORTED";
|
|
174
|
+
}>>;
|
|
175
|
+
duration_ms: z.ZodNumber;
|
|
176
|
+
scope: z.ZodNullable<z.ZodObject<{
|
|
177
|
+
org_id: z.ZodString;
|
|
178
|
+
workspace_id: z.ZodString;
|
|
179
|
+
connection_id: z.ZodString;
|
|
180
|
+
connection_revision: z.ZodString;
|
|
181
|
+
environment: z.ZodEnum<{
|
|
182
|
+
production: "production";
|
|
183
|
+
sandbox: "sandbox";
|
|
184
|
+
}>;
|
|
185
|
+
}, z.core.$strict>>;
|
|
186
|
+
}, z.core.$strict>;
|
|
187
|
+
/** One conformance vector: a decision, a posture, and the steps an executor is held to. */
|
|
188
|
+
export declare const ExecutorVectorSchema: z.ZodObject<{
|
|
189
|
+
description: z.ZodString;
|
|
190
|
+
contract: z.ZodLiteral<"agent-safe.executors.native/1">;
|
|
191
|
+
style: z.ZodEnum<{
|
|
192
|
+
dispatch: "dispatch";
|
|
193
|
+
permit: "permit";
|
|
194
|
+
}>;
|
|
195
|
+
posture: z.ZodEnum<{
|
|
196
|
+
BOUNDED_CONTINUITY: "BOUNDED_CONTINUITY";
|
|
197
|
+
CUSTOM: "CUSTOM";
|
|
198
|
+
STRICT: "STRICT";
|
|
199
|
+
}>;
|
|
200
|
+
custom_disposition: z.ZodOptional<z.ZodEnum<{
|
|
201
|
+
HELD: "HELD";
|
|
202
|
+
NOT_FORWARDED: "NOT_FORWARDED";
|
|
203
|
+
FORWARDED_UNGOVERNED: "FORWARDED_UNGOVERNED";
|
|
204
|
+
}>>;
|
|
205
|
+
decision: z.ZodObject<{
|
|
206
|
+
verdict: z.ZodEnum<{
|
|
207
|
+
ALLOW: "ALLOW";
|
|
208
|
+
ESCALATE: "ESCALATE";
|
|
209
|
+
BLOCK: "BLOCK";
|
|
210
|
+
}>;
|
|
211
|
+
fail_closed: z.ZodBoolean;
|
|
212
|
+
}, z.core.$strict>;
|
|
213
|
+
steps: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
214
|
+
op: z.ZodLiteral<"run">;
|
|
215
|
+
write: z.ZodEnum<{
|
|
216
|
+
INDETERMINATE: "INDETERMINATE";
|
|
217
|
+
COMMIT: "COMMIT";
|
|
218
|
+
REFUSE: "REFUSE";
|
|
219
|
+
FAIL_BEFORE_DISPATCH: "FAIL_BEFORE_DISPATCH";
|
|
220
|
+
THROW_AFTER_DISPATCH: "THROW_AFTER_DISPATCH";
|
|
221
|
+
}>;
|
|
222
|
+
expect: z.ZodObject<{
|
|
223
|
+
outcome: z.ZodEnum<{
|
|
224
|
+
BLOCKED: "BLOCKED";
|
|
225
|
+
REFUSED: "REFUSED";
|
|
226
|
+
COMPLETED: "COMPLETED";
|
|
227
|
+
FAILED_BEFORE_DISPATCH: "FAILED_BEFORE_DISPATCH";
|
|
228
|
+
UNKNOWN_AFTER_DISPATCH: "UNKNOWN_AFTER_DISPATCH";
|
|
229
|
+
DEFINITELY_NOT_EXECUTED: "DEFINITELY_NOT_EXECUTED";
|
|
230
|
+
CLAIMED: "CLAIMED";
|
|
231
|
+
HELD: "HELD";
|
|
232
|
+
}>;
|
|
233
|
+
executed: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
234
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
235
|
+
code: z.ZodOptional<z.ZodString>;
|
|
236
|
+
finalized: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
237
|
+
FAILED: "FAILED";
|
|
238
|
+
COMMITTED: "COMMITTED";
|
|
239
|
+
INDETERMINATE: "INDETERMINATE";
|
|
240
|
+
}>>>;
|
|
241
|
+
permit: z.ZodOptional<z.ZodBoolean>;
|
|
242
|
+
disposition: z.ZodOptional<z.ZodEnum<{
|
|
243
|
+
HELD: "HELD";
|
|
244
|
+
NOT_FORWARDED: "NOT_FORWARDED";
|
|
245
|
+
FORWARDED_UNGOVERNED: "FORWARDED_UNGOVERNED";
|
|
246
|
+
}>>;
|
|
247
|
+
writes: z.ZodOptional<z.ZodNumber>;
|
|
248
|
+
}, z.core.$strict>;
|
|
249
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
250
|
+
op: z.ZodLiteral<"hold">;
|
|
251
|
+
expect: z.ZodObject<{
|
|
252
|
+
outcome: z.ZodEnum<{
|
|
253
|
+
BLOCKED: "BLOCKED";
|
|
254
|
+
REFUSED: "REFUSED";
|
|
255
|
+
COMPLETED: "COMPLETED";
|
|
256
|
+
FAILED_BEFORE_DISPATCH: "FAILED_BEFORE_DISPATCH";
|
|
257
|
+
UNKNOWN_AFTER_DISPATCH: "UNKNOWN_AFTER_DISPATCH";
|
|
258
|
+
DEFINITELY_NOT_EXECUTED: "DEFINITELY_NOT_EXECUTED";
|
|
259
|
+
CLAIMED: "CLAIMED";
|
|
260
|
+
HELD: "HELD";
|
|
261
|
+
}>;
|
|
262
|
+
executed: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
263
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
264
|
+
code: z.ZodOptional<z.ZodString>;
|
|
265
|
+
finalized: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
266
|
+
FAILED: "FAILED";
|
|
267
|
+
COMMITTED: "COMMITTED";
|
|
268
|
+
INDETERMINATE: "INDETERMINATE";
|
|
269
|
+
}>>>;
|
|
270
|
+
permit: z.ZodOptional<z.ZodBoolean>;
|
|
271
|
+
disposition: z.ZodOptional<z.ZodEnum<{
|
|
272
|
+
HELD: "HELD";
|
|
273
|
+
NOT_FORWARDED: "NOT_FORWARDED";
|
|
274
|
+
FORWARDED_UNGOVERNED: "FORWARDED_UNGOVERNED";
|
|
275
|
+
}>>;
|
|
276
|
+
writes: z.ZodOptional<z.ZodNumber>;
|
|
277
|
+
}, z.core.$strict>;
|
|
278
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
279
|
+
op: z.ZodLiteral<"present">;
|
|
280
|
+
expect: z.ZodObject<{
|
|
281
|
+
outcome: z.ZodEnum<{
|
|
282
|
+
BLOCKED: "BLOCKED";
|
|
283
|
+
REFUSED: "REFUSED";
|
|
284
|
+
COMPLETED: "COMPLETED";
|
|
285
|
+
FAILED_BEFORE_DISPATCH: "FAILED_BEFORE_DISPATCH";
|
|
286
|
+
UNKNOWN_AFTER_DISPATCH: "UNKNOWN_AFTER_DISPATCH";
|
|
287
|
+
DEFINITELY_NOT_EXECUTED: "DEFINITELY_NOT_EXECUTED";
|
|
288
|
+
CLAIMED: "CLAIMED";
|
|
289
|
+
HELD: "HELD";
|
|
290
|
+
}>;
|
|
291
|
+
executed: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
292
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
293
|
+
code: z.ZodOptional<z.ZodString>;
|
|
294
|
+
finalized: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
295
|
+
FAILED: "FAILED";
|
|
296
|
+
COMMITTED: "COMMITTED";
|
|
297
|
+
INDETERMINATE: "INDETERMINATE";
|
|
298
|
+
}>>>;
|
|
299
|
+
permit: z.ZodOptional<z.ZodBoolean>;
|
|
300
|
+
disposition: z.ZodOptional<z.ZodEnum<{
|
|
301
|
+
HELD: "HELD";
|
|
302
|
+
NOT_FORWARDED: "NOT_FORWARDED";
|
|
303
|
+
FORWARDED_UNGOVERNED: "FORWARDED_UNGOVERNED";
|
|
304
|
+
}>>;
|
|
305
|
+
writes: z.ZodOptional<z.ZodNumber>;
|
|
306
|
+
}, z.core.$strict>;
|
|
307
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
308
|
+
op: z.ZodLiteral<"receipt">;
|
|
309
|
+
status: z.ZodEnum<{
|
|
310
|
+
REJECTED: "REJECTED";
|
|
311
|
+
POSTED: "POSTED";
|
|
312
|
+
UNREADABLE: "UNREADABLE";
|
|
313
|
+
}>;
|
|
314
|
+
expect: z.ZodObject<{
|
|
315
|
+
outcome: z.ZodEnum<{
|
|
316
|
+
BLOCKED: "BLOCKED";
|
|
317
|
+
REFUSED: "REFUSED";
|
|
318
|
+
COMPLETED: "COMPLETED";
|
|
319
|
+
FAILED_BEFORE_DISPATCH: "FAILED_BEFORE_DISPATCH";
|
|
320
|
+
UNKNOWN_AFTER_DISPATCH: "UNKNOWN_AFTER_DISPATCH";
|
|
321
|
+
DEFINITELY_NOT_EXECUTED: "DEFINITELY_NOT_EXECUTED";
|
|
322
|
+
CLAIMED: "CLAIMED";
|
|
323
|
+
HELD: "HELD";
|
|
324
|
+
}>;
|
|
325
|
+
executed: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
326
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
327
|
+
code: z.ZodOptional<z.ZodString>;
|
|
328
|
+
finalized: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
329
|
+
FAILED: "FAILED";
|
|
330
|
+
COMMITTED: "COMMITTED";
|
|
331
|
+
INDETERMINATE: "INDETERMINATE";
|
|
332
|
+
}>>>;
|
|
333
|
+
permit: z.ZodOptional<z.ZodBoolean>;
|
|
334
|
+
disposition: z.ZodOptional<z.ZodEnum<{
|
|
335
|
+
HELD: "HELD";
|
|
336
|
+
NOT_FORWARDED: "NOT_FORWARDED";
|
|
337
|
+
FORWARDED_UNGOVERNED: "FORWARDED_UNGOVERNED";
|
|
338
|
+
}>>;
|
|
339
|
+
writes: z.ZodOptional<z.ZodNumber>;
|
|
340
|
+
}, z.core.$strict>;
|
|
341
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
342
|
+
op: z.ZodLiteral<"reconcile">;
|
|
343
|
+
answer: z.ZodEnum<{
|
|
344
|
+
COMPLETED: "COMPLETED";
|
|
345
|
+
NOT_EXECUTED: "NOT_EXECUTED";
|
|
346
|
+
UNKNOWN: "UNKNOWN";
|
|
347
|
+
}>;
|
|
348
|
+
expect: z.ZodObject<{
|
|
349
|
+
outcome: z.ZodEnum<{
|
|
350
|
+
BLOCKED: "BLOCKED";
|
|
351
|
+
REFUSED: "REFUSED";
|
|
352
|
+
COMPLETED: "COMPLETED";
|
|
353
|
+
FAILED_BEFORE_DISPATCH: "FAILED_BEFORE_DISPATCH";
|
|
354
|
+
UNKNOWN_AFTER_DISPATCH: "UNKNOWN_AFTER_DISPATCH";
|
|
355
|
+
DEFINITELY_NOT_EXECUTED: "DEFINITELY_NOT_EXECUTED";
|
|
356
|
+
CLAIMED: "CLAIMED";
|
|
357
|
+
HELD: "HELD";
|
|
358
|
+
}>;
|
|
359
|
+
executed: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
360
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
361
|
+
code: z.ZodOptional<z.ZodString>;
|
|
362
|
+
finalized: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
363
|
+
FAILED: "FAILED";
|
|
364
|
+
COMMITTED: "COMMITTED";
|
|
365
|
+
INDETERMINATE: "INDETERMINATE";
|
|
366
|
+
}>>>;
|
|
367
|
+
permit: z.ZodOptional<z.ZodBoolean>;
|
|
368
|
+
disposition: z.ZodOptional<z.ZodEnum<{
|
|
369
|
+
HELD: "HELD";
|
|
370
|
+
NOT_FORWARDED: "NOT_FORWARDED";
|
|
371
|
+
FORWARDED_UNGOVERNED: "FORWARDED_UNGOVERNED";
|
|
372
|
+
}>>;
|
|
373
|
+
writes: z.ZodOptional<z.ZodNumber>;
|
|
374
|
+
}, z.core.$strict>;
|
|
375
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
376
|
+
op: z.ZodLiteral<"advance">;
|
|
377
|
+
ms: z.ZodNumber;
|
|
378
|
+
}, z.core.$strict>], "op">>;
|
|
379
|
+
}, z.core.$strict>;
|
|
380
|
+
export type ExecutorVector = z.infer<typeof ExecutorVectorSchema>;
|
|
381
|
+
/**
|
|
382
|
+
* The published JSON Schema of the contract's wire objects, generated from
|
|
383
|
+
* the validators this package runs, so the document a third party validates
|
|
384
|
+
* against and the reference implementation are one definition.
|
|
385
|
+
*/
|
|
386
|
+
export declare function nativeExecutorJsonSchema(): Record<string, unknown>;
|
|
387
|
+
//# sourceMappingURL=NativeExecutorSchema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeExecutorSchema.d.ts","sourceRoot":"","sources":["../../src/execution/NativeExecutorSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,yBAAyB,qGAC8D,CAAC;AAuBrG,eAAO,MAAM,sBAAsB;;;;;;;EAAmB,CAAC;AAEvD,2FAA2F;AAC3F,eAAO,MAAM,sBAAsB;;;;;;;kBAYjC,CAAC;AAEH,2FAA2F;AAC3F,eAAO,MAAM,yBAAyB;;;;;;;kBAOpC,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;kBAMjC,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;kBAUlC,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;kBA6B9B,CAAC;AAEH,kEAAkE;AAClE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;oBAYhC,CAAC;AAEH,oGAAoG;AACpG,eAAO,MAAM,2BAA2B;;kBAEtC,CAAC;AAEH,eAAO,MAAM,4BAA4B;;;;;;;;kBAGvC,CAAC;AAEH,0EAA0E;AAC1E,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAgCrC,CAAC;AAkDH,2FAA2F;AAC3F,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAa/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAgBlE;;;;GAIG;AACH,wBAAgB,wBAAwB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAclE"}
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { EXECUTOR_EVIDENCE_VERSION } from "./ExecutorEvidence.js";
|
|
3
|
+
import { NATIVE_EXECUTOR_CONTRACT } from "./NativeExecutor.js";
|
|
4
|
+
export const NATIVE_EXECUTOR_SCHEMA_ID = "https://github.com/decionis/agent-safe-pipeline/blob/master/spec/executors/native/v1/schema.json";
|
|
5
|
+
const identifier = z.string().min(1).max(200);
|
|
6
|
+
const code = z.string().regex(/^[A-Z][A-Z0-9_]{1,63}$/);
|
|
7
|
+
const actionType = z
|
|
8
|
+
.string()
|
|
9
|
+
.min(1)
|
|
10
|
+
.max(120)
|
|
11
|
+
.regex(/^[a-z][a-z0-9._:-]*$/);
|
|
12
|
+
const sha256Digest = z.string().regex(/^sha256:[0-9a-f]{64}$/);
|
|
13
|
+
/** A bare SHA-256, as the wire profile's `intent_sha256` carries it. */
|
|
14
|
+
const sha256Hex = z.string().regex(/^[0-9a-f]{64}$/);
|
|
15
|
+
const instant = z.iso.datetime();
|
|
16
|
+
const OUTCOMES = [
|
|
17
|
+
"BLOCKED",
|
|
18
|
+
"HELD",
|
|
19
|
+
"FAILED_BEFORE_DISPATCH",
|
|
20
|
+
"COMPLETED",
|
|
21
|
+
"DEFINITELY_NOT_EXECUTED",
|
|
22
|
+
"UNKNOWN_AFTER_DISPATCH",
|
|
23
|
+
];
|
|
24
|
+
export const ExecutionOutcomeSchema = z.enum(OUTCOMES);
|
|
25
|
+
/** Who carries the action out, as `POST /v1/authority/grants` accepts it in `executor`. */
|
|
26
|
+
export const ExecutorIdentitySchema = z.strictObject({
|
|
27
|
+
platform: z
|
|
28
|
+
.string()
|
|
29
|
+
.min(1)
|
|
30
|
+
.max(64)
|
|
31
|
+
.regex(/^[a-z0-9][a-z0-9._-]*$/),
|
|
32
|
+
style: z.enum(["dispatch", "permit"]),
|
|
33
|
+
version: z
|
|
34
|
+
.string()
|
|
35
|
+
.min(1)
|
|
36
|
+
.max(64)
|
|
37
|
+
.regex(/^[^\W_][\w.+-]*$/),
|
|
38
|
+
});
|
|
39
|
+
/** What one executor can write for one action type: `ExecutionCapability`, on the wire. */
|
|
40
|
+
export const ExecutionCapabilitySchema = z.strictObject({
|
|
41
|
+
platform: identifier,
|
|
42
|
+
action_type: actionType,
|
|
43
|
+
enabled: z.boolean(),
|
|
44
|
+
scope_granted: z.boolean(),
|
|
45
|
+
connected: z.boolean(),
|
|
46
|
+
requirement: z.string().max(500),
|
|
47
|
+
});
|
|
48
|
+
/**
|
|
49
|
+
* Permit wire profile, step 1: `POST /v1/connections/{connectionId}/executions`.
|
|
50
|
+
* The connection, organisation and environment come from the authenticated
|
|
51
|
+
* connection, never from this body.
|
|
52
|
+
*/
|
|
53
|
+
export const ExecutionRequestSchema = z.strictObject({
|
|
54
|
+
executor: ExecutorIdentitySchema,
|
|
55
|
+
action_type: actionType,
|
|
56
|
+
/** The platform's own description of the action, as the executor's `prepare` reads it. */
|
|
57
|
+
action: z.record(z.string(), z.unknown()),
|
|
58
|
+
correlation_id: identifier.optional(),
|
|
59
|
+
});
|
|
60
|
+
/**
|
|
61
|
+
* Permit wire profile, step 2: what the executor host answers. `permit_id`,
|
|
62
|
+
* `intent_sha256` and `expires_at` are present only when the outcome is
|
|
63
|
+
* `HELD`: there is a permit to present.
|
|
64
|
+
*/
|
|
65
|
+
export const ExecutionResponseSchema = z.strictObject({
|
|
66
|
+
execution_id: identifier,
|
|
67
|
+
outcome: z.enum(["HELD", "BLOCKED"]),
|
|
68
|
+
/** The authority's verdict in the vocabulary the platform reads (`PROCEED`, `HOLD`, `BLOCK`, …). */
|
|
69
|
+
decision: code,
|
|
70
|
+
reason_codes: z.array(code).max(32),
|
|
71
|
+
dossier_id: identifier.nullable(),
|
|
72
|
+
permit_id: identifier.nullable(),
|
|
73
|
+
intent_sha256: sha256Hex.nullable(),
|
|
74
|
+
expires_at: instant.nullable(),
|
|
75
|
+
});
|
|
76
|
+
/**
|
|
77
|
+
* Permit wire profile, step 4: `POST …/executions/{executionId}/receipts`.
|
|
78
|
+
* The platform's native receipt, verbatim in its own vocabulary; the
|
|
79
|
+
* executor's `observe` reads it into an outcome.
|
|
80
|
+
*/
|
|
81
|
+
export const NativeReceiptSchema = z.strictObject({
|
|
82
|
+
permit_id: identifier,
|
|
83
|
+
/** Exactly what `POST /v1/authority/grants/{grantId}/receipts` accepts as `native_receipt`. */
|
|
84
|
+
native_receipt: z.strictObject({
|
|
85
|
+
platform: z
|
|
86
|
+
.string()
|
|
87
|
+
.min(1)
|
|
88
|
+
.max(64)
|
|
89
|
+
.regex(/^[a-z0-9][a-z0-9._-]*$/),
|
|
90
|
+
kind: z
|
|
91
|
+
.string()
|
|
92
|
+
.min(1)
|
|
93
|
+
.max(64)
|
|
94
|
+
.regex(/^[a-z][a-z0-9._-]*$/),
|
|
95
|
+
reference: z.string().trim().min(1).max(500),
|
|
96
|
+
status: z
|
|
97
|
+
.string()
|
|
98
|
+
.min(1)
|
|
99
|
+
.max(64)
|
|
100
|
+
.regex(/^[^\W\d_][\w.-]*$/),
|
|
101
|
+
observed_at: instant,
|
|
102
|
+
digest: sha256Digest.optional(),
|
|
103
|
+
}),
|
|
104
|
+
/** A signed effect receipt (compact JWS), when the platform issues one. */
|
|
105
|
+
signed_receipt: z
|
|
106
|
+
.string()
|
|
107
|
+
.max(20_000)
|
|
108
|
+
.regex(/^[\w-]+\.[\w-]+\.[\w-]+$/)
|
|
109
|
+
.optional(),
|
|
110
|
+
});
|
|
111
|
+
/** How a receipt settled the execution, or why it was refused. */
|
|
112
|
+
export const ReceiptResponseSchema = z.union([
|
|
113
|
+
z.strictObject({
|
|
114
|
+
execution_id: identifier,
|
|
115
|
+
status: z.literal("SETTLED"),
|
|
116
|
+
outcome: z.enum(["COMPLETED", "DEFINITELY_NOT_EXECUTED", "UNKNOWN_AFTER_DISPATCH"]),
|
|
117
|
+
finalization: z.enum(["RECORDED", "PENDING", "UNSUPPORTED"]),
|
|
118
|
+
}),
|
|
119
|
+
z.strictObject({
|
|
120
|
+
execution_id: identifier,
|
|
121
|
+
status: z.literal("REFUSED"),
|
|
122
|
+
reason: z.enum(["RECEIPT_DUPLICATE", "PERMIT_NOT_PRESENTED"]),
|
|
123
|
+
}),
|
|
124
|
+
]);
|
|
125
|
+
/** `POST …/executions/{executionId}/reconciliations`: ask the executor what happened, read-only. */
|
|
126
|
+
export const ReconciliationRequestSchema = z.strictObject({
|
|
127
|
+
permit_id: identifier,
|
|
128
|
+
});
|
|
129
|
+
export const ReconciliationResponseSchema = z.strictObject({
|
|
130
|
+
execution_id: identifier,
|
|
131
|
+
outcome: z.enum(["COMPLETED", "DEFINITELY_NOT_EXECUTED", "UNKNOWN_AFTER_DISPATCH", "BLOCKED"]),
|
|
132
|
+
});
|
|
133
|
+
/** One `agent-safe.executor-evidence/1` line, as the runner writes it. */
|
|
134
|
+
export const ExecutorEvidenceLineSchema = z.strictObject({
|
|
135
|
+
version: z.literal(EXECUTOR_EVIDENCE_VERSION),
|
|
136
|
+
contract: z.literal(NATIVE_EXECUTOR_CONTRACT),
|
|
137
|
+
at: instant,
|
|
138
|
+
stage: z.enum(["RUN", "PRESENTATION", "SETTLEMENT", "RECONCILIATION"]),
|
|
139
|
+
executor: ExecutorIdentitySchema,
|
|
140
|
+
action_type: actionType,
|
|
141
|
+
intent_id: identifier,
|
|
142
|
+
intent_hash: sha256Digest,
|
|
143
|
+
decision_id: identifier.nullable(),
|
|
144
|
+
dossier_id: identifier.nullable(),
|
|
145
|
+
verdict: code.nullable(),
|
|
146
|
+
grant_id: identifier.nullable(),
|
|
147
|
+
outcome: z.enum([...OUTCOMES, "CLAIMED"]),
|
|
148
|
+
executed: z.boolean().nullable(),
|
|
149
|
+
reason: code.nullable(),
|
|
150
|
+
code: code.nullable(),
|
|
151
|
+
governed: z.boolean(),
|
|
152
|
+
authority_state: z.enum(["DECIDED", "AUTHORITY_UNAVAILABLE"]),
|
|
153
|
+
posture: z.enum(["STRICT", "BOUNDED_CONTINUITY", "CUSTOM"]),
|
|
154
|
+
disposition: z.enum(["NOT_FORWARDED", "HELD", "FORWARDED_UNGOVERNED"]).nullable(),
|
|
155
|
+
finalization: z.enum(["RECORDED", "PENDING", "UNSUPPORTED"]).nullable(),
|
|
156
|
+
duration_ms: z.number().int().min(0),
|
|
157
|
+
scope: z
|
|
158
|
+
.strictObject({
|
|
159
|
+
org_id: identifier,
|
|
160
|
+
workspace_id: identifier,
|
|
161
|
+
connection_id: identifier,
|
|
162
|
+
connection_revision: identifier,
|
|
163
|
+
environment: z.enum(["sandbox", "production"]),
|
|
164
|
+
})
|
|
165
|
+
.nullable(),
|
|
166
|
+
});
|
|
167
|
+
const VectorExpectationSchema = z.strictObject({
|
|
168
|
+
outcome: z.enum([...OUTCOMES, "CLAIMED", "REFUSED"]),
|
|
169
|
+
executed: z.boolean().nullable().optional(),
|
|
170
|
+
reason: identifier.optional(),
|
|
171
|
+
code: code.optional(),
|
|
172
|
+
/** What the authority recorded for the grant after the step, when it records one. */
|
|
173
|
+
finalized: z.enum(["COMMITTED", "FAILED", "INDETERMINATE"]).nullable().optional(),
|
|
174
|
+
/** Whether a permit came back with the step. */
|
|
175
|
+
permit: z.boolean().optional(),
|
|
176
|
+
disposition: z.enum(["NOT_FORWARDED", "HELD", "FORWARDED_UNGOVERNED"]).optional(),
|
|
177
|
+
/** How many times the executor's write was attempted, cumulatively. */
|
|
178
|
+
writes: z.number().int().min(0).optional(),
|
|
179
|
+
});
|
|
180
|
+
const VectorStepSchema = z.discriminatedUnion("op", [
|
|
181
|
+
z.strictObject({
|
|
182
|
+
op: z.literal("run"),
|
|
183
|
+
/** What the executor's write does. */
|
|
184
|
+
write: z.enum([
|
|
185
|
+
"COMMIT",
|
|
186
|
+
"REFUSE",
|
|
187
|
+
"INDETERMINATE",
|
|
188
|
+
"FAIL_BEFORE_DISPATCH",
|
|
189
|
+
"THROW_AFTER_DISPATCH",
|
|
190
|
+
]),
|
|
191
|
+
expect: VectorExpectationSchema,
|
|
192
|
+
}),
|
|
193
|
+
z.strictObject({ op: z.literal("hold"), expect: VectorExpectationSchema }),
|
|
194
|
+
z.strictObject({ op: z.literal("present"), expect: VectorExpectationSchema }),
|
|
195
|
+
z.strictObject({
|
|
196
|
+
op: z.literal("receipt"),
|
|
197
|
+
/** The native receipt's status, in the vector platform's vocabulary. */
|
|
198
|
+
status: z.enum(["POSTED", "REJECTED", "UNREADABLE"]),
|
|
199
|
+
expect: VectorExpectationSchema,
|
|
200
|
+
}),
|
|
201
|
+
z.strictObject({
|
|
202
|
+
op: z.literal("reconcile"),
|
|
203
|
+
/** What the platform answers when asked about the attempt. */
|
|
204
|
+
answer: z.enum(["COMPLETED", "NOT_EXECUTED", "UNKNOWN"]),
|
|
205
|
+
expect: VectorExpectationSchema,
|
|
206
|
+
}),
|
|
207
|
+
z.strictObject({
|
|
208
|
+
op: z.literal("advance"),
|
|
209
|
+
/** Milliseconds the clock moves before the next step. */
|
|
210
|
+
ms: z.number().int().min(1),
|
|
211
|
+
}),
|
|
212
|
+
]);
|
|
213
|
+
/** One conformance vector: a decision, a posture, and the steps an executor is held to. */
|
|
214
|
+
export const ExecutorVectorSchema = z.strictObject({
|
|
215
|
+
description: z.string().min(1).max(500),
|
|
216
|
+
contract: z.literal(NATIVE_EXECUTOR_CONTRACT),
|
|
217
|
+
style: z.enum(["dispatch", "permit"]),
|
|
218
|
+
posture: z.enum(["STRICT", "BOUNDED_CONTINUITY", "CUSTOM"]),
|
|
219
|
+
/** For `CUSTOM` posture: the disposition the institution's rule chooses. */
|
|
220
|
+
custom_disposition: z.enum(["NOT_FORWARDED", "HELD", "FORWARDED_UNGOVERNED"]).optional(),
|
|
221
|
+
decision: z.strictObject({
|
|
222
|
+
verdict: z.enum(["ALLOW", "ESCALATE", "BLOCK"]),
|
|
223
|
+
/** True when the authority could not be reached and the gate failed closed. */
|
|
224
|
+
fail_closed: z.boolean(),
|
|
225
|
+
}),
|
|
226
|
+
steps: z.array(VectorStepSchema).min(1).max(16),
|
|
227
|
+
});
|
|
228
|
+
const DEFINITIONS = {
|
|
229
|
+
ExecutionOutcome: ExecutionOutcomeSchema,
|
|
230
|
+
ExecutorIdentity: ExecutorIdentitySchema,
|
|
231
|
+
ExecutionCapability: ExecutionCapabilitySchema,
|
|
232
|
+
ExecutionRequest: ExecutionRequestSchema,
|
|
233
|
+
ExecutionResponse: ExecutionResponseSchema,
|
|
234
|
+
NativeReceipt: NativeReceiptSchema,
|
|
235
|
+
ReceiptResponse: ReceiptResponseSchema,
|
|
236
|
+
ReconciliationRequest: ReconciliationRequestSchema,
|
|
237
|
+
ReconciliationResponse: ReconciliationResponseSchema,
|
|
238
|
+
ExecutorEvidenceLine: ExecutorEvidenceLineSchema,
|
|
239
|
+
ExecutorVector: ExecutorVectorSchema,
|
|
240
|
+
};
|
|
241
|
+
/**
|
|
242
|
+
* The published JSON Schema of the contract's wire objects, generated from
|
|
243
|
+
* the validators this package runs, so the document a third party validates
|
|
244
|
+
* against and the reference implementation are one definition.
|
|
245
|
+
*/
|
|
246
|
+
export function nativeExecutorJsonSchema() {
|
|
247
|
+
const definitions = {};
|
|
248
|
+
for (const [name, schema] of Object.entries(DEFINITIONS)) {
|
|
249
|
+
const generated = z.toJSONSchema(schema, { target: "draft-2020-12", io: "input" });
|
|
250
|
+
const definition = { ...generated };
|
|
251
|
+
delete definition["$schema"];
|
|
252
|
+
definitions[name] = definition;
|
|
253
|
+
}
|
|
254
|
+
return {
|
|
255
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
256
|
+
$id: NATIVE_EXECUTOR_SCHEMA_ID,
|
|
257
|
+
title: NATIVE_EXECUTOR_CONTRACT,
|
|
258
|
+
$defs: definitions,
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
//# sourceMappingURL=NativeExecutorSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeExecutorSchema.js","sourceRoot":"","sources":["../../src/execution/NativeExecutorSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAE/D,MAAM,CAAC,MAAM,yBAAyB,GACpC,kGAAkG,CAAC;AAErG,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC9C,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;AACxD,MAAM,UAAU,GAAG,CAAC;KACjB,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,CAAC;KACN,GAAG,CAAC,GAAG,CAAC;KACR,KAAK,CAAC,sBAAsB,CAAC,CAAC;AACjC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;AAC/D,wEAAwE;AACxE,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;AACrD,MAAM,OAAO,GAAG,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;AAEjC,MAAM,QAAQ,GAAG;IACf,SAAS;IACT,MAAM;IACN,wBAAwB;IACxB,WAAW;IACX,yBAAyB;IACzB,wBAAwB;CAChB,CAAC;AAEX,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,IAA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