@odingard/guardian-sdk 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +252 -17
- package/dist/contracts.js +9865 -0
- package/dist/index.js +12976 -1787
- package/dist/public-catalog.v1.json +6915 -0
- package/dist-dts/catalog.d.ts +14 -0
- package/dist-dts/client.d.ts +51 -1
- package/dist-dts/contracts/action-pack.d.ts +464 -0
- package/dist-dts/contracts/action-registry.d.ts +91 -1
- package/dist-dts/contracts/action.d.ts +1408 -17
- package/dist-dts/contracts/agent-state.d.ts +386 -0
- package/dist-dts/contracts/approval.d.ts +224 -5
- package/dist-dts/contracts/assurance.d.ts +60 -0
- package/dist-dts/contracts/authority-graph.d.ts +294 -0
- package/dist-dts/contracts/authority-state.d.ts +17 -2
- package/dist-dts/contracts/authority.d.ts +31 -5
- package/dist-dts/contracts/billing.d.ts +32 -0
- package/dist-dts/contracts/calendar.d.ts +6 -6
- package/dist-dts/contracts/denial.d.ts +648 -0
- package/dist-dts/contracts/evidence.d.ts +73 -16
- package/dist-dts/contracts/execution.d.ts +449 -55
- package/dist-dts/contracts/identifiers.d.ts +16 -0
- package/dist-dts/contracts/index.d.ts +22 -0
- package/dist-dts/contracts/intent.d.ts +335 -0
- package/dist-dts/contracts/lineage.d.ts +218 -0
- package/dist-dts/contracts/local.d.ts +101 -0
- package/dist-dts/contracts/multi-principal.d.ts +292 -0
- package/dist-dts/contracts/multiparty.d.ts +169 -0
- package/dist-dts/contracts/obligation.d.ts +196 -0
- package/dist-dts/contracts/plan.d.ts +67 -0
- package/dist-dts/contracts/policy-simulation.d.ts +681 -0
- package/dist-dts/contracts/prerequisite.d.ts +147 -0
- package/dist-dts/contracts/protected-data.d.ts +67 -0
- package/dist-dts/contracts/receipt.d.ts +3126 -0
- package/dist-dts/contracts/resource-claims.d.ts +146 -0
- package/dist-dts/contracts/runtime.d.ts +111 -0
- package/dist-dts/contracts/safety-envelope.d.ts +287 -0
- package/dist-dts/contracts/sequence.d.ts +132 -0
- package/dist-dts/contracts/sources.d.ts +191 -0
- package/dist-dts/contracts/tools.d.ts +50 -5
- package/dist-dts/contracts/transaction.d.ts +360 -0
- package/dist-dts/contracts-entry.d.ts +1 -0
- package/dist-dts/embedded.d.ts +58 -0
- package/dist-dts/evidence/evidence.d.ts +25 -0
- package/dist-dts/evidence/receipt.d.ts +61 -0
- package/dist-dts/index.d.ts +5 -1
- package/dist-dts/lifecycle.d.ts +25 -0
- package/dist-dts/proposal.d.ts +16 -0
- package/dist-dts/receipts.d.ts +37 -0
- package/package.json +12 -6
- package/dist-dts/__tests__/client.test.d.ts +0 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import catalog from "./catalog/public-catalog.v1.json";
|
|
2
|
+
/**
|
|
3
|
+
* Guardian's public catalog metadata, generated from the canonical private
|
|
4
|
+
* catalog (`@odingard/guardian-catalog`) and synced verbatim. Declarative
|
|
5
|
+
* only: reading it grants nothing — every action is still decided at
|
|
6
|
+
* runtime by the Guardian authority path under a human's policy.
|
|
7
|
+
*/
|
|
8
|
+
export type GuardianPublicCatalog = typeof catalog;
|
|
9
|
+
export type GuardianCatalogVertical = GuardianPublicCatalog["verticals"][number];
|
|
10
|
+
export type GuardianCatalogAgentSystem = GuardianPublicCatalog["agentSystems"][number];
|
|
11
|
+
export declare const guardianCatalog: GuardianPublicCatalog;
|
|
12
|
+
/** Verticals whose catalog rows include `actionId`, with honest maturity. */
|
|
13
|
+
export declare function verticalsForAction(actionId: string): readonly GuardianCatalogVertical[];
|
|
14
|
+
export declare function findAgentSystem(systemPackId: string): GuardianCatalogAgentSystem | undefined;
|
package/dist-dts/client.d.ts
CHANGED
|
@@ -23,6 +23,16 @@ export type GuardianToolInvocation = Readonly<{
|
|
|
23
23
|
arguments: Record<string, unknown>;
|
|
24
24
|
adapterId?: string;
|
|
25
25
|
purpose?: string;
|
|
26
|
+
/** WO-022 — optional intent/plan provenance bound into the action. */
|
|
27
|
+
intentId?: string;
|
|
28
|
+
planId?: string;
|
|
29
|
+
/**
|
|
30
|
+
* WO-024 — optional causal provenance: the recorded parent action
|
|
31
|
+
* (request id) and/or the recorded effect (attempt id) this action
|
|
32
|
+
* uses. Validated fail-closed against recorded evidence.
|
|
33
|
+
*/
|
|
34
|
+
parentActionId?: string;
|
|
35
|
+
sourceEffectId?: string;
|
|
26
36
|
}>;
|
|
27
37
|
export type GuardianMcpInvocation = Readonly<{
|
|
28
38
|
action: "mcp.install";
|
|
@@ -30,13 +40,39 @@ export type GuardianMcpInvocation = Readonly<{
|
|
|
30
40
|
tool: McpInstallParametersV1["tool"];
|
|
31
41
|
adapterId?: string;
|
|
32
42
|
purpose?: string;
|
|
43
|
+
intentId?: string;
|
|
44
|
+
planId?: string;
|
|
45
|
+
parentActionId?: string;
|
|
46
|
+
sourceEffectId?: string;
|
|
33
47
|
}> | Readonly<{
|
|
34
48
|
action: "mcp.enable";
|
|
35
49
|
connectionId: string;
|
|
36
50
|
toolName: string;
|
|
37
51
|
adapterId?: string;
|
|
38
52
|
purpose?: string;
|
|
53
|
+
intentId?: string;
|
|
54
|
+
planId?: string;
|
|
55
|
+
parentActionId?: string;
|
|
56
|
+
sourceEffectId?: string;
|
|
57
|
+
}>;
|
|
58
|
+
/**
|
|
59
|
+
* WO-025 — minimal passthrough for the data-lineage + agent-communication
|
|
60
|
+
* actions. Callers supply the already-formed material parameters (the
|
|
61
|
+
* corresponding *V1Schema validates server-side); the SDK forwards them
|
|
62
|
+
* into the canonical proposal unchanged.
|
|
63
|
+
*/
|
|
64
|
+
export type GuardianGovernedInvocation = Readonly<{
|
|
65
|
+
action: "api.request" | "protected_data.derive" | "protected_data.transform" | "protected_data.export" | "agent.message" | "agent.share_context" | "agent.share_memory" | "agent.transfer_task" | "agent.transfer_capability";
|
|
66
|
+
connectionId: string;
|
|
67
|
+
materialParameters: Record<string, unknown>;
|
|
68
|
+
adapterId?: string;
|
|
69
|
+
purpose?: string;
|
|
70
|
+
intentId?: string;
|
|
71
|
+
planId?: string;
|
|
72
|
+
parentActionId?: string;
|
|
73
|
+
sourceEffectId?: string;
|
|
39
74
|
}>;
|
|
75
|
+
export type GuardianInvocation = GuardianToolInvocation | GuardianMcpInvocation | GuardianGovernedInvocation;
|
|
40
76
|
export type GuardianRequestResult = {
|
|
41
77
|
ok: true;
|
|
42
78
|
requestId: string;
|
|
@@ -46,6 +82,8 @@ export type GuardianRequestResult = {
|
|
|
46
82
|
} | {
|
|
47
83
|
ok: false;
|
|
48
84
|
reasonCode: string;
|
|
85
|
+
/** The proposal's request id — needed to `claim` after an ASK. */
|
|
86
|
+
requestId?: string;
|
|
49
87
|
};
|
|
50
88
|
export interface GuardianClient {
|
|
51
89
|
/**
|
|
@@ -53,7 +91,7 @@ export interface GuardianClient {
|
|
|
53
91
|
* capabilityToken immediately; ASK returns decision "ASK" and the human
|
|
54
92
|
* approves out-of-band (then call `claim`); DENY refuses.
|
|
55
93
|
*/
|
|
56
|
-
request(invocation:
|
|
94
|
+
request(invocation: GuardianInvocation): Promise<GuardianRequestResult>;
|
|
57
95
|
/** Collect a capability after human approval of a prior ASK. */
|
|
58
96
|
claim(requestId: string): Promise<GuardianRequestResult>;
|
|
59
97
|
/** Execute a held capability; resolves to the execution receipt. */
|
|
@@ -67,6 +105,18 @@ export interface GuardianClient {
|
|
|
67
105
|
ok: false;
|
|
68
106
|
reasonCode: string;
|
|
69
107
|
}>;
|
|
108
|
+
/**
|
|
109
|
+
* WO-042 — the signed portable authority receipt (`greceipt.v1`) for a
|
|
110
|
+
* completed request. Verify it with `verifyReceiptOffline` (no Guardian
|
|
111
|
+
* credential or service needed) or `verifyReceiptOnline`.
|
|
112
|
+
*/
|
|
113
|
+
portableReceipt(requestId: string): Promise<{
|
|
114
|
+
ok: true;
|
|
115
|
+
receipt: unknown;
|
|
116
|
+
} | {
|
|
117
|
+
ok: false;
|
|
118
|
+
reasonCode: string;
|
|
119
|
+
}>;
|
|
70
120
|
/** Machine-readable proof for a request (WO-015 developer receipts). */
|
|
71
121
|
receipts(requestId: string): Promise<{
|
|
72
122
|
ok: true;
|
|
@@ -0,0 +1,464 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ActionDefinition } from "./action-registry.js";
|
|
3
|
+
/**
|
|
4
|
+
* WO-021 — Action Pack v1 (`guardian.action.v1`).
|
|
5
|
+
*
|
|
6
|
+
* A signed, declarative package that defines one governed action: identity,
|
|
7
|
+
* family, resource type, risk class, reversibility, material parameters,
|
|
8
|
+
* required fields, approval display, verification method, compatibility,
|
|
9
|
+
* provenance, review state, rollback metadata, integrity digest and a trusted
|
|
10
|
+
* publisher's Ed25519 signature. Packs are inputs, never executables: nothing
|
|
11
|
+
* a pack declares is interpreted inside the authority kernel (K15). A pack
|
|
12
|
+
* whose signature, integrity, publisher trust, review state, compatibility or
|
|
13
|
+
* internal consistency fails is rejected at load time — the action it names
|
|
14
|
+
* stays unregistered, so every proposal deterministically DENYs (K14).
|
|
15
|
+
*/
|
|
16
|
+
export declare const ACTION_PACK_FORMAT = "guardian.action.v1";
|
|
17
|
+
export declare const ACTION_PACK_DOMAIN = "odingard.guardian.action-pack.v1";
|
|
18
|
+
export declare const ACTION_PACK_REGISTRY_COMPATIBILITY = 1;
|
|
19
|
+
export declare const ACTION_PACK_MAX_FIELDS = 32;
|
|
20
|
+
export declare const ACTION_PACK_MAX_DISPLAY_FIELDS = 16;
|
|
21
|
+
export declare const ACTION_PACK_MAX_PROVIDERS = 8;
|
|
22
|
+
export declare const ACTION_PACK_MAX_EVIDENCE = 16;
|
|
23
|
+
export declare const ACTION_PACK_MAX_ENUM = 64;
|
|
24
|
+
/** Transports a pack may bind its material parameters to. v1: api.request. */
|
|
25
|
+
export declare const ACTION_PACK_TRANSPORTS: readonly ["api.request.v1"];
|
|
26
|
+
export type ActionPackTransport = (typeof ACTION_PACK_TRANSPORTS)[number];
|
|
27
|
+
export declare const ActionPackActionIdSchema: z.ZodString;
|
|
28
|
+
export declare const ActionPackPublisherIdSchema: z.ZodString;
|
|
29
|
+
export declare const ActionPackKeyIdSchema: z.ZodString;
|
|
30
|
+
/** RFC 8037 Ed25519 JWK (public parts only) for a trusted pack publisher. */
|
|
31
|
+
export declare const ActionPackPublisherKeySchema: z.ZodObject<{
|
|
32
|
+
kty: z.ZodLiteral<"OKP">;
|
|
33
|
+
crv: z.ZodLiteral<"Ed25519">;
|
|
34
|
+
kid: z.ZodString;
|
|
35
|
+
use: z.ZodLiteral<"sig">;
|
|
36
|
+
alg: z.ZodLiteral<"EdDSA">;
|
|
37
|
+
x: z.ZodString;
|
|
38
|
+
}, z.core.$strict>;
|
|
39
|
+
export type ActionPackPublisherKey = z.infer<typeof ActionPackPublisherKeySchema>;
|
|
40
|
+
/** The human-governed trust set: which publishers may sign installed packs. */
|
|
41
|
+
export type ActionPackTrustSet = Readonly<{
|
|
42
|
+
publishers: readonly ActionPackPublisherKey[];
|
|
43
|
+
}>;
|
|
44
|
+
/**
|
|
45
|
+
* Declarative constraint on one material field. Bounds are data the pipeline
|
|
46
|
+
* evaluates deterministically — no pack-supplied logic executes.
|
|
47
|
+
*/
|
|
48
|
+
export declare const ActionPackFieldSchema: z.ZodObject<{
|
|
49
|
+
name: z.ZodString;
|
|
50
|
+
type: z.ZodEnum<{
|
|
51
|
+
string: "string";
|
|
52
|
+
number: "number";
|
|
53
|
+
boolean: "boolean";
|
|
54
|
+
object: "object";
|
|
55
|
+
array: "array";
|
|
56
|
+
integer: "integer";
|
|
57
|
+
}>;
|
|
58
|
+
required: z.ZodBoolean;
|
|
59
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
60
|
+
enum: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
61
|
+
mustStartWith: z.ZodOptional<z.ZodString>;
|
|
62
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
63
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
64
|
+
}, z.core.$strict>;
|
|
65
|
+
export type ActionPackField = z.infer<typeof ActionPackFieldSchema>;
|
|
66
|
+
export declare const ActionPackContentSchema: z.ZodObject<{
|
|
67
|
+
actionId: z.ZodString;
|
|
68
|
+
family: z.ZodString;
|
|
69
|
+
resourceType: z.ZodString;
|
|
70
|
+
humanLabel: z.ZodString;
|
|
71
|
+
description: z.ZodString;
|
|
72
|
+
risk: z.ZodEnum<{
|
|
73
|
+
R0: "R0";
|
|
74
|
+
R1: "R1";
|
|
75
|
+
R2: "R2";
|
|
76
|
+
R3: "R3";
|
|
77
|
+
R4: "R4";
|
|
78
|
+
R5: "R5";
|
|
79
|
+
}>;
|
|
80
|
+
reversibility: z.ZodEnum<{
|
|
81
|
+
destructive: "destructive";
|
|
82
|
+
reversible: "reversible";
|
|
83
|
+
limited: "limited";
|
|
84
|
+
difficult: "difficult";
|
|
85
|
+
"safety-sensitive": "safety-sensitive";
|
|
86
|
+
}>;
|
|
87
|
+
posture: z.ZodEnum<{
|
|
88
|
+
deny: "deny";
|
|
89
|
+
allow: "allow";
|
|
90
|
+
ask: "ask";
|
|
91
|
+
}>;
|
|
92
|
+
providers: z.ZodArray<z.ZodString>;
|
|
93
|
+
transport: z.ZodEnum<{
|
|
94
|
+
"api.request.v1": "api.request.v1";
|
|
95
|
+
}>;
|
|
96
|
+
materialFields: z.ZodArray<z.ZodObject<{
|
|
97
|
+
name: z.ZodString;
|
|
98
|
+
type: z.ZodEnum<{
|
|
99
|
+
string: "string";
|
|
100
|
+
number: "number";
|
|
101
|
+
boolean: "boolean";
|
|
102
|
+
object: "object";
|
|
103
|
+
array: "array";
|
|
104
|
+
integer: "integer";
|
|
105
|
+
}>;
|
|
106
|
+
required: z.ZodBoolean;
|
|
107
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
108
|
+
enum: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
109
|
+
mustStartWith: z.ZodOptional<z.ZodString>;
|
|
110
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
111
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
112
|
+
}, z.core.$strict>>;
|
|
113
|
+
requiredFields: z.ZodArray<z.ZodString>;
|
|
114
|
+
approvalDisplay: z.ZodArray<z.ZodObject<{
|
|
115
|
+
field: z.ZodString;
|
|
116
|
+
label: z.ZodString;
|
|
117
|
+
}, z.core.$strict>>;
|
|
118
|
+
verification: z.ZodObject<{
|
|
119
|
+
method: z.ZodEnum<{
|
|
120
|
+
"provider-receipt": "provider-receipt";
|
|
121
|
+
"recorded-outcome": "recorded-outcome";
|
|
122
|
+
}>;
|
|
123
|
+
level: z.ZodEnum<{
|
|
124
|
+
"post-commit-content": "post-commit-content";
|
|
125
|
+
}>;
|
|
126
|
+
}, z.core.$strict>;
|
|
127
|
+
counterpartyRules: z.ZodString;
|
|
128
|
+
dataEffects: z.ZodString;
|
|
129
|
+
executionContract: z.ZodString;
|
|
130
|
+
evidenceRequirements: z.ZodArray<z.ZodString>;
|
|
131
|
+
capabilityUses: z.ZodNumber;
|
|
132
|
+
requiresExplicitGrant: z.ZodOptional<z.ZodBoolean>;
|
|
133
|
+
minPrincipalClass: z.ZodOptional<z.ZodLiteral<"adult">>;
|
|
134
|
+
claimRules: z.ZodArray<z.ZodObject<{
|
|
135
|
+
path: z.ZodString;
|
|
136
|
+
op: z.ZodEnum<{
|
|
137
|
+
in: "in";
|
|
138
|
+
includes: "includes";
|
|
139
|
+
eq: "eq";
|
|
140
|
+
neq: "neq";
|
|
141
|
+
excludes: "excludes";
|
|
142
|
+
}>;
|
|
143
|
+
value: z.ZodUnknown;
|
|
144
|
+
}, z.core.$strict>>;
|
|
145
|
+
bindingRules: z.ZodArray<z.ZodObject<{
|
|
146
|
+
field: z.ZodString;
|
|
147
|
+
claim: z.ZodString;
|
|
148
|
+
op: z.ZodEnum<{
|
|
149
|
+
within: "within";
|
|
150
|
+
memberOf: "memberOf";
|
|
151
|
+
}>;
|
|
152
|
+
}, z.core.$strict>>;
|
|
153
|
+
}, z.core.$strict>;
|
|
154
|
+
export type ActionPackContent = z.infer<typeof ActionPackContentSchema>;
|
|
155
|
+
export declare const ActionPackBodySchema: z.ZodObject<{
|
|
156
|
+
pack: z.ZodLiteral<"guardian.action.v1">;
|
|
157
|
+
content: z.ZodObject<{
|
|
158
|
+
actionId: z.ZodString;
|
|
159
|
+
family: z.ZodString;
|
|
160
|
+
resourceType: z.ZodString;
|
|
161
|
+
humanLabel: z.ZodString;
|
|
162
|
+
description: z.ZodString;
|
|
163
|
+
risk: z.ZodEnum<{
|
|
164
|
+
R0: "R0";
|
|
165
|
+
R1: "R1";
|
|
166
|
+
R2: "R2";
|
|
167
|
+
R3: "R3";
|
|
168
|
+
R4: "R4";
|
|
169
|
+
R5: "R5";
|
|
170
|
+
}>;
|
|
171
|
+
reversibility: z.ZodEnum<{
|
|
172
|
+
destructive: "destructive";
|
|
173
|
+
reversible: "reversible";
|
|
174
|
+
limited: "limited";
|
|
175
|
+
difficult: "difficult";
|
|
176
|
+
"safety-sensitive": "safety-sensitive";
|
|
177
|
+
}>;
|
|
178
|
+
posture: z.ZodEnum<{
|
|
179
|
+
deny: "deny";
|
|
180
|
+
allow: "allow";
|
|
181
|
+
ask: "ask";
|
|
182
|
+
}>;
|
|
183
|
+
providers: z.ZodArray<z.ZodString>;
|
|
184
|
+
transport: z.ZodEnum<{
|
|
185
|
+
"api.request.v1": "api.request.v1";
|
|
186
|
+
}>;
|
|
187
|
+
materialFields: z.ZodArray<z.ZodObject<{
|
|
188
|
+
name: z.ZodString;
|
|
189
|
+
type: z.ZodEnum<{
|
|
190
|
+
string: "string";
|
|
191
|
+
number: "number";
|
|
192
|
+
boolean: "boolean";
|
|
193
|
+
object: "object";
|
|
194
|
+
array: "array";
|
|
195
|
+
integer: "integer";
|
|
196
|
+
}>;
|
|
197
|
+
required: z.ZodBoolean;
|
|
198
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
199
|
+
enum: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
200
|
+
mustStartWith: z.ZodOptional<z.ZodString>;
|
|
201
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
202
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
203
|
+
}, z.core.$strict>>;
|
|
204
|
+
requiredFields: z.ZodArray<z.ZodString>;
|
|
205
|
+
approvalDisplay: z.ZodArray<z.ZodObject<{
|
|
206
|
+
field: z.ZodString;
|
|
207
|
+
label: z.ZodString;
|
|
208
|
+
}, z.core.$strict>>;
|
|
209
|
+
verification: z.ZodObject<{
|
|
210
|
+
method: z.ZodEnum<{
|
|
211
|
+
"provider-receipt": "provider-receipt";
|
|
212
|
+
"recorded-outcome": "recorded-outcome";
|
|
213
|
+
}>;
|
|
214
|
+
level: z.ZodEnum<{
|
|
215
|
+
"post-commit-content": "post-commit-content";
|
|
216
|
+
}>;
|
|
217
|
+
}, z.core.$strict>;
|
|
218
|
+
counterpartyRules: z.ZodString;
|
|
219
|
+
dataEffects: z.ZodString;
|
|
220
|
+
executionContract: z.ZodString;
|
|
221
|
+
evidenceRequirements: z.ZodArray<z.ZodString>;
|
|
222
|
+
capabilityUses: z.ZodNumber;
|
|
223
|
+
requiresExplicitGrant: z.ZodOptional<z.ZodBoolean>;
|
|
224
|
+
minPrincipalClass: z.ZodOptional<z.ZodLiteral<"adult">>;
|
|
225
|
+
claimRules: z.ZodArray<z.ZodObject<{
|
|
226
|
+
path: z.ZodString;
|
|
227
|
+
op: z.ZodEnum<{
|
|
228
|
+
in: "in";
|
|
229
|
+
includes: "includes";
|
|
230
|
+
eq: "eq";
|
|
231
|
+
neq: "neq";
|
|
232
|
+
excludes: "excludes";
|
|
233
|
+
}>;
|
|
234
|
+
value: z.ZodUnknown;
|
|
235
|
+
}, z.core.$strict>>;
|
|
236
|
+
bindingRules: z.ZodArray<z.ZodObject<{
|
|
237
|
+
field: z.ZodString;
|
|
238
|
+
claim: z.ZodString;
|
|
239
|
+
op: z.ZodEnum<{
|
|
240
|
+
within: "within";
|
|
241
|
+
memberOf: "memberOf";
|
|
242
|
+
}>;
|
|
243
|
+
}, z.core.$strict>>;
|
|
244
|
+
}, z.core.$strict>;
|
|
245
|
+
version: z.ZodNumber;
|
|
246
|
+
compatibility: z.ZodObject<{
|
|
247
|
+
registry: z.ZodLiteral<1>;
|
|
248
|
+
}, z.core.$strict>;
|
|
249
|
+
review: z.ZodObject<{
|
|
250
|
+
state: z.ZodEnum<{
|
|
251
|
+
draft: "draft";
|
|
252
|
+
revoked: "revoked";
|
|
253
|
+
approved: "approved";
|
|
254
|
+
}>;
|
|
255
|
+
reviewer: z.ZodString;
|
|
256
|
+
atEpochMs: z.ZodNumber;
|
|
257
|
+
}, z.core.$strict>;
|
|
258
|
+
rollback: z.ZodObject<{
|
|
259
|
+
supersedes: z.ZodOptional<z.ZodObject<{
|
|
260
|
+
actionId: z.ZodString;
|
|
261
|
+
version: z.ZodNumber;
|
|
262
|
+
}, z.core.$strict>>;
|
|
263
|
+
restores: z.ZodOptional<z.ZodObject<{
|
|
264
|
+
actionId: z.ZodString;
|
|
265
|
+
version: z.ZodNumber;
|
|
266
|
+
}, z.core.$strict>>;
|
|
267
|
+
}, z.core.$strict>;
|
|
268
|
+
provenance: z.ZodObject<{
|
|
269
|
+
source: z.ZodString;
|
|
270
|
+
generatedBy: z.ZodString;
|
|
271
|
+
}, z.core.$strict>;
|
|
272
|
+
publisher: z.ZodObject<{
|
|
273
|
+
id: z.ZodString;
|
|
274
|
+
keyId: z.ZodString;
|
|
275
|
+
}, z.core.$strict>;
|
|
276
|
+
}, z.core.$strict>;
|
|
277
|
+
export type ActionPackBody = z.infer<typeof ActionPackBodySchema>;
|
|
278
|
+
export declare const ActionPackSchema: z.ZodObject<{
|
|
279
|
+
pack: z.ZodLiteral<"guardian.action.v1">;
|
|
280
|
+
content: z.ZodObject<{
|
|
281
|
+
actionId: z.ZodString;
|
|
282
|
+
family: z.ZodString;
|
|
283
|
+
resourceType: z.ZodString;
|
|
284
|
+
humanLabel: z.ZodString;
|
|
285
|
+
description: z.ZodString;
|
|
286
|
+
risk: z.ZodEnum<{
|
|
287
|
+
R0: "R0";
|
|
288
|
+
R1: "R1";
|
|
289
|
+
R2: "R2";
|
|
290
|
+
R3: "R3";
|
|
291
|
+
R4: "R4";
|
|
292
|
+
R5: "R5";
|
|
293
|
+
}>;
|
|
294
|
+
reversibility: z.ZodEnum<{
|
|
295
|
+
destructive: "destructive";
|
|
296
|
+
reversible: "reversible";
|
|
297
|
+
limited: "limited";
|
|
298
|
+
difficult: "difficult";
|
|
299
|
+
"safety-sensitive": "safety-sensitive";
|
|
300
|
+
}>;
|
|
301
|
+
posture: z.ZodEnum<{
|
|
302
|
+
deny: "deny";
|
|
303
|
+
allow: "allow";
|
|
304
|
+
ask: "ask";
|
|
305
|
+
}>;
|
|
306
|
+
providers: z.ZodArray<z.ZodString>;
|
|
307
|
+
transport: z.ZodEnum<{
|
|
308
|
+
"api.request.v1": "api.request.v1";
|
|
309
|
+
}>;
|
|
310
|
+
materialFields: z.ZodArray<z.ZodObject<{
|
|
311
|
+
name: z.ZodString;
|
|
312
|
+
type: z.ZodEnum<{
|
|
313
|
+
string: "string";
|
|
314
|
+
number: "number";
|
|
315
|
+
boolean: "boolean";
|
|
316
|
+
object: "object";
|
|
317
|
+
array: "array";
|
|
318
|
+
integer: "integer";
|
|
319
|
+
}>;
|
|
320
|
+
required: z.ZodBoolean;
|
|
321
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
322
|
+
enum: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
323
|
+
mustStartWith: z.ZodOptional<z.ZodString>;
|
|
324
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
325
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
326
|
+
}, z.core.$strict>>;
|
|
327
|
+
requiredFields: z.ZodArray<z.ZodString>;
|
|
328
|
+
approvalDisplay: z.ZodArray<z.ZodObject<{
|
|
329
|
+
field: z.ZodString;
|
|
330
|
+
label: z.ZodString;
|
|
331
|
+
}, z.core.$strict>>;
|
|
332
|
+
verification: z.ZodObject<{
|
|
333
|
+
method: z.ZodEnum<{
|
|
334
|
+
"provider-receipt": "provider-receipt";
|
|
335
|
+
"recorded-outcome": "recorded-outcome";
|
|
336
|
+
}>;
|
|
337
|
+
level: z.ZodEnum<{
|
|
338
|
+
"post-commit-content": "post-commit-content";
|
|
339
|
+
}>;
|
|
340
|
+
}, z.core.$strict>;
|
|
341
|
+
counterpartyRules: z.ZodString;
|
|
342
|
+
dataEffects: z.ZodString;
|
|
343
|
+
executionContract: z.ZodString;
|
|
344
|
+
evidenceRequirements: z.ZodArray<z.ZodString>;
|
|
345
|
+
capabilityUses: z.ZodNumber;
|
|
346
|
+
requiresExplicitGrant: z.ZodOptional<z.ZodBoolean>;
|
|
347
|
+
minPrincipalClass: z.ZodOptional<z.ZodLiteral<"adult">>;
|
|
348
|
+
claimRules: z.ZodArray<z.ZodObject<{
|
|
349
|
+
path: z.ZodString;
|
|
350
|
+
op: z.ZodEnum<{
|
|
351
|
+
in: "in";
|
|
352
|
+
includes: "includes";
|
|
353
|
+
eq: "eq";
|
|
354
|
+
neq: "neq";
|
|
355
|
+
excludes: "excludes";
|
|
356
|
+
}>;
|
|
357
|
+
value: z.ZodUnknown;
|
|
358
|
+
}, z.core.$strict>>;
|
|
359
|
+
bindingRules: z.ZodArray<z.ZodObject<{
|
|
360
|
+
field: z.ZodString;
|
|
361
|
+
claim: z.ZodString;
|
|
362
|
+
op: z.ZodEnum<{
|
|
363
|
+
within: "within";
|
|
364
|
+
memberOf: "memberOf";
|
|
365
|
+
}>;
|
|
366
|
+
}, z.core.$strict>>;
|
|
367
|
+
}, z.core.$strict>;
|
|
368
|
+
version: z.ZodNumber;
|
|
369
|
+
compatibility: z.ZodObject<{
|
|
370
|
+
registry: z.ZodLiteral<1>;
|
|
371
|
+
}, z.core.$strict>;
|
|
372
|
+
review: z.ZodObject<{
|
|
373
|
+
state: z.ZodEnum<{
|
|
374
|
+
draft: "draft";
|
|
375
|
+
revoked: "revoked";
|
|
376
|
+
approved: "approved";
|
|
377
|
+
}>;
|
|
378
|
+
reviewer: z.ZodString;
|
|
379
|
+
atEpochMs: z.ZodNumber;
|
|
380
|
+
}, z.core.$strict>;
|
|
381
|
+
rollback: z.ZodObject<{
|
|
382
|
+
supersedes: z.ZodOptional<z.ZodObject<{
|
|
383
|
+
actionId: z.ZodString;
|
|
384
|
+
version: z.ZodNumber;
|
|
385
|
+
}, z.core.$strict>>;
|
|
386
|
+
restores: z.ZodOptional<z.ZodObject<{
|
|
387
|
+
actionId: z.ZodString;
|
|
388
|
+
version: z.ZodNumber;
|
|
389
|
+
}, z.core.$strict>>;
|
|
390
|
+
}, z.core.$strict>;
|
|
391
|
+
provenance: z.ZodObject<{
|
|
392
|
+
source: z.ZodString;
|
|
393
|
+
generatedBy: z.ZodString;
|
|
394
|
+
}, z.core.$strict>;
|
|
395
|
+
publisher: z.ZodObject<{
|
|
396
|
+
id: z.ZodString;
|
|
397
|
+
keyId: z.ZodString;
|
|
398
|
+
}, z.core.$strict>;
|
|
399
|
+
integrity: z.ZodObject<{
|
|
400
|
+
algorithm: z.ZodLiteral<"sha256">;
|
|
401
|
+
digest: z.ZodString;
|
|
402
|
+
}, z.core.$strict>;
|
|
403
|
+
signature: z.ZodObject<{
|
|
404
|
+
algorithm: z.ZodLiteral<"Ed25519">;
|
|
405
|
+
domain: z.ZodLiteral<"odingard.guardian.action-pack.v1">;
|
|
406
|
+
canonicalization: z.ZodLiteral<"guardian-jcs-v1">;
|
|
407
|
+
keyId: z.ZodString;
|
|
408
|
+
signature: z.ZodString;
|
|
409
|
+
}, z.core.$strict>;
|
|
410
|
+
}, z.core.$strict>;
|
|
411
|
+
export type ActionPack = z.infer<typeof ActionPackSchema>;
|
|
412
|
+
/** The canonical body the integrity digest covers (pack minus integrity/sig). */
|
|
413
|
+
export declare function actionPackBody(pack: ActionPack): ActionPackBody;
|
|
414
|
+
/** sha256 over the canonical pack body — the declared integrity digest. */
|
|
415
|
+
export declare function actionPackIntegrity(pack: ActionPack): string;
|
|
416
|
+
/** UTF-8 bytes of the canonical signed document (domain-separated). */
|
|
417
|
+
export declare function actionPackSigningInput(pack: ActionPack): Uint8Array;
|
|
418
|
+
export type ActionPackRejection = "PACK_SCHEMA_INVALID" | "PACK_INTEGRITY_MISMATCH" | "PACK_KEY_MISMATCH" | "PACK_PUBLISHER_UNTRUSTED" | "PACK_SIGNATURE_INVALID" | "PACK_NOT_APPROVED" | "PACK_FIELD_SCOPE_INVALID" | "PACK_TRANSPORT_FIELDS_INVALID" | "PACK_ACTION_SHADOWS_BUILTIN" | "PACK_VERSION_AMBIGUOUS";
|
|
419
|
+
/**
|
|
420
|
+
* Verifies a signed Action Pack against the human-governed trust set. Every
|
|
421
|
+
* rejection is deterministic: the named action never enters the registry, so
|
|
422
|
+
* proposals for it resolve as unknown actions and DENY.
|
|
423
|
+
*/
|
|
424
|
+
export declare function verifyActionPack(input: unknown, trust: ActionPackTrustSet): Readonly<{
|
|
425
|
+
ok: true;
|
|
426
|
+
pack: ActionPack;
|
|
427
|
+
}> | Readonly<{
|
|
428
|
+
ok: false;
|
|
429
|
+
reasonCode: ActionPackRejection;
|
|
430
|
+
}>;
|
|
431
|
+
/**
|
|
432
|
+
* Derives the ActionDefinition a verified pack installs. The definition's
|
|
433
|
+
* hooks are registry-side executable logic (allowed: §43) — the pack itself
|
|
434
|
+
* only carries declarative data the hooks evaluate.
|
|
435
|
+
*/
|
|
436
|
+
export declare function actionDefinitionFromPack(body: ActionPackBody): ActionDefinition;
|
|
437
|
+
/**
|
|
438
|
+
* Installs verified packs into a registry composed over an optional builtin
|
|
439
|
+
* base. Selection is deterministic: the highest-version approved pack per
|
|
440
|
+
* actionId wins; a pack cannot shadow a builtin action; equal-version
|
|
441
|
+
* ambiguity rejects every candidate. `rejected` reports each pack that did
|
|
442
|
+
* not install and why — the action stays unregistered and DENYs.
|
|
443
|
+
*/
|
|
444
|
+
export declare function createPackBackedRegistry(input: {
|
|
445
|
+
packs: readonly unknown[];
|
|
446
|
+
trust: ActionPackTrustSet;
|
|
447
|
+
base?: {
|
|
448
|
+
get(actionId: string): unknown;
|
|
449
|
+
entries(): readonly ActionDefinition[];
|
|
450
|
+
};
|
|
451
|
+
}): {
|
|
452
|
+
registry: {
|
|
453
|
+
get(actionId: string): ActionDefinition | undefined;
|
|
454
|
+
entries(): readonly ActionDefinition[];
|
|
455
|
+
};
|
|
456
|
+
installed: readonly {
|
|
457
|
+
actionId: string;
|
|
458
|
+
version: number;
|
|
459
|
+
}[];
|
|
460
|
+
rejected: readonly {
|
|
461
|
+
actionId?: string;
|
|
462
|
+
reasonCode: ActionPackRejection;
|
|
463
|
+
}[];
|
|
464
|
+
};
|