openpond-sdk 0.3.3 → 0.5.0
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/MODEL_STARTERS.md +26 -0
- package/TASKSETS.md +55 -0
- package/dist/actions-local.js +67 -118
- package/dist/actions-local.js.map +4 -4
- package/dist/actions.js +4 -92
- package/dist/actions.js.map +4 -4
- package/dist/chunk-25TBEGXB.js +220 -0
- package/dist/chunk-25TBEGXB.js.map +7 -0
- package/dist/chunk-27ETSPHQ.js +83 -0
- package/dist/chunk-27ETSPHQ.js.map +7 -0
- package/dist/chunk-5PRP457R.js +477 -0
- package/dist/chunk-5PRP457R.js.map +7 -0
- package/dist/chunk-65D4C7HP.js +273 -0
- package/dist/chunk-65D4C7HP.js.map +7 -0
- package/dist/chunk-6LGGLXAM.js +2395 -0
- package/dist/chunk-6LGGLXAM.js.map +7 -0
- package/dist/chunk-747CMU2Y.js +222 -0
- package/dist/chunk-747CMU2Y.js.map +7 -0
- package/dist/chunk-7O5X7DBU.js +80 -0
- package/dist/chunk-7O5X7DBU.js.map +7 -0
- package/dist/chunk-A4ZDOZKP.js +115 -0
- package/dist/chunk-A4ZDOZKP.js.map +7 -0
- package/dist/chunk-APHPXQEA.js +155 -0
- package/dist/chunk-APHPXQEA.js.map +7 -0
- package/dist/chunk-AVW35YOH.js +574 -0
- package/dist/chunk-AVW35YOH.js.map +7 -0
- package/dist/chunk-EPJM7VEV.js +177 -0
- package/dist/chunk-EPJM7VEV.js.map +7 -0
- package/dist/chunk-EV4PKJWN.js +1373 -0
- package/dist/chunk-EV4PKJWN.js.map +7 -0
- package/dist/chunk-K5ZCYOZO.js +49 -0
- package/dist/chunk-K5ZCYOZO.js.map +7 -0
- package/dist/chunk-LXXQVGQY.js +1 -0
- package/dist/chunk-LXXQVGQY.js.map +7 -0
- package/dist/chunk-NF63YMOL.js +593 -0
- package/dist/chunk-NF63YMOL.js.map +7 -0
- package/dist/chunk-P27DQ65Z.js +138 -0
- package/dist/chunk-P27DQ65Z.js.map +7 -0
- package/dist/chunk-QLEJOCQX.js +72 -0
- package/dist/chunk-QLEJOCQX.js.map +7 -0
- package/dist/chunk-S7I45WJQ.js +57 -0
- package/dist/chunk-S7I45WJQ.js.map +7 -0
- package/dist/index.js +33 -2488
- package/dist/index.js.map +4 -4
- package/dist/learning.js +16 -2042
- package/dist/learning.js.map +4 -4
- package/dist/model-batch-review.js +5 -42
- package/dist/model-batch-review.js.map +3 -3
- package/dist/model-projects.js +29 -430
- package/dist/model-projects.js.map +3 -3
- package/dist/model-starter-attempts.js +13 -420
- package/dist/model-starter-attempts.js.map +4 -4
- package/dist/model-starter-catalog.js +17 -460
- package/dist/model-starter-catalog.js.map +4 -4
- package/dist/model-starters.js +32 -709
- package/dist/model-starters.js.map +4 -4
- package/dist/model-taskset-authoring.js +11 -44
- package/dist/model-taskset-authoring.js.map +3 -3
- package/dist/model-taskset-runs.js +196 -0
- package/dist/model-taskset-runs.js.map +7 -0
- package/dist/profile-actions.js +4 -211
- package/dist/profile-actions.js.map +3 -3
- package/dist/project-actions.js +4 -224
- package/dist/project-actions.js.map +3 -3
- package/dist/refiner.js +14 -554
- package/dist/refiner.js.map +4 -4
- package/dist/taskset-catalog.js +9 -104
- package/dist/taskset-catalog.js.map +3 -3
- package/dist/taskset-drafts.js +465 -0
- package/dist/taskset-drafts.js.map +7 -0
- package/dist/taskset-packages.js +946 -3089
- package/dist/taskset-packages.js.map +4 -4
- package/dist/training.js +43 -822
- package/dist/training.js.map +4 -4
- package/dist/types/packages/sdk/src/index.d.ts +3 -3
- package/dist/types/packages/sdk/src/index.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/learning-client.d.ts +130 -0
- package/dist/types/packages/sdk/src/learning-client.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/learning.d.ts +1 -129
- package/dist/types/packages/sdk/src/learning.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/model-taskset-runs-contracts.d.ts +568 -0
- package/dist/types/packages/sdk/src/model-taskset-runs-contracts.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/model-taskset-runs.d.ts +722 -0
- package/dist/types/packages/sdk/src/model-taskset-runs.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/taskset-authored-contracts.d.ts +1170 -0
- package/dist/types/packages/sdk/src/taskset-authored-contracts.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/taskset-authored-files.d.ts +560 -0
- package/dist/types/packages/sdk/src/taskset-authored-files.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/taskset-authored-portable-release.d.ts +92 -0
- package/dist/types/packages/sdk/src/taskset-authored-portable-release.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/taskset-authored-tool-environment.d.ts +15 -0
- package/dist/types/packages/sdk/src/taskset-authored-tool-environment.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/taskset-authored-validation.d.ts +18 -0
- package/dist/types/packages/sdk/src/taskset-authored-validation.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/taskset-draft-api-contracts.d.ts +1681 -0
- package/dist/types/packages/sdk/src/taskset-draft-api-contracts.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/taskset-draft-authoring.d.ts +19 -0
- package/dist/types/packages/sdk/src/taskset-draft-authoring.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/taskset-draft-client.d.ts +2713 -0
- package/dist/types/packages/sdk/src/taskset-draft-client.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/taskset-draft-core.d.ts +1000 -0
- package/dist/types/packages/sdk/src/taskset-draft-core.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/taskset-draft-dataset-artifacts.d.ts +429 -0
- package/dist/types/packages/sdk/src/taskset-draft-dataset-artifacts.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/taskset-draft-dataset-sources.d.ts +284 -0
- package/dist/types/packages/sdk/src/taskset-draft-dataset-sources.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/taskset-draft-document.d.ts +846 -0
- package/dist/types/packages/sdk/src/taskset-draft-document.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/taskset-draft-files.d.ts +8 -0
- package/dist/types/packages/sdk/src/taskset-draft-files.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/taskset-draft-harness-actions.d.ts +28 -0
- package/dist/types/packages/sdk/src/taskset-draft-harness-actions.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/taskset-draft-manifests.d.ts +8 -0
- package/dist/types/packages/sdk/src/taskset-draft-manifests.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/taskset-draft-package-compiler.d.ts +967 -0
- package/dist/types/packages/sdk/src/taskset-draft-package-compiler.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/taskset-draft-publication.d.ts +10 -0
- package/dist/types/packages/sdk/src/taskset-draft-publication.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/taskset-draft-source.d.ts +1297 -0
- package/dist/types/packages/sdk/src/taskset-draft-source.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/taskset-draft-workspace.d.ts +1597 -0
- package/dist/types/packages/sdk/src/taskset-draft-workspace.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/taskset-drafts.d.ts +16 -0
- package/dist/types/packages/sdk/src/taskset-drafts.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/taskset-package-grader-projection.d.ts +64 -0
- package/dist/types/packages/sdk/src/taskset-package-grader-projection.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/taskset-package-projection.d.ts +1514 -0
- package/dist/types/packages/sdk/src/taskset-package-projection.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/taskset-packages.d.ts +6 -0
- package/dist/types/packages/sdk/src/taskset-packages.d.ts.map +1 -1
- package/dist/workflows.js +4 -221
- package/dist/workflows.js.map +3 -3
- package/package.json +11 -3
package/dist/learning.js
CHANGED
|
@@ -1,2050 +1,24 @@
|
|
|
1
|
-
// src/learning.ts
|
|
2
|
-
import { z as z12 } from "zod";
|
|
3
1
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
import
|
|
19
|
-
|
|
20
|
-
// ../harness/dist/sha256.js
|
|
21
|
-
var INITIAL_STATE = new Uint32Array([
|
|
22
|
-
1779033703,
|
|
23
|
-
3144134277,
|
|
24
|
-
1013904242,
|
|
25
|
-
2773480762,
|
|
26
|
-
1359893119,
|
|
27
|
-
2600822924,
|
|
28
|
-
528734635,
|
|
29
|
-
1541459225
|
|
30
|
-
]);
|
|
31
|
-
var ROUND_CONSTANTS = new Uint32Array([
|
|
32
|
-
1116352408,
|
|
33
|
-
1899447441,
|
|
34
|
-
3049323471,
|
|
35
|
-
3921009573,
|
|
36
|
-
961987163,
|
|
37
|
-
1508970993,
|
|
38
|
-
2453635748,
|
|
39
|
-
2870763221,
|
|
40
|
-
3624381080,
|
|
41
|
-
310598401,
|
|
42
|
-
607225278,
|
|
43
|
-
1426881987,
|
|
44
|
-
1925078388,
|
|
45
|
-
2162078206,
|
|
46
|
-
2614888103,
|
|
47
|
-
3248222580,
|
|
48
|
-
3835390401,
|
|
49
|
-
4022224774,
|
|
50
|
-
264347078,
|
|
51
|
-
604807628,
|
|
52
|
-
770255983,
|
|
53
|
-
1249150122,
|
|
54
|
-
1555081692,
|
|
55
|
-
1996064986,
|
|
56
|
-
2554220882,
|
|
57
|
-
2821834349,
|
|
58
|
-
2952996808,
|
|
59
|
-
3210313671,
|
|
60
|
-
3336571891,
|
|
61
|
-
3584528711,
|
|
62
|
-
113926993,
|
|
63
|
-
338241895,
|
|
64
|
-
666307205,
|
|
65
|
-
773529912,
|
|
66
|
-
1294757372,
|
|
67
|
-
1396182291,
|
|
68
|
-
1695183700,
|
|
69
|
-
1986661051,
|
|
70
|
-
2177026350,
|
|
71
|
-
2456956037,
|
|
72
|
-
2730485921,
|
|
73
|
-
2820302411,
|
|
74
|
-
3259730800,
|
|
75
|
-
3345764771,
|
|
76
|
-
3516065817,
|
|
77
|
-
3600352804,
|
|
78
|
-
4094571909,
|
|
79
|
-
275423344,
|
|
80
|
-
430227734,
|
|
81
|
-
506948616,
|
|
82
|
-
659060556,
|
|
83
|
-
883997877,
|
|
84
|
-
958139571,
|
|
85
|
-
1322822218,
|
|
86
|
-
1537002063,
|
|
87
|
-
1747873779,
|
|
88
|
-
1955562222,
|
|
89
|
-
2024104815,
|
|
90
|
-
2227730452,
|
|
91
|
-
2361852424,
|
|
92
|
-
2428436474,
|
|
93
|
-
2756734187,
|
|
94
|
-
3204031479,
|
|
95
|
-
3329325298
|
|
96
|
-
]);
|
|
97
|
-
function sha256Hex(value) {
|
|
98
|
-
const bytes = typeof value === "string" ? new TextEncoder().encode(value) : value;
|
|
99
|
-
const paddedLength = Math.ceil((bytes.byteLength + 9) / 64) * 64;
|
|
100
|
-
const padded = new Uint8Array(paddedLength);
|
|
101
|
-
padded.set(bytes);
|
|
102
|
-
padded[bytes.byteLength] = 128;
|
|
103
|
-
const bitLength = bytes.byteLength * 8;
|
|
104
|
-
const view = new DataView(padded.buffer);
|
|
105
|
-
view.setUint32(paddedLength - 8, Math.floor(bitLength / 4294967296), false);
|
|
106
|
-
view.setUint32(paddedLength - 4, bitLength >>> 0, false);
|
|
107
|
-
const state = new Uint32Array(INITIAL_STATE);
|
|
108
|
-
const words = new Uint32Array(64);
|
|
109
|
-
for (let offset = 0; offset < paddedLength; offset += 64) {
|
|
110
|
-
for (let index = 0; index < 16; index += 1) {
|
|
111
|
-
words[index] = view.getUint32(offset + index * 4, false);
|
|
112
|
-
}
|
|
113
|
-
for (let index = 16; index < 64; index += 1) {
|
|
114
|
-
const previous = words[index - 15];
|
|
115
|
-
const recent = words[index - 2];
|
|
116
|
-
const sigma0 = rotateRight(previous, 7) ^ rotateRight(previous, 18) ^ previous >>> 3;
|
|
117
|
-
const sigma1 = rotateRight(recent, 17) ^ rotateRight(recent, 19) ^ recent >>> 10;
|
|
118
|
-
words[index] = words[index - 16] + sigma0 + words[index - 7] + sigma1 >>> 0;
|
|
119
|
-
}
|
|
120
|
-
let a = state[0];
|
|
121
|
-
let b = state[1];
|
|
122
|
-
let c = state[2];
|
|
123
|
-
let d = state[3];
|
|
124
|
-
let e = state[4];
|
|
125
|
-
let f = state[5];
|
|
126
|
-
let g = state[6];
|
|
127
|
-
let h = state[7];
|
|
128
|
-
for (let index = 0; index < 64; index += 1) {
|
|
129
|
-
const choice = e & f ^ ~e & g;
|
|
130
|
-
const majority = a & b ^ a & c ^ b & c;
|
|
131
|
-
const sum0 = rotateRight(a, 2) ^ rotateRight(a, 13) ^ rotateRight(a, 22);
|
|
132
|
-
const sum1 = rotateRight(e, 6) ^ rotateRight(e, 11) ^ rotateRight(e, 25);
|
|
133
|
-
const first = h + sum1 + choice + ROUND_CONSTANTS[index] + words[index] >>> 0;
|
|
134
|
-
const second = sum0 + majority >>> 0;
|
|
135
|
-
h = g;
|
|
136
|
-
g = f;
|
|
137
|
-
f = e;
|
|
138
|
-
e = d + first >>> 0;
|
|
139
|
-
d = c;
|
|
140
|
-
c = b;
|
|
141
|
-
b = a;
|
|
142
|
-
a = first + second >>> 0;
|
|
143
|
-
}
|
|
144
|
-
state[0] = state[0] + a >>> 0;
|
|
145
|
-
state[1] = state[1] + b >>> 0;
|
|
146
|
-
state[2] = state[2] + c >>> 0;
|
|
147
|
-
state[3] = state[3] + d >>> 0;
|
|
148
|
-
state[4] = state[4] + e >>> 0;
|
|
149
|
-
state[5] = state[5] + f >>> 0;
|
|
150
|
-
state[6] = state[6] + g >>> 0;
|
|
151
|
-
state[7] = state[7] + h >>> 0;
|
|
152
|
-
}
|
|
153
|
-
return Array.from(state, (word) => word.toString(16).padStart(8, "0")).join("");
|
|
154
|
-
}
|
|
155
|
-
function rotateRight(value, bits) {
|
|
156
|
-
return value >>> bits | value << 32 - bits;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
// ../harness/dist/common.js
|
|
160
|
-
var MAX_PORTABLE_PATH_BYTES = 2e3;
|
|
161
|
-
var MAX_PORTABLE_ASSET_BYTES = 25e7;
|
|
162
|
-
var ReleaseIdSchema = z.string().trim().min(1).max(240);
|
|
163
|
-
var ReleaseHashSchema = z.string().regex(/^[a-f0-9]{64}$/);
|
|
164
|
-
var ReleaseTimestampSchema = z.string().datetime({ offset: true });
|
|
165
|
-
var MetadataSchema = z.record(z.string(), z.unknown()).default({});
|
|
166
|
-
var ImmutableReleaseRefSchema = z.object({
|
|
167
|
-
id: ReleaseIdSchema,
|
|
168
|
-
contentHash: ReleaseHashSchema
|
|
169
|
-
}).strict();
|
|
170
|
-
var ImmutableAssetRefSchema = z.object({
|
|
171
|
-
id: ReleaseIdSchema,
|
|
172
|
-
path: z.string().trim().min(1).max(MAX_PORTABLE_PATH_BYTES).refine(safeRelativePath),
|
|
173
|
-
contentHash: ReleaseHashSchema,
|
|
174
|
-
sizeBytes: z.number().int().nonnegative().max(MAX_PORTABLE_ASSET_BYTES),
|
|
175
|
-
mediaType: z.string().trim().min(1).max(200),
|
|
176
|
-
visibility: z.enum(["policy", "verifier", "host_private"])
|
|
177
|
-
}).strict();
|
|
178
|
-
var ImmutableArtifactRefSchema = z.object({
|
|
179
|
-
id: ReleaseIdSchema,
|
|
180
|
-
contentHash: ReleaseHashSchema,
|
|
181
|
-
mediaType: z.string().trim().min(1).max(200).nullable().default(null),
|
|
182
|
-
sizeBytes: z.number().int().nonnegative().max(MAX_PORTABLE_ASSET_BYTES).nullable().default(null)
|
|
183
|
-
}).strict();
|
|
184
|
-
var FailureClassSchema = z.enum([
|
|
185
|
-
"policy_failure",
|
|
186
|
-
"grader_failure",
|
|
187
|
-
"environment_failure",
|
|
188
|
-
"infrastructure_failure",
|
|
189
|
-
"timeout",
|
|
190
|
-
"cancelled"
|
|
191
|
-
]);
|
|
192
|
-
function canonicalJson(value) {
|
|
193
|
-
return `${JSON.stringify(sortValue(value), null, 2)}
|
|
194
|
-
`;
|
|
195
|
-
}
|
|
196
|
-
function sha256(value) {
|
|
197
|
-
return sha256Hex(value);
|
|
198
|
-
}
|
|
199
|
-
function contentHash(value) {
|
|
200
|
-
return sha256(canonicalJson(value));
|
|
201
|
-
}
|
|
202
|
-
function safeRelativePath(value) {
|
|
203
|
-
const normalized = value.replaceAll("\\", "/");
|
|
204
|
-
if (!normalized || normalized.startsWith("/") || normalized.includes("\0"))
|
|
205
|
-
return false;
|
|
206
|
-
return !normalized.split("/").some((part) => !part || part === "." || part === "..");
|
|
207
|
-
}
|
|
208
|
-
function sortValue(value) {
|
|
209
|
-
if (Array.isArray(value))
|
|
210
|
-
return value.map(sortValue);
|
|
211
|
-
if (!value || typeof value !== "object")
|
|
212
|
-
return value;
|
|
213
|
-
return Object.fromEntries(Object.entries(value).sort(([left], [right]) => left.localeCompare(right)).map(([key, child]) => [key, sortValue(child)]));
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
// ../harness/dist/evaluation-review.js
|
|
217
|
-
import { z as z2 } from "zod";
|
|
218
|
-
var BoundedTextSchema = z2.string().trim().min(1).max(1e5);
|
|
219
|
-
var HarnessEvaluationReviewClassificationSchema = z2.enum([
|
|
220
|
-
"no_action",
|
|
221
|
-
"harness_maintenance",
|
|
222
|
-
"runtime",
|
|
223
|
-
"product",
|
|
224
|
-
"taskset",
|
|
225
|
-
"model_improvement"
|
|
226
|
-
]);
|
|
227
|
-
var HarnessEvaluationReviewAuthoritySchema = z2.enum([
|
|
228
|
-
"none",
|
|
229
|
-
"runtime_service",
|
|
230
|
-
"product_team",
|
|
231
|
-
"human_review",
|
|
232
|
-
"evaluation_system",
|
|
233
|
-
"training_system"
|
|
234
|
-
]);
|
|
235
|
-
var HarnessReviewEvidenceKindSchema = z2.enum([
|
|
236
|
-
"observation",
|
|
237
|
-
"trigger",
|
|
238
|
-
"route_decision",
|
|
239
|
-
"refiner_outcome",
|
|
240
|
-
"proposal",
|
|
241
|
-
"validation",
|
|
242
|
-
"apply_receipt",
|
|
243
|
-
"harness_advance",
|
|
244
|
-
"rollback",
|
|
245
|
-
"work_outcome",
|
|
246
|
-
"taskset",
|
|
247
|
-
"evaluation",
|
|
248
|
-
"training_qualification",
|
|
249
|
-
"model_candidate"
|
|
250
|
-
]);
|
|
251
|
-
var HarnessReviewOwnerScopeSchema = z2.object({
|
|
252
|
-
kind: z2.enum(["personal", "team"]),
|
|
253
|
-
id: ReleaseIdSchema
|
|
254
|
-
}).strict();
|
|
255
|
-
var HarnessReviewSourcePolicyRefSchema = z2.object({
|
|
256
|
-
policy: ImmutableReleaseRefSchema,
|
|
257
|
-
state: z2.enum(["authorized", "revoked", "deleted", "expired"]),
|
|
258
|
-
checkedAt: ReleaseTimestampSchema
|
|
259
|
-
}).strict();
|
|
260
|
-
var HarnessReviewEvidenceRefSchema = z2.object({
|
|
261
|
-
evidence: ImmutableReleaseRefSchema,
|
|
262
|
-
kind: HarnessReviewEvidenceKindSchema,
|
|
263
|
-
sourceRef: ReleaseIdSchema,
|
|
264
|
-
sourcePolicy: HarnessReviewSourcePolicyRefSchema,
|
|
265
|
-
occurrenceKey: ReleaseHashSchema,
|
|
266
|
-
occurredAt: ReleaseTimestampSchema
|
|
267
|
-
}).strict();
|
|
268
|
-
var HarnessReviewExcludedEvidenceSchema = z2.object({
|
|
269
|
-
evidence: ImmutableReleaseRefSchema,
|
|
270
|
-
sourcePolicy: HarnessReviewSourcePolicyRefSchema.nullable(),
|
|
271
|
-
reason: z2.enum([
|
|
272
|
-
"outside_scope",
|
|
273
|
-
"before_watermark",
|
|
274
|
-
"duplicate",
|
|
275
|
-
"resolved",
|
|
276
|
-
"revoked",
|
|
277
|
-
"deleted",
|
|
278
|
-
"expired",
|
|
279
|
-
"sensitive",
|
|
280
|
-
"unverified",
|
|
281
|
-
"budget"
|
|
282
|
-
])
|
|
283
|
-
}).strict();
|
|
284
|
-
var HarnessReviewWatermarkSchema = z2.object({
|
|
285
|
-
cursor: ReleaseHashSchema,
|
|
286
|
-
throughCreatedAt: ReleaseTimestampSchema
|
|
287
|
-
}).strict();
|
|
288
|
-
var HarnessReviewClaimSchema = z2.object({
|
|
289
|
-
fingerprint: ReleaseHashSchema,
|
|
290
|
-
recurrenceFamily: z2.string().trim().min(1).max(1e3),
|
|
291
|
-
statement: BoundedTextSchema,
|
|
292
|
-
candidateDisposition: z2.enum(["observe", "confirm"]).optional(),
|
|
293
|
-
independentOccurrences: z2.number().int().positive().max(1e6),
|
|
294
|
-
unresolvedOccurrences: z2.number().int().positive().max(1e6)
|
|
295
|
-
}).strict().refine((claim) => claim.unresolvedOccurrences <= claim.independentOccurrences, "unresolved occurrences cannot exceed independent occurrences");
|
|
296
|
-
var HarnessReviewTriageLayerSchema = z2.enum([
|
|
297
|
-
"harness",
|
|
298
|
-
"runtime",
|
|
299
|
-
"product",
|
|
300
|
-
"retrieval",
|
|
301
|
-
"tools",
|
|
302
|
-
"evaluation",
|
|
303
|
-
"model"
|
|
304
|
-
]);
|
|
305
|
-
var HarnessReviewTriageDecisionSchema = z2.object({
|
|
306
|
-
layer: HarnessReviewTriageLayerSchema,
|
|
307
|
-
status: z2.enum(["not_applicable", "unresolved", "resolved", "blocked"]),
|
|
308
|
-
reason: BoundedTextSchema,
|
|
309
|
-
evidenceRefs: z2.array(ImmutableReleaseRefSchema).max(1e3)
|
|
310
|
-
}).strict();
|
|
311
|
-
var HarnessEvaluationReviewReceiptContentSchema = z2.object({
|
|
312
|
-
schemaVersion: z2.literal("openpond.harnessEvaluationReviewReceipt.v1"),
|
|
313
|
-
id: ReleaseIdSchema,
|
|
314
|
-
ownerScope: HarnessReviewOwnerScopeSchema,
|
|
315
|
-
workspaceRef: ReleaseIdSchema,
|
|
316
|
-
harnessRelease: ImmutableReleaseRefSchema,
|
|
317
|
-
previousWatermark: HarnessReviewWatermarkSchema.nullable(),
|
|
318
|
-
nextWatermark: HarnessReviewWatermarkSchema,
|
|
319
|
-
selectedEvidence: z2.array(HarnessReviewEvidenceRefSchema).max(1e4),
|
|
320
|
-
excludedEvidence: z2.array(HarnessReviewExcludedEvidenceSchema).max(1e4),
|
|
321
|
-
claim: HarnessReviewClaimSchema.nullable(),
|
|
322
|
-
classification: HarnessEvaluationReviewClassificationSchema,
|
|
323
|
-
triage: z2.array(HarnessReviewTriageDecisionSchema).max(16),
|
|
324
|
-
reason: BoundedTextSchema,
|
|
325
|
-
nextAuthority: HarnessEvaluationReviewAuthoritySchema,
|
|
326
|
-
maxEstimatedCostUsd: z2.number().finite().nonnegative(),
|
|
327
|
-
tasksetProposal: ImmutableReleaseRefSchema.nullable(),
|
|
328
|
-
evaluation: ImmutableReleaseRefSchema.nullable(),
|
|
329
|
-
trainingQualification: ImmutableReleaseRefSchema.nullable(),
|
|
330
|
-
policyVersion: ReleaseIdSchema,
|
|
331
|
-
createdAt: ReleaseTimestampSchema,
|
|
332
|
-
metadata: MetadataSchema
|
|
333
|
-
}).strict().superRefine((receipt, context) => {
|
|
334
|
-
const selectedKeys = receipt.selectedEvidence.map((item) => `${item.evidence.id}:${item.evidence.contentHash}`);
|
|
335
|
-
if (new Set(selectedKeys).size !== selectedKeys.length) {
|
|
336
|
-
context.addIssue({
|
|
337
|
-
code: "custom",
|
|
338
|
-
message: "selected review evidence must be unique",
|
|
339
|
-
path: ["selectedEvidence"]
|
|
340
|
-
});
|
|
341
|
-
}
|
|
342
|
-
if (receipt.selectedEvidence.some((item) => item.sourcePolicy.state !== "authorized")) {
|
|
343
|
-
context.addIssue({
|
|
344
|
-
code: "custom",
|
|
345
|
-
message: "selected review evidence must be authorized at review time",
|
|
346
|
-
path: ["selectedEvidence"]
|
|
347
|
-
});
|
|
348
|
-
}
|
|
349
|
-
if (receipt.classification === "no_action") {
|
|
350
|
-
if (receipt.nextAuthority !== "none") {
|
|
351
|
-
context.addIssue({
|
|
352
|
-
code: "custom",
|
|
353
|
-
message: "no-action review receipts require no next authority",
|
|
354
|
-
path: ["nextAuthority"]
|
|
355
|
-
});
|
|
356
|
-
}
|
|
357
|
-
if (receipt.tasksetProposal || receipt.evaluation || receipt.trainingQualification) {
|
|
358
|
-
context.addIssue({
|
|
359
|
-
code: "custom",
|
|
360
|
-
message: "no-action review receipts cannot carry downstream refs"
|
|
361
|
-
});
|
|
362
|
-
}
|
|
363
|
-
} else if (!receipt.claim || receipt.selectedEvidence.length === 0) {
|
|
364
|
-
context.addIssue({
|
|
365
|
-
code: "custom",
|
|
366
|
-
message: "actionable review receipts require a claim and selected evidence"
|
|
367
|
-
});
|
|
368
|
-
}
|
|
369
|
-
if (receipt.classification === "runtime" && receipt.nextAuthority !== "runtime_service") {
|
|
370
|
-
context.addIssue({
|
|
371
|
-
code: "custom",
|
|
372
|
-
message: "runtime classifications route to runtime-service authority",
|
|
373
|
-
path: ["nextAuthority"]
|
|
374
|
-
});
|
|
375
|
-
}
|
|
376
|
-
if (receipt.classification === "product" && receipt.nextAuthority !== "product_team") {
|
|
377
|
-
context.addIssue({
|
|
378
|
-
code: "custom",
|
|
379
|
-
message: "product classifications route to product-team authority",
|
|
380
|
-
path: ["nextAuthority"]
|
|
381
|
-
});
|
|
382
|
-
}
|
|
383
|
-
if (receipt.classification === "taskset" && receipt.nextAuthority !== "human_review") {
|
|
384
|
-
context.addIssue({
|
|
385
|
-
code: "custom",
|
|
386
|
-
message: "Taskset classifications require human review"
|
|
387
|
-
});
|
|
388
|
-
}
|
|
389
|
-
if (receipt.classification === "model_improvement" && (!receipt.evaluation || !receipt.trainingQualification || !["human_review", "training_system"].includes(receipt.nextAuthority))) {
|
|
390
|
-
context.addIssue({
|
|
391
|
-
code: "custom",
|
|
392
|
-
message: "model-improvement classifications require Evaluation and qualification refs plus explicit authority"
|
|
393
|
-
});
|
|
394
|
-
}
|
|
395
|
-
});
|
|
396
|
-
var HarnessEvaluationReviewReceiptSchema = HarnessEvaluationReviewReceiptContentSchema.extend({
|
|
397
|
-
contentHash: ReleaseHashSchema
|
|
398
|
-
}).strict();
|
|
399
|
-
var HarnessEvaluationReviewModelEvidenceSchema = z2.object({
|
|
400
|
-
id: ReleaseIdSchema,
|
|
401
|
-
evidence: ImmutableReleaseRefSchema,
|
|
402
|
-
kind: HarnessReviewEvidenceKindSchema,
|
|
403
|
-
sourceRef: ReleaseIdSchema,
|
|
404
|
-
occurredAt: ReleaseTimestampSchema,
|
|
405
|
-
payload: z2.record(z2.string(), z2.unknown())
|
|
406
|
-
}).strict();
|
|
407
|
-
var HarnessEvaluationReviewModelNoActionSchema = z2.object({
|
|
408
|
-
schemaVersion: z2.literal("openpond.harnessEvaluationReviewModelDecision.v2"),
|
|
409
|
-
decision: z2.literal("no_action"),
|
|
410
|
-
reason: BoundedTextSchema,
|
|
411
|
-
ignoredEvidence: z2.array(z2.object({
|
|
412
|
-
id: ReleaseIdSchema,
|
|
413
|
-
reason: z2.string().trim().min(1).max(2e3)
|
|
414
|
-
}).strict()).max(1e3)
|
|
415
|
-
}).strict();
|
|
416
|
-
var HarnessEvaluationReviewModelActionSchema = z2.object({
|
|
417
|
-
schemaVersion: z2.literal("openpond.harnessEvaluationReviewModelDecision.v2"),
|
|
418
|
-
decision: z2.literal("review"),
|
|
419
|
-
classification: z2.enum([
|
|
420
|
-
"harness_maintenance",
|
|
421
|
-
"runtime",
|
|
422
|
-
"product",
|
|
423
|
-
"taskset"
|
|
424
|
-
]),
|
|
425
|
-
selectedEvidenceIds: z2.array(ReleaseIdSchema).min(1).max(1e3),
|
|
426
|
-
ignoredEvidence: z2.array(z2.object({
|
|
427
|
-
id: ReleaseIdSchema,
|
|
428
|
-
reason: z2.string().trim().min(1).max(2e3)
|
|
429
|
-
}).strict()).max(1e3),
|
|
430
|
-
recurrenceFamily: z2.string().trim().min(1).max(1e3),
|
|
431
|
-
statement: BoundedTextSchema,
|
|
432
|
-
triageLayer: HarnessReviewTriageLayerSchema,
|
|
433
|
-
expectedOutcome: BoundedTextSchema,
|
|
434
|
-
counterevidence: z2.string().trim().max(1e4),
|
|
435
|
-
confidence: z2.number().min(0).max(1),
|
|
436
|
-
candidateDisposition: z2.enum(["observe", "confirm"]).nullable(),
|
|
437
|
-
reason: BoundedTextSchema
|
|
438
|
-
}).strict().superRefine((decision, context) => {
|
|
439
|
-
const requiresDisposition = decision.classification === "harness_maintenance";
|
|
440
|
-
if (requiresDisposition !== (decision.candidateDisposition !== null)) {
|
|
441
|
-
context.addIssue({
|
|
442
|
-
code: "custom",
|
|
443
|
-
message: "Harness maintenance requires a candidate disposition; external routes require null",
|
|
444
|
-
path: ["candidateDisposition"]
|
|
445
|
-
});
|
|
446
|
-
}
|
|
447
|
-
});
|
|
448
|
-
var HarnessEvaluationReviewModelResolutionSchema = z2.object({
|
|
449
|
-
schemaVersion: z2.literal("openpond.harnessEvaluationReviewModelDecision.v2"),
|
|
450
|
-
decision: z2.literal("resolve_candidate"),
|
|
451
|
-
candidateId: ReleaseIdSchema,
|
|
452
|
-
candidateFingerprint: ReleaseHashSchema,
|
|
453
|
-
selectedEvidenceIds: z2.array(ReleaseIdSchema).min(1).max(1e3),
|
|
454
|
-
ignoredEvidence: z2.array(z2.object({
|
|
455
|
-
id: ReleaseIdSchema,
|
|
456
|
-
reason: z2.string().trim().min(1).max(2e3)
|
|
457
|
-
}).strict()).max(1e3),
|
|
458
|
-
confidence: z2.number().min(0).max(1),
|
|
459
|
-
reason: BoundedTextSchema
|
|
460
|
-
}).strict();
|
|
461
|
-
var HarnessEvaluationReviewModelDecisionSchema = z2.discriminatedUnion("decision", [
|
|
462
|
-
HarnessEvaluationReviewModelNoActionSchema,
|
|
463
|
-
HarnessEvaluationReviewModelActionSchema,
|
|
464
|
-
HarnessEvaluationReviewModelResolutionSchema
|
|
465
|
-
]);
|
|
466
|
-
var HarnessEvaluationReviewNavigationDecisionSchema = z2.object({
|
|
467
|
-
schemaVersion: z2.literal("openpond.harnessEvaluationReviewNavigationDecision.v1"),
|
|
468
|
-
selectedEvidenceIds: z2.array(ReleaseIdSchema).min(1).max(50),
|
|
469
|
-
reason: BoundedTextSchema
|
|
470
|
-
}).strict();
|
|
471
|
-
|
|
472
|
-
// ../harness/dist/harness.js
|
|
473
|
-
import { z as z4 } from "zod";
|
|
474
|
-
|
|
475
|
-
// ../harness/dist/tools.js
|
|
476
|
-
import { z as z3 } from "zod";
|
|
477
|
-
var ToolDeclarationSchema = z3.object({
|
|
478
|
-
name: z3.string().trim().min(1).max(64).regex(/^[a-zA-Z][a-zA-Z0-9_-]*$/),
|
|
479
|
-
description: z3.string().trim().min(1).max(2e3),
|
|
480
|
-
inputSchema: z3.record(z3.string(), z3.unknown()),
|
|
481
|
-
inputSchemaHash: ReleaseHashSchema,
|
|
482
|
-
sideEffect: z3.enum(["read", "write"]),
|
|
483
|
-
timeoutMs: z3.number().int().positive().max(36e5)
|
|
484
|
-
}).strict();
|
|
485
|
-
var CapabilityRequirementSchema = z3.object({
|
|
486
|
-
id: ReleaseIdSchema,
|
|
487
|
-
required: z3.boolean(),
|
|
488
|
-
scopes: z3.array(z3.string().trim().min(1).max(500)).max(100).default([]),
|
|
489
|
-
portability: z3.enum(["portable", "host_adapter", "local_only", "hosted_only"])
|
|
490
|
-
}).strict();
|
|
491
|
-
|
|
492
|
-
// ../harness/dist/harness.js
|
|
493
|
-
var PortabilityReportSchema = z4.object({
|
|
494
|
-
portable: z4.boolean(),
|
|
495
|
-
blockers: z4.array(z4.string().trim().min(1).max(2e3)).max(1e3),
|
|
496
|
-
localOnlyAssetRefs: z4.array(ReleaseIdSchema).max(1e4),
|
|
497
|
-
hostPrivateAssetRefs: z4.array(ReleaseIdSchema).max(1e4)
|
|
498
|
-
}).strict();
|
|
499
|
-
var AgentSnapshotContentSchema = z4.object({
|
|
500
|
-
schemaVersion: z4.literal("openpond.agentSnapshot.v2"),
|
|
501
|
-
id: ReleaseIdSchema,
|
|
502
|
-
sourceRelease: ImmutableReleaseRefSchema.nullable(),
|
|
503
|
-
instructions: z4.array(ImmutableAssetRefSchema).max(1e4),
|
|
504
|
-
skills: z4.array(ImmutableAssetRefSchema).max(1e4),
|
|
505
|
-
agents: z4.array(ImmutableAssetRefSchema).max(1e4),
|
|
506
|
-
toolDeclarations: z4.array(ToolDeclarationSchema).max(200),
|
|
507
|
-
capabilityRequirements: z4.array(CapabilityRequirementSchema).max(200),
|
|
508
|
-
dependencyLock: ImmutableAssetRefSchema,
|
|
509
|
-
portability: PortabilityReportSchema,
|
|
510
|
-
metadata: MetadataSchema
|
|
511
|
-
}).strict();
|
|
512
|
-
var AgentSnapshotSchema = AgentSnapshotContentSchema.extend({ contentHash: ReleaseHashSchema }).strict();
|
|
513
|
-
var LifecycleContractSchema = z4.object({
|
|
514
|
-
create: z4.literal(true),
|
|
515
|
-
reset: z4.literal(true),
|
|
516
|
-
step: z4.literal(true),
|
|
517
|
-
collect: z4.literal(true),
|
|
518
|
-
destroy: z4.literal(true),
|
|
519
|
-
resetScope: z4.enum(["task", "attempt"])
|
|
520
|
-
}).strict();
|
|
521
|
-
var GraderInterfaceContractSchema = z4.object({
|
|
522
|
-
visibleEvidence: z4.array(ReleaseIdSchema).max(1e3),
|
|
523
|
-
privilegedEvidence: z4.array(ReleaseIdSchema).max(1e3),
|
|
524
|
-
privateVerifierIsolation: z4.boolean()
|
|
525
|
-
}).strict();
|
|
526
|
-
var HarnessReleaseContentSchema = z4.object({
|
|
527
|
-
schemaVersion: z4.literal("openpond.harnessRelease.v2"),
|
|
528
|
-
id: ReleaseIdSchema,
|
|
529
|
-
agentSnapshot: ImmutableReleaseRefSchema,
|
|
530
|
-
program: ImmutableAssetRefSchema,
|
|
531
|
-
tools: z4.array(ToolDeclarationSchema).max(200),
|
|
532
|
-
lifecycle: LifecycleContractSchema,
|
|
533
|
-
graderInterface: GraderInterfaceContractSchema,
|
|
534
|
-
files: z4.array(ImmutableAssetRefSchema).max(1e5),
|
|
535
|
-
metadata: MetadataSchema
|
|
536
|
-
}).strict();
|
|
537
|
-
var HarnessReleaseSchema = HarnessReleaseContentSchema.extend({ contentHash: ReleaseHashSchema }).strict();
|
|
538
|
-
var ModelActionSchema = z4.object({
|
|
539
|
-
id: ReleaseIdSchema,
|
|
540
|
-
turn: z4.number().int().nonnegative(),
|
|
541
|
-
kind: z4.enum(["message", "tool_call", "terminal"]),
|
|
542
|
-
name: ReleaseIdSchema.nullable(),
|
|
543
|
-
arguments: z4.record(z4.string(), z4.unknown()),
|
|
544
|
-
content: z4.string().max(1e6).nullable()
|
|
545
|
-
}).strict();
|
|
546
|
-
var ToolObservationSchema = z4.object({
|
|
547
|
-
actionId: ReleaseIdSchema,
|
|
548
|
-
turn: z4.number().int().nonnegative(),
|
|
549
|
-
terminal: z4.boolean(),
|
|
550
|
-
output: z4.record(z4.string(), z4.unknown()),
|
|
551
|
-
artifactRefs: z4.array(ImmutableArtifactRefSchema).max(1e5)
|
|
552
|
-
}).strict();
|
|
553
|
-
var HarnessLifecycleEventSchema = z4.object({
|
|
554
|
-
sequence: z4.number().int().nonnegative(),
|
|
555
|
-
type: z4.enum(["created", "reset", "action", "observation", "terminal", "failure", "collected", "destroyed"]),
|
|
556
|
-
payloadHash: ReleaseHashSchema,
|
|
557
|
-
metadata: MetadataSchema
|
|
558
|
-
}).strict();
|
|
559
|
-
var HarnessTraceSchema = z4.object({
|
|
560
|
-
schemaVersion: z4.literal("openpond.harnessTrace.v1"),
|
|
561
|
-
manifest: ImmutableReleaseRefSchema,
|
|
562
|
-
taskId: ReleaseIdSchema,
|
|
563
|
-
seed: z4.string().trim().min(1).max(500),
|
|
564
|
-
events: z4.array(HarnessLifecycleEventSchema).max(1e6),
|
|
565
|
-
actions: z4.array(ModelActionSchema).max(1e5),
|
|
566
|
-
observations: z4.array(ToolObservationSchema).max(1e5),
|
|
567
|
-
terminal: z4.boolean(),
|
|
568
|
-
failureClass: FailureClassSchema.nullable(),
|
|
569
|
-
output: z4.record(z4.string(), z4.unknown()),
|
|
570
|
-
contentHash: ReleaseHashSchema
|
|
571
|
-
}).strict();
|
|
572
|
-
|
|
573
|
-
// ../harness/dist/harness-improvements.js
|
|
574
|
-
import { z as z6 } from "zod";
|
|
575
|
-
|
|
576
|
-
// ../harness/dist/harness-workspaces.js
|
|
577
|
-
import { z as z5 } from "zod";
|
|
578
|
-
var MetadataSchema2 = z5.record(z5.string(), z5.unknown()).default({});
|
|
579
|
-
var RevisionSchema = z5.number().int().nonnegative();
|
|
580
|
-
var BoundedTextSchema2 = z5.string().trim().min(1).max(1e5);
|
|
581
|
-
var HarnessOwnerScopeSchema = z5.object({
|
|
582
|
-
kind: z5.enum(["personal", "team"]),
|
|
583
|
-
id: ReleaseIdSchema
|
|
584
|
-
}).strict();
|
|
585
|
-
var HarnessCurrentChannelSchema = z5.object({
|
|
586
|
-
name: ReleaseIdSchema,
|
|
587
|
-
release: ImmutableReleaseRefSchema.nullable(),
|
|
588
|
-
revision: RevisionSchema
|
|
589
|
-
}).strict();
|
|
590
|
-
var HarnessWorkspaceSchema = z5.object({
|
|
591
|
-
schemaVersion: z5.literal("openpond.harnessWorkspace.v1"),
|
|
592
|
-
id: ReleaseIdSchema,
|
|
593
|
-
ownerScope: HarnessOwnerScopeSchema,
|
|
594
|
-
name: z5.string().trim().min(1).max(240),
|
|
595
|
-
location: z5.enum(["local", "hosted"]),
|
|
596
|
-
sourceRevision: z5.string().trim().min(1).max(500),
|
|
597
|
-
revision: RevisionSchema,
|
|
598
|
-
dirty: z5.boolean(),
|
|
599
|
-
currentChannel: HarnessCurrentChannelSchema,
|
|
600
|
-
createdAt: ReleaseTimestampSchema,
|
|
601
|
-
updatedAt: ReleaseTimestampSchema,
|
|
602
|
-
metadata: MetadataSchema2
|
|
603
|
-
}).strict();
|
|
604
|
-
var HarnessImprovementRouteSchema = z5.enum([
|
|
605
|
-
"runtime",
|
|
606
|
-
"memory",
|
|
607
|
-
"prompt",
|
|
608
|
-
"skill",
|
|
609
|
-
"agent",
|
|
610
|
-
"product",
|
|
611
|
-
"taskset",
|
|
612
|
-
"training"
|
|
613
|
-
]);
|
|
614
|
-
var HarnessChangeEffectSchema = z5.enum([
|
|
615
|
-
"text_instruction",
|
|
616
|
-
"memory",
|
|
617
|
-
"dependency_selection",
|
|
618
|
-
"executable_code",
|
|
619
|
-
"business_logic",
|
|
620
|
-
"financial_logic",
|
|
621
|
-
"permission",
|
|
622
|
-
"connected_app",
|
|
623
|
-
"publication",
|
|
624
|
-
"deployment",
|
|
625
|
-
"training",
|
|
626
|
-
"model_binding",
|
|
627
|
-
"team_or_global"
|
|
628
|
-
]);
|
|
629
|
-
var HarnessOverlayEditSchema = z5.object({
|
|
630
|
-
id: ReleaseIdSchema,
|
|
631
|
-
route: HarnessImprovementRouteSchema,
|
|
632
|
-
operation: z5.enum(["create", "update", "delete"]),
|
|
633
|
-
target: z5.string().trim().min(1).max(2e3),
|
|
634
|
-
summary: z5.string().trim().min(1).max(2e3),
|
|
635
|
-
content: z5.string().max(1e6).nullable(),
|
|
636
|
-
contentHash: ReleaseHashSchema.nullable(),
|
|
637
|
-
effects: z5.array(HarnessChangeEffectSchema).min(1).max(20)
|
|
638
|
-
}).strict().superRefine((edit, context) => {
|
|
639
|
-
if (edit.operation === "delete") {
|
|
640
|
-
if (edit.content !== null || edit.contentHash !== null) {
|
|
641
|
-
context.addIssue({
|
|
642
|
-
code: "custom",
|
|
643
|
-
message: "delete edits cannot include replacement content",
|
|
644
|
-
path: ["content"]
|
|
645
|
-
});
|
|
646
|
-
}
|
|
647
|
-
return;
|
|
648
|
-
}
|
|
649
|
-
if (edit.content === null || edit.contentHash === null) {
|
|
650
|
-
context.addIssue({
|
|
651
|
-
code: "custom",
|
|
652
|
-
message: "create and update edits require content and contentHash",
|
|
653
|
-
path: ["content"]
|
|
654
|
-
});
|
|
655
|
-
return;
|
|
656
|
-
}
|
|
657
|
-
const expected = contentHash(edit.content);
|
|
658
|
-
if (edit.contentHash !== expected) {
|
|
659
|
-
context.addIssue({
|
|
660
|
-
code: "custom",
|
|
661
|
-
message: `edit contentHash is ${edit.contentHash}; expected ${expected}`,
|
|
662
|
-
path: ["contentHash"]
|
|
663
|
-
});
|
|
664
|
-
}
|
|
665
|
-
});
|
|
666
|
-
var HarnessWorkspaceRevisionRefSchema = z5.object({
|
|
667
|
-
workspaceId: ReleaseIdSchema,
|
|
668
|
-
revision: RevisionSchema,
|
|
669
|
-
sourceRevision: z5.string().trim().min(1).max(500),
|
|
670
|
-
channelRevision: RevisionSchema
|
|
671
|
-
}).strict();
|
|
672
|
-
var HarnessOverlaySnapshotRefSchema = z5.object({
|
|
673
|
-
id: ReleaseIdSchema,
|
|
674
|
-
revision: RevisionSchema,
|
|
675
|
-
contentHash: ReleaseHashSchema
|
|
676
|
-
}).strict();
|
|
677
|
-
var HarnessTurnSnapshotSchema = z5.object({
|
|
678
|
-
schemaVersion: z5.literal("openpond.harnessTurnSnapshot.v1"),
|
|
679
|
-
workspaceId: ReleaseIdSchema,
|
|
680
|
-
workspaceRevision: RevisionSchema,
|
|
681
|
-
sourceRevision: z5.string().trim().min(1).max(500),
|
|
682
|
-
channelName: ReleaseIdSchema,
|
|
683
|
-
channelRevision: RevisionSchema,
|
|
684
|
-
harnessRelease: ImmutableReleaseRefSchema,
|
|
685
|
-
toolCatalogHash: ReleaseHashSchema.nullable().optional(),
|
|
686
|
-
overlay: HarnessOverlaySnapshotRefSchema.nullable().optional().default(null)
|
|
687
|
-
}).strict();
|
|
688
|
-
var HarnessRunOverlayContentSchema = z5.object({
|
|
689
|
-
schemaVersion: z5.literal("openpond.harnessRunOverlay.v1"),
|
|
690
|
-
id: ReleaseIdSchema,
|
|
691
|
-
runId: ReleaseIdSchema,
|
|
692
|
-
baseHarnessRelease: ImmutableReleaseRefSchema,
|
|
693
|
-
workspace: HarnessWorkspaceRevisionRefSchema,
|
|
694
|
-
revision: RevisionSchema,
|
|
695
|
-
status: z5.enum(["active", "frozen", "abandoned"]),
|
|
696
|
-
edits: z5.array(HarnessOverlayEditSchema).max(1e3),
|
|
697
|
-
createdAt: ReleaseTimestampSchema,
|
|
698
|
-
updatedAt: ReleaseTimestampSchema,
|
|
699
|
-
metadata: MetadataSchema2
|
|
700
|
-
}).strict();
|
|
701
|
-
var HarnessRunOverlaySchema = HarnessRunOverlayContentSchema.extend({
|
|
702
|
-
contentHash: ReleaseHashSchema
|
|
703
|
-
}).strict();
|
|
704
|
-
var HarnessProposalEvidenceRefSchema = z5.object({
|
|
705
|
-
kind: z5.enum([
|
|
706
|
-
"tool_event",
|
|
707
|
-
"recovery",
|
|
708
|
-
"validation",
|
|
709
|
-
"user_turn",
|
|
710
|
-
"work_output",
|
|
711
|
-
"work_receipt"
|
|
712
|
-
]),
|
|
713
|
-
id: ReleaseIdSchema,
|
|
714
|
-
contentHash: ReleaseHashSchema.nullable()
|
|
715
|
-
}).strict();
|
|
716
|
-
var HarnessValidationPlanItemSchema = z5.object({
|
|
717
|
-
id: ReleaseIdSchema,
|
|
718
|
-
kind: z5.enum([
|
|
719
|
-
"dependency",
|
|
720
|
-
"schema",
|
|
721
|
-
"package",
|
|
722
|
-
"file_render",
|
|
723
|
-
"skill",
|
|
724
|
-
"prompt",
|
|
725
|
-
"business_formula",
|
|
726
|
-
"targeted_evaluation",
|
|
727
|
-
"observed_recovery",
|
|
728
|
-
"memory",
|
|
729
|
-
"component_activation"
|
|
730
|
-
]),
|
|
731
|
-
description: BoundedTextSchema2,
|
|
732
|
-
required: z5.boolean()
|
|
733
|
-
}).strict();
|
|
734
|
-
var HarnessImprovementProposalContentSchema = z5.object({
|
|
735
|
-
schemaVersion: z5.literal("openpond.harnessImprovementProposal.v1"),
|
|
736
|
-
id: ReleaseIdSchema,
|
|
737
|
-
overlay: HarnessOverlaySnapshotRefSchema,
|
|
738
|
-
baseHarnessRelease: ImmutableReleaseRefSchema,
|
|
739
|
-
expectedWorkspace: HarnessWorkspaceRevisionRefSchema,
|
|
740
|
-
requestedScope: z5.enum(["personal", "team", "global"]),
|
|
741
|
-
route: HarnessImprovementRouteSchema,
|
|
742
|
-
risk: z5.enum(["low", "review", "restricted"]),
|
|
743
|
-
effects: z5.array(HarnessChangeEffectSchema).min(1).max(20),
|
|
744
|
-
evidence: z5.array(HarnessProposalEvidenceRefSchema).min(1).max(1e3),
|
|
745
|
-
edits: z5.array(HarnessOverlayEditSchema).min(1).max(1e3),
|
|
746
|
-
validationPlan: z5.array(HarnessValidationPlanItemSchema).min(1).max(100),
|
|
747
|
-
expectedOutcome: BoundedTextSchema2,
|
|
748
|
-
createdAt: ReleaseTimestampSchema,
|
|
749
|
-
metadata: MetadataSchema2
|
|
750
|
-
}).strict().superRefine((proposal, context) => {
|
|
751
|
-
const declaredEffects = new Set(proposal.effects);
|
|
752
|
-
for (const [index, edit] of proposal.edits.entries()) {
|
|
753
|
-
if (edit.route !== proposal.route) {
|
|
754
|
-
context.addIssue({
|
|
755
|
-
code: "custom",
|
|
756
|
-
message: "every edit route must match the proposal route",
|
|
757
|
-
path: ["edits", index, "route"]
|
|
758
|
-
});
|
|
759
|
-
}
|
|
760
|
-
for (const effect of edit.effects) {
|
|
761
|
-
if (!declaredEffects.has(effect)) {
|
|
762
|
-
context.addIssue({
|
|
763
|
-
code: "custom",
|
|
764
|
-
message: `edit effect ${effect} is missing from proposal effects`,
|
|
765
|
-
path: ["edits", index, "effects"]
|
|
766
|
-
});
|
|
767
|
-
}
|
|
768
|
-
}
|
|
769
|
-
}
|
|
770
|
-
if (new Set(proposal.validationPlan.map((item) => item.id)).size !== proposal.validationPlan.length) {
|
|
771
|
-
context.addIssue({
|
|
772
|
-
code: "custom",
|
|
773
|
-
message: "validation plan ids must be unique",
|
|
774
|
-
path: ["validationPlan"]
|
|
775
|
-
});
|
|
776
|
-
}
|
|
777
|
-
});
|
|
778
|
-
var HarnessImprovementProposalSchema = HarnessImprovementProposalContentSchema.extend({
|
|
779
|
-
contentHash: ReleaseHashSchema
|
|
780
|
-
}).strict();
|
|
781
|
-
var HarnessTargetedValidationReceiptContentSchema = z5.object({
|
|
782
|
-
schemaVersion: z5.literal("openpond.harnessTargetedValidationReceipt.v1"),
|
|
783
|
-
id: ReleaseIdSchema,
|
|
784
|
-
proposal: ImmutableReleaseRefSchema,
|
|
785
|
-
validationId: ReleaseIdSchema,
|
|
786
|
-
kind: HarnessValidationPlanItemSchema.shape.kind,
|
|
787
|
-
status: z5.enum(["passed", "failed", "blocked", "skipped"]),
|
|
788
|
-
summary: BoundedTextSchema2,
|
|
789
|
-
evidenceRefs: z5.array(HarnessProposalEvidenceRefSchema).max(1e3),
|
|
790
|
-
createdAt: ReleaseTimestampSchema,
|
|
791
|
-
metadata: MetadataSchema2
|
|
792
|
-
}).strict();
|
|
793
|
-
var HarnessTargetedValidationReceiptSchema = HarnessTargetedValidationReceiptContentSchema.extend({
|
|
794
|
-
contentHash: ReleaseHashSchema
|
|
795
|
-
}).strict();
|
|
796
|
-
var HarnessAdvanceDecisionSchema = z5.enum([
|
|
797
|
-
"advanced",
|
|
798
|
-
"retained",
|
|
799
|
-
"conflict",
|
|
800
|
-
"rolled_back"
|
|
801
|
-
]);
|
|
802
|
-
var HarnessAdvanceReceiptContentSchema = z5.object({
|
|
803
|
-
schemaVersion: z5.literal("openpond.harnessAdvanceReceipt.v1"),
|
|
804
|
-
id: ReleaseIdSchema,
|
|
805
|
-
workspaceId: ReleaseIdSchema,
|
|
806
|
-
ownerScope: HarnessOwnerScopeSchema,
|
|
807
|
-
proposal: ImmutableReleaseRefSchema.nullable(),
|
|
808
|
-
expectedWorkspaceRevision: RevisionSchema,
|
|
809
|
-
observedWorkspaceRevision: RevisionSchema,
|
|
810
|
-
previousChannelRevision: RevisionSchema,
|
|
811
|
-
nextChannelRevision: RevisionSchema,
|
|
812
|
-
previousRelease: ImmutableReleaseRefSchema.nullable(),
|
|
813
|
-
nextRelease: ImmutableReleaseRefSchema.nullable(),
|
|
814
|
-
validationReceipts: z5.array(ImmutableReleaseRefSchema).max(100),
|
|
815
|
-
decision: HarnessAdvanceDecisionSchema,
|
|
816
|
-
reason: BoundedTextSchema2,
|
|
817
|
-
rollbackOf: ImmutableReleaseRefSchema.nullable(),
|
|
818
|
-
createdAt: ReleaseTimestampSchema,
|
|
819
|
-
metadata: MetadataSchema2
|
|
820
|
-
}).strict().superRefine((receipt, context) => {
|
|
821
|
-
const changed = receipt.nextChannelRevision === receipt.previousChannelRevision + 1;
|
|
822
|
-
if (["advanced", "rolled_back"].includes(receipt.decision) !== changed) {
|
|
823
|
-
context.addIssue({
|
|
824
|
-
code: "custom",
|
|
825
|
-
message: "only successful advancement or rollback increments the channel revision",
|
|
826
|
-
path: ["nextChannelRevision"]
|
|
827
|
-
});
|
|
828
|
-
}
|
|
829
|
-
if (receipt.decision === "rolled_back" && receipt.rollbackOf === null) {
|
|
830
|
-
context.addIssue({
|
|
831
|
-
code: "custom",
|
|
832
|
-
message: "rollback receipts require rollbackOf",
|
|
833
|
-
path: ["rollbackOf"]
|
|
834
|
-
});
|
|
835
|
-
}
|
|
836
|
-
if (receipt.decision !== "rolled_back" && receipt.rollbackOf !== null) {
|
|
837
|
-
context.addIssue({
|
|
838
|
-
code: "custom",
|
|
839
|
-
message: "rollbackOf is only valid for rollback receipts",
|
|
840
|
-
path: ["rollbackOf"]
|
|
841
|
-
});
|
|
842
|
-
}
|
|
843
|
-
});
|
|
844
|
-
var HarnessAdvanceReceiptSchema = HarnessAdvanceReceiptContentSchema.extend({
|
|
845
|
-
contentHash: ReleaseHashSchema
|
|
846
|
-
}).strict();
|
|
847
|
-
var HarnessOverlayMergeReceiptContentSchema = z5.object({
|
|
848
|
-
schemaVersion: z5.literal("openpond.harnessOverlayMergeReceipt.v1"),
|
|
849
|
-
id: ReleaseIdSchema,
|
|
850
|
-
workspaceId: ReleaseIdSchema,
|
|
851
|
-
baseHarnessRelease: ImmutableReleaseRefSchema,
|
|
852
|
-
leftOverlay: HarnessOverlaySnapshotRefSchema,
|
|
853
|
-
rightOverlay: HarnessOverlaySnapshotRefSchema,
|
|
854
|
-
decision: z5.enum(["merged", "conflict"]),
|
|
855
|
-
mergedOverlay: HarnessOverlaySnapshotRefSchema.nullable(),
|
|
856
|
-
conflictTargets: z5.array(z5.string().trim().min(1).max(2e3)).max(1e3),
|
|
857
|
-
requiresRevalidation: z5.literal(true),
|
|
858
|
-
createdAt: ReleaseTimestampSchema,
|
|
859
|
-
metadata: MetadataSchema2
|
|
860
|
-
}).strict().superRefine((receipt, context) => {
|
|
861
|
-
if (receipt.decision === "merged" !== (receipt.mergedOverlay !== null)) {
|
|
862
|
-
context.addIssue({
|
|
863
|
-
code: "custom",
|
|
864
|
-
message: "merged decisions require a merged overlay; conflicts cannot provide one",
|
|
865
|
-
path: ["mergedOverlay"]
|
|
866
|
-
});
|
|
867
|
-
}
|
|
868
|
-
if (receipt.decision === "conflict" !== receipt.conflictTargets.length > 0) {
|
|
869
|
-
context.addIssue({
|
|
870
|
-
code: "custom",
|
|
871
|
-
message: "conflict decisions require conflict targets and merged decisions cannot include them",
|
|
872
|
-
path: ["conflictTargets"]
|
|
873
|
-
});
|
|
874
|
-
}
|
|
875
|
-
});
|
|
876
|
-
var HarnessOverlayMergeReceiptSchema = HarnessOverlayMergeReceiptContentSchema.extend({
|
|
877
|
-
contentHash: ReleaseHashSchema
|
|
878
|
-
}).strict();
|
|
879
|
-
|
|
880
|
-
// ../harness/dist/harness-improvements.js
|
|
881
|
-
var BoundedTextSchema3 = z6.string().trim().min(1).max(1e5);
|
|
882
|
-
var MetadataSchema3 = z6.record(z6.string(), z6.unknown()).default({});
|
|
883
|
-
var ImprovementSafeBoundaryKindSchema = z6.enum([
|
|
884
|
-
"completed_tool_batch",
|
|
885
|
-
"before_model_step",
|
|
886
|
-
"turn_completed",
|
|
887
|
-
"turn_paused"
|
|
888
|
-
]);
|
|
889
|
-
var ImprovementSafeBoundarySchema = z6.object({
|
|
890
|
-
kind: ImprovementSafeBoundaryKindSchema,
|
|
891
|
-
eventSequence: z6.number().int().nonnegative(),
|
|
892
|
-
occurredAt: ReleaseTimestampSchema
|
|
893
|
-
}).strict();
|
|
894
|
-
var ImprovementEventRefSchema = z6.object({
|
|
895
|
-
id: ReleaseIdSchema,
|
|
896
|
-
sequence: z6.number().int().nonnegative().nullable(),
|
|
897
|
-
contentHash: ReleaseHashSchema
|
|
898
|
-
}).strict();
|
|
899
|
-
var ImprovementObservationKindSchema = z6.enum([
|
|
900
|
-
"tool_failure",
|
|
901
|
-
"retry",
|
|
902
|
-
"recovery",
|
|
903
|
-
"validation",
|
|
904
|
-
"user_turn",
|
|
905
|
-
"reusable_success",
|
|
906
|
-
"completion_detour"
|
|
907
|
-
]);
|
|
908
|
-
var ImprovementObservationStateSchema = z6.enum([
|
|
909
|
-
"open",
|
|
910
|
-
"recovered",
|
|
911
|
-
"terminal"
|
|
912
|
-
]);
|
|
913
|
-
var ImprovementToolIdentitySchema = z6.object({
|
|
914
|
-
name: z6.string().trim().min(1).max(500),
|
|
915
|
-
invocationKey: ReleaseHashSchema
|
|
916
|
-
}).strict();
|
|
917
|
-
var ImprovementObservationContentSchema = z6.object({
|
|
918
|
-
schemaVersion: z6.literal("openpond.improvementObservation.v1"),
|
|
919
|
-
id: ReleaseIdSchema,
|
|
920
|
-
runRef: ReleaseIdSchema,
|
|
921
|
-
turnId: ReleaseIdSchema,
|
|
922
|
-
harnessRelease: ImmutableReleaseRefSchema,
|
|
923
|
-
overlay: HarnessOverlaySnapshotRefSchema.nullable(),
|
|
924
|
-
eventRefs: z6.array(ImprovementEventRefSchema).min(1).max(100),
|
|
925
|
-
kind: ImprovementObservationKindSchema,
|
|
926
|
-
state: ImprovementObservationStateSchema,
|
|
927
|
-
tool: ImprovementToolIdentitySchema.nullable(),
|
|
928
|
-
deterministicClass: z6.string().trim().min(1).max(500).nullable(),
|
|
929
|
-
summary: BoundedTextSchema3,
|
|
930
|
-
createdAt: ReleaseTimestampSchema,
|
|
931
|
-
metadata: MetadataSchema3
|
|
932
|
-
}).strict().superRefine((observation, context) => {
|
|
933
|
-
if (new Set(observation.eventRefs.map((reference) => reference.id)).size !== observation.eventRefs.length) {
|
|
934
|
-
context.addIssue({
|
|
935
|
-
code: "custom",
|
|
936
|
-
message: "observation event refs must be unique",
|
|
937
|
-
path: ["eventRefs"]
|
|
938
|
-
});
|
|
939
|
-
}
|
|
940
|
-
if (["tool_failure", "retry", "recovery", "completion_detour"].includes(observation.kind) && observation.tool === null) {
|
|
941
|
-
context.addIssue({
|
|
942
|
-
code: "custom",
|
|
943
|
-
message: `${observation.kind} observations require a tool identity`,
|
|
944
|
-
path: ["tool"]
|
|
945
|
-
});
|
|
946
|
-
}
|
|
947
|
-
});
|
|
948
|
-
var ImprovementObservationSchema = ImprovementObservationContentSchema.extend({
|
|
949
|
-
contentHash: ReleaseHashSchema
|
|
950
|
-
}).strict();
|
|
951
|
-
var RefinementTriggerPolicySchema = z6.object({
|
|
952
|
-
schemaVersion: z6.literal("openpond.refinementTriggerPolicy.v1"),
|
|
953
|
-
maxEstimatedCostUsd: z6.number().finite().nonnegative(),
|
|
954
|
-
cooldownMs: z6.number().int().nonnegative(),
|
|
955
|
-
maxPendingPlans: z6.number().int().min(1).max(100),
|
|
956
|
-
maxEvidenceEvents: z6.number().int().min(1).max(1e3),
|
|
957
|
-
maxProposalEdits: z6.number().int().min(1).max(1e3),
|
|
958
|
-
maxProposalBytes: z6.number().int().min(1).max(1e7)
|
|
959
|
-
}).strict();
|
|
960
|
-
var RefinementTriggerDecisionKindSchema = z6.enum([
|
|
961
|
-
"no_action",
|
|
962
|
-
"route_deterministically",
|
|
963
|
-
"queue_refiner"
|
|
964
|
-
]);
|
|
965
|
-
var RefinementTriggerDecisionContentSchema = z6.object({
|
|
966
|
-
schemaVersion: z6.literal("openpond.refinementTriggerDecision.v1"),
|
|
967
|
-
id: ReleaseIdSchema,
|
|
968
|
-
runRef: ReleaseIdSchema,
|
|
969
|
-
turnId: ReleaseIdSchema,
|
|
970
|
-
harnessRelease: ImmutableReleaseRefSchema,
|
|
971
|
-
overlay: HarnessOverlaySnapshotRefSchema.nullable(),
|
|
972
|
-
observations: z6.array(ImmutableReleaseRefSchema).max(100),
|
|
973
|
-
decision: RefinementTriggerDecisionKindSchema,
|
|
974
|
-
deterministicRoute: HarnessImprovementRouteSchema.nullable(),
|
|
975
|
-
suggestedRoutes: z6.array(HarnessImprovementRouteSchema).max(8),
|
|
976
|
-
reason: BoundedTextSchema3,
|
|
977
|
-
deduplicationKey: ReleaseHashSchema,
|
|
978
|
-
policy: RefinementTriggerPolicySchema,
|
|
979
|
-
estimatedMaxCostUsd: z6.number().finite().nonnegative(),
|
|
980
|
-
pendingPlanCount: z6.number().int().nonnegative(),
|
|
981
|
-
boundary: ImprovementSafeBoundarySchema,
|
|
982
|
-
cooldownUntil: ReleaseTimestampSchema.nullable(),
|
|
983
|
-
createdAt: ReleaseTimestampSchema,
|
|
984
|
-
metadata: MetadataSchema3
|
|
985
|
-
}).strict().superRefine((trigger, context) => {
|
|
986
|
-
if (trigger.estimatedMaxCostUsd > trigger.policy.maxEstimatedCostUsd) {
|
|
987
|
-
context.addIssue({
|
|
988
|
-
code: "custom",
|
|
989
|
-
message: "estimated Refiner cost exceeds the trigger policy budget",
|
|
990
|
-
path: ["estimatedMaxCostUsd"]
|
|
991
|
-
});
|
|
992
|
-
}
|
|
993
|
-
if (trigger.pendingPlanCount > trigger.policy.maxPendingPlans) {
|
|
994
|
-
context.addIssue({
|
|
995
|
-
code: "custom",
|
|
996
|
-
message: "pending plan count exceeds the trigger policy limit",
|
|
997
|
-
path: ["pendingPlanCount"]
|
|
998
|
-
});
|
|
999
|
-
}
|
|
1000
|
-
if (trigger.observations.length > trigger.policy.maxEvidenceEvents) {
|
|
1001
|
-
context.addIssue({
|
|
1002
|
-
code: "custom",
|
|
1003
|
-
message: "trigger observations exceed the evidence budget",
|
|
1004
|
-
path: ["observations"]
|
|
1005
|
-
});
|
|
1006
|
-
}
|
|
1007
|
-
if (trigger.decision === "route_deterministically" && trigger.deterministicRoute === null) {
|
|
1008
|
-
context.addIssue({
|
|
1009
|
-
code: "custom",
|
|
1010
|
-
message: "deterministic decisions require a route",
|
|
1011
|
-
path: ["deterministicRoute"]
|
|
1012
|
-
});
|
|
1013
|
-
}
|
|
1014
|
-
if (trigger.decision !== "route_deterministically" && trigger.deterministicRoute !== null) {
|
|
1015
|
-
context.addIssue({
|
|
1016
|
-
code: "custom",
|
|
1017
|
-
message: "only deterministic decisions may declare a deterministic route",
|
|
1018
|
-
path: ["deterministicRoute"]
|
|
1019
|
-
});
|
|
1020
|
-
}
|
|
1021
|
-
if (trigger.decision === "no_action" && trigger.suggestedRoutes.length > 0) {
|
|
1022
|
-
context.addIssue({
|
|
1023
|
-
code: "custom",
|
|
1024
|
-
message: "no-action decisions cannot suggest routes",
|
|
1025
|
-
path: ["suggestedRoutes"]
|
|
1026
|
-
});
|
|
1027
|
-
}
|
|
1028
|
-
if (trigger.decision !== "no_action" && trigger.observations.length === 0) {
|
|
1029
|
-
context.addIssue({
|
|
1030
|
-
code: "custom",
|
|
1031
|
-
message: "actionable trigger decisions require observations",
|
|
1032
|
-
path: ["observations"]
|
|
1033
|
-
});
|
|
1034
|
-
}
|
|
1035
|
-
});
|
|
1036
|
-
var RefinementTriggerDecisionSchema = RefinementTriggerDecisionContentSchema.extend({
|
|
1037
|
-
contentHash: ReleaseHashSchema
|
|
1038
|
-
}).strict();
|
|
1039
|
-
var ImprovementRouteAuthoritySchema = z6.enum([
|
|
1040
|
-
"runtime_service",
|
|
1041
|
-
"refiner_model",
|
|
1042
|
-
"human_review",
|
|
1043
|
-
"evaluation_system",
|
|
1044
|
-
"training_system"
|
|
1045
|
-
]);
|
|
1046
|
-
var ImprovementRouteDecisionContentSchema = z6.object({
|
|
1047
|
-
schemaVersion: z6.literal("openpond.improvementRouteDecision.v1"),
|
|
1048
|
-
id: ReleaseIdSchema,
|
|
1049
|
-
trigger: ImmutableReleaseRefSchema,
|
|
1050
|
-
route: HarnessImprovementRouteSchema,
|
|
1051
|
-
authority: ImprovementRouteAuthoritySchema,
|
|
1052
|
-
automatic: z6.boolean(),
|
|
1053
|
-
reason: BoundedTextSchema3,
|
|
1054
|
-
createdAt: ReleaseTimestampSchema,
|
|
1055
|
-
metadata: MetadataSchema3
|
|
1056
|
-
}).strict().superRefine((decision, context) => {
|
|
1057
|
-
if (decision.automatic && ["human_review", "evaluation_system", "training_system"].includes(decision.authority)) {
|
|
1058
|
-
context.addIssue({
|
|
1059
|
-
code: "custom",
|
|
1060
|
-
message: `${decision.authority} routes cannot be marked automatic`,
|
|
1061
|
-
path: ["automatic"]
|
|
1062
|
-
});
|
|
1063
|
-
}
|
|
1064
|
-
if (decision.route === "training" && decision.automatic && decision.authority !== "training_system") {
|
|
1065
|
-
context.addIssue({
|
|
1066
|
-
code: "custom",
|
|
1067
|
-
message: "automatic training routes require training-system authority",
|
|
1068
|
-
path: ["authority"]
|
|
1069
|
-
});
|
|
1070
|
-
}
|
|
1071
|
-
});
|
|
1072
|
-
var ImprovementRouteDecisionSchema = ImprovementRouteDecisionContentSchema.extend({
|
|
1073
|
-
contentHash: ReleaseHashSchema
|
|
1074
|
-
}).strict();
|
|
1075
|
-
var HarnessRefinerOutcomeContentSchema = z6.object({
|
|
1076
|
-
schemaVersion: z6.literal("openpond.harnessRefinerOutcome.v1"),
|
|
1077
|
-
id: ReleaseIdSchema,
|
|
1078
|
-
trigger: ImmutableReleaseRefSchema,
|
|
1079
|
-
decision: z6.enum(["no_action", "proposed"]),
|
|
1080
|
-
proposal: ImmutableReleaseRefSchema.nullable(),
|
|
1081
|
-
reason: BoundedTextSchema3,
|
|
1082
|
-
evidenceRefs: z6.array(ImmutableReleaseRefSchema).max(100),
|
|
1083
|
-
estimatedCostUsd: z6.number().finite().nonnegative(),
|
|
1084
|
-
createdAt: ReleaseTimestampSchema,
|
|
1085
|
-
metadata: MetadataSchema3
|
|
1086
|
-
}).strict().superRefine((outcome, context) => {
|
|
1087
|
-
if (outcome.decision === "proposed" !== (outcome.proposal !== null)) {
|
|
1088
|
-
context.addIssue({
|
|
1089
|
-
code: "custom",
|
|
1090
|
-
message: "proposed Refiner outcomes require a proposal; no-action outcomes cannot include one",
|
|
1091
|
-
path: ["proposal"]
|
|
1092
|
-
});
|
|
1093
|
-
}
|
|
1094
|
-
});
|
|
1095
|
-
var HarnessRefinerOutcomeSchema = HarnessRefinerOutcomeContentSchema.extend({
|
|
1096
|
-
contentHash: ReleaseHashSchema
|
|
1097
|
-
}).strict();
|
|
1098
|
-
var ImprovementApplyDecisionSchema = z6.enum([
|
|
1099
|
-
"applied",
|
|
1100
|
-
"retained",
|
|
1101
|
-
"declined",
|
|
1102
|
-
"conflict",
|
|
1103
|
-
"rolled_back"
|
|
1104
|
-
]);
|
|
1105
|
-
var ImprovementApplyReceiptContentSchema = z6.object({
|
|
1106
|
-
schemaVersion: z6.literal("openpond.improvementApplyReceipt.v1"),
|
|
1107
|
-
id: ReleaseIdSchema,
|
|
1108
|
-
proposal: ImmutableReleaseRefSchema,
|
|
1109
|
-
beforeOverlay: HarnessOverlaySnapshotRefSchema,
|
|
1110
|
-
afterOverlay: HarnessOverlaySnapshotRefSchema.nullable(),
|
|
1111
|
-
decision: ImprovementApplyDecisionSchema,
|
|
1112
|
-
boundary: ImprovementSafeBoundarySchema,
|
|
1113
|
-
validationRefs: z6.array(ImmutableReleaseRefSchema).max(100),
|
|
1114
|
-
outcomeEvidenceRefs: z6.array(ImprovementEventRefSchema).max(1e3),
|
|
1115
|
-
rollbackOf: ImmutableReleaseRefSchema.nullable(),
|
|
1116
|
-
createdAt: ReleaseTimestampSchema,
|
|
1117
|
-
metadata: MetadataSchema3
|
|
1118
|
-
}).strict().superRefine((receipt, context) => {
|
|
1119
|
-
if (receipt.decision === "applied" !== (receipt.afterOverlay !== null)) {
|
|
1120
|
-
context.addIssue({
|
|
1121
|
-
code: "custom",
|
|
1122
|
-
message: "applied receipts require an after-overlay; other decisions cannot include one",
|
|
1123
|
-
path: ["afterOverlay"]
|
|
1124
|
-
});
|
|
1125
|
-
}
|
|
1126
|
-
if (receipt.decision === "rolled_back" !== (receipt.rollbackOf !== null)) {
|
|
1127
|
-
context.addIssue({
|
|
1128
|
-
code: "custom",
|
|
1129
|
-
message: "only rollback receipts require rollbackOf",
|
|
1130
|
-
path: ["rollbackOf"]
|
|
1131
|
-
});
|
|
1132
|
-
}
|
|
1133
|
-
});
|
|
1134
|
-
var ImprovementApplyReceiptSchema = ImprovementApplyReceiptContentSchema.extend({
|
|
1135
|
-
contentHash: ReleaseHashSchema
|
|
1136
|
-
}).strict();
|
|
1137
|
-
|
|
1138
|
-
// ../harness/dist/models.js
|
|
1139
|
-
import { z as z7 } from "zod";
|
|
1140
|
-
var ModelRefSchema = z7.object({
|
|
1141
|
-
provider: ReleaseIdSchema,
|
|
1142
|
-
model: ReleaseIdSchema,
|
|
1143
|
-
revision: z7.string().trim().min(1).max(500).nullable().default(null),
|
|
1144
|
-
artifactHash: ReleaseHashSchema.nullable().default(null),
|
|
1145
|
-
tokenizerRevision: z7.string().trim().min(1).max(500).nullable().default(null),
|
|
1146
|
-
chatTemplateHash: ReleaseHashSchema.nullable().default(null)
|
|
1147
|
-
}).strict();
|
|
1148
|
-
|
|
1149
|
-
// ../harness/dist/refiner.js
|
|
1150
|
-
import { z as z9 } from "zod";
|
|
1151
|
-
|
|
1152
|
-
// ../harness/dist/refiner-profiles.js
|
|
1153
|
-
import { z as z8 } from "zod";
|
|
1154
|
-
var RefinerProposalRouteSchema = z8.enum(["memory", "prompt", "skill", "agent"]);
|
|
1155
|
-
var RefinerExternalRouteSchema = z8.enum(["runtime", "product", "taskset", "training"]);
|
|
1156
|
-
var RefinerReviewInstructionSchema = z8.object({
|
|
1157
|
-
id: z8.string().trim().min(1).max(120).regex(/^[a-z0-9][a-z0-9._-]*$/),
|
|
1158
|
-
text: z8.string().trim().min(1).max(1e4)
|
|
1159
|
-
}).strict();
|
|
1160
|
-
var RefinerReviewProfileSchema = z8.object({
|
|
1161
|
-
schemaVersion: z8.literal("openpond.refinerReviewProfile.v1"),
|
|
1162
|
-
id: z8.string().trim().min(1).max(120).regex(/^[a-z0-9][a-z0-9._-]*$/),
|
|
1163
|
-
version: z8.string().trim().min(1).max(120),
|
|
1164
|
-
name: z8.string().trim().min(1).max(200),
|
|
1165
|
-
objective: z8.string().trim().min(1).max(1e4),
|
|
1166
|
-
instructions: z8.array(RefinerReviewInstructionSchema).max(100),
|
|
1167
|
-
allowedProposalRoutes: z8.array(RefinerProposalRouteSchema).max(4),
|
|
1168
|
-
allowedExternalRoutes: z8.array(RefinerExternalRouteSchema).max(4)
|
|
1169
|
-
}).strict().superRefine((profile, context) => {
|
|
1170
|
-
const instructionIds = profile.instructions.map((instruction) => instruction.id);
|
|
1171
|
-
if (new Set(instructionIds).size !== instructionIds.length) {
|
|
1172
|
-
context.addIssue({ code: "custom", message: "instruction IDs must be unique", path: ["instructions"] });
|
|
1173
|
-
}
|
|
1174
|
-
if (new Set(profile.allowedProposalRoutes).size !== profile.allowedProposalRoutes.length) {
|
|
1175
|
-
context.addIssue({ code: "custom", message: "proposal routes must be unique", path: ["allowedProposalRoutes"] });
|
|
1176
|
-
}
|
|
1177
|
-
if (new Set(profile.allowedExternalRoutes).size !== profile.allowedExternalRoutes.length) {
|
|
1178
|
-
context.addIssue({ code: "custom", message: "external routes must be unique", path: ["allowedExternalRoutes"] });
|
|
1179
|
-
}
|
|
1180
|
-
});
|
|
1181
|
-
var RefinerReleaseSchema = z8.object({
|
|
1182
|
-
schemaVersion: z8.literal("openpond.refinerRelease.v1"),
|
|
1183
|
-
id: z8.string().trim().min(1).max(240),
|
|
1184
|
-
coreVersion: z8.string().trim().min(1).max(120),
|
|
1185
|
-
coreHash: ReleaseHashSchema,
|
|
1186
|
-
profile: RefinerReviewProfileSchema,
|
|
1187
|
-
profileHash: ReleaseHashSchema,
|
|
1188
|
-
composedPromptHash: ReleaseHashSchema,
|
|
1189
|
-
createdAt: ReleaseTimestampSchema,
|
|
1190
|
-
contentHash: ReleaseHashSchema
|
|
1191
|
-
}).strict();
|
|
1192
|
-
var RefinerBindingSchema = z8.object({
|
|
1193
|
-
schemaVersion: z8.literal("openpond.refinerBinding.v1"),
|
|
1194
|
-
channel: z8.literal("active"),
|
|
1195
|
-
revision: z8.number().int().nonnegative(),
|
|
1196
|
-
release: ImmutableReleaseRefSchema,
|
|
1197
|
-
updatedAt: ReleaseTimestampSchema
|
|
1198
|
-
}).strict();
|
|
1199
|
-
var RefinerTransitionReceiptSchema = z8.object({
|
|
1200
|
-
schemaVersion: z8.literal("openpond.refinerTransitionReceipt.v1"),
|
|
1201
|
-
id: z8.string().trim().min(1).max(240),
|
|
1202
|
-
operation: z8.enum(["initialize", "update", "activate", "rollback"]),
|
|
1203
|
-
bindingChanged: z8.boolean(),
|
|
1204
|
-
previousRelease: ImmutableReleaseRefSchema.nullable(),
|
|
1205
|
-
nextRelease: ImmutableReleaseRefSchema,
|
|
1206
|
-
actor: z8.string().trim().min(1).max(240),
|
|
1207
|
-
reason: z8.string().trim().min(1).max(1e4),
|
|
1208
|
-
authoringSkillHash: ReleaseHashSchema.nullable(),
|
|
1209
|
-
validation: z8.object({ valid: z8.boolean(), messages: z8.array(z8.string().max(2e3)).max(100) }).strict(),
|
|
1210
|
-
createdAt: ReleaseTimestampSchema,
|
|
1211
|
-
contentHash: ReleaseHashSchema
|
|
1212
|
-
}).strict();
|
|
1213
|
-
|
|
1214
|
-
// ../harness/dist/refiner.js
|
|
1215
|
-
var RefinerNoActionDecisionSchema = z9.object({
|
|
1216
|
-
schemaVersion: z9.literal("openpond.localHarnessRefinerDecision.v1"),
|
|
1217
|
-
decision: z9.literal("no_action"),
|
|
1218
|
-
reason: z9.string().trim().min(1).max(1e4)
|
|
1219
|
-
}).strip();
|
|
1220
|
-
var RefinerExternalRouteDecisionSchema = z9.object({
|
|
1221
|
-
schemaVersion: z9.literal("openpond.localHarnessRefinerDecision.v1"),
|
|
1222
|
-
decision: z9.literal("route"),
|
|
1223
|
-
route: z9.enum(["runtime", "product", "taskset", "training"]),
|
|
1224
|
-
summary: z9.string().trim().min(1).max(2e3),
|
|
1225
|
-
expectedOutcome: z9.string().trim().min(1).max(1e4),
|
|
1226
|
-
reason: z9.string().trim().min(1).max(1e4)
|
|
1227
|
-
}).strip();
|
|
1228
|
-
var RefinerProposalDecisionSchema = z9.object({
|
|
1229
|
-
schemaVersion: z9.literal("openpond.localHarnessRefinerDecision.v1"),
|
|
1230
|
-
decision: z9.literal("propose"),
|
|
1231
|
-
route: z9.enum(["memory", "prompt", "skill", "agent"]),
|
|
1232
|
-
operation: z9.enum(["create", "update", "delete"]),
|
|
1233
|
-
target: z9.string().trim().min(1).max(2e3),
|
|
1234
|
-
summary: z9.string().trim().min(1).max(2e3),
|
|
1235
|
-
createContent: z9.string().min(1).max(2e4).nullable(),
|
|
1236
|
-
find: z9.string().min(1).max(8e3).nullable(),
|
|
1237
|
-
replace: z9.string().max(8e3).nullable(),
|
|
1238
|
-
expectedOutcome: z9.string().trim().min(1).max(1e4),
|
|
1239
|
-
reason: z9.string().trim().min(1).max(1e4)
|
|
1240
|
-
}).strip().superRefine((decision, context) => {
|
|
1241
|
-
if (decision.operation === "create" && (decision.createContent === null || decision.find !== null || decision.replace !== null)) {
|
|
1242
|
-
context.addIssue({
|
|
1243
|
-
code: "custom",
|
|
1244
|
-
message: "create proposals require createContent and null find/replace",
|
|
1245
|
-
path: ["createContent"]
|
|
1246
|
-
});
|
|
1247
|
-
}
|
|
1248
|
-
if (decision.operation === "update" && (decision.createContent !== null || decision.find === null || decision.replace === null)) {
|
|
1249
|
-
context.addIssue({
|
|
1250
|
-
code: "custom",
|
|
1251
|
-
message: "update proposals require one exact find/replace edit and null createContent",
|
|
1252
|
-
path: ["find"]
|
|
1253
|
-
});
|
|
1254
|
-
}
|
|
1255
|
-
if (decision.operation === "delete" && (decision.createContent !== null || decision.find !== null || decision.replace !== null)) {
|
|
1256
|
-
context.addIssue({
|
|
1257
|
-
code: "custom",
|
|
1258
|
-
message: "delete proposals require null createContent/find/replace",
|
|
1259
|
-
path: ["createContent"]
|
|
1260
|
-
});
|
|
1261
|
-
}
|
|
1262
|
-
});
|
|
1263
|
-
var LocalHarnessRefinerDecisionSchema = z9.discriminatedUnion("decision", [
|
|
1264
|
-
RefinerNoActionDecisionSchema,
|
|
1265
|
-
RefinerExternalRouteDecisionSchema,
|
|
1266
|
-
RefinerProposalDecisionSchema
|
|
1267
|
-
]);
|
|
1268
|
-
var LocalHarnessRefinerDecisionV1Schema = LocalHarnessRefinerDecisionSchema;
|
|
1269
|
-
var HarnessRefinerEvidenceBasisSchema = z9.object({
|
|
1270
|
-
kind: z9.enum(["single_deterministic", "recurrent_independent"]),
|
|
1271
|
-
supportingEvidenceIds: z9.array(z9.string().trim().min(1).max(2e3)).min(1).max(100),
|
|
1272
|
-
counterevidence: z9.array(z9.string().trim().min(1).max(2e3)).max(20)
|
|
1273
|
-
}).strict().superRefine((basis, context) => {
|
|
1274
|
-
if (new Set(basis.supportingEvidenceIds).size !== basis.supportingEvidenceIds.length) {
|
|
1275
|
-
context.addIssue({
|
|
1276
|
-
code: "custom",
|
|
1277
|
-
message: "supporting evidence IDs must be unique",
|
|
1278
|
-
path: ["supportingEvidenceIds"]
|
|
1279
|
-
});
|
|
1280
|
-
}
|
|
1281
|
-
if (basis.kind === "recurrent_independent" && basis.supportingEvidenceIds.length < 2) {
|
|
1282
|
-
context.addIssue({
|
|
1283
|
-
code: "custom",
|
|
1284
|
-
message: "recurrent independent evidence requires at least two supplied incidents",
|
|
1285
|
-
path: ["supportingEvidenceIds"]
|
|
1286
|
-
});
|
|
1287
|
-
}
|
|
1288
|
-
});
|
|
1289
|
-
var RefinerNoActionDecisionV2Schema = z9.object({
|
|
1290
|
-
schemaVersion: z9.literal("openpond.localHarnessRefinerDecision.v2"),
|
|
1291
|
-
decision: z9.literal("no_action"),
|
|
1292
|
-
reason: z9.string().trim().min(1).max(1e4)
|
|
1293
|
-
}).strict();
|
|
1294
|
-
var RefinerExternalRouteDecisionV2Schema = z9.object({
|
|
1295
|
-
schemaVersion: z9.literal("openpond.localHarnessRefinerDecision.v2"),
|
|
1296
|
-
decision: z9.literal("route"),
|
|
1297
|
-
route: z9.enum(["runtime", "product", "taskset", "training"]),
|
|
1298
|
-
summary: z9.string().trim().min(1).max(2e3),
|
|
1299
|
-
evidenceBasis: HarnessRefinerEvidenceBasisSchema,
|
|
1300
|
-
expectedOutcome: z9.string().trim().min(1).max(1e4),
|
|
1301
|
-
reason: z9.string().trim().min(1).max(1e4)
|
|
1302
|
-
}).strict();
|
|
1303
|
-
var RefinerProposalDecisionV2Schema = z9.object({
|
|
1304
|
-
schemaVersion: z9.literal("openpond.localHarnessRefinerDecision.v2"),
|
|
1305
|
-
decision: z9.literal("propose"),
|
|
1306
|
-
route: z9.enum(["memory", "prompt", "skill", "agent"]),
|
|
1307
|
-
operation: z9.enum(["create", "update", "delete"]),
|
|
1308
|
-
target: z9.string().trim().min(1).max(2e3),
|
|
1309
|
-
summary: z9.string().trim().min(1).max(2e3),
|
|
1310
|
-
evidenceBasis: HarnessRefinerEvidenceBasisSchema,
|
|
1311
|
-
createContent: z9.string().min(1).max(2e4).nullable(),
|
|
1312
|
-
find: z9.string().min(1).max(8e3).nullable(),
|
|
1313
|
-
replace: z9.string().max(8e3).nullable(),
|
|
1314
|
-
expectedOutcome: z9.string().trim().min(1).max(1e4),
|
|
1315
|
-
reason: z9.string().trim().min(1).max(1e4)
|
|
1316
|
-
}).strict().superRefine((decision, context) => {
|
|
1317
|
-
if (decision.operation === "create" && (decision.createContent === null || decision.find !== null || decision.replace !== null)) {
|
|
1318
|
-
context.addIssue({
|
|
1319
|
-
code: "custom",
|
|
1320
|
-
message: "create proposals require createContent and null find/replace",
|
|
1321
|
-
path: ["createContent"]
|
|
1322
|
-
});
|
|
1323
|
-
}
|
|
1324
|
-
if (decision.operation === "update" && (decision.createContent !== null || decision.find === null || decision.replace === null)) {
|
|
1325
|
-
context.addIssue({
|
|
1326
|
-
code: "custom",
|
|
1327
|
-
message: "update proposals require one exact find/replace edit and null createContent",
|
|
1328
|
-
path: ["find"]
|
|
1329
|
-
});
|
|
1330
|
-
}
|
|
1331
|
-
if (decision.operation === "delete" && (decision.createContent !== null || decision.find !== null || decision.replace !== null)) {
|
|
1332
|
-
context.addIssue({
|
|
1333
|
-
code: "custom",
|
|
1334
|
-
message: "delete proposals require null createContent/find/replace",
|
|
1335
|
-
path: ["createContent"]
|
|
1336
|
-
});
|
|
1337
|
-
}
|
|
1338
|
-
});
|
|
1339
|
-
var LocalHarnessRefinerDecisionV2Schema = z9.discriminatedUnion("decision", [
|
|
1340
|
-
RefinerNoActionDecisionV2Schema,
|
|
1341
|
-
RefinerExternalRouteDecisionV2Schema,
|
|
1342
|
-
RefinerProposalDecisionV2Schema
|
|
1343
|
-
]);
|
|
1344
|
-
var LocalHarnessRefinerDecisionAnySchema = z9.union([
|
|
1345
|
-
LocalHarnessRefinerDecisionV1Schema,
|
|
1346
|
-
LocalHarnessRefinerDecisionV2Schema
|
|
1347
|
-
]);
|
|
1348
|
-
var HarnessRefinerCapabilitiesSchema = z9.object({
|
|
1349
|
-
memory: z9.boolean(),
|
|
1350
|
-
prompt: z9.boolean(),
|
|
1351
|
-
skill: z9.boolean(),
|
|
1352
|
-
agent: z9.boolean()
|
|
1353
|
-
}).strict();
|
|
1354
|
-
var SourceKindSchema = z9.enum(["memory", "instruction", "skill", "agent"]);
|
|
1355
|
-
var RefinerSourceFileSchema = z9.object({
|
|
1356
|
-
path: z9.string().trim().min(1).max(2e3),
|
|
1357
|
-
kind: SourceKindSchema,
|
|
1358
|
-
content: z9.string().max(6e4),
|
|
1359
|
-
loaded: z9.boolean()
|
|
1360
|
-
}).strict();
|
|
1361
|
-
var RefinerSourceCatalogEntrySchema = z9.object({
|
|
1362
|
-
path: z9.string().trim().min(1).max(2e3),
|
|
1363
|
-
kind: SourceKindSchema,
|
|
1364
|
-
loaded: z9.boolean()
|
|
1365
|
-
}).strict();
|
|
1366
|
-
var LocalHarnessRefinerEvidenceSchema = z9.object({
|
|
1367
|
-
capabilities: HarnessRefinerCapabilitiesSchema,
|
|
1368
|
-
trigger: z9.record(z9.string(), z9.unknown()),
|
|
1369
|
-
observations: z9.array(z9.record(z9.string(), z9.unknown())).max(20),
|
|
1370
|
-
admissibleEvidenceIds: z9.array(z9.string().trim().min(1).max(2e3)).max(1e4),
|
|
1371
|
-
reviewPacket: z9.object({
|
|
1372
|
-
currentTurn: z9.object({
|
|
1373
|
-
id: z9.string().trim().min(1).max(2e3),
|
|
1374
|
-
status: z9.string().trim().min(1).max(100).nullable(),
|
|
1375
|
-
error: z9.string().max(2100).nullable(),
|
|
1376
|
-
prompt: z9.string().max(8100).nullable(),
|
|
1377
|
-
assistantOutput: z9.string().max(8100).nullable(),
|
|
1378
|
-
assistantOutputLinkCount: z9.number().int().nonnegative()
|
|
1379
|
-
}).strict(),
|
|
1380
|
-
priorConversation: z9.array(z9.object({
|
|
1381
|
-
turnId: z9.string().trim().min(1).max(2e3),
|
|
1382
|
-
status: z9.string().trim().min(1).max(100).nullable(),
|
|
1383
|
-
prompt: z9.string().max(3100).nullable(),
|
|
1384
|
-
assistantOutput: z9.string().max(3100).nullable()
|
|
1385
|
-
}).strict()).max(3),
|
|
1386
|
-
timeline: z9.array(z9.record(z9.string(), z9.unknown())).max(60),
|
|
1387
|
-
artifacts: z9.array(z9.record(z9.string(), z9.unknown())).max(30),
|
|
1388
|
-
artifactDiagnostics: z9.array(z9.record(z9.string(), z9.unknown())).max(20),
|
|
1389
|
-
executionProfile: z9.object({
|
|
1390
|
-
modelRequestCount: z9.number().int().nonnegative(),
|
|
1391
|
-
failedModelRequestCount: z9.number().int().nonnegative(),
|
|
1392
|
-
promptTokens: z9.number().int().nonnegative(),
|
|
1393
|
-
completionTokens: z9.number().int().nonnegative(),
|
|
1394
|
-
totalTokens: z9.number().int().nonnegative(),
|
|
1395
|
-
toolFailureCount: z9.number().int().nonnegative(),
|
|
1396
|
-
retryCount: z9.number().int().nonnegative(),
|
|
1397
|
-
recoveryCount: z9.number().int().nonnegative()
|
|
1398
|
-
}).strict(),
|
|
1399
|
-
priorIncidents: z9.array(z9.record(z9.string(), z9.unknown())).max(3),
|
|
1400
|
-
truncation: z9.object({
|
|
1401
|
-
timelineEventCount: z9.number().int().nonnegative(),
|
|
1402
|
-
includedTimelineEventCount: z9.number().int().nonnegative(),
|
|
1403
|
-
timelineTruncated: z9.boolean()
|
|
1404
|
-
}).strict()
|
|
1405
|
-
}).strict(),
|
|
1406
|
-
runtimeActivation: z9.object({
|
|
1407
|
-
admittedRelease: ImmutableReleaseRefSchema,
|
|
1408
|
-
currentRelease: ImmutableReleaseRefSchema,
|
|
1409
|
-
rebasedOntoCurrent: z9.boolean(),
|
|
1410
|
-
admittedSourceFiles: z9.array(RefinerSourceFileSchema).max(100),
|
|
1411
|
-
admittedSourceCatalog: z9.array(RefinerSourceCatalogEntrySchema).max(1e3)
|
|
1412
|
-
}).strict(),
|
|
1413
|
-
sourceFiles: z9.array(RefinerSourceFileSchema).max(100),
|
|
1414
|
-
sourceCatalog: z9.array(RefinerSourceCatalogEntrySchema).max(1e3),
|
|
1415
|
-
additionalEvidence: z9.unknown().nullable().optional()
|
|
1416
|
-
}).strict();
|
|
1417
|
-
var OverlayRefSchema = z9.object({
|
|
1418
|
-
id: z9.string().trim().min(1).max(240),
|
|
1419
|
-
revision: z9.number().int().nonnegative(),
|
|
1420
|
-
contentHash: ReleaseHashSchema
|
|
1421
|
-
}).strict();
|
|
1422
|
-
var HostedHarnessRefinerRequestSchema = z9.object({
|
|
1423
|
-
schemaVersion: z9.literal("openpond.hostedHarnessRefinerRequest.v2"),
|
|
1424
|
-
requestId: z9.string().trim().min(1).max(240),
|
|
1425
|
-
idempotencyKey: z9.string().trim().min(1).max(240),
|
|
1426
|
-
evidenceHash: ReleaseHashSchema,
|
|
1427
|
-
harness: z9.object({
|
|
1428
|
-
admittedRelease: ImmutableReleaseRefSchema,
|
|
1429
|
-
currentRelease: ImmutableReleaseRefSchema,
|
|
1430
|
-
overlay: OverlayRefSchema,
|
|
1431
|
-
workspace: z9.object({
|
|
1432
|
-
id: z9.string().trim().min(1).max(240),
|
|
1433
|
-
revision: z9.number().int().nonnegative(),
|
|
1434
|
-
sourceRevision: ReleaseHashSchema,
|
|
1435
|
-
channelRevision: z9.number().int().nonnegative()
|
|
1436
|
-
}).strict(),
|
|
1437
|
-
capabilities: HarnessRefinerCapabilitiesSchema
|
|
1438
|
-
}).strict(),
|
|
1439
|
-
evidence: LocalHarnessRefinerEvidenceSchema
|
|
1440
|
-
}).strict();
|
|
1441
|
-
var HostedHarnessRefinerUsageSchema = z9.object({
|
|
1442
|
-
promptTokens: z9.number().int().nonnegative(),
|
|
1443
|
-
completionTokens: z9.number().int().nonnegative(),
|
|
1444
|
-
totalTokens: z9.number().int().nonnegative()
|
|
1445
|
-
}).strict();
|
|
1446
|
-
var HostedHarnessRefinerResponseSchema = z9.object({
|
|
1447
|
-
schemaVersion: z9.literal("openpond.hostedHarnessRefinerResponse.v2"),
|
|
1448
|
-
requestId: z9.string().trim().min(1).max(240),
|
|
1449
|
-
evidenceHash: ReleaseHashSchema,
|
|
1450
|
-
admittedRelease: ImmutableReleaseRefSchema,
|
|
1451
|
-
currentRelease: ImmutableReleaseRefSchema,
|
|
1452
|
-
decision: LocalHarnessRefinerDecisionV2Schema,
|
|
1453
|
-
serviceRevision: z9.string().trim().min(1).max(240),
|
|
1454
|
-
usage: HostedHarnessRefinerUsageSchema
|
|
1455
|
-
}).strict();
|
|
1456
|
-
|
|
1457
|
-
// ../harness/dist/refinement-lifecycle.js
|
|
1458
|
-
import { z as z10 } from "zod";
|
|
1459
|
-
var ShortTextSchema = z10.string().trim().min(1).max(2e3);
|
|
1460
|
-
var BoundedTextSchema4 = z10.string().trim().min(1).max(1e5);
|
|
1461
|
-
var HarnessRefinerOperationSchema = z10.enum(["create", "update", "delete"]);
|
|
1462
|
-
var HarnessRefinerInternalRouteSchema = z10.enum([
|
|
1463
|
-
"memory",
|
|
1464
|
-
"prompt",
|
|
1465
|
-
"skill",
|
|
1466
|
-
"agent"
|
|
1467
|
-
]);
|
|
1468
|
-
var HarnessRefinerExternalRouteSchema = z10.enum([
|
|
1469
|
-
"runtime",
|
|
1470
|
-
"product",
|
|
1471
|
-
"taskset",
|
|
1472
|
-
"training"
|
|
1473
|
-
]);
|
|
1474
|
-
var HarnessRefinerActivityResultSchema = z10.enum([
|
|
1475
|
-
"no_action",
|
|
1476
|
-
"routed",
|
|
1477
|
-
"applied",
|
|
1478
|
-
"retained",
|
|
1479
|
-
"failed"
|
|
1480
|
-
]);
|
|
1481
|
-
var HarnessRefinerCritiqueStatusSchema = z10.enum([
|
|
1482
|
-
"not_applicable",
|
|
1483
|
-
"pending",
|
|
1484
|
-
"passed",
|
|
1485
|
-
"rejected",
|
|
1486
|
-
"failed"
|
|
1487
|
-
]);
|
|
1488
|
-
var HarnessRefinerValidationStatusSchema = z10.enum([
|
|
1489
|
-
"not_applicable",
|
|
1490
|
-
"pending",
|
|
1491
|
-
"passed",
|
|
1492
|
-
"failed"
|
|
1493
|
-
]);
|
|
1494
|
-
var HarnessRefinerActivityReceiptContentSchema = z10.object({
|
|
1495
|
-
schemaVersion: z10.literal("openpond.harnessRefinerActivityReceipt.v1"),
|
|
1496
|
-
id: ReleaseIdSchema,
|
|
1497
|
-
runRef: ReleaseIdSchema,
|
|
1498
|
-
turnId: ReleaseIdSchema,
|
|
1499
|
-
result: HarnessRefinerActivityResultSchema,
|
|
1500
|
-
decision: z10.enum(["no_action", "route", "propose"]).nullable(),
|
|
1501
|
-
route: HarnessImprovementRouteSchema.nullable(),
|
|
1502
|
-
operation: HarnessRefinerOperationSchema.nullable(),
|
|
1503
|
-
target: z10.string().trim().min(1).max(2e3).nullable(),
|
|
1504
|
-
summary: ShortTextSchema,
|
|
1505
|
-
evidenceBasis: HarnessRefinerEvidenceBasisSchema.nullable(),
|
|
1506
|
-
critiqueStatus: HarnessRefinerCritiqueStatusSchema,
|
|
1507
|
-
validationStatus: HarnessRefinerValidationStatusSchema,
|
|
1508
|
-
trigger: ImmutableReleaseRefSchema,
|
|
1509
|
-
outcome: ImmutableReleaseRefSchema.nullable(),
|
|
1510
|
-
proposal: ImmutableReleaseRefSchema.nullable(),
|
|
1511
|
-
applyReceipt: ImmutableReleaseRefSchema.nullable(),
|
|
1512
|
-
inputHarness: ImmutableReleaseRefSchema,
|
|
1513
|
-
outputHarness: ImmutableReleaseRefSchema.nullable(),
|
|
1514
|
-
createdAt: ReleaseTimestampSchema
|
|
1515
|
-
}).strict().superRefine((receipt, context) => {
|
|
1516
|
-
const proposalResult = receipt.result === "applied" || receipt.result === "retained";
|
|
1517
|
-
if (receipt.result === "no_action") {
|
|
1518
|
-
requireFields(context, receipt, {
|
|
1519
|
-
decision: "no_action",
|
|
1520
|
-
route: null,
|
|
1521
|
-
operation: null,
|
|
1522
|
-
target: null,
|
|
1523
|
-
evidenceBasis: null,
|
|
1524
|
-
proposal: null,
|
|
1525
|
-
applyReceipt: null,
|
|
1526
|
-
outputHarness: null,
|
|
1527
|
-
critiqueStatus: "not_applicable",
|
|
1528
|
-
validationStatus: "not_applicable"
|
|
1529
|
-
});
|
|
1530
|
-
} else if (receipt.result === "routed") {
|
|
1531
|
-
if (receipt.decision !== "route" || !HarnessRefinerExternalRouteSchema.safeParse(receipt.route).success || receipt.operation !== null || receipt.target !== null || receipt.evidenceBasis === null || receipt.proposal !== null || receipt.applyReceipt !== null || receipt.outputHarness !== null) {
|
|
1532
|
-
context.addIssue({
|
|
1533
|
-
code: "custom",
|
|
1534
|
-
message: "routed activity requires an external route and evidence basis without proposal state"
|
|
1535
|
-
});
|
|
1536
|
-
}
|
|
1537
|
-
requireFields(context, receipt, {
|
|
1538
|
-
critiqueStatus: "not_applicable",
|
|
1539
|
-
validationStatus: "not_applicable"
|
|
1540
|
-
});
|
|
1541
|
-
} else if (proposalResult) {
|
|
1542
|
-
if (receipt.decision !== "propose" || !HarnessRefinerInternalRouteSchema.safeParse(receipt.route).success || receipt.operation === null || receipt.target === null || receipt.evidenceBasis === null || receipt.proposal === null || receipt.applyReceipt === null) {
|
|
1543
|
-
context.addIssue({
|
|
1544
|
-
code: "custom",
|
|
1545
|
-
message: "applied and retained activity requires complete proposal state"
|
|
1546
|
-
});
|
|
1547
|
-
}
|
|
1548
|
-
if (receipt.result === "applied" && receipt.outputHarness === null) {
|
|
1549
|
-
context.addIssue({
|
|
1550
|
-
code: "custom",
|
|
1551
|
-
message: "applied activity requires the advanced Harness release",
|
|
1552
|
-
path: ["outputHarness"]
|
|
1553
|
-
});
|
|
1554
|
-
}
|
|
1555
|
-
if (receipt.result === "applied" && (receipt.critiqueStatus !== "passed" || receipt.validationStatus !== "passed")) {
|
|
1556
|
-
context.addIssue({
|
|
1557
|
-
code: "custom",
|
|
1558
|
-
message: "applied activity requires passed critique and validation"
|
|
1559
|
-
});
|
|
1560
|
-
}
|
|
1561
|
-
if (receipt.result === "retained" && receipt.outputHarness !== null) {
|
|
1562
|
-
context.addIssue({
|
|
1563
|
-
code: "custom",
|
|
1564
|
-
message: "retained activity cannot report a new Harness release",
|
|
1565
|
-
path: ["outputHarness"]
|
|
1566
|
-
});
|
|
1567
|
-
}
|
|
1568
|
-
} else if (receipt.decision !== null || receipt.route !== null || receipt.operation !== null || receipt.target !== null || receipt.evidenceBasis !== null || receipt.outcome !== null || receipt.proposal !== null || receipt.applyReceipt !== null || receipt.outputHarness !== null) {
|
|
1569
|
-
context.addIssue({
|
|
1570
|
-
code: "custom",
|
|
1571
|
-
message: "failed activity cannot claim a decision, route, proposal, or release transition"
|
|
1572
|
-
});
|
|
1573
|
-
}
|
|
1574
|
-
if (receipt.result !== "failed" && receipt.outcome === null) {
|
|
1575
|
-
context.addIssue({
|
|
1576
|
-
code: "custom",
|
|
1577
|
-
message: "terminal Refiner decisions require an outcome reference",
|
|
1578
|
-
path: ["outcome"]
|
|
1579
|
-
});
|
|
1580
|
-
}
|
|
1581
|
-
});
|
|
1582
|
-
var HarnessRefinerActivityReceiptSchema = HarnessRefinerActivityReceiptContentSchema.extend({
|
|
1583
|
-
contentHash: ReleaseHashSchema
|
|
1584
|
-
}).strict();
|
|
1585
|
-
var HarnessRefinementCandidateStatusSchema = z10.enum([
|
|
1586
|
-
"unresolved",
|
|
1587
|
-
"confirmed",
|
|
1588
|
-
"resolved",
|
|
1589
|
-
"rejected",
|
|
1590
|
-
"expired"
|
|
1591
|
-
]);
|
|
1592
|
-
var HarnessRefinementCandidateResolutionSchema = z10.object({
|
|
1593
|
-
kind: z10.enum([
|
|
1594
|
-
"applied_change",
|
|
1595
|
-
"later_success",
|
|
1596
|
-
"manual_rejection",
|
|
1597
|
-
"source_revoked",
|
|
1598
|
-
"expired"
|
|
1599
|
-
]),
|
|
1600
|
-
reason: BoundedTextSchema4,
|
|
1601
|
-
evidenceRefs: z10.array(ImmutableReleaseRefSchema).max(1e3),
|
|
1602
|
-
resolvedAt: ReleaseTimestampSchema
|
|
1603
|
-
}).strict();
|
|
1604
|
-
var HarnessRefinementCandidateContentSchema = z10.object({
|
|
1605
|
-
schemaVersion: z10.literal("openpond.harnessRefinementCandidate.v1"),
|
|
1606
|
-
id: ReleaseIdSchema,
|
|
1607
|
-
ownerScope: HarnessReviewOwnerScopeSchema,
|
|
1608
|
-
workspaceRef: ReleaseIdSchema,
|
|
1609
|
-
fingerprint: ReleaseHashSchema,
|
|
1610
|
-
recurrenceFamily: z10.string().trim().min(1).max(1e3),
|
|
1611
|
-
statement: BoundedTextSchema4,
|
|
1612
|
-
status: HarnessRefinementCandidateStatusSchema,
|
|
1613
|
-
occurrences: z10.array(HarnessReviewEvidenceRefSchema).max(1e3),
|
|
1614
|
-
counterevidence: z10.array(HarnessReviewEvidenceRefSchema).max(1e3),
|
|
1615
|
-
sourceReviews: z10.array(ImmutableReleaseRefSchema).min(1).max(100),
|
|
1616
|
-
relatedHarnessReleases: z10.array(ImmutableReleaseRefSchema).max(100),
|
|
1617
|
-
firstSeenAt: ReleaseTimestampSchema,
|
|
1618
|
-
lastSeenAt: ReleaseTimestampSchema,
|
|
1619
|
-
lastReviewedAt: ReleaseTimestampSchema,
|
|
1620
|
-
expiresAt: ReleaseTimestampSchema,
|
|
1621
|
-
resolution: HarnessRefinementCandidateResolutionSchema.nullable(),
|
|
1622
|
-
createdAt: ReleaseTimestampSchema,
|
|
1623
|
-
updatedAt: ReleaseTimestampSchema
|
|
1624
|
-
}).strict().superRefine((candidate, context) => {
|
|
1625
|
-
requireUniqueRefs(context, candidate.occurrences, "occurrences");
|
|
1626
|
-
requireUniqueRefs(context, candidate.counterevidence, "counterevidence");
|
|
1627
|
-
requireUniqueRefs(context, candidate.sourceReviews, "sourceReviews");
|
|
1628
|
-
requireUniqueRefs(context, candidate.relatedHarnessReleases, "relatedHarnessReleases");
|
|
1629
|
-
const supportingKeys = new Set(candidate.occurrences.map((item) => item.occurrenceKey));
|
|
1630
|
-
if (candidate.counterevidence.some((item) => supportingKeys.has(item.occurrenceKey))) {
|
|
1631
|
-
context.addIssue({
|
|
1632
|
-
code: "custom",
|
|
1633
|
-
message: "supporting occurrences and counterevidence must be disjoint",
|
|
1634
|
-
path: ["counterevidence"]
|
|
1635
|
-
});
|
|
1636
|
-
}
|
|
1637
|
-
const actionable = candidate.status === "unresolved" || candidate.status === "confirmed";
|
|
1638
|
-
if (actionable && candidate.occurrences.length === 0) {
|
|
1639
|
-
context.addIssue({
|
|
1640
|
-
code: "custom",
|
|
1641
|
-
message: "actionable candidates require at least one supporting occurrence",
|
|
1642
|
-
path: ["occurrences"]
|
|
1643
|
-
});
|
|
1644
|
-
}
|
|
1645
|
-
if (actionable && [...candidate.occurrences, ...candidate.counterevidence].some((item) => item.sourcePolicy.state !== "authorized")) {
|
|
1646
|
-
context.addIssue({
|
|
1647
|
-
code: "custom",
|
|
1648
|
-
message: "actionable candidates may contain only currently authorized evidence",
|
|
1649
|
-
path: ["occurrences"]
|
|
1650
|
-
});
|
|
1651
|
-
}
|
|
1652
|
-
if (actionable !== (candidate.resolution === null)) {
|
|
1653
|
-
context.addIssue({
|
|
1654
|
-
code: "custom",
|
|
1655
|
-
message: "only resolved, rejected, or expired candidates require a resolution",
|
|
1656
|
-
path: ["resolution"]
|
|
1657
|
-
});
|
|
1658
|
-
}
|
|
1659
|
-
if (candidate.status === "expired" && candidate.resolution?.kind !== "expired") {
|
|
1660
|
-
context.addIssue({
|
|
1661
|
-
code: "custom",
|
|
1662
|
-
message: "expired candidates require an expired resolution",
|
|
1663
|
-
path: ["resolution", "kind"]
|
|
1664
|
-
});
|
|
1665
|
-
}
|
|
1666
|
-
if (candidate.status === "rejected" && candidate.resolution && !["manual_rejection", "source_revoked"].includes(candidate.resolution.kind)) {
|
|
1667
|
-
context.addIssue({
|
|
1668
|
-
code: "custom",
|
|
1669
|
-
message: "rejected candidates require a rejection or revocation resolution",
|
|
1670
|
-
path: ["resolution", "kind"]
|
|
1671
|
-
});
|
|
1672
|
-
}
|
|
1673
|
-
if (candidate.status === "resolved" && candidate.resolution && !["applied_change", "later_success"].includes(candidate.resolution.kind)) {
|
|
1674
|
-
context.addIssue({
|
|
1675
|
-
code: "custom",
|
|
1676
|
-
message: "resolved candidates require applied-change or later-success evidence",
|
|
1677
|
-
path: ["resolution", "kind"]
|
|
1678
|
-
});
|
|
1679
|
-
}
|
|
1680
|
-
requireChronology(context, candidate);
|
|
1681
|
-
});
|
|
1682
|
-
var HarnessRefinementCandidateSchema = HarnessRefinementCandidateContentSchema.extend({
|
|
1683
|
-
contentHash: ReleaseHashSchema
|
|
1684
|
-
}).strict();
|
|
1685
|
-
var HarnessRefinementCandidateLifecycleDecisionSchema = z10.enum([
|
|
1686
|
-
"created",
|
|
1687
|
-
"merged",
|
|
1688
|
-
"rejected",
|
|
1689
|
-
"expired",
|
|
1690
|
-
"reopened",
|
|
1691
|
-
"resolved"
|
|
1692
|
-
]);
|
|
1693
|
-
var HarnessRefinementCandidateLifecycleReceiptContentSchema = z10.object({
|
|
1694
|
-
schemaVersion: z10.literal("openpond.harnessRefinementCandidateLifecycleReceipt.v1"),
|
|
1695
|
-
id: ReleaseIdSchema,
|
|
1696
|
-
candidateId: ReleaseIdSchema,
|
|
1697
|
-
decision: HarnessRefinementCandidateLifecycleDecisionSchema,
|
|
1698
|
-
beforeCandidate: ImmutableReleaseRefSchema.nullable(),
|
|
1699
|
-
afterCandidate: ImmutableReleaseRefSchema,
|
|
1700
|
-
review: ImmutableReleaseRefSchema,
|
|
1701
|
-
addedEvidence: z10.array(HarnessReviewEvidenceRefSchema).max(1e3),
|
|
1702
|
-
removedEvidence: z10.array(ImmutableReleaseRefSchema).max(1e3),
|
|
1703
|
-
reason: BoundedTextSchema4,
|
|
1704
|
-
createdAt: ReleaseTimestampSchema
|
|
1705
|
-
}).strict().superRefine((receipt, context) => {
|
|
1706
|
-
if (receipt.decision === "created" !== (receipt.beforeCandidate === null)) {
|
|
1707
|
-
context.addIssue({
|
|
1708
|
-
code: "custom",
|
|
1709
|
-
message: "only candidate creation omits the previous candidate reference",
|
|
1710
|
-
path: ["beforeCandidate"]
|
|
1711
|
-
});
|
|
1712
|
-
}
|
|
1713
|
-
if (receipt.beforeCandidate && receipt.beforeCandidate.contentHash === receipt.afterCandidate.contentHash) {
|
|
1714
|
-
context.addIssue({
|
|
1715
|
-
code: "custom",
|
|
1716
|
-
message: "candidate lifecycle transitions must change candidate content",
|
|
1717
|
-
path: ["afterCandidate"]
|
|
1718
|
-
});
|
|
1719
|
-
}
|
|
1720
|
-
if (["created", "reopened"].includes(receipt.decision) && receipt.addedEvidence.length === 0) {
|
|
1721
|
-
context.addIssue({
|
|
1722
|
-
code: "custom",
|
|
1723
|
-
message: `${receipt.decision} candidate transitions require added evidence`,
|
|
1724
|
-
path: ["addedEvidence"]
|
|
1725
|
-
});
|
|
1726
|
-
}
|
|
1727
|
-
if (receipt.addedEvidence.some((item) => item.sourcePolicy.state !== "authorized")) {
|
|
1728
|
-
context.addIssue({
|
|
1729
|
-
code: "custom",
|
|
1730
|
-
message: "candidate transitions may add only authorized evidence",
|
|
1731
|
-
path: ["addedEvidence"]
|
|
1732
|
-
});
|
|
1733
|
-
}
|
|
1734
|
-
requireUniqueRefs(context, receipt.addedEvidence, "addedEvidence");
|
|
1735
|
-
requireUniqueRefs(context, receipt.removedEvidence, "removedEvidence");
|
|
1736
|
-
const removedKeys = new Set(receipt.removedEvidence.map((item) => refKey(item)));
|
|
1737
|
-
if (receipt.addedEvidence.some((item) => removedKeys.has(refKey(item.evidence)))) {
|
|
1738
|
-
context.addIssue({
|
|
1739
|
-
code: "custom",
|
|
1740
|
-
message: "candidate lifecycle evidence cannot be added and removed together",
|
|
1741
|
-
path: ["removedEvidence"]
|
|
1742
|
-
});
|
|
1743
|
-
}
|
|
1744
|
-
});
|
|
1745
|
-
var HarnessRefinementCandidateLifecycleReceiptSchema = HarnessRefinementCandidateLifecycleReceiptContentSchema.extend({
|
|
1746
|
-
contentHash: ReleaseHashSchema
|
|
1747
|
-
}).strict();
|
|
1748
|
-
var HarnessCrossRunRefinementRequestContentSchema = z10.object({
|
|
1749
|
-
schemaVersion: z10.literal("openpond.harnessCrossRunRefinementRequest.v1"),
|
|
1750
|
-
id: ReleaseIdSchema,
|
|
1751
|
-
ownerScope: HarnessReviewOwnerScopeSchema,
|
|
1752
|
-
workspaceRef: ReleaseIdSchema,
|
|
1753
|
-
candidate: ImmutableReleaseRefSchema,
|
|
1754
|
-
candidateFingerprint: ReleaseHashSchema,
|
|
1755
|
-
review: ImmutableReleaseRefSchema,
|
|
1756
|
-
admittedHarness: ImmutableReleaseRefSchema,
|
|
1757
|
-
evidence: z10.array(HarnessReviewEvidenceRefSchema).min(1).max(1e3),
|
|
1758
|
-
capabilities: HarnessRefinerCapabilitiesSchema,
|
|
1759
|
-
deduplicationKey: ReleaseHashSchema,
|
|
1760
|
-
createdAt: ReleaseTimestampSchema
|
|
1761
|
-
}).strict().superRefine((request, context) => {
|
|
1762
|
-
if (request.evidence.some((item) => item.sourcePolicy.state !== "authorized")) {
|
|
1763
|
-
context.addIssue({
|
|
1764
|
-
code: "custom",
|
|
1765
|
-
message: "cross-run refinement requires currently authorized evidence",
|
|
1766
|
-
path: ["evidence"]
|
|
1767
|
-
});
|
|
1768
|
-
}
|
|
1769
|
-
requireUniqueRefs(context, request.evidence, "evidence");
|
|
1770
|
-
if (!Object.values(request.capabilities).some(Boolean)) {
|
|
1771
|
-
context.addIssue({
|
|
1772
|
-
code: "custom",
|
|
1773
|
-
message: "cross-run refinement requires at least one available Harness capability",
|
|
1774
|
-
path: ["capabilities"]
|
|
1775
|
-
});
|
|
1776
|
-
}
|
|
1777
|
-
const expected = harnessCrossRunRefinementDeduplicationKey(request);
|
|
1778
|
-
if (request.deduplicationKey !== expected) {
|
|
1779
|
-
context.addIssue({
|
|
1780
|
-
code: "custom",
|
|
1781
|
-
message: `cross-run refinement deduplicationKey is ${request.deduplicationKey}; expected ${expected}`,
|
|
1782
|
-
path: ["deduplicationKey"]
|
|
1783
|
-
});
|
|
1784
|
-
}
|
|
1785
|
-
});
|
|
1786
|
-
var HarnessCrossRunRefinementRequestSchema = HarnessCrossRunRefinementRequestContentSchema.extend({
|
|
1787
|
-
contentHash: ReleaseHashSchema
|
|
1788
|
-
}).strict();
|
|
1789
|
-
function harnessCrossRunRefinementDeduplicationKey(input) {
|
|
1790
|
-
return contentHash({
|
|
1791
|
-
schemaVersion: "openpond.harnessCrossRunRefinementIdentity.v1",
|
|
1792
|
-
workspaceRef: input.workspaceRef,
|
|
1793
|
-
candidateFingerprint: input.candidateFingerprint,
|
|
1794
|
-
admittedHarness: input.admittedHarness
|
|
1795
|
-
});
|
|
1796
|
-
}
|
|
1797
|
-
function requireFields(context, value, expected) {
|
|
1798
|
-
for (const [key, expectedValue] of Object.entries(expected)) {
|
|
1799
|
-
if (value[key] === expectedValue)
|
|
1800
|
-
continue;
|
|
1801
|
-
context.addIssue({
|
|
1802
|
-
code: "custom",
|
|
1803
|
-
message: `${key} must be ${String(expectedValue)}`,
|
|
1804
|
-
path: [key]
|
|
1805
|
-
});
|
|
1806
|
-
}
|
|
1807
|
-
}
|
|
1808
|
-
function requireUniqueRefs(context, values, path) {
|
|
1809
|
-
const keys = values.map((value) => refKey(value));
|
|
1810
|
-
if (new Set(keys).size === keys.length)
|
|
1811
|
-
return;
|
|
1812
|
-
context.addIssue({
|
|
1813
|
-
code: "custom",
|
|
1814
|
-
message: `${path} references must be unique`,
|
|
1815
|
-
path: [path]
|
|
1816
|
-
});
|
|
1817
|
-
}
|
|
1818
|
-
function refKey(value) {
|
|
1819
|
-
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
1820
|
-
return String(value);
|
|
1821
|
-
const record = value;
|
|
1822
|
-
if (typeof record.occurrenceKey === "string")
|
|
1823
|
-
return record.occurrenceKey;
|
|
1824
|
-
const nested = record.evidence;
|
|
1825
|
-
if (nested && typeof nested === "object" && !Array.isArray(nested)) {
|
|
1826
|
-
const evidence = nested;
|
|
1827
|
-
return `${String(evidence.id)}:${String(evidence.contentHash)}`;
|
|
1828
|
-
}
|
|
1829
|
-
return `${String(record.id)}:${String(record.contentHash)}`;
|
|
1830
|
-
}
|
|
1831
|
-
function requireChronology(context, candidate) {
|
|
1832
|
-
const chronology = [
|
|
1833
|
-
["firstSeenAt", candidate.firstSeenAt],
|
|
1834
|
-
["lastSeenAt", candidate.lastSeenAt],
|
|
1835
|
-
["lastReviewedAt", candidate.lastReviewedAt],
|
|
1836
|
-
["updatedAt", candidate.updatedAt],
|
|
1837
|
-
["expiresAt", candidate.expiresAt]
|
|
1838
|
-
];
|
|
1839
|
-
for (let index = 1; index < chronology.length; index += 1) {
|
|
1840
|
-
const previous = chronology[index - 1];
|
|
1841
|
-
const current = chronology[index];
|
|
1842
|
-
if (Date.parse(previous[1]) <= Date.parse(current[1]))
|
|
1843
|
-
continue;
|
|
1844
|
-
context.addIssue({
|
|
1845
|
-
code: "custom",
|
|
1846
|
-
message: `${current[0]} must not precede ${previous[0]}`,
|
|
1847
|
-
path: [current[0]]
|
|
1848
|
-
});
|
|
1849
|
-
}
|
|
1850
|
-
if (Date.parse(candidate.createdAt) > Date.parse(candidate.updatedAt)) {
|
|
1851
|
-
context.addIssue({
|
|
1852
|
-
code: "custom",
|
|
1853
|
-
message: "updatedAt must not precede createdAt",
|
|
1854
|
-
path: ["updatedAt"]
|
|
1855
|
-
});
|
|
1856
|
-
}
|
|
1857
|
-
}
|
|
1858
|
-
|
|
1859
|
-
// src/learning-credentials.ts
|
|
1860
|
-
import { LearningRevisionRefSchema } from "@openpond/evals/learning";
|
|
1861
|
-
import { TaskSplitSchema } from "@openpond/evals/tasksets";
|
|
1862
|
-
var LearningSourceCredentialSchema = z11.object({
|
|
1863
|
-
id: ReleaseIdSchema,
|
|
1864
|
-
scope: ReleaseIdSchema,
|
|
1865
|
-
sourceId: ReleaseIdSchema,
|
|
1866
|
-
name: z11.string().trim().min(1).max(100),
|
|
1867
|
-
keyPrefix: z11.string().min(1).max(100),
|
|
1868
|
-
createdAt: z11.iso.datetime(),
|
|
1869
|
-
expiresAt: z11.iso.datetime(),
|
|
1870
|
-
revokedAt: z11.iso.datetime().nullable()
|
|
1871
|
-
}).strict();
|
|
1872
|
-
var LearningSourceCredentialSecretSchema = z11.string().regex(/^opk_key_[A-Za-z0-9]{16}_[A-Za-z0-9]{48}$/);
|
|
1873
|
-
var LearningSourceCredentialRequestSchema = z11.discriminatedUnion("action", [
|
|
1874
|
-
z11.object({ action: z11.literal("create"), scope: ReleaseIdSchema, sourceId: ReleaseIdSchema, name: z11.string().trim().min(1).max(100), expiresAt: z11.iso.datetime(), operationId: ReleaseIdSchema, apiKey: LearningSourceCredentialSecretSchema }).strict(),
|
|
1875
|
-
z11.object({ action: z11.literal("list"), scope: ReleaseIdSchema, sourceId: ReleaseIdSchema, afterId: ReleaseIdSchema.optional(), limit: z11.number().int().min(1).max(100).default(30) }).strict(),
|
|
1876
|
-
z11.object({ action: z11.literal("revoke"), scope: ReleaseIdSchema, sourceId: ReleaseIdSchema, id: ReleaseIdSchema }).strict()
|
|
1877
|
-
]);
|
|
1878
|
-
var LearningSourceCredentialCreatedSchema = z11.object({ credential: LearningSourceCredentialSchema, apiKey: LearningSourceCredentialSecretSchema }).strict();
|
|
1879
|
-
var LearningSourceCredentialPageSchema = z11.object({ items: z11.array(LearningSourceCredentialSchema).max(100), nextCursor: ReleaseIdSchema.nullable() }).strict();
|
|
1880
|
-
var LearningSourceConfigurationRequestSchema = z11.object({ scope: ReleaseIdSchema, sourceId: ReleaseIdSchema }).strict();
|
|
1881
|
-
var LearningSourceConfigurationSchema = z11.object({
|
|
1882
|
-
scope: ReleaseIdSchema,
|
|
1883
|
-
source: LearningRevisionRefSchema,
|
|
1884
|
-
taskDefinition: LearningRevisionRefSchema,
|
|
1885
|
-
enabled: z11.boolean(),
|
|
1886
|
-
allowedSplits: z11.array(TaskSplitSchema).min(1).max(4)
|
|
1887
|
-
}).strict();
|
|
1888
|
-
function createSourceCredentialRequest(input) {
|
|
1889
|
-
return { ...input, operationId: crypto.randomUUID(), apiKey: `opk_key_${randomToken(16)}_${randomToken(48)}` };
|
|
1890
|
-
}
|
|
1891
|
-
function randomToken(length) {
|
|
1892
|
-
const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
1893
|
-
let value = "";
|
|
1894
|
-
while (value.length < length) {
|
|
1895
|
-
for (const byte of crypto.getRandomValues(new Uint8Array(64))) {
|
|
1896
|
-
if (byte < 248) value += alphabet[byte % 62];
|
|
1897
|
-
if (value.length === length) return value;
|
|
1898
|
-
}
|
|
1899
|
-
}
|
|
1900
|
-
return value;
|
|
1901
|
-
}
|
|
1902
|
-
function assertLearningCredentialExpiry(expiresAt, now) {
|
|
1903
|
-
const expires = Date.parse(z11.iso.datetime().parse(expiresAt));
|
|
1904
|
-
if (expires <= now.getTime() || expires > now.getTime() + 90 * 24 * 60 * 60 * 1e3) throw new Error("Source credentials must expire within 90 days.");
|
|
1905
|
-
}
|
|
2
|
+
LearningBatchPublicationResultSchema,
|
|
3
|
+
LearningBatchPublicationSchema,
|
|
4
|
+
LearningSourceConfigurationRequestSchema,
|
|
5
|
+
LearningSourceConfigurationSchema,
|
|
6
|
+
LearningSourceCredentialCreatedSchema,
|
|
7
|
+
LearningSourceCredentialPageSchema,
|
|
8
|
+
LearningSourceCredentialRequestSchema,
|
|
9
|
+
LearningSourceCredentialSchema,
|
|
10
|
+
LearningSourceCredentialSecretSchema,
|
|
11
|
+
OpenPondLearningClient,
|
|
12
|
+
OpenPondLearningError,
|
|
13
|
+
assertLearningCredentialExpiry,
|
|
14
|
+
createSourceCredentialRequest
|
|
15
|
+
} from "./chunk-25TBEGXB.js";
|
|
16
|
+
import "./chunk-EV4PKJWN.js";
|
|
17
|
+
import "./chunk-NF63YMOL.js";
|
|
1906
18
|
|
|
1907
19
|
// src/learning.ts
|
|
1908
20
|
export * from "@openpond/evals/learning";
|
|
1909
21
|
export * from "@openpond/evals/rewards";
|
|
1910
|
-
var LearningBatchPublicationSchema = z12.object({
|
|
1911
|
-
batchId: z12.string().trim().min(1).max(500),
|
|
1912
|
-
modelProjectId: z12.string().trim().min(1).max(500)
|
|
1913
|
-
}).strict();
|
|
1914
|
-
var LearningBatchPublicationResultSchema = z12.object({
|
|
1915
|
-
batchId: z12.string().min(1),
|
|
1916
|
-
projectId: z12.string().min(1),
|
|
1917
|
-
tasksetId: z12.string().min(1),
|
|
1918
|
-
releaseId: z12.string().min(1),
|
|
1919
|
-
revision: z12.number().int().positive(),
|
|
1920
|
-
contentHash: z12.string().regex(/^[a-f0-9]{64}$/)
|
|
1921
|
-
}).strict();
|
|
1922
|
-
var OpenPondLearningError = class extends Error {
|
|
1923
|
-
constructor(status, code, message, details) {
|
|
1924
|
-
super(message);
|
|
1925
|
-
this.status = status;
|
|
1926
|
-
this.code = code;
|
|
1927
|
-
this.details = details;
|
|
1928
|
-
this.name = "OpenPondLearningError";
|
|
1929
|
-
}
|
|
1930
|
-
status;
|
|
1931
|
-
code;
|
|
1932
|
-
details;
|
|
1933
|
-
};
|
|
1934
|
-
var OpenPondLearningClient = class {
|
|
1935
|
-
#options;
|
|
1936
|
-
constructor(options) {
|
|
1937
|
-
if (!options.apiKey.trim() || !options.scope.trim()) throw new Error("Learning API key and scope are required.");
|
|
1938
|
-
const url = new URL(options.baseUrl);
|
|
1939
|
-
if (!["http:", "https:"].includes(url.protocol) || url.username || url.password || url.search || url.hash) throw new Error("Learning base URL must be an HTTP(S) endpoint without credentials, query, or fragment.");
|
|
1940
|
-
this.#options = { ...options, baseUrl: url.toString().replace(/\/+$/, "") };
|
|
1941
|
-
}
|
|
1942
|
-
async command(command, options = {}) {
|
|
1943
|
-
assertLearningRequestJson(command);
|
|
1944
|
-
const request = LearningCommandRequestSchema.parse({ scope: this.#options.scope, command });
|
|
1945
|
-
const result = LearningOperationResultSchema.parse(await this.#request("commands", request, options));
|
|
1946
|
-
if (result.operationId !== command.operationId) throw new OpenPondLearningError(502, "operation_identity_mismatch", "Learning response did not match the submitted operation.", null);
|
|
1947
|
-
return result;
|
|
1948
|
-
}
|
|
1949
|
-
submitExample(example, options = {}) {
|
|
1950
|
-
return this.command({ action: "submit_example", operationId: example.idempotencyKey, example }, options);
|
|
1951
|
-
}
|
|
1952
|
-
submitFeedback(feedback, options = {}) {
|
|
1953
|
-
return this.command({ action: "submit_feedback", operationId: feedback.idempotencyKey, feedback }, options);
|
|
1954
|
-
}
|
|
1955
|
-
async get(kind, id, revision, options = {}) {
|
|
1956
|
-
const request = LearningReadRequestSchema.parse({ action: "get", scope: this.#options.scope, kind, id, ...revision === void 0 ? {} : { revision } });
|
|
1957
|
-
return learningResourceSchemas[kind].parse(await this.#request("read", request, options));
|
|
1958
|
-
}
|
|
1959
|
-
async inspectEvidence(evidence, options = {}) {
|
|
1960
|
-
const request = LearningReadRequestSchema.parse({ action: "inspect_evidence", scope: this.#options.scope, evidence });
|
|
1961
|
-
const result = TaskEvidenceInspectionResultSchema.parse(await this.#request("read", request, options));
|
|
1962
|
-
if (!sameLearningRef(result.evidence, evidence)) throw new OpenPondLearningError(502, "evidence_identity_mismatch", "Inspection did not match the requested evidence release.", null);
|
|
1963
|
-
return result;
|
|
1964
|
-
}
|
|
1965
|
-
/** Prepare once with createSourceCredentialRequest and reuse it for retries. */
|
|
1966
|
-
async createSourceCredential(input, options = {}) {
|
|
1967
|
-
const request = LearningSourceCredentialRequestSchema.parse({ ...input, action: "create", scope: this.#options.scope });
|
|
1968
|
-
const result = LearningSourceCredentialCreatedSchema.parse(await this.#request("credentials", request, options));
|
|
1969
|
-
this.#assertCredentialScope(result.credential, input.sourceId);
|
|
1970
|
-
if (result.apiKey !== input.apiKey || !input.apiKey.startsWith(`${result.credential.keyPrefix}_`)) throw new OpenPondLearningError(502, "credential_identity_mismatch", "Credential response did not match the prepared credential.", null);
|
|
1971
|
-
return result;
|
|
1972
|
-
}
|
|
1973
|
-
async listSourceCredentials(sourceId, query = {}, options = {}) {
|
|
1974
|
-
const request = LearningSourceCredentialRequestSchema.parse({ ...query, action: "list", scope: this.#options.scope, sourceId });
|
|
1975
|
-
const result = LearningSourceCredentialPageSchema.parse(await this.#request("credentials", request, options));
|
|
1976
|
-
if (result.items.length > (query.limit ?? 30)) throw new OpenPondLearningError(502, "credential_page_invalid", "Credential response exceeded the requested page size.", null);
|
|
1977
|
-
for (const item of result.items) this.#assertCredentialScope(item, sourceId);
|
|
1978
|
-
return result;
|
|
1979
|
-
}
|
|
1980
|
-
async revokeSourceCredential(sourceId, id, options = {}) {
|
|
1981
|
-
const request = LearningSourceCredentialRequestSchema.parse({ action: "revoke", scope: this.#options.scope, sourceId, id });
|
|
1982
|
-
const result = LearningSourceCredentialSchema.parse(await this.#request("credentials", request, options));
|
|
1983
|
-
this.#assertCredentialScope(result, sourceId);
|
|
1984
|
-
if (result.id !== id || result.revokedAt === null) throw new OpenPondLearningError(502, "credential_revocation_mismatch", "Credential revocation did not match the requested credential.", null);
|
|
1985
|
-
return result;
|
|
1986
|
-
}
|
|
1987
|
-
async sourceConfiguration(sourceId, options = {}) {
|
|
1988
|
-
const request = LearningSourceConfigurationRequestSchema.parse({ scope: this.#options.scope, sourceId });
|
|
1989
|
-
const result = LearningSourceConfigurationSchema.parse(await this.#request("source-config", request, options));
|
|
1990
|
-
if (result.scope !== this.#options.scope || result.source.id !== sourceId) throw new OpenPondLearningError(502, "source_identity_mismatch", "Source configuration did not match the requested source.", null);
|
|
1991
|
-
return result;
|
|
1992
|
-
}
|
|
1993
|
-
#assertCredentialScope(value, sourceId) {
|
|
1994
|
-
if (value.scope !== this.#options.scope || value.sourceId !== sourceId) throw new OpenPondLearningError(502, "credential_scope_mismatch", "Credential response did not match the requested source.", null);
|
|
1995
|
-
}
|
|
1996
|
-
async list(kind, query = {}, options = {}) {
|
|
1997
|
-
const request = LearningReadRequestSchema.parse({ action: "list", scope: this.#options.scope, kind, ...query });
|
|
1998
|
-
return z12.object({ items: z12.array(learningResourceSchemas[kind]).max(100), nextCursor: z12.string().nullable() }).strict().parse(await this.#request("read", request, options));
|
|
1999
|
-
}
|
|
2000
|
-
/** Hosted publication only: stores an immutable package and attaches it, without starting training. */
|
|
2001
|
-
async publishBatch(input, options = {}) {
|
|
2002
|
-
const request = LearningBatchPublicationSchema.parse(input);
|
|
2003
|
-
const result = LearningBatchPublicationResultSchema.parse(await this.#request("publish-batch", { ...request, scope: this.#options.scope }, options));
|
|
2004
|
-
if (result.batchId !== request.batchId) throw new OpenPondLearningError(502, "batch_identity_mismatch", "Published batch response did not match the requested batch.", null);
|
|
2005
|
-
return result;
|
|
2006
|
-
}
|
|
2007
|
-
async #request(endpoint, body, options) {
|
|
2008
|
-
assertBoundedTaskJson(body, 16777216);
|
|
2009
|
-
const response = await (this.#options.fetch ?? globalThis.fetch)(`${this.#options.baseUrl}/v1/learning/${endpoint}`, {
|
|
2010
|
-
method: "POST",
|
|
2011
|
-
headers: { Authorization: `Bearer ${this.#options.apiKey}`, "Content-Type": "application/json", Accept: "application/json", "X-OpenPond-Team-Id": this.#options.scope },
|
|
2012
|
-
body: JSON.stringify(body),
|
|
2013
|
-
signal: options.signal,
|
|
2014
|
-
redirect: "error"
|
|
2015
|
-
});
|
|
2016
|
-
const payload = await readBoundedLearningResponse(response);
|
|
2017
|
-
if (!response.ok) {
|
|
2018
|
-
const error = z12.object({ code: z12.string().optional(), error: z12.string().optional() }).passthrough().safeParse(payload);
|
|
2019
|
-
throw new OpenPondLearningError(response.status, error.success ? error.data.code ?? "learning_request_failed" : "learning_request_failed", error.success ? error.data.error ?? `Learning request failed (${response.status}).` : `Learning request failed (${response.status}).`, payload);
|
|
2020
|
-
}
|
|
2021
|
-
return payload;
|
|
2022
|
-
}
|
|
2023
|
-
};
|
|
2024
|
-
async function readBoundedLearningResponse(response) {
|
|
2025
|
-
const maximumBytes = 16777216;
|
|
2026
|
-
const reader = response.body?.getReader();
|
|
2027
|
-
if (!reader) throw new OpenPondLearningError(response.status, "empty_response", "Learning response was empty.", null);
|
|
2028
|
-
const decoder = new TextDecoder();
|
|
2029
|
-
let bytes = 0;
|
|
2030
|
-
let text = "";
|
|
2031
|
-
try {
|
|
2032
|
-
while (true) {
|
|
2033
|
-
const next = await reader.read();
|
|
2034
|
-
if (next.done) break;
|
|
2035
|
-
bytes += next.value.byteLength;
|
|
2036
|
-
if (bytes > maximumBytes) throw new OpenPondLearningError(response.status, "response_too_large", "Learning response exceeded 16 MiB; request a smaller page.", null);
|
|
2037
|
-
text += decoder.decode(next.value, { stream: true });
|
|
2038
|
-
}
|
|
2039
|
-
text += decoder.decode();
|
|
2040
|
-
const value = JSON.parse(text);
|
|
2041
|
-
assertBoundedTaskJson(value, maximumBytes);
|
|
2042
|
-
return value;
|
|
2043
|
-
} finally {
|
|
2044
|
-
await reader.cancel();
|
|
2045
|
-
reader.releaseLock();
|
|
2046
|
-
}
|
|
2047
|
-
}
|
|
2048
22
|
export {
|
|
2049
23
|
LearningBatchPublicationResultSchema,
|
|
2050
24
|
LearningBatchPublicationSchema,
|