@tangle-network/agent-interface 0.37.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.
@@ -0,0 +1,41 @@
1
+ import { z } from "zod";
2
+ import type { Sha256Digest } from "./agent-candidate.js";
3
+ /** One exact native file applied before an agent process starts. */
4
+ export interface AgentProfileActivationFileEvidence {
5
+ path: string;
6
+ mode: number;
7
+ content: string;
8
+ }
9
+ /**
10
+ * Shared evidence carried by every exact profile activation.
11
+ *
12
+ * The plan type remains owned by the producer because ordinary agent runs and
13
+ * sealed benchmark runs have different plan contracts. The applied file bytes
14
+ * and activation identity are shared so those producers cannot invent
15
+ * competing activation evidence.
16
+ */
17
+ export interface AgentProfileActivationEvidence<TProfilePlan = unknown> {
18
+ profilePlan: TProfilePlan;
19
+ files: AgentProfileActivationFileEvidence[];
20
+ digest: Sha256Digest;
21
+ }
22
+ /** Runtime validator for one exact native profile file. */
23
+ export declare const agentProfileActivationFileEvidenceSchema: z.ZodObject<{
24
+ path: z.ZodString;
25
+ mode: z.ZodNumber;
26
+ content: z.ZodString;
27
+ }, z.core.$strict>;
28
+ /**
29
+ * Compose the shared activation evidence with a producer-owned exact plan.
30
+ * Candidate materialization uses this factory and adds its stronger plan/file
31
+ * consistency checks around the resulting schema.
32
+ */
33
+ export declare function createAgentProfileActivationEvidenceSchema<TProfilePlan>(profilePlanSchema: z.ZodType<TProfilePlan>): z.ZodObject<{
34
+ profilePlan: z.ZodType<TProfilePlan, unknown, z.core.$ZodTypeInternals<TProfilePlan, unknown>>;
35
+ files: z.ZodArray<z.ZodObject<{
36
+ path: z.ZodString;
37
+ mode: z.ZodNumber;
38
+ content: z.ZodString;
39
+ }, z.core.$strict>>;
40
+ digest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
41
+ }, z.core.$strict>;
@@ -0,0 +1,24 @@
1
+ import { z } from "zod";
2
+ import { isSafeRelativePath, isWellFormedUnicode, sha256DigestSchema, } from "./agent-candidate-schema-common.js";
3
+ /** Runtime validator for one exact native profile file. */
4
+ export const agentProfileActivationFileEvidenceSchema = z.strictObject({
5
+ path: z
6
+ .string()
7
+ .refine((value) => isSafeRelativePath(value, false), "profile activation file must use a canonical relative path"),
8
+ mode: z.number().int().min(0).max(0o777),
9
+ content: z
10
+ .string()
11
+ .refine(isWellFormedUnicode, "profile activation content must be valid Unicode"),
12
+ });
13
+ /**
14
+ * Compose the shared activation evidence with a producer-owned exact plan.
15
+ * Candidate materialization uses this factory and adds its stronger plan/file
16
+ * consistency checks around the resulting schema.
17
+ */
18
+ export function createAgentProfileActivationEvidenceSchema(profilePlanSchema) {
19
+ return z.strictObject({
20
+ profilePlan: profilePlanSchema,
21
+ files: z.array(agentProfileActivationFileEvidenceSchema),
22
+ digest: sha256DigestSchema,
23
+ });
24
+ }
@@ -0,0 +1,34 @@
1
+ import type { AgentProfile } from "./agent-profile.js";
2
+ /**
3
+ * The 29 canonical AgentProfile leaves that can affect one execution.
4
+ *
5
+ * Compound parents such as `model`, `prompt`, and `resources` are deliberately
6
+ * absent. A producer must report the exact requested leaf instead of claiming
7
+ * a parent while silently dropping one of its children.
8
+ */
9
+ export declare const AGENT_PROFILE_MATERIALIZATION_AXES: readonly ["name", "description", "version", "tags", "systemPrompt", "instructions", "modelDefault", "modelSmall", "modelProvider", "modelReasoningEffort", "modelMetadata", "harness", "permissions", "tools", "mcp", "connections", "subagents", "files", "resourceTools", "skills", "resourceAgents", "commands", "resourceInstructions", "resourceFailOnError", "hooks", "modes", "confidential", "metadata", "extensions"];
10
+ /** One exact leaf of the public AgentProfile contract. */
11
+ export type AgentProfileMaterializationAxis = (typeof AGENT_PROFILE_MATERIALIZATION_AXES)[number];
12
+ /** Compatibility name used by runtimes that distinguish canonical axes. */
13
+ export type CanonicalAgentProfileMaterializationAxis = AgentProfileMaterializationAxis;
14
+ /** One requested profile leaf and its canonical RFC 6901 JSON Pointer. */
15
+ export interface AgentProfileMaterializationRequest {
16
+ axis: AgentProfileMaterializationAxis;
17
+ path: string;
18
+ }
19
+ /**
20
+ * Return every canonical profile leaf that contains a meaningful request.
21
+ * Every explicit value is a request, including empty strings, empty
22
+ * collections, `null`, `false`, and `0`. Only an absent/undefined leaf is
23
+ * omitted.
24
+ */
25
+ export declare function profileMaterializationAxes(profile: AgentProfile): readonly AgentProfileMaterializationAxis[];
26
+ /**
27
+ * Expand requested axes into exact JSON Pointer paths.
28
+ *
29
+ * Compound maps and arrays produce one row per explicit scalar leaf. An empty
30
+ * compound value produces its axis-root path. This prevents an executor from
31
+ * acknowledging one tool, server, resource, or instruction while claiming the
32
+ * whole axis, without losing an explicit request to clear that axis.
33
+ */
34
+ export declare function profileMaterializationRequests(profile: AgentProfile): readonly AgentProfileMaterializationRequest[];
@@ -0,0 +1,243 @@
1
+ /**
2
+ * The 29 canonical AgentProfile leaves that can affect one execution.
3
+ *
4
+ * Compound parents such as `model`, `prompt`, and `resources` are deliberately
5
+ * absent. A producer must report the exact requested leaf instead of claiming
6
+ * a parent while silently dropping one of its children.
7
+ */
8
+ export const AGENT_PROFILE_MATERIALIZATION_AXES = [
9
+ "name",
10
+ "description",
11
+ "version",
12
+ "tags",
13
+ "systemPrompt",
14
+ "instructions",
15
+ "modelDefault",
16
+ "modelSmall",
17
+ "modelProvider",
18
+ "modelReasoningEffort",
19
+ "modelMetadata",
20
+ "harness",
21
+ "permissions",
22
+ "tools",
23
+ "mcp",
24
+ "connections",
25
+ "subagents",
26
+ "files",
27
+ "resourceTools",
28
+ "skills",
29
+ "resourceAgents",
30
+ "commands",
31
+ "resourceInstructions",
32
+ "resourceFailOnError",
33
+ "hooks",
34
+ "modes",
35
+ "confidential",
36
+ "metadata",
37
+ "extensions",
38
+ ];
39
+ const profileProperties = [
40
+ "prompt",
41
+ "model",
42
+ "harness",
43
+ "permissions",
44
+ "tools",
45
+ "mcp",
46
+ "connections",
47
+ "subagents",
48
+ "resources",
49
+ "hooks",
50
+ "modes",
51
+ "confidential",
52
+ "metadata",
53
+ "extensions",
54
+ ];
55
+ const profilePropertiesAreExhaustive = true;
56
+ void profilePropertiesAreExhaustive;
57
+ const AXIS_DESCRIPTORS = [
58
+ { axis: "name", rootPath: "/name", value: (profile) => profile.name },
59
+ {
60
+ axis: "description",
61
+ rootPath: "/description",
62
+ value: (profile) => profile.description,
63
+ },
64
+ { axis: "version", rootPath: "/version", value: (profile) => profile.version },
65
+ { axis: "tags", rootPath: "/tags", value: (profile) => profile.tags },
66
+ {
67
+ axis: "systemPrompt",
68
+ rootPath: "/prompt/systemPrompt",
69
+ value: (profile) => profile.prompt?.systemPrompt,
70
+ },
71
+ {
72
+ axis: "instructions",
73
+ rootPath: "/prompt/instructions",
74
+ value: (profile) => profile.prompt?.instructions,
75
+ },
76
+ {
77
+ axis: "modelDefault",
78
+ rootPath: "/model/default",
79
+ value: (profile) => profile.model?.default,
80
+ },
81
+ {
82
+ axis: "modelSmall",
83
+ rootPath: "/model/small",
84
+ value: (profile) => profile.model?.small,
85
+ },
86
+ {
87
+ axis: "modelProvider",
88
+ rootPath: "/model/provider",
89
+ value: (profile) => profile.model?.provider,
90
+ },
91
+ {
92
+ axis: "modelReasoningEffort",
93
+ rootPath: "/model/reasoningEffort",
94
+ value: (profile) => profile.model?.reasoningEffort,
95
+ },
96
+ {
97
+ axis: "modelMetadata",
98
+ rootPath: "/model/metadata",
99
+ value: (profile) => profile.model?.metadata,
100
+ },
101
+ { axis: "harness", rootPath: "/harness", value: (profile) => profile.harness },
102
+ {
103
+ axis: "permissions",
104
+ rootPath: "/permissions",
105
+ value: (profile) => profile.permissions,
106
+ },
107
+ { axis: "tools", rootPath: "/tools", value: (profile) => profile.tools },
108
+ { axis: "mcp", rootPath: "/mcp", value: (profile) => profile.mcp },
109
+ {
110
+ axis: "connections",
111
+ rootPath: "/connections",
112
+ value: (profile) => profile.connections,
113
+ },
114
+ {
115
+ axis: "subagents",
116
+ rootPath: "/subagents",
117
+ value: (profile) => profile.subagents,
118
+ },
119
+ {
120
+ axis: "files",
121
+ rootPath: "/resources/files",
122
+ value: (profile) => profile.resources?.files,
123
+ },
124
+ {
125
+ axis: "resourceTools",
126
+ rootPath: "/resources/tools",
127
+ value: (profile) => profile.resources?.tools,
128
+ },
129
+ {
130
+ axis: "skills",
131
+ rootPath: "/resources/skills",
132
+ value: (profile) => profile.resources?.skills,
133
+ },
134
+ {
135
+ axis: "resourceAgents",
136
+ rootPath: "/resources/agents",
137
+ value: (profile) => profile.resources?.agents,
138
+ },
139
+ {
140
+ axis: "commands",
141
+ rootPath: "/resources/commands",
142
+ value: (profile) => profile.resources?.commands,
143
+ },
144
+ {
145
+ axis: "resourceInstructions",
146
+ rootPath: "/resources/instructions",
147
+ value: (profile) => profile.resources?.instructions,
148
+ },
149
+ {
150
+ axis: "resourceFailOnError",
151
+ rootPath: "/resources/failOnError",
152
+ value: (profile) => profile.resources?.failOnError,
153
+ },
154
+ { axis: "hooks", rootPath: "/hooks", value: (profile) => profile.hooks },
155
+ { axis: "modes", rootPath: "/modes", value: (profile) => profile.modes },
156
+ {
157
+ axis: "confidential",
158
+ rootPath: "/confidential",
159
+ value: (profile) => profile.confidential,
160
+ },
161
+ {
162
+ axis: "metadata",
163
+ rootPath: "/metadata",
164
+ value: (profile) => profile.metadata,
165
+ },
166
+ {
167
+ axis: "extensions",
168
+ rootPath: "/extensions",
169
+ value: (profile) => profile.extensions,
170
+ },
171
+ ];
172
+ const axisDescriptorsAreExhaustive = true;
173
+ void axisDescriptorsAreExhaustive;
174
+ /**
175
+ * Return every canonical profile leaf that contains a meaningful request.
176
+ * Every explicit value is a request, including empty strings, empty
177
+ * collections, `null`, `false`, and `0`. Only an absent/undefined leaf is
178
+ * omitted.
179
+ */
180
+ export function profileMaterializationAxes(profile) {
181
+ const axes = [];
182
+ for (const descriptor of AXIS_DESCRIPTORS) {
183
+ if (descriptor.value(profile) !== undefined) {
184
+ axes.push(descriptor.axis);
185
+ }
186
+ }
187
+ return axes;
188
+ }
189
+ /**
190
+ * Expand requested axes into exact JSON Pointer paths.
191
+ *
192
+ * Compound maps and arrays produce one row per explicit scalar leaf. An empty
193
+ * compound value produces its axis-root path. This prevents an executor from
194
+ * acknowledging one tool, server, resource, or instruction while claiming the
195
+ * whole axis, without losing an explicit request to clear that axis.
196
+ */
197
+ export function profileMaterializationRequests(profile) {
198
+ const requests = [];
199
+ for (const descriptor of AXIS_DESCRIPTORS) {
200
+ const paths = materializationValuePaths(descriptor.value(profile), descriptor.rootPath);
201
+ for (const path of paths) {
202
+ requests.push({ axis: descriptor.axis, path });
203
+ }
204
+ }
205
+ return requests;
206
+ }
207
+ function materializationValuePaths(root, rootPath) {
208
+ const paths = [];
209
+ visitMaterializationValue(root, rootPath, [], paths);
210
+ return paths;
211
+ }
212
+ function visitMaterializationValue(value, path, ancestors, paths) {
213
+ if (value === undefined)
214
+ return false;
215
+ if (value === null || typeof value !== "object") {
216
+ paths.push(path);
217
+ return true;
218
+ }
219
+ if (ancestors.includes(value)) {
220
+ paths.push(path);
221
+ return true;
222
+ }
223
+ const nextAncestors = [...ancestors, value];
224
+ const entries = Array.isArray(value)
225
+ ? Array.from({ length: value.length }, (_, index) => [
226
+ String(index),
227
+ Object.prototype.hasOwnProperty.call(value, index)
228
+ ? value[index]
229
+ : undefined,
230
+ ])
231
+ : Object.entries(value).sort(([left], [right]) => left < right ? -1 : left > right ? 1 : 0);
232
+ let childRequested = false;
233
+ for (const [key, child] of entries) {
234
+ childRequested =
235
+ visitMaterializationValue(child, `${path}/${escapeJsonPointerSegment(key)}`, nextAncestors, paths) || childRequested;
236
+ }
237
+ if (!childRequested)
238
+ paths.push(path);
239
+ return true;
240
+ }
241
+ function escapeJsonPointerSegment(value) {
242
+ return value.replace(/~/g, "~0").replace(/\//g, "~1");
243
+ }
@@ -3,8 +3,13 @@
3
3
  *
4
4
  * These model portable agent intent at the application boundary. Individual
5
5
  * backends translate this shape into their own native profile/configuration
6
- * formats internally. This package is the canonical public home for these
7
- * symbols.
6
+ * formats internally. Profile content participates in unsalted public identity.
7
+ * Prompts, resources, metadata, commands, paths, and secret-reference keys are
8
+ * caller-declared public data; recognizable credential patterns are refused as
9
+ * defense in depth, not as proof that arbitrary text is non-secret. MCP and hook
10
+ * secret-capable fields structurally require tagged public values or opaque
11
+ * secret references, which a private executor resolves only after identity is
12
+ * fixed. This package is the canonical public home for these symbols.
8
13
  */
9
14
  import type { HarnessType } from "./harness.js";
10
15
  /**
@@ -96,7 +101,8 @@ export interface AgentProfileResources {
96
101
  * A backend without a matching native tier may clamp down to its strongest supported level, but it
97
102
  * must never turn reasoning on for `none` or silently increase a requested effort.
98
103
  */
99
- export type ReasoningEffort = "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "ultracode";
104
+ export declare const REASONING_EFFORTS: readonly ["none", "minimal", "low", "medium", "high", "xhigh", "ultracode"];
105
+ export type ReasoningEffort = (typeof REASONING_EFFORTS)[number];
100
106
  /**
101
107
  * Model selection hints for backends.
102
108
  */
@@ -136,6 +142,37 @@ export interface AgentProfilePrompt {
136
142
  */
137
143
  instructions?: string[];
138
144
  }
145
+ /** Deliberately public configuration included in profile identity. */
146
+ export interface AgentProfilePublicConfigValue {
147
+ kind: "public";
148
+ value: string;
149
+ }
150
+ /**
151
+ * Opaque reference resolved only inside the private prepared executor.
152
+ * `key` is caller-declared public identity naming provider/operator-owned
153
+ * secret material; callers must not put the secret value in it.
154
+ */
155
+ export interface AgentProfileSecretRef {
156
+ kind: "secret-ref";
157
+ key: string;
158
+ /** Apply no decoration or a `Bearer ` prefix after private resolution. */
159
+ format?: "raw" | "bearer";
160
+ }
161
+ /** A configuration value is public bytes or an opaque secret identity. */
162
+ export type AgentProfileConfigValue = AgentProfilePublicConfigValue | AgentProfileSecretRef;
163
+ /**
164
+ * Private executor port for resolving one public secret-reference identity.
165
+ * Implementations return the raw undecorated value. Consumers must fail
166
+ * preparation on missing or blank values and must keep resolved values out of
167
+ * profiles, public plans, digests, receipts, diagnostics, and logs.
168
+ */
169
+ export interface AgentProfileSecretProvider {
170
+ get(key: string): Promise<string | undefined>;
171
+ }
172
+ /** Mark an exact configuration value as public profile material. */
173
+ export declare function defineAgentProfilePublicConfig(value: string): AgentProfilePublicConfigValue;
174
+ /** Create a secret reference whose key is caller-declared public identity. */
175
+ export declare function defineAgentProfileSecretRef(key: string, format?: AgentProfileSecretRef["format"]): AgentProfileSecretRef;
139
176
  /**
140
177
  * Generic subagent definition.
141
178
  */
@@ -153,7 +190,7 @@ export interface AgentProfileHookCommand {
153
190
  timeoutMs?: number;
154
191
  blocking?: boolean;
155
192
  matcher?: string;
156
- env?: Record<string, string>;
193
+ env?: Record<string, AgentProfileConfigValue>;
157
194
  }
158
195
  export interface AgentProfileMode {
159
196
  description?: string;
@@ -198,8 +235,8 @@ interface AgentProfileLocalMcpServer extends AgentProfileMcpServerBase {
198
235
  enabled?: true;
199
236
  transport?: "stdio";
200
237
  command: string;
201
- args?: string[];
202
- env?: Record<string, string>;
238
+ args?: AgentProfileConfigValue[];
239
+ env?: Record<string, AgentProfileConfigValue>;
203
240
  cwd?: string;
204
241
  url?: never;
205
242
  headers?: never;
@@ -212,7 +249,7 @@ interface AgentProfileRemoteMcpServer extends AgentProfileMcpServerBase {
212
249
  env?: never;
213
250
  cwd?: never;
214
251
  url: string;
215
- headers?: Record<string, string>;
252
+ headers?: Record<string, AgentProfileConfigValue>;
216
253
  }
217
254
  interface AgentProfileDisabledMcpServer extends AgentProfileMcpServerBase {
218
255
  enabled: false;
@@ -3,8 +3,13 @@
3
3
  *
4
4
  * These model portable agent intent at the application boundary. Individual
5
5
  * backends translate this shape into their own native profile/configuration
6
- * formats internally. This package is the canonical public home for these
7
- * symbols.
6
+ * formats internally. Profile content participates in unsalted public identity.
7
+ * Prompts, resources, metadata, commands, paths, and secret-reference keys are
8
+ * caller-declared public data; recognizable credential patterns are refused as
9
+ * defense in depth, not as proof that arbitrary text is non-secret. MCP and hook
10
+ * secret-capable fields structurally require tagged public values or opaque
11
+ * secret references, which a private executor resolves only after identity is
12
+ * fixed. This package is the canonical public home for these symbols.
8
13
  */
9
14
  /**
10
15
  * Helper for creating typed inline resource refs.
@@ -24,6 +29,38 @@ export function defineGitHubResource(path, options = {}) {
24
29
  name: options.name,
25
30
  };
26
31
  }
32
+ /**
33
+ * Portable reasoning/thinking effort. Backends map it to their native control at materialization:
34
+ * codex `model_reasoning_effort`, kimi `--thinking`/`--no-thinking`, claude thinking budget.
35
+ * Ordered low→high:
36
+ * - `none` — extended thinking OFF (no reasoning budget at all)
37
+ * - `minimal` — thinking ON, the lowest budget (distinct from `none`)
38
+ * - `low` / `medium` / `high` / `xhigh`
39
+ * - `ultracode` — maximum (Claude Code's `max` and Codex's `ultra` reconcile here).
40
+ * A backend without a matching native tier may clamp down to its strongest supported level, but it
41
+ * must never turn reasoning on for `none` or silently increase a requested effort.
42
+ */
43
+ export const REASONING_EFFORTS = Object.freeze([
44
+ "none",
45
+ "minimal",
46
+ "low",
47
+ "medium",
48
+ "high",
49
+ "xhigh",
50
+ "ultracode",
51
+ ]);
52
+ /** Mark an exact configuration value as public profile material. */
53
+ export function defineAgentProfilePublicConfig(value) {
54
+ return { kind: "public", value };
55
+ }
56
+ /** Create a secret reference whose key is caller-declared public identity. */
57
+ export function defineAgentProfileSecretRef(key, format) {
58
+ return {
59
+ kind: "secret-ref",
60
+ key,
61
+ ...(format === undefined ? {} : { format }),
62
+ };
63
+ }
27
64
  /**
28
65
  * Helper for declaring typed profiles in application code.
29
66
  */
@@ -0,0 +1,138 @@
1
+ import { z } from "zod";
2
+ import type { Sha256Digest } from "./agent-candidate.js";
3
+ export declare const AGENT_WORKSPACE_LEASE_PHASES: readonly ["copy-ready", "workspace-sealed", "execution-bound", "destroying", "cleanup-failed", "destroyed"];
4
+ 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
+ /** Public allocation identity. `root` locates bytes; it grants no authority. */
17
+ export interface AgentWorkspaceAllocationIdentity {
18
+ provider: string;
19
+ root: string;
20
+ /** Digest of the provider, lease/allocation identity, and canonical root. */
21
+ identityDigest: Sha256Digest;
22
+ }
23
+ interface AgentWorkspaceLeaseRecordBase {
24
+ kind: "agent-workspace-lease";
25
+ schemaVersion: 1;
26
+ leaseId: string;
27
+ ownerId: string;
28
+ workspace: AgentWorkspaceAllocationIdentity;
29
+ isolation: "per-run" | "shared";
30
+ sourceSnapshotDigest: Sha256Digest;
31
+ /** Governs both the source and prepared workspace digest interpretation. */
32
+ sourceSnapshotPolicy: AgentWorkspaceSourceSnapshotPolicy;
33
+ createdAtMs: number;
34
+ updatedAtMs: number;
35
+ expiresAtMs: number;
36
+ }
37
+ interface AgentWorkspaceUnpreparedEvidence {
38
+ preparedWorkspaceDigest?: never;
39
+ profileActivationDigest?: never;
40
+ executionPreparationDigest?: never;
41
+ }
42
+ interface AgentWorkspaceSealedEvidence {
43
+ preparedWorkspaceDigest: Sha256Digest;
44
+ profileActivationDigest: Sha256Digest;
45
+ executionPreparationDigest?: never;
46
+ }
47
+ interface AgentWorkspaceExecutionBoundEvidence {
48
+ preparedWorkspaceDigest: Sha256Digest;
49
+ profileActivationDigest: Sha256Digest;
50
+ executionPreparationDigest: Sha256Digest;
51
+ }
52
+ export type AgentWorkspaceCopyReadyLeaseRecordMaterial = AgentWorkspaceLeaseRecordBase & AgentWorkspaceUnpreparedEvidence & {
53
+ phase: "copy-ready";
54
+ cleanupAttempts: 0;
55
+ cleanupError?: never;
56
+ };
57
+ export type AgentWorkspaceSealedLeaseRecordMaterial = AgentWorkspaceLeaseRecordBase & AgentWorkspaceSealedEvidence & {
58
+ phase: "workspace-sealed";
59
+ cleanupAttempts: 0;
60
+ cleanupError?: never;
61
+ };
62
+ export type AgentWorkspaceExecutionBoundLeaseRecordMaterial = AgentWorkspaceLeaseRecordBase & AgentWorkspaceExecutionBoundEvidence & {
63
+ phase: "execution-bound";
64
+ cleanupAttempts: 0;
65
+ cleanupError?: never;
66
+ };
67
+ type AgentWorkspaceCleanupEvidence = AgentWorkspaceUnpreparedEvidence | AgentWorkspaceSealedEvidence | AgentWorkspaceExecutionBoundEvidence;
68
+ export type AgentWorkspaceDestroyingLeaseRecordMaterial = AgentWorkspaceLeaseRecordBase & AgentWorkspaceCleanupEvidence & {
69
+ phase: "destroying";
70
+ cleanupAttempts: number;
71
+ cleanupError?: never;
72
+ };
73
+ export type AgentWorkspaceCleanupFailedLeaseRecordMaterial = AgentWorkspaceLeaseRecordBase & AgentWorkspaceCleanupEvidence & {
74
+ phase: "cleanup-failed";
75
+ cleanupAttempts: number;
76
+ /** Sanitized public diagnostic; providers remain responsible for redaction. */
77
+ cleanupError: string;
78
+ };
79
+ export type AgentWorkspaceDestroyedLeaseRecordMaterial = AgentWorkspaceLeaseRecordBase & AgentWorkspaceCleanupEvidence & {
80
+ phase: "destroyed";
81
+ cleanupAttempts: number;
82
+ cleanupError?: never;
83
+ };
84
+ export type AgentWorkspaceLeaseRecordMaterial = AgentWorkspaceCopyReadyLeaseRecordMaterial | AgentWorkspaceSealedLeaseRecordMaterial | AgentWorkspaceExecutionBoundLeaseRecordMaterial | AgentWorkspaceDestroyingLeaseRecordMaterial | AgentWorkspaceCleanupFailedLeaseRecordMaterial | AgentWorkspaceDestroyedLeaseRecordMaterial;
85
+ type WithDigest<Material> = Material extends unknown ? Material & {
86
+ digest: Sha256Digest;
87
+ } : never;
88
+ /** Self-hashed public projection. Private authorization and durable state stay out. */
89
+ export type AgentWorkspaceLeaseRecord = WithDigest<AgentWorkspaceLeaseRecordMaterial>;
90
+ export type AgentWorkspaceCopyReadyLeaseRecord = WithDigest<AgentWorkspaceCopyReadyLeaseRecordMaterial>;
91
+ export type AgentWorkspaceSealedLeaseRecord = WithDigest<AgentWorkspaceSealedLeaseRecordMaterial>;
92
+ export type AgentWorkspaceExecutionBoundLeaseRecord = WithDigest<AgentWorkspaceExecutionBoundLeaseRecordMaterial>;
93
+ export type AgentWorkspaceDestroyingLeaseRecord = WithDigest<AgentWorkspaceDestroyingLeaseRecordMaterial>;
94
+ export type AgentWorkspaceCleanupFailedLeaseRecord = WithDigest<AgentWorkspaceCleanupFailedLeaseRecordMaterial>;
95
+ export type AgentWorkspaceDestroyedLeaseRecord = WithDigest<AgentWorkspaceDestroyedLeaseRecordMaterial>;
96
+ /**
97
+ * Request-only owner capability. Providers persist at most a one-way digest;
98
+ * this value never belongs in a public lease or execution receipt.
99
+ */
100
+ export interface AgentWorkspaceLeaseAuthorization {
101
+ leaseId: string;
102
+ ownerToken: string;
103
+ }
104
+ export interface AgentWorkspaceSealRequest extends AgentWorkspaceLeaseAuthorization {
105
+ profileActivationDigest: Sha256Digest;
106
+ }
107
+ export interface AgentWorkspaceExecutionBindingRequest extends AgentWorkspaceLeaseAuthorization {
108
+ executionPreparationDigest: Sha256Digest;
109
+ }
110
+ export interface AgentWorkspaceLeaseRenewalRequest extends AgentWorkspaceLeaseAuthorization {
111
+ expiresAtMs: number;
112
+ }
113
+ export declare const agentWorkspaceLeasePhaseSchema: z.ZodEnum<{
114
+ "copy-ready": "copy-ready";
115
+ "workspace-sealed": "workspace-sealed";
116
+ "execution-bound": "execution-bound";
117
+ destroying: "destroying";
118
+ "cleanup-failed": "cleanup-failed";
119
+ destroyed: "destroyed";
120
+ }>;
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
+ export declare const agentWorkspaceAllocationIdentitySchema: z.ZodObject<{
128
+ provider: z.ZodString;
129
+ root: z.ZodString;
130
+ identityDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
131
+ }, z.core.$strict>;
132
+ export declare const agentWorkspaceLeaseRecordMaterialSchema: z.ZodType<AgentWorkspaceLeaseRecordMaterial>;
133
+ export declare const agentWorkspaceLeaseRecordSchema: z.ZodType<AgentWorkspaceLeaseRecord>;
134
+ /** Canonical public identity; private token/state fields cannot enter its schema. */
135
+ export declare function canonicalAgentWorkspaceLeaseRecordDigest(material: AgentWorkspaceLeaseRecordMaterial): Sha256Digest;
136
+ /** Build and self-hash one phase-valid public workspace lease record. */
137
+ export declare function buildAgentWorkspaceLeaseRecord<Material extends AgentWorkspaceLeaseRecordMaterial>(material: Material): WithDigest<Material>;
138
+ export {};