openpond-sdk 0.0.13 → 0.0.14

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/README.md CHANGED
@@ -258,7 +258,10 @@ identity and explicit approval is captured for that submission only.
258
258
  `createTrainingClient` reads capabilities and creates or observes immutable
259
259
  Jobs, including Project-filtered Run history. These clients require an
260
260
  authenticated server-side API context; the schemas themselves contain no
261
- database, provider, credential, Electron, or UI dependencies.
261
+ database, provider, credential, Electron, or UI dependencies. See
262
+ [TRAINING_PROTOCOL.md](./TRAINING_PROTOCOL.md) for media types, hashing, size
263
+ limits, compatibility rules, provider routes, receipts, and the published
264
+ conformance fixtures.
262
265
 
263
266
  ## Development
264
267
 
@@ -0,0 +1,78 @@
1
+ # OpenPond Training Protocol V2
2
+
3
+ `openpond-sdk/training` and `openpond-sdk/model-projects` are the portable,
4
+ provider-neutral contract for OpenPond managed training. Providers implement
5
+ these resources without importing the OpenPond application server or exposing
6
+ their placement, worker, lease, credential, or storage internals.
7
+
8
+ ## Compatibility rules
9
+
10
+ - Send and accept `application/vnd.openpond.training+json;version=2` for
11
+ Training resources and `application/vnd.openpond.model-project+json;version=2`
12
+ for Model Project resources. Reject unsupported major versions with a
13
+ versioned API error and HTTP 406 or 415.
14
+ - Public resource envelopes are strict. Unknown fields are rejected. The two
15
+ intentionally extensible locations are versioned recipe documents and event
16
+ `data`; a provider must preserve recipe fields it does not interpret and
17
+ reject a recipe version it cannot execute.
18
+ - A Training Job submission is at most 1 MiB of canonical JSON. Model Project
19
+ sync is at most 512 KiB. SDK responses are bounded at 8 MiB. Artifact bytes
20
+ are not embedded in these documents; they are transferred through immutable,
21
+ content-addressed artifact references.
22
+ - `contentHash` on `openpond.trainingJobSubmission.v2` is lowercase SHA-256 of
23
+ the canonical JSON object with the top-level `contentHash` member omitted.
24
+ Canonical JSON sorts object keys, preserves array order, rejects non-JSON and
25
+ non-finite values, and encodes UTF-8 bytes.
26
+ - A repeated idempotency key for the same team and identical submission hash
27
+ returns the original Job. Reusing the key with different bytes is a conflict.
28
+ Project revisions use optimistic ETags; a stale Project author must refresh
29
+ before overwriting mutable authoring fields.
30
+ - Jobs, events, outputs, and receipts are immutable history. Cancellation and
31
+ stop-after-group require the caller's observed Job version. Hosted Job state
32
+ never overwrites mutable Project authoring fields.
33
+
34
+ ## Required provider routes
35
+
36
+ ```text
37
+ GET /v1/training/capabilities
38
+ POST /v1/training/jobs
39
+ GET /v1/training/jobs?modelProjectId=&cursor=&limit=
40
+ GET /v1/training/jobs/{jobId}
41
+ POST /v1/training/jobs/{jobId}/cancel
42
+ POST /v1/training/jobs/{jobId}/stop-after-group
43
+ GET /v1/training/jobs/{jobId}/events
44
+ GET /v1/training/jobs/{jobId}/logs
45
+ GET /v1/training/jobs/{jobId}/outputs
46
+
47
+ PUT /v1/model-projects/{portableProjectId}
48
+ GET /v1/model-projects
49
+ GET /v1/model-projects/{projectId}
50
+ ```
51
+
52
+ Every route is authenticated and team-scoped. The provider stores the exact
53
+ portable Project ID, source revision/hash, Harness/Taskset/Dataset refs,
54
+ submission hash, and approval/budget facts. It resolves those public facts to
55
+ private execution state only after validation and admission.
56
+
57
+ `GET /outputs` returns `openpond.trainingJobOutputs.v2`, containing immutable
58
+ output refs and a provider-issued execution receipt. The receipt binds the
59
+ submission, manifest, recipe, capability document, runtime release, all input
60
+ and output hashes, duration, spend, issuer, and cleanup result. It attests to
61
+ execution and artifact bytes; OpenPond remains responsible for evaluation,
62
+ qualification, selection, promotion, rejection, and rollback semantics.
63
+
64
+ ## Conformance
65
+
66
+ Published fixtures live in `fixtures/training/v2`. Providers should:
67
+
68
+ 1. validate `policy-optimize.valid.json` with
69
+ `parseAndVerifyTrainingJobSubmission`;
70
+ 2. reject the published unknown-field mutation;
71
+ 3. run the same fixtures through their HTTP admission adapter;
72
+ 4. prove authorization, idempotency, stale-version control, terminal outputs,
73
+ receipt verification, and cleanup in provider-local tests;
74
+ 5. compare V1 and V2 only at projection/admission time until a bounded V2
75
+ canary is explicitly approved—never launch duplicate paid Jobs.
76
+
77
+ The package's `check` command validates schemas, fixtures, canonical hashes,
78
+ the built entry points, and a clean npm-style consumer install.
package/dist/index.js CHANGED
@@ -2687,13 +2687,13 @@ function requiredId(value, label) {
2687
2687
  return normalized;
2688
2688
  }
