openpond-sdk 0.12.10 → 0.12.12

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.
Files changed (91) hide show
  1. package/LEARNING.md +11 -0
  2. package/README.md +2 -0
  3. package/dist/advanced-refiner-evaluations.js +8 -8
  4. package/dist/candidate-evaluations.js +7 -7
  5. package/dist/{chunk-QQ444G6A.js → chunk-2LVR24GU.js} +2 -2
  6. package/dist/{chunk-5QMREXMU.js → chunk-7BYLH47N.js} +3 -3
  7. package/dist/{chunk-RYDUAY52.js → chunk-C3TS766N.js} +21 -74
  8. package/dist/chunk-C3TS766N.js.map +1 -0
  9. package/dist/{chunk-HDKP6KE2.js → chunk-C4W2MEFP.js} +2 -2
  10. package/dist/{chunk-XJKGCU2K.js → chunk-CNREFTAV.js} +2 -2
  11. package/dist/{chunk-UAYXORU5.js → chunk-GHPCQXG5.js} +2 -2
  12. package/dist/{chunk-WOD72SFI.js → chunk-GJRXJL6G.js} +3 -3
  13. package/dist/{chunk-GRQWKATA.js → chunk-HAQPGTQ4.js} +2 -2
  14. package/dist/{chunk-7WKCQ4V5.js → chunk-IFBCLRBM.js} +2 -2
  15. package/dist/chunk-IZ26ZCGU.js +65 -0
  16. package/dist/chunk-IZ26ZCGU.js.map +1 -0
  17. package/dist/{chunk-ICFFZ4WC.js → chunk-JBYFD3QS.js} +3 -3
  18. package/dist/{chunk-4L556MYM.js → chunk-JDQVAG3R.js} +3 -3
  19. package/dist/{chunk-7FYPFHCQ.js → chunk-K54BDIKL.js} +3 -3
  20. package/dist/{chunk-ESW25WSD.js → chunk-KOJC3TH4.js} +6 -6
  21. package/dist/{chunk-GIEST52U.js → chunk-LHHHJIDR.js} +2 -2
  22. package/dist/{chunk-FC56EMHT.js → chunk-NKF5NIML.js} +6 -6
  23. package/dist/{chunk-LKKKTBLL.js → chunk-O3NOGKMT.js} +2 -2
  24. package/dist/{chunk-XNRM3QGR.js → chunk-ORYA2G7S.js} +3 -3
  25. package/dist/{chunk-PT72OARU.js → chunk-RIN6Z56W.js} +5 -5
  26. package/dist/{chunk-LT2YQCZI.js → chunk-RLW4Y5ZV.js} +2 -2
  27. package/dist/{chunk-PKW3II5M.js → chunk-TLSP5JKG.js} +2 -2
  28. package/dist/{chunk-BQ2C2Y54.js → chunk-UOV2LEXS.js} +4 -4
  29. package/dist/{chunk-ZZZU6XER.js → chunk-UWY5PUHR.js} +2 -2
  30. package/dist/{chunk-DMN6EF3R.js → chunk-XMVSQIK4.js} +2 -2
  31. package/dist/{chunk-WEL535AI.js → chunk-XRBM6PBD.js} +4 -4
  32. package/dist/{chunk-2DK7UBAG.js → chunk-YIGFQWZV.js} +3 -3
  33. package/dist/{chunk-IIQENUOK.js → chunk-ZYDDHHZZ.js} +3 -3
  34. package/dist/connected-evidence.js +14 -14
  35. package/dist/dataset-workspaces.js +14 -14
  36. package/dist/experiment-evaluation-schedules.js +18 -18
  37. package/dist/experiment-improvements.js +8 -8
  38. package/dist/experiments.js +17 -17
  39. package/dist/index.js +26 -25
  40. package/dist/index.js.map +1 -1
  41. package/dist/learning.js +9 -7
  42. package/dist/learning.js.map +1 -1
  43. package/dist/model-projects.js +4 -4
  44. package/dist/model-starter-attempts.js +3 -3
  45. package/dist/model-starter-catalog.js +10 -10
  46. package/dist/model-starters.js +10 -10
  47. package/dist/model-taskset-runs.js +4 -4
  48. package/dist/post-training.js +7 -7
  49. package/dist/taskset-drafts.js +13 -13
  50. package/dist/taskset-packages.js +15 -15
  51. package/dist/tool-learning-local-store.js +160 -7
  52. package/dist/tool-learning-local-store.js.map +1 -1
  53. package/dist/tool-learning.js +519 -0
  54. package/dist/tool-learning.js.map +1 -1
  55. package/dist/training-bundle.js +11 -11
  56. package/dist/training.js +8 -8
  57. package/dist/types/packages/sdk/src/tool-learning-client.d.ts +1236 -0
  58. package/dist/types/packages/sdk/src/tool-learning-client.d.ts.map +1 -0
  59. package/dist/types/packages/sdk/src/tool-learning-episodes.d.ts +58 -0
  60. package/dist/types/packages/sdk/src/tool-learning-episodes.d.ts.map +1 -0
  61. package/dist/types/packages/sdk/src/tool-learning-local-store.d.ts +70 -2
  62. package/dist/types/packages/sdk/src/tool-learning-local-store.d.ts.map +1 -1
  63. package/dist/types/packages/sdk/src/tool-learning.d.ts +2 -0
  64. package/dist/types/packages/sdk/src/tool-learning.d.ts.map +1 -1
  65. package/package.json +1 -1
  66. package/dist/chunk-RYDUAY52.js.map +0 -1
  67. /package/dist/{chunk-QQ444G6A.js.map → chunk-2LVR24GU.js.map} +0 -0
  68. /package/dist/{chunk-5QMREXMU.js.map → chunk-7BYLH47N.js.map} +0 -0
  69. /package/dist/{chunk-HDKP6KE2.js.map → chunk-C4W2MEFP.js.map} +0 -0
  70. /package/dist/{chunk-XJKGCU2K.js.map → chunk-CNREFTAV.js.map} +0 -0
  71. /package/dist/{chunk-UAYXORU5.js.map → chunk-GHPCQXG5.js.map} +0 -0
  72. /package/dist/{chunk-WOD72SFI.js.map → chunk-GJRXJL6G.js.map} +0 -0
  73. /package/dist/{chunk-GRQWKATA.js.map → chunk-HAQPGTQ4.js.map} +0 -0
  74. /package/dist/{chunk-7WKCQ4V5.js.map → chunk-IFBCLRBM.js.map} +0 -0
  75. /package/dist/{chunk-ICFFZ4WC.js.map → chunk-JBYFD3QS.js.map} +0 -0
  76. /package/dist/{chunk-4L556MYM.js.map → chunk-JDQVAG3R.js.map} +0 -0
  77. /package/dist/{chunk-7FYPFHCQ.js.map → chunk-K54BDIKL.js.map} +0 -0
  78. /package/dist/{chunk-ESW25WSD.js.map → chunk-KOJC3TH4.js.map} +0 -0
  79. /package/dist/{chunk-GIEST52U.js.map → chunk-LHHHJIDR.js.map} +0 -0
  80. /package/dist/{chunk-FC56EMHT.js.map → chunk-NKF5NIML.js.map} +0 -0
  81. /package/dist/{chunk-LKKKTBLL.js.map → chunk-O3NOGKMT.js.map} +0 -0
  82. /package/dist/{chunk-XNRM3QGR.js.map → chunk-ORYA2G7S.js.map} +0 -0
  83. /package/dist/{chunk-PT72OARU.js.map → chunk-RIN6Z56W.js.map} +0 -0
  84. /package/dist/{chunk-LT2YQCZI.js.map → chunk-RLW4Y5ZV.js.map} +0 -0
  85. /package/dist/{chunk-PKW3II5M.js.map → chunk-TLSP5JKG.js.map} +0 -0
  86. /package/dist/{chunk-BQ2C2Y54.js.map → chunk-UOV2LEXS.js.map} +0 -0
  87. /package/dist/{chunk-ZZZU6XER.js.map → chunk-UWY5PUHR.js.map} +0 -0
  88. /package/dist/{chunk-DMN6EF3R.js.map → chunk-XMVSQIK4.js.map} +0 -0
  89. /package/dist/{chunk-WEL535AI.js.map → chunk-XRBM6PBD.js.map} +0 -0
  90. /package/dist/{chunk-2DK7UBAG.js.map → chunk-YIGFQWZV.js.map} +0 -0
  91. /package/dist/{chunk-IIQENUOK.js.map → chunk-ZYDDHHZZ.js.map} +0 -0
