@openagentsy/hooks 0.0.0-stage → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +674 -0
- package/README.md +32 -2
- package/dist/accountability.d.ts +29 -0
- package/dist/accountability.d.ts.map +1 -0
- package/dist/accountability.js +21 -0
- package/dist/accountability.js.map +1 -0
- package/dist/accountability.test.d.ts +2 -0
- package/dist/accountability.test.d.ts.map +1 -0
- package/dist/accountability.test.js +42 -0
- package/dist/accountability.test.js.map +1 -0
- package/dist/approvals.d.ts +110 -0
- package/dist/approvals.d.ts.map +1 -0
- package/dist/approvals.js +464 -0
- package/dist/approvals.js.map +1 -0
- package/dist/approvals.test.d.ts +2 -0
- package/dist/approvals.test.d.ts.map +1 -0
- package/dist/approvals.test.js +307 -0
- package/dist/approvals.test.js.map +1 -0
- package/dist/base-tool.d.ts +26 -0
- package/dist/base-tool.d.ts.map +1 -0
- package/dist/base-tool.js +37 -0
- package/dist/base-tool.js.map +1 -0
- package/dist/base-tool.test.d.ts +2 -0
- package/dist/base-tool.test.d.ts.map +1 -0
- package/dist/base-tool.test.js +34 -0
- package/dist/base-tool.test.js.map +1 -0
- package/dist/eval/index.d.ts +3 -0
- package/dist/eval/index.d.ts.map +1 -0
- package/dist/eval/index.js +3 -0
- package/dist/eval/index.js.map +1 -0
- package/dist/eval/runner.d.ts +179 -0
- package/dist/eval/runner.d.ts.map +1 -0
- package/dist/eval/runner.js +616 -0
- package/dist/eval/runner.js.map +1 -0
- package/dist/eval/runner.test.d.ts +2 -0
- package/dist/eval/runner.test.d.ts.map +1 -0
- package/dist/eval/runner.test.js +431 -0
- package/dist/eval/runner.test.js.map +1 -0
- package/dist/eval/types.d.ts +173 -0
- package/dist/eval/types.d.ts.map +1 -0
- package/dist/eval/types.js +104 -0
- package/dist/eval/types.js.map +1 -0
- package/dist/event.d.ts +59 -0
- package/dist/event.d.ts.map +1 -0
- package/dist/event.js +178 -0
- package/dist/event.js.map +1 -0
- package/dist/event.test.d.ts +2 -0
- package/dist/event.test.d.ts.map +1 -0
- package/dist/event.test.js +49 -0
- package/dist/event.test.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -0
- package/dist/lessons/capture.d.ts +66 -0
- package/dist/lessons/capture.d.ts.map +1 -0
- package/dist/lessons/capture.js +166 -0
- package/dist/lessons/capture.js.map +1 -0
- package/dist/lessons/capture.test.d.ts +2 -0
- package/dist/lessons/capture.test.d.ts.map +1 -0
- package/dist/lessons/capture.test.js +200 -0
- package/dist/lessons/capture.test.js.map +1 -0
- package/dist/lessons/decide.d.ts +90 -0
- package/dist/lessons/decide.d.ts.map +1 -0
- package/dist/lessons/decide.js +334 -0
- package/dist/lessons/decide.js.map +1 -0
- package/dist/lessons/decide.test.d.ts +2 -0
- package/dist/lessons/decide.test.d.ts.map +1 -0
- package/dist/lessons/decide.test.js +527 -0
- package/dist/lessons/decide.test.js.map +1 -0
- package/dist/lessons/id.d.ts +5 -0
- package/dist/lessons/id.d.ts.map +1 -0
- package/dist/lessons/id.js +20 -0
- package/dist/lessons/id.js.map +1 -0
- package/dist/lessons/index.d.ts +5 -0
- package/dist/lessons/index.d.ts.map +1 -0
- package/dist/lessons/index.js +5 -0
- package/dist/lessons/index.js.map +1 -0
- package/dist/lessons/model.d.ts +163 -0
- package/dist/lessons/model.d.ts.map +1 -0
- package/dist/lessons/model.js +181 -0
- package/dist/lessons/model.js.map +1 -0
- package/dist/lessons/model.test.d.ts +2 -0
- package/dist/lessons/model.test.d.ts.map +1 -0
- package/dist/lessons/model.test.js +178 -0
- package/dist/lessons/model.test.js.map +1 -0
- package/dist/lessons/permissions.test.d.ts +2 -0
- package/dist/lessons/permissions.test.d.ts.map +1 -0
- package/dist/lessons/permissions.test.js +88 -0
- package/dist/lessons/permissions.test.js.map +1 -0
- package/dist/lessons/store.d.ts +74 -0
- package/dist/lessons/store.d.ts.map +1 -0
- package/dist/lessons/store.js +231 -0
- package/dist/lessons/store.js.map +1 -0
- package/dist/output-checks.d.ts +64 -0
- package/dist/output-checks.d.ts.map +1 -0
- package/dist/output-checks.js +248 -0
- package/dist/output-checks.js.map +1 -0
- package/dist/output-checks.test.d.ts +2 -0
- package/dist/output-checks.test.d.ts.map +1 -0
- package/dist/output-checks.test.js +58 -0
- package/dist/output-checks.test.js.map +1 -0
- package/dist/paths.d.ts +37 -0
- package/dist/paths.d.ts.map +1 -0
- package/dist/paths.js +70 -0
- package/dist/paths.js.map +1 -0
- package/dist/paths.test.d.ts +2 -0
- package/dist/paths.test.d.ts.map +1 -0
- package/dist/paths.test.js +36 -0
- package/dist/paths.test.js.map +1 -0
- package/dist/policies/agi-framing.d.ts +12 -0
- package/dist/policies/agi-framing.d.ts.map +1 -0
- package/dist/policies/agi-framing.js +33 -0
- package/dist/policies/agi-framing.js.map +1 -0
- package/dist/policies/anti-anthropomorphism.d.ts +13 -0
- package/dist/policies/anti-anthropomorphism.d.ts.map +1 -0
- package/dist/policies/anti-anthropomorphism.js +34 -0
- package/dist/policies/anti-anthropomorphism.js.map +1 -0
- package/dist/policies/anti-dependence.d.ts +12 -0
- package/dist/policies/anti-dependence.d.ts.map +1 -0
- package/dist/policies/anti-dependence.js +33 -0
- package/dist/policies/anti-dependence.js.map +1 -0
- package/dist/policies/anti-sycophancy.d.ts +13 -0
- package/dist/policies/anti-sycophancy.d.ts.map +1 -0
- package/dist/policies/anti-sycophancy.js +34 -0
- package/dist/policies/anti-sycophancy.js.map +1 -0
- package/dist/policies/dark-pattern.d.ts +14 -0
- package/dist/policies/dark-pattern.d.ts.map +1 -0
- package/dist/policies/dark-pattern.js +44 -0
- package/dist/policies/dark-pattern.js.map +1 -0
- package/dist/policies/destructive-needs-approval.d.ts +14 -0
- package/dist/policies/destructive-needs-approval.d.ts.map +1 -0
- package/dist/policies/destructive-needs-approval.js +31 -0
- package/dist/policies/destructive-needs-approval.js.map +1 -0
- package/dist/policies/discovery.d.ts +12 -0
- package/dist/policies/discovery.d.ts.map +1 -0
- package/dist/policies/discovery.js +130 -0
- package/dist/policies/discovery.js.map +1 -0
- package/dist/policies/high-risk.d.ts +25 -0
- package/dist/policies/high-risk.d.ts.map +1 -0
- package/dist/policies/high-risk.js +105 -0
- package/dist/policies/high-risk.js.map +1 -0
- package/dist/policies/human-only-decisions.d.ts +14 -0
- package/dist/policies/human-only-decisions.d.ts.map +1 -0
- package/dist/policies/human-only-decisions.js +33 -0
- package/dist/policies/human-only-decisions.js.map +1 -0
- package/dist/policies/index.d.ts +29 -0
- package/dist/policies/index.d.ts.map +1 -0
- package/dist/policies/index.js +82 -0
- package/dist/policies/index.js.map +1 -0
- package/dist/policies/no-skip-git-hooks.d.ts +14 -0
- package/dist/policies/no-skip-git-hooks.d.ts.map +1 -0
- package/dist/policies/no-skip-git-hooks.js +31 -0
- package/dist/policies/no-skip-git-hooks.js.map +1 -0
- package/dist/policies/package-manager.d.ts +12 -0
- package/dist/policies/package-manager.d.ts.map +1 -0
- package/dist/policies/package-manager.js +29 -0
- package/dist/policies/package-manager.js.map +1 -0
- package/dist/policies/patterns.d.ts +17 -0
- package/dist/policies/patterns.d.ts.map +1 -0
- package/dist/policies/patterns.js +30 -0
- package/dist/policies/patterns.js.map +1 -0
- package/dist/policies/policies.test.d.ts +2 -0
- package/dist/policies/policies.test.d.ts.map +1 -0
- package/dist/policies/policies.test.js +210 -0
- package/dist/policies/policies.test.js.map +1 -0
- package/dist/policies/privacy-transparency.d.ts +14 -0
- package/dist/policies/privacy-transparency.d.ts.map +1 -0
- package/dist/policies/privacy-transparency.js +50 -0
- package/dist/policies/privacy-transparency.js.map +1 -0
- package/dist/policies/professional-displacement.d.ts +15 -0
- package/dist/policies/professional-displacement.d.ts.map +1 -0
- package/dist/policies/professional-displacement.js +45 -0
- package/dist/policies/professional-displacement.js.map +1 -0
- package/dist/policies/protect-policy.d.ts +14 -0
- package/dist/policies/protect-policy.d.ts.map +1 -0
- package/dist/policies/protect-policy.js +35 -0
- package/dist/policies/protect-policy.js.map +1 -0
- package/dist/policies/scope-enforcement.d.ts +14 -0
- package/dist/policies/scope-enforcement.d.ts.map +1 -0
- package/dist/policies/scope-enforcement.js +34 -0
- package/dist/policies/scope-enforcement.js.map +1 -0
- package/dist/policies/secret-scan-writes.d.ts +13 -0
- package/dist/policies/secret-scan-writes.d.ts.map +1 -0
- package/dist/policies/secret-scan-writes.js +38 -0
- package/dist/policies/secret-scan-writes.js.map +1 -0
- package/dist/policies/selection.d.ts +20 -0
- package/dist/policies/selection.d.ts.map +1 -0
- package/dist/policies/selection.js +93 -0
- package/dist/policies/selection.js.map +1 -0
- package/dist/policies/structural-bias.d.ts +14 -0
- package/dist/policies/structural-bias.d.ts.map +1 -0
- package/dist/policies/structural-bias.js +41 -0
- package/dist/policies/structural-bias.js.map +1 -0
- package/dist/policies/third-party-impact.d.ts +13 -0
- package/dist/policies/third-party-impact.d.ts.map +1 -0
- package/dist/policies/third-party-impact.js +38 -0
- package/dist/policies/third-party-impact.js.map +1 -0
- package/dist/policies/tool-call.d.ts +38 -0
- package/dist/policies/tool-call.d.ts.map +1 -0
- package/dist/policies/tool-call.js +53 -0
- package/dist/policies/tool-call.js.map +1 -0
- package/dist/policies/truthfulness-uncertainty.d.ts +13 -0
- package/dist/policies/truthfulness-uncertainty.d.ts.map +1 -0
- package/dist/policies/truthfulness-uncertainty.js +45 -0
- package/dist/policies/truthfulness-uncertainty.js.map +1 -0
- package/dist/policies/workspace-writes-only.d.ts +25 -0
- package/dist/policies/workspace-writes-only.d.ts.map +1 -0
- package/dist/policies/workspace-writes-only.js +54 -0
- package/dist/policies/workspace-writes-only.js.map +1 -0
- package/dist/policy-engine.d.ts +69 -0
- package/dist/policy-engine.d.ts.map +1 -0
- package/dist/policy-engine.js +145 -0
- package/dist/policy-engine.js.map +1 -0
- package/dist/policy-registry.d.ts +62 -0
- package/dist/policy-registry.d.ts.map +1 -0
- package/dist/policy-registry.js +63 -0
- package/dist/policy-registry.js.map +1 -0
- package/dist/policy-registry.test.d.ts +2 -0
- package/dist/policy-registry.test.d.ts.map +1 -0
- package/dist/policy-registry.test.js +79 -0
- package/dist/policy-registry.test.js.map +1 -0
- package/dist/policy-release.d.ts +44 -0
- package/dist/policy-release.d.ts.map +1 -0
- package/dist/policy-release.js +65 -0
- package/dist/policy-release.js.map +1 -0
- package/dist/policy.d.ts +141 -0
- package/dist/policy.d.ts.map +1 -0
- package/dist/policy.js +22 -0
- package/dist/policy.js.map +1 -0
- package/dist/quality/audit.d.ts +56 -0
- package/dist/quality/audit.d.ts.map +1 -0
- package/dist/quality/audit.js +52 -0
- package/dist/quality/audit.js.map +1 -0
- package/dist/quality/findings.d.ts +34 -0
- package/dist/quality/findings.d.ts.map +1 -0
- package/dist/quality/findings.js +121 -0
- package/dist/quality/findings.js.map +1 -0
- package/dist/quality/findings.test.d.ts +2 -0
- package/dist/quality/findings.test.d.ts.map +1 -0
- package/dist/quality/findings.test.js +79 -0
- package/dist/quality/findings.test.js.map +1 -0
- package/dist/quality/index.d.ts +20 -0
- package/dist/quality/index.d.ts.map +1 -0
- package/dist/quality/index.js +20 -0
- package/dist/quality/index.js.map +1 -0
- package/dist/quality/rule.d.ts +43 -0
- package/dist/quality/rule.d.ts.map +1 -0
- package/dist/quality/rule.js +162 -0
- package/dist/quality/rule.js.map +1 -0
- package/dist/quality/rule.test.d.ts +2 -0
- package/dist/quality/rule.test.d.ts.map +1 -0
- package/dist/quality/rule.test.js +187 -0
- package/dist/quality/rule.test.js.map +1 -0
- package/dist/quality/tools.d.ts +30 -0
- package/dist/quality/tools.d.ts.map +1 -0
- package/dist/quality/tools.js +33 -0
- package/dist/quality/tools.js.map +1 -0
- package/dist/quality/tools.test.d.ts +2 -0
- package/dist/quality/tools.test.d.ts.map +1 -0
- package/dist/quality/tools.test.js +41 -0
- package/dist/quality/tools.test.js.map +1 -0
- package/dist/quality/waive.d.ts +37 -0
- package/dist/quality/waive.d.ts.map +1 -0
- package/dist/quality/waive.js +39 -0
- package/dist/quality/waive.js.map +1 -0
- package/dist/quality/waivers.d.ts +63 -0
- package/dist/quality/waivers.d.ts.map +1 -0
- package/dist/quality/waivers.js +132 -0
- package/dist/quality/waivers.js.map +1 -0
- package/dist/quality/waivers.test.d.ts +2 -0
- package/dist/quality/waivers.test.d.ts.map +1 -0
- package/dist/quality/waivers.test.js +138 -0
- package/dist/quality/waivers.test.js.map +1 -0
- package/dist/registry.d.ts +86 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +92 -0
- package/dist/registry.js.map +1 -0
- package/dist/registry.test.d.ts +2 -0
- package/dist/registry.test.d.ts.map +1 -0
- package/dist/registry.test.js +117 -0
- package/dist/registry.test.js.map +1 -0
- package/dist/rules.d.ts +107 -0
- package/dist/rules.d.ts.map +1 -0
- package/dist/rules.js +632 -0
- package/dist/rules.js.map +1 -0
- package/dist/rules.test.d.ts +2 -0
- package/dist/rules.test.d.ts.map +1 -0
- package/dist/rules.test.js +488 -0
- package/dist/rules.test.js.map +1 -0
- package/dist/secrets.d.ts +17 -0
- package/dist/secrets.d.ts.map +1 -0
- package/dist/secrets.js +17 -0
- package/dist/secrets.js.map +1 -0
- package/dist/secrets.test.d.ts +2 -0
- package/dist/secrets.test.d.ts.map +1 -0
- package/dist/secrets.test.js +20 -0
- package/dist/secrets.test.js.map +1 -0
- package/dist/shell-env.d.ts +23 -0
- package/dist/shell-env.d.ts.map +1 -0
- package/dist/shell-env.js +34 -0
- package/dist/shell-env.js.map +1 -0
- package/dist/shell-env.test.d.ts +2 -0
- package/dist/shell-env.test.d.ts.map +1 -0
- package/dist/shell-env.test.js +45 -0
- package/dist/shell-env.test.js.map +1 -0
- package/package.json +49 -4
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { isAbsolute, resolve } from 'node:path';
|
|
3
|
+
import { assertConsistent, readArtifact, runEvalArtifact } from '../eval/runner.js';
|
|
4
|
+
import { EvalResultShape, ProofError } from '../eval/types.js';
|
|
5
|
+
import { isInside } from '../paths.js';
|
|
6
|
+
import { isSuiteProof, LessonError, transition, } from './model.js';
|
|
7
|
+
import { readLesson, writeLesson } from './store.js';
|
|
8
|
+
/**
|
|
9
|
+
* The decision.
|
|
10
|
+
*
|
|
11
|
+
* A person decides what happens to a lesson: it is validated, applied,
|
|
12
|
+
* rejected, or observed. The tool that carries the decision is denied to
|
|
13
|
+
* every agent role by the permission map, and the command that runs this
|
|
14
|
+
* code is the one a person uses, so `decidedBy` is the human.
|
|
15
|
+
*/
|
|
16
|
+
/** What a person can do to a lesson. */
|
|
17
|
+
export const LESSON_ACTIONS = ['validate', 'apply', 'reject', 'observe'];
|
|
18
|
+
/**
|
|
19
|
+
* The states an observation can land a lesson in.
|
|
20
|
+
*
|
|
21
|
+
* An observation is what a person saw: the behaviour did not change, a newer
|
|
22
|
+
* lesson took over, or the claim needs an answer before it can go on.
|
|
23
|
+
*/
|
|
24
|
+
export const OBSERVE_OUTCOMES = ['rolled_back', 'superseded', 'open_question'];
|
|
25
|
+
/** How many runs a suite proof needs. */
|
|
26
|
+
export const SUITE_RUNS = 3;
|
|
27
|
+
/**
|
|
28
|
+
* The state an observation of a lesson in this state lands in.
|
|
29
|
+
*
|
|
30
|
+
* An applied lesson is observed after the fact: the behaviour either changed
|
|
31
|
+
* or it did not, and a behaviour that did not change is a rollback. A
|
|
32
|
+
* candidate is observed while it is being considered: an observation that
|
|
33
|
+
* raises a question leaves it as a question, and an answered question goes
|
|
34
|
+
* back to being a candidate.
|
|
35
|
+
*/
|
|
36
|
+
export function observeTarget(state) {
|
|
37
|
+
switch (state) {
|
|
38
|
+
case 'applied':
|
|
39
|
+
return 'rolled_back';
|
|
40
|
+
case 'candidate':
|
|
41
|
+
return 'open_question';
|
|
42
|
+
case 'open_question':
|
|
43
|
+
return 'candidate';
|
|
44
|
+
default:
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The state a decision moves the lesson to.
|
|
50
|
+
*/
|
|
51
|
+
export function targetState(lesson, input) {
|
|
52
|
+
switch (input.action) {
|
|
53
|
+
case 'validate':
|
|
54
|
+
return 'validated';
|
|
55
|
+
case 'apply':
|
|
56
|
+
return 'applied';
|
|
57
|
+
case 'reject':
|
|
58
|
+
return 'rejected';
|
|
59
|
+
case 'observe':
|
|
60
|
+
if (input.outcome === undefined)
|
|
61
|
+
return observeTarget(lesson.state);
|
|
62
|
+
if (!OBSERVE_OUTCOMES.includes(input.outcome))
|
|
63
|
+
return undefined;
|
|
64
|
+
return input.outcome;
|
|
65
|
+
default:
|
|
66
|
+
return undefined;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* The path of the proof of a lesson.
|
|
71
|
+
*
|
|
72
|
+
* The proof is a file in the project the lesson is about, so the resolved
|
|
73
|
+
* path has to stay inside the project: a proof that names a directory above
|
|
74
|
+
* it, or a file somewhere else on the machine, is not a proof of this lesson.
|
|
75
|
+
*/
|
|
76
|
+
export function proofPath(root, proof) {
|
|
77
|
+
const path = isAbsolute(proof) ? resolve(proof) : resolve(root, proof);
|
|
78
|
+
if (!isInside(path, [root])) {
|
|
79
|
+
throw new ProofError('the proof is outside the project', 'a proof has to be a file in the project the lesson is about');
|
|
80
|
+
}
|
|
81
|
+
return path;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Whether a result is one a run produced.
|
|
85
|
+
*
|
|
86
|
+
* A run holds the scenarios that ran, each with the hash of the command that
|
|
87
|
+
* ran and the assertions it made. A result with none of that was not run.
|
|
88
|
+
*/
|
|
89
|
+
function isRunProduced(result) {
|
|
90
|
+
if (!Array.isArray(result.scenarios) || result.scenarios.length === 0)
|
|
91
|
+
return false;
|
|
92
|
+
return result.scenarios.every((scenario) => typeof scenario.command_sha256 === 'string' &&
|
|
93
|
+
scenario.command_sha256.length > 0 &&
|
|
94
|
+
scenario.assertions !== undefined &&
|
|
95
|
+
Object.keys(scenario.assertions).length > 0);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* The checks a result has to pass before a decision rests on it.
|
|
99
|
+
*
|
|
100
|
+
* A result is not trusted: it has to be an eval result, it has to agree
|
|
101
|
+
* with its own assertions, it has to be about this lesson, and it has to
|
|
102
|
+
* have passed.
|
|
103
|
+
*/
|
|
104
|
+
function checkResult(result, lesson) {
|
|
105
|
+
if (!EvalResultShape.safeParse(result).success) {
|
|
106
|
+
return {
|
|
107
|
+
ok: false,
|
|
108
|
+
reason: 'the proof result is not an eval result',
|
|
109
|
+
hint: 'the result has to be the JSON the runner wrote',
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
try {
|
|
113
|
+
assertConsistent(result);
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
return {
|
|
117
|
+
ok: false,
|
|
118
|
+
reason: error instanceof Error ? error.message : 'the proof result is inconsistent',
|
|
119
|
+
hint: 'the result has to agree with its own assertions',
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
if (result.lesson_id !== lesson.id) {
|
|
123
|
+
return {
|
|
124
|
+
ok: false,
|
|
125
|
+
reason: `the proof result is about ${result.lesson_id}, not about this lesson`,
|
|
126
|
+
hint: 'run the proof for this lesson',
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
if (result.passed !== true) {
|
|
130
|
+
return {
|
|
131
|
+
ok: false,
|
|
132
|
+
reason: 'the proof did not pass',
|
|
133
|
+
hint: 'a lesson is only validated by a proof that passes',
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
return undefined;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* The proof of a lesson, checked and, where the runner can, run.
|
|
140
|
+
*
|
|
141
|
+
* A proof that is an eval artifact is run here, so the verdict is the
|
|
142
|
+
* runner's and not a file somebody wrote. A proof that is an evals/ suite is
|
|
143
|
+
* run by the safety suite, so the result of its three runs is handed to the
|
|
144
|
+
* decision - and it is only accepted when it is the shape a run writes.
|
|
145
|
+
*/
|
|
146
|
+
async function verifyProof(root, lesson, supplied) {
|
|
147
|
+
const proof = lesson.packet.proof ?? '';
|
|
148
|
+
if (proof.trim() === '') {
|
|
149
|
+
return {
|
|
150
|
+
ok: false,
|
|
151
|
+
reason: 'the lesson has no proof',
|
|
152
|
+
hint: 'name the eval artifact the lesson is proved by',
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
if (isSuiteProof(proof))
|
|
156
|
+
return verifySuiteProof(lesson, supplied);
|
|
157
|
+
return verifyArtifactProof(root, lesson, proof, supplied);
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* The proof of a lesson that is an evals/ suite.
|
|
161
|
+
*
|
|
162
|
+
* The suite runs through the safety suite's own runner, so the result of its
|
|
163
|
+
* three runs is handed to the decision. The result has to be a run: a result
|
|
164
|
+
* with no scenarios, or with scenarios that carry no command, was never run
|
|
165
|
+
* and proves nothing.
|
|
166
|
+
*/
|
|
167
|
+
function verifySuiteProof(lesson, supplied) {
|
|
168
|
+
if (supplied === undefined) {
|
|
169
|
+
return {
|
|
170
|
+
ok: false,
|
|
171
|
+
reason: 'a suite proof needs the result of its three runs',
|
|
172
|
+
hint: 'run the suite and hand the result to the decision',
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
const problem = checkResult(supplied, lesson);
|
|
176
|
+
if (problem !== undefined)
|
|
177
|
+
return problem;
|
|
178
|
+
if (!isRunProduced(supplied)) {
|
|
179
|
+
return {
|
|
180
|
+
ok: false,
|
|
181
|
+
reason: 'the proof result carries no run',
|
|
182
|
+
hint: 'a suite result has to hold the scenarios that ran, each with the hash of its command',
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
if (supplied.runs < SUITE_RUNS) {
|
|
186
|
+
return {
|
|
187
|
+
ok: false,
|
|
188
|
+
reason: `a suite proof needs ${SUITE_RUNS} passing runs`,
|
|
189
|
+
hint: 'run the suite three times and hand the result to the decision',
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
return { ok: true, result: supplied };
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* The proof of a lesson that is an eval artifact.
|
|
196
|
+
*
|
|
197
|
+
* The artifact has to be about this lesson, and it is run here, so the
|
|
198
|
+
* verdict is the runner's. A result that was handed to the decision has to
|
|
199
|
+
* agree with the run.
|
|
200
|
+
*/
|
|
201
|
+
async function verifyArtifactProof(root, lesson, proof, supplied) {
|
|
202
|
+
let path;
|
|
203
|
+
let artifact;
|
|
204
|
+
try {
|
|
205
|
+
path = proofPath(root, proof);
|
|
206
|
+
artifact = await readArtifact(path);
|
|
207
|
+
}
|
|
208
|
+
catch (error) {
|
|
209
|
+
return {
|
|
210
|
+
ok: false,
|
|
211
|
+
reason: error instanceof Error ? error.message : 'the proof could not be read',
|
|
212
|
+
hint: 'the proof has to be an eval artifact of this project',
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
if (artifact.lesson_id !== lesson.id) {
|
|
216
|
+
return {
|
|
217
|
+
ok: false,
|
|
218
|
+
reason: `the proof is about ${artifact.lesson_id}, not about this lesson`,
|
|
219
|
+
hint: 'the proof has to be written for the lesson it proves',
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
let run;
|
|
223
|
+
try {
|
|
224
|
+
run = await runEvalArtifact({
|
|
225
|
+
artifactPath: path,
|
|
226
|
+
workspace: root,
|
|
227
|
+
stateRoot: root,
|
|
228
|
+
lessonId: lesson.id,
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
catch (error) {
|
|
232
|
+
return {
|
|
233
|
+
ok: false,
|
|
234
|
+
reason: error instanceof Error ? error.message : 'the proof could not be run',
|
|
235
|
+
hint: 'the proof has to run before the lesson can be validated',
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
if (supplied !== undefined) {
|
|
239
|
+
const problem = checkResult(supplied, lesson);
|
|
240
|
+
if (problem !== undefined)
|
|
241
|
+
return problem;
|
|
242
|
+
if (supplied.artifact_sha256 !== run.artifact_sha256) {
|
|
243
|
+
return {
|
|
244
|
+
ok: false,
|
|
245
|
+
reason: 'the proof result does not match the proof',
|
|
246
|
+
hint: 'run the proof again and hand the result to the decision',
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
if (run.passed !== true) {
|
|
251
|
+
return {
|
|
252
|
+
ok: false,
|
|
253
|
+
reason: 'the proof did not pass',
|
|
254
|
+
hint: 'a lesson is only validated by a proof that passes',
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
return { ok: true, result: run };
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Record a decision.
|
|
261
|
+
*
|
|
262
|
+
* The move itself is the model's: this only finds the lesson, works out
|
|
263
|
+
* where the decision lands it, and writes the result. A decision that the
|
|
264
|
+
* lifecycle refuses is refused here too, with the reason the model gives.
|
|
265
|
+
*/
|
|
266
|
+
export async function decideLesson(root, input, now = () => new Date()) {
|
|
267
|
+
const lesson = await readLesson(root, input.id);
|
|
268
|
+
if (lesson === undefined) {
|
|
269
|
+
return {
|
|
270
|
+
ok: false,
|
|
271
|
+
reason: `the lesson ${input.id} is not there`,
|
|
272
|
+
hint: 'run the lessons inbox to see what is waiting for a decision',
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
const target = targetState(lesson, input);
|
|
276
|
+
if (target === undefined) {
|
|
277
|
+
return {
|
|
278
|
+
ok: false,
|
|
279
|
+
reason: `a ${lesson.state} lesson has no state an observation can land in`,
|
|
280
|
+
hint: 'a validated lesson is rejected rather than observed, and a lesson that is already final is history',
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
let evalResult = input.evalResult;
|
|
284
|
+
if (target === 'validated') {
|
|
285
|
+
const proof = await verifyProof(root, lesson, input.evalResult);
|
|
286
|
+
if (!proof.ok)
|
|
287
|
+
return { ok: false, reason: proof.reason, hint: proof.hint };
|
|
288
|
+
evalResult = proof.result;
|
|
289
|
+
}
|
|
290
|
+
const decision = {
|
|
291
|
+
decidedBy: input.decidedBy,
|
|
292
|
+
reason: input.reason,
|
|
293
|
+
...(evalResult === undefined ? {} : { evalResult }),
|
|
294
|
+
...(input.changeRef === undefined ? {} : { changeRef: input.changeRef }),
|
|
295
|
+
};
|
|
296
|
+
let moved;
|
|
297
|
+
try {
|
|
298
|
+
moved = transition(lesson, target, decision, now);
|
|
299
|
+
}
|
|
300
|
+
catch (error) {
|
|
301
|
+
if (error instanceof LessonError) {
|
|
302
|
+
return { ok: false, reason: error.message, hint: error.hint };
|
|
303
|
+
}
|
|
304
|
+
throw error;
|
|
305
|
+
}
|
|
306
|
+
await writeLesson(root, moved);
|
|
307
|
+
return { ok: true, lesson: moved };
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* The result of a proof, read from a file.
|
|
311
|
+
*
|
|
312
|
+
* A file that cannot be read is an error and not an absent result: the
|
|
313
|
+
* person who asked has to know which of the two it was.
|
|
314
|
+
*/
|
|
315
|
+
export async function readEvalResult(root, path) {
|
|
316
|
+
let text;
|
|
317
|
+
try {
|
|
318
|
+
text = await readFile(isAbsolute(path) ? path : resolve(root, path), 'utf8');
|
|
319
|
+
}
|
|
320
|
+
catch (error) {
|
|
321
|
+
return {
|
|
322
|
+
error: error instanceof Error ? error.message : `the proof result ${path} could not be read`,
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
try {
|
|
326
|
+
return { result: JSON.parse(text) };
|
|
327
|
+
}
|
|
328
|
+
catch (error) {
|
|
329
|
+
return {
|
|
330
|
+
error: error instanceof Error ? error.message : `the proof result ${path} is not JSON`,
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
//# sourceMappingURL=decide.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decide.js","sourceRoot":"","sources":["../../src/lessons/decide.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MA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