openpond-sdk 0.5.17 → 0.5.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/learning.js CHANGED
@@ -23,7 +23,70 @@ export * from "@openpond/evals/learning";
23
23
  export * from "@openpond/evals/rewards";
24
24
 
25
25
  // src/model-learning-policy.ts
26
- import { LearningDomainError } from "@openpond/evals/learning";
26
+ import { LearningDomainError, LearningPolicyContentSchema } from "@openpond/evals/learning";
27
+ function hostedLearningPolicyDefaults(project, policy) {
28
+ const maximumSpend = policy?.limits.maxIterationSpendUsd ?? project.trainingSetup.preferredMaximumSpendUsd ?? 1;
29
+ return {
30
+ enabled: policy?.enabled ?? false,
31
+ scheduled: policy?.trigger.kind === "schedule",
32
+ intervalSeconds: policy?.trigger.kind === "schedule" ? policy.trigger.intervalSeconds : 86400,
33
+ humanReviewRequired: policy?.admission.mode !== "qualified_automatic",
34
+ minimumApprovedExamples: policy?.admission.minimumApprovedExamples ?? 8,
35
+ maxBatchExamples: policy?.limits.maxBatchExamples ?? 8,
36
+ maxIterationSpendUsd: maximumSpend,
37
+ maxDailySpendUsd: policy?.limits.maxDailySpendUsd ?? maximumSpend,
38
+ cooldownSeconds: policy?.limits.cooldownSeconds ?? 3600,
39
+ maxRetries: policy?.limits.maxRetries ?? 0,
40
+ maxBacklogExamples: policy?.limits.maxBacklogExamples ?? 1e3
41
+ };
42
+ }
43
+ function createHostedLearningPolicyContent(input) {
44
+ const { project, previous, settings } = input;
45
+ if (previous && (previous.id !== input.policyId || previous.modelProjectId !== project.portableProjectId || previous.executionOwner !== "hosted")) {
46
+ throw new LearningDomainError("learning_policy_model_mismatch", 422, "Learning settings must belong to this hosted Model.");
47
+ }
48
+ const applyModel = input.applyModelConfiguration || !previous;
49
+ const refs = applyModel ? hostedLearningPolicyReferences(project) : null;
50
+ const method = applyModel ? project.trainingSetup.recipe?.method : previous?.training.method;
51
+ if (settings.enabled && method !== "grpo") {
52
+ throw new LearningDomainError("learning_training_method_unsupported", 422, "Hosted continual learning currently supports GRPO.");
53
+ }
54
+ return LearningPolicyContentSchema.parse({
55
+ schemaVersion: "openpond.learningPolicy.v1",
56
+ id: input.policyId,
57
+ revision: (previous?.revision ?? 0) + 1,
58
+ modelProjectId: project.portableProjectId,
59
+ executionOwner: "hosted",
60
+ enabled: settings.enabled,
61
+ sources: input.sources,
62
+ taskDefinition: input.taskDefinition,
63
+ rewardBinding: applyModel ? project.trainingSetup.rewardBindingRef : previous?.rewardBinding,
64
+ admission: {
65
+ mode: settings.humanReviewRequired ? "human" : "qualified_automatic",
66
+ qualification: settings.humanReviewRequired ? null : previous?.admission.qualification ?? null,
67
+ minimumApprovedExamples: settings.minimumApprovedExamples
68
+ },
69
+ trigger: settings.scheduled ? { kind: "schedule", intervalSeconds: settings.intervalSeconds } : { kind: "manual" },
70
+ trainingParent: refs?.trainingParent ?? previous?.trainingParent,
71
+ teacher: previous?.teacher ?? null,
72
+ training: {
73
+ method,
74
+ recipe: refs?.recipe ?? previous?.training.recipe,
75
+ retentionEvaluation: refs?.retentionEvaluation ?? previous?.training.retentionEvaluation,
76
+ replayBatches: previous?.training.replayBatches ?? []
77
+ },
78
+ limits: {
79
+ maxIterationSpendUsd: settings.maxIterationSpendUsd,
80
+ maxDailySpendUsd: settings.maxDailySpendUsd,
81
+ cooldownSeconds: settings.cooldownSeconds,
82
+ maxRetries: settings.maxRetries,
83
+ maxBatchExamples: settings.maxBatchExamples,
84
+ maxBacklogExamples: settings.maxBacklogExamples
85
+ },
86
+ automation: { collect: false, train: settings.scheduled, accept: false, serve: false },
87
+ acceptance: previous?.acceptance ?? { minimumScore: 0, maximumRetentionRegression: 0, requireImprovement: true, rollbackVersion: null }
88
+ });
89
+ }
27
90
  function hostedLearningPolicyReferences(project) {
28
91
  const setup = project.trainingSetup;
29
92
  const base = setup.baseModel ?? project.defaultBaseModel;
@@ -53,7 +116,9 @@ export {
53
116
  OpenPondLearningClient,
54
117
  OpenPondLearningError,
55
118
  assertLearningCredentialExpiry,
119
+ createHostedLearningPolicyContent,
56
120
  createSourceCredentialRequest,
121
+ hostedLearningPolicyDefaults,
57
122
  hostedLearningPolicyReferences
58
123
  };
59
124
  //# sourceMappingURL=learning.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/learning.ts", "../src/model-learning-policy.ts"],
4
- "sourcesContent": ["export * from \"@openpond/evals/learning\";\nexport * from \"@openpond/evals/rewards\";\nexport * from \"./learning-credentials.js\";\nexport * from \"./learning-client.js\";\nexport * from \"./model-learning-policy.js\";\n", "import { LearningDomainError } from \"@openpond/evals/learning\";\nimport { contentHash } from \"@openpond/harness\";\n\nimport type { HostedModelProjectSummary } from \"./model-projects.js\";\n\n/** Bind a reviewed hosted Model configuration before asynchronous preparation.\n * Keep the established recipe identity: its id binds the whole Model revision,\n * including Harness and retention selections, while its hash binds the recipe.\n * Callers must obtain the summary from the authenticated Model API. */\nexport function hostedLearningPolicyReferences(project: HostedModelProjectSummary) {\n const setup = project.trainingSetup;\n const base = setup.baseModel ?? project.defaultBaseModel;\n if (!setup.recipe || !base || !setup.evaluationTasksetRef) {\n throw new LearningDomainError(\"learning_model_configuration_incomplete\", 422,\n \"Select a training recipe, starting model and retained evaluation before enabling hosted learning.\");\n }\n return {\n recipe: { id: `model-recipe-${project.etag}`, contentHash: contentHash(setup.recipe) },\n trainingParent: { id: base.modelId, contentHash: contentHash(base) },\n retentionEvaluation: { id: setup.evaluationTasksetRef.id, contentHash: setup.evaluationTasksetRef.contentHash },\n };\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA,cAAc;AACd,cAAc;;;ACDd,SAAS,2BAA2B;AAS7B,SAAS,+BAA+B,SAAoC;AACjF,QAAM,QAAQ,QAAQ;AACtB,QAAM,OAAO,MAAM,aAAa,QAAQ;AACxC,MAAI,CAAC,MAAM,UAAU,CAAC,QAAQ,CAAC,MAAM,sBAAsB;AACzD,UAAM,IAAI;AAAA,MAAoB;AAAA,MAA2C;AAAA,MACvE;AAAA,IAAmG;AAAA,EACvG;AACA,SAAO;AAAA,IACL,QAAQ,EAAE,IAAI,gBAAgB,QAAQ,IAAI,IAAI,aAAa,YAAY,MAAM,MAAM,EAAE;AAAA,IACrF,gBAAgB,EAAE,IAAI,KAAK,SAAS,aAAa,YAAY,IAAI,EAAE;AAAA,IACnE,qBAAqB,EAAE,IAAI,MAAM,qBAAqB,IAAI,aAAa,MAAM,qBAAqB,YAAY;AAAA,EAChH;AACF;",
4
+ "sourcesContent": ["export * from \"@openpond/evals/learning\";\nexport * from \"@openpond/evals/rewards\";\nexport * from \"./learning-credentials.js\";\nexport * from \"./learning-client.js\";\nexport * from \"./model-learning-policy.js\";\n", "import { LearningDomainError, LearningPolicyContentSchema, type LearningPolicy, type LearningRevisionRef } from \"@openpond/evals/learning\";\nimport { contentHash } from \"@openpond/harness\";\n\nimport type { HostedModelProjectSummary } from \"./model-projects.js\";\n\n/** Shared starting values for both Model clients. Existing policies retain\n * their exact limits; opening settings must never silently increase spending. */\nexport function hostedLearningPolicyDefaults(project: HostedModelProjectSummary, policy: LearningPolicy | null) {\n const maximumSpend = policy?.limits.maxIterationSpendUsd ?? project.trainingSetup.preferredMaximumSpendUsd ?? 1;\n return {\n enabled: policy?.enabled ?? false,\n scheduled: policy?.trigger.kind === \"schedule\",\n intervalSeconds: policy?.trigger.kind === \"schedule\" ? policy.trigger.intervalSeconds : 86_400,\n humanReviewRequired: policy?.admission.mode !== \"qualified_automatic\",\n minimumApprovedExamples: policy?.admission.minimumApprovedExamples ?? 8,\n maxBatchExamples: policy?.limits.maxBatchExamples ?? 8,\n maxIterationSpendUsd: maximumSpend,\n maxDailySpendUsd: policy?.limits.maxDailySpendUsd ?? maximumSpend,\n cooldownSeconds: policy?.limits.cooldownSeconds ?? 3_600,\n maxRetries: policy?.limits.maxRetries ?? 0,\n maxBacklogExamples: policy?.limits.maxBacklogExamples ?? 1_000,\n };\n}\n\nexport interface HostedLearningPolicySettings {\n enabled: boolean;\n scheduled: boolean;\n intervalSeconds: number;\n humanReviewRequired: boolean;\n minimumApprovedExamples: number;\n maxBatchExamples: number;\n maxIterationSpendUsd: number;\n maxDailySpendUsd: number;\n cooldownSeconds: number;\n maxRetries: number;\n maxBacklogExamples: number;\n}\n\n/** Compile reviewed settings without following mutable Model configuration\n * unless the caller explicitly chooses to apply it. Publication still owns\n * authorization, revision comparison and source/qualification validation. */\nexport function createHostedLearningPolicyContent(input: {\n project: HostedModelProjectSummary;\n previous: LearningPolicy | null;\n policyId: string;\n applyModelConfiguration: boolean;\n sources: LearningRevisionRef[];\n taskDefinition: LearningRevisionRef;\n settings: HostedLearningPolicySettings;\n}) {\n const { project, previous, settings } = input;\n if (previous && (previous.id !== input.policyId || previous.modelProjectId !== project.portableProjectId || previous.executionOwner !== \"hosted\")) {\n throw new LearningDomainError(\"learning_policy_model_mismatch\", 422, \"Learning settings must belong to this hosted Model.\");\n }\n const applyModel = input.applyModelConfiguration || !previous;\n const refs = applyModel ? hostedLearningPolicyReferences(project) : null;\n const method = applyModel ? project.trainingSetup.recipe?.method : previous?.training.method;\n if (settings.enabled && method !== \"grpo\") {\n throw new LearningDomainError(\"learning_training_method_unsupported\", 422, \"Hosted continual learning currently supports GRPO.\");\n }\n return LearningPolicyContentSchema.parse({\n schemaVersion: \"openpond.learningPolicy.v1\", id: input.policyId, revision: (previous?.revision ?? 0) + 1,\n modelProjectId: project.portableProjectId, executionOwner: \"hosted\", enabled: settings.enabled,\n sources: input.sources, taskDefinition: input.taskDefinition,\n rewardBinding: applyModel ? project.trainingSetup.rewardBindingRef : previous?.rewardBinding,\n admission: { mode: settings.humanReviewRequired ? \"human\" : \"qualified_automatic\",\n qualification: settings.humanReviewRequired ? null : previous?.admission.qualification ?? null,\n minimumApprovedExamples: settings.minimumApprovedExamples },\n trigger: settings.scheduled ? { kind: \"schedule\", intervalSeconds: settings.intervalSeconds } : { kind: \"manual\" },\n trainingParent: refs?.trainingParent ?? previous?.trainingParent,\n teacher: previous?.teacher ?? null,\n training: { method, recipe: refs?.recipe ?? previous?.training.recipe,\n retentionEvaluation: refs?.retentionEvaluation ?? previous?.training.retentionEvaluation,\n replayBatches: previous?.training.replayBatches ?? [] },\n limits: { maxIterationSpendUsd: settings.maxIterationSpendUsd, maxDailySpendUsd: settings.maxDailySpendUsd,\n cooldownSeconds: settings.cooldownSeconds, maxRetries: settings.maxRetries,\n maxBatchExamples: settings.maxBatchExamples, maxBacklogExamples: settings.maxBacklogExamples },\n automation: { collect: false, train: settings.scheduled, accept: false, serve: false },\n acceptance: previous?.acceptance ?? { minimumScore: 0, maximumRetentionRegression: 0, requireImprovement: true, rollbackVersion: null },\n });\n}\n\n/** Bind a reviewed hosted Model configuration before asynchronous preparation.\n * Keep the established recipe identity: its id binds the whole Model revision,\n * including Harness and retention selections, while its hash binds the recipe.\n * Callers must obtain the summary from the authenticated Model API. */\nexport function hostedLearningPolicyReferences(project: HostedModelProjectSummary) {\n const setup = project.trainingSetup;\n const base = setup.baseModel ?? project.defaultBaseModel;\n if (!setup.recipe || !base || !setup.evaluationTasksetRef) {\n throw new LearningDomainError(\"learning_model_configuration_incomplete\", 422,\n \"Select a training recipe, starting model and retained evaluation before enabling hosted learning.\");\n }\n return {\n recipe: { id: `model-recipe-${project.etag}`, contentHash: contentHash(setup.recipe) },\n trainingParent: { id: base.modelId, contentHash: contentHash(base) },\n retentionEvaluation: { id: setup.evaluationTasksetRef.id, contentHash: setup.evaluationTasksetRef.contentHash },\n };\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA,cAAc;AACd,cAAc;;;ACDd,SAAS,qBAAqB,mCAAkF;AAOzG,SAAS,6BAA6B,SAAoC,QAA+B;AAC9G,QAAM,eAAe,QAAQ,OAAO,wBAAwB,QAAQ,cAAc,4BAA4B;AAC9G,SAAO;AAAA,IACL,SAAS,QAAQ,WAAW;AAAA,IAC5B,WAAW,QAAQ,QAAQ,SAAS;AAAA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E,IAAI,MAAM,qBAAqB,IAAI,aAAa,MAAM,qBAAqB,YAAY;AAAA,EAChH;AACF;",
6
6
  "names": []
7
7
  }
@@ -77,6 +77,40 @@ export declare class OpenPondLearningClient {
77
77
  latestIterationId: string;
78
78
  lastReservedAt: string | null;
79
79
  updatedAt: string;
80
+ acceptedParent?: {
81
+ iterationId: string;
82
+ iterationRevision: number;
83
+ candidate: {
84
+ id: string;
85
+ contentHash: string;
86
+ };
87
+ decision: {
88
+ id: string;
89
+ contentHash: string;
90
+ revision: number;
91
+ };
92
+ decidedAt: string;
93
+ } | null | undefined;
94
+ } | null;
95
+ trainingParent: {
96
+ reference: {
97
+ id: string;
98
+ contentHash: string;
99
+ };
100
+ selection: {
101
+ iterationId: string;
102
+ iterationRevision: number;
103
+ candidate: {
104
+ id: string;
105
+ contentHash: string;
106
+ };
107
+ decision: {
108
+ id: string;
109
+ contentHash: string;
110
+ revision: number;
111
+ };
112
+ decidedAt: string;
113
+ } | null;
80
114
  } | null;
81
115
  counts: {
82
116
  eligible: number;
@@ -1 +1 @@
1
- {"version":3,"file":"learning-client.d.ts","sourceRoot":"","sources":["../../../../../src/learning-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAEgD,KAAK,mBAAmB,EAGpD,KAAK,eAAe,EAAE,KAAK,uBAAuB,EAC3E,KAAK,mBAAmB,EAAE,KAAK,oBAAoB,EAAE,KAAK,oBAAoB,EAC9E,KAAK,qBAAqB,EAAE,KAAK,qBAAqB,EAAE,KAAK,sBAAsB,EACpF,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAiO,KAAK,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AAEhT,MAAM,WAAW,6BAA6B;IAC5C,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,wFAAwF;IACxF,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,UA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EAAE,OAAO,GAAE,sBAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAOrF,gFAAgF;IAC1E,sBAAsB,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,+BAA+B,EAAE;QAAE,MAAM,EAAE,QAAQ,CAAA;KAAE,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,EAAE,OAAO,GAAE,sBAA2B;;;;;;;;;;;;;IAQ5J,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,GAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAO,EAAE,OAAO,GAAE,sBAA2B;;;;;;;;;;;;;IAQ9H,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,sBAA2B;;;;;;;;;;IAQzF,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,sBAA2B;;;;;;;;;;;;;;;IAW1E,IAAI,CAAC,CAAC,SAAS,oBAAoB,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,GAAE,OAAO,CAAC,qBAAqB,CAAM,EAAE,OAAO,GAAE,sBAA2B,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC;IAKvK,uGAAuG;IACjG,YAAY,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,EAAE,OAAO,GAAE,sBAA2B;;;;;;;;CAoB/G"}
@@ -1,4 +1,132 @@
1
+ import { type LearningPolicy, type LearningRevisionRef } from "@openpond/evals/learning";
1
2
  import type { HostedModelProjectSummary } from "./model-projects.js";
3
+ /** Shared starting values for both Model clients. Existing policies retain
4
+ * their exact limits; opening settings must never silently increase spending. */
5
+ export declare function hostedLearningPolicyDefaults(project: HostedModelProjectSummary, policy: LearningPolicy | null): {
6
+ enabled: boolean;
7
+ scheduled: boolean;
8
+ intervalSeconds: number;
9
+ humanReviewRequired: boolean;
10
+ minimumApprovedExamples: number;
11
+ maxBatchExamples: number;
12
+ maxIterationSpendUsd: number;
13
+ maxDailySpendUsd: number;
14
+ cooldownSeconds: number;
15
+ maxRetries: number;
16
+ maxBacklogExamples: number;
17
+ };
18
+ export interface HostedLearningPolicySettings {
19
+ enabled: boolean;
20
+ scheduled: boolean;
21
+ intervalSeconds: number;
22
+ humanReviewRequired: boolean;
23
+ minimumApprovedExamples: number;
24
+ maxBatchExamples: number;
25
+ maxIterationSpendUsd: number;
26
+ maxDailySpendUsd: number;
27
+ cooldownSeconds: number;
28
+ maxRetries: number;
29
+ maxBacklogExamples: number;
30
+ }
31
+ /** Compile reviewed settings without following mutable Model configuration
32
+ * unless the caller explicitly chooses to apply it. Publication still owns
33
+ * authorization, revision comparison and source/qualification validation. */
34
+ export declare function createHostedLearningPolicyContent(input: {
35
+ project: HostedModelProjectSummary;
36
+ previous: LearningPolicy | null;
37
+ policyId: string;
38
+ applyModelConfiguration: boolean;
39
+ sources: LearningRevisionRef[];
40
+ taskDefinition: LearningRevisionRef;
41
+ settings: HostedLearningPolicySettings;
42
+ }): {
43
+ schemaVersion: "openpond.learningPolicy.v1";
44
+ id: string;
45
+ revision: number;
46
+ modelProjectId: string;
47
+ executionOwner: "local" | "hosted";
48
+ enabled: boolean;
49
+ sources: {
50
+ id: string;
51
+ contentHash: string;
52
+ revision: number;
53
+ }[];
54
+ taskDefinition: {
55
+ id: string;
56
+ contentHash: string;
57
+ revision: number;
58
+ };
59
+ rewardBinding: {
60
+ id: string;
61
+ contentHash: string;
62
+ revision: number;
63
+ };
64
+ admission: {
65
+ mode: "human" | "qualified_automatic";
66
+ qualification: {
67
+ id: string;
68
+ contentHash: string;
69
+ } | null;
70
+ minimumApprovedExamples: number;
71
+ };
72
+ trigger: {
73
+ kind: "manual";
74
+ } | {
75
+ kind: "approved_count";
76
+ } | {
77
+ kind: "schedule";
78
+ intervalSeconds: number;
79
+ } | {
80
+ kind: "upstream_accepted";
81
+ modelProjectId: string;
82
+ };
83
+ trainingParent: {
84
+ id: string;
85
+ contentHash: string;
86
+ };
87
+ teacher: {
88
+ id: string;
89
+ contentHash: string;
90
+ } | null;
91
+ training: {
92
+ method: "sft" | "dpo" | "grpo" | "ppo" | "sdft" | "opd" | "opsd" | "sdpo";
93
+ recipe: {
94
+ id: string;
95
+ contentHash: string;
96
+ };
97
+ retentionEvaluation: {
98
+ id: string;
99
+ contentHash: string;
100
+ };
101
+ replayBatches: {
102
+ id: string;
103
+ contentHash: string;
104
+ }[];
105
+ };
106
+ limits: {
107
+ maxIterationSpendUsd: number;
108
+ maxDailySpendUsd: number;
109
+ cooldownSeconds: number;
110
+ maxRetries: number;
111
+ maxBatchExamples: number;
112
+ maxBacklogExamples: number;
113
+ };
114
+ automation: {
115
+ collect: boolean;
116
+ train: boolean;
117
+ accept: boolean;
118
+ serve: boolean;
119
+ };
120
+ acceptance: {
121
+ minimumScore: number;
122
+ maximumRetentionRegression: number;
123
+ requireImprovement: boolean;
124
+ rollbackVersion: {
125
+ id: string;
126
+ contentHash: string;
127
+ } | null;
128
+ };
129
+ };
2
130
  /** Bind a reviewed hosted Model configuration before asynchronous preparation.
3
131
  * Keep the established recipe identity: its id binds the whole Model revision,
4
132
  * including Harness and retention selections, while its hash binds the recipe.
@@ -1 +1 @@
1
- {"version":3,"file":"model-learning-policy.d.ts","sourceRoot":"","sources":["../../../../../src/model-learning-policy.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAErE;;;uEAGuE;AACvE,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,yBAAyB;;;;;;;;;;;;;EAYhF"}
1
+ {"version":3,"file":"model-learning-policy.d.ts","sourceRoot":"","sources":["../../../../../src/model-learning-policy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoD,KAAK,cAAc,EAAE,K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
- baseline: "baseline";
34
33
  candidate: "candidate";
34
+ baseline: "baseline";
35
35
  }>;
36
36
  policyVersion: z.ZodNumber;
37
37
  taskset: z.ZodObject<{
@@ -1009,7 +1009,7 @@ export declare function createTrainingClient(input: {
1009
1009
  id: string;
1010
1010
  contentHash: string;
1011
1011
  };
1012
- kind: "baseline" | "candidate";
1012
+ kind: "candidate" | "baseline";
1013
1013
  policyVersion: number;
1014
1014
  taskset: {
1015
1015
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openpond-sdk",
3
- "version": "0.5.17",
3
+ "version": "0.5.19",
4
4
  "description": "Server-side TypeScript SDK for OpenPond sandboxes and agentic work",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -139,7 +139,7 @@
139
139
  "vitest": "4.1.10"
140
140
  },
141
141
  "dependencies": {
142
- "@openpond/evals": "^0.10.6",
142
+ "@openpond/evals": "^0.10.7",
143
143
  "@openpond/harness": "^0.3.0",
144
144
  "esbuild": "0.28.1",
145
145
  "zod": "^4.1.13"