@vess-id/ai-identity 0.0.0-dev-20260902121045

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 (173) hide show
  1. package/README.md +265 -0
  2. package/dist/agent/agent-did-manager.d.ts +97 -0
  3. package/dist/agent/agent-did-manager.d.ts.map +1 -0
  4. package/dist/auth/auth-provider.d.ts +51 -0
  5. package/dist/auth/auth-provider.d.ts.map +1 -0
  6. package/dist/auth/index.d.ts +2 -0
  7. package/dist/auth/index.d.ts.map +1 -0
  8. package/dist/client.d.ts +63 -0
  9. package/dist/client.d.ts.map +1 -0
  10. package/dist/config/index.d.ts +84 -0
  11. package/dist/config/index.d.ts.map +1 -0
  12. package/dist/constraint/constraint-evaluator.d.ts +103 -0
  13. package/dist/constraint/constraint-evaluator.d.ts.map +1 -0
  14. package/dist/constraint/index.d.ts +5 -0
  15. package/dist/constraint/index.d.ts.map +1 -0
  16. package/dist/did/agent.d.ts +58 -0
  17. package/dist/did/agent.d.ts.map +1 -0
  18. package/dist/did/did-utils.d.ts +82 -0
  19. package/dist/did/did-utils.d.ts.map +1 -0
  20. package/dist/did/key-manager.d.ts +19 -0
  21. package/dist/did/key-manager.d.ts.map +1 -0
  22. package/dist/gateway/gateway-client.d.ts +103 -0
  23. package/dist/gateway/gateway-client.d.ts.map +1 -0
  24. package/dist/gateway/index.d.ts +2 -0
  25. package/dist/gateway/index.d.ts.map +1 -0
  26. package/dist/grant/grant-manager.d.ts +140 -0
  27. package/dist/grant/grant-manager.d.ts.map +1 -0
  28. package/dist/grant/index.d.ts +2 -0
  29. package/dist/grant/index.d.ts.map +1 -0
  30. package/dist/identity/device-enroll-manager.d.ts +117 -0
  31. package/dist/identity/device-enroll-manager.d.ts.map +1 -0
  32. package/dist/identity/user-identity-manager.d.ts +123 -0
  33. package/dist/identity/user-identity-manager.d.ts.map +1 -0
  34. package/dist/identity/user-key-pair-manager.d.ts +22 -0
  35. package/dist/identity/user-key-pair-manager.d.ts.map +1 -0
  36. package/dist/index.d.mts +42685 -0
  37. package/dist/index.d.ts +57 -0
  38. package/dist/index.d.ts.map +1 -0
  39. package/dist/index.js +19534 -0
  40. package/dist/index.js.map +1 -0
  41. package/dist/index.mjs +19347 -0
  42. package/dist/index.mjs.map +1 -0
  43. package/dist/internal-signature/canonical.d.ts +80 -0
  44. package/dist/internal-signature/canonical.d.ts.map +1 -0
  45. package/dist/internal-signature/index.d.ts +17 -0
  46. package/dist/internal-signature/index.d.ts.map +1 -0
  47. package/dist/internal-signature/signer.d.ts +76 -0
  48. package/dist/internal-signature/signer.d.ts.map +1 -0
  49. package/dist/policy/cedar-engine.d.ts +334 -0
  50. package/dist/policy/cedar-engine.d.ts.map +1 -0
  51. package/dist/policy/cedar-entities.d.ts +59 -0
  52. package/dist/policy/cedar-entities.d.ts.map +1 -0
  53. package/dist/policy/decision.d.ts +46 -0
  54. package/dist/policy/decision.d.ts.map +1 -0
  55. package/dist/policy/index.d.ts +15 -0
  56. package/dist/policy/index.d.ts.map +1 -0
  57. package/dist/registry/access-orchestrator.d.ts +184 -0
  58. package/dist/registry/access-orchestrator.d.ts.map +1 -0
  59. package/dist/registry/action-aliases.d.ts +37 -0
  60. package/dist/registry/action-aliases.d.ts.map +1 -0
  61. package/dist/registry/action-input-validator.d.ts +19 -0
  62. package/dist/registry/action-input-validator.d.ts.map +1 -0
  63. package/dist/registry/action-normalizer.d.ts +47 -0
  64. package/dist/registry/action-normalizer.d.ts.map +1 -0
  65. package/dist/registry/action-registry-json.d.ts +35897 -0
  66. package/dist/registry/action-registry-json.d.ts.map +1 -0
  67. package/dist/registry/action-registry.d.ts +101 -0
  68. package/dist/registry/action-registry.d.ts.map +1 -0
  69. package/dist/registry/action-risk.d.ts +109 -0
  70. package/dist/registry/action-risk.d.ts.map +1 -0
  71. package/dist/registry/action-summary.d.ts +16 -0
  72. package/dist/registry/action-summary.d.ts.map +1 -0
  73. package/dist/registry/index.d.ts +14 -0
  74. package/dist/registry/index.d.ts.map +1 -0
  75. package/dist/registry/providers.d.ts +32 -0
  76. package/dist/registry/providers.d.ts.map +1 -0
  77. package/dist/registry/reauth-constants.d.ts +56 -0
  78. package/dist/registry/reauth-constants.d.ts.map +1 -0
  79. package/dist/registry/resource-type-labels.d.ts +15 -0
  80. package/dist/registry/resource-type-labels.d.ts.map +1 -0
  81. package/dist/registry/resource-types.d.ts +47 -0
  82. package/dist/registry/resource-types.d.ts.map +1 -0
  83. package/dist/resolver/approval-time-resolution.d.ts +72 -0
  84. package/dist/resolver/approval-time-resolution.d.ts.map +1 -0
  85. package/dist/resolver/canonical-resource-id.d.ts +37 -0
  86. package/dist/resolver/canonical-resource-id.d.ts.map +1 -0
  87. package/dist/resolver/compare-resource-id.d.ts +37 -0
  88. package/dist/resolver/compare-resource-id.d.ts.map +1 -0
  89. package/dist/resolver/salient-digest.d.ts +48 -0
  90. package/dist/resolver/salient-digest.d.ts.map +1 -0
  91. package/dist/resolver/target-resolver.d.ts +28 -0
  92. package/dist/resolver/target-resolver.d.ts.map +1 -0
  93. package/dist/state/index.d.ts +3 -0
  94. package/dist/state/index.d.ts.map +1 -0
  95. package/dist/state/json-state-store.d.ts +24 -0
  96. package/dist/state/json-state-store.d.ts.map +1 -0
  97. package/dist/state/state-store.interface.d.ts +37 -0
  98. package/dist/state/state-store.interface.d.ts.map +1 -0
  99. package/dist/storage/filesystem-key-storage.d.ts +16 -0
  100. package/dist/storage/filesystem-key-storage.d.ts.map +1 -0
  101. package/dist/storage/index.d.ts +4 -0
  102. package/dist/storage/index.d.ts.map +1 -0
  103. package/dist/storage/key-storage.interface.d.ts +42 -0
  104. package/dist/storage/key-storage.interface.d.ts.map +1 -0
  105. package/dist/storage/memory-key-storage.d.ts +17 -0
  106. package/dist/storage/memory-key-storage.d.ts.map +1 -0
  107. package/dist/tool/tool-manager.d.ts +44 -0
  108. package/dist/tool/tool-manager.d.ts.map +1 -0
  109. package/dist/types/agent.d.ts +139 -0
  110. package/dist/types/agent.d.ts.map +1 -0
  111. package/dist/types/audit.d.ts +23 -0
  112. package/dist/types/audit.d.ts.map +1 -0
  113. package/dist/types/cedar-policy.d.ts +60 -0
  114. package/dist/types/cedar-policy.d.ts.map +1 -0
  115. package/dist/types/connector-plugin.d.ts +252 -0
  116. package/dist/types/connector-plugin.d.ts.map +1 -0
  117. package/dist/types/connectors.d.ts +39 -0
  118. package/dist/types/connectors.d.ts.map +1 -0
  119. package/dist/types/context.d.ts +152 -0
  120. package/dist/types/context.d.ts.map +1 -0
  121. package/dist/types/did.d.ts +18 -0
  122. package/dist/types/did.d.ts.map +1 -0
  123. package/dist/types/errors.d.ts +24 -0
  124. package/dist/types/errors.d.ts.map +1 -0
  125. package/dist/types/grant.d.ts +522 -0
  126. package/dist/types/grant.d.ts.map +1 -0
  127. package/dist/types/index.d.ts +22 -0
  128. package/dist/types/index.d.ts.map +1 -0
  129. package/dist/types/intent.d.ts +133 -0
  130. package/dist/types/intent.d.ts.map +1 -0
  131. package/dist/types/invitation.d.ts +97 -0
  132. package/dist/types/invitation.d.ts.map +1 -0
  133. package/dist/types/jira.d.ts +348 -0
  134. package/dist/types/jira.d.ts.map +1 -0
  135. package/dist/types/oauth.d.ts +72 -0
  136. package/dist/types/oauth.d.ts.map +1 -0
  137. package/dist/types/organization.d.ts +77 -0
  138. package/dist/types/organization.d.ts.map +1 -0
  139. package/dist/types/permission-mode.d.ts +138 -0
  140. package/dist/types/permission-mode.d.ts.map +1 -0
  141. package/dist/types/permission-vc.d.ts +800 -0
  142. package/dist/types/permission-vc.d.ts.map +1 -0
  143. package/dist/types/receipt.d.ts +133 -0
  144. package/dist/types/receipt.d.ts.map +1 -0
  145. package/dist/types/target-binding.d.ts +163 -0
  146. package/dist/types/target-binding.d.ts.map +1 -0
  147. package/dist/types/tier.d.ts +13 -0
  148. package/dist/types/tier.d.ts.map +1 -0
  149. package/dist/types/vc.d.ts +213 -0
  150. package/dist/types/vc.d.ts.map +1 -0
  151. package/dist/types/vp.d.ts +25 -0
  152. package/dist/types/vp.d.ts.map +1 -0
  153. package/dist/utils/action-classifier.d.ts +13 -0
  154. package/dist/utils/action-classifier.d.ts.map +1 -0
  155. package/dist/utils/crypto.d.ts +22 -0
  156. package/dist/utils/crypto.d.ts.map +1 -0
  157. package/dist/utils/freemail-domains.d.ts +13 -0
  158. package/dist/utils/freemail-domains.d.ts.map +1 -0
  159. package/dist/utils/sdjwt-client.d.ts +415 -0
  160. package/dist/utils/sdjwt-client.d.ts.map +1 -0
  161. package/dist/utils/sdjwt-disclosure.d.ts +13 -0
  162. package/dist/utils/sdjwt-disclosure.d.ts.map +1 -0
  163. package/dist/utils/tier-utils.d.ts +15 -0
  164. package/dist/utils/tier-utils.d.ts.map +1 -0
  165. package/dist/vc/api-vc-manager.d.ts +43 -0
  166. package/dist/vc/api-vc-manager.d.ts.map +1 -0
  167. package/dist/vc/vc-manager.d.ts +55 -0
  168. package/dist/vc/vc-manager.d.ts.map +1 -0
  169. package/dist/vp/kb-jwt-builder.d.ts +89 -0
  170. package/dist/vp/kb-jwt-builder.d.ts.map +1 -0
  171. package/dist/vp/vp-manager.d.ts +75 -0
  172. package/dist/vp/vp-manager.d.ts.map +1 -0
  173. package/package.json +66 -0
