@skill-harness/core 0.17.0 → 0.18.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.
Files changed (93) hide show
  1. package/README.md +1 -2
  2. package/dist/adapters/types.d.ts +0 -12
  3. package/dist/capture-trace-types.d.ts +0 -96
  4. package/dist/capture-trace-types.js +0 -4
  5. package/dist/command-cost.d.ts +1 -1
  6. package/dist/command-cost.js +0 -5
  7. package/dist/execution-trace.js +1 -1
  8. package/dist/index.d.ts +3 -23
  9. package/dist/index.js +3 -23
  10. package/dist/instruction-coverage.d.ts +0 -7
  11. package/dist/instruction-coverage.js +5 -7
  12. package/dist/journal.d.ts +0 -8
  13. package/dist/metrics.d.ts +18 -0
  14. package/dist/metrics.js +28 -0
  15. package/dist/redaction.d.ts +6 -0
  16. package/dist/redaction.js +55 -0
  17. package/dist/regate.js +6 -71
  18. package/dist/regrade.d.ts +1 -3
  19. package/dist/regrade.js +1 -21
  20. package/dist/report.d.ts +1 -15
  21. package/dist/report.js +1 -13
  22. package/dist/reps.d.ts +1 -2
  23. package/dist/reps.js +0 -2
  24. package/dist/results.d.ts +0 -9
  25. package/dist/results.js +2 -19
  26. package/dist/run.js +11 -72
  27. package/dist/seeded.d.ts +1 -7
  28. package/dist/seeded.js +5 -11
  29. package/dist/sources.js +4 -9
  30. package/dist/spec.d.ts +0 -13
  31. package/dist/spec.js +6 -48
  32. package/dist/trajectory-events.d.ts +58 -0
  33. package/dist/trajectory-events.js +119 -0
  34. package/package.json +1 -1
  35. package/schemas/results-v2.schema.json +376 -75
  36. package/schemas/specification-v1.schema.json +128 -174
  37. package/dist/adjudication.d.ts +0 -219
  38. package/dist/adjudication.js +0 -422
  39. package/dist/adoption.d.ts +0 -128
  40. package/dist/adoption.js +0 -102
  41. package/dist/affected.d.ts +0 -88
  42. package/dist/affected.js +0 -222
  43. package/dist/capture.d.ts +0 -193
  44. package/dist/capture.js +0 -344
  45. package/dist/comparison.d.ts +0 -97
  46. package/dist/comparison.js +0 -189
  47. package/dist/factory-calibration.d.ts +0 -63
  48. package/dist/factory-calibration.js +0 -115
  49. package/dist/intervention-results.d.ts +0 -6
  50. package/dist/intervention-results.js +0 -52
  51. package/dist/intervention.d.ts +0 -123
  52. package/dist/intervention.js +0 -218
  53. package/dist/investigation.d.ts +0 -94
  54. package/dist/investigation.js +0 -148
  55. package/dist/judge-agreement.d.ts +0 -19
  56. package/dist/judge-agreement.js +0 -31
  57. package/dist/qualification-capture.d.ts +0 -44
  58. package/dist/qualification-capture.js +0 -163
  59. package/dist/qualification-config.d.ts +0 -233
  60. package/dist/qualification-config.js +0 -694
  61. package/dist/qualification-lock.d.ts +0 -15
  62. package/dist/qualification-lock.js +0 -87
  63. package/dist/qualification-oauth-directory.d.ts +0 -79
  64. package/dist/qualification-oauth-directory.js +0 -444
  65. package/dist/qualification-panel-store.d.ts +0 -14
  66. package/dist/qualification-panel-store.js +0 -188
  67. package/dist/qualification-panels.d.ts +0 -99
  68. package/dist/qualification-panels.js +0 -91
  69. package/dist/qualification-process.d.ts +0 -13
  70. package/dist/qualification-process.js +0 -190
  71. package/dist/qualification-runner.d.ts +0 -203
  72. package/dist/qualification-runner.js +0 -2037
  73. package/dist/qualification-store.d.ts +0 -187
  74. package/dist/qualification-store.js +0 -833
  75. package/dist/qualification-validation.d.ts +0 -12
  76. package/dist/qualification-validation.js +0 -8
  77. package/dist/screen.d.ts +0 -31
  78. package/dist/screen.js +0 -105
  79. package/dist/trajectory-gates.d.ts +0 -137
  80. package/dist/trajectory-gates.js +0 -576
  81. package/dist/trusted-host-supervision.d.ts +0 -25
  82. package/dist/trusted-host-supervision.js +0 -94
  83. package/dist/work-capture-schema.d.ts +0 -38
  84. package/dist/work-capture-schema.js +0 -33
  85. package/dist/work-capture.d.ts +0 -43
  86. package/dist/work-capture.js +0 -81
  87. package/dist/work-signals.d.ts +0 -55
  88. package/dist/work-signals.js +0 -71
  89. package/schemas/qualification-cell-result-v1.schema.json +0 -32
  90. package/schemas/qualification-config-v1.schema.json +0 -244
  91. package/schemas/qualification-invocation-request-v1.schema.json +0 -59
  92. package/schemas/qualification-judge-panel-result-v1.schema.json +0 -42
  93. package/schemas/trajectory-event-v1.schema.json +0 -80
