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.
@@ -0,0 +1,100 @@
1
+ import { z } from "zod";
2
+ /** Source credentials can submit evidence and feedback for one source only. */
3
+ export declare const LearningSourceCredentialSchema: z.ZodObject<{
4
+ id: z.ZodString;
5
+ scope: z.ZodString;
6
+ sourceId: z.ZodString;
7
+ name: z.ZodString;
8
+ keyPrefix: z.ZodString;
9
+ createdAt: z.ZodISODateTime;
10
+ expiresAt: z.ZodISODateTime;
11
+ revokedAt: z.ZodNullable<z.ZodISODateTime>;
12
+ }, z.core.$strict>;
13
+ export type LearningSourceCredential = z.infer<typeof LearningSourceCredentialSchema>;
14
+ export declare const LearningSourceCredentialSecretSchema: z.ZodString;
15
+ export declare const LearningSourceCredentialRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
16
+ action: z.ZodLiteral<"create">;
17
+ scope: z.ZodString;
18
+ sourceId: z.ZodString;
19
+ name: z.ZodString;
20
+ expiresAt: z.ZodISODateTime;
21
+ operationId: z.ZodString;
22
+ apiKey: z.ZodString;
23
+ }, z.core.$strict>, z.ZodObject<{
24
+ action: z.ZodLiteral<"list">;
25
+ scope: z.ZodString;
26
+ sourceId: z.ZodString;
27
+ afterId: z.ZodOptional<z.ZodString>;
28
+ limit: z.ZodDefault<z.ZodNumber>;
29
+ }, z.core.$strict>, z.ZodObject<{
30
+ action: z.ZodLiteral<"revoke">;
31
+ scope: z.ZodString;
32
+ sourceId: z.ZodString;
33
+ id: z.ZodString;
34
+ }, z.core.$strict>], "action">;
35
+ export type LearningSourceCredentialRequest = z.infer<typeof LearningSourceCredentialRequestSchema>;
36
+ export declare const LearningSourceCredentialCreatedSchema: z.ZodObject<{
37
+ credential: z.ZodObject<{
38
+ id: z.ZodString;
39
+ scope: z.ZodString;
40
+ sourceId: z.ZodString;
41
+ name: z.ZodString;
42
+ keyPrefix: z.ZodString;
43
+ createdAt: z.ZodISODateTime;
44
+ expiresAt: z.ZodISODateTime;
45
+ revokedAt: z.ZodNullable<z.ZodISODateTime>;
46
+ }, z.core.$strict>;
47
+ apiKey: z.ZodString;
48
+ }, z.core.$strict>;
49
+ export declare const LearningSourceCredentialPageSchema: z.ZodObject<{
50
+ items: z.ZodArray<z.ZodObject<{
51
+ id: z.ZodString;
52
+ scope: z.ZodString;
53
+ sourceId: z.ZodString;
54
+ name: z.ZodString;
55
+ keyPrefix: z.ZodString;
56
+ createdAt: z.ZodISODateTime;
57
+ expiresAt: z.ZodISODateTime;
58
+ revokedAt: z.ZodNullable<z.ZodISODateTime>;
59
+ }, z.core.$strict>>;
60
+ nextCursor: z.ZodNullable<z.ZodString>;
61
+ }, z.core.$strict>;
62
+ export declare const LearningSourceConfigurationRequestSchema: z.ZodObject<{
63
+ scope: z.ZodString;
64
+ sourceId: z.ZodString;
65
+ }, z.core.$strict>;
66
+ export declare const LearningSourceConfigurationSchema: z.ZodObject<{
67
+ scope: z.ZodString;
68
+ source: z.ZodObject<{
69
+ id: z.ZodString;
70
+ contentHash: z.ZodString;
71
+ revision: z.ZodNumber;
72
+ }, z.core.$strict>;
73
+ taskDefinition: z.ZodObject<{
74
+ id: z.ZodString;
75
+ contentHash: z.ZodString;
76
+ revision: z.ZodNumber;
77
+ }, z.core.$strict>;
78
+ enabled: z.ZodBoolean;
79
+ allowedSplits: z.ZodArray<z.ZodEnum<{
80
+ train: "train";
81
+ validation: "validation";
82
+ test: "test";
83
+ frozen_eval: "frozen_eval";
84
+ }>>;
85
+ }, z.core.$strict>;
86
+ /** Keep this request in memory for retries. Hosts persist hashes, never its secret. */
87
+ export declare function createSourceCredentialRequest(input: {
88
+ sourceId: string;
89
+ name: string;
90
+ expiresAt: string;
91
+ }): {
92
+ operationId: `${string}-${string}-${string}-${string}-${string}`;
93
+ apiKey: string;
94
+ sourceId: string;
95
+ name: string;
96
+ expiresAt: string;
97
+ };
98
+ /** Hosts enforce expiry when issuing and authenticating; tokens are never permanent. */
99
+ export declare function assertLearningCredentialExpiry(expiresAt: string, now: Date): void;
100
+ //# sourceMappingURL=learning-credentials.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"learning-credentials.d.ts","sourceRoot":"","sources":["../../../../../src/learning-credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,+EAA+E;AAC/E,eAAO,MAAM,8BAA8B;;;;;;;;;kBAShC,CAAC;AACZ,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AACtF,eAAO,MAAM,oCAAoC,aAAgE,CAAC;AAElH,eAAO,MAAM,qCAAqC;;;;;;;;;;;;;;;;;;;8BAIhD,CAAC;AACH,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qCAAqC,CAAC,CAAC;AACpG,eAAO,MAAM,qCAAqC;;;;;;;;;;;;kBAAkH,CAAC;AACrK,eAAO,MAAM,kCAAkC;;;;;;;;;;;;kBAAyH,CAAC;AACzK,eAAO,MAAM,wCAAwC;;;kBAA2E,CAAC;AACjI,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;kBAGnC,CAAC;AAEZ,uFAAuF;AACvF,wBAAgB,6BAA6B,CAAC,KAAK,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE;;;cAAzC,MAAM;UAAQ,MAAM;eAAa,MAAM;EAEvG;AAeD,wFAAwF;AACxF,wBAAgB,8BAA8B,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,GAAG,IAAI,CAGjF"}
@@ -1,7 +1,9 @@
1
1
  import { z } from "zod";
