@tangle-network/agent-interface 1.2.0 → 1.4.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 +6 -0
- package/dist/agent-execution-preparation-receipt.d.ts +308 -0
- package/dist/agent-execution-preparation-receipt.js +217 -0
- package/dist/agent-execution-preparation.d.ts +5 -300
- package/dist/agent-execution-preparation.js +6 -219
- package/dist/agent-workspace-lease.d.ts +2 -18
- package/dist/agent-workspace-lease.js +2 -14
- package/dist/agent-workspace-source-snapshot.d.ts +21 -0
- package/dist/agent-workspace-source-snapshot.js +18 -0
- package/dist/environment-interactive-control.d.ts +1694 -0
- package/dist/environment-interactive-control.js +456 -0
- package/dist/environment-interactive-shared.d.ts +5 -0
- package/dist/environment-interactive-shared.js +16 -0
- package/dist/environment-interactive-start.d.ts +238 -0
- package/dist/environment-interactive-start.js +95 -0
- package/dist/environment-interactive.d.ts +2 -1930
- package/dist/environment-interactive.js +2 -557
- package/dist/environment-observation.d.ts +3 -3
- package/dist/environment-runtime.d.ts +41 -1
- package/dist/environment-runtime.js +27 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/runtime-control.js +66 -0
- package/dist/stream-events.d.ts +59 -1
- package/package.json +6 -1
|
@@ -1,102 +1,11 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
1
|
import type { Sha256Digest } from "./agent-candidate.js";
|
|
3
|
-
import {
|
|
2
|
+
import type { AgentProfile } from "./agent-profile.js";
|
|
4
3
|
import type { AgentProfileActivationEvidence } from "./agent-profile-activation.js";
|
|
5
4
|
import { type AgentProfileMaterializationAxis } from "./agent-profile-materialization.js";
|
|
6
|
-
import { type
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
export type AgentExecutionPreparationOwner
|
|
10
|
-
/** One exact profile path and how the prepared execution will handle it. */
|
|
11
|
-
export interface AgentExecutionPreparationAxisResult {
|
|
12
|
-
axis: AgentProfileMaterializationAxis;
|
|
13
|
-
disposition: AgentExecutionPreparationDisposition;
|
|
14
|
-
owner: AgentExecutionPreparationOwner;
|
|
15
|
-
/** Public mechanism identifier; launch arguments are structurally refused. */
|
|
16
|
-
mechanism: string;
|
|
17
|
-
evidenceDigest?: Sha256Digest;
|
|
18
|
-
/** RFC 6901 JSON Pointer. Required when one axis has multiple requested paths. */
|
|
19
|
-
path?: string;
|
|
20
|
-
/**
|
|
21
|
-
* Sanitized public diagnostic prose for an override or unsupported path.
|
|
22
|
-
* The schema refuses recognized credential formats, but cannot identify
|
|
23
|
-
* arbitrary secret strings; producers remain responsible for redaction.
|
|
24
|
-
*/
|
|
25
|
-
reason?: string;
|
|
26
|
-
}
|
|
27
|
-
export interface AgentExecutionPreparationReasoningEffort {
|
|
28
|
-
requested: ReasoningEffort;
|
|
29
|
-
resolved?: ReasoningEffort;
|
|
30
|
-
fidelity: "exact" | "clamped" | "unsupported";
|
|
31
|
-
}
|
|
32
|
-
export interface AgentExecutionPreparationResolvedModel {
|
|
33
|
-
/** Exact effective profile request; an explicit empty hint remains empty. */
|
|
34
|
-
requested: string;
|
|
35
|
-
/** Concrete non-empty model selected for execution. */
|
|
36
|
-
resolved: string;
|
|
37
|
-
/** Exact effective provider hint when present, including an explicit empty hint. */
|
|
38
|
-
provider?: string;
|
|
39
|
-
reasoningEffort?: AgentExecutionPreparationReasoningEffort;
|
|
40
|
-
}
|
|
41
|
-
export interface AgentExecutionPreparationWorkspace {
|
|
42
|
-
/** Public, non-secret lifecycle identity for the workspace lease. */
|
|
43
|
-
leaseId: string;
|
|
44
|
-
/** Provider that owns the private prepared workspace capability. */
|
|
45
|
-
provider: string;
|
|
46
|
-
/**
|
|
47
|
-
* Digest of the immutable allocation tuple (provider, lease/allocation id,
|
|
48
|
-
* and canonical root). This binds `leaseId` to its allocation; it is not a
|
|
49
|
-
* filesystem-content digest.
|
|
50
|
-
*/
|
|
51
|
-
identityDigest: Sha256Digest;
|
|
52
|
-
isolation: "per-run" | "shared";
|
|
53
|
-
/** Canonical source snapshot before the isolated copy is prepared. */
|
|
54
|
-
sourceSnapshotDigest: Sha256Digest;
|
|
55
|
-
/** Public identity of the provider's exact snapshot/canonicalization policy. */
|
|
56
|
-
sourceSnapshotPolicy: AgentWorkspaceSourceSnapshotPolicy;
|
|
57
|
-
/** Canonical actual workspace after profile activation and before compute. */
|
|
58
|
-
preparedWorkspaceDigest: Sha256Digest;
|
|
59
|
-
profileActivationDigest: Sha256Digest;
|
|
60
|
-
}
|
|
61
|
-
export interface AgentExecutionPreparationMaterializer {
|
|
62
|
-
name: string;
|
|
63
|
-
version: string;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Executor acknowledgement emitted after all launch decisions are fixed and
|
|
67
|
-
* before any agent compute begins.
|
|
68
|
-
*
|
|
69
|
-
* `executionPlanDigest` is required to hash only public launch decisions plus
|
|
70
|
-
* caller-declared public secret-slot/reference identities. Secret values belong
|
|
71
|
-
* solely in the private prepared-executor closure/capability; hashing them here
|
|
72
|
-
* would leak equality and permit guessing low-entropy credentials. This receipt
|
|
73
|
-
* proves public plan identity, not possession of that private capability.
|
|
74
|
-
* Secret-capable MCP/hook slots structurally accept only tagged public values or
|
|
75
|
-
* opaque references. Other authored profile text and reference keys remain
|
|
76
|
-
* caller-declared public data; recognizable-pattern refusal is defense in depth,
|
|
77
|
-
* not proof that arbitrary text is non-secret.
|
|
78
|
-
*/
|
|
79
|
-
export interface AgentExecutionPreparationReceipt {
|
|
80
|
-
kind: "agent-execution-preparation";
|
|
81
|
-
schemaVersion: 1;
|
|
82
|
-
preparationId: string;
|
|
83
|
-
requestDigest: Sha256Digest;
|
|
84
|
-
/** Canonical identity before executor overrides. */
|
|
85
|
-
authoredProfileDigest: Sha256Digest;
|
|
86
|
-
/** Canonical identity after executor overrides. */
|
|
87
|
-
effectiveProfileDigest: Sha256Digest;
|
|
88
|
-
backend: string;
|
|
89
|
-
harness: HarnessType;
|
|
90
|
-
harnessVersion: string;
|
|
91
|
-
resolvedModel: AgentExecutionPreparationResolvedModel;
|
|
92
|
-
workspace: AgentExecutionPreparationWorkspace;
|
|
93
|
-
axisResults: AgentExecutionPreparationAxisResult[];
|
|
94
|
-
/** Caller-supplied digest of public decisions and secret-reference identities. */
|
|
95
|
-
executionPlanDigest: Sha256Digest;
|
|
96
|
-
materializer: AgentExecutionPreparationMaterializer;
|
|
97
|
-
expiresAtMs: number;
|
|
98
|
-
digest: Sha256Digest;
|
|
99
|
-
}
|
|
5
|
+
import { type AgentExecutionPreparationAxisResult, type AgentExecutionPreparationMaterializer, type AgentExecutionPreparationReceipt, type AgentExecutionPreparationResolvedModel } from "./agent-execution-preparation-receipt.js";
|
|
6
|
+
import type { HarnessType } from "./harness.js";
|
|
7
|
+
import { type AgentWorkspaceExecutionBoundLeaseRecord, type AgentWorkspaceSealedLeaseRecord } from "./agent-workspace-lease.js";
|
|
8
|
+
export { agentExecutionPreparationAxisResultSchema, agentExecutionPreparationReasoningEffortSchema, agentExecutionPreparationReceiptSchema, type AgentExecutionPreparationAxisResult, type AgentExecutionPreparationDisposition, type AgentExecutionPreparationMaterializer, type AgentExecutionPreparationOwner, type AgentExecutionPreparationReasoningEffort, type AgentExecutionPreparationReceipt, type AgentExecutionPreparationResolvedModel, type AgentExecutionPreparationWorkspace, } from "./agent-execution-preparation-receipt.js";
|
|
100
9
|
export interface BuildAgentExecutionPreparationReceiptInput {
|
|
101
10
|
preparationId: string;
|
|
102
11
|
requestDigest: Sha256Digest;
|
|
@@ -148,210 +57,6 @@ export type AgentExecutionPreparationValidationResult = {
|
|
|
148
57
|
ok: false;
|
|
149
58
|
issues: AgentExecutionPreparationValidationIssue[];
|
|
150
59
|
};
|
|
151
|
-
export declare const agentExecutionPreparationAxisResultSchema: z.ZodObject<{
|
|
152
|
-
axis: z.ZodEnum<{
|
|
153
|
-
name: "name";
|
|
154
|
-
systemPrompt: "systemPrompt";
|
|
155
|
-
appendSystemPrompt: "appendSystemPrompt";
|
|
156
|
-
instructions: "instructions";
|
|
157
|
-
files: "files";
|
|
158
|
-
tools: "tools";
|
|
159
|
-
skills: "skills";
|
|
160
|
-
commands: "commands";
|
|
161
|
-
description: "description";
|
|
162
|
-
version: "version";
|
|
163
|
-
tags: "tags";
|
|
164
|
-
harness: "harness";
|
|
165
|
-
permissions: "permissions";
|
|
166
|
-
mcp: "mcp";
|
|
167
|
-
connections: "connections";
|
|
168
|
-
subagents: "subagents";
|
|
169
|
-
hooks: "hooks";
|
|
170
|
-
modes: "modes";
|
|
171
|
-
confidential: "confidential";
|
|
172
|
-
metadata: "metadata";
|
|
173
|
-
extensions: "extensions";
|
|
174
|
-
modelDefault: "modelDefault";
|
|
175
|
-
modelSmall: "modelSmall";
|
|
176
|
-
modelProvider: "modelProvider";
|
|
177
|
-
modelReasoningEffort: "modelReasoningEffort";
|
|
178
|
-
modelMetadata: "modelMetadata";
|
|
179
|
-
resourceTools: "resourceTools";
|
|
180
|
-
resourceAgents: "resourceAgents";
|
|
181
|
-
resourceInstructions: "resourceInstructions";
|
|
182
|
-
resourceFailOnError: "resourceFailOnError";
|
|
183
|
-
}>;
|
|
184
|
-
disposition: z.ZodEnum<{
|
|
185
|
-
unsupported: "unsupported";
|
|
186
|
-
behavior: "behavior";
|
|
187
|
-
control: "control";
|
|
188
|
-
overridden: "overridden";
|
|
189
|
-
}>;
|
|
190
|
-
owner: z.ZodEnum<{
|
|
191
|
-
runtime: "runtime";
|
|
192
|
-
executor: "executor";
|
|
193
|
-
}>;
|
|
194
|
-
mechanism: z.ZodString;
|
|
195
|
-
evidenceDigest: z.ZodOptional<z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>>;
|
|
196
|
-
path: z.ZodOptional<z.ZodString>;
|
|
197
|
-
reason: z.ZodOptional<z.ZodString>;
|
|
198
|
-
}, z.core.$strict>;
|
|
199
|
-
export declare const agentExecutionPreparationReasoningEffortSchema: z.ZodObject<{
|
|
200
|
-
requested: z.ZodEnum<{
|
|
201
|
-
none: "none";
|
|
202
|
-
minimal: "minimal";
|
|
203
|
-
low: "low";
|
|
204
|
-
medium: "medium";
|
|
205
|
-
high: "high";
|
|
206
|
-
xhigh: "xhigh";
|
|
207
|
-
ultracode: "ultracode";
|
|
208
|
-
}>;
|
|
209
|
-
resolved: z.ZodOptional<z.ZodEnum<{
|
|
210
|
-
none: "none";
|
|
211
|
-
minimal: "minimal";
|
|
212
|
-
low: "low";
|
|
213
|
-
medium: "medium";
|
|
214
|
-
high: "high";
|
|
215
|
-
xhigh: "xhigh";
|
|
216
|
-
ultracode: "ultracode";
|
|
217
|
-
}>>;
|
|
218
|
-
fidelity: z.ZodEnum<{
|
|
219
|
-
exact: "exact";
|
|
220
|
-
unsupported: "unsupported";
|
|
221
|
-
clamped: "clamped";
|
|
222
|
-
}>;
|
|
223
|
-
}, z.core.$strict>;
|
|
224
|
-
export declare const agentExecutionPreparationReceiptSchema: z.ZodObject<{
|
|
225
|
-
kind: z.ZodLiteral<"agent-execution-preparation">;
|
|
226
|
-
schemaVersion: z.ZodLiteral<1>;
|
|
227
|
-
preparationId: z.ZodString;
|
|
228
|
-
requestDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
229
|
-
authoredProfileDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
230
|
-
effectiveProfileDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
231
|
-
backend: z.ZodString;
|
|
232
|
-
harness: z.ZodEnum<{
|
|
233
|
-
"claude-code": "claude-code";
|
|
234
|
-
nanoclaw: "nanoclaw";
|
|
235
|
-
codex: "codex";
|
|
236
|
-
opencode: "opencode";
|
|
237
|
-
"kimi-code": "kimi-code";
|
|
238
|
-
pi: "pi";
|
|
239
|
-
prime: "prime";
|
|
240
|
-
gemini: "gemini";
|
|
241
|
-
hermes: "hermes";
|
|
242
|
-
openclaw: "openclaw";
|
|
243
|
-
amp: "amp";
|
|
244
|
-
"factory-droids": "factory-droids";
|
|
245
|
-
forge: "forge";
|
|
246
|
-
cursor: "cursor";
|
|
247
|
-
acp: "acp";
|
|
248
|
-
"cli-base": "cli-base";
|
|
249
|
-
}>;
|
|
250
|
-
harnessVersion: z.ZodString;
|
|
251
|
-
resolvedModel: z.ZodObject<{
|
|
252
|
-
requested: z.ZodString;
|
|
253
|
-
resolved: z.ZodString;
|
|
254
|
-
provider: z.ZodOptional<z.ZodString>;
|
|
255
|
-
reasoningEffort: z.ZodOptional<z.ZodObject<{
|
|
256
|
-
requested: z.ZodEnum<{
|
|
257
|
-
none: "none";
|
|
258
|
-
minimal: "minimal";
|
|
259
|
-
low: "low";
|
|
260
|
-
medium: "medium";
|
|
261
|
-
high: "high";
|
|
262
|
-
xhigh: "xhigh";
|
|
263
|
-
ultracode: "ultracode";
|
|
264
|
-
}>;
|
|
265
|
-
resolved: z.ZodOptional<z.ZodEnum<{
|
|
266
|
-
none: "none";
|
|
267
|
-
minimal: "minimal";
|
|
268
|
-
low: "low";
|
|
269
|
-
medium: "medium";
|
|
270
|
-
high: "high";
|
|
271
|
-
xhigh: "xhigh";
|
|
272
|
-
ultracode: "ultracode";
|
|
273
|
-
}>>;
|
|
274
|
-
fidelity: z.ZodEnum<{
|
|
275
|
-
exact: "exact";
|
|
276
|
-
unsupported: "unsupported";
|
|
277
|
-
clamped: "clamped";
|
|
278
|
-
}>;
|
|
279
|
-
}, z.core.$strict>>;
|
|
280
|
-
}, z.core.$strict>;
|
|
281
|
-
workspace: z.ZodObject<{
|
|
282
|
-
leaseId: z.ZodString;
|
|
283
|
-
provider: z.ZodString;
|
|
284
|
-
identityDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
285
|
-
isolation: z.ZodEnum<{
|
|
286
|
-
"per-run": "per-run";
|
|
287
|
-
shared: "shared";
|
|
288
|
-
}>;
|
|
289
|
-
sourceSnapshotDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
290
|
-
sourceSnapshotPolicy: z.ZodObject<{
|
|
291
|
-
kind: z.ZodLiteral<"provider-declared">;
|
|
292
|
-
name: z.ZodString;
|
|
293
|
-
version: z.ZodNumber;
|
|
294
|
-
digest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
295
|
-
}, z.core.$strict>;
|
|
296
|
-
preparedWorkspaceDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
297
|
-
profileActivationDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
298
|
-
}, z.core.$strict>;
|
|
299
|
-
axisResults: z.ZodArray<z.ZodObject<{
|
|
300
|
-
axis: z.ZodEnum<{
|
|
301
|
-
name: "name";
|
|
302
|
-
systemPrompt: "systemPrompt";
|
|
303
|
-
appendSystemPrompt: "appendSystemPrompt";
|
|
304
|
-
instructions: "instructions";
|
|
305
|
-
files: "files";
|
|
306
|
-
tools: "tools";
|
|
307
|
-
skills: "skills";
|
|
308
|
-
commands: "commands";
|
|
309
|
-
description: "description";
|
|
310
|
-
version: "version";
|
|
311
|
-
tags: "tags";
|
|
312
|
-
harness: "harness";
|
|
313
|
-
permissions: "permissions";
|
|
314
|
-
mcp: "mcp";
|
|
315
|
-
connections: "connections";
|
|
316
|
-
subagents: "subagents";
|
|
317
|
-
hooks: "hooks";
|
|
318
|
-
modes: "modes";
|
|
319
|
-
confidential: "confidential";
|
|
320
|
-
metadata: "metadata";
|
|
321
|
-
extensions: "extensions";
|
|
322
|
-
modelDefault: "modelDefault";
|
|
323
|
-
modelSmall: "modelSmall";
|
|
324
|
-
modelProvider: "modelProvider";
|
|
325
|
-
modelReasoningEffort: "modelReasoningEffort";
|
|
326
|
-
modelMetadata: "modelMetadata";
|
|
327
|
-
resourceTools: "resourceTools";
|
|
328
|
-
resourceAgents: "resourceAgents";
|
|
329
|
-
resourceInstructions: "resourceInstructions";
|
|
330
|
-
resourceFailOnError: "resourceFailOnError";
|
|
331
|
-
}>;
|
|
332
|
-
disposition: z.ZodEnum<{
|
|
333
|
-
unsupported: "unsupported";
|
|
334
|
-
behavior: "behavior";
|
|
335
|
-
control: "control";
|
|
336
|
-
overridden: "overridden";
|
|
337
|
-
}>;
|
|
338
|
-
owner: z.ZodEnum<{
|
|
339
|
-
runtime: "runtime";
|
|
340
|
-
executor: "executor";
|
|
341
|
-
}>;
|
|
342
|
-
mechanism: z.ZodString;
|
|
343
|
-
evidenceDigest: z.ZodOptional<z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>>;
|
|
344
|
-
path: z.ZodOptional<z.ZodString>;
|
|
345
|
-
reason: z.ZodOptional<z.ZodString>;
|
|
346
|
-
}, z.core.$strict>>;
|
|
347
|
-
executionPlanDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
348
|
-
materializer: z.ZodObject<{
|
|
349
|
-
name: z.ZodString;
|
|
350
|
-
version: z.ZodString;
|
|
351
|
-
}, z.core.$strict>;
|
|
352
|
-
expiresAtMs: z.ZodNumber;
|
|
353
|
-
digest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
354
|
-
}, z.core.$strict>;
|
|
355
60
|
/**
|
|
356
61
|
* Canonical RFC 8785/SHA-256 identity for one validated, public AgentProfile.
|
|
357
62
|
* Secret-capable MCP/hook fields are tagged. Other prompt, resource, metadata,
|
|
@@ -1,186 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { canonicalCandidateDigest, canonicalCandidateJson, isCanonicalJsonValue, isWellFormedUnicode, looksLikeCredential, omitTopLevelDigest, sha256DigestSchema, } from "./agent-candidate-schema-common.js";
|
|
1
|
+
import { canonicalCandidateDigest, canonicalCandidateJson, isCanonicalJsonValue, } from "./agent-candidate-schema-common.js";
|
|
3
2
|
import { canonicalAgentProfileValue } from "./agent-profile-canonical.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
const nonBlankStringSchema = z
|
|
10
|
-
.string()
|
|
11
|
-
.refine((value) => value.trim().length > 0, "value cannot be blank");
|
|
12
|
-
const publicMechanismIdentifierSchema = z
|
|
13
|
-
.string()
|
|
14
|
-
.regex(/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,199}$/, "mechanism must be a public identifier, not launch arguments")
|
|
15
|
-
.refine((value) => !looksLikeCredential(value), "mechanism cannot carry credential-like material");
|
|
16
|
-
const publicLifecycleIdentifierSchema = z
|
|
17
|
-
.string()
|
|
18
|
-
.regex(/^[A-Za-z0-9][A-Za-z0-9._~:/+-]{0,499}$/, "lifecycle identity must be a public identifier")
|
|
19
|
-
.refine((value) => !looksLikeCredential(value), "lifecycle identity cannot carry credential-like material");
|
|
20
|
-
const publicReasonSchema = nonBlankStringSchema
|
|
21
|
-
.max(4_000)
|
|
22
|
-
.refine((value) => !looksLikeCredential(value), "reason cannot carry credential-like material");
|
|
23
|
-
const jsonPointerSchema = z
|
|
24
|
-
.string()
|
|
25
|
-
.refine(isCanonicalJsonPointer, "path must be a canonical RFC 6901 JSON Pointer");
|
|
26
|
-
export const agentExecutionPreparationAxisResultSchema = z
|
|
27
|
-
.strictObject({
|
|
28
|
-
axis: z.enum(AGENT_PROFILE_MATERIALIZATION_AXES),
|
|
29
|
-
disposition: z.enum([
|
|
30
|
-
"behavior",
|
|
31
|
-
"control",
|
|
32
|
-
"overridden",
|
|
33
|
-
"unsupported",
|
|
34
|
-
]),
|
|
35
|
-
owner: z.enum(["runtime", "executor"]),
|
|
36
|
-
mechanism: publicMechanismIdentifierSchema,
|
|
37
|
-
evidenceDigest: sha256DigestSchema.optional(),
|
|
38
|
-
path: jsonPointerSchema.optional(),
|
|
39
|
-
reason: publicReasonSchema.optional(),
|
|
40
|
-
})
|
|
41
|
-
.superRefine((result, context) => {
|
|
42
|
-
const requiresReason = result.disposition === "overridden" ||
|
|
43
|
-
result.disposition === "unsupported";
|
|
44
|
-
if (requiresReason && result.reason === undefined) {
|
|
45
|
-
context.addIssue({
|
|
46
|
-
code: "custom",
|
|
47
|
-
path: ["reason"],
|
|
48
|
-
message: `${result.disposition} profile coverage requires a reason`,
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
if (!requiresReason && result.reason !== undefined) {
|
|
52
|
-
context.addIssue({
|
|
53
|
-
code: "custom",
|
|
54
|
-
path: ["reason"],
|
|
55
|
-
message: `${result.disposition} profile coverage cannot carry an override reason`,
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
export const agentExecutionPreparationReasoningEffortSchema = z
|
|
60
|
-
.strictObject({
|
|
61
|
-
requested: reasoningEffortSchema,
|
|
62
|
-
resolved: reasoningEffortSchema.optional(),
|
|
63
|
-
fidelity: z.enum(["exact", "clamped", "unsupported"]),
|
|
64
|
-
})
|
|
65
|
-
.superRefine((effort, context) => {
|
|
66
|
-
if (effort.fidelity === "unsupported") {
|
|
67
|
-
if (effort.resolved !== undefined) {
|
|
68
|
-
context.addIssue({
|
|
69
|
-
code: "custom",
|
|
70
|
-
path: ["resolved"],
|
|
71
|
-
message: "unsupported reasoning effort cannot claim a resolved value",
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
if (effort.resolved === undefined) {
|
|
77
|
-
context.addIssue({
|
|
78
|
-
code: "custom",
|
|
79
|
-
path: ["resolved"],
|
|
80
|
-
message: `${effort.fidelity} reasoning fidelity requires a resolved value`,
|
|
81
|
-
});
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
if (effort.fidelity === "exact" && effort.resolved !== effort.requested) {
|
|
85
|
-
context.addIssue({
|
|
86
|
-
code: "custom",
|
|
87
|
-
path: ["resolved"],
|
|
88
|
-
message: "exact reasoning fidelity must preserve the requested effort",
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
if (effort.fidelity === "clamped") {
|
|
92
|
-
if (effort.resolved === effort.requested) {
|
|
93
|
-
context.addIssue({
|
|
94
|
-
code: "custom",
|
|
95
|
-
path: ["resolved"],
|
|
96
|
-
message: "clamped reasoning fidelity must change the requested effort",
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
else if (!isDownwardReasoningClamp(effort.requested, effort.resolved)) {
|
|
100
|
-
context.addIssue({
|
|
101
|
-
code: "custom",
|
|
102
|
-
path: ["resolved"],
|
|
103
|
-
message: "reasoning effort may clamp down but must never increase",
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
export const agentExecutionPreparationReceiptSchema = z
|
|
109
|
-
.strictObject({
|
|
110
|
-
kind: z.literal("agent-execution-preparation"),
|
|
111
|
-
schemaVersion: z.literal(1),
|
|
112
|
-
preparationId: nonBlankStringSchema.max(500),
|
|
113
|
-
requestDigest: sha256DigestSchema,
|
|
114
|
-
authoredProfileDigest: sha256DigestSchema,
|
|
115
|
-
effectiveProfileDigest: sha256DigestSchema,
|
|
116
|
-
backend: nonBlankStringSchema.max(200),
|
|
117
|
-
harness: harnessTypeSchema,
|
|
118
|
-
harnessVersion: nonBlankStringSchema.max(200),
|
|
119
|
-
resolvedModel: z.strictObject({
|
|
120
|
-
requested: z.string().max(500),
|
|
121
|
-
resolved: nonBlankStringSchema.max(500),
|
|
122
|
-
provider: z.string().max(200).optional(),
|
|
123
|
-
reasoningEffort: agentExecutionPreparationReasoningEffortSchema.optional(),
|
|
124
|
-
}),
|
|
125
|
-
workspace: z.strictObject({
|
|
126
|
-
leaseId: publicLifecycleIdentifierSchema,
|
|
127
|
-
provider: publicLifecycleIdentifierSchema,
|
|
128
|
-
identityDigest: sha256DigestSchema,
|
|
129
|
-
isolation: z.enum(["per-run", "shared"]),
|
|
130
|
-
sourceSnapshotDigest: sha256DigestSchema,
|
|
131
|
-
sourceSnapshotPolicy: agentWorkspaceSourceSnapshotPolicySchema,
|
|
132
|
-
preparedWorkspaceDigest: sha256DigestSchema,
|
|
133
|
-
profileActivationDigest: sha256DigestSchema,
|
|
134
|
-
}),
|
|
135
|
-
axisResults: z.array(agentExecutionPreparationAxisResultSchema),
|
|
136
|
-
executionPlanDigest: sha256DigestSchema,
|
|
137
|
-
materializer: z.strictObject({
|
|
138
|
-
name: nonBlankStringSchema.max(200),
|
|
139
|
-
version: nonBlankStringSchema.max(200),
|
|
140
|
-
}),
|
|
141
|
-
expiresAtMs: z.number().int().positive().safe(),
|
|
142
|
-
digest: sha256DigestSchema,
|
|
143
|
-
})
|
|
144
|
-
.superRefine((receipt, context) => {
|
|
145
|
-
const seen = new Map();
|
|
146
|
-
for (const [index, result] of receipt.axisResults.entries()) {
|
|
147
|
-
const key = axisResultKey(result.axis, result.path);
|
|
148
|
-
const previous = seen.get(key);
|
|
149
|
-
if (previous !== undefined) {
|
|
150
|
-
context.addIssue({
|
|
151
|
-
code: "custom",
|
|
152
|
-
path: ["axisResults", index],
|
|
153
|
-
message: canonicalRowsEqual(previous, result)
|
|
154
|
-
? "duplicate profile axis/path result"
|
|
155
|
-
: "conflicting profile axis/path results",
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
else {
|
|
159
|
-
seen.set(key, result);
|
|
160
|
-
}
|
|
161
|
-
if (index > 0 &&
|
|
162
|
-
compareAxisResults(receipt.axisResults[index - 1], result) >= 0) {
|
|
163
|
-
context.addIssue({
|
|
164
|
-
code: "custom",
|
|
165
|
-
path: ["axisResults", index],
|
|
166
|
-
message: "profile axis/path results must be canonically sorted",
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
if (!isCanonicalJsonValue(receipt)) {
|
|
171
|
-
context.addIssue({
|
|
172
|
-
code: "custom",
|
|
173
|
-
message: "execution preparation receipt must contain only RFC 8785 JSON values",
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
else if (canonicalCandidateDigest(omitTopLevelDigest(receipt)) !== receipt.digest) {
|
|
177
|
-
context.addIssue({
|
|
178
|
-
code: "custom",
|
|
179
|
-
path: ["digest"],
|
|
180
|
-
message: "execution preparation receipt digest is invalid",
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
});
|
|
3
|
+
import { profileMaterializationRequests, } from "./agent-profile-materialization.js";
|
|
4
|
+
import { agentExecutionPreparationAxisResultKey as axisResultKey, agentExecutionPreparationAxisResultsEqual as canonicalRowsEqual, agentExecutionPreparationReceiptSchema, compareAgentExecutionPreparationAxisResults as compareAxisResults, } from "./agent-execution-preparation-receipt.js";
|
|
5
|
+
import { agentProfileSchema } from "./profile-schema.js";
|
|
6
|
+
import { agentWorkspaceLeaseRecordSchema, } from "./agent-workspace-lease.js";
|
|
7
|
+
export { agentExecutionPreparationAxisResultSchema, agentExecutionPreparationReasoningEffortSchema, agentExecutionPreparationReceiptSchema, } from "./agent-execution-preparation-receipt.js";
|
|
184
8
|
/**
|
|
185
9
|
* Canonical RFC 8785/SHA-256 identity for one validated, public AgentProfile.
|
|
186
10
|
* Secret-capable MCP/hook fields are tagged. Other prompt, resource, metadata,
|
|
@@ -681,14 +505,6 @@ function canonicalValuesEqual(left, right) {
|
|
|
681
505
|
return Object.is(left, right);
|
|
682
506
|
}
|
|
683
507
|
}
|
|
684
|
-
function canonicalRowsEqual(left, right) {
|
|
685
|
-
try {
|
|
686
|
-
return canonicalCandidateJson(left) === canonicalCandidateJson(right);
|
|
687
|
-
}
|
|
688
|
-
catch {
|
|
689
|
-
return false;
|
|
690
|
-
}
|
|
691
|
-
}
|
|
692
508
|
function compareDigest(issues, label, actual, expected) {
|
|
693
509
|
if (actual === expected)
|
|
694
510
|
return;
|
|
@@ -705,32 +521,3 @@ function compareExpectation(issues, label, actual, expected) {
|
|
|
705
521
|
message: `${label} does not match the prepared execution`,
|
|
706
522
|
});
|
|
707
523
|
}
|
|
708
|
-
function isCanonicalJsonPointer(value) {
|
|
709
|
-
if (!value.startsWith("/") || !isWellFormedUnicode(value))
|
|
710
|
-
return false;
|
|
711
|
-
for (let index = 0; index < value.length; index += 1) {
|
|
712
|
-
if (value[index] !== "~")
|
|
713
|
-
continue;
|
|
714
|
-
const escape = value[index + 1];
|
|
715
|
-
if (escape !== "0" && escape !== "1")
|
|
716
|
-
return false;
|
|
717
|
-
index += 1;
|
|
718
|
-
}
|
|
719
|
-
return true;
|
|
720
|
-
}
|
|
721
|
-
const AXIS_ORDER = new Map(AGENT_PROFILE_MATERIALIZATION_AXES.map((axis, index) => [axis, index]));
|
|
722
|
-
function compareAxisResults(left, right) {
|
|
723
|
-
const axisDifference = (AXIS_ORDER.get(left.axis) ?? Number.MAX_SAFE_INTEGER) -
|
|
724
|
-
(AXIS_ORDER.get(right.axis) ?? Number.MAX_SAFE_INTEGER);
|
|
725
|
-
if (axisDifference !== 0)
|
|
726
|
-
return axisDifference;
|
|
727
|
-
const leftPath = left.path ?? "";
|
|
728
|
-
const rightPath = right.path ?? "";
|
|
729
|
-
return leftPath < rightPath ? -1 : leftPath > rightPath ? 1 : 0;
|
|
730
|
-
}
|
|
731
|
-
function axisResultKey(axis, path) {
|
|
732
|
-
return `${axis}\u0000${path ?? ""}`;
|
|
733
|
-
}
|
|
734
|
-
function isDownwardReasoningClamp(requested, resolved) {
|
|
735
|
-
return (REASONING_EFFORTS.indexOf(resolved) < REASONING_EFFORTS.indexOf(requested));
|
|
736
|
-
}
|
|
@@ -1,18 +1,9 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { Sha256Digest } from "./agent-candidate.js";
|
|
3
|
+
import { type AgentWorkspaceSourceSnapshotPolicy } from "./agent-workspace-source-snapshot.js";
|
|
4
|
+
export { agentWorkspaceSourceSnapshotPolicySchema, type AgentWorkspaceSourceSnapshotPolicy, } from "./agent-workspace-source-snapshot.js";
|
|
3
5
|
export declare const AGENT_WORKSPACE_LEASE_PHASES: readonly ["copy-ready", "workspace-sealed", "execution-bound", "destroying", "cleanup-failed", "destroyed"];
|
|
4
6
|
export type AgentWorkspaceLeasePhase = (typeof AGENT_WORKSPACE_LEASE_PHASES)[number];
|
|
5
|
-
/**
|
|
6
|
-
* Public identity of the provider-owned rules used to capture workspace state.
|
|
7
|
-
* The digest binds the exact canonical policy document retained by the provider;
|
|
8
|
-
* this descriptor does not claim that every provider captures the same fields.
|
|
9
|
-
*/
|
|
10
|
-
export interface AgentWorkspaceSourceSnapshotPolicy {
|
|
11
|
-
kind: "provider-declared";
|
|
12
|
-
name: string;
|
|
13
|
-
version: number;
|
|
14
|
-
digest: Sha256Digest;
|
|
15
|
-
}
|
|
16
7
|
/** Public allocation identity. `root` locates bytes; it grants no authority. */
|
|
17
8
|
export interface AgentWorkspaceAllocationIdentity {
|
|
18
9
|
provider: string;
|
|
@@ -118,12 +109,6 @@ export declare const agentWorkspaceLeasePhaseSchema: z.ZodEnum<{
|
|
|
118
109
|
"cleanup-failed": "cleanup-failed";
|
|
119
110
|
destroyed: "destroyed";
|
|
120
111
|
}>;
|
|
121
|
-
export declare const agentWorkspaceSourceSnapshotPolicySchema: z.ZodObject<{
|
|
122
|
-
kind: z.ZodLiteral<"provider-declared">;
|
|
123
|
-
name: z.ZodString;
|
|
124
|
-
version: z.ZodNumber;
|
|
125
|
-
digest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
126
|
-
}, z.core.$strict>;
|
|
127
112
|
export declare const agentWorkspaceAllocationIdentitySchema: z.ZodObject<{
|
|
128
113
|
provider: z.ZodString;
|
|
129
114
|
root: z.ZodString;
|
|
@@ -135,4 +120,3 @@ export declare const agentWorkspaceLeaseRecordSchema: z.ZodType<AgentWorkspaceLe
|
|
|
135
120
|
export declare function canonicalAgentWorkspaceLeaseRecordDigest(material: AgentWorkspaceLeaseRecordMaterial): Sha256Digest;
|
|
136
121
|
/** Build and self-hash one phase-valid public workspace lease record. */
|
|
137
122
|
export declare function buildAgentWorkspaceLeaseRecord<Material extends AgentWorkspaceLeaseRecordMaterial>(material: Material): WithDigest<Material>;
|
|
138
|
-
export {};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { canonicalCandidateDigest, isCanonicalJsonValue, isWellFormedUnicode, looksLikeCredential, omitTopLevelDigest, sha256DigestSchema, } from "./agent-candidate-schema-common.js";
|
|
3
|
+
import { agentWorkspacePublicIdentifierSchema as publicIdentifierSchema, agentWorkspaceSourceSnapshotPolicySchema, } from "./agent-workspace-source-snapshot.js";
|
|
4
|
+
export { agentWorkspaceSourceSnapshotPolicySchema, } from "./agent-workspace-source-snapshot.js";
|
|
3
5
|
export const AGENT_WORKSPACE_LEASE_PHASES = [
|
|
4
6
|
"copy-ready",
|
|
5
7
|
"workspace-sealed",
|
|
@@ -9,14 +11,6 @@ export const AGENT_WORKSPACE_LEASE_PHASES = [
|
|
|
9
11
|
"destroyed",
|
|
10
12
|
];
|
|
11
13
|
const controlCharacterPattern = /[\u0000-\u001f\u007f]/;
|
|
12
|
-
const publicIdentifierSchema = z
|
|
13
|
-
.string()
|
|
14
|
-
.min(1)
|
|
15
|
-
.max(500)
|
|
16
|
-
.refine((value) => value.trim().length > 0 &&
|
|
17
|
-
isWellFormedUnicode(value) &&
|
|
18
|
-
!controlCharacterPattern.test(value) &&
|
|
19
|
-
!looksLikeCredential(value), "public workspace identity cannot carry credential-like material");
|
|
20
14
|
const publicLocatorSchema = z
|
|
21
15
|
.string()
|
|
22
16
|
.min(1)
|
|
@@ -39,12 +33,6 @@ const timestampSchema = z
|
|
|
39
33
|
.nonnegative()
|
|
40
34
|
.max(Number.MAX_SAFE_INTEGER);
|
|
41
35
|
export const agentWorkspaceLeasePhaseSchema = z.enum(AGENT_WORKSPACE_LEASE_PHASES);
|
|
42
|
-
export const agentWorkspaceSourceSnapshotPolicySchema = z.strictObject({
|
|
43
|
-
kind: z.literal("provider-declared"),
|
|
44
|
-
name: publicIdentifierSchema,
|
|
45
|
-
version: z.number().int().positive().max(Number.MAX_SAFE_INTEGER),
|
|
46
|
-
digest: sha256DigestSchema,
|
|
47
|
-
});
|
|
48
36
|
export const agentWorkspaceAllocationIdentitySchema = z.strictObject({
|
|
49
37
|
provider: publicIdentifierSchema,
|
|
50
38
|
root: publicLocatorSchema,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { Sha256Digest } from "./agent-candidate.js";
|
|
3
|
+
/** Shared public identifier used by workspace lifecycle contracts. */
|
|
4
|
+
export declare const agentWorkspacePublicIdentifierSchema: z.ZodString;
|
|
5
|
+
/**
|
|
6
|
+
* Public identity of the provider-owned rules used to capture workspace state.
|
|
7
|
+
* The digest binds the exact canonical policy document retained by the provider;
|
|
8
|
+
* this descriptor does not claim that every provider captures the same fields.
|
|
9
|
+
*/
|
|
10
|
+
export interface AgentWorkspaceSourceSnapshotPolicy {
|
|
11
|
+
kind: "provider-declared";
|
|
12
|
+
name: string;
|
|
13
|
+
version: number;
|
|
14
|
+
digest: Sha256Digest;
|
|
15
|
+
}
|
|
16
|
+
export declare const agentWorkspaceSourceSnapshotPolicySchema: z.ZodObject<{
|
|
17
|
+
kind: z.ZodLiteral<"provider-declared">;
|
|
18
|
+
name: z.ZodString;
|
|
19
|
+
version: z.ZodNumber;
|
|
20
|
+
digest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
21
|
+
}, z.core.$strict>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { isWellFormedUnicode, looksLikeCredential, sha256DigestSchema, } from "./agent-candidate-schema-common.js";
|
|
3
|
+
const controlCharacterPattern = /[\u0000-\u001f\u007f]/;
|
|
4
|
+
/** Shared public identifier used by workspace lifecycle contracts. */
|
|
5
|
+
export const agentWorkspacePublicIdentifierSchema = z
|
|
6
|
+
.string()
|
|
7
|
+
.min(1)
|
|
8
|
+
.max(500)
|
|
9
|
+
.refine((value) => value.trim().length > 0 &&
|
|
10
|
+
isWellFormedUnicode(value) &&
|
|
11
|
+
!controlCharacterPattern.test(value) &&
|
|
12
|
+
!looksLikeCredential(value), "public workspace identity cannot carry credential-like material");
|
|
13
|
+
export const agentWorkspaceSourceSnapshotPolicySchema = z.strictObject({
|
|
14
|
+
kind: z.literal("provider-declared"),
|
|
15
|
+
name: agentWorkspacePublicIdentifierSchema,
|
|
16
|
+
version: z.number().int().positive().max(Number.MAX_SAFE_INTEGER),
|
|
17
|
+
digest: sha256DigestSchema,
|
|
18
|
+
});
|