openpond-sdk 0.5.11 → 0.5.12

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.
@@ -59,6 +59,7 @@ import {
59
59
  LearningReadRequestSchema,
60
60
  TaskEvidenceInspectionResultSchema,
61
61
  sameLearningRef,
62
+ LearningPolicyInspectionResultSchema,
62
63
  assertLearningRequestJson,
63
64
  learningResourceSchemas
64
65
  } from "@openpond/evals/learning";
@@ -118,6 +119,13 @@ var OpenPondLearningClient = class {
118
119
  if (!sameLearningRef(result.evidence, evidence)) throw new OpenPondLearningError(502, "evidence_identity_mismatch", "Inspection did not match the requested evidence release.", null);
119
120
  return result;
120
121
  }
122
+ /** Read current shared eligibility and budget without reserving or launching work. */
123
+ async inspectPolicy(policy, options = {}) {
124
+ const request = LearningReadRequestSchema.parse({ action: "inspect_policy", scope: this.#options.scope, policy });
125
+ const result = LearningPolicyInspectionResultSchema.parse(await this.#request("read", request, options));
126
+ if (!sameLearningRef(result.policy, policy)) throw new OpenPondLearningError(502, "policy_identity_mismatch", "Inspection did not match the requested policy release.", null);
127
+ return result;
128
+ }
121
129
  /** Prepare once with createSourceCredentialRequest and reuse it for retries. */
122
130
  async createSourceCredential(input, options = {}) {
123
131
  const request = LearningSourceCredentialRequestSchema.parse({ ...input, action: "create", scope: this.#options.scope });
@@ -217,4 +225,4 @@ export {
217
225
  OpenPondLearningError,
218
226
  OpenPondLearningClient
219
227
  };
220
- //# sourceMappingURL=chunk-TKJU3BOW.js.map
228
+ //# sourceMappingURL=chunk-5M3PPP7D.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/learning-credentials.ts", "../src/learning-client.ts"],
4
+ "sourcesContent": ["import { z } from \"zod\";\nimport { ReleaseIdSchema } from \"@openpond/harness\";\nimport { LearningRevisionRefSchema } from \"@openpond/evals/learning\";\nimport { TaskSplitSchema } from \"@openpond/evals/tasksets\";\n\n/** Source credentials can submit evidence and feedback for one source only. */\nexport const LearningSourceCredentialSchema = z.object({\n id: ReleaseIdSchema,\n scope: ReleaseIdSchema,\n sourceId: ReleaseIdSchema,\n name: z.string().trim().min(1).max(100),\n keyPrefix: z.string().min(1).max(100),\n createdAt: z.iso.datetime(),\n expiresAt: z.iso.datetime(),\n revokedAt: z.iso.datetime().nullable(),\n}).strict();\nexport type LearningSourceCredential = z.infer<typeof LearningSourceCredentialSchema>;\nexport const LearningSourceCredentialSecretSchema = z.string().regex(/^opk_key_[A-Za-z0-9]{16}_[A-Za-z0-9]{48}$/);\n\nexport const LearningSourceCredentialRequestSchema = z.discriminatedUnion(\"action\", [\n z.object({ action: z.literal(\"create\"), scope: ReleaseIdSchema, sourceId: ReleaseIdSchema, name: z.string().trim().min(1).max(100), expiresAt: z.iso.datetime(), operationId: ReleaseIdSchema, apiKey: LearningSourceCredentialSecretSchema }).strict(),\n z.object({ action: z.literal(\"list\"), scope: ReleaseIdSchema, sourceId: ReleaseIdSchema, afterId: ReleaseIdSchema.optional(), limit: z.number().int().min(1).max(100).default(30) }).strict(),\n z.object({ action: z.literal(\"revoke\"), scope: ReleaseIdSchema, sourceId: ReleaseIdSchema, id: ReleaseIdSchema }).strict(),\n]);\nexport type LearningSourceCredentialRequest = z.infer<typeof LearningSourceCredentialRequestSchema>;\nexport const LearningSourceCredentialCreatedSchema = z.object({ credential: LearningSourceCredentialSchema, apiKey: LearningSourceCredentialSecretSchema }).strict();\nexport const LearningSourceCredentialPageSchema = z.object({ items: z.array(LearningSourceCredentialSchema).max(100), nextCursor: ReleaseIdSchema.nullable() }).strict();\nexport const LearningSourceConfigurationRequestSchema = z.object({ scope: ReleaseIdSchema, sourceId: ReleaseIdSchema }).strict();\nexport const LearningSourceConfigurationSchema = z.object({\n scope: ReleaseIdSchema, source: LearningRevisionRefSchema, taskDefinition: LearningRevisionRefSchema,\n enabled: z.boolean(), allowedSplits: z.array(TaskSplitSchema).min(1).max(4),\n}).strict();\n\n/** Keep this request in memory for retries. Hosts persist hashes, never its secret. */\nexport function createSourceCredentialRequest(input: { sourceId: string; name: string; expiresAt: string }) {\n return { ...input, operationId: crypto.randomUUID(), apiKey: `opk_key_${randomToken(16)}_${randomToken(48)}` };\n}\n\nfunction randomToken(length: number): string {\n const alphabet = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\n let value = \"\";\n while (value.length < length) {\n for (const byte of crypto.getRandomValues(new Uint8Array(64))) {\n // Rejection sampling avoids modulo bias in the 62-character alphabet.\n if (byte < 248) value += alphabet[byte % 62];\n if (value.length === length) return value;\n }\n }\n return value;\n}\n\n/** Hosts enforce expiry when issuing and authenticating; tokens are never permanent. */\nexport function assertLearningCredentialExpiry(expiresAt: string, now: Date): void {\n const expires = Date.parse(z.iso.datetime().parse(expiresAt));\n if (expires <= now.getTime() || expires > now.getTime() + 90 * 24 * 60 * 60 * 1_000) throw new Error(\"Source credentials must expire within 90 days.\");\n}\n", "import { z } from \"zod\";\nimport {\n LearningCommandRequestSchema, LearningOperationResultSchema, LearningReadRequestSchema,\n TaskEvidenceInspectionResultSchema, sameLearningRef, type LearningRevisionRef,\n LearningPolicyInspectionResultSchema,\n assertLearningRequestJson,\n learningResourceSchemas, type LearningCommand, type LearningOperationResult,\n type LearningResourceFor, type LearningResourceKind, type LearningResourcePage,\n type LearningResourceQuery, type TaskExampleSubmission, type TaskFeedbackSubmission,\n} from \"@openpond/evals/learning\";\nimport { assertBoundedTaskJson } from \"@openpond/evals/task-schema\";\nimport { LearningSourceCredentialSchema, LearningSourceCredentialRequestSchema, LearningSourceCredentialCreatedSchema, LearningSourceCredentialPageSchema, LearningSourceConfigurationRequestSchema, LearningSourceConfigurationSchema, type LearningSourceCredentialRequest } from \"./learning-credentials.js\";\n\nexport interface OpenPondLearningClientOptions {\n apiKey: string;\n baseUrl: string;\n /** Local profile or hosted team scope. The server checks the credential's ownership. */\n scope: string;\n fetch?: typeof globalThis.fetch;\n}\nexport interface LearningRequestOptions { signal?: AbortSignal }\nexport const LearningBatchPublicationSchema = z.object({\n batchId: z.string().trim().min(1).max(500), modelProjectId: z.string().trim().min(1).max(500),\n}).strict();\nexport const LearningBatchPublicationResultSchema = z.object({\n batchId: z.string().min(1), projectId: z.string().min(1), tasksetId: z.string().min(1),\n releaseId: z.string().min(1), revision: z.number().int().positive(), contentHash: z.string().regex(/^[a-f0-9]{64}$/),\n}).strict();\nexport class OpenPondLearningError extends Error {\n constructor(readonly status: number, readonly code: string, message: string, readonly details: unknown) {\n super(message);\n this.name = \"OpenPondLearningError\";\n }\n}\n\n/** The same portable commands are sent to the local and hosted execution owner. */\nexport class OpenPondLearningClient {\n readonly #options: OpenPondLearningClientOptions;\n constructor(options: OpenPondLearningClientOptions) {\n if (!options.apiKey.trim() || !options.scope.trim()) throw new Error(\"Learning API key and scope are required.\");\n const url = new URL(options.baseUrl);\n if (![\"http:\", \"https:\"].includes(url.protocol) || url.username || url.password || url.search || url.hash) throw new Error(\"Learning base URL must be an HTTP(S) endpoint without credentials, query, or fragment.\");\n this.#options = { ...options, baseUrl: url.toString().replace(/\\/+$/, \"\") };\n }\n\n async command(command: LearningCommand, options: LearningRequestOptions = {}): Promise<LearningOperationResult> {\n assertLearningRequestJson(command);\n const request = LearningCommandRequestSchema.parse({ scope: this.#options.scope, command });\n const result = LearningOperationResultSchema.parse(await this.#request(\"commands\", request, options));\n if (result.operationId !== command.operationId) throw new OpenPondLearningError(502, \"operation_identity_mismatch\", \"Learning response did not match the submitted operation.\", null);\n return result;\n }\n\n submitExample(example: TaskExampleSubmission, options: LearningRequestOptions = {}) {\n return this.command({ action: \"submit_example\", operationId: example.idempotencyKey, example }, options);\n }\n\n submitFeedback(feedback: TaskFeedbackSubmission, options: LearningRequestOptions = {}) {\n return this.command({ action: \"submit_feedback\", operationId: feedback.idempotencyKey, feedback }, options);\n }\n\n async get<K extends LearningResourceKind>(kind: K, id: string, revision?: number, options: LearningRequestOptions = {}): Promise<LearningResourceFor<K>> {\n const request = LearningReadRequestSchema.parse({ action: \"get\", scope: this.#options.scope, kind, id, ...(revision === undefined ? {} : { revision }) });\n return learningResourceSchemas[kind].parse(await this.#request(\"read\", request, options)) as LearningResourceFor<K>;\n }\n\n async inspectEvidence(evidence: LearningRevisionRef, options: LearningRequestOptions = {}) {\n const request = LearningReadRequestSchema.parse({ action: \"inspect_evidence\", scope: this.#options.scope, evidence });\n const result = TaskEvidenceInspectionResultSchema.parse(await this.#request(\"read\", request, options));\n if (!sameLearningRef(result.evidence, evidence)) throw new OpenPondLearningError(502, \"evidence_identity_mismatch\", \"Inspection did not match the requested evidence release.\", null);\n return result;\n }\n\n /** Read current shared eligibility and budget without reserving or launching work. */\n async inspectPolicy(policy: LearningRevisionRef, options: LearningRequestOptions = {}) {\n const request = LearningReadRequestSchema.parse({ action: \"inspect_policy\", scope: this.#options.scope, policy });\n const result = LearningPolicyInspectionResultSchema.parse(await this.#request(\"read\", request, options));\n if (!sameLearningRef(result.policy, policy)) throw new OpenPondLearningError(502, \"policy_identity_mismatch\", \"Inspection did not match the requested policy release.\", null);\n return result;\n }\n\n /** Prepare once with createSourceCredentialRequest and reuse it for retries. */\n async createSourceCredential(input: Omit<Extract<LearningSourceCredentialRequest, { action: \"create\" }>, \"action\" | \"scope\">, options: LearningRequestOptions = {}) {\n const request = LearningSourceCredentialRequestSchema.parse({ ...input, action: \"create\", scope: this.#options.scope });\n const result = LearningSourceCredentialCreatedSchema.parse(await this.#request(\"credentials\", request, options));\n this.#assertCredentialScope(result.credential, input.sourceId);\n if (result.apiKey !== input.apiKey || !input.apiKey.startsWith(`${result.credential.keyPrefix}_`)) throw new OpenPondLearningError(502, \"credential_identity_mismatch\", \"Credential response did not match the prepared credential.\", null);\n return result;\n }\n\n async listSourceCredentials(sourceId: string, query: { afterId?: string; limit?: number } = {}, options: LearningRequestOptions = {}) {\n const request = LearningSourceCredentialRequestSchema.parse({ ...query, action: \"list\", scope: this.#options.scope, sourceId });\n const result = LearningSourceCredentialPageSchema.parse(await this.#request(\"credentials\", request, options));\n if (result.items.length > (query.limit ?? 30)) throw new OpenPondLearningError(502, \"credential_page_invalid\", \"Credential response exceeded the requested page size.\", null);\n for (const item of result.items) this.#assertCredentialScope(item, sourceId);\n return result;\n }\n\n async revokeSourceCredential(sourceId: string, id: string, options: LearningRequestOptions = {}) {\n const request = LearningSourceCredentialRequestSchema.parse({ action: \"revoke\", scope: this.#options.scope, sourceId, id });\n const result = LearningSourceCredentialSchema.parse(await this.#request(\"credentials\", request, options));\n this.#assertCredentialScope(result, sourceId);\n if (result.id !== id || result.revokedAt === null) throw new OpenPondLearningError(502, \"credential_revocation_mismatch\", \"Credential revocation did not match the requested credential.\", null);\n return result;\n }\n\n async sourceConfiguration(sourceId: string, options: LearningRequestOptions = {}) {\n const request = LearningSourceConfigurationRequestSchema.parse({ scope: this.#options.scope, sourceId });\n const result = LearningSourceConfigurationSchema.parse(await this.#request(\"source-config\", request, options));\n if (result.scope !== this.#options.scope || result.source.id !== sourceId) throw new OpenPondLearningError(502, \"source_identity_mismatch\", \"Source configuration did not match the requested source.\", null);\n return result;\n }\n\n #assertCredentialScope(value: { scope: string; sourceId: string }, sourceId: string) {\n if (value.scope !== this.#options.scope || value.sourceId !== sourceId) throw new OpenPondLearningError(502, \"credential_scope_mismatch\", \"Credential response did not match the requested source.\", null);\n }\n\n async list<K extends LearningResourceKind>(kind: K, query: Partial<LearningResourceQuery> = {}, options: LearningRequestOptions = {}): Promise<LearningResourcePage<K>> {\n const request = LearningReadRequestSchema.parse({ action: \"list\", scope: this.#options.scope, kind, ...query });\n return z.object({ items: z.array(learningResourceSchemas[kind]).max(100), nextCursor: z.string().nullable() }).strict().parse(await this.#request(\"read\", request, options)) as LearningResourcePage<K>;\n }\n\n /** Hosted publication only: stores an immutable package and attaches it, without starting training. */\n async publishBatch(input: z.infer<typeof LearningBatchPublicationSchema>, options: LearningRequestOptions = {}) {\n const request = LearningBatchPublicationSchema.parse(input);\n const result = LearningBatchPublicationResultSchema.parse(await this.#request(\"publish-batch\", { ...request, scope: this.#options.scope }, options));\n if (result.batchId !== request.batchId) throw new OpenPondLearningError(502, \"batch_identity_mismatch\", \"Published batch response did not match the requested batch.\", null);\n return result;\n }\n\n async #request(endpoint: \"commands\" | \"read\" | \"publish-batch\" | \"credentials\" | \"source-config\", body: unknown, options: LearningRequestOptions): Promise<unknown> {\n assertBoundedTaskJson(body, 16_777_216);\n const response = await (this.#options.fetch ?? globalThis.fetch)(`${this.#options.baseUrl}/v1/learning/${endpoint}`, {\n method: \"POST\", headers: { Authorization: `Bearer ${this.#options.apiKey}`, \"Content-Type\": \"application/json\", Accept: \"application/json\", \"X-OpenPond-Team-Id\": this.#options.scope }, body: JSON.stringify(body), signal: options.signal,\n redirect: \"error\",\n });\n const payload = await readBoundedLearningResponse(response);\n if (!response.ok) {\n const error = z.object({ code: z.string().optional(), error: z.string().optional() }).passthrough().safeParse(payload);\n throw new OpenPondLearningError(response.status, error.success ? error.data.code ?? \"learning_request_failed\" : \"learning_request_failed\", error.success ? error.data.error ?? `Learning request failed (${response.status}).` : `Learning request failed (${response.status}).`, payload);\n }\n return payload;\n }\n}\n\nasync function readBoundedLearningResponse(response: Response): Promise<unknown> {\n const maximumBytes = 16_777_216;\n const reader = response.body?.getReader();\n if (!reader) throw new OpenPondLearningError(response.status, \"empty_response\", \"Learning response was empty.\", null);\n const decoder = new TextDecoder();\n let bytes = 0;\n let text = \"\";\n try {\n while (true) {\n const next = await reader.read();\n if (next.done) break;\n bytes += next.value.byteLength;\n if (bytes > maximumBytes) throw new OpenPondLearningError(response.status, \"response_too_large\", \"Learning response exceeded 16 MiB; request a smaller page.\", null);\n text += decoder.decode(next.value, { stream: true });\n }\n text += decoder.decode();\n const value: unknown = JSON.parse(text);\n assertBoundedTaskJson(value, maximumBytes);\n return value;\n } finally {\n await reader.cancel();\n reader.releaseLock();\n }\n}\n"],
5
+ "mappings": ";;;;;AAAA,SAAS,SAAS;AAElB,SAAS,iCAAiC;AAC1C,SAAS,u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ACT;AACF;AAEA,eAAe,4BAA4B,UAAsC;AAC/E,QAAM,eAAe;AACrB,QAAM,SAAS,SAAS,MAAM,UAAU;AACxC,MAAI,CAAC,OAAQ,OAAM,IAAI,sBAAsB,SAAS,QAAQ,kBAAkB,gCAAgC,IAAI;AACpH,QAAM,UAAU,IAAI,YAAY;AAChC,MAAI,QAAQ;AACZ,MAAI,OAAO;AACX,MAAI;AACF,WAAO,MAAM;AACX,YAAM,OAAO,MAAM,OAAO,KAAK;AAC/B,UAAI,KAAK,KAAM;AACf,eAAS,KAAK,MAAM;AACpB,UAAI,QAAQ,aAAc,OAAM,IAAI,sBAAsB,SAAS,QAAQ,sBAAsB,8DAA8D,IAAI;AACnK,cAAQ,QAAQ,OAAO,KAAK,OAAO,EAAE,QAAQ,KAAK,CAAC;AAAA,IACrD;AACA,YAAQ,QAAQ,OAAO;AACvB,UAAM,QAAiB,KAAK,MAAM,IAAI;AACtC,0BAAsB,OAAO,YAAY;AACzC,WAAO;AAAA,EACT,UAAE;AACA,UAAM,OAAO,OAAO;AACpB,WAAO,YAAY;AAAA,EACrB;AACF;",
6
+ "names": ["z", "z"]
7
+ }
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  OpenPondLearningClient,
3
3
  OpenPondLearningError
4
- } from "./chunk-TKJU3BOW.js";
4
+ } from "./chunk-5M3PPP7D.js";
5
5
  import "./chunk-5FBPNWT4.js";
6
6
  import {
7
7
  OpenPondProjectActionsClient
package/dist/learning.js CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  OpenPondLearningError,
13
13
  assertLearningCredentialExpiry,
14
14
  createSourceCredentialRequest
15
- } from "./chunk-TKJU3BOW.js";
15
+ } from "./chunk-5M3PPP7D.js";
16
16
  import "./chunk-5FBPNWT4.js";
17
17
  import "./chunk-QUOW6URQ.js";
18
18
 
@@ -59,6 +59,46 @@ export declare class OpenPondLearningClient {
59
59
  }[];
60
60
  };
61
61
  }>;