2
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
+ import { type LearningSourceCredentialRequest } from "./learning-credentials.js";
3
4
  export * from "@openpond/evals/learning";
4
5
  export * from "@openpond/evals/rewards";
6
+ export * from "./learning-credentials.js";
5
7
  export interface OpenPondLearningClientOptions {
6
8
  apiKey: string;
7
9
  baseUrl: string;
@@ -60,6 +62,63 @@ export declare class OpenPondLearningClient {
60
62
  }[];
61
63
  };
62
64
  }>;
65
+ /** Prepare once with createSourceCredentialRequest and reuse it for retries. */
66
+ createSourceCredential(input: Omit<Extract<LearningSourceCredentialRequest, {
67
+ action: "create";
68
+ }>, "action" | "scope">, options?: LearningRequestOptions): Promise<{
69
+ credential: {
70
+ id: string;
71
+ scope: string;
72
+ sourceId: string;
73
+ name: string;
74
+ keyPrefix: string;
75
+ createdAt: string;
76
+ expiresAt: string;
77
+ revokedAt: string | null;
78
+ };
79
+ apiKey: string;
80
+ }>;
81
+ listSourceCredentials(sourceId: string, query?: {
82
+ afterId?: string;
83
+ limit?: number;
84
+ }, options?: LearningRequestOptions): Promise<{
85
+ items: {
86
+ id: string;
87
+ scope: string;
88
+ sourceId: string;
89
+ name: string;
90
+ keyPrefix: string;
91
+ createdAt: string;
92
+ expiresAt: string;
93
+ revokedAt: string | null;
94
+ }[];
95
+ nextCursor: string | null;
96
+ }>;
97
+ revokeSourceCredential(sourceId: string, id: string, options?: LearningRequestOptions): Promise<{
98
+ id: string;
99
+ scope: string;
100
+ sourceId: string;
101
+ name: string;
102
+ keyPrefix: string;
103
+ createdAt: string;
104
+ expiresAt: string;
105
+ revokedAt: string | null;
106
+ }>;
107
+ sourceConfiguration(sourceId: string, options?: LearningRequestOptions): Promise<{
108
+ scope: string;
109
+ source: {
110
+ id: string;
111
+ contentHash: string;
112
+ revision: number;
113
+ };
114
+ taskDefinition: {
115
+ id: string;
116
+ contentHash: string;
117
+ revision: number;
118
+ };
119
+ enabled: boolean;
120
+ allowedSplits: ("train" | "validation" | "test" | "frozen_eval")[];
121
+ }>;
63
122
  list<K extends LearningResourceKind>(kind: K, query?: Partial<LearningResourceQuery>, options?: LearningRequestOptions): Promise<LearningResourcePage<K>>;
