@tangle-network/agent-interface 0.36.0 → 0.38.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 +504 -0
- package/dist/agent-candidate-artifact-schema.js +16 -1
- package/dist/agent-candidate-execution-plan-schema.d.ts +50 -27
- package/dist/agent-candidate-execution-plan-schema.js +4 -16
- package/dist/agent-candidate-profile-schema.d.ts +341 -25
- package/dist/agent-candidate-promotion-schema.d.ts +2320 -287
- package/dist/agent-candidate-receipt-schema.d.ts +50 -27
- package/dist/agent-candidate-schema-common.js +1 -1
- package/dist/agent-candidate-schema.d.ts +341 -25
- package/dist/agent-candidate.d.ts +7 -8
- package/dist/agent-execution-preparation.d.ts +366 -0
- package/dist/agent-execution-preparation.js +793 -0
- package/dist/agent-improvement-source.d.ts +61 -3
- package/dist/agent-improvement-source.js +122 -8
- package/dist/agent-profile-activation.d.ts +41 -0
- package/dist/agent-profile-activation.js +24 -0
- package/dist/agent-profile-improvement-schema.d.ts +48 -4
- package/dist/agent-profile-materialization.d.ts +34 -0
- package/dist/agent-profile-materialization.js +243 -0
- package/dist/agent-profile.d.ts +44 -7
- package/dist/agent-profile.js +39 -2
- package/dist/agent-workspace-lease.d.ts +138 -0
- package/dist/agent-workspace-lease.js +203 -0
- package/dist/harness-capabilities.d.ts +1 -1
- package/dist/harness-capabilities.js +2 -9
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/profile-schema.d.ts +142 -84
- package/dist/profile-schema.js +152 -41
- package/package.json +3 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { agentCandidateGitHubRepositorySchema, gitObjectSchema, isSafeRelativePath, isWellFormedUnicode, looksLikeCredential, sha256DigestSchema, } from "./agent-candidate-schema-common.js";
|
|
3
|
+
import { agentImprovementSourceSchema } from "./agent-improvement-source.js";
|
|
3
4
|
const base64Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
4
5
|
const s3BucketPattern = /^(?!\d+\.\d+\.\d+\.\d+$)[a-z0-9][a-z0-9.-]{1,61}[a-z0-9]$/;
|
|
5
6
|
const awsRegionPattern = /^[a-z]{2}(?:-gov)?-[a-z]+-\d$/;
|
|
@@ -156,6 +157,16 @@ export function validateEmbeddedArtifact(artifact, ctx) {
|
|
|
156
157
|
});
|
|
157
158
|
}
|
|
158
159
|
}
|
|
160
|
+
function validateResourceSourceDigest(resource, ctx) {
|
|
161
|
+
if (resource.source !== undefined &&
|
|
162
|
+
resource.source.sourceDigest !== resource.sha256) {
|
|
163
|
+
ctx.addIssue({
|
|
164
|
+
code: "custom",
|
|
165
|
+
path: ["source", "sourceDigest"],
|
|
166
|
+
message: "resource source digest must equal the frozen resource digest",
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
}
|
|
159
170
|
export const agentCandidateInlineResourceSchema = z
|
|
160
171
|
.object({
|
|
161
172
|
kind: z.literal("inline"),
|
|
@@ -163,6 +174,7 @@ export const agentCandidateInlineResourceSchema = z
|
|
|
163
174
|
content: z.string().refine(isWellFormedUnicode),
|
|
164
175
|
sha256: sha256DigestSchema,
|
|
165
176
|
byteLength: z.number().int().nonnegative(),
|
|
177
|
+
source: agentImprovementSourceSchema.optional(),
|
|
166
178
|
})
|
|
167
179
|
.strict()
|
|
168
180
|
.superRefine((resource, ctx) => {
|
|
@@ -173,6 +185,7 @@ export const agentCandidateInlineResourceSchema = z
|
|
|
173
185
|
message: "byteLength must match UTF-8 content",
|
|
174
186
|
});
|
|
175
187
|
}
|
|
188
|
+
validateResourceSourceDigest(resource, ctx);
|
|
176
189
|
});
|
|
177
190
|
export const agentCandidateGitHubResourceSchema = z
|
|
178
191
|
.object({
|
|
@@ -185,8 +198,10 @@ export const agentCandidateGitHubResourceSchema = z
|
|
|
185
198
|
name: z.string().min(1).refine(isWellFormedUnicode).optional(),
|
|
186
199
|
sha256: sha256DigestSchema,
|
|
187
200
|
byteLength: z.number().int().nonnegative(),
|
|
201
|
+
source: agentImprovementSourceSchema.optional(),
|
|
188
202
|
})
|
|
189
|
-
.strict()
|
|
203
|
+
.strict()
|
|
204
|
+
.superRefine(validateResourceSourceDigest);
|
|
190
205
|
export const agentCandidateResourceRefSchema = z.discriminatedUnion("kind", [
|
|
191
206
|
agentCandidateInlineResourceSchema,
|
|
192
207
|
agentCandidateGitHubResourceSchema,
|
|
@@ -587,11 +587,10 @@ export declare const agentCandidateProfilePlanEvidenceSchema: z.ZodObject<{
|
|
|
587
587
|
}, z.core.$strict>]>;
|
|
588
588
|
}, z.core.$strict>;
|
|
589
589
|
export declare const agentCandidateProfileActivationSchema: z.ZodObject<{
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
material: z.ZodType<{
|
|
590
|
+
profilePlan: z.ZodType<{
|
|
591
|
+
kind: "agent-profile-workspace-plan";
|
|
592
|
+
digest: `sha256:${string}`;
|
|
593
|
+
material: {
|
|
595
594
|
sourceProfileDigest: `sha256:${string}`;
|
|
596
595
|
harness: "claude-code" | "nanoclaw" | "codex" | "opencode" | "kimi-code" | "pi" | "gemini" | "hermes" | "openclaw" | "amp" | "factory-droids" | "acp" | "cli-base";
|
|
597
596
|
files: {
|
|
@@ -615,7 +614,30 @@ export declare const agentCandidateProfileActivationSchema: z.ZodObject<{
|
|
|
615
614
|
kind: "public";
|
|
616
615
|
value: string;
|
|
617
616
|
} | undefined;
|
|
618
|
-
}
|
|
617
|
+
};
|
|
618
|
+
artifact: {
|
|
619
|
+
locator: {
|
|
620
|
+
kind: "s3";
|
|
621
|
+
bucket: string;
|
|
622
|
+
key: string;
|
|
623
|
+
region?: string | undefined;
|
|
624
|
+
} | {
|
|
625
|
+
kind: "ipfs";
|
|
626
|
+
cid: string;
|
|
627
|
+
path?: string | undefined;
|
|
628
|
+
};
|
|
629
|
+
sha256: `sha256:${string}`;
|
|
630
|
+
byteLength: number;
|
|
631
|
+
} | {
|
|
632
|
+
encoding: "base64";
|
|
633
|
+
content: string;
|
|
634
|
+
sha256: `sha256:${string}`;
|
|
635
|
+
byteLength: number;
|
|
636
|
+
};
|
|
637
|
+
}, unknown, z.core.$ZodTypeInternals<{
|
|
638
|
+
kind: "agent-profile-workspace-plan";
|
|
639
|
+
digest: `sha256:${string}`;
|
|
640
|
+
material: {
|
|
619
641
|
sourceProfileDigest: `sha256:${string}`;
|
|
620
642
|
harness: "claude-code" | "nanoclaw" | "codex" | "opencode" | "kimi-code" | "pi" | "gemini" | "hermes" | "openclaw" | "amp" | "factory-droids" | "acp" | "cli-base";
|
|
621
643
|
files: {
|
|
@@ -639,33 +661,34 @@ export declare const agentCandidateProfileActivationSchema: z.ZodObject<{
|
|
|
639
661
|
kind: "public";
|
|
640
662
|
value: string;
|
|
641
663
|
} | undefined;
|
|
642
|
-
}
|
|
643
|
-
artifact:
|
|
644
|
-
locator:
|
|
645
|
-
kind:
|
|
646
|
-
bucket:
|
|
647
|
-
key:
|
|
648
|
-
region
|
|
649
|
-
}
|
|
650
|
-
kind:
|
|
651
|
-
cid:
|
|
652
|
-
path
|
|
653
|
-
}
|
|
654
|
-
sha256:
|
|
655
|
-
byteLength:
|
|
656
|
-
}
|
|
657
|
-
encoding:
|
|
658
|
-
content:
|
|
659
|
-
sha256:
|
|
660
|
-
byteLength:
|
|
661
|
-
}
|
|
662
|
-
},
|
|
664
|
+
};
|
|
665
|
+
artifact: {
|
|
666
|
+
locator: {
|
|
667
|
+
kind: "s3";
|
|
668
|
+
bucket: string;
|
|
669
|
+
key: string;
|
|
670
|
+
region?: string | undefined;
|
|
671
|
+
} | {
|
|
672
|
+
kind: "ipfs";
|
|
673
|
+
cid: string;
|
|
674
|
+
path?: string | undefined;
|
|
675
|
+
};
|
|
676
|
+
sha256: `sha256:${string}`;
|
|
677
|
+
byteLength: number;
|
|
678
|
+
} | {
|
|
679
|
+
encoding: "base64";
|
|
680
|
+
content: string;
|
|
681
|
+
sha256: `sha256:${string}`;
|
|
682
|
+
byteLength: number;
|
|
683
|
+
};
|
|
684
|
+
}, unknown>>;
|
|
663
685
|
files: z.ZodArray<z.ZodObject<{
|
|
664
686
|
path: z.ZodString;
|
|
665
687
|
mode: z.ZodNumber;
|
|
666
688
|
content: z.ZodString;
|
|
667
689
|
}, z.core.$strict>>;
|
|
668
690
|
digest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
691
|
+
kind: z.ZodLiteral<"agent-candidate-profile-activation">;
|
|
669
692
|
}, z.core.$strict>;
|
|
670
693
|
export declare const agentCandidateExecutionPlanEvidenceSchema: z.ZodObject<{
|
|
671
694
|
kind: z.ZodLiteral<"agent-candidate-execution-plan">;
|
|
@@ -2,8 +2,9 @@ import { z } from "zod";
|
|
|
2
2
|
import { agentCandidateArtifactRefSchema, agentCandidateCapturedArtifactSchema, agentCandidateWorkspaceSnapshotEvidenceSchema, } from "./agent-candidate-artifact-schema.js";
|
|
3
3
|
import { agentCandidateContainerSchema, agentCandidateInstructionDeliverySchema, agentCandidateWorkingDirectorySchema, } from "./agent-candidate-code-schema.js";
|
|
4
4
|
import { reasoningEffortSchema } from "./profile-schema.js";
|
|
5
|
-
import { addDuplicateIssues, agentCandidateConfigValueSchema, agentCandidateMediaTypeSchema, environmentConfigSchema, gitObjectSchema, isCanonicalJsonValue, isObviouslyPrivateHostname, isSafeExecutable, isSafeRelativePath,
|
|
5
|
+
import { addDuplicateIssues, agentCandidateConfigValueSchema, agentCandidateMediaTypeSchema, environmentConfigSchema, gitObjectSchema, isCanonicalJsonValue, isObviouslyPrivateHostname, isSafeExecutable, isSafeRelativePath, sameGitObjectFormat, sha256Utf8, sha256DigestSchema, } from "./agent-candidate-schema-common.js";
|
|
6
6
|
import { harnessTypeSchema } from "./harness.js";
|
|
7
|
+
import { createAgentProfileActivationEvidenceSchema } from "./agent-profile-activation.js";
|
|
7
8
|
function isCanonicalAbsolutePath(value) {
|
|
8
9
|
return (value.startsWith("/") &&
|
|
9
10
|
value !== "/" &&
|
|
@@ -471,22 +472,9 @@ function planEvidenceSchema(kind, material) {
|
|
|
471
472
|
});
|
|
472
473
|
}
|
|
473
474
|
export const agentCandidateProfilePlanEvidenceSchema = planEvidenceSchema("agent-profile-workspace-plan", agentCandidateProfilePlanMaterialSchema);
|
|
474
|
-
export const agentCandidateProfileActivationSchema =
|
|
475
|
-
.
|
|
475
|
+
export const agentCandidateProfileActivationSchema = createAgentProfileActivationEvidenceSchema(agentCandidateProfilePlanEvidenceSchema)
|
|
476
|
+
.extend({
|
|
476
477
|
kind: z.literal("agent-candidate-profile-activation"),
|
|
477
|
-
profilePlan: agentCandidateProfilePlanEvidenceSchema,
|
|
478
|
-
files: z.array(z
|
|
479
|
-
.object({
|
|
480
|
-
path: z
|
|
481
|
-
.string()
|
|
482
|
-
.refine((value) => isSafeRelativePath(value, false), "profile activation file must use a canonical relative path"),
|
|
483
|
-
mode: z.number().int().min(0).max(0o777),
|
|
484
|
-
content: z
|
|
485
|
-
.string()
|
|
486
|
-
.refine(isWellFormedUnicode, "profile activation content must be valid Unicode"),
|
|
487
|
-
})
|
|
488
|
-
.strict()),
|
|
489
|
-
digest: sha256DigestSchema,
|
|
490
478
|
})
|
|
491
479
|
.strict()
|
|
492
480
|
.superRefine((activation, ctx) => {
|