@reticlehq/core 2.13.1 → 2.14.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 +20 -0
- package/dist/artifacts-entry.js +20 -0
- package/dist/consequence.d.ts +8 -1
- package/dist/consequence.js +11 -2
- package/dist/constants.d.ts +33 -0
- package/dist/constants.js +32 -0
- package/dist/dev-server-registry.d.ts +2 -2
- package/dist/event-payloads.d.ts +167 -10
- package/dist/event-payloads.js +40 -0
- package/dist/findings.d.ts +61 -0
- package/dist/findings.js +67 -0
- package/dist/flow-constants.d.ts +8 -0
- package/dist/flow-constants.js +8 -0
- package/dist/flow-types.d.ts +371 -133
- package/dist/flow-types.js +55 -3
- package/dist/global-press.d.ts +30 -0
- package/dist/global-press.js +54 -0
- package/dist/impact-savings.d.ts +7 -3
- package/dist/impact-savings.js +27 -4
- package/dist/impact.d.ts +96 -44
- package/dist/impact.js +21 -0
- package/dist/index.d.ts +16 -2
- package/dist/index.js +16 -2
- package/dist/instrumentation-gap.d.ts +15 -0
- package/dist/instrumentation-gap.js +16 -0
- package/dist/intent.d.ts +24 -24
- package/dist/journal.d.ts +7 -7
- package/dist/messages.d.ts +107 -46
- package/dist/messages.js +25 -0
- package/dist/net.d.ts +40 -0
- package/dist/net.js +40 -0
- package/dist/notices.d.ts +16 -0
- package/dist/notices.js +19 -0
- package/dist/redaction.d.ts +30 -0
- package/dist/redaction.js +127 -2
- package/dist/schema/event-message.json +1 -0
- package/dist/schema/event-type.json +1 -0
- package/dist/schema/hello-message.json +6 -0
- package/dist/schema/reticle-event.json +1 -0
- package/dist/schema/reticle-message.json +7 -0
- package/dist/telemetry-entry.d.ts +15 -0
- package/dist/telemetry-entry.js +15 -0
- package/dist/telemetry-feedback.d.ts +2 -2
- package/dist/telemetry-session.d.ts +2 -2
- package/dist/telemetry.d.ts +52 -50
- package/dist/types.d.ts +83 -44
- package/dist/types.js +20 -1
- package/dist/upgrade.d.ts +2 -2
- package/dist/verification-run.d.ts +36 -36
- package/dist/verified-constants.d.ts +11 -0
- package/dist/verified-constants.js +11 -0
- package/dist/verify-progress.d.ts +133 -0
- package/dist/verify-progress.js +78 -0
- package/package.json +9 -1
|
@@ -258,12 +258,12 @@ export declare const RunCheckSchema: z.ZodObject<{
|
|
|
258
258
|
evidence: z.ZodOptional<z.ZodUnknown>;
|
|
259
259
|
}, "strip", z.ZodTypeAny, {
|
|
260
260
|
status: "pass" | "fail";
|
|
261
|
-
kind: "
|
|
261
|
+
kind: "state" | "signal" | "console" | "element" | "network" | "layout";
|
|
262
262
|
predicate: string;
|
|
263
263
|
evidence?: unknown;
|
|
264
264
|
}, {
|
|
265
265
|
status: "pass" | "fail";
|
|
266
|
-
kind: "
|
|
266
|
+
kind: "state" | "signal" | "console" | "element" | "network" | "layout";
|
|
267
267
|
predicate: string;
|
|
268
268
|
evidence?: unknown;
|
|
269
269
|
}>;
|
|
@@ -361,14 +361,14 @@ export declare const VerificationEvidenceSchema: z.ZodObject<{
|
|
|
361
361
|
actual: z.ZodUnknown;
|
|
362
362
|
ok: z.ZodBoolean;
|
|
363
363
|
}, "strip", z.ZodTypeAny, {
|
|
364
|
-
ok: boolean;
|
|
365
364
|
path: string;
|
|
365
|
+
ok: boolean;
|
|
366
366
|
store: string;
|
|
367
367
|
expected?: unknown;
|
|
368
368
|
actual?: unknown;
|
|
369
369
|
}, {
|
|
370
|
-
ok: boolean;
|
|
371
370
|
path: string;
|
|
371
|
+
ok: boolean;
|
|
372
372
|
store: string;
|
|
373
373
|
expected?: unknown;
|
|
374
374
|
actual?: unknown;
|
|
@@ -399,8 +399,8 @@ export declare const VerificationEvidenceSchema: z.ZodObject<{
|
|
|
399
399
|
status?: number | undefined;
|
|
400
400
|
}[];
|
|
401
401
|
stateAssertions: {
|
|
402
|
-
ok: boolean;
|
|
403
402
|
path: string;
|
|
403
|
+
ok: boolean;
|
|
404
404
|
store: string;
|
|
405
405
|
expected?: unknown;
|
|
406
406
|
actual?: unknown;
|
|
@@ -423,8 +423,8 @@ export declare const VerificationEvidenceSchema: z.ZodObject<{
|
|
|
423
423
|
status?: number | undefined;
|
|
424
424
|
}[] | undefined;
|
|
425
425
|
stateAssertions?: {
|
|
426
|
-
ok: boolean;
|
|
427
426
|
path: string;
|
|
427
|
+
ok: boolean;
|
|
428
428
|
store: string;
|
|
429
429
|
expected?: unknown;
|
|
430
430
|
actual?: unknown;
|
|
@@ -459,8 +459,8 @@ export declare const RepairPacketSchema: z.ZodObject<{
|
|
|
459
459
|
expected: string;
|
|
460
460
|
actual: string;
|
|
461
461
|
suggestedPrompt: string;
|
|
462
|
-
step?: number | undefined;
|
|
463
462
|
flow?: string | undefined;
|
|
463
|
+
step?: number | undefined;
|
|
464
464
|
sourceLocation?: {
|
|
465
465
|
file: string;
|
|
466
466
|
component?: string | undefined;
|
|
@@ -470,8 +470,8 @@ export declare const RepairPacketSchema: z.ZodObject<{
|
|
|
470
470
|
expected: string;
|
|
471
471
|
actual: string;
|
|
472
472
|
suggestedPrompt: string;
|
|
473
|
-
step?: number | undefined;
|
|
474
473
|
flow?: string | undefined;
|
|
474
|
+
step?: number | undefined;
|
|
475
475
|
sourceLocation?: {
|
|
476
476
|
file: string;
|
|
477
477
|
component?: string | undefined;
|
|
@@ -494,12 +494,12 @@ export declare const RunVerdictSchema: z.ZodObject<{
|
|
|
494
494
|
}>;
|
|
495
495
|
blockingRisks: z.ZodDefault<z.ZodNumber>;
|
|
496
496
|
}, "strip", z.ZodTypeAny, {
|
|
497
|
-
status: "
|
|
497
|
+
status: "partial" | "pass" | "fail";
|
|
498
498
|
reasons: string[];
|
|
499
499
|
confidence: "low" | "medium" | "high";
|
|
500
500
|
blockingRisks: number;
|
|
501
501
|
}, {
|
|
502
|
-
status: "
|
|
502
|
+
status: "partial" | "pass" | "fail";
|
|
503
503
|
confidence: "low" | "medium" | "high";
|
|
504
504
|
reasons?: string[] | undefined;
|
|
505
505
|
blockingRisks?: number | undefined;
|
|
@@ -570,12 +570,12 @@ export declare const ReticleVerificationRunSchema: z.ZodObject<{
|
|
|
570
570
|
}>;
|
|
571
571
|
model: z.ZodOptional<z.ZodString>;
|
|
572
572
|
}, "strip", z.ZodTypeAny, {
|
|
573
|
-
kind: "human" | "coding-agent" | "oem-pipeline";
|
|
574
573
|
id: string;
|
|
574
|
+
kind: "human" | "coding-agent" | "oem-pipeline";
|
|
575
575
|
model?: string | undefined;
|
|
576
576
|
}, {
|
|
577
|
-
kind: "human" | "coding-agent" | "oem-pipeline";
|
|
578
577
|
id: string;
|
|
578
|
+
kind: "human" | "coding-agent" | "oem-pipeline";
|
|
579
579
|
model?: string | undefined;
|
|
580
580
|
}>;
|
|
581
581
|
trigger: z.ZodObject<{
|
|
@@ -692,12 +692,12 @@ export declare const ReticleVerificationRunSchema: z.ZodObject<{
|
|
|
692
692
|
evidence: z.ZodOptional<z.ZodUnknown>;
|
|
693
693
|
}, "strip", z.ZodTypeAny, {
|
|
694
694
|
status: "pass" | "fail";
|
|
695
|
-
kind: "
|
|
695
|
+
kind: "state" | "signal" | "console" | "element" | "network" | "layout";
|
|
696
696
|
predicate: string;
|
|
697
697
|
evidence?: unknown;
|
|
698
698
|
}, {
|
|
699
699
|
status: "pass" | "fail";
|
|
700
|
-
kind: "
|
|
700
|
+
kind: "state" | "signal" | "console" | "element" | "network" | "layout";
|
|
701
701
|
predicate: string;
|
|
702
702
|
evidence?: unknown;
|
|
703
703
|
}>, "many">>;
|
|
@@ -791,14 +791,14 @@ export declare const ReticleVerificationRunSchema: z.ZodObject<{
|
|
|
791
791
|
actual: z.ZodUnknown;
|
|
792
792
|
ok: z.ZodBoolean;
|
|
793
793
|
}, "strip", z.ZodTypeAny, {
|
|
794
|
-
ok: boolean;
|
|
795
794
|
path: string;
|
|
795
|
+
ok: boolean;
|
|
796
796
|
store: string;
|
|
797
797
|
expected?: unknown;
|
|
798
798
|
actual?: unknown;
|
|
799
799
|
}, {
|
|
800
|
-
ok: boolean;
|
|
801
800
|
path: string;
|
|
801
|
+
ok: boolean;
|
|
802
802
|
store: string;
|
|
803
803
|
expected?: unknown;
|
|
804
804
|
actual?: unknown;
|
|
@@ -829,8 +829,8 @@ export declare const ReticleVerificationRunSchema: z.ZodObject<{
|
|
|
829
829
|
status?: number | undefined;
|
|
830
830
|
}[];
|
|
831
831
|
stateAssertions: {
|
|
832
|
-
ok: boolean;
|
|
833
832
|
path: string;
|
|
833
|
+
ok: boolean;
|
|
834
834
|
store: string;
|
|
835
835
|
expected?: unknown;
|
|
836
836
|
actual?: unknown;
|
|
@@ -853,8 +853,8 @@ export declare const ReticleVerificationRunSchema: z.ZodObject<{
|
|
|
853
853
|
status?: number | undefined;
|
|
854
854
|
}[] | undefined;
|
|
855
855
|
stateAssertions?: {
|
|
856
|
-
ok: boolean;
|
|
857
856
|
path: string;
|
|
857
|
+
ok: boolean;
|
|
858
858
|
store: string;
|
|
859
859
|
expected?: unknown;
|
|
860
860
|
actual?: unknown;
|
|
@@ -889,8 +889,8 @@ export declare const ReticleVerificationRunSchema: z.ZodObject<{
|
|
|
889
889
|
expected: string;
|
|
890
890
|
actual: string;
|
|
891
891
|
suggestedPrompt: string;
|
|
892
|
-
step?: number | undefined;
|
|
893
892
|
flow?: string | undefined;
|
|
893
|
+
step?: number | undefined;
|
|
894
894
|
sourceLocation?: {
|
|
895
895
|
file: string;
|
|
896
896
|
component?: string | undefined;
|
|
@@ -900,8 +900,8 @@ export declare const ReticleVerificationRunSchema: z.ZodObject<{
|
|
|
900
900
|
expected: string;
|
|
901
901
|
actual: string;
|
|
902
902
|
suggestedPrompt: string;
|
|
903
|
-
step?: number | undefined;
|
|
904
903
|
flow?: string | undefined;
|
|
904
|
+
step?: number | undefined;
|
|
905
905
|
sourceLocation?: {
|
|
906
906
|
file: string;
|
|
907
907
|
component?: string | undefined;
|
|
@@ -913,8 +913,8 @@ export declare const ReticleVerificationRunSchema: z.ZodObject<{
|
|
|
913
913
|
expected: string;
|
|
914
914
|
actual: string;
|
|
915
915
|
suggestedPrompt: string;
|
|
916
|
-
step?: number | undefined;
|
|
917
916
|
flow?: string | undefined;
|
|
917
|
+
step?: number | undefined;
|
|
918
918
|
sourceLocation?: {
|
|
919
919
|
file: string;
|
|
920
920
|
component?: string | undefined;
|
|
@@ -926,8 +926,8 @@ export declare const ReticleVerificationRunSchema: z.ZodObject<{
|
|
|
926
926
|
expected: string;
|
|
927
927
|
actual: string;
|
|
928
928
|
suggestedPrompt: string;
|
|
929
|
-
step?: number | undefined;
|
|
930
929
|
flow?: string | undefined;
|
|
930
|
+
step?: number | undefined;
|
|
931
931
|
sourceLocation?: {
|
|
932
932
|
file: string;
|
|
933
933
|
component?: string | undefined;
|
|
@@ -949,12 +949,12 @@ export declare const ReticleVerificationRunSchema: z.ZodObject<{
|
|
|
949
949
|
}>;
|
|
950
950
|
blockingRisks: z.ZodDefault<z.ZodNumber>;
|
|
951
951
|
}, "strip", z.ZodTypeAny, {
|
|
952
|
-
status: "
|
|
952
|
+
status: "partial" | "pass" | "fail";
|
|
953
953
|
reasons: string[];
|
|
954
954
|
confidence: "low" | "medium" | "high";
|
|
955
955
|
blockingRisks: number;
|
|
956
956
|
}, {
|
|
957
|
-
status: "
|
|
957
|
+
status: "partial" | "pass" | "fail";
|
|
958
958
|
confidence: "low" | "medium" | "high";
|
|
959
959
|
reasons?: string[] | undefined;
|
|
960
960
|
blockingRisks?: number | undefined;
|
|
@@ -987,9 +987,10 @@ export declare const ReticleVerificationRunSchema: z.ZodObject<{
|
|
|
987
987
|
evidenceRef?: string | undefined;
|
|
988
988
|
failureReason?: string | undefined;
|
|
989
989
|
}[];
|
|
990
|
+
runId: string & z.BRAND<"RunId">;
|
|
990
991
|
agent: {
|
|
991
|
-
kind: "human" | "coding-agent" | "oem-pipeline";
|
|
992
992
|
id: string;
|
|
993
|
+
kind: "human" | "coding-agent" | "oem-pipeline";
|
|
993
994
|
model?: string | undefined;
|
|
994
995
|
};
|
|
995
996
|
project: {
|
|
@@ -1014,8 +1015,8 @@ export declare const ReticleVerificationRunSchema: z.ZodObject<{
|
|
|
1014
1015
|
status?: number | undefined;
|
|
1015
1016
|
}[];
|
|
1016
1017
|
stateAssertions: {
|
|
1017
|
-
ok: boolean;
|
|
1018
1018
|
path: string;
|
|
1019
|
+
ok: boolean;
|
|
1019
1020
|
store: string;
|
|
1020
1021
|
expected?: unknown;
|
|
1021
1022
|
actual?: unknown;
|
|
@@ -1027,7 +1028,6 @@ export declare const ReticleVerificationRunSchema: z.ZodObject<{
|
|
|
1027
1028
|
}[];
|
|
1028
1029
|
};
|
|
1029
1030
|
schemaVersion: 1;
|
|
1030
|
-
runId: string & z.BRAND<"RunId">;
|
|
1031
1031
|
profile: "dev" | "prod-preview";
|
|
1032
1032
|
trigger: {
|
|
1033
1033
|
kind: "manual" | "edit" | "ci" | "oem";
|
|
@@ -1041,7 +1041,7 @@ export declare const ReticleVerificationRunSchema: z.ZodObject<{
|
|
|
1041
1041
|
}[];
|
|
1042
1042
|
checks: {
|
|
1043
1043
|
status: "pass" | "fail";
|
|
1044
|
-
kind: "
|
|
1044
|
+
kind: "state" | "signal" | "console" | "element" | "network" | "layout";
|
|
1045
1045
|
predicate: string;
|
|
1046
1046
|
evidence?: unknown;
|
|
1047
1047
|
}[];
|
|
@@ -1057,7 +1057,7 @@ export declare const ReticleVerificationRunSchema: z.ZodObject<{
|
|
|
1057
1057
|
} | undefined;
|
|
1058
1058
|
}[];
|
|
1059
1059
|
verdict: {
|
|
1060
|
-
status: "
|
|
1060
|
+
status: "partial" | "pass" | "fail";
|
|
1061
1061
|
reasons: string[];
|
|
1062
1062
|
confidence: "low" | "medium" | "high";
|
|
1063
1063
|
blockingRisks: number;
|
|
@@ -1067,8 +1067,8 @@ export declare const ReticleVerificationRunSchema: z.ZodObject<{
|
|
|
1067
1067
|
expected: string;
|
|
1068
1068
|
actual: string;
|
|
1069
1069
|
suggestedPrompt: string;
|
|
1070
|
-
step?: number | undefined;
|
|
1071
1070
|
flow?: string | undefined;
|
|
1071
|
+
step?: number | undefined;
|
|
1072
1072
|
sourceLocation?: {
|
|
1073
1073
|
file: string;
|
|
1074
1074
|
component?: string | undefined;
|
|
@@ -1082,9 +1082,10 @@ export declare const ReticleVerificationRunSchema: z.ZodObject<{
|
|
|
1082
1082
|
signedAt: number;
|
|
1083
1083
|
} | undefined;
|
|
1084
1084
|
}, {
|
|
1085
|
+
runId: string;
|
|
1085
1086
|
agent: {
|
|
1086
|
-
kind: "human" | "coding-agent" | "oem-pipeline";
|
|
1087
1087
|
id: string;
|
|
1088
|
+
kind: "human" | "coding-agent" | "oem-pipeline";
|
|
1088
1089
|
model?: string | undefined;
|
|
1089
1090
|
};
|
|
1090
1091
|
project: {
|
|
@@ -1109,8 +1110,8 @@ export declare const ReticleVerificationRunSchema: z.ZodObject<{
|
|
|
1109
1110
|
status?: number | undefined;
|
|
1110
1111
|
}[] | undefined;
|
|
1111
1112
|
stateAssertions?: {
|
|
1112
|
-
ok: boolean;
|
|
1113
1113
|
path: string;
|
|
1114
|
+
ok: boolean;
|
|
1114
1115
|
store: string;
|
|
1115
1116
|
expected?: unknown;
|
|
1116
1117
|
actual?: unknown;
|
|
@@ -1122,7 +1123,6 @@ export declare const ReticleVerificationRunSchema: z.ZodObject<{
|
|
|
1122
1123
|
}[] | undefined;
|
|
1123
1124
|
};
|
|
1124
1125
|
schemaVersion: 1;
|
|
1125
|
-
runId: string;
|
|
1126
1126
|
profile: "dev" | "prod-preview";
|
|
1127
1127
|
trigger: {
|
|
1128
1128
|
kind: "manual" | "edit" | "ci" | "oem";
|
|
@@ -1130,7 +1130,7 @@ export declare const ReticleVerificationRunSchema: z.ZodObject<{
|
|
|
1130
1130
|
diffRef?: string | undefined;
|
|
1131
1131
|
};
|
|
1132
1132
|
verdict: {
|
|
1133
|
-
status: "
|
|
1133
|
+
status: "partial" | "pass" | "fail";
|
|
1134
1134
|
confidence: "low" | "medium" | "high";
|
|
1135
1135
|
reasons?: string[] | undefined;
|
|
1136
1136
|
blockingRisks?: number | undefined;
|
|
@@ -1156,7 +1156,7 @@ export declare const ReticleVerificationRunSchema: z.ZodObject<{
|
|
|
1156
1156
|
}[] | undefined;
|
|
1157
1157
|
checks?: {
|
|
1158
1158
|
status: "pass" | "fail";
|
|
1159
|
-
kind: "
|
|
1159
|
+
kind: "state" | "signal" | "console" | "element" | "network" | "layout";
|
|
1160
1160
|
predicate: string;
|
|
1161
1161
|
evidence?: unknown;
|
|
1162
1162
|
}[] | undefined;
|
|
@@ -1176,8 +1176,8 @@ export declare const ReticleVerificationRunSchema: z.ZodObject<{
|
|
|
1176
1176
|
expected: string;
|
|
1177
1177
|
actual: string;
|
|
1178
1178
|
suggestedPrompt: string;
|
|
1179
|
-
step?: number | undefined;
|
|
1180
1179
|
flow?: string | undefined;
|
|
1180
|
+
step?: number | undefined;
|
|
1181
1181
|
sourceLocation?: {
|
|
1182
1182
|
file: string;
|
|
1183
1183
|
component?: string | undefined;
|
|
@@ -68,6 +68,17 @@ export declare const VerifiedReason: {
|
|
|
68
68
|
* RED, from the layer whose entire job is not to produce one.
|
|
69
69
|
*/
|
|
70
70
|
readonly OBSERVATION_LOST: "observation_lost";
|
|
71
|
+
/**
|
|
72
|
+
* The request the assertion named was still in flight when the window closed, so a miss is not a
|
|
73
|
+
* failure — the consequence had not finished. NEVER `"no"`.
|
|
74
|
+
*
|
|
75
|
+
* Measured: `act_and_wait` returned `verified: "no"` / `assertion_failed` while the same result's
|
|
76
|
+
* contradictions named the matching POST as still in flight. The request completed 200 half a
|
|
77
|
+
* second after the window; a warm backend on the same assertion came back `yes`. A red that flips
|
|
78
|
+
* green when the backend warms up teaches the agent to loosen checks — the behaviour the docs
|
|
79
|
+
* forbid. See #669.
|
|
80
|
+
*/
|
|
81
|
+
readonly WINDOW_CLOSED_EARLY: "window_closed_early";
|
|
71
82
|
/** The declared consequence did not hold. */
|
|
72
83
|
readonly ASSERTION_FAILED: "assertion_failed";
|
|
73
84
|
/** Channels disagreed about the action — the false green this product exists to catch. */
|
|
@@ -67,6 +67,17 @@ export const VerifiedReason = {
|
|
|
67
67
|
* RED, from the layer whose entire job is not to produce one.
|
|
68
68
|
*/
|
|
69
69
|
OBSERVATION_LOST: 'observation_lost',
|
|
70
|
+
/**
|
|
71
|
+
* The request the assertion named was still in flight when the window closed, so a miss is not a
|
|
72
|
+
* failure — the consequence had not finished. NEVER `"no"`.
|
|
73
|
+
*
|
|
74
|
+
* Measured: `act_and_wait` returned `verified: "no"` / `assertion_failed` while the same result's
|
|
75
|
+
* contradictions named the matching POST as still in flight. The request completed 200 half a
|
|
76
|
+
* second after the window; a warm backend on the same assertion came back `yes`. A red that flips
|
|
77
|
+
* green when the backend warms up teaches the agent to loosen checks — the behaviour the docs
|
|
78
|
+
* forbid. See #669.
|
|
79
|
+
*/
|
|
80
|
+
WINDOW_CLOSED_EARLY: 'window_closed_early',
|
|
70
81
|
/** The declared consequence did not hold. */
|
|
71
82
|
ASSERTION_FAILED: 'assertion_failed',
|
|
72
83
|
/** Channels disagreed about the action — the false green this product exists to catch. */
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a verification run is DOING, while it is still doing it.
|
|
3
|
+
*
|
|
4
|
+
* ## Why this crosses a boundary at all
|
|
5
|
+
*
|
|
6
|
+
* A verification takes tens of seconds to minutes: a browser launches, flows replay one at a time
|
|
7
|
+
* against a live app, and the artifact only exists at the end. Everything watching from outside —
|
|
8
|
+
* a dashboard, a CI log, an editor — sees nothing until it finishes, so a run that is working and a
|
|
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.
|
|
15
|
+
*
|
|
16
|
+
* ## The rules that keep it honest
|
|
17
|
+
*
|
|
18
|
+
* - **A reporter must never fail a run.** Emitting is best-effort at every layer; a listener that
|
|
19
|
+
* throws, or a network that is down, changes nothing about the verification or its exit code.
|
|
20
|
+
* - **Progress is not proof.** `flow_finished` carries `ok` so a watcher can colour a row, and
|
|
21
|
+
* that is a convenience for a human reading a list — the verdict is computed from the artifact,
|
|
22
|
+
* which is graded, and never from this.
|
|
23
|
+
* - **`total` is known before the loop starts**, because "step 3" without "of 12" tells a reader
|
|
24
|
+
* nothing about whether to keep waiting, which is the entire question they are asking.
|
|
25
|
+
*/
|
|
26
|
+
import { z } from 'zod';
|
|
27
|
+
/** The phases a run passes through, in the order they occur. */
|
|
28
|
+
export declare const VerifyPhase: {
|
|
29
|
+
/** Opening the bridge connection. Fast, and the first thing that can fail. */
|
|
30
|
+
readonly CONNECTING: "connecting";
|
|
31
|
+
/** Connected, waiting for the app to attach a session. This is where a dead dev server shows up. */
|
|
32
|
+
readonly WAITING_FOR_APP: "waiting_for_app";
|
|
33
|
+
/** The suite is known. Carries `total`, which is what makes every later step legible. */
|
|
34
|
+
readonly FLOWS_FOUND: "flows_found";
|
|
35
|
+
/** One flow is replaying now. Carries its name and index. */
|
|
36
|
+
readonly FLOW_STARTED: "flow_started";
|
|
37
|
+
/** That flow is done. Carries `ok` — a convenience for a watcher, never a verdict. */
|
|
38
|
+
readonly FLOW_FINISHED: "flow_finished";
|
|
39
|
+
/** Every flow has run; the artifact is being assembled and graded. */
|
|
40
|
+
readonly GRADING: "grading";
|
|
41
|
+
/** The run reached the dashboard. The last thing anybody watching is waiting for. */
|
|
42
|
+
readonly PUSHED: "pushed";
|
|
43
|
+
};
|
|
44
|
+
export type VerifyPhase = (typeof VerifyPhase)[keyof typeof VerifyPhase];
|
|
45
|
+
/**
|
|
46
|
+
* A flow name is user-supplied and unbounded, and this string is rendered in somebody's dashboard.
|
|
47
|
+
* Bounded here rather than at the reader, so no consumer has to remember to truncate it.
|
|
48
|
+
*/
|
|
49
|
+
export declare const VERIFY_PROGRESS_NAME_MAX = 120;
|
|
50
|
+
/** How many events a receiver keeps for one run. A walk nobody can scroll is not more honest. */
|
|
51
|
+
export declare const VERIFY_PROGRESS_MAX_EVENTS = 200;
|
|
52
|
+
export declare const verifyProgressEventSchema: z.ZodObject<{
|
|
53
|
+
phase: z.ZodEnum<["connecting", "waiting_for_app", "flows_found", "flow_started", "flow_finished", "grading", "pushed"]>;
|
|
54
|
+
/** 0-based position in the suite. Absent on phases that are not about one flow. */
|
|
55
|
+
index: z.ZodOptional<z.ZodNumber>;
|
|
56
|
+
/** How many flows the run will replay. Present from `flows_found` onwards. */
|
|
57
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
58
|
+
/** The flow being replayed. Absent on phases that are not about one flow. */
|
|
59
|
+
name: z.ZodOptional<z.ZodString>;
|
|
60
|
+
/** Did that flow replay cleanly? A convenience for rendering, never a verdict. */
|
|
61
|
+
ok: z.ZodOptional<z.ZodBoolean>;
|
|
62
|
+
/** When the emitter saw it, from the injected clock — never `Date.now()` in logic. */
|
|
63
|
+
at: z.ZodNumber;
|
|
64
|
+
}, "strip", z.ZodTypeAny, {
|
|
65
|
+
at: number;
|
|
66
|
+
phase: "connecting" | "waiting_for_app" | "flows_found" | "flow_started" | "flow_finished" | "grading" | "pushed";
|
|
67
|
+
ok?: boolean | undefined;
|
|
68
|
+
index?: number | undefined;
|
|
69
|
+
total?: number | undefined;
|
|
70
|
+
name?: string | undefined;
|
|
71
|
+
}, {
|
|
72
|
+
at: number;
|
|
73
|
+
phase: "connecting" | "waiting_for_app" | "flows_found" | "flow_started" | "flow_finished" | "grading" | "pushed";
|
|
74
|
+
ok?: boolean | undefined;
|
|
75
|
+
index?: number | undefined;
|
|
76
|
+
total?: number | undefined;
|
|
77
|
+
name?: string | undefined;
|
|
78
|
+
}>;
|
|
79
|
+
export type VerifyProgressEvent = z.infer<typeof verifyProgressEventSchema>;
|
|
80
|
+
/** The batch shape a run posts. Batched because one request per flow is a request per flow. */
|
|
81
|
+
export declare const verifyProgressBatchSchema: z.ZodObject<{
|
|
82
|
+
runId: z.ZodString;
|
|
83
|
+
events: z.ZodArray<z.ZodObject<{
|
|
84
|
+
phase: z.ZodEnum<["connecting", "waiting_for_app", "flows_found", "flow_started", "flow_finished", "grading", "pushed"]>;
|
|
85
|
+
/** 0-based position in the suite. Absent on phases that are not about one flow. */
|
|
86
|
+
index: z.ZodOptional<z.ZodNumber>;
|
|
87
|
+
/** How many flows the run will replay. Present from `flows_found` onwards. */
|
|
88
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
89
|
+
/** The flow being replayed. Absent on phases that are not about one flow. */
|
|
90
|
+
name: z.ZodOptional<z.ZodString>;
|
|
91
|
+
/** Did that flow replay cleanly? A convenience for rendering, never a verdict. */
|
|
92
|
+
ok: z.ZodOptional<z.ZodBoolean>;
|
|
93
|
+
/** When the emitter saw it, from the injected clock — never `Date.now()` in logic. */
|
|
94
|
+
at: z.ZodNumber;
|
|
95
|
+
}, "strip", z.ZodTypeAny, {
|
|
96
|
+
at: number;
|
|
97
|
+
phase: "connecting" | "waiting_for_app" | "flows_found" | "flow_started" | "flow_finished" | "grading" | "pushed";
|
|
98
|
+
ok?: boolean | undefined;
|
|
99
|
+
index?: number | undefined;
|
|
100
|
+
total?: number | undefined;
|
|
101
|
+
name?: string | undefined;
|
|
102
|
+
}, {
|
|
103
|
+
at: number;
|
|
104
|
+
phase: "connecting" | "waiting_for_app" | "flows_found" | "flow_started" | "flow_finished" | "grading" | "pushed";
|
|
105
|
+
ok?: boolean | undefined;
|
|
106
|
+
index?: number | undefined;
|
|
107
|
+
total?: number | undefined;
|
|
108
|
+
name?: string | undefined;
|
|
109
|
+
}>, "many">;
|
|
110
|
+
}, "strip", z.ZodTypeAny, {
|
|
111
|
+
runId: string;
|
|
112
|
+
events: {
|
|
113
|
+
at: number;
|
|
114
|
+
phase: "connecting" | "waiting_for_app" | "flows_found" | "flow_started" | "flow_finished" | "grading" | "pushed";
|
|
115
|
+
ok?: boolean | undefined;
|
|
116
|
+
index?: number | undefined;
|
|
117
|
+
total?: number | undefined;
|
|
118
|
+
name?: string | undefined;
|
|
119
|
+
}[];
|
|
120
|
+
}, {
|
|
121
|
+
runId: string;
|
|
122
|
+
events: {
|
|
123
|
+
at: number;
|
|
124
|
+
phase: "connecting" | "waiting_for_app" | "flows_found" | "flow_started" | "flow_finished" | "grading" | "pushed";
|
|
125
|
+
ok?: boolean | undefined;
|
|
126
|
+
index?: number | undefined;
|
|
127
|
+
total?: number | undefined;
|
|
128
|
+
name?: string | undefined;
|
|
129
|
+
}[];
|
|
130
|
+
}>;
|
|
131
|
+
export type VerifyProgressBatch = z.infer<typeof verifyProgressBatchSchema>;
|
|
132
|
+
/** Truncate a user-supplied flow name to the wire bound, so a caller cannot overflow the schema. */
|
|
133
|
+
export declare const boundFlowName: (name: string) => string;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a verification run is DOING, while it is still doing it.
|
|
3
|
+
*
|
|
4
|
+
* ## Why this crosses a boundary at all
|
|
5
|
+
*
|
|
6
|
+
* A verification takes tens of seconds to minutes: a browser launches, flows replay one at a time
|
|
7
|
+
* against a live app, and the artifact only exists at the end. Everything watching from outside —
|
|
8
|
+
* a dashboard, a CI log, an editor — sees nothing until it finishes, so a run that is working and a
|
|
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.
|
|
15
|
+
*
|
|
16
|
+
* ## The rules that keep it honest
|
|
17
|
+
*
|
|
18
|
+
* - **A reporter must never fail a run.** Emitting is best-effort at every layer; a listener that
|
|
19
|
+
* throws, or a network that is down, changes nothing about the verification or its exit code.
|
|
20
|
+
* - **Progress is not proof.** `flow_finished` carries `ok` so a watcher can colour a row, and
|
|
21
|
+
* that is a convenience for a human reading a list — the verdict is computed from the artifact,
|
|
22
|
+
* which is graded, and never from this.
|
|
23
|
+
* - **`total` is known before the loop starts**, because "step 3" without "of 12" tells a reader
|
|
24
|
+
* nothing about whether to keep waiting, which is the entire question they are asking.
|
|
25
|
+
*/
|
|
26
|
+
import { z } from 'zod';
|
|
27
|
+
/** The phases a run passes through, in the order they occur. */
|
|
28
|
+
export const VerifyPhase = {
|
|
29
|
+
/** Opening the bridge connection. Fast, and the first thing that can fail. */
|
|
30
|
+
CONNECTING: 'connecting',
|
|
31
|
+
/** Connected, waiting for the app to attach a session. This is where a dead dev server shows up. */
|
|
32
|
+
WAITING_FOR_APP: 'waiting_for_app',
|
|
33
|
+
/** The suite is known. Carries `total`, which is what makes every later step legible. */
|
|
34
|
+
FLOWS_FOUND: 'flows_found',
|
|
35
|
+
/** One flow is replaying now. Carries its name and index. */
|
|
36
|
+
FLOW_STARTED: 'flow_started',
|
|
37
|
+
/** That flow is done. Carries `ok` — a convenience for a watcher, never a verdict. */
|
|
38
|
+
FLOW_FINISHED: 'flow_finished',
|
|
39
|
+
/** Every flow has run; the artifact is being assembled and graded. */
|
|
40
|
+
GRADING: 'grading',
|
|
41
|
+
/** The run reached the dashboard. The last thing anybody watching is waiting for. */
|
|
42
|
+
PUSHED: 'pushed',
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* A flow name is user-supplied and unbounded, and this string is rendered in somebody's dashboard.
|
|
46
|
+
* Bounded here rather than at the reader, so no consumer has to remember to truncate it.
|
|
47
|
+
*/
|
|
48
|
+
export const VERIFY_PROGRESS_NAME_MAX = 120;
|
|
49
|
+
/** How many events a receiver keeps for one run. A walk nobody can scroll is not more honest. */
|
|
50
|
+
export const VERIFY_PROGRESS_MAX_EVENTS = 200;
|
|
51
|
+
export const verifyProgressEventSchema = z.object({
|
|
52
|
+
phase: z.enum([
|
|
53
|
+
VerifyPhase.CONNECTING,
|
|
54
|
+
VerifyPhase.WAITING_FOR_APP,
|
|
55
|
+
VerifyPhase.FLOWS_FOUND,
|
|
56
|
+
VerifyPhase.FLOW_STARTED,
|
|
57
|
+
VerifyPhase.FLOW_FINISHED,
|
|
58
|
+
VerifyPhase.GRADING,
|
|
59
|
+
VerifyPhase.PUSHED,
|
|
60
|
+
]),
|
|
61
|
+
/** 0-based position in the suite. Absent on phases that are not about one flow. */
|
|
62
|
+
index: z.number().int().nonnegative().optional(),
|
|
63
|
+
/** How many flows the run will replay. Present from `flows_found` onwards. */
|
|
64
|
+
total: z.number().int().nonnegative().optional(),
|
|
65
|
+
/** The flow being replayed. Absent on phases that are not about one flow. */
|
|
66
|
+
name: z.string().max(VERIFY_PROGRESS_NAME_MAX).optional(),
|
|
67
|
+
/** Did that flow replay cleanly? A convenience for rendering, never a verdict. */
|
|
68
|
+
ok: z.boolean().optional(),
|
|
69
|
+
/** When the emitter saw it, from the injected clock — never `Date.now()` in logic. */
|
|
70
|
+
at: z.number().int().nonnegative(),
|
|
71
|
+
});
|
|
72
|
+
/** The batch shape a run posts. Batched because one request per flow is a request per flow. */
|
|
73
|
+
export const verifyProgressBatchSchema = z.object({
|
|
74
|
+
runId: z.string().min(1).max(200),
|
|
75
|
+
events: z.array(verifyProgressEventSchema).max(VERIFY_PROGRESS_MAX_EVENTS),
|
|
76
|
+
});
|
|
77
|
+
/** Truncate a user-supplied flow name to the wire bound, so a caller cannot overflow the schema. */
|
|
78
|
+
export const boundFlowName = (name) => name.length <= VERIFY_PROGRESS_NAME_MAX ? name : name.slice(0, VERIFY_PROGRESS_NAME_MAX);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reticlehq/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.14.0",
|
|
4
4
|
"description": "The Reticle foundation: the shared wire contract — types, zod schemas, constants, messages, and the isomorphic kernel that every Reticle package (browser SDK, server, kits, test harness) imports. Depends only on zod.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -10,6 +10,14 @@
|
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
11
11
|
"default": "./dist/index.js"
|
|
12
12
|
},
|
|
13
|
+
"./telemetry": {
|
|
14
|
+
"types": "./dist/telemetry-entry.d.ts",
|
|
15
|
+
"default": "./dist/telemetry-entry.js"
|
|
16
|
+
},
|
|
17
|
+
"./artifacts": {
|
|
18
|
+
"types": "./dist/artifacts-entry.d.ts",
|
|
19
|
+
"default": "./dist/artifacts-entry.js"
|
|
20
|
+
},
|
|
13
21
|
"./schema/*.json": "./dist/schema/*.json",
|
|
14
22
|
"./desktop-contract": {
|
|
15
23
|
"types": "./dist/desktop-contract.d.cts",
|