2689
2689
 
2690
- // ../harness/dist/refiner.js
2690
+ // ../../node_modules/.pnpm/@openpond+harness@0.2.5/node_modules/@openpond/harness/dist/refiner.js
2691
2691
  import { z as z3 } from "zod";
2692
2692
 
2693
- // ../harness/dist/common.js
2693
+ // ../../node_modules/.pnpm/@openpond+harness@0.2.5/node_modules/@openpond/harness/dist/common.js
2694
2694
  import { z } from "zod";
2695
2695
 
2696
- // ../harness/dist/sha256.js
2696
+ // ../../node_modules/.pnpm/@openpond+harness@0.2.5/node_modules/@openpond/harness/dist/sha256.js
2697
2697
  var INITIAL_STATE = new Uint32Array([
2698
2698
  1779033703,
2699
2699
  3144134277,
@@ -2832,7 +2832,7 @@ function rotateRight(value, bits) {
2832
2832
  return value >>> bits | value << 32 - bits;
2833
2833
  }
2834
2834
 
2835
- // ../harness/dist/common.js
2835
+ // ../../node_modules/.pnpm/@openpond+harness@0.2.5/node_modules/@openpond/harness/dist/common.js
2836
2836
  var MAX_PORTABLE_PATH_BYTES = 2e3;
2837
2837
  var MAX_PORTABLE_ASSET_BYTES = 25e7;
2838
2838
  var ReleaseIdSchema = z.string().trim().min(1).max(240);
@@ -2889,7 +2889,7 @@ function sortValue(value) {
2889
2889
  return Object.fromEntries(Object.entries(value).sort(([left], [right]) => left.localeCompare(right)).map(([key, child]) => [key, sortValue(child)]));
2890
2890
  }
2891
2891
 
2892
- // ../harness/dist/refiner-profiles.js
2892
+ // ../../node_modules/.pnpm/@openpond+harness@0.2.5/node_modules/@openpond/harness/dist/refiner-profiles.js
2893
2893
  import { z as z2 } from "zod";
2894
2894
  var RefinerProposalRouteSchema = z2.enum(["memory", "prompt", "skill", "agent"]);
2895
2895
  var RefinerExternalRouteSchema = z2.enum(["runtime", "product", "taskset", "training"]);
@@ -2998,7 +2998,7 @@ function serializeReviewProfile(profile) {
2998
2998
  return canonicalJson(RefinerReviewProfileSchema.parse(profile));
2999
2999
  }
3000
3000
 
3001
- // ../harness/dist/refiner.js
3001
+ // ../../node_modules/.pnpm/@openpond+harness@0.2.5/node_modules/@openpond/harness/dist/refiner.js
3002
3002
  var RefinerNoActionDecisionSchema = z3.object({
3003
3003
  schemaVersion: z3.literal("openpond.localHarnessRefinerDecision.v1"),
3004
3004
  decision: z3.literal("no_action"),