@reticlehq/core 2.14.0 → 3.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/dist/{artifacts-entry.d.ts → artifacts/artifacts-entry.d.ts} +7 -7
- package/dist/{artifacts-entry.js → artifacts/artifacts-entry.js} +7 -7
- package/dist/artifacts/flow-composition.d.ts +30 -0
- package/dist/artifacts/flow-composition.js +19 -0
- package/dist/{flow-constants.d.ts → artifacts/flow-constants.d.ts} +89 -3
- package/dist/{flow-constants.js → artifacts/flow-constants.js} +95 -4
- package/dist/artifacts/flow-mutation-target.d.ts +39 -0
- package/dist/artifacts/flow-mutation-target.js +89 -0
- package/dist/artifacts/flow-order.d.ts +30 -0
- package/dist/artifacts/flow-order.js +49 -0
- package/dist/artifacts/flow-select.d.ts +56 -0
- package/dist/artifacts/flow-select.js +56 -0
- package/dist/artifacts/flow-step-tool.d.ts +31 -0
- package/dist/artifacts/flow-step-tool.js +31 -0
- package/dist/artifacts/flow-types.d.ts +3736 -0
- package/dist/artifacts/flow-types.js +463 -0
- package/dist/artifacts/flow-unreached.d.ts +12 -0
- package/dist/artifacts/flow-unreached.js +24 -0
- package/dist/{impact.d.ts → artifacts/impact.d.ts} +119 -103
- package/dist/{impact.js → artifacts/impact.js} +14 -5
- package/dist/{journal.d.ts → artifacts/journal.d.ts} +51 -7
- package/dist/{journal.js → artifacts/journal.js} +38 -2
- package/dist/artifacts/step-effect.d.ts +29 -0
- package/dist/artifacts/step-effect.js +28 -0
- package/dist/hooks/hook-events.d.ts +311 -0
- package/dist/hooks/hook-events.js +127 -0
- package/dist/hooks/hooks-entry.d.ts +9 -0
- package/dist/hooks/hooks-entry.js +9 -0
- package/dist/{brand.d.ts → identity/brand.d.ts} +7 -0
- package/dist/{contract-fingerprint.d.ts → identity/contract-fingerprint.d.ts} +21 -3
- package/dist/{contract-fingerprint.js → identity/contract-fingerprint.js} +22 -4
- package/dist/{document-identity.d.ts → identity/document-identity.d.ts} +4 -5
- package/dist/{document-identity.js → identity/document-identity.js} +4 -5
- package/dist/{source-constants.d.ts → identity/source-constants.d.ts} +4 -4
- package/dist/{source-constants.js → identity/source-constants.js} +4 -4
- package/dist/index.d.ts +56 -43
- package/dist/index.js +65 -45
- package/dist/onboarding.d.ts +114 -0
- package/dist/onboarding.js +141 -0
- package/dist/realm/registry.d.ts +212 -0
- package/dist/realm/registry.js +302 -0
- package/dist/{dev-server-registry.d.ts → registry/dev-server-registry.d.ts} +6 -7
- package/dist/{dev-server-registry.js → registry/dev-server-registry.js} +28 -19
- package/dist/{project-registry.d.ts → registry/project-registry.d.ts} +5 -5
- package/dist/{project-registry.js → registry/project-registry.js} +5 -5
- package/dist/schema/command-name.json +31 -0
- package/dist/schema/event-payloads.json +791 -0
- package/dist/schema/hello-message.json +70 -2
- package/dist/schema/reticle-message.json +70 -2
- package/dist/telemetry-entry.d.ts +1 -1
- package/dist/telemetry-entry.js +1 -1
- package/dist/telemetry-feedback.d.ts +15 -16
- package/dist/telemetry-feedback.js +11 -12
- package/dist/telemetry-license.d.ts +1 -1
- package/dist/telemetry-license.js +1 -1
- package/dist/telemetry-refusal.d.ts +11 -11
- package/dist/telemetry-refusal.js +7 -8
- package/dist/telemetry-session.d.ts +51 -59
- package/dist/telemetry-session.js +47 -55
- package/dist/telemetry.d.ts +243 -214
- package/dist/telemetry.js +83 -98
- package/dist/tour-entry.d.ts +10 -0
- package/dist/tour-entry.js +10 -0
- package/dist/tour.d.ts +125 -0
- package/dist/tour.js +165 -0
- package/dist/{consequence.d.ts → verdict/consequence.d.ts} +32 -15
- package/dist/{consequence.js → verdict/consequence.js} +9 -31
- package/dist/{finding-fingerprint.js → verdict/finding-fingerprint.js} +1 -1
- package/dist/{findings.d.ts → verdict/findings.d.ts} +86 -39
- package/dist/{findings.js → verdict/findings.js} +103 -49
- package/dist/{instrumentation-gap.d.ts → verdict/instrumentation-gap.d.ts} +7 -14
- package/dist/{instrumentation-gap.js → verdict/instrumentation-gap.js} +7 -15
- package/dist/{intent.d.ts → verdict/intent.d.ts} +35 -46
- package/dist/{intent.js → verdict/intent.js} +11 -22
- package/dist/verdict/revision.d.ts +44 -0
- package/dist/verdict/revision.js +53 -0
- package/dist/{run-context.d.ts → verdict/run-context.d.ts} +13 -34
- package/dist/{run-context.js → verdict/run-context.js} +15 -36
- package/dist/{security.js → verdict/security.js} +12 -21
- package/dist/{verification-run.d.ts → verdict/verification-run.d.ts} +381 -105
- package/dist/{verification-run.js → verdict/verification-run.js} +157 -21
- package/dist/{verified-constants.d.ts → verdict/verified-constants.d.ts} +25 -13
- package/dist/{verified-constants.js → verdict/verified-constants.js} +25 -13
- package/dist/{verify-progress.d.ts → verdict/verify-progress.d.ts} +18 -22
- package/dist/{verify-progress.js → verdict/verify-progress.js} +6 -10
- package/dist/wire/channel.d.ts +46 -0
- package/dist/wire/channel.js +95 -0
- package/dist/{constants.d.ts → wire/constants/constants.d.ts} +91 -28
- package/dist/{constants.js → wire/constants/constants.js} +105 -28
- package/dist/{session-constants.d.ts → wire/constants/session-constants.d.ts} +9 -2
- package/dist/{session-constants.js → wire/constants/session-constants.js} +9 -2
- package/dist/{desktop-contract.js → wire/desktop-contract.js} +1 -1
- package/dist/{event-classification.js → wire/event-classification.js} +1 -1
- package/dist/{event-payloads.d.ts → wire/event-payloads.d.ts} +68 -13
- package/dist/{event-payloads.js → wire/event-payloads.js} +21 -3
- package/dist/{event-priority.d.ts → wire/event-priority.d.ts} +1 -4
- package/dist/{event-priority.js → wire/event-priority.js} +2 -5
- package/dist/{global-press.js → wire/global-press.js} +1 -1
- package/dist/{messages.d.ts → wire/messages.d.ts} +239 -48
- package/dist/{messages.js → wire/messages.js} +68 -5
- package/dist/wire/narrow.d.ts +39 -0
- package/dist/wire/narrow.js +45 -0
- package/dist/{net.d.ts → wire/net.d.ts} +12 -13
- package/dist/{net.js → wire/net.js} +12 -13
- package/dist/wire/platform.d.ts +37 -0
- package/dist/wire/platform.js +36 -0
- package/dist/{redaction.js → wire/redaction.js} +12 -12
- package/dist/wire/tool-names.d.ts +133 -0
- package/dist/wire/tool-names.js +142 -0
- package/dist/{toon.js → wire/toon.js} +1 -1
- package/dist/{types.d.ts → wire/types.d.ts} +77 -76
- package/dist/{types.js → wire/types.js} +4 -3
- package/dist/{no-session-reason.d.ts → words/no-session-reason.d.ts} +7 -3
- package/dist/{no-session-reason.js → words/no-session-reason.js} +7 -3
- package/dist/{notices.d.ts → words/notices.d.ts} +8 -12
- package/dist/{notices.js → words/notices.js} +8 -12
- package/package.json +16 -7
- package/dist/flow-types.d.ts +0 -1711
- package/dist/flow-types.js +0 -247
- package/dist/{impact-savings.d.ts → artifacts/impact-savings.d.ts} +0 -0
- package/dist/{impact-savings.js → artifacts/impact-savings.js} +0 -0
- package/dist/{brand.js → identity/brand.js} +0 -0
- package/dist/{edit-epoch.d.ts → identity/edit-epoch.d.ts} +0 -0
- package/dist/{edit-epoch.js → identity/edit-epoch.js} +0 -0
- package/dist/{project-id.d.ts → identity/project-id.d.ts} +0 -0
- package/dist/{project-id.js → identity/project-id.js} +0 -0
- package/dist/{daemon-registry.d.ts → registry/daemon-registry.d.ts} +0 -0
- package/dist/{daemon-registry.js → registry/daemon-registry.js} +0 -0
- package/dist/{finding-fingerprint.d.ts → verdict/finding-fingerprint.d.ts} +0 -0
- package/dist/{security.d.ts → verdict/security.d.ts} +0 -0
- package/dist/{desktop-contract.d.ts → wire/desktop-contract.d.ts} +0 -0
- package/dist/{event-classification.d.ts → wire/event-classification.d.ts} +0 -0
- package/dist/{global-press.d.ts → wire/global-press.d.ts} +0 -0
- package/dist/{redaction.d.ts → wire/redaction.d.ts} +0 -0
- package/dist/{state-select.d.ts → wire/state-select.d.ts} +0 -0
- package/dist/{state-select.js → wire/state-select.js} +0 -0
- package/dist/{toon.d.ts → wire/toon.d.ts} +0 -0
- package/dist/{browser-misdirect.d.ts → words/browser-misdirect.d.ts} +0 -0
- package/dist/{browser-misdirect.js → words/browser-misdirect.js} +0 -0
- package/dist/{unreachable-notice.d.ts → words/unreachable-notice.d.ts} +0 -0
- package/dist/{unreachable-notice.js → words/unreachable-notice.js} +0 -0
- package/dist/{upgrade.d.ts → words/upgrade.d.ts} +2 -2
- /package/dist/{upgrade.js → words/upgrade.js} +0 -0
|
@@ -10,8 +10,44 @@
|
|
|
10
10
|
* logic), no `any` (opaque evidence is `z.unknown`), and every domain string is a named constant.
|
|
11
11
|
*/
|
|
12
12
|
import { z } from 'zod';
|
|
13
|
+
import { SubjectRefSchema } from 'open-verification';
|
|
14
|
+
import { PredicateKind } from './consequence.js';
|
|
15
|
+
import { Verified } from './verified-constants.js';
|
|
13
16
|
/** Schema version stamped into every run file so a reader can reject/upgrade old artifacts. */
|
|
14
|
-
export const RUN_FILE_VERSION =
|
|
17
|
+
export const RUN_FILE_VERSION = 3;
|
|
18
|
+
/**
|
|
19
|
+
* The version this artifact used before checks were recorded in the assertion vocabulary.
|
|
20
|
+
*
|
|
21
|
+
* Version 1 spelled a network check `network` where an assertion says `net`, and had a `layout` kind
|
|
22
|
+
* nothing could produce. Files already on disk are still read: the two old spellings are translated
|
|
23
|
+
* on the way in, so a stored run from before this change opens rather than reading as empty. Empty
|
|
24
|
+
* is the dangerous outcome -- it looks like a run that found nothing.
|
|
25
|
+
*/
|
|
26
|
+
const RUN_FILE_VERSION_BEFORE_ONE_VOCABULARY = 1;
|
|
27
|
+
/**
|
|
28
|
+
* The version this artifact used before a check could say it was undetermined.
|
|
29
|
+
*
|
|
30
|
+
* Version 2 recorded a check as `pass` or `fail` and nothing else, so a check nobody could evaluate
|
|
31
|
+
* had no spelling and was dropped on the way in. That is the exact loss this whole system exists to
|
|
32
|
+
* prevent, committed by Reticle's own artifact: "I could not see" left the document silently, and a
|
|
33
|
+
* reader counting checks counted blind spots as the app's clean bill of health.
|
|
34
|
+
*
|
|
35
|
+
* Files already on disk are still read. `pass` and `fail` translate to `yes` and `no`, which is what
|
|
36
|
+
* they always meant.
|
|
37
|
+
*/
|
|
38
|
+
const RUN_FILE_VERSION_BEFORE_UNDETERMINED_CHECKS = 2;
|
|
39
|
+
/** The old spelling of each check outcome, for reading a version 2 file. */
|
|
40
|
+
const OLD_CHECK_STATUS_SPELLING = {
|
|
41
|
+
pass: Verified.YES,
|
|
42
|
+
fail: Verified.NO,
|
|
43
|
+
};
|
|
44
|
+
/** The old spelling of each check kind, for reading a version 1 file. */
|
|
45
|
+
const OLD_CHECK_KIND_SPELLING = {
|
|
46
|
+
network: PredicateKind.NET,
|
|
47
|
+
// `layout` was never produced by anything, so a file cannot contain one. Mapped to the nearest
|
|
48
|
+
// truthful thing rather than dropped, so a hand-written file does not fail to open.
|
|
49
|
+
layout: PredicateKind.ELEMENT,
|
|
50
|
+
};
|
|
15
51
|
/**
|
|
16
52
|
* A run's identity, branded so it can't be confused with another id (e.g. a flow name) that also feeds
|
|
17
53
|
* path helpers. The schema brands on parse; mint a fresh one with asRunId at a trusted/validated point.
|
|
@@ -36,6 +72,16 @@ export const VerdictStatus = {
|
|
|
36
72
|
PASS: 'pass',
|
|
37
73
|
FAIL: 'fail',
|
|
38
74
|
PARTIAL: 'partial',
|
|
75
|
+
/**
|
|
76
|
+
* Nothing was proved either way -- no flow and no check produced an outcome, so there is nothing
|
|
77
|
+
* to pass and nothing to fail.
|
|
78
|
+
*
|
|
79
|
+
* This is deliberately NOT a pass. A run that checked nothing and a run that checked everything
|
|
80
|
+
* successfully are different facts, and flattening them into one word is how a green light comes
|
|
81
|
+
* to mean "we did not look". It matches how a single action is already judged, where "could not
|
|
82
|
+
* tell" has always been its own answer.
|
|
83
|
+
*/
|
|
84
|
+
UNKNOWN: 'unknown',
|
|
39
85
|
};
|
|
40
86
|
/** Per-flow outcome inside a run. HEALED = a drifted anchor was consequence-verified and rebound. */
|
|
41
87
|
export const RunFlowStatus = {
|
|
@@ -44,20 +90,22 @@ export const RunFlowStatus = {
|
|
|
44
90
|
SKIPPED: 'skipped',
|
|
45
91
|
HEALED: 'healed',
|
|
46
92
|
};
|
|
47
|
-
/**
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
93
|
+
/**
|
|
94
|
+
* The kind of standalone assertion captured outside a flow.
|
|
95
|
+
*
|
|
96
|
+
* This is `PredicateKind` -- the vocabulary assertions are written in -- and not a second list: two
|
|
97
|
+
* lists drift, and an artifact can only record what somebody can actually assert. Re-exported so
|
|
98
|
+
* the places that read it from this file still can.
|
|
99
|
+
*/
|
|
100
|
+
export { PredicateKind };
|
|
101
|
+
/**
|
|
102
|
+
* What a check came out as.
|
|
103
|
+
*
|
|
104
|
+
* `Verified` and not a second list. A binary one here would lose `unknown` and `no-fault` -- the
|
|
105
|
+
* two the specification says make the other two mean anything -- at the moment the verdict is
|
|
106
|
+
* written down. Re-exported so the places that read it from this file still can.
|
|
107
|
+
*/
|
|
108
|
+
export { Verified };
|
|
61
109
|
/**
|
|
62
110
|
* A risk surface a changed file / observed behaviour touches. The governance seed: a host can gate
|
|
63
111
|
* a deploy when a high-severity surface is hit. Mirrors the surfaces real AI-app-builder incidents
|
|
@@ -154,10 +202,52 @@ export const RunFlowResultSchema = z.object({
|
|
|
154
202
|
});
|
|
155
203
|
/** A standalone assertion not tied to a flow. `evidence` is opaque (narrowed per kind by the caller). */
|
|
156
204
|
export const RunCheckSchema = z.object({
|
|
157
|
-
kind: z.nativeEnum(
|
|
205
|
+
kind: z.preprocess((given) => ('string' === typeof given ? (OLD_CHECK_KIND_SPELLING[given] ?? given) : given), z.nativeEnum(PredicateKind)),
|
|
158
206
|
predicate: z.string(),
|
|
159
|
-
status: z.nativeEnum(
|
|
207
|
+
status: z.preprocess((given) => ('string' === typeof given ? (OLD_CHECK_STATUS_SPELLING[given] ?? given) : given), z.nativeEnum(Verified)),
|
|
160
208
|
evidence: z.unknown().optional(),
|
|
209
|
+
/**
|
|
210
|
+
* Was this claim written down BEFORE the action, or after it?
|
|
211
|
+
*
|
|
212
|
+
* The difference between a check and a rationalisation. Afterwards, anything that happened can be
|
|
213
|
+
* described as what you meant; a claim made in advance can only be met or missed.
|
|
214
|
+
*
|
|
215
|
+
* Optional, and absence is not `false`. `false` says the claim came afterwards. Absent says nobody
|
|
216
|
+
* recorded which, and those are different facts about the evidence.
|
|
217
|
+
*/
|
|
218
|
+
declaredBeforeActing: z.boolean().optional(),
|
|
219
|
+
/**
|
|
220
|
+
* What kind of evidence bought this answer.
|
|
221
|
+
*
|
|
222
|
+
* A green paid for with "something matching was on screen" is not the same green as one paid for
|
|
223
|
+
* with "the request went out", and a report that flattens them lets the cheap one pass for the
|
|
224
|
+
* dear one. Free-form because the grades belong to whoever produced the verdict.
|
|
225
|
+
*/
|
|
226
|
+
grade: z.string().optional(),
|
|
227
|
+
/**
|
|
228
|
+
* What could not be seen while this was being checked.
|
|
229
|
+
*
|
|
230
|
+
* The property with no prior art: every other test report in existence is silent about its own
|
|
231
|
+
* blind spots. An empty list means nothing was hidden; absence means nobody looked.
|
|
232
|
+
*/
|
|
233
|
+
couldNotSee: z.array(z.string()).optional(),
|
|
234
|
+
/**
|
|
235
|
+
* Why the verdict came out this way, in the engine's vocabulary.
|
|
236
|
+
*
|
|
237
|
+
* Carried so a reader -- and the fold that looks for late answers -- can tell an outcome that
|
|
238
|
+
* has not arrived from a capture that could not be read. Both are `unknown`, and only the
|
|
239
|
+
* first is a question that waiting can settle.
|
|
240
|
+
*/
|
|
241
|
+
reason: z.string().optional(),
|
|
242
|
+
/** This check's own name, so a later verdict can cite it. See revision.ts. */
|
|
243
|
+
checkId: z.string().optional(),
|
|
244
|
+
/**
|
|
245
|
+
* The earlier check this one corrects, as `<runId>#<checkId>`.
|
|
246
|
+
*
|
|
247
|
+
* Present only on a correction, and the check it names is NOT edited: both stand, so a reader
|
|
248
|
+
* can see that the first answer was given, when it changed, and why.
|
|
249
|
+
*/
|
|
250
|
+
supersedes: z.string().optional(),
|
|
161
251
|
});
|
|
162
252
|
/** A flagged risk. `gated` = a policy gate tripped on this surface. */
|
|
163
253
|
export const RunRiskSchema = z.object({
|
|
@@ -214,6 +304,22 @@ export const RunVerdictSchema = z.object({
|
|
|
214
304
|
reasons: z.array(z.string()).default([]),
|
|
215
305
|
confidence: z.nativeEnum(RunConfidence),
|
|
216
306
|
blockingRisks: z.number().default(0),
|
|
307
|
+
/**
|
|
308
|
+
* Which check this verdict is about, so a later one can say it corrects this.
|
|
309
|
+
*
|
|
310
|
+
* Optional because a run's overall verdict is not about one check. A verdict with no check named
|
|
311
|
+
* cannot be cited, and therefore cannot be corrected -- see revision.ts.
|
|
312
|
+
*/
|
|
313
|
+
checkId: z.string().optional(),
|
|
314
|
+
/**
|
|
315
|
+
* The verdict this one replaces, written as `<runId>#<checkId>`.
|
|
316
|
+
*
|
|
317
|
+
* Present only on a correction. The verdict it names is NOT edited: it stays exactly as it was
|
|
318
|
+
* given, and this is a second, later answer that cites it. Rewriting the first in place would
|
|
319
|
+
* erase the fact that it was ever given, and "we always knew" is the shape of the problem this
|
|
320
|
+
* whole system exists to prevent.
|
|
321
|
+
*/
|
|
322
|
+
supersedes: z.string().optional(),
|
|
217
323
|
});
|
|
218
324
|
/** Optional tamper-evidence signature over the run (for audit; populated later). */
|
|
219
325
|
export const RunSignatureSchema = z.object({
|
|
@@ -222,12 +328,19 @@ export const RunSignatureSchema = z.object({
|
|
|
222
328
|
signedAt: z.number(),
|
|
223
329
|
});
|
|
224
330
|
/**
|
|
225
|
-
* The top-level verification-run artifact. Stable contract — additive changes only within
|
|
226
|
-
* RUN_FILE_VERSION
|
|
227
|
-
*
|
|
331
|
+
* The top-level verification-run artifact. Stable contract — additive changes only within a
|
|
332
|
+
* RUN_FILE_VERSION; a breaking change bumps it. Arrays default to empty so a minimal run (e.g. a
|
|
333
|
+
* single smoke flow) still validates. Version 1 files are still read; see the note on the constant.
|
|
228
334
|
*/
|
|
229
335
|
export const ReticleVerificationRunSchema = z.object({
|
|
230
|
-
|
|
336
|
+
// All three versions are read; only the current one is written. Each older version differs from
|
|
337
|
+
// its successor in exactly one way -- how a check's kind is spelled, then how its outcome is --
|
|
338
|
+
// and both are translated above, so there is nothing else to migrate.
|
|
339
|
+
schemaVersion: z.union([
|
|
340
|
+
z.literal(RUN_FILE_VERSION),
|
|
341
|
+
z.literal(RUN_FILE_VERSION_BEFORE_UNDETERMINED_CHECKS),
|
|
342
|
+
z.literal(RUN_FILE_VERSION_BEFORE_ONE_VOCABULARY),
|
|
343
|
+
]),
|
|
231
344
|
runId: RunIdSchema,
|
|
232
345
|
createdAt: z.number(), // epoch ms — INJECTED, never computed in pure logic
|
|
233
346
|
durationMs: z.number(),
|
|
@@ -249,6 +362,29 @@ export const ReticleVerificationRunSchema = z.object({
|
|
|
249
362
|
diffRef: z.string().optional(),
|
|
250
363
|
note: z.string().optional(),
|
|
251
364
|
}),
|
|
365
|
+
/**
|
|
366
|
+
* Which round of source edits this evidence belongs to.
|
|
367
|
+
*
|
|
368
|
+
* Evidence gathered before the change under test is true about the OLD code. Reporting it as true
|
|
369
|
+
* about the new code is a false pass, and it is the kind nobody notices because everything looks
|
|
370
|
+
* green. Absent when the run had no way to know.
|
|
371
|
+
*/
|
|
372
|
+
editEpoch: z.number().optional(),
|
|
373
|
+
/**
|
|
374
|
+
* What was verified, in the protocol's own vocabulary.
|
|
375
|
+
*
|
|
376
|
+
* The artifact recorded the project, the agent, the trigger and the edit round, and never what
|
|
377
|
+
* KIND of thing was on the other end -- so a run against a Tauri desktop app and one against a
|
|
378
|
+
* web page were indistinguishable to every reader of this file. `surface` is the field that
|
|
379
|
+
* separates them, and `instance` is the one that says which document the evidence belongs to,
|
|
380
|
+
* which is the difference between evidence about this page and evidence that survived a
|
|
381
|
+
* navigation.
|
|
382
|
+
*
|
|
383
|
+
* `SubjectRef` is the specification's, imported rather than restated. Optional because a run
|
|
384
|
+
* assembled without a live session -- in CI, from flows alone -- genuinely does not know, and
|
|
385
|
+
* an invented subject is worse than an absent one.
|
|
386
|
+
*/
|
|
387
|
+
subject: SubjectRefSchema.optional(),
|
|
252
388
|
changedFiles: z.array(RunChangedFileSchema).default([]),
|
|
253
389
|
flows: z.array(RunFlowResultSchema).default([]),
|
|
254
390
|
checks: z.array(RunCheckSchema).default([]),
|
|
@@ -50,6 +50,18 @@ export type Verified = (typeof Verified)[keyof typeof Verified];
|
|
|
50
50
|
* equal). Nothing anywhere re-lists these.
|
|
51
51
|
*/
|
|
52
52
|
export declare const VerifiedReason: {
|
|
53
|
+
/**
|
|
54
|
+
* The claim needed to read something this implementation never said it could see.
|
|
55
|
+
*
|
|
56
|
+
* Not a failure and not a refusal shape of its own. It arrives through the verdict, because the
|
|
57
|
+
* verdict is the one channel an agent is told to gate on -- adding a ninth way to say "I cannot"
|
|
58
|
+
* would repeat the mistake that made this necessary.
|
|
59
|
+
*
|
|
60
|
+
* The distinction it draws is between "it did not happen" and "nothing was watching", which used
|
|
61
|
+
* to produce the same empty answer. Saying `no` to the second blames the app for a gap in the
|
|
62
|
+
* tooling, and is the confident wrong answer this whole mechanism exists to remove.
|
|
63
|
+
*/
|
|
64
|
+
readonly CAPABILITY_ABSENT: "capability-absent";
|
|
53
65
|
/** The assertion was never EVALUATED — under-specified call, or nothing instrumented to read. */
|
|
54
66
|
readonly INCONCLUSIVE: "inconclusive";
|
|
55
67
|
/**
|
|
@@ -104,11 +116,10 @@ export declare const VerifiedReason: {
|
|
|
104
116
|
* The assertion held, but a channel's outcome had not been observed when the window closed — an
|
|
105
117
|
* ABSENCE-derived finding (see ABSENCE_DERIVED_CONTRADICTIONS), not evidence against the action.
|
|
106
118
|
*
|
|
107
|
-
*
|
|
108
|
-
* independently of whether the page went idle.
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
* whose own evidence block denies its stated reason is a verdict nobody can act on.
|
|
119
|
+
* DISTINCT FROM `UNSETTLED`, because that word is a claim about idle and this clause fires
|
|
120
|
+
* independently of whether the page went idle. Reporting it as `unsettled` produces a verdict
|
|
121
|
+
* whose own evidence block denies its stated reason — `verifiedReason: "unsettled"` beside
|
|
122
|
+
* `settled: true` — which nobody can act on.
|
|
112
123
|
*/
|
|
113
124
|
readonly EVIDENCE_INCOMPLETE: "evidence_incomplete";
|
|
114
125
|
/** Held at a real grade over a clean capture with no channel disagreeing. */
|
|
@@ -121,9 +132,9 @@ export type VerifiedReason = (typeof VerifiedReason)[keyof typeof VerifiedReason
|
|
|
121
132
|
* WHAT made a capture unclean — the closed vocabulary behind `UNCLEAN_CAPTURE`.
|
|
122
133
|
*
|
|
123
134
|
* `unclean_capture` names three losses that belong to three different owners and need three
|
|
124
|
-
* different fixes:
|
|
125
|
-
* can see through.
|
|
126
|
-
*
|
|
135
|
+
* different fixes: the server buffer, the browser transport, and a boundary in the page that nobody
|
|
136
|
+
* can see through. Without it they arrive as one value and one sentence of free prose in
|
|
137
|
+
* `integrity.issues`, which is not something a query can group by.
|
|
127
138
|
*
|
|
128
139
|
* That cost real time. `unclean_capture` became a large share of all `unknown` verdicts in the
|
|
129
140
|
* field, and answering "which of the three?" took reading the eviction policy, because the data
|
|
@@ -191,11 +202,12 @@ export declare const BlindSpotKind: {
|
|
|
191
202
|
readonly UNINSTRUMENTED_FRAME: "uninstrumented-frame";
|
|
192
203
|
readonly VIRTUALIZED_UNMOUNTED: "virtualized-unmounted";
|
|
193
204
|
/**
|
|
194
|
-
* Something wrapped `fetch`
|
|
195
|
-
*
|
|
196
|
-
* after
|
|
197
|
-
* exactly that. Unfixable from inside the page — there is no "patch last" primitive — so it
|
|
198
|
-
* declared instead, and a verdict over it reports partial coverage rather than implying
|
|
205
|
+
* Something wrapped `fetch` first, so the recorded request is not necessarily the request that
|
|
206
|
+
* leaves. Wrappers chain outermost-first: anything installed EARLIER sits underneath and mutates
|
|
207
|
+
* the body after it has been read. An interceptor initialised before connect(), or a polyfill,
|
|
208
|
+
* does exactly that. Unfixable from inside the page — there is no "patch last" primitive — so it
|
|
209
|
+
* is declared instead, and a verdict over it reports partial coverage rather than implying the
|
|
210
|
+
* wire was seen.
|
|
199
211
|
*/
|
|
200
212
|
readonly WRAPPED_NETWORK: "wrapped-network";
|
|
201
213
|
/**
|
|
@@ -49,6 +49,18 @@ export const Verified = {
|
|
|
49
49
|
* equal). Nothing anywhere re-lists these.
|
|
50
50
|
*/
|
|
51
51
|
export const VerifiedReason = {
|
|
52
|
+
/**
|
|
53
|
+
* The claim needed to read something this implementation never said it could see.
|
|
54
|
+
*
|
|
55
|
+
* Not a failure and not a refusal shape of its own. It arrives through the verdict, because the
|
|
56
|
+
* verdict is the one channel an agent is told to gate on -- adding a ninth way to say "I cannot"
|
|
57
|
+
* would repeat the mistake that made this necessary.
|
|
58
|
+
*
|
|
59
|
+
* The distinction it draws is between "it did not happen" and "nothing was watching", which used
|
|
60
|
+
* to produce the same empty answer. Saying `no` to the second blames the app for a gap in the
|
|
61
|
+
* tooling, and is the confident wrong answer this whole mechanism exists to remove.
|
|
62
|
+
*/
|
|
63
|
+
CAPABILITY_ABSENT: 'capability-absent',
|
|
52
64
|
/** The assertion was never EVALUATED — under-specified call, or nothing instrumented to read. */
|
|
53
65
|
INCONCLUSIVE: 'inconclusive',
|
|
54
66
|
/**
|
|
@@ -103,11 +115,10 @@ export const VerifiedReason = {
|
|
|
103
115
|
* The assertion held, but a channel's outcome had not been observed when the window closed — an
|
|
104
116
|
* ABSENCE-derived finding (see ABSENCE_DERIVED_CONTRADICTIONS), not evidence against the action.
|
|
105
117
|
*
|
|
106
|
-
*
|
|
107
|
-
* independently of whether the page went idle.
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
* whose own evidence block denies its stated reason is a verdict nobody can act on.
|
|
118
|
+
* DISTINCT FROM `UNSETTLED`, because that word is a claim about idle and this clause fires
|
|
119
|
+
* independently of whether the page went idle. Reporting it as `unsettled` produces a verdict
|
|
120
|
+
* whose own evidence block denies its stated reason — `verifiedReason: "unsettled"` beside
|
|
121
|
+
* `settled: true` — which nobody can act on.
|
|
111
122
|
*/
|
|
112
123
|
EVIDENCE_INCOMPLETE: 'evidence_incomplete',
|
|
113
124
|
/** Held at a real grade over a clean capture with no channel disagreeing. */
|
|
@@ -119,9 +130,9 @@ export const VerifiedReason = {
|
|
|
119
130
|
* WHAT made a capture unclean — the closed vocabulary behind `UNCLEAN_CAPTURE`.
|
|
120
131
|
*
|
|
121
132
|
* `unclean_capture` names three losses that belong to three different owners and need three
|
|
122
|
-
* different fixes:
|
|
123
|
-
* can see through.
|
|
124
|
-
*
|
|
133
|
+
* different fixes: the server buffer, the browser transport, and a boundary in the page that nobody
|
|
134
|
+
* can see through. Without it they arrive as one value and one sentence of free prose in
|
|
135
|
+
* `integrity.issues`, which is not something a query can group by.
|
|
125
136
|
*
|
|
126
137
|
* That cost real time. `unclean_capture` became a large share of all `unknown` verdicts in the
|
|
127
138
|
* field, and answering "which of the three?" took reading the eviction policy, because the data
|
|
@@ -188,11 +199,12 @@ export const BlindSpotKind = {
|
|
|
188
199
|
UNINSTRUMENTED_FRAME: 'uninstrumented-frame',
|
|
189
200
|
VIRTUALIZED_UNMOUNTED: 'virtualized-unmounted',
|
|
190
201
|
/**
|
|
191
|
-
* Something wrapped `fetch`
|
|
192
|
-
*
|
|
193
|
-
* after
|
|
194
|
-
* exactly that. Unfixable from inside the page — there is no "patch last" primitive — so it
|
|
195
|
-
* declared instead, and a verdict over it reports partial coverage rather than implying
|
|
202
|
+
* Something wrapped `fetch` first, so the recorded request is not necessarily the request that
|
|
203
|
+
* leaves. Wrappers chain outermost-first: anything installed EARLIER sits underneath and mutates
|
|
204
|
+
* the body after it has been read. An interceptor initialised before connect(), or a polyfill,
|
|
205
|
+
* does exactly that. Unfixable from inside the page — there is no "patch last" primitive — so it
|
|
206
|
+
* is declared instead, and a verdict over it reports partial coverage rather than implying the
|
|
207
|
+
* wire was seen.
|
|
196
208
|
*/
|
|
197
209
|
WRAPPED_NETWORK: 'wrapped-network',
|
|
198
210
|
/**
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* What a verification run is DOING, while it is still doing it.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* A verification takes tens of seconds to minutes and the artifact only exists at the end, so
|
|
5
|
+
* without narration a run that is working and a run that has died look identical for the whole of
|
|
6
|
+
* its duration.
|
|
5
7
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* run that has died look identical for the whole of its duration. Somebody watching a hosted
|
|
10
|
-
* dashboard sat on that ambiguity for fifteen minutes.
|
|
11
|
-
*
|
|
12
|
-
* These events are the narration. They are DERIVED from work that is already happening, never a
|
|
13
|
-
* second source of truth: the run artifact remains the only record of what was proved, and nothing
|
|
14
|
-
* here is ever graded, stored as evidence, or allowed to influence a verdict.
|
|
8
|
+
* These events are DERIVED from work that is already happening, never a second source of truth: the
|
|
9
|
+
* run artifact remains the only record of what was proved, and nothing here is ever graded, stored
|
|
10
|
+
* as evidence, or allowed to influence a verdict.
|
|
15
11
|
*
|
|
16
12
|
* ## The rules that keep it honest
|
|
17
13
|
*
|
|
@@ -65,16 +61,16 @@ export declare const verifyProgressEventSchema: z.ZodObject<{
|
|
|
65
61
|
at: number;
|
|
66
62
|
phase: "connecting" | "waiting_for_app" | "flows_found" | "flow_started" | "flow_finished" | "grading" | "pushed";
|
|
67
63
|
ok?: boolean | undefined;
|
|
68
|
-
index?: number | undefined;
|
|
69
|
-
total?: number | undefined;
|
|
70
64
|
name?: string | undefined;
|
|
65
|
+
total?: number | undefined;
|
|
66
|
+
index?: number | undefined;
|
|
71
67
|
}, {
|
|
72
68
|
at: number;
|
|
73
69
|
phase: "connecting" | "waiting_for_app" | "flows_found" | "flow_started" | "flow_finished" | "grading" | "pushed";
|
|
74
70
|
ok?: boolean | undefined;
|
|
75
|
-
index?: number | undefined;
|
|
76
|
-
total?: number | undefined;
|
|
77
71
|
name?: string | undefined;
|
|
72
|
+
total?: number | undefined;
|
|
73
|
+
index?: number | undefined;
|
|
78
74
|
}>;
|
|
79
75
|
export type VerifyProgressEvent = z.infer<typeof verifyProgressEventSchema>;
|
|
80
76
|
/** The batch shape a run posts. Batched because one request per flow is a request per flow. */
|
|
@@ -96,16 +92,16 @@ export declare const verifyProgressBatchSchema: z.ZodObject<{
|
|
|
96
92
|
at: number;
|
|
97
93
|
phase: "connecting" | "waiting_for_app" | "flows_found" | "flow_started" | "flow_finished" | "grading" | "pushed";
|
|
98
94
|
ok?: boolean | undefined;
|
|
99
|
-
index?: number | undefined;
|
|
100
|
-
total?: number | undefined;
|
|
101
95
|
name?: string | undefined;
|
|
96
|
+
total?: number | undefined;
|
|
97
|
+
index?: number | undefined;
|
|
102
98
|
}, {
|
|
103
99
|
at: number;
|
|
104
100
|
phase: "connecting" | "waiting_for_app" | "flows_found" | "flow_started" | "flow_finished" | "grading" | "pushed";
|
|
105
101
|
ok?: boolean | undefined;
|
|
106
|
-
index?: number | undefined;
|
|
107
|
-
total?: number | undefined;
|
|
108
102
|
name?: string | undefined;
|
|
103
|
+
total?: number | undefined;
|
|
104
|
+
index?: number | undefined;
|
|
109
105
|
}>, "many">;
|
|
110
106
|
}, "strip", z.ZodTypeAny, {
|
|
111
107
|
runId: string;
|
|
@@ -113,9 +109,9 @@ export declare const verifyProgressBatchSchema: z.ZodObject<{
|
|
|
113
109
|
at: number;
|
|
114
110
|
phase: "connecting" | "waiting_for_app" | "flows_found" | "flow_started" | "flow_finished" | "grading" | "pushed";
|
|
115
111
|
ok?: boolean | undefined;
|
|
116
|
-
index?: number | undefined;
|
|
117
|
-
total?: number | undefined;
|
|
118
112
|
name?: string | undefined;
|
|
113
|
+
total?: number | undefined;
|
|
114
|
+
index?: number | undefined;
|
|
119
115
|
}[];
|
|
120
116
|
}, {
|
|
121
117
|
runId: string;
|
|
@@ -123,9 +119,9 @@ export declare const verifyProgressBatchSchema: z.ZodObject<{
|
|
|
123
119
|
at: number;
|
|
124
120
|
phase: "connecting" | "waiting_for_app" | "flows_found" | "flow_started" | "flow_finished" | "grading" | "pushed";
|
|
125
121
|
ok?: boolean | undefined;
|
|
126
|
-
index?: number | undefined;
|
|
127
|
-
total?: number | undefined;
|
|
128
122
|
name?: string | undefined;
|
|
123
|
+
total?: number | undefined;
|
|
124
|
+
index?: number | undefined;
|
|
129
125
|
}[];
|
|
130
126
|
}>;
|
|
131
127
|
export type VerifyProgressBatch = z.infer<typeof verifyProgressBatchSchema>;
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* What a verification run is DOING, while it is still doing it.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* A verification takes tens of seconds to minutes and the artifact only exists at the end, so
|
|
5
|
+
* without narration a run that is working and a run that has died look identical for the whole of
|
|
6
|
+
* its duration.
|
|
5
7
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* run that has died look identical for the whole of its duration. Somebody watching a hosted
|
|
10
|
-
* dashboard sat on that ambiguity for fifteen minutes.
|
|
11
|
-
*
|
|
12
|
-
* These events are the narration. They are DERIVED from work that is already happening, never a
|
|
13
|
-
* second source of truth: the run artifact remains the only record of what was proved, and nothing
|
|
14
|
-
* here is ever graded, stored as evidence, or allowed to influence a verdict.
|
|
8
|
+
* These events are DERIVED from work that is already happening, never a second source of truth: the
|
|
9
|
+
* run artifact remains the only record of what was proved, and nothing here is ever graded, stored
|
|
10
|
+
* as evidence, or allowed to influence a verdict.
|
|
15
11
|
*
|
|
16
12
|
* ## The rules that keep it honest
|
|
17
13
|
*
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { CHANNEL_DEFAULTS, ChannelId, Independence } from 'open-verification';
|
|
2
|
+
import { PredicateKind } from '../verdict/consequence.js';
|
|
3
|
+
/**
|
|
4
|
+
* The sources of truth a verdict can be built from.
|
|
5
|
+
*
|
|
6
|
+
* An implementation declares which of these it can observe. A claim reads one or more of them. Put
|
|
7
|
+
* those two facts together and you can tell, at the moment a connection opens, whether a claim is
|
|
8
|
+
* answerable at all -- rather than finding out after the action has been spent and the moment has
|
|
9
|
+
* passed.
|
|
10
|
+
*
|
|
11
|
+
* That ordering is the whole point. Reticle has a history of discovering a missing observation at
|
|
12
|
+
* assert time and reporting a result that looked like evidence: the assertion could not be answered
|
|
13
|
+
* because nothing was watching, and "nothing was watching" and "it did not happen" produced the same
|
|
14
|
+
* empty answer. Each time, the fix was one more flag on the handshake named for that one case. This
|
|
15
|
+
* is the mechanism those flags were each a hand-made instance of.
|
|
16
|
+
*
|
|
17
|
+
* Names are chosen for what the thing IS, not for what one surface calls it. A browser console, a
|
|
18
|
+
* phone's log stream and a server's stdout are one channel: `log`. A realm that has no console still
|
|
19
|
+
* has somewhere errors go.
|
|
20
|
+
*/
|
|
21
|
+
export { ChannelId };
|
|
22
|
+
/** The channels a claim of this kind needs to look at. */
|
|
23
|
+
export declare function channelsRead(kind: PredicateKind): readonly ChannelId[];
|
|
24
|
+
/**
|
|
25
|
+
* The independence rule, and where it lives.
|
|
26
|
+
*
|
|
27
|
+
* It is not defined here. It is defined in `open-verification`, the specification this codebase
|
|
28
|
+
* implements, and re-exported here so the rest of the repository can reach it.
|
|
29
|
+
*
|
|
30
|
+
* That direction is the point. A rule this load-bearing, defined in the product and described in
|
|
31
|
+
* the spec, is two definitions of one contract -- and the two would drift the way every such pair
|
|
32
|
+
* drifts, silently and in the product's favour. Defining it in the protocol and importing it here
|
|
33
|
+
* means an implementation cannot quietly hold a more convenient version of the rule than the one
|
|
34
|
+
* it publishes.
|
|
35
|
+
*/
|
|
36
|
+
export { Independence, CHANNEL_DEFAULTS };
|
|
37
|
+
/**
|
|
38
|
+
* May a disagreement between these two channels be reported as a fault?
|
|
39
|
+
*
|
|
40
|
+
* The protocol's rule, reached by channel id rather than by descriptor, because that is the shape
|
|
41
|
+
* every caller here already holds. The judgement itself is not re-implemented -- it is the
|
|
42
|
+
* specification's function, applied to this repository's defaults.
|
|
43
|
+
*/
|
|
44
|
+
export declare function disagreementCanConvict(a: ChannelId, b: ChannelId): boolean;
|
|
45
|
+
/** How independent each channel is, in the shape this repository already reads it in. */
|
|
46
|
+
export declare const CHANNEL_INDEPENDENCE: Record<ChannelId, Independence>;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { CHANNEL_DEFAULTS, ChannelId, Independence, disagreementCanConvict as protocolRule, } from 'open-verification';
|
|
2
|
+
import { PredicateKind } from '../verdict/consequence.js';
|
|
3
|
+
/**
|
|
4
|
+
* The sources of truth a verdict can be built from.
|
|
5
|
+
*
|
|
6
|
+
* An implementation declares which of these it can observe. A claim reads one or more of them. Put
|
|
7
|
+
* those two facts together and you can tell, at the moment a connection opens, whether a claim is
|
|
8
|
+
* answerable at all -- rather than finding out after the action has been spent and the moment has
|
|
9
|
+
* passed.
|
|
10
|
+
*
|
|
11
|
+
* That ordering is the whole point. Reticle has a history of discovering a missing observation at
|
|
12
|
+
* assert time and reporting a result that looked like evidence: the assertion could not be answered
|
|
13
|
+
* because nothing was watching, and "nothing was watching" and "it did not happen" produced the same
|
|
14
|
+
* empty answer. Each time, the fix was one more flag on the handshake named for that one case. This
|
|
15
|
+
* is the mechanism those flags were each a hand-made instance of.
|
|
16
|
+
*
|
|
17
|
+
* Names are chosen for what the thing IS, not for what one surface calls it. A browser console, a
|
|
18
|
+
* phone's log stream and a server's stdout are one channel: `log`. A realm that has no console still
|
|
19
|
+
* has somewhere errors go.
|
|
20
|
+
*/
|
|
21
|
+
export { ChannelId };
|
|
22
|
+
/**
|
|
23
|
+
* Which channels each kind of claim needs to look at.
|
|
24
|
+
*
|
|
25
|
+
* `Record<PredicateKind, ...>` on purpose: a new kind of claim will not compile until somebody says
|
|
26
|
+
* what it reads. A kind that answered "nothing" would slip past the rule that refuses claims reading
|
|
27
|
+
* undeclared channels, so silence is not an available answer.
|
|
28
|
+
*/
|
|
29
|
+
const CHANNELS_OF = {
|
|
30
|
+
[PredicateKind.ELEMENT]: [ChannelId.UI],
|
|
31
|
+
[PredicateKind.TEXT]: [ChannelId.UI],
|
|
32
|
+
[PredicateKind.SIGNAL]: [ChannelId.SIGNAL],
|
|
33
|
+
[PredicateKind.NET]: [ChannelId.NET],
|
|
34
|
+
[PredicateKind.STATE]: [ChannelId.STATE],
|
|
35
|
+
[PredicateKind.ROUTE]: [ChannelId.ROUTE],
|
|
36
|
+
[PredicateKind.CONSOLE]: [ChannelId.LOG],
|
|
37
|
+
// An animation is a thing on screen, observed over time. Both, because a realm that renders but
|
|
38
|
+
// cannot tell you when something settled cannot answer this either.
|
|
39
|
+
[PredicateKind.ANIMATION]: [ChannelId.UI, ChannelId.TIME],
|
|
40
|
+
// "Has everything gone quiet" is a question about time, and about the traffic being waited on.
|
|
41
|
+
[PredicateKind.SETTLED]: [ChannelId.TIME, ChannelId.NET],
|
|
42
|
+
// A claim made of other claims can contain any of them. Reporting only its own channels would
|
|
43
|
+
// make `allOf` a way to wrap a claim and escape the rule entirely.
|
|
44
|
+
[PredicateKind.ALL_OF]: ANY_CHANNEL_A_CLAIM_CAN_READ(),
|
|
45
|
+
[PredicateKind.ANY_OF]: ANY_CHANNEL_A_CLAIM_CAN_READ(),
|
|
46
|
+
[PredicateKind.NOT]: ANY_CHANNEL_A_CLAIM_CAN_READ(),
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Every channel a claim could possibly read -- the answer for a claim built out of other claims.
|
|
50
|
+
*
|
|
51
|
+
* Deliberately the whole set rather than an inspection of the children. The children are not
|
|
52
|
+
* available here (this is a table keyed by kind, not a function of a value), and being pessimistic
|
|
53
|
+
* is the safe direction: it can refuse a composite that would in fact have been answerable, which
|
|
54
|
+
* costs a false refusal. The other direction costs a false verdict.
|
|
55
|
+
*/
|
|
56
|
+
function ANY_CHANNEL_A_CLAIM_CAN_READ() {
|
|
57
|
+
return [
|
|
58
|
+
ChannelId.UI,
|
|
59
|
+
ChannelId.NET,
|
|
60
|
+
ChannelId.STATE,
|
|
61
|
+
ChannelId.SIGNAL,
|
|
62
|
+
ChannelId.LOG,
|
|
63
|
+
ChannelId.ROUTE,
|
|
64
|
+
ChannelId.TIME,
|
|
65
|
+
];
|
|
66
|
+
}
|
|
67
|
+
/** The channels a claim of this kind needs to look at. */
|
|
68
|
+
export function channelsRead(kind) {
|
|
69
|
+
return CHANNELS_OF[kind];
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* The independence rule, and where it lives.
|
|
73
|
+
*
|
|
74
|
+
* It is not defined here. It is defined in `open-verification`, the specification this codebase
|
|
75
|
+
* implements, and re-exported here so the rest of the repository can reach it.
|
|
76
|
+
*
|
|
77
|
+
* That direction is the point. A rule this load-bearing, defined in the product and described in
|
|
78
|
+
* the spec, is two definitions of one contract -- and the two would drift the way every such pair
|
|
79
|
+
* drifts, silently and in the product's favour. Defining it in the protocol and importing it here
|
|
80
|
+
* means an implementation cannot quietly hold a more convenient version of the rule than the one
|
|
81
|
+
* it publishes.
|
|
82
|
+
*/
|
|
83
|
+
export { Independence, CHANNEL_DEFAULTS };
|
|
84
|
+
/**
|
|
85
|
+
* May a disagreement between these two channels be reported as a fault?
|
|
86
|
+
*
|
|
87
|
+
* The protocol's rule, reached by channel id rather than by descriptor, because that is the shape
|
|
88
|
+
* every caller here already holds. The judgement itself is not re-implemented -- it is the
|
|
89
|
+
* specification's function, applied to this repository's defaults.
|
|
90
|
+
*/
|
|
91
|
+
export function disagreementCanConvict(a, b) {
|
|
92
|
+
return protocolRule({ id: a, ...CHANNEL_DEFAULTS[a] }, { id: b, ...CHANNEL_DEFAULTS[b] });
|
|
93
|
+
}
|
|
94
|
+
/** How independent each channel is, in the shape this repository already reads it in. */
|
|
95
|
+
export const CHANNEL_INDEPENDENCE = Object.fromEntries(Object.entries(CHANNEL_DEFAULTS).map(([id, spec]) => [id, spec.independence]));
|