openpond-sdk 0.12.10 → 0.12.11
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 +2 -0
- package/dist/advanced-refiner-evaluations.js +8 -8
- package/dist/candidate-evaluations.js +7 -7
- package/dist/{chunk-QQ444G6A.js → chunk-2LVR24GU.js} +2 -2
- package/dist/{chunk-5QMREXMU.js → chunk-7BYLH47N.js} +3 -3
- package/dist/{chunk-RYDUAY52.js → chunk-C3TS766N.js} +21 -74
- package/dist/chunk-C3TS766N.js.map +1 -0
- package/dist/{chunk-HDKP6KE2.js → chunk-C4W2MEFP.js} +2 -2
- package/dist/{chunk-XJKGCU2K.js → chunk-CNREFTAV.js} +2 -2
- package/dist/{chunk-UAYXORU5.js → chunk-GHPCQXG5.js} +2 -2
- package/dist/{chunk-WOD72SFI.js → chunk-GJRXJL6G.js} +3 -3
- package/dist/{chunk-GRQWKATA.js → chunk-HAQPGTQ4.js} +2 -2
- package/dist/{chunk-7WKCQ4V5.js → chunk-IFBCLRBM.js} +2 -2
- package/dist/chunk-IZ26ZCGU.js +65 -0
- package/dist/chunk-IZ26ZCGU.js.map +1 -0
- package/dist/{chunk-ICFFZ4WC.js → chunk-JBYFD3QS.js} +3 -3
- package/dist/{chunk-4L556MYM.js → chunk-JDQVAG3R.js} +3 -3
- package/dist/{chunk-7FYPFHCQ.js → chunk-K54BDIKL.js} +3 -3
- package/dist/{chunk-ESW25WSD.js → chunk-KOJC3TH4.js} +6 -6
- package/dist/{chunk-GIEST52U.js → chunk-LHHHJIDR.js} +2 -2
- package/dist/{chunk-FC56EMHT.js → chunk-NKF5NIML.js} +6 -6
- package/dist/{chunk-LKKKTBLL.js → chunk-O3NOGKMT.js} +2 -2
- package/dist/{chunk-XNRM3QGR.js → chunk-ORYA2G7S.js} +3 -3
- package/dist/{chunk-PT72OARU.js → chunk-RIN6Z56W.js} +5 -5
- package/dist/{chunk-LT2YQCZI.js → chunk-RLW4Y5ZV.js} +2 -2
- package/dist/{chunk-PKW3II5M.js → chunk-TLSP5JKG.js} +2 -2
- package/dist/{chunk-BQ2C2Y54.js → chunk-UOV2LEXS.js} +4 -4
- package/dist/{chunk-ZZZU6XER.js → chunk-UWY5PUHR.js} +2 -2
- package/dist/{chunk-DMN6EF3R.js → chunk-XMVSQIK4.js} +2 -2
- package/dist/{chunk-WEL535AI.js → chunk-XRBM6PBD.js} +4 -4
- package/dist/{chunk-2DK7UBAG.js → chunk-YIGFQWZV.js} +3 -3
- package/dist/{chunk-IIQENUOK.js → chunk-ZYDDHHZZ.js} +3 -3
- package/dist/connected-evidence.js +14 -14
- package/dist/dataset-workspaces.js +14 -14
- package/dist/experiment-evaluation-schedules.js +18 -18
- package/dist/experiment-improvements.js +8 -8
- package/dist/experiments.js +17 -17
- package/dist/index.js +26 -25
- package/dist/index.js.map +1 -1
- package/dist/learning.js +9 -7
- package/dist/learning.js.map +1 -1
- package/dist/model-projects.js +4 -4
- package/dist/model-starter-attempts.js +3 -3
- package/dist/model-starter-catalog.js +10 -10
- package/dist/model-starters.js +10 -10
- package/dist/model-taskset-runs.js +4 -4
- package/dist/post-training.js +7 -7
- package/dist/taskset-drafts.js +13 -13
- package/dist/taskset-packages.js +15 -15
- package/dist/tool-learning-local-store.js +160 -7
- package/dist/tool-learning-local-store.js.map +1 -1
- package/dist/tool-learning.js +411 -0
- package/dist/tool-learning.js.map +1 -1
- package/dist/training-bundle.js +11 -11
- package/dist/training.js +8 -8
- package/dist/types/packages/sdk/src/tool-learning-client.d.ts +1217 -0
- package/dist/types/packages/sdk/src/tool-learning-client.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/tool-learning-local-store.d.ts +70 -2
- package/dist/types/packages/sdk/src/tool-learning-local-store.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/tool-learning.d.ts +1 -0
- package/dist/types/packages/sdk/src/tool-learning.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/training-learning-batch.d.ts +40 -40
- package/package.json +1 -1
- package/dist/chunk-RYDUAY52.js.map +0 -1
- /package/dist/{chunk-QQ444G6A.js.map → chunk-2LVR24GU.js.map} +0 -0
- /package/dist/{chunk-5QMREXMU.js.map → chunk-7BYLH47N.js.map} +0 -0
- /package/dist/{chunk-HDKP6KE2.js.map → chunk-C4W2MEFP.js.map} +0 -0
- /package/dist/{chunk-XJKGCU2K.js.map → chunk-CNREFTAV.js.map} +0 -0
- /package/dist/{chunk-UAYXORU5.js.map → chunk-GHPCQXG5.js.map} +0 -0
- /package/dist/{chunk-WOD72SFI.js.map → chunk-GJRXJL6G.js.map} +0 -0
- /package/dist/{chunk-GRQWKATA.js.map → chunk-HAQPGTQ4.js.map} +0 -0
- /package/dist/{chunk-7WKCQ4V5.js.map → chunk-IFBCLRBM.js.map} +0 -0
- /package/dist/{chunk-ICFFZ4WC.js.map → chunk-JBYFD3QS.js.map} +0 -0
- /package/dist/{chunk-4L556MYM.js.map → chunk-JDQVAG3R.js.map} +0 -0
- /package/dist/{chunk-7FYPFHCQ.js.map → chunk-K54BDIKL.js.map} +0 -0
- /package/dist/{chunk-ESW25WSD.js.map → chunk-KOJC3TH4.js.map} +0 -0
- /package/dist/{chunk-GIEST52U.js.map → chunk-LHHHJIDR.js.map} +0 -0
- /package/dist/{chunk-FC56EMHT.js.map → chunk-NKF5NIML.js.map} +0 -0
- /package/dist/{chunk-LKKKTBLL.js.map → chunk-O3NOGKMT.js.map} +0 -0
- /package/dist/{chunk-XNRM3QGR.js.map → chunk-ORYA2G7S.js.map} +0 -0
- /package/dist/{chunk-PT72OARU.js.map → chunk-RIN6Z56W.js.map} +0 -0
- /package/dist/{chunk-LT2YQCZI.js.map → chunk-RLW4Y5ZV.js.map} +0 -0
- /package/dist/{chunk-PKW3II5M.js.map → chunk-TLSP5JKG.js.map} +0 -0
- /package/dist/{chunk-BQ2C2Y54.js.map → chunk-UOV2LEXS.js.map} +0 -0
- /package/dist/{chunk-ZZZU6XER.js.map → chunk-UWY5PUHR.js.map} +0 -0
- /package/dist/{chunk-DMN6EF3R.js.map → chunk-XMVSQIK4.js.map} +0 -0
- /package/dist/{chunk-WEL535AI.js.map → chunk-XRBM6PBD.js.map} +0 -0
- /package/dist/{chunk-2DK7UBAG.js.map → chunk-YIGFQWZV.js.map} +0 -0
- /package/dist/{chunk-IIQENUOK.js.map → chunk-ZYDDHHZZ.js.map} +0 -0
package/dist/tool-learning.js
CHANGED
|
@@ -1,3 +1,414 @@
|
|
|
1
|
+
import {
|
|
2
|
+
LearningSourceCredentialSecretSchema,
|
|
3
|
+
createSourceCredentialRequest
|
|
4
|
+
} from "./chunk-IZ26ZCGU.js";
|
|
5
|
+
import {
|
|
6
|
+
readBoundedJsonResponse
|
|
7
|
+
} from "./chunk-B3ZHJ2KK.js";
|
|
8
|
+
import {
|
|
9
|
+
contentHash
|
|
10
|
+
} from "./chunk-H3JZ3P5T.js";
|
|
11
|
+
import "./chunk-YLJ4XMA6.js";
|
|
12
|
+
|
|
1
13
|
// src/tool-learning.ts
|
|
2
14
|
export * from "@openpond/evals/tool-learning";
|
|
15
|
+
|
|
16
|
+
// src/tool-learning-client.ts
|
|
17
|
+
import { z } from "zod";
|
|
18
|
+
import { LearningRevisionRefSchema } from "@openpond/evals/learning";
|
|
19
|
+
import {
|
|
20
|
+
TOOL_LEARNING_LIMITS,
|
|
21
|
+
ToolLearningRegistrationSchema,
|
|
22
|
+
ToolLearningInstallationSchema,
|
|
23
|
+
ToolLearningIdSchema,
|
|
24
|
+
ToolEpisodeEventSchema,
|
|
25
|
+
ToolLearningRefSchema,
|
|
26
|
+
ToolLearningDecisionSchema,
|
|
27
|
+
boundedToolLearningSchema,
|
|
28
|
+
ToolLearningInstallationUpdateSchema,
|
|
29
|
+
ToolEpisodeAppendSchema,
|
|
30
|
+
ToolEpisodeAppendReceiptSchema,
|
|
31
|
+
ToolLearningManifestSchema,
|
|
32
|
+
ToolLearningCapabilitySchema,
|
|
33
|
+
ToolLearningConsultationRequestSchema,
|
|
34
|
+
assertToolLearningConsultationResponse
|
|
35
|
+
} from "@openpond/evals/tool-learning";
|
|
36
|
+
import { assertBoundedTaskJson } from "@openpond/evals/task-schema";
|
|
37
|
+
var ToolLearningRegistrationRequestSchema = boundedToolLearningSchema(
|
|
38
|
+
z.object({
|
|
39
|
+
registration: ToolLearningRegistrationSchema,
|
|
40
|
+
credential: z.object({ apiKey: LearningSourceCredentialSecretSchema, expiresAt: z.iso.datetime() }).strict()
|
|
41
|
+
}).strict(),
|
|
42
|
+
TOOL_LEARNING_LIMITS.eventBytes
|
|
43
|
+
);
|
|
44
|
+
var ToolLearningProjectionRequestSchema = boundedToolLearningSchema(
|
|
45
|
+
z.object({
|
|
46
|
+
operationId: ToolLearningIdSchema,
|
|
47
|
+
expectedRevision: z.number().int().positive(),
|
|
48
|
+
episodeId: ToolLearningIdSchema,
|
|
49
|
+
failure: ToolLearningRefSchema,
|
|
50
|
+
recovery: ToolLearningRefSchema,
|
|
51
|
+
taskDefinition: LearningRevisionRefSchema,
|
|
52
|
+
familyKey: ToolLearningIdSchema,
|
|
53
|
+
split: z.literal("train"),
|
|
54
|
+
proposedTarget: ToolLearningDecisionSchema,
|
|
55
|
+
saveToPrivateDataset: z.literal(true),
|
|
56
|
+
targetApproval: z.literal("pending_owner_review")
|
|
57
|
+
}).strict(),
|
|
58
|
+
TOOL_LEARNING_LIMITS.eventBytes
|
|
59
|
+
);
|
|
60
|
+
var ToolLearningProjectionReceiptSchema = boundedToolLearningSchema(
|
|
61
|
+
z.object({
|
|
62
|
+
installationId: ToolLearningIdSchema,
|
|
63
|
+
projectId: ToolLearningIdSchema,
|
|
64
|
+
operationId: ToolLearningIdSchema,
|
|
65
|
+
source: LearningRevisionRefSchema,
|
|
66
|
+
evidence: LearningRevisionRefSchema,
|
|
67
|
+
originHash: z.string().regex(/^[a-f0-9]{64}$/),
|
|
68
|
+
requestHash: z.string().regex(/^[a-f0-9]{64}$/),
|
|
69
|
+
projectedAt: z.iso.datetime(),
|
|
70
|
+
targetApproval: z.literal("pending_owner_review"),
|
|
71
|
+
learningEnrollment: z.literal(false)
|
|
72
|
+
}).strict(),
|
|
73
|
+
TOOL_LEARNING_LIMITS.eventBytes
|
|
74
|
+
);
|
|
75
|
+
var ToolLearningRoutingRequestSchema = boundedToolLearningSchema(
|
|
76
|
+
z.object({
|
|
77
|
+
operationId: ToolLearningIdSchema,
|
|
78
|
+
expectedRevision: z.number().int().nonnegative(),
|
|
79
|
+
state: z.enum(["enabled", "disabled"]),
|
|
80
|
+
modelId: ToolLearningIdSchema,
|
|
81
|
+
qualification: z.discriminatedUnion("kind", [
|
|
82
|
+
z.object({ kind: z.literal("integration"), evaluationRunId: ToolLearningIdSchema }).strict(),
|
|
83
|
+
z.object({
|
|
84
|
+
kind: z.literal("learned"),
|
|
85
|
+
evaluationRunId: ToolLearningIdSchema,
|
|
86
|
+
baselineRunId: ToolLearningIdSchema,
|
|
87
|
+
trainingRunId: ToolLearningIdSchema
|
|
88
|
+
}).strict()
|
|
89
|
+
]),
|
|
90
|
+
capabilities: z.array(ToolLearningCapabilitySchema.omit({ qualification: true })).min(1).max(16),
|
|
91
|
+
limits: z.object({
|
|
92
|
+
maxOutputTokens: z.number().int().min(128).max(2048),
|
|
93
|
+
maximumCallUsd: z.number().positive().max(1),
|
|
94
|
+
maximumDayUsd: z.number().positive().max(10),
|
|
95
|
+
maximumSessionCalls: z.number().int().min(1).max(20),
|
|
96
|
+
maximumDayCalls: z.number().int().min(1).max(200)
|
|
97
|
+
}).strict()
|
|
98
|
+
}).strict(),
|
|
99
|
+
TOOL_LEARNING_LIMITS.eventBytes
|
|
100
|
+
);
|
|
101
|
+
var ToolLearningRoutingSchema = boundedToolLearningSchema(
|
|
102
|
+
z.object({
|
|
103
|
+
installationId: ToolLearningIdSchema,
|
|
104
|
+
scope: z.object({ teamId: ToolLearningIdSchema, projectId: ToolLearningIdSchema }).strict(),
|
|
105
|
+
revision: z.number().int().positive(),
|
|
106
|
+
operationId: ToolLearningIdSchema,
|
|
107
|
+
requestHash: z.string().regex(/^[a-f0-9]{64}$/),
|
|
108
|
+
configuration: ToolLearningRoutingRequestSchema,
|
|
109
|
+
modelRelease: ToolLearningRefSchema,
|
|
110
|
+
policySystemPrompt: z.string().min(1).max(16384),
|
|
111
|
+
capabilities: z.array(ToolLearningCapabilitySchema).max(16),
|
|
112
|
+
updatedAt: z.iso.datetime()
|
|
113
|
+
}).strict(),
|
|
114
|
+
TOOL_LEARNING_LIMITS.eventBytes
|
|
115
|
+
);
|
|
116
|
+
function prepareToolLearningRegistration(registration, expiresAt) {
|
|
117
|
+
const prepared = createSourceCredentialRequest({
|
|
118
|
+
sourceId: registration.installationId,
|
|
119
|
+
name: "Tool learning installation",
|
|
120
|
+
expiresAt
|
|
121
|
+
});
|
|
122
|
+
return ToolLearningRegistrationRequestSchema.parse({
|
|
123
|
+
registration,
|
|
124
|
+
credential: { apiKey: prepared.apiKey, expiresAt }
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
var OpenPondToolLearningError = class extends Error {
|
|
128
|
+
constructor(status, code) {
|
|
129
|
+
super(`Tool learning request failed (${status}): ${code}`);
|
|
130
|
+
this.status = status;
|
|
131
|
+
this.code = code;
|
|
132
|
+
this.name = "OpenPondToolLearningError";
|
|
133
|
+
}
|
|
134
|
+
status;
|
|
135
|
+
code;
|
|
136
|
+
};
|
|
137
|
+
var OpenPondToolLearningClient = class {
|
|
138
|
+
#baseUrl;
|
|
139
|
+
#options;
|
|
140
|
+
constructor(options) {
|
|
141
|
+
this.#options = { ...options };
|
|
142
|
+
const url = new URL(options.baseUrl);
|
|
143
|
+
if (!["https:", "http:"].includes(url.protocol) || url.username || url.password || url.search || url.hash || !options.apiKey.trim() || !options.teamId.trim() || !options.projectId.trim())
|
|
144
|
+
throw new Error("tool_learning_client_scope_required");
|
|
145
|
+
this.#baseUrl = url.toString().replace(/\/+$/, "");
|
|
146
|
+
}
|
|
147
|
+
async register(value, signal) {
|
|
148
|
+
const input = ToolLearningRegistrationRequestSchema.parse(value);
|
|
149
|
+
if (input.registration.projectId !== this.#options.projectId)
|
|
150
|
+
throw new Error("tool_learning_project_mismatch");
|
|
151
|
+
const result = z.object({
|
|
152
|
+
installation: ToolLearningInstallationSchema,
|
|
153
|
+
apiKey: LearningSourceCredentialSecretSchema
|
|
154
|
+
}).strict().parse(await this.#request("installations", "POST", input, signal));
|
|
155
|
+
this.#installation(result.installation, input.registration.installationId);
|
|
156
|
+
if (result.apiKey !== input.credential.apiKey)
|
|
157
|
+
throw new Error("tool_learning_credential_mismatch");
|
|
158
|
+
const installation = result.installation;
|
|
159
|
+
if (installation.client !== input.registration.client || installation.clientVersion !== input.registration.clientVersion || installation.machineSourceId !== input.registration.machineSourceId || contentHash(installation.adapterRelease) !== contentHash(input.registration.adapterRelease) || contentHash(installation.collectionPolicy) !== contentHash(input.registration.collectionPolicy) || installation.collectionPolicyHash !== contentHash(input.registration.collectionPolicy) || installation.credential?.expiresAt !== input.credential.expiresAt)
|
|
160
|
+
throw new Error("tool_learning_registration_receipt_mismatch");
|
|
161
|
+
return result;
|
|
162
|
+
}
|
|
163
|
+
async installation(id, signal) {
|
|
164
|
+
const result = ToolLearningInstallationSchema.parse(
|
|
165
|
+
await this.#request(`installations/${encodeURIComponent(id)}`, "GET", void 0, signal)
|
|
166
|
+
);
|
|
167
|
+
this.#installation(result, id);
|
|
168
|
+
return result;
|
|
169
|
+
}
|
|
170
|
+
async installations(after, signal) {
|
|
171
|
+
const result = z.object({
|
|
172
|
+
items: z.array(ToolLearningInstallationSchema).max(30),
|
|
173
|
+
nextCursor: ToolLearningIdSchema.nullable()
|
|
174
|
+
}).strict().parse(
|
|
175
|
+
await this.#request(
|
|
176
|
+
`installations?projectId=${encodeURIComponent(this.#options.projectId)}${after ? `&after=${encodeURIComponent(after)}` : ""}`,
|
|
177
|
+
"GET",
|
|
178
|
+
void 0,
|
|
179
|
+
signal
|
|
180
|
+
)
|
|
181
|
+
);
|
|
182
|
+
for (const installation of result.items) this.#installation(installation, installation.id);
|
|
183
|
+
if (result.nextCursor !== null && result.nextCursor !== result.items.at(-1)?.id)
|
|
184
|
+
throw new Error("tool_learning_installation_cursor_mismatch");
|
|
185
|
+
return result;
|
|
186
|
+
}
|
|
187
|
+
async episodes(installationId, after, signal) {
|
|
188
|
+
const result = z.object({
|
|
189
|
+
installationId: ToolLearningIdSchema,
|
|
190
|
+
scope: z.object({ teamId: ToolLearningIdSchema, projectId: ToolLearningIdSchema }).strict(),
|
|
191
|
+
items: z.array(
|
|
192
|
+
z.object({
|
|
193
|
+
episodeId: ToolLearningIdSchema,
|
|
194
|
+
eventCount: z.number().int().positive(),
|
|
195
|
+
lastReceivedAt: z.iso.datetime()
|
|
196
|
+
}).strict()
|
|
197
|
+
).max(30),
|
|
198
|
+
nextCursor: ToolLearningIdSchema.nullable(),
|
|
199
|
+
learningEnrollment: z.literal(false)
|
|
200
|
+
}).strict().parse(
|
|
201
|
+
await this.#request(
|
|
202
|
+
`installations/${encodeURIComponent(installationId)}/episodes${after ? `?after=${encodeURIComponent(after)}` : ""}`,
|
|
203
|
+
"GET",
|
|
204
|
+
void 0,
|
|
205
|
+
signal
|
|
206
|
+
)
|
|
207
|
+
);
|
|
208
|
+
if (result.installationId !== installationId || result.scope.teamId !== this.#options.teamId || result.scope.projectId !== this.#options.projectId || result.nextCursor !== null && result.nextCursor !== result.items.at(-1)?.episodeId)
|
|
209
|
+
throw new Error("tool_learning_episode_page_mismatch");
|
|
210
|
+
return result;
|
|
211
|
+
}
|
|
212
|
+
async episode(installationId, episodeId, signal) {
|
|
213
|
+
const result = z.object({
|
|
214
|
+
installationId: ToolLearningIdSchema,
|
|
215
|
+
episodeId: ToolLearningIdSchema,
|
|
216
|
+
scope: z.object({ teamId: ToolLearningIdSchema, projectId: ToolLearningIdSchema }).strict(),
|
|
217
|
+
events: z.array(ToolEpisodeEventSchema).max(TOOL_LEARNING_LIMITS.eventsPerEpisode),
|
|
218
|
+
state: z.enum(["incomplete", "awaiting_owner_review"]),
|
|
219
|
+
verificationAuthority: z.literal("not_granted"),
|
|
220
|
+
learningEnrollment: z.literal(false)
|
|
221
|
+
}).strict().parse(
|
|
222
|
+
await this.#request(
|
|
223
|
+
`installations/${encodeURIComponent(installationId)}/episodes/${encodeURIComponent(episodeId)}`,
|
|
224
|
+
"GET",
|
|
225
|
+
void 0,
|
|
226
|
+
signal
|
|
227
|
+
)
|
|
228
|
+
);
|
|
229
|
+
if (result.installationId !== installationId || result.episodeId !== episodeId || result.scope.teamId !== this.#options.teamId || result.scope.projectId !== this.#options.projectId || result.events.some(
|
|
230
|
+
(event) => event.installationId !== installationId || event.episodeId !== episodeId
|
|
231
|
+
))
|
|
232
|
+
throw new Error("tool_learning_episode_scope_mismatch");
|
|
233
|
+
return result;
|
|
234
|
+
}
|
|
235
|
+
async purge(installationId, input, signal) {
|
|
236
|
+
const request = z.object({ operationId: ToolLearningIdSchema, expectedRevision: z.number().int().positive() }).strict().parse(input);
|
|
237
|
+
const result = z.object({
|
|
238
|
+
installationId: ToolLearningIdSchema,
|
|
239
|
+
operationId: ToolLearningIdSchema,
|
|
240
|
+
purgedEvents: z.number().int().nonnegative(),
|
|
241
|
+
learningEnrollment: z.literal(false)
|
|
242
|
+
}).strict().parse(
|
|
243
|
+
await this.#request(
|
|
244
|
+
`installations/${encodeURIComponent(installationId)}/purge`,
|
|
245
|
+
"POST",
|
|
246
|
+
request,
|
|
247
|
+
signal
|
|
248
|
+
)
|
|
249
|
+
);
|
|
250
|
+
if (result.installationId !== installationId || result.operationId !== request.operationId)
|
|
251
|
+
throw new Error("tool_learning_purge_scope_mismatch");
|
|
252
|
+
return result;
|
|
253
|
+
}
|
|
254
|
+
async project(installationId, value, signal) {
|
|
255
|
+
const input = ToolLearningProjectionRequestSchema.parse(value);
|
|
256
|
+
const result = ToolLearningProjectionReceiptSchema.parse(
|
|
257
|
+
await this.#request(
|
|
258
|
+
`installations/${encodeURIComponent(installationId)}/project`,
|
|
259
|
+
"POST",
|
|
260
|
+
input,
|
|
261
|
+
signal
|
|
262
|
+
)
|
|
263
|
+
);
|
|
264
|
+
if (result.installationId !== installationId || result.projectId !== this.#options.projectId || result.operationId !== input.operationId || result.requestHash !== contentHash(input))
|
|
265
|
+
throw new Error("tool_learning_projection_scope_mismatch");
|
|
266
|
+
return result;
|
|
267
|
+
}
|
|
268
|
+
async setState(id, value, signal) {
|
|
269
|
+
const input = ToolLearningInstallationUpdateSchema.parse(value);
|
|
270
|
+
const result = ToolLearningInstallationSchema.parse(
|
|
271
|
+
await this.#request(`installations/${encodeURIComponent(id)}`, "PATCH", input, signal)
|
|
272
|
+
);
|
|
273
|
+
this.#installation(result, id);
|
|
274
|
+
if (result.state !== input.state) throw new Error("tool_learning_state_mismatch");
|
|
275
|
+
return result;
|
|
276
|
+
}
|
|
277
|
+
async append(value, signal) {
|
|
278
|
+
const input = ToolEpisodeAppendSchema.parse(value);
|
|
279
|
+
const result = ToolEpisodeAppendReceiptSchema.parse(
|
|
280
|
+
await this.#request("episodes", "POST", input, signal)
|
|
281
|
+
);
|
|
282
|
+
if (result.operationId !== input.operationId || result.installationId !== input.installationId || result.teamId !== this.#options.teamId || result.projectId !== this.#options.projectId || result.requestHash !== contentHash(input) || result.events.length !== input.events.length || new Set(result.events.map((event) => event.eventId)).size !== result.events.length)
|
|
283
|
+
throw new Error("tool_learning_append_receipt_mismatch");
|
|
284
|
+
for (const event of result.events) {
|
|
285
|
+
const submitted = input.events.find((value2) => value2.eventId === event.eventId);
|
|
286
|
+
if (!submitted || submitted.contentHash !== event.contentHash)
|
|
287
|
+
throw new Error("tool_learning_append_event_mismatch");
|
|
288
|
+
}
|
|
289
|
+
return result;
|
|
290
|
+
}
|
|
291
|
+
async routing(installationId, signal) {
|
|
292
|
+
return this.#routing(
|
|
293
|
+
installationId,
|
|
294
|
+
await this.#request(
|
|
295
|
+
`installations/${encodeURIComponent(installationId)}/routing`,
|
|
296
|
+
"GET",
|
|
297
|
+
void 0,
|
|
298
|
+
signal
|
|
299
|
+
)
|
|
300
|
+
);
|
|
301
|
+
}
|
|
302
|
+
async configureRouting(installationId, value, signal) {
|
|
303
|
+
const input = ToolLearningRoutingRequestSchema.parse(value);
|
|
304
|
+
const result = this.#routing(
|
|
305
|
+
installationId,
|
|
306
|
+
await this.#request(
|
|
307
|
+
`installations/${encodeURIComponent(installationId)}/routing`,
|
|
308
|
+
"POST",
|
|
309
|
+
input,
|
|
310
|
+
signal
|
|
311
|
+
)
|
|
312
|
+
);
|
|
313
|
+
if (result.operationId !== input.operationId || result.requestHash !== contentHash(input) || contentHash(result.configuration) !== contentHash(input))
|
|
314
|
+
throw new Error("tool_learning_routing_receipt_mismatch");
|
|
315
|
+
return result;
|
|
316
|
+
}
|
|
317
|
+
#routing(installationId, value) {
|
|
318
|
+
const result = ToolLearningRoutingSchema.parse(value);
|
|
319
|
+
if (result.installationId !== installationId || result.scope.teamId !== this.#options.teamId || result.scope.projectId !== this.#options.projectId)
|
|
320
|
+
throw new Error("tool_learning_routing_scope_mismatch");
|
|
321
|
+
return result;
|
|
322
|
+
}
|
|
323
|
+
async manifest(installationId, signal) {
|
|
324
|
+
const result = ToolLearningManifestSchema.parse(
|
|
325
|
+
await this.#request(
|
|
326
|
+
`installations/${encodeURIComponent(installationId)}/manifest`,
|
|
327
|
+
"GET",
|
|
328
|
+
void 0,
|
|
329
|
+
signal
|
|
330
|
+
)
|
|
331
|
+
);
|
|
332
|
+
if (result.installationId !== installationId || result.scope.teamId !== this.#options.teamId || result.scope.projectId !== this.#options.projectId)
|
|
333
|
+
throw new Error("tool_learning_manifest_scope_mismatch");
|
|
334
|
+
if (Date.parse(result.expiresAt) <= Date.now() || Date.parse(result.issuedAt) > Date.now() + 3e4)
|
|
335
|
+
throw new Error("tool_learning_manifest_expired");
|
|
336
|
+
return result;
|
|
337
|
+
}
|
|
338
|
+
async consult(value, signal) {
|
|
339
|
+
const input = ToolLearningConsultationRequestSchema.parse(value);
|
|
340
|
+
if (input.scope.teamId !== this.#options.teamId || input.scope.projectId !== this.#options.projectId)
|
|
341
|
+
throw new Error("tool_learning_consultation_scope_mismatch");
|
|
342
|
+
return assertToolLearningConsultationResponse(
|
|
343
|
+
input,
|
|
344
|
+
await this.#request("consultations", "POST", input, signal)
|
|
345
|
+
);
|
|
346
|
+
}
|
|
347
|
+
async consultation(value, signal) {
|
|
348
|
+
const input = ToolLearningConsultationRequestSchema.parse(value);
|
|
349
|
+
if (input.scope.teamId !== this.#options.teamId || input.scope.projectId !== this.#options.projectId)
|
|
350
|
+
throw new Error("tool_learning_consultation_scope_mismatch");
|
|
351
|
+
return assertToolLearningConsultationResponse(
|
|
352
|
+
input,
|
|
353
|
+
await this.#request(
|
|
354
|
+
`installations/${encodeURIComponent(input.installationId)}/consultations/${encodeURIComponent(input.operationId)}`,
|
|
355
|
+
"GET",
|
|
356
|
+
void 0,
|
|
357
|
+
signal
|
|
358
|
+
)
|
|
359
|
+
);
|
|
360
|
+
}
|
|
361
|
+
#installation(value, id) {
|
|
362
|
+
if (value.id !== id || value.scope.teamId !== this.#options.teamId || value.scope.projectId !== this.#options.projectId)
|
|
363
|
+
throw new Error("tool_learning_installation_scope_mismatch");
|
|
364
|
+
}
|
|
365
|
+
async #request(path, method, body, signal) {
|
|
366
|
+
if (body !== void 0)
|
|
367
|
+
assertBoundedTaskJson(
|
|
368
|
+
body,
|
|
369
|
+
TOOL_LEARNING_LIMITS.eventBytes * TOOL_LEARNING_LIMITS.eventsPerAppend
|
|
370
|
+
);
|
|
371
|
+
const timeout = AbortSignal.timeout(3e4);
|
|
372
|
+
const response = await (this.#options.fetch ?? globalThis.fetch)(
|
|
373
|
+
`${this.#baseUrl}/v1/tool-learning/${path}`,
|
|
374
|
+
{
|
|
375
|
+
method,
|
|
376
|
+
redirect: "error",
|
|
377
|
+
signal: signal ? AbortSignal.any([signal, timeout]) : timeout,
|
|
378
|
+
headers: {
|
|
379
|
+
Authorization: `Bearer ${this.#options.apiKey}`,
|
|
380
|
+
"X-OpenPond-Team-Id": this.#options.teamId,
|
|
381
|
+
Accept: "application/json",
|
|
382
|
+
...body === void 0 ? {} : { "Content-Type": "application/json" }
|
|
383
|
+
},
|
|
384
|
+
...body === void 0 ? {} : { body: JSON.stringify(body) }
|
|
385
|
+
}
|
|
386
|
+
);
|
|
387
|
+
const value = await readBoundedJsonResponse(
|
|
388
|
+
response,
|
|
389
|
+
TOOL_LEARNING_LIMITS.eventBytes * TOOL_LEARNING_LIMITS.eventsPerAppend,
|
|
390
|
+
"Tool learning response"
|
|
391
|
+
);
|
|
392
|
+
if (!response.ok) {
|
|
393
|
+
const error = z.object({
|
|
394
|
+
code: z.string().regex(/^[a-z0-9_]+$/).max(200)
|
|
395
|
+
}).passthrough().safeParse(value);
|
|
396
|
+
throw new OpenPondToolLearningError(
|
|
397
|
+
response.status,
|
|
398
|
+
error.success ? error.data.code : "tool_learning_request_failed"
|
|
399
|
+
);
|
|
400
|
+
}
|
|
401
|
+
return value;
|
|
402
|
+
}
|
|
403
|
+
};
|
|
404
|
+
export {
|
|
405
|
+
OpenPondToolLearningClient,
|
|
406
|
+
OpenPondToolLearningError,
|
|
407
|
+
ToolLearningProjectionReceiptSchema,
|
|
408
|
+
ToolLearningProjectionRequestSchema,
|
|
409
|
+
ToolLearningRegistrationRequestSchema,
|
|
410
|
+
ToolLearningRoutingRequestSchema,
|
|
411
|
+
ToolLearningRoutingSchema,
|
|
412
|
+
prepareToolLearningRegistration
|
|
413
|
+
};
|
|
3
414
|
//# sourceMappingURL=tool-learning.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/tool-learning.ts"],"sourcesContent":["/** Portable episode and recovery-consultation protocol; no installation side effects. */\nexport * from \"@openpond/evals/tool-learning\";\n"],"mappings":";AACA,cAAc;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/tool-learning.ts","../src/tool-learning-client.ts"],"sourcesContent":["/** Portable episode and recovery-consultation protocol; no installation side effects. */\nexport * from \"@openpond/evals/tool-learning\";\nexport * from \"./tool-learning-client.js\";\n","import { z } from \"zod\";\nimport { contentHash } from \"@openpond/harness\";\nimport { LearningRevisionRefSchema } from \"@openpond/evals/learning\";\nimport {\n TOOL_LEARNING_LIMITS,\n ToolLearningRegistrationSchema,\n ToolLearningInstallationSchema,\n ToolLearningIdSchema,\n ToolEpisodeEventSchema,\n ToolLearningRefSchema,\n ToolLearningDecisionSchema,\n boundedToolLearningSchema,\n ToolLearningInstallationUpdateSchema,\n ToolEpisodeAppendSchema,\n ToolEpisodeAppendReceiptSchema,\n ToolLearningManifestSchema,\n ToolLearningCapabilitySchema,\n ToolLearningConsultationRequestSchema,\n assertToolLearningConsultationResponse,\n type ToolLearningRegistration,\n type ToolEpisodeAppend,\n type ToolLearningConsultationRequest,\n} from \"@openpond/evals/tool-learning\";\nimport {\n LearningSourceCredentialSecretSchema,\n createSourceCredentialRequest,\n} from \"./learning-credentials.js\";\nimport { assertBoundedTaskJson } from \"@openpond/evals/task-schema\";\nimport { readBoundedJsonResponse } from \"./protocol.js\";\n\n/** Prepare and retain this request privately before registration. Retrying the\n * same bytes recovers issuance without storing plaintext on the host. */\nexport const ToolLearningRegistrationRequestSchema = boundedToolLearningSchema(\n z\n .object({\n registration: ToolLearningRegistrationSchema,\n credential: z\n .object({ apiKey: LearningSourceCredentialSecretSchema, expiresAt: z.iso.datetime() })\n .strict(),\n })\n .strict(),\n TOOL_LEARNING_LIMITS.eventBytes,\n);\n\nexport const ToolLearningProjectionRequestSchema = boundedToolLearningSchema(\n z\n .object({\n operationId: ToolLearningIdSchema,\n expectedRevision: z.number().int().positive(),\n episodeId: ToolLearningIdSchema,\n failure: ToolLearningRefSchema,\n recovery: ToolLearningRefSchema,\n taskDefinition: LearningRevisionRefSchema,\n familyKey: ToolLearningIdSchema,\n split: z.literal(\"train\"),\n proposedTarget: ToolLearningDecisionSchema,\n saveToPrivateDataset: z.literal(true),\n targetApproval: z.literal(\"pending_owner_review\"),\n })\n .strict(),\n TOOL_LEARNING_LIMITS.eventBytes,\n);\nexport const ToolLearningProjectionReceiptSchema = boundedToolLearningSchema(\n z\n .object({\n installationId: ToolLearningIdSchema,\n projectId: ToolLearningIdSchema,\n operationId: ToolLearningIdSchema,\n source: LearningRevisionRefSchema,\n evidence: LearningRevisionRefSchema,\n originHash: z.string().regex(/^[a-f0-9]{64}$/),\n requestHash: z.string().regex(/^[a-f0-9]{64}$/),\n projectedAt: z.iso.datetime(),\n targetApproval: z.literal(\"pending_owner_review\"),\n learningEnrollment: z.literal(false),\n })\n .strict(),\n TOOL_LEARNING_LIMITS.eventBytes,\n);\n\n/** Explicit owner selection. Capturing events never authorizes inference spend. */\nexport const ToolLearningRoutingRequestSchema = boundedToolLearningSchema(\n z\n .object({\n operationId: ToolLearningIdSchema,\n expectedRevision: z.number().int().nonnegative(),\n state: z.enum([\"enabled\", \"disabled\"]),\n modelId: ToolLearningIdSchema,\n qualification: z.discriminatedUnion(\"kind\", [\n z\n .object({ kind: z.literal(\"integration\"), evaluationRunId: ToolLearningIdSchema })\n .strict(),\n z\n .object({\n kind: z.literal(\"learned\"),\n evaluationRunId: ToolLearningIdSchema,\n baselineRunId: ToolLearningIdSchema,\n trainingRunId: ToolLearningIdSchema,\n })\n .strict(),\n ]),\n capabilities: z\n .array(ToolLearningCapabilitySchema.omit({ qualification: true }))\n .min(1)\n .max(16),\n limits: z\n .object({\n maxOutputTokens: z.number().int().min(128).max(2048),\n maximumCallUsd: z.number().positive().max(1),\n maximumDayUsd: z.number().positive().max(10),\n maximumSessionCalls: z.number().int().min(1).max(20),\n maximumDayCalls: z.number().int().min(1).max(200),\n })\n .strict(),\n })\n .strict(),\n TOOL_LEARNING_LIMITS.eventBytes,\n);\nexport const ToolLearningRoutingSchema = boundedToolLearningSchema(\n z\n .object({\n installationId: ToolLearningIdSchema,\n scope: z.object({ teamId: ToolLearningIdSchema, projectId: ToolLearningIdSchema }).strict(),\n revision: z.number().int().positive(),\n operationId: ToolLearningIdSchema,\n requestHash: z.string().regex(/^[a-f0-9]{64}$/),\n configuration: ToolLearningRoutingRequestSchema,\n modelRelease: ToolLearningRefSchema,\n policySystemPrompt: z.string().min(1).max(16384),\n capabilities: z.array(ToolLearningCapabilitySchema).max(16),\n updatedAt: z.iso.datetime(),\n })\n .strict(),\n TOOL_LEARNING_LIMITS.eventBytes,\n);\n\nexport function prepareToolLearningRegistration(\n registration: ToolLearningRegistration,\n expiresAt: string,\n) {\n const prepared = createSourceCredentialRequest({\n sourceId: registration.installationId,\n name: \"Tool learning installation\",\n expiresAt,\n });\n return ToolLearningRegistrationRequestSchema.parse({\n registration,\n credential: { apiKey: prepared.apiKey, expiresAt },\n });\n}\n\nexport class OpenPondToolLearningError extends Error {\n constructor(\n readonly status: number,\n readonly code: string,\n ) {\n super(`Tool learning request failed (${status}): ${code}`);\n this.name = \"OpenPondToolLearningError\";\n }\n}\n\n/** Owner credentials register/control installations. External hooks and MCP\n * use only the separate installation credential returned by registration. */\ntype ToolLearningClientOptions = {\n baseUrl: string;\n apiKey: string;\n teamId: string;\n projectId: string;\n fetch?: typeof globalThis.fetch;\n};\n\nexport class OpenPondToolLearningClient {\n readonly #baseUrl: string;\n readonly #options: ToolLearningClientOptions;\n constructor(options: ToolLearningClientOptions) {\n this.#options = { ...options };\n\n const url = new URL(options.baseUrl);\n if (\n ![\"https:\", \"http:\"].includes(url.protocol) ||\n url.username ||\n url.password ||\n url.search ||\n url.hash ||\n !options.apiKey.trim() ||\n !options.teamId.trim() ||\n !options.projectId.trim()\n )\n throw new Error(\"tool_learning_client_scope_required\");\n this.#baseUrl = url.toString().replace(/\\/+$/, \"\");\n }\n\n async register(\n value: z.input<typeof ToolLearningRegistrationRequestSchema>,\n signal?: AbortSignal,\n ) {\n const input = ToolLearningRegistrationRequestSchema.parse(value);\n if (input.registration.projectId !== this.#options.projectId)\n throw new Error(\"tool_learning_project_mismatch\");\n const result = z\n .object({\n installation: ToolLearningInstallationSchema,\n apiKey: LearningSourceCredentialSecretSchema,\n })\n .strict()\n .parse(await this.#request(\"installations\", \"POST\", input, signal));\n this.#installation(result.installation, input.registration.installationId);\n if (result.apiKey !== input.credential.apiKey)\n throw new Error(\"tool_learning_credential_mismatch\");\n const installation = result.installation;\n if (\n installation.client !== input.registration.client ||\n installation.clientVersion !== input.registration.clientVersion ||\n installation.machineSourceId !== input.registration.machineSourceId ||\n contentHash(installation.adapterRelease) !== contentHash(input.registration.adapterRelease) ||\n contentHash(installation.collectionPolicy) !==\n contentHash(input.registration.collectionPolicy) ||\n installation.collectionPolicyHash !== contentHash(input.registration.collectionPolicy) ||\n installation.credential?.expiresAt !== input.credential.expiresAt\n )\n throw new Error(\"tool_learning_registration_receipt_mismatch\");\n return result;\n }\n\n async installation(id: string, signal?: AbortSignal) {\n const result = ToolLearningInstallationSchema.parse(\n await this.#request(`installations/${encodeURIComponent(id)}`, \"GET\", undefined, signal),\n );\n this.#installation(result, id);\n return result;\n }\n\n async installations(after?: string, signal?: AbortSignal) {\n const result = z\n .object({\n items: z.array(ToolLearningInstallationSchema).max(30),\n nextCursor: ToolLearningIdSchema.nullable(),\n })\n .strict()\n .parse(\n await this.#request(\n `installations?projectId=${encodeURIComponent(this.#options.projectId)}${after ? `&after=${encodeURIComponent(after)}` : \"\"}`,\n \"GET\",\n undefined,\n signal,\n ),\n );\n for (const installation of result.items) this.#installation(installation, installation.id);\n if (result.nextCursor !== null && result.nextCursor !== result.items.at(-1)?.id)\n throw new Error(\"tool_learning_installation_cursor_mismatch\");\n return result;\n }\n\n async episodes(installationId: string, after?: string, signal?: AbortSignal) {\n const result = z\n .object({\n installationId: ToolLearningIdSchema,\n scope: z.object({ teamId: ToolLearningIdSchema, projectId: ToolLearningIdSchema }).strict(),\n items: z\n .array(\n z\n .object({\n episodeId: ToolLearningIdSchema,\n eventCount: z.number().int().positive(),\n lastReceivedAt: z.iso.datetime(),\n })\n .strict(),\n )\n .max(30),\n nextCursor: ToolLearningIdSchema.nullable(),\n learningEnrollment: z.literal(false),\n })\n .strict()\n .parse(\n await this.#request(\n `installations/${encodeURIComponent(installationId)}/episodes${after ? `?after=${encodeURIComponent(after)}` : \"\"}`,\n \"GET\",\n undefined,\n signal,\n ),\n );\n if (\n result.installationId !== installationId ||\n result.scope.teamId !== this.#options.teamId ||\n result.scope.projectId !== this.#options.projectId ||\n (result.nextCursor !== null && result.nextCursor !== result.items.at(-1)?.episodeId)\n )\n throw new Error(\"tool_learning_episode_page_mismatch\");\n return result;\n }\n\n async episode(installationId: string, episodeId: string, signal?: AbortSignal) {\n const result = z\n .object({\n installationId: ToolLearningIdSchema,\n episodeId: ToolLearningIdSchema,\n scope: z.object({ teamId: ToolLearningIdSchema, projectId: ToolLearningIdSchema }).strict(),\n events: z.array(ToolEpisodeEventSchema).max(TOOL_LEARNING_LIMITS.eventsPerEpisode),\n state: z.enum([\"incomplete\", \"awaiting_owner_review\"]),\n verificationAuthority: z.literal(\"not_granted\"),\n learningEnrollment: z.literal(false),\n })\n .strict()\n .parse(\n await this.#request(\n `installations/${encodeURIComponent(installationId)}/episodes/${encodeURIComponent(episodeId)}`,\n \"GET\",\n undefined,\n signal,\n ),\n );\n if (\n result.installationId !== installationId ||\n result.episodeId !== episodeId ||\n result.scope.teamId !== this.#options.teamId ||\n result.scope.projectId !== this.#options.projectId ||\n result.events.some(\n (event) => event.installationId !== installationId || event.episodeId !== episodeId,\n )\n )\n throw new Error(\"tool_learning_episode_scope_mismatch\");\n return result;\n }\n\n async purge(\n installationId: string,\n input: { operationId: string; expectedRevision: number },\n signal?: AbortSignal,\n ) {\n const request = z\n .object({ operationId: ToolLearningIdSchema, expectedRevision: z.number().int().positive() })\n .strict()\n .parse(input);\n const result = z\n .object({\n installationId: ToolLearningIdSchema,\n operationId: ToolLearningIdSchema,\n purgedEvents: z.number().int().nonnegative(),\n learningEnrollment: z.literal(false),\n })\n .strict()\n .parse(\n await this.#request(\n `installations/${encodeURIComponent(installationId)}/purge`,\n \"POST\",\n request,\n signal,\n ),\n );\n if (result.installationId !== installationId || result.operationId !== request.operationId)\n throw new Error(\"tool_learning_purge_scope_mismatch\");\n return result;\n }\n\n async project(\n installationId: string,\n value: z.input<typeof ToolLearningProjectionRequestSchema>,\n signal?: AbortSignal,\n ) {\n const input = ToolLearningProjectionRequestSchema.parse(value);\n const result = ToolLearningProjectionReceiptSchema.parse(\n await this.#request(\n `installations/${encodeURIComponent(installationId)}/project`,\n \"POST\",\n input,\n signal,\n ),\n );\n if (\n result.installationId !== installationId ||\n result.projectId !== this.#options.projectId ||\n result.operationId !== input.operationId ||\n result.requestHash !== contentHash(input)\n )\n throw new Error(\"tool_learning_projection_scope_mismatch\");\n return result;\n }\n\n async setState(\n id: string,\n value: z.input<typeof ToolLearningInstallationUpdateSchema>,\n signal?: AbortSignal,\n ) {\n const input = ToolLearningInstallationUpdateSchema.parse(value);\n const result = ToolLearningInstallationSchema.parse(\n await this.#request(`installations/${encodeURIComponent(id)}`, \"PATCH\", input, signal),\n );\n this.#installation(result, id);\n if (result.state !== input.state) throw new Error(\"tool_learning_state_mismatch\");\n return result;\n }\n\n async append(value: ToolEpisodeAppend, signal?: AbortSignal) {\n const input = ToolEpisodeAppendSchema.parse(value);\n const result = ToolEpisodeAppendReceiptSchema.parse(\n await this.#request(\"episodes\", \"POST\", input, signal),\n );\n if (\n result.operationId !== input.operationId ||\n result.installationId !== input.installationId ||\n result.teamId !== this.#options.teamId ||\n result.projectId !== this.#options.projectId ||\n result.requestHash !== contentHash(input) ||\n result.events.length !== input.events.length ||\n new Set(result.events.map((event) => event.eventId)).size !== result.events.length\n )\n throw new Error(\"tool_learning_append_receipt_mismatch\");\n for (const event of result.events) {\n const submitted = input.events.find((value) => value.eventId === event.eventId);\n if (!submitted || submitted.contentHash !== event.contentHash)\n throw new Error(\"tool_learning_append_event_mismatch\");\n }\n return result;\n }\n\n async routing(installationId: string, signal?: AbortSignal) {\n return this.#routing(\n installationId,\n await this.#request(\n `installations/${encodeURIComponent(installationId)}/routing`,\n \"GET\",\n undefined,\n signal,\n ),\n );\n }\n\n async configureRouting(\n installationId: string,\n value: z.input<typeof ToolLearningRoutingRequestSchema>,\n signal?: AbortSignal,\n ) {\n const input = ToolLearningRoutingRequestSchema.parse(value);\n const result = this.#routing(\n installationId,\n await this.#request(\n `installations/${encodeURIComponent(installationId)}/routing`,\n \"POST\",\n input,\n signal,\n ),\n );\n if (\n result.operationId !== input.operationId ||\n result.requestHash !== contentHash(input) ||\n contentHash(result.configuration) !== contentHash(input)\n )\n throw new Error(\"tool_learning_routing_receipt_mismatch\");\n return result;\n }\n\n #routing(installationId: string, value: unknown) {\n const result = ToolLearningRoutingSchema.parse(value);\n if (\n result.installationId !== installationId ||\n result.scope.teamId !== this.#options.teamId ||\n result.scope.projectId !== this.#options.projectId\n )\n throw new Error(\"tool_learning_routing_scope_mismatch\");\n return result;\n }\n\n async manifest(installationId: string, signal?: AbortSignal) {\n const result = ToolLearningManifestSchema.parse(\n await this.#request(\n `installations/${encodeURIComponent(installationId)}/manifest`,\n \"GET\",\n undefined,\n signal,\n ),\n );\n if (\n result.installationId !== installationId ||\n result.scope.teamId !== this.#options.teamId ||\n result.scope.projectId !== this.#options.projectId\n )\n throw new Error(\"tool_learning_manifest_scope_mismatch\");\n if (\n Date.parse(result.expiresAt) <= Date.now() ||\n Date.parse(result.issuedAt) > Date.now() + 30000\n )\n throw new Error(\"tool_learning_manifest_expired\");\n return result;\n }\n\n async consult(value: ToolLearningConsultationRequest, signal?: AbortSignal) {\n const input = ToolLearningConsultationRequestSchema.parse(value);\n if (\n input.scope.teamId !== this.#options.teamId ||\n input.scope.projectId !== this.#options.projectId\n )\n throw new Error(\"tool_learning_consultation_scope_mismatch\");\n return assertToolLearningConsultationResponse(\n input,\n await this.#request(\"consultations\", \"POST\", input, signal),\n );\n }\n\n async consultation(value: ToolLearningConsultationRequest, signal?: AbortSignal) {\n const input = ToolLearningConsultationRequestSchema.parse(value);\n if (\n input.scope.teamId !== this.#options.teamId ||\n input.scope.projectId !== this.#options.projectId\n )\n throw new Error(\"tool_learning_consultation_scope_mismatch\");\n return assertToolLearningConsultationResponse(\n input,\n await this.#request(\n `installations/${encodeURIComponent(input.installationId)}/consultations/${encodeURIComponent(input.operationId)}`,\n \"GET\",\n undefined,\n signal,\n ),\n );\n }\n\n #installation(value: z.infer<typeof ToolLearningInstallationSchema>, id: string) {\n if (\n value.id !== id ||\n value.scope.teamId !== this.#options.teamId ||\n value.scope.projectId !== this.#options.projectId\n )\n throw new Error(\"tool_learning_installation_scope_mismatch\");\n }\n\n async #request(\n path: string,\n method: string,\n body: unknown,\n signal?: AbortSignal,\n ): Promise<unknown> {\n if (body !== undefined)\n assertBoundedTaskJson(\n body,\n TOOL_LEARNING_LIMITS.eventBytes * TOOL_LEARNING_LIMITS.eventsPerAppend,\n );\n const timeout = AbortSignal.timeout(30000);\n const response = await (this.#options.fetch ?? globalThis.fetch)(\n `${this.#baseUrl}/v1/tool-learning/${path}`,\n {\n method,\n redirect: \"error\",\n signal: signal ? AbortSignal.any([signal, timeout]) : timeout,\n headers: {\n Authorization: `Bearer ${this.#options.apiKey}`,\n \"X-OpenPond-Team-Id\": this.#options.teamId,\n Accept: \"application/json\",\n ...(body === undefined ? {} : { \"Content-Type\": \"application/json\" }),\n },\n ...(body === undefined ? {} : { body: JSON.stringify(body) }),\n },\n );\n const value = await readBoundedJsonResponse(\n response,\n TOOL_LEARNING_LIMITS.eventBytes * TOOL_LEARNING_LIMITS.eventsPerAppend,\n \"Tool learning response\",\n );\n if (!response.ok) {\n const error = z\n .object({\n code: z\n .string()\n .regex(/^[a-z0-9_]+$/)\n .max(200),\n })\n .passthrough()\n .safeParse(value);\n throw new OpenPondToolLearningError(\n response.status,\n error.success ? error.data.code : \"tool_learning_request_failed\",\n );\n }\n return value;\n }\n}\n"],"mappings":";;;;;;;;;;;;;AACA,cAAc;;;ACDd,SAAS,SAAS;AAElB,SAAS,iCAAiC;AAC1C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAA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EAC/D;AAAA,EAEA,MAAM,SACJ,MACA,QACA,MACA,QACkB;AAClB,QAAI,SAAS;AACX;AAAA,QACE;AAAA,QACA,qBAAqB,aAAa,qBAAqB;AAAA,MACzD;AACF,UAAM,UAAU,YAAY,QAAQ,GAAK;AACzC,UAAM,WAAW,OAAO,KAAK,SAAS,SAAS,WAAW;AAAA,MACxD,GAAG,KAAK,QAAQ,qBAAqB,IAAI;AAAA,MACzC;AAAA,QACE;AAAA,QACA,UAAU;AAAA,QACV,QAAQ,SAAS,YAAY,IAAI,CAAC,QAAQ,OAAO,CAAC,IAAI;AAAA,QACtD,SAAS;AAAA,UACP,eAAe,UAAU,KAAK,SAAS,MAAM;AAAA,UAC7C,sBAAsB,KAAK,SAAS;AAAA,UACpC,QAAQ;AAAA,UACR,GAAI,SAAS,SAAY,CAAC,IAAI,EAAE,gBAAgB,mBAAmB;AAAA,QACrE;AAAA,QACA,GAAI,SAAS,SAAY,CAAC,IAAI,EAAE,MAAM,KAAK,UAAU,IAAI,EAAE;AAAA,MAC7D;AAAA,IACF;AACA,UAAM,QAAQ,MAAM;AAAA,MAClB;AAAA,MACA,qBAAqB,aAAa,qBAAqB;AAAA,MACvD;AAAA,IACF;AACA,QAAI,CAAC,SAAS,IAAI;AAChB,YAAM,QAAQ,EACX,OAAO;AAAA,QACN,MAAM,EACH,OAAO,EACP,MAAM,cAAc,EACpB,IAAI,GAAG;AAAA,MACZ,CAAC,EACA,YAAY,EACZ,UAAU,KAAK;AAClB,YAAM,IAAI;AAAA,QACR,SAAS;AAAA,QACT,MAAM,UAAU,MAAM,KAAK,OAAO;AAAA,MACpC;AAAA,IACF;AACA,WAAO;AAAA,EACT;AACF;","names":["value"]}
|
package/dist/training-bundle.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
prepareImportedTasksetPackage,
|
|
3
3
|
projectLearningBatchGraders
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-JBYFD3QS.js";
|
|
5
5
|
import {
|
|
6
6
|
projectPortableTaskRecord,
|
|
7
7
|
resolvePortableTasksetRewardExecution
|
|
@@ -10,13 +10,13 @@ import {
|
|
|
10
10
|
TasksetDraftOutputContractSchema,
|
|
11
11
|
TasksetSchema,
|
|
12
12
|
computeTasksetHash
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-GHPCQXG5.js";
|
|
14
14
|
import {
|
|
15
15
|
LearningBatchDatasetSourceRefSchema,
|
|
16
16
|
MAX_TASKSET_PACKAGE_BYTES,
|
|
17
17
|
decodeTasksetPackageFile,
|
|
18
18
|
validateTasksetPackage
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-IFBCLRBM.js";
|
|
20
20
|
import {
|
|
21
21
|
ManagedSftRecipeSchema,
|
|
22
22
|
TRAINING_EVALUATION_SOURCE_PATH,
|
|
@@ -30,15 +30,15 @@ import {
|
|
|
30
30
|
trainingEvaluationSourceRef,
|
|
31
31
|
trainingInputArtifactUploadHash,
|
|
32
32
|
trainingJobSubmissionHash
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-GJRXJL6G.js";
|
|
34
34
|
import "./chunk-EZME7DV4.js";
|
|
35
35
|
import "./chunk-GX6KMHW2.js";
|
|
36
36
|
import "./chunk-TK3DXH7A.js";
|
|
37
37
|
import "./chunk-H3367ISL.js";
|
|
38
38
|
import {
|
|
39
39
|
TrainingHandoffOriginSchema
|
|
40
|
-
} from "./chunk-
|
|
41
|
-
import "./chunk-
|
|
40
|
+
} from "./chunk-7BYLH47N.js";
|
|
41
|
+
import "./chunk-K54BDIKL.js";
|
|
42
42
|
import {
|
|
43
43
|
HarnessSourceSelectionSchema,
|
|
44
44
|
createAgentSnapshot,
|
|
@@ -46,14 +46,14 @@ import {
|
|
|
46
46
|
validateHarnessPolicySourcePackage,
|
|
47
47
|
validateHarnessSourcePackage
|
|
48
48
|
} from "./chunk-Q4TKI2MV.js";
|
|
49
|
-
import "./chunk-
|
|
50
|
-
import "./chunk-
|
|
51
|
-
import "./chunk-
|
|
49
|
+
import "./chunk-C4W2MEFP.js";
|
|
50
|
+
import "./chunk-ZYDDHHZZ.js";
|
|
51
|
+
import "./chunk-RLW4Y5ZV.js";
|
|
52
52
|
import {
|
|
53
53
|
TrainingGpuSelectionSchema
|
|
54
|
-
} from "./chunk-
|
|
55
|
-
import "./chunk-B3ZHJ2KK.js";
|
|
54
|
+
} from "./chunk-UOV2LEXS.js";
|
|
56
55
|
import "./chunk-CL3IOOVL.js";
|
|
56
|
+
import "./chunk-B3ZHJ2KK.js";
|
|
57
57
|
import {
|
|
58
58
|
ImmutableReleaseRefSchema,
|
|
59
59
|
ReleaseHashSchema,
|
package/dist/training.js
CHANGED
|
@@ -70,7 +70,7 @@ import {
|
|
|
70
70
|
trainingExecutionReceiptHash,
|
|
71
71
|
trainingInputArtifactUploadHash,
|
|
72
72
|
trainingJobSubmissionHash
|
|
73
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-GJRXJL6G.js";
|
|
74
74
|
import {
|
|
75
75
|
HardwareAvailabilitySchema,
|
|
76
76
|
HardwareFleetSnapshotSchema,
|
|
@@ -81,17 +81,18 @@ import {
|
|
|
81
81
|
OpenPondTrainingApiError,
|
|
82
82
|
TrainingApiErrorSchema
|
|
83
83
|
} from "./chunk-GX6KMHW2.js";
|
|
84
|
-
import "./chunk-
|
|
85
|
-
import "./chunk-
|
|
84
|
+
import "./chunk-7BYLH47N.js";
|
|
85
|
+
import "./chunk-K54BDIKL.js";
|
|
86
86
|
import "./chunk-Q4TKI2MV.js";
|
|
87
|
-
import "./chunk-
|
|
88
|
-
import "./chunk-
|
|
89
|
-
import "./chunk-
|
|
87
|
+
import "./chunk-C4W2MEFP.js";
|
|
88
|
+
import "./chunk-ZYDDHHZZ.js";
|
|
89
|
+
import "./chunk-RLW4Y5ZV.js";
|
|
90
90
|
import {
|
|
91
91
|
TrainingEstimateReviewSchema,
|
|
92
92
|
TrainingGpuCatalogSchema,
|
|
93
93
|
TrainingGpuSelectionSchema
|
|
94
|
-
} from "./chunk-
|
|
94
|
+
} from "./chunk-UOV2LEXS.js";
|
|
95
|
+
import "./chunk-CL3IOOVL.js";
|
|
95
96
|
import {
|
|
96
97
|
OPENPOND_TRAINING_MEDIA_TYPE,
|
|
97
98
|
OPENPOND_TRAINING_PROTOCOL_MAJOR,
|
|
@@ -105,7 +106,6 @@ import {
|
|
|
105
106
|
canonicalSha256,
|
|
106
107
|
parseBoundedJson
|
|
107
108
|
} from "./chunk-B3ZHJ2KK.js";
|
|
108
|
-
import "./chunk-CL3IOOVL.js";
|
|
109
109
|
import "./chunk-H3JZ3P5T.js";
|
|
110
110
|
import "./chunk-YLJ4XMA6.js";
|
|
111
111
|
export {
|