@tangle-network/agent-interface 0.36.0 → 0.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/README.md +2 -2
  2. package/dist/agent-candidate-artifact-schema.d.ts +504 -0
  3. package/dist/agent-candidate-artifact-schema.js +16 -1
  4. package/dist/agent-candidate-execution-plan-schema.d.ts +50 -27
  5. package/dist/agent-candidate-execution-plan-schema.js +4 -16
  6. package/dist/agent-candidate-profile-schema.d.ts +341 -25
  7. package/dist/agent-candidate-promotion-schema.d.ts +2320 -287
  8. package/dist/agent-candidate-receipt-schema.d.ts +50 -27
  9. package/dist/agent-candidate-schema-common.js +1 -1
  10. package/dist/agent-candidate-schema.d.ts +341 -25
  11. package/dist/agent-candidate.d.ts +7 -8
  12. package/dist/agent-execution-preparation.d.ts +366 -0
  13. package/dist/agent-execution-preparation.js +793 -0
  14. package/dist/agent-improvement-source.d.ts +61 -3
  15. package/dist/agent-improvement-source.js +122 -8
  16. package/dist/agent-profile-activation.d.ts +41 -0
  17. package/dist/agent-profile-activation.js +24 -0
  18. package/dist/agent-profile-improvement-schema.d.ts +48 -4
  19. package/dist/agent-profile-materialization.d.ts +34 -0
  20. package/dist/agent-profile-materialization.js +243 -0
  21. package/dist/agent-profile.d.ts +44 -7
  22. package/dist/agent-profile.js +39 -2
  23. package/dist/agent-workspace-lease.d.ts +138 -0
  24. package/dist/agent-workspace-lease.js +203 -0
  25. package/dist/harness-capabilities.d.ts +1 -1
  26. package/dist/harness-capabilities.js +2 -9
  27. package/dist/index.d.ts +4 -0
  28. package/dist/index.js +4 -0
  29. package/dist/profile-schema.d.ts +142 -84
  30. package/dist/profile-schema.js +152 -41
  31. package/package.json +3 -1
