openpond-sdk 0.0.18 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -46,11 +46,11 @@ export declare const TrainingJobStateSchema: z.ZodEnum<{
46
46
  running: "running";
47
47
  failed: "failed";
48
48
  queued: "queued";
49
+ cancelled: "cancelled";
50
+ cancelling: "cancelling";
49
51
  admitting: "admitting";
50
52
  provisioning: "provisioning";
51
53
  stopping: "stopping";
52
- cancelling: "cancelling";
53
- cancelled: "cancelled";
54
54
  }>;
55
55
  export declare const TrainingCapabilityRequirementSchema: z.ZodObject<{
56
56
  id: z.ZodString;
@@ -497,11 +497,11 @@ export declare const TrainingJobSchema: z.ZodObject<{
497
497
  running: "running";
498
498
  failed: "failed";
499
499
  queued: "queued";
500
+ cancelled: "cancelled";
501
+ cancelling: "cancelling";
500
502
  admitting: "admitting";
501
503
  provisioning: "provisioning";
502
504
  stopping: "stopping";
503
- cancelling: "cancelling";
504
- cancelled: "cancelled";
505
505
  }>;
506
506
  phase: z.ZodString;
507
507
  version: z.ZodNumber;
@@ -537,11 +537,11 @@ export declare const TrainingJobPageSchema: z.ZodObject<{
537
537
  running: "running";
538
538
  failed: "failed";
539
539
  queued: "queued";
540
+ cancelled: "cancelled";
541
+ cancelling: "cancelling";
540
542
  admitting: "admitting";
541
543
  provisioning: "provisioning";
542
544
  stopping: "stopping";
543
- cancelling: "cancelling";
544
- cancelled: "cancelled";
545
545
  }>;
546
546
  phase: z.ZodString;
547
547
  version: z.ZodNumber;
@@ -592,11 +592,11 @@ export declare const TrainingJobOutputSchema: z.ZodObject<{
592
592
  id: z.ZodString;
593
593
  jobId: z.ZodString;
594
594
  kind: z.ZodEnum<{
595
+ evaluation: "evaluation";
595
596
  checkpoint: "checkpoint";
596
597
  adapter: "adapter";
597
598
  scorer: "scorer";
598
599
  metrics: "metrics";
599
- evaluation: "evaluation";
600
600
  trace: "trace";
601
601
  receipt: "receipt";
602
602
  }>;
@@ -649,11 +649,11 @@ export declare const TrainingJobOutputsSchema: z.ZodObject<{
649
649
  id: z.ZodString;
650
650
  jobId: z.ZodString;
651
651
  kind: z.ZodEnum<{
652
+ evaluation: "evaluation";
652
653
  checkpoint: "checkpoint";
653
654
  adapter: "adapter";
654
655
  scorer: "scorer";
655
656
  metrics: "metrics";
656
- evaluation: "evaluation";
657
657
  trace: "trace";
658
658
  receipt: "receipt";
659
659
  }>;
@@ -791,7 +791,7 @@ export declare function createTrainingClient(input: {
791
791
  portableProjectId: string;
792
792
  sourceProjectRevision: number;
793
793
  submissionHash: string;
794
- state: "succeeded" | "running" | "failed" | "queued" | "admitting" | "provisioning" | "stopping" | "cancelling" | "cancelled";
794
+ state: "succeeded" | "running" | "failed" | "queued" | "cancelled" | "cancelling" | "admitting" | "provisioning" | "stopping";
795
795
  phase: string;
796
796
  version: number;
797
797
  progress: number;
@@ -822,7 +822,7 @@ export declare function createTrainingClient(input: {
822
822
  portableProjectId: string;
823
823
  sourceProjectRevision: number;
824
824
  submissionHash: string;
825
- state: "succeeded" | "running" | "failed" | "queued" | "admitting" | "provisioning" | "stopping" | "cancelling" | "cancelled";
825
+ state: "succeeded" | "running" | "failed" | "queued" | "cancelled" | "cancelling" | "admitting" | "provisioning" | "stopping";
826
826
  phase: string;
827
827
  version: number;
828
828
  progress: number;
@@ -849,7 +849,7 @@ export declare function createTrainingClient(input: {
849
849
  portableProjectId: string;
850
850
  sourceProjectRevision: number;
851
851
  submissionHash: string;
852
- state: "succeeded" | "running" | "failed" | "queued" | "admitting" | "provisioning" | "stopping" | "cancelling" | "cancelled";
852
+ state: "succeeded" | "running" | "failed" | "queued" | "cancelled" | "cancelling" | "admitting" | "provisioning" | "stopping";
853
853
  phase: string;
854
854
  version: number;
855
855
  progress: number;
@@ -874,7 +874,7 @@ export declare function createTrainingClient(input: {
874
874
  portableProjectId: string;
875
875
  sourceProjectRevision: number;
876
876
  submissionHash: string;
877
- state: "succeeded" | "running" | "failed" | "queued" | "admitting" | "provisioning" | "stopping" | "cancelling" | "cancelled";
877
+ state: "succeeded" | "running" | "failed" | "queued" | "cancelled" | "cancelling" | "admitting" | "provisioning" | "stopping";
878
878
  phase: string;
879
879
  version: number;
880
880
  progress: number;
@@ -899,7 +899,7 @@ export declare function createTrainingClient(input: {
899
899
  portableProjectId: string;
900
900
  sourceProjectRevision: number;
901
901
  submissionHash: string;
902
- state: "succeeded" | "running" | "failed" | "queued" | "admitting" | "provisioning" | "stopping" | "cancelling" | "cancelled";
902
+ state: "succeeded" | "running" | "failed" | "queued" | "cancelled" | "cancelling" | "admitting" | "provisioning" | "stopping";
903
903
  phase: string;
904
904
  version: number;
905
905
  progress: number;
@@ -932,7 +932,7 @@ export declare function createTrainingClient(input: {
932
932
  schemaVersion: "openpond.trainingJobOutput.v2";
933
933
  id: string;
934
934
  jobId: string;
935
- kind: "checkpoint" | "adapter" | "scorer" | "metrics" | "evaluation" | "trace" | "receipt";
935
+ kind: "evaluation" | "checkpoint" | "adapter" | "scorer" | "metrics" | "trace" | "receipt";
936
936
  artifactRef: string;
937
937
  contentHash: string;
938
938
  sizeBytes: number;
@@ -0,0 +1,14 @@
1
+ {
2
+ "idempotencyKey": "arithmetic-example-001-attempt-001",
3
+ "exampleId": "arithmetic-example-001",
4
+ "attemptId": "attempt-001",
5
+ "occurredAt": "2026-09-06T12:00:00.000Z",
6
+ "familyKey": "arithmetic-two-plus-two",
7
+ "split": "train",
8
+ "input": { "question": "What is two plus two?" },
9
+ "observedOutput": { "answer": "5" },
10
+ "expected": { "answer": "4" },
11
+ "evaluatorContext": { "explanation": "Integer addition." },
12
+ "assets": [],
13
+ "provenance": { "sourceRecordRef": null, "mappingHash": null }
14
+ }
@@ -0,0 +1,57 @@
1
+ """python3 submit.py SOURCE_ID example.json (Python standard library only)."""
2
+ import json
3
+ import os
4
+ import sys
5
+ import urllib.error
6
+ import urllib.parse
7
+ import urllib.request
8
+
9
+
10
+ class NoRedirect(urllib.request.HTTPRedirectHandler):
11
+ def redirect_request(self, req, fp, code, msg, headers, newurl):
12
+ return None
13
+
14
+
15
+ def main():
16
+ if len(sys.argv) != 3:
17
+ raise ValueError("Usage: submit.py SOURCE_ID example.json")
18
+ source_id, filename = sys.argv[1:]
19
+ endpoint = os.environ["OPENPOND_API_URL"].rstrip("/")
20
+ parsed = urllib.parse.urlparse(endpoint)
21
+ if parsed.scheme not in ("http", "https") or not parsed.hostname or parsed.username or parsed.password or parsed.query or parsed.fragment:
22
+ raise ValueError("Use an HTTP(S) API URL without credentials, query or fragment.")
23
+ scope = os.environ["OPENPOND_LEARNING_SCOPE"]
24
+ token = os.environ["OPENPOND_API_KEY"]
25
+ opener = urllib.request.build_opener(NoRedirect())
26
+
27
+ def post(route, payload):
28
+ body = json.dumps(payload, allow_nan=False).encode("utf-8")
29
+ if len(body) > 16_777_216:
30
+ raise ValueError("Request exceeds 16 MiB.")
31
+ request = urllib.request.Request(endpoint + "/v1/learning/" + route, data=body, headers={"Authorization": "Bearer " + token, "Content-Type": "application/json", "Accept": "application/json", "X-OpenPond-Team-Id": scope}, method="POST")
32
+ try:
33
+ with opener.open(request, timeout=60) as response:
34
+ result = response.read(16_777_217)
35
+ if len(result) > 16_777_216:
36
+ raise ValueError("Response exceeds 16 MiB.")
37
+ return json.loads(result)
38
+ except urllib.error.HTTPError as error:
39
+ # Do not print request headers or echoed evidence from error bodies.
40
+ raise RuntimeError("Learning API rejected the request (HTTP %s)." % error.code) from None
41
+
42
+ source = post("read", {"action": "get", "scope": scope, "kind": "source", "id": source_id})
43
+ with open(filename, encoding="utf-8") as handle:
44
+ example = json.load(handle)
45
+ example.update(schemaVersion="openpond.taskExample.v1", sourceId=source_id, taskDefinition=source["taskDefinition"])
46
+ operation_id = example["idempotencyKey"]
47
+ result = post("commands", {"scope": scope, "command": {"action": "submit_example", "operationId": operation_id, "example": example}})
48
+ if result["operationId"] != operation_id:
49
+ raise RuntimeError("Operation identity mismatch.")
50
+ evidence = result["resources"][0]
51
+ if evidence["schemaVersion"] != "openpond.taskEvidence.v1":
52
+ raise RuntimeError("Unexpected resource type.")
53
+ print(json.dumps({"operationId": operation_id, "evidenceId": evidence["id"], "revision": evidence["revision"], "contentHash": evidence["contentHash"]}))
54
+
55
+
56
+ if __name__ == "__main__":
57
+ main()
@@ -0,0 +1,20 @@
1
+ import { readFile } from "node:fs/promises";
2
+ import { OpenPondLearningClient, TaskExampleSubmissionSchema, TaskEvidenceSchema } from "openpond-sdk/learning";
3
+
4
+ // node --experimental-strip-types submit.ts SOURCE_ID example.json
5
+ // Set OPENPOND_API_KEY, OPENPOND_API_URL and OPENPOND_LEARNING_SCOPE in your shell.
6
+ function required(name: string): string {
7
+ const value = process.env[name];
8
+ if (!value) throw new Error(`Set ${name} before running this example.`);
9
+ return value;
10
+ }
11
+ const [sourceId, file] = process.argv.slice(2);
12
+ if (!sourceId || !file) throw new Error("Usage: submit.ts SOURCE_ID example.json");
13
+ const client = new OpenPondLearningClient({ apiKey: required("OPENPOND_API_KEY"), baseUrl: required("OPENPOND_API_URL"), scope: required("OPENPOND_LEARNING_SCOPE") });
14
+ const source = await client.get("source", sourceId);
15
+ const record: unknown = JSON.parse(await readFile(file, "utf8"));
16
+ if (!record || typeof record !== "object" || Array.isArray(record)) throw new Error("Expected one JSON object.");
17
+ const example = TaskExampleSubmissionSchema.parse({ ...record, schemaVersion: "openpond.taskExample.v1", sourceId, taskDefinition: source.taskDefinition });
18
+ const receipt = await client.submitExample(example);
19
+ const evidence = TaskEvidenceSchema.parse(receipt.resources[0]);
20
+ console.log(JSON.stringify({ operationId: receipt.operationId, evidenceId: evidence.id, revision: evidence.revision, contentHash: evidence.contentHash }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openpond-sdk",
3
- "version": "0.0.18",
3
+ "version": "0.1.0",
4
4
  "description": "Server-side TypeScript SDK for OpenPond sandboxes and agentic work",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -11,9 +11,15 @@
11
11
  "fixtures",
12
12
  "README.md",
13
13
  "TRAINING_PROTOCOL.md",
14
- "LICENSE"
14
+ "LICENSE",
15
+ "examples",
16
+ "LEARNING.md"
15
17
  ],
16
18
  "exports": {
19
+ "./learning": {
20
+ "types": "./dist/types/packages/sdk/src/learning.d.ts",
21
+ "import": "./dist/learning.js"
22
+ },
17
23
  ".": {
18
24
  "types": "./dist/types/packages/sdk/src/index.d.ts",
19
25
  "import": "./dist/index.js"
@@ -74,12 +80,12 @@
74
80
  "@openpond/harness"
75
81
  ],
76
82
  "scripts": {
77
- "prebuild": "pnpm --dir ../cloud run build && pnpm --dir ../harness run build",
83
+ "prebuild": "pnpm --dir ../cloud run build && pnpm --dir ../harness run build && pnpm --dir ../evals run build",
78
84
  "build": "tsx scripts/build.ts",
79
85
  "typecheck": "tsc --noEmit --project tsconfig.json",
80
86
  "test": "vitest run --root ../.. --config vitest.config.ts --project sdk",
81
- "check": "pnpm run typecheck && pnpm run test && tsx scripts/check-protocol-fixtures.ts && pnpm run build && tsx scripts/check-published-consumer.ts && npm pack --dry-run",
82
- "publish:check": "tsx scripts/check-protocol-fixtures.ts && pnpm run build && tsx scripts/check-published-consumer.ts && npm pack --dry-run"
87
+ "check": "pnpm run build && pnpm run typecheck && pnpm run test && tsx scripts/check-protocol-fixtures.ts && tsx scripts/check-published-consumer.ts --local-evals && npm pack --dry-run",
88
+ "publish:check": "pnpm run build && tsx scripts/check-protocol-fixtures.ts && tsx scripts/check-published-consumer.ts && npm pack --dry-run"
83
89
  },
84
90
  "devDependencies": {
85
91
  "@openpond/actions": "workspace:*",
@@ -91,6 +97,7 @@
91
97
  "vitest": "4.1.10"
92
98
  },
93
99
  "dependencies": {
100
+ "@openpond/evals": "^0.7.0",
94
101
  "@openpond/harness": "^0.2.5",
95
102
  "esbuild": "0.28.1",
96
103
  "zod": "^4.1.13"