openpond-sdk 0.12.11 → 0.12.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/LEARNING.md +11 -0
  2. package/dist/{chunk-RIN6Z56W.js → chunk-47I6LT4X.js} +4 -2
  3. package/dist/chunk-47I6LT4X.js.map +1 -0
  4. package/dist/{chunk-NKF5NIML.js → chunk-RN5G3DQN.js} +91 -15
  5. package/dist/chunk-RN5G3DQN.js.map +1 -0
  6. package/dist/experiment-evaluation-schedules.js +1 -1
  7. package/dist/experiments.js +1 -1
  8. package/dist/index.js +1 -1
  9. package/dist/model-starter-catalog.js +1 -1
  10. package/dist/model-starters.js +1 -1
  11. package/dist/taskset-packages.js +1 -1
  12. package/dist/tool-learning.js +238 -104
  13. package/dist/tool-learning.js.map +1 -1
  14. package/dist/types/packages/sdk/src/model-ordinary-taskset-reward.d.ts.map +1 -1
  15. package/dist/types/packages/sdk/src/model-supervised-training-defaults.d.ts +7 -0
  16. package/dist/types/packages/sdk/src/model-supervised-training-defaults.d.ts.map +1 -0
  17. package/dist/types/packages/sdk/src/model-taskset-runs.d.ts +216 -216
  18. package/dist/types/packages/sdk/src/model-training-defaults.d.ts +9 -2
  19. package/dist/types/packages/sdk/src/model-training-defaults.d.ts.map +1 -1
  20. package/dist/types/packages/sdk/src/tool-learning-client.d.ts +20 -1
  21. package/dist/types/packages/sdk/src/tool-learning-client.d.ts.map +1 -1
  22. package/dist/types/packages/sdk/src/tool-learning-episodes.d.ts +58 -0
  23. package/dist/types/packages/sdk/src/tool-learning-episodes.d.ts.map +1 -0
  24. package/dist/types/packages/sdk/src/tool-learning-responses.d.ts +713 -0
  25. package/dist/types/packages/sdk/src/tool-learning-responses.d.ts.map +1 -0
  26. package/dist/types/packages/sdk/src/tool-learning.d.ts +2 -0
  27. package/dist/types/packages/sdk/src/tool-learning.d.ts.map +1 -1
  28. package/dist/types/packages/sdk/src/training-learning-batch.d.ts +40 -40
  29. package/fixtures/python-foundation/operation-matrix.json +239 -1
  30. package/fixtures/python-foundation/schemas.json +24720 -19214
  31. package/package.json +1 -1
  32. package/dist/chunk-NKF5NIML.js.map +0 -1
  33. package/dist/chunk-RIN6Z56W.js.map +0 -1
@@ -14,15 +14,14 @@ import "./chunk-YLJ4XMA6.js";
14
14
  export * from "@openpond/evals/tool-learning";
15
15
 
16
16
  // src/tool-learning-client.ts
17
- import { z } from "zod";
17
+ import { z as z3 } from "zod";
18
18
  import { LearningRevisionRefSchema } from "@openpond/evals/learning";
