openpond-sdk 0.0.12 → 0.0.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 (41) hide show
  1. package/README.md +28 -0
  2. package/dist/actions-local.js +34 -14551
  3. package/dist/actions-local.js.map +4 -4
  4. package/dist/actions.js +12 -14530
  5. package/dist/actions.js.map +4 -4
  6. package/dist/index.js +582 -29
  7. package/dist/index.js.map +4 -4
  8. package/dist/model-projects.js +215 -0
  9. package/dist/model-projects.js.map +7 -0
  10. package/dist/profile-actions.js +1 -20
  11. package/dist/profile-actions.js.map +3 -3
  12. package/dist/project-actions.js +1 -20
  13. package/dist/project-actions.js.map +3 -3
  14. package/dist/refiner.js +568 -0
  15. package/dist/refiner.js.map +7 -0
  16. package/dist/training.js +470 -0
  17. package/dist/training.js.map +7 -0
  18. package/dist/types/packages/cloud/src/api/core.d.ts.map +1 -1
  19. package/dist/types/packages/cloud/src/hosted-chat.d.ts +20 -0
  20. package/dist/types/packages/cloud/src/hosted-chat.d.ts.map +1 -1
  21. package/dist/types/packages/cloud/src/sandbox/client-handles.d.ts +2 -1
  22. package/dist/types/packages/cloud/src/sandbox/client-handles.d.ts.map +1 -1
  23. package/dist/types/packages/cloud/src/sandbox/client.d.ts +3 -1
  24. package/dist/types/packages/cloud/src/sandbox/client.d.ts.map +1 -1
  25. package/dist/types/packages/cloud/src/sandbox/types/org-project-agent.d.ts +13 -0
  26. package/dist/types/packages/cloud/src/sandbox/types/org-project-agent.d.ts.map +1 -1
  27. package/dist/types/packages/sdk/src/index.d.ts +1 -0
  28. package/dist/types/packages/sdk/src/index.d.ts.map +1 -1
  29. package/dist/types/packages/sdk/src/model-projects.d.ts +804 -0
  30. package/dist/types/packages/sdk/src/model-projects.d.ts.map +1 -0
  31. package/dist/types/packages/sdk/src/refiner.d.ts +6 -0
  32. package/dist/types/packages/sdk/src/refiner.d.ts.map +1 -0
  33. package/dist/types/packages/sdk/src/training.d.ts +682 -0
  34. package/dist/types/packages/sdk/src/training.d.ts.map +1 -0
  35. package/dist/types/packages/sdk/src/types.d.ts +1 -1
  36. package/dist/types/packages/sdk/src/types.d.ts.map +1 -1
  37. package/dist/workflows.js +1 -20
  38. package/dist/workflows.js.map +3 -3
  39. package/package.json +17 -3
  40. package/dist/types/packages/cloud/src/api/vercel-protection.d.ts +0 -2
  41. package/dist/types/packages/cloud/src/api/vercel-protection.d.ts.map +0 -1
