@tangle-network/agent-interface 0.19.0 → 0.21.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/README.md +24 -0
- package/dist/agent-candidate-artifact-schema.d.ts +311 -0
- package/dist/agent-candidate-artifact-schema.js +192 -0
- package/dist/agent-candidate-code-schema.d.ts +295 -0
- package/dist/agent-candidate-code-schema.js +185 -0
- package/dist/agent-candidate-execution-plan-schema.d.ts +1193 -0
- package/dist/agent-candidate-execution-plan-schema.js +418 -0
- package/dist/agent-candidate-lineage-schema.d.ts +78 -0
- package/dist/agent-candidate-lineage-schema.js +96 -0
- package/dist/agent-candidate-profile-schema.d.ts +267 -0
- package/dist/agent-candidate-profile-schema.js +125 -0
- package/dist/agent-candidate-receipt-schema.d.ts +1081 -0
- package/dist/agent-candidate-receipt-schema.js +263 -0
- package/dist/agent-candidate-schema-common.d.ts +32 -0
- package/dist/agent-candidate-schema-common.js +251 -0
- package/dist/agent-candidate-schema.d.ts +498 -0
- package/dist/agent-candidate-schema.js +144 -0
- package/dist/agent-candidate.d.ts +518 -0
- package/dist/agent-candidate.js +6 -0
- package/dist/agent-candidate.test-fixture.d.ts +160 -0
- package/dist/agent-candidate.test-fixture.js +151 -0
- package/dist/agent-profile.d.ts +14 -0
- package/dist/harness.d.ts +7 -4
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/interaction.d.ts +4 -4
- package/dist/profile-diff.d.ts +4 -1
- package/dist/profile-diff.js +64 -64
- package/dist/profile-schema.d.ts +19 -0
- package/dist/profile-schema.js +3 -0
- package/package.json +1 -1
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const agentCandidateCodeDisabledSchema: z.ZodObject<{
|
|
3
|
+
kind: z.ZodLiteral<"disabled">;
|
|
4
|
+
reason: z.ZodEnum<{
|
|
5
|
+
control: "control";
|
|
6
|
+
"not-applicable": "not-applicable";
|
|
7
|
+
}>;
|
|
8
|
+
}, z.core.$strict>;
|
|
9
|
+
export declare const agentCandidateCodeNoOpSchema: z.ZodObject<{
|
|
10
|
+
kind: z.ZodLiteral<"no-op">;
|
|
11
|
+
reason: z.ZodLiteral<"proposer-no-change">;
|
|
12
|
+
repository: z.ZodObject<{
|
|
13
|
+
kind: z.ZodLiteral<"github">;
|
|
14
|
+
owner: z.ZodString;
|
|
15
|
+
repo: z.ZodString;
|
|
16
|
+
}, z.core.$strict>;
|
|
17
|
+
baseCommit: z.ZodString;
|
|
18
|
+
baseTree: z.ZodString;
|
|
19
|
+
}, z.core.$strict>;
|
|
20
|
+
export declare const agentCandidateGitPatchSchema: z.ZodObject<{
|
|
21
|
+
kind: z.ZodLiteral<"git-patch">;
|
|
22
|
+
repository: z.ZodObject<{
|
|
23
|
+
kind: z.ZodLiteral<"github">;
|
|
24
|
+
owner: z.ZodString;
|
|
25
|
+
repo: z.ZodString;
|
|
26
|
+
}, z.core.$strict>;
|
|
27
|
+
baseCommit: z.ZodString;
|
|
28
|
+
baseTree: z.ZodString;
|
|
29
|
+
candidateTree: z.ZodString;
|
|
30
|
+
patch: z.ZodObject<{
|
|
31
|
+
format: z.ZodLiteral<"git-diff-binary">;
|
|
32
|
+
artifact: z.ZodObject<{
|
|
33
|
+
encoding: z.ZodLiteral<"base64">;
|
|
34
|
+
content: z.ZodString;
|
|
35
|
+
sha256: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
36
|
+
byteLength: z.ZodNumber;
|
|
37
|
+
}, z.core.$strict>;
|
|
38
|
+
}, z.core.$strict>;
|
|
39
|
+
}, z.core.$strict>;
|
|
40
|
+
export declare const agentCandidateCodeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
41
|
+
kind: z.ZodLiteral<"disabled">;
|
|
42
|
+
reason: z.ZodEnum<{
|
|
43
|
+
control: "control";
|
|
44
|
+
"not-applicable": "not-applicable";
|
|
45
|
+
}>;
|
|
46
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
47
|
+
kind: z.ZodLiteral<"no-op">;
|
|
48
|
+
reason: z.ZodLiteral<"proposer-no-change">;
|
|
49
|
+
repository: z.ZodObject<{
|
|
50
|
+
kind: z.ZodLiteral<"github">;
|
|
51
|
+
owner: z.ZodString;
|
|
52
|
+
repo: z.ZodString;
|
|
53
|
+
}, z.core.$strict>;
|
|
54
|
+
baseCommit: z.ZodString;
|
|
55
|
+
baseTree: z.ZodString;
|
|
56
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
57
|
+
kind: z.ZodLiteral<"git-patch">;
|
|
58
|
+
repository: z.ZodObject<{
|
|
59
|
+
kind: z.ZodLiteral<"github">;
|
|
60
|
+
owner: z.ZodString;
|
|
61
|
+
repo: z.ZodString;
|
|
62
|
+
}, z.core.$strict>;
|
|
63
|
+
baseCommit: z.ZodString;
|
|
64
|
+
baseTree: z.ZodString;
|
|
65
|
+
candidateTree: z.ZodString;
|
|
66
|
+
patch: z.ZodObject<{
|
|
67
|
+
format: z.ZodLiteral<"git-diff-binary">;
|
|
68
|
+
artifact: z.ZodObject<{
|
|
69
|
+
encoding: z.ZodLiteral<"base64">;
|
|
70
|
+
content: z.ZodString;
|
|
71
|
+
sha256: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
72
|
+
byteLength: z.ZodNumber;
|
|
73
|
+
}, z.core.$strict>;
|
|
74
|
+
}, z.core.$strict>;
|
|
75
|
+
}, z.core.$strict>], "kind">;
|
|
76
|
+
export declare const agentCandidateContainerSchema: z.ZodObject<{
|
|
77
|
+
image: z.ZodString;
|
|
78
|
+
indexDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
79
|
+
}, z.core.$strict>;
|
|
80
|
+
export declare const agentCandidatePinnedContainerEnvironmentSchema: z.ZodObject<{
|
|
81
|
+
kind: z.ZodLiteral<"pinned-container">;
|
|
82
|
+
container: z.ZodObject<{
|
|
83
|
+
image: z.ZodString;
|
|
84
|
+
indexDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
85
|
+
}, z.core.$strict>;
|
|
86
|
+
}, z.core.$strict>;
|
|
87
|
+
export declare const agentCandidateEvaluatorTaskEnvironmentSchema: z.ZodObject<{
|
|
88
|
+
kind: z.ZodLiteral<"evaluator-task-container">;
|
|
89
|
+
}, z.core.$strict>;
|
|
90
|
+
export declare const agentCandidateExecutionEnvironmentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
91
|
+
kind: z.ZodLiteral<"pinned-container">;
|
|
92
|
+
container: z.ZodObject<{
|
|
93
|
+
image: z.ZodString;
|
|
94
|
+
indexDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
95
|
+
}, z.core.$strict>;
|
|
96
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
97
|
+
kind: z.ZodLiteral<"evaluator-task-container">;
|
|
98
|
+
}, z.core.$strict>], "kind">;
|
|
99
|
+
export declare const agentCandidateWorkingDirectorySchema: z.ZodObject<{
|
|
100
|
+
workspace: z.ZodEnum<{
|
|
101
|
+
candidate: "candidate";
|
|
102
|
+
task: "task";
|
|
103
|
+
}>;
|
|
104
|
+
path: z.ZodString;
|
|
105
|
+
}, z.core.$strict>;
|
|
106
|
+
export declare const agentCandidateContainerLaunchSchema: z.ZodObject<{
|
|
107
|
+
kind: z.ZodLiteral<"container-command">;
|
|
108
|
+
executable: z.ZodString;
|
|
109
|
+
args: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
110
|
+
kind: z.ZodLiteral<"public">;
|
|
111
|
+
value: z.ZodString;
|
|
112
|
+
}, z.core.$strict>>>;
|
|
113
|
+
}, z.core.$strict>;
|
|
114
|
+
export declare const agentCandidateEntrypointLaunchSchema: z.ZodObject<{
|
|
115
|
+
kind: z.ZodLiteral<"candidate-entrypoint">;
|
|
116
|
+
entrypoint: z.ZodString;
|
|
117
|
+
interpreter: z.ZodOptional<z.ZodEnum<{
|
|
118
|
+
node: "node";
|
|
119
|
+
python: "python";
|
|
120
|
+
python3: "python3";
|
|
121
|
+
bun: "bun";
|
|
122
|
+
deno: "deno";
|
|
123
|
+
tsx: "tsx";
|
|
124
|
+
uv: "uv";
|
|
125
|
+
}>>;
|
|
126
|
+
args: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
127
|
+
kind: z.ZodLiteral<"public">;
|
|
128
|
+
value: z.ZodString;
|
|
129
|
+
}, z.core.$strict>>>;
|
|
130
|
+
}, z.core.$strict>;
|
|
131
|
+
export declare const agentCandidateLaunchSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
132
|
+
kind: z.ZodLiteral<"container-command">;
|
|
133
|
+
executable: z.ZodString;
|
|
134
|
+
args: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
135
|
+
kind: z.ZodLiteral<"public">;
|
|
136
|
+
value: z.ZodString;
|
|
137
|
+
}, z.core.$strict>>>;
|
|
138
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
139
|
+
kind: z.ZodLiteral<"candidate-entrypoint">;
|
|
140
|
+
entrypoint: z.ZodString;
|
|
141
|
+
interpreter: z.ZodOptional<z.ZodEnum<{
|
|
142
|
+
node: "node";
|
|
143
|
+
python: "python";
|
|
144
|
+
python3: "python3";
|
|
145
|
+
bun: "bun";
|
|
146
|
+
deno: "deno";
|
|
147
|
+
tsx: "tsx";
|
|
148
|
+
uv: "uv";
|
|
149
|
+
}>>;
|
|
150
|
+
args: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
151
|
+
kind: z.ZodLiteral<"public">;
|
|
152
|
+
value: z.ZodString;
|
|
153
|
+
}, z.core.$strict>>>;
|
|
154
|
+
}, z.core.$strict>], "kind">;
|
|
155
|
+
export declare const agentCandidateInstructionDeliverySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
156
|
+
kind: z.ZodLiteral<"argv-append">;
|
|
157
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
158
|
+
kind: z.ZodLiteral<"stdin-utf8">;
|
|
159
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
160
|
+
kind: z.ZodLiteral<"utf8-file">;
|
|
161
|
+
env: z.ZodLiteral<"TANGLE_CANDIDATE_TASK_PATH">;
|
|
162
|
+
path: z.ZodLiteral<"/tangle/input/task.txt">;
|
|
163
|
+
}, z.core.$strict>], "kind">;
|
|
164
|
+
export declare const agentCandidateExecutionSchema: z.ZodObject<{
|
|
165
|
+
harness: z.ZodEnum<{
|
|
166
|
+
"claude-code": "claude-code";
|
|
167
|
+
claude: "claude";
|
|
168
|
+
claudish: "claudish";
|
|
169
|
+
nanoclaw: "nanoclaw";
|
|
170
|
+
codex: "codex";
|
|
171
|
+
opencode: "opencode";
|
|
172
|
+
"kimi-code": "kimi-code";
|
|
173
|
+
kimi: "kimi";
|
|
174
|
+
pi: "pi";
|
|
175
|
+
gemini: "gemini";
|
|
176
|
+
hermes: "hermes";
|
|
177
|
+
openclaw: "openclaw";
|
|
178
|
+
amp: "amp";
|
|
179
|
+
"factory-droids": "factory-droids";
|
|
180
|
+
acp: "acp";
|
|
181
|
+
"cli-base": "cli-base";
|
|
182
|
+
}>;
|
|
183
|
+
harnessVersion: z.ZodString;
|
|
184
|
+
launch: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
185
|
+
kind: z.ZodLiteral<"container-command">;
|
|
186
|
+
executable: z.ZodString;
|
|
187
|
+
args: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
188
|
+
kind: z.ZodLiteral<"public">;
|
|
189
|
+
value: z.ZodString;
|
|
190
|
+
}, z.core.$strict>>>;
|
|
191
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
192
|
+
kind: z.ZodLiteral<"candidate-entrypoint">;
|
|
193
|
+
entrypoint: z.ZodString;
|
|
194
|
+
interpreter: z.ZodOptional<z.ZodEnum<{
|
|
195
|
+
node: "node";
|
|
196
|
+
python: "python";
|
|
197
|
+
python3: "python3";
|
|
198
|
+
bun: "bun";
|
|
199
|
+
deno: "deno";
|
|
200
|
+
tsx: "tsx";
|
|
201
|
+
uv: "uv";
|
|
202
|
+
}>>;
|
|
203
|
+
args: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
204
|
+
kind: z.ZodLiteral<"public">;
|
|
205
|
+
value: z.ZodString;
|
|
206
|
+
}, z.core.$strict>>>;
|
|
207
|
+
}, z.core.$strict>], "kind">;
|
|
208
|
+
instructionDelivery: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
209
|
+
kind: z.ZodLiteral<"argv-append">;
|
|
210
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
211
|
+
kind: z.ZodLiteral<"stdin-utf8">;
|
|
212
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
213
|
+
kind: z.ZodLiteral<"utf8-file">;
|
|
214
|
+
env: z.ZodLiteral<"TANGLE_CANDIDATE_TASK_PATH">;
|
|
215
|
+
path: z.ZodLiteral<"/tangle/input/task.txt">;
|
|
216
|
+
}, z.core.$strict>], "kind">;
|
|
217
|
+
cwd: z.ZodObject<{
|
|
218
|
+
workspace: z.ZodEnum<{
|
|
219
|
+
candidate: "candidate";
|
|
220
|
+
task: "task";
|
|
221
|
+
}>;
|
|
222
|
+
path: z.ZodString;
|
|
223
|
+
}, z.core.$strict>;
|
|
224
|
+
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
225
|
+
kind: z.ZodLiteral<"public">;
|
|
226
|
+
value: z.ZodString;
|
|
227
|
+
}, z.core.$strict>>>;
|
|
228
|
+
environment: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
229
|
+
kind: z.ZodLiteral<"pinned-container">;
|
|
230
|
+
container: z.ZodObject<{
|
|
231
|
+
image: z.ZodString;
|
|
232
|
+
indexDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
233
|
+
}, z.core.$strict>;
|
|
234
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
235
|
+
kind: z.ZodLiteral<"evaluator-task-container">;
|
|
236
|
+
}, z.core.$strict>], "kind">;
|
|
237
|
+
workspace: z.ZodOptional<z.ZodObject<{
|
|
238
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
239
|
+
kind: z.ZodLiteral<"agent-candidate-workspace-snapshot">;
|
|
240
|
+
digest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
241
|
+
material: z.ZodObject<{
|
|
242
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
243
|
+
kind: z.ZodLiteral<"agent-candidate-workspace-manifest">;
|
|
244
|
+
files: z.ZodArray<z.ZodObject<{
|
|
245
|
+
path: z.ZodString;
|
|
246
|
+
mode: z.ZodUnion<readonly [z.ZodLiteral<420>, z.ZodLiteral<493>]>;
|
|
247
|
+
sha256: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
248
|
+
byteLength: z.ZodNumber;
|
|
249
|
+
}, z.core.$strict>>;
|
|
250
|
+
}, z.core.$strict>;
|
|
251
|
+
manifest: z.ZodUnion<readonly [z.ZodObject<{
|
|
252
|
+
locator: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
253
|
+
kind: z.ZodLiteral<"s3">;
|
|
254
|
+
bucket: z.ZodString;
|
|
255
|
+
key: z.ZodString;
|
|
256
|
+
region: z.ZodOptional<z.ZodString>;
|
|
257
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
258
|
+
kind: z.ZodLiteral<"ipfs">;
|
|
259
|
+
cid: z.ZodString;
|
|
260
|
+
path: z.ZodOptional<z.ZodString>;
|
|
261
|
+
}, z.core.$strict>], "kind">;
|
|
262
|
+
sha256: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
263
|
+
byteLength: z.ZodNumber;
|
|
264
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
265
|
+
encoding: z.ZodLiteral<"base64">;
|
|
266
|
+
content: z.ZodString;
|
|
267
|
+
sha256: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
268
|
+
byteLength: z.ZodNumber;
|
|
269
|
+
}, z.core.$strict>]>;
|
|
270
|
+
archive: z.ZodUnion<readonly [z.ZodObject<{
|
|
271
|
+
locator: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
272
|
+
kind: z.ZodLiteral<"s3">;
|
|
273
|
+
bucket: z.ZodString;
|
|
274
|
+
key: z.ZodString;
|
|
275
|
+
region: z.ZodOptional<z.ZodString>;
|
|
276
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
277
|
+
kind: z.ZodLiteral<"ipfs">;
|
|
278
|
+
cid: z.ZodString;
|
|
279
|
+
path: z.ZodOptional<z.ZodString>;
|
|
280
|
+
}, z.core.$strict>], "kind">;
|
|
281
|
+
sha256: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
282
|
+
byteLength: z.ZodNumber;
|
|
283
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
284
|
+
encoding: z.ZodLiteral<"base64">;
|
|
285
|
+
content: z.ZodString;
|
|
286
|
+
sha256: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
287
|
+
byteLength: z.ZodNumber;
|
|
288
|
+
}, z.core.$strict>]>;
|
|
289
|
+
}, z.core.$strict>>;
|
|
290
|
+
isolation: z.ZodObject<{
|
|
291
|
+
network: z.ZodLiteral<"disabled">;
|
|
292
|
+
remoteIntegrations: z.ZodLiteral<"disabled">;
|
|
293
|
+
candidateSecrets: z.ZodLiteral<"disabled">;
|
|
294
|
+
}, z.core.$strict>;
|
|
295
|
+
}, z.core.$strict>;
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { agentCandidateEmbeddedArtifactSchema, agentCandidateWorkspaceSnapshotEvidenceSchema, } from "./agent-candidate-artifact-schema.js";
|
|
3
|
+
import { agentCandidateConfigValueSchema, agentCandidateGitHubRepositorySchema, environmentConfigSchema, gitObjectSchema, isObviouslyPrivateHostname, isSafeExecutable, isSafeRelativePath, sameGitObjectFormat, sha256DigestSchema, } from "./agent-candidate-schema-common.js";
|
|
4
|
+
import { harnessTypeSchema } from "./harness.js";
|
|
5
|
+
function isSafeOciImage(value) {
|
|
6
|
+
if (!/^[A-Za-z0-9._:/-]+$/.test(value) ||
|
|
7
|
+
/\s/.test(value) ||
|
|
8
|
+
value.includes("@") ||
|
|
9
|
+
value.includes("://")) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
const parts = value.split("/");
|
|
13
|
+
if (parts.length < 2)
|
|
14
|
+
return true;
|
|
15
|
+
const first = parts[0] ?? "";
|
|
16
|
+
const hasExplicitRegistry = first.includes(".") || first.includes(":") || first === "localhost";
|
|
17
|
+
if (!hasExplicitRegistry)
|
|
18
|
+
return true;
|
|
19
|
+
const hostname = first.startsWith("[")
|
|
20
|
+
? first.slice(1, first.indexOf("]"))
|
|
21
|
+
: first.split(":")[0] ?? "";
|
|
22
|
+
return hostname.length > 0 && !isObviouslyPrivateHostname(hostname);
|
|
23
|
+
}
|
|
24
|
+
const executableSchema = z
|
|
25
|
+
.string()
|
|
26
|
+
.refine(isSafeExecutable, "executable must be a canonical non-shell command");
|
|
27
|
+
export const agentCandidateCodeDisabledSchema = z
|
|
28
|
+
.object({
|
|
29
|
+
kind: z.literal("disabled"),
|
|
30
|
+
reason: z.enum(["control", "not-applicable"]),
|
|
31
|
+
})
|
|
32
|
+
.strict();
|
|
33
|
+
export const agentCandidateCodeNoOpSchema = z
|
|
34
|
+
.object({
|
|
35
|
+
kind: z.literal("no-op"),
|
|
36
|
+
reason: z.literal("proposer-no-change"),
|
|
37
|
+
repository: agentCandidateGitHubRepositorySchema,
|
|
38
|
+
baseCommit: gitObjectSchema,
|
|
39
|
+
baseTree: gitObjectSchema,
|
|
40
|
+
})
|
|
41
|
+
.strict()
|
|
42
|
+
.superRefine((code, ctx) => {
|
|
43
|
+
if (!sameGitObjectFormat(code.baseCommit, code.baseTree)) {
|
|
44
|
+
ctx.addIssue({
|
|
45
|
+
code: "custom",
|
|
46
|
+
message: "Git object ids in one code record must use one object format",
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
export const agentCandidateGitPatchSchema = z
|
|
51
|
+
.object({
|
|
52
|
+
kind: z.literal("git-patch"),
|
|
53
|
+
repository: agentCandidateGitHubRepositorySchema,
|
|
54
|
+
baseCommit: gitObjectSchema,
|
|
55
|
+
baseTree: gitObjectSchema,
|
|
56
|
+
candidateTree: gitObjectSchema,
|
|
57
|
+
patch: z
|
|
58
|
+
.object({
|
|
59
|
+
format: z.literal("git-diff-binary"),
|
|
60
|
+
artifact: agentCandidateEmbeddedArtifactSchema,
|
|
61
|
+
})
|
|
62
|
+
.strict(),
|
|
63
|
+
})
|
|
64
|
+
.strict()
|
|
65
|
+
.superRefine((code, ctx) => {
|
|
66
|
+
if (!sameGitObjectFormat(code.baseCommit, code.baseTree, code.candidateTree)) {
|
|
67
|
+
ctx.addIssue({
|
|
68
|
+
code: "custom",
|
|
69
|
+
message: "Git object ids in one code record must use one object format",
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
if (code.baseTree === code.candidateTree) {
|
|
73
|
+
ctx.addIssue({
|
|
74
|
+
code: "custom",
|
|
75
|
+
path: ["candidateTree"],
|
|
76
|
+
message: "git-patch must change the tree; use code.kind='no-op'",
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
if (code.patch.artifact.byteLength === 0) {
|
|
80
|
+
ctx.addIssue({
|
|
81
|
+
code: "custom",
|
|
82
|
+
path: ["patch", "artifact", "byteLength"],
|
|
83
|
+
message: "git-patch must contain bytes; use code.kind='no-op'",
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
export const agentCandidateCodeSchema = z.discriminatedUnion("kind", [
|
|
88
|
+
agentCandidateCodeDisabledSchema,
|
|
89
|
+
agentCandidateCodeNoOpSchema,
|
|
90
|
+
agentCandidateGitPatchSchema,
|
|
91
|
+
]);
|
|
92
|
+
export const agentCandidateContainerSchema = z
|
|
93
|
+
.object({
|
|
94
|
+
image: z
|
|
95
|
+
.string()
|
|
96
|
+
.min(1)
|
|
97
|
+
.refine(isSafeOciImage, "image must be a non-private OCI reference without credentials or an embedded digest"),
|
|
98
|
+
indexDigest: sha256DigestSchema,
|
|
99
|
+
})
|
|
100
|
+
.strict();
|
|
101
|
+
export const agentCandidatePinnedContainerEnvironmentSchema = z
|
|
102
|
+
.object({
|
|
103
|
+
kind: z.literal("pinned-container"),
|
|
104
|
+
container: agentCandidateContainerSchema,
|
|
105
|
+
})
|
|
106
|
+
.strict();
|
|
107
|
+
export const agentCandidateEvaluatorTaskEnvironmentSchema = z
|
|
108
|
+
.object({
|
|
109
|
+
kind: z.literal("evaluator-task-container"),
|
|
110
|
+
})
|
|
111
|
+
.strict();
|
|
112
|
+
export const agentCandidateExecutionEnvironmentSchema = z.discriminatedUnion("kind", [
|
|
113
|
+
agentCandidatePinnedContainerEnvironmentSchema,
|
|
114
|
+
agentCandidateEvaluatorTaskEnvironmentSchema,
|
|
115
|
+
]);
|
|
116
|
+
export const agentCandidateWorkingDirectorySchema = z
|
|
117
|
+
.object({
|
|
118
|
+
workspace: z.enum(["candidate", "task"]),
|
|
119
|
+
path: z
|
|
120
|
+
.string()
|
|
121
|
+
.refine((value) => isSafeRelativePath(value, true), "cwd path must be a canonical workspace-relative path"),
|
|
122
|
+
})
|
|
123
|
+
.strict();
|
|
124
|
+
export const agentCandidateContainerLaunchSchema = z
|
|
125
|
+
.object({
|
|
126
|
+
kind: z.literal("container-command"),
|
|
127
|
+
executable: executableSchema,
|
|
128
|
+
args: z.array(agentCandidateConfigValueSchema).optional(),
|
|
129
|
+
})
|
|
130
|
+
.strict();
|
|
131
|
+
export const agentCandidateEntrypointLaunchSchema = z
|
|
132
|
+
.object({
|
|
133
|
+
kind: z.literal("candidate-entrypoint"),
|
|
134
|
+
entrypoint: z
|
|
135
|
+
.string()
|
|
136
|
+
.refine((value) => isSafeRelativePath(value, false), "entrypoint must be a canonical candidate-relative path"),
|
|
137
|
+
interpreter: z
|
|
138
|
+
.enum(["node", "python", "python3", "bun", "deno", "tsx", "uv"])
|
|
139
|
+
.optional(),
|
|
140
|
+
args: z.array(agentCandidateConfigValueSchema).optional(),
|
|
141
|
+
})
|
|
142
|
+
.strict();
|
|
143
|
+
export const agentCandidateLaunchSchema = z.discriminatedUnion("kind", [
|
|
144
|
+
agentCandidateContainerLaunchSchema,
|
|
145
|
+
agentCandidateEntrypointLaunchSchema,
|
|
146
|
+
]);
|
|
147
|
+
export const agentCandidateInstructionDeliverySchema = z.discriminatedUnion("kind", [
|
|
148
|
+
z.object({ kind: z.literal("argv-append") }).strict(),
|
|
149
|
+
z.object({ kind: z.literal("stdin-utf8") }).strict(),
|
|
150
|
+
z
|
|
151
|
+
.object({
|
|
152
|
+
kind: z.literal("utf8-file"),
|
|
153
|
+
env: z.literal("TANGLE_CANDIDATE_TASK_PATH"),
|
|
154
|
+
path: z.literal("/tangle/input/task.txt"),
|
|
155
|
+
})
|
|
156
|
+
.strict(),
|
|
157
|
+
]);
|
|
158
|
+
export const agentCandidateExecutionSchema = z
|
|
159
|
+
.object({
|
|
160
|
+
harness: harnessTypeSchema,
|
|
161
|
+
harnessVersion: z.string().min(1),
|
|
162
|
+
launch: agentCandidateLaunchSchema,
|
|
163
|
+
instructionDelivery: agentCandidateInstructionDeliverySchema,
|
|
164
|
+
cwd: agentCandidateWorkingDirectorySchema,
|
|
165
|
+
env: environmentConfigSchema.optional(),
|
|
166
|
+
environment: agentCandidateExecutionEnvironmentSchema,
|
|
167
|
+
workspace: agentCandidateWorkspaceSnapshotEvidenceSchema.optional(),
|
|
168
|
+
isolation: z
|
|
169
|
+
.object({
|
|
170
|
+
network: z.literal("disabled"),
|
|
171
|
+
remoteIntegrations: z.literal("disabled"),
|
|
172
|
+
candidateSecrets: z.literal("disabled"),
|
|
173
|
+
})
|
|
174
|
+
.strict(),
|
|
175
|
+
})
|
|
176
|
+
.strict()
|
|
177
|
+
.superRefine((execution, ctx) => {
|
|
178
|
+
if (execution.env?.TANGLE_CANDIDATE_TASK_PATH !== undefined) {
|
|
179
|
+
ctx.addIssue({
|
|
180
|
+
code: "custom",
|
|
181
|
+
path: ["env", "TANGLE_CANDIDATE_TASK_PATH"],
|
|
182
|
+
message: "the evaluator exclusively owns task-instruction delivery",
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
});
|