@qmilab/lodestar-core 0.1.4 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/index.d.ts +6 -0
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +12 -0
  4. package/dist/index.js.map +1 -1
  5. package/dist/schemas/action.d.ts +31 -13
  6. package/dist/schemas/action.d.ts.map +1 -1
  7. package/dist/schemas/action.js +20 -1
  8. package/dist/schemas/action.js.map +1 -1
  9. package/dist/schemas/approval.d.ts +271 -0
  10. package/dist/schemas/approval.d.ts.map +1 -0
  11. package/dist/schemas/approval.js +119 -0
  12. package/dist/schemas/approval.js.map +1 -0
  13. package/dist/schemas/belief.d.ts.map +1 -1
  14. package/dist/schemas/belief.js +7 -1
  15. package/dist/schemas/belief.js.map +1 -1
  16. package/dist/schemas/calibration.d.ts +977 -0
  17. package/dist/schemas/calibration.d.ts.map +1 -0
  18. package/dist/schemas/calibration.js +187 -0
  19. package/dist/schemas/calibration.js.map +1 -0
  20. package/dist/schemas/claim.d.ts.map +1 -1
  21. package/dist/schemas/claim.js +4 -2
  22. package/dist/schemas/claim.js.map +1 -1
  23. package/dist/schemas/common.d.ts.map +1 -1
  24. package/dist/schemas/common.js +11 -5
  25. package/dist/schemas/common.js.map +1 -1
  26. package/dist/schemas/policy.d.ts +768 -0
  27. package/dist/schemas/policy.d.ts.map +1 -0
  28. package/dist/schemas/policy.js +200 -0
  29. package/dist/schemas/policy.js.map +1 -0
  30. package/dist/schemas/probe-pack.d.ts +152 -0
  31. package/dist/schemas/probe-pack.d.ts.map +1 -0
  32. package/dist/schemas/probe-pack.js +140 -0
  33. package/dist/schemas/probe-pack.js.map +1 -0
  34. package/dist/schemas/reflection.d.ts +405 -0
  35. package/dist/schemas/reflection.d.ts.map +1 -0
  36. package/dist/schemas/reflection.js +154 -0
  37. package/dist/schemas/reflection.js.map +1 -0
  38. package/dist/schemas/revision.d.ts.map +1 -1
  39. package/dist/schemas/revision.js.map +1 -1
  40. package/dist/schemas/sentinel.d.ts +134 -0
  41. package/dist/schemas/sentinel.d.ts.map +1 -0
  42. package/dist/schemas/sentinel.js +97 -0
  43. package/dist/schemas/sentinel.js.map +1 -0
  44. package/package.json +2 -7
  45. package/src/index.ts +18 -0
  46. package/src/schemas/action.ts +20 -1
  47. package/src/schemas/approval.ts +136 -0
  48. package/src/schemas/belief.ts +7 -1
  49. package/src/schemas/calibration.ts +212 -0
  50. package/src/schemas/claim.ts +15 -8
  51. package/src/schemas/common.ts +16 -10
  52. package/src/schemas/policy.ts +231 -0
  53. package/src/schemas/probe-pack.ts +169 -0
  54. package/src/schemas/reflection.ts +166 -0
  55. package/src/schemas/revision.ts +7 -5
  56. package/src/schemas/sentinel.ts +104 -0