19
19
  import {
20
- TOOL_LEARNING_LIMITS,
20
+ TOOL_LEARNING_LIMITS as TOOL_LEARNING_LIMITS3,
21
21
  ToolLearningRegistrationSchema,
22
- ToolLearningInstallationSchema,
23
- ToolLearningIdSchema,
24
- ToolEpisodeEventSchema,
25
- ToolLearningRefSchema,
22
+ ToolLearningInstallationSchema as ToolLearningInstallationSchema2,
23
+ ToolLearningIdSchema as ToolLearningIdSchema2,
24
+ ToolLearningRefSchema as ToolLearningRefSchema2,
26
25
  ToolLearningDecisionSchema,
27
26
  boundedToolLearningSchema,
28
27
  ToolLearningInstallationUpdateSchema,
@@ -34,84 +33,238 @@ import {
34
33
  assertToolLearningConsultationResponse
35
34
  } from "@openpond/evals/tool-learning";
36
35
  import { assertBoundedTaskJson } from "@openpond/evals/task-schema";
36
+
37
+ // src/tool-learning-episodes.ts
38
+ import { z } from "zod";
39
+ import {
40
+ TOOL_LEARNING_LIMITS,
41
+ ToolEpisodeEventSchema,
42
+ ToolLearningHashSchema,
43
+ ToolLearningRefSchema
44
+ } from "@openpond/evals/tool-learning";
45
+ var ToolLearningEpisodeAssemblySchema = z.object({
46
+ state: z.enum(["incomplete", "ambiguous", "awaiting_owner_review"]),
47
+ issues: z.array(z.enum([
48
+ "missing_attempt",
49
+ "missing_observation",
50
+ "completion_not_observed",
51
+ "conflicting_observations",
52
+ "reference_mismatch",
53
+ "lineage_mismatch",
54
+ "mixed_scope",
55
+ "conflicting_event"
56
+ ])).max(8),
57
+ groups: z.array(z.object({
58
+ key: ToolLearningHashSchema,
59
+ application: z.string().min(1).max(200),
60
+ applicationVersion: z.string().min(1).max(200),
61
+ tool: z.object({
62
+ name: z.string().min(1).max(200),
63
+ version: z.string().max(200).nullable(),
64
+ server: z.string().max(200).nullable()
65
+ }).strict(),
66
+ environmentFingerprints: z.array(ToolLearningHashSchema).max(TOOL_LEARNING_LIMITS.eventsPerEpisode),
67
+ attempts: z.array(ToolLearningRefSchema).max(TOOL_LEARNING_LIMITS.eventsPerEpisode)
68
+ }).strict()).max(TOOL_LEARNING_LIMITS.eventsPerEpisode)
69
+ }).strict();
70
+ function assembleToolLearningEpisode(raw) {
71
+ const events = z.array(ToolEpisodeEventSchema).max(TOOL_LEARNING_LIMITS.eventsPerEpisode).parse(raw);
72
+ const incomplete = /* @__PURE__ */ new Set(), ambiguous = /* @__PURE__ */ new Set();
73
+ const byId = /* @__PURE__ */ new Map();
74
+ const first = events[0];
75
+ for (const event of events) {
76
+ if (first && (event.installationId !== first.installationId || event.episodeId !== first.episodeId))
77
+ ambiguous.add("mixed_scope");
78
+ if (event.parentSessionId === event.sessionId) ambiguous.add("lineage_mismatch");
79
+ const previous = byId.get(event.eventId);
80
+ if (previous && previous.contentHash !== event.contentHash) ambiguous.add("conflicting_event");
81
+ else byId.set(event.eventId, event);
82
+ }
83
+ const attempts = [...byId.values()].filter((event) => event.eventKind === "attempt");
84
+ const observations = /* @__PURE__ */ new Map();
85
+ const callOwners = /* @__PURE__ */ new Map();
86
+ if (!attempts.length) incomplete.add("missing_attempt");
87
+ for (const event of byId.values()) {
88
+ if (event.eventKind !== "observation") continue;
89
+ const attempt = byId.get(event.payload.attempt.id);
90
+ if (!attempt) incomplete.add("missing_attempt");
91
+ else if (attempt.eventKind !== "attempt" || attempt.contentHash !== event.payload.attempt.contentHash || attempt.payload.actionHash !== event.payload.actionHash) ambiguous.add("reference_mismatch");
92
+ else if (attempt.sessionId !== event.sessionId || attempt.callId !== event.callId || attempt.parentSessionId && event.parentSessionId && attempt.parentSessionId !== event.parentSessionId || attempt.turnId && event.turnId && attempt.turnId !== event.turnId) ambiguous.add("lineage_mismatch");
93
+ const values = observations.get(event.payload.attempt.id) ?? [];
94
+ values.push(event);
95
+ observations.set(event.payload.attempt.id, values);
96
+ }
97
+ const grouped = /* @__PURE__ */ new Map();
98
+ for (const attempt of attempts) {
99
+ const callKey = JSON.stringify([attempt.sessionId, attempt.callId]);
100
+ const previousCall = callOwners.get(callKey);
101
+ if (previousCall && previousCall !== attempt.contentHash) ambiguous.add("lineage_mismatch");
102
+ callOwners.set(callKey, attempt.contentHash);
103
+ const values = observations.get(attempt.eventId) ?? [];
104
+ if (!values.length) incomplete.add("missing_observation");
105
+ else {
106
+ const terminal = values.filter((event) => event.payload.outcome !== "incomplete");
107
+ if (!terminal.length) incomplete.add("completion_not_observed");
108
+ if (new Set(terminal.map((event) => contentHash(event.payload))).size > 1)
109
+ ambiguous.add("conflicting_observations");
110
+ }
111
+ const { environment, tool } = attempt.payload;
112
+ const key = contentHash([environment.application, environment.version, tool.name, tool.version, tool.server]);
113
+ const group = grouped.get(key) ?? {
114
+ application: environment.application,
115
+ applicationVersion: environment.version,
116
+ tool,
117
+ fingerprints: /* @__PURE__ */ new Set(),
118
+ attempts: []
119
+ };
120
+ group.fingerprints.add(environment.fingerprint);
121
+ group.attempts.push({ id: attempt.eventId, contentHash: attempt.contentHash });
122
+ grouped.set(key, group);
123
+ }
124
+ return ToolLearningEpisodeAssemblySchema.parse({
125
+ state: ambiguous.size ? "ambiguous" : incomplete.size ? "incomplete" : "awaiting_owner_review",
126
+ issues: [.../* @__PURE__ */ new Set([...ambiguous, ...incomplete])].sort(),
127
+ groups: [...grouped].sort(([a], [b]) => a.localeCompare(b)).map(([key, group]) => ({
128
+ key,
129
+ application: group.application,
130
+ applicationVersion: group.applicationVersion,
131
+ tool: group.tool,
132
+ environmentFingerprints: [...group.fingerprints].sort(),
133
+ attempts: group.attempts.sort((a, b) => a.id.localeCompare(b.id))
134
+ }))
135
+ });
136
+ }
137
+
138
+ // src/tool-learning-responses.ts
139
+ import { z as z2 } from "zod";
140
+ import {
141
+ TOOL_LEARNING_LIMITS as TOOL_LEARNING_LIMITS2,
142
+ ToolEpisodeEventSchema as ToolEpisodeEventSchema2,
143
+ ToolLearningIdSchema,
144
+ ToolLearningInstallationSchema,
145
+ ToolLearningScopeSchema
146
+ } from "@openpond/evals/tool-learning";
147
+ var ToolLearningRegistrationReceiptSchema = z2.object({
148
+ installation: ToolLearningInstallationSchema,
149
+ apiKey: LearningSourceCredentialSecretSchema
150
+ }).strict();
151
+ var ToolLearningInstallationPageSchema = z2.object({
152
+ items: z2.array(ToolLearningInstallationSchema).max(30),
153
+ nextCursor: ToolLearningIdSchema.nullable()
154
+ }).strict();
155
+ var ToolLearningEpisodePageSchema = z2.object({
156
+ installationId: ToolLearningIdSchema,
157
+ scope: ToolLearningScopeSchema,
158
+ items: z2.array(
159
+ z2.object({
160
+ episodeId: ToolLearningIdSchema,
161
+ eventCount: z2.number().int().positive(),
162
+ lastReceivedAt: z2.iso.datetime()
163
+ }).strict()
164
+ ).max(30),
165
+ nextCursor: ToolLearningIdSchema.nullable(),
166
+ learningEnrollment: z2.literal(false)
167
+ }).strict();
168
+ var ToolLearningEpisodeDetailSchema = z2.object({
169
+ installationId: ToolLearningIdSchema,
170
+ episodeId: ToolLearningIdSchema,
171
+ scope: ToolLearningScopeSchema,
172
+ events: z2.array(ToolEpisodeEventSchema2).max(TOOL_LEARNING_LIMITS2.eventsPerEpisode),
173
+ state: ToolLearningEpisodeAssemblySchema.shape.state,
174
+ assembly: ToolLearningEpisodeAssemblySchema,
175
+ verificationAuthority: z2.literal("not_granted"),
176
+ learningEnrollment: z2.literal(false)
177
+ }).strict();
178
+ var ToolLearningPurgeRequestSchema = z2.object({
179
+ operationId: ToolLearningIdSchema,
180
+ expectedRevision: z2.number().int().positive()
181
+ }).strict();
182
+ var ToolLearningPurgeReceiptSchema = z2.object({
183
+ installationId: ToolLearningIdSchema,
184
+ operationId: ToolLearningIdSchema,
185
+ purgedEvents: z2.number().int().nonnegative(),
186
+ learningEnrollment: z2.literal(false)
187
+ }).strict();
188
+
189
+ // src/tool-learning-client.ts
37
190
  var ToolLearningRegistrationRequestSchema = boundedToolLearningSchema(
38
- z.object({
191
+ z3.object({
39
192
  registration: ToolLearningRegistrationSchema,
40
- credential: z.object({ apiKey: LearningSourceCredentialSecretSchema, expiresAt: z.iso.datetime() }).strict()
193
+ credential: z3.object({ apiKey: LearningSourceCredentialSecretSchema, expiresAt: z3.iso.datetime() }).strict()
41
194
  }).strict(),
42
- TOOL_LEARNING_LIMITS.eventBytes
195
+ TOOL_LEARNING_LIMITS3.eventBytes
43
196
  );
44
197
  var ToolLearningProjectionRequestSchema = boundedToolLearningSchema(
45
- z.object({
46
- operationId: ToolLearningIdSchema,
47
- expectedRevision: z.number().int().positive(),
48
- episodeId: ToolLearningIdSchema,
49
- failure: ToolLearningRefSchema,
50
- recovery: ToolLearningRefSchema,
198
+ z3.object({
199
+ operationId: ToolLearningIdSchema2,
200
+ expectedRevision: z3.number().int().positive(),
201
+ episodeId: ToolLearningIdSchema2,
202
+ failure: ToolLearningRefSchema2,
203
+ recovery: ToolLearningRefSchema2,
51
204
  taskDefinition: LearningRevisionRefSchema,
52
- familyKey: ToolLearningIdSchema,
53
- split: z.literal("train"),
205
+ familyKey: ToolLearningIdSchema2,
206
+ split: z3.literal("train"),
54
207
  proposedTarget: ToolLearningDecisionSchema,
55
- saveToPrivateDataset: z.literal(true),
56
- targetApproval: z.literal("pending_owner_review")
208
+ saveToPrivateDataset: z3.literal(true),
209
+ targetApproval: z3.literal("pending_owner_review")
57
210
  }).strict(),
58
- TOOL_LEARNING_LIMITS.eventBytes
211
+ TOOL_LEARNING_LIMITS3.eventBytes
59
212
  );
60
213
  var ToolLearningProjectionReceiptSchema = boundedToolLearningSchema(
61
- z.object({
62
- installationId: ToolLearningIdSchema,
63
- projectId: ToolLearningIdSchema,
64
- operationId: ToolLearningIdSchema,
214
+ z3.object({
215
+ installationId: ToolLearningIdSchema2,
216
+ projectId: ToolLearningIdSchema2,
217
+ operationId: ToolLearningIdSchema2,
65
218
  source: LearningRevisionRefSchema,
66
219
  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)
220
+ originHash: z3.string().regex(/^[a-f0-9]{64}$/),
221
+ requestHash: z3.string().regex(/^[a-f0-9]{64}$/),
222
+ projectedAt: z3.iso.datetime(),
223
+ targetApproval: z3.literal("pending_owner_review"),
224
+ learningEnrollment: z3.literal(false)
72
225
  }).strict(),
73
- TOOL_LEARNING_LIMITS.eventBytes
226
+ TOOL_LEARNING_LIMITS3.eventBytes
74
227
  );
75
228
  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
229
+ z3.object({
230
+ operationId: ToolLearningIdSchema2,
231
+ expectedRevision: z3.number().int().nonnegative(),
232
+ state: z3.enum(["enabled", "disabled"]),
233
+ modelId: ToolLearningIdSchema2,
234
+ qualification: z3.discriminatedUnion("kind", [
235
+ z3.object({ kind: z3.literal("integration"), evaluationRunId: ToolLearningIdSchema2 }).strict(),
236
+ z3.object({
237
+ kind: z3.literal("learned"),
238
+ evaluationRunId: ToolLearningIdSchema2,
239
+ baselineRunId: ToolLearningIdSchema2,
240
+ trainingRunId: ToolLearningIdSchema2
88
241
  }).strict()
89
242
  ]),
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)
243
+ capabilities: z3.array(ToolLearningCapabilitySchema.omit({ qualification: true })).min(1).max(16),
244
+ limits: z3.object({
245
+ maxOutputTokens: z3.number().int().min(128).max(2048),
246
+ maximumCallUsd: z3.number().positive().max(1),
247
+ maximumDayUsd: z3.number().positive().max(10),
248
+ maximumSessionCalls: z3.number().int().min(1).max(20),
249
+ maximumDayCalls: z3.number().int().min(1).max(200)
97
250
  }).strict()
98
251
  }).strict(),
99
- TOOL_LEARNING_LIMITS.eventBytes
252
+ TOOL_LEARNING_LIMITS3.eventBytes
100
253
  );
101
254
  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}$/),
255
+ z3.object({
256
+ installationId: ToolLearningIdSchema2,
257
+ scope: z3.object({ teamId: ToolLearningIdSchema2, projectId: ToolLearningIdSchema2 }).strict(),
258
+ revision: z3.number().int().positive(),
259
+ operationId: ToolLearningIdSchema2,
260
+ requestHash: z3.string().regex(/^[a-f0-9]{64}$/),
108
261
  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()
262
+ modelRelease: ToolLearningRefSchema2,
263
+ policySystemPrompt: z3.string().min(1).max(16384),
264
+ capabilities: z3.array(ToolLearningCapabilitySchema).max(16),
265
+ updatedAt: z3.iso.datetime()
113
266
  }).strict(),
114
- TOOL_LEARNING_LIMITS.eventBytes
267
+ TOOL_LEARNING_LIMITS3.eventBytes
115
268
  );
116
269
  function prepareToolLearningRegistration(registration, expiresAt) {
117
270
  const prepared = createSourceCredentialRequest({
@@ -148,10 +301,9 @@ var OpenPondToolLearningClient = class {
148
301
  const input = ToolLearningRegistrationRequestSchema.parse(value);
149
302
  if (input.registration.projectId !== this.#options.projectId)
150
303
  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));
304
+ const result = ToolLearningRegistrationReceiptSchema.parse(
305
+ await this.#request("installations", "POST", input, signal)
306
+ );
155
307
  this.#installation(result.installation, input.registration.installationId);
156
308
  if (result.apiKey !== input.credential.apiKey)
157
309
  throw new Error("tool_learning_credential_mismatch");
@@ -161,17 +313,14 @@ var OpenPondToolLearningClient = class {
161
313
  return result;
162
314
  }
163
315
  async installation(id, signal) {
164
- const result = ToolLearningInstallationSchema.parse(
316
+ const result = ToolLearningInstallationSchema2.parse(
165
317
  await this.#request(`installations/${encodeURIComponent(id)}`, "GET", void 0, signal)
166
318
  );
167
319
  this.#installation(result, id);
168
320
  return result;
169
321
  }
170
322
  async installations(after, signal) {
171
- const result = z.object({
172
- items: z.array(ToolLearningInstallationSchema).max(30),
173
- nextCursor: ToolLearningIdSchema.nullable()
174
- }).strict().parse(
323
+ const result = ToolLearningInstallationPageSchema.parse(
175
324
  await this.#request(
176
325
  `installations?projectId=${encodeURIComponent(this.#options.projectId)}${after ? `&after=${encodeURIComponent(after)}` : ""}`,
177
326
  "GET",
@@ -185,19 +334,7 @@ var OpenPondToolLearningClient = class {
185
334
  return result;
186
335
  }
187
336
  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(
337
+ const result = ToolLearningEpisodePageSchema.parse(
201
338
  await this.#request(
202
339
  `installations/${encodeURIComponent(installationId)}/episodes${after ? `?after=${encodeURIComponent(after)}` : ""}`,
203
340
  "GET",
@@ -210,15 +347,7 @@ var OpenPondToolLearningClient = class {
210
347
  return result;
211
348
  }
212
349
  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(
350
+ const result = ToolLearningEpisodeDetailSchema.parse(
222
351
  await this.#request(
223
352
  `installations/${encodeURIComponent(installationId)}/episodes/${encodeURIComponent(episodeId)}`,
224
353
  "GET",
@@ -230,16 +359,13 @@ var OpenPondToolLearningClient = class {
230
359
  (event) => event.installationId !== installationId || event.episodeId !== episodeId
231
360
  ))
232
361
  throw new Error("tool_learning_episode_scope_mismatch");
362
+ if (result.state !== result.assembly.state || contentHash(assembleToolLearningEpisode(result.events)) !== contentHash(result.assembly))
363
+ throw new Error("tool_learning_episode_assembly_mismatch");
233
364
  return result;
234
365
  }
235
366
  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(
367
+ const request = ToolLearningPurgeRequestSchema.parse(input);
368
+ const result = ToolLearningPurgeReceiptSchema.parse(
243
369
  await this.#request(
244
370
  `installations/${encodeURIComponent(installationId)}/purge`,
245
371
  "POST",
@@ -267,7 +393,7 @@ var OpenPondToolLearningClient = class {
267
393
  }
268
394
  async setState(id, value, signal) {
269
395
  const input = ToolLearningInstallationUpdateSchema.parse(value);
270
- const result = ToolLearningInstallationSchema.parse(
396
+ const result = ToolLearningInstallationSchema2.parse(
271
397
  await this.#request(`installations/${encodeURIComponent(id)}`, "PATCH", input, signal)
272
398
  );
273
399
  this.#installation(result, id);
@@ -366,7 +492,7 @@ var OpenPondToolLearningClient = class {
366
492
  if (body !== void 0)
367
493
  assertBoundedTaskJson(
368
494
  body,
369
- TOOL_LEARNING_LIMITS.eventBytes * TOOL_LEARNING_LIMITS.eventsPerAppend
495
+ TOOL_LEARNING_LIMITS3.eventBytes * TOOL_LEARNING_LIMITS3.eventsPerAppend
370
496
  );
371
497
  const timeout = AbortSignal.timeout(3e4);
372
498
  const response = await (this.#options.fetch ?? globalThis.fetch)(
@@ -386,12 +512,12 @@ var OpenPondToolLearningClient = class {
386
512
  );
387
513
  const value = await readBoundedJsonResponse(
388
514
  response,
389
- TOOL_LEARNING_LIMITS.eventBytes * TOOL_LEARNING_LIMITS.eventsPerAppend,
515
+ TOOL_LEARNING_LIMITS3.eventBytes * TOOL_LEARNING_LIMITS3.eventsPerAppend,
390
516
  "Tool learning response"
391
517
  );
392
518
  if (!response.ok) {
393
- const error = z.object({
394
- code: z.string().regex(/^[a-z0-9_]+$/).max(200)
519
+ const error = z3.object({
520
+ code: z3.string().regex(/^[a-z0-9_]+$/).max(200)
395
521
  }).passthrough().safeParse(value);
396
522
  throw new OpenPondToolLearningError(
397
523
  response.status,
@@ -404,11 +530,19 @@ var OpenPondToolLearningClient = class {
404
530
  export {
405
531
  OpenPondToolLearningClient,
406
532
  OpenPondToolLearningError,
533
+ ToolLearningEpisodeAssemblySchema,
534
+ ToolLearningEpisodeDetailSchema,
535
+ ToolLearningEpisodePageSchema,
536
+ ToolLearningInstallationPageSchema,
407
537
  ToolLearningProjectionReceiptSchema,
408
538
  ToolLearningProjectionRequestSchema,
539
+ ToolLearningPurgeReceiptSchema,
540
+ ToolLearningPurgeRequestSchema,
541
+ ToolLearningRegistrationReceiptSchema,
409
542
  ToolLearningRegistrationRequestSchema,
410
543
  ToolLearningRoutingRequestSchema,
411
544
  ToolLearningRoutingSchema,
545
+ assembleToolLearningEpisode,
412
546
  prepareToolLearningRegistration
413
547
  };
414
548
  //# sourceMappingURL=tool-learning.js.map
@@ -1 +1 @@
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;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AAKP,SAAS,6BAA6B;AAK/B,IAAM,wCAAwC;AAAA,EACnD,EACG,OAAO;AAAA,IACN,cAAc;AAAA,IACd,YAAY,EACT,OAAO,EAAE,QAAQ,sCAAsC,WAAW,EAAE,IAAI,SAAS,EAAE,CAAC,EACpF,OAAO;AAAA,EACZ,CAAC,EACA,OAAO;AAAA,EACV,qBAAqB;AACvB;AAEO,IAAM,sCAAsC;AAAA,EACjD,EACG,OAAO;AAAA,IACN,aAAa;AAAA,IACb,kBAAkB,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS;AAAA,IAC5C,WAAW;AAAA,IACX,SAAS;AAAA,IACT,UAAU;AAAA,IACV,gBAAgB;AAAA,IAChB,WAAW;AAAA,IACX,OAAO,EAAE,QAAQ,OAAO;AAAA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AS,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"]}
1
+ {"version":3,"sources":["../src/tool-learning.ts","../src/tool-learning-client.ts","../src/tool-learning-episodes.ts","../src/tool-learning-responses.ts"],"sourcesContent":["/** Portable episode and recovery-consultation protocol; no installation side effects. */\nexport * from \"@openpond/evals/tool-learning\";\nexport * from \"./tool-learning-client.js\";\nexport * from \"./tool-learning-episodes.js\";\nexport * from \"./tool-learning-responses.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 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\";\nimport { assembleToolLearningEpisode } from \"./tool-learning-episodes.js\";\nimport {\n ToolLearningRegistrationReceiptSchema,\n ToolLearningInstallationPageSchema,\n ToolLearningEpisodePageSchema,\n ToolLearningEpisodeDetailSchema,\n ToolLearningPurgeRequestSchema,\n ToolLearningPurgeReceiptSchema,\n} from \"./tool-learning-responses.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 = ToolLearningRegistrationReceiptSchema.parse(\n await this.#request(\"installations\", \"POST\", input, signal),\n );\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 = ToolLearningInstallationPageSchema.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 = ToolLearningEpisodePageSchema.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 = ToolLearningEpisodeDetailSchema.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 if (\n result.state !== result.assembly.state ||\n contentHash(assembleToolLearningEpisode(result.events)) !== contentHash(result.assembly)\n )\n throw new Error(\"tool_learning_episode_assembly_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 = ToolLearningPurgeRequestSchema.parse(input);\n const result = ToolLearningPurgeReceiptSchema.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","import { z } from \"zod\";\nimport { contentHash } from \"@openpond/harness\";\nimport {\n TOOL_LEARNING_LIMITS,\n ToolEpisodeEventSchema,\n ToolLearningHashSchema,\n ToolLearningRefSchema,\n type ToolEpisodeEvent,\n} from \"@openpond/evals/tool-learning\";\n\nexport const ToolLearningEpisodeAssemblySchema = z.object({\n state: z.enum([\"incomplete\", \"ambiguous\", \"awaiting_owner_review\"]),\n issues: z.array(z.enum([\n \"missing_attempt\", \"missing_observation\", \"completion_not_observed\",\n \"conflicting_observations\", \"reference_mismatch\", \"lineage_mismatch\",\n \"mixed_scope\", \"conflicting_event\",\n ])).max(8),\n groups: z.array(z.object({\n key: ToolLearningHashSchema,\n application: z.string().min(1).max(200),\n applicationVersion: z.string().min(1).max(200),\n tool: z.object({\n name: z.string().min(1).max(200),\n version: z.string().max(200).nullable(),\n server: z.string().max(200).nullable(),\n }).strict(),\n environmentFingerprints: z.array(ToolLearningHashSchema).max(TOOL_LEARNING_LIMITS.eventsPerEpisode),\n attempts: z.array(ToolLearningRefSchema).max(TOOL_LEARNING_LIMITS.eventsPerEpisode),\n }).strict()).max(TOOL_LEARNING_LIMITS.eventsPerEpisode),\n}).strict();\n\ntype Issue = z.infer<typeof ToolLearningEpisodeAssemblySchema>[\"issues\"][number];\ntype Attempt = Extract<ToolEpisodeEvent, { eventKind: \"attempt\" }>;\ntype Observation = Extract<ToolEpisodeEvent, { eventKind: \"observation\" }>;\n\n/** Structural assembly of retained calls, never recovery verification or label\n * approval. Conflicting observations remain visible instead of selecting the\n * most recently received answer. Recovery/verifier claims retain their separate\n * owner authority and are not promoted by this read projection. */\nexport function assembleToolLearningEpisode(raw: readonly ToolEpisodeEvent[]) {\n const events = z.array(ToolEpisodeEventSchema).max(TOOL_LEARNING_LIMITS.eventsPerEpisode).parse(raw);\n const incomplete = new Set<Issue>(), ambiguous = new Set<Issue>();\n const byId = new Map<string, ToolEpisodeEvent>();\n const first = events[0];\n for (const event of events) {\n if (first && (event.installationId !== first.installationId || event.episodeId !== first.episodeId))\n ambiguous.add(\"mixed_scope\");\n if (event.parentSessionId === event.sessionId) ambiguous.add(\"lineage_mismatch\");\n const previous = byId.get(event.eventId);\n if (previous && previous.contentHash !== event.contentHash) ambiguous.add(\"conflicting_event\");\n else byId.set(event.eventId, event);\n }\n const attempts = [...byId.values()].filter((event): event is Attempt => event.eventKind === \"attempt\");\n const observations = new Map<string, Observation[]>();\n const callOwners = new Map<string, string>();\n if (!attempts.length) incomplete.add(\"missing_attempt\");\n for (const event of byId.values()) {\n if (event.eventKind !== \"observation\") continue;\n const attempt = byId.get(event.payload.attempt.id);\n if (!attempt) incomplete.add(\"missing_attempt\");\n else if (attempt.eventKind !== \"attempt\" ||\n attempt.contentHash !== event.payload.attempt.contentHash ||\n attempt.payload.actionHash !== event.payload.actionHash) ambiguous.add(\"reference_mismatch\");\n else if (attempt.sessionId !== event.sessionId || attempt.callId !== event.callId ||\n (attempt.parentSessionId && event.parentSessionId && attempt.parentSessionId !== event.parentSessionId) ||\n (attempt.turnId && event.turnId && attempt.turnId !== event.turnId)) ambiguous.add(\"lineage_mismatch\");\n const values = observations.get(event.payload.attempt.id) ?? [];\n values.push(event);\n observations.set(event.payload.attempt.id, values);\n }\n const grouped = new Map<string, {\n application: string; applicationVersion: string; tool: Attempt[\"payload\"][\"tool\"];\n fingerprints: Set<string>; attempts: Array<{ id: string; contentHash: string }>;\n }>();\n for (const attempt of attempts) {\n const callKey = JSON.stringify([attempt.sessionId, attempt.callId]);\n const previousCall = callOwners.get(callKey);\n if (previousCall && previousCall !== attempt.contentHash) ambiguous.add(\"lineage_mismatch\");\n callOwners.set(callKey, attempt.contentHash);\n const values = observations.get(attempt.eventId) ?? [];\n if (!values.length) incomplete.add(\"missing_observation\");\n else {\n const terminal = values.filter((event) => event.payload.outcome !== \"incomplete\");\n if (!terminal.length) incomplete.add(\"completion_not_observed\");\n if (new Set(terminal.map((event) => contentHash(event.payload))).size > 1)\n ambiguous.add(\"conflicting_observations\");\n }\n const { environment, tool } = attempt.payload;\n const key = contentHash([environment.application, environment.version, tool.name, tool.version, tool.server]);\n const group = grouped.get(key) ?? {\n application: environment.application, applicationVersion: environment.version,\n tool, fingerprints: new Set<string>(), attempts: [],\n };\n group.fingerprints.add(environment.fingerprint);\n group.attempts.push({ id: attempt.eventId, contentHash: attempt.contentHash });\n grouped.set(key, group);\n }\n return ToolLearningEpisodeAssemblySchema.parse({\n state: ambiguous.size ? \"ambiguous\" : incomplete.size ? \"incomplete\" : \"awaiting_owner_review\",\n issues: [...new Set([...ambiguous, ...incomplete])].sort(),\n groups: [...grouped].sort(([a], [b]) => a.localeCompare(b)).map(([key, group]) => ({\n key, application: group.application, applicationVersion: group.applicationVersion, tool: group.tool,\n environmentFingerprints: [...group.fingerprints].sort(),\n attempts: group.attempts.sort((a, b) => a.id.localeCompare(b.id)),\n })),\n });\n}\n","import { z } from \"zod\";\nimport {\n TOOL_LEARNING_LIMITS,\n ToolEpisodeEventSchema,\n ToolLearningIdSchema,\n ToolLearningInstallationSchema,\n ToolLearningScopeSchema,\n} from \"@openpond/evals/tool-learning\";\nimport { LearningSourceCredentialSecretSchema } from \"./learning-credentials.js\";\nimport { ToolLearningEpisodeAssemblySchema } from \"./tool-learning-episodes.js\";\n\n/** Shared wire envelopes used by native clients and the Python schema exporter. */\nexport const ToolLearningRegistrationReceiptSchema = z\n .object({\n installation: ToolLearningInstallationSchema,\n apiKey: LearningSourceCredentialSecretSchema,\n })\n .strict();\n\nexport const ToolLearningInstallationPageSchema = z\n .object({\n items: z.array(ToolLearningInstallationSchema).max(30),\n nextCursor: ToolLearningIdSchema.nullable(),\n })\n .strict();\n\nexport const ToolLearningEpisodePageSchema = z\n .object({\n installationId: ToolLearningIdSchema,\n scope: ToolLearningScopeSchema,\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\nexport const ToolLearningEpisodeDetailSchema = z\n .object({\n installationId: ToolLearningIdSchema,\n episodeId: ToolLearningIdSchema,\n scope: ToolLearningScopeSchema,\n events: z.array(ToolEpisodeEventSchema).max(TOOL_LEARNING_LIMITS.eventsPerEpisode),\n state: ToolLearningEpisodeAssemblySchema.shape.state,\n assembly: ToolLearningEpisodeAssemblySchema,\n verificationAuthority: z.literal(\"not_granted\"),\n learningEnrollment: z.literal(false),\n })\n .strict();\n\nexport const ToolLearningPurgeRequestSchema = z\n .object({\n operationId: ToolLearningIdSchema,\n expectedRevision: z.number().int().positive(),\n })\n .strict();\n\nexport const ToolLearningPurgeReceiptSchema = z\n .object({\n installationId: ToolLearningIdSchema,\n operationId: ToolLearningIdSchema,\n purgedEvents: z.number().int().nonnegative(),\n learningEnrollment: z.literal(false),\n })\n .strict();\n"],"mappings":";;;;;;;;;;;;;AACA,cAAc;;;ACDd,SAAS,KAAAA,UAAS;AAElB,SAAS,iCAAiC;AAC1C;AAAA,EACE,wBAAAC;AAAA,EACA;AAAA,EACA,kCAAAC;AAAA,EACA,wBAAAC;AAAA,EACA,yBAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AAKP,SAAS,6BAA6B;;;AC1BtC,SAAS,SAAS;AAElB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAEA,IAAM,oCAAoC,EAAE,OAAO;AAAA,EACxD,OAAO,EAAE,KAAK,CAAC,cAAc,aAAa,uBAAuB,CAAC;AAAA,EAClE,QAAQ,EAAE,MAAM,EAAE,KAAK;AAAA,IACrB;AAAA,IAAmB;AAAA,IAAuB;AAA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,SAAS,IAAI;AAChB,YAAM,QAAQD,GACX,OAAO;AAAA,QACN,MAAMA,GACH,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":["z","TOOL_LEARNING_LIMITS","ToolLearningInstallationSchema","ToolLearningIdSchema","ToolLearningRefSchema","z","TOOL_LEARNING_LIMITS","ToolEpisodeEventSchema","z","ToolEpisodeEventSchema","TOOL_LEARNING_LIMITS","z","TOOL_LEARNING_LIMITS","ToolLearningIdSchema","ToolLearningRefSchema","ToolLearningInstallationSchema","value"]}
@@ -1 +1 @@
1
- {"version":3,"file":"model-ordinary-taskset-reward.d.ts","sourceRoot":"","sources":["../../../../../src/model-ordinary-taskset-reward.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmF,KAAK,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AACnJ,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAE5E,OAAO,EAAmF,KAAK,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAItJ;+EAC+E;AAC/E,wBAAgB,8BAA8B,CAAC,KAAK,EAAE;IACpD,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5C,MAAM,EAAE,cAAc,CAAC;IACvB,aAAa,EAAE,aAAa,CAAC;IAC7B,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,MAAM,EAAE,iBAAiB,EAAE,CAAC;CAC7B,GAAG,cAAc,CA6CjB"}
1
+ {"version":3,"file":"model-ordinary-taskset-reward.d.ts","sourceRoot":"","sources":["../../../../../src/model-ordinary-taskset-reward.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmF,KAAK,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AACnJ,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAE5E,OAAO,EAAmF,KAAK,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAItJ;+EAC+E;AAC/E,wBAAgB,8BAA8B,CAAC,KAAK,EAAE;IACpD,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5C,MAAM,EAAE,cAAc,CAAC;IACvB,aAAa,EAAE,aAAa,CAAC;IAC7B,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,MAAM,EAAE,iBAAiB,EAAE,CAAC;CAC7B,GAAG,cAAc,CAiDjB"}