@decionis/agent-safe-pipeline 0.1.4 → 0.3.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.
Files changed (85) hide show
  1. package/README.md +170 -10
  2. package/dist/Index.d.ts +8 -0
  3. package/dist/Index.d.ts.map +1 -1
  4. package/dist/Index.js +7 -0
  5. package/dist/Index.js.map +1 -1
  6. package/dist/audit/AuditRecorder.d.ts +1 -1
  7. package/dist/audit/AuditRecorder.d.ts.map +1 -1
  8. package/dist/audit/AuditRecorder.js.map +1 -1
  9. package/dist/decision/CreateGate.d.ts +123 -0
  10. package/dist/decision/CreateGate.d.ts.map +1 -0
  11. package/dist/decision/CreateGate.js +211 -0
  12. package/dist/decision/CreateGate.js.map +1 -0
  13. package/dist/decision/DecionisGate.d.ts +18 -1
  14. package/dist/decision/DecionisGate.d.ts.map +1 -1
  15. package/dist/decision/DecionisGate.js +31 -3
  16. package/dist/decision/DecionisGate.js.map +1 -1
  17. package/dist/decision/DecisionAuthority.d.ts +26 -0
  18. package/dist/decision/DecisionAuthority.d.ts.map +1 -1
  19. package/dist/decision/DecisionAuthority.js.map +1 -1
  20. package/dist/decision/ImmutableGateDecision.d.ts.map +1 -1
  21. package/dist/decision/ImmutableGateDecision.js +8 -0
  22. package/dist/decision/ImmutableGateDecision.js.map +1 -1
  23. package/dist/decision/Provision.d.ts +33 -0
  24. package/dist/decision/Provision.d.ts.map +1 -0
  25. package/dist/decision/Provision.js +116 -0
  26. package/dist/decision/Provision.js.map +1 -0
  27. package/dist/decision/ShadowGate.d.ts +31 -0
  28. package/dist/decision/ShadowGate.d.ts.map +1 -0
  29. package/dist/decision/ShadowGate.js +79 -0
  30. package/dist/decision/ShadowGate.js.map +1 -0
  31. package/dist/execution/ActionRegistry.d.ts +40 -0
  32. package/dist/execution/ActionRegistry.d.ts.map +1 -1
  33. package/dist/execution/ActionRegistry.js +47 -2
  34. package/dist/execution/ActionRegistry.js.map +1 -1
  35. package/dist/execution/AuthorizationVerifier.d.ts +147 -1
  36. package/dist/execution/AuthorizationVerifier.d.ts.map +1 -1
  37. package/dist/execution/AuthorizationVerifier.js +209 -6
  38. package/dist/execution/AuthorizationVerifier.js.map +1 -1
  39. package/dist/execution/SafeExecutor.d.ts +34 -3
  40. package/dist/execution/SafeExecutor.d.ts.map +1 -1
  41. package/dist/execution/SafeExecutor.js +42 -5
  42. package/dist/execution/SafeExecutor.js.map +1 -1
  43. package/dist/http/ClientIdentification.d.ts +22 -0
  44. package/dist/http/ClientIdentification.d.ts.map +1 -0
  45. package/dist/http/ClientIdentification.js +44 -0
  46. package/dist/http/ClientIdentification.js.map +1 -0
  47. package/dist/http/Credential.d.ts +17 -0
  48. package/dist/http/Credential.d.ts.map +1 -0
  49. package/dist/http/Credential.js +5 -0
  50. package/dist/http/Credential.js.map +1 -0
  51. package/dist/http/StoredCredentials.d.ts +34 -0
  52. package/dist/http/StoredCredentials.d.ts.map +1 -0
  53. package/dist/http/StoredCredentials.js +85 -0
  54. package/dist/http/StoredCredentials.js.map +1 -0
  55. package/dist/intent/CanonicalIntentHasher.d.ts.map +1 -1
  56. package/dist/intent/CanonicalIntentHasher.js +3 -0
  57. package/dist/intent/CanonicalIntentHasher.js.map +1 -1
  58. package/dist/intent/ExecutionIntent.d.ts +13 -1
  59. package/dist/intent/ExecutionIntent.d.ts.map +1 -1
  60. package/dist/intent/ExecutionIntent.js +4 -0
  61. package/dist/intent/ExecutionIntent.js.map +1 -1
  62. package/dist/intent/IntentCapture.d.ts.map +1 -1
  63. package/dist/intent/IntentCapture.js +3 -0
  64. package/dist/intent/IntentCapture.js.map +1 -1
  65. package/dist/report/DecisionReport.d.ts +22 -0
  66. package/dist/report/DecisionReport.d.ts.map +1 -0
  67. package/dist/report/DecisionReport.js +37 -0
  68. package/dist/report/DecisionReport.js.map +1 -0
  69. package/dist/report/DossierReport.d.ts +43 -0
  70. package/dist/report/DossierReport.d.ts.map +1 -0
  71. package/dist/report/DossierReport.js +130 -0
  72. package/dist/report/DossierReport.js.map +1 -0
  73. package/dist/report/HostedOutcome.d.ts +18 -0
  74. package/dist/report/HostedOutcome.d.ts.map +1 -0
  75. package/dist/report/HostedOutcome.js +24 -0
  76. package/dist/report/HostedOutcome.js.map +1 -0
  77. package/dist/testing/Index.d.ts +1 -1
  78. package/dist/testing/Index.d.ts.map +1 -1
  79. package/dist/testing/Index.js +1 -1
  80. package/dist/testing/Index.js.map +1 -1
  81. package/dist/testing/LocalAuthority.d.ts +156 -0
  82. package/dist/testing/LocalAuthority.d.ts.map +1 -1
  83. package/dist/testing/LocalAuthority.js +531 -9
  84. package/dist/testing/LocalAuthority.js.map +1 -1
  85. package/package.json +1 -1