@@ -0,0 +1,768 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Action policy — the wire format for what actions may touch the world.
4
+ *
5
+ * Design lock: `docs/architecture/policy-kernel.md`. The short version:
6
+ *
7
+ * - Policy is a *declarative document*, not a function. Today's enforcement
8
+ * is an opaque `PolicyGate` closure (the `autoApprovePolicy` preset). The
9
+ * Policy Kernel compiles a `Policy` document into that gate, so the verdict
10
+ * becomes data — addressable, hashable, signable, and citable by
11
+ * `Decision.policy_dependencies`.
12
+ * - Rules are evaluated *in order*; the first decisive rule wins, over a
13
+ * *structural* deny default. There is deliberately no `default` field and
14
+ * no expressible `default: allow` — the safe outcome is structural, not a
15
+ * rule someone can forget to add ("no silent defaults for security-relevant
16
+ * settings", root CLAUDE.md).
17
+ * - The *trust-ladder floor* (L5 deny, L4 always require_approval) is a
18
+ * non-overridable pre-check applied *before* the rule list, in the engine —
19
+ * it is NOT expressed as a rule, so no broad earlier `allow` can lift it.
20
+ *
21
+ * Not to be confused with `ContextPolicy` (`belief.ts`), which governs what
22
+ * beliefs may enter model context. This `Policy` governs what actions may
23
+ * touch the world — a different gate on a different chain link.
24
+ *
25
+ * Core owns the wire format only. The engine — `compile(policy) → PolicyGate`,
26
+ * the three-valued gate, signature verification, the arbitrate hook — lives in
27
+ * `@qmilab/lodestar-policy-kernel`.
28
+ */
29
+ /**
30
+ * The declarative effect of a matched rule.
31
+ *
32
+ * `require_approval` is the *declarative* counterpart of the gate's runtime
33
+ * `hold` verdict: a matched `require_approval` rule causes the engine to park
34
+ * the action at `pending_approval` and open an `ApprovalRequest`. (The runtime
35
+ * three-valued verdict `allow | deny | hold` is an engine type and lives in
36
+ * `@qmilab/lodestar-policy-kernel`, not in the wire format.)
37
+ */
38
+ export declare const PolicyEffectSchema: z.ZodEnum<["allow", "deny", "require_approval"]>;
39
+ export type PolicyEffect = z.infer<typeof PolicyEffectSchema>;
40
+ /**
41
+ * The match clause of a rule. All present fields must hold (AND); an absent
42
+ * field is a wildcard. A rule with an empty `match` matches every action.
43
+ *
44
+ * The fields constrain an `ActionContract` (`action.ts`):
45
+ * - `tool` is a glob over the tool registry key (e.g. `"git.*"`).
46
+ * - `max_blast_radius` matches contracts at or below this radius on the
47
+ * ordering self < session < project < external (the comparison is engine
48
+ * logic; the schema stores the ceiling).
49
+ * - `reversibility` is the set the contract's reversibility must be a member
50
+ * of (e.g. `["reversible", "compensable"]` excludes `irreversible`).
51
+ * - `scope` constrains the contract's `ResourceScope`.
52
+ * - `data_sensitivity` matches the contract's 3-value action sensitivity.
53
+ * - `required_level_lte` matches contracts whose `required_level` is at or
54
+ * below this trust level.
55
+ */
56
+ export declare const PolicyMatchSchema: z.ZodObject<{
57
+ tool: z.ZodOptional<z.ZodString>;
58
+ max_blast_radius: z.ZodOptional<z.ZodEnum<["self", "session", "project", "external"]>>;
59
+ reversibility: z.ZodOptional<z.ZodArray<z.ZodEnum<["reversible", "compensable", "irreversible"]>, "many">>;
60
+ scope: z.ZodOptional<z.ZodObject<{
61
+ level: z.ZodEnum<["global", "organization", "user", "project", "repo", "session"]>;
62
+ identifier: z.ZodString;
63
+ }, "strip", z.ZodTypeAny, {
64
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
65
+ identifier: string;
66
+ }, {
67
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
68
+ identifier: string;
69
+ }>>;
70
+ data_sensitivity: z.ZodOptional<z.ZodEnum<["public", "private", "secret"]>>;
71
+ required_level_lte: z.ZodOptional<z.ZodNumber>;
72
+ }, "strip", z.ZodTypeAny, {
73
+ tool?: string | undefined;
74
+ scope?: {
75
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
76
+ identifier: string;
77
+ } | undefined;
78
+ reversibility?: ("reversible" | "compensable" | "irreversible")[] | undefined;
79
+ data_sensitivity?: "public" | "secret" | "private" | undefined;
80
+ max_blast_radius?: "project" | "session" | "external" | "self" | undefined;
81
+ required_level_lte?: number | undefined;
82
+ }, {
83
+ tool?: string | undefined;
84
+ scope?: {
85
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
86
+ identifier: string;
87
+ } | undefined;
88
+ reversibility?: ("reversible" | "compensable" | "irreversible")[] | undefined;
89
+ data_sensitivity?: "public" | "secret" | "private" | undefined;
90
+ max_blast_radius?: "project" | "session" | "external" | "self" | undefined;
91
+ required_level_lte?: number | undefined;
92
+ }>;
93
+ export type PolicyMatch = z.infer<typeof PolicyMatchSchema>;
94
+ /**
95
+ * Constraints an approver must satisfy to resolve a held action. *Data, not a
96
+ * callback* — it says *what* an approver must be, checked against the
97
+ * resolver's `Actor`. This is what lets a team approval surface route a
98
+ * request to the right person without the Policy Kernel knowing anything
99
+ * about people. All fields optional; an empty object means "any actor the
100
+ * host has configured as a resolver may approve".
101
+ *
102
+ * The clearance check spans two alphabets: an action's `data_sensitivity` is
103
+ * the 3-value `public | private | secret`, an `Actor.sensitivity_clearance`
104
+ * is the 4-value `Sensitivity`. `sensitivity_clearance` here is the *4-value*
105
+ * `Sensitivity` — the action's sensitivity *mapped* via the Action Kernel's
106
+ * `sensitivityForContract` (`public→public`, `private→internal`,
107
+ * `secret→secret`) — so the approver-side comparison happens in one alphabet.
108
+ */
109
+ export declare const RequiredAuthoritySchema: z.ZodObject<{
110
+ min_trust_baseline: z.ZodOptional<z.ZodNumber>;
111
+ sensitivity_clearance: z.ZodOptional<z.ZodEnum<["public", "internal", "confidential", "secret"]>>;
112
+ scope: z.ZodOptional<z.ZodObject<{
113
+ level: z.ZodEnum<["global", "organization", "user", "project", "repo", "session"]>;
114
+ identifier: z.ZodString;
115
+ }, "strip", z.ZodTypeAny, {
116
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
117
+ identifier: string;
118
+ }, {
119
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
120
+ identifier: string;
121
+ }>>;
122
+ }, "strip", z.ZodTypeAny, {
123
+ sensitivity_clearance?: "public" | "internal" | "confidential" | "secret" | undefined;
124
+ scope?: {
125
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
126
+ identifier: string;
127
+ } | undefined;
128
+ min_trust_baseline?: number | undefined;
129
+ }, {
130
+ sensitivity_clearance?: "public" | "internal" | "confidential" | "secret" | undefined;
131
+ scope?: {
132
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
133
+ identifier: string;
134
+ } | undefined;
135
+ min_trust_baseline?: number | undefined;
136
+ }>;
137
+ export type RequiredAuthority = z.infer<typeof RequiredAuthoritySchema>;
138
+ /**
139
+ * The approval requirement carried by a `require_approval` rule. When the rule
140
+ * fires, its `required_authority` becomes the opened `ApprovalRequest`'s
141
+ * `required_authority`. Omitting `required_authority` (or the whole
142
+ * `approval` object) means any configured resolver may approve.
143
+ *
144
+ * A thin wrapper today; it is the seam where multi-approver / N-of-M
145
+ * constraints attach when the team approval surface is built (deferred —
146
+ * `policy-kernel.md`, "a separate team surface").
147
+ */
148
+ export declare const ApprovalRequirementSchema: z.ZodObject<{
149
+ required_authority: z.ZodOptional<z.ZodObject<{
150
+ min_trust_baseline: z.ZodOptional<z.ZodNumber>;
151
+ sensitivity_clearance: z.ZodOptional<z.ZodEnum<["public", "internal", "confidential", "secret"]>>;
152
+ scope: z.ZodOptional<z.ZodObject<{
153
+ level: z.ZodEnum<["global", "organization", "user", "project", "repo", "session"]>;
154
+ identifier: z.ZodString;
155
+ }, "strip", z.ZodTypeAny, {
156
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
157
+ identifier: string;
158
+ }, {
159
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
160
+ identifier: string;
161
+ }>>;
162
+ }, "strip", z.ZodTypeAny, {
163
+ sensitivity_clearance?: "public" | "internal" | "confidential" | "secret" | undefined;
164
+ scope?: {
165
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
166
+ identifier: string;
167
+ } | undefined;
168
+ min_trust_baseline?: number | undefined;
169
+ }, {
170
+ sensitivity_clearance?: "public" | "internal" | "confidential" | "secret" | undefined;
171
+ scope?: {
172
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
173
+ identifier: string;
174
+ } | undefined;
175
+ min_trust_baseline?: number | undefined;
176
+ }>>;
177
+ }, "strip", z.ZodTypeAny, {
178
+ required_authority?: {
179
+ sensitivity_clearance?: "public" | "internal" | "confidential" | "secret" | undefined;
180
+ scope?: {
181
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
182
+ identifier: string;
183
+ } | undefined;
184
+ min_trust_baseline?: number | undefined;
185
+ } | undefined;
186
+ }, {
187
+ required_authority?: {
188
+ sensitivity_clearance?: "public" | "internal" | "confidential" | "secret" | undefined;
189
+ scope?: {
190
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
191
+ identifier: string;
192
+ } | undefined;
193
+ min_trust_baseline?: number | undefined;
194
+ } | undefined;
195
+ }>;
196
+ export type ApprovalRequirement = z.infer<typeof ApprovalRequirementSchema>;
197
+ /**
198
+ * One match → effect rule. Evaluated in document order; the first rule whose
199
+ * `match` holds is decisive. `reason` is surfaced verbatim in the
200
+ * `PolicyDecision` (and, for a held action, in the `ApprovalRequest`).
201
+ *
202
+ * `approval` may be present only on a `require_approval` rule (enforced
203
+ * below). It is not *required* there — an absent `approval` means the hold has
204
+ * no authority constraints (any configured resolver may approve), which is a
205
+ * meaningful default, so it is left optional rather than forced to an empty
206
+ * object.
207
+ */
208
+ export declare const PolicyRuleSchema: z.ZodEffects<z.ZodObject<{
209
+ match: z.ZodObject<{
210
+ tool: z.ZodOptional<z.ZodString>;
211
+ max_blast_radius: z.ZodOptional<z.ZodEnum<["self", "session", "project", "external"]>>;
212
+ reversibility: z.ZodOptional<z.ZodArray<z.ZodEnum<["reversible", "compensable", "irreversible"]>, "many">>;
213
+ scope: z.ZodOptional<z.ZodObject<{
214
+ level: z.ZodEnum<["global", "organization", "user", "project", "repo", "session"]>;
215
+ identifier: z.ZodString;
216
+ }, "strip", z.ZodTypeAny, {
217
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
218
+ identifier: string;
219
+ }, {
220
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
221
+ identifier: string;
222
+ }>>;
223
+ data_sensitivity: z.ZodOptional<z.ZodEnum<["public", "private", "secret"]>>;
224
+ required_level_lte: z.ZodOptional<z.ZodNumber>;
225
+ }, "strip", z.ZodTypeAny, {
226
+ tool?: string | undefined;
227
+ scope?: {
228
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
229
+ identifier: string;
230
+ } | undefined;
231
+ reversibility?: ("reversible" | "compensable" | "irreversible")[] | undefined;
232
+ data_sensitivity?: "public" | "secret" | "private" | undefined;
233
+ max_blast_radius?: "project" | "session" | "external" | "self" | undefined;
234
+ required_level_lte?: number | undefined;
235
+ }, {
236
+ tool?: string | undefined;
237
+ scope?: {
238
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
239
+ identifier: string;
240
+ } | undefined;
241
+ reversibility?: ("reversible" | "compensable" | "irreversible")[] | undefined;
242
+ data_sensitivity?: "public" | "secret" | "private" | undefined;
243
+ max_blast_radius?: "project" | "session" | "external" | "self" | undefined;
244
+ required_level_lte?: number | undefined;
245
+ }>;
246
+ effect: z.ZodEnum<["allow", "deny", "require_approval"]>;
247
+ approval: z.ZodOptional<z.ZodObject<{
248
+ required_authority: z.ZodOptional<z.ZodObject<{
249
+ min_trust_baseline: z.ZodOptional<z.ZodNumber>;
250
+ sensitivity_clearance: z.ZodOptional<z.ZodEnum<["public", "internal", "confidential", "secret"]>>;
251
+ scope: z.ZodOptional<z.ZodObject<{
252
+ level: z.ZodEnum<["global", "organization", "user", "project", "repo", "session"]>;
253
+ identifier: z.ZodString;
254
+ }, "strip", z.ZodTypeAny, {
255
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
256
+ identifier: string;
257
+ }, {
258
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
259
+ identifier: string;
260
+ }>>;
261
+ }, "strip", z.ZodTypeAny, {
262
+ sensitivity_clearance?: "public" | "internal" | "confidential" | "secret" | undefined;
263
+ scope?: {
264
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
265
+ identifier: string;
266
+ } | undefined;
267
+ min_trust_baseline?: number | undefined;
268
+ }, {
269
+ sensitivity_clearance?: "public" | "internal" | "confidential" | "secret" | undefined;
270
+ scope?: {
271
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
272
+ identifier: string;
273
+ } | undefined;
274
+ min_trust_baseline?: number | undefined;
275
+ }>>;
276
+ }, "strip", z.ZodTypeAny, {
277
+ required_authority?: {
278
+ sensitivity_clearance?: "public" | "internal" | "confidential" | "secret" | undefined;
279
+ scope?: {
280
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
281
+ identifier: string;
282
+ } | undefined;
283
+ min_trust_baseline?: number | undefined;
284
+ } | undefined;
285
+ }, {
286
+ required_authority?: {
287
+ sensitivity_clearance?: "public" | "internal" | "confidential" | "secret" | undefined;
288
+ scope?: {
289
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
290
+ identifier: string;
291
+ } | undefined;
292
+ min_trust_baseline?: number | undefined;
293
+ } | undefined;
294
+ }>>;
295
+ reason: z.ZodString;
296
+ }, "strip", z.ZodTypeAny, {
297
+ reason: string;
298
+ match: {
299
+ tool?: string | undefined;
300
+ scope?: {
301
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
302
+ identifier: string;
303
+ } | undefined;
304
+ reversibility?: ("reversible" | "compensable" | "irreversible")[] | undefined;
305
+ data_sensitivity?: "public" | "secret" | "private" | undefined;
306
+ max_blast_radius?: "project" | "session" | "external" | "self" | undefined;
307
+ required_level_lte?: number | undefined;
308
+ };
309
+ effect: "allow" | "deny" | "require_approval";
310
+ approval?: {
311
+ required_authority?: {
312
+ sensitivity_clearance?: "public" | "internal" | "confidential" | "secret" | undefined;
313
+ scope?: {
314
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
315
+ identifier: string;
316
+ } | undefined;
317
+ min_trust_baseline?: number | undefined;
318
+ } | undefined;
319
+ } | undefined;
320
+ }, {
321
+ reason: string;
322
+ match: {
323
+ tool?: string | undefined;
324
+ scope?: {
325
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
326
+ identifier: string;
327
+ } | undefined;
328
+ reversibility?: ("reversible" | "compensable" | "irreversible")[] | undefined;
329
+ data_sensitivity?: "public" | "secret" | "private" | undefined;
330
+ max_blast_radius?: "project" | "session" | "external" | "self" | undefined;
331
+ required_level_lte?: number | undefined;
332
+ };
333
+ effect: "allow" | "deny" | "require_approval";
334
+ approval?: {
335
+ required_authority?: {
336
+ sensitivity_clearance?: "public" | "internal" | "confidential" | "secret" | undefined;
337
+ scope?: {
338
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
339
+ identifier: string;
340
+ } | undefined;
341
+ min_trust_baseline?: number | undefined;
342
+ } | undefined;
343
+ } | undefined;
344
+ }>, {
345
+ reason: string;
346
+ match: {
347
+ tool?: string | undefined;
348
+ scope?: {
349
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
350
+ identifier: string;
351
+ } | undefined;
352
+ reversibility?: ("reversible" | "compensable" | "irreversible")[] | undefined;
353
+ data_sensitivity?: "public" | "secret" | "private" | undefined;
354
+ max_blast_radius?: "project" | "session" | "external" | "self" | undefined;
355
+ required_level_lte?: number | undefined;
356
+ };
357
+ effect: "allow" | "deny" | "require_approval";
358
+ approval?: {
359
+ required_authority?: {
360
+ sensitivity_clearance?: "public" | "internal" | "confidential" | "secret" | undefined;
361
+ scope?: {
362
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
363
+ identifier: string;
364
+ } | undefined;
365
+ min_trust_baseline?: number | undefined;
366
+ } | undefined;
367
+ } | undefined;
368
+ }, {
369
+ reason: string;
370
+ match: {
371
+ tool?: string | undefined;
372
+ scope?: {
373
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
374
+ identifier: string;
375
+ } | undefined;
376
+ reversibility?: ("reversible" | "compensable" | "irreversible")[] | undefined;
377
+ data_sensitivity?: "public" | "secret" | "private" | undefined;
378
+ max_blast_radius?: "project" | "session" | "external" | "self" | undefined;
379
+ required_level_lte?: number | undefined;
380
+ };
381
+ effect: "allow" | "deny" | "require_approval";
382
+ approval?: {
383
+ required_authority?: {
384
+ sensitivity_clearance?: "public" | "internal" | "confidential" | "secret" | undefined;
385
+ scope?: {
386
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
387
+ identifier: string;
388
+ } | undefined;
389
+ min_trust_baseline?: number | undefined;
390
+ } | undefined;
391
+ } | undefined;
392
+ }>;
393
+ export type PolicyRule = z.infer<typeof PolicyRuleSchema>;
394
+ /**
395
+ * A signed, packageable action-policy document.
396
+ *
397
+ * `version` is the monotonic string that `Decision.policy_dependencies` cites,
398
+ * so an audit can resolve exactly which policy version arbitrated an action.
399
+ *
400
+ * `signature` / `signed_by` are *optional at the schema level* so that
401
+ * unsigned **drafts** parse, but `v02-delta.md` §5 lists policy versions among
402
+ * the artifacts that *require* Ed25519 signatures: the Policy Kernel rejects an
403
+ * unsigned (or invalid-signature) policy at the gate, except under an explicit,
404
+ * logged `allow_unsigned: true` development opt-in. The signer is
405
+ * `signature.signer_id`; `signed_by` is a top-level convenience that must
406
+ * equal it when a signature is present (enforced below) — never a second,
407
+ * divergeable source of truth.
408
+ *
409
+ * The signature is computed over the *canonical document without the
410
+ * signature* — `{ id, version, rules }` — since a document cannot sign over
411
+ * its own signature. That canonical hash is what `signature.payload_hash`
412
+ * carries and what `Decision.policy_dependencies` ultimately pins.
413
+ */
414
+ export declare const PolicySchema: z.ZodEffects<z.ZodObject<{
415
+ id: z.ZodString;
416
+ version: z.ZodString;
417
+ rules: z.ZodArray<z.ZodEffects<z.ZodObject<{
418
+ match: z.ZodObject<{
419
+ tool: z.ZodOptional<z.ZodString>;
420
+ max_blast_radius: z.ZodOptional<z.ZodEnum<["self", "session", "project", "external"]>>;
421
+ reversibility: z.ZodOptional<z.ZodArray<z.ZodEnum<["reversible", "compensable", "irreversible"]>, "many">>;
422
+ scope: z.ZodOptional<z.ZodObject<{
423
+ level: z.ZodEnum<["global", "organization", "user", "project", "repo", "session"]>;
424
+ identifier: z.ZodString;
425
+ }, "strip", z.ZodTypeAny, {
426
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
427
+ identifier: string;
428
+ }, {
429
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
430
+ identifier: string;
431
+ }>>;
432
+ data_sensitivity: z.ZodOptional<z.ZodEnum<["public", "private", "secret"]>>;
433
+ required_level_lte: z.ZodOptional<z.ZodNumber>;
434
+ }, "strip", z.ZodTypeAny, {
435
+ tool?: string | undefined;
436
+ scope?: {
437
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
438
+ identifier: string;
439
+ } | undefined;
440
+ reversibility?: ("reversible" | "compensable" | "irreversible")[] | undefined;
441
+ data_sensitivity?: "public" | "secret" | "private" | undefined;
442
+ max_blast_radius?: "project" | "session" | "external" | "self" | undefined;
443
+ required_level_lte?: number | undefined;
444
+ }, {
445
+ tool?: string | undefined;
446
+ scope?: {
447
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
448
+ identifier: string;
449
+ } | undefined;
450
+ reversibility?: ("reversible" | "compensable" | "irreversible")[] | undefined;
451
+ data_sensitivity?: "public" | "secret" | "private" | undefined;
452
+ max_blast_radius?: "project" | "session" | "external" | "self" | undefined;
453
+ required_level_lte?: number | undefined;
454
+ }>;
455
+ effect: z.ZodEnum<["allow", "deny", "require_approval"]>;
456
+ approval: z.ZodOptional<z.ZodObject<{
457
+ required_authority: z.ZodOptional<z.ZodObject<{
458
+ min_trust_baseline: z.ZodOptional<z.ZodNumber>;
459
+ sensitivity_clearance: z.ZodOptional<z.ZodEnum<["public", "internal", "confidential", "secret"]>>;
460
+ scope: z.ZodOptional<z.ZodObject<{
461
+ level: z.ZodEnum<["global", "organization", "user", "project", "repo", "session"]>;
462
+ identifier: z.ZodString;
463
+ }, "strip", z.ZodTypeAny, {
464
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
465
+ identifier: string;
466
+ }, {
467
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
468
+ identifier: string;
469
+ }>>;
470
+ }, "strip", z.ZodTypeAny, {
471
+ sensitivity_clearance?: "public" | "internal" | "confidential" | "secret" | undefined;
472
+ scope?: {
473
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
474
+ identifier: string;
475
+ } | undefined;
476
+ min_trust_baseline?: number | undefined;
477
+ }, {
478
+ sensitivity_clearance?: "public" | "internal" | "confidential" | "secret" | undefined;
479
+ scope?: {
480
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
481
+ identifier: string;
482
+ } | undefined;
483
+ min_trust_baseline?: number | undefined;
484
+ }>>;
485
+ }, "strip", z.ZodTypeAny, {
486
+ required_authority?: {
487
+ sensitivity_clearance?: "public" | "internal" | "confidential" | "secret" | undefined;
488
+ scope?: {
489
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
490
+ identifier: string;
491
+ } | undefined;
492
+ min_trust_baseline?: number | undefined;
493
+ } | undefined;
494
+ }, {
495
+ required_authority?: {
496
+ sensitivity_clearance?: "public" | "internal" | "confidential" | "secret" | undefined;
497
+ scope?: {
498
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
499
+ identifier: string;
500
+ } | undefined;
501
+ min_trust_baseline?: number | undefined;
502
+ } | undefined;
503
+ }>>;
504
+ reason: z.ZodString;
505
+ }, "strip", z.ZodTypeAny, {
506
+ reason: string;
507
+ match: {
508
+ tool?: string | undefined;
509
+ scope?: {
510
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
511
+ identifier: string;
512
+ } | undefined;
513
+ reversibility?: ("reversible" | "compensable" | "irreversible")[] | undefined;
514
+ data_sensitivity?: "public" | "secret" | "private" | undefined;
515
+ max_blast_radius?: "project" | "session" | "external" | "self" | undefined;
516
+ required_level_lte?: number | undefined;
517
+ };
518
+ effect: "allow" | "deny" | "require_approval";
519
+ approval?: {
520
+ required_authority?: {
521
+ sensitivity_clearance?: "public" | "internal" | "confidential" | "secret" | undefined;
522
+ scope?: {
523
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
524
+ identifier: string;
525
+ } | undefined;
526
+ min_trust_baseline?: number | undefined;
527
+ } | undefined;
528
+ } | undefined;
529
+ }, {
530
+ reason: string;
531
+ match: {
532
+ tool?: string | undefined;
533
+ scope?: {
534
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
535
+ identifier: string;
536
+ } | undefined;
537
+ reversibility?: ("reversible" | "compensable" | "irreversible")[] | undefined;
538
+ data_sensitivity?: "public" | "secret" | "private" | undefined;
539
+ max_blast_radius?: "project" | "session" | "external" | "self" | undefined;
540
+ required_level_lte?: number | undefined;
541
+ };
542
+ effect: "allow" | "deny" | "require_approval";
543
+ approval?: {
544
+ required_authority?: {
545
+ sensitivity_clearance?: "public" | "internal" | "confidential" | "secret" | undefined;
546
+ scope?: {
547
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
548
+ identifier: string;
549
+ } | undefined;
550
+ min_trust_baseline?: number | undefined;
551
+ } | undefined;
552
+ } | undefined;
553
+ }>, {
554
+ reason: string;
555
+ match: {
556
+ tool?: string | undefined;
557
+ scope?: {
558
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
559
+ identifier: string;
560
+ } | undefined;
561
+ reversibility?: ("reversible" | "compensable" | "irreversible")[] | undefined;
562
+ data_sensitivity?: "public" | "secret" | "private" | undefined;
563
+ max_blast_radius?: "project" | "session" | "external" | "self" | undefined;
564
+ required_level_lte?: number | undefined;
565
+ };
566
+ effect: "allow" | "deny" | "require_approval";
567
+ approval?: {
568
+ required_authority?: {
569
+ sensitivity_clearance?: "public" | "internal" | "confidential" | "secret" | undefined;
570
+ scope?: {
571
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
572
+ identifier: string;
573
+ } | undefined;
574
+ min_trust_baseline?: number | undefined;
575
+ } | undefined;
576
+ } | undefined;
577
+ }, {
578
+ reason: string;
579
+ match: {
580
+ tool?: string | undefined;
581
+ scope?: {
582
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
583
+ identifier: string;
584
+ } | undefined;
585
+ reversibility?: ("reversible" | "compensable" | "irreversible")[] | undefined;
586
+ data_sensitivity?: "public" | "secret" | "private" | undefined;
587
+ max_blast_radius?: "project" | "session" | "external" | "self" | undefined;
588
+ required_level_lte?: number | undefined;
589
+ };
590
+ effect: "allow" | "deny" | "require_approval";
591
+ approval?: {
592
+ required_authority?: {
593
+ sensitivity_clearance?: "public" | "internal" | "confidential" | "secret" | undefined;
594
+ scope?: {
595
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
596
+ identifier: string;
597
+ } | undefined;
598
+ min_trust_baseline?: number | undefined;
599
+ } | undefined;
600
+ } | undefined;
601
+ }>, "many">;
602
+ signature: z.ZodOptional<z.ZodObject<{
603
+ signer_id: z.ZodString;
604
+ payload_hash: z.ZodString;
605
+ algorithm: z.ZodLiteral<"ed25519">;
606
+ signature: z.ZodString;
607
+ at: z.ZodString;
608
+ }, "strip", z.ZodTypeAny, {
609
+ at: string;
610
+ signer_id: string;
611
+ payload_hash: string;
612
+ algorithm: "ed25519";
613
+ signature: string;
614
+ }, {
615
+ at: string;
616
+ signer_id: string;
617
+ payload_hash: string;
618
+ algorithm: "ed25519";
619
+ signature: string;
620
+ }>>;
621
+ signed_by: z.ZodOptional<z.ZodString>;
622
+ }, "strip", z.ZodTypeAny, {
623
+ id: string;
624
+ version: string;
625
+ rules: {
626
+ reason: string;
627
+ match: {
628
+ tool?: string | undefined;
629
+ scope?: {
630
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
631
+ identifier: string;
632
+ } | undefined;
633
+ reversibility?: ("reversible" | "compensable" | "irreversible")[] | undefined;
634
+ data_sensitivity?: "public" | "secret" | "private" | undefined;
635
+ max_blast_radius?: "project" | "session" | "external" | "self" | undefined;
636
+ required_level_lte?: number | undefined;
637
+ };
638
+ effect: "allow" | "deny" | "require_approval";
639
+ approval?: {
640
+ required_authority?: {
641
+ sensitivity_clearance?: "public" | "internal" | "confidential" | "secret" | undefined;
642
+ scope?: {
643
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
644
+ identifier: string;
645
+ } | undefined;
646
+ min_trust_baseline?: number | undefined;
647
+ } | undefined;
648
+ } | undefined;
649
+ }[];
650
+ signature?: {
651
+ at: string;
652
+ signer_id: string;
653
+ payload_hash: string;
654
+ algorithm: "ed25519";
655
+ signature: string;
656
+ } | undefined;
657
+ signed_by?: string | undefined;
658
+ }, {
659
+ id: string;
660
+ version: string;
661
+ rules: {
662
+ reason: string;
663
+ match: {
664
+ tool?: string | undefined;
665
+ scope?: {
666
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
667
+ identifier: string;
668
+ } | undefined;
669
+ reversibility?: ("reversible" | "compensable" | "irreversible")[] | undefined;
670
+ data_sensitivity?: "public" | "secret" | "private" | undefined;
671
+ max_blast_radius?: "project" | "session" | "external" | "self" | undefined;
672
+ required_level_lte?: number | undefined;
673
+ };
674
+ effect: "allow" | "deny" | "require_approval";
675
+ approval?: {
676
+ required_authority?: {
677
+ sensitivity_clearance?: "public" | "internal" | "confidential" | "secret" | undefined;
678
+ scope?: {
679
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
680
+ identifier: string;
681
+ } | undefined;
682
+ min_trust_baseline?: number | undefined;
683
+ } | undefined;
684
+ } | undefined;
685
+ }[];
686
+ signature?: {
687
+ at: string;
688
+ signer_id: string;
689
+ payload_hash: string;
690
+ algorithm: "ed25519";
691
+ signature: string;
692
+ } | undefined;
693
+ signed_by?: string | undefined;
694
+ }>, {
695
+ id: string;
696
+ version: string;
697
+ rules: {
698
+ reason: string;
699
+ match: {
700
+ tool?: string | undefined;
701
+ scope?: {
702
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
703
+ identifier: string;
704
+ } | undefined;
705
+ reversibility?: ("reversible" | "compensable" | "irreversible")[] | undefined;
706
+ data_sensitivity?: "public" | "secret" | "private" | undefined;
707
+ max_blast_radius?: "project" | "session" | "external" | "self" | undefined;
708
+ required_level_lte?: number | undefined;
709
+ };
710
+ effect: "allow" | "deny" | "require_approval";
711
+ approval?: {
712
+ required_authority?: {
713
+ sensitivity_clearance?: "public" | "internal" | "confidential" | "secret" | undefined;
714
+ scope?: {
715
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
716
+ identifier: string;
717
+ } | undefined;
718
+ min_trust_baseline?: number | undefined;
719
+ } | undefined;
720
+ } | undefined;
721
+ }[];
722
+ signature?: {
723
+ at: string;
724
+ signer_id: string;
725
+ payload_hash: string;
726
+ algorithm: "ed25519";
727
+ signature: string;
728
+ } | undefined;
729
+ signed_by?: string | undefined;
730
+ }, {
731
+ id: string;
732
+ version: string;
733
+ rules: {
734
+ reason: string;
735
+ match: {
736
+ tool?: string | undefined;
737
+ scope?: {
738
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
739
+ identifier: string;
740
+ } | undefined;
741
+ reversibility?: ("reversible" | "compensable" | "irreversible")[] | undefined;
742
+ data_sensitivity?: "public" | "secret" | "private" | undefined;
743
+ max_blast_radius?: "project" | "session" | "external" | "self" | undefined;
744
+ required_level_lte?: number | undefined;
745
+ };
746
+ effect: "allow" | "deny" | "require_approval";
747
+ approval?: {
748
+ required_authority?: {
749
+ sensitivity_clearance?: "public" | "internal" | "confidential" | "secret" | undefined;
750
+ scope?: {
751
+ level: "global" | "organization" | "user" | "project" | "repo" | "session";
752
+ identifier: string;
753
+ } | undefined;
754
+ min_trust_baseline?: number | undefined;
755
+ } | undefined;
756
+ } | undefined;
757
+ }[];
758
+ signature?: {
759
+ at: string;
760
+ signer_id: string;
761
+ payload_hash: string;
762
+ algorithm: "ed25519";
763
+ signature: string;
764
+ } | undefined;
765
+ signed_by?: string | undefined;
766
+ }>;
767
+ export type Policy = z.infer<typeof PolicySchema>;
768
+ //# sourceMappingURL=policy.d.ts.map