package/LEARNING.md CHANGED
@@ -154,3 +154,14 @@ or known eligible boundaries. Changed originals require a new policy.
154
154
  false when unreadable originals are excluded. `coverage.excludedSessions` retains
155
155
  their count. These fields establish inventory reconciliation only; reconstructed
156
156
  tasks still need their own starting-state and grader qualification.
157
+
158
+ ### Bounded tool episode records
159
+
160
+ `openpond-sdk/tool-learning` exports `assembleToolLearningEpisode`. Episode reads
161
+ retain the original events plus an `assembly` with structural application/tool
162
+ version groups and an explicit `incomplete`, `ambiguous`, or
163
+ `awaiting_owner_review` state. Missing observations stay incomplete; contradictory
164
+ terminal observations or mismatched call references stay ambiguous. Delivery
165
+ order does not select a preferred outcome. The SDK checks assembly against the
166
+ returned events. These records grant neither verification nor learning authority;
167
+ owner review and canonical grading/admission remain separate.
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # `openpond-sdk`
2
2
 
3
+ See [tool learning](./TOOL_LEARNING.md) for scoped tool capture, private recovery evidence, and metered specialist consultation.
4
+
3
5
  See [task evidence and learning](./LEARNING.md) for reusable Rewards, task-format publication, SDK/HTTP intake, grading, review and approved batches.
4
6
 
5
7
  The OpenPond SDK is the server-side TypeScript client for running agentic work in OpenPond sandboxes. It gives Node.js applications, Next.js route handlers, workers, and backend services a small API for creating sandboxes, executing commands, managing files and runtimes, and running a model/tool loop in an isolated workspace.
@@ -12,18 +12,18 @@ import {
12
12
  sealAdvancedRefinerEvaluationPin,
13
13
  sealAdvancedRefinerReviewReceipt,
14
14
  verifyAdvancedRefinerEvaluationPin
15
- } from "./chunk-ZZZU6XER.js";
16
- import "./chunk-LKKKTBLL.js";
15
+ } from "./chunk-UWY5PUHR.js";
16
+ import "./chunk-O3NOGKMT.js";
17
17
  import "./chunk-3B5KSH3V.js";
18
18
  import "./chunk-H3367ISL.js";
19
- import "./chunk-GIEST52U.js";
19
+ import "./chunk-LHHHJIDR.js";
20
20
  import "./chunk-O6FKHAWN.js";
21
- import "./chunk-HDKP6KE2.js";
22
- import "./chunk-IIQENUOK.js";
23
- import "./chunk-LT2YQCZI.js";
24
- import "./chunk-BQ2C2Y54.js";
25
- import "./chunk-B3ZHJ2KK.js";
21
+ import "./chunk-C4W2MEFP.js";
22
+ import "./chunk-ZYDDHHZZ.js";
23
+ import "./chunk-RLW4Y5ZV.js";
24
+ import "./chunk-UOV2LEXS.js";
26
25
  import "./chunk-CL3IOOVL.js";
26
+ import "./chunk-B3ZHJ2KK.js";
27
27
  import "./chunk-H3JZ3P5T.js";
28
28
  import "./chunk-YLJ4XMA6.js";
29
29
  export {
@@ -5,14 +5,14 @@ import {
5
5
  CandidateEvaluationPreparationSchema,
6
6
  CandidateEvaluationRequestSchema,
7
7
  createCandidateEvaluationClient
8
- } from "./chunk-XJKGCU2K.js";
9
- import "./chunk-7FYPFHCQ.js";
10
- import "./chunk-HDKP6KE2.js";
11
- import "./chunk-IIQENUOK.js";
12
- import "./chunk-LT2YQCZI.js";
13
- import "./chunk-BQ2C2Y54.js";
14
- import "./chunk-B3ZHJ2KK.js";
8
+ } from "./chunk-CNREFTAV.js";
9
+ import "./chunk-K54BDIKL.js";
10
+ import "./chunk-C4W2MEFP.js";
11
+ import "./chunk-ZYDDHHZZ.js";
12
+ import "./chunk-RLW4Y5ZV.js";
13
+ import "./chunk-UOV2LEXS.js";
15
14
  import "./chunk-CL3IOOVL.js";
15
+ import "./chunk-B3ZHJ2KK.js";
16
16
  import "./chunk-H3JZ3P5T.js";
17
17
  import "./chunk-YLJ4XMA6.js";
18
18
  export {
@@ -6,7 +6,7 @@ import {
6
6
  ExperimentImprovementTestRecipeSchema,
7
7
  verifyExperimentImprovementHumanOptions,
8
8
  verifyExperimentImprovementState
9
- } from "./chunk-LKKKTBLL.js";
9
+ } from "./chunk-O3NOGKMT.js";
10
10
  import {
11
11
  fetchConnectedJson
12
12
  } from "./chunk-O6FKHAWN.js";
@@ -157,4 +157,4 @@ export {
157
157
  HostedProfileCandidateCommandSchema,
158
158
  ExperimentImprovementClient
159
159
  };