@@ -1,4 +1,6 @@
1
+ import { type Credential } from "../http/Credential.js";
1
2
  import type { CapturedIntent } from "../intent/ExecutionIntent.js";
3
+ import type { JsonObject } from "../intent/JsonValue.js";
2
4
  import type { GateDecision } from "../decision/DecisionAuthority.js";
3
5
  export interface VerifiedAuthorization {
4
6
  readonly decisionId: string;
@@ -6,6 +8,34 @@ export interface VerifiedAuthorization {
6
8
  readonly grantId: string;
7
9
  readonly intentHash: string;
8
10
  readonly expiresAt: string;
11
+ /**
12
+ * When the authority stops accepting a commit for this claim, if it said.
13
+ * A lease is shorter than the grant's own expiry and is the real window a
14
+ * side effect has to finish inside: a commit the authority will no longer
15
+ * record leaves an outcome nobody can reconcile from the record, however
16
+ * successful the dispatch was.
17
+ *
18
+ * Absent when the authority did not return one, which is how a deployment
19
+ * whose issuer predates the field behaves. A consumer that ignores this
20
+ * field is exactly as correct as it was before the field existed.
21
+ */
22
+ readonly leaseExpiresAt?: string;
23
+ /**
24
+ * The digest the authority bound over the canonical action parameters, when
25
+ * it exposed one. It has already been checked against this package's own
26
+ * digest of the same parameters before this object exists: a claim whose
27
+ * digest disagreed was refused, not returned. It is carried so a handler
28
+ * can show a downstream what the authority bound, not so anyone re-checks it.
29
+ */
30
+ readonly payloadDigest?: string;
31
+ /**
32
+ * Proof of this claim a system of record can verify without trusting this
33
+ * process: a compact JWS the authority signed over the grant, the decision,
34
+ * the binding and the lease. A handler forwards it downstream, and a
35
+ * downstream that requires it can refuse an instruction the authority never
36
+ * claimed. Absent when the authority predates it.
37
+ */
38
+ readonly claimAttestation?: string;
9
39
  }
10
40
  /** Outcome of the downstream attempt reported to the authority after a claimed grant. */
11
41
  export type ExecutionCommitOutcome = "COMMITTED" | "FAILED" | "INDETERMINATE";
@@ -15,11 +45,83 @@ export type ExecutionCommitOutcome = "COMMITTED" | "FAILED" | "INDETERMINATE";
15
45
  * the verifier has no finalization contract.
16
46
  */
17
47
  export type ExecutionFinalization = "RECORDED" | "PENDING" | "UNSUPPORTED";
48
+ /**
49
+ * Exact wire shape of the Decionis Protocol 1.1 `EffectEvidence` contract: an
50
+ * observation of what happened downstream, supplied by the trusted runtime that
51
+ * observed it. This package never constructs, interprets, upgrades, or
52
+ * downgrades an observation; it forwards a bounded, validated copy of the one
53
+ * it was handed, and drops anything outside the contract's own shape rather
54
+ * than serialising a caller-controlled object onto an authenticated request.
55
+ */
56
+ export interface AuthorityEffectEvidence {
57
+ readonly version: "1.0";
58
+ readonly status: "CONFIRMED" | "UNCONFIRMED";
59
+ readonly observation_method: "DOWNSTREAM_ACK" | "READ_AFTER_WRITE" | "EVENT_CONFIRMATION" | "STATE_RECONCILIATION" | "SIGNED_RECEIPT" | "EXTERNAL_ATTESTATION" | "HUMAN_VALIDATION";
60
+ readonly observer: {
61
+ readonly id: string;
62
+ readonly version: string | null;
63
+ } | null;
64
+ readonly expected_effect_digest: string;
65
+ readonly observed_effect_digest: string | null;
66
+ readonly observed_at: string | null;
67
+ readonly evidence_digest: string | null;
68
+ readonly evidence_reference: string | null;
69
+ readonly execution_correlation_id: string;
70
+ }
71
+ /**
72
+ * What the authority itself said about an observation it was sent, narrowed by
73
+ * what this executor knows it sent. `effectEvidenceRecorded` and
74
+ * `effectConfirmation` are the authority's statement, but they are only ever
75
+ * reported for a finalization that actually carried the observation: an
76
+ * authority claiming to have recorded evidence it was not sent is not evidence.
77
+ */
78
+ export interface AuthorityEffectReport {
79
+ /** The finalization that was recorded carried the observation. */
80
+ readonly effectEvidenceSent: boolean;
81
+ /**
82
+ * An earlier finalization attempt carried the observation and the authority
83
+ * refused it, so this commit record was recovered without it. Distinguishes a
84
+ * refused observation from one that was dropped or never supplied.
85
+ */
86
+ readonly effectEvidenceRefused: boolean;
87
+ readonly effectEvidenceRecorded: boolean;
88
+ readonly effectConfirmation: "CONFIRMED" | "UNCONFIRMED";
89
+ /** The finalization that was recorded carried the provider's effect receipt. */
90
+ readonly effectReceiptSent: boolean;
91
+ /**
92
+ * The authority verified the receipt it was sent: the provider's signature
93
+ * under a key the organisation registered, describing this grant and this
94
+ * claim. Only ever true for a finalization that carried one.
95
+ */
96
+ readonly effectReceiptVerified: boolean;
97
+ /** The authority's code for what it found in the receipt, when it was sent one. */
98
+ readonly effectReceiptVerification: string | null;
99
+ }
18
100
  export interface AuthorizationFinalizationInput {
19
101
  readonly captured: CapturedIntent;
20
102
  readonly decision: GateDecision;
21
103
  readonly authorization: VerifiedAuthorization;
22
104
  readonly outcome: ExecutionCommitOutcome;
105
+ /**
106
+ * Optional observation of the downstream effect, forwarded verbatim. It is
107
+ * sent only when the signed grant committed to an expected-effect digest, the
108
+ * evidence names that same digest, and its `execution_correlation_id` equals
109
+ * the commit correlation id this grant was claimed with. Otherwise it is
110
+ * dropped, because the authority refuses the entire finalization for evidence
111
+ * it cannot bind and the commit outcome would be lost with it. It is also
112
+ * dropped when it does not conform to the contract's own bounded shape.
113
+ */
114
+ readonly effectEvidence?: AuthorityEffectEvidence;
115
+ /**
116
+ * The provider's signed effect receipt, as it returned it with its answer:
117
+ * a compact JWS the authority verifies against the keys the organisation
118
+ * registered and records with the commit evidence. Forwarded verbatim when
119
+ * it has the shape of a compact JWS and is no longer than the contract
120
+ * allows; otherwise dropped, because the authority refuses a malformed
121
+ * body and the commit outcome would be lost with it. It is never a reason
122
+ * for the authority to refuse a finalization it would otherwise record.
123
+ */
124
+ readonly effectReceipt?: string;
23
125
  }
24
126
  export interface AuthorizationVerifier {
25
127
  verifyAndConsume(captured: CapturedIntent, decision: GateDecision): Promise<VerifiedAuthorization | null>;
@@ -32,7 +134,8 @@ export interface AuthorizationVerifier {
32
134
  }
33
135
  export interface DecionisGrantVerifierOptions {
34
136
  readonly baseUrl: string;
35
- readonly apiKey: string;
137
+ /** The Decionis credential, as a value or as a function read at each request. */
138
+ readonly apiKey: Credential;
36
139
  readonly timeoutMs?: number;
37
140
  readonly fetch?: typeof fetch;
38
141
  readonly allowInsecureLoopback?: boolean;
@@ -50,8 +153,51 @@ export declare class DecionisGrantVerifier implements AuthorizationVerifier {
50
153
  private readonly fetchImpl;
51
154
  /** Claim material is keyed by the frozen authorization it belongs to and never exposed. */
52
155
  private readonly claims;
156
+ /** The authority's own answer about an observation, keyed by the frozen authorization. */
157
+ private readonly reports;
158
+ /**
159
+ * The digest the authority binds over the action parameters: SHA-256 of
160
+ * their RFC 8785 canonical form, the same canonicalization the intent hash
161
+ * uses. Exposed so a test, or an authority implementation, can produce the
162
+ * value this verifier will accept.
163
+ */
164
+ static parametersDigest(parameters: JsonObject): `sha256:${string}`;
53
165
  constructor(options: DecionisGrantVerifierOptions);
54
166
  verifyAndConsume(captured: CapturedIntent, decision: GateDecision): Promise<VerifiedAuthorization | null>;
55
167
  finalize(input: AuthorizationFinalizationInput): Promise<"RECORDED" | "PENDING">;
168
+ /**
169
+ * What the authority reported about effect evidence for an authorization this
170
+ * verifier finalized. `null` until a finalization was recorded. This is the
171
+ * authority's statement, never this package's inference.
172
+ */
173
+ effectReport(authorization: VerifiedAuthorization): AuthorityEffectReport | null;
174
+ /**
175
+ * `REFUSED` only for the one status a finalization refusal uses (409); every
176
+ * other non-ok status, a throw, a timeout, or an oversize body is `PENDING`,
177
+ * exactly as it was before effect evidence existed. A rate-limited or
178
+ * unauthenticated authority must never be re-posted to.
179
+ */
180
+ private post;
181
+ /**
182
+ * Effect evidence reaches the authority only when this executor can prove the
183
+ * authority will bind it: it must conform to the contract's bounded shape,
184
+ * the grant the authority returned must have committed to an expected-effect
185
+ * digest, the evidence must name that exact digest, and it must carry the
186
+ * correlation id this claim was made with. Unbindable evidence is dropped
187
+ * rather than sent, because the authority answers it with a 409 that aborts
188
+ * the whole finalization rather than discarding the observation.
189
+ *
190
+ * The checks run against the parsed copy, which is also the copy that is
191
+ * serialised, so a caller object with accessors cannot present one value to
192
+ * the drop rule and another to the wire.
193
+ */
194
+ private static bindableEffectEvidence;
195
+ /**
196
+ * A receipt is forwarded as the provider returned it, and only when it has
197
+ * the shape the contract accepts: anything else would be refused as a
198
+ * malformed body, and the commit outcome with it. Its signature and claims
199
+ * are the authority's to verify; this package reads nothing in it.
200
+ */
201
+ private static bindableEffectReceipt;
56
202
  }
57
203
  //# sourceMappingURL=AuthorizationVerifier.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AuthorizationVerifier.d.ts","sourceRoot":"","sources":["../../src/execution/AuthorizationVerifier.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAErE,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,yFAAyF;AACzF,MAAM,MAAM,sBAAsB,GAAG,WAAW,GAAG,QAAQ,GAAG,eAAe,CAAC;AAE9E;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG,UAAU,GAAG,SAAS,GAAG,aAAa,CAAC;AAE3E,MAAM,WAAW,8BAA8B;IAC7C,QAAQ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O,CAAC,UAAU,GAAG,SAAS,CAAC;IAkB7F;;;;OAIG;IACI,YAAY,CAAC,aAAa,EAAE,qBAAqB,GAAG,qBAAqB,GAAG,IAAI;IAIvF;;;;;OAKG;YACW,IAAI;IAyDlB;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,MAAM,CAAC,sBAAsB;IAerC;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,qBAAqB;CAKrC"}
@@ -1,5 +1,7 @@
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
7
  const boundedIdentifier = z
@@ -7,8 +9,43 @@ const boundedIdentifier = z
7
9
  .min(1)
8
10
  .max(200)
9
11
  .refine(hasNoControlCharacters, { message: "IDENTIFIER_INVALID" });
10
- const intentHash = z.string().regex(/^sha256:[0-9a-f]{64}$/);
12
+ const sha256Digest = z.string().regex(/^sha256:[0-9a-f]{64}$/);
13
+ const intentHash = sha256Digest;
11
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
+ });
12
49
  /**
13
50
  * Mirrors `ExecutionTokenResponse` and `ExecutionTokenClaims` in the Decionis
14
51
  * OpenAPI contract. Claims are declared `additionalProperties: true`, and the
@@ -30,7 +67,27 @@ const ClaimResponseSchema = z.looseObject({
30
67
  action: boundedIdentifier,
31
68
  decision: z.literal("allow"),
32
69
  scope: z.literal("execute"),
33
- binding: z.looseObject({ intent_hash: intentHash }),
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
+ }),
34
91
  jti: boundedIdentifier,
35
92
  iat: z.number().int(),
36
93
  nbf: z.number().int(),
@@ -38,11 +95,34 @@ const ClaimResponseSchema = z.looseObject({
38
95
  }),
39
96
  claim_token: z.string().regex(CLAIM_TOKEN_PATTERN).nullable().optional(),
40
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),
41
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
+ */
42
111
  const FinalizeResponseSchema = z.looseObject({
43
112
  finalized: z.boolean(),
44
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
+ effect_receipt: z
117
+ .looseObject({
118
+ verified: z.boolean(),
119
+ verification_code: boundedIdentifier.nullable().optional().catch(undefined),
120
+ })
121
+ .optional()
122
+ .catch(undefined),
45
123
  });
124
+ /** The contract's bound on a forwarded receipt: three base64url segments, at most this long. */
125
+ const MAX_RECEIPT_LENGTH = 20_000;
46
126
  const MAX_RESPONSE_BYTES = 100 * 1024;
47
127
  /**
48
128
  * Claims a Decionis execution grant through `/v1/execution/claim-token`
@@ -57,9 +137,21 @@ export class DecionisGrantVerifier {
57
137
  fetchImpl;
58
138
  /** Claim material is keyed by the frozen authorization it belongs to and never exposed. */
59
139
  claims = new WeakMap();
140
+ /** The authority's own answer about an observation, keyed by the frozen authorization. */
141
+ reports = new WeakMap();
142
+ /**
143
+ * The digest the authority binds over the action parameters: SHA-256 of
144
+ * their RFC 8785 canonical form, the same canonicalization the intent hash
145
+ * uses. Exposed so a test, or an authority implementation, can produce the
146
+ * value this verifier will accept.
147
+ */
148
+ static parametersDigest(parameters) {
149
+ const canonical = CanonicalIntentHasher.stringify(parameters);
150
+ return `sha256:${createHash("sha256").update(canonical, "utf8").digest("hex")}`;
151
+ }
60
152
  constructor(options) {
61
153
  this.baseUrl = AuthorityBaseUrl.normalize(options.baseUrl, options.allowInsecureLoopback === true);
62
- this.apiKey = options.apiKey;
154
+ this.apiKey = credentialReader(options.apiKey);
63
155
  this.timeoutMs = Math.min(Math.max(options.timeoutMs ?? 4_000, 1), 15_000);
64
156
  this.fetchImpl = options.fetch ?? fetch;
65
157
  }
@@ -78,7 +170,7 @@ export class DecionisGrantVerifier {
78
170
  const response = await this.fetchImpl(`${this.baseUrl}/v1/execution/claim-token`, {
79
171
  method: "POST",
80
172
  headers: {
81
- authorization: `Bearer ${this.apiKey}`,
173
+ authorization: `Bearer ${this.apiKey()}`,
82
174
  "content-type": "application/json",
83
175
  },
84
176
  body: JSON.stringify({
@@ -100,12 +192,25 @@ export class DecionisGrantVerifier {
100
192
  return null;
101
193
  const parsed = ClaimResponseSchema.parse(JSON.parse(text));
102
194
  const claims = parsed.claims;
195
+ /** A `null` commitment is no commitment, exactly as an absent one is. */
196
+ const committedEffectDigest = claims.binding.expected_effect_digest ?? undefined;
103
197
  const claimExpiryMs = claims.exp * 1_000;
104
198
  const decisionExpirySeconds = Math.floor(Date.parse(decision.authorization.expiresAt) / 1_000);
105
199
  const audience = `${captured.intent.downstreamTarget.system}:${captured.intent.downstreamTarget.operation}`;
200
+ // When the authority says which digest it bound over the parameters,
201
+ // it must be the digest of the parameters this process captured, under
202
+ // a canonicalization this process can reproduce. A digest under a
203
+ // profile this package cannot compute is not "probably fine": it is a
204
+ // claim about the payload that cannot be checked, and is refused.
205
+ const payloadDigest = claims.binding.execution_payload_digest ?? undefined;
206
+ const payloadDigestDisagrees = payloadDigest !== undefined &&
207
+ (claims.binding.execution_payload_canonicalization_profile !== JCS_PROFILE ||
208
+ payloadDigest !== DecionisGrantVerifier.parametersDigest(captured.intent.parameters));
106
209
  if (parsed.should_execute === false ||
107
210
  typeof parsed.claim_token !== "string" ||
108
211
  claims.binding.intent_hash !== captured.intentHash ||
212
+ committedEffectDigest !== captured.intent.expectedEffectDigest ||
213
+ payloadDigestDisagrees ||
109
214
  claims.decision_id !== decision.decisionId ||
110
215
  claims.dossier_id !== decision.dossierId ||
111
216
  claims.org_id !== captured.intent.tenantId ||
@@ -117,17 +222,27 @@ export class DecionisGrantVerifier {
117
222
  claimExpiryMs > Date.parse(captured.intent.expiresAt)) {
118
223
  return null;
119
224
  }
225
+ // The lease the authority named for this claim, when it named one. It
226
+ // is reported rather than enforced here: what a caller does with a
227
+ // window is the caller's decision, and the grant's own expiry is
228
+ // already the outer bound this verifier checked above.
229
+ const lease = parsed.claim_lease_expires_at;
230
+ const attestation = parsed.claim_attestation ?? undefined;
120
231
  const authorization = Object.freeze({
121
232
  decisionId: claims.decision_id,
122
233
  dossierId: claims.dossier_id,
123
234
  grantId: claims.jti,
124
235
  intentHash: claims.binding.intent_hash,
125
236
  expiresAt: new Date(claims.exp * 1_000).toISOString(),
237
+ ...(typeof lease === "string" ? { leaseExpiresAt: lease } : {}),
238
+ ...(payloadDigest === undefined ? {} : { payloadDigest }),
239
+ ...(attestation === undefined ? {} : { claimAttestation: attestation }),
126
240
  });
127
241
  this.claims.set(authorization, {
128
242
  executionToken: decision.authorization.token,
129
243
  claimToken: parsed.claim_token,
130
244
  commitCorrelationId,
245
+ expectedEffectDigest: committedEffectDigest,
131
246
  });
132
247
  return authorization;
133
248
  }
@@ -142,13 +257,44 @@ export class DecionisGrantVerifier {
142
257
  const claim = this.claims.get(input.authorization);
143
258
  if (claim === undefined)
144
259
  return "PENDING";
260
+ const evidence = DecionisGrantVerifier.bindableEffectEvidence(input, claim);
261
+ const receipt = DecionisGrantVerifier.bindableEffectReceipt(input);
262
+ const first = await this.post(input, claim, evidence, receipt, false);
263
+ if (first === "RECORDED")
264
+ return "RECORDED";
265
+ if (first === "PENDING" || evidence === undefined)
266
+ return "PENDING";
267
+ // The authority answered with the one status an effect refusal uses, and
268
+ // every effect rejection precedes the commit transition, so the commit
269
+ // record is still recoverable by reporting the same outcome without the
270
+ // observation. This retries no side effect and sends nothing it has not
271
+ // already sent: the second body is the first without the observation.
272
+ // The receipt stays, because the authority never refuses for a receipt.
273
+ const second = await this.post(input, claim, undefined, receipt, true);
274
+ return second === "RECORDED" ? "RECORDED" : "PENDING";
275
+ }
276
+ /**
277
+ * What the authority reported about effect evidence for an authorization this
278
+ * verifier finalized. `null` until a finalization was recorded. This is the
279
+ * authority's statement, never this package's inference.
280
+ */
281
+ effectReport(authorization) {
282
+ return this.reports.get(authorization) ?? null;
283
+ }
284
+ /**
285
+ * `REFUSED` only for the one status a finalization refusal uses (409); every
286
+ * other non-ok status, a throw, a timeout, or an oversize body is `PENDING`,
287
+ * exactly as it was before effect evidence existed. A rate-limited or
288
+ * unauthenticated authority must never be re-posted to.
289
+ */
290
+ async post(input, claim, evidence, receipt, evidenceRefused) {
145
291
  const controller = new AbortController();
146
292
  const timeout = setTimeout(() => controller.abort(), this.timeoutMs);
147
293
  try {
148
294
  const response = await this.fetchImpl(`${this.baseUrl}/v1/execution/finalize-token`, {
149
295
  method: "POST",
150
296
  headers: {
151
- authorization: `Bearer ${this.apiKey}`,
297
+ authorization: `Bearer ${this.apiKey()}`,
152
298
  "content-type": "application/json",
153
299
  },
154
300
  body: JSON.stringify({
@@ -156,17 +302,35 @@ export class DecionisGrantVerifier {
156
302
  claim_token: claim.claimToken,
157
303
  outcome: input.outcome,
158
304
  commit_correlation_id: claim.commitCorrelationId,
305
+ ...(evidence === undefined ? {} : { effect_evidence: evidence }),
306
+ ...(receipt === undefined ? {} : { effect_receipt: receipt }),
159
307
  }),
160
308
  signal: controller.signal,
161
309
  });
162
310
  if (!response.ok)
163
- return "PENDING";
311
+ return response.status === 409 ? "REFUSED" : "PENDING";
164
312
  const text = await BoundedResponseBody.read(response, MAX_RESPONSE_BYTES);
165
313
  if (text === null)
166
314
  return "PENDING";
167
315
  const parsed = FinalizeResponseSchema.parse(JSON.parse(text));
168
316
  if (!parsed.finalized)
169
317
  return "PENDING";
318
+ // The authority's answer about an observation is only meaningful for a
319
+ // finalization that carried one. What was not sent cannot have been
320
+ // recorded, whatever the response says.
321
+ const sent = evidence !== undefined;
322
+ const receiptSent = receipt !== undefined;
323
+ this.reports.set(input.authorization, {
324
+ effectEvidenceSent: sent,
325
+ effectEvidenceRefused: evidenceRefused,
326
+ effectEvidenceRecorded: sent && parsed.effect_evidence_recorded === true,
327
+ effectConfirmation: sent && parsed.effect_confirmation === "CONFIRMED" ? "CONFIRMED" : "UNCONFIRMED",
328
+ effectReceiptSent: receiptSent,
329
+ effectReceiptVerified: receiptSent && parsed.effect_receipt?.verified === true,
330
+ effectReceiptVerification: receiptSent
331
+ ? (parsed.effect_receipt?.verification_code ?? null)
332
+ : null,
333
+ });
170
334
  this.claims.delete(input.authorization);
171
335
  return "RECORDED";
172
336
  }
@@ -177,6 +341,45 @@ export class DecionisGrantVerifier {
177
341
  clearTimeout(timeout);
178
342
  }
179
343
  }
344
+ /**
345
+ * Effect evidence reaches the authority only when this executor can prove the
346
+ * authority will bind it: it must conform to the contract's bounded shape,
347
+ * the grant the authority returned must have committed to an expected-effect
348
+ * digest, the evidence must name that exact digest, and it must carry the
349
+ * correlation id this claim was made with. Unbindable evidence is dropped
350
+ * rather than sent, because the authority answers it with a 409 that aborts
351
+ * the whole finalization rather than discarding the observation.
352
+ *
353
+ * The checks run against the parsed copy, which is also the copy that is
354
+ * serialised, so a caller object with accessors cannot present one value to
355
+ * the drop rule and another to the wire.
356
+ */
357
+ static bindableEffectEvidence(input, claim) {
358
+ if (input.effectEvidence === undefined || claim.expectedEffectDigest === undefined) {
359
+ return undefined;
360
+ }
361
+ const parsed = EffectEvidenceSchema.safeParse(input.effectEvidence);
362
+ if (!parsed.success)
363
+ return undefined;
364
+ const evidence = parsed.data;
365
+ if (evidence.expected_effect_digest !== claim.expectedEffectDigest)
366
+ return undefined;
367
+ if (evidence.execution_correlation_id !== claim.commitCorrelationId)
368
+ return undefined;
369
+ return Object.freeze(evidence);
370
+ }
371
+ /**
372
+ * A receipt is forwarded as the provider returned it, and only when it has
373
+ * the shape the contract accepts: anything else would be refused as a
374
+ * malformed body, and the commit outcome with it. Its signature and claims
375
+ * are the authority's to verify; this package reads nothing in it.
376
+ */
377
+ static bindableEffectReceipt(input) {
378
+ const receipt = input.effectReceipt;
379
+ if (typeof receipt !== "string" || receipt.length > MAX_RECEIPT_LENGTH)
380
+ return undefined;
381
+ return COMPACT_JWS_PATTERN.test(receipt) ? receipt : undefined;
382
+ }
180
383
  }
181
384
  function hasNoControlCharacters(value) {
182
385
  for (let index = 0; index < value.length; index += 1) {
@@ -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;AA0C3E,MAAM,iBAAiB,GAAG,CAAC;KACxB,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,CAAC;KACN,GAAG,CAAC,GAAG,CAAC;KACR,MAAM,CAAC,sBAAsB,EAAE,EAAE,OAAO,EAAE,oBAAoB,EAAE,CAAC,CAAC;AACrE,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;AAC7D,MAAM,mBAAmB,GAAG,iBA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ActionRegistry.js";
5
5
  import type { AuthorizationVerifier, ExecutionFinalization, VerifiedAuthorization } from "./AuthorizationVerifier.js";
6
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
7
  export type ExecutionPreDispatchFailureReason = "HANDLER_FAILED_BEFORE_DISPATCH" | "AUDIT_UNAVAILABLE";
8
- export interface ExecutionRecoveryReference extends VerifiedAuthorization {
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 {
9
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;
10
21
  readonly idempotencyKey: string;
11
22
  }
12
23
  export interface ExecutionBlockedResult {
@@ -16,6 +27,23 @@ export interface ExecutionBlockedResult {
16
27
  readonly result: null;
17
28
  readonly authorization: null;
18
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
+ }
19
47
  export interface ProviderOutcomeUnknownResult {
20
48
  readonly outcome: "UNKNOWN_AFTER_DISPATCH";
21
49
  readonly executed: null;
@@ -43,7 +71,9 @@ export type SafeExecutionResult<TResult = unknown> = {
43
71
  readonly result: null;
44
72
  readonly authorization: VerifiedAuthorization;
45
73
  readonly finalization: ExecutionFinalization;
46
- } | (ProviderOutcomeUnknownResult & {
74
+ } | (ProviderRefusedResult & {
75
+ readonly finalization: ExecutionFinalization;
76
+ }) | (ProviderOutcomeUnknownResult & {
47
77
  readonly finalization: ExecutionFinalization;
48
78
  });
49
79
  export type ExecutionReconciliationResult<TResult = unknown> = {
@@ -68,7 +98,8 @@ export declare class SafeExecutor {
68
98
  constructor(registry: ActionRegistry, verifier: AuthorizationVerifier, audit?: AuditRecorder | undefined);
69
99
  run<TResult = unknown>(captured: CapturedIntent, decision: GateDecision): Promise<SafeExecutionResult<TResult>>;
70
100
  /**
71
- * Reports the attempt outcome to the verifier's authority. A missing,
101
+ * Reports the attempt outcome to the verifier's authority, with the
102
+ * provider's effect receipt when the attempt brought one back. A missing,
72
103
  * failing, or malformed finalization can never alter the execution result.
73
104
  */
74
105
  private finalize;