@@ -1,12 +0,0 @@
1
- /** Canonical final validator: invocation evidence plus panel-board completeness. */
2
- export declare function validateQualificationRunnerSpool(spoolDir: string): {
3
- derived: {
4
- panels: number;
5
- cells: number;
6
- };
7
- ok: true;
8
- configuration_sha256: string;
9
- invocations: number;
10
- accounting: import("./qualification-store.js").QualificationAccountingReport;
11
- terminal: number;
12
- };
@@ -1,8 +0,0 @@
1
- import { validateQualificationPanelOutputs } from "./qualification-panel-store.js";
2
- import { validateQualificationBaseSpool } from "./qualification-runner.js";
3
- /** Canonical final validator: invocation evidence plus panel-board completeness. */
4
- export function validateQualificationRunnerSpool(spoolDir) {
5
- const base = validateQualificationBaseSpool(spoolDir);
6
- return { ...base, derived: validateQualificationPanelOutputs(spoolDir) };
7
- }
8
- //# sourceMappingURL=qualification-validation.js.map
package/dist/screen.d.ts DELETED
@@ -1,31 +0,0 @@
1
- import { type ResultsFile } from "./results.js";
2
- export type ScreenClassification = "CEILING" | "FLOOR" | "INFORMATIVE" | "UNKNOWN";
3
- export interface ScreenRate {
4
- passes: number;
5
- n: number;
6
- }
7
- export interface ScreenScenario {
8
- skill: string;
9
- model: string;
10
- id: string;
11
- control: ScreenRate;
12
- treatment: ScreenRate;
13
- not_measured: number;
14
- classification: ScreenClassification;
15
- }
16
- export interface ScreenCriterion {
17
- skill: string;
18
- model: string;
19
- scenario_id: string;
20
- criterion: number;
21
- failures: number;
22
- n: number;
23
- fail_rate: number;
24
- }
25
- export interface ScreenReport {
26
- scenarios: ScreenScenario[];
27
- criteria: ScreenCriterion[];
28
- }
29
- /** Pure/offline: derive only from v3 retained invocation and vote evidence. */
30
- export declare function screenResults(results: ResultsFile[]): ScreenReport;
31
- export declare function formatScreen(report: ScreenReport): string;
package/dist/screen.js DELETED
@@ -1,105 +0,0 @@
1
- import { deliveryStatusForObservations } from "./results.js";
2
- import { collapseVotePanel } from "./vote-panel.js";
3
- function classify(rate) {
4
- if (rate.n === 0)
5
- return "UNKNOWN";
6
- const p = rate.passes / rate.n;
7
- if (p >= 0.8)
8
- return "CEILING";
9
- if (p <= 0.1)
10
- return "FLOOR";
11
- if (p >= 0.2 && p <= 0.7)
12
- return "INFORMATIVE";
13
- return "UNKNOWN";
14
- }
15
- /** Pure/offline: derive only from v3 retained invocation and vote evidence. */
16
- export function screenResults(results) {
17
- const rows = new Map();
18
- const criteria = new Map();
19
- for (const result of results) {
20
- const observations = result.schema === 3 ? result.subject_invocations : [];
21
- for (const scenario of result.scenarios) {
22
- const rowKey = `${result.skill}\u0000${result.model}\u0000${scenario.id}`;
23
- const row = rows.get(rowKey) ?? { control: { passes: 0, n: 0 }, treatment: { passes: 0, n: 0 }, not_measured: 0 };
24
- for (const rep of scenario.rep_judgments ?? []) {
25
- const repObservations = observations.filter(observation => observation.scenario_id === scenario.id && observation.repetition === rep.repetition);
26
- const deliveryStatus = deliveryStatusForObservations(repObservations);
27
- if (deliveryStatus === "NOT-MEASURED")
28
- row.not_measured++;
29
- if (deliveryStatus !== "PASS")
30
- continue;
31
- const terminalAttempt = Math.max(...repObservations.map(observation => observation.attempt ?? 0));
32
- const mechanisms = new Set(repObservations.filter(observation => (observation.attempt ?? 0) === terminalAttempt).map(observation => observation.prompt.mechanism));
33
- if (mechanisms.size !== 1)
34
- continue;
35
- const rate = mechanisms.has("none") ? row.control : row.treatment;
36
- let panelVerdict = rep.recorded_verdict;
37
- if (rep.judgments.length > 0) {
38
- const clean = rep.judgments.filter(judgment => !judgment.suspect && (judgment.verdict === "PASS" || judgment.verdict === "FAIL"));
39
- if (clean.length === 0)
40
- continue;
41
- panelVerdict = clean.length === 1 ? clean[0].verdict : collapseVotePanel(rep.judgments).verdict ?? "JUDGE-AMBIGUOUS";
42
- }
43
- else if (rep.objective?.status === "FAIL" && rep.recorded_verdict === "FAIL") {
44
- panelVerdict = "FAIL"; // objective behavioral evidence needs no prose judge
45
- }
46
- else
47
- continue;
48
- if (scenario.adjudication?.repetition === rep.repetition) {
49
- if (scenario.adjudication.state === "unresolved" || !scenario.adjudication.verdict)
50
- continue;
51
- const adjudicated = collapseVotePanel(scenario.adjudication.judgments);
52
- if (adjudicated.state !== scenario.adjudication.state || adjudicated.verdict !== scenario.adjudication.verdict)
53
- continue;
54
- panelVerdict = adjudicated.verdict;
55
- }
56
- const effective = rep.objective?.status === "ERROR" ? "ERROR" : rep.objective?.status === "NOT-MEASURED" ? "NOT-MEASURED" : rep.objective?.status === "FAIL" ? "FAIL" : panelVerdict;
57
- if (effective !== "PASS" && effective !== "FAIL")
58
- continue;
59
- rate.n++;
60
- if (effective === "PASS")
61
- rate.passes++;
62
- for (const judgment of rep.judgments) {
63
- if (judgment.suspect || (judgment.verdict !== "PASS" && judgment.verdict !== "FAIL"))
64
- continue;
65
- for (const vote of judgment.criteria ?? [])
66
- addCriterion(criteria, result.skill, result.model, scenario.id, vote);
67
- }
68
- }
69
- const adjudicatedRep = scenario.adjudication?.repetition;
70
- const adjudicationDelivery = result.schema === 3 && adjudicatedRep !== undefined
71
- ? deliveryStatusForObservations(observations.filter(observation => observation.scenario_id === scenario.id && observation.repetition === adjudicatedRep))
72
- : "ERROR";
73
- for (const judgment of adjudicationDelivery === "PASS" ? scenario.adjudication?.judgments.filter(judgment => judgment.ordinal > 1) ?? [] : []) {
74
- if (judgment.suspect || (judgment.verdict !== "PASS" && judgment.verdict !== "FAIL"))
75
- continue;
76
- for (const vote of judgment.criteria ?? [])
77
- addCriterion(criteria, result.skill, result.model, scenario.id, vote);
78
- }
79
- rows.set(rowKey, row);
80
- }
81
- }
82
- return {
83
- scenarios: [...rows.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([key, row]) => { const [skill, model, id] = key.split("\u0000"); return { skill, model, id, ...row, classification: classify(row.control) }; }),
84
- criteria: [...criteria.values()].sort((a, b) => a.scenario_id.localeCompare(b.scenario_id) || a.criterion - b.criterion).map(x => ({ ...x, fail_rate: x.failures / x.n })),
85
- };
86
- }
87
- function addCriterion(map, skill, model, id, vote) {
88
- if (vote.verdict === "ERROR")
89
- return;
90
- const key = `${skill}\u0000${model}\u0000${id}:${vote.index}`, row = map.get(key) ?? { skill, model, scenario_id: id, criterion: vote.index, failures: 0, n: 0 };
91
- row.n++;
92
- if (vote.verdict === "FAIL")
93
- row.failures++;
94
- map.set(key, row);
95
- }
96
- export function formatScreen(report) {
97
- const lines = ["skill/model/scenario control treatment not-measured class"];
98
- for (const s of report.scenarios)
99
- lines.push(`${s.skill}/${s.model}/${s.id} ${s.control.passes}/${s.control.n} ${s.treatment.passes}/${s.treatment.n} ${s.not_measured} ${s.classification}`);
100
- lines.push("", "skill/model/criterion failures/n fail-rate");
101
- for (const c of report.criteria)
102
- lines.push(`${c.skill}/${c.model}/${c.scenario_id}.${c.criterion} ${c.failures}/${c.n} ${(c.fail_rate * 100).toFixed(1)}%`);
103
- return lines.join("\n");
104
- }
105
- //# sourceMappingURL=screen.js.map
@@ -1,137 +0,0 @@
1
- import { type ArgPredicate, type CountConstraint } from "./trace-gates.js";
2
- /** Adapter-neutral event contract used by objective trajectory assertions. */
3
- export declare const LEGACY_TRAJECTORY_EVENT_VERSION: "1.0";
4
- export declare const TRAJECTORY_EVENT_VERSION: "1.1";
5
- export type TrajectoryEventVersion = typeof LEGACY_TRAJECTORY_EVENT_VERSION | typeof TRAJECTORY_EVENT_VERSION;
6
- export declare const TRAJECTORY_ASSERT_VERSION: "1.0";
7
- export interface TrajectoryApproval {
8
- id?: string;
9
- capability?: string;
10
- subject?: string;
11
- source?: string;
12
- scope?: string;
13
- approved_at?: string;
14
- expires_at?: string;
15
- used_at?: string;
16
- }
17
- export interface TrajectoryDigests {
18
- plan?: string;
19
- task?: string;
20
- definition?: string;
21
- head?: string;
22
- tree?: string;
23
- [key: string]: string | undefined;
24
- }
25
- /**
26
- * One normalized workflow event. Native field names remain available in
27
- * `attributes`; common correlation fields are promoted so the evaluator never
28
- * needs to know whether the source was pi, pi-daddy, or principal assurance.
29
- */
30
- export interface TrajectoryEventV1 {
31
- event_version: TrajectoryEventVersion;
32
- seq: number;
33
- type: string;
34
- source: string;
35
- at?: string;
36
- run_id?: string;
37
- task_id?: string;
38
- workspace_id?: string;
39
- context_id?: string;
40
- finding_id?: string;
41
- parent_id?: string;
42
- child_id?: string;
43
- /** Unique pi-daddy v3 execution occurrence; never synthesized for v2/0.17. */
44
- execution_id?: string;
45
- /** Explicit v3 execution parent. Null is a meaningful root identity. */
46
- parent_execution_id?: string | null;
47
- /** Unique v3 occurrence whose output composed this task. */
48
- task_from_execution_id?: string;
49
- /** Identity of a pi-daddy v3 workflow_fact occurrence. */
50
- workflow_fact_id?: string;
51
- /** Immutable v3 nonterminal lifecycle deadline. */
52
- deadline_at?: string;
53
- phase?: string;
54
- tool?: string;
55
- capability?: string;
56
- requested_capabilities?: string[];
57
- effective_capabilities?: string[];
58
- refusal_code?: string;
59
- exit_code?: number;
60
- digests?: TrajectoryDigests;
61
- approval?: TrajectoryApproval;
62
- requirements?: string[];
63
- attributes?: Record<string, unknown>;
64
- }
65
- export interface EventSelector {
66
- event: string;
67
- where?: Record<string, ArgPredicate>;
68
- select?: "first" | "last" | "all";
69
- }
70
- export interface RequiredEvent extends EventSelector {
71
- count?: CountConstraint;
72
- }
73
- export interface CorrelationAssert {
74
- left: EventSelector;
75
- right: EventSelector;
76
- same?: string[];
77
- different?: string[];
78
- order?: "before" | "after";
79
- }
80
- export interface FreshnessAssert {
81
- subject: EventSelector;
82
- after: EventSelector[];
83
- same?: string[];
84
- }
85
- export interface UniqueAssert {
86
- events: EventSelector;
87
- fields: string[];
88
- }
89
- export interface ForbidAfterAssert {
90
- anchor: EventSelector;
91
- forbidden: EventSelector[];
92
- same?: string[];
93
- anchor_optional?: boolean;
94
- }
95
- export interface ApprovalAssert {
96
- grant: EventSelector;
97
- use: EventSelector;
98
- same?: string[];
99
- scopes?: string[];
100
- sources?: string[];
101
- unexpired?: boolean;
102
- max_uses?: number;
103
- }
104
- export interface CoverageAssert {
105
- requirements: string[];
106
- events?: EventSelector;
107
- }
108
- export interface TrajectoryAssert {
109
- version: typeof TRAJECTORY_ASSERT_VERSION;
110
- require?: RequiredEvent[];
111
- forbid?: EventSelector[];
112
- ordered?: EventSelector[][];
113
- correlate?: CorrelationAssert[];
114
- freshness?: FreshnessAssert[];
115
- unique?: UniqueAssert[];
116
- forbid_after?: ForbidAfterAssert[];
117
- approvals?: ApprovalAssert[];
118
- coverage?: CoverageAssert[];
119
- }
120
- export type TrajectoryAssertionStatus = "PASS" | "FAIL" | "ERROR";
121
- export interface TrajectoryAssertionResult {
122
- kind: "require_event" | "forbid_event" | "ordered_events" | "correlation" | "freshness" | "unique" | "forbid_after" | "approval" | "coverage" | "evidence";
123
- status: TrajectoryAssertionStatus;
124
- detail: string;
125
- }
126
- export interface TrajectoryGateResult {
127
- status: TrajectoryAssertionStatus;
128
- event_version: typeof TRAJECTORY_EVENT_VERSION;
129
- events_sha256: string;
130
- assertions: TrajectoryAssertionResult[];
131
- }
132
- export declare function trajectoryEventsSha256(events: TrajectoryEventV1[]): string;
133
- export declare function serializeTrajectoryEvents(events: TrajectoryEventV1[]): string;
134
- export declare function deserializeTrajectoryEvents(text: string): TrajectoryEventV1[] | null;
135
- /** Evaluate a closed, declarative assertion set over saved normalized events. */
136
- export declare function evaluateTrajectoryGates(assert: TrajectoryAssert, input: TrajectoryEventV1[]): TrajectoryGateResult;
137
- export declare function parseTrajectoryAssert(raw: unknown, ctx: string): TrajectoryAssert;