@tangle-network/agent-interface 0.22.0 → 0.23.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.
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
export declare const agentCandidateModelAccessNetworkSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
3
|
+
mode: z.ZodLiteral<"disabled">;
|
|
4
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
5
|
+
mode: z.ZodLiteral<"gateway-only">;
|
|
6
|
+
domains: z.ZodArray<z.ZodString>;
|
|
7
|
+
}, z.core.$strict>], "mode">;
|
|
2
8
|
export declare const agentCandidateResolvedModelSchema: z.ZodObject<{
|
|
3
9
|
requested: z.ZodString;
|
|
4
10
|
provider: z.ZodString;
|
|
@@ -359,6 +365,12 @@ export declare const agentCandidateExecutionPlanMaterialSchema: z.ZodObject<{
|
|
|
359
365
|
access: z.ZodObject<{
|
|
360
366
|
kind: z.ZodLiteral<"evaluator-mediated">;
|
|
361
367
|
grantDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
368
|
+
network: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
369
|
+
mode: z.ZodLiteral<"disabled">;
|
|
370
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
371
|
+
mode: z.ZodLiteral<"gateway-only">;
|
|
372
|
+
domains: z.ZodArray<z.ZodString>;
|
|
373
|
+
}, z.core.$strict>], "mode">;
|
|
362
374
|
}, z.core.$strict>;
|
|
363
375
|
routes: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
364
376
|
kind: z.ZodLiteral<"primary">;
|
|
@@ -684,6 +696,12 @@ export declare const agentCandidateExecutionPlanEvidenceSchema: z.ZodObject<{
|
|
|
684
696
|
access: {
|
|
685
697
|
kind: "evaluator-mediated";
|
|
686
698
|
grantDigest: `sha256:${string}`;
|
|
699
|
+
network: {
|
|
700
|
+
mode: "disabled";
|
|
701
|
+
} | {
|
|
702
|
+
mode: "gateway-only";
|
|
703
|
+
domains: string[];
|
|
704
|
+
};
|
|
687
705
|
};
|
|
688
706
|
routes: ({
|
|
689
707
|
kind: "primary";
|
|
@@ -989,6 +1007,12 @@ export declare const agentCandidateExecutionPlanEvidenceSchema: z.ZodObject<{
|
|
|
989
1007
|
access: {
|
|
990
1008
|
kind: "evaluator-mediated";
|
|
991
1009
|
grantDigest: `sha256:${string}`;
|
|
1010
|
+
network: {
|
|
1011
|
+
mode: "disabled";
|
|
1012
|
+
} | {
|
|
1013
|
+
mode: "gateway-only";
|
|
1014
|
+
domains: string[];
|
|
1015
|
+
};
|
|
992
1016
|
};
|
|
993
1017
|
routes: ({
|
|
994
1018
|
kind: "primary";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { 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, isSafeExecutable, isSafeRelativePath, sameGitObjectFormat, sha256DigestSchema, } from "./agent-candidate-schema-common.js";
|
|
4
|
+
import { addDuplicateIssues, agentCandidateConfigValueSchema, environmentConfigSchema, gitObjectSchema, isCanonicalJsonValue, isObviouslyPrivateHostname, isSafeExecutable, isSafeRelativePath, sameGitObjectFormat, sha256DigestSchema, } from "./agent-candidate-schema-common.js";
|
|
5
5
|
import { harnessTypeSchema } from "./harness.js";
|
|
6
6
|
const reasoningEffortSchema = z.enum([
|
|
7
7
|
"none",
|
|
@@ -21,6 +21,34 @@ function isCanonicalAbsolutePath(value) {
|
|
|
21
21
|
function pathsOverlap(left, right) {
|
|
22
22
|
return left === right || left.startsWith(`${right}/`) || right.startsWith(`${left}/`);
|
|
23
23
|
}
|
|
24
|
+
function isExactPublicGatewayDomain(value) {
|
|
25
|
+
if (value.length > 253 ||
|
|
26
|
+
value !== value.toLowerCase() ||
|
|
27
|
+
value.endsWith(".") ||
|
|
28
|
+
value.includes(":") ||
|
|
29
|
+
isObviouslyPrivateHostname(value)) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
const labels = value.split(".");
|
|
33
|
+
return (labels.length >= 2 &&
|
|
34
|
+
labels.every((label) => label.length >= 1 &&
|
|
35
|
+
label.length <= 63 &&
|
|
36
|
+
/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/.test(label)) &&
|
|
37
|
+
/[a-z]/.test(labels.at(-1) ?? ""));
|
|
38
|
+
}
|
|
39
|
+
export const agentCandidateModelAccessNetworkSchema = z.discriminatedUnion("mode", [
|
|
40
|
+
z.object({ mode: z.literal("disabled") }).strict(),
|
|
41
|
+
z
|
|
42
|
+
.object({
|
|
43
|
+
mode: z.literal("gateway-only"),
|
|
44
|
+
domains: z
|
|
45
|
+
.array(z
|
|
46
|
+
.string()
|
|
47
|
+
.refine(isExactPublicGatewayDomain, "model gateway must be an exact lowercase public DNS name"))
|
|
48
|
+
.min(1),
|
|
49
|
+
})
|
|
50
|
+
.strict(),
|
|
51
|
+
]);
|
|
24
52
|
export const agentCandidateResolvedModelSchema = z
|
|
25
53
|
.object({
|
|
26
54
|
requested: z.string().min(1),
|
|
@@ -195,6 +223,7 @@ export const agentCandidateExecutionPlanMaterialSchema = z
|
|
|
195
223
|
.object({
|
|
196
224
|
kind: z.literal("evaluator-mediated"),
|
|
197
225
|
grantDigest: sha256DigestSchema,
|
|
226
|
+
network: agentCandidateModelAccessNetworkSchema,
|
|
198
227
|
})
|
|
199
228
|
.strict(),
|
|
200
229
|
routes: z
|
|
@@ -300,6 +329,33 @@ export const agentCandidateExecutionPlanMaterialSchema = z
|
|
|
300
329
|
});
|
|
301
330
|
}
|
|
302
331
|
}
|
|
332
|
+
const modelNetwork = material.model.access.network;
|
|
333
|
+
if (material.limits.maxModelCalls === 0 && modelNetwork.mode !== "disabled") {
|
|
334
|
+
ctx.addIssue({
|
|
335
|
+
code: "custom",
|
|
336
|
+
path: ["model", "access", "network"],
|
|
337
|
+
message: "zero-call plans cannot expose a model gateway",
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
if (material.limits.maxModelCalls > 0 && modelNetwork.mode !== "gateway-only") {
|
|
341
|
+
ctx.addIssue({
|
|
342
|
+
code: "custom",
|
|
343
|
+
path: ["model", "access", "network"],
|
|
344
|
+
message: "model-calling plans require one frozen gateway allowlist",
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
if (modelNetwork.mode === "gateway-only") {
|
|
348
|
+
addDuplicateIssues(modelNetwork.domains, ["model", "access", "network", "domains"], ctx);
|
|
349
|
+
for (let index = 1; index < modelNetwork.domains.length; index++) {
|
|
350
|
+
if ((modelNetwork.domains[index - 1] ?? "") >= (modelNetwork.domains[index] ?? "")) {
|
|
351
|
+
ctx.addIssue({
|
|
352
|
+
code: "custom",
|
|
353
|
+
path: ["model", "access", "network", "domains", index],
|
|
354
|
+
message: "model gateway domains must be lexicographically sorted",
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
303
359
|
const activeCode = material.codeKind !== "disabled";
|
|
304
360
|
if (activeCode !== (material.candidateWorkspace !== undefined)) {
|
|
305
361
|
ctx.addIssue({
|
|
@@ -319,6 +319,12 @@ export declare const agentCandidateMaterializationReceiptSchema: z.ZodObject<{
|
|
|
319
319
|
access: {
|
|
320
320
|
kind: "evaluator-mediated";
|
|
321
321
|
grantDigest: `sha256:${string}`;
|
|
322
|
+
network: {
|
|
323
|
+
mode: "disabled";
|
|
324
|
+
} | {
|
|
325
|
+
mode: "gateway-only";
|
|
326
|
+
domains: string[];
|
|
327
|
+
};
|
|
322
328
|
};
|
|
323
329
|
routes: ({
|
|
324
330
|
kind: "primary";
|
|
@@ -624,6 +630,12 @@ export declare const agentCandidateMaterializationReceiptSchema: z.ZodObject<{
|
|
|
624
630
|
access: {
|
|
625
631
|
kind: "evaluator-mediated";
|
|
626
632
|
grantDigest: `sha256:${string}`;
|
|
633
|
+
network: {
|
|
634
|
+
mode: "disabled";
|
|
635
|
+
} | {
|
|
636
|
+
mode: "gateway-only";
|
|
637
|
+
domains: string[];
|
|
638
|
+
};
|
|
627
639
|
};
|
|
628
640
|
routes: ({
|
|
629
641
|
kind: "primary";
|
|
@@ -352,6 +352,13 @@ export interface AgentCandidateProfileApplication {
|
|
|
352
352
|
targetWorkspace: AgentCandidateWorkingDirectory["workspace"];
|
|
353
353
|
mountPaths: string[];
|
|
354
354
|
}
|
|
355
|
+
/** Evaluator-owned network exception for the one frozen model gateway. */
|
|
356
|
+
export type AgentCandidateModelAccessNetwork = {
|
|
357
|
+
mode: "disabled";
|
|
358
|
+
} | {
|
|
359
|
+
mode: "gateway-only";
|
|
360
|
+
domains: string[];
|
|
361
|
+
};
|
|
355
362
|
/**
|
|
356
363
|
* Canonical, digest-free per-task execution identity document.
|
|
357
364
|
*
|
|
@@ -405,6 +412,7 @@ export interface AgentCandidateExecutionPlanMaterialV1 {
|
|
|
405
412
|
access: {
|
|
406
413
|
kind: "evaluator-mediated";
|
|
407
414
|
grantDigest: Sha256Digest;
|
|
415
|
+
network: AgentCandidateModelAccessNetwork;
|
|
408
416
|
};
|
|
409
417
|
routes: Array<{
|
|
410
418
|
kind: "primary";
|