@@ -0,0 +1,366 @@
1
+ import { z } from "zod";
2
+ import type { Sha256Digest } from "./agent-candidate.js";
3
+ import { type AgentProfile, type ReasoningEffort } from "./agent-profile.js";
4
+ import type { AgentProfileActivationEvidence } from "./agent-profile-activation.js";
5
+ import { type AgentProfileMaterializationAxis } from "./agent-profile-materialization.js";
6
+ import { type HarnessType } from "./harness.js";
7
+ import { type AgentWorkspaceExecutionBoundLeaseRecord, type AgentWorkspaceSealedLeaseRecord, type AgentWorkspaceSourceSnapshotPolicy } from "./agent-workspace-lease.js";
8
+ export type AgentExecutionPreparationDisposition = "behavior" | "control" | "overridden" | "unsupported";
9
+ export type AgentExecutionPreparationOwner = "runtime" | "executor";
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
+ authoredProfileDigest: Sha256Digest;
85
+ effectiveProfileDigest: Sha256Digest;
86
+ backend: string;
87
+ harness: HarnessType;
88
+ harnessVersion: string;
89
+ resolvedModel: AgentExecutionPreparationResolvedModel;
90
+ workspace: AgentExecutionPreparationWorkspace;
91
+ axisResults: AgentExecutionPreparationAxisResult[];
92
+ /** Caller-supplied digest of public decisions and secret-reference identities. */
93
+ executionPlanDigest: Sha256Digest;
94
+ materializer: AgentExecutionPreparationMaterializer;
95
+ expiresAtMs: number;
96
+ digest: Sha256Digest;
97
+ }
98
+ export interface BuildAgentExecutionPreparationReceiptInput {
99
+ preparationId: string;
100
+ requestDigest: Sha256Digest;
101
+ authoredProfile: AgentProfile;
102
+ effectiveProfile: AgentProfile;
103
+ backend: string;
104
+ harness: HarnessType;
105
+ harnessVersion: string;
106
+ resolvedModel: AgentExecutionPreparationResolvedModel;
107
+ /** Exact sealed public lease projection; owner authorization remains private. */
108
+ workspaceLease: AgentWorkspaceSealedLeaseRecord;
109
+ profileActivation: Pick<AgentProfileActivationEvidence, "digest">;
110
+ axisResults: readonly AgentExecutionPreparationAxisResult[];
111
+ /** Must digest public decisions and reference identities, not resolved values. */
112
+ executionPlanDigest: Sha256Digest;
113
+ materializer: AgentExecutionPreparationMaterializer;
114
+ expiresAtMs: number;
115
+ /** Clock used only to refuse already-expired preparations. */
116
+ nowMs?: number;
117
+ }
118
+ export interface ValidateAgentExecutionPreparationReceiptOptions {
119
+ receipt: unknown;
120
+ requestDigest: Sha256Digest;
121
+ authoredProfile: AgentProfile;
122
+ effectiveProfile: AgentProfile;
123
+ /** Expected public-plan identity; callers must not derive it from secret values. */
124
+ executionPlanDigest: Sha256Digest;
125
+ profileActivation: Pick<AgentProfileActivationEvidence, "digest">;
126
+ /** Bound lease closes the receipt→workspace link before compute begins. */
127
+ workspaceLease: AgentWorkspaceExecutionBoundLeaseRecord;
128
+ nowMs?: number;
129
+ preparationId?: string;
130
+ backend?: string;
131
+ harness?: HarnessType;
132
+ harnessVersion?: string;
133
+ }
134
+ export type AgentExecutionPreparationValidationIssueCode = "invalid-receipt" | "invalid-profile" | "invalid-workspace-lease" | "workspace-not-execution-bound" | "execution-binding-mismatch" | "digest-mismatch" | "expectation-mismatch" | "expired" | "missing-coverage" | "ambiguous-coverage" | "duplicate-coverage" | "conflicting-coverage" | "unrequested-coverage" | "invalid-disposition" | "strict-unsupported" | "model-fidelity";
135
+ export interface AgentExecutionPreparationValidationIssue {
136
+ code: AgentExecutionPreparationValidationIssueCode;
137
+ message: string;
138
+ axis?: AgentProfileMaterializationAxis;
139
+ path?: string;
140
+ }
141
+ export type AgentExecutionPreparationValidationResult = {
142
+ ok: true;
143
+ receipt: AgentExecutionPreparationReceipt;
144
+ issues: [];
145
+ } | {
146
+ ok: false;
147
+ issues: AgentExecutionPreparationValidationIssue[];
148
+ };
149
+ export declare const agentExecutionPreparationAxisResultSchema: z.ZodObject<{
150
+ axis: z.ZodEnum<{
151
+ permissions: "permissions";
152
+ tools: "tools";
153
+ mcp: "mcp";
154
+ connections: "connections";
155
+ subagents: "subagents";
156
+ hooks: "hooks";
157
+ modes: "modes";
158
+ metadata: "metadata";
159
+ description: "description";
160
+ name: "name";
161
+ files: "files";
162
+ version: "version";
163
+ tags: "tags";
164
+ harness: "harness";
165
+ confidential: "confidential";
166
+ extensions: "extensions";
167
+ instructions: "instructions";
168
+ skills: "skills";
169
+ commands: "commands";
170
+ systemPrompt: "systemPrompt";
171
+ modelDefault: "modelDefault";
172
+ modelSmall: "modelSmall";
173
+ modelProvider: "modelProvider";
174
+ modelReasoningEffort: "modelReasoningEffort";
175
+ modelMetadata: "modelMetadata";
176
+ resourceTools: "resourceTools";
177
+ resourceAgents: "resourceAgents";
178
+ resourceInstructions: "resourceInstructions";
179
+ resourceFailOnError: "resourceFailOnError";
180
+ }>;
181
+ disposition: z.ZodEnum<{
182
+ unsupported: "unsupported";
183
+ behavior: "behavior";
184
+ control: "control";
185
+ overridden: "overridden";
186
+ }>;
187
+ owner: z.ZodEnum<{
188
+ runtime: "runtime";
189
+ executor: "executor";
190
+ }>;
191
+ mechanism: z.ZodString;
192
+ evidenceDigest: z.ZodOptional<z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>>;
193
+ path: z.ZodOptional<z.ZodString>;
194
+ reason: z.ZodOptional<z.ZodString>;
195
+ }, z.core.$strict>;
196
+ export declare const agentExecutionPreparationReasoningEffortSchema: z.ZodObject<{
197
+ requested: z.ZodEnum<{
198
+ none: "none";
199
+ minimal: "minimal";
200
+ low: "low";
201
+ medium: "medium";
202
+ high: "high";
203
+ xhigh: "xhigh";
204
+ ultracode: "ultracode";
205
+ }>;
206
+ resolved: z.ZodOptional<z.ZodEnum<{
207
+ none: "none";
208
+ minimal: "minimal";
209
+ low: "low";
210
+ medium: "medium";
211
+ high: "high";
212
+ xhigh: "xhigh";
213
+ ultracode: "ultracode";
214
+ }>>;
215
+ fidelity: z.ZodEnum<{
216
+ exact: "exact";
217
+ unsupported: "unsupported";
218
+ clamped: "clamped";
219
+ }>;
220
+ }, z.core.$strict>;
221
+ export declare const agentExecutionPreparationReceiptSchema: z.ZodObject<{
222
+ kind: z.ZodLiteral<"agent-execution-preparation">;
223
+ schemaVersion: z.ZodLiteral<1>;
224
+ preparationId: z.ZodString;
225
+ requestDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
226
+ authoredProfileDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
227
+ effectiveProfileDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
228
+ backend: z.ZodString;
229
+ harness: z.ZodEnum<{
230
+ "claude-code": "claude-code";
231
+ nanoclaw: "nanoclaw";
232
+ codex: "codex";
233
+ opencode: "opencode";
234
+ "kimi-code": "kimi-code";
235
+ pi: "pi";
236
+ gemini: "gemini";
237
+ hermes: "hermes";
238
+ openclaw: "openclaw";
239
+ amp: "amp";
240
+ "factory-droids": "factory-droids";
241
+ acp: "acp";
242
+ "cli-base": "cli-base";
243
+ }>;
244
+ harnessVersion: z.ZodString;
245
+ resolvedModel: z.ZodObject<{
246
+ requested: z.ZodString;
247
+ resolved: z.ZodString;
248
+ provider: z.ZodOptional<z.ZodString>;
249
+ reasoningEffort: z.ZodOptional<z.ZodObject<{
250
+ requested: z.ZodEnum<{
251
+ none: "none";
252
+ minimal: "minimal";
253
+ low: "low";
254
+ medium: "medium";
255
+ high: "high";
256
+ xhigh: "xhigh";
257
+ ultracode: "ultracode";
258
+ }>;
259
+ resolved: z.ZodOptional<z.ZodEnum<{
260
+ none: "none";
261
+ minimal: "minimal";
262
+ low: "low";
263
+ medium: "medium";
264
+ high: "high";
265
+ xhigh: "xhigh";
266
+ ultracode: "ultracode";
267
+ }>>;
268
+ fidelity: z.ZodEnum<{
269
+ exact: "exact";
270
+ unsupported: "unsupported";
271
+ clamped: "clamped";
272
+ }>;
273
+ }, z.core.$strict>>;
274
+ }, z.core.$strict>;
275
+ workspace: z.ZodObject<{
276
+ leaseId: z.ZodString;
277
+ provider: z.ZodString;
278
+ identityDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
279
+ isolation: z.ZodEnum<{
280
+ "per-run": "per-run";
281
+ shared: "shared";
282
+ }>;
283
+ sourceSnapshotDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
284
+ sourceSnapshotPolicy: z.ZodObject<{
285
+ kind: z.ZodLiteral<"provider-declared">;
286
+ name: z.ZodString;
287
+ version: z.ZodNumber;
288
+ digest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
289
+ }, z.core.$strict>;
290
+ preparedWorkspaceDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
291
+ profileActivationDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
292
+ }, z.core.$strict>;
293
+ axisResults: z.ZodArray<z.ZodObject<{
294
+ axis: z.ZodEnum<{
295
+ permissions: "permissions";
296
+ tools: "tools";
297
+ mcp: "mcp";
298
+ connections: "connections";
299
+ subagents: "subagents";
300
+ hooks: "hooks";
301
+ modes: "modes";
302
+ metadata: "metadata";
303
+ description: "description";
304
+ name: "name";
305
+ files: "files";
306
+ version: "version";
307
+ tags: "tags";
308
+ harness: "harness";
309
+ confidential: "confidential";
310
+ extensions: "extensions";
311
+ instructions: "instructions";
312
+ skills: "skills";
313
+ commands: "commands";
314
+ systemPrompt: "systemPrompt";
315
+ modelDefault: "modelDefault";
316
+ modelSmall: "modelSmall";
317
+ modelProvider: "modelProvider";
318
+ modelReasoningEffort: "modelReasoningEffort";
319
+ modelMetadata: "modelMetadata";
320
+ resourceTools: "resourceTools";
321
+ resourceAgents: "resourceAgents";
322
+ resourceInstructions: "resourceInstructions";
323
+ resourceFailOnError: "resourceFailOnError";
324
+ }>;
325
+ disposition: z.ZodEnum<{
326
+ unsupported: "unsupported";
327
+ behavior: "behavior";
328
+ control: "control";
329
+ overridden: "overridden";
330
+ }>;
331
+ owner: z.ZodEnum<{
332
+ runtime: "runtime";
333
+ executor: "executor";
334
+ }>;
335
+ mechanism: z.ZodString;
336
+ evidenceDigest: z.ZodOptional<z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>>;
337
+ path: z.ZodOptional<z.ZodString>;
338
+ reason: z.ZodOptional<z.ZodString>;
339
+ }, z.core.$strict>>;
340
+ executionPlanDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
341
+ materializer: z.ZodObject<{
342
+ name: z.ZodString;
343
+ version: z.ZodString;
344
+ }, z.core.$strict>;
345
+ expiresAtMs: z.ZodNumber;
346
+ digest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
347
+ }, z.core.$strict>;
348
+ /**
349
+ * Canonical RFC 8785/SHA-256 identity for one validated, public AgentProfile.
350
+ * Secret-capable MCP/hook fields are tagged. Other prompt, resource, metadata,
351
+ * and tool text is ordinary public profile data: it may legitimately discuss
352
+ * credentials, security incidents, or examples that resemble credentials, so
353
+ * pattern matching cannot decide whether it is secret. Resolve opaque secret
354
+ * references only after this public identity is fixed.
355
+ */
356
+ export declare function canonicalAgentProfileDigest(profile: AgentProfile): Sha256Digest;
357
+ /** Build, self-hash, and cross-check one pre-compute executor acknowledgement. */
358
+ export declare function buildAgentExecutionPreparationReceipt(input: BuildAgentExecutionPreparationReceiptInput): AgentExecutionPreparationReceipt;
359
+ /** Validate structure, bindings, expiry, model fidelity, and exact path coverage. */
360
+ export declare function validateAgentExecutionPreparationReceipt(options: ValidateAgentExecutionPreparationReceiptOptions): AgentExecutionPreparationValidationResult;
361
+ /** Throw one structured error when a preparation acknowledgement is invalid. */
362
+ export declare function assertAgentExecutionPreparationReceipt(options: ValidateAgentExecutionPreparationReceiptOptions): AgentExecutionPreparationReceipt;
363
+ export declare class AgentExecutionPreparationValidationError extends Error {
364
+ readonly issues: readonly AgentExecutionPreparationValidationIssue[];
365
+ constructor(issues: readonly AgentExecutionPreparationValidationIssue[]);
366
+ }