openpond-sdk 0.5.7 → 0.5.8

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.
@@ -175,3 +175,16 @@ The same entry point exports `materializeLearningBatchTaskset`. It verifies a
175
175
  sealed learning batch and its evidence, admission decisions, Reward releases,
176
176
  and verifier assets, then returns the authored Taskset, portable release, and
177
177
  generated verifier files consumed by training preparation.
178
+
179
+ `prepareReviewedLearningBatch` applies the shared evidence privacy scan before
180
+ that projection. Both clients use it to construct training-source provenance
181
+ from the actual scan and sealed admission decisions.
182
+
183
+ `prepareManagedTrainingSubmission` constructs the staged portable artifact and
184
+ public policy-optimization Job from the approved manifest, recipe, exact file
185
+ inventory, held-out source and synchronized Model. It verifies the selected
186
+ bytes and budget, copies its inputs before hashing, and performs no network
187
+ requests. A hosted iteration supplies its durable dispatch id as
188
+ `idempotencyKey`; manual training retains its manifest-derived identity. The
189
+ caller stages the returned `artifact` and creates the returned `submission`
190
+ through the existing training client.
@@ -4,6 +4,7 @@ import {
4
4
  resolvePortableTasksetRewardExecution
5
5
  } from "./chunk-ARUJ3FJT.js";
6
6
  import {
7
+ LearningBatchDatasetSourceRefSchema,
7
8
  TasksetSchema,
8
9
  computeTasksetHash
9
10
  } from "./chunk-QFT2MCIC.js";
@@ -12,7 +13,12 @@ import "./chunk-S7I45WJQ.js";
12
13
  import {
13
14
  TRAINING_EVALUATION_SOURCE_PATH,
14
15
  TrainingEvaluationSourceSchema,
15
- assertTrainingEvaluationIsolation
16
+ assertTrainingEvaluationIsolation,
17
+ parseAndVerifyTrainingInputArtifactUpload,
18
+ parseAndVerifyTrainingJobSubmission,
19
+ trainingEvaluationSourceRef,
20
+ trainingInputArtifactUploadHash,
21
+ trainingJobSubmissionHash
16
22
  } from "./chunk-F5JBFRAH.js";
17
23
  import {
18
24
  HarnessSourceSelectionSchema,
@@ -134,6 +140,42 @@ var ResolvedTrainingBundleManifestSchema = ResolvedTrainingBundleContentSchema.e
134
140
  contentHash: ReleaseHashSchema
135
141
  }).strict();
136
142
 
