openpond-sdk 0.0.12 → 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.
Files changed (46) hide show
  1. package/README.md +31 -0
  2. package/TRAINING_PROTOCOL.md +78 -0
  3. package/dist/actions-local.js +34 -14551
  4. package/dist/actions-local.js.map +4 -4
  5. package/dist/actions.js +12 -14530
  6. package/dist/actions.js.map +4 -4
  7. package/dist/index.js +582 -29
  8. package/dist/index.js.map +4 -4
  9. package/dist/model-projects.js +348 -0
  10. package/dist/model-projects.js.map +7 -0
  11. package/dist/profile-actions.js +1 -20
  12. package/dist/profile-actions.js.map +3 -3
  13. package/dist/project-actions.js +1 -20
  14. package/dist/project-actions.js.map +3 -3
  15. package/dist/refiner.js +568 -0
  16. package/dist/refiner.js.map +7 -0
  17. package/dist/training.js +691 -0
  18. package/dist/training.js.map +7 -0
  19. package/dist/types/packages/cloud/src/api/core.d.ts.map +1 -1
  20. package/dist/types/packages/cloud/src/hosted-chat.d.ts +20 -0
  21. package/dist/types/packages/cloud/src/hosted-chat.d.ts.map +1 -1
  22. package/dist/types/packages/cloud/src/sandbox/client-handles.d.ts +2 -1
  23. package/dist/types/packages/cloud/src/sandbox/client-handles.d.ts.map +1 -1
  24. package/dist/types/packages/cloud/src/sandbox/client.d.ts +3 -1
  25. package/dist/types/packages/cloud/src/sandbox/client.d.ts.map +1 -1
  26. package/dist/types/packages/cloud/src/sandbox/types/org-project-agent.d.ts +13 -0
  27. package/dist/types/packages/cloud/src/sandbox/types/org-project-agent.d.ts.map +1 -1
  28. package/dist/types/packages/sdk/src/index.d.ts +1 -0
  29. package/dist/types/packages/sdk/src/index.d.ts.map +1 -1
  30. package/dist/types/packages/sdk/src/model-projects.d.ts +820 -0
  31. package/dist/types/packages/sdk/src/model-projects.d.ts.map +1 -0
  32. package/dist/types/packages/sdk/src/protocol.d.ts +25 -0
  33. package/dist/types/packages/sdk/src/protocol.d.ts.map +1 -0
  34. package/dist/types/packages/sdk/src/refiner.d.ts +6 -0
  35. package/dist/types/packages/sdk/src/refiner.d.ts.map +1 -0
  36. package/dist/types/packages/sdk/src/training.d.ts +859 -0
  37. package/dist/types/packages/sdk/src/training.d.ts.map +1 -0
  38. package/dist/types/packages/sdk/src/types.d.ts +1 -1
  39. package/dist/types/packages/sdk/src/types.d.ts.map +1 -1
  40. package/dist/workflows.js +1 -20
  41. package/dist/workflows.js.map +3 -3
  42. package/fixtures/training/v2/policy-optimize.unknown-field.invalid.json +10 -0
  43. package/fixtures/training/v2/policy-optimize.valid.json +84 -0
  44. package/package.json +20 -4
  45. package/dist/types/packages/cloud/src/api/vercel-protection.d.ts +0 -2
  46. package/dist/types/packages/cloud/src/api/vercel-protection.d.ts.map +0 -1
package/README.md CHANGED
@@ -232,6 +232,37 @@ await openpond.work.deleteSandbox(sandboxId);
232
232
 
233
233
  The sandbox's 15-minute idle timeout is crash protection, not the normal successful-turn cleanup path. Use conservative budgets and application-level retention. API keys, provider credentials, and bypass secrets must remain in server-side configuration.
234
234
 
235
+ ## Model Projects and training
236
+
237
+ The SDK exposes dependency-light contracts and API clients without importing
238
+ the OpenPond application server:
239
+
240
+ ```ts
241
+ import {
242
+ ModelProjectSchema,
243
+ createModelProjectsClient,
244
+ } from "openpond-sdk/model-projects";
245
+ import {
246
+ TrainingJobSubmissionSchema,
247
+ createTrainingClient,
248
+ } from "openpond-sdk/training";
249
+ ```
250
+
251
+ A Model Project is the mutable authoring object and owns one current training
252
+ setup. Tasksets, Harnesses, evidence, Jobs, and Model Versions remain separate
253
+ resources connected by immutable references. Submitting training snapshots the
254
+ exact Project revision into an immutable Job; the Job is the durable Run
255
+ identity and explicit approval is captured for that submission only.
256
+
257
+ `createModelProjectsClient` synchronizes and reads hosted Project projections.
258
+ `createTrainingClient` reads capabilities and creates or observes immutable
259
+ Jobs, including Project-filtered Run history. These clients require an
260
+ authenticated server-side API context; the schemas themselves contain no
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.
265
+
235
266
  ## Development
236
267
 
237
268
  From the OpenPond monorepo:
@@ -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.