openpond-sdk 0.9.9 → 0.11.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/README.md +18 -17
- package/dist/advanced-refiner-evaluations.js +42 -0
- package/dist/advanced-refiner-evaluations.js.map +7 -0
- package/dist/candidate-evaluations.js +25 -0
- package/dist/candidate-evaluations.js.map +7 -0
- package/dist/{chunk-BGXWHDYM.js → chunk-2JKV5OJO.js} +95 -59
- package/dist/chunk-2JKV5OJO.js.map +7 -0
- package/dist/{chunk-4HZORGK3.js → chunk-2NSNBED7.js} +18 -5
- package/dist/chunk-2NSNBED7.js.map +7 -0
- package/dist/chunk-5RZAPZWI.js +445 -0
- package/dist/chunk-5RZAPZWI.js.map +7 -0
- package/dist/{chunk-JCPLAIZL.js → chunk-5U25KAJM.js} +106 -76
- package/dist/chunk-5U25KAJM.js.map +7 -0
- package/dist/chunk-7Q7I6FAT.js +139 -0
- package/dist/chunk-7Q7I6FAT.js.map +7 -0
- package/dist/chunk-A64VYVXN.js +64 -0
- package/dist/chunk-A64VYVXN.js.map +7 -0
- package/dist/{chunk-DT7FRNIZ.js → chunk-CSWVE3E6.js} +2 -2
- package/dist/chunk-DJWHN7NU.js +394 -0
- package/dist/chunk-DJWHN7NU.js.map +7 -0
- package/dist/{chunk-KYCQ7LZ4.js → chunk-DSGGM2ME.js} +2 -2
- package/dist/chunk-DSGGM2ME.js.map +7 -0
- package/dist/chunk-GDJRGRHA.js +144 -0
- package/dist/chunk-GDJRGRHA.js.map +7 -0
- package/dist/chunk-HOAYWW33.js +587 -0
- package/dist/chunk-HOAYWW33.js.map +7 -0
- package/dist/{chunk-Y4NGWGTA.js → chunk-I2MBVOVX.js} +265 -264
- package/dist/chunk-I2MBVOVX.js.map +7 -0
- package/dist/{chunk-6D4JIOOC.js → chunk-IXBSFJCX.js} +5 -5
- package/dist/{chunk-WOPM32SE.js → chunk-JA3KFK3U.js} +7 -1
- package/dist/chunk-JA3KFK3U.js.map +7 -0
- package/dist/chunk-JMQ4HBWP.js +160 -0
- package/dist/chunk-JMQ4HBWP.js.map +7 -0
- package/dist/chunk-KQWCXW3A.js +294 -0
- package/dist/chunk-KQWCXW3A.js.map +7 -0
- package/dist/{chunk-3HV3G6DG.js → chunk-NHCGOFQW.js} +3 -3
- package/dist/{chunk-XMKEFQ62.js → chunk-PJ2VLNJF.js} +20 -2
- package/dist/chunk-PJ2VLNJF.js.map +7 -0
- package/dist/{chunk-32H2EJRA.js → chunk-R3M6BIOK.js} +2 -2
- package/dist/chunk-SLS3GFPG.js +125 -0
- package/dist/chunk-SLS3GFPG.js.map +7 -0
- package/dist/chunk-SVU4RZ4K.js +70 -0
- package/dist/chunk-SVU4RZ4K.js.map +7 -0
- package/dist/chunk-T4APHDES.js +74 -0
- package/dist/chunk-T4APHDES.js.map +7 -0
- package/dist/chunk-VC5OV5AS.js +174 -0
- package/dist/chunk-VC5OV5AS.js.map +7 -0
- package/dist/{chunk-YYJ4T4U4.js → chunk-WX22WN33.js} +13 -7
- package/dist/chunk-WX22WN33.js.map +7 -0
- package/dist/chunk-XEUOJ5WF.js +31 -0
- package/dist/chunk-XEUOJ5WF.js.map +7 -0
- package/dist/{chunk-LGEF4S5I.js → chunk-XJDWHTH5.js} +390 -362
- package/dist/chunk-XJDWHTH5.js.map +7 -0
- package/dist/chunk-YCQVVFE5.js +37 -0
- package/dist/chunk-YCQVVFE5.js.map +7 -0
- package/dist/chunk-ZVJU5CJ5.js +267 -0
- package/dist/chunk-ZVJU5CJ5.js.map +7 -0
- package/dist/connected-evidence.js +81 -0
- package/dist/connected-evidence.js.map +7 -0
- package/dist/dataset-workspaces.js +45 -80
- package/dist/dataset-workspaces.js.map +4 -4
- package/dist/experiment-evaluation-schedules.js +48 -0
- package/dist/experiment-evaluation-schedules.js.map +7 -0
- package/dist/experiment-improvements.js +52 -0
- package/dist/experiment-improvements.js.map +7 -0
- package/dist/experiments.js +63 -124
- package/dist/experiments.js.map +4 -4
- package/dist/human-review.js +13 -0
- package/dist/human-review.js.map +7 -0
- package/dist/index.js +208 -17
- package/dist/index.js.map +2 -2
- package/dist/learning.js +1 -1
- package/dist/model-starter-attempts.js +2 -2
- package/dist/model-starter-catalog.js +9 -4
- package/dist/model-starter-catalog.js.map +1 -1
- package/dist/model-starters.js +15 -6
- package/dist/model-taskset-runs.js +3 -3
- package/dist/post-training.js +47 -0
- package/dist/post-training.js.map +7 -0
- package/dist/taskset-drafts.js +13 -6
- package/dist/taskset-drafts.js.map +2 -2
- package/dist/taskset-packages.js +31 -559
- package/dist/taskset-packages.js.map +4 -4
- package/dist/training-bundle.js +59 -18
- package/dist/training-bundle.js.map +2 -2
- package/dist/training-projects.js +3 -1
- package/dist/training-projects.js.map +2 -2
- package/dist/training.js +7 -2
- package/dist/types/packages/sdk/src/advanced-refiner-evaluations.d.ts +2673 -0
- package/dist/types/packages/sdk/src/advanced-refiner-evaluations.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/candidate-evaluation-client.d.ts +1079 -0
- package/dist/types/packages/sdk/src/candidate-evaluation-client.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/candidate-evaluations.d.ts +845 -0
- package/dist/types/packages/sdk/src/candidate-evaluations.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/claude-code-runtime.d.ts +51 -0
- package/dist/types/packages/sdk/src/claude-code-runtime.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/connected-dataset-publication.d.ts +15 -0
- package/dist/types/packages/sdk/src/connected-dataset-publication.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/connected-dataset-source.d.ts +48 -0
- package/dist/types/packages/sdk/src/connected-dataset-source.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/connected-evidence-client.d.ts +2460 -0
- package/dist/types/packages/sdk/src/connected-evidence-client.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/connected-evidence-contracts.d.ts +215 -0
- package/dist/types/packages/sdk/src/connected-evidence-contracts.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/connected-evidence-http.d.ts +6 -0
- package/dist/types/packages/sdk/src/connected-evidence-http.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/connected-evidence.d.ts +6 -0
- package/dist/types/packages/sdk/src/connected-evidence.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/connected-recorded-execution.d.ts +690 -0
- package/dist/types/packages/sdk/src/connected-recorded-execution.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/dataset-population.d.ts +1 -0
- package/dist/types/packages/sdk/src/dataset-population.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/dataset-workspace-client.d.ts +771 -120
- package/dist/types/packages/sdk/src/dataset-workspace-client.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/dataset-workspace-contracts.d.ts +278 -38
- package/dist/types/packages/sdk/src/dataset-workspace-contracts.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/dataset-workspace-operations.d.ts +280 -40
- package/dist/types/packages/sdk/src/dataset-workspace-operations.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/evaluation-coordination-http.d.ts +17 -0
- package/dist/types/packages/sdk/src/evaluation-coordination-http.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/experiment-client.d.ts +4353 -490
- package/dist/types/packages/sdk/src/experiment-client.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/experiment-contracts.d.ts +1067 -2
- package/dist/types/packages/sdk/src/experiment-contracts.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/experiment-evaluation-schedules.d.ts +2780 -0
- package/dist/types/packages/sdk/src/experiment-evaluation-schedules.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/experiment-execution-selection.d.ts +58 -0
- package/dist/types/packages/sdk/src/experiment-execution-selection.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/experiment-grading-contracts.d.ts +8 -0
- package/dist/types/packages/sdk/src/experiment-grading-contracts.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/experiment-harness-catalog.d.ts +24 -0
- package/dist/types/packages/sdk/src/experiment-harness-catalog.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/experiment-improvement-client.d.ts +5724 -0
- package/dist/types/packages/sdk/src/experiment-improvement-client.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/experiment-improvement-contracts.d.ts +13024 -0
- package/dist/types/packages/sdk/src/experiment-improvement-contracts.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/experiment-improvement-hosted-adoption.d.ts +1361 -0
- package/dist/types/packages/sdk/src/experiment-improvement-hosted-adoption.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/experiment-improvements.d.ts +4 -0
- package/dist/types/packages/sdk/src/experiment-improvements.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/experiment-run-contracts.d.ts +383 -0
- package/dist/types/packages/sdk/src/experiment-run-contracts.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/experiment-run-details.d.ts +2111 -0
- package/dist/types/packages/sdk/src/experiment-run-details.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/experiment-scoring-contracts.d.ts +7 -2
- package/dist/types/packages/sdk/src/experiment-scoring-contracts.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/experiments.d.ts +7 -1
- package/dist/types/packages/sdk/src/experiments.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/grader-inspection.d.ts +307 -5
- package/dist/types/packages/sdk/src/grader-inspection.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/harness-experiment-policy.d.ts +238 -0
- package/dist/types/packages/sdk/src/harness-experiment-policy.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/human-review-client.d.ts +1267 -0
- package/dist/types/packages/sdk/src/human-review-client.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/human-review.d.ts +3 -0
- package/dist/types/packages/sdk/src/human-review.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/index.d.ts +10 -0
- package/dist/types/packages/sdk/src/index.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/managed-training-preparation.d.ts +181 -0
- package/dist/types/packages/sdk/src/managed-training-preparation.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/model-batch-review-contracts.d.ts +20 -4
- package/dist/types/packages/sdk/src/model-batch-review-contracts.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/model-batch-review-preparation.d.ts +79 -5
- package/dist/types/packages/sdk/src/model-batch-review-preparation.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/model-batch-review.d.ts +15 -13
- package/dist/types/packages/sdk/src/model-batch-review.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/model-learning-policy.d.ts +359 -1
- package/dist/types/packages/sdk/src/model-learning-policy.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/model-starter-attempts.d.ts +444 -19
- package/dist/types/packages/sdk/src/model-starter-attempts.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/model-starter-catalog.d.ts +234 -12
- package/dist/types/packages/sdk/src/model-starter-catalog.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/model-starter-execution.d.ts +79 -1
- package/dist/types/packages/sdk/src/model-starter-execution.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/model-starters.d.ts +467 -13
- package/dist/types/packages/sdk/src/model-starters.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/model-taskset-derivation.d.ts +312 -4
- package/dist/types/packages/sdk/src/model-taskset-derivation.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/model-taskset-resources.d.ts +78 -1
- package/dist/types/packages/sdk/src/model-taskset-resources.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/model-taskset-runs-contracts.d.ts +1326 -4
- package/dist/types/packages/sdk/src/model-taskset-runs-contracts.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/model-taskset-runs.d.ts +1329 -5
- package/dist/types/packages/sdk/src/model-taskset-runs.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/post-training.d.ts +3518 -0
- package/dist/types/packages/sdk/src/post-training.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/profile-evaluation-discovery.d.ts +1127 -0
- package/dist/types/packages/sdk/src/profile-evaluation-discovery.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/profile-external-dataset-package.d.ts +1369 -0
- package/dist/types/packages/sdk/src/profile-external-dataset-package.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/taskset-authored-contracts.d.ts +142 -22
- package/dist/types/packages/sdk/src/taskset-authored-contracts.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/taskset-authored-files.d.ts +111 -18
- package/dist/types/packages/sdk/src/taskset-authored-files.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/taskset-draft-api-contracts.d.ts +278 -38
- package/dist/types/packages/sdk/src/taskset-draft-api-contracts.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/taskset-draft-client.d.ts +661 -103
- package/dist/types/packages/sdk/src/taskset-draft-client.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/taskset-draft-core.d.ts +217 -20
- package/dist/types/packages/sdk/src/taskset-draft-core.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/taskset-draft-dataset-artifacts.d.ts +12 -12
- package/dist/types/packages/sdk/src/taskset-draft-dataset-sources.d.ts +17 -17
- package/dist/types/packages/sdk/src/taskset-draft-document.d.ts +140 -20
- package/dist/types/packages/sdk/src/taskset-draft-document.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/taskset-draft-package-compiler.d.ts +638 -42
- package/dist/types/packages/sdk/src/taskset-draft-package-compiler.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/taskset-draft-source.d.ts +249 -36
- package/dist/types/packages/sdk/src/taskset-draft-source.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/taskset-draft-workspace.d.ts +278 -38
- package/dist/types/packages/sdk/src/taskset-draft-workspace.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/taskset-drafts.d.ts +1 -0
- package/dist/types/packages/sdk/src/taskset-drafts.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/taskset-package-client.d.ts +2805 -41
- package/dist/types/packages/sdk/src/taskset-package-client.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/taskset-package-contracts.d.ts +660 -12
- package/dist/types/packages/sdk/src/taskset-package-contracts.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/taskset-package-grader-projection.d.ts +77 -3
- package/dist/types/packages/sdk/src/taskset-package-grader-projection.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/taskset-package-learning.d.ts +29 -11
- package/dist/types/packages/sdk/src/taskset-package-learning.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/taskset-package-projection.d.ts +430 -39
- package/dist/types/packages/sdk/src/taskset-package-projection.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/training-acceptance.d.ts +10 -10
- package/dist/types/packages/sdk/src/training-candidate-decisions.d.ts +2 -2
- package/dist/types/packages/sdk/src/training-evaluation-results.d.ts +1 -1
- package/dist/types/packages/sdk/src/training-learning-batch.d.ts +376 -42
- package/dist/types/packages/sdk/src/training-learning-batch.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/training-preparations.d.ts +3930 -0
- package/dist/types/packages/sdk/src/training-preparations.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/training-project-client.d.ts +828 -8
- package/dist/types/packages/sdk/src/training-project-client.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/training-project-contracts.d.ts +1226 -11
- package/dist/types/packages/sdk/src/training-project-contracts.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/training.d.ts +2655 -24
- package/dist/types/packages/sdk/src/training.d.ts.map +1 -1
- package/package.json +30 -2
- package/dist/chunk-4HZORGK3.js.map +0 -7
- package/dist/chunk-4JRSH2TT.js +0 -256
- package/dist/chunk-4JRSH2TT.js.map +0 -7
- package/dist/chunk-BGXWHDYM.js.map +0 -7
- package/dist/chunk-JCPLAIZL.js.map +0 -7
- package/dist/chunk-KYCQ7LZ4.js.map +0 -7
- package/dist/chunk-LGEF4S5I.js.map +0 -7
- package/dist/chunk-WOPM32SE.js.map +0 -7
- package/dist/chunk-XMKEFQ62.js.map +0 -7
- package/dist/chunk-Y4NGWGTA.js.map +0 -7
- package/dist/chunk-YYJ4T4U4.js.map +0 -7
- package/dist/types/packages/sdk/src/experiment-history.d.ts +0 -266
- package/dist/types/packages/sdk/src/experiment-history.d.ts.map +0 -1
- /package/dist/{chunk-DT7FRNIZ.js.map → chunk-CSWVE3E6.js.map} +0 -0
- /package/dist/{chunk-6D4JIOOC.js.map → chunk-IXBSFJCX.js.map} +0 -0
- /package/dist/{chunk-3HV3G6DG.js.map → chunk-NHCGOFQW.js.map} +0 -0
- /package/dist/{chunk-32H2EJRA.js.map → chunk-R3M6BIOK.js.map} +0 -0
|
@@ -0,0 +1,587 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ModelBatchReviewInspectionSchema,
|
|
3
|
+
ModelBatchReviewReceiptSchema,
|
|
4
|
+
ModelBatchReviewRequestSchema
|
|
5
|
+
} from "./chunk-YVUIHH6Z.js";
|
|
6
|
+
import {
|
|
7
|
+
importedPackageGraders,
|
|
8
|
+
learningVerifierModule,
|
|
9
|
+
projectLearningBatchGraders
|
|
10
|
+
} from "./chunk-NHCGOFQW.js";
|
|
11
|
+
import {
|
|
12
|
+
AuthoredTasksetFileInventorySchema
|
|
13
|
+
} from "./chunk-IXBSFJCX.js";
|
|
14
|
+
import {
|
|
15
|
+
TasksetDraftSchema,
|
|
16
|
+
configuredTasksetDraftFiles,
|
|
17
|
+
createTasksetDraft,
|
|
18
|
+
createTasksetDraftWorkspace,
|
|
19
|
+
decodeTasksetDraftWorkspaceFile,
|
|
20
|
+
isManagedTasksetDraftFilePath
|
|
21
|
+
} from "./chunk-R3M6BIOK.js";
|
|
22
|
+
import {
|
|
23
|
+
GraderFixtureSchema,
|
|
24
|
+
TasksetEnvironmentResourceSchema,
|
|
25
|
+
TasksetSchema,
|
|
26
|
+
TasksetSourceRefSchema,
|
|
27
|
+
computeTasksetHash
|
|
28
|
+
} from "./chunk-XJDWHTH5.js";
|
|
29
|
+
import {
|
|
30
|
+
compileModelTasksetReward,
|
|
31
|
+
createTasksetPackage,
|
|
32
|
+
decodeTasksetPackageFile,
|
|
33
|
+
resolveTasksetPackageExecution,
|
|
34
|
+
resolveTasksetPackageInstructions,
|
|
35
|
+
validateTasksetPackage
|
|
36
|
+
} from "./chunk-JA3KFK3U.js";
|
|
37
|
+
import {
|
|
38
|
+
ModelTasksetDraftPreparationSchema,
|
|
39
|
+
TasksetDraftFilePathSchema
|
|
40
|
+
} from "./chunk-2U54EOXJ.js";
|
|
41
|
+
import {
|
|
42
|
+
contentHash,
|
|
43
|
+
sha256
|
|
44
|
+
} from "./chunk-QUOW6URQ.js";
|
|
45
|
+
|
|
46
|
+
// src/model-ordinary-taskset-reward.ts
|
|
47
|
+
import { LearningTextAssetSchema, TaskDefinitionSchema, learningRef, sealLearningContent } from "@openpond/evals/learning";
|
|
48
|
+
function bindOrdinaryModelTasksetReward(input) {
|
|
49
|
+
const source = validateTasksetPackage(input.source);
|
|
50
|
+
if (source.modelResources || source.learningResources) throw new Error("Binding an ordinary Reward requires an ordinary source package.");
|
|
51
|
+
const instructions = resolveTasksetPackageInstructions(source);
|
|
52
|
+
if (!instructions.trim()) throw new Error("Add collection instructions before selecting a saved Reward.");
|
|
53
|
+
const assets = /* @__PURE__ */ new Map();
|
|
54
|
+
const execution = resolveTasksetPackageExecution(source);
|
|
55
|
+
for (const asset of execution?.assets ?? []) assets.set(asset.id, asset);
|
|
56
|
+
const contextIds = /* @__PURE__ */ new Set([
|
|
57
|
+
...source.taskset.tasks.flatMap((task) => task.privilegedContextRef ? [task.privilegedContextRef] : []),
|
|
58
|
+
...[source.environment.actionSchemaRef, source.environment.observationSchemaRef, source.environment.stateSchemaRef].flatMap((ref) => ref ? [ref.id] : [])
|
|
59
|
+
]);
|
|
60
|
+
for (const id of contextIds) {
|
|
61
|
+
if (assets.has(id)) continue;
|
|
62
|
+
const file = source.files.find((file2) => file2.asset.id === id);
|
|
63
|
+
if (!file) throw new Error(`Source Taskset context is missing: ${id}.`);
|
|
64
|
+
const text = new TextDecoder("utf-8", { fatal: true }).decode(decodeTasksetPackageFile(file));
|
|
65
|
+
assets.set(id, LearningTextAssetSchema.parse(sealLearningContent({ schemaVersion: "openpond.learningTextAsset.v1", id, revision: 1, asset: file.asset, text })));
|
|
66
|
+
}
|
|
67
|
+
for (const asset of input.assets) {
|
|
68
|
+
const original = source.files.find((file) => file.asset.id === asset.id);
|
|
69
|
+
if (original && sealLearningContent({ asset: original.asset }).contentHash !== sealLearningContent({ asset: asset.asset }).contentHash) throw new Error(`Selected Reward conflicts with a source asset: ${asset.id}.`);
|
|
70
|
+
assets.set(asset.id, asset);
|
|
71
|
+
}
|
|
72
|
+
const { policy, environment, environmentRelease, tools, capabilities, verifierSetRelease } = source.taskset;
|
|
73
|
+
const taskDefinition = TaskDefinitionSchema.parse(sealLearningContent({
|
|
74
|
+
schemaVersion: "openpond.taskDefinition.v1",
|
|
75
|
+
id: `${source.taskset.id}-definition`,
|
|
76
|
+
revision: 1,
|
|
77
|
+
name: source.taskset.id,
|
|
78
|
+
description: "",
|
|
79
|
+
instructions,
|
|
80
|
+
category: "custom",
|
|
81
|
+
familyNamespace: source.taskset.id,
|
|
82
|
+
inputSchema: { type: "object" },
|
|
83
|
+
outputSchema: { type: "object" },
|
|
84
|
+
rewardBinding: learningRef(input.rewardBinding),
|
|
85
|
+
harness: null,
|
|
86
|
+
execution: { policy, environment, environmentRelease, tools, capabilities, verifierSetRelease }
|
|
87
|
+
}));
|
|
88
|
+
const derived = compileModelTasksetReward({ ...input, assets: [...assets.values()], source: {
|
|
89
|
+
taskset: source.taskset,
|
|
90
|
+
taskDefinition,
|
|
91
|
+
instructionMode: "per_task",
|
|
92
|
+
executionResources: { environment: source.environment, verifierSet: source.verifierSet },
|
|
93
|
+
...execution ? { execution: execution.execution } : {}
|
|
94
|
+
} });
|
|
95
|
+
const files = new Map(source.files.map((file) => [file.asset.id, file]));
|
|
96
|
+
for (const asset of derived.assets) {
|
|
97
|
+
let raw = "";
|
|
98
|
+
for (const byte of new TextEncoder().encode(asset.text)) raw += String.fromCharCode(byte);
|
|
99
|
+
files.set(asset.id, { asset: asset.asset, base64: btoa(raw) });
|
|
100
|
+
}
|
|
101
|
+
const { taskset, executionResources, ...modelResources } = derived;
|
|
102
|
+
return createTasksetPackage({ schemaVersion: "openpond.tasksetPackage.v1", taskset, ...executionResources, modelResources, files: [...files.values()] });
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// src/model-batch-review.ts
|
|
106
|
+
import {
|
|
107
|
+
LearningDomainError as LearningDomainError2,
|
|
108
|
+
learningRef as learningRef3,
|
|
109
|
+
sameLearningRef as sameLearningRef2,
|
|
110
|
+
requireLearningRelease,
|
|
111
|
+
requireLearningResource,
|
|
112
|
+
taskBatchPackageMetadata as taskBatchPackageMetadata2
|
|
113
|
+
} from "@openpond/evals/learning";
|
|
114
|
+
|
|
115
|
+
// src/model-batch-review-preparation.ts
|
|
116
|
+
import {
|
|
117
|
+
LearningDomainError,
|
|
118
|
+
LearningSourceSchema,
|
|
119
|
+
TaskDefinitionSchema as TaskDefinitionSchema2,
|
|
120
|
+
TaskEvidenceSchema,
|
|
121
|
+
TaskFeedbackSchema,
|
|
122
|
+
assertLearningContentHash,
|
|
123
|
+
learningEvidenceId,
|
|
124
|
+
learningRef as learningRef2,
|
|
125
|
+
sameLearningRef,
|
|
126
|
+
sealLearningContent as sealLearningContent2,
|
|
127
|
+
taskBatchPackageMetadata,
|
|
128
|
+
verifyLearningTextAsset
|
|
129
|
+
} from "@openpond/evals/learning";
|
|
130
|
+
import { compileBoundGraders, createRewardBinding, createRewardRelease, resolveBoundRewards } from "@openpond/evals/rewards";
|
|
131
|
+
function prepareModelBatchReview(input) {
|
|
132
|
+
const { request, package: value } = input;
|
|
133
|
+
const learning = value.learningResources;
|
|
134
|
+
if (!learning) throw new LearningDomainError("model_review_batch_required", 422);
|
|
135
|
+
const metadata = taskBatchPackageMetadata(value.taskset);
|
|
136
|
+
const id = `model-review-${contentHash([input.scope, request.modelId, request.operationId])}`;
|
|
137
|
+
const edits = new Map(request.examples.map((edit) => [contentHash(edit.evidence), edit]));
|
|
138
|
+
const parentRefs = new Set(learning.evidence.map((evidence2) => contentHash(learningRef2(evidence2))));
|
|
139
|
+
const decisions = new Map(learning.decisions.map((decision) => [contentHash(decision.evidence), decision]));
|
|
140
|
+
if (edits.size !== request.examples.length || request.examples.some((edit) => !parentRefs.has(contentHash(edit.evidence)))) {
|
|
141
|
+
throw new LearningDomainError("model_review_evidence_mismatch", 409);
|
|
142
|
+
}
|
|
143
|
+
for (const resource of [input.binding, ...input.rewards, ...input.assets]) assertLearningContentHash(resource);
|
|
144
|
+
resolveBoundRewards(input.binding, input.rewards);
|
|
145
|
+
const rewardByHash = /* @__PURE__ */ new Map();
|
|
146
|
+
for (const source2 of input.binding.sources) {
|
|
147
|
+
const original = input.rewards.find((reward) => sameLearningRef(learningRef2(reward), source2.reward));
|
|
148
|
+
const { contentHash: _hash, ...content } = original;
|
|
149
|
+
rewardByHash.set(original.contentHash, createRewardRelease({ ...content, id: `${id}-reward-${original.contentHash}`, revision: 1 }));
|
|
150
|
+
}
|
|
151
|
+
const rewards = [...rewardByHash.values()];
|
|
152
|
+
const { contentHash: _bindingHash, recipeRef: _recipe, ...bindingContent } = input.binding;
|
|
153
|
+
const binding = createRewardBinding({
|
|
154
|
+
...bindingContent,
|
|
155
|
+
id: `${id}-binding`,
|
|
156
|
+
revision: 1,
|
|
157
|
+
sources: input.binding.sources.map((source2) => ({ ...source2, reward: learningRef2(rewardByHash.get(source2.reward.contentHash)) }))
|
|
158
|
+
}, rewards);
|
|
159
|
+
const assetRefs = rewards.flatMap((reward) => [
|
|
160
|
+
...reward.assets,
|
|
161
|
+
..."verifierRef" in reward.implementation ? [reward.implementation.verifierRef] : [],
|
|
162
|
+
..."rubricRef" in reward.implementation ? [reward.implementation.rubricRef] : [],
|
|
163
|
+
..."inputContract" in reward.implementation ? [reward.implementation.inputContract] : []
|
|
164
|
+
]);
|
|
165
|
+
const assets = [...new Map(assetRefs.map((ref) => {
|
|
166
|
+
const asset = input.assets.find((asset2) => asset2.id === ref.id);
|
|
167
|
+
if (!asset) throw new LearningDomainError("model_review_reward_asset_missing", 422);
|
|
168
|
+
verifyLearningTextAsset(asset, ref);
|
|
169
|
+
if (ref.visibility === "policy") throw new LearningDomainError("reward_asset_visibility_invalid", 422);
|
|
170
|
+
return [asset.id, asset];
|
|
171
|
+
})).values()];
|
|
172
|
+
const { environmentRelease: _environment, verifierSetRelease: _verifiers, ...execution } = metadata.definition.execution;
|
|
173
|
+
const { contentHash: _definitionHash, ...definitionContent } = metadata.definition;
|
|
174
|
+
const definition = TaskDefinitionSchema2.parse(sealLearningContent2({
|
|
175
|
+
...definitionContent,
|
|
176
|
+
...request.definition,
|
|
177
|
+
id: `${id}-definition`,
|
|
178
|
+
revision: 1,
|
|
179
|
+
rewardBinding: learningRef2(binding),
|
|
180
|
+
execution: {
|
|
181
|
+
...execution,
|
|
182
|
+
policy: { ...execution.policy, hiddenGraderRefs: compileBoundGraders(binding, rewards).filter((grader) => grader.privileged).map((grader) => grader.id) }
|
|
183
|
+
}
|
|
184
|
+
}));
|
|
185
|
+
const source = LearningSourceSchema.parse(sealLearningContent2({
|
|
186
|
+
schemaVersion: "openpond.learningSource.v1",
|
|
187
|
+
id,
|
|
188
|
+
revision: 1,
|
|
189
|
+
name: `${definition.name} review`,
|
|
190
|
+
kind: "direct",
|
|
191
|
+
taskDefinition: learningRef2(definition),
|
|
192
|
+
enabled: true,
|
|
193
|
+
allowedSplits: [...new Set(learning.evidence.map((item) => item.submission.split))],
|
|
194
|
+
mapping: null,
|
|
195
|
+
adapterVersion: null,
|
|
196
|
+
reviewOrigin: {
|
|
197
|
+
modelId: request.modelId,
|
|
198
|
+
packageHash: value.contentHash,
|
|
199
|
+
taskset: learningRef2(value.taskset),
|
|
200
|
+
batch: learningRef2(learning.batch),
|
|
201
|
+
rewardBinding: learningRef2(input.binding)
|
|
202
|
+
}
|
|
203
|
+
}));
|
|
204
|
+
const evidence = learning.evidence.map((parent) => {
|
|
205
|
+
const edit = edits.get(contentHash(learningRef2(parent)));
|
|
206
|
+
const attemptId = `review-${parent.contentHash}`;
|
|
207
|
+
const policyChanged = contentHash({
|
|
208
|
+
instructions: definition.instructions,
|
|
209
|
+
inputSchema: definition.inputSchema,
|
|
210
|
+
outputSchema: definition.outputSchema,
|
|
211
|
+
requiredOutputs: definition.requiredOutputs ?? [],
|
|
212
|
+
input: edit?.input ?? parent.submission.input
|
|
213
|
+
}) !== contentHash({
|
|
214
|
+
instructions: metadata.definition.instructions,
|
|
215
|
+
inputSchema: metadata.definition.inputSchema,
|
|
216
|
+
outputSchema: metadata.definition.outputSchema,
|
|
217
|
+
requiredOutputs: metadata.definition.requiredOutputs ?? [],
|
|
218
|
+
input: parent.submission.input
|
|
219
|
+
});
|
|
220
|
+
return TaskEvidenceSchema.parse(sealLearningContent2({
|
|
221
|
+
schemaVersion: "openpond.taskEvidence.v1",
|
|
222
|
+
id: learningEvidenceId(source.id, parent.submission.exampleId, attemptId),
|
|
223
|
+
revision: 1,
|
|
224
|
+
source: learningRef2(source),
|
|
225
|
+
submission: {
|
|
226
|
+
...parent.submission,
|
|
227
|
+
sourceId: source.id,
|
|
228
|
+
taskDefinition: learningRef2(definition),
|
|
229
|
+
attemptId,
|
|
230
|
+
// The old response was observed under the old policy-visible task. Its
|
|
231
|
+
// parent snapshot remains available, but it is not a run of new inputs.
|
|
232
|
+
observedOutput: policyChanged ? null : parent.submission.observedOutput,
|
|
233
|
+
idempotencyKey: `${id}-${parent.contentHash}`,
|
|
234
|
+
...edit?.input === void 0 ? {} : { input: edit.input },
|
|
235
|
+
...edit?.expected === void 0 ? {} : { expected: edit.expected },
|
|
236
|
+
...edit?.evaluatorContext === void 0 ? {} : { evaluatorContext: edit.evaluatorContext }
|
|
237
|
+
},
|
|
238
|
+
supersedes: learningRef2(parent),
|
|
239
|
+
correctionFeedbackId: null,
|
|
240
|
+
receivedAt: input.now
|
|
241
|
+
}));
|
|
242
|
+
});
|
|
243
|
+
const proposals = evidence.flatMap((item) => {
|
|
244
|
+
const edit = edits.get(contentHash(item.supersedes));
|
|
245
|
+
const decision = decisions.get(contentHash(item.supersedes));
|
|
246
|
+
const target = edit?.proposedTarget === void 0 ? decision.approvedTarget : edit.proposedTarget;
|
|
247
|
+
return target === null ? [] : [TaskFeedbackSchema.parse({
|
|
248
|
+
schemaVersion: "openpond.taskFeedbackRecord.v1",
|
|
249
|
+
id: `feedback-${contentHash([id, item.id])}`,
|
|
250
|
+
revision: 1,
|
|
251
|
+
submission: {
|
|
252
|
+
schemaVersion: "openpond.taskFeedback.v1",
|
|
253
|
+
sourceId: source.id,
|
|
254
|
+
idempotencyKey: `${id}-${item.id}`,
|
|
255
|
+
exampleId: item.submission.exampleId,
|
|
256
|
+
attemptId: item.submission.attemptId,
|
|
257
|
+
expectedEvidenceHash: item.contentHash,
|
|
258
|
+
occurredAt: input.now,
|
|
259
|
+
kind: "target_correction",
|
|
260
|
+
value: target,
|
|
261
|
+
note: "Proposed target for the revised task. Grade and review before admission."
|
|
262
|
+
},
|
|
263
|
+
status: "pending_review",
|
|
264
|
+
evidence: learningRef2(item),
|
|
265
|
+
createdAt: input.now,
|
|
266
|
+
review: null
|
|
267
|
+
})];
|
|
268
|
+
});
|
|
269
|
+
return { source, definition, binding, rewards, assets, evidence, proposals };
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// src/model-batch-review.ts
|
|
273
|
+
import { LearningDomainError as LearningDomainError3 } from "@openpond/evals/learning";
|
|
274
|
+
var operation = (request) => `model-batch-review-${contentHash([request.modelId, request.operationId])}`;
|
|
275
|
+
function inspectModelBatchPackage(raw) {
|
|
276
|
+
const value = validateTasksetPackage(raw);
|
|
277
|
+
if (!value.learningResources) throw new LearningDomainError2("model_review_batch_required", 422);
|
|
278
|
+
const metadata = taskBatchPackageMetadata2(value.taskset);
|
|
279
|
+
return ModelBatchReviewInspectionSchema.parse({
|
|
280
|
+
schemaVersion: "openpond.modelBatchReviewInspection.v1",
|
|
281
|
+
packageHash: value.contentHash,
|
|
282
|
+
definition: metadata.definition,
|
|
283
|
+
binding: metadata.binding,
|
|
284
|
+
evidence: value.learningResources.evidence,
|
|
285
|
+
decisions: value.learningResources.decisions
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
async function findModelBatchReview(transaction, raw) {
|
|
289
|
+
const request = ModelBatchReviewRequestSchema.parse(raw);
|
|
290
|
+
const prior = await transaction.operation(operation(request));
|
|
291
|
+
if (!prior) return null;
|
|
292
|
+
if (prior.requestHash !== contentHash(request)) throw new LearningDomainError2("learning_idempotency_conflict", 409);
|
|
293
|
+
return readReceipt(transaction, request, prior.resources);
|
|
294
|
+
}
|
|
295
|
+
async function beginModelBatchReview(transaction, input) {
|
|
296
|
+
const request = ModelBatchReviewRequestSchema.parse(input.request);
|
|
297
|
+
const prior = await findModelBatchReview(transaction, request);
|
|
298
|
+
if (prior) return prior;
|
|
299
|
+
const value = validateTasksetPackage(input.package);
|
|
300
|
+
if (!value.learningResources) throw new LearningDomainError2("model_review_batch_required", 422);
|
|
301
|
+
const metadata = taskBatchPackageMetadata2(value.taskset);
|
|
302
|
+
const selected = request.rewardBindingRef;
|
|
303
|
+
const retained = !selected || sameLearningRef2(selected, learningRef3(metadata.binding));
|
|
304
|
+
const binding = retained ? metadata.binding : await requireLearningRelease(transaction, "binding", selected);
|
|
305
|
+
const rewards = retained ? metadata.rewards : await Promise.all(binding.sources.map((source) => requireLearningRelease(transaction, "reward", source.reward)));
|
|
306
|
+
const assetIds = new Set(rewards.flatMap((reward) => [
|
|
307
|
+
...reward.assets,
|
|
308
|
+
..."verifierRef" in reward.implementation ? [reward.implementation.verifierRef] : [],
|
|
309
|
+
..."rubricRef" in reward.implementation ? [reward.implementation.rubricRef] : [],
|
|
310
|
+
..."inputContract" in reward.implementation ? [reward.implementation.inputContract] : []
|
|
311
|
+
]).map((asset) => asset.id));
|
|
312
|
+
const assets = retained ? value.learningResources.assets : await Promise.all([...assetIds].map((id) => requireLearningResource(transaction, "asset", id, 1)));
|
|
313
|
+
const prepared = prepareModelBatchReview({ ...input, request, package: value, binding, rewards, assets });
|
|
314
|
+
const pointers = [];
|
|
315
|
+
for (const asset of prepared.assets) {
|
|
316
|
+
const existing = await transaction.get("asset", asset.id, 1);
|
|
317
|
+
if (existing && existing.contentHash !== asset.contentHash) throw new LearningDomainError2("model_review_asset_conflict", 409);
|
|
318
|
+
if (!existing) await transaction.put("asset", asset, 0);
|
|
319
|
+
}
|
|
320
|
+
for (const reward of prepared.rewards) await transaction.put("reward", reward, 0);
|
|
321
|
+
await transaction.put("binding", prepared.binding, 0);
|
|
322
|
+
await transaction.put("definition", prepared.definition, 0);
|
|
323
|
+
await transaction.put("source", prepared.source, 0, { parentId: request.modelId });
|
|
324
|
+
pointers.push({ kind: "source", id: prepared.source.id, revision: 1 });
|
|
325
|
+
for (const evidence of prepared.evidence) {
|
|
326
|
+
await transaction.put("evidence", evidence, 0, { parentId: prepared.source.id });
|
|
327
|
+
pointers.push({ kind: "evidence", id: evidence.id, revision: 1 });
|
|
328
|
+
}
|
|
329
|
+
for (const proposal of prepared.proposals) {
|
|
330
|
+
await transaction.put("feedback", proposal, 0, { parentId: proposal.evidence.id, status: proposal.status });
|
|
331
|
+
pointers.push({ kind: "feedback", id: proposal.id, revision: 1 });
|
|
332
|
+
}
|
|
333
|
+
await transaction.saveOperation(operation(request), { requestHash: contentHash(request), resources: pointers });
|
|
334
|
+
return readReceipt(transaction, request, pointers);
|
|
335
|
+
}
|
|
336
|
+
async function readReceipt(transaction, request, pointers) {
|
|
337
|
+
const resources = await Promise.all(pointers.map((pointer) => requireLearningResource(transaction, pointer.kind, pointer.id, pointer.revision)));
|
|
338
|
+
return ModelBatchReviewReceiptSchema.parse({
|
|
339
|
+
schemaVersion: "openpond.modelBatchReviewReceipt.v1",
|
|
340
|
+
operationId: request.operationId,
|
|
341
|
+
modelId: request.modelId,
|
|
342
|
+
source: resources.find((resource) => resource.schemaVersion === "openpond.learningSource.v1"),
|
|
343
|
+
evidence: resources.filter((resource) => resource.schemaVersion === "openpond.taskEvidence.v1"),
|
|
344
|
+
proposals: resources.filter((resource) => resource.schemaVersion === "openpond.taskFeedbackRecord.v1")
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
// src/taskset-package-projection.ts
|
|
349
|
+
import { learningRef as learningRef4, taskBatchPackageMetadata as taskBatchPackageMetadata3, verifyLearningTextAsset as verifyLearningTextAsset2 } from "@openpond/evals/learning";
|
|
350
|
+
function prepareImportedTasksetPackage(input) {
|
|
351
|
+
const value = validateTasksetPackage(input.package);
|
|
352
|
+
const release = value.taskset;
|
|
353
|
+
const resources = value.modelResources;
|
|
354
|
+
const learning = value.learningResources ? taskBatchPackageMetadata3(release) : void 0;
|
|
355
|
+
const source = TasksetSourceRefSchema.parse({
|
|
356
|
+
schemaVersion: "openpond.uploadedFileDatasetSource.v1",
|
|
357
|
+
kind: "uploaded_file",
|
|
358
|
+
id: `package-source-${contentHash({ profileId: input.profileId, packageHash: value.contentHash })}`,
|
|
359
|
+
profileId: input.profileId,
|
|
360
|
+
title: input.name,
|
|
361
|
+
sourceHash: value.contentHash,
|
|
362
|
+
occurredAt: input.createdAt,
|
|
363
|
+
licensingStatus: "pending",
|
|
364
|
+
secretScanStatus: "pending",
|
|
365
|
+
piiScanStatus: "pending",
|
|
366
|
+
originalFileNames: ["taskset-package.json"],
|
|
367
|
+
mediaTypes: ["application/json"],
|
|
368
|
+
sourceFileHashes: [value.contentHash],
|
|
369
|
+
totalBytes: new TextEncoder().encode(JSON.stringify(value)).byteLength,
|
|
370
|
+
parserVersion: "openpond.tasksetPackage.v1",
|
|
371
|
+
metadata: {}
|
|
372
|
+
});
|
|
373
|
+
const draft = createTasksetDraft({ profileId: input.profileId, id: `${release.id}-import`, name: input.name, now: input.createdAt });
|
|
374
|
+
const files = [];
|
|
375
|
+
for (const grader of release.graders) if (grader.kind === "custom_verifier") {
|
|
376
|
+
const asset = resources?.assets.find((asset2) => asset2.id === grader.verifierRef.id);
|
|
377
|
+
const file = value.files.find((file2) => file2.asset.id === grader.verifierRef.id);
|
|
378
|
+
if (!file) throw new Error(`Imported verifier source is missing: ${grader.id}.`);
|
|
379
|
+
const name = learningVerifierModule(grader.verifierRef.contentHash);
|
|
380
|
+
if (!files.some((file2) => file2.path === name)) files.push({ path: name, role: "verifier", content: asset ? verifyLearningTextAsset2(asset, grader.verifierRef) : new TextDecoder("utf-8", { fatal: true }).decode(decodeTasksetPackageFile(file)) });
|
|
381
|
+
}
|
|
382
|
+
const authoring = release.metadata.ordinaryAuthoring ?? release.metadata.starterAuthoring;
|
|
383
|
+
const fixtures = GraderFixtureSchema.array().max(1e5).parse(authoring?.graderFixtures ?? []);
|
|
384
|
+
const kind = release.environment.kind === "text" ? "chat" : release.environment.kind === "custom_program" ? "program" : release.environment.kind;
|
|
385
|
+
const projected = TasksetSchema.parse({
|
|
386
|
+
schemaVersion: "openpond.taskset.v1",
|
|
387
|
+
id: release.id,
|
|
388
|
+
revision: release.revision,
|
|
389
|
+
profileId: input.profileId,
|
|
390
|
+
profileRelease: null,
|
|
391
|
+
createImproveRunId: null,
|
|
392
|
+
name: input.name,
|
|
393
|
+
objective: resolveTasksetPackageInstructions(value),
|
|
394
|
+
status: "needs_review",
|
|
395
|
+
sourceRefs: [source],
|
|
396
|
+
datasetArtifact: null,
|
|
397
|
+
policy: release.policy,
|
|
398
|
+
environment: {
|
|
399
|
+
...draft.environment,
|
|
400
|
+
kind,
|
|
401
|
+
entrypoint: release.environment.entrypoint,
|
|
402
|
+
resources: TasksetEnvironmentResourceSchema.array().max(1e4).parse(release.metadata.environmentResources ?? []),
|
|
403
|
+
stateful: release.environment.stateful,
|
|
404
|
+
deterministicSeeds: release.environment.deterministicSeeds,
|
|
405
|
+
toolNames: release.tools.map((tool) => tool.name),
|
|
406
|
+
defaultTimeoutMs: release.environment.defaultTimeoutMs,
|
|
407
|
+
networkPolicy: release.environment.networkPolicy,
|
|
408
|
+
metadata: {
|
|
409
|
+
runtimeSourceTasksetId: tasksetPackageSourceId(input.profileId, value.contentHash),
|
|
410
|
+
portableEnvironment: release.environment,
|
|
411
|
+
portableTools: release.tools,
|
|
412
|
+
portableExecutionResources: { environment: value.environment, verifierSet: value.verifierSet }
|
|
413
|
+
}
|
|
414
|
+
},
|
|
415
|
+
capabilities: {
|
|
416
|
+
...draft.capabilities,
|
|
417
|
+
taskKind: kind === "chat" ? "chat" : kind === "program" ? "custom_program" : "single_agent",
|
|
418
|
+
compatibleMethods: ["none"],
|
|
419
|
+
requiresTools: release.tools.length > 0,
|
|
420
|
+
requiresState: release.environment.stateful,
|
|
421
|
+
rewardKinds: [...new Set(release.graders.map((grader) => grader.kind === "human" ? "human" : grader.kind === "model_judge" ? "model_judge" : "deterministic"))]
|
|
422
|
+
},
|
|
423
|
+
tasks: release.tasks.map((task) => ({
|
|
424
|
+
...task,
|
|
425
|
+
schemaVersion: "openpond.taskData.v1",
|
|
426
|
+
sourceRefs: [source.id],
|
|
427
|
+
assets: task.artifactRefs.map((asset) => ({
|
|
428
|
+
id: asset.id,
|
|
429
|
+
sourceRefId: source.id,
|
|
430
|
+
artifactRef: asset.path,
|
|
431
|
+
fileName: asset.path.split("/").at(-1),
|
|
432
|
+
mediaType: asset.mediaType,
|
|
433
|
+
sha256: asset.contentHash,
|
|
434
|
+
sizeBytes: asset.sizeBytes,
|
|
435
|
+
split: task.split,
|
|
436
|
+
metadata: { portableAsset: asset }
|
|
437
|
+
})),
|
|
438
|
+
...task.requiredOutputs ? { requiredOutputs: task.requiredOutputs.map((output) => ({
|
|
439
|
+
...output,
|
|
440
|
+
schemaRef: output.schemaRef?.id ?? null,
|
|
441
|
+
maxBytes: output.maxBytes ?? void 0
|
|
442
|
+
})) } : {},
|
|
443
|
+
metadata: { portableTaskRecord: task, exampleOrigin: "imported" }
|
|
444
|
+
})),
|
|
445
|
+
graders: resources ? projectLearningBatchGraders(resources.rewardBinding, resources.rewards, resources.assets) : learning ? projectLearningBatchGraders(learning.binding, learning.rewards, value.learningResources.assets) : importedPackageGraders(value),
|
|
446
|
+
graderFixtures: fixtures,
|
|
447
|
+
learningSignals: draft.learningSignals,
|
|
448
|
+
...release.metrics ? { metrics: release.metrics } : {},
|
|
449
|
+
authoringProvenance: {
|
|
450
|
+
schemaVersion: "openpond.taskAuthoringProvenance.v1",
|
|
451
|
+
model: null,
|
|
452
|
+
modelConfig: {},
|
|
453
|
+
skillHash: contentHash("openpond-package-import-v1"),
|
|
454
|
+
promptTemplateVersion: "package-import-v1",
|
|
455
|
+
buildIntent: "discovery",
|
|
456
|
+
buildSpecification: null,
|
|
457
|
+
evidenceHashes: [value.contentHash],
|
|
458
|
+
tasksetSdkVersion: "package-import-v1",
|
|
459
|
+
sourceCommit: null,
|
|
460
|
+
repairHistory: [],
|
|
461
|
+
createdAt: input.createdAt
|
|
462
|
+
},
|
|
463
|
+
readiness: null,
|
|
464
|
+
contentHash: "00000000",
|
|
465
|
+
createdAt: input.createdAt,
|
|
466
|
+
updatedAt: input.createdAt,
|
|
467
|
+
metadata: {
|
|
468
|
+
importedPackageHash: value.contentHash,
|
|
469
|
+
...learning ? { learning } : {},
|
|
470
|
+
portableFileInventory: value.files.map((file) => ({ asset: file.asset, sourcePath: file.asset.path })),
|
|
471
|
+
...resources ? {
|
|
472
|
+
taskDefinition: learningRef4(resources.taskDefinition),
|
|
473
|
+
rewardBinding: learningRef4(resources.rewardBinding),
|
|
474
|
+
rewardExecution: { binding: resources.rewardBinding, rewards: resources.rewards }
|
|
475
|
+
} : {},
|
|
476
|
+
portableCapabilities: release.capabilities,
|
|
477
|
+
derivedPortableMetadata: release.metadata,
|
|
478
|
+
...release.metadata.modelTasksetDerivation ? { modelTasksetDerivation: release.metadata.modelTasksetDerivation } : {}
|
|
479
|
+
}
|
|
480
|
+
});
|
|
481
|
+
return { package: value, taskset: TasksetSchema.parse({ ...projected, contentHash: computeTasksetHash(projected) }), generatedFiles: files };
|
|
482
|
+
}
|
|
483
|
+
function tasksetPackageSourceId(profileId, packageHash) {
|
|
484
|
+
return `package-${contentHash({ profileId, packageHash })}`;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
// src/taskset-draft-source.ts
|
|
488
|
+
import { z } from "zod";
|
|
489
|
+
import { learningRef as learningRef5, sameLearningRef as sameLearningRef3 } from "@openpond/evals/learning";
|
|
490
|
+
var TasksetDraftSourceInitializationSchema = z.object({
|
|
491
|
+
draft: TasksetDraftSchema,
|
|
492
|
+
filePaths: z.array(z.object({ assetId: z.string().min(1), paths: z.array(TasksetDraftFilePathSchema).min(1).max(1e4) }).strict()).max(1e4)
|
|
493
|
+
}).strict();
|
|
494
|
+
function prepareTasksetDraftSource(input) {
|
|
495
|
+
const source = validateTasksetPackage(input.source);
|
|
496
|
+
const original = TasksetDraftSchema.parse(input.sourceDraft);
|
|
497
|
+
const preparation = ModelTasksetDraftPreparationSchema.parse(input.preparation);
|
|
498
|
+
if (source.contentHash !== preparation.sourcePackageHash || !sameLearningRef3(learningRef5(source.taskset), preparation.sourceTasksetRef)) throw new Error("Taskset draft preparation differs from its source package.");
|
|
499
|
+
if (source.learningResources) throw new Error("Reviewed Tasksets require their reviewed authoring workflow.");
|
|
500
|
+
if (Boolean(source.modelResources) !== (preparation.authoringGraph === "bound")) throw new Error("Taskset draft authoring graph differs from its source.");
|
|
501
|
+
const inventory = AuthoredTasksetFileInventorySchema.parse(original.metadata.portableFileInventory ?? []);
|
|
502
|
+
const sourcePath = (relative) => isManagedTasksetDraftFilePath(relative) ? `source-artifacts/${source.contentHash}/${contentHash(relative)}/${relative.split("/").at(-1)}` : relative;
|
|
503
|
+
const references = [
|
|
504
|
+
...original.tasks.flatMap((task) => (task.assets ?? []).map((asset) => asset.artifactRef)),
|
|
505
|
+
...(original.environment.resources ?? []).map((resource) => resource.path),
|
|
506
|
+
...source.taskset.tasks.flatMap((task) => (task.requiredOutputs ?? []).flatMap((output) => output.schemaRef ? [output.schemaRef.path] : [])),
|
|
507
|
+
...original.metrics.customAggregator ? [original.metrics.customAggregator.module] : [],
|
|
508
|
+
...original.graders.flatMap((grader) => grader.kind === "custom_verifier" ? [grader.module] : [])
|
|
509
|
+
];
|
|
510
|
+
if (references.some(isManagedTasksetDraftFilePath)) throw new Error("A referenced source asset occupies a reserved Taskset authoring path.");
|
|
511
|
+
const filePaths = source.files.map((file) => {
|
|
512
|
+
const paths = /* @__PURE__ */ new Set([file.asset.path]);
|
|
513
|
+
for (const entry of inventory) if (entry.asset.id === file.asset.id) paths.add(entry.sourcePath);
|
|
514
|
+
for (const task of original.tasks) for (const asset of task.assets ?? []) if (asset.id === file.asset.id) paths.add(asset.artifactRef);
|
|
515
|
+
for (const grader of source.taskset.graders) if (grader.kind === "custom_verifier" && grader.verifierRef.id === file.asset.id) {
|
|
516
|
+
const projected = original.graders.find((candidate) => candidate.id === grader.id);
|
|
517
|
+
if (projected?.kind === "custom_verifier") paths.add(projected.module);
|
|
518
|
+
}
|
|
519
|
+
return { assetId: file.asset.id, paths: [...paths].map(sourcePath) };
|
|
520
|
+
});
|
|
521
|
+
const metadata = { ...original.metadata };
|
|
522
|
+
if (source.modelResources) for (const key of ["taskDefinition", "rewardBinding", "rewardExecution", "derivedPortableMetadata", "modelTasksetDerivation", "importedPackageHash"]) delete metadata[key];
|
|
523
|
+
const draft = TasksetDraftSchema.parse({
|
|
524
|
+
...original,
|
|
525
|
+
id: preparation.draftId,
|
|
526
|
+
revision: 1,
|
|
527
|
+
status: "draft",
|
|
528
|
+
graders: original.graders.map((grader) => ({ ...grader, metadata: {
|
|
529
|
+
...grader.metadata,
|
|
530
|
+
portableGrader: source.taskset.graders.find((candidate) => candidate.id === grader.id)
|
|
531
|
+
} })),
|
|
532
|
+
environment: { ...original.environment, metadata: { ...original.environment.metadata, portableExecutionResources: { environment: source.environment } } },
|
|
533
|
+
modelScope: { modelId: preparation.lineage.owner.modelId, expectedModelRevision: input.expectedModelRevision, source: preparation },
|
|
534
|
+
publishedTasksetRef: preparation.tasksetRevision > 1 ? preparation.sourceTasksetRef : null,
|
|
535
|
+
metadata: {
|
|
536
|
+
...metadata,
|
|
537
|
+
modelTasksetAuthoring: preparation.lineage,
|
|
538
|
+
portableFileInventory: inventory.map((entry) => ({ ...entry, sourcePath: sourcePath(entry.sourcePath), asset: {
|
|
539
|
+
...entry.asset,
|
|
540
|
+
id: isManagedTasksetDraftFilePath(entry.sourcePath) ? `source-artifact-${contentHash({ packageHash: source.contentHash, assetId: entry.asset.id })}` : entry.asset.id,
|
|
541
|
+
path: sourcePath(entry.asset.path)
|
|
542
|
+
} }))
|
|
543
|
+
}
|
|
544
|
+
});
|
|
545
|
+
return TasksetDraftSourceInitializationSchema.parse({ draft, filePaths });
|
|
546
|
+
}
|
|
547
|
+
function materializeTasksetDraftWorkspace(input) {
|
|
548
|
+
const initialized = TasksetDraftSourceInitializationSchema.parse(input.initialized);
|
|
549
|
+
const source = validateTasksetPackage(input.source);
|
|
550
|
+
if (initialized.draft.modelScope?.source?.sourcePackageHash !== source.contentHash) throw new Error("Taskset draft lost its source preparation.");
|
|
551
|
+
const files = /* @__PURE__ */ new Map();
|
|
552
|
+
for (const mapping of initialized.filePaths) {
|
|
553
|
+
const file = source.files.find((candidate) => candidate.asset.id === mapping.assetId);
|
|
554
|
+
if (!file) throw new Error("Taskset draft source asset is missing.");
|
|
555
|
+
for (const path of mapping.paths) {
|
|
556
|
+
const previous = files.get(path);
|
|
557
|
+
if (previous && previous.contentHash !== file.asset.contentHash) throw new Error("Taskset draft source paths conflict.");
|
|
558
|
+
files.set(path, { path, contentHash: file.asset.contentHash, sizeBytes: file.asset.sizeBytes, base64: file.base64 });
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
for (const configured of configuredTasksetDraftFiles(initialized.draft)) if (!files.has(configured.relativePath)) {
|
|
562
|
+
const bytes = new TextEncoder().encode(configured.source);
|
|
563
|
+
files.set(configured.relativePath, { path: configured.relativePath, contentHash: sha256(bytes), sizeBytes: bytes.byteLength, base64: Buffer.from(bytes).toString("base64") });
|
|
564
|
+
}
|
|
565
|
+
let draft = initialized.draft;
|
|
566
|
+
if (draft.metrics.customAggregator) {
|
|
567
|
+
const file = files.get(draft.metrics.customAggregator.module);
|
|
568
|
+
if (!file) throw new Error("Declared Taskset metric module is missing.");
|
|
569
|
+
decodeTasksetDraftWorkspaceFile(file);
|
|
570
|
+
draft = TasksetDraftSchema.parse({ ...draft, metrics: { ...draft.metrics, customAggregator: { ...draft.metrics.customAggregator, contentHash: file.contentHash } } });
|
|
571
|
+
}
|
|
572
|
+
return createTasksetDraftWorkspace({ schemaVersion: "openpond.tasksetDraftWorkspace.v1", draft, files: [...files.values()] });
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
export {
|
|
576
|
+
bindOrdinaryModelTasksetReward,
|
|
577
|
+
inspectModelBatchPackage,
|
|
578
|
+
findModelBatchReview,
|
|
579
|
+
beginModelBatchReview,
|
|
580
|
+
LearningDomainError3 as LearningDomainError,
|
|
581
|
+
prepareImportedTasksetPackage,
|
|
582
|
+
tasksetPackageSourceId,
|
|
583
|
+
TasksetDraftSourceInitializationSchema,
|
|
584
|
+
prepareTasksetDraftSource,
|
|
585
|
+
materializeTasksetDraftWorkspace
|
|
586
|
+
};
|
|
587
|
+
//# sourceMappingURL=chunk-HOAYWW33.js.map
|