@tangle-network/agent-interface 1.9.0 → 2.1.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 -0
- package/dist/agent-candidate-execution-plan-schema.d.ts +5 -0
- package/dist/agent-candidate-execution-plan-schema.js +8 -4
- package/dist/agent-candidate-promotion-schema.d.ts +10 -0
- package/dist/agent-candidate-receipt-schema.d.ts +2 -0
- package/dist/agent-candidate-schema-common.d.ts +6 -0
- package/dist/agent-candidate-schema-common.js +25 -10
- package/dist/agent-candidate.d.ts +2 -0
- package/dist/environment-command-turn.js +4 -1
- package/dist/environment-provider.d.ts +1 -0
- package/dist/environment-provider.js +1 -0
- package/dist/environment-requests.d.ts +22 -2
- package/dist/environment-requests.js +29 -1
- package/dist/environment-runtime.d.ts +9 -0
- package/dist/environment-runtime.js +6 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/workspace-cwd.d.ts +28 -0
- package/dist/workspace-cwd.js +77 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -27,6 +27,17 @@ The portable contract owns only inline profile and harness selection, shared or
|
|
|
27
27
|
|
|
28
28
|
`shared` means ordinary same-computer file visibility. It is not automatic merge behavior or tenant isolation. `isolated` asks the provider for a private writable view and explicit inspect or commit behavior. Providers must reject unsatisfied machine requirements rather than silently replacing or migrating a live environment.
|
|
29
29
|
|
|
30
|
+
`WorkspaceRequest.cwd` is an explicitly based path reference.
|
|
31
|
+
Use `base: "repository"` for a portable repository-relative POSIX path.
|
|
32
|
+
Use `base: "host"` for a provider-owned native host path.
|
|
33
|
+
The shared schema rejects unsafe repository paths and control characters in both path forms.
|
|
34
|
+
It canonicalizes redundant `.` segments and separators for repository paths.
|
|
35
|
+
Use `.` for the repository root.
|
|
36
|
+
Providers advertise accepted path bases under `AgentEnvironmentCapabilities.workspace.cwdBases`.
|
|
37
|
+
To migrate a string cwd, wrap it in the base that owns its path.
|
|
38
|
+
Use the repository base for Tangle and other portable workspace providers.
|
|
39
|
+
Use the host base for CLI Bridge native process paths.
|
|
40
|
+
|
|
30
41
|
The public `AgentInstanceRecord` contains a credential-free profile identity, not the full profile or provider request. Existing session APIs can implement this contract without a new service: one instance maps to one managed session, compatible sessions may reuse a backend process, and stop maps to idempotent session deletion or process release.
|
|
31
42
|
|
|
32
43
|
## Durable runs, interactions, and context
|
|
@@ -84,6 +84,7 @@ export declare const agentCandidateProfilePlanMaterialSchema: z.ZodObject<{
|
|
|
84
84
|
relPath: z.ZodString;
|
|
85
85
|
mode: z.ZodNumber;
|
|
86
86
|
contentSha256: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
87
|
+
root: z.ZodOptional<z.ZodLiteral<"agent">>;
|
|
87
88
|
}, z.core.$strict>>;
|
|
88
89
|
env: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
89
90
|
kind: z.ZodLiteral<"public">;
|
|
@@ -536,6 +537,7 @@ export declare const agentCandidateProfilePlanEvidenceSchema: z.ZodObject<{
|
|
|
536
537
|
relPath: string;
|
|
537
538
|
mode: number;
|
|
538
539
|
contentSha256: `sha256:${string}`;
|
|
540
|
+
root?: "agent" | undefined;
|
|
539
541
|
}[];
|
|
540
542
|
env: Record<string, {
|
|
541
543
|
kind: "public";
|
|
@@ -564,6 +566,7 @@ export declare const agentCandidateProfilePlanEvidenceSchema: z.ZodObject<{
|
|
|
564
566
|
relPath: string;
|
|
565
567
|
mode: number;
|
|
566
568
|
contentSha256: `sha256:${string}`;
|
|
569
|
+
root?: "agent" | undefined;
|
|
567
570
|
}[];
|
|
568
571
|
env: Record<string, {
|
|
569
572
|
kind: "public";
|
|
@@ -617,6 +620,7 @@ export declare const agentCandidateProfileActivationSchema: z.ZodObject<{
|
|
|
617
620
|
relPath: string;
|
|
618
621
|
mode: number;
|
|
619
622
|
contentSha256: `sha256:${string}`;
|
|
623
|
+
root?: "agent" | undefined;
|
|
620
624
|
}[];
|
|
621
625
|
env: Record<string, {
|
|
622
626
|
kind: "public";
|
|
@@ -668,6 +672,7 @@ export declare const agentCandidateProfileActivationSchema: z.ZodObject<{
|
|
|
668
672
|
relPath: string;
|
|
669
673
|
mode: number;
|
|
670
674
|
contentSha256: `sha256:${string}`;
|
|
675
|
+
root?: "agent" | undefined;
|
|
671
676
|
}[];
|
|
672
677
|
env: Record<string, {
|
|
673
678
|
kind: "public";
|
|
@@ -15,6 +15,9 @@ function isCanonicalAbsolutePath(value) {
|
|
|
15
15
|
function pathsOverlap(left, right) {
|
|
16
16
|
return left === right || left.startsWith(`${right}/`) || right.startsWith(`${left}/`);
|
|
17
17
|
}
|
|
18
|
+
function profilePlanFileIdentity(file) {
|
|
19
|
+
return `${file.root ?? "workspace"}\u0000${file.relPath}`;
|
|
20
|
+
}
|
|
18
21
|
function isExactPublicGatewayDomain(value) {
|
|
19
22
|
if (value.length > 253 ||
|
|
20
23
|
value !== value.toLowerCase() ||
|
|
@@ -113,6 +116,7 @@ export const agentCandidateProfilePlanMaterialSchema = z
|
|
|
113
116
|
.refine((value) => isSafeRelativePath(value, false), "profile-plan file must use a canonical relative path"),
|
|
114
117
|
mode: z.number().int().min(0).max(0o777),
|
|
115
118
|
contentSha256: sha256DigestSchema,
|
|
119
|
+
root: z.literal("agent").optional(),
|
|
116
120
|
})
|
|
117
121
|
.strict()),
|
|
118
122
|
env: environmentConfigSchema,
|
|
@@ -130,14 +134,14 @@ export const agentCandidateProfilePlanMaterialSchema = z
|
|
|
130
134
|
})
|
|
131
135
|
.strict()
|
|
132
136
|
.superRefine((material, ctx) => {
|
|
133
|
-
|
|
137
|
+
const fileIdentities = material.files.map(profilePlanFileIdentity);
|
|
138
|
+
addDuplicateIssues(fileIdentities, ["files"], ctx);
|
|
134
139
|
for (let index = 1; index < material.files.length; index++) {
|
|
135
|
-
if ((
|
|
136
|
-
(material.files[index]?.relPath ?? "")) {
|
|
140
|
+
if ((fileIdentities[index - 1] ?? "") >= (fileIdentities[index] ?? "")) {
|
|
137
141
|
ctx.addIssue({
|
|
138
142
|
code: "custom",
|
|
139
143
|
path: ["files", index, "relPath"],
|
|
140
|
-
message: "profile-plan files must be lexicographically sorted",
|
|
144
|
+
message: "profile-plan files must be lexicographically sorted by root and path",
|
|
141
145
|
});
|
|
142
146
|
}
|
|
143
147
|
}
|
|
@@ -2076,6 +2076,7 @@ export declare const candidateExecutionEvidenceSchema: z.ZodObject<{
|
|
|
2076
2076
|
relPath: string;
|
|
2077
2077
|
mode: number;
|
|
2078
2078
|
contentSha256: `sha256:${string}`;
|
|
2079
|
+
root?: "agent" | undefined;
|
|
2079
2080
|
}[];
|
|
2080
2081
|
env: Record<string, {
|
|
2081
2082
|
kind: "public";
|
|
@@ -2127,6 +2128,7 @@ export declare const candidateExecutionEvidenceSchema: z.ZodObject<{
|
|
|
2127
2128
|
relPath: string;
|
|
2128
2129
|
mode: number;
|
|
2129
2130
|
contentSha256: `sha256:${string}`;
|
|
2131
|
+
root?: "agent" | undefined;
|
|
2130
2132
|
}[];
|
|
2131
2133
|
env: Record<string, {
|
|
2132
2134
|
kind: "public";
|
|
@@ -5664,6 +5666,7 @@ export declare const agentImprovementMeasuredComparisonSchema: z.ZodObject<{
|
|
|
5664
5666
|
relPath: string;
|
|
5665
5667
|
mode: number;
|
|
5666
5668
|
contentSha256: `sha256:${string}`;
|
|
5669
|
+
root?: "agent" | undefined;
|
|
5667
5670
|
}[];
|
|
5668
5671
|
env: Record<string, {
|
|
5669
5672
|
kind: "public";
|
|
@@ -5715,6 +5718,7 @@ export declare const agentImprovementMeasuredComparisonSchema: z.ZodObject<{
|
|
|
5715
5718
|
relPath: string;
|
|
5716
5719
|
mode: number;
|
|
5717
5720
|
contentSha256: `sha256:${string}`;
|
|
5721
|
+
root?: "agent" | undefined;
|
|
5718
5722
|
}[];
|
|
5719
5723
|
env: Record<string, {
|
|
5720
5724
|
kind: "public";
|
|
@@ -7059,6 +7063,7 @@ export declare const agentImprovementMeasuredComparisonSchema: z.ZodObject<{
|
|
|
7059
7063
|
relPath: string;
|
|
7060
7064
|
mode: number;
|
|
7061
7065
|
contentSha256: `sha256:${string}`;
|
|
7066
|
+
root?: "agent" | undefined;
|
|
7062
7067
|
}[];
|
|
7063
7068
|
env: Record<string, {
|
|
7064
7069
|
kind: "public";
|
|
@@ -7110,6 +7115,7 @@ export declare const agentImprovementMeasuredComparisonSchema: z.ZodObject<{
|
|
|
7110
7115
|
relPath: string;
|
|
7111
7116
|
mode: number;
|
|
7112
7117
|
contentSha256: `sha256:${string}`;
|
|
7118
|
+
root?: "agent" | undefined;
|
|
7113
7119
|
}[];
|
|
7114
7120
|
env: Record<string, {
|
|
7115
7121
|
kind: "public";
|
|
@@ -10679,6 +10685,7 @@ export declare const agentImprovementProposalSchema: z.ZodObject<{
|
|
|
10679
10685
|
relPath: string;
|
|
10680
10686
|
mode: number;
|
|
10681
10687
|
contentSha256: `sha256:${string}`;
|
|
10688
|
+
root?: "agent" | undefined;
|
|
10682
10689
|
}[];
|
|
10683
10690
|
env: Record<string, {
|
|
10684
10691
|
kind: "public";
|
|
@@ -10730,6 +10737,7 @@ export declare const agentImprovementProposalSchema: z.ZodObject<{
|
|
|
10730
10737
|
relPath: string;
|
|
10731
10738
|
mode: number;
|
|
10732
10739
|
contentSha256: `sha256:${string}`;
|
|
10740
|
+
root?: "agent" | undefined;
|
|
10733
10741
|
}[];
|
|
10734
10742
|
env: Record<string, {
|
|
10735
10743
|
kind: "public";
|
|
@@ -12074,6 +12082,7 @@ export declare const agentImprovementProposalSchema: z.ZodObject<{
|
|
|
12074
12082
|
relPath: string;
|
|
12075
12083
|
mode: number;
|
|
12076
12084
|
contentSha256: `sha256:${string}`;
|
|
12085
|
+
root?: "agent" | undefined;
|
|
12077
12086
|
}[];
|
|
12078
12087
|
env: Record<string, {
|
|
12079
12088
|
kind: "public";
|
|
@@ -12125,6 +12134,7 @@ export declare const agentImprovementProposalSchema: z.ZodObject<{
|
|
|
12125
12134
|
relPath: string;
|
|
12126
12135
|
mode: number;
|
|
12127
12136
|
contentSha256: `sha256:${string}`;
|
|
12137
|
+
root?: "agent" | undefined;
|
|
12128
12138
|
}[];
|
|
12129
12139
|
env: Record<string, {
|
|
12130
12140
|
kind: "public";
|
|
@@ -201,6 +201,7 @@ export declare const agentCandidateMaterializationReceiptSchema: z.ZodObject<{
|
|
|
201
201
|
relPath: string;
|
|
202
202
|
mode: number;
|
|
203
203
|
contentSha256: `sha256:${string}`;
|
|
204
|
+
root?: "agent" | undefined;
|
|
204
205
|
}[];
|
|
205
206
|
env: Record<string, {
|
|
206
207
|
kind: "public";
|
|
@@ -252,6 +253,7 @@ export declare const agentCandidateMaterializationReceiptSchema: z.ZodObject<{
|
|
|
252
253
|
relPath: string;
|
|
253
254
|
mode: number;
|
|
254
255
|
contentSha256: `sha256:${string}`;
|
|
256
|
+
root?: "agent" | undefined;
|
|
255
257
|
}[];
|
|
256
258
|
env: Record<string, {
|
|
257
259
|
kind: "public";
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { Sha256Digest } from "./agent-candidate.js";
|
|
3
|
+
export type RelativePathSafetyIssue = "empty" | "control-character" | "malformed-unicode" | "absolute" | "backslash" | "parent-traversal";
|
|
4
|
+
export type PathSafetyIssue = "control-character" | "malformed-unicode";
|
|
3
5
|
export declare const sha256DigestSchema: z.ZodType<Sha256Digest>;
|
|
4
6
|
export declare const gitObjectSchema: z.ZodString;
|
|
5
7
|
export declare const environmentNameSchema: z.ZodString;
|
|
@@ -15,6 +17,10 @@ export declare function omitTopLevelDigest<T extends {
|
|
|
15
17
|
digest: Sha256Digest;
|
|
16
18
|
}>(value: T): Omit<T, "digest">;
|
|
17
19
|
export declare function isWellFormedUnicode(value: string): boolean;
|
|
20
|
+
/** Return shared boundary violations for path strings. */
|
|
21
|
+
export declare function pathSafetyIssues(value: string): PathSafetyIssue[];
|
|
22
|
+
/** Return shared boundary violations for paths that must stay inside a workspace. */
|
|
23
|
+
export declare function relativePathSafetyIssues(value: string): RelativePathSafetyIssue[];
|
|
18
24
|
export declare function isSafeRelativePath(value: string, allowDot: boolean): boolean;
|
|
19
25
|
export declare function isSafeExecutable(value: string): boolean;
|
|
20
26
|
export declare function isObviouslyPrivateHostname(rawHostname: string): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { sha256 } from "@noble/hashes/
|
|
1
|
+
import { sha256 } from "@noble/hashes/sha2.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
const sha256Pattern = /^sha256:[a-f0-9]{64}$/;
|
|
4
4
|
const gitObjectPattern = /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/;
|
|
@@ -86,20 +86,35 @@ export function isWellFormedUnicode(value) {
|
|
|
86
86
|
}
|
|
87
87
|
return true;
|
|
88
88
|
}
|
|
89
|
+
/** Return shared boundary violations for path strings. */
|
|
90
|
+
export function pathSafetyIssues(value) {
|
|
91
|
+
const issues = [];
|
|
92
|
+
if (controlCharacterPattern.test(value))
|
|
93
|
+
issues.push("control-character");
|
|
94
|
+
if (!isWellFormedUnicode(value))
|
|
95
|
+
issues.push("malformed-unicode");
|
|
96
|
+
return issues;
|
|
97
|
+
}
|
|
98
|
+
/** Return shared boundary violations for paths that must stay inside a workspace. */
|
|
99
|
+
export function relativePathSafetyIssues(value) {
|
|
100
|
+
const issues = [...pathSafetyIssues(value)];
|
|
101
|
+
if (value.length === 0)
|
|
102
|
+
issues.push("empty");
|
|
103
|
+
if (value.startsWith("/") || /^[A-Za-z]:/.test(value))
|
|
104
|
+
issues.push("absolute");
|
|
105
|
+
if (value.includes("\\"))
|
|
106
|
+
issues.push("backslash");
|
|
107
|
+
if (value.split("/").includes(".."))
|
|
108
|
+
issues.push("parent-traversal");
|
|
109
|
+
return issues;
|
|
110
|
+
}
|
|
89
111
|
export function isSafeRelativePath(value, allowDot) {
|
|
90
|
-
if (value.length
|
|
91
|
-
controlCharacterPattern.test(value) ||
|
|
92
|
-
!isWellFormedUnicode(value) ||
|
|
93
|
-
value.startsWith("/") ||
|
|
94
|
-
value.startsWith("\\") ||
|
|
95
|
-
value.includes("\\") ||
|
|
96
|
-
/^[A-Za-z]:/.test(value)) {
|
|
112
|
+
if (relativePathSafetyIssues(value).length > 0)
|
|
97
113
|
return false;
|
|
98
|
-
}
|
|
99
114
|
if (value === ".")
|
|
100
115
|
return allowDot;
|
|
101
116
|
const parts = value.split("/");
|
|
102
|
-
return (parts.every((part) => part.length > 0 && part !== "."
|
|
117
|
+
return (parts.every((part) => part.length > 0 && part !== ".") &&
|
|
103
118
|
!parts.some((part) => reservedWorkspaceRoots.has(part)));
|
|
104
119
|
}
|
|
105
120
|
export function isSafeExecutable(value) {
|
|
@@ -341,6 +341,8 @@ export interface AgentCandidateProfilePlanMaterial {
|
|
|
341
341
|
relPath: string;
|
|
342
342
|
mode: number;
|
|
343
343
|
contentSha256: Sha256Digest;
|
|
344
|
+
/** Omit for a workspace-root file; agent-root files must name this root. */
|
|
345
|
+
root?: "agent";
|
|
344
346
|
}>;
|
|
345
347
|
env: Record<string, AgentCandidateConfigValue>;
|
|
346
348
|
flags: AgentCandidateConfigValue[];
|
|
@@ -119,7 +119,10 @@ export function execOnlyEnvironmentCapabilities(workspace) {
|
|
|
119
119
|
turnIdempotency: false,
|
|
120
120
|
},
|
|
121
121
|
sessions: { continue: false, list: false, messages: false },
|
|
122
|
-
workspace: {
|
|
122
|
+
workspace: {
|
|
123
|
+
cwdBases: { repository: false, host: false },
|
|
124
|
+
...workspace,
|
|
125
|
+
},
|
|
123
126
|
branching: { checkpoint: false, fork: false },
|
|
124
127
|
placement: true,
|
|
125
128
|
usage: false,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { WorkspaceCwd } from "./workspace-cwd.js";
|
|
1
3
|
import type { AgentProfile } from "./agent-profile.js";
|
|
2
4
|
/** Portable profile reference: inline profile or provider catalog id. */
|
|
3
5
|
export type AgentProfileRef = AgentProfile | string;
|
|
@@ -12,11 +14,29 @@ export interface WorkspaceRequest {
|
|
|
12
14
|
repoUrl?: string;
|
|
13
15
|
/** Git ref for {@link repoUrl}. */
|
|
14
16
|
gitRef?: string;
|
|
15
|
-
/**
|
|
16
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Explicitly based working directory inside the environment or on the host.
|
|
19
|
+
* Repository paths use `base: "repository"`; host paths use `base: "host"`.
|
|
20
|
+
*/
|
|
21
|
+
cwd?: WorkspaceCwd;
|
|
17
22
|
/** Opaque provider-native workspace fields. */
|
|
18
23
|
providerOptions?: Record<string, unknown>;
|
|
19
24
|
}
|
|
25
|
+
/** Runtime contract for the portable workspace request carried by providers. */
|
|
26
|
+
export declare const WorkspaceRequestSchema: z.ZodObject<{
|
|
27
|
+
environment: z.ZodOptional<z.ZodString>;
|
|
28
|
+
image: z.ZodOptional<z.ZodString>;
|
|
29
|
+
repoUrl: z.ZodOptional<z.ZodString>;
|
|
30
|
+
gitRef: z.ZodOptional<z.ZodString>;
|
|
31
|
+
cwd: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
32
|
+
base: z.ZodLiteral<"repository">;
|
|
33
|
+
path: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
34
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
35
|
+
base: z.ZodLiteral<"host">;
|
|
36
|
+
path: z.ZodString;
|
|
37
|
+
}, z.core.$strict>], "base">>;
|
|
38
|
+
providerOptions: z.ZodOptional<z.ZodCustom<Record<string, unknown>, Record<string, unknown>>>;
|
|
39
|
+
}, z.core.$strict>;
|
|
20
40
|
export interface ResourceRequest {
|
|
21
41
|
cpu?: number;
|
|
22
42
|
memoryMb?: number;
|
|
@@ -1 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { boundedIdentifierSchema, boundedJsonRecordSchema, boundedStringSchema, } from "./contract-limits.js";
|
|
3
|
+
import { workspaceCwdSchema } from "./workspace-cwd.js";
|
|
4
|
+
/** Runtime contract for the portable workspace request carried by providers. */
|
|
5
|
+
export const WorkspaceRequestSchema = z
|
|
6
|
+
.strictObject({
|
|
7
|
+
environment: boundedIdentifierSchema.optional(),
|
|
8
|
+
image: boundedStringSchema.min(1).optional(),
|
|
9
|
+
repoUrl: boundedStringSchema.min(1).optional(),
|
|
10
|
+
gitRef: boundedIdentifierSchema.optional(),
|
|
11
|
+
cwd: workspaceCwdSchema.optional(),
|
|
12
|
+
providerOptions: boundedJsonRecordSchema.optional(),
|
|
13
|
+
})
|
|
14
|
+
.superRefine((workspace, refinement) => {
|
|
15
|
+
if (workspace.environment !== undefined && workspace.image !== undefined) {
|
|
16
|
+
refinement.addIssue({
|
|
17
|
+
code: "custom",
|
|
18
|
+
path: ["image"],
|
|
19
|
+
message: "workspace cannot specify both environment and image",
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
if (workspace.gitRef !== undefined && workspace.repoUrl === undefined) {
|
|
23
|
+
refinement.addIssue({
|
|
24
|
+
code: "custom",
|
|
25
|
+
path: ["gitRef"],
|
|
26
|
+
message: "workspace gitRef requires repoUrl",
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
});
|
|
@@ -818,6 +818,11 @@ export interface AgentEnvironmentCapabilities {
|
|
|
818
818
|
git: boolean;
|
|
819
819
|
upload: boolean;
|
|
820
820
|
download: boolean;
|
|
821
|
+
/** Path bases accepted by the provider's workspace create contract. */
|
|
822
|
+
cwdBases?: {
|
|
823
|
+
repository: boolean;
|
|
824
|
+
host: boolean;
|
|
825
|
+
};
|
|
821
826
|
};
|
|
822
827
|
branching: {
|
|
823
828
|
checkpoint: boolean;
|
|
@@ -949,6 +954,10 @@ export declare const AgentEnvironmentCapabilitiesSchema: z.ZodObject<{
|
|
|
949
954
|
git: z.ZodBoolean;
|
|
950
955
|
upload: z.ZodBoolean;
|
|
951
956
|
download: z.ZodBoolean;
|
|
957
|
+
cwdBases: z.ZodOptional<z.ZodObject<{
|
|
958
|
+
repository: z.ZodBoolean;
|
|
959
|
+
host: z.ZodBoolean;
|
|
960
|
+
}, z.core.$strict>>;
|
|
952
961
|
}, z.core.$strict>;
|
|
953
962
|
branching: z.ZodObject<{
|
|
954
963
|
checkpoint: z.ZodBoolean;
|
|
@@ -205,6 +205,12 @@ export const AgentEnvironmentCapabilitiesSchema = z
|
|
|
205
205
|
git: z.boolean(),
|
|
206
206
|
upload: z.boolean(),
|
|
207
207
|
download: z.boolean(),
|
|
208
|
+
cwdBases: z
|
|
209
|
+
.strictObject({
|
|
210
|
+
repository: z.boolean(),
|
|
211
|
+
host: z.boolean(),
|
|
212
|
+
})
|
|
213
|
+
.optional(),
|
|
208
214
|
}),
|
|
209
215
|
branching: z.strictObject({
|
|
210
216
|
checkpoint: z.boolean(),
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export * from "./host-services.js";
|
|
|
8
8
|
export * from "./mcp.js";
|
|
9
9
|
export * from "./provider-adapter.js";
|
|
10
10
|
export type * from "./environment-provider.js";
|
|
11
|
-
export { AgentEnvironmentCapabilitiesSchema, AgentNativeContextContinuationAdmissionSchema, AgentNativeContextContinuationResultSchema, AgentTurnInputSchema, AgentTurnResultSchema, agentEnvironmentCreateInputDigest, agentNativeContextContinuationAdmissionMatchesRequest, agentNativeContextContinuationResultMatchesRequest, AccountUsageSchema, AgentEnvironmentObservationSchema, AgentEnvironmentStatusSchema, ComputeBillingSchema, EnvironmentLifecycleSchema, ModelUsageSchema, ObservationProvenanceSchema, ObservationStateSchema, PlacementDescriptorSchema, ProviderIdentitySchema, ResourceProfileSchema, ResourceUseSampleSchema, SafeEndpointSchema, agentEnvironmentObservationIdentityMatches, assertObservationCredentialFree, observationContainsCredential, observationOf, AgentInteractiveSessionAttachSchema, AgentInteractiveSessionControlClaimAcknowledgementSchema, AgentInteractiveSessionControlClaimRequestSchema, AgentInteractiveSessionControlClaimSchema, AgentInteractiveSessionPromptAcknowledgementSchema, AgentInteractiveSessionPromptCommandSchema, AgentInteractiveSessionRefSchema, AgentInteractiveSessionStartSchema, AgentInteractiveSessionStopAcknowledgementSchema, AgentInteractiveSessionStopCommandSchema, AgentInteractiveSessionStatusSchema, agentInteractiveSessionControlClaimAcknowledgementMatchesRequest, agentInteractiveSessionControlClaimRequestDigest, agentInteractiveSessionControlClaimMatchesRef, agentInteractiveSessionControlClaimIsNewer, agentInteractiveSessionPromptAcknowledgementMatchesCommand, agentInteractiveSessionPromptRequestDigest, agentInteractiveSessionStopAcknowledgementMatchesCommand, agentInteractiveSessionStopRequestDigest, agentInteractiveSessionRequestDigest, agentInteractiveSessionRefMatchesStart, agentInteractiveSessionRunRef, agentInteractiveSessionStatusMatchesRef, exactAgentInteractiveSessionStart, AgentEnvironmentCreationSchema, createAgentEnvironmentWithIdempotency, replayedAgentEnvironmentView, TerminalAttachRequestSchema, TerminalAttachResultSchema, TerminalDetachAckSchema, TerminalInputSchema, TerminalOutputEventSchema, TerminalReplayWindowSchema, TerminalResizeSchema, TerminalSessionRefSchema, terminalAttachResultMatchesRequest, terminalSessionUsable, } from "./environment-provider.js";
|
|
11
|
+
export { AgentEnvironmentCapabilitiesSchema, AgentNativeContextContinuationAdmissionSchema, AgentNativeContextContinuationResultSchema, AgentTurnInputSchema, AgentTurnResultSchema, agentEnvironmentCreateInputDigest, agentNativeContextContinuationAdmissionMatchesRequest, agentNativeContextContinuationResultMatchesRequest, AccountUsageSchema, AgentEnvironmentObservationSchema, AgentEnvironmentStatusSchema, ComputeBillingSchema, EnvironmentLifecycleSchema, ModelUsageSchema, ObservationProvenanceSchema, ObservationStateSchema, PlacementDescriptorSchema, ProviderIdentitySchema, ResourceProfileSchema, ResourceUseSampleSchema, SafeEndpointSchema, agentEnvironmentObservationIdentityMatches, assertObservationCredentialFree, observationContainsCredential, observationOf, AgentInteractiveSessionAttachSchema, AgentInteractiveSessionControlClaimAcknowledgementSchema, AgentInteractiveSessionControlClaimRequestSchema, AgentInteractiveSessionControlClaimSchema, AgentInteractiveSessionPromptAcknowledgementSchema, AgentInteractiveSessionPromptCommandSchema, AgentInteractiveSessionRefSchema, AgentInteractiveSessionStartSchema, AgentInteractiveSessionStopAcknowledgementSchema, AgentInteractiveSessionStopCommandSchema, AgentInteractiveSessionStatusSchema, agentInteractiveSessionControlClaimAcknowledgementMatchesRequest, agentInteractiveSessionControlClaimRequestDigest, agentInteractiveSessionControlClaimMatchesRef, agentInteractiveSessionControlClaimIsNewer, agentInteractiveSessionPromptAcknowledgementMatchesCommand, agentInteractiveSessionPromptRequestDigest, agentInteractiveSessionStopAcknowledgementMatchesCommand, agentInteractiveSessionStopRequestDigest, agentInteractiveSessionRequestDigest, agentInteractiveSessionRefMatchesStart, agentInteractiveSessionRunRef, agentInteractiveSessionStatusMatchesRef, exactAgentInteractiveSessionStart, AgentEnvironmentCreationSchema, createAgentEnvironmentWithIdempotency, replayedAgentEnvironmentView, canonicalWorkspaceCwd, MAX_WORKSPACE_CWD_LENGTH, workspaceCwdSchema, workspaceCwdPathForBase, WorkspaceRequestSchema, TerminalAttachRequestSchema, TerminalAttachResultSchema, TerminalDetachAckSchema, TerminalInputSchema, TerminalOutputEventSchema, TerminalReplayWindowSchema, TerminalResizeSchema, TerminalSessionRefSchema, terminalAttachResultMatchesRequest, terminalSessionUsable, } from "./environment-provider.js";
|
|
12
12
|
export * from "./plan.js";
|
|
13
13
|
export * from "./runtime-control.js";
|
|
14
14
|
export * from "./portable-context.js";
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ export * from "./provider-config.js";
|
|
|
7
7
|
export * from "./host-services.js";
|
|
8
8
|
export * from "./mcp.js";
|
|
9
9
|
export * from "./provider-adapter.js";
|
|
10
|
-
export { AgentEnvironmentCapabilitiesSchema, AgentNativeContextContinuationAdmissionSchema, AgentNativeContextContinuationResultSchema, AgentTurnInputSchema, AgentTurnResultSchema, agentEnvironmentCreateInputDigest, agentNativeContextContinuationAdmissionMatchesRequest, agentNativeContextContinuationResultMatchesRequest, AccountUsageSchema, AgentEnvironmentObservationSchema, AgentEnvironmentStatusSchema, ComputeBillingSchema, EnvironmentLifecycleSchema, ModelUsageSchema, ObservationProvenanceSchema, ObservationStateSchema, PlacementDescriptorSchema, ProviderIdentitySchema, ResourceProfileSchema, ResourceUseSampleSchema, SafeEndpointSchema, agentEnvironmentObservationIdentityMatches, assertObservationCredentialFree, observationContainsCredential, observationOf, AgentInteractiveSessionAttachSchema, AgentInteractiveSessionControlClaimAcknowledgementSchema, AgentInteractiveSessionControlClaimRequestSchema, AgentInteractiveSessionControlClaimSchema, AgentInteractiveSessionPromptAcknowledgementSchema, AgentInteractiveSessionPromptCommandSchema, AgentInteractiveSessionRefSchema, AgentInteractiveSessionStartSchema, AgentInteractiveSessionStopAcknowledgementSchema, AgentInteractiveSessionStopCommandSchema, AgentInteractiveSessionStatusSchema, agentInteractiveSessionControlClaimAcknowledgementMatchesRequest, agentInteractiveSessionControlClaimRequestDigest, agentInteractiveSessionControlClaimMatchesRef, agentInteractiveSessionControlClaimIsNewer, agentInteractiveSessionPromptAcknowledgementMatchesCommand, agentInteractiveSessionPromptRequestDigest, agentInteractiveSessionStopAcknowledgementMatchesCommand, agentInteractiveSessionStopRequestDigest, agentInteractiveSessionRequestDigest, agentInteractiveSessionRefMatchesStart, agentInteractiveSessionRunRef, agentInteractiveSessionStatusMatchesRef, exactAgentInteractiveSessionStart, AgentEnvironmentCreationSchema, createAgentEnvironmentWithIdempotency, replayedAgentEnvironmentView, TerminalAttachRequestSchema, TerminalAttachResultSchema, TerminalDetachAckSchema, TerminalInputSchema, TerminalOutputEventSchema, TerminalReplayWindowSchema, TerminalResizeSchema, TerminalSessionRefSchema, terminalAttachResultMatchesRequest, terminalSessionUsable, } from "./environment-provider.js";
|
|
10
|
+
export { AgentEnvironmentCapabilitiesSchema, AgentNativeContextContinuationAdmissionSchema, AgentNativeContextContinuationResultSchema, AgentTurnInputSchema, AgentTurnResultSchema, agentEnvironmentCreateInputDigest, agentNativeContextContinuationAdmissionMatchesRequest, agentNativeContextContinuationResultMatchesRequest, AccountUsageSchema, AgentEnvironmentObservationSchema, AgentEnvironmentStatusSchema, ComputeBillingSchema, EnvironmentLifecycleSchema, ModelUsageSchema, ObservationProvenanceSchema, ObservationStateSchema, PlacementDescriptorSchema, ProviderIdentitySchema, ResourceProfileSchema, ResourceUseSampleSchema, SafeEndpointSchema, agentEnvironmentObservationIdentityMatches, assertObservationCredentialFree, observationContainsCredential, observationOf, AgentInteractiveSessionAttachSchema, AgentInteractiveSessionControlClaimAcknowledgementSchema, AgentInteractiveSessionControlClaimRequestSchema, AgentInteractiveSessionControlClaimSchema, AgentInteractiveSessionPromptAcknowledgementSchema, AgentInteractiveSessionPromptCommandSchema, AgentInteractiveSessionRefSchema, AgentInteractiveSessionStartSchema, AgentInteractiveSessionStopAcknowledgementSchema, AgentInteractiveSessionStopCommandSchema, AgentInteractiveSessionStatusSchema, agentInteractiveSessionControlClaimAcknowledgementMatchesRequest, agentInteractiveSessionControlClaimRequestDigest, agentInteractiveSessionControlClaimMatchesRef, agentInteractiveSessionControlClaimIsNewer, agentInteractiveSessionPromptAcknowledgementMatchesCommand, agentInteractiveSessionPromptRequestDigest, agentInteractiveSessionStopAcknowledgementMatchesCommand, agentInteractiveSessionStopRequestDigest, agentInteractiveSessionRequestDigest, agentInteractiveSessionRefMatchesStart, agentInteractiveSessionRunRef, agentInteractiveSessionStatusMatchesRef, exactAgentInteractiveSessionStart, AgentEnvironmentCreationSchema, createAgentEnvironmentWithIdempotency, replayedAgentEnvironmentView, canonicalWorkspaceCwd, MAX_WORKSPACE_CWD_LENGTH, workspaceCwdSchema, workspaceCwdPathForBase, WorkspaceRequestSchema, TerminalAttachRequestSchema, TerminalAttachResultSchema, TerminalDetachAckSchema, TerminalInputSchema, TerminalOutputEventSchema, TerminalReplayWindowSchema, TerminalResizeSchema, TerminalSessionRefSchema, terminalAttachResultMatchesRequest, terminalSessionUsable, } from "./environment-provider.js";
|
|
11
11
|
export * from "./plan.js";
|
|
12
12
|
export * from "./runtime-control.js";
|
|
13
13
|
export * from "./portable-context.js";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** Maximum number of UTF-16 code units accepted in a workspace cwd path. */
|
|
3
|
+
export declare const MAX_WORKSPACE_CWD_LENGTH = 4096;
|
|
4
|
+
export type WorkspaceCwdBase = "repository" | "host";
|
|
5
|
+
export type WorkspaceCwd = {
|
|
6
|
+
base: "repository";
|
|
7
|
+
path: string;
|
|
8
|
+
} | {
|
|
9
|
+
base: "host";
|
|
10
|
+
path: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Validate and canonicalize an explicitly based workspace path.
|
|
14
|
+
*
|
|
15
|
+
* Repository paths never start with `./`, contain duplicate separators, or
|
|
16
|
+
* leave the workspace root. Host paths preserve native separators and values.
|
|
17
|
+
*/
|
|
18
|
+
export declare const workspaceCwdSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
19
|
+
base: z.ZodLiteral<"repository">;
|
|
20
|
+
path: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
21
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
22
|
+
base: z.ZodLiteral<"host">;
|
|
23
|
+
path: z.ZodString;
|
|
24
|
+
}, z.core.$strict>], "base">;
|
|
25
|
+
/** Validate and return the canonical form of a workspace cwd. */
|
|
26
|
+
export declare function canonicalWorkspaceCwd(value: WorkspaceCwd): WorkspaceCwd;
|
|
27
|
+
/** Return a provider path only when its explicit base is supported. */
|
|
28
|
+
export declare function workspaceCwdPathForBase(value: WorkspaceCwd | undefined, base: WorkspaceCwdBase, providerLabel: string): string | undefined;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { pathSafetyIssues, relativePathSafetyIssues, } from "./agent-candidate-schema-common.js";
|
|
3
|
+
/** Maximum number of UTF-16 code units accepted in a workspace cwd path. */
|
|
4
|
+
export const MAX_WORKSPACE_CWD_LENGTH = 4_096;
|
|
5
|
+
const workspaceCwdIssueMessages = {
|
|
6
|
+
absolute: "Workspace cwd must be relative",
|
|
7
|
+
backslash: "Workspace cwd must use POSIX separators",
|
|
8
|
+
"control-character": "Workspace cwd cannot contain control characters",
|
|
9
|
+
"parent-traversal": "Workspace cwd cannot leave the workspace root",
|
|
10
|
+
"malformed-unicode": "Workspace cwd must contain well-formed Unicode",
|
|
11
|
+
};
|
|
12
|
+
function normalizeWorkspaceCwd(value) {
|
|
13
|
+
const segments = value
|
|
14
|
+
.split("/")
|
|
15
|
+
.filter((segment) => segment.length > 0 && segment !== ".");
|
|
16
|
+
return segments.join("/") || ".";
|
|
17
|
+
}
|
|
18
|
+
const pathIssueMessages = {
|
|
19
|
+
"control-character": "Workspace cwd cannot contain control characters",
|
|
20
|
+
"malformed-unicode": "Workspace cwd must contain well-formed Unicode",
|
|
21
|
+
};
|
|
22
|
+
const repositoryWorkspaceCwdPathSchema = z
|
|
23
|
+
.string()
|
|
24
|
+
.min(1)
|
|
25
|
+
.max(MAX_WORKSPACE_CWD_LENGTH)
|
|
26
|
+
.superRefine((value, refinement) => {
|
|
27
|
+
for (const issue of relativePathSafetyIssues(value)) {
|
|
28
|
+
const message = workspaceCwdIssueMessages[issue];
|
|
29
|
+
if (message === undefined)
|
|
30
|
+
continue;
|
|
31
|
+
refinement.addIssue({
|
|
32
|
+
code: "custom",
|
|
33
|
+
message,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
.transform(normalizeWorkspaceCwd);
|
|
38
|
+
const hostWorkspaceCwdPathSchema = z
|
|
39
|
+
.string()
|
|
40
|
+
.max(MAX_WORKSPACE_CWD_LENGTH)
|
|
41
|
+
.superRefine((value, refinement) => {
|
|
42
|
+
for (const issue of pathSafetyIssues(value)) {
|
|
43
|
+
refinement.addIssue({
|
|
44
|
+
code: "custom",
|
|
45
|
+
message: pathIssueMessages[issue],
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
/**
|
|
50
|
+
* Validate and canonicalize an explicitly based workspace path.
|
|
51
|
+
*
|
|
52
|
+
* Repository paths never start with `./`, contain duplicate separators, or
|
|
53
|
+
* leave the workspace root. Host paths preserve native separators and values.
|
|
54
|
+
*/
|
|
55
|
+
export const workspaceCwdSchema = z.discriminatedUnion("base", [
|
|
56
|
+
z.strictObject({
|
|
57
|
+
base: z.literal("repository"),
|
|
58
|
+
path: repositoryWorkspaceCwdPathSchema,
|
|
59
|
+
}),
|
|
60
|
+
z.strictObject({
|
|
61
|
+
base: z.literal("host"),
|
|
62
|
+
path: hostWorkspaceCwdPathSchema,
|
|
63
|
+
}),
|
|
64
|
+
]);
|
|
65
|
+
/** Validate and return the canonical form of a workspace cwd. */
|
|
66
|
+
export function canonicalWorkspaceCwd(value) {
|
|
67
|
+
return workspaceCwdSchema.parse(value);
|
|
68
|
+
}
|
|
69
|
+
/** Return a provider path only when its explicit base is supported. */
|
|
70
|
+
export function workspaceCwdPathForBase(value, base, providerLabel) {
|
|
71
|
+
if (value === undefined)
|
|
72
|
+
return undefined;
|
|
73
|
+
if (value.base !== base) {
|
|
74
|
+
throw new Error(`${providerLabel} supports workspace cwd base "${base}", not "${value.base}"`);
|
|
75
|
+
}
|
|
76
|
+
return value.path;
|
|
77
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/agent-interface",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "MIT",
|
|
@@ -83,9 +83,9 @@
|
|
|
83
83
|
"LICENSE"
|
|
84
84
|
],
|
|
85
85
|
"dependencies": {
|
|
86
|
-
"@noble/hashes": "
|
|
86
|
+
"@noble/hashes": "2.4.0",
|
|
87
87
|
"spdx-expression-parse": "5.0.0",
|
|
88
|
-
"zod": "4.4
|
|
88
|
+
"zod": "4.5.4"
|
|
89
89
|
},
|
|
90
90
|
"devDependencies": {
|
|
91
91
|
"@types/node": "26.4.0",
|