openpond-sdk 0.1.3 → 0.1.4

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
@@ -4,6 +4,8 @@ import {
4
4
  LearningCommandRequestSchema,
5
5
  LearningOperationResultSchema,
6
6
  LearningReadRequestSchema,
7
+ TaskEvidenceInspectionResultSchema,
8
+ sameLearningRef,
7
9
  assertLearningRequestJson,
8
10
  learningResourceSchemas
9
11
  } from "@openpond/evals/learning";
@@ -59,6 +61,12 @@ var OpenPondLearningClient = class {
59
61
  const request = LearningReadRequestSchema.parse({ action: "get", scope: this.#options.scope, kind, id, ...revision === void 0 ? {} : { revision } });
60
62
  return learningResourceSchemas[kind].parse(await this.#request("read", request, options));
61
63
  }
64
+ async inspectEvidence(evidence, options = {}) {
65
+ const request = LearningReadRequestSchema.parse({ action: "inspect_evidence", scope: this.#options.scope, evidence });
66
+ const result = TaskEvidenceInspectionResultSchema.parse(await this.#request("read", request, options));
67
+ if (!sameLearningRef(result.evidence, evidence)) throw new OpenPondLearningError(502, "evidence_identity_mismatch", "Inspection did not match the requested evidence release.", null);
68
+ return result;
69
+ }
62
70
  async list(kind, query = {}, options = {}) {
63
71
  const request = LearningReadRequestSchema.parse({ action: "list", scope: this.#options.scope, kind, ...query });
64
72
  return z.object({ items: z.array(learningResourceSchemas[kind]).max(100), nextCursor: z.string().nullable() }).strict().parse(await this.#request("read", request, options));
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/learning.ts"],
4
- "sourcesContent": ["import { z } from \"zod\";\nimport {\n LearningCommandRequestSchema, LearningOperationResultSchema, LearningReadRequestSchema,\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\";\n\nexport * from \"@openpond/evals/learning\";\nexport * from \"@openpond/evals/rewards\";\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();\nexport class OpenPondLearningError extends Error {\n constructor(readonly status: number, readonly code: string, message: string, readonly details: unknown) {\n super(message);\n this.name = \"OpenPondLearningError\";\n }\n}\n\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 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\", 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\nasync 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"],
5
- "mappings": ";AAAA,SAAS,SAAS;AAClB;AAAA,EACE;AAAA,EAA8B;AAAA,EAA+B;AAAA,EAC7D;AAAA,EACA;AAAA,OAGK;AACP,SAAS,6BAA6B;AAEtC,cAAc;AACd,cAAc;AAUP,IAAM,iCAAiC,EAAE,OAAO;AAAA,EACrD,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAAA,EAAG,gBAAgB,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAC9F,CAAC,EAAE,OAAO;AACH,IAAM,uCAAuC,EAAE,OAAO;AAAA,EAC3D,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EAAG,WAAW,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EAAG,WAAW,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACrF,WAAW,EAAE,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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;",
4
+ "sourcesContent": ["import { z } from \"zod\";\nimport {\n LearningCommandRequestSchema, LearningOperationResultSchema, LearningReadRequestSchema,\n TaskEvidenceInspectionResultSchema, sameLearningRef, type LearningRevisionRef,\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\";\n\nexport * from \"@openpond/evals/learning\";\nexport * from \"@openpond/evals/rewards\";\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();\nexport class OpenPondLearningError extends Error {\n constructor(readonly status: number, readonly code: string, message: string, readonly details: unknown) {\n super(message);\n this.name = \"OpenPondLearningError\";\n }\n}\n\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 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\", 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\nasync 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"],
5
+ "mappings": ";AAAA,SAAS,SAAS;AAClB;AAAA,EACE;AAAA,EAA8B;AAAA,EAA+B;AAAA,EAC7D;AAAA,EAAoC;AAAA,EACpC;AAAA,EACA;AAAA,OAGK;AACP,SAAS,6BAA6B;AAEtC,cAAc;AACd,cAAc;AAUP,IAAM,iCAAiC,EAAE,OAAO;AAAA,EACrD,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAAA,EAAG,gBAAgB,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAC9F,CAAC,EAAE,OAAO;AACH,IAAM,uCAAuC,EAAE,OAAO;AAAA,EAC3D,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EAAG,WAAW,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EAAG,WAAW,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACrF,WAAW,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EAAG,UAAU,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS;AAAA,EAAG,aAAa,EAAE,OAAO,EAAE,MAAM,gBAAgB;AACrH,CAAC,EAAE,OAAO;AACH,IAAM,wBAAN,cAAoC,MAAM;AAAA,EAC/C,YAAqB,QAAyB,MAAc,SAA0B,SAAkB;AACtG,UAAM,OAAO;AADM;AAAyB;AAAwC;AAEpF,SAAK,OAAO;AAAA,EACd;AAAA,EAHqB;AAAA,EAAyB;AAAA,EAAwC;AAIxF;AAGO,IAAM,yBAAN,MA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,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;",
6
6
  "names": []
7
7
  }
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { type LearningCommand, type LearningOperationResult, type LearningResourceFor, type LearningResourceKind, type LearningResourcePage, type LearningResourceQuery, type TaskExampleSubmission, type TaskFeedbackSubmission } from "@openpond/evals/learning";
2
+ import { type LearningRevisionRef, type LearningCommand, type LearningOperationResult, type LearningResourceFor, type LearningResourceKind, type LearningResourcePage, type LearningResourceQuery, type TaskExampleSubmission, type TaskFeedbackSubmission } from "@openpond/evals/learning";
3
3
  export * from "@openpond/evals/learning";
4
4
  export * from "@openpond/evals/rewards";
5
5
  export interface OpenPondLearningClientOptions {
@@ -38,6 +38,28 @@ export declare class OpenPondLearningClient {
38
38
  submitExample(example: TaskExampleSubmission, options?: LearningRequestOptions): Promise<LearningOperationResult>;
39
39
  submitFeedback(feedback: TaskFeedbackSubmission, options?: LearningRequestOptions): Promise<LearningOperationResult>;
40
40
  get<K extends LearningResourceKind>(kind: K, id: string, revision?: number, options?: LearningRequestOptions): Promise<LearningResourceFor<K>>;
41
+ inspectEvidence(evidence: LearningRevisionRef, options?: LearningRequestOptions): Promise<{
42
+ evidence: {
43
+ id: string;
44
+ contentHash: string;
45
+ revision: number;
46
+ };
47
+ definition: {
48
+ id: string;
49
+ contentHash: string;
50
+ revision: number;
51
+ };
52
+ inspection: {
53
+ evidenceValidity: "valid" | "invalid";
54
+ taskReady: boolean;
55
+ observedOutputValid: boolean | null;
56
+ issues: {
57
+ path: string;
58
+ code: string;
59
+ message: string;
60
+ }[];
61
+ };
62
+ }>;
41
63
  list<K extends LearningResourceKind>(kind: K, query?: Partial<LearningResourceQuery>, options?: LearningRequestOptions): Promise<LearningResourcePage<K>>;
42
64
  /** Hosted publication only: stores an immutable package and attaches it, without starting training. */
43
65
  publishBatch(input: z.infer<typeof LearningBatchPublicationSchema>, options?: LearningRequestOptions): Promise<{
@@ -1 +1 @@
1
- {"version":3,"file":"learning.d.ts","sourceRoot":"","sources":["../../../../../src/learning.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAGoB,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;AAGlC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AAExC,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,UAAU,CAAC,KAAK,CAAC;CACjC;AACD,MAAM,WAAW,sBAAsB;IAAG,MAAM,CAAC,EAAE,WAAW,CAAA;CAAE;AAChE,eAAO,MAAM,8BAA8B;;;kBAEhC,CAAC;AACZ,eAAO,MAAM,oCAAoC;;;;;;;kBAGtC,CAAC;AACZ,qBAAa,qBAAsB,SAAQ,KAAK;IAClC,QAAQ,CAAC,MAAM,EAAE,MAAM;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM;IAAmB,QAAQ,CAAC,OAAO,EAAE,OAAO;gBAAjF,MAAM,EAAE,MAAM,EAAW,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAW,OAAO,EAAE,OAAO;CAIvG;AAED,mFAAmF;AACnF,qBAAa,sBAAsB;;gBAErB,OAAO,EAAE,6BAA6B;I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AA2B,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openpond-sdk",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Server-side TypeScript SDK for OpenPond sandboxes and agentic work",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -102,7 +102,7 @@
102
102
  "vitest": "4.1.10"
103
103
  },
104
104
  "dependencies": {
105
- "@openpond/evals": "^0.7.0",
105
+ "@openpond/evals": "^0.7.1",
106
106
  "@openpond/harness": "^0.2.5",
107
107
  "esbuild": "0.28.1",
108
108
  "zod": "^4.1.13"