agent-passport-system 7.0.0 → 7.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.
Files changed (198) hide show
  1. package/SECURITY.md +11 -0
  2. package/dist/src/core/tool-integrity.d.ts +13 -0
  3. package/dist/src/core/tool-integrity.d.ts.map +1 -1
  4. package/dist/src/core/tool-integrity.js +1 -1
  5. package/dist/src/core/tool-integrity.js.map +1 -1
  6. package/dist/src/index.d.ts +52 -2
  7. package/dist/src/index.d.ts.map +1 -1
  8. package/dist/src/index.js +282 -1
  9. package/dist/src/index.js.map +1 -1
  10. package/dist/src/v2/activation/canonical.d.ts +40 -0
  11. package/dist/src/v2/activation/canonical.d.ts.map +1 -0
  12. package/dist/src/v2/activation/canonical.js +64 -0
  13. package/dist/src/v2/activation/canonical.js.map +1 -0
  14. package/dist/src/v2/activation/index.d.ts +4 -0
  15. package/dist/src/v2/activation/index.d.ts.map +1 -0
  16. package/dist/src/v2/activation/index.js +11 -0
  17. package/dist/src/v2/activation/index.js.map +1 -0
  18. package/dist/src/v2/activation/types.d.ts +268 -0
  19. package/dist/src/v2/activation/types.d.ts.map +1 -0
  20. package/dist/src/v2/activation/types.js +198 -0
  21. package/dist/src/v2/activation/types.js.map +1 -0
  22. package/dist/src/v2/activation/verify.d.ts +132 -0
  23. package/dist/src/v2/activation/verify.d.ts.map +1 -0
  24. package/dist/src/v2/activation/verify.js +406 -0
  25. package/dist/src/v2/activation/verify.js.map +1 -0
  26. package/dist/src/v2/authority-revocation/canonical.d.ts +46 -0
  27. package/dist/src/v2/authority-revocation/canonical.d.ts.map +1 -0
  28. package/dist/src/v2/authority-revocation/canonical.js +68 -0
  29. package/dist/src/v2/authority-revocation/canonical.js.map +1 -0
  30. package/dist/src/v2/authority-revocation/index.d.ts +9 -0
  31. package/dist/src/v2/authority-revocation/index.d.ts.map +1 -0
  32. package/dist/src/v2/authority-revocation/index.js +11 -0
  33. package/dist/src/v2/authority-revocation/index.js.map +1 -0
  34. package/dist/src/v2/authority-revocation/issue.d.ts +54 -0
  35. package/dist/src/v2/authority-revocation/issue.d.ts.map +1 -0
  36. package/dist/src/v2/authority-revocation/issue.js +111 -0
  37. package/dist/src/v2/authority-revocation/issue.js.map +1 -0
  38. package/dist/src/v2/authority-revocation/record.d.ts +69 -0
  39. package/dist/src/v2/authority-revocation/record.d.ts.map +1 -0
  40. package/dist/src/v2/authority-revocation/record.js +51 -0
  41. package/dist/src/v2/authority-revocation/record.js.map +1 -0
  42. package/dist/src/v2/authority-revocation/resolver.d.ts +30 -0
  43. package/dist/src/v2/authority-revocation/resolver.d.ts.map +1 -0
  44. package/dist/src/v2/authority-revocation/resolver.js +52 -0
  45. package/dist/src/v2/authority-revocation/resolver.js.map +1 -0
  46. package/dist/src/v2/authority-revocation/schema.d.ts +15 -0
  47. package/dist/src/v2/authority-revocation/schema.d.ts.map +1 -0
  48. package/dist/src/v2/authority-revocation/schema.js +107 -0
  49. package/dist/src/v2/authority-revocation/schema.js.map +1 -0
  50. package/dist/src/v2/authority-revocation/store.d.ts +55 -0
  51. package/dist/src/v2/authority-revocation/store.d.ts.map +1 -0
  52. package/dist/src/v2/authority-revocation/store.js +69 -0
  53. package/dist/src/v2/authority-revocation/store.js.map +1 -0
  54. package/dist/src/v2/authority-revocation/types.d.ts +136 -0
  55. package/dist/src/v2/authority-revocation/types.d.ts.map +1 -0
  56. package/dist/src/v2/authority-revocation/types.js +11 -0
  57. package/dist/src/v2/authority-revocation/types.js.map +1 -0
  58. package/dist/src/v2/authority-revocation/verify.d.ts +38 -0
  59. package/dist/src/v2/authority-revocation/verify.d.ts.map +1 -0
  60. package/dist/src/v2/authority-revocation/verify.js +139 -0
  61. package/dist/src/v2/authority-revocation/verify.js.map +1 -0
  62. package/dist/src/v2/authority-state/fencing.d.ts +49 -0
  63. package/dist/src/v2/authority-state/fencing.d.ts.map +1 -0
  64. package/dist/src/v2/authority-state/fencing.js +92 -0
  65. package/dist/src/v2/authority-state/fencing.js.map +1 -0
  66. package/dist/src/v2/authority-state/index.d.ts +7 -0
  67. package/dist/src/v2/authority-state/index.d.ts.map +1 -0
  68. package/dist/src/v2/authority-state/index.js +14 -0
  69. package/dist/src/v2/authority-state/index.js.map +1 -0
  70. package/dist/src/v2/authority-state/marker.d.ts +70 -0
  71. package/dist/src/v2/authority-state/marker.d.ts.map +1 -0
  72. package/dist/src/v2/authority-state/marker.js +122 -0
  73. package/dist/src/v2/authority-state/marker.js.map +1 -0
  74. package/dist/src/v2/authority-state/report.d.ts +55 -0
  75. package/dist/src/v2/authority-state/report.d.ts.map +1 -0
  76. package/dist/src/v2/authority-state/report.js +51 -0
  77. package/dist/src/v2/authority-state/report.js.map +1 -0
  78. package/dist/src/v2/authority-state/retained.d.ts +82 -0
  79. package/dist/src/v2/authority-state/retained.d.ts.map +1 -0
  80. package/dist/src/v2/authority-state/retained.js +93 -0
  81. package/dist/src/v2/authority-state/retained.js.map +1 -0
  82. package/dist/src/v2/authority-state/types.d.ts +198 -0
  83. package/dist/src/v2/authority-state/types.d.ts.map +1 -0
  84. package/dist/src/v2/authority-state/types.js +103 -0
  85. package/dist/src/v2/authority-state/types.js.map +1 -0
  86. package/dist/src/v2/authority-state/withdrawal.d.ts +80 -0
  87. package/dist/src/v2/authority-state/withdrawal.d.ts.map +1 -0
  88. package/dist/src/v2/authority-state/withdrawal.js +199 -0
  89. package/dist/src/v2/authority-state/withdrawal.js.map +1 -0
  90. package/dist/src/v2/bounds/canonical.d.ts +30 -0
  91. package/dist/src/v2/bounds/canonical.d.ts.map +1 -0
  92. package/dist/src/v2/bounds/canonical.js +69 -0
  93. package/dist/src/v2/bounds/canonical.js.map +1 -0
  94. package/dist/src/v2/bounds/evaluate.d.ts +107 -0
  95. package/dist/src/v2/bounds/evaluate.d.ts.map +1 -0
  96. package/dist/src/v2/bounds/evaluate.js +315 -0
  97. package/dist/src/v2/bounds/evaluate.js.map +1 -0
  98. package/dist/src/v2/bounds/index.d.ts +6 -0
  99. package/dist/src/v2/bounds/index.d.ts.map +1 -0
  100. package/dist/src/v2/bounds/index.js +13 -0
  101. package/dist/src/v2/bounds/index.js.map +1 -0
  102. package/dist/src/v2/bounds/purpose.d.ts +2 -0
  103. package/dist/src/v2/bounds/purpose.d.ts.map +1 -0
  104. package/dist/src/v2/bounds/purpose.js +23 -0
  105. package/dist/src/v2/bounds/purpose.js.map +1 -0
  106. package/dist/src/v2/bounds/record.d.ts +78 -0
  107. package/dist/src/v2/bounds/record.d.ts.map +1 -0
  108. package/dist/src/v2/bounds/record.js +170 -0
  109. package/dist/src/v2/bounds/record.js.map +1 -0
  110. package/dist/src/v2/bounds/types.d.ts +275 -0
  111. package/dist/src/v2/bounds/types.d.ts.map +1 -0
  112. package/dist/src/v2/bounds/types.js +124 -0
  113. package/dist/src/v2/bounds/types.js.map +1 -0
  114. package/dist/src/v2/capability-binding/binding.d.ts +67 -0
  115. package/dist/src/v2/capability-binding/binding.d.ts.map +1 -0
  116. package/dist/src/v2/capability-binding/binding.js +267 -0
  117. package/dist/src/v2/capability-binding/binding.js.map +1 -0
  118. package/dist/src/v2/capability-binding/digest.d.ts +33 -0
  119. package/dist/src/v2/capability-binding/digest.d.ts.map +1 -0
  120. package/dist/src/v2/capability-binding/digest.js +55 -0
  121. package/dist/src/v2/capability-binding/digest.js.map +1 -0
  122. package/dist/src/v2/capability-binding/identifier.d.ts +103 -0
  123. package/dist/src/v2/capability-binding/identifier.d.ts.map +1 -0
  124. package/dist/src/v2/capability-binding/identifier.js +281 -0
  125. package/dist/src/v2/capability-binding/identifier.js.map +1 -0
  126. package/dist/src/v2/capability-binding/index.d.ts +6 -0
  127. package/dist/src/v2/capability-binding/index.d.ts.map +1 -0
  128. package/dist/src/v2/capability-binding/index.js +13 -0
  129. package/dist/src/v2/capability-binding/index.js.map +1 -0
  130. package/dist/src/v2/capability-binding/pins.d.ts +30 -0
  131. package/dist/src/v2/capability-binding/pins.d.ts.map +1 -0
  132. package/dist/src/v2/capability-binding/pins.js +109 -0
  133. package/dist/src/v2/capability-binding/pins.js.map +1 -0
  134. package/dist/src/v2/capability-binding/types.d.ts +213 -0
  135. package/dist/src/v2/capability-binding/types.d.ts.map +1 -0
  136. package/dist/src/v2/capability-binding/types.js +150 -0
  137. package/dist/src/v2/capability-binding/types.js.map +1 -0
  138. package/dist/src/v2/chain-selection/index.d.ts +4 -0
  139. package/dist/src/v2/chain-selection/index.d.ts.map +1 -0
  140. package/dist/src/v2/chain-selection/index.js +11 -0
  141. package/dist/src/v2/chain-selection/index.js.map +1 -0
  142. package/dist/src/v2/chain-selection/select.d.ts +62 -0
  143. package/dist/src/v2/chain-selection/select.d.ts.map +1 -0
  144. package/dist/src/v2/chain-selection/select.js +390 -0
  145. package/dist/src/v2/chain-selection/select.js.map +1 -0
  146. package/dist/src/v2/chain-selection/types.d.ts +189 -0
  147. package/dist/src/v2/chain-selection/types.d.ts.map +1 -0
  148. package/dist/src/v2/chain-selection/types.js +81 -0
  149. package/dist/src/v2/chain-selection/types.js.map +1 -0
  150. package/dist/src/v2/lifecycle-state/index.d.ts +4 -0
  151. package/dist/src/v2/lifecycle-state/index.d.ts.map +1 -0
  152. package/dist/src/v2/lifecycle-state/index.js +10 -0
  153. package/dist/src/v2/lifecycle-state/index.js.map +1 -0
  154. package/dist/src/v2/lifecycle-state/map.d.ts +52 -0
  155. package/dist/src/v2/lifecycle-state/map.d.ts.map +1 -0
  156. package/dist/src/v2/lifecycle-state/map.js +122 -0
  157. package/dist/src/v2/lifecycle-state/map.js.map +1 -0
  158. package/dist/src/v2/lifecycle-state/state.d.ts +60 -0
  159. package/dist/src/v2/lifecycle-state/state.d.ts.map +1 -0
  160. package/dist/src/v2/lifecycle-state/state.js +157 -0
  161. package/dist/src/v2/lifecycle-state/state.js.map +1 -0
  162. package/dist/src/v2/lifecycle-state/types.d.ts +163 -0
  163. package/dist/src/v2/lifecycle-state/types.d.ts.map +1 -0
  164. package/dist/src/v2/lifecycle-state/types.js +121 -0
  165. package/dist/src/v2/lifecycle-state/types.js.map +1 -0
  166. package/dist/src/v2/receipt-core/composite.d.ts +69 -3
  167. package/dist/src/v2/receipt-core/composite.d.ts.map +1 -1
  168. package/dist/src/v2/receipt-core/composite.js +75 -9
  169. package/dist/src/v2/receipt-core/composite.js.map +1 -1
  170. package/dist/src/v2/receipt-core/predecessor.d.ts +95 -0
  171. package/dist/src/v2/receipt-core/predecessor.d.ts.map +1 -0
  172. package/dist/src/v2/receipt-core/predecessor.js +115 -0
  173. package/dist/src/v2/receipt-core/predecessor.js.map +1 -0
  174. package/dist/src/v2/status-coverage/decide.d.ts +52 -0
  175. package/dist/src/v2/status-coverage/decide.d.ts.map +1 -0
  176. package/dist/src/v2/status-coverage/decide.js +398 -0
  177. package/dist/src/v2/status-coverage/decide.js.map +1 -0
  178. package/dist/src/v2/status-coverage/index.d.ts +3 -0
  179. package/dist/src/v2/status-coverage/index.d.ts.map +1 -0
  180. package/dist/src/v2/status-coverage/index.js +10 -0
  181. package/dist/src/v2/status-coverage/index.js.map +1 -0
  182. package/dist/src/v2/status-coverage/types.d.ts +258 -0
  183. package/dist/src/v2/status-coverage/types.d.ts.map +1 -0
  184. package/dist/src/v2/status-coverage/types.js +127 -0
  185. package/dist/src/v2/status-coverage/types.js.map +1 -0
  186. package/dist/src/v2/suspension/evaluate.d.ts +88 -0
  187. package/dist/src/v2/suspension/evaluate.d.ts.map +1 -0
  188. package/dist/src/v2/suspension/evaluate.js +404 -0
  189. package/dist/src/v2/suspension/evaluate.js.map +1 -0
  190. package/dist/src/v2/suspension/index.d.ts +3 -0
  191. package/dist/src/v2/suspension/index.d.ts.map +1 -0
  192. package/dist/src/v2/suspension/index.js +10 -0
  193. package/dist/src/v2/suspension/index.js.map +1 -0
  194. package/dist/src/v2/suspension/types.d.ts +243 -0
  195. package/dist/src/v2/suspension/types.d.ts.map +1 -0
  196. package/dist/src/v2/suspension/types.js +135 -0
  197. package/dist/src/v2/suspension/types.js.map +1 -0
  198. package/package.json +10 -7