64
123
  /** Hosted publication only: stores an immutable package and attaches it, without starting training. */
65
124
  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,EAEgD,KAAK,mBAAmB,EAEpD,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;CAIv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,CAAC,CAAC,CAAC,CAAC;IAKlJ,eAAe,CAAC,QAAQ,EAAE,mBAAmB,EAAE,OAAO,GAAE,sBAA2B;;;;;;;;;;;;;;;;;;;;;;IAOzF,gFAAgF;IAC1E,sBAAsB,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,+BAA+B,EAAE;QAAE,MAAM,EAAE,QAAQ,CAAA;KAAE,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,EAAE,OAAO,GAAE,sBAA2B;;;;;;;;;;;;;IAQ5J,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,GAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAO,EAAE,OAAO,GAAE,sBAA2B;;;;;;;;;;;;;IAQ9H,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,sBAA2B;;;;;;;;;;IAQzF,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,sBAA2B;;;;;;;;;;;;;;;IAW1E,IAAI,CAAC,CAAC,SAAS,oBAAoB,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,GAAE,OAAO,CAAC,qBAAqB,CAAM,EAAE,OAAO,GAAE,sBAA2B,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"}
@@ -39,7 +39,7 @@ def main():
39
39
  # Do not print request headers or echoed evidence from error bodies.
40
40
  raise RuntimeError("Learning API rejected the request (HTTP %s)." % error.code) from None
41
41
 
42
- source = post("read", {"action": "get", "scope": scope, "kind": "source", "id": source_id})
42
+ source = post("source-config", {"scope": scope, "sourceId": source_id})
43
43
  with open(filename, encoding="utf-8") as handle:
44
44
  example = json.load(handle)
45
45
  example.update(schemaVersion="openpond.taskExample.v1", sourceId=source_id, taskDefinition=source["taskDefinition"])
@@ -11,7 +11,7 @@ function required(name: string): string {
11
11
  const [sourceId, file] = process.argv.slice(2);
12
12
  if (!sourceId || !file) throw new Error("Usage: submit.ts SOURCE_ID example.json");
13
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);
14
+ const source = await client.sourceConfiguration(sourceId);
15
15
  const record: unknown = JSON.parse(await readFile(file, "utf8"));
16
16
  if (!record || typeof record !== "object" || Array.isArray(record)) throw new Error("Expected one JSON object.");
17
17
  const example = TaskExampleSubmissionSchema.parse({ ...record, schemaVersion: "openpond.taskExample.v1", sourceId, taskDefinition: source.taskDefinition });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openpond-sdk",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
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.1",
105
+ "@openpond/evals": "^0.7.2",
106
106
  "@openpond/harness": "^0.2.5",
107
107
  "esbuild": "0.28.1",
108
108
  "zod": "^4.1.13"