160
- //# sourceMappingURL=chunk-QQ444G6A.js.map
160
+ //# sourceMappingURL=chunk-2LVR24GU.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  RunExperimentSchema
3
- } from "./chunk-7FYPFHCQ.js";
3
+ } from "./chunk-K54BDIKL.js";
4
4
  import {
5
5
  HostedModelProjectSummarySchema
6
- } from "./chunk-BQ2C2Y54.js";
6
+ } from "./chunk-UOV2LEXS.js";
7
7
  import {
8
8
  OpenPondProtocolError,
9
9
  canonicalSha256
@@ -295,4 +295,4 @@ export {
295
295
  HostedTrainingPolicyControlSchema,
296
296
  TrainingHandoffOriginSchema2 as TrainingHandoffOriginSchema
297
297
  };
298
- //# sourceMappingURL=chunk-5QMREXMU.js.map
298
+ //# sourceMappingURL=chunk-7BYLH47N.js.map
@@ -2,60 +2,16 @@ import {
2
2
  OpenPondLearningError
3
3
  } from "./chunk-U2KGUAIS.js";
4
4
  import {
5
- ReleaseIdSchema
6
- } from "./chunk-H3JZ3P5T.js";
7
-
8
- // src/learning-credentials.ts
9
- import { z } from "zod";
10
- import { LearningRevisionRefSchema } from "@openpond/evals/learning";
11
- import { TaskSplitSchema } from "@openpond/evals/tasksets";
12
- var LearningSourceCredentialSchema = z.object({
13
- id: ReleaseIdSchema,
14
- scope: ReleaseIdSchema,
15
- sourceId: ReleaseIdSchema,
16
- name: z.string().trim().min(1).max(100),
17
- keyPrefix: z.string().min(1).max(100),
18
- createdAt: z.iso.datetime(),
19
- expiresAt: z.iso.datetime(),
20
- revokedAt: z.iso.datetime().nullable()
21
- }).strict();
22
- var LearningSourceCredentialSecretSchema = z.string().regex(/^opk_key_[A-Za-z0-9]{16}_[A-Za-z0-9]{48}$/);
23
- var LearningSourceCredentialRequestSchema = z.discriminatedUnion("action", [
24
- z.object({ action: z.literal("create"), scope: ReleaseIdSchema, sourceId: ReleaseIdSchema, name: z.string().trim().min(1).max(100), expiresAt: z.iso.datetime(), operationId: ReleaseIdSchema, apiKey: LearningSourceCredentialSecretSchema }).strict(),
25
- z.object({ action: z.literal("list"), scope: ReleaseIdSchema, sourceId: ReleaseIdSchema, afterId: ReleaseIdSchema.optional(), limit: z.number().int().min(1).max(100).default(30) }).strict(),
26
- z.object({ action: z.literal("revoke"), scope: ReleaseIdSchema, sourceId: ReleaseIdSchema, id: ReleaseIdSchema }).strict()
27
- ]);
28
- var LearningSourceCredentialCreatedSchema = z.object({ credential: LearningSourceCredentialSchema, apiKey: LearningSourceCredentialSecretSchema }).strict();
29
- var LearningSourceCredentialPageSchema = z.object({ items: z.array(LearningSourceCredentialSchema).max(100), nextCursor: ReleaseIdSchema.nullable() }).strict();
30
- var LearningSourceConfigurationRequestSchema = z.object({ scope: ReleaseIdSchema, sourceId: ReleaseIdSchema }).strict();
31
- var LearningSourceConfigurationSchema = z.object({
32
- scope: ReleaseIdSchema,
33
- source: LearningRevisionRefSchema,
34
- taskDefinition: LearningRevisionRefSchema,
35
- enabled: z.boolean(),
36
- allowedSplits: z.array(TaskSplitSchema).min(1).max(4)
37
- }).strict();
38
- function createSourceCredentialRequest(input) {
39
- return { ...input, operationId: crypto.randomUUID(), apiKey: `opk_key_${randomToken(16)}_${randomToken(48)}` };
40
- }
41
- function randomToken(length) {
42
- const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
43
- let value = "";
44
- while (value.length < length) {
45
- for (const byte of crypto.getRandomValues(new Uint8Array(64))) {
46
- if (byte < 248) value += alphabet[byte % 62];
47
- if (value.length === length) return value;
48
- }
49
- }
50
- return value;
51
- }
52
- function assertLearningCredentialExpiry(expiresAt, now) {
53
- const expires = Date.parse(z.iso.datetime().parse(expiresAt));
54
- if (expires <= now.getTime() || expires > now.getTime() + 90 * 24 * 60 * 60 * 1e3) throw new Error("Source credentials must expire within 90 days.");
55
- }
5
+ LearningSourceConfigurationRequestSchema,
6
+ LearningSourceConfigurationSchema,
7
+ LearningSourceCredentialCreatedSchema,
8
+ LearningSourceCredentialPageSchema,
9
+ LearningSourceCredentialRequestSchema,
10
+ LearningSourceCredentialSchema
11
+ } from "./chunk-IZ26ZCGU.js";
56
12
 
57
13
  // src/learning-client.ts