143
+ // src/training-privacy.ts
144
+ var SECRET_PATTERNS = [
145
+ { label: "OpenAI-style API key", pattern: /\bsk-[A-Za-z0-9_-]{16,}\b/g },
146
+ { label: "OpenPond API key", pattern: /\bopk_[A-Za-z0-9_-]{12,}\b/g },
147
+ { label: "private key", pattern: /-----BEGIN (?:RSA |EC |OPENSSH )?PRIVATE KEY-----/g },
148
+ { label: "credential assignment", pattern: /\b(?:api[_-]?key|password|secret|token)\s*[:=]\s*["']?[^\s"']{8,}/gi }
149
+ ];
150
+ var EMAIL_PATTERN = /\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/gi;
151
+ var PHONE_PATTERN = /\b(?:\+?1[-.\s]?)?\(?\d{3}\)?[-.\s]\d{3}[-.\s]\d{4}\b/g;
152
+ function scanAndRedactEvidence(text) {
153
+ const findings = [];
154
+ let redacted = text;
155
+ for (const item of SECRET_PATTERNS) {
156
+ item.pattern.lastIndex = 0;
157
+ if (item.pattern.test(redacted)) findings.push(item.label);
158
+ item.pattern.lastIndex = 0;
159
+ redacted = redacted.replace(item.pattern, `[REDACTED ${item.label}]`);
160
+ }
161
+ EMAIL_PATTERN.lastIndex = 0;
162
+ const hasEmail = EMAIL_PATTERN.test(redacted);
163
+ EMAIL_PATTERN.lastIndex = 0;
164
+ if (hasEmail) findings.push("email address");
165
+ redacted = redacted.replace(EMAIL_PATTERN, "[REDACTED email]");
166
+ PHONE_PATTERN.lastIndex = 0;
167
+ const hasPhone = PHONE_PATTERN.test(redacted);
168
+ PHONE_PATTERN.lastIndex = 0;
169
+ if (hasPhone) findings.push("phone number");
170
+ redacted = redacted.replace(PHONE_PATTERN, "[REDACTED phone]");
171
+ return {
172
+ secretStatus: findings.some((finding) => !finding.includes("email") && !finding.includes("phone")) ? "blocked" : "passed",
173
+ piiStatus: hasEmail || hasPhone ? "review" : "passed",
174
+ findings,
175
+ redacted
176
+ };
177
+ }
178
+
137
179
  // src/training-learning-batch.ts
138
180
  import { compileTaskBatch, learningRef, taskBatchPackageMetadata, verifyLearningTextAsset } from "@openpond/evals";
139
181
  function materializeLearningBatchTaskset(input) {
@@ -213,6 +255,121 @@ function fixtureOutcome(grade) {
213
255
  if (outcome.status !== "scored") return null;
214
256
  return { passed: outcome.passed === true, rewardEligible: grade.training.status === "scored" };
215
257
  }
258
+ function prepareReviewedLearningBatch(input) {
259
+ const scan = scanAndRedactEvidence(JSON.stringify({
260
+ tasks: input.evidence.map((item) => item.submission),
261
+ targets: input.decisions.map((item) => item.approvedTarget),
262
+ definition: input.definition
263
+ }));
264
+ if (scan.secretStatus !== "passed" || scan.piiStatus !== "passed") throw new Error(`Learning batch contains unresolved data findings (${scan.findings.join(", ")}). Correct the source examples and seal a revised batch before training.`);
265
+ const source = LearningBatchDatasetSourceRefSchema.parse({
266
+ schemaVersion: "openpond.learningBatchDatasetSource.v1",
267
+ kind: "learning_batch",
268
+ id: `batch-source-${input.batch.contentHash.slice(0, 40)}`,
269
+ profileId: input.profileId,
270
+ title: input.definition.name,
271
+ sourceHash: input.batch.contentHash,
272
+ occurredAt: input.batch.sealedAt,
273
+ batch: learningRef(input.batch),
274
+ taskDefinition: input.batch.taskDefinition,
275
+ admittedBy: input.batch.sealedBy,
276
+ licensingStatus: "approved",
277
+ secretScanStatus: scan.secretStatus,
278
+ piiScanStatus: scan.piiStatus,
279
+ metadata: { admission: input.admissionContext ?? "explicit_local_batch_review", privacyScanner: "openpond-evidence-v1", findings: scan.findings }
280
+ });
281
+ return materializeLearningBatchTaskset({ ...input, source });
282
+ }
283
+
284
+ // src/managed-training-preparation.ts
285
+ import { z as z2 } from "zod";
286
+ async function prepareManagedTrainingSubmission(raw) {
287
+ const input = structuredClone(raw);
288
+ const { project, recipe, taskset, approval } = input;
289
+ const manifest = HarnessRunManifestSchema.parse(input.manifest);
290
+ const bundle = ResolvedTrainingBundleManifestSchema.parse(input.bundleManifest);
291
+ const { contentHash: manifestHash, ...manifestContent } = manifest;
292
+ const { contentHash: bundleHash, ...bundleContent } = bundle;
293
+ if (contentHash(manifestContent) !== manifestHash || contentHash(bundleContent) !== bundleHash || manifest.resolvedBundleHash !== bundleHash || contentHash(manifest.harnessRelease) !== contentHash(bundle.harnessRelease) || contentHash(manifest.datasetRelease) !== contentHash(bundle.datasetRelease) || contentHash(manifest.evidenceSets) !== contentHash(bundle.evidenceSetRelease ? [bundle.evidenceSetRelease] : [])) {
294
+ throw new Error("The managed training manifest or resolved bundle changed.");
295
+ }
296
+ if (!project.hosted || project.hosted.syncedSourceRevision !== project.revision || project.hosted.portableProjectId !== project.id) throw new Error("Sync the exact Model Project revision before preparing managed training.");
297
+ const baseModel = project.trainingSetup.baseModel;
298
+ if (!baseModel || baseModel.modelId !== manifest.model.source || baseModel.revision !== manifest.model.revision || baseModel.tokenizerRevision !== manifest.model.tokenizerRevision || baseModel.chatTemplateHash !== manifest.model.chatTemplateHash) {
299
+ throw new Error("The synced Model Project base Model does not match the Run manifest.");
300
+ }
301
+ if (recipe.method !== "grpo" || contentHash(recipe) !== manifest.recipe.configHash || approval.approvalHash !== manifest.approval.approvalHash || approval.maximumSpendUsd !== manifest.approval.maximumSpendUsd) {
302
+ throw new Error("Managed training requires the exact approved GRPO recipe and spend ceiling.");
303
+ }
304
+ const limits = z2.object({ wallTimeMs: z2.number().positive() }).parse(recipe.resourceLimits);
305
+ if (input.idempotencyKey !== void 0) z2.string().trim().min(16).max(191).parse(input.idempotencyKey);
306
+ const files = verifyFiles(bundle, input.files);
307
+ const evaluationSource = TrainingEvaluationSourceSchema.parse(input.evaluationSource);
308
+ const evaluationFile = files.find((file) => file.path === TRAINING_EVALUATION_SOURCE_PATH);
309
+ if (!evaluationFile || contentHash(JSON.parse(Buffer.from(evaluationFile.content, "base64").toString("utf8"))) !== contentHash(evaluationSource)) {
310
+ throw new Error("The evaluation source differs from the immutable training bundle.");
311
+ }
312
+ const evaluation = await trainingEvaluationSourceRef(evaluationSource);
313
+ const payload = {
314
+ schemaVersion: "openpond.managedRlPortableSubmission.v1",
315
+ sourceRunRef: `openpond:model-run:${manifest.id}`,
316
+ name: `OpenPond Managed \xB7 ${project.id}`.slice(0, 191),
317
+ idempotencyKey: input.idempotencyKey ?? `openpond-managed:${manifestHash}`.slice(0, 191),
318
+ modelProject: { id: project.hosted.projectId, portableProjectId: project.hosted.portableProjectId },
319
+ manifest,
320
+ sourceTaskset: taskset,
321
+ modelImprovementQualification: input.modelImprovementQualification ?? null,
322
+ recipe,
323
+ resolvedBundle: { manifest: bundle, files },
324
+ validationTasks: evaluationSource.tasks,
325
+ validationAssets: evaluationSource.assets
326
+ };
327
+ const artifactContent = {
328
+ schemaVersion: "openpond.trainingInputArtifactUpload.v2",
329
+ kind: "portable_training_bundle",
330
+ idempotencyKey: `stage:${input.idempotencyKey ?? manifestHash}`,
331
+ sourceManifest: { id: manifest.id, contentHash: manifestHash },
332
+ payload
333
+ };
334
+ const artifact = await parseAndVerifyTrainingInputArtifactUpload({ ...artifactContent, contentHash: await trainingInputArtifactUploadHash(artifactContent) });
335
+ const jobContent = {
336
+ schemaVersion: "openpond.trainingJobSubmission.v2",
337
+ idempotencyKey: input.idempotencyKey ?? `openpond-training-v2:${manifestHash}`,
338
+ name: `OpenPond Managed \xB7 ${project.id}`.slice(0, 200),
339
+ source: {
340
+ modelProject: { id: project.hosted.projectId, portableProjectId: project.hosted.portableProjectId, revision: project.revision, contentHash: project.hosted.etag },
341
+ harnessRunManifest: artifactContent.sourceManifest,
342
+ harnessRelease: manifest.harnessRelease,
343
+ taskset,
344
+ tasksetRelease: { id: taskset.id, contentHash: taskset.contentHash },
345
+ dataset: bundle.datasetRelease,
346
+ evaluation,
347
+ evidenceSets: bundle.evidenceSetRelease ? [bundle.evidenceSetRelease] : []
348
+ },
349
+ job: { kind: "policy_optimize", baseModel, recipe, rewardSource: input.rewardSource, resumeFrom: input.resumeFrom },
350
+ requestedCapabilities: [
351
+ { id: "managed_rl.policy.grpo", version: "1", required: true },
352
+ { id: `managed_rl.rollouts.${manifest.runtimeTarget.placement}`, version: "1", required: true },
353
+ ...project.trainingSetup.managedGpuRequirement === "h100_hbm3" ? [{ id: "managed_rl.gpu.h100_hbm3", version: "1", required: true }] : []
354
+ ],
355
+ placementObjective: project.trainingSetup.managedGpuPlacementObjective,
356
+ budget: { maximumSpendUsd: approval.maximumSpendUsd, maximumWallSeconds: Math.ceil(limits.wallTimeMs / 1e3) },
357
+ approval: { ...approval, approvedAt: manifest.approval.approvedAt, exportApproved: true }
358
+ };
359
+ const submission = await parseAndVerifyTrainingJobSubmission({ ...jobContent, contentHash: await trainingJobSubmissionHash(jobContent) });
360
+ return { artifact, submission };
361
+ }
362
+ function verifyFiles(bundle, files) {
363
+ if (files.length !== bundle.files.length || new Set(files.map((file) => file.path)).size !== files.length) throw new Error("The managed bundle file inventory changed.");
364
+ const indexed = new Map(files.map((file) => [file.path, file]));
365
+ return bundle.files.map((expected) => {
366
+ const file = indexed.get(expected.path);
367
+ if (!file || file.path.includes("\\") || file.path.includes("\0") || file.path.split("/").some((part) => !part || part === "." || part === "..") || file.path === "bundle-manifest.json" || file.encoding !== "base64") throw new Error("The managed bundle contains an invalid file.");
368
+ const bytes2 = Buffer.from(file.content, "base64");
369
+ if (bytes2.toString("base64") !== file.content || file.sha256 !== expected.sha256 || file.sizeBytes !== expected.sizeBytes || bytes2.byteLength !== expected.sizeBytes || sha256(bytes2) !== expected.sha256) throw new Error(`Managed training bundle file ${file.path} changed before upload.`);
370
+ return file;
371
+ });
372
+ }
216
373
 
217
374
  // src/training-bundle.ts
218
375
  function buildTasksetTrainingBundle(input) {
@@ -454,6 +611,9 @@ export {
454
611
  ScopedSecretDeclarationSchema,
455
612
  TrainingEngineBindingSchema,
456
613
  buildTasksetTrainingBundle,
457
- materializeLearningBatchTaskset
614
+ materializeLearningBatchTaskset,
615
+ prepareManagedTrainingSubmission,
616
+ prepareReviewedLearningBatch,
617
+ scanAndRedactEvidence
458
618
  };
459
619
  //# sourceMappingURL=training-bundle.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/training-bundle.ts", "../src/training-bundle-contracts.ts", "../src/training-learning-batch.ts"],
4
- "sourcesContent": ["import { canonicalJson, contentHash, sha256, ImmutableReleaseRefSchema, HarnessSourceSelectionSchema, validateHarnessSourcePackage, type HarnessSourcePackage, type ImmutableReleaseRef, type VersionedReleaseRef } from \"@openpond/harness\";\nimport { compileBoundGraders } from \"@openpond/evals/rewards\";\nimport { verifyLearningTextAsset, type LearningTextAsset } from \"@openpond/evals/learning\";\nimport { HarnessRunManifestContentSchema, HarnessRunManifestSchema, ResolvedTrainingBundleContentSchema, ResolvedTrainingBundleManifestSchema, type ComputeTargetBinding, type HarnessRunManifest, type HarnessRuntimeTargetBinding, type OpaqueSecretLeaseRef, type ResolvedTrainingBundleManifest, type TrainingEngineBinding } from \"./training-bundle-contracts.js\";\nimport type { ModelProject } from \"./model-projects.js\";\nimport type { Taskset } from \"./taskset-authored-contracts.js\";\nimport { computeTasksetHash } from \"./taskset-authored-validation.js\";\nimport { resolvePortableTasksetRewardExecution, type TasksetRewardExecution } from \"./taskset-authored-portable-release.js\";\nimport { TRAINING_EVALUATION_SOURCE_PATH, TrainingEvaluationSourceSchema, assertTrainingEvaluationIsolation, type TrainingEvaluationSource } from \"./training-evaluation-source.js\";\n\nexport * from \"./training-bundle-contracts.js\";\nexport { materializeLearningBatchTaskset } from \"./training-learning-batch.js\";\n\nexport type TasksetTrainingBundle = {\n manifest: HarnessRunManifest;\n resolvedBundleManifest: ResolvedTrainingBundleManifest;\n assets: ReadonlyMap<string, Uint8Array>;\n profileRelease: VersionedReleaseRef;\n harnessRelease: ImmutableReleaseRef;\n tasksetRelease: ImmutableReleaseRef;\n datasetRelease: ImmutableReleaseRef;\n evidenceSetRelease: ImmutableReleaseRef | null;\n};\n\n/**\n * Produces the one artifact the training worker consumes. The release refs in\n * the manifest are immutable lineage identifiers, not separately materialized\n * release objects.\n */\nexport function buildTasksetTrainingBundle(input: {\n taskset: Taskset;\n modelProject: ModelProject;\n modelRunId: string;\n runtime: HarnessRuntimeTargetBinding;\n compute: ComputeTargetBinding;\n engine: TrainingEngineBinding;\n approval: {\n approvalHash: string;\n approvedAt: string;\n maximumSpendUsd: number | null;\n };\n secretLeaseRefs?: OpaqueSecretLeaseRef[];\n openpondRelease: string;\n workerProtocol: string;\n harnessRelease: ImmutableReleaseRef;\n tasksetRelease: ImmutableReleaseRef;\n harnessSource?: HarnessSourcePackage | null;\n tasksetAssetBytes?: ReadonlyMap<string, Uint8Array>;\n rewardExecution?: TasksetRewardExecution;\n verifierAssets?: LearningTextAsset[];\n evaluationSource?: TrainingEvaluationSource;\n}): TasksetTrainingBundle {\n const { taskset, modelProject, harnessRelease, tasksetRelease } = input;\n const setup = modelProject.trainingSetup;\n const releasedHarness = ImmutableReleaseRefSchema.parse(harnessRelease);\n const releasedTaskset = ImmutableReleaseRefSchema.parse(tasksetRelease);\n // These remain part of the preparation API for adapter compatibility; the\n // selected Harness release is now supplied explicitly and is never rebuilt\n // from mutable Profile/Taskset state here.\n void input.openpondRelease;\n void input.workerProtocol;\n const actualTasksetHash = computeTasksetHash(taskset);\n if (actualTasksetHash !== taskset.contentHash) {\n throw new Error(\n \"Taskset authoring state changed after its release was selected.\",\n );\n }\n if (\n !setup.baseModel?.revision ||\n !setup.baseModel.tokenizerRevision ||\n !setup.baseModel.chatTemplateHash ||\n !setup.recipe ||\n !setup.tasksetRef ||\n setup.tasksetRef.id !== taskset.id ||\n setup.tasksetRef.contentHash !== taskset.contentHash\n ) {\n throw new Error(\n \"Model Run must bind an exact Taskset, Model revision, tokenizer, chat template, and Recipe.\",\n );\n }\n\n const profileRelease = taskset.profileRelease ?? {\n id: `profile_${taskset.profileId}`,\n revision: taskset.revision,\n contentHash: contentHash({\n profileId: taskset.profileId,\n sourceCommit: taskset.authoringProvenance.sourceCommit,\n skillHash: taskset.authoringProvenance.skillHash,\n }),\n };\n const assets = new Map<string, Uint8Array>();\n if (input.evaluationSource) {\n const evaluation = TrainingEvaluationSourceSchema.parse(input.evaluationSource);\n if (contentHash(evaluation.taskset) !== contentHash(setup.evaluationTasksetRef)) {\n throw new Error(\"The evaluation source differs from the prepared Model configuration.\");\n }\n assertTrainingEvaluationIsolation(taskset.tasks.filter(task => task.split === \"train\"), evaluation.tasks);\n assets.set(TRAINING_EVALUATION_SOURCE_PATH, new TextEncoder().encode(canonicalJson(evaluation)));\n } else if (setup.evaluationTasksetRef) {\n throw new Error(\"The prepared Model requires its pinned evaluation source bytes.\");\n }\n const harnessSource = input.harnessSource\n ? validateHarnessSourcePackage(input.harnessSource, releasedHarness)\n : null;\n if (setup.harnessRelease && !harnessSource) {\n throw new Error(\"A selected Harness requires its complete immutable source package.\");\n }\n if (harnessSource && (!setup.harnessRelease\n || setup.harnessRelease.id !== releasedHarness.id\n || setup.harnessRelease.contentHash !== releasedHarness.contentHash)) {\n throw new Error(\"Harness source differs from the Model's explicit selection.\");\n }\n if (harnessSource) {\n const leavesLocalHost = input.runtime.placement !== \"local\" || input.compute.kind !== \"local\";\n if (leavesLocalHost && (!harnessSource.agentSnapshot.portability.portable\n || harnessSource.harnessRelease.files.some(file => file.visibility === \"host_private\"))) {\n throw new Error(\"The selected Harness contains source that cannot leave its local host.\");\n }\n addJsonAsset(assets, \"harness/source-package.json\", harnessSource);\n }\n addJsonAsset(assets, \"harness/execution.json\", HarnessSourceSelectionSchema.parse({\n schemaVersion: \"openpond.harnessSourceSelection.v1\",\n mode: harnessSource ? \"selected_release\" : \"taskset_owned\",\n harnessRelease: releasedHarness,\n sourcePackageHash: harnessSource?.contentHash ?? null,\n }));\n const rewardExecution = resolvePortableTasksetRewardExecution(taskset, input.rewardExecution);\n if (rewardExecution) {\n const verifierAssets = input.verifierAssets ?? [];\n const references = compileBoundGraders(rewardExecution.binding, rewardExecution.rewards)\n .flatMap(grader => grader.kind === \"custom_verifier\" ? [grader.verifierRef] : []);\n const expected = new Set(references.map(reference => reference.id));\n if (new Set(verifierAssets.map(asset => asset.id)).size !== verifierAssets.length\n || verifierAssets.some(asset => !expected.has(asset.id))) throw new Error(\"Unexpected or duplicate private verifier asset.\");\n for (const reference of references) {\n const asset = verifierAssets.find(asset => asset.id === reference.id);\n if (!asset || reference.visibility !== \"verifier\") throw new Error(\"Training bundle requires its private verifier asset.\");\n verifyLearningTextAsset(asset, reference);\n }\n addJsonAsset(assets, \"reward-binding.json\", { kind: \"reward_binding_v1\", binding: rewardExecution.binding, rewards: rewardExecution.rewards, assets: verifierAssets });\n } else if (input.verifierAssets?.length) {\n throw new Error(\"Private verifier assets require a published Reward binding.\");\n }\n addJsonAsset(assets, \"environment.json\", {\n schemaVersion: \"openpond.harnessEnvironment.v1\",\n environment: taskset.environment,\n capabilities: taskset.capabilities,\n policy: taskset.policy,\n outputContract:\n (taskset.metadata.tasksetOutputContract as { mode?: unknown } | undefined)\n ?.mode === \"text\"\n ? null\n : taskset.metadata.tasksetOutputContract ?? null,\n });\n addJsonAsset(assets, \"graders.json\", {\n schemaVersion: \"openpond.harnessGraders.v1\",\n graders: taskset.graders,\n fixtures: taskset.graderFixtures,\n });\n addJsonAsset(assets, \"tool-contract.json\", {\n schemaVersion: \"openpond.harnessToolContract.v1\",\n toolNames: taskset.environment.toolNames,\n actionBindings: taskset.environment.actionBindings ?? [],\n capabilities: taskset.capabilities,\n connectedAppScopes: taskset.policy.connectedAppScopes,\n });\n const trainTasks = taskset.tasks.filter((task) => task.split === \"train\");\n if (trainTasks.length > 0) {\n addJsonAsset(assets, \"dataset/train.json\", {\n schemaVersion: \"openpond.datasetSplit.v1\",\n split: \"train\",\n tasks: trainTasks,\n });\n addTasksetAssets({\n assets,\n tasks: trainTasks,\n tasksetAssetBytes: input.tasksetAssetBytes ?? new Map(),\n });\n } else if (taskset.datasetArtifact) {\n addJsonAsset(assets, \"dataset/artifact.json\", taskset.datasetArtifact);\n } else {\n throw new Error(\"Taskset has no training dataset.\");\n }\n\n const approvedSignals = Object.values(taskset.learningSignals)\n .flat()\n .filter((signal) => signal.approved);\n for (const signal of approvedSignals) {\n const value = bytes(signal);\n assets.set(`evidence/signals/${sha256(value)}.json`, value);\n }\n\n const datasetRelease = {\n id: `dataset_${taskset.id}_r${taskset.revision}`,\n contentHash: contentHash({\n taskset: releasedTaskset,\n sourceRefs: taskset.sourceRefs,\n datasetArtifact: taskset.datasetArtifact ?? null,\n trainTasks,\n }),\n };\n const evidenceSetRelease =\n approvedSignals.length > 0\n ? {\n id: `evidence_${taskset.id}_r${taskset.revision}`,\n contentHash: contentHash({\n taskset: releasedTaskset,\n harnessRelease: releasedHarness,\n datasetRelease,\n profileRelease,\n signals: approvedSignals,\n }),\n }\n : null;\n\n const bundleContent = ResolvedTrainingBundleContentSchema.parse({\n schemaVersion: \"openpond.resolvedTrainingBundle.v1\",\n projection: \"trainer\",\n harnessRelease: releasedHarness,\n datasetRelease,\n evidenceSetRelease,\n files: [...assets.entries()]\n .sort(([left], [right]) => left.localeCompare(right))\n .map(([assetPath, value]) => ({\n path: assetPath,\n sha256: sha256(value),\n sizeBytes: value.byteLength,\n })),\n });\n const resolvedBundleManifest = ResolvedTrainingBundleManifestSchema.parse({\n ...bundleContent,\n contentHash: contentHash(bundleContent),\n });\n const manifestContent = HarnessRunManifestContentSchema.parse({\n schemaVersion: \"openpond.harnessRunManifest.v1\",\n id: `manifest_${input.modelRunId}_${input.approval.approvalHash.slice(0, 16)}`,\n harnessRelease,\n datasetRelease,\n evidenceSets: evidenceSetRelease ? [evidenceSetRelease] : [],\n model: {\n source: setup.baseModel.modelId,\n revision: setup.baseModel.revision,\n artifactHash: null,\n tokenizerRevision: setup.baseModel.tokenizerRevision,\n chatTemplateHash: setup.baseModel.chatTemplateHash,\n },\n recipe: {\n method: setup.recipe.method,\n version: \"openpond.trainingRecipe.v1\",\n configHash: contentHash(setup.recipe),\n },\n runtimeTarget: input.runtime,\n computeTarget: input.compute,\n engine: input.engine,\n resolvedBundleHash: resolvedBundleManifest.contentHash,\n secretLeaseRefs: input.secretLeaseRefs ?? [],\n approval: input.approval,\n createdAt: modelProject.updatedAt,\n });\n const manifest = HarnessRunManifestSchema.parse({\n ...manifestContent,\n contentHash: contentHash(manifestContent),\n });\n return {\n manifest,\n resolvedBundleManifest,\n assets,\n profileRelease,\n harnessRelease: releasedHarness,\n tasksetRelease: releasedTaskset,\n datasetRelease,\n evidenceSetRelease,\n };\n}\n\nfunction addTasksetAssets(input: {\n assets: Map<string, Uint8Array>;\n tasks: Taskset[\"tasks\"];\n tasksetAssetBytes: ReadonlyMap<string, Uint8Array>;\n}): void {\n const expected = new Set<string>();\n for (const task of input.tasks) {\n for (const asset of task.assets ?? []) {\n if (expected.has(asset.artifactRef)) {\n throw new Error(\n `Training asset path ${asset.artifactRef} is shared by multiple tasks.`,\n );\n }\n expected.add(asset.artifactRef);\n const value = input.tasksetAssetBytes.get(asset.artifactRef);\n if (!value) {\n throw new Error(\n `Resolved Training Bundle is missing Work asset ${asset.artifactRef}.`,\n );\n }\n if (value.byteLength !== asset.sizeBytes || sha256(value) !== asset.sha256) {\n throw new Error(\n `Resolved Training Bundle Work asset ${asset.artifactRef} failed immutable verification.`,\n );\n }\n input.assets.set(asset.artifactRef, value);\n }\n }\n for (const assetPath of input.tasksetAssetBytes.keys()) {\n if (!expected.has(assetPath)) {\n throw new Error(\n `Resolved Training Bundle received unexpected Work asset ${assetPath}.`,\n );\n }\n }\n}\n\nfunction addJsonAsset(\n assets: Map<string, Uint8Array>,\n assetPath: string,\n value: unknown,\n): void {\n assets.set(assetPath, bytes(value));\n}\n\nfunction bytes(value: unknown): Uint8Array {\n return Buffer.from(canonicalJson(value), \"utf8\");\n}\n", "import { z } from \"zod\";\nimport { ImmutableReleaseRefSchema, ReleaseHashSchema, ReleaseIdSchema, ReleaseTimestampSchema } from \"@openpond/harness\";\n\nexport const ScopedSecretDeclarationSchema = z\n .object({\n id: ReleaseIdSchema,\n purpose: z.string().trim().min(1).max(500),\n audience: z.enum([\n \"orchestrator\",\n \"environment\",\n \"privileged_scorer\",\n \"trainer\",\n \"infrastructure\",\n ]),\n required: z.boolean(),\n ttlSeconds: z.number().int().positive().max(86_400),\n scopes: z.array(z.string().trim().min(1).max(500)).max(100).default([]),\n })\n .strict();\n\nexport const OpaqueSecretLeaseRefSchema = z\n .object({\n declarationId: ReleaseIdSchema,\n leaseRef: z.string().trim().min(8).max(1_000),\n audience: ScopedSecretDeclarationSchema.shape.audience,\n expiresAt: ReleaseTimestampSchema,\n })\n .strict();\n\nexport type ScopedSecretDeclaration = z.infer<\n typeof ScopedSecretDeclarationSchema\n>;\nexport type OpaqueSecretLeaseRef = z.infer<typeof OpaqueSecretLeaseRefSchema>;\n\nexport const HarnessRuntimeTargetBindingSchema = z\n .object({\n adapterId: ReleaseIdSchema,\n placement: z.enum([\"local\", \"remote\", \"colocated\", \"provider_native\"]),\n capabilityReceipt: ReleaseHashSchema,\n runtimeVersion: z.string().trim().min(1).max(200),\n dataPlane: z\n .object({\n provider: ReleaseIdSchema,\n dataPlaneId: ReleaseIdSchema,\n cellId: ReleaseIdSchema,\n runnerPoolId: ReleaseIdSchema,\n runtimeImageDigest: z.string().regex(/^sha256:[a-f0-9]{64}$/),\n capabilityReceipt: ReleaseHashSchema,\n })\n .strict()\n .nullable(),\n })\n .strict();\n\nexport const ComputeTargetBindingSchema = z\n .object({\n adapterId: ReleaseIdSchema,\n kind: z.enum([\"local\", \"ssh\", \"managed\", \"custom\"]),\n deviceOrPool: z.string().trim().min(1).max(1_000),\n capabilityReceipt: ReleaseHashSchema,\n provider: ReleaseIdSchema.nullable(),\n })\n .strict();\n\nexport const TrainingEngineBindingSchema = z\n .object({\n adapterId: ReleaseIdSchema,\n workerVersion: z.string().trim().min(1).max(200),\n workerImageDigest: z\n .string()\n .regex(/^sha256:[a-f0-9]{64}$/)\n .nullable(),\n upstreamRevision: z.string().trim().min(1).max(500),\n capabilityReceipt: ReleaseHashSchema,\n })\n .strict();\n\nexport const HarnessRunManifestContentSchema = z\n .object({\n schemaVersion: z.literal(\"openpond.harnessRunManifest.v1\"),\n id: ReleaseIdSchema,\n harnessRelease: ImmutableReleaseRefSchema,\n datasetRelease: ImmutableReleaseRefSchema,\n evidenceSets: z.array(ImmutableReleaseRefSchema).max(10_000),\n model: z\n .object({\n source: z.string().trim().min(1).max(200),\n revision: z.string().trim().min(1).max(500),\n artifactHash: ReleaseHashSchema.nullable(),\n tokenizerRevision: z.string().trim().min(1).max(500),\n chatTemplateHash: ReleaseHashSchema,\n })\n .strict(),\n recipe: z\n .object({\n method: z.string().trim().min(1).max(100),\n version: z.string().trim().min(1).max(200),\n configHash: ReleaseHashSchema,\n })\n .strict(),\n runtimeTarget: HarnessRuntimeTargetBindingSchema,\n computeTarget: ComputeTargetBindingSchema,\n engine: TrainingEngineBindingSchema,\n resolvedBundleHash: ReleaseHashSchema,\n secretLeaseRefs: z.array(OpaqueSecretLeaseRefSchema).max(1_000),\n approval: z\n .object({\n approvalHash: ReleaseHashSchema,\n approvedAt: ReleaseTimestampSchema,\n maximumSpendUsd: z.number().nonnegative().nullable(),\n })\n .strict(),\n createdAt: ReleaseTimestampSchema,\n })\n .strict();\n\nexport const HarnessRunManifestSchema = HarnessRunManifestContentSchema.extend({\n contentHash: ReleaseHashSchema,\n}).strict();\n\nexport const ResolvedTrainingBundleContentSchema = z\n .object({\n schemaVersion: z.literal(\"openpond.resolvedTrainingBundle.v1\"),\n projection: z.literal(\"trainer\"),\n harnessRelease: ImmutableReleaseRefSchema,\n datasetRelease: ImmutableReleaseRefSchema,\n evidenceSetRelease: ImmutableReleaseRefSchema.nullable(),\n files: z\n .array(\n z\n .object({\n path: z.string().trim().min(1).max(2_000),\n sha256: ReleaseHashSchema,\n sizeBytes: z.number().int().nonnegative(),\n })\n .strict(),\n )\n .max(100_000),\n })\n .strict();\n\nexport const ResolvedTrainingBundleManifestSchema =\n ResolvedTrainingBundleContentSchema.extend({\n contentHash: ReleaseHashSchema,\n }).strict();\n\nexport type HarnessRuntimeTargetBinding = z.infer<\n typeof HarnessRuntimeTargetBindingSchema\n>;\nexport type ComputeTargetBinding = z.infer<typeof ComputeTargetBindingSchema>;\nexport type TrainingEngineBinding = z.infer<\n typeof TrainingEngineBindingSchema\n>;\nexport type HarnessRunManifest = z.infer<typeof HarnessRunManifestSchema>;\nexport type ResolvedTrainingBundleManifest = z.infer<\n typeof ResolvedTrainingBundleManifestSchema\n>;\n", "import { TasksetSchema, type GeneratedTaskFile } from \"./taskset-authored-contracts.js\";\nimport type { GraderFixture, LearningSignalInventory, TasksetSourceRef } from \"./taskset-draft-core.js\";\nimport { compileTaskBatch, learningRef, taskBatchPackageMetadata, verifyLearningTextAsset, type LearningTextAsset, type RewardBinding, type RewardComposition, type RewardRelease, type TaskAdmissionDecision, type TaskBatch, type TaskDefinition, type TaskEvidence } from \"@openpond/evals\";\nimport { computeTasksetHash } from \"./taskset-authored-validation.js\";\nimport { contentHash } from \"@openpond/harness\";\nimport { learningVerifierModule, projectLearningBatchGraders } from \"./taskset-package-grader-projection.js\";\n\n/** Projects a sealed batch into training inputs. The public batch compiler\n * rechecks every evidence/decision snapshot before adaptation. */\nexport function materializeLearningBatchTaskset(input: {\n batch: TaskBatch; definition: TaskDefinition; binding: RewardBinding; rewards: RewardRelease[];\n evidence: TaskEvidence[]; decisions: TaskAdmissionDecision[]; profileId: string;\n source: TasksetSourceRef;\n assets?: LearningTextAsset[];\n}) {\n const release = compileTaskBatch(input);\n const metadata = taskBatchPackageMetadata(release);\n if (release.environment.kind !== \"text\" || release.tools.length || release.tasks.some((task) => task.artifactRefs.length)) throw new Error(\"This learning batch requires an environment or asset adapter before training preparation.\");\n const sourceId = input.source.id;\n const signals: LearningSignalInventory = { demonstrations: [], preferences: [], corrections: [], feedback: [], rewards: [], labels: [] };\n const fixtures: GraderFixture[] = [];\n for (const admission of metadata.admissions) {\n const evidence = input.evidence.find((item) => item.id === admission.evidence.id)!;\n const decision = input.decisions.find((item) => item.id === admission.decision.id)!;\n if (input.batch.purpose === \"reward_training\" && decision.grade?.training.status === \"scored\") signals.rewards.push({\n id: `reward-${admission.taskId}`, taskId: admission.taskId, kind: \"reward\", task: input.definition.instructions,\n rules: [{ id: input.binding.id, points: 1, condition: \"Execute the released Reward binding with its declared normalization, weights and gates.\" }],\n otherwisePoints: 0, executable: true, approved: true, confidence: 1, sourceRefs: [sourceId], artifactRef: input.binding.id,\n metadata: { rewardBinding: learningRef(input.binding), evidence: admission.evidence, decision: admission.decision },\n });\n if (admission.supervisedTarget !== null) signals.demonstrations.push({ kind: \"demonstration\", id: `demo-${admission.taskId}`, taskId: admission.taskId, sourceRefs: [sourceId], artifactRef: admission.decision.id, approved: true, confidence: 1, prompt: null, response: JSON.stringify(admission.supervisedTarget), metadata: { evidence: admission.evidence, decision: admission.decision, targetGradeHash: decision.targetGrade?.contentHash } });\n for (const [kind, output, grade] of [[\"observed\", evidence.submission.observedOutput, decision.grade], [\"target\", decision.approvedTarget, decision.targetGrade]] as const) {\n const outcome = fixtureOutcome(grade);\n if (output === null || outcome === null) continue;\n fixtures.push({ id: `fixture-${kind}-${admission.taskId}`, taskId: admission.taskId, label: outcome.passed ? \"positive\" : \"negative\", output, infrastructureError: null, expectedPassed: outcome.passed, expectedRewardEligible: outcome.rewardEligible, metadata: { gradeReceiptHash: grade!.contentHash, evidence: admission.evidence, decision: admission.decision } });\n }\n }\n if (!fixtures.length) throw new Error(\"Grade at least one reviewed response before preparing this batch. Grader fixtures must come from actual receipts.\");\n const graders = projectLearningBatchGraders(input.binding, input.rewards, input.assets);\n const generatedFiles: GeneratedTaskFile[] = [];\n for (const grader of release.graders) {\n if (grader.kind !== \"custom_verifier\") continue;\n const asset = input.assets?.find((asset) => asset.id === grader.verifierRef.id);\n if (!asset) throw new Error(`Reward ${grader.id} is missing its immutable verifier source.`);\n const module = learningVerifierModule(grader.verifierRef.contentHash);\n if (!generatedFiles.some((file) => file.path === module)) generatedFiles.push({ path: module, role: \"verifier\", content: verifyLearningTextAsset(asset, grader.verifierRef) });\n }\n const taskset = TasksetSchema.parse({\n schemaVersion: \"openpond.taskset.v1\", id: `learning-${contentHash([input.profileId, input.batch.contentHash]).slice(0, 40)}`, revision: 1,\n profileId: input.profileId, profileRelease: null, createImproveRunId: null, name: `${input.definition.name} \u00B7 ${input.batch.examples.length} approved examples`, objective: input.definition.instructions,\n purpose: \"general\", benchmark: null, status: \"needs_review\", sourceRefs: [input.source], datasetArtifact: null,\n policy: release.policy,\n environment: { protocolVersion: \"openpond.taskEnvironment.v1\", kind: \"chat\", entrypoint: \"openpond.text.v1\", stateful: false, deterministicSeeds: release.environment.deterministicSeeds, toolNames: [], lifecycle: [\"create\", \"reset\", \"step\", \"grade\", \"cleanup\"], defaultTimeoutMs: release.environment.defaultTimeoutMs, networkPolicy: release.environment.networkPolicy, metadata: { portableEnvironment: release.environment } },\n capabilities: { schemaVersion: \"openpond.tasksetCapabilities.v1\", taskKind: \"chat\", supportedSignals: signals.demonstrations.length ? [\"demonstration\", \"reward\"] : [\"reward\"], compatibleMethods: input.batch.purpose === \"supervised_training\" ? [\"sft\"] : input.batch.purpose === \"reward_training\" ? [\"grpo\", \"ppo\"] : [\"none\"], rewardKinds: [\"deterministic\"], requiresTools: false, requiresState: false, requiresPrivilegedGrading: true, environmentPlacements: [\"local\", \"remote\"], exportable: true, portabilityBlockers: [] },\n tasks: release.tasks.map(({ artifactRefs: _assets, ...task }) => ({ ...task, schemaVersion: \"openpond.taskData.v1\", sourceRefs: [sourceId], metadata: { admission: metadata.admissions.find((entry) => entry.taskId === task.id), exampleOrigin: input.evidence.find((evidence) => evidence.id === task.id)?.correctionFeedbackId ? \"corrected\" : \"extracted\" } })),\n graders, graderFixtures: fixtures, learningSignals: signals,\n authoringProvenance: { schemaVersion: \"openpond.taskAuthoringProvenance.v1\", model: null, modelConfig: {}, skillHash: contentHash(\"openpond-learning-batch-v1\"), promptTemplateVersion: \"learning-batch-v1\", buildIntent: input.batch.purpose === \"supervised_training\" ? \"demonstrations\" : \"verifiable_reward\", buildSpecification: null, evidenceHashes: input.batch.examples.map((entry) => entry.evidence.contentHash), tasksetSdkVersion: \"learning-batch-v1\", sourceCommit: null, repairHistory: [], createdAt: input.batch.sealedAt },\n readiness: null, contentHash: \"00000000\", createdAt: input.batch.sealedAt, updatedAt: input.batch.sealedAt,\n metadata: { learning: metadata, learningRelease: learningRef(release), trainingMethod: input.batch.purpose === \"supervised_training\" ? \"sft\" : input.batch.purpose === \"reward_training\" ? \"grpo\" : \"none\", tasksetOutputContract: { mode: \"structured_json\", jsonSchema: input.definition.outputSchema, renderer: null } },\n });\n return { taskset: TasksetSchema.parse({ ...taskset, contentHash: computeTasksetHash(taskset) }), release, generatedFiles };\n}\n\nfunction fixtureOutcome(grade: RewardComposition | null) {\n if (!grade) return null;\n const outcome = grade.training.status === \"not_configured\" ? grade.evaluation : grade.training;\n if (outcome.status !== \"scored\") return null;\n return { passed: outcome.passed === true, rewardEligible: grade.training.status === \"scored\" };\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAAS,2BAA2B;AACpC,SAAS,2BAAAA,gCAAuD;;;ACFhE,SAAS,SAAS;AAGX,IAAM,gCAAgC,EAC1C,OAAO;AAAA,EACN,IAAI;AAAA,EACJ,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAAA,EACzC,UAAU,EAAE,KAAK;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAAA,EACD,UAAU,EAAE,QAAQ;AAAA,EACpB,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,KAAM;AAAA,EAClD,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,EAAE,QAAQ,CAAC,CAAC;AACxE,CAAC,EACA,OAAO;AAEH,IAAM,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E;AAAA,IACF;AAAA,EACF;AACF;AAEA,SAAS,aACP,QACA,WACA,OACM;AACN,SAAO,IAAI,WAAW,MAAM,KAAK,CAAC;AACpC;AAEA,SAAS,MAAM,OAA4B;AACzC,SAAO,OAAO,KAAK,cAAc,KAAK,GAAG,MAAM;AACjD;",
6
- "names": ["verifyLearningTextAsset", "asset", "asset", "verifyLearningTextAsset"]
3
+ "sources": ["../src/training-bundle.ts", "../src/training-bundle-contracts.ts", "../src/training-privacy.ts", "../src/training-learning-batch.ts", "../src/managed-training-preparation.ts"],
4
+ "sourcesContent": ["import { canonicalJson, contentHash, sha256, ImmutableReleaseRefSchema, HarnessSourceSelectionSchema, validateHarnessSourcePackage, type HarnessSourcePackage, type ImmutableReleaseRef, type VersionedReleaseRef } from \"@openpond/harness\";\nimport { compileBoundGraders } from \"@openpond/evals/rewards\";\nimport { verifyLearningTextAsset, type LearningTextAsset } from \"@openpond/evals/learning\";\nimport { HarnessRunManifestContentSchema, HarnessRunManifestSchema, ResolvedTrainingBundleContentSchema, ResolvedTrainingBundleManifestSchema, type ComputeTargetBinding, type HarnessRunManifest, type HarnessRuntimeTargetBinding, type OpaqueSecretLeaseRef, type ResolvedTrainingBundleManifest, type TrainingEngineBinding } from \"./training-bundle-contracts.js\";\nimport type { ModelProject } from \"./model-projects.js\";\nimport type { Taskset } from \"./taskset-authored-contracts.js\";\nimport { computeTasksetHash } from \"./taskset-authored-validation.js\";\nimport { resolvePortableTasksetRewardExecution, type TasksetRewardExecution } from \"./taskset-authored-portable-release.js\";\nimport { TRAINING_EVALUATION_SOURCE_PATH, TrainingEvaluationSourceSchema, assertTrainingEvaluationIsolation, type TrainingEvaluationSource } from \"./training-evaluation-source.js\";\n\nexport * from \"./training-bundle-contracts.js\";\nexport { materializeLearningBatchTaskset, prepareReviewedLearningBatch } from \"./training-learning-batch.js\";\nexport { prepareManagedTrainingSubmission, type ManagedTrainingPreparationInput, type TrainingPreparationFile } from \"./managed-training-preparation.js\";\nexport { scanAndRedactEvidence, type EvidencePrivacyScan } from \"./training-privacy.js\";\n\nexport type TasksetTrainingBundle = {\n manifest: HarnessRunManifest;\n resolvedBundleManifest: ResolvedTrainingBundleManifest;\n assets: ReadonlyMap<string, Uint8Array>;\n profileRelease: VersionedReleaseRef;\n harnessRelease: ImmutableReleaseRef;\n tasksetRelease: ImmutableReleaseRef;\n datasetRelease: ImmutableReleaseRef;\n evidenceSetRelease: ImmutableReleaseRef | null;\n};\n\n/**\n * Produces the one artifact the training worker consumes. The release refs in\n * the manifest are immutable lineage identifiers, not separately materialized\n * release objects.\n */\nexport function buildTasksetTrainingBundle(input: {\n taskset: Taskset;\n modelProject: ModelProject;\n modelRunId: string;\n runtime: HarnessRuntimeTargetBinding;\n compute: ComputeTargetBinding;\n engine: TrainingEngineBinding;\n approval: {\n approvalHash: string;\n approvedAt: string;\n maximumSpendUsd: number | null;\n };\n secretLeaseRefs?: OpaqueSecretLeaseRef[];\n openpondRelease: string;\n workerProtocol: string;\n harnessRelease: ImmutableReleaseRef;\n tasksetRelease: ImmutableReleaseRef;\n harnessSource?: HarnessSourcePackage | null;\n tasksetAssetBytes?: ReadonlyMap<string, Uint8Array>;\n rewardExecution?: TasksetRewardExecution;\n verifierAssets?: LearningTextAsset[];\n evaluationSource?: TrainingEvaluationSource;\n}): TasksetTrainingBundle {\n const { taskset, modelProject, harnessRelease, tasksetRelease } = input;\n const setup = modelProject.trainingSetup;\n const releasedHarness = ImmutableReleaseRefSchema.parse(harnessRelease);\n const releasedTaskset = ImmutableReleaseRefSchema.parse(tasksetRelease);\n // These remain part of the preparation API for adapter compatibility; the\n // selected Harness release is now supplied explicitly and is never rebuilt\n // from mutable Profile/Taskset state here.\n void input.openpondRelease;\n void input.workerProtocol;\n const actualTasksetHash = computeTasksetHash(taskset);\n if (actualTasksetHash !== taskset.contentHash) {\n throw new Error(\n \"Taskset authoring state changed after its release was selected.\",\n );\n }\n if (\n !setup.baseModel?.revision ||\n !setup.baseModel.tokenizerRevision ||\n !setup.baseModel.chatTemplateHash ||\n !setup.recipe ||\n !setup.tasksetRef ||\n setup.tasksetRef.id !== taskset.id ||\n setup.tasksetRef.contentHash !== taskset.contentHash\n ) {\n throw new Error(\n \"Model Run must bind an exact Taskset, Model revision, tokenizer, chat template, and Recipe.\",\n );\n }\n\n const profileRelease = taskset.profileRelease ?? {\n id: `profile_${taskset.profileId}`,\n revision: taskset.revision,\n contentHash: contentHash({\n profileId: taskset.profileId,\n sourceCommit: taskset.authoringProvenance.sourceCommit,\n skillHash: taskset.authoringProvenance.skillHash,\n }),\n };\n const assets = new Map<string, Uint8Array>();\n if (input.evaluationSource) {\n const evaluation = TrainingEvaluationSourceSchema.parse(input.evaluationSource);\n if (contentHash(evaluation.taskset) !== contentHash(setup.evaluationTasksetRef)) {\n throw new Error(\"The evaluation source differs from the prepared Model configuration.\");\n }\n assertTrainingEvaluationIsolation(taskset.tasks.filter(task => task.split === \"train\"), evaluation.tasks);\n assets.set(TRAINING_EVALUATION_SOURCE_PATH, new TextEncoder().encode(canonicalJson(evaluation)));\n } else if (setup.evaluationTasksetRef) {\n throw new Error(\"The prepared Model requires its pinned evaluation source bytes.\");\n }\n const harnessSource = input.harnessSource\n ? validateHarnessSourcePackage(input.harnessSource, releasedHarness)\n : null;\n if (setup.harnessRelease && !harnessSource) {\n throw new Error(\"A selected Harness requires its complete immutable source package.\");\n }\n if (harnessSource && (!setup.harnessRelease\n || setup.harnessRelease.id !== releasedHarness.id\n || setup.harnessRelease.contentHash !== releasedHarness.contentHash)) {\n throw new Error(\"Harness source differs from the Model's explicit selection.\");\n }\n if (harnessSource) {\n const leavesLocalHost = input.runtime.placement !== \"local\" || input.compute.kind !== \"local\";\n if (leavesLocalHost && (!harnessSource.agentSnapshot.portability.portable\n || harnessSource.harnessRelease.files.some(file => file.visibility === \"host_private\"))) {\n throw new Error(\"The selected Harness contains source that cannot leave its local host.\");\n }\n addJsonAsset(assets, \"harness/source-package.json\", harnessSource);\n }\n addJsonAsset(assets, \"harness/execution.json\", HarnessSourceSelectionSchema.parse({\n schemaVersion: \"openpond.harnessSourceSelection.v1\",\n mode: harnessSource ? \"selected_release\" : \"taskset_owned\",\n harnessRelease: releasedHarness,\n sourcePackageHash: harnessSource?.contentHash ?? null,\n }));\n const rewardExecution = resolvePortableTasksetRewardExecution(taskset, input.rewardExecution);\n if (rewardExecution) {\n const verifierAssets = input.verifierAssets ?? [];\n const references = compileBoundGraders(rewardExecution.binding, rewardExecution.rewards)\n .flatMap(grader => grader.kind === \"custom_verifier\" ? [grader.verifierRef] : []);\n const expected = new Set(references.map(reference => reference.id));\n if (new Set(verifierAssets.map(asset => asset.id)).size !== verifierAssets.length\n || verifierAssets.some(asset => !expected.has(asset.id))) throw new Error(\"Unexpected or duplicate private verifier asset.\");\n for (const reference of references) {\n const asset = verifierAssets.find(asset => asset.id === reference.id);\n if (!asset || reference.visibility !== \"verifier\") throw new Error(\"Training bundle requires its private verifier asset.\");\n verifyLearningTextAsset(asset, reference);\n }\n addJsonAsset(assets, \"reward-binding.json\", { kind: \"reward_binding_v1\", binding: rewardExecution.binding, rewards: rewardExecution.rewards, assets: verifierAssets });\n } else if (input.verifierAssets?.length) {\n throw new Error(\"Private verifier assets require a published Reward binding.\");\n }\n addJsonAsset(assets, \"environment.json\", {\n schemaVersion: \"openpond.harnessEnvironment.v1\",\n environment: taskset.environment,\n capabilities: taskset.capabilities,\n policy: taskset.policy,\n outputContract:\n (taskset.metadata.tasksetOutputContract as { mode?: unknown } | undefined)\n ?.mode === \"text\"\n ? null\n : taskset.metadata.tasksetOutputContract ?? null,\n });\n addJsonAsset(assets, \"graders.json\", {\n schemaVersion: \"openpond.harnessGraders.v1\",\n graders: taskset.graders,\n fixtures: taskset.graderFixtures,\n });\n addJsonAsset(assets, \"tool-contract.json\", {\n schemaVersion: \"openpond.harnessToolContract.v1\",\n toolNames: taskset.environment.toolNames,\n actionBindings: taskset.environment.actionBindings ?? [],\n capabilities: taskset.capabilities,\n connectedAppScopes: taskset.policy.connectedAppScopes,\n });\n const trainTasks = taskset.tasks.filter((task) => task.split === \"train\");\n if (trainTasks.length > 0) {\n addJsonAsset(assets, \"dataset/train.json\", {\n schemaVersion: \"openpond.datasetSplit.v1\",\n split: \"train\",\n tasks: trainTasks,\n });\n addTasksetAssets({\n assets,\n tasks: trainTasks,\n tasksetAssetBytes: input.tasksetAssetBytes ?? new Map(),\n });\n } else if (taskset.datasetArtifact) {\n addJsonAsset(assets, \"dataset/artifact.json\", taskset.datasetArtifact);\n } else {\n throw new Error(\"Taskset has no training dataset.\");\n }\n\n const approvedSignals = Object.values(taskset.learningSignals)\n .flat()\n .filter((signal) => signal.approved);\n for (const signal of approvedSignals) {\n const value = bytes(signal);\n assets.set(`evidence/signals/${sha256(value)}.json`, value);\n }\n\n const datasetRelease = {\n id: `dataset_${taskset.id}_r${taskset.revision}`,\n contentHash: contentHash({\n taskset: releasedTaskset,\n sourceRefs: taskset.sourceRefs,\n datasetArtifact: taskset.datasetArtifact ?? null,\n trainTasks,\n }),\n };\n const evidenceSetRelease =\n approvedSignals.length > 0\n ? {\n id: `evidence_${taskset.id}_r${taskset.revision}`,\n contentHash: contentHash({\n taskset: releasedTaskset,\n harnessRelease: releasedHarness,\n datasetRelease,\n profileRelease,\n signals: approvedSignals,\n }),\n }\n : null;\n\n const bundleContent = ResolvedTrainingBundleContentSchema.parse({\n schemaVersion: \"openpond.resolvedTrainingBundle.v1\",\n projection: \"trainer\",\n harnessRelease: releasedHarness,\n datasetRelease,\n evidenceSetRelease,\n files: [...assets.entries()]\n .sort(([left], [right]) => left.localeCompare(right))\n .map(([assetPath, value]) => ({\n path: assetPath,\n sha256: sha256(value),\n sizeBytes: value.byteLength,\n })),\n });\n const resolvedBundleManifest = ResolvedTrainingBundleManifestSchema.parse({\n ...bundleContent,\n contentHash: contentHash(bundleContent),\n });\n const manifestContent = HarnessRunManifestContentSchema.parse({\n schemaVersion: \"openpond.harnessRunManifest.v1\",\n id: `manifest_${input.modelRunId}_${input.approval.approvalHash.slice(0, 16)}`,\n harnessRelease,\n datasetRelease,\n evidenceSets: evidenceSetRelease ? [evidenceSetRelease] : [],\n model: {\n source: setup.baseModel.modelId,\n revision: setup.baseModel.revision,\n artifactHash: null,\n tokenizerRevision: setup.baseModel.tokenizerRevision,\n chatTemplateHash: setup.baseModel.chatTemplateHash,\n },\n recipe: {\n method: setup.recipe.method,\n version: \"openpond.trainingRecipe.v1\",\n configHash: contentHash(setup.recipe),\n },\n runtimeTarget: input.runtime,\n computeTarget: input.compute,\n engine: input.engine,\n resolvedBundleHash: resolvedBundleManifest.contentHash,\n secretLeaseRefs: input.secretLeaseRefs ?? [],\n approval: input.approval,\n createdAt: modelProject.updatedAt,\n });\n const manifest = HarnessRunManifestSchema.parse({\n ...manifestContent,\n contentHash: contentHash(manifestContent),\n });\n return {\n manifest,\n resolvedBundleManifest,\n assets,\n profileRelease,\n harnessRelease: releasedHarness,\n tasksetRelease: releasedTaskset,\n datasetRelease,\n evidenceSetRelease,\n };\n}\n\nfunction addTasksetAssets(input: {\n assets: Map<string, Uint8Array>;\n tasks: Taskset[\"tasks\"];\n tasksetAssetBytes: ReadonlyMap<string, Uint8Array>;\n}): void {\n const expected = new Set<string>();\n for (const task of input.tasks) {\n for (const asset of task.assets ?? []) {\n if (expected.has(asset.artifactRef)) {\n throw new Error(\n `Training asset path ${asset.artifactRef} is shared by multiple tasks.`,\n );\n }\n expected.add(asset.artifactRef);\n const value = input.tasksetAssetBytes.get(asset.artifactRef);\n if (!value) {\n throw new Error(\n `Resolved Training Bundle is missing Work asset ${asset.artifactRef}.`,\n );\n }\n if (value.byteLength !== asset.sizeBytes || sha256(value) !== asset.sha256) {\n throw new Error(\n `Resolved Training Bundle Work asset ${asset.artifactRef} failed immutable verification.`,\n );\n }\n input.assets.set(asset.artifactRef, value);\n }\n }\n for (const assetPath of input.tasksetAssetBytes.keys()) {\n if (!expected.has(assetPath)) {\n throw new Error(\n `Resolved Training Bundle received unexpected Work asset ${assetPath}.`,\n );\n }\n }\n}\n\nfunction addJsonAsset(\n assets: Map<string, Uint8Array>,\n assetPath: string,\n value: unknown,\n): void {\n assets.set(assetPath, bytes(value));\n}\n\nfunction bytes(value: unknown): Uint8Array {\n return Buffer.from(canonicalJson(value), \"utf8\");\n}\n", "import { z } from \"zod\";\nimport { ImmutableReleaseRefSchema, ReleaseHashSchema, ReleaseIdSchema, ReleaseTimestampSchema } from \"@openpond/harness\";\n\nexport const ScopedSecretDeclarationSchema = z\n .object({\n id: ReleaseIdSchema,\n purpose: z.string().trim().min(1).max(500),\n audience: z.enum([\n \"orchestrator\",\n \"environment\",\n \"privileged_scorer\",\n \"trainer\",\n \"infrastructure\",\n ]),\n required: z.boolean(),\n ttlSeconds: z.number().int().positive().max(86_400),\n scopes: z.array(z.string().trim().min(1).max(500)).max(100).default([]),\n })\n .strict();\n\nexport const OpaqueSecretLeaseRefSchema = z\n .object({\n declarationId: ReleaseIdSchema,\n leaseRef: z.string().trim().min(8).max(1_000),\n audience: ScopedSecretDeclarationSchema.shape.audience,\n expiresAt: ReleaseTimestampSchema,\n })\n .strict();\n\nexport type ScopedSecretDeclaration = z.infer<\n typeof ScopedSecretDeclarationSchema\n>;\nexport type OpaqueSecretLeaseRef = z.infer<typeof OpaqueSecretLeaseRefSchema>;\n\nexport const HarnessRuntimeTargetBindingSchema = z\n .object({\n adapterId: ReleaseIdSchema,\n placement: z.enum([\"local\", \"remote\", \"colocated\", \"provider_native\"]),\n capabilityReceipt: ReleaseHashSchema,\n runtimeVersion: z.string().trim().min(1).max(200),\n dataPlane: z\n .object({\n provider: ReleaseIdSchema,\n dataPlaneId: ReleaseIdSchema,\n cellId: ReleaseIdSchema,\n runnerPoolId: ReleaseIdSchema,\n runtimeImageDigest: z.string().regex(/^sha256:[a-f0-9]{64}$/),\n capabilityReceipt: ReleaseHashSchema,\n })\n .strict()\n .nullable(),\n })\n .strict();\n\nexport const ComputeTargetBindingSchema = z\n .object({\n adapterId: ReleaseIdSchema,\n kind: z.enum([\"local\", \"ssh\", \"managed\", \"custom\"]),\n deviceOrPool: z.string().trim().min(1).max(1_000),\n capabilityReceipt: ReleaseHashSchema,\n provider: ReleaseIdSchema.nullable(),\n })\n .strict();\n\nexport const TrainingEngineBindingSchema = z\n .object({\n adapterId: ReleaseIdSchema,\n workerVersion: z.string().trim().min(1).max(200),\n workerImageDigest: z\n .string()\n .regex(/^sha256:[a-f0-9]{64}$/)\n .nullable(),\n upstreamRevision: z.string().trim().min(1).max(500),\n capabilityReceipt: ReleaseHashSchema,\n })\n .strict();\n\nexport const HarnessRunManifestContentSchema = z\n .object({\n schemaVersion: z.literal(\"openpond.harnessRunManifest.v1\"),\n id: ReleaseIdSchema,\n harnessRelease: ImmutableReleaseRefSchema,\n datasetRelease: ImmutableReleaseRefSchema,\n evidenceSets: z.array(ImmutableReleaseRefSchema).max(10_000),\n model: z\n .object({\n source: z.string().trim().min(1).max(200),\n revision: z.string().trim().min(1).max(500),\n artifactHash: ReleaseHashSchema.nullable(),\n tokenizerRevision: z.string().trim().min(1).max(500),\n chatTemplateHash: ReleaseHashSchema,\n })\n .strict(),\n recipe: z\n .object({\n method: z.string().trim().min(1).max(100),\n version: z.string().trim().min(1).max(200),\n configHash: ReleaseHashSchema,\n })\n .strict(),\n runtimeTarget: HarnessRuntimeTargetBindingSchema,\n computeTarget: ComputeTargetBindingSchema,\n engine: TrainingEngineBindingSchema,\n resolvedBundleHash: ReleaseHashSchema,\n secretLeaseRefs: z.array(OpaqueSecretLeaseRefSchema).max(1_000),\n approval: z\n .object({\n approvalHash: ReleaseHashSchema,\n approvedAt: ReleaseTimestampSchema,\n maximumSpendUsd: z.number().nonnegative().nullable(),\n })\n .strict(),\n createdAt: ReleaseTimestampSchema,\n })\n .strict();\n\nexport const HarnessRunManifestSchema = HarnessRunManifestContentSchema.extend({\n contentHash: ReleaseHashSchema,\n}).strict();\n\nexport const ResolvedTrainingBundleContentSchema = z\n .object({\n schemaVersion: z.literal(\"openpond.resolvedTrainingBundle.v1\"),\n projection: z.literal(\"trainer\"),\n harnessRelease: ImmutableReleaseRefSchema,\n datasetRelease: ImmutableReleaseRefSchema,\n evidenceSetRelease: ImmutableReleaseRefSchema.nullable(),\n files: z\n .array(\n z\n .object({\n path: z.string().trim().min(1).max(2_000),\n sha256: ReleaseHashSchema,\n sizeBytes: z.number().int().nonnegative(),\n })\n .strict(),\n )\n .max(100_000),\n })\n .strict();\n\nexport const ResolvedTrainingBundleManifestSchema =\n ResolvedTrainingBundleContentSchema.extend({\n contentHash: ReleaseHashSchema,\n }).strict();\n\nexport type HarnessRuntimeTargetBinding = z.infer<\n typeof HarnessRuntimeTargetBindingSchema\n>;\nexport type ComputeTargetBinding = z.infer<typeof ComputeTargetBindingSchema>;\nexport type TrainingEngineBinding = z.infer<\n typeof TrainingEngineBindingSchema\n>;\nexport type HarnessRunManifest = z.infer<typeof HarnessRunManifestSchema>;\nexport type ResolvedTrainingBundleManifest = z.infer<\n typeof ResolvedTrainingBundleManifestSchema\n>;\n", "const SECRET_PATTERNS: Array<{ label: string; pattern: RegExp }> = [\n { label: \"OpenAI-style API key\", pattern: /\\bsk-[A-Za-z0-9_-]{16,}\\b/g },\n { label: \"OpenPond API key\", pattern: /\\bopk_[A-Za-z0-9_-]{12,}\\b/g },\n { label: \"private key\", pattern: /-----BEGIN (?:RSA |EC |OPENSSH )?PRIVATE KEY-----/g },\n { label: \"credential assignment\", pattern: /\\b(?:api[_-]?key|password|secret|token)\\s*[:=]\\s*[\"']?[^\\s\"']{8,}/gi },\n];\nconst EMAIL_PATTERN = /\\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,}\\b/gi;\nconst PHONE_PATTERN = /\\b(?:\\+?1[-.\\s]?)?\\(?\\d{3}\\)?[-.\\s]\\d{3}[-.\\s]\\d{4}\\b/g;\n\nexport type EvidencePrivacyScan = {\n secretStatus: \"passed\" | \"blocked\";\n piiStatus: \"passed\" | \"review\";\n findings: string[];\n redacted: string;\n};\n\nexport function scanAndRedactEvidence(text: string): EvidencePrivacyScan {\n const findings: string[] = [];\n let redacted = text;\n for (const item of SECRET_PATTERNS) {\n item.pattern.lastIndex = 0;\n if (item.pattern.test(redacted)) findings.push(item.label);\n item.pattern.lastIndex = 0;\n redacted = redacted.replace(item.pattern, `[REDACTED ${item.label}]`);\n }\n EMAIL_PATTERN.lastIndex = 0;\n const hasEmail = EMAIL_PATTERN.test(redacted);\n EMAIL_PATTERN.lastIndex = 0;\n if (hasEmail) findings.push(\"email address\");\n redacted = redacted.replace(EMAIL_PATTERN, \"[REDACTED email]\");\n PHONE_PATTERN.lastIndex = 0;\n const hasPhone = PHONE_PATTERN.test(redacted);\n PHONE_PATTERN.lastIndex = 0;\n if (hasPhone) findings.push(\"phone number\");\n redacted = redacted.replace(PHONE_PATTERN, \"[REDACTED phone]\");\n return {\n secretStatus: findings.some((finding) => !finding.includes(\"email\") && !finding.includes(\"phone\")) ? \"blocked\" : \"passed\",\n piiStatus: hasEmail || hasPhone ? \"review\" : \"passed\",\n findings,\n redacted,\n };\n}\n", "import { TasksetSchema, type GeneratedTaskFile } from \"./taskset-authored-contracts.js\";\nimport type { GraderFixture, LearningSignalInventory, TasksetSourceRef } from \"./taskset-draft-core.js\";\nimport { LearningBatchDatasetSourceRefSchema } from \"./taskset-draft-dataset-sources.js\";\nimport { scanAndRedactEvidence } from \"./training-privacy.js\";\nimport { compileTaskBatch, learningRef, taskBatchPackageMetadata, verifyLearningTextAsset, type LearningTextAsset, type RewardBinding, type RewardComposition, type RewardRelease, type TaskAdmissionDecision, type TaskBatch, type TaskDefinition, type TaskEvidence } from \"@openpond/evals\";\nimport { computeTasksetHash } from \"./taskset-authored-validation.js\";\nimport { contentHash } from \"@openpond/harness\";\nimport { learningVerifierModule, projectLearningBatchGraders } from \"./taskset-package-grader-projection.js\";\n\n/** Projects a sealed batch into training inputs. The public batch compiler\n * rechecks every evidence/decision snapshot before adaptation. */\nexport function materializeLearningBatchTaskset(input: {\n batch: TaskBatch; definition: TaskDefinition; binding: RewardBinding; rewards: RewardRelease[];\n evidence: TaskEvidence[]; decisions: TaskAdmissionDecision[]; profileId: string;\n source: TasksetSourceRef;\n assets?: LearningTextAsset[];\n}) {\n const release = compileTaskBatch(input);\n const metadata = taskBatchPackageMetadata(release);\n if (release.environment.kind !== \"text\" || release.tools.length || release.tasks.some((task) => task.artifactRefs.length)) throw new Error(\"This learning batch requires an environment or asset adapter before training preparation.\");\n const sourceId = input.source.id;\n const signals: LearningSignalInventory = { demonstrations: [], preferences: [], corrections: [], feedback: [], rewards: [], labels: [] };\n const fixtures: GraderFixture[] = [];\n for (const admission of metadata.admissions) {\n const evidence = input.evidence.find((item) => item.id === admission.evidence.id)!;\n const decision = input.decisions.find((item) => item.id === admission.decision.id)!;\n if (input.batch.purpose === \"reward_training\" && decision.grade?.training.status === \"scored\") signals.rewards.push({\n id: `reward-${admission.taskId}`, taskId: admission.taskId, kind: \"reward\", task: input.definition.instructions,\n rules: [{ id: input.binding.id, points: 1, condition: \"Execute the released Reward binding with its declared normalization, weights and gates.\" }],\n otherwisePoints: 0, executable: true, approved: true, confidence: 1, sourceRefs: [sourceId], artifactRef: input.binding.id,\n metadata: { rewardBinding: learningRef(input.binding), evidence: admission.evidence, decision: admission.decision },\n });\n if (admission.supervisedTarget !== null) signals.demonstrations.push({ kind: \"demonstration\", id: `demo-${admission.taskId}`, taskId: admission.taskId, sourceRefs: [sourceId], artifactRef: admission.decision.id, approved: true, confidence: 1, prompt: null, response: JSON.stringify(admission.supervisedTarget), metadata: { evidence: admission.evidence, decision: admission.decision, targetGradeHash: decision.targetGrade?.contentHash } });\n for (const [kind, output, grade] of [[\"observed\", evidence.submission.observedOutput, decision.grade], [\"target\", decision.approvedTarget, decision.targetGrade]] as const) {\n const outcome = fixtureOutcome(grade);\n if (output === null || outcome === null) continue;\n fixtures.push({ id: `fixture-${kind}-${admission.taskId}`, taskId: admission.taskId, label: outcome.passed ? \"positive\" : \"negative\", output, infrastructureError: null, expectedPassed: outcome.passed, expectedRewardEligible: outcome.rewardEligible, metadata: { gradeReceiptHash: grade!.contentHash, evidence: admission.evidence, decision: admission.decision } });\n }\n }\n if (!fixtures.length) throw new Error(\"Grade at least one reviewed response before preparing this batch. Grader fixtures must come from actual receipts.\");\n const graders = projectLearningBatchGraders(input.binding, input.rewards, input.assets);\n const generatedFiles: GeneratedTaskFile[] = [];\n for (const grader of release.graders) {\n if (grader.kind !== \"custom_verifier\") continue;\n const asset = input.assets?.find((asset) => asset.id === grader.verifierRef.id);\n if (!asset) throw new Error(`Reward ${grader.id} is missing its immutable verifier source.`);\n const module = learningVerifierModule(grader.verifierRef.contentHash);\n if (!generatedFiles.some((file) => file.path === module)) generatedFiles.push({ path: module, role: \"verifier\", content: verifyLearningTextAsset(asset, grader.verifierRef) });\n }\n const taskset = TasksetSchema.parse({\n schemaVersion: \"openpond.taskset.v1\", id: `learning-${contentHash([input.profileId, input.batch.contentHash]).slice(0, 40)}`, revision: 1,\n profileId: input.profileId, profileRelease: null, createImproveRunId: null, name: `${input.definition.name} \u00B7 ${input.batch.examples.length} approved examples`, objective: input.definition.instructions,\n purpose: \"general\", benchmark: null, status: \"needs_review\", sourceRefs: [input.source], datasetArtifact: null,\n policy: release.policy,\n environment: { protocolVersion: \"openpond.taskEnvironment.v1\", kind: \"chat\", entrypoint: \"openpond.text.v1\", stateful: false, deterministicSeeds: release.environment.deterministicSeeds, toolNames: [], lifecycle: [\"create\", \"reset\", \"step\", \"grade\", \"cleanup\"], defaultTimeoutMs: release.environment.defaultTimeoutMs, networkPolicy: release.environment.networkPolicy, metadata: { portableEnvironment: release.environment } },\n capabilities: { schemaVersion: \"openpond.tasksetCapabilities.v1\", taskKind: \"chat\", supportedSignals: signals.demonstrations.length ? [\"demonstration\", \"reward\"] : [\"reward\"], compatibleMethods: input.batch.purpose === \"supervised_training\" ? [\"sft\"] : input.batch.purpose === \"reward_training\" ? [\"grpo\", \"ppo\"] : [\"none\"], rewardKinds: [\"deterministic\"], requiresTools: false, requiresState: false, requiresPrivilegedGrading: true, environmentPlacements: [\"local\", \"remote\"], exportable: true, portabilityBlockers: [] },\n tasks: release.tasks.map(({ artifactRefs: _assets, ...task }) => ({ ...task, schemaVersion: \"openpond.taskData.v1\", sourceRefs: [sourceId], metadata: { admission: metadata.admissions.find((entry) => entry.taskId === task.id), exampleOrigin: input.evidence.find((evidence) => evidence.id === task.id)?.correctionFeedbackId ? \"corrected\" : \"extracted\" } })),\n graders, graderFixtures: fixtures, learningSignals: signals,\n authoringProvenance: { schemaVersion: \"openpond.taskAuthoringProvenance.v1\", model: null, modelConfig: {}, skillHash: contentHash(\"openpond-learning-batch-v1\"), promptTemplateVersion: \"learning-batch-v1\", buildIntent: input.batch.purpose === \"supervised_training\" ? \"demonstrations\" : \"verifiable_reward\", buildSpecification: null, evidenceHashes: input.batch.examples.map((entry) => entry.evidence.contentHash), tasksetSdkVersion: \"learning-batch-v1\", sourceCommit: null, repairHistory: [], createdAt: input.batch.sealedAt },\n readiness: null, contentHash: \"00000000\", createdAt: input.batch.sealedAt, updatedAt: input.batch.sealedAt,\n metadata: { learning: metadata, learningRelease: learningRef(release), trainingMethod: input.batch.purpose === \"supervised_training\" ? \"sft\" : input.batch.purpose === \"reward_training\" ? \"grpo\" : \"none\", tasksetOutputContract: { mode: \"structured_json\", jsonSchema: input.definition.outputSchema, renderer: null } },\n });\n return { taskset: TasksetSchema.parse({ ...taskset, contentHash: computeTasksetHash(taskset) }), release, generatedFiles };\n}\n\nfunction fixtureOutcome(grade: RewardComposition | null) {\n if (!grade) return null;\n const outcome = grade.training.status === \"not_configured\" ? grade.evaluation : grade.training;\n if (outcome.status !== \"scored\") return null;\n return { passed: outcome.passed === true, rewardEligible: grade.training.status === \"scored\" };\n}\n\n/** Shared admission-to-training preparation. No caller may claim a passed\n * privacy scan without executing the same checks over the pinned evidence.\n */\nexport function prepareReviewedLearningBatch(input: Omit<Parameters<typeof materializeLearningBatchTaskset>[0], \"source\"> & {\n admissionContext?: \"explicit_local_batch_review\" | \"explicit_hosted_batch_review\";\n}) {\n const scan = scanAndRedactEvidence(JSON.stringify({\n tasks: input.evidence.map(item => item.submission), targets: input.decisions.map(item => item.approvedTarget), definition: input.definition,\n }));\n if (scan.secretStatus !== \"passed\" || scan.piiStatus !== \"passed\") throw new Error(`Learning batch contains unresolved data findings (${scan.findings.join(\", \")}). Correct the source examples and seal a revised batch before training.`);\n const source = LearningBatchDatasetSourceRefSchema.parse({\n schemaVersion: \"openpond.learningBatchDatasetSource.v1\", kind: \"learning_batch\",\n id: `batch-source-${input.batch.contentHash.slice(0, 40)}`, profileId: input.profileId,\n title: input.definition.name, sourceHash: input.batch.contentHash, occurredAt: input.batch.sealedAt,\n batch: learningRef(input.batch), taskDefinition: input.batch.taskDefinition, admittedBy: input.batch.sealedBy,\n licensingStatus: \"approved\", secretScanStatus: scan.secretStatus, piiScanStatus: scan.piiStatus,\n metadata: { admission: input.admissionContext ?? \"explicit_local_batch_review\", privacyScanner: \"openpond-evidence-v1\", findings: scan.findings },\n });\n return materializeLearningBatchTaskset({ ...input, source });\n}\n", "import { contentHash, sha256 } from \"@openpond/harness\";\nimport { z } from \"zod\";\n\nimport type { ModelProject } from \"./model-projects.js\";\nimport { HarnessRunManifestSchema, ResolvedTrainingBundleManifestSchema, type HarnessRunManifest, type ResolvedTrainingBundleManifest } from \"./training-bundle-contracts.js\";\nimport { TRAINING_EVALUATION_SOURCE_PATH, TrainingEvaluationSourceSchema, trainingEvaluationSourceRef, type TrainingEvaluationSource } from \"./training-evaluation-source.js\";\nimport { parseAndVerifyTrainingInputArtifactUpload, parseAndVerifyTrainingJobSubmission, trainingInputArtifactUploadHash, trainingJobSubmissionHash, type TrainingJobSubmission } from \"./training.js\";\n\ntype PolicyJob = Extract<TrainingJobSubmission[\"job\"], { kind: \"policy_optimize\" }>;\nexport type TrainingPreparationFile = TrainingEvaluationSource[\"assets\"][number];\n\nexport interface ManagedTrainingPreparationInput {\n project: ModelProject;\n manifest: HarnessRunManifest;\n recipe: PolicyJob[\"recipe\"];\n taskset: TrainingJobSubmission[\"source\"][\"taskset\"];\n bundleManifest: ResolvedTrainingBundleManifest;\n files: TrainingPreparationFile[];\n evaluationSource: TrainingEvaluationSource;\n rewardSource: PolicyJob[\"rewardSource\"];\n resumeFrom: PolicyJob[\"resumeFrom\"];\n approval: Pick<TrainingJobSubmission[\"approval\"], \"approvalHash\" | \"maximumSpendUsd\" | \"retentionDays\" | \"region\">;\n modelImprovementQualification?: { id: string; contentHash: string } | null;\n /** A durable hosted iteration supplies its dispatch identity here. */\n idempotencyKey?: string;\n}\n\n/** Build the exact staged artifact and public Job without network or compute.\n * Inputs are copied before hashing so an asynchronous caller cannot rewrite the\n * selected bytes while preparation is in progress.\n */\nexport async function prepareManagedTrainingSubmission(raw: ManagedTrainingPreparationInput) {\n const input = structuredClone(raw);\n const { project, recipe, taskset, approval } = input;\n const manifest = HarnessRunManifestSchema.parse(input.manifest);\n const bundle = ResolvedTrainingBundleManifestSchema.parse(input.bundleManifest);\n const { contentHash: manifestHash, ...manifestContent } = manifest;\n const { contentHash: bundleHash, ...bundleContent } = bundle;\n if (contentHash(manifestContent) !== manifestHash || contentHash(bundleContent) !== bundleHash\n || manifest.resolvedBundleHash !== bundleHash || contentHash(manifest.harnessRelease) !== contentHash(bundle.harnessRelease)\n || contentHash(manifest.datasetRelease) !== contentHash(bundle.datasetRelease)\n || contentHash(manifest.evidenceSets) !== contentHash(bundle.evidenceSetRelease ? [bundle.evidenceSetRelease] : [])) {\n throw new Error(\"The managed training manifest or resolved bundle changed.\");\n }\n if (!project.hosted || project.hosted.syncedSourceRevision !== project.revision\n || project.hosted.portableProjectId !== project.id) throw new Error(\"Sync the exact Model Project revision before preparing managed training.\");\n const baseModel = project.trainingSetup.baseModel;\n if (!baseModel || baseModel.modelId !== manifest.model.source || baseModel.revision !== manifest.model.revision\n || baseModel.tokenizerRevision !== manifest.model.tokenizerRevision || baseModel.chatTemplateHash !== manifest.model.chatTemplateHash) {\n throw new Error(\"The synced Model Project base Model does not match the Run manifest.\");\n }\n if (recipe.method !== \"grpo\" || contentHash(recipe) !== manifest.recipe.configHash\n || approval.approvalHash !== manifest.approval.approvalHash || approval.maximumSpendUsd !== manifest.approval.maximumSpendUsd) {\n throw new Error(\"Managed training requires the exact approved GRPO recipe and spend ceiling.\");\n }\n const limits = z.object({ wallTimeMs: z.number().positive() }).parse(recipe.resourceLimits);\n if (input.idempotencyKey !== undefined) z.string().trim().min(16).max(191).parse(input.idempotencyKey);\n const files = verifyFiles(bundle, input.files);\n const evaluationSource = TrainingEvaluationSourceSchema.parse(input.evaluationSource);\n const evaluationFile = files.find(file => file.path === TRAINING_EVALUATION_SOURCE_PATH);\n if (!evaluationFile || contentHash(JSON.parse(Buffer.from(evaluationFile.content, \"base64\").toString(\"utf8\"))) !== contentHash(evaluationSource)) {\n throw new Error(\"The evaluation source differs from the immutable training bundle.\");\n }\n const evaluation = await trainingEvaluationSourceRef(evaluationSource);\n const payload = {\n schemaVersion: \"openpond.managedRlPortableSubmission.v1\" as const,\n sourceRunRef: `openpond:model-run:${manifest.id}`,\n name: `OpenPond Managed \u00B7 ${project.id}`.slice(0, 191),\n idempotencyKey: input.idempotencyKey ?? `openpond-managed:${manifestHash}`.slice(0, 191),\n modelProject: { id: project.hosted.projectId, portableProjectId: project.hosted.portableProjectId },\n manifest, sourceTaskset: taskset,\n modelImprovementQualification: input.modelImprovementQualification ?? null,\n recipe, resolvedBundle: { manifest: bundle, files },\n validationTasks: evaluationSource.tasks, validationAssets: evaluationSource.assets,\n };\n const artifactContent = {\n schemaVersion: \"openpond.trainingInputArtifactUpload.v2\" as const,\n kind: \"portable_training_bundle\" as const,\n idempotencyKey: `stage:${input.idempotencyKey ?? manifestHash}`,\n sourceManifest: { id: manifest.id, contentHash: manifestHash }, payload,\n };\n const artifact = await parseAndVerifyTrainingInputArtifactUpload({ ...artifactContent, contentHash: await trainingInputArtifactUploadHash(artifactContent) });\n const jobContent: Omit<TrainingJobSubmission, \"contentHash\"> = {\n schemaVersion: \"openpond.trainingJobSubmission.v2\",\n idempotencyKey: input.idempotencyKey ?? `openpond-training-v2:${manifestHash}`,\n name: `OpenPond Managed \u00B7 ${project.id}`.slice(0, 200),\n source: {\n modelProject: { id: project.hosted.projectId, portableProjectId: project.hosted.portableProjectId, revision: project.revision, contentHash: project.hosted.etag },\n harnessRunManifest: artifactContent.sourceManifest, harnessRelease: manifest.harnessRelease,\n taskset, tasksetRelease: { id: taskset.id, contentHash: taskset.contentHash },\n dataset: bundle.datasetRelease, evaluation,\n evidenceSets: bundle.evidenceSetRelease ? [bundle.evidenceSetRelease] : [],\n },\n job: { kind: \"policy_optimize\", baseModel, recipe, rewardSource: input.rewardSource, resumeFrom: input.resumeFrom },\n requestedCapabilities: [\n { id: \"managed_rl.policy.grpo\", version: \"1\", required: true },\n { id: `managed_rl.rollouts.${manifest.runtimeTarget.placement}`, version: \"1\", required: true },\n ...(project.trainingSetup.managedGpuRequirement === \"h100_hbm3\" ? [{ id: \"managed_rl.gpu.h100_hbm3\", version: \"1\", required: true }] : []),\n ],\n placementObjective: project.trainingSetup.managedGpuPlacementObjective,\n budget: { maximumSpendUsd: approval.maximumSpendUsd, maximumWallSeconds: Math.ceil(limits.wallTimeMs / 1_000) },\n approval: { ...approval, approvedAt: manifest.approval.approvedAt, exportApproved: true },\n };\n const submission = await parseAndVerifyTrainingJobSubmission({ ...jobContent, contentHash: await trainingJobSubmissionHash(jobContent) });\n return { artifact, submission };\n}\n\nfunction verifyFiles(bundle: ResolvedTrainingBundleManifest, files: TrainingPreparationFile[]) {\n if (files.length !== bundle.files.length || new Set(files.map(file => file.path)).size !== files.length) throw new Error(\"The managed bundle file inventory changed.\");\n const indexed = new Map(files.map(file => [file.path, file]));\n return bundle.files.map(expected => {\n const file = indexed.get(expected.path);\n if (!file || file.path.includes(\"\\\\\") || file.path.includes(\"\\0\") || file.path.split(\"/\").some(part => !part || part === \".\" || part === \"..\")\n || file.path === \"bundle-manifest.json\" || file.encoding !== \"base64\") throw new Error(\"The managed bundle contains an invalid file.\");\n const bytes = Buffer.from(file.content, \"base64\");\n if (bytes.toString(\"base64\") !== file.content || file.sha256 !== expected.sha256 || file.sizeBytes !== expected.sizeBytes\n || bytes.byteLength !== expected.sizeBytes || sha256(bytes) !== expected.sha256) throw new Error(`Managed training bundle file ${file.path} changed before upload.`);\n return file;\n });\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAAS,2BAA2B;AACpC,SAAS,2BAAAA,gCAAuD;;;ACFhE,SAAS,SAAS;AAGX,IAAM,gCAAgC,EAC1C,OAAO;AAAA,EACN,IAAI;AAAA,EACJ,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAAA,EACzC,UAAU,EAAE,KAAK;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAAA,EACD,UAAU,EAAE,QAAQ;AAAA,EACpB,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,KAAM;AAAA,EAClD,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,EAAE,QAAQ,CAAC,CAAC;AACxE,CAAC,EACA,OAAO;AAEH,IAAM,6BAA6B,EACvC,OAAO;AAAA,EACN,eAAe;AAAA,EACf,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,IAAI,GAAK;AAAA,EAC5C,UAAU,8BAA8B,MAAM;AAAA,EAC9C,WAAW;AACb,CAAC,EACA,OAAO;AAOH,IAAM,oCAAoC,EAC9C,OAAO;AAAA,EACN,WAAW;AAAA,EACX,WAAW,EAAE,KAAK,CAAC,SAAS,UAAU,aAAa,iBAAiB,CAAC;AAAA,EACrE,mBAAmB;AAAA,EACnB,gBAAgB,EA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