@@ -0,0 +1,268 @@
1
+ import type { EstablishmentGap, LifecycleStateResult } from '../lifecycle-state/types.js';
2
+ /** Record type of the activation condition this module owns. The `proposed:` prefix is
3
+ * deliberate: the conformance suite's CONTRIBUTING.md reserves record fields, failure-class
4
+ * names and verifier semantics to the schema owner, so nothing here is minted APS
5
+ * vocabulary and nothing downstream should treat it as stable. */
6
+ export declare const ACTIVATION_CONDITION_TYPE: 'proposed:aps:activation-condition:v0';
7
+ /** Record type of the activation attestation this module owns. Same caveat as above.
8
+ * A model may accept condition evidence in a shape this module does not own; see
9
+ * `ActivationVerificationInput.attestationPreimage`. */
10
+ export declare const ACTIVATION_ATTESTATION_TYPE: 'proposed:aps:activation-attestation:v0';
11
+ /** The two kinds of activation condition the concept text names in one sentence: "A grant can
12
+ * be validly issued and still wait on a date or a recorded event." They are answered by
13
+ * different deciders, which is why they are separate members here rather than one shape with
14
+ * optional fields. A date condition needs no evidence at all: the verifier reads the date. A
15
+ * recorded-event condition needs evidence from a source the model accepts for it. */
16
+ export declare const ACTIVATION_CONDITION_KINDS: readonly ['date', 'recorded_event'];
17
+ export type ActivationConditionKind = (typeof ACTIVATION_CONDITION_KINDS)[number];
18
+ /** Which instant a `condition_occurred` attestation is measured against.
19
+ *
20
+ * - `condition_occurrence` the instant the condition itself is asserted to have occurred,
21
+ * from the record's `occurred_at`. This is CAND-04 v2's reading:
22
+ * "A condition that first occurred after an action does not make
23
+ * that action exercisable", which is a statement about the
24
+ * condition's own instant. Under it, a record written after an
25
+ * action can establish a condition that obtained before it, which
26
+ * is the normal case for any model built around an
27
+ * after-the-fact determination.
28
+ * - `attestation_written` the instant the record was written, from `attested_at`. A model
29
+ * that keys activation on when someone wrote the determination
30
+ * down rather than on when the condition occurred can say so
31
+ * here.
32
+ *
33
+ * THERE IS NO DEFAULT. The concept text groups a date and a recorded event in one sentence
34
+ * and says nothing about which instant either is measured from, and a default in an SDK is a
35
+ * ruling made by whoever wrote the SDK. Both readings give opposite verdicts on a
36
+ * deployment-relevant case (an occurrence before an action, attested after it), so the
37
+ * condition has to state which one governs.
38
+ *
39
+ * `instant_basis` does not apply to a `condition_not_occurred_through` record. That
40
+ * assertion states the interval it covers, and the interval is what the coverage check
41
+ * reads. Concept source: BROAD-L7's coverage limb. */
42
+ export declare const ACTIVATION_INSTANT_BASES: readonly ['condition_occurrence', 'attestation_written'];
43
+ export type ActivationInstantBasis = (typeof ACTIVATION_INSTANT_BASES)[number];
44
+ /** The two assertions an activation attestation can carry.
45
+ *
46
+ * - `condition_occurred` the event occurred, at `occurred_at`.
47
+ * - `condition_not_occurred_through` the event had not occurred through
48
+ * `not_occurred_through`. A NEGATIVE that is evidence,
49
+ * not an absence of evidence, which is the distinction
50
+ * between `not_yet_effective` and `not_established`.
51
+ *
52
+ * An absence-triggered condition, where the trigger is that something did NOT happen within
53
+ * a declared window, is NOT modelled here. CAND-04's own counterexample analysis names it as
54
+ * the shape most likely to be implemented wrongly in the fail-closed direction, and this
55
+ * module has no vocabulary for it. `resolveAttestorRole` returning `unknown` is what keeps
56
+ * that case reachable for a later surface rather than silently answered here. */
57
+ export declare const ACTIVATION_ASSERTIONS: readonly ['condition_occurred', 'condition_not_occurred_through'];
58
+ export type ActivationAssertion = (typeof ACTIVATION_ASSERTIONS)[number];
59
+ /** Members every activation condition carries. */
60
+ export interface ActivationConditionCommonV0 {
61
+ readonly record_type: typeof ACTIVATION_CONDITION_TYPE;
62
+ /** Opaque. This module never derives, parses or interprets a condition identifier. */
63
+ readonly condition_id: string;
64
+ /** The grant this condition gates. A REFERENCE, never a facet: draft-03 section 3.2 closes
65
+ * `authority` at seven facets, so a condition cannot ride inside a signed
66
+ * `AuthorityDelegationV1` at all. */
67
+ readonly delegation_id: string;
68
+ }
69
+ /** A condition that waits on a date. The verifier reads the date and compares it with the
70
+ * action instant, so an unreached date is always a known negative and never an unknown one.
71
+ * No attestation is involved and none is consulted. */
72
+ export interface DateActivationConditionV0 extends ActivationConditionCommonV0 {
73
+ readonly condition_type: 'date';
74
+ /** RFC 3339, offset required. */
75
+ readonly activation_date: string;
76
+ }
77
+ /** A condition that waits on a recorded event, attested by a party holding a declared role. */
78
+ export interface RecordedEventActivationConditionV0 extends ActivationConditionCommonV0 {
79
+ readonly condition_type: 'recorded_event';
80
+ /** Opaque to this module. Compared for equality against an attestation's own member. */
81
+ readonly event_type: string;
82
+ /** Opaque to this module. Compared for equality against an attestation's own member. */
83
+ readonly event_id: string;
84
+ /** ROLE identifiers, never principals. Who holds a role is the resolver's answer, not the
85
+ * condition's and never the attestation's. At least one member is required: a condition
86
+ * that names no accepted source has not stated what it accepts, and this module refuses it
87
+ * rather than accepting anything. A record from a party holding ANY member is acceptable,
88
+ * which is a union and not a conjunction; a model needing every named role to attest needs
89
+ * a rule this module does not express. */
90
+ readonly required_attestor_roles: readonly string[];
91
+ /** How many acceptable attestations establish a finding. At least 1, and there is NO
92
+ * DEFAULT for what it should be: how many determinations a model requires is a model
93
+ * decision. The same threshold applies in both directions, so a model wanting one record
94
+ * to establish an occurrence and two to establish a non-occurrence is not expressible
95
+ * here. That asymmetry is an open question, not a settled no. */
96
+ readonly threshold: number;
97
+ readonly instant_basis: ActivationInstantBasis;
98
+ }
99
+ export type ActivationConditionV0 = DateActivationConditionV0 | RecordedEventActivationConditionV0;
100
+ /** An activation attestation, as presented.
101
+ *
102
+ * `record_type` is typed as `string` rather than as this module's own constant because a
103
+ * model can accept condition evidence in a shape this module does not own. What it accepts
104
+ * is a model declaration, supplied through
105
+ * `ActivationVerificationInput.acceptedAttestationRecordTypes`.
106
+ *
107
+ * `attestor_role` is the attestor's CLAIM ABOUT ITSELF and is never authority for anything.
108
+ * It is checked against the resolver, and a claim the resolver contradicts is its own
109
+ * rejection reason rather than being folded into a plain role mismatch, because the two are
110
+ * different findings: one party is in the wrong place, the other says it is somewhere it is
111
+ * not. An attestation that makes no role claim is not rejected for that; the required-role
112
+ * check still runs.
113
+ *
114
+ * The index signature is deliberate. Extra members ride along, are inside the signed
115
+ * preimage, and are never interpreted here. */
116
+ export interface ActivationAttestationV0 {
117
+ readonly record_type: string;
118
+ readonly assertion: string;
119
+ readonly attestor: string;
120
+ readonly attestor_role?: string;
121
+ readonly condition_id: string;
122
+ readonly event_type?: string;
123
+ readonly event_id?: string;
124
+ /** RFC 3339. Present on `condition_occurred`. */
125
+ readonly occurred_at?: string;
126
+ /** RFC 3339. Present on `condition_not_occurred_through`. */
127
+ readonly not_occurred_through?: string;
128
+ /** RFC 3339. When the record itself was written. Used to select the signing key version
129
+ * authorized at that instant, per draft-03 section 2.4, and used as the occurrence instant
130
+ * only under `instant_basis: 'attestation_written'`. */
131
+ readonly attested_at: string;
132
+ readonly verification_method: string;
133
+ readonly attestation_id: string;
134
+ readonly signature: string;
135
+ readonly [key: string]: unknown;
136
+ }
137
+ /** What a resolver can say about whether an attestor holds a role at an instant.
138
+ *
139
+ * THREE VALUES, NOT A BOOLEAN. "This registry does not know" is a distinct answer from "this
140
+ * party does not hold that role", and collapsing the first into the second turns ignorance
141
+ * into a denial. That collapse is the failure BROAD-L7 exists to name, and it is the reason
142
+ * an absence-triggered condition needs `unknown` to stay reachable. */
143
+ export declare const ATTESTOR_ROLE_STANDINGS: readonly ['holds', 'does_not_hold', 'unknown'];
144
+ export type AttestorRoleStanding = (typeof ATTESTOR_ROLE_STANDINGS)[number];
145
+ /** Resolves whether `attestor` held `role` at `atInstant`.
146
+ *
147
+ * Role standing is resolved OUTSIDE the record, always. This module never reads standing
148
+ * from the artifact asserting it, which is the single control that separates a real
149
+ * attestor-role check from a self-declared one. `atInstant` is passed so a registry with its
150
+ * own history can answer for the right moment; a resolver that ignores it is answering for
151
+ * "now", which is a choice the resolver makes and not one this module makes for it.
152
+ *
153
+ * Where role standing comes from, who publishes it and what a verifier consults are not
154
+ * settled by any published or proposed text. That is why this is a callback and not a
155
+ * registry type. */
156
+ export type AttestorRoleResolver = (attestor: string, role: string, atInstant: string) => AttestorRoleStanding;
157
+ /** What one accepted attestation establishes about the condition at the action instant.
158
+ *
159
+ * - `occurred_by_action` the condition's instant is at or before the action instant.
160
+ * - `occurred_after_action` the condition's instant is after it. The SAME record
161
+ * establishes the condition for any later action, which is
162
+ * what makes this a wait rather than a failure.
163
+ * - `not_occurred_through_action` an accepted record states the condition had not occurred
164
+ * through an instant that reaches the action instant. */
165
+ export declare const ACTIVATION_FINDINGS: readonly ['occurred_by_action', 'occurred_after_action', 'not_occurred_through_action'];
166
+ export type ActivationFindingKind = (typeof ACTIVATION_FINDINGS)[number];
167
+ /** One accepted attestation and what it established. */
168
+ export interface ActivationFinding {
169
+ readonly attestation_id: string;
170
+ readonly attestor: string;
171
+ readonly finding: ActivationFindingKind;
172
+ }
173
+ /** One rejected attestation and why. A rejected attestation is NOT evidence in either
174
+ * direction: it cannot establish the condition and it equally cannot establish that the
175
+ * condition was unmet. That is the whole of the difference between `not_established` and
176
+ * `not_yet_effective` for a record from a source the model does not accept. */
177
+ export interface ActivationRejection {
178
+ readonly attestation_id: string;
179
+ readonly attestor: string;
180
+ readonly reason_code: ActivationReasonCode;
181
+ }
182
+ /** Every reason code this module emits, verdict-level and rejection-level.
183
+ *
184
+ * Module-local and SCREAMING_SNAKE_CASE, per the lifecycle-state vocabulary's rule that two
185
+ * findings sharing a verdict name must be told apart by their codes. Not minted APS
186
+ * vocabulary. */
187
+ export declare const ACTIVATION_REASON_CODES: readonly [
188
+ /** valid: an accepted record establishes the condition at or before the action instant, or
189
+ * a date condition's date has been reached. */
190
+ 'ACTIVATION_ESTABLISHED',
191
+ /** not_yet_effective: a date condition's activation date is after the action instant. */
192
+ 'CONDITION_DATE_NOT_REACHED',
193
+ /** not_yet_effective: an accepted record states the condition had not occurred through an
194
+ * instant reaching the action instant. */
195
+ 'CONDITION_ESTABLISHED_NOT_YET_OCCURRED',
196
+ /** not_yet_effective: an accepted record puts the condition's first occurrence after the
197
+ * action instant. No retroactive activation: the same record establishes the condition for
198
+ * a later action, and never for this one. */
199
+ 'CONDITION_FIRST_OCCURRED_AFTER_ACTION',
200
+ /** not_established, source: two accepted records disagree about the action instant. Neither
201
+ * defeats the other and this module has no precedence rule. */
202
+ 'CONDITION_EVIDENCE_CONFLICT',
203
+ /** not_established, source: accepted records exist but fewer than `threshold` of them
204
+ * support the finding. */
205
+ 'ACTIVATION_THRESHOLD_NOT_MET',
206
+ /** not_established, source: nothing was presented. */
207
+ 'NO_ATTESTATION_PRESENTED',
208
+ /** not_established, coverage: the condition presented gates a different delegation. The
209
+ * claim does not state that it covers what the verdict needed. */
210
+ 'CONDITION_DELEGATION_MISMATCH',
211
+ /** source: the record's type is not one the model declared it accepts for this condition. */
212
+ 'ATTESTATION_RECORD_TYPE_NOT_ACCEPTED',
213
+ /** source: no key resolved for the record's verification method at its own `attested_at`,
214
+ * or the signature does not verify over the record's canonical bytes. */
215
+ 'ATTESTATION_SIGNATURE_UNVERIFIED',
216
+ /** source: the verification method does not belong to the attestor the body names, so a
217
+ * valid signature says nothing about who attested. */
218
+ 'ATTESTATION_ATTESTOR_BINDING_MISMATCH',
219
+ /** source: the resolver does not know whether the attestor holds the role. Ignorance, and
220
+ * deliberately not folded into a mismatch. */
221
+ 'ATTESTATION_ATTESTOR_ROLE_UNKNOWN',
222
+ /** source: the record claims a role the resolver says the attestor does not hold. */
223
+ 'ATTESTATION_ROLE_CLAIM_CONFLICT',
224
+ /** source: the attestor holds no role the condition requires. */
225
+ 'ATTESTATION_ATTESTOR_ROLE_MISMATCH',
226
+ /** source: the record's condition, event type or event id is not the condition's. */
227
+ 'ATTESTATION_CONDITION_MISMATCH',
228
+ /** source: the assertion is not one of the two this module defines, or the member that
229
+ * assertion needs is absent. */
230
+ 'ATTESTATION_UNKNOWN_ASSERTION',
231
+ /** source: an instant on the record is not an RFC 3339 instant this module will compare. */
232
+ 'ATTESTATION_INSTANT_MALFORMED',
233
+ /** coverage: a `condition_not_occurred_through` record stops before the action instant, so
234
+ * it says nothing about the interval between where it stops and the action. */
235
+ 'ATTESTATION_DOES_NOT_REACH_ACTION'];
236
+ export type ActivationReasonCode = (typeof ACTIVATION_REASON_CODES)[number];
237
+ /** Which establishment limb is missing when a reason code produces `not_established`.
238
+ *
239
+ * `freshness` never appears. A freshness bound is model declared, this module is given none,
240
+ * and the surface that owns multi-source status observation owns freshness. A mapping that
241
+ * invented a freshness finding would be claiming something the verifier never measured. */
242
+ export declare const ACTIVATION_GAPS_BY_REASON: Readonly<Partial<Record<ActivationReasonCode, readonly EstablishmentGap[]>>>;
243
+ /** What `verifyActivation` concludes.
244
+ *
245
+ * `state` is a `LifecycleStateResult` in the lifecycle-state vocabulary, so activation shares
246
+ * one verdict set with every other proposed lifecycle surface instead of spelling a seventh
247
+ * local copy of the same missing values. Only three of the six verdicts are reachable here:
248
+ * `valid`, `not_yet_effective` and `not_established`. `invalid` is NEVER one of them. An
249
+ * unmet activation condition does not make a grant invalid, and whether the grant is valid at
250
+ * all is chain verification's answer, not this module's.
251
+ *
252
+ * `findings` and `rejections` are the working, one entry per presented attestation across the
253
+ * two, so a caller can report which record did what rather than only the verdict. */
254
+ export interface ActivationResult {
255
+ readonly state: LifecycleStateResult;
256
+ readonly condition_id: string;
257
+ readonly condition_type: ActivationConditionKind;
258
+ readonly findings: readonly ActivationFinding[];
259
+ readonly rejections: readonly ActivationRejection[];
260
+ }
261
+ /** Thrown when a condition or a call is malformed. A shape rule broken at the call site is a
262
+ * programming error, not a verdict, which is the same split `lifecycleState` makes. Evidence
263
+ * problems are never thrown: they are verdicts. */
264
+ export declare class ActivationError extends Error {
265
+ readonly code: string;
266
+ constructor(code: string, message: string);
267
+ }
268
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/v2/activation/types.ts"],"names":[],"mappings":"AA4CA,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AAEzF;;;mEAGmE;AACnE,eAAO,MAAM,yBAAyB,EAAG,sCAA+C,CAAA;AAExF;;yDAEyD;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AEV,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAA;AAE3E;;;;4FAI4F;AAC5F,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAC9C,OAAO,CAAC,MAAM,CAAC,oBAAoB,EAAE,SAAS,gBAAgB,EAAE,CAAC,CAAC,CAIlE,CAAA;AAEF;;;;;;;;;;sFAUsF;AACtF,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,EAAE,oBAAoB,CAAA;IACpC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,cAAc,EAAE,uBAAuB,CAAA;IAChD,QAAQ,CAAC,QAAQ,EAAE,SAAS,iBAAiB,EAAE,CAAA;IAC/C,QAAQ,CAAC,UAAU,EAAE,SAAS,mBAAmB,EAAE,CAAA;CACpD;AAED;;oDAEoD;AACpD,qBAAa,eAAgB,SAAQ,KAAK;IACxC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IAErB,YAAY,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAIxC;CACF"}
@@ -0,0 +1,198 @@
1
+ // Copyright (c) 2026 Tymofii Pidlisnyi
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ //
4
+ // PROPOSED, OPT-IN. Activation conditions and condition attestation.
5
+ //
6
+ // NOT REQUIRED BY draft-pidlisnyi-aps-03. The published text states no activation-condition
7
+ // rule, no attestor role and no attestation-acceptance rule: a case-insensitive search of
8
+ // draft-pidlisnyi-aps-03 for `activation`, `attestor` and `contingen` returns nothing.
9
+ // Draft-03 section 3.2 also states, verbatim: "authority contains exactly seven required
10
+ // facets: scope, spend, depth, time, reputation, values, and reversibility. A missing facet
11
+ // is invalid rather than an implicit unconstrained value." That closes the authority vector,
12
+ // so an activation condition can never be a facet. It is a SEPARATE artifact that references
13
+ // a `delegation_id`, which is what this module models.
14
+ //
15
+ // Concept source: the aeoess/agent-authority-lifecycle concept document
16
+ // (AUTHORITY-LIFECYCLE.md, "Activation condition" under "Authority and dependencies", marked
17
+ // proposed with no public case testing it) and invariant candidates CAND-04 (activation is
18
+ // established, not yet effective, or not established), CAND-13 (replacement authority may be
19
+ // pre-committed) and BROAD-L7 (any current lifecycle state claim is established only from an
20
+ // accepted source, within a declared freshness bound, over the coverage the claim states).
21
+ // All three are proposed. Nothing here claims otherwise.
22
+ //
23
+ // Additive and opt-in. `AuthorityValidationState`, `AuthorityValidationResult`,
24
+ // `AuthorityVectorV1` and everything `verifyAuthorityDelegationChain` returns are unchanged.
25
+ // A caller that never imports this module sees exactly today's behaviour.
26
+ //
27
+ // THREE THINGS THE CONCEPT TEXT DOES NOT DECIDE, and how this module refuses to decide them:
28
+ //
29
+ // 1. WHICH INSTANT an occurrence is measured from. A recorded-event condition carries
30
+ // `instant_basis` and there is no default. CAND-04 v2 reads it as the condition's own
31
+ // occurrence instant, and `attestation_written` exists so a model that reads it the
32
+ // other way has to say so in the record rather than inherit a choice this SDK made.
33
+ // 2. HOW MANY acceptable attestations establish a condition. `threshold` is required and
34
+ // there is no default.
35
+ // 3. WHO decides a condition. Role standing is resolved through a caller-supplied
36
+ // resolver and is never read off the attestation asserting it. An attestation's
37
+ // `attestor_role` member is the attestor's claim about itself, and this module checks
38
+ // that claim AGAINST the resolver rather than believing it.
39
+ //
40
+ // A fourth thing it does not decide is whether a waiting grant is `invalid` or
41
+ // `not_yet_effective` when the wait is carried by the time facet rather than by an activation
42
+ // condition. This module does not touch the time facet and `composeActivation` keeps the
43
+ // chain verifier's own answer unless the caller opts out. See ./verify.ts.
44
+ /** Record type of the activation condition this module owns. The `proposed:` prefix is
45
+ * deliberate: the conformance suite's CONTRIBUTING.md reserves record fields, failure-class
46
+ * names and verifier semantics to the schema owner, so nothing here is minted APS
47
+ * vocabulary and nothing downstream should treat it as stable. */
48
+ export const ACTIVATION_CONDITION_TYPE = 'proposed:aps:activation-condition:v0';
49
+ /** Record type of the activation attestation this module owns. Same caveat as above.
50
+ * A model may accept condition evidence in a shape this module does not own; see
51
+ * `ActivationVerificationInput.attestationPreimage`. */
52
+ export const ACTIVATION_ATTESTATION_TYPE = 'proposed:aps:activation-attestation:v0';
53
+ /** The two kinds of activation condition the concept text names in one sentence: "A grant can
54
+ * be validly issued and still wait on a date or a recorded event." They are answered by
55
+ * different deciders, which is why they are separate members here rather than one shape with
56
+ * optional fields. A date condition needs no evidence at all: the verifier reads the date. A
57
+ * recorded-event condition needs evidence from a source the model accepts for it. */
58
+ export const ACTIVATION_CONDITION_KINDS = ['date', 'recorded_event'];
59
+ /** Which instant a `condition_occurred` attestation is measured against.
60
+ *
61
+ * - `condition_occurrence` the instant the condition itself is asserted to have occurred,
62
+ * from the record's `occurred_at`. This is CAND-04 v2's reading:
63
+ * "A condition that first occurred after an action does not make
64
+ * that action exercisable", which is a statement about the
65
+ * condition's own instant. Under it, a record written after an
66
+ * action can establish a condition that obtained before it, which
67
+ * is the normal case for any model built around an
68
+ * after-the-fact determination.
69
+ * - `attestation_written` the instant the record was written, from `attested_at`. A model
70
+ * that keys activation on when someone wrote the determination
71
+ * down rather than on when the condition occurred can say so
72
+ * here.
73
+ *
74
+ * THERE IS NO DEFAULT. The concept text groups a date and a recorded event in one sentence
75
+ * and says nothing about which instant either is measured from, and a default in an SDK is a
76
+ * ruling made by whoever wrote the SDK. Both readings give opposite verdicts on a
77
+ * deployment-relevant case (an occurrence before an action, attested after it), so the
78
+ * condition has to state which one governs.
79
+ *
80
+ * `instant_basis` does not apply to a `condition_not_occurred_through` record. That
81
+ * assertion states the interval it covers, and the interval is what the coverage check
82
+ * reads. Concept source: BROAD-L7's coverage limb. */
83
+ export const ACTIVATION_INSTANT_BASES = ['condition_occurrence', 'attestation_written'];
84
+ /** The two assertions an activation attestation can carry.
85
+ *
86
+ * - `condition_occurred` the event occurred, at `occurred_at`.
87
+ * - `condition_not_occurred_through` the event had not occurred through
88
+ * `not_occurred_through`. A NEGATIVE that is evidence,
89
+ * not an absence of evidence, which is the distinction
90
+ * between `not_yet_effective` and `not_established`.
91
+ *
92
+ * An absence-triggered condition, where the trigger is that something did NOT happen within
93
+ * a declared window, is NOT modelled here. CAND-04's own counterexample analysis names it as
94
+ * the shape most likely to be implemented wrongly in the fail-closed direction, and this
95
+ * module has no vocabulary for it. `resolveAttestorRole` returning `unknown` is what keeps
96
+ * that case reachable for a later surface rather than silently answered here. */
97
+ export const ACTIVATION_ASSERTIONS = [
98
+ 'condition_occurred',
99
+ 'condition_not_occurred_through',
100
+ ];
101
+ /** What a resolver can say about whether an attestor holds a role at an instant.
102
+ *
103
+ * THREE VALUES, NOT A BOOLEAN. "This registry does not know" is a distinct answer from "this
104
+ * party does not hold that role", and collapsing the first into the second turns ignorance
105
+ * into a denial. That collapse is the failure BROAD-L7 exists to name, and it is the reason
106
+ * an absence-triggered condition needs `unknown` to stay reachable. */
107
+ export const ATTESTOR_ROLE_STANDINGS = ['holds', 'does_not_hold', 'unknown'];
108
+ /** What one accepted attestation establishes about the condition at the action instant.
109
+ *
110
+ * - `occurred_by_action` the condition's instant is at or before the action instant.
111
+ * - `occurred_after_action` the condition's instant is after it. The SAME record
112
+ * establishes the condition for any later action, which is
113
+ * what makes this a wait rather than a failure.
114
+ * - `not_occurred_through_action` an accepted record states the condition had not occurred
115
+ * through an instant that reaches the action instant. */
116
+ export const ACTIVATION_FINDINGS = [
117
+ 'occurred_by_action',
118
+ 'occurred_after_action',
119
+ 'not_occurred_through_action',
120
+ ];
121
+ /** Every reason code this module emits, verdict-level and rejection-level.
122
+ *
123
+ * Module-local and SCREAMING_SNAKE_CASE, per the lifecycle-state vocabulary's rule that two
124
+ * findings sharing a verdict name must be told apart by their codes. Not minted APS
125
+ * vocabulary. */
126
+ export const ACTIVATION_REASON_CODES = [
127
+ // ── verdict-level ──
128
+ /** valid: an accepted record establishes the condition at or before the action instant, or
129
+ * a date condition's date has been reached. */
130
+ 'ACTIVATION_ESTABLISHED',
131
+ /** not_yet_effective: a date condition's activation date is after the action instant. */
132
+ 'CONDITION_DATE_NOT_REACHED',
133
+ /** not_yet_effective: an accepted record states the condition had not occurred through an
134
+ * instant reaching the action instant. */
135
+ 'CONDITION_ESTABLISHED_NOT_YET_OCCURRED',
136
+ /** not_yet_effective: an accepted record puts the condition's first occurrence after the
137
+ * action instant. No retroactive activation: the same record establishes the condition for
138
+ * a later action, and never for this one. */
139
+ 'CONDITION_FIRST_OCCURRED_AFTER_ACTION',
140
+ /** not_established, source: two accepted records disagree about the action instant. Neither
141
+ * defeats the other and this module has no precedence rule. */
142
+ 'CONDITION_EVIDENCE_CONFLICT',
143
+ /** not_established, source: accepted records exist but fewer than `threshold` of them
144
+ * support the finding. */
145
+ 'ACTIVATION_THRESHOLD_NOT_MET',
146
+ /** not_established, source: nothing was presented. */
147
+ 'NO_ATTESTATION_PRESENTED',
148
+ /** not_established, coverage: the condition presented gates a different delegation. The
149
+ * claim does not state that it covers what the verdict needed. */
150
+ 'CONDITION_DELEGATION_MISMATCH',
151
+ // ── rejection-level, in check order ──
152
+ /** source: the record's type is not one the model declared it accepts for this condition. */
153
+ 'ATTESTATION_RECORD_TYPE_NOT_ACCEPTED',
154
+ /** source: no key resolved for the record's verification method at its own `attested_at`,
155
+ * or the signature does not verify over the record's canonical bytes. */
156
+ 'ATTESTATION_SIGNATURE_UNVERIFIED',
157
+ /** source: the verification method does not belong to the attestor the body names, so a
158
+ * valid signature says nothing about who attested. */
159
+ 'ATTESTATION_ATTESTOR_BINDING_MISMATCH',
160
+ /** source: the resolver does not know whether the attestor holds the role. Ignorance, and
161
+ * deliberately not folded into a mismatch. */
162
+ 'ATTESTATION_ATTESTOR_ROLE_UNKNOWN',
163
+ /** source: the record claims a role the resolver says the attestor does not hold. */
164
+ 'ATTESTATION_ROLE_CLAIM_CONFLICT',
165
+ /** source: the attestor holds no role the condition requires. */
166
+ 'ATTESTATION_ATTESTOR_ROLE_MISMATCH',
167
+ /** source: the record's condition, event type or event id is not the condition's. */
168
+ 'ATTESTATION_CONDITION_MISMATCH',
169
+ /** source: the assertion is not one of the two this module defines, or the member that
170
+ * assertion needs is absent. */
171
+ 'ATTESTATION_UNKNOWN_ASSERTION',
172
+ /** source: an instant on the record is not an RFC 3339 instant this module will compare. */
173
+ 'ATTESTATION_INSTANT_MALFORMED',
174
+ /** coverage: a `condition_not_occurred_through` record stops before the action instant, so
175
+ * it says nothing about the interval between where it stops and the action. */
176
+ 'ATTESTATION_DOES_NOT_REACH_ACTION',
177
+ ];
178
+ /** Which establishment limb is missing when a reason code produces `not_established`.
179
+ *
180
+ * `freshness` never appears. A freshness bound is model declared, this module is given none,
181
+ * and the surface that owns multi-source status observation owns freshness. A mapping that
182
+ * invented a freshness finding would be claiming something the verifier never measured. */
183
+ export const ACTIVATION_GAPS_BY_REASON = Object.freeze({
184
+ CONDITION_DELEGATION_MISMATCH: Object.freeze(['coverage']),
185
+ ATTESTATION_DOES_NOT_REACH_ACTION: Object.freeze(['coverage']),
186
+ });
187
+ /** Thrown when a condition or a call is malformed. A shape rule broken at the call site is a
188
+ * programming error, not a verdict, which is the same split `lifecycleState` makes. Evidence
189
+ * problems are never thrown: they are verdicts. */
190
+ export class ActivationError extends Error {
191
+ code;
192
+ constructor(code, message) {
193
+ super(message);
194
+ this.name = 'ActivationError';
195
+ this.code = code;
196
+ }
197
+ }
198
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/v2/activation/types.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,sCAAsC;AACtC,EAAE;AACF,qEAAqE;AACrE,EAAE;AACF,4FAA4F;AAC5F,0FAA0F;AAC1F,uFAAuF;AACvF,yFAAyF;AACzF,4FAA4F;AAC5F,6FAA6F;AAC7F,6FAA6F;AAC7F,uDAAuD;AACvD,EAAE;AACF,wEAAwE;AACxE,6FAA6F;AAC7F,2FAA2F;AAC3F,6FAA6F;AAC7F,6FAA6F;AAC7F,2FAA2F;AAC3F,yDAAyD;AAC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BAC2B;IAC3B,8BAA8B;IAC9B,sDAAsD;IACtD,0BAA0B;IAC1B;uEACmE;IACnE,+BAA+B;IAC/B,wCAAwC;IACxC,6FAA6F;IAC7F,sCAAsC;IACtC;8EAC0E;IAC1E,kCAAkC;IAClC;2DACuD;IACvD,uCAAuC;IACvC;mDAC+C;IAC/C,mCAAmC;IACnC,qFAAqF;IACrF,iCAAiC;IACjC,iEAAiE;IACjE,oCAAoC;IACpC,qFAAqF;IACrF,gCAAgC;IAChC;qCACiC;IACjC,+BAA+B;IAC/B,4FAA4F;IAC5F,+BAA+B;IAC/B;oFACgF;IAChF,mCAAmC;CAC3B,CAAA;AAIV;;;;4FAI4F;AAC5F,MAAM,CAAC,MAAM,yBAAyB,GAElC,MAAM,CAAC,MAAM,CAAC;IAChB,6BAA6B,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,UAAU,CAAU,CAAC;IACnE,iCAAiC,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,UAAU,CAAU,CAAC;CACxE,CAAC,CAAA;AAqBF;;oDAEoD;AACpD,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAC/B,IAAI,CAAQ;IAErB,YAAY,IAAY,EAAE,OAAe;QACvC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAA;QAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;CACF"}
@@ -0,0 +1,132 @@
1
+ import type { AuthorityValidationResult, VerificationKeyResolver } from '../authority-delegation/types.js';
2
+ import type { LifecycleMappingOptions } from '../lifecycle-state/map.js';
3
+ import type { CompositeAuthorityResult } from '../lifecycle-state/types.js';
4
+ import { type ActivationAttestationV0, type ActivationConditionV0, type ActivationResult, type AttestorRoleResolver } from './types.js';
5
+ export interface ActivationVerificationInput {
6
+ /** The condition gating the grant. Shape-checked; a malformed condition throws. */
7
+ readonly condition: ActivationConditionV0;
8
+ /** The `delegation_id` of the grant being evaluated. Checked against the condition's own
9
+ * `delegation_id`, so a condition for another grant produces a verdict rather than being
10
+ * silently applied to this one. */
11
+ readonly delegationId: string;
12
+ /** The instant the action is being authorized at. RFC 3339, offset required. */
13
+ readonly actionInstant: string;
14
+ /** Presented attestations, in presentation order. Absent or empty is the "nothing
15
+ * presented" case, which is `not_established` and never `not_yet_effective`. */
16
+ readonly attestations?: readonly ActivationAttestationV0[];
17
+ /** Resolves whether an attestor held a role. Required even for a date condition, so a
18
+ * caller cannot get a date answer and then discover the event path needs plumbing it does
19
+ * not have. */
20
+ readonly resolveAttestorRole: AttestorRoleResolver;
21
+ /** Resolves the key that signed an attestation, selected at the attestation's own
22
+ * `attested_at` rather than at verification time. Same resolver shape and the same
23
+ * historical-key discipline draft-03 section 2.4 states for delegations: the key current at
24
+ * verification time is not necessarily the one that signed this record. The `issuer`
25
+ * argument receives the attestation's `attestor`. */
26
+ readonly resolveVerificationKey: VerificationKeyResolver;
27
+ /** Exact bytes a presented attestation's signature covers.
28
+ *
29
+ * Absent is the normal case: the module uses its own domain-tagged preimage
30
+ * (`activationAttestationSignatureInput`) and, because that preimage belongs to a record
31
+ * type it owns, REQUIRES `record_type` to be `ACTIVATION_ATTESTATION_TYPE`.
32
+ *
33
+ * Supplied is the escape hatch for a model that accepts condition evidence in a shape this
34
+ * module does not own. Which bytes a signature covers is a property of a record type, and
35
+ * an SDK cannot dictate the signing convention of a record type it did not define. A caller
36
+ * using it must also declare `acceptedAttestationRecordTypes`, or the module has no stated
37
+ * basis for accepting the record at all. */
38
+ readonly attestationPreimage?: (attestation: ActivationAttestationV0) => string;
39
+ /** Which attestation record types the model accepts as evidence for this condition.
40
+ * Required when `attestationPreimage` is supplied. Membership is exact string equality. */
41
+ readonly acceptedAttestationRecordTypes?: readonly string[];
42
+ }
43
+ /** Shape rules, each with the reason it exists. A condition that breaks one is a programming
44
+ * error at the caller, not a verdict about evidence, so this throws.
45
+ *
46
+ * Exported so a caller can validate a condition it received before reaching a boundary. */
47
+ export declare function validateActivationCondition(condition: ActivationConditionV0): ActivationConditionV0;
48
+ /**
49
+ * Decide whether an activation condition is established for one action at one instant.
50
+ *
51
+ * Three verdicts are reachable and `invalid` is not one of them:
52
+ *
53
+ * | situation | verdict |
54
+ * |--------------------------------------------------------------|---------------------|
55
+ * | condition established at or before the action instant | `valid` |
56
+ * | established as not met at that instant, or first met after it | `not_yet_effective` |
57
+ * | the verifier cannot tell | `not_established` |
58
+ *
59
+ * NOT ESTABLISHED IS NOT THE NEGATION OF THE CLAIM. It says the verifier could not reach a
60
+ * conclusion and names which establishment limb was missing. `not_yet_effective` says the
61
+ * verifier DID reach a conclusion and it was negative; its remedy is to wait, where
62
+ * `not_established`'s remedy is a better source. Collapsing the two throws away a decidable
63
+ * answer the verifier already had.
64
+ *
65
+ * NO RETROACTIVE ACTIVATION, KEYED ON THE CONDITION'S OWN INSTANT. A record putting the
66
+ * condition's first occurrence after the action instant leaves that action
67
+ * `not_yet_effective`, and the SAME record establishes the condition for any later action.
68
+ * What the rule keys on is the condition's instant, not the instant someone wrote the record:
69
+ * learning on Thursday that a condition was met on Monday is the normal case for any model
70
+ * built around an after-the-fact determination, and under
71
+ * `instant_basis: 'condition_occurrence'` such a record establishes the condition. A model
72
+ * that reads it the other way says so with `instant_basis: 'attestation_written'`.
73
+ *
74
+ * ORDER OF RESOLUTION, and why contradiction sits above acceptance:
75
+ *
76
+ * 1. two accepted records that disagree `not_established`, `CONDITION_EVIDENCE_CONFLICT`
77
+ * 2. `threshold` records say occurred by it `valid`
78
+ * 3. `threshold` records say not occurred `not_yet_effective`
79
+ * 4. `threshold` records say occurred after `not_yet_effective`
80
+ * 5. some accepted, fewer than `threshold` `not_established`, `ACTIVATION_THRESHOLD_NOT_MET`
81
+ * 6. none accepted `not_established`, furthest rejection reason
82
+ *
83
+ * Contradiction is evaluated on PRESENCE, not on counts. Two acceptable records that disagree
84
+ * leave the verifier unable to tell which holds, and neither is discarded in favour of the
85
+ * other: preferring the later record, or the negative one, or a majority, would each be a
86
+ * precedence rule the concept text does not state.
87
+ *
88
+ * This function reads no clock and makes no network call. `actionInstant` is a parameter.
89
+ *
90
+ * Proposed. Concept source: aeoess/agent-authority-lifecycle, invariant candidates CAND-04
91
+ * and CAND-13 (activation half) and BROAD-L7. Not required by draft-pidlisnyi-aps-03.
92
+ */
93
+ export declare function verifyActivation(input: ActivationVerificationInput): ActivationResult;
94
+ export interface ActivationCompositionOptions {
95
+ /** Passed through to `mapAuthorityValidationToLifecycle` when the chain result is reported
96
+ * in the lifecycle vocabulary.
97
+ *
98
+ * The contested reading lives here and stays the CALLER's. Both reference SDKs answer
99
+ * `invalid` with `NOT_YET_VALID` for a grant whose time facet `not_before` has not been
100
+ * reached, and that is what the chain result says. An activation-condition date at the same
101
+ * instant answers `not_yet_effective` here. One instant, two mechanisms carrying the wait,
102
+ * two answers, and the concept text does not say whether a waiting grant should be
103
+ * `invalid`, `not_yet_effective` or something else. This module does not settle it by
104
+ * default: the default keeps the chain verifier's own answer, and
105
+ * `notYetValidAsNotYetEffective: true` takes the other reading. */
106
+ readonly mapping?: LifecycleMappingOptions;
107
+ }
108
+ /**
109
+ * Report an activation result ALONGSIDE a chain result, never merged into it.
110
+ *
111
+ * Two stages, in order, and the order is the point:
112
+ *
113
+ * 1. Chain verification decides whether the grant is valid at the action instant. Its
114
+ * four-value result is returned untouched in `chain`.
115
+ * 2. Activation is asked ONLY when the chain is valid. A grant that does not verify is not a
116
+ * grant that is waiting on a condition, and reporting `not_yet_effective` for a revoked
117
+ * or unparented grant would say the remedy is to wait when it is not.
118
+ *
119
+ * This is also where CAND-13's activation half lands. A pre-committed replacement grant is an
120
+ * ordinary grant with an ordinary condition, so it needs no separate machinery here, and the
121
+ * ordering is what keeps L1 intact: if the pre-committing instrument is revoked, the
122
+ * replacement's chain is invalid and no activation evidence can make it exercisable. Nothing
123
+ * in this module can turn an invalid chain into a `valid` lifecycle verdict.
124
+ *
125
+ * `activation` may be `null`, which is how a caller says no activation module ran. The
126
+ * composite then carries only the chain's own reading.
127
+ *
128
+ * Proposed. Concept source: aeoess/agent-authority-lifecycle, invariant L1 and invariant
129
+ * candidates CAND-04 and CAND-13.
130
+ */
131
+ export declare function composeActivation(chain: AuthorityValidationResult, activation: ActivationResult | null, options?: ActivationCompositionOptions): CompositeAuthorityResult<AuthorityValidationResult>;
132
+ //# sourceMappingURL=verify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../../../src/v2/activation/verify.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,yBAAyB,EACzB,uBAAuB,EACxB,MAAM,kCAAkC,CAAA;AACzC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AAGxE,OAAO,KAAK,EACV,wBAAwB,EAEzB,MAAM,6BAA6B,CAAA;AAEpC,OAAO,EAML,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAK1B,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EAE1B,MAAM,YAAY,CAAA;AA4BnB,MAAM,WAAW,2BAA2B;IAC1C,mFAAmF;IACnF,QAAQ,CAAC,SAAS,EAAE,qBAAqB,CAAA;IACzC;;wCAEoC;IACpC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,gFAAgF;IAChF,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B;qFACiF;IACjF,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,uBAAuB,EAAE,CAAA;IAC1D;;oBAEgB;IAChB,QAAQ,CAAC,mBAAmB,EAAE,oBAAoB,CAAA;IAClD;;;;0DAIsD;IACtD,QAAQ,CAAC,sBAAsB,EAAE,uBAAuB,CAAA;IACxD;;;;;;;;;;iDAU6C;IAC7C,QAAQ,CAAC,mBAAmB,CAAC,EAAE,CAAC,WAAW,EAAE,uBAAuB,KAAK,MAAM,CAAA;IAC/E;gGAC4F;IAC5F,QAAQ,CAAC,8BAA8B,CAAC,EAAE,SAAS,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