@@ -0,0 +1,568 @@
1
+ // ../harness/dist/refiner.js
2
+ import { z as z3 } from "zod";
3
+
4
+ // ../harness/dist/common.js
5
+ import { z } from "zod";
6
+
7
+ // ../harness/dist/sha256.js
8
+ var INITIAL_STATE = new Uint32Array([
9
+ 1779033703,
10
+ 3144134277,
11
+ 1013904242,
12
+ 2773480762,
13
+ 1359893119,
14
+ 2600822924,
15
+ 528734635,
16
+ 1541459225
17
+ ]);
18
+ var ROUND_CONSTANTS = new Uint32Array([
19
+ 1116352408,
20
+ 1899447441,
21
+ 3049323471,
22
+ 3921009573,
23
+ 961987163,
24
+ 1508970993,
25
+ 2453635748,
26
+ 2870763221,
27
+ 3624381080,
28
+ 310598401,
29
+ 607225278,
30
+ 1426881987,
31
+ 1925078388,
32
+ 2162078206,
33
+ 2614888103,
34
+ 3248222580,
35
+ 3835390401,
36
+ 4022224774,
37
+ 264347078,
38
+ 604807628,
39
+ 770255983,
40
+ 1249150122,
41
+ 1555081692,
42
+ 1996064986,
43
+ 2554220882,
44
+ 2821834349,
45
+ 2952996808,
46
+ 3210313671,
47
+ 3336571891,
48
+ 3584528711,
49
+ 113926993,
50
+ 338241895,
51
+ 666307205,
52
+ 773529912,
53
+ 1294757372,
54
+ 1396182291,
55
+ 1695183700,
56
+ 1986661051,
57
+ 2177026350,
58
+ 2456956037,
59
+ 2730485921,
60
+ 2820302411,
61
+ 3259730800,
62
+ 3345764771,
63
+ 3516065817,
64
+ 3600352804,
65
+ 4094571909,
66
+ 275423344,
67
+ 430227734,
68
+ 506948616,
69
+ 659060556,
70
+ 883997877,
71
+ 958139571,
72
+ 1322822218,
73
+ 1537002063,
74
+ 1747873779,
75
+ 1955562222,
76
+ 2024104815,
77
+ 2227730452,
78
+ 2361852424,
79
+ 2428436474,
80
+ 2756734187,
81
+ 3204031479,
82
+ 3329325298
83
+ ]);
84
+ function sha256Hex(value) {
85
+ const bytes = typeof value === "string" ? new TextEncoder().encode(value) : value;
86
+ const paddedLength = Math.ceil((bytes.byteLength + 9) / 64) * 64;
87
+ const padded = new Uint8Array(paddedLength);
88
+ padded.set(bytes);
89
+ padded[bytes.byteLength] = 128;
90
+ const bitLength = bytes.byteLength * 8;
91
+ const view = new DataView(padded.buffer);
92
+ view.setUint32(paddedLength - 8, Math.floor(bitLength / 4294967296), false);
93
+ view.setUint32(paddedLength - 4, bitLength >>> 0, false);
94
+ const state = new Uint32Array(INITIAL_STATE);
95
+ const words = new Uint32Array(64);
96
+ for (let offset = 0; offset < paddedLength; offset += 64) {
97
+ for (let index = 0; index < 16; index += 1) {
98
+ words[index] = view.getUint32(offset + index * 4, false);
99
+ }
100
+ for (let index = 16; index < 64; index += 1) {
101
+ const previous = words[index - 15];
102
+ const recent = words[index - 2];
103
+ const sigma0 = rotateRight(previous, 7) ^ rotateRight(previous, 18) ^ previous >>> 3;
104
+ const sigma1 = rotateRight(recent, 17) ^ rotateRight(recent, 19) ^ recent >>> 10;
105
+ words[index] = words[index - 16] + sigma0 + words[index - 7] + sigma1 >>> 0;
106
+ }
107
+ let a = state[0];
108
+ let b = state[1];
109
+ let c = state[2];
110
+ let d = state[3];
111
+ let e = state[4];
112
+ let f = state[5];
113
+ let g = state[6];
114
+ let h = state[7];
115
+ for (let index = 0; index < 64; index += 1) {
116
+ const choice = e & f ^ ~e & g;
117
+ const majority = a & b ^ a & c ^ b & c;
118
+ const sum0 = rotateRight(a, 2) ^ rotateRight(a, 13) ^ rotateRight(a, 22);
119
+ const sum1 = rotateRight(e, 6) ^ rotateRight(e, 11) ^ rotateRight(e, 25);
120
+ const first = h + sum1 + choice + ROUND_CONSTANTS[index] + words[index] >>> 0;
121
+ const second = sum0 + majority >>> 0;
122
+ h = g;
123
+ g = f;
124
+ f = e;
125
+ e = d + first >>> 0;
126
+ d = c;
127
+ c = b;
128
+ b = a;
129
+ a = first + second >>> 0;
130
+ }
131
+ state[0] = state[0] + a >>> 0;
132
+ state[1] = state[1] + b >>> 0;
133
+ state[2] = state[2] + c >>> 0;
134
+ state[3] = state[3] + d >>> 0;
135
+ state[4] = state[4] + e >>> 0;
136
+ state[5] = state[5] + f >>> 0;
137
+ state[6] = state[6] + g >>> 0;
138
+ state[7] = state[7] + h >>> 0;
139
+ }
140
+ return Array.from(state, (word) => word.toString(16).padStart(8, "0")).join("");
141
+ }
142
+ function rotateRight(value, bits) {
143
+ return value >>> bits | value << 32 - bits;
144
+ }
145
+
146
+ // ../harness/dist/common.js
147
+ var MAX_PORTABLE_PATH_BYTES = 2e3;
148
+ var MAX_PORTABLE_ASSET_BYTES = 25e7;
149
+ var ReleaseIdSchema = z.string().trim().min(1).max(240);
150
+ var ReleaseHashSchema = z.string().regex(/^[a-f0-9]{64}$/);
151
+ var ReleaseTimestampSchema = z.string().datetime({ offset: true });
152
+ var MetadataSchema = z.record(z.string(), z.unknown()).default({});
153
+ var ImmutableReleaseRefSchema = z.object({
154
+ id: ReleaseIdSchema,
155
+ contentHash: ReleaseHashSchema
156
+ }).strict();
157
+ var ImmutableAssetRefSchema = z.object({
158
+ id: ReleaseIdSchema,
159
+ path: z.string().trim().min(1).max(MAX_PORTABLE_PATH_BYTES).refine(safeRelativePath),
160
+ contentHash: ReleaseHashSchema,
161
+ sizeBytes: z.number().int().nonnegative().max(MAX_PORTABLE_ASSET_BYTES),
162
+ mediaType: z.string().trim().min(1).max(200),
163
+ visibility: z.enum(["policy", "verifier", "host_private"])
164
+ }).strict();
165
+ var ImmutableArtifactRefSchema = z.object({
166
+ id: ReleaseIdSchema,
167
+ contentHash: ReleaseHashSchema,
168
+ mediaType: z.string().trim().min(1).max(200).nullable().default(null),
169
+ sizeBytes: z.number().int().nonnegative().max(MAX_PORTABLE_ASSET_BYTES).nullable().default(null)
170
+ }).strict();
171
+ var FailureClassSchema = z.enum([
172
+ "policy_failure",
173
+ "grader_failure",
174
+ "environment_failure",
175
+ "infrastructure_failure",
176
+ "timeout",
177
+ "cancelled"
178
+ ]);
179
+ function canonicalJson(value) {
180
+ return `${JSON.stringify(sortValue(value), null, 2)}
181
+ `;
182
+ }
183
+ function sha256(value) {
184
+ return sha256Hex(value);
185
+ }
186
+ function contentHash(value) {
187
+ return sha256(canonicalJson(value));
188
+ }
189
+ function safeRelativePath(value) {
190
+ const normalized = value.replaceAll("\\", "/");
191
+ if (!normalized || normalized.startsWith("/") || normalized.includes("\0"))
192
+ return false;
193
+ return !normalized.split("/").some((part) => !part || part === "." || part === "..");
194
+ }
195
+ function sortValue(value) {
196
+ if (Array.isArray(value))
197
+ return value.map(sortValue);
198
+ if (!value || typeof value !== "object")
199
+ return value;
200
+ return Object.fromEntries(Object.entries(value).sort(([left], [right]) => left.localeCompare(right)).map(([key, child]) => [key, sortValue(child)]));
201
+ }
202
+
203
+ // ../harness/dist/refiner-profiles.js
204
+ import { z as z2 } from "zod";
205
+ var RefinerProposalRouteSchema = z2.enum(["memory", "prompt", "skill", "agent"]);
206
+ var RefinerExternalRouteSchema = z2.enum(["runtime", "product", "taskset", "training"]);
207
+ var RefinerReviewInstructionSchema = z2.object({
208
+ id: z2.string().trim().min(1).max(120).regex(/^[a-z0-9][a-z0-9._-]*$/),
209
+ text: z2.string().trim().min(1).max(1e4)
210
+ }).strict();
211
+ var RefinerReviewProfileSchema = z2.object({
212
+ schemaVersion: z2.literal("openpond.refinerReviewProfile.v1"),
213
+ id: z2.string().trim().min(1).max(120).regex(/^[a-z0-9][a-z0-9._-]*$/),
214
+ version: z2.string().trim().min(1).max(120),
215
+ name: z2.string().trim().min(1).max(200),
216
+ objective: z2.string().trim().min(1).max(1e4),
217
+ instructions: z2.array(RefinerReviewInstructionSchema).max(100),
218
+ allowedProposalRoutes: z2.array(RefinerProposalRouteSchema).max(4),
219
+ allowedExternalRoutes: z2.array(RefinerExternalRouteSchema).max(4)
220
+ }).strict().superRefine((profile, context) => {
221
+ const instructionIds = profile.instructions.map((instruction) => instruction.id);
222
+ if (new Set(instructionIds).size !== instructionIds.length) {
223
+ context.addIssue({ code: "custom", message: "instruction IDs must be unique", path: ["instructions"] });
224
+ }
225
+ if (new Set(profile.allowedProposalRoutes).size !== profile.allowedProposalRoutes.length) {
226
+ context.addIssue({ code: "custom", message: "proposal routes must be unique", path: ["allowedProposalRoutes"] });
227
+ }
228
+ if (new Set(profile.allowedExternalRoutes).size !== profile.allowedExternalRoutes.length) {
229
+ context.addIssue({ code: "custom", message: "external routes must be unique", path: ["allowedExternalRoutes"] });
230
+ }
231
+ });
232
+ var DEFAULT_REFINER_REVIEW_PROFILE = {
233
+ schemaVersion: "openpond.refinerReviewProfile.v1",
234
+ id: "openpond.default",
235
+ version: "1",
236
+ name: "OpenPond default review",
237
+ objective: "Find the smallest reusable change that improves future work without learning task-specific facts.",
238
+ instructions: [],
239
+ allowedProposalRoutes: ["memory", "prompt", "skill", "agent"],
240
+ allowedExternalRoutes: ["runtime", "product", "taskset", "training"]
241
+ };
242
+ var RefinerReleaseSchema = z2.object({
243
+ schemaVersion: z2.literal("openpond.refinerRelease.v1"),
244
+ id: z2.string().trim().min(1).max(240),
245
+ coreVersion: z2.string().trim().min(1).max(120),
246
+ coreHash: ReleaseHashSchema,
247
+ profile: RefinerReviewProfileSchema,
248
+ profileHash: ReleaseHashSchema,
249
+ composedPromptHash: ReleaseHashSchema,
250
+ createdAt: ReleaseTimestampSchema,
251
+ contentHash: ReleaseHashSchema
252
+ }).strict();
253
+ var RefinerBindingSchema = z2.object({
254
+ schemaVersion: z2.literal("openpond.refinerBinding.v1"),
255
+ channel: z2.literal("active"),
256
+ revision: z2.number().int().nonnegative(),
257
+ release: ImmutableReleaseRefSchema,
258
+ updatedAt: ReleaseTimestampSchema
259
+ }).strict();
260
+ var RefinerTransitionReceiptSchema = z2.object({
261
+ schemaVersion: z2.literal("openpond.refinerTransitionReceipt.v1"),
262
+ id: z2.string().trim().min(1).max(240),
263
+ operation: z2.enum(["initialize", "update", "activate", "rollback"]),
264
+ bindingChanged: z2.boolean(),
265
+ previousRelease: ImmutableReleaseRefSchema.nullable(),
266
+ nextRelease: ImmutableReleaseRefSchema,
267
+ actor: z2.string().trim().min(1).max(240),
268
+ reason: z2.string().trim().min(1).max(1e4),
269
+ authoringSkillHash: ReleaseHashSchema.nullable(),
270
+ validation: z2.object({ valid: z2.boolean(), messages: z2.array(z2.string().max(2e3)).max(100) }).strict(),
271
+ createdAt: ReleaseTimestampSchema,
272
+ contentHash: ReleaseHashSchema
273
+ }).strict();
274
+ function defineReviewProfile(profile) {
275
+ return RefinerReviewProfileSchema.parse(profile);
276
+ }
277
+ function createRefinerRelease(input) {
278
+ const profile = RefinerReviewProfileSchema.parse(input.profile);
279
+ const createdAt = input.createdAt ?? (/* @__PURE__ */ new Date()).toISOString();
280
+ const coreHash = contentHash({ coreVersion: input.coreVersion, corePrompt: input.corePrompt });
281
+ const profileHash = contentHash(profile);
282
+ const composedPromptHash = contentHash({ coreHash, profile });
283
+ const releaseWithoutHash = {
284
+ schemaVersion: "openpond.refinerRelease.v1",
285
+ id: `refiner-${composedPromptHash.slice(0, 24)}`,
286
+ coreVersion: input.coreVersion,
287
+ coreHash,
288
+ profile,
289
+ profileHash,
290
+ composedPromptHash,
291
+ createdAt
292
+ };
293
+ return RefinerReleaseSchema.parse({
294
+ ...releaseWithoutHash,
295
+ contentHash: contentHash(releaseWithoutHash)
296
+ });
297
+ }
298
+ function refinerProfilePrompt(profile) {
299
+ const parsed = RefinerReviewProfileSchema.parse(profile);
300
+ return [
301
+ `Review profile: ${parsed.name} (${parsed.id}@${parsed.version})`,
302
+ `Objective: ${parsed.objective}`,
303
+ `Allowed Harness proposal routes: ${parsed.allowedProposalRoutes.join(", ")}.`,
304
+ `Allowed external routes: ${parsed.allowedExternalRoutes.join(", ")}.`,
305
+ ...parsed.instructions.map((instruction) => `[${instruction.id}] ${instruction.text}`)
306
+ ].join("\n");
307
+ }
308
+ function serializeReviewProfile(profile) {
309
+ return canonicalJson(RefinerReviewProfileSchema.parse(profile));
310
+ }
311
+
312
+ // ../harness/dist/refiner.js
313
+ var RefinerNoActionDecisionSchema = z3.object({
314
+ schemaVersion: z3.literal("openpond.localHarnessRefinerDecision.v1"),
315
+ decision: z3.literal("no_action"),
316
+ reason: z3.string().trim().min(1).max(1e4)
317
+ }).strip();
318
+ var RefinerExternalRouteDecisionSchema = z3.object({
319
+ schemaVersion: z3.literal("openpond.localHarnessRefinerDecision.v1"),
320
+ decision: z3.literal("route"),
321
+ route: z3.enum(["runtime", "product", "taskset", "training"]),
322
+ summary: z3.string().trim().min(1).max(2e3),
323
+ expectedOutcome: z3.string().trim().min(1).max(1e4),
324
+ reason: z3.string().trim().min(1).max(1e4)
325
+ }).strip();
326
+ var RefinerProposalDecisionSchema = z3.object({
327
+ schemaVersion: z3.literal("openpond.localHarnessRefinerDecision.v1"),
328
+ decision: z3.literal("propose"),
329
+ route: z3.enum(["memory", "prompt", "skill", "agent"]),
330
+ operation: z3.enum(["create", "update", "delete"]),
331
+ target: z3.string().trim().min(1).max(2e3),
332
+ summary: z3.string().trim().min(1).max(2e3),
333
+ createContent: z3.string().min(1).max(2e4).nullable(),
334
+ find: z3.string().min(1).max(8e3).nullable(),
335
+ replace: z3.string().max(8e3).nullable(),
336
+ expectedOutcome: z3.string().trim().min(1).max(1e4),
337
+ reason: z3.string().trim().min(1).max(1e4)
338
+ }).strip().superRefine((decision, context) => {
339
+ if (decision.operation === "create" && (decision.createContent === null || decision.find !== null || decision.replace !== null)) {
340
+ context.addIssue({
341
+ code: "custom",
342
+ message: "create proposals require createContent and null find/replace",
343
+ path: ["createContent"]
344
+ });
345
+ }
346
+ if (decision.operation === "update" && (decision.createContent !== null || decision.find === null || decision.replace === null)) {
347
+ context.addIssue({
348
+ code: "custom",
349
+ message: "update proposals require one exact find/replace edit and null createContent",
350
+ path: ["find"]
351
+ });
352
+ }
353
+ if (decision.operation === "delete" && (decision.createContent !== null || decision.find !== null || decision.replace !== null)) {
354
+ context.addIssue({
355
+ code: "custom",
356
+ message: "delete proposals require null createContent/find/replace",
357
+ path: ["createContent"]
358
+ });
359
+ }
360
+ });
361
+ var LocalHarnessRefinerDecisionSchema = z3.discriminatedUnion("decision", [
362
+ RefinerNoActionDecisionSchema,
363
+ RefinerExternalRouteDecisionSchema,
364
+ RefinerProposalDecisionSchema
365
+ ]);
366
+ var LocalHarnessRefinerDecisionV1Schema = LocalHarnessRefinerDecisionSchema;
367
+ var HarnessRefinerEvidenceBasisSchema = z3.object({
368
+ kind: z3.enum(["single_deterministic", "recurrent_independent"]),
369
+ supportingEvidenceIds: z3.array(z3.string().trim().min(1).max(2e3)).min(1).max(100),
370
+ counterevidence: z3.array(z3.string().trim().min(1).max(2e3)).max(20)
371
+ }).strict().superRefine((basis, context) => {
372
+ if (new Set(basis.supportingEvidenceIds).size !== basis.supportingEvidenceIds.length) {
373
+ context.addIssue({
374
+ code: "custom",
375
+ message: "supporting evidence IDs must be unique",
376
+ path: ["supportingEvidenceIds"]
377
+ });
378
+ }
379
+ if (basis.kind === "recurrent_independent" && basis.supportingEvidenceIds.length < 2) {
380
+ context.addIssue({
381
+ code: "custom",
382
+ message: "recurrent independent evidence requires at least two supplied incidents",
383
+ path: ["supportingEvidenceIds"]
384
+ });
385
+ }
386
+ });
387
+ var RefinerNoActionDecisionV2Schema = z3.object({
388
+ schemaVersion: z3.literal("openpond.localHarnessRefinerDecision.v2"),
389
+ decision: z3.literal("no_action"),
390
+ reason: z3.string().trim().min(1).max(1e4)
391
+ }).strict();
392
+ var RefinerExternalRouteDecisionV2Schema = z3.object({
393
+ schemaVersion: z3.literal("openpond.localHarnessRefinerDecision.v2"),
394
+ decision: z3.literal("route"),
395
+ route: z3.enum(["runtime", "product", "taskset", "training"]),
396
+ summary: z3.string().trim().min(1).max(2e3),
397
+ evidenceBasis: HarnessRefinerEvidenceBasisSchema,
398
+ expectedOutcome: z3.string().trim().min(1).max(1e4),
399
+ reason: z3.string().trim().min(1).max(1e4)
400
+ }).strict();
401
+ var RefinerProposalDecisionV2Schema = z3.object({
402
+ schemaVersion: z3.literal("openpond.localHarnessRefinerDecision.v2"),
403
+ decision: z3.literal("propose"),
404
+ route: z3.enum(["memory", "prompt", "skill", "agent"]),
405
+ operation: z3.enum(["create", "update", "delete"]),
406
+ target: z3.string().trim().min(1).max(2e3),
407
+ summary: z3.string().trim().min(1).max(2e3),
408
+ evidenceBasis: HarnessRefinerEvidenceBasisSchema,
409
+ createContent: z3.string().min(1).max(2e4).nullable(),
410
+ find: z3.string().min(1).max(8e3).nullable(),
411
+ replace: z3.string().max(8e3).nullable(),
412
+ expectedOutcome: z3.string().trim().min(1).max(1e4),
413
+ reason: z3.string().trim().min(1).max(1e4)
414
+ }).strict().superRefine((decision, context) => {
415
+ if (decision.operation === "create" && (decision.createContent === null || decision.find !== null || decision.replace !== null)) {
416
+ context.addIssue({
417
+ code: "custom",
418
+ message: "create proposals require createContent and null find/replace",
419
+ path: ["createContent"]
420
+ });
421
+ }
422
+ if (decision.operation === "update" && (decision.createContent !== null || decision.find === null || decision.replace === null)) {
423
+ context.addIssue({
424
+ code: "custom",
425
+ message: "update proposals require one exact find/replace edit and null createContent",
426
+ path: ["find"]
427
+ });
428
+ }
429
+ if (decision.operation === "delete" && (decision.createContent !== null || decision.find !== null || decision.replace !== null)) {
430
+ context.addIssue({
431
+ code: "custom",
432
+ message: "delete proposals require null createContent/find/replace",
433
+ path: ["createContent"]
434
+ });
435
+ }
436
+ });
437
+ var LocalHarnessRefinerDecisionV2Schema = z3.discriminatedUnion("decision", [
438
+ RefinerNoActionDecisionV2Schema,
439
+ RefinerExternalRouteDecisionV2Schema,
440
+ RefinerProposalDecisionV2Schema
441
+ ]);
442
+ var LocalHarnessRefinerDecisionAnySchema = z3.union([
443
+ LocalHarnessRefinerDecisionV1Schema,
444
+ LocalHarnessRefinerDecisionV2Schema
445
+ ]);
446
+ var HarnessRefinerCapabilitiesSchema = z3.object({
447
+ memory: z3.boolean(),
448
+ prompt: z3.boolean(),
449
+ skill: z3.boolean(),
450
+ agent: z3.boolean()
451
+ }).strict();
452
+ var SourceKindSchema = z3.enum(["memory", "instruction", "skill", "agent"]);
453
+ var RefinerSourceFileSchema = z3.object({
454
+ path: z3.string().trim().min(1).max(2e3),
455
+ kind: SourceKindSchema,
456
+ content: z3.string().max(6e4),
457
+ loaded: z3.boolean()
458
+ }).strict();
459
+ var RefinerSourceCatalogEntrySchema = z3.object({
460
+ path: z3.string().trim().min(1).max(2e3),
461
+ kind: SourceKindSchema,
462
+ loaded: z3.boolean()
463
+ }).strict();
464
+ var LocalHarnessRefinerEvidenceSchema = z3.object({
465
+ capabilities: HarnessRefinerCapabilitiesSchema,
466
+ trigger: z3.record(z3.string(), z3.unknown()),
467
+ observations: z3.array(z3.record(z3.string(), z3.unknown())).max(20),
468
+ admissibleEvidenceIds: z3.array(z3.string().trim().min(1).max(2e3)).max(1e4),
469
+ reviewPacket: z3.object({
470
+ currentTurn: z3.object({
471
+ id: z3.string().trim().min(1).max(2e3),
472
+ status: z3.string().trim().min(1).max(100).nullable(),
473
+ error: z3.string().max(2100).nullable(),
474
+ prompt: z3.string().max(8100).nullable(),
475
+ assistantOutput: z3.string().max(8100).nullable(),
476
+ assistantOutputLinkCount: z3.number().int().nonnegative()
477
+ }).strict(),
478
+ priorConversation: z3.array(z3.object({
479
+ turnId: z3.string().trim().min(1).max(2e3),
480
+ status: z3.string().trim().min(1).max(100).nullable(),
481
+ prompt: z3.string().max(3100).nullable(),
482
+ assistantOutput: z3.string().max(3100).nullable()
483
+ }).strict()).max(3),
484
+ timeline: z3.array(z3.record(z3.string(), z3.unknown())).max(60),
485
+ artifacts: z3.array(z3.record(z3.string(), z3.unknown())).max(30),
486
+ artifactDiagnostics: z3.array(z3.record(z3.string(), z3.unknown())).max(20),
487
+ executionProfile: z3.object({
488
+ modelRequestCount: z3.number().int().nonnegative(),
489
+ failedModelRequestCount: z3.number().int().nonnegative(),
490
+ promptTokens: z3.number().int().nonnegative(),
491
+ completionTokens: z3.number().int().nonnegative(),
492
+ totalTokens: z3.number().int().nonnegative(),
493
+ toolFailureCount: z3.number().int().nonnegative(),
494
+ retryCount: z3.number().int().nonnegative(),
495
+ recoveryCount: z3.number().int().nonnegative()
496
+ }).strict(),
497
+ priorIncidents: z3.array(z3.record(z3.string(), z3.unknown())).max(3),
498
+ truncation: z3.object({
499
+ timelineEventCount: z3.number().int().nonnegative(),
500
+ includedTimelineEventCount: z3.number().int().nonnegative(),
501
+ timelineTruncated: z3.boolean()
502
+ }).strict()
503
+ }).strict(),
504
+ runtimeActivation: z3.object({
505
+ admittedRelease: ImmutableReleaseRefSchema,
506
+ currentRelease: ImmutableReleaseRefSchema,
507
+ rebasedOntoCurrent: z3.boolean(),
508
+ admittedSourceFiles: z3.array(RefinerSourceFileSchema).max(100),
509
+ admittedSourceCatalog: z3.array(RefinerSourceCatalogEntrySchema).max(1e3)
510
+ }).strict(),
511
+ sourceFiles: z3.array(RefinerSourceFileSchema).max(100),
512
+ sourceCatalog: z3.array(RefinerSourceCatalogEntrySchema).max(1e3),
513
+ additionalEvidence: z3.unknown().nullable().optional()
514
+ }).strict();
515
+ var REFINER_CORE_VERSION = "openpond.refinerCore.v2";
516
+ var OverlayRefSchema = z3.object({
517
+ id: z3.string().trim().min(1).max(240),
518
+ revision: z3.number().int().nonnegative(),
519
+ contentHash: ReleaseHashSchema
520
+ }).strict();
521
+ var HostedHarnessRefinerRequestSchema = z3.object({
522
+ schemaVersion: z3.literal("openpond.hostedHarnessRefinerRequest.v2"),
523
+ requestId: z3.string().trim().min(1).max(240),
524
+ idempotencyKey: z3.string().trim().min(1).max(240),
525
+ evidenceHash: ReleaseHashSchema,
526
+ harness: z3.object({
527
+ admittedRelease: ImmutableReleaseRefSchema,
528
+ currentRelease: ImmutableReleaseRefSchema,
529
+ overlay: OverlayRefSchema,
530
+ workspace: z3.object({
531
+ id: z3.string().trim().min(1).max(240),
532
+ revision: z3.number().int().nonnegative(),
533
+ sourceRevision: ReleaseHashSchema,
534
+ channelRevision: z3.number().int().nonnegative()
535
+ }).strict(),
536
+ capabilities: HarnessRefinerCapabilitiesSchema
537
+ }).strict(),
538
+ evidence: LocalHarnessRefinerEvidenceSchema
539
+ }).strict();
540
+ var HostedHarnessRefinerUsageSchema = z3.object({
541
+ promptTokens: z3.number().int().nonnegative(),
542
+ completionTokens: z3.number().int().nonnegative(),
543
+ totalTokens: z3.number().int().nonnegative()
544
+ }).strict();
545
+ var HostedHarnessRefinerResponseSchema = z3.object({
546
+ schemaVersion: z3.literal("openpond.hostedHarnessRefinerResponse.v2"),
547
+ requestId: z3.string().trim().min(1).max(240),
548
+ evidenceHash: ReleaseHashSchema,
549
+ admittedRelease: ImmutableReleaseRefSchema,
550
+ currentRelease: ImmutableReleaseRefSchema,
551
+ decision: LocalHarnessRefinerDecisionV2Schema,
552
+ serviceRevision: z3.string().trim().min(1).max(240),
553
+ usage: HostedHarnessRefinerUsageSchema
554
+ }).strict();
555
+ export {
556
+ DEFAULT_REFINER_REVIEW_PROFILE,
557
+ REFINER_CORE_VERSION,
558
+ RefinerBindingSchema,
559
+ RefinerReleaseSchema,
560
+ RefinerReviewInstructionSchema,
561
+ RefinerReviewProfileSchema,
562
+ RefinerTransitionReceiptSchema,
563
+ createRefinerRelease,
564
+ defineReviewProfile,
565
+ refinerProfilePrompt,
566
+ serializeReviewProfile
567
+ };
568
+ //# sourceMappingURL=refiner.js.map