openpond-sdk 0.12.11 → 0.12.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LEARNING.md +11 -0
- package/dist/tool-learning.js +178 -70
- package/dist/tool-learning.js.map +1 -1
- package/dist/types/packages/sdk/src/tool-learning-client.d.ts +20 -1
- package/dist/types/packages/sdk/src/tool-learning-client.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/tool-learning-episodes.d.ts +58 -0
- package/dist/types/packages/sdk/src/tool-learning-episodes.d.ts.map +1 -0
- 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/LEARNING.md
CHANGED
|
@@ -154,3 +154,14 @@ or known eligible boundaries. Changed originals require a new policy.
|
|
|
154
154
|
false when unreadable originals are excluded. `coverage.excludedSessions` retains
|
|
155
155
|
their count. These fields establish inventory reconciliation only; reconstructed
|
|
156
156
|
tasks still need their own starting-state and grader qualification.
|
|
157
|
+
|
|
158
|
+
### Bounded tool episode records
|
|
159
|
+
|
|
160
|
+
`openpond-sdk/tool-learning` exports `assembleToolLearningEpisode`. Episode reads
|
|
161
|
+
retain the original events plus an `assembly` with structural application/tool
|
|
162
|
+
version groups and an explicit `incomplete`, `ambiguous`, or
|
|
163
|
+
`awaiting_owner_review` state. Missing observations stay incomplete; contradictory
|
|
164
|
+
terminal observations or mismatched call references stay ambiguous. Delivery
|
|
165
|
+
order does not select a preferred outcome. The SDK checks assembly against the
|
|
166
|
+
returned events. These records grant neither verification nor learning authority;
|
|
167
|
+
owner review and canonical grading/admission remain separate.
|
package/dist/tool-learning.js
CHANGED
|
@@ -14,15 +14,15 @@ 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 z2 } from "zod";
|
|
18
18
|
import { LearningRevisionRefSchema } from "@openpond/evals/learning";
|
|
19
19
|
import {
|
|
20
|
-
TOOL_LEARNING_LIMITS,
|
|
20
|
+
TOOL_LEARNING_LIMITS as TOOL_LEARNING_LIMITS2,
|
|
21
21
|
ToolLearningRegistrationSchema,
|
|
22
22
|
ToolLearningInstallationSchema,
|
|
23
23
|
ToolLearningIdSchema,
|
|
24
|
-
ToolEpisodeEventSchema,
|
|
25
|
-
ToolLearningRefSchema,
|
|
24
|
+
ToolEpisodeEventSchema as ToolEpisodeEventSchema2,
|
|
25
|
+
ToolLearningRefSchema as ToolLearningRefSchema2,
|
|
26
26
|
ToolLearningDecisionSchema,
|
|
27
27
|
boundedToolLearningSchema,
|
|
28
28
|
ToolLearningInstallationUpdateSchema,
|
|
@@ -34,84 +34,187 @@ import {
|
|
|
34
34
|
assertToolLearningConsultationResponse
|
|
35
35
|
} from "@openpond/evals/tool-learning";
|
|
36
36
|
import { assertBoundedTaskJson } from "@openpond/evals/task-schema";
|
|
37
|
+
|
|
38
|
+
// src/tool-learning-episodes.ts
|
|
39
|
+
import { z } from "zod";
|
|
40
|
+
import {
|
|
41
|
+
TOOL_LEARNING_LIMITS,
|
|
42
|
+
ToolEpisodeEventSchema,
|
|
43
|
+
ToolLearningHashSchema,
|
|
44
|
+
ToolLearningRefSchema
|
|
45
|
+
} from "@openpond/evals/tool-learning";
|
|
46
|
+
var ToolLearningEpisodeAssemblySchema = z.object({
|
|
47
|
+
state: z.enum(["incomplete", "ambiguous", "awaiting_owner_review"]),
|
|
48
|
+
issues: z.array(z.enum([
|
|
49
|
+
"missing_attempt",
|
|
50
|
+
"missing_observation",
|
|
51
|
+
"completion_not_observed",
|
|
52
|
+
"conflicting_observations",
|
|
53
|
+
"reference_mismatch",
|
|
54
|
+
"lineage_mismatch",
|
|
55
|
+
"mixed_scope",
|
|
56
|
+
"conflicting_event"
|
|
57
|
+
])).max(8),
|
|
58
|
+
groups: z.array(z.object({
|
|
59
|
+
key: ToolLearningHashSchema,
|
|
60
|
+
application: z.string().min(1).max(200),
|
|
61
|
+
applicationVersion: z.string().min(1).max(200),
|
|
62
|
+
tool: z.object({
|
|
63
|
+
name: z.string().min(1).max(200),
|
|
64
|
+
version: z.string().max(200).nullable(),
|
|
65
|
+
server: z.string().max(200).nullable()
|
|
66
|
+
}).strict(),
|
|
67
|
+
environmentFingerprints: z.array(ToolLearningHashSchema).max(TOOL_LEARNING_LIMITS.eventsPerEpisode),
|
|
68
|
+
attempts: z.array(ToolLearningRefSchema).max(TOOL_LEARNING_LIMITS.eventsPerEpisode)
|
|
69
|
+
}).strict()).max(TOOL_LEARNING_LIMITS.eventsPerEpisode)
|
|
70
|
+
}).strict();
|
|
71
|
+
function assembleToolLearningEpisode(raw) {
|
|
72
|
+
const events = z.array(ToolEpisodeEventSchema).max(TOOL_LEARNING_LIMITS.eventsPerEpisode).parse(raw);
|
|
73
|
+
const incomplete = /* @__PURE__ */ new Set(), ambiguous = /* @__PURE__ */ new Set();
|
|
74
|
+
const byId = /* @__PURE__ */ new Map();
|
|
75
|
+
const first = events[0];
|
|
76
|
+
for (const event of events) {
|
|
77
|
+
if (first && (event.installationId !== first.installationId || event.episodeId !== first.episodeId))
|
|
78
|
+
ambiguous.add("mixed_scope");
|
|
79
|
+
if (event.parentSessionId === event.sessionId) ambiguous.add("lineage_mismatch");
|
|
80
|
+
const previous = byId.get(event.eventId);
|
|
81
|
+
if (previous && previous.contentHash !== event.contentHash) ambiguous.add("conflicting_event");
|
|
82
|
+
else byId.set(event.eventId, event);
|
|
83
|
+
}
|
|
84
|
+
const attempts = [...byId.values()].filter((event) => event.eventKind === "attempt");
|
|
85
|
+
const observations = /* @__PURE__ */ new Map();
|
|
86
|
+
const callOwners = /* @__PURE__ */ new Map();
|
|
87
|
+
if (!attempts.length) incomplete.add("missing_attempt");
|
|
88
|
+
for (const event of byId.values()) {
|
|
89
|
+
if (event.eventKind !== "observation") continue;
|
|
90
|
+
const attempt = byId.get(event.payload.attempt.id);
|
|
91
|
+
if (!attempt) incomplete.add("missing_attempt");
|
|
92
|
+
else if (attempt.eventKind !== "attempt" || attempt.contentHash !== event.payload.attempt.contentHash || attempt.payload.actionHash !== event.payload.actionHash) ambiguous.add("reference_mismatch");
|
|
93
|
+
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");
|
|
94
|
+
const values = observations.get(event.payload.attempt.id) ?? [];
|
|
95
|
+
values.push(event);
|
|
96
|
+
observations.set(event.payload.attempt.id, values);
|
|
97
|
+
}
|
|
98
|
+
const grouped = /* @__PURE__ */ new Map();
|
|
99
|
+
for (const attempt of attempts) {
|
|
100
|
+
const callKey = JSON.stringify([attempt.sessionId, attempt.callId]);
|
|
101
|
+
const previousCall = callOwners.get(callKey);
|
|
102
|
+
if (previousCall && previousCall !== attempt.contentHash) ambiguous.add("lineage_mismatch");
|
|
103
|
+
callOwners.set(callKey, attempt.contentHash);
|
|
104
|
+
const values = observations.get(attempt.eventId) ?? [];
|
|
105
|
+
if (!values.length) incomplete.add("missing_observation");
|
|
106
|
+
else {
|
|
107
|
+
const terminal = values.filter((event) => event.payload.outcome !== "incomplete");
|
|
108
|
+
if (!terminal.length) incomplete.add("completion_not_observed");
|
|
109
|
+
if (new Set(terminal.map((event) => contentHash(event.payload))).size > 1)
|
|
110
|
+
ambiguous.add("conflicting_observations");
|
|
111
|
+
}
|
|
112
|
+
const { environment, tool } = attempt.payload;
|
|
113
|
+
const key = contentHash([environment.application, environment.version, tool.name, tool.version, tool.server]);
|
|
114
|
+
const group = grouped.get(key) ?? {
|
|
115
|
+
application: environment.application,
|
|
116
|
+
applicationVersion: environment.version,
|
|
117
|
+
tool,
|
|
118
|
+
fingerprints: /* @__PURE__ */ new Set(),
|
|
119
|
+
attempts: []
|
|
120
|
+
};
|
|
121
|
+
group.fingerprints.add(environment.fingerprint);
|
|
122
|
+
group.attempts.push({ id: attempt.eventId, contentHash: attempt.contentHash });
|
|
123
|
+
grouped.set(key, group);
|
|
124
|
+
}
|
|
125
|
+
return ToolLearningEpisodeAssemblySchema.parse({
|
|
126
|
+
state: ambiguous.size ? "ambiguous" : incomplete.size ? "incomplete" : "awaiting_owner_review",
|
|
127
|
+
issues: [.../* @__PURE__ */ new Set([...ambiguous, ...incomplete])].sort(),
|
|
128
|
+
groups: [...grouped].sort(([a], [b]) => a.localeCompare(b)).map(([key, group]) => ({
|
|
129
|
+
key,
|
|
130
|
+
application: group.application,
|
|
131
|
+
applicationVersion: group.applicationVersion,
|
|
132
|
+
tool: group.tool,
|
|
133
|
+
environmentFingerprints: [...group.fingerprints].sort(),
|
|
134
|
+
attempts: group.attempts.sort((a, b) => a.id.localeCompare(b.id))
|
|
135
|
+
}))
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// src/tool-learning-client.ts
|
|
37
140
|
var ToolLearningRegistrationRequestSchema = boundedToolLearningSchema(
|
|
38
|
-
|
|
141
|
+
z2.object({
|
|
39
142
|
registration: ToolLearningRegistrationSchema,
|
|
40
|
-
credential:
|
|
143
|
+
credential: z2.object({ apiKey: LearningSourceCredentialSecretSchema, expiresAt: z2.iso.datetime() }).strict()
|
|
41
144
|
}).strict(),
|
|
42
|
-
|
|
145
|
+
TOOL_LEARNING_LIMITS2.eventBytes
|
|
43
146
|
);
|
|
44
147
|
var ToolLearningProjectionRequestSchema = boundedToolLearningSchema(
|
|
45
|
-
|
|
148
|
+
z2.object({
|
|
46
149
|
operationId: ToolLearningIdSchema,
|
|
47
|
-
expectedRevision:
|
|
150
|
+
expectedRevision: z2.number().int().positive(),
|
|
48
151
|
episodeId: ToolLearningIdSchema,
|
|
49
|
-
failure:
|
|
50
|
-
recovery:
|
|
152
|
+
failure: ToolLearningRefSchema2,
|
|
153
|
+
recovery: ToolLearningRefSchema2,
|
|
51
154
|
taskDefinition: LearningRevisionRefSchema,
|
|
52
155
|
familyKey: ToolLearningIdSchema,
|
|
53
|
-
split:
|
|
156
|
+
split: z2.literal("train"),
|
|
54
157
|
proposedTarget: ToolLearningDecisionSchema,
|
|
55
|
-
saveToPrivateDataset:
|
|
56
|
-
targetApproval:
|
|
158
|
+
saveToPrivateDataset: z2.literal(true),
|
|
159
|
+
targetApproval: z2.literal("pending_owner_review")
|
|
57
160
|
}).strict(),
|
|
58
|
-
|
|
161
|
+
TOOL_LEARNING_LIMITS2.eventBytes
|
|
59
162
|
);
|
|
60
163
|
var ToolLearningProjectionReceiptSchema = boundedToolLearningSchema(
|
|
61
|
-
|
|
164
|
+
z2.object({
|
|
62
165
|
installationId: ToolLearningIdSchema,
|
|
63
166
|
projectId: ToolLearningIdSchema,
|
|
64
167
|
operationId: ToolLearningIdSchema,
|
|
65
168
|
source: LearningRevisionRefSchema,
|
|
66
169
|
evidence: LearningRevisionRefSchema,
|
|
67
|
-
originHash:
|
|
68
|
-
requestHash:
|
|
69
|
-
projectedAt:
|
|
70
|
-
targetApproval:
|
|
71
|
-
learningEnrollment:
|
|
170
|
+
originHash: z2.string().regex(/^[a-f0-9]{64}$/),
|
|
171
|
+
requestHash: z2.string().regex(/^[a-f0-9]{64}$/),
|
|
172
|
+
projectedAt: z2.iso.datetime(),
|
|
173
|
+
targetApproval: z2.literal("pending_owner_review"),
|
|
174
|
+
learningEnrollment: z2.literal(false)
|
|
72
175
|
}).strict(),
|
|
73
|
-
|
|
176
|
+
TOOL_LEARNING_LIMITS2.eventBytes
|
|
74
177
|
);
|
|
75
178
|
var ToolLearningRoutingRequestSchema = boundedToolLearningSchema(
|
|
76
|
-
|
|
179
|
+
z2.object({
|
|
77
180
|
operationId: ToolLearningIdSchema,
|
|
78
|
-
expectedRevision:
|
|
79
|
-
state:
|
|
181
|
+
expectedRevision: z2.number().int().nonnegative(),
|
|
182
|
+
state: z2.enum(["enabled", "disabled"]),
|
|
80
183
|
modelId: ToolLearningIdSchema,
|
|
81
|
-
qualification:
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
kind:
|
|
184
|
+
qualification: z2.discriminatedUnion("kind", [
|
|
185
|
+
z2.object({ kind: z2.literal("integration"), evaluationRunId: ToolLearningIdSchema }).strict(),
|
|
186
|
+
z2.object({
|
|
187
|
+
kind: z2.literal("learned"),
|
|
85
188
|
evaluationRunId: ToolLearningIdSchema,
|
|
86
189
|
baselineRunId: ToolLearningIdSchema,
|
|
87
190
|
trainingRunId: ToolLearningIdSchema
|
|
88
191
|
}).strict()
|
|
89
192
|
]),
|
|
90
|
-
capabilities:
|
|
91
|
-
limits:
|
|
92
|
-
maxOutputTokens:
|
|
93
|
-
maximumCallUsd:
|
|
94
|
-
maximumDayUsd:
|
|
95
|
-
maximumSessionCalls:
|
|
96
|
-
maximumDayCalls:
|
|
193
|
+
capabilities: z2.array(ToolLearningCapabilitySchema.omit({ qualification: true })).min(1).max(16),
|
|
194
|
+
limits: z2.object({
|
|
195
|
+
maxOutputTokens: z2.number().int().min(128).max(2048),
|
|
196
|
+
maximumCallUsd: z2.number().positive().max(1),
|
|
197
|
+
maximumDayUsd: z2.number().positive().max(10),
|
|
198
|
+
maximumSessionCalls: z2.number().int().min(1).max(20),
|
|
199
|
+
maximumDayCalls: z2.number().int().min(1).max(200)
|
|
97
200
|
}).strict()
|
|
98
201
|
}).strict(),
|
|
99
|
-
|
|
202
|
+
TOOL_LEARNING_LIMITS2.eventBytes
|
|
100
203
|
);
|
|
101
204
|
var ToolLearningRoutingSchema = boundedToolLearningSchema(
|
|
102
|
-
|
|
205
|
+
z2.object({
|
|
103
206
|
installationId: ToolLearningIdSchema,
|
|
104
|
-
scope:
|
|
105
|
-
revision:
|
|
207
|
+
scope: z2.object({ teamId: ToolLearningIdSchema, projectId: ToolLearningIdSchema }).strict(),
|
|
208
|
+
revision: z2.number().int().positive(),
|
|
106
209
|
operationId: ToolLearningIdSchema,
|
|
107
|
-
requestHash:
|
|
210
|
+
requestHash: z2.string().regex(/^[a-f0-9]{64}$/),
|
|
108
211
|
configuration: ToolLearningRoutingRequestSchema,
|
|
109
|
-
modelRelease:
|
|
110
|
-
policySystemPrompt:
|
|
111
|
-
capabilities:
|
|
112
|
-
updatedAt:
|
|
212
|
+
modelRelease: ToolLearningRefSchema2,
|
|
213
|
+
policySystemPrompt: z2.string().min(1).max(16384),
|
|
214
|
+
capabilities: z2.array(ToolLearningCapabilitySchema).max(16),
|
|
215
|
+
updatedAt: z2.iso.datetime()
|
|
113
216
|
}).strict(),
|
|
114
|
-
|
|
217
|
+
TOOL_LEARNING_LIMITS2.eventBytes
|
|
115
218
|
);
|
|
116
219
|
function prepareToolLearningRegistration(registration, expiresAt) {
|
|
117
220
|
const prepared = createSourceCredentialRequest({
|
|
@@ -148,7 +251,7 @@ var OpenPondToolLearningClient = class {
|
|
|
148
251
|
const input = ToolLearningRegistrationRequestSchema.parse(value);
|
|
149
252
|
if (input.registration.projectId !== this.#options.projectId)
|
|
150
253
|
throw new Error("tool_learning_project_mismatch");
|
|
151
|
-
const result =
|
|
254
|
+
const result = z2.object({
|
|
152
255
|
installation: ToolLearningInstallationSchema,
|
|
153
256
|
apiKey: LearningSourceCredentialSecretSchema
|
|
154
257
|
}).strict().parse(await this.#request("installations", "POST", input, signal));
|
|
@@ -168,8 +271,8 @@ var OpenPondToolLearningClient = class {
|
|
|
168
271
|
return result;
|
|
169
272
|
}
|
|
170
273
|
async installations(after, signal) {
|
|
171
|
-
const result =
|
|
172
|
-
items:
|
|
274
|
+
const result = z2.object({
|
|
275
|
+
items: z2.array(ToolLearningInstallationSchema).max(30),
|
|
173
276
|
nextCursor: ToolLearningIdSchema.nullable()
|
|
174
277
|
}).strict().parse(
|
|
175
278
|
await this.#request(
|
|
@@ -185,18 +288,18 @@ var OpenPondToolLearningClient = class {
|
|
|
185
288
|
return result;
|
|
186
289
|
}
|
|
187
290
|
async episodes(installationId, after, signal) {
|
|
188
|
-
const result =
|
|
291
|
+
const result = z2.object({
|
|
189
292
|
installationId: ToolLearningIdSchema,
|
|
190
|
-
scope:
|
|
191
|
-
items:
|
|
192
|
-
|
|
293
|
+
scope: z2.object({ teamId: ToolLearningIdSchema, projectId: ToolLearningIdSchema }).strict(),
|
|
294
|
+
items: z2.array(
|
|
295
|
+
z2.object({
|
|
193
296
|
episodeId: ToolLearningIdSchema,
|
|
194
|
-
eventCount:
|
|
195
|
-
lastReceivedAt:
|
|
297
|
+
eventCount: z2.number().int().positive(),
|
|
298
|
+
lastReceivedAt: z2.iso.datetime()
|
|
196
299
|
}).strict()
|
|
197
300
|
).max(30),
|
|
198
301
|
nextCursor: ToolLearningIdSchema.nullable(),
|
|
199
|
-
learningEnrollment:
|
|
302
|
+
learningEnrollment: z2.literal(false)
|
|
200
303
|
}).strict().parse(
|
|
201
304
|
await this.#request(
|
|
202
305
|
`installations/${encodeURIComponent(installationId)}/episodes${after ? `?after=${encodeURIComponent(after)}` : ""}`,
|
|
@@ -210,14 +313,15 @@ var OpenPondToolLearningClient = class {
|
|
|
210
313
|
return result;
|
|
211
314
|
}
|
|
212
315
|
async episode(installationId, episodeId, signal) {
|
|
213
|
-
const result =
|
|
316
|
+
const result = z2.object({
|
|
214
317
|
installationId: ToolLearningIdSchema,
|
|
215
318
|
episodeId: ToolLearningIdSchema,
|
|
216
|
-
scope:
|
|
217
|
-
events:
|
|
218
|
-
state:
|
|
219
|
-
|
|
220
|
-
|
|
319
|
+
scope: z2.object({ teamId: ToolLearningIdSchema, projectId: ToolLearningIdSchema }).strict(),
|
|
320
|
+
events: z2.array(ToolEpisodeEventSchema2).max(TOOL_LEARNING_LIMITS2.eventsPerEpisode),
|
|
321
|
+
state: ToolLearningEpisodeAssemblySchema.shape.state,
|
|
322
|
+
assembly: ToolLearningEpisodeAssemblySchema,
|
|
323
|
+
verificationAuthority: z2.literal("not_granted"),
|
|
324
|
+
learningEnrollment: z2.literal(false)
|
|
221
325
|
}).strict().parse(
|
|
222
326
|
await this.#request(
|
|
223
327
|
`installations/${encodeURIComponent(installationId)}/episodes/${encodeURIComponent(episodeId)}`,
|
|
@@ -230,15 +334,17 @@ var OpenPondToolLearningClient = class {
|
|
|
230
334
|
(event) => event.installationId !== installationId || event.episodeId !== episodeId
|
|
231
335
|
))
|
|
232
336
|
throw new Error("tool_learning_episode_scope_mismatch");
|
|
337
|
+
if (result.state !== result.assembly.state || contentHash(assembleToolLearningEpisode(result.events)) !== contentHash(result.assembly))
|
|
338
|
+
throw new Error("tool_learning_episode_assembly_mismatch");
|
|
233
339
|
return result;
|
|
234
340
|
}
|
|
235
341
|
async purge(installationId, input, signal) {
|
|
236
|
-
const request =
|
|
237
|
-
const result =
|
|
342
|
+
const request = z2.object({ operationId: ToolLearningIdSchema, expectedRevision: z2.number().int().positive() }).strict().parse(input);
|
|
343
|
+
const result = z2.object({
|
|
238
344
|
installationId: ToolLearningIdSchema,
|
|
239
345
|
operationId: ToolLearningIdSchema,
|
|
240
|
-
purgedEvents:
|
|
241
|
-
learningEnrollment:
|
|
346
|
+
purgedEvents: z2.number().int().nonnegative(),
|
|
347
|
+
learningEnrollment: z2.literal(false)
|
|
242
348
|
}).strict().parse(
|
|
243
349
|
await this.#request(
|
|
244
350
|
`installations/${encodeURIComponent(installationId)}/purge`,
|
|
@@ -366,7 +472,7 @@ var OpenPondToolLearningClient = class {
|
|
|
366
472
|
if (body !== void 0)
|
|
367
473
|
assertBoundedTaskJson(
|
|
368
474
|
body,
|
|
369
|
-
|
|
475
|
+
TOOL_LEARNING_LIMITS2.eventBytes * TOOL_LEARNING_LIMITS2.eventsPerAppend
|
|
370
476
|
);
|
|
371
477
|
const timeout = AbortSignal.timeout(3e4);
|
|
372
478
|
const response = await (this.#options.fetch ?? globalThis.fetch)(
|
|
@@ -386,12 +492,12 @@ var OpenPondToolLearningClient = class {
|
|
|
386
492
|
);
|
|
387
493
|
const value = await readBoundedJsonResponse(
|
|
388
494
|
response,
|
|
389
|
-
|
|
495
|
+
TOOL_LEARNING_LIMITS2.eventBytes * TOOL_LEARNING_LIMITS2.eventsPerAppend,
|
|
390
496
|
"Tool learning response"
|
|
391
497
|
);
|
|
392
498
|
if (!response.ok) {
|
|
393
|
-
const error =
|
|
394
|
-
code:
|
|
499
|
+
const error = z2.object({
|
|
500
|
+
code: z2.string().regex(/^[a-z0-9_]+$/).max(200)
|
|
395
501
|
}).passthrough().safeParse(value);
|
|
396
502
|
throw new OpenPondToolLearningError(
|
|
397
503
|
response.status,
|
|
@@ -404,11 +510,13 @@ var OpenPondToolLearningClient = class {
|
|
|
404
510
|
export {
|
|
405
511
|
OpenPondToolLearningClient,
|
|
406
512
|
OpenPondToolLearningError,
|
|
513
|
+
ToolLearningEpisodeAssemblySchema,
|
|
407
514
|
ToolLearningProjectionReceiptSchema,
|
|
408
515
|
ToolLearningProjectionRequestSchema,
|
|
409
516
|
ToolLearningRegistrationRequestSchema,
|
|
410
517
|
ToolLearningRoutingRequestSchema,
|
|
411
518
|
ToolLearningRoutingSchema,
|
|
519
|
+
assembleToolLearningEpisode,
|
|
412
520
|
prepareToolLearningRegistration
|
|
413
521
|
};
|
|
414
522
|
//# 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,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I,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"]}
|
|
1
|
+
{"version":3,"sources":["../src/tool-learning.ts","../src/tool-learning-client.ts","../src/tool-learning-episodes.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\";\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\";\nimport { assembleToolLearningEpisode, ToolLearningEpisodeAssemblySchema } from \"./tool-learning-episodes.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: ToolLearningEpisodeAssemblySchema.shape.state,\n assembly: ToolLearningEpisodeAssemblySchema,\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 if (result.state !== result.assembly.state ||\n contentHash(assembleToolLearningEpisode(result.events)) !== contentHash(result.assembly))\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 = 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","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"],"mappings":";;;;;;;;;;;;;AACA,cAAc;;;ACDd,SAAS,KAAAA,UAAS;AAElB,SAAS,iCAAiC;AAC1C;AAAA,EACE,wBAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,0BAAAC;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;;;AC3BtC,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;AAAA,IAC1C;AAAA,IAA4B;AAAA,IAAsB;AAAA,IAClD;AAAA,IAAe;AAAA,EACjB,CAAC,CAAC,EAAE,IAAI,CAAC;AAAA,EACT,QAAQ,EAAE,MAAM,EAAE,OAAO;AAAA,IACvB,KAAK;AAAA,IACL,aAAa,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAAA,IACtC,oBAAoB,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAAA,IAC7C,MAAM,EAAE,OAAO;AAAA,MACb,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAAA,MAC/B,SAAS,EAAE,OA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aA,sBAAqB;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,MACAA,sBAAqB,aAAaA,sBAAqB;AAAA,MACvD;AAAA,IACF;AACA,QAAI,CAAC,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","ToolEpisodeEventSchema","ToolLearningRefSchema","z","TOOL_LEARNING_LIMITS","ToolLearningRefSchema","ToolEpisodeEventSchema","value"]}
|
|
@@ -776,7 +776,26 @@ export declare class OpenPondToolLearningClient {
|
|
|
776
776
|
reason: string;
|
|
777
777
|
};
|
|
778
778
|
})[];
|
|
779
|
-
state: "awaiting_owner_review" | "incomplete";
|
|
779
|
+
state: "ambiguous" | "awaiting_owner_review" | "incomplete";
|
|
780
|
+
assembly: {
|
|
781
|
+
state: "ambiguous" | "awaiting_owner_review" | "incomplete";
|
|
782
|
+
issues: ("completion_not_observed" | "conflicting_event" | "conflicting_observations" | "lineage_mismatch" | "missing_attempt" | "missing_observation" | "mixed_scope" | "reference_mismatch")[];
|
|
783
|
+
groups: {
|
|
784
|
+
key: string;
|
|
785
|
+
application: string;
|
|
786
|
+
applicationVersion: string;
|
|
787
|
+
tool: {
|
|
788
|
+
name: string;
|
|
789
|
+
version: string | null;
|
|
790
|
+
server: string | null;
|
|
791
|
+
};
|
|
792
|
+
environmentFingerprints: string[];
|
|
793
|
+
attempts: {
|
|
794
|
+
id: string;
|
|
795
|
+
contentHash: string;
|
|
796
|
+
}[];
|
|
797
|
+
}[];
|
|
798
|
+
};
|
|
780
799
|
verificationAuthority: "not_granted";
|
|
781
800
|
learningEnrollment: false;
|
|
782
801
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-learning-client.d.ts","sourceRoot":"","sources":["../../../../../src/tool-learning-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EASL,oCAAoC,EAOpC,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,EACtB,KAAK,+BAA+B,EACrC,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"tool-learning-client.d.ts","sourceRoot":"","sources":["../../../../../src/tool-learning-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EASL,oCAAoC,EAOpC,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,EACtB,KAAK,+BAA+B,EACrC,MAAM,+BAA+B,CAAC;AASvC;yEACyE;AACzE,eAAO,MAAM,qCAAqC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAUjD,CAAC;AAEF,eAAO,MAAM,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AM,CAAC,EAAE,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OASrB;IAEK,MAAM,CAAC,KAAK,EAAE,iBAAiB,EAAE,MAAM,CAAC,EAAE,WAAW;;;;;;;;;;;;;;;;OAqB1D;IAEK,OAAO,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAUzD;IAEK,gBAAgB,CACpB,cAAc,EAAE,MAAM,EACtB,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,EACvD,MAAM,CAAC,EAAE,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmBrB;IAaK,QAAQ,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqB1D;IAEK,OAAO,CAAC,KAAK,EAAE,+BAA+B,EAAE,MAAM,CAAC,EAAE,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAWzE;IAEK,YAAY,CAAC,KAAK,EAAE,+BAA+B,EAAE,MAAM,CAAC,EAAE,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgB9E;CA4DF"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type ToolEpisodeEvent } from "@openpond/evals/tool-learning";
|
|
3
|
+
export declare const ToolLearningEpisodeAssemblySchema: z.ZodObject<{
|
|
4
|
+
state: z.ZodEnum<{
|
|
5
|
+
ambiguous: "ambiguous";
|
|
6
|
+
awaiting_owner_review: "awaiting_owner_review";
|
|
7
|
+
incomplete: "incomplete";
|
|
8
|
+
}>;
|
|
9
|
+
issues: z.ZodArray<z.ZodEnum<{
|
|
10
|
+
completion_not_observed: "completion_not_observed";
|
|
11
|
+
conflicting_event: "conflicting_event";
|
|
12
|
+
conflicting_observations: "conflicting_observations";
|
|
13
|
+
lineage_mismatch: "lineage_mismatch";
|
|
14
|
+
missing_attempt: "missing_attempt";
|
|
15
|
+
missing_observation: "missing_observation";
|
|
16
|
+
mixed_scope: "mixed_scope";
|
|
17
|
+
reference_mismatch: "reference_mismatch";
|
|
18
|
+
}>>;
|
|
19
|
+
groups: z.ZodArray<z.ZodObject<{
|
|
20
|
+
key: z.ZodString;
|
|
21
|
+
application: z.ZodString;
|
|
22
|
+
applicationVersion: z.ZodString;
|
|
23
|
+
tool: z.ZodObject<{
|
|
24
|
+
name: z.ZodString;
|
|
25
|
+
version: z.ZodNullable<z.ZodString>;
|
|
26
|
+
server: z.ZodNullable<z.ZodString>;
|
|
27
|
+
}, z.core.$strict>;
|
|
28
|
+
environmentFingerprints: z.ZodArray<z.ZodString>;
|
|
29
|
+
attempts: z.ZodArray<z.ZodObject<{
|
|
30
|
+
id: z.ZodString;
|
|
31
|
+
contentHash: z.ZodString;
|
|
32
|
+
}, z.core.$strict>>;
|
|
33
|
+
}, z.core.$strict>>;
|
|
34
|
+
}, z.core.$strict>;
|
|
35
|
+
/** Structural assembly of retained calls, never recovery verification or label
|
|
36
|
+
* approval. Conflicting observations remain visible instead of selecting the
|
|
37
|
+
* most recently received answer. Recovery/verifier claims retain their separate
|
|
38
|
+
* owner authority and are not promoted by this read projection. */
|
|
39
|
+
export declare function assembleToolLearningEpisode(raw: readonly ToolEpisodeEvent[]): {
|
|
40
|
+
state: "ambiguous" | "awaiting_owner_review" | "incomplete";
|
|
41
|
+
issues: ("completion_not_observed" | "conflicting_event" | "conflicting_observations" | "lineage_mismatch" | "missing_attempt" | "missing_observation" | "mixed_scope" | "reference_mismatch")[];
|
|
42
|
+
groups: {
|
|
43
|
+
key: string;
|
|
44
|
+
application: string;
|
|
45
|
+
applicationVersion: string;
|
|
46
|
+
tool: {
|
|
47
|
+
name: string;
|
|
48
|
+
version: string | null;
|
|
49
|
+
server: string | null;
|
|
50
|
+
};
|
|
51
|
+
environmentFingerprints: string[];
|
|
52
|
+
attempts: {
|
|
53
|
+
id: string;
|
|
54
|
+
contentHash: string;
|
|
55
|
+
}[];
|
|
56
|
+
}[];
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=tool-learning-episodes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-learning-episodes.d.ts","sourceRoot":"","sources":["../../../../../src/tool-learning-episodes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAKL,KAAK,gBAAgB,EACtB,MAAM,+BAA+B,CAAC;AAEvC,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAmBnC,CAAC;AAMZ;;;mEAGmE;AACnE,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,SAAS,gBAAgB,EAAE;;;;;;;;;;;;;;;;;;EAmE3E"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** Portable episode and recovery-consultation protocol; no installation side effects. */
|
|
2
2
|
export * from "@openpond/evals/tool-learning";
|
|
3
3
|
export * from "./tool-learning-client.js";
|
|
4
|
+
export * from "./tool-learning-episodes.js";
|
|
4
5
|
//# sourceMappingURL=tool-learning.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-learning.d.ts","sourceRoot":"","sources":["../../../../../src/tool-learning.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC"}
|
|
1
|
+
{"version":3,"file":"tool-learning.d.ts","sourceRoot":"","sources":["../../../../../src/tool-learning.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC"}
|
|
@@ -50,26 +50,6 @@ export declare function materializeLearningBatchTaskset(input: {
|
|
|
50
50
|
} | null;
|
|
51
51
|
status: "archived" | "awaiting_disclosure_approval" | "awaiting_materialization_approval" | "baselining" | "blocked" | "draft" | "failed" | "materializing" | "needs_review" | "ready" | "validating";
|
|
52
52
|
sourceRefs: ({
|
|
53
|
-
schemaVersion: "openpond.connectedDatasetSource.v1";
|
|
54
|
-
kind: "connected_activity";
|
|
55
|
-
id: string;
|
|
56
|
-
profileId: string;
|
|
57
|
-
title: string;
|
|
58
|
-
sourceHash: string;
|
|
59
|
-
occurredAt: string;
|
|
60
|
-
licensingStatus: "approved" | "blocked" | "pending" | "review";
|
|
61
|
-
secretScanStatus: "blocked" | "passed" | "pending";
|
|
62
|
-
piiScanStatus: "blocked" | "passed" | "pending" | "review";
|
|
63
|
-
origin: "claude_code" | "codex" | "grok_build" | "hermes" | "native_chat" | "native_work" | "oh_my_pi" | "openclaw" | "opencode" | "pi";
|
|
64
|
-
sourceId: string;
|
|
65
|
-
sessionId: string;
|
|
66
|
-
normalizerVersion: string;
|
|
67
|
-
projection: "conversation" | "turn";
|
|
68
|
-
ownerUserId: string;
|
|
69
|
-
purpose: "recorded_evaluation";
|
|
70
|
-
sourceFileHashes?: string[] | undefined;
|
|
71
|
-
metadata: Record<string, unknown>;
|
|
72
|
-
} | {
|
|
73
53
|
id: string;
|
|
74
54
|
profileId: string;
|
|
75
55
|
title: string;
|
|
@@ -169,6 +149,26 @@ export declare function materializeLearningBatchTaskset(input: {
|
|
|
169
149
|
piiScanStatus: "blocked" | "passed" | "pending" | "review";
|
|
170
150
|
licensingStatus: "approved" | "blocked" | "pending" | "review";
|
|
171
151
|
metadata: Record<string, unknown>;
|
|
152
|
+
} | {
|
|
153
|
+
schemaVersion: "openpond.connectedDatasetSource.v1";
|
|
154
|
+
kind: "connected_activity";
|
|
155
|
+
id: string;
|
|
156
|
+
profileId: string;
|
|
157
|
+
title: string;
|
|
158
|
+
sourceHash: string;
|
|
159
|
+
occurredAt: string;
|
|
160
|
+
licensingStatus: "approved" | "blocked" | "pending" | "review";
|
|
161
|
+
secretScanStatus: "blocked" | "passed" | "pending";
|
|
162
|
+
piiScanStatus: "blocked" | "passed" | "pending" | "review";
|
|
163
|
+
origin: "claude_code" | "codex" | "grok_build" | "hermes" | "native_chat" | "native_work" | "oh_my_pi" | "openclaw" | "opencode" | "pi";
|
|
164
|
+
sourceId: string;
|
|
165
|
+
sessionId: string;
|
|
166
|
+
normalizerVersion: string;
|
|
167
|
+
projection: "conversation" | "turn";
|
|
168
|
+
ownerUserId: string;
|
|
169
|
+
purpose: "recorded_evaluation";
|
|
170
|
+
sourceFileHashes?: string[] | undefined;
|
|
171
|
+
metadata: Record<string, unknown>;
|
|
172
172
|
})[];
|
|
173
173
|
datasetArtifact?: {
|
|
174
174
|
schemaVersion: "openpond.datasetArtifact.v1";
|
|
@@ -941,26 +941,6 @@ export declare function prepareReviewedLearningBatch(input: Omit<Parameters<type
|
|
|
941
941
|
} | null;
|
|
942
942
|
status: "archived" | "awaiting_disclosure_approval" | "awaiting_materialization_approval" | "baselining" | "blocked" | "draft" | "failed" | "materializing" | "needs_review" | "ready" | "validating";
|
|
943
943
|
sourceRefs: ({
|
|
944
|
-
schemaVersion: "openpond.connectedDatasetSource.v1";
|
|
945
|
-
kind: "connected_activity";
|
|
946
|
-
id: string;
|
|
947
|
-
profileId: string;
|
|
948
|
-
title: string;
|
|
949
|
-
sourceHash: string;
|
|
950
|
-
occurredAt: string;
|
|
951
|
-
licensingStatus: "approved" | "blocked" | "pending" | "review";
|
|
952
|
-
secretScanStatus: "blocked" | "passed" | "pending";
|
|
953
|
-
piiScanStatus: "blocked" | "passed" | "pending" | "review";
|
|
954
|
-
origin: "claude_code" | "codex" | "grok_build" | "hermes" | "native_chat" | "native_work" | "oh_my_pi" | "openclaw" | "opencode" | "pi";
|
|
955
|
-
sourceId: string;
|
|
956
|
-
sessionId: string;
|
|
957
|
-
normalizerVersion: string;
|
|
958
|
-
projection: "conversation" | "turn";
|
|
959
|
-
ownerUserId: string;
|
|
960
|
-
purpose: "recorded_evaluation";
|
|
961
|
-
sourceFileHashes?: string[] | undefined;
|
|
962
|
-
metadata: Record<string, unknown>;
|
|
963
|
-
} | {
|
|
964
944
|
id: string;
|
|
965
945
|
profileId: string;
|
|
966
946
|
title: string;
|
|
@@ -1060,6 +1040,26 @@ export declare function prepareReviewedLearningBatch(input: Omit<Parameters<type
|
|
|
1060
1040
|
piiScanStatus: "blocked" | "passed" | "pending" | "review";
|
|
1061
1041
|
licensingStatus: "approved" | "blocked" | "pending" | "review";
|
|
1062
1042
|
metadata: Record<string, unknown>;
|
|
1043
|
+
} | {
|
|
1044
|
+
schemaVersion: "openpond.connectedDatasetSource.v1";
|
|
1045
|
+
kind: "connected_activity";
|
|
1046
|
+
id: string;
|
|
1047
|
+
profileId: string;
|
|
1048
|
+
title: string;
|
|
1049
|
+
sourceHash: string;
|
|
1050
|
+
occurredAt: string;
|
|
1051
|
+
licensingStatus: "approved" | "blocked" | "pending" | "review";
|
|
1052
|
+
secretScanStatus: "blocked" | "passed" | "pending";
|
|
1053
|
+
piiScanStatus: "blocked" | "passed" | "pending" | "review";
|
|
1054
|
+
origin: "claude_code" | "codex" | "grok_build" | "hermes" | "native_chat" | "native_work" | "oh_my_pi" | "openclaw" | "opencode" | "pi";
|
|
1055
|
+
sourceId: string;
|
|
1056
|
+
sessionId: string;
|
|
1057
|
+
normalizerVersion: string;
|
|
1058
|
+
projection: "conversation" | "turn";
|
|
1059
|
+
ownerUserId: string;
|
|
1060
|
+
purpose: "recorded_evaluation";
|
|
1061
|
+
sourceFileHashes?: string[] | undefined;
|
|
1062
|
+
metadata: Record<string, unknown>;
|
|
1063
1063
|
})[];
|
|
1064
1064
|
datasetArtifact?: {
|
|
1065
1065
|
schemaVersion: "openpond.datasetArtifact.v1";
|