62
+ /** Read current shared eligibility and budget without reserving or launching work. */
63
+ inspectPolicy(policy: LearningRevisionRef, options?: LearningRequestOptions): Promise<{
64
+ policy: {
65
+ id: string;
66
+ contentHash: string;
67
+ revision: number;
68
+ };
69
+ modelProjectId: string;
70
+ inspectedAt: string;
71
+ chain: {
72
+ schemaVersion: "openpond.learningChain.v1";
73
+ id: string;
74
+ revision: number;
75
+ modelProjectId: string;
76
+ activeIterationId: string | null;
77
+ latestIterationId: string;
78
+ lastReservedAt: string | null;
79
+ updatedAt: string;
80
+ } | null;
81
+ counts: {
82
+ eligible: number;
83
+ awaitingReview: number;
84
+ excluded: number;
85
+ consumed: number;
86
+ } | null;
87
+ minimumApprovedExamples: number;
88
+ canReserve: boolean;
89
+ blockers: {
90
+ code: string;
91
+ message: string;
92
+ }[];
93
+ cooldownUntil: string | null;
94
+ budget: {
95
+ reservedSpendUsd: number;
96
+ settledSpendUsd: number;
97
+ committedSpendUsd: number;
98
+ maximumIterationSpendUsd: number;
99
+ maximumDailySpendUsd: number;
100
+ };
101
+ }>;
62
102
  /** Prepare once with createSourceCredentialRequest and reuse it for retries. */
