@tangle-network/agent-interface 3.2.0 → 5.0.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 +11 -2
- package/dist/environment-provider.d.ts +1 -0
- package/dist/environment-provider.js +1 -0
- package/dist/environment-requests.d.ts +72 -0
- package/dist/environment-requests.js +16 -0
- package/dist/environment-runtime.d.ts +789 -39
- package/dist/environment-runtime.js +11 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/portable-context-commitments.d.ts +47 -0
- package/dist/portable-context-commitments.js +48 -0
- package/dist/portable-context-plan-request.d.ts +2 -1
- package/dist/portable-context-plan-wire.d.ts +103 -0
- package/dist/portable-context-plan-wire.js +127 -0
- package/dist/portable-context-plan.d.ts +6 -13
- package/dist/portable-context-plan.js +12 -14
- package/dist/portable-context-transfer.d.ts +344 -37
- package/dist/portable-context-transfer.js +40 -3
- package/dist/portable-context.d.ts +1 -0
- package/dist/portable-context.js +1 -0
- package/dist/provider-adapter.d.ts +9 -3
- package/dist/provider-config.d.ts +5 -0
- package/dist/workspace-snapshot.d.ts +79 -0
- package/dist/workspace-snapshot.js +31 -0
- package/package.json +1 -1
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { AgentCandidateArtifactRef, Sha256Digest } from "./agent-candidate.js";
|
|
3
|
+
import { type AgentWorkspaceLeaseRecord } from "./agent-workspace-lease.js";
|
|
4
|
+
/** Public source binding. A lease identifier or artifact locator grants no authority. */
|
|
5
|
+
export type AgentWorkspaceSnapshotSource = Pick<AgentWorkspaceLeaseRecord, "leaseId" | "workspace" | "sourceSnapshotDigest" | "sourceSnapshotPolicy"> & {
|
|
6
|
+
leaseRecordDigest: Sha256Digest;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Reference-only projection of the canonical candidate workspace archive.
|
|
10
|
+
* Runtime resolves and verifies the canonical manifest and archive before restore. The manifest
|
|
11
|
+
* digest binds file bytes and modes; the archive hash additionally binds Git HEAD and index state.
|
|
12
|
+
* Capture requires the source owner's private lease. Acceptance binds this complete value, not
|
|
13
|
+
* only `digest`. Receivers authorize each closed artifact reference for the accepted operation.
|
|
14
|
+
*/
|
|
15
|
+
export interface AgentWorkspaceSnapshotRef {
|
|
16
|
+
kind: "agent-candidate-workspace-snapshot";
|
|
17
|
+
digest: Sha256Digest;
|
|
18
|
+
manifest: AgentCandidateArtifactRef;
|
|
19
|
+
archive: AgentCandidateArtifactRef;
|
|
20
|
+
source: AgentWorkspaceSnapshotSource;
|
|
21
|
+
}
|
|
22
|
+
export declare const AgentWorkspaceSnapshotRefSchema: z.ZodObject<{
|
|
23
|
+
kind: z.ZodLiteral<"agent-candidate-workspace-snapshot">;
|
|
24
|
+
digest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
25
|
+
manifest: z.ZodObject<{
|
|
26
|
+
locator: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
27
|
+
kind: z.ZodLiteral<"s3">;
|
|
28
|
+
bucket: z.ZodString;
|
|
29
|
+
key: z.ZodString;
|
|
30
|
+
region: z.ZodOptional<z.ZodString>;
|
|
31
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
32
|
+
kind: z.ZodLiteral<"ipfs">;
|
|
33
|
+
cid: z.ZodString;
|
|
34
|
+
path: z.ZodOptional<z.ZodString>;
|
|
35
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
36
|
+
kind: z.ZodLiteral<"private-cas">;
|
|
37
|
+
namespace: z.ZodString;
|
|
38
|
+
digest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
39
|
+
}, z.core.$strict>], "kind">;
|
|
40
|
+
sha256: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
41
|
+
byteLength: z.ZodNumber;
|
|
42
|
+
}, z.core.$strict>;
|
|
43
|
+
archive: z.ZodObject<{
|
|
44
|
+
locator: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
45
|
+
kind: z.ZodLiteral<"s3">;
|
|
46
|
+
bucket: z.ZodString;
|
|
47
|
+
key: z.ZodString;
|
|
48
|
+
region: z.ZodOptional<z.ZodString>;
|
|
49
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
50
|
+
kind: z.ZodLiteral<"ipfs">;
|
|
51
|
+
cid: z.ZodString;
|
|
52
|
+
path: z.ZodOptional<z.ZodString>;
|
|
53
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
54
|
+
kind: z.ZodLiteral<"private-cas">;
|
|
55
|
+
namespace: z.ZodString;
|
|
56
|
+
digest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
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>;
|
|
61
|
+
source: z.ZodObject<{
|
|
62
|
+
leaseId: z.ZodString;
|
|
63
|
+
leaseRecordDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
64
|
+
workspace: z.ZodObject<{
|
|
65
|
+
provider: z.ZodString;
|
|
66
|
+
root: z.ZodString;
|
|
67
|
+
identityDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
68
|
+
}, z.core.$strict>;
|
|
69
|
+
sourceSnapshotDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
70
|
+
sourceSnapshotPolicy: z.ZodObject<{
|
|
71
|
+
kind: z.ZodLiteral<"provider-declared">;
|
|
72
|
+
name: z.ZodString;
|
|
73
|
+
version: z.ZodNumber;
|
|
74
|
+
digest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
75
|
+
}, z.core.$strict>;
|
|
76
|
+
}, z.core.$strict>;
|
|
77
|
+
}, z.core.$strict>;
|
|
78
|
+
/** Acceptance identity of the complete reference, including Git archive and source binding. */
|
|
79
|
+
export declare function agentWorkspaceSnapshotRefDigest(snapshot: AgentWorkspaceSnapshotRef): Sha256Digest;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { agentCandidateArtifactRefSchema } from "./agent-candidate-artifact-schema.js";
|
|
3
|
+
import { canonicalCandidateDigest, sha256DigestSchema } from "./agent-candidate-schema-common.js";
|
|
4
|
+
import { agentWorkspaceAllocationIdentitySchema, } from "./agent-workspace-lease.js";
|
|
5
|
+
import { agentWorkspacePublicIdentifierSchema, agentWorkspaceSourceSnapshotPolicySchema, } from "./agent-workspace-source-snapshot.js";
|
|
6
|
+
const nonemptyArtifactRefSchema = agentCandidateArtifactRefSchema.superRefine((ref, ctx) => {
|
|
7
|
+
if (!Number.isSafeInteger(ref.byteLength) || ref.byteLength < 1) {
|
|
8
|
+
ctx.addIssue({ code: "custom", path: ["byteLength"], message: "workspace artifact length must be a positive safe integer" });
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
export const AgentWorkspaceSnapshotRefSchema = z.strictObject({
|
|
12
|
+
kind: z.literal("agent-candidate-workspace-snapshot"),
|
|
13
|
+
digest: sha256DigestSchema,
|
|
14
|
+
manifest: nonemptyArtifactRefSchema,
|
|
15
|
+
archive: nonemptyArtifactRefSchema,
|
|
16
|
+
source: z.strictObject({
|
|
17
|
+
leaseId: agentWorkspacePublicIdentifierSchema,
|
|
18
|
+
leaseRecordDigest: sha256DigestSchema,
|
|
19
|
+
workspace: agentWorkspaceAllocationIdentitySchema,
|
|
20
|
+
sourceSnapshotDigest: sha256DigestSchema,
|
|
21
|
+
sourceSnapshotPolicy: agentWorkspaceSourceSnapshotPolicySchema,
|
|
22
|
+
}),
|
|
23
|
+
}).superRefine((snapshot, ctx) => {
|
|
24
|
+
if (snapshot.digest !== snapshot.manifest.sha256) {
|
|
25
|
+
ctx.addIssue({ code: "custom", path: ["manifest", "sha256"], message: "workspace digest must equal the canonical manifest hash" });
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
/** Acceptance identity of the complete reference, including Git archive and source binding. */
|
|
29
|
+
export function agentWorkspaceSnapshotRefDigest(snapshot) {
|
|
30
|
+
return canonicalCandidateDigest(AgentWorkspaceSnapshotRefSchema.parse(snapshot));
|
|
31
|
+
}
|