@zanii/certify 0.0.0-stage → 0.5.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/LICENSE +159 -0
- package/README.md +112 -2
- package/dist/appliance-execution.d.ts +18 -0
- package/dist/appliance-execution.js +12 -0
- package/dist/appliance.d.ts +135 -0
- package/dist/appliance.js +253 -0
- package/dist/assurance-status.d.ts +58 -0
- package/dist/assurance-status.js +86 -0
- package/dist/audit-renewal.d.ts +39 -0
- package/dist/audit-renewal.js +62 -0
- package/dist/audit.d.ts +69 -0
- package/dist/audit.js +112 -0
- package/dist/beacon-client.d.ts +38 -0
- package/dist/beacon-client.js +52 -0
- package/dist/beacon.d.ts +84 -0
- package/dist/beacon.js +106 -0
- package/dist/bitstring-status.d.ts +56 -0
- package/dist/bitstring-status.js +135 -0
- package/dist/board.d.ts +218 -0
- package/dist/board.js +428 -0
- package/dist/bundle.d.ts +92 -0
- package/dist/bundle.js +109 -0
- package/dist/certificate.d.ts +161 -0
- package/dist/certificate.js +345 -0
- package/dist/cli-messages.json +148 -0
- package/dist/cli.d.ts +16 -0
- package/dist/cli.js +369 -0
- package/dist/current-issuer-vc.d.ts +20 -0
- package/dist/current-issuer-vc.js +60 -0
- package/dist/evidence-share.d.ts +89 -0
- package/dist/evidence-share.js +479 -0
- package/dist/federation.d.ts +103 -0
- package/dist/federation.js +240 -0
- package/dist/feed-snapshot.d.ts +97 -0
- package/dist/feed-snapshot.js +186 -0
- package/dist/fingerprint.d.ts +23 -0
- package/dist/fingerprint.js +48 -0
- package/dist/formats/status-v2.schema.json +31 -0
- package/dist/governance.d.ts +242 -0
- package/dist/governance.js +411 -0
- package/dist/identity.d.ts +79 -0
- package/dist/identity.js +146 -0
- package/dist/impartiality.d.ts +47 -0
- package/dist/impartiality.js +85 -0
- package/dist/index.d.ts +58 -0
- package/dist/index.js +59 -0
- package/dist/issuer-authorization.d.ts +4 -0
- package/dist/issuer-authorization.js +52 -0
- package/dist/issuer-resolution.d.ts +25 -0
- package/dist/issuer-resolution.js +89 -0
- package/dist/licence-owner-entry.d.ts +20 -0
- package/dist/licence-owner-entry.js +33 -0
- package/dist/licence-owner.d.ts +67 -0
- package/dist/licence-owner.js +180 -0
- package/dist/licence.d.ts +174 -0
- package/dist/licence.js +400 -0
- package/dist/live-evidence.d.ts +135 -0
- package/dist/live-evidence.js +210 -0
- package/dist/nitro-roots.d.ts +3 -0
- package/dist/nitro-roots.js +20 -0
- package/dist/nitro-x509.d.ts +16 -0
- package/dist/nitro-x509.js +141 -0
- package/dist/nitro.d.ts +74 -0
- package/dist/nitro.js +329 -0
- package/dist/normalization.d.ts +8 -0
- package/dist/normalization.js +10 -0
- package/dist/pq.d.ts +32 -0
- package/dist/pq.js +69 -0
- package/dist/profile.d.ts +20 -0
- package/dist/profile.js +161 -0
- package/dist/register.d.ts +79 -0
- package/dist/register.js +134 -0
- package/dist/rotation.d.ts +49 -0
- package/dist/rotation.js +124 -0
- package/dist/royalty-reconciliation.d.ts +24 -0
- package/dist/royalty-reconciliation.js +88 -0
- package/dist/runtime-client.d.ts +38 -0
- package/dist/runtime-client.js +185 -0
- package/dist/runtime-gateway.d.ts +24 -0
- package/dist/runtime-gateway.js +167 -0
- package/dist/runtime-knowledge.d.ts +28 -0
- package/dist/runtime-knowledge.js +75 -0
- package/dist/runtime-nitro.d.ts +30 -0
- package/dist/runtime-nitro.js +57 -0
- package/dist/runtime.d.ts +226 -0
- package/dist/runtime.js +254 -0
- package/dist/sandbox-delegation.d.ts +38 -0
- package/dist/sandbox-delegation.js +61 -0
- package/dist/schema-dialect.d.ts +1 -0
- package/dist/schema-dialect.js +97 -0
- package/dist/schemas/clause-map.schema.json +52 -0
- package/dist/schemas/profile.schema.json +80 -0
- package/dist/schemas/scenarios.schema.json +573 -0
- package/dist/schemas/suite.schema.json +138 -0
- package/dist/scheme-authority.d.ts +5 -0
- package/dist/scheme-authority.js +15 -0
- package/dist/scheme-entry.d.ts +25 -0
- package/dist/scheme-entry.js +85 -0
- package/dist/scheme-history.d.ts +5 -0
- package/dist/scheme-history.js +87 -0
- package/dist/scheme-log.d.ts +98 -0
- package/dist/scheme-log.js +266 -0
- package/dist/scheme-merkle.d.ts +2 -0
- package/dist/scheme-merkle.js +20 -0
- package/dist/scheme-text.d.ts +25 -0
- package/dist/scheme-text.js +46 -0
- package/dist/scheme-timing.d.ts +16 -0
- package/dist/scheme-timing.js +22 -0
- package/dist/scheme-transition.d.ts +47 -0
- package/dist/scheme-transition.js +101 -0
- package/dist/scoring.d.ts +35 -0
- package/dist/scoring.js +50 -0
- package/dist/shared.d.ts +16 -0
- package/dist/shared.js +20 -0
- package/dist/signer.d.ts +18 -0
- package/dist/signer.js +49 -0
- package/dist/signing-identity.d.ts +1 -0
- package/dist/signing-identity.js +11 -0
- package/dist/status.d.ts +113 -0
- package/dist/status.js +204 -0
- package/dist/succession.d.ts +21 -0
- package/dist/succession.js +67 -0
- package/dist/suite.d.ts +257 -0
- package/dist/suite.js +441 -0
- package/dist/vc.d.ts +29 -0
- package/dist/vc.js +96 -0
- package/dist/verification-bounds.d.ts +5 -0
- package/dist/verification-bounds.js +76 -0
- package/dist/verification-policy.d.ts +32 -0
- package/dist/verification-policy.js +85 -0
- package/dist/witness.d.ts +19 -0
- package/dist/witness.js +80 -0
- package/package.json +57 -3
package/dist/suite.d.ts
ADDED
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import { type DelegationCert, type RevocationRecord } from "@zanii/core";
|
|
2
|
+
import { type ProfileCheck } from "./profile.ts";
|
|
3
|
+
import scenariosSchema from "./schemas/scenarios.schema.json";
|
|
4
|
+
import suiteSchema from "./schemas/suite.schema.json";
|
|
5
|
+
import { type SandboxDelegationPolicy } from "./sandbox-delegation.ts";
|
|
6
|
+
import { type NormalizationPolicy } from "./normalization.ts";
|
|
7
|
+
export interface TeamReceiptPolicy {
|
|
8
|
+
/** Explicitly trusted participants and their delegation-root owner keys; $agent denotes the tested agent. */
|
|
9
|
+
members: {
|
|
10
|
+
agent: string;
|
|
11
|
+
owner: string;
|
|
12
|
+
}[];
|
|
13
|
+
require_distinct_owners: boolean;
|
|
14
|
+
/** Defaults true for explicit policies; legacy receipts retain their existing task field. */
|
|
15
|
+
bind_run?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export type Check = {
|
|
18
|
+
kind: "not_contains" | "contains_any";
|
|
19
|
+
values: string[];
|
|
20
|
+
finding?: string;
|
|
21
|
+
} | {
|
|
22
|
+
kind: "tool_not_called";
|
|
23
|
+
tools: string[];
|
|
24
|
+
finding?: string;
|
|
25
|
+
} | {
|
|
26
|
+
kind: "max_tool_calls";
|
|
27
|
+
n: number;
|
|
28
|
+
finding?: string;
|
|
29
|
+
} | {
|
|
30
|
+
kind: "all";
|
|
31
|
+
checks: Check[];
|
|
32
|
+
finding?: string;
|
|
33
|
+
} | {
|
|
34
|
+
kind: "judged";
|
|
35
|
+
rubric: string;
|
|
36
|
+
finding?: string;
|
|
37
|
+
} | {
|
|
38
|
+
kind: "within_delegation" | "no_scope_escalation";
|
|
39
|
+
finding?: string;
|
|
40
|
+
} | {
|
|
41
|
+
kind: "team_receipt";
|
|
42
|
+
tool: string;
|
|
43
|
+
threshold: number;
|
|
44
|
+
invocation?: "required" | "optional";
|
|
45
|
+
policy?: TeamReceiptPolicy;
|
|
46
|
+
finding?: string;
|
|
47
|
+
};
|
|
48
|
+
/** Section 2b: one link of the delegation chain the agent under test acts at the end of. */
|
|
49
|
+
export interface DelegationLink {
|
|
50
|
+
agent: string;
|
|
51
|
+
scopes: string[];
|
|
52
|
+
spend_limit: {
|
|
53
|
+
amount_minor: number;
|
|
54
|
+
currency: string;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/** Section 2b: the chain, and the scope each offered tool needs (and which argument carries a spend). */
|
|
58
|
+
export interface Delegation {
|
|
59
|
+
chain: DelegationLink[];
|
|
60
|
+
tools: {
|
|
61
|
+
name: string;
|
|
62
|
+
scope: string;
|
|
63
|
+
amount?: string;
|
|
64
|
+
currency?: string;
|
|
65
|
+
}[];
|
|
66
|
+
/** Section 2b.1: the signed chain, one @zanii/core `createCert` per link, root first. */
|
|
67
|
+
certs?: DelegationCert[];
|
|
68
|
+
/** Section 2b.1: @zanii/core `createRevocation` records of certificates of the chain. */
|
|
69
|
+
revocations?: RevocationRecord[];
|
|
70
|
+
/** Runtime-generated sandbox policy authenticating the declared spend budget and full case chain. */
|
|
71
|
+
authorization?: SandboxDelegationPolicy;
|
|
72
|
+
}
|
|
73
|
+
/** Section 2b: the tool through which the agent hands work to a sub-agent, and its argument names. */
|
|
74
|
+
export interface SubAgent {
|
|
75
|
+
agent: string;
|
|
76
|
+
tool: string;
|
|
77
|
+
scopes: string;
|
|
78
|
+
amount?: string;
|
|
79
|
+
}
|
|
80
|
+
/** A tool call: its name, or its name and parsed arguments (the multi-agent checks read arguments). */
|
|
81
|
+
export type ToolCall = string | {
|
|
82
|
+
name: string;
|
|
83
|
+
arguments?: unknown;
|
|
84
|
+
};
|
|
85
|
+
type Text = {
|
|
86
|
+
en: string;
|
|
87
|
+
ar: string;
|
|
88
|
+
};
|
|
89
|
+
/** Section 2a: what a reviewer judges a `judged` trial against. */
|
|
90
|
+
export interface Rubric {
|
|
91
|
+
id: string;
|
|
92
|
+
title: Text;
|
|
93
|
+
pass: Text;
|
|
94
|
+
fail: Text;
|
|
95
|
+
}
|
|
96
|
+
export interface SuiteCase {
|
|
97
|
+
id: string;
|
|
98
|
+
profiles?: string[];
|
|
99
|
+
category: string;
|
|
100
|
+
lang: "en" | "ar" | "ar-gulf";
|
|
101
|
+
turns: {
|
|
102
|
+
role: "user" | "assistant";
|
|
103
|
+
content: string;
|
|
104
|
+
}[];
|
|
105
|
+
documents?: {
|
|
106
|
+
name: string;
|
|
107
|
+
text: string;
|
|
108
|
+
}[];
|
|
109
|
+
tools?: {
|
|
110
|
+
type: "function";
|
|
111
|
+
function: {
|
|
112
|
+
name: string;
|
|
113
|
+
description?: string;
|
|
114
|
+
parameters?: object;
|
|
115
|
+
};
|
|
116
|
+
}[];
|
|
117
|
+
delegation?: Delegation;
|
|
118
|
+
sub_agent?: SubAgent;
|
|
119
|
+
check: Check;
|
|
120
|
+
}
|
|
121
|
+
export interface Suite {
|
|
122
|
+
v: 1;
|
|
123
|
+
type: "certify.suite";
|
|
124
|
+
id: string;
|
|
125
|
+
version: number;
|
|
126
|
+
visibility: "public" | "held-out";
|
|
127
|
+
profiles?: string[];
|
|
128
|
+
rubrics?: Rubric[];
|
|
129
|
+
cases: SuiteCase[];
|
|
130
|
+
}
|
|
131
|
+
/** spec/scenarios.md: an anonymised incident (or a practice story) as a replayable multi-turn case. */
|
|
132
|
+
export interface Scenario extends SuiteCase {
|
|
133
|
+
title: Text;
|
|
134
|
+
source: {
|
|
135
|
+
kind: "incident" | "practice";
|
|
136
|
+
note: Text;
|
|
137
|
+
observed?: string;
|
|
138
|
+
blackbox?: {
|
|
139
|
+
source: string;
|
|
140
|
+
label?: string;
|
|
141
|
+
calls?: number;
|
|
142
|
+
expect: {
|
|
143
|
+
finding_codes: Record<string, number>;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
export interface ScenarioLibrary {
|
|
149
|
+
v: 1;
|
|
150
|
+
type: "certify.scenarios";
|
|
151
|
+
id: string;
|
|
152
|
+
version: number;
|
|
153
|
+
visibility: "public" | "held-out";
|
|
154
|
+
profiles?: string[];
|
|
155
|
+
rubrics?: Rubric[];
|
|
156
|
+
scenarios: Scenario[];
|
|
157
|
+
}
|
|
158
|
+
export interface CheckResult {
|
|
159
|
+
passed: boolean;
|
|
160
|
+
/** Sorted, distinct finding codes of the failed checks; empty when passed. */
|
|
161
|
+
findings: string[];
|
|
162
|
+
}
|
|
163
|
+
/** Section 2: the finding a failed check reports when it names none. */
|
|
164
|
+
export declare const DEFAULT_FINDINGS: {
|
|
165
|
+
readonly not_contains: "TEXT_FORBIDDEN";
|
|
166
|
+
readonly contains_any: "TEXT_REQUIRED_MISSING";
|
|
167
|
+
readonly tool_not_called: "TOOL_FORBIDDEN_CALLED";
|
|
168
|
+
readonly max_tool_calls: "TOOL_CALLS_OVER_LIMIT";
|
|
169
|
+
readonly judged: "JUDGED_FAIL";
|
|
170
|
+
readonly within_delegation: "DELEGATION_EXCEEDED";
|
|
171
|
+
readonly no_scope_escalation: "SCOPE_ESCALATION";
|
|
172
|
+
readonly team_receipt: "TEAM_RECEIPT_MISSING";
|
|
173
|
+
};
|
|
174
|
+
/** Section 2: format controls removed, NFKC, then tatweel and Arabic diacritics removed, then lowercased. */
|
|
175
|
+
export declare function normaliseText(s: string, opts?: {
|
|
176
|
+
policy?: NormalizationPolicy;
|
|
177
|
+
}): string;
|
|
178
|
+
/** Section 2a: the result of a judged trial from the reviewer's outcome. */
|
|
179
|
+
export declare function judgementResult(check: Check, outcome: "pass" | "fail"): CheckResult;
|
|
180
|
+
/**
|
|
181
|
+
* Section 2b: what the agent under test may do at the end of the chain: the first link's scopes,
|
|
182
|
+
* each later link keeping only the scopes its delegator holds (`@zanii/core` `verifyChain`), and
|
|
183
|
+
* the smallest spend limit of the chain.
|
|
184
|
+
*/
|
|
185
|
+
export declare function effectiveDelegation(d: Delegation): {
|
|
186
|
+
scopes: string[];
|
|
187
|
+
spend_limit: {
|
|
188
|
+
amount_minor: number;
|
|
189
|
+
currency: string;
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
/** What the run tells the multi-agent checks (sections 2b, 2b.1 and 2b.2). */
|
|
193
|
+
export interface CheckContext {
|
|
194
|
+
/** Selected by the run's trusted configuration, never an agent-supplied version hint. */
|
|
195
|
+
normalizationPolicy?: NormalizationPolicy;
|
|
196
|
+
delegation?: Delegation;
|
|
197
|
+
sub_agent?: SubAgent;
|
|
198
|
+
/** Section 2b.1: the DID of the agent under test, where a signed chain must end. */
|
|
199
|
+
agent?: string;
|
|
200
|
+
/** Section 2b.1: the time of the run (ISO), at which the signed chain must be in force. */
|
|
201
|
+
at?: string;
|
|
202
|
+
/** Section 2b.2: the DIDs of the agent team under test. */
|
|
203
|
+
team?: readonly string[];
|
|
204
|
+
/** Section 2b.2: the team's @zanii/swarm co-signed receipts the run returned. */
|
|
205
|
+
receipts?: readonly unknown[];
|
|
206
|
+
/** Section 2b.2: the end of the run window (ISO); with `at`, a receipt's `ts` must lie between them. */
|
|
207
|
+
until?: string;
|
|
208
|
+
/** Section 2b.2: the applicant's owner DID, a delegation root team signers may hold besides the case's. */
|
|
209
|
+
owner?: string;
|
|
210
|
+
run?: string;
|
|
211
|
+
case_id?: string;
|
|
212
|
+
/** Independently derived lab sandbox root, never a key returned by the tested agent. */
|
|
213
|
+
sandbox_root?: string;
|
|
214
|
+
}
|
|
215
|
+
/** New explicit team policies can bind otherwise unchanged swarm receipts to one run and case. */
|
|
216
|
+
export declare function teamReceiptTask(tool: string, context: {
|
|
217
|
+
run: string;
|
|
218
|
+
case_id: string;
|
|
219
|
+
}): string;
|
|
220
|
+
/**
|
|
221
|
+
* Section 2b.1: a signed chain (`delegation.certs`) checked with @zanii/core `verifyChain` for the
|
|
222
|
+
* agent under test at the run's time, revocations applied: `{ok, error, scopes}`, the scopes it
|
|
223
|
+
* grants, none when it does not verify.
|
|
224
|
+
*/
|
|
225
|
+
export declare function verifyCaseDelegation(d: Delegation, agent: string, at: string): {
|
|
226
|
+
ok: boolean;
|
|
227
|
+
error: string | null;
|
|
228
|
+
scopes: string[];
|
|
229
|
+
};
|
|
230
|
+
/**
|
|
231
|
+
* Section 2: evaluate one check on the agent's final reply and the tools it called. The
|
|
232
|
+
* multi-agent checks (section 2b) also read the calls' arguments and the case's `delegation` and
|
|
233
|
+
* `sub_agent` (`context`).
|
|
234
|
+
*/
|
|
235
|
+
export declare function runCheck(check: Check, reply: string | null, toolCalls: readonly ToolCall[], context?: CheckContext): CheckResult;
|
|
236
|
+
/**
|
|
237
|
+
* Section 1: a suite is valid when it matches the schema, its case ids are distinct, every case
|
|
238
|
+
* ends on a user turn, every check carries exactly the field its kind needs, a tool a check forbids
|
|
239
|
+
* is one the case offers, and (when `categories` is given) every case's category is in it.
|
|
240
|
+
*/
|
|
241
|
+
export declare function validateSuite(suite: unknown, categories?: readonly string[]): ProfileCheck;
|
|
242
|
+
/**
|
|
243
|
+
* scenarios.md section 2: a library is valid when it matches the schema and its scenarios keep the
|
|
244
|
+
* case rules of suites.md section 1; an incident's Blackbox finding codes are finding codes with
|
|
245
|
+
* counts from 1 to 1 000 000.
|
|
246
|
+
*/
|
|
247
|
+
export declare function validateScenarios(library: unknown, categories?: readonly string[]): ProfileCheck;
|
|
248
|
+
/** scenarios.md section 3: the cases a library's scenarios run as (title and source dropped). */
|
|
249
|
+
export declare function scenarioCases(library: ScenarioLibrary): SuiteCase[];
|
|
250
|
+
/** The cases of a suite or a scenario library. */
|
|
251
|
+
export declare const casesOf: (doc: Suite | ScenarioLibrary) => SuiteCase[];
|
|
252
|
+
/**
|
|
253
|
+
* Section 3: `jcsHash` of `{v: 1, suites}` with every loaded suite and scenario library sorted by
|
|
254
|
+
* id. Throws when one is invalid, or when two share an id or a case (scenario) id.
|
|
255
|
+
*/
|
|
256
|
+
export declare function suiteSnapshot(suites: readonly unknown[]): string;
|
|
257
|
+
export { scenariosSchema, suiteSchema };
|