dissent 0.0.0-stage → 0.1.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 +202 -0
- package/README.md +282 -2
- package/dist/index.d.ts +493 -0
- package/dist/index.js +3793 -0
- package/dist/index.js.map +1 -0
- package/package.json +73 -4
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,493 @@
|
|
|
1
|
+
import { FinishReason, FlexibleSchema, Instructions, JSONValue, LanguageModel, LanguageModelCallOptions, ModelMessage, RequestOptions, TelemetryOptions, TimeoutConfiguration, ToolSet, generateText } from "ai";
|
|
2
|
+
type GenerateTextProviderOptions = Parameters<typeof generateText>[0]['providerOptions'];
|
|
3
|
+
/** Per-witness overrides. Same meaning as the `generateText` options of the same name. */
|
|
4
|
+
type WitnessSettings = LanguageModelCallOptions & {
|
|
5
|
+
timeout?: TimeoutConfiguration<ToolSet>;
|
|
6
|
+
maxRetries?: number;
|
|
7
|
+
headers?: RequestOptions<ToolSet>['headers'];
|
|
8
|
+
providerOptions?: GenerateTextProviderOptions;
|
|
9
|
+
};
|
|
10
|
+
type WitnessEntry = LanguageModel | {
|
|
11
|
+
model: LanguageModel;
|
|
12
|
+
settings?: WitnessSettings;
|
|
13
|
+
};
|
|
14
|
+
type ComparatorOverride = 'exact' | 'set' | 'none' | {
|
|
15
|
+
comparator: 'exact' | 'set' | 'none';
|
|
16
|
+
onSplit?: Severity;
|
|
17
|
+
} | {
|
|
18
|
+
onSplit: Severity;
|
|
19
|
+
} | {
|
|
20
|
+
tolerance: ToleranceSpec;
|
|
21
|
+
onSplit?: Severity;
|
|
22
|
+
} | {
|
|
23
|
+
key: string;
|
|
24
|
+
onSplit?: Severity;
|
|
25
|
+
};
|
|
26
|
+
type CompareOverrides<T> = Partial<Record<(T extends object ? Extract<keyof T, string> : never) | `/${string}`, ComparatorOverride>>;
|
|
27
|
+
type CorroborateOptions<T, W extends string> = {
|
|
28
|
+
/** Two to 16 witnesses. Keys are labels. */
|
|
29
|
+
witnesses: Record<W, WitnessEntry>;
|
|
30
|
+
/** The only schema input in v0.1. Its JSON Schema root MUST be an object. */
|
|
31
|
+
schema: FlexibleSchema<T>;
|
|
32
|
+
schemaName?: string;
|
|
33
|
+
schemaDescription?: string;
|
|
34
|
+
instructions?: Instructions;
|
|
35
|
+
compare?: CompareOverrides<T>;
|
|
36
|
+
provenance?: {
|
|
37
|
+
/** Each entry MUST be `provider/modelId`. */
|
|
38
|
+
authorModels: readonly string[];
|
|
39
|
+
/** Default false. When true, matching witnesses are excluded and listed. */
|
|
40
|
+
excludeAuthor?: boolean;
|
|
41
|
+
};
|
|
42
|
+
/** Default 'normalize-for-hash'. Never changes what is sent. */
|
|
43
|
+
lineEndings?: 'normalize-for-hash' | 'preserve';
|
|
44
|
+
/** Default 'hash'. 'full' copies the input into `ledger.question.raw`. */
|
|
45
|
+
includeInput?: 'hash' | 'full';
|
|
46
|
+
/** Default false. When true, `coverage-low` is critical. */
|
|
47
|
+
strictCoverage?: boolean;
|
|
48
|
+
/** Default 8. Integer in [1, 16]. */
|
|
49
|
+
maxConcurrency?: number;
|
|
50
|
+
/** Default 1_048_576. UTF-8 bytes of canonical JSON per witness output. */
|
|
51
|
+
maxOutputBytes?: number;
|
|
52
|
+
/** Default 2048. UTF-8 bytes per error `message` and per `rawText`. */
|
|
53
|
+
maxErrorTextBytes?: number;
|
|
54
|
+
/** Called once per witness as it settles, in settle order. */
|
|
55
|
+
onWitness?: (label: W, record: WitnessRecord<T>) => void;
|
|
56
|
+
abortSignal?: AbortSignal;
|
|
57
|
+
timeout?: TimeoutConfiguration<ToolSet>;
|
|
58
|
+
maxRetries?: number;
|
|
59
|
+
headers?: RequestOptions<ToolSet>['headers'];
|
|
60
|
+
providerOptions?: GenerateTextProviderOptions;
|
|
61
|
+
telemetry?: TelemetryOptions;
|
|
62
|
+
} & ({
|
|
63
|
+
prompt: string | ModelMessage[];
|
|
64
|
+
messages?: never;
|
|
65
|
+
} | {
|
|
66
|
+
messages: ModelMessage[];
|
|
67
|
+
prompt?: never;
|
|
68
|
+
});
|
|
69
|
+
type Severity = 'info' | 'warn' | 'critical';
|
|
70
|
+
type Advisory = 'clear' | 'warnings' | 'review-required';
|
|
71
|
+
type Ledger<T, W extends string = string> = {
|
|
72
|
+
protocol: 'dissent-ledger/1';
|
|
73
|
+
/** Inputs only (§4.5, I3). */
|
|
74
|
+
fingerprint: string;
|
|
75
|
+
question: QuestionRecord;
|
|
76
|
+
plan: {
|
|
77
|
+
fingerprint: string;
|
|
78
|
+
fields: Record<string, FieldPlan>;
|
|
79
|
+
};
|
|
80
|
+
witnesses: Record<W, WitnessRecord<T>>;
|
|
81
|
+
quorum: Quorum;
|
|
82
|
+
independence: Independence<W>;
|
|
83
|
+
fields: Record<string, FieldResult<W>>;
|
|
84
|
+
coverage: Coverage;
|
|
85
|
+
findings: Finding<W>[];
|
|
86
|
+
advisory: Advisory;
|
|
87
|
+
usage: {
|
|
88
|
+
perWitness: Record<W, WitnessUsage | null>;
|
|
89
|
+
total: WitnessUsage;
|
|
90
|
+
};
|
|
91
|
+
/** ISO-8601 UTC with milliseconds. Not fingerprinted. */
|
|
92
|
+
createdAt: string;
|
|
93
|
+
};
|
|
94
|
+
type QuestionRecord = {
|
|
95
|
+
fingerprint: string;
|
|
96
|
+
inputKind: 'prompt' | 'messages';
|
|
97
|
+
/** sha256 of canonical JSON of the hash form of `prompt` or `messages` (§4.2). */
|
|
98
|
+
inputHash: string;
|
|
99
|
+
/** null when `instructions` was not given. */
|
|
100
|
+
instructionsHash: string | null;
|
|
101
|
+
/** sha256 of canonical JSON of { jsonSchema, name, description } (absent keys omitted). */
|
|
102
|
+
schemaHash: string;
|
|
103
|
+
/** UTF-8 byte length of the canonical JSON whose hash is `inputHash`. */
|
|
104
|
+
inputBytes: number;
|
|
105
|
+
lineEndings: 'normalized-for-hash' | 'preserved';
|
|
106
|
+
/** Only with includeInput: 'full'. JSON-safe form of the input as sent (§4.2). */
|
|
107
|
+
raw?: {
|
|
108
|
+
instructions?: JSONValue;
|
|
109
|
+
prompt?: JSONValue;
|
|
110
|
+
messages?: JSONValue;
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
type Quorum = {
|
|
114
|
+
listed: number;
|
|
115
|
+
asked: number;
|
|
116
|
+
answered: number;
|
|
117
|
+
failed: number;
|
|
118
|
+
excluded: number;
|
|
119
|
+
};
|
|
120
|
+
type ModelIdentity = {
|
|
121
|
+
provider: string;
|
|
122
|
+
modelId: string;
|
|
123
|
+
/** Matching key (§8.2). Lowercase. */
|
|
124
|
+
canonicalId: string;
|
|
125
|
+
/** Provider prefix of canonicalId, or '(default)'. */
|
|
126
|
+
providerKey: string;
|
|
127
|
+
};
|
|
128
|
+
type WitnessUsage = {
|
|
129
|
+
inputTokens: number | null;
|
|
130
|
+
outputTokens: number | null;
|
|
131
|
+
totalTokens: number | null;
|
|
132
|
+
cacheReadTokens: number | null;
|
|
133
|
+
cacheWriteTokens: number | null;
|
|
134
|
+
reasoningTokens: number | null;
|
|
135
|
+
};
|
|
136
|
+
type WitnessBase = {
|
|
137
|
+
requested: ModelIdentity;
|
|
138
|
+
durationMs: number;
|
|
139
|
+
};
|
|
140
|
+
type WitnessRecord<T> = (WitnessBase & {
|
|
141
|
+
status: 'answered';
|
|
142
|
+
served: ModelIdentity | null;
|
|
143
|
+
output: T;
|
|
144
|
+
finishReason: FinishReason;
|
|
145
|
+
usage: WitnessUsage;
|
|
146
|
+
/** Each SDK warning as sanitized JSON, at most 16 entries. */
|
|
147
|
+
warnings: JSONValue[];
|
|
148
|
+
}) | (WitnessBase & {
|
|
149
|
+
status: 'failed';
|
|
150
|
+
served: ModelIdentity | null;
|
|
151
|
+
error: WitnessError;
|
|
152
|
+
usage: WitnessUsage | null;
|
|
153
|
+
}) | (WitnessBase & {
|
|
154
|
+
status: 'excluded';
|
|
155
|
+
stage: 'before-dispatch' | 'after-response';
|
|
156
|
+
match: {
|
|
157
|
+
authorModel: string;
|
|
158
|
+
on: 'requested' | 'served';
|
|
159
|
+
};
|
|
160
|
+
served: ModelIdentity | null;
|
|
161
|
+
output?: T;
|
|
162
|
+
usage: WitnessUsage | null;
|
|
163
|
+
});
|
|
164
|
+
type WitnessErrorKind = 'invalid-output' | 'truncated' | 'refused' | 'api-error' | 'timeout' | 'aborted' | 'unknown';
|
|
165
|
+
type WitnessError = {
|
|
166
|
+
kind: WitnessErrorKind;
|
|
167
|
+
/** error.name, sanitized; 'NonJsonValue' / 'OutputTooLarge' for Dissent's own guards. */
|
|
168
|
+
name: string;
|
|
169
|
+
/** Sanitized, redacted, capped (§12.3). */
|
|
170
|
+
message: string;
|
|
171
|
+
messageTruncated: boolean;
|
|
172
|
+
finishReason?: FinishReason;
|
|
173
|
+
statusCode?: number;
|
|
174
|
+
isRetryable?: boolean;
|
|
175
|
+
rawText?: string;
|
|
176
|
+
rawTextTruncated?: boolean;
|
|
177
|
+
/** Only for Dissent's own guards: JSON Pointer of the offending value. */
|
|
178
|
+
path?: string;
|
|
179
|
+
};
|
|
180
|
+
type Comparator = 'exact' | 'tolerance' | 'set' | 'keyed-set' | 'discriminated-union' | 'none';
|
|
181
|
+
type PlanReason = 'default-by-type' | 'caller-override' | 'nullable-unwrap' | 'ref-resolved' | 'discriminated-union' | 'policy' | 'unsupported';
|
|
182
|
+
type NotComparedDetail = 'free-text' | 'number-without-tolerance' | 'number-array' | 'caller-none' | 'external-ref' | 'ref-cycle' | 'depth-exceeded' | 'union' | 'all-of' | 'conditional' | 'record' | 'additional-properties' | 'tuple' | 'nested-array' | 'object-array-requires-key' | 'nested-composite' | 'multi-type' | 'untyped' | 'not' | 'invalid-ref';
|
|
183
|
+
type PlanCommon = {
|
|
184
|
+
reasons: PlanReason[];
|
|
185
|
+
nullable: boolean;
|
|
186
|
+
};
|
|
187
|
+
type ToleranceSpec = {
|
|
188
|
+
absolute?: number;
|
|
189
|
+
relative?: number;
|
|
190
|
+
};
|
|
191
|
+
type LeafPlan = (PlanCommon & {
|
|
192
|
+
comparator: 'exact';
|
|
193
|
+
onSplit: Severity;
|
|
194
|
+
}) | (PlanCommon & {
|
|
195
|
+
comparator: 'tolerance';
|
|
196
|
+
tolerance: ToleranceSpec;
|
|
197
|
+
onSplit: Severity;
|
|
198
|
+
}) | (PlanCommon & {
|
|
199
|
+
comparator: 'set';
|
|
200
|
+
onSplit: Severity;
|
|
201
|
+
}) | (PlanCommon & {
|
|
202
|
+
comparator: 'none';
|
|
203
|
+
reason: 'policy' | 'unsupported';
|
|
204
|
+
detail: NotComparedDetail;
|
|
205
|
+
});
|
|
206
|
+
type FieldPlan = LeafPlan | (PlanCommon & {
|
|
207
|
+
comparator: 'keyed-set';
|
|
208
|
+
key: string;
|
|
209
|
+
onSplit: Severity;
|
|
210
|
+
/** Keyed by JSON Pointer relative to the item. */
|
|
211
|
+
itemFields: Record<string, LeafPlan>;
|
|
212
|
+
}) | (PlanCommon & {
|
|
213
|
+
comparator: 'discriminated-union';
|
|
214
|
+
discriminator: string;
|
|
215
|
+
onSplit: Severity;
|
|
216
|
+
/** Keyed by canonical JSON of the discriminator value. */
|
|
217
|
+
branches: Record<string, Record<string, LeafPlan>>;
|
|
218
|
+
});
|
|
219
|
+
type FieldStatus = 'agree' | 'split' | 'insufficient' | 'not-compared';
|
|
220
|
+
type ResultCommon<W extends string> = {
|
|
221
|
+
status: FieldStatus;
|
|
222
|
+
/** Answering witnesses: the denominator of every support count. */
|
|
223
|
+
answered: number;
|
|
224
|
+
presented: W[];
|
|
225
|
+
missing: W[];
|
|
226
|
+
nulls: W[];
|
|
227
|
+
};
|
|
228
|
+
type ValueGroup<W extends string> = {
|
|
229
|
+
value: JSONValue;
|
|
230
|
+
witnesses: W[];
|
|
231
|
+
support: number;
|
|
232
|
+
};
|
|
233
|
+
type ExactResult<W extends string> = ResultCommon<W> & {
|
|
234
|
+
comparator: 'exact';
|
|
235
|
+
groups: ValueGroup<W>[];
|
|
236
|
+
};
|
|
237
|
+
type ToleranceResult<W extends string> = ResultCommon<W> & {
|
|
238
|
+
comparator: 'tolerance';
|
|
239
|
+
tolerance: ToleranceSpec;
|
|
240
|
+
min?: number;
|
|
241
|
+
max?: number;
|
|
242
|
+
spread?: number;
|
|
243
|
+
groups: Array<{
|
|
244
|
+
min: number;
|
|
245
|
+
max: number;
|
|
246
|
+
values: ValueGroup<W>[];
|
|
247
|
+
support: number;
|
|
248
|
+
}>;
|
|
249
|
+
nullGroup?: {
|
|
250
|
+
witnesses: W[];
|
|
251
|
+
support: number;
|
|
252
|
+
};
|
|
253
|
+
};
|
|
254
|
+
type SetResult<W extends string> = ResultCommon<W> & {
|
|
255
|
+
comparator: 'set';
|
|
256
|
+
union: JSONValue[];
|
|
257
|
+
intersection: JSONValue[];
|
|
258
|
+
items: Array<{
|
|
259
|
+
item: JSONValue;
|
|
260
|
+
witnesses: W[];
|
|
261
|
+
support: number;
|
|
262
|
+
}>;
|
|
263
|
+
jaccard?: number;
|
|
264
|
+
duplicates: W[];
|
|
265
|
+
};
|
|
266
|
+
type NotComparedResult<W extends string> = ResultCommon<W> & {
|
|
267
|
+
comparator: 'none';
|
|
268
|
+
status: 'not-compared';
|
|
269
|
+
reason: 'policy' | 'unsupported' | 'duplicate-key';
|
|
270
|
+
detail: NotComparedDetail | 'duplicate-key';
|
|
271
|
+
values: Array<{
|
|
272
|
+
witness: W;
|
|
273
|
+
value: JSONValue;
|
|
274
|
+
}>;
|
|
275
|
+
duplicateKeyWitnesses?: W[];
|
|
276
|
+
};
|
|
277
|
+
type LeafResult<W extends string> = ExactResult<W> | ToleranceResult<W> | SetResult<W> | NotComparedResult<W>;
|
|
278
|
+
type KeyedSetResult<W extends string> = ResultCommon<W> & {
|
|
279
|
+
comparator: 'keyed-set';
|
|
280
|
+
key: string;
|
|
281
|
+
keys: Omit<SetResult<W>, keyof ResultCommon<W> | 'comparator' | 'duplicates'>;
|
|
282
|
+
items: Array<{
|
|
283
|
+
key: JSONValue;
|
|
284
|
+
witnesses: W[];
|
|
285
|
+
fields: Record<string, LeafResult<W>>;
|
|
286
|
+
}>;
|
|
287
|
+
};
|
|
288
|
+
type UnionResult<W extends string> = ResultCommon<W> & {
|
|
289
|
+
comparator: 'discriminated-union';
|
|
290
|
+
discriminator: string;
|
|
291
|
+
choice: ExactResult<W>;
|
|
292
|
+
branches: Array<{
|
|
293
|
+
value: JSONValue;
|
|
294
|
+
witnesses: W[];
|
|
295
|
+
fields: Record<string, LeafResult<W>>;
|
|
296
|
+
}>;
|
|
297
|
+
};
|
|
298
|
+
type FieldResult<W extends string> = LeafResult<W> | KeyedSetResult<W> | UnionResult<W>;
|
|
299
|
+
type Coverage = {
|
|
300
|
+
fields: number;
|
|
301
|
+
compared: number;
|
|
302
|
+
notComparedByPolicy: number;
|
|
303
|
+
unsupported: number;
|
|
304
|
+
failedAtRuntime: number;
|
|
305
|
+
ratio: number;
|
|
306
|
+
byReason: Record<string, number>;
|
|
307
|
+
};
|
|
308
|
+
type FindingCode = 'insufficient-quorum' | 'witness-failed' | 'witness-excluded' | 'truncated-output' | 'field-split' | 'field-partial' | 'duplicate-key' | 'unsupported-schema' | 'coverage-low' | 'duplicate-served-model' | 'single-provider' | 'self-grading';
|
|
309
|
+
type Finding<W extends string = string> = {
|
|
310
|
+
code: FindingCode;
|
|
311
|
+
severity: Severity;
|
|
312
|
+
path?: string;
|
|
313
|
+
within?: {
|
|
314
|
+
key: JSONValue;
|
|
315
|
+
} | {
|
|
316
|
+
branch: JSONValue;
|
|
317
|
+
};
|
|
318
|
+
subpath?: string;
|
|
319
|
+
witnesses?: W[];
|
|
320
|
+
data?: Record<string, JSONValue>;
|
|
321
|
+
};
|
|
322
|
+
type Independence<W extends string> = {
|
|
323
|
+
uniqueRequestedProviders: number;
|
|
324
|
+
duplicateServedModels: Array<{
|
|
325
|
+
canonicalId: string;
|
|
326
|
+
witnesses: W[];
|
|
327
|
+
}>;
|
|
328
|
+
sameProviderGroups: Array<{
|
|
329
|
+
providerKey: string;
|
|
330
|
+
witnesses: W[];
|
|
331
|
+
}>;
|
|
332
|
+
selfGradingWitnesses: Array<{
|
|
333
|
+
witness: W;
|
|
334
|
+
authorModel: string;
|
|
335
|
+
on: 'requested' | 'served';
|
|
336
|
+
}>;
|
|
337
|
+
excludedWitnesses: Array<{
|
|
338
|
+
witness: W;
|
|
339
|
+
stage: 'before-dispatch' | 'after-response';
|
|
340
|
+
authorModel: string;
|
|
341
|
+
on: 'requested' | 'served';
|
|
342
|
+
}>;
|
|
343
|
+
};
|
|
344
|
+
type EvidenceOutcome = 'pass' | 'fail' | 'error' | 'unknown';
|
|
345
|
+
type EvidenceClaim = {
|
|
346
|
+
path: string;
|
|
347
|
+
value: JSONValue;
|
|
348
|
+
} | {
|
|
349
|
+
scope: 'artifact';
|
|
350
|
+
};
|
|
351
|
+
type Evidence = {
|
|
352
|
+
/** Who produced it, e.g. 'vitest'. 1–128 chars after sanitizing. */
|
|
353
|
+
source: string;
|
|
354
|
+
outcome: EvidenceOutcome;
|
|
355
|
+
claim?: EvidenceClaim;
|
|
356
|
+
details?: Record<string, JSONValue>;
|
|
357
|
+
/** @experimental Structured facts about the run, carried into the fingerprint. */
|
|
358
|
+
claims?: Record<string, JSONValue>;
|
|
359
|
+
/** @experimental Execution environment receipt (§10.5). */
|
|
360
|
+
receipt?: ExecutionEnvironmentReceipt;
|
|
361
|
+
};
|
|
362
|
+
/** @experimental */
|
|
363
|
+
type ExecutionEnvironmentReceipt = {
|
|
364
|
+
provider: string;
|
|
365
|
+
/** 'offline-verification-v1' is the only profile that validates. */
|
|
366
|
+
profile: string;
|
|
367
|
+
runtimeImageDigest: string;
|
|
368
|
+
networkPolicyEnforced: boolean;
|
|
369
|
+
networkPolicySha256: string;
|
|
370
|
+
receiptId: string;
|
|
371
|
+
region: string;
|
|
372
|
+
};
|
|
373
|
+
type ReceiptCheck = {
|
|
374
|
+
valid: true;
|
|
375
|
+
} | {
|
|
376
|
+
valid: false;
|
|
377
|
+
reason: 'malformed' | 'wrong-profile' | 'network-not-enforced' | 'policy-mismatch' | 'image-mismatch';
|
|
378
|
+
};
|
|
379
|
+
type AdjudicateOptions = {
|
|
380
|
+
/** Default false. */
|
|
381
|
+
escalateOnReview?: boolean;
|
|
382
|
+
/** @experimental Artifact evidence with a missing or invalid receipt counts as 'unknown'. */
|
|
383
|
+
requireOfflineReceipt?: boolean | {
|
|
384
|
+
networkPolicySha256?: string;
|
|
385
|
+
runtimeImageDigest?: string;
|
|
386
|
+
};
|
|
387
|
+
};
|
|
388
|
+
type Verdict = 'confirmed' | 'rejected' | 'uncertain';
|
|
389
|
+
type VerdictReason = 'no-artifact-evidence' | 'artifact-evidence-failed' | 'artifact-evidence-inconclusive' | 'artifact-evidence-passed' | 'escalated-on-review';
|
|
390
|
+
type Settlement<W extends string> = {
|
|
391
|
+
path: string;
|
|
392
|
+
value: JSONValue;
|
|
393
|
+
source: string;
|
|
394
|
+
outcome: EvidenceOutcome;
|
|
395
|
+
comparator: Exclude<Comparator, 'none'> | 'not-comparable';
|
|
396
|
+
witnessesAgreeing: W[];
|
|
397
|
+
witnessesDissenting: W[];
|
|
398
|
+
witnessesSilent: W[];
|
|
399
|
+
};
|
|
400
|
+
type Adjudication<W extends string = string> = {
|
|
401
|
+
protocol: 'dissent-adjudication/1';
|
|
402
|
+
ledgerFingerprint: string;
|
|
403
|
+
fingerprint: string;
|
|
404
|
+
settlements: Settlement<W>[];
|
|
405
|
+
conflicts: Array<{
|
|
406
|
+
path: string;
|
|
407
|
+
sources: string[];
|
|
408
|
+
}>;
|
|
409
|
+
verdict: Verdict;
|
|
410
|
+
verdictReason: VerdictReason;
|
|
411
|
+
artifactEvidence: {
|
|
412
|
+
pass: number;
|
|
413
|
+
fail: number;
|
|
414
|
+
error: number;
|
|
415
|
+
unknown: number;
|
|
416
|
+
};
|
|
417
|
+
receiptChecks: Array<{
|
|
418
|
+
source: string;
|
|
419
|
+
receiptId: string | null;
|
|
420
|
+
check: ReceiptCheck;
|
|
421
|
+
}>;
|
|
422
|
+
unbound: Array<{
|
|
423
|
+
source: string;
|
|
424
|
+
outcome: EvidenceOutcome;
|
|
425
|
+
reason: 'no-claim' | 'unknown-path';
|
|
426
|
+
}>;
|
|
427
|
+
};
|
|
428
|
+
type FormatLedgerOptions = {
|
|
429
|
+
/** Default 'markdown'. */
|
|
430
|
+
format?: 'markdown' | 'ascii';
|
|
431
|
+
adjudication?: Adjudication;
|
|
432
|
+
/** Default 120. */
|
|
433
|
+
maxInlineChars?: number;
|
|
434
|
+
/** Default 4000. */
|
|
435
|
+
maxBlockChars?: number;
|
|
436
|
+
/** Default false. */
|
|
437
|
+
showOutputs?: boolean;
|
|
438
|
+
};
|
|
439
|
+
/**
|
|
440
|
+
* Runs one multi-model corroboration session over AI SDK v7 models (§2.2).
|
|
441
|
+
*/
|
|
442
|
+
export declare function corroborate<T, W extends string>(options: CorroborateOptions<T, W>): Promise<Ledger<T, W>>;
|
|
443
|
+
/**
|
|
444
|
+
* Pure Layer C adjudication: binds caller evidence to ledger fields (settlements, conflicts)
|
|
445
|
+
* and computes the artifact verdict without calling any model (§10).
|
|
446
|
+
*/
|
|
447
|
+
export declare function adjudicate<W extends string>(ledger: Ledger<unknown, W>, evidence: readonly Evidence[], options?: AdjudicateOptions): Promise<Adjudication<W>>;
|
|
448
|
+
/**
|
|
449
|
+
* Renders a `Ledger` as Markdown or ASCII without reading the clock, environment, or network (§11).
|
|
450
|
+
*/
|
|
451
|
+
export declare function formatLedger(ledger: Ledger<unknown, string>, options?: FormatLedgerOptions): string;
|
|
452
|
+
/**
|
|
453
|
+
* Validates an experimental offline execution environment receipt (§10.5).
|
|
454
|
+
* Pure, never throws.
|
|
455
|
+
*
|
|
456
|
+
* @experimental Can change in a minor release until the v0.3 sandbox producer exists.
|
|
457
|
+
*/
|
|
458
|
+
export declare function validateOfflineReceipt(receipt: unknown, expected?: {
|
|
459
|
+
networkPolicySha256?: string;
|
|
460
|
+
runtimeImageDigest?: string;
|
|
461
|
+
}): ReceiptCheck;
|
|
462
|
+
declare const ROOT_MARKER: unique symbol;
|
|
463
|
+
declare const ARGUMENT_MARKER: unique symbol;
|
|
464
|
+
declare const NON_JSON_MARKER: unique symbol;
|
|
465
|
+
export declare class DissentError extends Error {
|
|
466
|
+
readonly [ROOT_MARKER] = true;
|
|
467
|
+
constructor(message: string, options?: {
|
|
468
|
+
cause?: unknown;
|
|
469
|
+
});
|
|
470
|
+
static isInstance(error: unknown): error is DissentError;
|
|
471
|
+
}
|
|
472
|
+
type DissentArgumentCode = 'too-few-witnesses' | 'too-many-witnesses' | 'invalid-label' | 'reserved-label' | 'invalid-witness-entry' | 'prompt-and-messages' | 'no-input' | 'schema-root-not-object' | 'unknown-compare-path' | 'incompatible-override' | 'invalid-tolerance' | 'invalid-key' | 'invalid-author-model' | 'exclude-without-authors' | 'too-few-witnesses-after-exclusion' | 'invalid-option' | 'invalid-evidence';
|
|
473
|
+
export declare class DissentArgumentError extends DissentError {
|
|
474
|
+
readonly [ARGUMENT_MARKER] = true;
|
|
475
|
+
readonly name: 'DissentArgumentError';
|
|
476
|
+
readonly code: DissentArgumentCode;
|
|
477
|
+
/** The option or path at fault, e.g. 'witnesses.__proto__' or 'compare./risk'. */
|
|
478
|
+
readonly argument: string;
|
|
479
|
+
constructor(code: DissentArgumentCode, argument: string, message?: string);
|
|
480
|
+
static isInstance(error: unknown): error is DissentArgumentError;
|
|
481
|
+
}
|
|
482
|
+
/** Thrown by the internal canonicalizer; caught in Layer A and recorded as invalid-output. */
|
|
483
|
+
export declare class NonJsonValueError extends DissentError {
|
|
484
|
+
readonly [NON_JSON_MARKER] = true;
|
|
485
|
+
readonly name: 'NonJsonValueError';
|
|
486
|
+
/** JSON Pointer of the offending value. */
|
|
487
|
+
readonly path: string;
|
|
488
|
+
/** e.g. 'Date', 'Map', 'NaN', 'Infinity', 'bigint', 'function', 'symbol', 'undefined-in-array', 'cycle', 'depth'. */
|
|
489
|
+
readonly found: string;
|
|
490
|
+
constructor(path: string, found: string);
|
|
491
|
+
static isInstance(error: unknown): error is NonJsonValueError;
|
|
492
|
+
}
|
|
493
|
+
export type { AdjudicateOptions, Adjudication, Advisory, Comparator, ComparatorOverride, CompareOverrides, CorroborateOptions, Coverage, DissentArgumentCode, Evidence, EvidenceClaim, EvidenceOutcome, ExactResult, ExecutionEnvironmentReceipt, FieldPlan, FieldResult, FieldStatus, Finding, FindingCode, FormatLedgerOptions, Independence, JSONValue, KeyedSetResult, LeafPlan, LeafResult, Ledger, ModelIdentity, NotComparedDetail, NotComparedResult, PlanReason, QuestionRecord, Quorum, ReceiptCheck, SetResult, Settlement, Severity, ToleranceResult, ToleranceSpec, UnionResult, ValueGroup, Verdict, VerdictReason, WitnessEntry, WitnessError, WitnessErrorKind, WitnessRecord, WitnessSettings, WitnessUsage };
|