58
- import { z as z2 } from "zod";
14
+ import { z } from "zod";
59
15
  import {
60
16
  LearningCommandRequestSchema,
61
17
  LearningOperationResultSchema,
@@ -68,17 +24,17 @@ import {
68
24
  learningResourceSchemas
69
25
  } from "@openpond/evals/learning";
70
26
  import { assertBoundedTaskJson } from "@openpond/evals/task-schema";
71
- var LearningBatchPublicationSchema = z2.object({
72
- batchId: z2.string().trim().min(1).max(500),
73
- modelProjectId: z2.string().trim().min(1).max(500)
27
+ var LearningBatchPublicationSchema = z.object({
28
+ batchId: z.string().trim().min(1).max(500),
29
+ modelProjectId: z.string().trim().min(1).max(500)
74
30
  }).strict();
75
- var LearningBatchPublicationResultSchema = z2.object({
76
- batchId: z2.string().min(1),
77
- projectId: z2.string().min(1),
78
- tasksetId: z2.string().min(1),
79
- releaseId: z2.string().min(1),
80
- revision: z2.number().int().positive(),
81
- contentHash: z2.string().regex(/^[a-f0-9]{64}$/)
31
+ var LearningBatchPublicationResultSchema = z.object({
32
+ batchId: z.string().min(1),
33
+ projectId: z.string().min(1),
34
+ tasksetId: z.string().min(1),
35
+ releaseId: z.string().min(1),
36
+ revision: z.number().int().positive(),
37
+ contentHash: z.string().regex(/^[a-f0-9]{64}$/)
82
38
  }).strict();
83
39
  var OpenPondLearningClient = class {
84
40
  #options;
@@ -158,7 +114,7 @@ var OpenPondLearningClient = class {
158
114
  }
159
115
  async list(kind, query = {}, options = {}) {
160
116
  const request = LearningReadRequestSchema.parse({ action: "list", scope: this.#options.scope, kind, ...query });
161
- return z2.object({ items: z2.array(learningResourceSchemas[kind]).max(100), nextCursor: z2.string().nullable() }).strict().parse(await this.#request("read", request, options));
117
+ return z.object({ items: z.array(learningResourceSchemas[kind]).max(100), nextCursor: z.string().nullable() }).strict().parse(await this.#request("read", request, options));
162
118
  }
163
119
  /** Hosted publication only: stores an immutable package and attaches it, without starting training. */
164
120
  async publishBatch(input, options = {}) {
@@ -178,7 +134,7 @@ var OpenPondLearningClient = class {
178
134
  });
179
135
  const payload = await readBoundedLearningResponse(response);
180
136
  if (!response.ok) {
181
- const error = z2.object({ code: z2.string().optional(), error: z2.string().optional() }).passthrough().safeParse(payload);
137
+ const error = z.object({ code: z.string().optional(), error: z.string().optional() }).passthrough().safeParse(payload);
182
138
  throw new OpenPondLearningError(response.status, error.success ? error.data.code ?? "learning_request_failed" : "learning_request_failed", error.success ? error.data.error ?? `Learning request failed (${response.status}).` : `Learning request failed (${response.status}).`, payload);
183
139
  }
184
140
  return payload;
@@ -210,18 +166,9 @@ async function readBoundedLearningResponse(response) {
210
166
  }
211
167
 
212
168
  export {
213
- LearningSourceCredentialSchema,
214
- LearningSourceCredentialSecretSchema,
215
- LearningSourceCredentialRequestSchema,
216
- LearningSourceCredentialCreatedSchema,
217
- LearningSourceCredentialPageSchema,
218
- LearningSourceConfigurationRequestSchema,
219
- LearningSourceConfigurationSchema,
220
- createSourceCredentialRequest,
221
- assertLearningCredentialExpiry,
222
169
  LearningBatchPublicationSchema,
223
170
  LearningBatchPublicationResultSchema,
224
171
  OpenPondLearningClient,
225
172
  readBoundedLearningResponse
226
173
  };
227
- //# sourceMappingURL=chunk-RYDUAY52.js.map
174
+ //# sourceMappingURL=chunk-C3TS766N.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/learning-client.ts"],"sourcesContent":["import { OpenPondLearningError } from \"./learning-error.js\";\nexport { OpenPondLearningError } from \"./learning-error.js\";\nimport { z } from \"zod\";\nimport {\n LearningCommandRequestSchema, LearningOperationResultSchema, LearningReadRequestSchema,\n TaskEvidenceInspectionResultSchema, sameLearningRef, type LearningRevisionRef,\n LearningPolicyInspectionResultSchema,\n LearningTaskQueueInspectionSchema,\n assertLearningRequestJson,\n learningResourceSchemas, type LearningCommand, type LearningOperationResult,\n type LearningResourceFor, type LearningResourceKind, type LearningResourcePage,\n type LearningResourceQuery, type TaskExampleSubmission, type TaskFeedbackSubmission,\n} from \"@openpond/evals/learning\";\nimport { assertBoundedTaskJson } from \"@openpond/evals/task-schema\";\nimport { LearningSourceCredentialSchema, LearningSourceCredentialRequestSchema, LearningSourceCredentialCreatedSchema, LearningSourceCredentialPageSchema, LearningSourceConfigurationRequestSchema, LearningSourceConfigurationSchema, type LearningSourceCredentialRequest } from \"./learning-credentials.js\";\n\nexport interface OpenPondLearningClientOptions {\n apiKey: string;\n baseUrl: string;\n /** Local profile or hosted team scope. The server checks the credential's ownership. */\n scope: string;\n fetch?: typeof globalThis.fetch;\n}\nexport interface LearningRequestOptions { signal?: AbortSignal }\nexport const LearningBatchPublicationSchema = z.object({\n batchId: z.string().trim().min(1).max(500), modelProjectId: z.string().trim().min(1).max(500),\n}).strict();\nexport const LearningBatchPublicationResultSchema = z.object({\n batchId: z.string().min(1), projectId: z.string().min(1), tasksetId: z.string().min(1),\n releaseId: z.string().min(1), revision: z.number().int().positive(), contentHash: z.string().regex(/^[a-f0-9]{64}$/),\n}).strict();\n/** The same portable commands are sent to the local and hosted execution owner. */\nexport class OpenPondLearningClient {\n readonly #options: OpenPondLearningClientOptions;\n constructor(options: OpenPondLearningClientOptions) {\n if (!options.apiKey.trim() || !options.scope.trim()) throw new Error(\"Learning API key and scope are required.\");\n const url = new URL(options.baseUrl);\n if (![\"http:\", \"https:\"].includes(url.protocol) || url.username || url.password || url.search || url.hash) throw new Error(\"Learning base URL must be an HTTP(S) endpoint without credentials, query, or fragment.\");\n this.#options = { ...options, baseUrl: url.toString().replace(/\\/+$/, \"\") };\n }\n\n async command(command: LearningCommand, options: LearningRequestOptions = {}): Promise<LearningOperationResult> {\n assertLearningRequestJson(command);\n const request = LearningCommandRequestSchema.parse({ scope: this.#options.scope, command });\n const result = LearningOperationResultSchema.parse(await this.#request(\"commands\", request, options));\n if (result.operationId !== command.operationId) throw new OpenPondLearningError(502, \"operation_identity_mismatch\", \"Learning response did not match the submitted operation.\", null);\n return result;\n }\n\n submitExample(example: TaskExampleSubmission, options: LearningRequestOptions = {}) {\n return this.command({ action: \"submit_example\", operationId: example.idempotencyKey, example }, options);\n }\n\n submitFeedback(feedback: TaskFeedbackSubmission, options: LearningRequestOptions = {}) {\n return this.command({ action: \"submit_feedback\", operationId: feedback.idempotencyKey, feedback }, options);\n }\n\n async get<K extends LearningResourceKind>(kind: K, id: string, revision?: number, options: LearningRequestOptions = {}): Promise<LearningResourceFor<K>> {\n const request = LearningReadRequestSchema.parse({ action: \"get\", scope: this.#options.scope, kind, id, ...(revision === undefined ? {} : { revision }) });\n return learningResourceSchemas[kind].parse(await this.#request(\"read\", request, options)) as LearningResourceFor<K>;\n }\n\n async inspectEvidence(evidence: LearningRevisionRef, options: LearningRequestOptions = {}) {\n const request = LearningReadRequestSchema.parse({ action: \"inspect_evidence\", scope: this.#options.scope, evidence });\n const result = TaskEvidenceInspectionResultSchema.parse(await this.#request(\"read\", request, options));\n if (!sameLearningRef(result.evidence, evidence)) throw new OpenPondLearningError(502, \"evidence_identity_mismatch\", \"Inspection did not match the requested evidence release.\", null);\n return result;\n }\n\n /** Read current shared eligibility and budget without reserving or launching work. */\n async inspectTaskQueue(modelProjectId: string | null = null, options: LearningRequestOptions = {}) {\n const request = LearningReadRequestSchema.parse({ action: \"inspect_task_queue\", scope: this.#options.scope, modelProjectId });\n const result = LearningTaskQueueInspectionSchema.parse(await this.#request(\"read\", request, options));\n if (result.modelProjectId !== modelProjectId) throw new OpenPondLearningError(502, \"model_identity_mismatch\", \"Task queue did not match the requested Model.\", null);\n return result;\n }\n\n /** Read current shared eligibility and budget without reserving or launching work. */\n async inspectPolicy(policy: LearningRevisionRef, options: LearningRequestOptions = {}) {\n const request = LearningReadRequestSchema.parse({ action: \"inspect_policy\", scope: this.#options.scope, policy });\n const result = LearningPolicyInspectionResultSchema.parse(await this.#request(\"read\", request, options));\n if (!sameLearningRef(result.policy, policy)) throw new OpenPondLearningError(502, \"policy_identity_mismatch\", \"Inspection did not match the requested policy release.\", null);\n return result;\n }\n\n /** Prepare once with createSourceCredentialRequest and reuse it for retries. */\n async createSourceCredential(input: Omit<Extract<LearningSourceCredentialRequest, { action: \"create\" }>, \"action\" | \"scope\">, options: LearningRequestOptions = {}) {\n const request = LearningSourceCredentialRequestSchema.parse({ ...input, action: \"create\", scope: this.#options.scope });\n const result = LearningSourceCredentialCreatedSchema.parse(await this.#request(\"credentials\", request, options));\n this.#assertCredentialScope(result.credential, input.sourceId);\n if (result.apiKey !== input.apiKey || !input.apiKey.startsWith(`${result.credential.keyPrefix}_`)) throw new OpenPondLearningError(502, \"credential_identity_mismatch\", \"Credential response did not match the prepared credential.\", null);\n return result;\n }\n\n async listSourceCredentials(sourceId: string, query: { afterId?: string; limit?: number } = {}, options: LearningRequestOptions = {}) {\n const request = LearningSourceCredentialRequestSchema.parse({ ...query, action: \"list\", scope: this.#options.scope, sourceId });\n const result = LearningSourceCredentialPageSchema.parse(await this.#request(\"credentials\", request, options));\n if (result.items.length > (query.limit ?? 30)) throw new OpenPondLearningError(502, \"credential_page_invalid\", \"Credential response exceeded the requested page size.\", null);\n for (const item of result.items) this.#assertCredentialScope(item, sourceId);\n return result;\n }\n\n async revokeSourceCredential(sourceId: string, id: string, options: LearningRequestOptions = {}) {\n const request = LearningSourceCredentialRequestSchema.parse({ action: \"revoke\", scope: this.#options.scope, sourceId, id });\n const result = LearningSourceCredentialSchema.parse(await this.#request(\"credentials\", request, options));\n this.#assertCredentialScope(result, sourceId);\n if (result.id !== id || result.revokedAt === null) throw new OpenPondLearningError(502, \"credential_revocation_mismatch\", \"Credential revocation did not match the requested credential.\", null);\n return result;\n }\n\n async sourceConfiguration(sourceId: string, options: LearningRequestOptions = {}) {\n const request = LearningSourceConfigurationRequestSchema.parse({ scope: this.#options.scope, sourceId });\n const result = LearningSourceConfigurationSchema.parse(await this.#request(\"source-config\", request, options));\n if (result.scope !== this.#options.scope || result.source.id !== sourceId) throw new OpenPondLearningError(502, \"source_identity_mismatch\", \"Source configuration did not match the requested source.\", null);\n return result;\n }\n\n #assertCredentialScope(value: { scope: string; sourceId: string }, sourceId: string) {\n if (value.scope !== this.#options.scope || value.sourceId !== sourceId) throw new OpenPondLearningError(502, \"credential_scope_mismatch\", \"Credential response did not match the requested source.\", null);\n }\n\n async list<K extends LearningResourceKind>(kind: K, query: Partial<LearningResourceQuery> = {}, options: LearningRequestOptions = {}): Promise<LearningResourcePage<K>> {\n const request = LearningReadRequestSchema.parse({ action: \"list\", scope: this.#options.scope, kind, ...query });\n return z.object({ items: z.array(learningResourceSchemas[kind]).max(100), nextCursor: z.string().nullable() }).strict().parse(await this.#request(\"read\", request, options)) as LearningResourcePage<K>;\n }\n\n /** Hosted publication only: stores an immutable package and attaches it, without starting training. */\n async publishBatch(input: z.infer<typeof LearningBatchPublicationSchema>, options: LearningRequestOptions = {}) {\n const request = LearningBatchPublicationSchema.parse(input);\n const result = LearningBatchPublicationResultSchema.parse(await this.#request(\"publish-batch\", { ...request, scope: this.#options.scope }, options));\n if (result.batchId !== request.batchId) throw new OpenPondLearningError(502, \"batch_identity_mismatch\", \"Published batch response did not match the requested batch.\", null);\n return result;\n }\n\n async #request(endpoint: \"commands\" | \"read\" | \"publish-batch\" | \"credentials\" | \"source-config\", body: unknown, options: LearningRequestOptions): Promise<unknown> {\n assertBoundedTaskJson(body, 16_777_216);\n const response = await (this.#options.fetch ?? globalThis.fetch)(`${this.#options.baseUrl}/v1/learning/${endpoint}`, {\n method: \"POST\", headers: { Authorization: `Bearer ${this.#options.apiKey}`, \"Content-Type\": \"application/json\", Accept: \"application/json\", \"X-OpenPond-Team-Id\": this.#options.scope }, body: JSON.stringify(body), signal: options.signal,\n redirect: \"error\",\n });\n const payload = await readBoundedLearningResponse(response);\n if (!response.ok) {\n const error = z.object({ code: z.string().optional(), error: z.string().optional() }).passthrough().safeParse(payload);\n throw new OpenPondLearningError(response.status, error.success ? error.data.code ?? \"learning_request_failed\" : \"learning_request_failed\", error.success ? error.data.error ?? `Learning request failed (${response.status}).` : `Learning request failed (${response.status}).`, payload);\n }\n return payload;\n }\n}\n\nexport async function readBoundedLearningResponse(response: Response): Promise<unknown> {\n const maximumBytes = 16_777_216;\n const reader = response.body?.getReader();\n if (!reader) throw new OpenPondLearningError(response.status, \"empty_response\", \"Learning response was empty.\", null);\n const decoder = new TextDecoder();\n let bytes = 0;\n let text = \"\";\n try {\n while (true) {\n const next = await reader.read();\n if (next.done) break;\n bytes += next.value.byteLength;\n if (bytes > maximumBytes) throw new OpenPondLearningError(response.status, \"response_too_large\", \"Learning response exceeded 16 MiB; request a smaller page.\", null);\n text += decoder.decode(next.value, { stream: true });\n }\n text += decoder.decode();\n const value: unknown = JSON.parse(text);\n assertBoundedTaskJson(value, maximumBytes);\n return value;\n } finally {\n await reader.cancel();\n reader.releaseLock();\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAEA,SAAS,SAAS;AAClB;AAAA,EACE;AAAA,EAA8B;AAAA,EAA+B;AAAA,EAC7D;AAAA,EAAoC;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AACP,SAAS,6BAA6B;AAW/B,IAAM,iCAAiC,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AM,UAAU,MAAM,KAAK,SAAS,4BAA4B,SAAS,MAAM,OAAO,4BAA4B,SAAS,MAAM,MAAM,OAAO;AAAA,IAC3R;AACA,WAAO;AAAA,EACT;AACF;AAEA,eAAsB,4BAA4B,UAAsC;AACtF,QAAM,eAAe;AACrB,QAAM,SAAS,SAAS,MAAM,UAAU;AACxC,MAAI,CAAC,OAAQ,OAAM,IAAI,sBAAsB,SAAS,QAAQ,kBAAkB,gCAAgC,IAAI;AACpH,QAAM,UAAU,IAAI,YAAY;AAChC,MAAI,QAAQ;AACZ,MAAI,OAAO;AACX,MAAI;AACF,WAAO,MAAM;AACX,YAAM,OAAO,MAAM,OAAO,KAAK;AAC/B,UAAI,KAAK,KAAM;AACf,eAAS,KAAK,MAAM;AACpB,UAAI,QAAQ,aAAc,OAAM,IAAI,sBAAsB,SAAS,QAAQ,sBAAsB,8DAA8D,IAAI;AACnK,cAAQ,QAAQ,OAAO,KAAK,OAAO,EAAE,QAAQ,KAAK,CAAC;AAAA,IACrD;AACA,YAAQ,QAAQ,OAAO;AACvB,UAAM,QAAiB,KAAK,MAAM,IAAI;AACtC,0BAAsB,OAAO,YAAY;AACzC,WAAO;AAAA,EACT,UAAE;AACA,UAAM,OAAO,OAAO;AACpB,WAAO,YAAY;AAAA,EACrB;AACF;","names":[]}
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  HarnessExperimentPolicySchema,
3
3
  ModelTasksetRunRequestSchema
4
- } from "./chunk-IIQENUOK.js";
4
+ } from "./chunk-ZYDDHHZZ.js";
5
5
  import {
6
6
  contentHash
7
7
  } from "./chunk-H3JZ3P5T.js";
@@ -172,4 +172,4 @@ export {
172
172
  verifyExperimentDefinition,
173
173
  experimentDefinitionRef
174
174
  };
175
- //# sourceMappingURL=chunk-HDKP6KE2.js.map
175
+ //# sourceMappingURL=chunk-C4W2MEFP.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  RunExperimentSchema
3
- } from "./chunk-7FYPFHCQ.js";
3
+ } from "./chunk-K54BDIKL.js";
4
4
  import {
5
5
  contentHash
6
6
  } from "./chunk-H3JZ3P5T.js";
@@ -136,4 +136,4 @@ export {
136
136
  CandidateEvaluationPreparationSchema,
137
137
  CandidateEvaluationControlSchema
138
138
  };
139
- //# sourceMappingURL=chunk-XJKGCU2K.js.map
139
+ //# sourceMappingURL=chunk-CNREFTAV.js.map
@@ -11,7 +11,7 @@ import {
11
11
  TasksetPreferenceComparisonBindingSchema,
12
12
  TasksetPurposeSchema,
13
13
  TasksetSourceRefSchema
14
- } from "./chunk-7WKCQ4V5.js";
14
+ } from "./chunk-IFBCLRBM.js";
15
15
  import {
16
16
  ModelTasksetDraftPreparationSchema
17
17
  } from "./chunk-TK3DXH7A.js";
@@ -910,4 +910,4 @@ export {
910
910
  computeTasksetHash,
911
911
  validatePortability
912
912
  };
913
- //# sourceMappingURL=chunk-UAYXORU5.js.map
913
+ //# sourceMappingURL=chunk-GHPCQXG5.js.map
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  TrainingHandoffOriginSchema,
9
9
  createPostTrainingClient
10
- } from "./chunk-5QMREXMU.js";
10
+ } from "./chunk-7BYLH47N.js";
11
11
  import {
12
12
  validateHarnessPolicySourcePackage,
13
13
  validateHarnessSourcePackage
@@ -20,7 +20,7 @@ import {
20
20
  TrainingEstimateReviewSchema,
21
21
  TrainingGpuCatalogSchema,
22
22
  TrainingGpuSelectionSchema
23
- } from "./chunk-BQ2C2Y54.js";
23
+ } from "./chunk-UOV2LEXS.js";
24
24
  import {
25
25
  OpenPondProtocolError,
26
26
  TRAINING_API_RESPONSE_MAX_BYTES,
@@ -1525,4 +1525,4 @@ export {
1525
1525
  TrainingCapabilitiesSchema,
1526
1526
  createTrainingClient
1527
1527
  };
1528
- //# sourceMappingURL=chunk-WOD72SFI.js.map
1528
+ //# sourceMappingURL=chunk-GJRXJL6G.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-3B5KSH3V.js";
4
4
  import {
5
5
  RunExperimentSchema
6
- } from "./chunk-7FYPFHCQ.js";
6
+ } from "./chunk-K54BDIKL.js";
7
7
  import {
8
8
  ImmutableReleaseRefSchema,
9
9
  assertContentHash,
@@ -171,4 +171,4 @@ export {
171
171
  ExperimentEvaluationScheduleCommandSchema,
172
172
  OpenPondExperimentEvaluationScheduleClient
173
173
  };
174
- //# sourceMappingURL=chunk-GRQWKATA.js.map
174
+ //# sourceMappingURL=chunk-HAQPGTQ4.js.map
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-H3367ISL.js";
7
7
  import {
8
8
  ModelProjectVersionedRefSchema
9
- } from "./chunk-BQ2C2Y54.js";
9
+ } from "./chunk-UOV2LEXS.js";
10
10
  import {
11
11
  canonicalJson as canonicalJson2
12
12
  } from "./chunk-B3ZHJ2KK.js";
@@ -8942,4 +8942,4 @@ export {
8942
8942
  createTasksetPackage,
8943
8943
  resolveTasksetWorkOutputs
8944
8944
  };
8945
- //# sourceMappingURL=chunk-7WKCQ4V5.js.map
8945
+ //# sourceMappingURL=chunk-IFBCLRBM.js.map
@@ -0,0 +1,65 @@
1
+ import {
2
+ ReleaseIdSchema
3
+ } from "./chunk-H3JZ3P5T.js";
4
+
5
+ // src/learning-credentials.ts
6
+ import { z } from "zod";
7
+ import { LearningRevisionRefSchema } from "@openpond/evals/learning";
8
+ import { TaskSplitSchema } from "@openpond/evals/tasksets";
9
+ var LearningSourceCredentialSchema = z.object({
10
+ id: ReleaseIdSchema,
11
+ scope: ReleaseIdSchema,
12
+ sourceId: ReleaseIdSchema,
13
+ name: z.string().trim().min(1).max(100),
14
+ keyPrefix: z.string().min(1).max(100),
15
+ createdAt: z.iso.datetime(),
16
+ expiresAt: z.iso.datetime(),
17
+ revokedAt: z.iso.datetime().nullable()
18
+ }).strict();
19
+ var LearningSourceCredentialSecretSchema = z.string().regex(/^opk_key_[A-Za-z0-9]{16}_[A-Za-z0-9]{48}$/);
20
+ var LearningSourceCredentialRequestSchema = z.discriminatedUnion("action", [
21
+ z.object({ action: z.literal("create"), scope: ReleaseIdSchema, sourceId: ReleaseIdSchema, name: z.string().trim().min(1).max(100), expiresAt: z.iso.datetime(), operationId: ReleaseIdSchema, apiKey: LearningSourceCredentialSecretSchema }).strict(),
22
+ z.object({ action: z.literal("list"), scope: ReleaseIdSchema, sourceId: ReleaseIdSchema, afterId: ReleaseIdSchema.optional(), limit: z.number().int().min(1).max(100).default(30) }).strict(),
23
+ z.object({ action: z.literal("revoke"), scope: ReleaseIdSchema, sourceId: ReleaseIdSchema, id: ReleaseIdSchema }).strict()
24
+ ]);
25
+ var LearningSourceCredentialCreatedSchema = z.object({ credential: LearningSourceCredentialSchema, apiKey: LearningSourceCredentialSecretSchema }).strict();
26
+ var LearningSourceCredentialPageSchema = z.object({ items: z.array(LearningSourceCredentialSchema).max(100), nextCursor: ReleaseIdSchema.nullable() }).strict();
27
+ var LearningSourceConfigurationRequestSchema = z.object({ scope: ReleaseIdSchema, sourceId: ReleaseIdSchema }).strict();
28
+ var LearningSourceConfigurationSchema = z.object({
29
+ scope: ReleaseIdSchema,
30
+ source: LearningRevisionRefSchema,
31
+ taskDefinition: LearningRevisionRefSchema,
32
+ enabled: z.boolean(),
33
+ allowedSplits: z.array(TaskSplitSchema).min(1).max(4)
34
+ }).strict();
35
+ function createSourceCredentialRequest(input) {
36
+ return { ...input, operationId: crypto.randomUUID(), apiKey: `opk_key_${randomToken(16)}_${randomToken(48)}` };
37
+ }
38
+ function randomToken(length) {
39
+ const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
40
+ let value = "";
41
+ while (value.length < length) {
42
+ for (const byte of crypto.getRandomValues(new Uint8Array(64))) {
43
+ if (byte < 248) value += alphabet[byte % 62];
44
+ if (value.length === length) return value;
45
+ }
46
+ }
47
+ return value;
48
+ }
49
+ function assertLearningCredentialExpiry(expiresAt, now) {
50
+ const expires = Date.parse(z.iso.datetime().parse(expiresAt));
51
+ if (expires <= now.getTime() || expires > now.getTime() + 90 * 24 * 60 * 60 * 1e3) throw new Error("Source credentials must expire within 90 days.");
52
+ }
53
+
54
+ export {
55
+ LearningSourceCredentialSchema,
56
+ LearningSourceCredentialSecretSchema,
57
+ LearningSourceCredentialRequestSchema,
58
+ LearningSourceCredentialCreatedSchema,
59
+ LearningSourceCredentialPageSchema,
60
+ LearningSourceConfigurationRequestSchema,
61
+ LearningSourceConfigurationSchema,
62
+ createSourceCredentialRequest,
63
+ assertLearningCredentialExpiry
64
+ };
65
+ //# sourceMappingURL=chunk-IZ26ZCGU.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/learning-credentials.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { ReleaseIdSchema } from \"@openpond/harness\";\nimport { LearningRevisionRefSchema } from \"@openpond/evals/learning\";\nimport { TaskSplitSchema } from \"@openpond/evals/tasksets\";\n\n/** Source credentials can submit evidence and feedback for one source only. */\nexport const LearningSourceCredentialSchema = z.object({\n id: ReleaseIdSchema,\n scope: ReleaseIdSchema,\n sourceId: ReleaseIdSchema,\n name: z.string().trim().min(1).max(100),\n keyPrefix: z.string().min(1).max(100),\n createdAt: z.iso.datetime(),\n expiresAt: z.iso.datetime(),\n revokedAt: z.iso.datetime().nullable(),\n}).strict();\nexport type LearningSourceCredential = z.infer<typeof LearningSourceCredentialSchema>;\nexport const LearningSourceCredentialSecretSchema = z.string().regex(/^opk_key_[A-Za-z0-9]{16}_[A-Za-z0-9]{48}$/);\n\nexport const LearningSourceCredentialRequestSchema = z.discriminatedUnion(\"action\", [\n z.object({ action: z.literal(\"create\"), scope: ReleaseIdSchema, sourceId: ReleaseIdSchema, name: z.string().trim().min(1).max(100), expiresAt: z.iso.datetime(), operationId: ReleaseIdSchema, apiKey: LearningSourceCredentialSecretSchema }).strict(),\n z.object({ action: z.literal(\"list\"), scope: ReleaseIdSchema, sourceId: ReleaseIdSchema, afterId: ReleaseIdSchema.optional(), limit: z.number().int().min(1).max(100).default(30) }).strict(),\n z.object({ action: z.literal(\"revoke\"), scope: ReleaseIdSchema, sourceId: ReleaseIdSchema, id: ReleaseIdSchema }).strict(),\n]);\nexport type LearningSourceCredentialRequest = z.infer<typeof LearningSourceCredentialRequestSchema>;\nexport const LearningSourceCredentialCreatedSchema = z.object({ credential: LearningSourceCredentialSchema, apiKey: LearningSourceCredentialSecretSchema }).strict();\nexport const LearningSourceCredentialPageSchema = z.object({ items: z.array(LearningSourceCredentialSchema).max(100), nextCursor: ReleaseIdSchema.nullable() }).strict();\nexport const LearningSourceConfigurationRequestSchema = z.object({ scope: ReleaseIdSchema, sourceId: ReleaseIdSchema }).strict();\nexport const LearningSourceConfigurationSchema = z.object({\n scope: ReleaseIdSchema, source: LearningRevisionRefSchema, taskDefinition: LearningRevisionRefSchema,\n enabled: z.boolean(), allowedSplits: z.array(TaskSplitSchema).min(1).max(4),\n}).strict();\n\n/** Keep this request in memory for retries. Hosts persist hashes, never its secret. */\nexport function createSourceCredentialRequest(input: { sourceId: string; name: string; expiresAt: string }) {\n return { ...input, operationId: crypto.randomUUID(), apiKey: `opk_key_${randomToken(16)}_${randomToken(48)}` };\n}\n\nfunction randomToken(length: number): string {\n const alphabet = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\n let value = \"\";\n while (value.length < length) {\n for (const byte of crypto.getRandomValues(new Uint8Array(64))) {\n // Rejection sampling avoids modulo bias in the 62-character alphabet.\n if (byte < 248) value += alphabet[byte % 62];\n if (value.length === length) return value;\n }\n }\n return value;\n}\n\n/** Hosts enforce expiry when issuing and authenticating; tokens are never permanent. */\nexport function assertLearningCredentialExpiry(expiresAt: string, now: Date): void {\n const expires = Date.parse(z.iso.datetime().parse(expiresAt));\n if (expires <= now.getTime() || expires > now.getTime() + 90 * 24 * 60 * 60 * 1_000) throw new Error(\"Source credentials must expire within 90 days.\");\n}\n"],"mappings":";;;;;AAAA,SAAS,SAAS;AAElB,SAAS,iCAAiC;AAC1C,SAAS,uBAAuB;A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Schema,
@@ -11,7 +11,7 @@ import {
11
11
  decodeTasksetPackageFile,
12
12
  resolveTasksetPackageInstructions,
13
13
  validateTasksetPackage
14
- } from "./chunk-7WKCQ4V5.js";
14
+ } from "./chunk-IFBCLRBM.js";
15
15
  import {
16
16
  contentHash
17
17
  } from "./chunk-H3JZ3P5T.js";
@@ -266,4 +266,4 @@ export {
266
266
  prepareImportedTasksetPackage,
267
267
  tasksetPackageSourceId
268
268
  };
269
- //# sourceMappingURL=chunk-ICFFZ4WC.js.map
269
+ //# sourceMappingURL=chunk-JBYFD3QS.js.map
@@ -5,10 +5,10 @@ import {
5
5
  computeTasksetHash,
6
6
  draftPublishIssues,
7
7
  validateTaskset
8
- } from "./chunk-UAYXORU5.js";
8
+ } from "./chunk-GHPCQXG5.js";
9
9
  import {
10
10
  TaskDataRecordSchema
11
- } from "./chunk-7WKCQ4V5.js";
11
+ } from "./chunk-IFBCLRBM.js";
12
12
  import {
13
13
  TasksetDraftFileContentSchema,
14
14
  TasksetDraftFileMutationSchema,
@@ -487,4 +487,4 @@ export {
487
487
  tasksetDraftFromTaskset,
488
488
  publishTasksetDraft
489
489
  };
490
- //# sourceMappingURL=chunk-4L556MYM.js.map
490
+ //# sourceMappingURL=chunk-JDQVAG3R.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  ExperimentGraderSelectionSchema
3
- } from "./chunk-HDKP6KE2.js";
3
+ } from "./chunk-C4W2MEFP.js";
4
4
  import {
5
5
  ModelTasksetRunRequestSchema
6
- } from "./chunk-IIQENUOK.js";
6
+ } from "./chunk-ZYDDHHZZ.js";
7
7
 
