@openpond/evals 0.6.0 → 0.7.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/LEARNING.md +106 -0
- package/README.md +2 -0
- package/dist/graders.js +26 -5
- package/dist/index.js +3 -0
- package/dist/javascript-verifier-contract.js +7 -0
- package/dist/javascript-verifier-node.js +56 -0
- package/dist/javascript-verifier-worker-source.js +1 -0
- package/dist/javascript-verifier-worker.js +6 -0
- package/dist/javascript-verifier.js +64 -0
- package/dist/learning/admission.js +209 -0
- package/dist/learning/assets.js +37 -0
- package/dist/learning/contracts.js +267 -0
- package/dist/learning/errors.js +12 -0
- package/dist/learning/grade-worker.js +99 -0
- package/dist/learning/index.js +9 -0
- package/dist/learning/operations.js +33 -0
- package/dist/learning/repository.js +48 -0
- package/dist/learning/service.js +367 -0
- package/dist/learning/transport.js +25 -0
- package/dist/rewards.js +230 -0
- package/dist/task-schema.js +142 -0
- package/dist/tasksets.js +3 -0
- package/dist/telemetry-catalog.js +1 -1
- package/dist/types/builtin-benchmarks/harness-refiner.d.ts +7 -0
- package/dist/types/builtin-benchmarks/harness-refiner.d.ts.map +1 -1
- package/dist/types/conformance.d.ts +14 -0
- package/dist/types/conformance.d.ts.map +1 -1
- package/dist/types/execution-contracts.d.ts +14 -0
- package/dist/types/execution-contracts.d.ts.map +1 -1
- package/dist/types/graders.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/javascript-verifier-contract.d.ts +9 -0
- package/dist/types/javascript-verifier-contract.d.ts.map +1 -0
- package/dist/types/javascript-verifier-node.d.ts +5 -0
- package/dist/types/javascript-verifier-node.d.ts.map +1 -0
- package/dist/types/javascript-verifier-worker-source.d.ts +2 -0
- package/dist/types/javascript-verifier-worker.d.ts +2 -0
- package/dist/types/javascript-verifier-worker.d.ts.map +1 -0
- package/dist/types/javascript-verifier.d.ts +15 -0
- package/dist/types/javascript-verifier.d.ts.map +1 -0
- package/dist/types/learning/admission.d.ts +335 -0
- package/dist/types/learning/admission.d.ts.map +1 -0
- package/dist/types/learning/assets.d.ts +49 -0
- package/dist/types/learning/assets.d.ts.map +1 -0
- package/dist/types/learning/contracts.d.ts +2149 -0
- package/dist/types/learning/contracts.d.ts.map +1 -0
- package/dist/types/learning/errors.d.ts +8 -0
- package/dist/types/learning/errors.d.ts.map +1 -0
- package/dist/types/learning/grade-worker.d.ts +31 -0
- package/dist/types/learning/grade-worker.d.ts.map +1 -0
- package/dist/types/learning/index.d.ts +10 -0
- package/dist/types/learning/index.d.ts.map +1 -0
- package/dist/types/learning/operations.d.ts +2061 -0
- package/dist/types/learning/operations.d.ts.map +1 -0
- package/dist/types/learning/repository.d.ts +1143 -0
- package/dist/types/learning/repository.d.ts.map +1 -0
- package/dist/types/learning/service.d.ts +22 -0
- package/dist/types/learning/service.d.ts.map +1 -0
- package/dist/types/learning/transport.d.ts +2139 -0
- package/dist/types/learning/transport.d.ts.map +1 -0
- package/dist/types/preferences.d.ts +3 -3
- package/dist/types/review-conformance.d.ts +5 -5
- package/dist/types/rewards.d.ts +611 -0
- package/dist/types/rewards.d.ts.map +1 -0
- package/dist/types/task-schema.d.ts +18 -0
- package/dist/types/task-schema.d.ts.map +1 -0
- package/dist/types/tasksets.d.ts +28 -0
- package/dist/types/tasksets.d.ts.map +1 -1
- package/package.json +30 -3
- package/schemas/learning/v1/asset.schema.json +89 -0
- package/schemas/learning/v1/batch.schema.json +132 -0
- package/schemas/learning/v1/binding.schema.json +207 -0
- package/schemas/learning/v1/command-request.schema.json +2414 -0
- package/schemas/learning/v1/decision.schema.json +440 -0
- package/schemas/learning/v1/definition.schema.json +397 -0
- package/schemas/learning/v1/evidence.schema.json +317 -0
- package/schemas/learning/v1/example-submission.schema.json +253 -0
- package/schemas/learning/v1/feedback-submission.schema.json +114 -0
- package/schemas/learning/v1/feedback.schema.json +233 -0
- package/schemas/learning/v1/grade.schema.json +412 -0
- package/schemas/learning/v1/iteration.schema.json +236 -0
- package/schemas/learning/v1/package.schema.json +776 -0
- package/schemas/learning/v1/policy.schema.json +373 -0
- package/schemas/learning/v1/read-request.schema.json +101 -0
- package/schemas/learning/v1/reward.schema.json +302 -0
- package/schemas/learning/v1/source.schema.json +198 -0
package/dist/rewards.js
ADDED
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { LearningDomainError } from "./learning/errors.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { ImmutableAssetRefSchema, ImmutableReleaseRefSchema, ReleaseHashSchema, ReleaseIdSchema, contentHash } from "@openpond/harness";
|
|
4
|
+
import { gradeEvidence } from "./graders.js";
|
|
5
|
+
import { CustomVerifierGraderSpecSchema, DeterministicGraderSpecSchema, GraderSpecSchema, HumanGraderSpecSchema, ModelJudgeGraderSpecSchema } from "./tasksets.js";
|
|
6
|
+
import { assertBoundedTaskJson, validateTaskSchema } from "./task-schema.js";
|
|
7
|
+
const bindingFields = { id: true, version: true, weight: true, hardGate: true, rewardEligible: true, privileged: true };
|
|
8
|
+
export const RewardImplementationSchema = z.union([
|
|
9
|
+
DeterministicGraderSpecSchema.omit(bindingFields),
|
|
10
|
+
ModelJudgeGraderSpecSchema.omit(bindingFields),
|
|
11
|
+
CustomVerifierGraderSpecSchema.omit(bindingFields),
|
|
12
|
+
HumanGraderSpecSchema.omit(bindingFields),
|
|
13
|
+
z.object({ kind: z.literal("learned_model"), modelVersion: ImmutableReleaseRefSchema, inputContract: ImmutableAssetRefSchema }).strict(),
|
|
14
|
+
]);
|
|
15
|
+
export const RewardReleaseContentSchema = z.object({
|
|
16
|
+
schemaVersion: z.literal("openpond.rewardRelease.v1"),
|
|
17
|
+
id: ReleaseIdSchema,
|
|
18
|
+
revision: z.number().int().positive(),
|
|
19
|
+
name: z.string().trim().min(1).max(500),
|
|
20
|
+
description: z.string().max(10_000),
|
|
21
|
+
implementation: RewardImplementationSchema,
|
|
22
|
+
rawScore: z.object({ minimum: z.number().finite(), maximum: z.number().finite() }).strict(),
|
|
23
|
+
assets: z.array(ImmutableAssetRefSchema).max(1_000),
|
|
24
|
+
}).strict().superRefine((reward, context) => {
|
|
25
|
+
if (reward.rawScore.minimum >= reward.rawScore.maximum)
|
|
26
|
+
context.addIssue({ code: "custom", path: ["rawScore"], message: "A raw score contract requires minimum < maximum." });
|
|
27
|
+
if (reward.implementation.kind !== "learned_model" && (reward.rawScore.minimum !== 0 || reward.rawScore.maximum !== 1))
|
|
28
|
+
context.addIssue({ code: "custom", path: ["rawScore"], message: "Portable graders currently return scores in [0, 1]." });
|
|
29
|
+
if (reward.implementation.kind === "schema") {
|
|
30
|
+
const report = validateTaskSchema(reward.implementation.config.jsonSchema);
|
|
31
|
+
if (!report.valid)
|
|
32
|
+
context.addIssue({ code: "custom", path: ["implementation", "config", "jsonSchema"], message: report.issues[0].message });
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
export const RewardReleaseSchema = RewardReleaseContentSchema.safeExtend({ contentHash: ReleaseHashSchema }).strict();
|
|
36
|
+
export const RewardReleaseRefSchema = ImmutableReleaseRefSchema.extend({ revision: z.number().int().positive() }).strict();
|
|
37
|
+
export const RewardNormalizationSchema = z.discriminatedUnion("kind", [
|
|
38
|
+
z.object({ kind: z.literal("identity") }).strict(),
|
|
39
|
+
z.object({ kind: z.literal("linear"), minimum: z.number().finite(), maximum: z.number().finite(), direction: z.enum(["higher", "lower"]) }).strict(),
|
|
40
|
+
]);
|
|
41
|
+
export const RewardBindingSourceSchema = z.object({
|
|
42
|
+
graderId: ReleaseIdSchema,
|
|
43
|
+
reward: RewardReleaseRefSchema,
|
|
44
|
+
role: z.enum(["training", "evaluation"]),
|
|
45
|
+
normalization: RewardNormalizationSchema,
|
|
46
|
+
weight: z.number().nonnegative().max(1_000),
|
|
47
|
+
required: z.boolean(),
|
|
48
|
+
hardGate: z.boolean(),
|
|
49
|
+
privileged: z.boolean(),
|
|
50
|
+
fixtureRefs: z.array(ImmutableReleaseRefSchema).max(1_000),
|
|
51
|
+
}).strict();
|
|
52
|
+
export const RewardBindingContentSchema = z.object({
|
|
53
|
+
schemaVersion: z.literal("openpond.rewardBinding.v1"),
|
|
54
|
+
id: ReleaseIdSchema,
|
|
55
|
+
revision: z.number().int().positive(),
|
|
56
|
+
name: z.string().trim().min(1).max(500).optional(),
|
|
57
|
+
description: z.string().max(10_000).optional(),
|
|
58
|
+
recipeRef: RewardReleaseRefSchema.optional(),
|
|
59
|
+
sources: z.array(RewardBindingSourceSchema).min(1).max(100),
|
|
60
|
+
aggregation: z.literal("weighted_mean"),
|
|
61
|
+
unscorable: z.literal("exclude_optional_require_all_required"),
|
|
62
|
+
}).strict().superRefine((binding, context) => {
|
|
63
|
+
if (new Set(binding.sources.map((source) => source.graderId)).size !== binding.sources.length)
|
|
64
|
+
context.addIssue({ code: "custom", path: ["sources"], message: "Bound grader identities must be unique." });
|
|
65
|
+
if (!binding.sources.some((source) => source.weight > 0))
|
|
66
|
+
context.addIssue({ code: "custom", path: ["sources"], message: "A binding needs at least one positively weighted source." });
|
|
67
|
+
for (const [index, source] of binding.sources.entries()) {
|
|
68
|
+
if (source.hardGate && !source.required)
|
|
69
|
+
context.addIssue({ code: "custom", path: ["sources", index], message: "A hard gate must be required." });
|
|
70
|
+
if (source.normalization.kind === "linear" && source.normalization.minimum >= source.normalization.maximum)
|
|
71
|
+
context.addIssue({ code: "custom", path: ["sources", index, "normalization"], message: "Linear normalization requires minimum < maximum." });
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
export const RewardBindingSchema = RewardBindingContentSchema.safeExtend({ contentHash: ReleaseHashSchema }).strict();
|
|
75
|
+
export const BoundRewardResultSchema = z.object({
|
|
76
|
+
graderId: ReleaseIdSchema,
|
|
77
|
+
reward: RewardReleaseRefSchema,
|
|
78
|
+
role: z.enum(["training", "evaluation"]),
|
|
79
|
+
status: z.enum(["scored", "pending", "unavailable", "failed"]),
|
|
80
|
+
rawScore: z.number().finite().nullable(),
|
|
81
|
+
normalizedScore: z.number().min(0).max(1).nullable(),
|
|
82
|
+
passed: z.boolean().nullable(),
|
|
83
|
+
evidenceHashes: z.array(ReleaseHashSchema).max(1_000),
|
|
84
|
+
message: z.string().max(20_000).nullable(),
|
|
85
|
+
}).strict();
|
|
86
|
+
export const RewardCompositionContentSchema = z.object({
|
|
87
|
+
schemaVersion: z.literal("openpond.rewardComposition.v1"),
|
|
88
|
+
binding: RewardReleaseRefSchema,
|
|
89
|
+
taskHash: ReleaseHashSchema,
|
|
90
|
+
outputHash: ReleaseHashSchema,
|
|
91
|
+
results: z.array(BoundRewardResultSchema).min(1).max(100),
|
|
92
|
+
training: z.object({ status: z.enum(["scored", "unscorable", "not_configured"]), score: z.number().min(0).max(1).nullable(), passed: z.boolean().nullable() }).strict(),
|
|
93
|
+
evaluation: z.object({ status: z.enum(["scored", "unscorable", "not_configured"]), score: z.number().min(0).max(1).nullable(), passed: z.boolean().nullable() }).strict(),
|
|
94
|
+
}).strict();
|
|
95
|
+
export const RewardCompositionSchema = RewardCompositionContentSchema.extend({ contentHash: ReleaseHashSchema }).strict();
|
|
96
|
+
export function createRewardRelease(input) {
|
|
97
|
+
assertBoundedTaskJson(input);
|
|
98
|
+
const content = RewardReleaseContentSchema.parse(input);
|
|
99
|
+
return RewardReleaseSchema.parse({ ...content, contentHash: contentHash(content) });
|
|
100
|
+
}
|
|
101
|
+
export function createRewardBinding(input, rewards) {
|
|
102
|
+
const content = RewardBindingContentSchema.parse(input);
|
|
103
|
+
const binding = RewardBindingSchema.parse({ ...content, contentHash: contentHash(content) });
|
|
104
|
+
resolveBoundRewards(binding, rewards);
|
|
105
|
+
return binding;
|
|
106
|
+
}
|
|
107
|
+
export function resolveBoundRewards(input, rewards) {
|
|
108
|
+
const binding = RewardBindingSchema.parse(input);
|
|
109
|
+
assertRewardHash(binding);
|
|
110
|
+
return binding.sources.map((source) => {
|
|
111
|
+
const reward = rewards.find((candidate) => candidate.id === source.reward.id && candidate.revision === source.reward.revision && candidate.contentHash === source.reward.contentHash);
|
|
112
|
+
if (!reward)
|
|
113
|
+
throw new LearningDomainError("reward_release_missing", 422, source.graderId);
|
|
114
|
+
const parsed = RewardReleaseSchema.parse(reward);
|
|
115
|
+
assertRewardHash(parsed);
|
|
116
|
+
if (parsed.implementation.kind === "human" && source.role === "training")
|
|
117
|
+
throw new LearningDomainError("human_reward_not_executable", 422, source.graderId);
|
|
118
|
+
if (source.normalization.kind === "identity" && (parsed.rawScore.minimum < 0 || parsed.rawScore.maximum > 1))
|
|
119
|
+
throw new LearningDomainError("reward_normalization_required", 422, source.graderId);
|
|
120
|
+
if (source.normalization.kind === "linear" && (source.normalization.minimum !== parsed.rawScore.minimum || source.normalization.maximum !== parsed.rawScore.maximum))
|
|
121
|
+
throw new LearningDomainError("reward_normalization_contract_mismatch", 422, source.graderId);
|
|
122
|
+
return { source, reward: parsed };
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
export function compileBoundGraders(binding, rewards) {
|
|
126
|
+
return resolveBoundRewards(binding, rewards).map(({ source, reward }) => {
|
|
127
|
+
if (reward.implementation.kind === "learned_model")
|
|
128
|
+
throw new LearningDomainError("learned_reward_requires_model_execution_adapter");
|
|
129
|
+
return compileSource(source, reward);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
export async function executeRewardBinding(input) {
|
|
133
|
+
const resolved = resolveBoundRewards(input.binding, input.rewards);
|
|
134
|
+
const results = [];
|
|
135
|
+
for (const { source, reward } of resolved) {
|
|
136
|
+
input.signal?.throwIfAborted();
|
|
137
|
+
const result = { graderId: source.graderId, reward: source.reward, role: source.role, status: "unavailable", rawScore: null, normalizedScore: null, passed: null, evidenceHashes: [], message: null };
|
|
138
|
+
try {
|
|
139
|
+
if (reward.implementation.kind === "human") {
|
|
140
|
+
result.status = "pending";
|
|
141
|
+
result.message = "Human review is pending.";
|
|
142
|
+
}
|
|
143
|
+
else if (reward.implementation.kind === "learned_model") {
|
|
144
|
+
if (!input.learnedReward)
|
|
145
|
+
result.message = "Learned reward execution is not configured.";
|
|
146
|
+
else {
|
|
147
|
+
const scored = await input.learnedReward({ reward, task: input.task, evidence: input.evidence, signal: input.signal });
|
|
148
|
+
Object.assign(result, { status: "scored", ...scored });
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
const [evidence] = await gradeEvidence({ task: input.task, evidence: input.evidence, graders: [compileSource(source, reward)], modelJudge: input.modelJudge, customVerifier: input.customVerifier });
|
|
153
|
+
if (!evidence)
|
|
154
|
+
throw new LearningDomainError("reward_evidence_missing");
|
|
155
|
+
Object.assign(result, { status: evidence.score === null ? "unavailable" : "scored", rawScore: evidence.score, passed: evidence.score === null ? null : evidence.passed, evidenceHashes: [evidence.contentHash], message: evidence.feedback.join("\n") });
|
|
156
|
+
}
|
|
157
|
+
if (result.status === "scored") {
|
|
158
|
+
if (result.rawScore === null || !Number.isFinite(result.rawScore) || result.rawScore < reward.rawScore.minimum || result.rawScore > reward.rawScore.maximum)
|
|
159
|
+
throw new LearningDomainError("reward_raw_score_outside_contract");
|
|
160
|
+
const normalization = source.normalization;
|
|
161
|
+
result.normalizedScore = normalization.kind === "identity" ? result.rawScore : (result.rawScore - normalization.minimum) / (normalization.maximum - normalization.minimum);
|
|
162
|
+
if (normalization.kind === "linear" && normalization.direction === "lower")
|
|
163
|
+
result.normalizedScore = 1 - result.normalizedScore;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
catch (error) {
|
|
167
|
+
input.signal?.throwIfAborted();
|
|
168
|
+
Object.assign(result, { status: "failed", rawScore: null, normalizedScore: null, passed: null, message: error instanceof Error ? error.message : "Reward execution failed." });
|
|
169
|
+
}
|
|
170
|
+
results.push(BoundRewardResultSchema.parse(result));
|
|
171
|
+
}
|
|
172
|
+
return composeBoundRewards({ binding: input.binding, taskHash: contentHash(input.task), outputHash: contentHash(input.evidence), results });
|
|
173
|
+
}
|
|
174
|
+
export function composeBoundRewards(input) {
|
|
175
|
+
const binding = RewardBindingSchema.parse(input.binding);
|
|
176
|
+
assertRewardHash(binding);
|
|
177
|
+
const results = input.results.map((result) => BoundRewardResultSchema.parse(result));
|
|
178
|
+
if (results.length !== binding.sources.length || new Set(results.map((result) => result.graderId)).size !== results.length)
|
|
179
|
+
throw new LearningDomainError("reward_result_set_incomplete");
|
|
180
|
+
for (const source of binding.sources) {
|
|
181
|
+
const result = results.find((candidate) => candidate.graderId === source.graderId);
|
|
182
|
+
if (!result || contentHash(result.reward) !== contentHash(source.reward) || result.role !== source.role)
|
|
183
|
+
throw new LearningDomainError("reward_result_binding_mismatch");
|
|
184
|
+
if ((result.status === "scored") !== (result.rawScore !== null && result.normalizedScore !== null && result.passed !== null))
|
|
185
|
+
throw new LearningDomainError("reward_result_score_state_invalid");
|
|
186
|
+
if (result.status !== "scored" && (result.rawScore !== null || result.normalizedScore !== null || result.passed !== null))
|
|
187
|
+
throw new LearningDomainError("unscorable_reward_contains_score");
|
|
188
|
+
if (result.status === "scored") {
|
|
189
|
+
const transform = source.normalization;
|
|
190
|
+
const normalized = transform.kind === "identity" ? result.rawScore : (result.rawScore - transform.minimum) / (transform.maximum - transform.minimum);
|
|
191
|
+
const expected = transform.kind === "linear" && transform.direction === "lower" ? 1 - normalized : normalized;
|
|
192
|
+
if (Math.abs(expected - result.normalizedScore) > 1e-12)
|
|
193
|
+
throw new LearningDomainError("reward_normalization_mismatch");
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
const content = RewardCompositionContentSchema.parse({
|
|
197
|
+
schemaVersion: "openpond.rewardComposition.v1",
|
|
198
|
+
binding: { id: binding.id, revision: binding.revision, contentHash: binding.contentHash },
|
|
199
|
+
taskHash: input.taskHash,
|
|
200
|
+
outputHash: input.outputHash,
|
|
201
|
+
results,
|
|
202
|
+
training: aggregate("training"),
|
|
203
|
+
evaluation: aggregate("evaluation"),
|
|
204
|
+
});
|
|
205
|
+
return RewardCompositionSchema.parse({ ...content, contentHash: contentHash(content) });
|
|
206
|
+
function aggregate(role) {
|
|
207
|
+
const selected = binding.sources.filter((source) => source.role === role).map((source) => ({ source, result: results.find((candidate) => candidate.graderId === source.graderId) }));
|
|
208
|
+
if (!selected.length)
|
|
209
|
+
return { status: "not_configured", score: null, passed: null };
|
|
210
|
+
if (selected.some(({ source, result }) => source.required && result.status !== "scored"))
|
|
211
|
+
return { status: "unscorable", score: null, passed: null };
|
|
212
|
+
const scored = selected.filter(({ result }) => result.status === "scored");
|
|
213
|
+
const weight = scored.reduce((sum, { source }) => sum + source.weight, 0);
|
|
214
|
+
if (weight === 0)
|
|
215
|
+
return { status: "unscorable", score: null, passed: null };
|
|
216
|
+
const gated = scored.some(({ source, result }) => source.hardGate && !result.passed);
|
|
217
|
+
return { status: "scored", score: gated ? 0 : scored.reduce((sum, { source, result }) => sum + source.weight * result.normalizedScore, 0) / weight, passed: !gated && scored.every(({ result }) => result.passed) };
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
export function assertRewardHash(value) {
|
|
221
|
+
assertBoundedTaskJson(value);
|
|
222
|
+
if (contentHash(withoutRewardHash(value)) !== value.contentHash)
|
|
223
|
+
throw new LearningDomainError("reward_content_hash_mismatch");
|
|
224
|
+
}
|
|
225
|
+
function withoutRewardHash(value) { const { contentHash: _hash, ...content } = value; return content; }
|
|
226
|
+
function compileSource(source, reward) {
|
|
227
|
+
if (reward.implementation.kind === "learned_model")
|
|
228
|
+
throw new LearningDomainError("learned_reward_requires_model_execution_adapter");
|
|
229
|
+
return GraderSpecSchema.parse({ ...reward.implementation, id: source.graderId, version: String(reward.revision), weight: source.weight, hardGate: source.hardGate, rewardEligible: source.role === "training", privileged: source.privileged });
|
|
230
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { Ajv2020 } from "ajv/dist/2020.js";
|
|
2
|
+
import { contentHash } from "@openpond/harness";
|
|
3
|
+
export const TASK_JSON_SCHEMA_DIALECT = "https://json-schema.org/draft/2020-12/schema";
|
|
4
|
+
export const TASK_VALUE_MAX_BYTES = 1_048_576;
|
|
5
|
+
export const TASK_SCHEMA_MAX_BYTES = 32_768;
|
|
6
|
+
const validators = new Map();
|
|
7
|
+
const schemaMaps = new Set(["properties", "$defs", "dependentSchemas"]);
|
|
8
|
+
const schemaArrays = new Set(["allOf", "anyOf", "oneOf", "prefixItems"]);
|
|
9
|
+
const schemaChildren = new Set(["items", "additionalProperties", "not", "if", "then", "else", "contains", "unevaluatedProperties", "unevaluatedItems", "propertyNames"]);
|
|
10
|
+
const unsupported = new Set(["pattern", "patternProperties", "format", "$id", "$anchor", "$dynamicAnchor", "$dynamicRef", "$recursiveRef", "$recursiveAnchor", "$async", "$data", "contentSchema"]);
|
|
11
|
+
/** Bound producer-controlled JSON before hashing, schema compilation or validation. */
|
|
12
|
+
export function assertBoundedTaskJson(value, maxBytes = TASK_VALUE_MAX_BYTES) {
|
|
13
|
+
const pending = [{ value, depth: 0 }];
|
|
14
|
+
const seen = new Set();
|
|
15
|
+
let nodes = 0;
|
|
16
|
+
while (pending.length) {
|
|
17
|
+
const item = pending.pop();
|
|
18
|
+
if (item.exit) {
|
|
19
|
+
seen.delete(item.value);
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
if (++nodes > 100_000 || item.depth > 48)
|
|
23
|
+
throw new Error("task_json_complexity_exceeded");
|
|
24
|
+
if (item.value === null || typeof item.value === "string" || typeof item.value === "boolean")
|
|
25
|
+
continue;
|
|
26
|
+
if (typeof item.value === "number" && Number.isFinite(item.value))
|
|
27
|
+
continue;
|
|
28
|
+
if (typeof item.value !== "object")
|
|
29
|
+
throw new Error("task_json_value_invalid");
|
|
30
|
+
if (seen.has(item.value))
|
|
31
|
+
throw new Error("task_json_cycle");
|
|
32
|
+
seen.add(item.value);
|
|
33
|
+
pending.push({ ...item, exit: true });
|
|
34
|
+
const prototype = Object.getPrototypeOf(item.value);
|
|
35
|
+
if (!Array.isArray(item.value) && prototype !== Object.prototype && prototype !== null)
|
|
36
|
+
throw new Error("task_json_object_invalid");
|
|
37
|
+
if (Object.getOwnPropertySymbols(item.value).length)
|
|
38
|
+
throw new Error("task_json_symbol_invalid");
|
|
39
|
+
if (Object.hasOwn(item.value, "toJSON"))
|
|
40
|
+
throw new Error("task_json_serializer_invalid");
|
|
41
|
+
if (Array.isArray(item.value) && (item.value.length > 10_000 || Object.keys(item.value).length !== item.value.length))
|
|
42
|
+
throw new Error("task_json_array_invalid");
|
|
43
|
+
for (const [key, descriptor] of Object.entries(Object.getOwnPropertyDescriptors(item.value))) {
|
|
44
|
+
if (descriptor.get || descriptor.set)
|
|
45
|
+
throw new Error("task_json_accessor_invalid");
|
|
46
|
+
if (Array.isArray(item.value) && key !== "length" && (!/^(0|[1-9]\d*)$/u.test(key) || Number(key) >= item.value.length))
|
|
47
|
+
throw new Error("task_json_array_invalid");
|
|
48
|
+
if (descriptor.enumerable)
|
|
49
|
+
pending.push({ value: descriptor.value, depth: item.depth + 1 });
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (new TextEncoder().encode(JSON.stringify(value)).byteLength > maxBytes)
|
|
53
|
+
throw new Error("task_json_size_exceeded");
|
|
54
|
+
}
|
|
55
|
+
/** No remote resolution, custom code, data mutation, regex or format plugins. */
|
|
56
|
+
export function validateTaskSchema(schema) {
|
|
57
|
+
try {
|
|
58
|
+
validator(schema);
|
|
59
|
+
return { valid: true, issues: [] };
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
return { valid: false, issues: [{ path: "", code: "task_schema_invalid", message: error instanceof Error ? error.message : "Task schema is invalid." }] };
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
export function validateTaskValue(schema, value) {
|
|
66
|
+
try {
|
|
67
|
+
assertBoundedTaskJson(value);
|
|
68
|
+
const validate = validator(schema);
|
|
69
|
+
const valid = validate(value);
|
|
70
|
+
return {
|
|
71
|
+
valid,
|
|
72
|
+
issues: valid ? [] : (validate.errors ?? []).slice(0, 20).map((error) => ({
|
|
73
|
+
path: error.instancePath,
|
|
74
|
+
code: error.keyword,
|
|
75
|
+
message: error.message ?? "Value does not match the task schema.",
|
|
76
|
+
})),
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
return { valid: false, issues: [{ path: "", code: "task_validation_unavailable", message: error instanceof Error ? error.message : "Task validation failed." }] };
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function validator(schema) {
|
|
84
|
+
assertBoundedTaskJson(schema, TASK_SCHEMA_MAX_BYTES);
|
|
85
|
+
inspectSchema(schema, schema, new Set(), 0, { remaining: 2_048 });
|
|
86
|
+
const hash = contentHash(schema);
|
|
87
|
+
const cached = validators.get(hash);
|
|
88
|
+
if (cached)
|
|
89
|
+
return cached;
|
|
90
|
+
const ajv = new Ajv2020({ allErrors: false, ownProperties: true, strict: true, strictTypes: false, strictTuples: false, strictRequired: false, validateFormats: false, inlineRefs: false, loopRequired: 32, loopEnum: 32 });
|
|
91
|
+
const compiled = ajv.compile(schema);
|
|
92
|
+
if (validators.size >= 64)
|
|
93
|
+
validators.delete(validators.keys().next().value);
|
|
94
|
+
validators.set(hash, compiled);
|
|
95
|
+
return compiled;
|
|
96
|
+
}
|
|
97
|
+
function inspectSchema(value, root, ancestors, depth, budget) {
|
|
98
|
+
if (--budget.remaining < 0)
|
|
99
|
+
throw new Error("Task schema reference expansion exceeds the validation budget.");
|
|
100
|
+
if (typeof value === "boolean")
|
|
101
|
+
return;
|
|
102
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
103
|
+
throw new Error("A task schema must be an object or boolean.");
|
|
104
|
+
if (depth > 24 || ancestors.has(value))
|
|
105
|
+
throw new Error("Recursive or deeply nested task schemas are not supported.");
|
|
106
|
+
const next = new Set(ancestors).add(value);
|
|
107
|
+
const schema = value;
|
|
108
|
+
if (schema.$schema !== undefined && schema.$schema !== TASK_JSON_SCHEMA_DIALECT)
|
|
109
|
+
throw new Error(`Task schemas must use ${TASK_JSON_SCHEMA_DIALECT}.`);
|
|
110
|
+
for (const [key, child] of Object.entries(schema)) {
|
|
111
|
+
if (unsupported.has(key))
|
|
112
|
+
throw new Error(`Task schema keyword ${key} is not supported by the bounded validator.`);
|
|
113
|
+
if (key === "$ref") {
|
|
114
|
+
if (typeof child !== "string" || !child.startsWith("#/$defs/"))
|
|
115
|
+
throw new Error("Task schema references must be local JSON pointers into $defs.");
|
|
116
|
+
let target = root;
|
|
117
|
+
for (const segment of child.slice(2).split("/")) {
|
|
118
|
+
if (/~(?![01])/u.test(segment))
|
|
119
|
+
throw new Error("Invalid task schema JSON pointer.");
|
|
120
|
+
const decoded = segment.replaceAll("~1", "/").replaceAll("~0", "~");
|
|
121
|
+
if (!target || typeof target !== "object" || !Object.hasOwn(target, decoded))
|
|
122
|
+
throw new Error(`Task schema reference ${child} is missing.`);
|
|
123
|
+
target = target[decoded];
|
|
124
|
+
}
|
|
125
|
+
inspectSchema(target, root, next, depth + 1, budget);
|
|
126
|
+
}
|
|
127
|
+
else if (schemaMaps.has(key)) {
|
|
128
|
+
if (!child || typeof child !== "object" || Array.isArray(child))
|
|
129
|
+
throw new Error(`Invalid schema map ${key}.`);
|
|
130
|
+
for (const entry of Object.values(child))
|
|
131
|
+
inspectSchema(entry, root, next, depth + 1, budget);
|
|
132
|
+
}
|
|
133
|
+
else if (schemaArrays.has(key)) {
|
|
134
|
+
if (!Array.isArray(child) || child.length > 32)
|
|
135
|
+
throw new Error(`Schema ${key} must contain at most 32 alternatives.`);
|
|
136
|
+
for (const entry of child)
|
|
137
|
+
inspectSchema(entry, root, next, depth + 1, budget);
|
|
138
|
+
}
|
|
139
|
+
else if (schemaChildren.has(key))
|
|
140
|
+
inspectSchema(child, root, next, depth + 1, budget);
|
|
141
|
+
}
|
|
142
|
+
}
|
package/dist/tasksets.js
CHANGED
|
@@ -40,10 +40,13 @@ export const ModelJudgeGraderSpecSchema = GraderBaseSchema.extend({
|
|
|
40
40
|
kind: z.literal("model_judge"),
|
|
41
41
|
rubricRef: ImmutableAssetRefSchema,
|
|
42
42
|
calibrationStatus: z.enum(["pending", "passed", "failed"]),
|
|
43
|
+
model: z.object({ providerId: ReleaseIdSchema, modelId: ReleaseIdSchema, revision: z.string().trim().min(1).max(500).nullable() }).strict().optional(),
|
|
44
|
+
temperature: z.number().min(0).max(2).optional(),
|
|
43
45
|
}).strict();
|
|
44
46
|
export const CustomVerifierGraderSpecSchema = GraderBaseSchema.extend({
|
|
45
47
|
kind: z.literal("custom_verifier"),
|
|
46
48
|
verifierRef: ImmutableAssetRefSchema,
|
|
49
|
+
exportName: z.string().trim().min(1).max(240).optional(),
|
|
47
50
|
timeoutMs: z.number().int().positive().max(300_000),
|
|
48
51
|
networkPolicy: z.literal("none"),
|
|
49
52
|
}).strict();
|
|
@@ -9,7 +9,7 @@ export const CORE_METRIC_CATALOG = [
|
|
|
9
9
|
definition({ id: "attempt.failure_count", displayName: "Attempt failures", description: "Count of failed Attempts.", valueType: "counter", unit: "count", direction: "lower", aggregation: "sum", visibility: "team_visible", boundedDimensions: ["split", "failureOwner", "failureClass"] }),
|
|
10
10
|
definition({ id: "optimizer.loss", displayName: "Optimizer loss", description: "Policy optimizer loss after the step.", valueType: "gauge", unit: "scalar", direction: "neutral", aggregation: "mean", visibility: "team_visible", boundedDimensions: ["split"] }),
|
|
11
11
|
definition({ id: "optimizer.learning_rate", displayName: "Learning rate", description: "Optimizer learning rate after the step.", valueType: "gauge", unit: "scalar", direction: "neutral", aggregation: "last", visibility: "team_visible", boundedDimensions: ["split"] }),
|
|
12
|
-
definition({ id: "optimizer.kl", displayName: "KL
|
|
12
|
+
definition({ id: "optimizer.kl", displayName: "Policy update KL", description: "Sampled approximate KL between the frozen pre-update policy and the policy after the optimizer step.", valueType: "gauge", unit: "scalar", direction: "lower", aggregation: "mean", visibility: "team_visible", boundedDimensions: ["split"] }),
|
|
13
13
|
definition({ id: "optimizer.entropy", displayName: "Policy entropy", description: "Observed policy entropy for trainable tokens.", valueType: "gauge", unit: "scalar", direction: "neutral", aggregation: "mean", visibility: "team_visible", boundedDimensions: ["split"] }),
|
|
14
14
|
definition({ id: "optimizer.gradient_norm", displayName: "Gradient norm", description: "Gradient norm reported by the optimizer.", valueType: "gauge", unit: "scalar", direction: "neutral", aggregation: "max", visibility: "team_visible", boundedDimensions: ["split"] }),
|
|
15
15
|
definition({ id: "optimizer.clip_fraction", displayName: "Clip fraction", description: "Fraction of policy updates affected by clipping.", valueType: "gauge", unit: "ratio", direction: "neutral", aggregation: "mean", visibility: "team_visible", boundedDimensions: ["split"] }),
|
|
@@ -90,6 +90,12 @@ export declare const harnessRefinerBenchmarkRelease: {
|
|
|
90
90
|
visibility: "policy" | "verifier" | "host_private";
|
|
91
91
|
};
|
|
92
92
|
calibrationStatus: "pending" | "passed" | "failed";
|
|
93
|
+
model?: {
|
|
94
|
+
providerId: string;
|
|
95
|
+
modelId: string;
|
|
96
|
+
revision: string | null;
|
|
97
|
+
} | undefined;
|
|
98
|
+
temperature?: number | undefined;
|
|
93
99
|
} | {
|
|
94
100
|
id: string;
|
|
95
101
|
version: string;
|
|
@@ -108,6 +114,7 @@ export declare const harnessRefinerBenchmarkRelease: {
|
|
|
108
114
|
};
|
|
109
115
|
timeoutMs: number;
|
|
110
116
|
networkPolicy: "none";
|
|
117
|
+
exportName?: string | undefined;
|
|
111
118
|
} | {
|
|
112
119
|
id: string;
|
|
113
120
|
version: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"harness-refiner.d.ts","sourceRoot":"","sources":["../../../../../src/builtin-benchmarks/harness-refiner.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,8BAA8B
|
|
1
|
+
{"version":3,"file":"harness-refiner.d.ts","sourceRoot":"","sources":["../../../../../src/builtin-benchmarks/harness-refiner.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqqD1C,CAAC;AAEF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CASzE,CAAC"}
|
|
@@ -200,6 +200,12 @@ export declare const genericToolConformance: {
|
|
|
200
200
|
visibility: "policy" | "verifier" | "host_private";
|
|
201
201
|
};
|
|
202
202
|
calibrationStatus: "pending" | "passed" | "failed";
|
|
203
|
+
model?: {
|
|
204
|
+
providerId: string;
|
|
205
|
+
modelId: string;
|
|
206
|
+
revision: string | null;
|
|
207
|
+
} | undefined;
|
|
208
|
+
temperature?: number | undefined;
|
|
203
209
|
} | {
|
|
204
210
|
id: string;
|
|
205
211
|
version: string;
|
|
@@ -218,6 +224,7 @@ export declare const genericToolConformance: {
|
|
|
218
224
|
};
|
|
219
225
|
timeoutMs: number;
|
|
220
226
|
networkPolicy: "none";
|
|
227
|
+
exportName?: string | undefined;
|
|
221
228
|
} | {
|
|
222
229
|
id: string;
|
|
223
230
|
version: string;
|
|
@@ -489,6 +496,12 @@ export declare const marketingPortfolioConformance: {
|
|
|
489
496
|
visibility: "policy" | "verifier" | "host_private";
|
|
490
497
|
};
|
|
491
498
|
calibrationStatus: "pending" | "passed" | "failed";
|
|
499
|
+
model?: {
|
|
500
|
+
providerId: string;
|
|
501
|
+
modelId: string;
|
|
502
|
+
revision: string | null;
|
|
503
|
+
} | undefined;
|
|
504
|
+
temperature?: number | undefined;
|
|
492
505
|
} | {
|
|
493
506
|
id: string;
|
|
494
507
|
version: string;
|
|
@@ -507,6 +520,7 @@ export declare const marketingPortfolioConformance: {
|
|
|
507
520
|
};
|
|
508
521
|
timeoutMs: number;
|
|
509
522
|
networkPolicy: "none";
|
|
523
|
+
exportName?: string | undefined;
|
|
510
524
|
} | {
|
|
511
525
|
id: string;
|
|
512
526
|
version: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conformance.d.ts","sourceRoot":"","sources":["../../../../src/conformance.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,sBAAsB
|
|
1
|
+
{"version":3,"file":"conformance.d.ts","sourceRoot":"","sources":["../../../../src/conformance.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEjC,CAAC;AAEH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGxC,CAAC"}
|
|
@@ -385,6 +385,12 @@ export declare const VerifierSetReleaseContentSchema: z.ZodObject<{
|
|
|
385
385
|
passed: "passed";
|
|
386
386
|
failed: "failed";
|
|
387
387
|
}>;
|
|
388
|
+
model: z.ZodOptional<z.ZodObject<{
|
|
389
|
+
providerId: z.ZodString;
|
|
390
|
+
modelId: z.ZodString;
|
|
391
|
+
revision: z.ZodNullable<z.ZodString>;
|
|
392
|
+
}, z.core.$strict>>;
|
|
393
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
388
394
|
}, z.core.$strict>, z.ZodObject<{
|
|
389
395
|
id: z.ZodString;
|
|
390
396
|
version: z.ZodString;
|
|
@@ -405,6 +411,7 @@ export declare const VerifierSetReleaseContentSchema: z.ZodObject<{
|
|
|
405
411
|
host_private: "host_private";
|
|
406
412
|
}>;
|
|
407
413
|
}, z.core.$strict>;
|
|
414
|
+
exportName: z.ZodOptional<z.ZodString>;
|
|
408
415
|
timeoutMs: z.ZodNumber;
|
|
409
416
|
networkPolicy: z.ZodLiteral<"none">;
|
|
410
417
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -488,6 +495,12 @@ export declare const VerifierSetReleaseSchema: z.ZodObject<{
|
|
|
488
495
|
passed: "passed";
|
|
489
496
|
failed: "failed";
|
|
490
497
|
}>;
|
|
498
|
+
model: z.ZodOptional<z.ZodObject<{
|
|
499
|
+
providerId: z.ZodString;
|
|
500
|
+
modelId: z.ZodString;
|
|
501
|
+
revision: z.ZodNullable<z.ZodString>;
|
|
502
|
+
}, z.core.$strict>>;
|
|
503
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
491
504
|
}, z.core.$strict>, z.ZodObject<{
|
|
492
505
|
id: z.ZodString;
|
|
493
506
|
version: z.ZodString;
|
|
@@ -508,6 +521,7 @@ export declare const VerifierSetReleaseSchema: z.ZodObject<{
|
|
|
508
521
|
host_private: "host_private";
|
|
509
522
|
}>;
|
|
510
523
|
}, z.core.$strict>;
|
|
524
|
+
exportName: z.ZodOptional<z.ZodString>;
|
|
511
525
|
timeoutMs: z.ZodNumber;
|
|
512
526
|
networkPolicy: z.ZodLiteral<"none">;
|
|
513
527
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution-contracts.d.ts","sourceRoot":"","sources":["../../../../src/execution-contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,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;;;;;;;;;;;;;;;;;;;;;;kBAGK,CAAC;AAEtC,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAC5E,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAChF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAClF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graders.d.ts","sourceRoot":"","sources":["../../../../src/graders.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAA2B,UAAU,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"graders.d.ts","sourceRoot":"","sources":["../../../../src/graders.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAA2B,UAAU,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGrF,eAAO,MAAM,2BAA2B;;;;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M,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -17,4 +17,7 @@ export * from "./telemetry-catalog.js";
|
|
|
17
17
|
export * from "./telemetry-analysis.js";
|
|
18
18
|
export * from "./telemetry-bundle.js";
|
|
19
19
|
export * from "./tasksets.js";
|
|
20
|
+
export * from "./task-schema.js";
|
|
21
|
+
export * from "./rewards.js";
|
|
22
|
+
export * from "./learning/index.js";
|
|
20
23
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,WAAW,CAAC;AAC1B,cAAc,sCAAsC,CAAC;AACrD,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,WAAW,CAAC;AAC1B,cAAc,sCAAsC,CAAC;AACrD,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const JavaScriptVerifierResultSchema: z.ZodObject<{
|
|
3
|
+
score: z.ZodNumber;
|
|
4
|
+
passed: z.ZodBoolean;
|
|
5
|
+
feedback: z.ZodString;
|
|
6
|
+
evidenceRefs: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
7
|
+
}, z.core.$strict>;
|
|
8
|
+
export type JavaScriptVerifierResult = z.infer<typeof JavaScriptVerifierResultSchema>;
|
|
9
|
+
//# sourceMappingURL=javascript-verifier-contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"javascript-verifier-contract.d.ts","sourceRoot":"","sources":["../../../../src/javascript-verifier-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,8BAA8B;;;;;kBAKhC,CAAC;AACZ,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { executeJavaScriptVerifier } from "./javascript-verifier.js";
|
|
2
|
+
import { type JavaScriptVerifierResult } from "./javascript-verifier-contract.js";
|
|
3
|
+
/** Resolves/rejects only after the execution owner has stopped the worker. */
|
|
4
|
+
export declare function executeJavaScriptVerifierInWorker(input: Parameters<typeof executeJavaScriptVerifier>[0]): Promise<JavaScriptVerifierResult>;
|
|
5
|
+
//# sourceMappingURL=javascript-verifier-node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"javascript-verifier-node.d.ts","sourceRoot":"","sources":["../../../../src/javascript-verifier-node.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAAkC,KAAK,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAIlH,8EAA8E;AAC9E,wBAAsB,iCAAiC,CAAC,KAAK,EAAE,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAqCjJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"javascript-verifier-worker.d.ts","sourceRoot":"","sources":["../../../../src/javascript-verifier-worker.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type JavaScriptVerifierResult } from "./javascript-verifier-contract.js";
|
|
2
|
+
export { JavaScriptVerifierResultSchema, type JavaScriptVerifierResult } from "./javascript-verifier-contract.js";
|
|
3
|
+
/**
|
|
4
|
+
* A fresh WebAssembly interpreter with no host functions, filesystem, network,
|
|
5
|
+
* timers, or module loader. Hosts should run this on a worker to remain responsive
|
|
6
|
+
* and terminate that worker when cancellation is requested.
|
|
7
|
+
*/
|
|
8
|
+
export declare function executeJavaScriptVerifier(input: {
|
|
9
|
+
source: string;
|
|
10
|
+
exportName?: string;
|
|
11
|
+
value: unknown;
|
|
12
|
+
timeoutMs: number;
|
|
13
|
+
signal?: AbortSignal;
|
|
14
|
+
}): Promise<JavaScriptVerifierResult>;
|
|
15
|
+
//# sourceMappingURL=javascript-verifier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"javascript-verifier.d.ts","sourceRoot":"","sources":["../../../../src/javascript-verifier.ts"],"names":[],"mappings":"AAGA,OAAO,EAAkC,KAAK,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAClH,OAAO,EAAE,8BAA8B,EAAE,KAAK,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAElH;;;;GAIG;AACH,wBAAsB,yBAAyB,CAAC,KAAK,EAAE;IACrD,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAgCpC"}
|