@@ -0,0 +1,800 @@
1
+ /**
2
+ * Permission VC Claims Schema v2
3
+ *
4
+ * This is the CANONICAL format for Permission Verifiable Credential claims.
5
+ * All VC issuance paths MUST produce claims conforming to this schema.
6
+ * The PolicyEvaluator consumes this schema directly.
7
+ *
8
+ * Design principles:
9
+ * - Grant data is normalized into this format during VC issuance
10
+ * - PermissionRule is the atomic unit of authorization
11
+ * - Resource representation uses provider + type + id/pattern (OPA-compatible)
12
+ * - Constraints are carried per-rule for fine-grained control
13
+ * - Future OPA integration: this schema maps directly to OPA input document
14
+ */
15
+ /**
16
+ * Service provider identifier.
17
+ * @deprecated Import { CanonicalProvider, AnyProvider } from '@vess-id/ai-identity' registry instead.
18
+ * Kept for backward compatibility with existing code.
19
+ */
20
+ export type Provider = 'slack' | 'github' | 'google' | 'drive' | 'gmail' | 'jira';
21
+ /**
22
+ * Resource target within a permission rule.
23
+ *
24
+ * Separates provider from resource type (unlike Grant's combined "slack:channel").
25
+ * This enables cleaner OPA policy evaluation and avoids string-parsing at runtime.
26
+ *
27
+ * @example
28
+ * ```typescript
29
+ * // Specific channel
30
+ * { type: 'channel', id: 'C123456' }
31
+ *
32
+ * // Pattern match
33
+ * { type: 'channel', pattern: 'public-*' }
34
+ *
35
+ * // All resources of a type
36
+ * { type: 'channel', id: '*' }
37
+ *
38
+ * // All resource types for a provider
39
+ * { type: '*', id: '*' }
40
+ * ```
41
+ */
42
+ export interface PermissionResource {
43
+ /** Resource type (e.g., 'channel', 'repo', 'file', 'issue') */
44
+ type: string;
45
+ /** Specific resource ID. Use '*' for all resources of this type. */
46
+ id?: string;
47
+ /** Glob pattern for resource ID matching (e.g., 'public-*', 'team-?-dev') */
48
+ pattern?: string;
49
+ /** Tenant reference (e.g., workspace ID, org ID) */
50
+ tenant_ref?: string;
51
+ }
52
+ /**
53
+ * Time window constraint.
54
+ *
55
+ * Supports both:
56
+ * - Recurring windows (start/end HH:mm with daysOfWeek) - from Grant model
57
+ * - Absolute windows (not_before/not_after unix timestamps) - for VC-level
58
+ *
59
+ * The VC issuance layer converts Grant's recurring windows into the
60
+ * appropriate format based on context.
61
+ */
62
+ export interface PermissionTimeConstraint {
63
+ /** Absolute not-before (unix timestamp) */
64
+ not_before?: number;
65
+ /** Absolute not-after (unix timestamp) */
66
+ not_after?: number;
67
+ /** Recurring: allowed time start (HH:mm, UTC unless timezone specified) */
68
+ recurring_start?: string;
69
+ /** Recurring: allowed time end (HH:mm, UTC unless timezone specified) */
70
+ recurring_end?: string;
71
+ /** Recurring: allowed days of week (0=Sun, 1=Mon...6=Sat) */
72
+ days_of_week?: number[];
73
+ /** Timezone for recurring constraints (default: 'UTC') */
74
+ timezone?: string;
75
+ }
76
+ /**
77
+ * Rule-level constraints embedded in each PermissionRule.
78
+ *
79
+ * These are evaluated at policy decision time and support both
80
+ * Grant-originated constraints and VC-specific constraints.
81
+ */
82
+ export interface PermissionConstraints {
83
+ /** Time constraints */
84
+ time?: PermissionTimeConstraint;
85
+ /** Maximum invocations for this specific rule */
86
+ max_invocations?: number;
87
+ /** Rate limiting (requests per minute) */
88
+ rate_limit_per_min?: number;
89
+ /** Allowed IP ranges (CIDR notation) */
90
+ ip_allowlist?: string[];
91
+ /** Maximum risk score threshold (0-100) */
92
+ risk_threshold?: number;
93
+ /** Purpose description (for audit trail) */
94
+ purpose?: string;
95
+ /** Scope constraints (provider-specific, e.g., { thread_id: 'T123' }) */
96
+ scope?: Record<string, unknown>;
97
+ /**
98
+ * Target constraints for secondary destinations (cc, attendees, etc.).
99
+ * Alpha: defined but NOT evaluated by ConstraintEvaluator.
100
+ * Future: evaluated against PolicyInput.request.targets.
101
+ */
102
+ targets?: import('./target-binding').TargetConstraint[];
103
+ }
104
+ /**
105
+ * Inline policy mode — full Cedar policy embedded in the VC.
106
+ *
107
+ * Used for sub-agent re-delegation where the verifier cannot reach the
108
+ * Policy Registry over the network. The inline policy is authoritative;
109
+ * `policy_hash` is a sanity check for tamper-evidence.
110
+ *
111
+ * Spec refs:
112
+ * - docs/specs/2026-05-23-cedar-rar-permission-redesign.md §3.2
113
+ */
114
+ export interface PolicyRefInline {
115
+ mode: 'inline';
116
+ /** Full Cedar policy source (PolicySet text, UTF-8). */
117
+ policy_inline: string;
118
+ /** sha256 of `policy_inline` (hex), prefixed `sha256-` for tamper-evidence. */
119
+ policy_hash: string;
120
+ /**
121
+ * Cedar schema fragment id. **Phase 1 unused** (Cedar wasm schema-less
122
+ * evaluation, Implementation plan §1.1). **Phase 2+ で per-policy schema
123
+ * 切替時に inline モードでは REQUIRED 化** (reference モードは Registry
124
+ * resolve で取得できるため optional のまま).
125
+ */
126
+ schema_id?: string;
127
+ /**
128
+ * Policy engine that authored / evaluates this document. Omitted ⇒ `cedar`
129
+ * (historical default — all pre-Plan-B refs are Cedar and MUST stay wire-
130
+ * identical). Corresponds to the Policy Registry `engine` column (Plan B
131
+ * Task 1). Non-cedar engines (e.g. `'scheduling-delegation/v1'`) carry a
132
+ * non-Cedar `policy_inline` body and skip Cedar lint.
133
+ */
134
+ engine?: string;
135
+ }
136
+ /**
137
+ * Reference policy mode — policy lives in the Policy Registry.
138
+ *
139
+ * The verifier fetches `policy_uri` (must match the issuer's
140
+ * `/.well-known/policy-registry/:policy_id`), validates `policy_hash`,
141
+ * and evaluates the fetched Cedar policy.
142
+ *
143
+ * Spec refs:
144
+ * - docs/specs/2026-05-23-cedar-rar-permission-redesign.md §3.2
145
+ */
146
+ export interface PolicyRefReference {
147
+ mode: 'reference';
148
+ /** Policy Registry id. Format: `pol_<project_id>_<uuidv7>`. */
149
+ policy_id: string;
150
+ /** Absolute URL to `/.well-known/policy-registry/:policy_id`. */
151
+ policy_uri: string;
152
+ /** sha256 of the served Cedar policy text (hex), prefixed `sha256-`. */
153
+ policy_hash: string;
154
+ /**
155
+ * Cedar schema fragment id. Phase 1 unused (Registry resolve で取得可能、
156
+ * schema-less evaluation を使う簡易構成)。Phase 2+ で per-policy schema を
157
+ * 導入したときも reference モードは引き続き OPTIONAL — VC payload に
158
+ * 同梱せず Registry 側で resolve する方針。
159
+ */
160
+ schema_id?: string;
161
+ /**
162
+ * Policy engine that authored / evaluates the referenced document. Omitted ⇒
163
+ * `cedar` (historical default — all pre-Plan-B refs are Cedar and MUST stay
164
+ * wire-identical). Corresponds to the Policy Registry `engine` column (Plan B
165
+ * Task 1); the served `/.well-known/policy-registry/:id` document declares the
166
+ * same value. Non-cedar engines (e.g. `'scheduling-delegation/v1'`) resolve to
167
+ * a non-Cedar body and skip Cedar lint.
168
+ */
169
+ engine?: string;
170
+ }
171
+ /**
172
+ * Tagged union of policy reference shapes. Discriminator: `mode`.
173
+ *
174
+ * Use {@link isPolicyRefInline} / {@link isPolicyRefReference} for runtime
175
+ * narrowing.
176
+ */
177
+ export type PolicyRef = PolicyRefInline | PolicyRefReference;
178
+ /** Type guard for {@link PolicyRefInline}. */
179
+ export declare function isPolicyRefInline(ref: PolicyRef): ref is PolicyRefInline;
180
+ /** Type guard for {@link PolicyRefReference}. */
181
+ export declare function isPolicyRefReference(ref: PolicyRef): ref is PolicyRefReference;
182
+ /**
183
+ * Permission Rule - the atomic unit of authorization.
184
+ *
185
+ * Each rule grants specific actions on specific resources for a specific provider.
186
+ * Rules are evaluated independently during policy evaluation.
187
+ *
188
+ * Phase 1 (Cedar + RAR redesign) extensions:
189
+ * - `effect` widened from `'allow'` only to the 3-valued
190
+ * `'allow' | 'deny' | 'require_approval'` (spec §5).
191
+ * Existing call-sites that only used `'allow'` remain source-compatible.
192
+ * - `priority` field added (optional, used for deterministic ordering when
193
+ * multiple rules match the same request).
194
+ * - `policy_ref` field added (optional in Phase 1 for backward-compat
195
+ * during migration; Phase 2+ will bump the schema to v3.1 and make it
196
+ * required — see spec §3.1 reconciliation note).
197
+ *
198
+ * OPA mapping (legacy `'allow'`-only path, still used while
199
+ * `CEDAR_POLICY_ENABLED != enforce`):
200
+ * ```rego
201
+ * allow {
202
+ * some rule in input.credentials.delegates
203
+ * rule.effect == "allow"
204
+ * rule.provider == input.request.provider
205
+ * glob.match(rule.resource.type, [], input.request.resource.type)
206
+ * resource_id_matches(rule.resource, input.request.resource.id)
207
+ * action_matches(rule.actions, input.request.action)
208
+ * constraints_satisfied(rule.constraints, input.environment)
209
+ * }
210
+ * ```
211
+ */
212
+ export interface PermissionRule {
213
+ /** Rule identifier (for audit trail and matched_rule_id) */
214
+ id?: string;
215
+ /**
216
+ * Effect. Phase 1 widens this beyond legacy `'allow'`-only:
217
+ * - `'allow'` — permit the action (legacy default).
218
+ * - `'deny'` — explicit deny (override precedence over allow).
219
+ * - `'require_approval'` — pause and request human approval.
220
+ */
221
+ effect: 'allow' | 'deny' | 'require_approval';
222
+ /**
223
+ * Optional priority for deterministic ordering when multiple rules match.
224
+ * Higher priority wins. Phase 1 evaluator behaviour is unchanged when
225
+ * `priority` is absent.
226
+ */
227
+ priority?: number;
228
+ /** Service provider */
229
+ provider: Provider | string;
230
+ /** Target resource */
231
+ resource: PermissionResource;
232
+ /** Allowed actions (e.g., ['post_message', 'read_history']). '*' for all. */
233
+ actions: string[];
234
+ /** Rule-level constraints */
235
+ constraints?: PermissionConstraints;
236
+ /**
237
+ * RAR authorization-details type (RFC 9396 §2), carried verbatim (#952).
238
+ *
239
+ * A free-form URN naming the kind of authorization this delegate represents,
240
+ * for consumers that speak RAR. Deliberately unvalidated: the registry of
241
+ * types belongs to whoever issues them, and rejecting an unrecognised URN
242
+ * here would make this service the gatekeeper of a vocabulary it does not
243
+ * own.
244
+ *
245
+ * NOT an authorization input. Gate-2 authorises on `provider`, `actions`,
246
+ * `resource.type` and `resource.id`; a credential must not be able to widen
247
+ * or narrow what it may do by naming a type. Note how close this sits to
248
+ * `resource.type`, which Gate-2 *does* read — the two are one level apart
249
+ * and the format is unchecked, so a line reaching for the wrong one would
250
+ * not be caught by the compiler or at runtime. Pinned in
251
+ * `gate2-fast-path.spec.ts` ("delegates[].type is inert at Gate-2").
252
+ */
253
+ type?: string;
254
+ /**
255
+ * Cedar policy binding (Phase 1).
256
+ *
257
+ * When present, the policy engine evaluates this delegate via the
258
+ * referenced / inlined Cedar policy in addition to the static constraint
259
+ * check. Optional in Phase 1 for backward-compat during migration; Phase
260
+ * 2+ will bump the schema to v3.1 and make it required.
261
+ */
262
+ policy_ref?: PolicyRef;
263
+ /**
264
+ * Cedar policy bindings (複数) — 1 つの委任スコープに複数の policy が AND/OR
265
+ * で適用されるケース (例: calendarDomain 宛先制約 + timeWindow forbid)。
266
+ * 後方互換のため単数 `policy_ref` は維持し、発行時は `policy_refs[0]` を
267
+ * ミラーする。読み手は policy_refs を優先し、無ければ policy_ref を単要素配列に
268
+ * 正規化する。Cedar 評価では全 ref を 1 つの PolicySet に集約 (permit=OR,
269
+ * forbid=override で AND)。
270
+ */
271
+ policy_refs?: PolicyRef[];
272
+ }
273
+ /**
274
+ * Permission VC Claims v2 — the pre-Cedar canonical credential claims format.
275
+ *
276
+ * This is what gets signed into the SD-JWT VC. All VC issuance paths
277
+ * (VCService, RemoteVCIssuerService, PermissionVCManager) MUST produce
278
+ * claims conforming to either this interface or {@link PermissionVcClaims_V3}.
279
+ *
280
+ * The Grant → VC normalization layer converts:
281
+ * - GrantResource[] + actions[] → PermissionRule[]
282
+ * - GrantConstraints → PermissionConstraints (per-rule)
283
+ * - Grant metadata → top-level claims fields
284
+ *
285
+ * @remarks Phase 1 Step 2 renamed the original `PermissionVcClaims` to
286
+ * `PermissionVcClaims_V2`. The exported alias {@link PermissionVcClaims}
287
+ * is now a union of V2 + {@link PermissionVcClaims_V3}, preserving
288
+ * existing import sites (they will accept both shapes).
289
+ */
290
+ export interface PermissionVcClaims_V2 {
291
+ /** Schema version */
292
+ v: '2';
293
+ /** Credential type discriminator */
294
+ type: 'PermissionCredential';
295
+ /** Issuer DID (user who granted permission) */
296
+ iss: string;
297
+ /** Subject DID (agent receiving permission) */
298
+ sub: string;
299
+ /** Issued at (unix timestamp) */
300
+ iat: number;
301
+ /** Not before (unix timestamp) */
302
+ nbf?: number;
303
+ /** Expiration (unix timestamp) */
304
+ exp: number;
305
+ /** JWT ID (unique credential identifier) */
306
+ jti: string;
307
+ /** Project ID */
308
+ project_id: string;
309
+ /** User ID (grant owner) */
310
+ user_id?: string;
311
+ /** User DID (grant owner) */
312
+ user_did?: string;
313
+ /** Source grant IDs (supports multiple grants aggregated into one VC) */
314
+ grant_ids: string[];
315
+ /**
316
+ * Primary grant ID (derived from grant_ids[0]).
317
+ * @deprecated Use grant_ids instead. Kept for backward-compat JWT claims.
318
+ * Always set via {@link buildGrantIdFields} to keep both fields in sync.
319
+ */
320
+ grant_id: string;
321
+ /** Session ID (binds VC to specific session) */
322
+ session_id: string;
323
+ /** Parent JWT ID for re-delegation chain (not supported in MVP) */
324
+ parent_jti?: string;
325
+ /** Confirmation (Proof of Possession binding) */
326
+ cnf?: {
327
+ /** JWK for Proof of Possession (SD-JWT KB-JWT standard) */
328
+ jwk: Record<string, unknown>;
329
+ };
330
+ /** Delegated permission rules (the core authorization data) */
331
+ delegates: PermissionRule[];
332
+ }
333
+ /**
334
+ * Permission VC Claims v3 — Cedar + RAR Phase 1 schema.
335
+ *
336
+ * Inherits all V2 fields and adds two Phase-1-aware extensions:
337
+ * - `cedar_schema_ref?` — pointer to the Cedar schema fragment the
338
+ * delegates were authored against. **Phase 1 unused** (the SDK ships a
339
+ * single global schema fragment generated by connector-plugin codegen,
340
+ * per Implementation plan §1.1). Reserved for Phase 2+ per-policy schema
341
+ * switching.
342
+ * - `layer?` — chain hierarchy layer. **Phase 2+ only**; Phase 1 issuance
343
+ * pins this to `'agent_permission'` via {@link buildPhase1VcClaims}.
344
+ * Direct assignment is discouraged (ESLint rule planned in Step 5).
345
+ *
346
+ * Spec refs:
347
+ * - docs/specs/2026-05-23-cedar-rar-permission-redesign.md §3.1
348
+ * - docs/specs/2026-05-23-cedar-rar-implementation-plan-phase1.md Task 2.1 / 2.5
349
+ */
350
+ /**
351
+ * Bug B 真因修正 (β, 2026-05-28) — VC=mandate semantic を invoke 時 Cedar も
352
+ * 信じるため、approval の事実 (誰がいつ何を approve したか) を VC に焼き込む
353
+ * signed self-attestation。SD-protected (`_sd` 経由 disclosure)、SD-JWT 署名で
354
+ * 改竄不可。invoke 時 Cedar context.approval の最優先 source として採用。
355
+ *
356
+ * Forward compat: A2A AP2 Mandate (IntentMandate / CartMandate / PaymentMandate)
357
+ * との projection は Phase 2 spec で別途定義。本 field 名は内部
358
+ * ApprovalContext (snake_case) と一貫。
359
+ *
360
+ * Spec ref: docs/superpowers/plans/2026-05-28-bug-b-fix-beta-vc-embed-approval.md
361
+ */
362
+ export interface VcApprovalClaim {
363
+ /** `req_<uuid>` — 元 approval-request id (claimVC 元 request の id)。 */
364
+ request_id: string;
365
+ /** `outcome_<uuid>` — APPROVAL_OUTCOME audit event id (§11.1 join key)。 */
366
+ outcome_id: string;
367
+ /** approver の user id、または 'system' (auto-approve 経路)。最大 128 chars。 */
368
+ granted_by: string;
369
+ /** ISO-8601 timestamp of the approval action. */
370
+ granted_at: string;
371
+ /**
372
+ * #884 Task 5 (INV-4) — the concrete CANONICAL resource id the approval
373
+ * applied to (e.g. `'octocat/repo'`, `'C0123ABC'`). NAMES the tuple the
374
+ * approver actually consented to so the issued VC records WHAT was approved,
375
+ * not merely THAT something was. Optional for backward compatibility:
376
+ * absent for base-path / legacy approvals that selected no concrete resource.
377
+ */
378
+ resource_id?: string;
379
+ /**
380
+ * #884 Task 5 — the action the approval applied to (e.g.
381
+ * `'github.issue.update'`). Pairs with {@link resource_id} to fully name the
382
+ * approved (action, resource) tuple. Optional for backward compatibility.
383
+ */
384
+ action?: string;
385
+ /**
386
+ * #1205 P1 (decision-bound authorization) — `sha256:` hex of the
387
+ * canonicalized approved salient params. Binds the issued VC to the CONCRETE
388
+ * parameter values the approver consented to, so a caller cannot execute with
389
+ * different (e.g. tampered `body`/`to`) parameters under the same approval.
390
+ * Computed at claimVC (Step 4) from the final persisted `actionParams`;
391
+ * verified fail-closed at the PEP (Step 5). Absent on legacy VCs and on
392
+ * actions that declare no salient set.
393
+ */
394
+ params_hash?: string;
395
+ }
396
+ /**
397
+ * Scheduling Wow Phase 1 §5.3 (Task 7) — the delegation-policy snapshot baked
398
+ * into a VC that was AUTO-ISSUED (no human approval) because the invocation
399
+ * fell entirely inside the user's advance scheduling-delegation policy.
400
+ *
401
+ * Audit evidence: names WHAT standing authority the auto-issuance relied on
402
+ * ("何を根拠に自動実行されたか"), so a verifier / auditor can reconstruct the
403
+ * decision without the DB row (which may have been edited since). It is NOT
404
+ * read by any enforcement gate — resource_id / delegates semantics (#884
405
+ * canonical resource checks) are unchanged.
406
+ *
407
+ * SD-protected (disclosed via `_sd`) because `contactScope` can contain
408
+ * third-party emails/domains.
409
+ *
410
+ * Item binding (Tasks 9-11, spec §5.3): the optional {@link
411
+ * VcSchedulingDelegationClaim.itemId} names which negotiation an automated
412
+ * calendar write belonged to. It is ABSENT on `scheduling.request` issuances
413
+ * (at that gate the item does not exist yet — it is created by the request
414
+ * pipeline AFTER the VC gate, so there is nothing to bind) and PRESENT on the
415
+ * confirm (§7) and tentative-hold (§6) issuance contexts, which operate on a
416
+ * concrete item.
417
+ */
418
+ export interface VcSchedulingDelegationClaim {
419
+ /** The policy's allowed weekly window at issuance time. */
420
+ timeWindow: {
421
+ /** Allowed weekdays, 0 (Sun) – 6 (Sat). */
422
+ daysOfWeek: number[];
423
+ /** 'HH:mm' wall-clock window start (policy timezone). */
424
+ windowStart: string;
425
+ /** 'HH:mm' wall-clock window end (policy timezone). */
426
+ windowEnd: string;
427
+ /** IANA timezone the window is judged in (e.g. 'Asia/Tokyo'). */
428
+ timezone: string;
429
+ };
430
+ /** Upper bound on meeting duration (minutes) the policy allowed. */
431
+ maxDurationMinutes: number;
432
+ /** Counterpart scope the policy allowed. null = no restriction. */
433
+ contactScope: {
434
+ emails: string[];
435
+ domains: string[];
436
+ } | null;
437
+ /** ISO-8601 expiry of the delegation policy itself at issuance time. */
438
+ policyExpiresAt: string;
439
+ /**
440
+ * Scheduling Wow Phase 1 (Tasks 9-11, spec §5.3) — the inbox item id the
441
+ * automated calendar write belonged to. ADDITIVE / OPTIONAL: absent on
442
+ * `scheduling.request` issuances (the item does not exist yet at that gate),
443
+ * present on the confirm (§7) and tentative-hold (§6) issuance contexts,
444
+ * which DO operate on a concrete item and bind it so the audit evidence names
445
+ * which negotiation the write was for.
446
+ */
447
+ itemId?: string;
448
+ /**
449
+ * Scheduling Phase 2 §A / Plan A' (Task A6, spec §7 / §8.3) — the id of the
450
+ * standing booking link this automated calendar write was booked THROUGH. Present
451
+ * on the pull-type booking confirm path (a visitor 1-clicks a slot from an
452
+ * owner's booking link); ADDITIVE / OPTIONAL — absent on the push-type
453
+ * `scheduling.request` / confirm (§7) / hold (§6) contexts, which have no link.
454
+ *
455
+ * AUDIT-ONLY, same principle as the rest of this claim: no enforcement gate
456
+ * reads it. The audit evidence names which booking link the write belonged to
457
+ * so an auditor can reconstruct the standing pull-type authority; invoke-time
458
+ * authorization is unaffected (#884 unchanged).
459
+ */
460
+ linkId?: string;
461
+ /**
462
+ * Scheduling Phase 2 Plan B (Task 3 bakes this) — the Policy Registry id of
463
+ * the signed delegation-policy document the auto-issuance relied on. Lets an
464
+ * auditor fetch the exact JWS-signed `/.well-known/policy-registry/:id`
465
+ * document that this snapshot was derived from, instead of trusting the
466
+ * inline snapshot alone. ADDITIVE / OPTIONAL: absent on legacy rows minted
467
+ * before Plan B (which have no registry document).
468
+ *
469
+ * AUDIT-ONLY, same principle as the rest of this claim: no enforcement gate
470
+ * reads it. At invoke time the delegation is re-evaluated against the LIVE
471
+ * policy row + actual request parameters — the VC claim is never trusted as
472
+ * an authorization source (#884 canonical resource checks unchanged).
473
+ */
474
+ policyRegistryId?: string;
475
+ /**
476
+ * Scheduling Phase 2 Plan B (Task 3 bakes this) — `sha256-` prefixed hash of
477
+ * the canonical policy body the {@link policyRegistryId} document was minted
478
+ * with. Tamper-evidence linking this snapshot to that exact document version.
479
+ * ADDITIVE / OPTIONAL: absent on legacy rows minted before Plan B.
480
+ *
481
+ * AUDIT-ONLY, same principle as the rest of this claim: no enforcement gate
482
+ * reads it. Invoke-time evaluation trusts the live policy row + actual
483
+ * parameters, never the VC claim (#884 unchanged).
484
+ */
485
+ policyHash?: string;
486
+ }
487
+ export interface PermissionVcClaims_V3 extends Omit<PermissionVcClaims_V2, 'v'> {
488
+ /** Schema version — v3 adds Cedar policy_ref support and chain hierarchy fields. */
489
+ v: '3';
490
+ /**
491
+ * Cedar schema fragment reference (Phase 2+ per-policy schema switching).
492
+ * Phase 1: unused; SDK uses connector-plugin codegen global schema.
493
+ */
494
+ cedar_schema_ref?: {
495
+ /** e.g. `cedar_schema_2026_05_23_v1`. */
496
+ schema_id: string;
497
+ /** sha256 of the schema fragment (hex). */
498
+ schema_hash: string;
499
+ };
500
+ /**
501
+ * 4-layer chain (Org Policy → User Grant → Agent Permission → Sub-Agent Delegation).
502
+ * Phase 1 では `buildPhase1VcClaims()` factory 経由で `'agent_permission'` が固定セットされる。
503
+ * Phase 2+ では本フィールドを **required** に格上げする予定 (V3.1 schema)。
504
+ * 直接代入は禁止 (Phase 1 では factory を使うこと、Phase 2+ では ESLint rule で強制)。
505
+ * 詳細: design spec §3.1, §6.1 / Phase 1 plan Task 2.5。
506
+ */
507
+ layer?: 'org_policy' | 'user_grant' | 'agent_permission' | 'sub_agent_delegation';
508
+ /**
509
+ * Bug B 真因修正 (β, 2026-05-28) — approval メタを VC に焼き込む。
510
+ * VC=mandate なので「この VC が発行されたこと自体が approve の証拠」だが、
511
+ * invoke 時 Cedar に `context.approval.granted == true` を渡せるよう
512
+ * back-ref を明示。本 field 不在 = base path (legacy 互換、Cedar は token-
513
+ * ledger 経由 fallback)。{@link VcApprovalClaim} 参照。
514
+ */
515
+ approval?: VcApprovalClaim;
516
+ /**
517
+ * Scheduling Wow Phase 1 §5.3 (Task 7) — present ONLY when the VC was
518
+ * auto-issued under the user's advance scheduling-delegation policy
519
+ * (scheduling.request / confirm / hold contexts). Absent on every other
520
+ * issuance path (manual approval, Cedar permit, legacy). Audit-only:
521
+ * no enforcement gate reads it. {@link VcSchedulingDelegationClaim}.
522
+ */
523
+ schedulingDelegation?: VcSchedulingDelegationClaim;
524
+ /**
525
+ * How this credential came to exist (#954).
526
+ *
527
+ * - `'user_approved'` — a person consented. Paired with {@link approval},
528
+ * which carries the back-reference to the approval request and outcome.
529
+ * - `'auto_issued'` — consent was given on the user's behalf: a Cedar
530
+ * permit, an advance delegation policy, or a signup funnel.
531
+ * - `'unrecorded'` — provenance is genuinely unknown. Credentials issued
532
+ * before the consent type was recorded, and any path where no approval
533
+ * assertion reaches the issuer, land here.
534
+ *
535
+ * Derived from the approval's `consent_type` — HOW the consent was
536
+ * obtained — and never from `granted_by`, which records WHO. Those come
537
+ * apart in practice: booking start writes `granted_by: 'system'` for both
538
+ * an explicit human click and an automatic funnel, because the visitor's
539
+ * identity is gone by the time the credential is issued.
540
+ *
541
+ * The third value is not a placeholder to be tidied away later. Guessing
542
+ * between the other two would fabricate audit data, and this claim is
543
+ * signed — it cannot be corrected once issued.
544
+ *
545
+ * Never taken from the request: `approvalAssertion` is an internal-only
546
+ * extension on `issueVC` precisely so this stays true (see the comment on
547
+ * `IssueVCRequestDto`).
548
+ *
549
+ * Optional, and permanently so. The type describes credentials that are
550
+ * already signed and in circulation; those cannot be re-issued to carry a
551
+ * new field, so a required one would invalidate them at the type layer.
552
+ * Absent means "issued before #954", not "auto-issued".
553
+ *
554
+ * Audit and disclosure metadata — no gate reads it to decide anything. If a
555
+ * gate ever should, the decision belongs in policy, against `approval`,
556
+ * rather than against a label the issuer wrote about itself.
557
+ */
558
+ issuance_mode?: 'user_approved' | 'auto_issued' | 'unrecorded';
559
+ /**
560
+ * Why this credential was requested, in the requester's own words (#955).
561
+ *
562
+ * Free text, deliberately. Narrowing it to a vocabulary would turn a
563
+ * description into a decision input, and Phase 1 neither records nor
564
+ * evaluates it (DEV-INSTRUCTIONS §256) — no gate reads it, and none should
565
+ * without that being a decision someone makes on purpose.
566
+ *
567
+ * SD-protected at issuance. Natural language written by a person tends to
568
+ * name people, accounts and circumstances, so a verifier gets it only when
569
+ * the holder chooses to disclose it. Keep it out of audit logs and error
570
+ * messages for the same reason.
571
+ *
572
+ * Optional, and permanently so: the type describes credentials already
573
+ * signed and in circulation, which cannot be re-issued to carry a new
574
+ * field.
575
+ */
576
+ intent_description?: string;
577
+ }
578
+ /**
579
+ * Permission VC Claims (canonical union of v2 + v3).
580
+ *
581
+ * All existing import sites referencing `PermissionVcClaims` continue to
582
+ * compile because:
583
+ * - Code that only produced V2 still produces a value assignable to the
584
+ * union.
585
+ * - Code that consumes the union can narrow on `claims.v === '3'` to
586
+ * access V3-only fields.
587
+ */
588
+ export type PermissionVcClaims = PermissionVcClaims_V2 | PermissionVcClaims_V3;
589
+ /**
590
+ * Build synchronized grant_id / grant_ids fields for PermissionVcClaims.
591
+ * Guarantees grant_id === grant_ids[0].
592
+ */
593
+ export declare function buildGrantIdFields(grantIds: string[]): {
594
+ grant_ids: string[];
595
+ grant_id: string;
596
+ };
597
+ /**
598
+ * Policy evaluation input document.
599
+ *
600
+ * Designed to map 1:1 to OPA input document for future integration:
601
+ * ```rego
602
+ * package aidentity.authz
603
+ *
604
+ * default allow = false
605
+ *
606
+ * allow {
607
+ * some rule in input.credentials.delegates
608
+ * rule_matches(rule, input.request)
609
+ * constraints_ok(rule.constraints, input.environment)
610
+ * }
611
+ * ```
612
+ */
613
+ export interface PolicyInput {
614
+ /** Subject (who is requesting) */
615
+ subject: {
616
+ /** Agent DID */
617
+ agent_did: string;
618
+ /** Session ID */
619
+ session_id: string;
620
+ /** User DID (delegator) */
621
+ user_did?: string;
622
+ };
623
+ /** Tenant context */
624
+ tenant: {
625
+ /** Project ID */
626
+ project_id: string;
627
+ };
628
+ /** Request details (what is being requested) */
629
+ request: {
630
+ /** Service provider */
631
+ provider: string;
632
+ /** Action to perform */
633
+ action: string;
634
+ /** Target resource */
635
+ resource: {
636
+ type: string;
637
+ id: string;
638
+ /** Tenant/workspace reference for multi-account disambiguation (future) */
639
+ tenant_ref?: string;
640
+ };
641
+ /** Secondary targets extracted from tool parameters via TargetResolver */
642
+ targets?: import('./target-binding').PolicyTarget[];
643
+ /** Raw tool parameters (for OPA custom policies) */
644
+ params?: Record<string, unknown>;
645
+ };
646
+ /** Credential information (from VC) */
647
+ credentials: {
648
+ /** JWT ID */
649
+ jti: string;
650
+ /** Source grant IDs */
651
+ grant_ids: string[];
652
+ /** Primary grant ID */
653
+ grant_id: string;
654
+ /** Issued at timestamp */
655
+ issued_at: number;
656
+ /** Expiration timestamp */
657
+ expires_at: number;
658
+ /** Delegated permission rules from VC */
659
+ delegates: PermissionRule[];
660
+ };
661
+ /** Environment context (evaluated at request time) */
662
+ environment: {
663
+ /** Current timestamp (unix) */
664
+ now: number;
665
+ /** Client IP address */
666
+ ip_address?: string;
667
+ /** Risk score (0-100) */
668
+ risk_score?: number;
669
+ /** Current invocation count for the grant */
670
+ invocation_count?: number;
671
+ };
672
+ }
673
+ /**
674
+ * Policy evaluation result
675
+ */
676
+ export interface PolicyEvaluationResult {
677
+ /** Whether the action is allowed */
678
+ allowed: boolean;
679
+ /** Denial reason if not allowed */
680
+ reason?: string;
681
+ /** Error code for programmatic handling */
682
+ reason_code?: string;
683
+ /** Matched rule ID (if allowed) */
684
+ matched_rule_id?: string;
685
+ /** Which evaluation step failed (for debugging) */
686
+ step_failed?: string;
687
+ }
688
+ /**
689
+ * External Action Request - normalized format for tool invocations.
690
+ * Used as the bridge between MCP tool calls and policy evaluation.
691
+ */
692
+ export interface ExternalActionRequest {
693
+ /** Request ID for idempotency */
694
+ request_id: string;
695
+ /** Service provider */
696
+ provider: Provider | string;
697
+ /** Action to perform */
698
+ action: string;
699
+ /** Target resource */
700
+ resource: {
701
+ type: string;
702
+ id: string;
703
+ };
704
+ /** Project ID */
705
+ project_id: string;
706
+ /** Session ID */
707
+ session_id: string;
708
+ /** Action parameters (sanitized) */
709
+ params?: Record<string, unknown>;
710
+ }
711
+ /**
712
+ * Parsed provider and resource type from a Grant's combined resource type string.
713
+ *
714
+ * Grant uses "slack:channel" format, but VC uses separate provider + resource.type.
715
+ * This interface represents the parsed result.
716
+ */
717
+ export interface ParsedResourceType {
718
+ provider: string;
719
+ resourceType: string;
720
+ }
721
+ /**
722
+ * Parse a Grant resource type string into provider and resource type.
723
+ *
724
+ * @example
725
+ * parseGrantResourceType('slack:channel') // { provider: 'slack', resourceType: 'channel' }
726
+ * parseGrantResourceType('github:repo') // { provider: 'github', resourceType: 'repo' }
727
+ * parseGrantResourceType('slack') // { provider: 'slack', resourceType: '*' }
728
+ * parseGrantResourceType('*') // { provider: '*', resourceType: '*' }
729
+ */
730
+ export declare function parseGrantResourceType(grantType: string): ParsedResourceType;
731
+ /**
732
+ * Parse a Grant action string into provider and action.
733
+ *
734
+ * Grant actions use "provider.resource.operation" (dot format, canonical) or
735
+ * legacy "provider:resource.operation" (colon format).
736
+ * This extracts the provider prefix and the action name.
737
+ *
738
+ * @example
739
+ * parseGrantAction('slack.message.read') // { provider: 'slack', action: 'message.read' }
740
+ * parseGrantAction('slack:channel.post_message') // { provider: 'slack', action: 'channel.post_message' }
741
+ * parseGrantAction('*') // { provider: '*', action: '*' }
742
+ */
743
+ export declare function parseGrantAction(grantAction: string): {
744
+ provider: string;
745
+ action: string;
746
+ };
747
+ /**
748
+ * The single layer value Phase 1 VC issuance is allowed to emit.
749
+ *
750
+ * companion design spec §3.1 defines a 4-layer enum
751
+ * (`'org_policy' | 'user_grant' | 'agent_permission' | 'sub_agent_delegation'`),
752
+ * but Phase 1 only issues at the `agent_permission` layer. The other 3
753
+ * layers unlock in Phase 2+.
754
+ *
755
+ * Spec refs:
756
+ * - docs/specs/2026-05-23-cedar-rar-implementation-plan-phase1.md Task 2.5 (rev 5)
757
+ * - docs/specs/2026-05-23-cedar-rar-permission-redesign.md §3.1 Phase 1 layer 固定 note
758
+ */
759
+ export declare const PHASE_1_VC_LAYER: "agent_permission";
760
+ /** Literal type of {@link PHASE_1_VC_LAYER}. */
761
+ export type Phase1VcLayer = typeof PHASE_1_VC_LAYER;
762
+ /**
763
+ * Build a {@link PermissionVcClaims_V3} object with `layer` pinned to
764
+ * {@link PHASE_1_VC_LAYER} (`'agent_permission'`).
765
+ *
766
+ * **This factory is mandatory for Phase 1 VC issuance.** Direct assignment
767
+ * of `layer` on a V3 claims literal is discouraged and will be guarded by
768
+ * an ESLint rule once Step 5 wires usage in
769
+ * `packages/api/src/grant/services/remote-vc-issuer.service.ts`. Phase 2+
770
+ * will relax or delete this factory when the other 3 layers unlock.
771
+ *
772
+ * The input `base` type explicitly omits `layer` so passing it is a
773
+ * compile-time error — guaranteeing call-sites cannot accidentally
774
+ * smuggle a non-Phase-1 layer value through.
775
+ *
776
+ * @example
777
+ * ```ts
778
+ * import { buildPhase1VcClaims } from '@vess-id/ai-identity'
779
+ *
780
+ * const claims = buildPhase1VcClaims({
781
+ * v: '3',
782
+ * type: 'PermissionCredential',
783
+ * iss: userDid,
784
+ * sub: agentDid,
785
+ * iat: now,
786
+ * exp: now + 3600,
787
+ * jti,
788
+ * project_id,
789
+ * grant_ids,
790
+ * grant_id,
791
+ * session_id,
792
+ * delegates,
793
+ * })
794
+ * // claims.layer is type-narrowed to 'agent_permission'
795
+ * ```
796
+ */
797
+ export declare function buildPhase1VcClaims(base: Omit<PermissionVcClaims_V3, 'layer'>): PermissionVcClaims_V3 & {
798
+ layer: Phase1VcLayer;
799
+ };
800
+ //# sourceMappingURL=permission-vc.d.ts.map