@tangle-network/agent-interface 0.24.0 → 0.26.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 +2 -2
- package/dist/agent-candidate-artifact-schema.d.ts +5 -5
- package/dist/agent-candidate-artifact-schema.js +3 -3
- package/dist/agent-candidate-code-schema.d.ts +3 -3
- package/dist/agent-candidate-execution-plan-schema.d.ts +203 -46
- package/dist/agent-candidate-execution-plan-schema.js +89 -10
- package/dist/agent-candidate-lineage-schema.d.ts +90 -3
- package/dist/agent-candidate-lineage-schema.js +17 -3
- package/dist/agent-candidate-outcome-schema.d.ts +259 -395
- package/dist/agent-candidate-outcome-schema.js +75 -64
- package/dist/agent-candidate-promotion-schema.d.ts +2708 -0
- package/dist/agent-candidate-promotion-schema.js +409 -0
- package/dist/agent-candidate-receipt-schema.d.ts +278 -1337
- package/dist/agent-candidate-receipt-schema.js +7 -116
- package/dist/agent-candidate-schema-common.d.ts +2 -0
- package/dist/agent-candidate-schema-common.js +8 -0
- package/dist/agent-candidate-schema.d.ts +94 -7
- package/dist/agent-candidate-schema.js +1 -1
- package/dist/agent-candidate.d.ts +257 -87
- package/dist/agent-candidate.test-fixture.d.ts +45 -11
- package/dist/agent-candidate.test-fixture.js +46 -12
- package/dist/agent-profile.js +5 -20
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +3 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { agentCandidateCapturedArtifactSchema, agentCandidateWorkspaceSnapshotEvidenceSchema, } from "./agent-candidate-artifact-schema.js";
|
|
2
|
+
import { agentCandidateArtifactRefSchema, agentCandidateCapturedArtifactSchema, agentCandidateWorkspaceSnapshotEvidenceSchema, } from "./agent-candidate-artifact-schema.js";
|
|
3
3
|
import { agentCandidateContainerSchema, agentCandidateInstructionDeliverySchema, agentCandidateWorkingDirectorySchema, } from "./agent-candidate-code-schema.js";
|
|
4
|
-
import { addDuplicateIssues, agentCandidateConfigValueSchema, environmentConfigSchema, gitObjectSchema, isCanonicalJsonValue, isObviouslyPrivateHostname, isSafeExecutable, isSafeRelativePath, sameGitObjectFormat, sha256DigestSchema, } from "./agent-candidate-schema-common.js";
|
|
4
|
+
import { addDuplicateIssues, agentCandidateConfigValueSchema, agentCandidateMediaTypeSchema, environmentConfigSchema, gitObjectSchema, isCanonicalJsonValue, isObviouslyPrivateHostname, isSafeExecutable, isSafeRelativePath, isWellFormedUnicode, sameGitObjectFormat, sha256Utf8, sha256DigestSchema, } from "./agent-candidate-schema-common.js";
|
|
5
5
|
import { harnessTypeSchema } from "./harness.js";
|
|
6
6
|
const reasoningEffortSchema = z.enum([
|
|
7
7
|
"none",
|
|
@@ -140,9 +140,19 @@ export const agentCandidateExecutionLimitsSchema = z
|
|
|
140
140
|
maxCostUsd: z.number().finite().nonnegative(),
|
|
141
141
|
})
|
|
142
142
|
.strict();
|
|
143
|
+
export const agentCandidateTaskOutcomeSpecSchema = z.discriminatedUnion("kind", [
|
|
144
|
+
z.object({ kind: z.literal("workspace") }).strict(),
|
|
145
|
+
z
|
|
146
|
+
.object({
|
|
147
|
+
kind: z.literal("output"),
|
|
148
|
+
mediaType: agentCandidateMediaTypeSchema,
|
|
149
|
+
maxBytes: z.number().int().positive().max(64 * 1024 * 1024),
|
|
150
|
+
})
|
|
151
|
+
.strict(),
|
|
152
|
+
]);
|
|
143
153
|
export const agentCandidateExecutionPlanMaterialSchema = z
|
|
144
154
|
.object({
|
|
145
|
-
schemaVersion: z.literal(
|
|
155
|
+
schemaVersion: z.literal(2),
|
|
146
156
|
kind: z.literal("agent-candidate-execution-plan-material"),
|
|
147
157
|
bundleDigest: sha256DigestSchema,
|
|
148
158
|
executionId: z.string().min(1),
|
|
@@ -174,7 +184,9 @@ export const agentCandidateExecutionPlanMaterialSchema = z
|
|
|
174
184
|
baseCommit: gitObjectSchema,
|
|
175
185
|
baseTree: gitObjectSchema,
|
|
176
186
|
})
|
|
177
|
-
.strict()
|
|
187
|
+
.strict()
|
|
188
|
+
.optional(),
|
|
189
|
+
outcome: agentCandidateTaskOutcomeSpecSchema,
|
|
178
190
|
workspace: agentCandidateWorkspaceSnapshotEvidenceSchema,
|
|
179
191
|
})
|
|
180
192
|
.strict(),
|
|
@@ -258,6 +270,13 @@ export const agentCandidateExecutionPlanMaterialSchema = z
|
|
|
258
270
|
.min(1),
|
|
259
271
|
})
|
|
260
272
|
.strict(),
|
|
273
|
+
grader: z
|
|
274
|
+
.object({
|
|
275
|
+
name: z.string().min(1),
|
|
276
|
+
version: z.string().min(1),
|
|
277
|
+
artifact: agentCandidateArtifactRefSchema,
|
|
278
|
+
})
|
|
279
|
+
.strict(),
|
|
261
280
|
launch: z
|
|
262
281
|
.object({
|
|
263
282
|
executable: z
|
|
@@ -275,13 +294,22 @@ export const agentCandidateExecutionPlanMaterialSchema = z
|
|
|
275
294
|
})
|
|
276
295
|
.strict()
|
|
277
296
|
.superRefine((material, ctx) => {
|
|
278
|
-
if (
|
|
297
|
+
if (material.task.repository !== undefined &&
|
|
298
|
+
!sameGitObjectFormat(material.task.repository.baseCommit, material.task.repository.baseTree)) {
|
|
279
299
|
ctx.addIssue({
|
|
280
300
|
code: "custom",
|
|
281
301
|
path: ["task", "repository"],
|
|
282
302
|
message: "task Git object ids must use one object format",
|
|
283
303
|
});
|
|
284
304
|
}
|
|
305
|
+
if (material.task.outcome.kind === "workspace" &&
|
|
306
|
+
material.task.repository === undefined) {
|
|
307
|
+
ctx.addIssue({
|
|
308
|
+
code: "custom",
|
|
309
|
+
path: ["task", "repository"],
|
|
310
|
+
message: "workspace outcomes require task repository provenance",
|
|
311
|
+
});
|
|
312
|
+
}
|
|
285
313
|
if (material.attempt.number > material.attempt.maxAttempts) {
|
|
286
314
|
ctx.addIssue({
|
|
287
315
|
code: "custom",
|
|
@@ -429,7 +457,8 @@ export const agentCandidateExecutionPlanMaterialSchema = z
|
|
|
429
457
|
message: "active candidate workspaces cannot be empty",
|
|
430
458
|
});
|
|
431
459
|
}
|
|
432
|
-
if (material.task.
|
|
460
|
+
if (material.task.outcome.kind === "workspace" &&
|
|
461
|
+
material.task.workspace.material.files.length === 0) {
|
|
433
462
|
ctx.addIssue({
|
|
434
463
|
code: "custom",
|
|
435
464
|
path: ["task", "workspace", "material", "files"],
|
|
@@ -443,10 +472,10 @@ export const agentCandidateExecutionPlanMaterialSchema = z
|
|
|
443
472
|
});
|
|
444
473
|
}
|
|
445
474
|
});
|
|
446
|
-
function planEvidenceSchema(kind, material) {
|
|
475
|
+
function planEvidenceSchema(schemaVersion, kind, material) {
|
|
447
476
|
return z
|
|
448
477
|
.object({
|
|
449
|
-
schemaVersion: z.literal(
|
|
478
|
+
schemaVersion: z.literal(schemaVersion),
|
|
450
479
|
kind: z.literal(kind),
|
|
451
480
|
digest: sha256DigestSchema,
|
|
452
481
|
material,
|
|
@@ -470,5 +499,55 @@ function planEvidenceSchema(kind, material) {
|
|
|
470
499
|
}
|
|
471
500
|
});
|
|
472
501
|
}
|
|
473
|
-
export const agentCandidateProfilePlanEvidenceSchema = planEvidenceSchema("agent-profile-workspace-plan", agentCandidateProfilePlanMaterialSchema);
|
|
474
|
-
export const
|
|
502
|
+
export const agentCandidateProfilePlanEvidenceSchema = planEvidenceSchema(1, "agent-profile-workspace-plan", agentCandidateProfilePlanMaterialSchema);
|
|
503
|
+
export const agentCandidateProfileActivationSchema = z
|
|
504
|
+
.object({
|
|
505
|
+
schemaVersion: z.literal(1),
|
|
506
|
+
kind: z.literal("agent-candidate-profile-activation"),
|
|
507
|
+
profilePlan: agentCandidateProfilePlanEvidenceSchema,
|
|
508
|
+
files: z.array(z
|
|
509
|
+
.object({
|
|
510
|
+
path: z
|
|
511
|
+
.string()
|
|
512
|
+
.refine((value) => isSafeRelativePath(value, false), "profile activation file must use a canonical relative path"),
|
|
513
|
+
mode: z.number().int().min(0).max(0o777),
|
|
514
|
+
content: z
|
|
515
|
+
.string()
|
|
516
|
+
.refine(isWellFormedUnicode, "profile activation content must be valid Unicode"),
|
|
517
|
+
})
|
|
518
|
+
.strict()),
|
|
519
|
+
digest: sha256DigestSchema,
|
|
520
|
+
})
|
|
521
|
+
.strict()
|
|
522
|
+
.superRefine((activation, ctx) => {
|
|
523
|
+
const planned = activation.profilePlan.material.files;
|
|
524
|
+
if (activation.files.length !== planned.length) {
|
|
525
|
+
ctx.addIssue({
|
|
526
|
+
code: "custom",
|
|
527
|
+
path: ["files"],
|
|
528
|
+
message: "profile activation must contain every planned native file",
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
for (let index = 0; index < planned.length; index++) {
|
|
532
|
+
const expected = planned[index];
|
|
533
|
+
const actual = activation.files[index];
|
|
534
|
+
if (expected === undefined ||
|
|
535
|
+
actual === undefined ||
|
|
536
|
+
actual.path !== expected.relPath ||
|
|
537
|
+
actual.mode !== expected.mode ||
|
|
538
|
+
sha256Utf8(actual.content) !== expected.contentSha256) {
|
|
539
|
+
ctx.addIssue({
|
|
540
|
+
code: "custom",
|
|
541
|
+
path: ["files", index],
|
|
542
|
+
message: "profile activation file path, mode, and content must match the canonical plan",
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
if (!isCanonicalJsonValue(activation)) {
|
|
547
|
+
ctx.addIssue({
|
|
548
|
+
code: "custom",
|
|
549
|
+
message: "profile activation must contain only RFC 8785 JSON values",
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
});
|
|
553
|
+
export const agentCandidateExecutionPlanEvidenceSchema = planEvidenceSchema(2, "agent-candidate-execution-plan", agentCandidateExecutionPlanMaterialSchema);
|
|
@@ -1,7 +1,70 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const agentCandidateKnowledgeSchema: z.ZodObject<{
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
candidate: z.ZodObject<{
|
|
4
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
5
|
+
kind: z.ZodLiteral<"knowledge-improvement-candidate">;
|
|
6
|
+
runId: z.ZodString;
|
|
7
|
+
candidateId: z.ZodString;
|
|
8
|
+
goalHash: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
9
|
+
baseHash: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
10
|
+
candidateHash: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
11
|
+
evidenceHash: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
12
|
+
promotionPlanHash: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
13
|
+
}, z.core.$strict>;
|
|
14
|
+
snapshot: z.ZodObject<{
|
|
15
|
+
schemaVersion: z.ZodLiteral<2>;
|
|
16
|
+
kind: z.ZodLiteral<"agent-candidate-workspace-snapshot">;
|
|
17
|
+
digest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
18
|
+
material: z.ZodObject<{
|
|
19
|
+
schemaVersion: z.ZodLiteral<2>;
|
|
20
|
+
kind: z.ZodLiteral<"agent-candidate-workspace-manifest">;
|
|
21
|
+
files: z.ZodArray<z.ZodObject<{
|
|
22
|
+
path: z.ZodString;
|
|
23
|
+
mode: z.ZodNumber;
|
|
24
|
+
sha256: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
25
|
+
byteLength: z.ZodNumber;
|
|
26
|
+
}, z.core.$strict>>;
|
|
27
|
+
}, z.core.$strict>;
|
|
28
|
+
manifest: z.ZodUnion<readonly [z.ZodObject<{
|
|
29
|
+
locator: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
30
|
+
kind: z.ZodLiteral<"s3">;
|
|
31
|
+
bucket: z.ZodString;
|
|
32
|
+
key: z.ZodString;
|
|
33
|
+
region: z.ZodOptional<z.ZodString>;
|
|
34
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
35
|
+
kind: z.ZodLiteral<"ipfs">;
|
|
36
|
+
cid: z.ZodString;
|
|
37
|
+
path: z.ZodOptional<z.ZodString>;
|
|
38
|
+
}, z.core.$strict>], "kind">;
|
|
39
|
+
sha256: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
40
|
+
byteLength: z.ZodNumber;
|
|
41
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
42
|
+
encoding: z.ZodLiteral<"base64">;
|
|
43
|
+
content: z.ZodString;
|
|
44
|
+
sha256: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
45
|
+
byteLength: z.ZodNumber;
|
|
46
|
+
}, z.core.$strict>]>;
|
|
47
|
+
archive: z.ZodUnion<readonly [z.ZodObject<{
|
|
48
|
+
locator: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
49
|
+
kind: z.ZodLiteral<"s3">;
|
|
50
|
+
bucket: z.ZodString;
|
|
51
|
+
key: z.ZodString;
|
|
52
|
+
region: z.ZodOptional<z.ZodString>;
|
|
53
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
54
|
+
kind: z.ZodLiteral<"ipfs">;
|
|
55
|
+
cid: z.ZodString;
|
|
56
|
+
path: z.ZodOptional<z.ZodString>;
|
|
57
|
+
}, z.core.$strict>], "kind">;
|
|
58
|
+
sha256: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
59
|
+
byteLength: z.ZodNumber;
|
|
60
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
61
|
+
encoding: z.ZodLiteral<"base64">;
|
|
62
|
+
content: z.ZodString;
|
|
63
|
+
sha256: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
64
|
+
byteLength: z.ZodNumber;
|
|
65
|
+
}, z.core.$strict>]>;
|
|
66
|
+
}, z.core.$strict>;
|
|
67
|
+
retrievalConfig: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
5
68
|
locator: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
6
69
|
kind: z.ZodLiteral<"s3">;
|
|
7
70
|
bucket: z.ZodString;
|
|
@@ -14,7 +77,31 @@ export declare const agentCandidateKnowledgeSchema: z.ZodObject<{
|
|
|
14
77
|
}, z.core.$strict>], "kind">;
|
|
15
78
|
sha256: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
16
79
|
byteLength: z.ZodNumber;
|
|
17
|
-
}, z.core.$strict
|
|
80
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
81
|
+
encoding: z.ZodLiteral<"base64">;
|
|
82
|
+
content: z.ZodString;
|
|
83
|
+
sha256: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
84
|
+
byteLength: z.ZodNumber;
|
|
85
|
+
}, z.core.$strict>]>>;
|
|
86
|
+
evaluation: z.ZodUnion<readonly [z.ZodObject<{
|
|
87
|
+
locator: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
88
|
+
kind: z.ZodLiteral<"s3">;
|
|
89
|
+
bucket: z.ZodString;
|
|
90
|
+
key: z.ZodString;
|
|
91
|
+
region: z.ZodOptional<z.ZodString>;
|
|
92
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
93
|
+
kind: z.ZodLiteral<"ipfs">;
|
|
94
|
+
cid: z.ZodString;
|
|
95
|
+
path: z.ZodOptional<z.ZodString>;
|
|
96
|
+
}, z.core.$strict>], "kind">;
|
|
97
|
+
sha256: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
98
|
+
byteLength: z.ZodNumber;
|
|
99
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
100
|
+
encoding: z.ZodLiteral<"base64">;
|
|
101
|
+
content: z.ZodString;
|
|
102
|
+
sha256: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
103
|
+
byteLength: z.ZodNumber;
|
|
104
|
+
}, z.core.$strict>]>;
|
|
18
105
|
}, z.core.$strict>;
|
|
19
106
|
export declare const agentCandidateMemoryPolicySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
20
107
|
mode: z.ZodLiteral<"disabled">;
|
|
@@ -1,10 +1,24 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { agentCandidateArtifactRefSchema } from "./agent-candidate-artifact-schema.js";
|
|
2
|
+
import { agentCandidateArtifactRefSchema, agentCandidateCapturedArtifactSchema, agentCandidateWorkspaceSnapshotEvidenceSchema, } from "./agent-candidate-artifact-schema.js";
|
|
3
3
|
import { addDuplicateIssues, sha256DigestSchema, } from "./agent-candidate-schema-common.js";
|
|
4
4
|
export const agentCandidateKnowledgeSchema = z
|
|
5
5
|
.object({
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
candidate: z
|
|
7
|
+
.object({
|
|
8
|
+
schemaVersion: z.literal(1),
|
|
9
|
+
kind: z.literal("knowledge-improvement-candidate"),
|
|
10
|
+
runId: z.string().min(1),
|
|
11
|
+
candidateId: z.string().min(1),
|
|
12
|
+
goalHash: sha256DigestSchema,
|
|
13
|
+
baseHash: sha256DigestSchema,
|
|
14
|
+
candidateHash: sha256DigestSchema,
|
|
15
|
+
evidenceHash: sha256DigestSchema,
|
|
16
|
+
promotionPlanHash: sha256DigestSchema,
|
|
17
|
+
})
|
|
18
|
+
.strict(),
|
|
19
|
+
snapshot: agentCandidateWorkspaceSnapshotEvidenceSchema,
|
|
20
|
+
retrievalConfig: agentCandidateCapturedArtifactSchema.optional(),
|
|
21
|
+
evaluation: agentCandidateCapturedArtifactSchema,
|
|
8
22
|
})
|
|
9
23
|
.strict();
|
|
10
24
|
export const agentCandidateMemoryPolicySchema = z.discriminatedUnion("mode", [
|