@decionis/agent-safe-pipeline 0.1.3 → 0.2.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 +477 -16
- package/dist/Index.d.ts +9 -0
- package/dist/Index.d.ts.map +1 -1
- package/dist/Index.js +8 -0
- package/dist/Index.js.map +1 -1
- package/dist/approval/PresenceApprovalCoordinator.d.ts +25 -0
- package/dist/approval/PresenceApprovalCoordinator.d.ts.map +1 -1
- package/dist/approval/PresenceApprovalCoordinator.js +54 -6
- package/dist/approval/PresenceApprovalCoordinator.js.map +1 -1
- package/dist/audit/AuditRecorder.d.ts +122 -0
- package/dist/audit/AuditRecorder.d.ts.map +1 -0
- package/dist/audit/AuditRecorder.js +312 -0
- package/dist/audit/AuditRecorder.js.map +1 -0
- package/dist/decision/CreateGate.d.ts +123 -0
- package/dist/decision/CreateGate.d.ts.map +1 -0
- package/dist/decision/CreateGate.js +211 -0
- package/dist/decision/CreateGate.js.map +1 -0
- package/dist/decision/DecionisGate.d.ts +109 -3
- package/dist/decision/DecionisGate.d.ts.map +1 -1
- package/dist/decision/DecionisGate.js +823 -46
- package/dist/decision/DecionisGate.js.map +1 -1
- package/dist/decision/DecisionAuthority.d.ts +76 -1
- package/dist/decision/DecisionAuthority.d.ts.map +1 -1
- package/dist/decision/DecisionAuthority.js.map +1 -1
- package/dist/decision/FixtureDecisionAuthority.d.ts +27 -1
- package/dist/decision/FixtureDecisionAuthority.d.ts.map +1 -1
- package/dist/decision/FixtureDecisionAuthority.js +47 -0
- package/dist/decision/FixtureDecisionAuthority.js.map +1 -1
- package/dist/decision/ImmutableGateDecision.d.ts.map +1 -1
- package/dist/decision/ImmutableGateDecision.js +26 -0
- package/dist/decision/ImmutableGateDecision.js.map +1 -1
- package/dist/decision/Provision.d.ts +33 -0
- package/dist/decision/Provision.d.ts.map +1 -0
- package/dist/decision/Provision.js +116 -0
- package/dist/decision/Provision.js.map +1 -0
- package/dist/decision/ShadowGate.d.ts +31 -0
- package/dist/decision/ShadowGate.d.ts.map +1 -0
- package/dist/decision/ShadowGate.js +79 -0
- package/dist/decision/ShadowGate.js.map +1 -0
- package/dist/execution/ActionRegistry.d.ts +66 -0
- package/dist/execution/ActionRegistry.d.ts.map +1 -1
- package/dist/execution/ActionRegistry.js +110 -1
- package/dist/execution/ActionRegistry.js.map +1 -1
- package/dist/execution/AuthorizationVerifier.d.ts +149 -1
- package/dist/execution/AuthorizationVerifier.d.ts.map +1 -1
- package/dist/execution/AuthorizationVerifier.js +302 -27
- package/dist/execution/AuthorizationVerifier.js.map +1 -1
- package/dist/execution/SafeExecutor.d.ts +102 -7
- package/dist/execution/SafeExecutor.d.ts.map +1 -1
- package/dist/execution/SafeExecutor.js +288 -17
- package/dist/execution/SafeExecutor.js.map +1 -1
- package/dist/http/ClientIdentification.d.ts +22 -0
- package/dist/http/ClientIdentification.d.ts.map +1 -0
- package/dist/http/ClientIdentification.js +44 -0
- package/dist/http/ClientIdentification.js.map +1 -0
- package/dist/http/Credential.d.ts +17 -0
- package/dist/http/Credential.d.ts.map +1 -0
- package/dist/http/Credential.js +5 -0
- package/dist/http/Credential.js.map +1 -0
- package/dist/http/StoredCredentials.d.ts +34 -0
- package/dist/http/StoredCredentials.d.ts.map +1 -0
- package/dist/http/StoredCredentials.js +85 -0
- package/dist/http/StoredCredentials.js.map +1 -0
- package/dist/intent/CanonicalIntentHasher.d.ts +1 -1
- package/dist/intent/CanonicalIntentHasher.d.ts.map +1 -1
- package/dist/intent/CanonicalIntentHasher.js +9 -2
- package/dist/intent/CanonicalIntentHasher.js.map +1 -1
- package/dist/intent/ExecutionIntent.d.ts +26 -2
- package/dist/intent/ExecutionIntent.d.ts.map +1 -1
- package/dist/intent/ExecutionIntent.js +11 -0
- package/dist/intent/ExecutionIntent.js.map +1 -1
- package/dist/intent/IntentCapture.d.ts +5 -0
- package/dist/intent/IntentCapture.d.ts.map +1 -1
- package/dist/intent/IntentCapture.js +15 -1
- package/dist/intent/IntentCapture.js.map +1 -1
- package/dist/report/DecisionReport.d.ts +22 -0
- package/dist/report/DecisionReport.d.ts.map +1 -0
- package/dist/report/DecisionReport.js +37 -0
- package/dist/report/DecisionReport.js.map +1 -0
- package/dist/report/DossierReport.d.ts +43 -0
- package/dist/report/DossierReport.d.ts.map +1 -0
- package/dist/report/DossierReport.js +130 -0
- package/dist/report/DossierReport.js.map +1 -0
- package/dist/report/HostedOutcome.d.ts +18 -0
- package/dist/report/HostedOutcome.d.ts.map +1 -0
- package/dist/report/HostedOutcome.js +24 -0
- package/dist/report/HostedOutcome.js.map +1 -0
- package/dist/shadow/ShadowPipeline.d.ts +75 -5
- package/dist/shadow/ShadowPipeline.d.ts.map +1 -1
- package/dist/shadow/ShadowPipeline.js +157 -7
- package/dist/shadow/ShadowPipeline.js.map +1 -1
- package/dist/testing/Index.d.ts +12 -0
- package/dist/testing/Index.d.ts.map +1 -0
- package/dist/testing/Index.js +12 -0
- package/dist/testing/Index.js.map +1 -0
- package/dist/testing/LocalAuthority.d.ts +292 -0
- package/dist/testing/LocalAuthority.d.ts.map +1 -0
- package/dist/testing/LocalAuthority.js +1124 -0
- package/dist/testing/LocalAuthority.js.map +1 -0
- package/dist/testing/LocalPresence.d.ts +210 -0
- package/dist/testing/LocalPresence.d.ts.map +1 -0
- package/dist/testing/LocalPresence.js +473 -0
- package/dist/testing/LocalPresence.js.map +1 -0
- package/package.json +40 -4
|
@@ -1,30 +1,148 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
1
2
|
import { z } from "zod";
|
|
2
3
|
import { AuthorityBaseUrl } from "../http/AuthorityBaseUrl.js";
|
|
4
|
+
import { credentialReader } from "../http/Credential.js";
|
|
3
5
|
import { BoundedResponseBody } from "../http/BoundedResponseBody.js";
|
|
4
6
|
import { CanonicalIntentHasher } from "../intent/CanonicalIntentHasher.js";
|
|
5
|
-
const
|
|
6
|
-
.
|
|
7
|
+
const boundedIdentifier = z
|
|
8
|
+
.string()
|
|
9
|
+
.min(1)
|
|
10
|
+
.max(200)
|
|
11
|
+
.refine(hasNoControlCharacters, { message: "IDENTIFIER_INVALID" });
|
|
12
|
+
const sha256Digest = z.string().regex(/^sha256:[0-9a-f]{64}$/);
|
|
13
|
+
const intentHash = sha256Digest;
|
|
14
|
+
const CLAIM_TOKEN_PATTERN = /^[\w-]{43,128}$/;
|
|
15
|
+
const COMPACT_JWS_PATTERN = /^[\w-]+\.[\w-]+\.[\w-]+$/;
|
|
16
|
+
/** `boundedIdentifier` from the Decionis `EffectEvidence` contract, verbatim. */
|
|
17
|
+
const effectIdentifier = z.string().trim().min(1).max(500);
|
|
18
|
+
/**
|
|
19
|
+
* The Decionis Protocol 1.1 `EffectEvidence` contract, mirrored so an
|
|
20
|
+
* observation is bounded before it is serialised onto an authenticated
|
|
21
|
+
* request. Parsing also takes the snapshot the drop rule then checks, so the
|
|
22
|
+
* values that are verified are exactly the values that are sent. The
|
|
23
|
+
* `CONFIRMED` refinements are deliberately not mirrored: whether an
|
|
24
|
+
* observation qualifies as confirmed is the authority's judgement, not this
|
|
25
|
+
* package's, and a refusal is recoverable by the evidence-free retry.
|
|
26
|
+
*/
|
|
27
|
+
const EffectEvidenceSchema = z.strictObject({
|
|
28
|
+
version: z.literal("1.0"),
|
|
29
|
+
status: z.enum(["CONFIRMED", "UNCONFIRMED"]),
|
|
30
|
+
observation_method: z.enum([
|
|
31
|
+
"DOWNSTREAM_ACK",
|
|
32
|
+
"READ_AFTER_WRITE",
|
|
33
|
+
"EVENT_CONFIRMATION",
|
|
34
|
+
"STATE_RECONCILIATION",
|
|
35
|
+
"SIGNED_RECEIPT",
|
|
36
|
+
"EXTERNAL_ATTESTATION",
|
|
37
|
+
"HUMAN_VALIDATION",
|
|
38
|
+
]),
|
|
39
|
+
observer: z
|
|
40
|
+
.strictObject({ id: effectIdentifier, version: effectIdentifier.nullable() })
|
|
41
|
+
.nullable(),
|
|
42
|
+
expected_effect_digest: sha256Digest,
|
|
43
|
+
observed_effect_digest: sha256Digest.nullable(),
|
|
44
|
+
observed_at: z.string().datetime().nullable(),
|
|
45
|
+
evidence_digest: sha256Digest.nullable(),
|
|
46
|
+
evidence_reference: effectIdentifier.nullable(),
|
|
47
|
+
execution_correlation_id: effectIdentifier,
|
|
48
|
+
});
|
|
49
|
+
/**
|
|
50
|
+
* Mirrors `ExecutionTokenResponse` and `ExecutionTokenClaims` in the Decionis
|
|
51
|
+
* OpenAPI contract. Claims are declared `additionalProperties: true`, and the
|
|
52
|
+
* live response carries revalidation fields beyond the documented envelope, so
|
|
53
|
+
* unknown fields are tolerated; authority is established only by the positive
|
|
54
|
+
* assertions checked below, never by an extra field.
|
|
55
|
+
*/
|
|
56
|
+
const ClaimResponseSchema = z.looseObject({
|
|
7
57
|
valid: z.literal(true),
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
58
|
+
reason_codes: z.array(boundedIdentifier).max(50).optional(),
|
|
59
|
+
should_execute: z.boolean().optional(),
|
|
60
|
+
claims: z.looseObject({
|
|
61
|
+
iss: boundedIdentifier,
|
|
62
|
+
sub: boundedIdentifier.optional(),
|
|
63
|
+
aud: z.string().min(1).max(500).optional(),
|
|
64
|
+
org_id: z.string().uuid(),
|
|
65
|
+
dossier_id: boundedIdentifier,
|
|
66
|
+
decision_id: boundedIdentifier,
|
|
67
|
+
action: boundedIdentifier,
|
|
68
|
+
decision: z.literal("allow"),
|
|
69
|
+
scope: z.literal("execute"),
|
|
70
|
+
binding: z.looseObject({
|
|
71
|
+
intent_hash: intentHash,
|
|
72
|
+
// An authority that stores no commitment may omit the property, serialise
|
|
73
|
+
// its nullable column as `null`, or emit something this package does not
|
|
74
|
+
// recognise. All three mean "no commitment this executor can read", and
|
|
75
|
+
// all three must behave exactly as they did before this property existed,
|
|
76
|
+
// when the loose envelope passed the value through untouched. Reading an
|
|
77
|
+
// unrecognised value as absent keeps that promise and stays fail-closed:
|
|
78
|
+
// an intent that committed a digest still finds no match and is refused.
|
|
79
|
+
expected_effect_digest: sha256Digest.nullish().catch(undefined),
|
|
80
|
+
// The same rule for the payload digest and its profile: unreadable is
|
|
81
|
+
// absent, and absent means no comparison, which is what an authority
|
|
82
|
+
// that never bound one has always meant.
|
|
83
|
+
execution_payload_digest: sha256Digest.nullish().catch(undefined),
|
|
84
|
+
execution_payload_canonicalization_profile: z
|
|
85
|
+
.string()
|
|
86
|
+
.min(1)
|
|
87
|
+
.max(200)
|
|
88
|
+
.nullish()
|
|
89
|
+
.catch(undefined),
|
|
90
|
+
}),
|
|
91
|
+
jti: boundedIdentifier,
|
|
92
|
+
iat: z.number().int(),
|
|
93
|
+
nbf: z.number().int(),
|
|
13
94
|
exp: z.number().int().positive(),
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
.
|
|
95
|
+
}),
|
|
96
|
+
claim_token: z.string().regex(CLAIM_TOKEN_PATTERN).nullable().optional(),
|
|
97
|
+
claim_lease_expires_at: z.string().datetime().nullable().optional(),
|
|
98
|
+
// A compact JWS or nothing. This package never verifies it: it is not the
|
|
99
|
+
// audience, the downstream is. An unreadable value is treated as absent
|
|
100
|
+
// rather than refused, because the grant it rides with is what authorizes.
|
|
101
|
+
claim_attestation: z.string().regex(COMPACT_JWS_PATTERN).max(8_192).nullish().catch(undefined),
|
|
102
|
+
});
|
|
103
|
+
/** The canonicalization this package can reproduce, named the way the authority names it. */
|
|
104
|
+
const JCS_PROFILE = "RFC8785/JCS";
|
|
105
|
+
/**
|
|
106
|
+
* The response envelope is deliberately loose, and the two effect fields are
|
|
107
|
+
* reporting-only: a value outside their contract must never turn a recorded
|
|
108
|
+
* finalization into `PENDING` for a consumer using none of this. Anything
|
|
109
|
+
* unrecognised reads as absent, which reports closed.
|
|
110
|
+
*/
|
|
111
|
+
const FinalizeResponseSchema = z.looseObject({
|
|
112
|
+
finalized: z.boolean(),
|
|
113
|
+
reason_codes: z.array(boundedIdentifier).max(50).optional(),
|
|
114
|
+
effect_evidence_recorded: z.boolean().optional().catch(undefined),
|
|
115
|
+
effect_confirmation: z.enum(["CONFIRMED", "UNCONFIRMED"]).optional().catch(undefined),
|
|
116
|
+
});
|
|
19
117
|
const MAX_RESPONSE_BYTES = 100 * 1024;
|
|
118
|
+
/**
|
|
119
|
+
* Claims a Decionis execution grant through `/v1/execution/claim-token`
|
|
120
|
+
* immediately before dispatch and finalizes the attempt through
|
|
121
|
+
* `/v1/execution/finalize-token` afterwards, so commit evidence joins the
|
|
122
|
+
* Decision Dossier chain.
|
|
123
|
+
*/
|
|
20
124
|
export class DecionisGrantVerifier {
|
|
21
125
|
baseUrl;
|
|
22
126
|
apiKey;
|
|
23
127
|
timeoutMs;
|
|
24
128
|
fetchImpl;
|
|
129
|
+
/** Claim material is keyed by the frozen authorization it belongs to and never exposed. */
|
|
130
|
+
claims = new WeakMap();
|
|
131
|
+
/** The authority's own answer about an observation, keyed by the frozen authorization. */
|
|
132
|
+
reports = new WeakMap();
|
|
133
|
+
/**
|
|
134
|
+
* The digest the authority binds over the action parameters: SHA-256 of
|
|
135
|
+
* their RFC 8785 canonical form, the same canonicalization the intent hash
|
|
136
|
+
* uses. Exposed so a test, or an authority implementation, can produce the
|
|
137
|
+
* value this verifier will accept.
|
|
138
|
+
*/
|
|
139
|
+
static parametersDigest(parameters) {
|
|
140
|
+
const canonical = CanonicalIntentHasher.stringify(parameters);
|
|
141
|
+
return `sha256:${createHash("sha256").update(canonical, "utf8").digest("hex")}`;
|
|
142
|
+
}
|
|
25
143
|
constructor(options) {
|
|
26
144
|
this.baseUrl = AuthorityBaseUrl.normalize(options.baseUrl, options.allowInsecureLoopback === true);
|
|
27
|
-
this.apiKey = options.apiKey;
|
|
145
|
+
this.apiKey = credentialReader(options.apiKey);
|
|
28
146
|
this.timeoutMs = Math.min(Math.max(options.timeoutMs ?? 4_000, 1), 15_000);
|
|
29
147
|
this.fetchImpl = options.fetch ?? fetch;
|
|
30
148
|
}
|
|
@@ -36,20 +154,25 @@ export class DecionisGrantVerifier {
|
|
|
36
154
|
decision.intentHash !== captured.intentHash) {
|
|
37
155
|
return null;
|
|
38
156
|
}
|
|
157
|
+
const commitCorrelationId = captured.intent.intentId;
|
|
39
158
|
const controller = new AbortController();
|
|
40
159
|
const timeout = setTimeout(() => controller.abort(), this.timeoutMs);
|
|
41
160
|
try {
|
|
42
|
-
const response = await this.fetchImpl(`${this.baseUrl}/v1/execution/
|
|
161
|
+
const response = await this.fetchImpl(`${this.baseUrl}/v1/execution/claim-token`, {
|
|
43
162
|
method: "POST",
|
|
44
163
|
headers: {
|
|
45
|
-
authorization: `Bearer ${this.apiKey}`,
|
|
164
|
+
authorization: `Bearer ${this.apiKey()}`,
|
|
46
165
|
"content-type": "application/json",
|
|
47
166
|
},
|
|
48
167
|
body: JSON.stringify({
|
|
49
168
|
execution_token: decision.authorization.token,
|
|
50
169
|
intent_hash: captured.intentHash,
|
|
51
170
|
intent: CanonicalIntentHasher.bindingOf(captured.intent),
|
|
171
|
+
// A Presence-bound decision is re-verified by the authority at claim
|
|
172
|
+
// time, so the same evidence must accompany the claim.
|
|
173
|
+
...(decision.evidence === undefined ? {} : { evidence: decision.evidence }),
|
|
52
174
|
consumed_by: captured.intent.actor.id,
|
|
175
|
+
commit_correlation_id: commitCorrelationId,
|
|
53
176
|
}),
|
|
54
177
|
signal: controller.signal,
|
|
55
178
|
});
|
|
@@ -58,24 +181,61 @@ export class DecionisGrantVerifier {
|
|
|
58
181
|
const text = await BoundedResponseBody.read(response, MAX_RESPONSE_BYTES);
|
|
59
182
|
if (text === null)
|
|
60
183
|
return null;
|
|
61
|
-
const parsed =
|
|
62
|
-
const
|
|
184
|
+
const parsed = ClaimResponseSchema.parse(JSON.parse(text));
|
|
185
|
+
const claims = parsed.claims;
|
|
186
|
+
/** A `null` commitment is no commitment, exactly as an absent one is. */
|
|
187
|
+
const committedEffectDigest = claims.binding.expected_effect_digest ?? undefined;
|
|
188
|
+
const claimExpiryMs = claims.exp * 1_000;
|
|
63
189
|
const decisionExpirySeconds = Math.floor(Date.parse(decision.authorization.expiresAt) / 1_000);
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
190
|
+
const audience = `${captured.intent.downstreamTarget.system}:${captured.intent.downstreamTarget.operation}`;
|
|
191
|
+
// When the authority says which digest it bound over the parameters,
|
|
192
|
+
// it must be the digest of the parameters this process captured, under
|
|
193
|
+
// a canonicalization this process can reproduce. A digest under a
|
|
194
|
+
// profile this package cannot compute is not "probably fine": it is a
|
|
195
|
+
// claim about the payload that cannot be checked, and is refused.
|
|
196
|
+
const payloadDigest = claims.binding.execution_payload_digest ?? undefined;
|
|
197
|
+
const payloadDigestDisagrees = payloadDigest !== undefined &&
|
|
198
|
+
(claims.binding.execution_payload_canonicalization_profile !== JCS_PROFILE ||
|
|
199
|
+
payloadDigest !== DecionisGrantVerifier.parametersDigest(captured.intent.parameters));
|
|
200
|
+
if (parsed.should_execute === false ||
|
|
201
|
+
typeof parsed.claim_token !== "string" ||
|
|
202
|
+
claims.binding.intent_hash !== captured.intentHash ||
|
|
203
|
+
committedEffectDigest !== captured.intent.expectedEffectDigest ||
|
|
204
|
+
payloadDigestDisagrees ||
|
|
205
|
+
claims.decision_id !== decision.decisionId ||
|
|
206
|
+
claims.dossier_id !== decision.dossierId ||
|
|
207
|
+
claims.org_id !== captured.intent.tenantId ||
|
|
208
|
+
claims.sub !== captured.intent.actor.id ||
|
|
209
|
+
claims.action !== captured.intent.action ||
|
|
210
|
+
(claims.aud !== undefined && claims.aud !== audience) ||
|
|
211
|
+
claims.exp !== decisionExpirySeconds ||
|
|
68
212
|
claimExpiryMs <= Date.now() ||
|
|
69
213
|
claimExpiryMs > Date.parse(captured.intent.expiresAt)) {
|
|
70
214
|
return null;
|
|
71
215
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
216
|
+
// The lease the authority named for this claim, when it named one. It
|
|
217
|
+
// is reported rather than enforced here: what a caller does with a
|
|
218
|
+
// window is the caller's decision, and the grant's own expiry is
|
|
219
|
+
// already the outer bound this verifier checked above.
|
|
220
|
+
const lease = parsed.claim_lease_expires_at;
|
|
221
|
+
const attestation = parsed.claim_attestation ?? undefined;
|
|
222
|
+
const authorization = Object.freeze({
|
|
223
|
+
decisionId: claims.decision_id,
|
|
224
|
+
dossierId: claims.dossier_id,
|
|
225
|
+
grantId: claims.jti,
|
|
226
|
+
intentHash: claims.binding.intent_hash,
|
|
227
|
+
expiresAt: new Date(claims.exp * 1_000).toISOString(),
|
|
228
|
+
...(typeof lease === "string" ? { leaseExpiresAt: lease } : {}),
|
|
229
|
+
...(payloadDigest === undefined ? {} : { payloadDigest }),
|
|
230
|
+
...(attestation === undefined ? {} : { claimAttestation: attestation }),
|
|
231
|
+
});
|
|
232
|
+
this.claims.set(authorization, {
|
|
233
|
+
executionToken: decision.authorization.token,
|
|
234
|
+
claimToken: parsed.claim_token,
|
|
235
|
+
commitCorrelationId,
|
|
236
|
+
expectedEffectDigest: committedEffectDigest,
|
|
78
237
|
});
|
|
238
|
+
return authorization;
|
|
79
239
|
}
|
|
80
240
|
catch {
|
|
81
241
|
return null;
|
|
@@ -84,5 +244,120 @@ export class DecionisGrantVerifier {
|
|
|
84
244
|
clearTimeout(timeout);
|
|
85
245
|
}
|
|
86
246
|
}
|
|
247
|
+
async finalize(input) {
|
|
248
|
+
const claim = this.claims.get(input.authorization);
|
|
249
|
+
if (claim === undefined)
|
|
250
|
+
return "PENDING";
|
|
251
|
+
const evidence = DecionisGrantVerifier.bindableEffectEvidence(input, claim);
|
|
252
|
+
const first = await this.post(input, claim, evidence, false);
|
|
253
|
+
if (first === "RECORDED")
|
|
254
|
+
return "RECORDED";
|
|
255
|
+
if (first === "PENDING" || evidence === undefined)
|
|
256
|
+
return "PENDING";
|
|
257
|
+
// The authority answered with the one status an effect refusal uses, and
|
|
258
|
+
// every effect rejection precedes the commit transition, so the commit
|
|
259
|
+
// record is still recoverable by reporting the same outcome without the
|
|
260
|
+
// observation. This retries no side effect and sends nothing it has not
|
|
261
|
+
// already sent: the second body is byte-identical to the body this package
|
|
262
|
+
// sent before effect evidence existed.
|
|
263
|
+
const second = await this.post(input, claim, undefined, true);
|
|
264
|
+
return second === "RECORDED" ? "RECORDED" : "PENDING";
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* What the authority reported about effect evidence for an authorization this
|
|
268
|
+
* verifier finalized. `null` until a finalization was recorded. This is the
|
|
269
|
+
* authority's statement, never this package's inference.
|
|
270
|
+
*/
|
|
271
|
+
effectReport(authorization) {
|
|
272
|
+
return this.reports.get(authorization) ?? null;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* `REFUSED` only for the one status a finalization refusal uses (409); every
|
|
276
|
+
* other non-ok status, a throw, a timeout, or an oversize body is `PENDING`,
|
|
277
|
+
* exactly as it was before effect evidence existed. A rate-limited or
|
|
278
|
+
* unauthenticated authority must never be re-posted to.
|
|
279
|
+
*/
|
|
280
|
+
async post(input, claim, evidence, evidenceRefused) {
|
|
281
|
+
const controller = new AbortController();
|
|
282
|
+
const timeout = setTimeout(() => controller.abort(), this.timeoutMs);
|
|
283
|
+
try {
|
|
284
|
+
const response = await this.fetchImpl(`${this.baseUrl}/v1/execution/finalize-token`, {
|
|
285
|
+
method: "POST",
|
|
286
|
+
headers: {
|
|
287
|
+
authorization: `Bearer ${this.apiKey()}`,
|
|
288
|
+
"content-type": "application/json",
|
|
289
|
+
},
|
|
290
|
+
body: JSON.stringify({
|
|
291
|
+
execution_token: claim.executionToken,
|
|
292
|
+
claim_token: claim.claimToken,
|
|
293
|
+
outcome: input.outcome,
|
|
294
|
+
commit_correlation_id: claim.commitCorrelationId,
|
|
295
|
+
...(evidence === undefined ? {} : { effect_evidence: evidence }),
|
|
296
|
+
}),
|
|
297
|
+
signal: controller.signal,
|
|
298
|
+
});
|
|
299
|
+
if (!response.ok)
|
|
300
|
+
return response.status === 409 ? "REFUSED" : "PENDING";
|
|
301
|
+
const text = await BoundedResponseBody.read(response, MAX_RESPONSE_BYTES);
|
|
302
|
+
if (text === null)
|
|
303
|
+
return "PENDING";
|
|
304
|
+
const parsed = FinalizeResponseSchema.parse(JSON.parse(text));
|
|
305
|
+
if (!parsed.finalized)
|
|
306
|
+
return "PENDING";
|
|
307
|
+
// The authority's answer about an observation is only meaningful for a
|
|
308
|
+
// finalization that carried one. What was not sent cannot have been
|
|
309
|
+
// recorded, whatever the response says.
|
|
310
|
+
const sent = evidence !== undefined;
|
|
311
|
+
this.reports.set(input.authorization, {
|
|
312
|
+
effectEvidenceSent: sent,
|
|
313
|
+
effectEvidenceRefused: evidenceRefused,
|
|
314
|
+
effectEvidenceRecorded: sent && parsed.effect_evidence_recorded === true,
|
|
315
|
+
effectConfirmation: sent && parsed.effect_confirmation === "CONFIRMED" ? "CONFIRMED" : "UNCONFIRMED",
|
|
316
|
+
});
|
|
317
|
+
this.claims.delete(input.authorization);
|
|
318
|
+
return "RECORDED";
|
|
319
|
+
}
|
|
320
|
+
catch {
|
|
321
|
+
return "PENDING";
|
|
322
|
+
}
|
|
323
|
+
finally {
|
|
324
|
+
clearTimeout(timeout);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Effect evidence reaches the authority only when this executor can prove the
|
|
329
|
+
* authority will bind it: it must conform to the contract's bounded shape,
|
|
330
|
+
* the grant the authority returned must have committed to an expected-effect
|
|
331
|
+
* digest, the evidence must name that exact digest, and it must carry the
|
|
332
|
+
* correlation id this claim was made with. Unbindable evidence is dropped
|
|
333
|
+
* rather than sent, because the authority answers it with a 409 that aborts
|
|
334
|
+
* the whole finalization rather than discarding the observation.
|
|
335
|
+
*
|
|
336
|
+
* The checks run against the parsed copy, which is also the copy that is
|
|
337
|
+
* serialised, so a caller object with accessors cannot present one value to
|
|
338
|
+
* the drop rule and another to the wire.
|
|
339
|
+
*/
|
|
340
|
+
static bindableEffectEvidence(input, claim) {
|
|
341
|
+
if (input.effectEvidence === undefined || claim.expectedEffectDigest === undefined) {
|
|
342
|
+
return undefined;
|
|
343
|
+
}
|
|
344
|
+
const parsed = EffectEvidenceSchema.safeParse(input.effectEvidence);
|
|
345
|
+
if (!parsed.success)
|
|
346
|
+
return undefined;
|
|
347
|
+
const evidence = parsed.data;
|
|
348
|
+
if (evidence.expected_effect_digest !== claim.expectedEffectDigest)
|
|
349
|
+
return undefined;
|
|
350
|
+
if (evidence.execution_correlation_id !== claim.commitCorrelationId)
|
|
351
|
+
return undefined;
|
|
352
|
+
return Object.freeze(evidence);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
function hasNoControlCharacters(value) {
|
|
356
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
357
|
+
const codeUnit = value.charCodeAt(index);
|
|
358
|
+
if (codeUnit <= 0x1f || codeUnit === 0x7f)
|
|
359
|
+
return false;
|
|
360
|
+
}
|
|
361
|
+
return true;
|
|
87
362
|
}
|
|
88
363
|
//# sourceMappingURL=AuthorizationVerifier.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthorizationVerifier.js","sourceRoot":"","sources":["../../src/execution/AuthorizationVerifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAmB3E,MAAM,qBAAqB,GAAG,CAAC;KAC5B,MAAM,CAAC;IACN,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;IACtB,MAAM,EAAE,CAAC;SACN,MAAM,CAAC;QACN,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;QAC/B,WAAW,EA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der } from "../audit/AuditRecorder.js";
|
|
2
3
|
import type { CapturedIntent } from "../intent/ExecutionIntent.js";
|
|
3
4
|
import type { ActionRegistry } from "./ActionRegistry.js";
|
|
4
|
-
import type { AuthorizationVerifier, VerifiedAuthorization } from "./AuthorizationVerifier.js";
|
|
5
|
-
export type ExecutionBlockReason = "DECISION_NOT_ALLOW" | "INTENT_BINDING_MISMATCH" | "INTENT_CONFORMANCE_FAILED" | "AUTHORIZATION_MISSING" | "AUTHORIZATION_INVALID";
|
|
5
|
+
import type { AuthorizationVerifier, ExecutionFinalization, VerifiedAuthorization } from "./AuthorizationVerifier.js";
|
|
6
|
+
export type ExecutionBlockReason = "DECISION_NOT_AUTHORITATIVE" | "DECISION_NOT_ALLOW" | "INTENT_BINDING_MISMATCH" | "INTENT_CONFORMANCE_FAILED" | "AUTHORIZATION_MISSING" | "AUTHORIZATION_INVALID" | "RECOVERY_BINDING_MISMATCH" | "AUDIT_UNAVAILABLE";
|
|
7
|
+
export type ExecutionPreDispatchFailureReason = "HANDLER_FAILED_BEFORE_DISPATCH" | "AUDIT_UNAVAILABLE";
|
|
8
|
+
/**
|
|
9
|
+
* What a caller presents back to reconcile an attempt whose outcome was
|
|
10
|
+
* lost. The fields are listed rather than inherited, because this is a
|
|
11
|
+
* versioned wire object: a field that appears on `VerifiedAuthorization`
|
|
12
|
+
* later must be added here deliberately or not at all.
|
|
13
|
+
*/
|
|
14
|
+
export interface ExecutionRecoveryReference {
|
|
15
|
+
readonly version: "agent-safe.recovery/1";
|
|
16
|
+
readonly decisionId: string;
|
|
17
|
+
readonly dossierId: string;
|
|
18
|
+
readonly grantId: string;
|
|
19
|
+
readonly intentHash: string;
|
|
20
|
+
readonly expiresAt: string;
|
|
21
|
+
readonly idempotencyKey: string;
|
|
22
|
+
}
|
|
23
|
+
export interface ExecutionBlockedResult {
|
|
24
|
+
readonly outcome: "BLOCKED";
|
|
25
|
+
readonly executed: false;
|
|
26
|
+
readonly reason: ExecutionBlockReason;
|
|
27
|
+
readonly result: null;
|
|
28
|
+
readonly authorization: null;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The provider refused, definitively, after the dispatch boundary. The grant
|
|
32
|
+
* was consumed and the request was sent, and nothing was effected: the
|
|
33
|
+
* outcome is a fact, not an unknown, so there is nothing to reconcile and no
|
|
34
|
+
* recovery reference to present. A caller that wants the action after all
|
|
35
|
+
* needs a fresh decision and a fresh grant, because the refusal was about
|
|
36
|
+
* this attempt.
|
|
37
|
+
*/
|
|
38
|
+
export interface ProviderRefusedResult {
|
|
39
|
+
readonly outcome: "DEFINITELY_NOT_EXECUTED";
|
|
40
|
+
readonly executed: false;
|
|
41
|
+
readonly recovered: false;
|
|
42
|
+
/** The provider's own reason, as the handler reported it. */
|
|
43
|
+
readonly reason: string;
|
|
44
|
+
readonly result: null;
|
|
45
|
+
readonly authorization: VerifiedAuthorization;
|
|
46
|
+
}
|
|
47
|
+
export interface ProviderOutcomeUnknownResult {
|
|
48
|
+
readonly outcome: "UNKNOWN_AFTER_DISPATCH";
|
|
49
|
+
readonly executed: null;
|
|
50
|
+
readonly reason: "PROVIDER_OUTCOME_UNKNOWN";
|
|
51
|
+
readonly result: null;
|
|
52
|
+
readonly authorization: VerifiedAuthorization;
|
|
53
|
+
readonly recovery: ExecutionRecoveryReference;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Every outcome that consumed a grant reports whether the attempt's commit
|
|
57
|
+
* evidence reached the authority. Finalization is evidence, not authority;
|
|
58
|
+
* it never changes `outcome` or `executed`.
|
|
59
|
+
*/
|
|
6
60
|
export type SafeExecutionResult<TResult = unknown> = {
|
|
61
|
+
readonly outcome: "COMPLETED";
|
|
7
62
|
readonly executed: true;
|
|
63
|
+
readonly recovered: false;
|
|
64
|
+
readonly result: TResult;
|
|
65
|
+
readonly authorization: VerifiedAuthorization;
|
|
66
|
+
readonly finalization: ExecutionFinalization;
|
|
67
|
+
} | ExecutionBlockedResult | {
|
|
68
|
+
readonly outcome: "FAILED_BEFORE_DISPATCH";
|
|
69
|
+
readonly executed: false;
|
|
70
|
+
readonly reason: ExecutionPreDispatchFailureReason;
|
|
71
|
+
readonly result: null;
|
|
72
|
+
readonly authorization: VerifiedAuthorization;
|
|
73
|
+
readonly finalization: ExecutionFinalization;
|
|
74
|
+
} | (ProviderRefusedResult & {
|
|
75
|
+
readonly finalization: ExecutionFinalization;
|
|
76
|
+
}) | (ProviderOutcomeUnknownResult & {
|
|
77
|
+
readonly finalization: ExecutionFinalization;
|
|
78
|
+
});
|
|
79
|
+
export type ExecutionReconciliationResult<TResult = unknown> = {
|
|
80
|
+
readonly outcome: "COMPLETED";
|
|
81
|
+
readonly executed: true;
|
|
82
|
+
readonly recovered: true;
|
|
8
83
|
readonly result: TResult;
|
|
9
84
|
readonly authorization: VerifiedAuthorization;
|
|
10
85
|
} | {
|
|
86
|
+
readonly outcome: "DEFINITELY_NOT_EXECUTED";
|
|
11
87
|
readonly executed: false;
|
|
12
|
-
readonly
|
|
88
|
+
readonly recovered: true;
|
|
89
|
+
readonly reason: "PROVIDER_CONFIRMED_NOT_EXECUTED";
|
|
13
90
|
readonly result: null;
|
|
14
|
-
readonly authorization:
|
|
15
|
-
};
|
|
91
|
+
readonly authorization: VerifiedAuthorization;
|
|
92
|
+
} | ExecutionBlockedResult | ProviderOutcomeUnknownResult;
|
|
16
93
|
export declare class SafeExecutor {
|
|
17
94
|
private readonly registry;
|
|
18
95
|
private readonly verifier;
|
|
96
|
+
private readonly audit?;
|
|
19
97
|
private readonly hasher;
|
|
20
|
-
constructor(registry: ActionRegistry, verifier: AuthorizationVerifier);
|
|
98
|
+
constructor(registry: ActionRegistry, verifier: AuthorizationVerifier, audit?: AuditRecorder | undefined);
|
|
21
99
|
run<TResult = unknown>(captured: CapturedIntent, decision: GateDecision): Promise<SafeExecutionResult<TResult>>;
|
|
100
|
+
/**
|
|
101
|
+
* Reports the attempt outcome to the verifier's authority. A missing,
|
|
102
|
+
* failing, or malformed finalization can never alter the execution result.
|
|
103
|
+
*/
|
|
104
|
+
private finalize;
|
|
105
|
+
private static finalizationCode;
|
|
106
|
+
reconcile<TResult = unknown>(captured: CapturedIntent, recovery: ExecutionRecoveryReference): Promise<ExecutionReconciliationResult<TResult>>;
|
|
107
|
+
/**
|
|
108
|
+
* Observational artifacts carry an explicit non-authoritative marker. They
|
|
109
|
+
* must never be interpreted as a `GateDecision`, even after an unsafe cast
|
|
110
|
+
* or a JSON round trip.
|
|
111
|
+
*/
|
|
112
|
+
private static isAuthoritativeDecision;
|
|
22
113
|
private intentConforms;
|
|
23
|
-
private
|
|
114
|
+
private block;
|
|
115
|
+
private failedBeforeDispatch;
|
|
116
|
+
private record;
|
|
117
|
+
private static recoveryReference;
|
|
118
|
+
private static authorizationFrom;
|
|
24
119
|
}
|
|
25
120
|
//# sourceMappingURL=SafeExecutor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SafeExecutor.d.ts","sourceRoot":"","sources":["../../src/execution/SafeExecutor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"SafeExecutor.d.ts","sourceRoot":"","sources":["../../src/execution/SafeExecutor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,KAAK,EAAkB,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EACV,qBAAqB,EAErB,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,4BAA4B,CAAC;AAEpC,MAAM,MAAM,oBAAoB,GAC5B,4BAA4B,GAC5B,oBAAoB,GACpB,yBAAyB,GACzB,2BAA2B,GAC3B,uBAAuB,GACvB,uBAA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