@markstanden/opencode-test-container 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +263 -2
- package/container/Containerfile +24 -0
- package/container/README.md +29 -0
- package/dist/adapters/opencode/events.d.ts +90 -0
- package/dist/adapters/opencode/events.js +213 -0
- package/dist/adapters/opencode/runtime.d.ts +87 -0
- package/dist/adapters/opencode/runtime.js +136 -0
- package/dist/adapters/podman/container.d.ts +62 -0
- package/dist/adapters/podman/container.js +119 -0
- package/dist/adapters/podman/image.d.ts +50 -0
- package/dist/adapters/podman/image.js +124 -0
- package/dist/adapters/process.d.ts +38 -0
- package/dist/adapters/process.js +71 -0
- package/dist/campaign/assess.d.ts +45 -0
- package/dist/campaign/assess.js +208 -0
- package/dist/campaign/close.d.ts +17 -0
- package/dist/campaign/close.js +112 -0
- package/dist/campaign/evidence-guard.d.ts +24 -0
- package/dist/campaign/evidence-guard.js +49 -0
- package/dist/campaign/freeze.d.ts +94 -0
- package/dist/campaign/freeze.js +297 -0
- package/dist/campaign/inventory.d.ts +62 -0
- package/dist/campaign/inventory.js +192 -0
- package/dist/campaign/judge.d.ts +209 -0
- package/dist/campaign/judge.js +1285 -0
- package/dist/campaign/ledger.d.ts +64 -0
- package/dist/campaign/ledger.js +149 -0
- package/dist/campaign/prepare.d.ts +129 -0
- package/dist/campaign/prepare.js +483 -0
- package/dist/campaign/primary.d.ts +96 -0
- package/dist/campaign/primary.js +189 -0
- package/dist/campaign/run.d.ts +151 -0
- package/dist/campaign/run.js +562 -0
- package/dist/campaign/status.d.ts +76 -0
- package/dist/campaign/status.js +237 -0
- package/dist/cli/otc.d.ts +51 -0
- package/dist/cli/otc.js +435 -0
- package/dist/contracts/canonical.d.ts +21 -0
- package/dist/contracts/canonical.js +44 -0
- package/dist/contracts/types.d.ts +261 -0
- package/dist/contracts/types.js +9 -0
- package/dist/contracts/validate.d.ts +72 -0
- package/dist/contracts/validate.js +1021 -0
- package/dist/contracts/version.d.ts +44 -0
- package/dist/contracts/version.js +147 -0
- package/dist/evaluators/docs/analysis/accounting.d.ts +140 -0
- package/dist/evaluators/docs/analysis/accounting.js +237 -0
- package/dist/evaluators/docs/analysis/blinding.d.ts +40 -0
- package/dist/evaluators/docs/analysis/blinding.js +80 -0
- package/dist/evaluators/docs/analysis/bounds.d.ts +40 -0
- package/dist/evaluators/docs/analysis/bounds.js +31 -0
- package/dist/evaluators/docs/analysis/budget.d.ts +137 -0
- package/dist/evaluators/docs/analysis/budget.js +305 -0
- package/dist/evaluators/docs/analysis/closure.d.ts +175 -0
- package/dist/evaluators/docs/analysis/closure.js +251 -0
- package/dist/evaluators/docs/analysis/decision.d.ts +59 -0
- package/dist/evaluators/docs/analysis/decision.js +161 -0
- package/dist/evaluators/docs/analysis/freeze.d.ts +201 -0
- package/dist/evaluators/docs/analysis/freeze.js +395 -0
- package/dist/evaluators/docs/analysis/guardrails.d.ts +51 -0
- package/dist/evaluators/docs/analysis/guardrails.js +194 -0
- package/dist/evaluators/docs/analysis/journal.d.ts +150 -0
- package/dist/evaluators/docs/analysis/journal.js +475 -0
- package/dist/evaluators/docs/analysis/ledger.d.ts +78 -0
- package/dist/evaluators/docs/analysis/ledger.js +145 -0
- package/dist/evaluators/docs/analysis/measures.d.ts +302 -0
- package/dist/evaluators/docs/analysis/measures.js +1069 -0
- package/dist/evaluators/docs/analysis/model.d.ts +236 -0
- package/dist/evaluators/docs/analysis/model.js +740 -0
- package/dist/evaluators/docs/analysis/pairing.d.ts +68 -0
- package/dist/evaluators/docs/analysis/pairing.js +95 -0
- package/dist/evaluators/docs/analysis/records.d.ts +229 -0
- package/dist/evaluators/docs/analysis/records.js +935 -0
- package/dist/evaluators/docs/analysis/recovery.d.ts +225 -0
- package/dist/evaluators/docs/analysis/recovery.js +507 -0
- package/dist/evaluators/docs/analysis/render.d.ts +235 -0
- package/dist/evaluators/docs/analysis/render.js +566 -0
- package/dist/evaluators/docs/analysis/replay.d.ts +15 -0
- package/dist/evaluators/docs/analysis/replay.js +1272 -0
- package/dist/evaluators/docs/analysis/screening/inventory.d.ts +136 -0
- package/dist/evaluators/docs/analysis/screening/inventory.js +307 -0
- package/dist/evaluators/docs/analysis/screening/noteVersion.d.ts +15 -0
- package/dist/evaluators/docs/analysis/screening/noteVersion.js +46 -0
- package/dist/evaluators/docs/analysis/screening/reconcile.d.ts +38 -0
- package/dist/evaluators/docs/analysis/screening/reconcile.js +40 -0
- package/dist/evaluators/docs/analysis/screening/rules.d.ts +163 -0
- package/dist/evaluators/docs/analysis/screening/rules.js +330 -0
- package/dist/evaluators/docs/analysis/screening/scan.d.ts +72 -0
- package/dist/evaluators/docs/analysis/screening/scan.js +362 -0
- package/dist/evaluators/docs/analysis/selector.d.ts +68 -0
- package/dist/evaluators/docs/analysis/selector.js +123 -0
- package/dist/evaluators/docs/assess.d.ts +129 -0
- package/dist/evaluators/docs/assess.js +433 -0
- package/dist/evaluators/docs/campaign.d.ts +133 -0
- package/dist/evaluators/docs/campaign.js +222 -0
- package/dist/evaluators/docs/index.d.ts +25 -0
- package/dist/evaluators/docs/index.js +25 -0
- package/dist/evaluators/docs/journal.d.ts +150 -0
- package/dist/evaluators/docs/journal.js +475 -0
- package/dist/evaluators/docs/scoring.d.ts +367 -0
- package/dist/evaluators/docs/scoring.js +662 -0
- package/dist/evaluators/skills/assess.d.ts +94 -0
- package/dist/evaluators/skills/assess.js +207 -0
- package/dist/index.d.ts +46 -0
- package/dist/index.js +29 -0
- package/dist/legacy/prod014.d.ts +86 -0
- package/dist/legacy/prod014.js +209 -0
- package/dist/reporting/report.d.ts +79 -0
- package/dist/reporting/report.js +242 -0
- package/docs/architecture.md +106 -0
- package/docs/capability-matrix.md +84 -0
- package/docs/offline-rehearsal.md +75 -0
- package/docs/parity-record.md +81 -0
- package/docs/pr-description.md +103 -0
- package/docs/schema.md +97 -0
- package/examples/skills/README.md +13 -0
- package/examples/skills/campaign.json +73 -0
- package/examples/skills/skills/otel-helper/SKILL.md +10 -0
- package/examples/skills/suite.json +29 -0
- package/package.json +45 -5
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Opt-in judge recovery: the registered policy, the eligibility decision, the
|
|
3
|
+
* dual spend claim and the checked per-slot selection record.
|
|
4
|
+
*
|
|
5
|
+
* With no registered policy the campaign keeps its historical behaviour: the
|
|
6
|
+
* first unusable assessment stops it. A registered policy permits at most one
|
|
7
|
+
* fresh blind assessment of the same evidence, and only when a complete
|
|
8
|
+
* captured response failed with a JSON syntax error. Every other outcome —
|
|
9
|
+
* transport uncertainty, truncation, schema failure, semantic inconsistency,
|
|
10
|
+
* integrity or freeze problems, unresolved reservations — remains an explicit
|
|
11
|
+
* stop. Nothing here calls a model.
|
|
12
|
+
*/
|
|
13
|
+
import { type BudgetClaim } from "./budget.ts";
|
|
14
|
+
/** The policy schema version this module understands. */
|
|
15
|
+
export declare const RECOVERY_POLICY_VERSION = 1;
|
|
16
|
+
/** The single failure class the initial policy may make eligible. */
|
|
17
|
+
export declare const INITIAL_ELIGIBLE_CLASS = "json-syntax";
|
|
18
|
+
/** The one failure class an attempt can be recovered from under this policy. */
|
|
19
|
+
export type EligibleFailureClass = typeof INITIAL_ELIGIBLE_CLASS;
|
|
20
|
+
/** A registered recovery policy, frozen with the campaign manifest. */
|
|
21
|
+
export interface RecoveryPolicy {
|
|
22
|
+
/** The schema version; only 1 is accepted. */
|
|
23
|
+
version: number;
|
|
24
|
+
/** The failure classes eligible for recovery; `["json-syntax"]` only. */
|
|
25
|
+
eligibleFailureClasses: EligibleFailureClass[];
|
|
26
|
+
/** Completion evidence is mandatory; this policy cannot waive it. */
|
|
27
|
+
requiresCompletionEvidence: true;
|
|
28
|
+
/** Recoveries per failed slot; exactly one under this policy. */
|
|
29
|
+
maxRecoveriesPerSlot: number;
|
|
30
|
+
/** Campaign-wide recovery attempts. */
|
|
31
|
+
recoveryCeiling: number;
|
|
32
|
+
/** Total judge attempts, initial assessments plus recoveries. */
|
|
33
|
+
totalJudgeAttempts: number;
|
|
34
|
+
/** Requests per attempt the adapter exposes, or null when unavailable. */
|
|
35
|
+
providerRequestLimit: number | null;
|
|
36
|
+
}
|
|
37
|
+
/** The outcome of reading one registered policy. */
|
|
38
|
+
export type PolicyParse = {
|
|
39
|
+
ok: true;
|
|
40
|
+
policy: RecoveryPolicy;
|
|
41
|
+
} | {
|
|
42
|
+
ok: false;
|
|
43
|
+
problems: string[];
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Read and validate one registered recovery policy.
|
|
47
|
+
*
|
|
48
|
+
* The initial policy is deliberately narrow: completion evidence is mandatory,
|
|
49
|
+
* at most one recovery per slot is permitted, and the only eligible failure
|
|
50
|
+
* class is a JSON syntax failure. A declaration that widens any of those is
|
|
51
|
+
* refused rather than silently honoured, so a registration cannot become a
|
|
52
|
+
* general retry authorisation.
|
|
53
|
+
* @param value The manifest's `assessment.recovery` declaration.
|
|
54
|
+
* @returns The normalised policy, or every problem found.
|
|
55
|
+
*/
|
|
56
|
+
export declare function parseRecoveryPolicy(value: unknown): PolicyParse;
|
|
57
|
+
/**
|
|
58
|
+
* The canonical hash of a registered policy.
|
|
59
|
+
* @param policy The normalised policy.
|
|
60
|
+
* @returns The SHA-256 of its canonical JSON.
|
|
61
|
+
*/
|
|
62
|
+
export declare function recoveryPolicySha256(policy: RecoveryPolicy): string;
|
|
63
|
+
/** The facts an eligibility decision is made from. */
|
|
64
|
+
export interface RecoveryFacts {
|
|
65
|
+
/** The recorded judgement status of the manifest-selected attempt. */
|
|
66
|
+
attemptStatus: string;
|
|
67
|
+
/** That attempt's machine-readable failure class, when recorded. */
|
|
68
|
+
failureClass: string | null;
|
|
69
|
+
/** Whether that attempt's capture proves a complete final response. */
|
|
70
|
+
completionComplete: boolean | null;
|
|
71
|
+
/** Attempt ids recorded for the slot. */
|
|
72
|
+
attemptIds: readonly string[];
|
|
73
|
+
/** Attempt ids whose judgement status is usable. */
|
|
74
|
+
judgedAttemptIds: readonly string[];
|
|
75
|
+
/** Recovery claims already made campaign-wide. */
|
|
76
|
+
recoveryClaimsUsed: number;
|
|
77
|
+
/** Judge claims already made campaign-wide, initial and recovery. */
|
|
78
|
+
judgeClaimsUsed: number;
|
|
79
|
+
/** The parsed ledger state. */
|
|
80
|
+
ledgerState: "missing" | "malformed" | "open" | "closed";
|
|
81
|
+
/** Freeze-verification problems, empty when the premise is intact. */
|
|
82
|
+
freezeProblems: readonly string[];
|
|
83
|
+
/** Unsettled reservations that forbid a repeat dispatch. */
|
|
84
|
+
unresolvedReservations: readonly string[];
|
|
85
|
+
}
|
|
86
|
+
/** The eligibility decision for one failed slot. */
|
|
87
|
+
export type RecoveryDecision = {
|
|
88
|
+
eligible: true;
|
|
89
|
+
attemptId: string;
|
|
90
|
+
} | {
|
|
91
|
+
eligible: false;
|
|
92
|
+
reason: string;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Decide whether one failed slot may receive its single recovery attempt.
|
|
96
|
+
*
|
|
97
|
+
* Every refusal names the specific fact that stopped it, so a status report can
|
|
98
|
+
* distinguish an ineligible failure from an exhausted budget or a broken
|
|
99
|
+
* premise. A usable first assessment is never replaced.
|
|
100
|
+
* @param policy The registered policy.
|
|
101
|
+
* @param facts The recorded facts for the slot and the campaign.
|
|
102
|
+
* @returns The decision.
|
|
103
|
+
*/
|
|
104
|
+
export declare function recoveryDecision(policy: RecoveryPolicy, facts: RecoveryFacts): RecoveryDecision;
|
|
105
|
+
/** One attempt's recorded facts, as carried by the selection record. */
|
|
106
|
+
export interface SelectionAttempt {
|
|
107
|
+
/** The attempt directory name. */
|
|
108
|
+
attemptId: string;
|
|
109
|
+
/** Its recorded judgement status. */
|
|
110
|
+
judgementStatus: string;
|
|
111
|
+
/** The packet identity it was judged from, or null when unrecorded. */
|
|
112
|
+
packetSha256: string | null;
|
|
113
|
+
/** Its failure class, when it has no usable verdict. */
|
|
114
|
+
failureClass: string | null;
|
|
115
|
+
/** Whether its capture proves a complete final response. */
|
|
116
|
+
complete: boolean | null;
|
|
117
|
+
}
|
|
118
|
+
/** The per-slot assessment selection, written after a usable judgement lands. */
|
|
119
|
+
export interface SelectionRecord {
|
|
120
|
+
/** The record schema version. */
|
|
121
|
+
schemeVersion: number;
|
|
122
|
+
/** The scheduled slot the record belongs to. */
|
|
123
|
+
slot: number;
|
|
124
|
+
/** The scheduled pair id. */
|
|
125
|
+
pairId: string;
|
|
126
|
+
/** The trial stamp. */
|
|
127
|
+
stamp: string;
|
|
128
|
+
/** The arm letter. */
|
|
129
|
+
arm: string;
|
|
130
|
+
/** The scenario id. */
|
|
131
|
+
scenario: string;
|
|
132
|
+
/** The attempt whose judgement the analyser must read. */
|
|
133
|
+
selectedAttemptId: string;
|
|
134
|
+
/** The registered policy hash, or null when none applied. */
|
|
135
|
+
policySha256: string | null;
|
|
136
|
+
/** Every attempt recorded for the slot, in order. */
|
|
137
|
+
attempts: SelectionAttempt[];
|
|
138
|
+
}
|
|
139
|
+
/** The inputs a selection record is built from. */
|
|
140
|
+
export interface SelectionInput {
|
|
141
|
+
/** The scheduled slot. */
|
|
142
|
+
slot: number;
|
|
143
|
+
/** The scheduled pair id. */
|
|
144
|
+
pairId: string;
|
|
145
|
+
/** The trial stamp. */
|
|
146
|
+
stamp: string;
|
|
147
|
+
/** The arm letter. */
|
|
148
|
+
arm: string;
|
|
149
|
+
/** The scenario id. */
|
|
150
|
+
scenario: string;
|
|
151
|
+
/** The attempt whose judgement is authoritative. */
|
|
152
|
+
selectedAttemptId: string;
|
|
153
|
+
/** The registered policy hash, or null when none applied. */
|
|
154
|
+
policySha256: string | null;
|
|
155
|
+
/** Every attempt recorded for the slot. */
|
|
156
|
+
attempts: SelectionAttempt[];
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Build one selection record.
|
|
160
|
+
* @param input The slot identity, the selected attempt and every attempt fact.
|
|
161
|
+
* @returns The record.
|
|
162
|
+
*/
|
|
163
|
+
export declare function selectionRecordOf(input: SelectionInput): SelectionRecord;
|
|
164
|
+
/** The facts a recorded selection is checked against. */
|
|
165
|
+
export interface SelectionFacts {
|
|
166
|
+
/** The scheduled slot, when the caller knows it. */
|
|
167
|
+
slot?: number;
|
|
168
|
+
/** The pair id, when the caller knows it. */
|
|
169
|
+
pairId?: string;
|
|
170
|
+
/** The trial stamp. */
|
|
171
|
+
stamp?: string;
|
|
172
|
+
/** The arm letter, when the caller knows it. */
|
|
173
|
+
arm?: string;
|
|
174
|
+
/** The scenario id. */
|
|
175
|
+
scenario?: string;
|
|
176
|
+
/** Attempt directories actually present for the slot. */
|
|
177
|
+
attemptIds: readonly string[];
|
|
178
|
+
/** The frozen manifest selector. */
|
|
179
|
+
manifestAttemptId: string | null;
|
|
180
|
+
/** The registered policy, or null. */
|
|
181
|
+
policy: RecoveryPolicy | null;
|
|
182
|
+
/** The actual attempt facts, when the caller can re-derive them. */
|
|
183
|
+
attemptFacts?: Record<string, SelectionAttempt>;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Check one recorded selection against the evidence it claims to describe.
|
|
187
|
+
*
|
|
188
|
+
* The record is evidence, not a trusted pointer: its identity, attempt set,
|
|
189
|
+
* ordering, policy eligibility, packet identity and usable judgement status are
|
|
190
|
+
* all re-derived. A tampered record, an ineligible selection, or a replacement
|
|
191
|
+
* of an already-valid first assessment is refused.
|
|
192
|
+
* @param value The recorded selection, as read from disk.
|
|
193
|
+
* @param facts The actual slot and evidence facts.
|
|
194
|
+
* @returns Every problem; empty means the selection is trustworthy.
|
|
195
|
+
*/
|
|
196
|
+
export declare function selectionProblems(value: unknown, facts: SelectionFacts): string[];
|
|
197
|
+
/**
|
|
198
|
+
* Claim the recovery and judge budgets atomically.
|
|
199
|
+
*
|
|
200
|
+
* The recovery claim is taken first, then the judge claim, each with the
|
|
201
|
+
* filesystem deciding the winner. If the judge claim refuses, the recovery
|
|
202
|
+
* reservation is released only because it provably dispatched nothing; a
|
|
203
|
+
* spawned call keeps consuming both ceilings.
|
|
204
|
+
* @param root The campaign evidence root.
|
|
205
|
+
* @param policy The registered policy.
|
|
206
|
+
* @param identity The slot identity and the logical attempt key.
|
|
207
|
+
* @param identity.stamp The trial stamp the claim names.
|
|
208
|
+
* @param identity.attemptId The recovery attempt id.
|
|
209
|
+
* @param identity.key The logical attempt key; a repeat is refused.
|
|
210
|
+
* @param identity.at An injected claim timestamp, for determinism.
|
|
211
|
+
* @returns Both claims, or the refusal.
|
|
212
|
+
*/
|
|
213
|
+
export declare function claimRecoveryBudget(root: string, policy: RecoveryPolicy, identity: {
|
|
214
|
+
stamp: string;
|
|
215
|
+
attemptId: string;
|
|
216
|
+
key: string;
|
|
217
|
+
at?: string;
|
|
218
|
+
}): {
|
|
219
|
+
ok: true;
|
|
220
|
+
recovery: BudgetClaim;
|
|
221
|
+
judge: BudgetClaim;
|
|
222
|
+
} | {
|
|
223
|
+
ok: false;
|
|
224
|
+
reason: string;
|
|
225
|
+
};
|