63
103
  createSourceCredential(input: Omit<Extract<LearningSourceCredentialRequest, {
64
104
  action: "create";
@@ -1 +1 @@
1
- {"version":3,"file":"learning-client.d.ts","sourceRoot":"","sources":["../../../../../src/learning-client.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;AAElC,OAAO,EAAiO,KAAK,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AAEhT,MAAM,WAAW,6BAA6B;IAC5C,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAOrF,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openpond-sdk",
3
- "version": "0.5.11",
3
+ "version": "0.5.12",
4
4
  "description": "Server-side TypeScript SDK for OpenPond sandboxes and agentic work",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -139,7 +139,7 @@
139
139
  "vitest": "4.1.10"
140
140
  },
141
141
  "dependencies": {
142
- "@openpond/evals": "^0.10.4",
142
+ "@openpond/evals": "^0.10.5",
143
143
  "@openpond/harness": "^0.3.0",
144
144
  "esbuild": "0.28.1",
145
145
  "zod": "^4.1.13"
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/learning-credentials.ts", "../src/learning-client.ts"],
4
- "sourcesContent": ["import { z } from \"zod\";\nimport { ReleaseIdSchema } from \"@openpond/harness\";\nimport { LearningRevisionRefSchema } from \"@openpond/evals/learning\";\nimport { TaskSplitSchema } from \"@openpond/evals/tasksets\";\n\n/** Source credentials can submit evidence and feedback for one source only. */\nexport const LearningSourceCredentialSchema = z.object({\n id: ReleaseIdSchema,\n scope: ReleaseIdSchema,\n sourceId: ReleaseIdSchema,\n name: z.string().trim().min(1).max(100),\n keyPrefix: z.string().min(1).max(100),\n createdAt: z.iso.datetime(),\n expiresAt: z.iso.datetime(),\n revokedAt: z.iso.datetime().nullable(),\n}).strict();\nexport type LearningSourceCredential = z.infer<typeof LearningSourceCredentialSchema>;\nexport const LearningSourceCredentialSecretSchema = z.string().regex(/^opk_key_[A-Za-z0-9]{16}_[A-Za-z0-9]{48}$/);\n\nexport const LearningSourceCredentialRequestSchema = z.discriminatedUnion(\"action\", [\n z.object({ action: z.literal(\"create\"), scope: ReleaseIdSchema, sourceId: ReleaseIdSchema, name: z.string().trim().min(1).max(100), expiresAt: z.iso.datetime(), operationId: ReleaseIdSchema, apiKey: LearningSourceCredentialSecretSchema }).strict(),\n z.object({ action: z.literal(\"list\"), scope: ReleaseIdSchema, sourceId: ReleaseIdSchema, afterId: ReleaseIdSchema.optional(), limit: z.number().int().min(1).max(100).default(30) }).strict(),\n z.object({ action: z.literal(\"revoke\"), scope: ReleaseIdSchema, sourceId: ReleaseIdSchema, id: ReleaseIdSchema }).strict(),\n]);\nexport type LearningSourceCredentialRequest = z.infer<typeof LearningSourceCredentialRequestSchema>;\nexport const LearningSourceCredentialCreatedSchema = z.object({ credential: LearningSourceCredentialSchema, apiKey: LearningSourceCredentialSecretSchema }).strict();\nexport const LearningSourceCredentialPageSchema = z.object({ items: z.array(LearningSourceCredentialSchema).max(100), nextCursor: ReleaseIdSchema.nullable() }).strict();\nexport const LearningSourceConfigurationRequestSchema = z.object({ scope: ReleaseIdSchema, sourceId: ReleaseIdSchema }).strict();\nexport const LearningSourceConfigurationSchema = z.object({\n scope: ReleaseIdSchema, source: LearningRevisionRefSchema, taskDefinition: LearningRevisionRefSchema,\n enabled: z.boolean(), allowedSplits: z.array(TaskSplitSchema).min(1).max(4),\n}).strict();\n\n/** Keep this request in memory for retries. Hosts persist hashes, never its secret. */\nexport function createSourceCredentialRequest(input: { sourceId: string; name: string; expiresAt: string }) {\n return { ...input, operationId: crypto.randomUUID(), apiKey: `opk_key_${randomToken(16)}_${randomToken(48)}` };\n}\n\nfunction randomToken(length: number): string {\n const alphabet = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\n let value = \"\";\n while (value.length < length) {\n for (const byte of crypto.getRandomValues(new Uint8Array(64))) {\n // Rejection sampling avoids modulo bias in the 62-character alphabet.\n if (byte < 248) value += alphabet[byte % 62];\n if (value.length === length) return value;\n }\n }\n return value;\n}\n\n/** Hosts enforce expiry when issuing and authenticating; tokens are never permanent. */\nexport function assertLearningCredentialExpiry(expiresAt: string, now: Date): void {\n const expires = Date.parse(z.iso.datetime().parse(expiresAt));\n if (expires <= now.getTime() || expires > now.getTime() + 90 * 24 * 60 * 60 * 1_000) throw new Error(\"Source credentials must expire within 90 days.\");\n}\n", "import { z } from \"zod\";\nimport {\n LearningCommandRequestSchema, LearningOperationResultSchema, LearningReadRequestSchema,\n TaskEvidenceInspectionResultSchema, sameLearningRef, type LearningRevisionRef,\n assertLearningRequestJson,\n learningResourceSchemas, type LearningCommand, type LearningOperationResult,\n type LearningResourceFor, type LearningResourceKind, type LearningResourcePage,\n type LearningResourceQuery, type TaskExampleSubmission, type TaskFeedbackSubmission,\n} from \"@openpond/evals/learning\";\nimport { assertBoundedTaskJson } from \"@openpond/evals/task-schema\";\nimport { LearningSourceCredentialSchema, LearningSourceCredentialRequestSchema, LearningSourceCredentialCreatedSchema, LearningSourceCredentialPageSchema, LearningSourceConfigurationRequestSchema, LearningSourceConfigurationSchema, type LearningSourceCredentialRequest } from \"./learning-credentials.js\";\n\nexport interface OpenPondLearningClientOptions {\n apiKey: string;\n baseUrl: string;\n /** Local profile or hosted team scope. The server checks the credential's ownership. */\n scope: string;\n fetch?: typeof globalThis.fetch;\n}\nexport interface LearningRequestOptions { signal?: AbortSignal }\nexport const LearningBatchPublicationSchema = z.object({\n batchId: z.string().trim().min(1).max(500), modelProjectId: z.string().trim().min(1).max(500),\n}).strict();\nexport const LearningBatchPublicationResultSchema = z.object({\n batchId: z.string().min(1), projectId: z.string().min(1), tasksetId: z.string().min(1),\n releaseId: z.string().min(1), revision: z.number().int().positive(), contentHash: z.string().regex(/^[a-f0-9]{64}$/),\n}).strict();\nexport class OpenPondLearningError extends Error {\n constructor(readonly status: number, readonly code: string, message: string, readonly details: unknown) {\n super(message);\n this.name = \"OpenPondLearningError\";\n }\n}\n\n/** The same portable commands are sent to the local and hosted execution owner. */\nexport class OpenPondLearningClient {\n readonly #options: OpenPondLearningClientOptions;\n constructor(options: OpenPondLearningClientOptions) {\n if (!options.apiKey.trim() || !options.scope.trim()) throw new Error(\"Learning API key and scope are required.\");\n const url = new URL(options.baseUrl);\n if (![\"http:\", \"https:\"].includes(url.protocol) || url.username || url.password || url.search || url.hash) throw new Error(\"Learning base URL must be an HTTP(S) endpoint without credentials, query, or fragment.\");\n this.#options = { ...options, baseUrl: url.toString().replace(/\\/+$/, \"\") };\n }\n\n async command(command: LearningCommand, options: LearningRequestOptions = {}): Promise<LearningOperationResult> {\n assertLearningRequestJson(command);\n const request = LearningCommandRequestSchema.parse({ scope: this.#options.scope, command });\n const result = LearningOperationResultSchema.parse(await this.#request(\"commands\", request, options));\n if (result.operationId !== command.operationId) throw new OpenPondLearningError(502, \"operation_identity_mismatch\", \"Learning response did not match the submitted operation.\", null);\n return result;\n }\n\n submitExample(example: TaskExampleSubmission, options: LearningRequestOptions = {}) {\n return this.command({ action: \"submit_example\", operationId: example.idempotencyKey, example }, options);\n }\n\n submitFeedback(feedback: TaskFeedbackSubmission, options: LearningRequestOptions = {}) {\n return this.command({ action: \"submit_feedback\", operationId: feedback.idempotencyKey, feedback }, options);\n }\n\n async get<K extends LearningResourceKind>(kind: K, id: string, revision?: number, options: LearningRequestOptions = {}): Promise<LearningResourceFor<K>> {\n const request = LearningReadRequestSchema.parse({ action: \"get\", scope: this.#options.scope, kind, id, ...(revision === undefined ? {} : { revision }) });\n return learningResourceSchemas[kind].parse(await this.#request(\"read\", request, options)) as LearningResourceFor<K>;\n }\n\n async inspectEvidence(evidence: LearningRevisionRef, options: LearningRequestOptions = {}) {\n const request = LearningReadRequestSchema.parse({ action: \"inspect_evidence\", scope: this.#options.scope, evidence });\n const result = TaskEvidenceInspectionResultSchema.parse(await this.#request(\"read\", request, options));\n if (!sameLearningRef(result.evidence, evidence)) throw new OpenPondLearningError(502, \"evidence_identity_mismatch\", \"Inspection did not match the requested evidence release.\", null);\n return result;\n }\n\n /** Prepare once with createSourceCredentialRequest and reuse it for retries. */\n async createSourceCredential(input: Omit<Extract<LearningSourceCredentialRequest, { action: \"create\" }>, \"action\" | \"scope\">, options: LearningRequestOptions = {}) {\n const request = LearningSourceCredentialRequestSchema.parse({ ...input, action: \"create\", scope: this.#options.scope });\n const result = LearningSourceCredentialCreatedSchema.parse(await this.#request(\"credentials\", request, options));\n this.#assertCredentialScope(result.credential, input.sourceId);\n if (result.apiKey !== input.apiKey || !input.apiKey.startsWith(`${result.credential.keyPrefix}_`)) throw new OpenPondLearningError(502, \"credential_identity_mismatch\", \"Credential response did not match the prepared credential.\", null);\n return result;\n }\n\n async listSourceCredentials(sourceId: string, query: { afterId?: string; limit?: number } = {}, options: LearningRequestOptions = {}) {\n const request = LearningSourceCredentialRequestSchema.parse({ ...query, action: \"list\", scope: this.#options.scope, sourceId });\n const result = LearningSourceCredentialPageSchema.parse(await this.#request(\"credentials\", request, options));\n if (result.items.length > (query.limit ?? 30)) throw new OpenPondLearningError(502, \"credential_page_invalid\", \"Credential response exceeded the requested page size.\", null);\n for (const item of result.items) this.#assertCredentialScope(item, sourceId);\n return result;\n }\n\n async revokeSourceCredential(sourceId: string, id: string, options: LearningRequestOptions = {}) {\n const request = LearningSourceCredentialRequestSchema.parse({ action: \"revoke\", scope: this.#options.scope, sourceId, id });\n const result = LearningSourceCredentialSchema.parse(await this.#request(\"credentials\", request, options));\n this.#assertCredentialScope(result, sourceId);\n if (result.id !== id || result.revokedAt === null) throw new OpenPondLearningError(502, \"credential_revocation_mismatch\", \"Credential revocation did not match the requested credential.\", null);\n return result;\n }\n\n async sourceConfiguration(sourceId: string, options: LearningRequestOptions = {}) {\n const request = LearningSourceConfigurationRequestSchema.parse({ scope: this.#options.scope, sourceId });\n const result = LearningSourceConfigurationSchema.parse(await this.#request(\"source-config\", request, options));\n if (result.scope !== this.#options.scope || result.source.id !== sourceId) throw new OpenPondLearningError(502, \"source_identity_mismatch\", \"Source configuration did not match the requested source.\", null);\n return result;\n }\n\n #assertCredentialScope(value: { scope: string; sourceId: string }, sourceId: string) {\n if (value.scope !== this.#options.scope || value.sourceId !== sourceId) throw new OpenPondLearningError(502, \"credential_scope_mismatch\", \"Credential response did not match the requested source.\", null);\n }\n\n async list<K extends LearningResourceKind>(kind: K, query: Partial<LearningResourceQuery> = {}, options: LearningRequestOptions = {}): Promise<LearningResourcePage<K>> {\n const request = LearningReadRequestSchema.parse({ action: \"list\", scope: this.#options.scope, kind, ...query });\n return z.object({ items: z.array(learningResourceSchemas[kind]).max(100), nextCursor: z.string().nullable() }).strict().parse(await this.#request(\"read\", request, options)) as LearningResourcePage<K>;\n }\n\n /** Hosted publication only: stores an immutable package and attaches it, without starting training. */\n async publishBatch(input: z.infer<typeof LearningBatchPublicationSchema>, options: LearningRequestOptions = {}) {\n const request = LearningBatchPublicationSchema.parse(input);\n const result = LearningBatchPublicationResultSchema.parse(await this.#request(\"publish-batch\", { ...request, scope: this.#options.scope }, options));\n if (result.batchId !== request.batchId) throw new OpenPondLearningError(502, \"batch_identity_mismatch\", \"Published batch response did not match the requested batch.\", null);\n return result;\n }\n\n async #request(endpoint: \"commands\" | \"read\" | \"publish-batch\" | \"credentials\" | \"source-config\", body: unknown, options: LearningRequestOptions): Promise<unknown> {\n assertBoundedTaskJson(body, 16_777_216);\n const response = await (this.#options.fetch ?? globalThis.fetch)(`${this.#options.baseUrl}/v1/learning/${endpoint}`, {\n method: \"POST\", headers: { Authorization: `Bearer ${this.#options.apiKey}`, \"Content-Type\": \"application/json\", Accept: \"application/json\", \"X-OpenPond-Team-Id\": this.#options.scope }, body: JSON.stringify(body), signal: options.signal,\n redirect: \"error\",\n });\n const payload = await readBoundedLearningResponse(response);\n if (!response.ok) {\n const error = z.object({ code: z.string().optional(), error: z.string().optional() }).passthrough().safeParse(payload);\n throw new OpenPondLearningError(response.status, error.success ? error.data.code ?? \"learning_request_failed\" : \"learning_request_failed\", error.success ? error.data.error ?? `Learning request failed (${response.status}).` : `Learning request failed (${response.status}).`, payload);\n }\n return payload;\n }\n}\n\nasync function readBoundedLearningResponse(response: Response): Promise<unknown> {\n const maximumBytes = 16_777_216;\n const reader = response.body?.getReader();\n if (!reader) throw new OpenPondLearningError(response.status, \"empty_response\", \"Learning response was empty.\", null);\n const decoder = new TextDecoder();\n let bytes = 0;\n let text = \"\";\n try {\n while (true) {\n const next = await reader.read();\n if (next.done) break;\n bytes += next.value.byteLength;\n if (bytes > maximumBytes) throw new OpenPondLearningError(response.status, \"response_too_large\", \"Learning response exceeded 16 MiB; request a smaller page.\", null);\n text += decoder.decode(next.value, { stream: true });\n }\n text += decoder.decode();\n const value: unknown = JSON.parse(text);\n assertBoundedTaskJson(value, maximumBytes);\n return value;\n } finally {\n await reader.cancel();\n reader.releaseLock();\n }\n}\n"],
5
- "mappings": ";;;;;AAAA,SAAS,SAAS;AAElB,SAAS,iCAAiC;AAC1C,SAAS,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