openpond-sdk 0.1.4 → 0.1.6
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/LEARNING.md +45 -0
- package/dist/index.js +1846 -418
- package/dist/index.js.map +4 -4
- package/dist/learning.js +1950 -15
- package/dist/learning.js.map +4 -4
- package/dist/types/packages/sdk/src/learning-credentials.d.ts +100 -0
- package/dist/types/packages/sdk/src/learning-credentials.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/learning.d.ts +59 -0
- package/dist/types/packages/sdk/src/learning.d.ts.map +1 -1
- package/examples/learning/submit.py +1 -1
- package/examples/learning/submit.ts +1 -1
- package/package.json +2 -2
package/LEARNING.md
CHANGED
|
@@ -43,8 +43,53 @@ All client requests support an optional `AbortSignal`. Aborting a request does
|
|
|
43
43
|
not cancel remote compute; use `cancel_grade` and read the authoritative terminal
|
|
44
44
|
job state. Page through list responses with `nextCursor` as `afterId`.
|
|
45
45
|
|
|
46
|
+
## Connect an application
|
|
47
|
+
|
|
48
|
+
In the task format, open **Connect an application** and create a source credential.
|
|
49
|
+
Copy it into the application's secret store before closing the panel. Credentials
|
|
50
|
+
expire within 90 days and can be revoked from the same panel. The list contains
|
|
51
|
+
metadata and key prefixes only; hosts store secret hashes.
|
|
52
|
+
|
|
53
|
+
Use that credential as `OPENPOND_API_KEY` in the examples above. It authorizes
|
|
54
|
+
`submitExample`, `submitFeedback` and `sourceConfiguration(sourceId)` for exactly
|
|
55
|
+
one source and scope. Configuration returns the source and task-definition
|
|
56
|
+
references, allowed splits and enabled status. It does not expose private
|
|
57
|
+
evidence. Reading resources, grading, review, publication, training and credential
|
|
58
|
+
management require the owning user's authenticated client.
|
|
59
|
+
|
|
60
|
+
Owners can also manage credentials through the SDK:
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
import { createSourceCredentialRequest } from "openpond-sdk/learning";
|
|
64
|
+
|
|
65
|
+
const request = createSourceCredentialRequest({
|
|
66
|
+
sourceId,
|
|
67
|
+
name: "Application intake",
|
|
68
|
+
expiresAt: new Date(Date.now() + 30 * 86_400_000).toISOString(),
|
|
69
|
+
});
|
|
70
|
+
const issued = await ownerClient.createSourceCredential(request);
|
|
71
|
+
// Store issued.apiKey securely. Never log it or commit the prepared request.
|
|
72
|
+
const page = await ownerClient.listSourceCredentials(sourceId, { limit: 30 });
|
|
73
|
+
await ownerClient.revokeSourceCredential(sourceId, issued.credential.id);
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Keep the prepared request in memory for a transport retry: the same operation ID
|
|
77
|
+
and content returns the same credential, while changed content conflicts.
|
|
78
|
+
Revocation is idempotent; repeating creation does not reactivate a revoked key.
|
|
79
|
+
Use a new prepared request for a new credential. Disabling a source also prevents
|
|
80
|
+
new evidence submission. Hosts enforce authentication, expiry and source scope
|
|
81
|
+
on every request.
|
|
82
|
+
|
|
46
83
|
## Publish a reviewed batch to a hosted model
|
|
47
84
|
|
|
48
85
|
Call `learning.publishBatch({ batchId, modelProjectId })` against the hosted API after sealing an approved batch. This stores its immutable Taskset package and attaches the exact release to the model. It does not start training. The service authorizes the model and batch in the same team and deduplicates publication by release identity.
|
|
49
86
|
|
|
50
87
|
Model configuration can save `trainingSetup.rewardBindingRef` before selecting a Taskset. The reference pins a binding ID, revision and content hash; task compatibility and training readiness remain separate checks. Use `createModelProjectSaveRequest` with `createModelProjectsClient().checkConfiguration()` / `.saveConfiguration()` for hosted configuration operations, and `configurationCandidates()` for available starting models. Keep one request identity for transport retries.
|
|
88
|
+
|
|
89
|
+
## Durable authoring drafts
|
|
90
|
+
|
|
91
|
+
Reward, combined Reward and task-format editors save incomplete work separately from published releases. Use `AuthoringDraftInputSchema` with the corresponding typed fields schema. Drafts preserve incomplete JSON and JavaScript as strings; publishing still validates the finished resource. Drafts belong to the workspace and are not available to source credentials.
|
|
92
|
+
|
|
93
|
+
Send `save_draft` with a stable `operationId`, the draft input and its `expectedRevision` (zero for a new draft). Retry the identical command after an uncertain response. Distinct edits against the same revision conflict rather than overwriting each other. List with `client.list("draft", { parentId: "reward", status: "draft", limit: 20 })`; the other target kinds are `definition` and `binding`.
|
|
94
|
+
|
|
95
|
+
A draft's target and exact base release remain fixed. To publish, include `finalizeDraft: { draft: learningRef(savedDraft), targetKind: savedDraft.targetKind, release: learningRef(publishedRelease) }` in the `publish` or `publish_resources` command. The release and the draft's published status commit in one transaction; stale draft finalization rolls back publication. Archive unfinished work with `archive_draft` and its exact draft reference. Archived and published drafts cannot accept further edits.
|