8
8
  // src/experiment-run-contracts.ts
9
9
  import { z } from "zod";
@@ -28,4 +28,4 @@ var RunExperimentSchema = z.object({
28
28
  export {
29
29
  RunExperimentSchema
30
30
  };
31
- //# sourceMappingURL=chunk-7FYPFHCQ.js.map
31
+ //# sourceMappingURL=chunk-K54BDIKL.js.map
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  validateTasksetPackage
3
- } from "./chunk-7WKCQ4V5.js";
3
+ } from "./chunk-IFBCLRBM.js";
4
4
  import {
5
5
  RunExperimentSchema
6
- } from "./chunk-7FYPFHCQ.js";
6
+ } from "./chunk-K54BDIKL.js";
7
7
  import {
8
8
  ExperimentScoringRequestSchema,
9
9
  verifyExperimentScoringPass
10
- } from "./chunk-GIEST52U.js";
10
+ } from "./chunk-LHHHJIDR.js";
11
11
  import {
12
12
  fetchConnectedJson
13
13
  } from "./chunk-O6FKHAWN.js";
@@ -18,13 +18,13 @@ import {
18
18
  ExperimentListQuerySchema,
19
19
  PrepareHarnessExperimentSchema,
20
20
  PreparedHarnessExperimentSchema
21
- } from "./chunk-HDKP6KE2.js";
21
+ } from "./chunk-C4W2MEFP.js";
22
22
  import {
23
23
  ModelTasksetRunDetailsSchema,
24
24
  ModelTasksetRunRequestSchema,
25
25
  verifyHarnessExperimentManifest,
26
26
  verifyModelTasksetRunDetails
27
- } from "./chunk-IIQENUOK.js";
27
+ } from "./chunk-ZYDDHHZZ.js";
28
28
  import {
29
29
  ImmutableReleaseRefSchema,
30
30
  contentHash
@@ -652,4 +652,4 @@ export {
652
652
  ProfileEvaluationDiscoveryRequestSchema,
653
653
  OpenPondProfileEvaluationDiscoveryClient
654
654
  };
655
- //# sourceMappingURL=chunk-ESW25WSD.js.map
655
+ //# sourceMappingURL=chunk-KOJC3TH4.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ExperimentFieldMappingsSchema,
3
3
  ExperimentGraderPinSchema
4
- } from "./chunk-HDKP6KE2.js";
4
+ } from "./chunk-C4W2MEFP.js";
5
5
  import {
6
6
  ImmutableReleaseRefSchema,
7
7
  contentHash
@@ -67,4 +67,4 @@ export {
67
67
  ExperimentScoringPassSchema,
68
68
  verifyExperimentScoringPass
69
69
  };
70
- //# sourceMappingURL=chunk-GIEST52U.js.map
70
+ //# sourceMappingURL=chunk-LHHHJIDR.js.map
@@ -3,20 +3,20 @@ import {
3
3
  validateModelStarterExecution,
4
4
  validateModelTasksetPackage,
5
5
  validateTasksetPackage
6
- } from "./chunk-7WKCQ4V5.js";
6
+ } from "./chunk-IFBCLRBM.js";
7
7
  import {
8
8
  ModelProjectBaseModelSchema,
9
9
  ModelProjectRecipeDocumentSchema,
10
10
  ModelProjectTrainingMethodSchema,
11
11
  ModelProjectTrainingSetupSchema,
12
12
  ModelProjectVersionedRefSchema
13
- } from "./chunk-BQ2C2Y54.js";
14
- import {
15
- canonicalSha256
16
- } from "./chunk-B3ZHJ2KK.js";
13
+ } from "./chunk-UOV2LEXS.js";
17
14
  import {
18
15
  ModelInitialLearningSchema
19
16
  } from "./chunk-CL3IOOVL.js";
17
+ import {
18
+ canonicalSha256
19
+ } from "./chunk-B3ZHJ2KK.js";
20
20
  import {
21
21
  contentHash
22
22
  } from "./chunk-H3JZ3P5T.js";
@@ -336,4 +336,4 @@ export {
336
336
  previewModelStarter,
337
337
  validateResolvedModelStarter
338
338
  };
339
- //# sourceMappingURL=chunk-FC56EMHT.js.map
339
+ //# sourceMappingURL=chunk-NKF5NIML.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ExperimentScoringRequestSchema
3
- } from "./chunk-GIEST52U.js";
3
+ } from "./chunk-LHHHJIDR.js";
4
4
  import {
5
5
  ImmutableReleaseRefSchema,
6
6
  contentHash
@@ -141,4 +141,4 @@ export {
141
141
  verifyExperimentImprovementHumanOptions,
142
142
  sealExperimentImprovementHumanOptions
143
143
  };
144
- //# sourceMappingURL=chunk-LKKKTBLL.js.map
144
+ //# sourceMappingURL=chunk-O3NOGKMT.js.map