@tangle-network/agent-interface 2.20.1 → 3.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.
Files changed (58) hide show
  1. package/README.md +18 -23
  2. package/dist/agent-candidate-artifact-schema.d.ts +0 -4
  3. package/dist/agent-candidate-artifact-schema.js +1 -1
  4. package/dist/agent-candidate-execution-plan-schema.d.ts +52 -52
  5. package/dist/agent-candidate-promotion-schema.d.ts +340 -340
  6. package/dist/agent-candidate-receipt-schema.d.ts +68 -68
  7. package/dist/agent-candidate-schema-common.d.ts +0 -5
  8. package/dist/agent-candidate-schema-common.js +0 -27
  9. package/dist/agent-execution-limits.d.ts +0 -18
  10. package/dist/agent-execution-limits.js +0 -21
  11. package/dist/agent-execution-preparation-receipt.d.ts +2 -0
  12. package/dist/agent-execution-preparation.d.ts +2 -22
  13. package/dist/agent-execution-preparation.js +1 -25
  14. package/dist/agent-improvement-measurement-schema.d.ts +0 -17
  15. package/dist/agent-improvement-measurement-schema.js +3 -3
  16. package/dist/agent-improvement-source.d.ts +0 -2
  17. package/dist/agent-profile-materialization.d.ts +1 -1
  18. package/dist/agent-profile-materialization.js +3 -0
  19. package/dist/agent-profile.d.ts +22 -0
  20. package/dist/agent-workspace-lease.d.ts +0 -23
  21. package/dist/agent-workspace-lease.js +0 -4
  22. package/dist/contract-limits.d.ts +0 -3
  23. package/dist/contract-limits.js +0 -10
  24. package/dist/environment-interactive-control.d.ts +10 -0
  25. package/dist/environment-interactive-start.d.ts +28 -2
  26. package/dist/environment-interactive-start.js +1 -1
  27. package/dist/environment-observation.d.ts +0 -17
  28. package/dist/environment-observation.js +0 -13
  29. package/dist/environment-provider.d.ts +2 -1
  30. package/dist/environment-provider.js +2 -1
  31. package/dist/environment-runtime.d.ts +30 -16
  32. package/dist/environment-runtime.js +1 -5
  33. package/dist/index.d.ts +1 -3
  34. package/dist/index.js +1 -3
  35. package/dist/interaction-fields.d.ts +0 -1
  36. package/dist/interaction-response-validation.d.ts +0 -5
  37. package/dist/interaction-response-validation.js +0 -12
  38. package/dist/parts.d.ts +0 -3
  39. package/dist/parts.js +0 -9
  40. package/dist/plan.d.ts +0 -8
  41. package/dist/plan.js +0 -6
  42. package/dist/profile-diff.d.ts +2 -2
  43. package/dist/profile-diff.js +3 -31
  44. package/dist/profile-kb/index.d.ts +1 -22
  45. package/dist/profile-kb/index.js +1 -23
  46. package/dist/profile-schema.d.ts +58 -0
  47. package/dist/profile-schema.js +45 -0
  48. package/dist/runtime-control.d.ts +0 -61
  49. package/dist/runtime-control.js +0 -76
  50. package/dist/workspace-confidentiality.d.ts +0 -2
  51. package/dist/workspace-confidentiality.js +1 -1
  52. package/package.json +1 -11
  53. package/dist/agent-instance.d.ts +0 -98
  54. package/dist/agent-instance.js +0 -105
  55. package/dist/certified-context.d.ts +0 -118
  56. package/dist/certified-context.js +0 -220
  57. package/dist/environment-interactive.d.ts +0 -2
  58. package/dist/environment-interactive.js +0 -2
@@ -4,6 +4,7 @@ const agentProfileDiffPropertyAxes = [
4
4
  "prompt",
5
5
  "model",
6
6
  "harness",
7
+ "seats",
7
8
  "permissions",
8
9
  "tools",
9
10
  "mcp",
@@ -252,6 +253,8 @@ function applyRemoval(profile, remove) {
252
253
  }
253
254
  if (remove.harness !== undefined)
254
255
  delete next.harness;
256
+ if (remove.seats !== undefined)
257
+ delete next.seats;
255
258
  if (remove.permissions !== undefined) {
256
259
  setOrDelete(next, "permissions", removeKeys(next.permissions, remove.permissions));
257
260
  }
@@ -335,34 +338,3 @@ export function changedAgentProfileAxes(diff) {
335
338
  }
336
339
  return [...axes].sort();
337
340
  }
338
- export function pruneAgentProfileDiff(diff, axesToRemove) {
339
- const removeSet = new Set(axesToRemove);
340
- const set = diff.set ? { ...diff.set } : undefined;
341
- const remove = diff.remove ? { ...diff.remove } : undefined;
342
- if (removeSet.has("identity") && set) {
343
- delete set.name;
344
- delete set.description;
345
- delete set.version;
346
- delete set.tags;
347
- }
348
- if (removeSet.has("identity") && remove) {
349
- delete remove.identity;
350
- delete remove.tags;
351
- }
352
- for (const axis of agentProfileDiffPropertyAxes) {
353
- if (!removeSet.has(axis))
354
- continue;
355
- if (set)
356
- delete set[axis];
357
- if (remove)
358
- delete remove[axis];
359
- }
360
- const pruned = { ...diff };
361
- setOrDelete(pruned, "set", set && Object.values(set).some((value) => value !== undefined)
362
- ? set
363
- : undefined);
364
- setOrDelete(pruned, "remove", remove && Object.values(remove).some((value) => value !== undefined)
365
- ? remove
366
- : undefined);
367
- return pruned;
368
- }
@@ -6,12 +6,11 @@
6
6
  * The data is plain, dated, and sourced. Composition is pure: the same profile
7
7
  * yields the same composed profile, so profile identity stays deterministic.
8
8
  */
9
- import { composeAgentProfileGuidance, type AgentProfile, type AgentProfileGuidanceBlock } from "../agent-profile.js";
9
+ import { composeAgentProfileGuidance, type AgentProfile } from "../agent-profile.js";
10
10
  import type { HarnessType } from "../harness.js";
11
11
  import { profileKbHarnesses } from "./harnesses.js";
12
12
  import { profileKbModels } from "./models.js";
13
13
  import { profileKbDiscrepancies, profileKbLearnings } from "./records.js";
14
- import type { ProfileKbHarness, ProfileKbModel } from "./types.js";
15
14
  export type * from "./types.js";
16
15
  export type { AgentProfileGuidanceBlock, AgentProfileGuidanceChannel, AgentProfileGuidanceOptions, } from "../agent-profile.js";
17
16
  export { composeAgentProfileGuidance, profileKbDiscrepancies, profileKbHarnesses, profileKbLearnings, profileKbModels, };
@@ -20,31 +19,11 @@ export { composeAgentProfileGuidance, profileKbDiscrepancies, profileKbHarnesses
20
19
  * replaces blocks from these sources and keeps blocks any other layer added.
21
20
  */
22
21
  export declare const PROFILE_KB_SOURCES: readonly ["harness", "model", "learning"];
23
- /** Date of the latest source audit; individual historical observations retain their own dates. */
24
- export declare const PROFILE_KB_CHECKED_AT = "2026-10-04";
25
- /** Find a harness entry by its {@link HarnessType}. */
26
- export declare function findProfileKbHarness(harness: HarnessType | string | undefined): ProfileKbHarness | undefined;
27
- /**
28
- * Find a model entry by id or alias.
29
- *
30
- * Accepts the spellings harnesses and routers use: a provider prefix
31
- * (`anthropic/claude-opus-5-5`), a route prefix
32
- * (`pi/tangle-router/deepseek/deepseek-v4.1-flash`), and a trailing `:suffix`
33
- * such as pi's thinking level or a router's `:batch`. A different version is a
34
- * different model and never matches.
35
- */
36
- export declare function findProfileKbModel(model: string | undefined): ProfileKbModel | undefined;
37
22
  /** Which harness and model to compose guidance for. */
38
23
  export interface ProfileKbSelection {
39
24
  harness?: HarnessType | string;
40
25
  model?: string;
41
26
  }
42
- /**
43
- * The guidance blocks for one harness and model: the harness's, then the
44
- * model's, then any reproduced platform learnings for either. Unknown names
45
- * contribute nothing.
46
- */
47
- export declare function profileKbGuidance(selection: ProfileKbSelection): AgentProfileGuidanceBlock[];
48
27
  /**
49
28
  * Compose harness, model, and profile guidance into the profile's prompt.
50
29
  *
@@ -18,14 +18,6 @@ export { composeAgentProfileGuidance, profileKbDiscrepancies, profileKbHarnesses
18
18
  * replaces blocks from these sources and keeps blocks any other layer added.
19
19
  */
20
20
  export const PROFILE_KB_SOURCES = ["harness", "model", "learning"];
21
- /** Date of the latest source audit; individual historical observations retain their own dates. */
22
- export const PROFILE_KB_CHECKED_AT = "2026-10-04";
23
- /** Find a harness entry by its {@link HarnessType}. */
24
- export function findProfileKbHarness(harness) {
25
- if (!harness)
26
- return undefined;
27
- return profileKbHarnesses.find((entry) => entry.id === harness);
28
- }
29
21
  /*
30
22
  * Composition reads a frozen snapshot taken at load, never the exported
31
23
  * records. A consumer that edits an exported entry therefore cannot change
@@ -51,20 +43,6 @@ const modelIndex = (() => {
51
43
  });
52
44
  return index;
53
45
  })();
54
- /**
55
- * Find a model entry by id or alias.
56
- *
57
- * Accepts the spellings harnesses and routers use: a provider prefix
58
- * (`anthropic/claude-opus-5-5`), a route prefix
59
- * (`pi/tangle-router/deepseek/deepseek-v4.1-flash`), and a trailing `:suffix`
60
- * such as pi's thinking level or a router's `:batch`. A different version is a
61
- * different model and never matches.
62
- */
63
- export function findProfileKbModel(model) {
64
- // Public lookups search the exported records as they are now; composition
65
- // alone reads the frozen snapshot, so neither can desynchronize the other.
66
- return matchModelName(model, (candidate) => profileKbModels.find((entry) => [entry.id, ...entry.aliases].some((name) => name.toLowerCase() === candidate)));
67
- }
68
46
  /**
69
47
  * Try the name as given, then without each leading `provider/` or route
70
48
  * segment, after dropping a trailing `:suffix`.
@@ -108,7 +86,7 @@ function bullets(lines) {
108
86
  * model's, then any reproduced platform learnings for either. Unknown names
109
87
  * contribute nothing.
110
88
  */
111
- export function profileKbGuidance(selection) {
89
+ function profileKbGuidance(selection) {
112
90
  const harness = selection.harness
113
91
  ? harnessSnapshot[harnessPosition(selection.harness)]
114
92
  : undefined;
@@ -166,6 +166,35 @@ export declare const agentProfileModelHintsSchema: z.ZodObject<{
166
166
  maxTotalOutputTokens: z.ZodOptional<z.ZodNumber>;
167
167
  metadata: z.ZodOptional<z.ZodType<Record<string, unknown>, unknown, z.core.$ZodTypeInternals<Record<string, unknown>, unknown>>>;
168
168
  }, z.core.$strict>;
169
+ /** Ordered account selection policy, without credentials or ambient model defaults. */
170
+ export declare const agentProfileSeatSchema: z.ZodObject<{
171
+ harness: z.ZodEnum<{
172
+ acp: "acp";
173
+ amp: "amp";
174
+ "claude-code": "claude-code";
175
+ "cli-base": "cli-base";
176
+ codex: "codex";
177
+ cursor: "cursor";
178
+ "factory-droids": "factory-droids";
179
+ forge: "forge";
180
+ gemini: "gemini";
181
+ hermes: "hermes";
182
+ "kimi-code": "kimi-code";
183
+ nanoclaw: "nanoclaw";
184
+ openclaw: "openclaw";
185
+ opencode: "opencode";
186
+ pi: "pi";
187
+ prime: "prime";
188
+ }>;
189
+ provider: z.ZodString;
190
+ model: z.ZodString;
191
+ selector: z.ZodUnion<readonly [z.ZodObject<{
192
+ kind: z.ZodLiteral<"all-eligible">;
193
+ }, z.core.$strict>, z.ZodObject<{
194
+ kind: z.ZodLiteral<"seat">;
195
+ id: z.ZodString;
196
+ }, z.core.$strict>]>;
197
+ }, z.core.$strict>;
169
198
  /**
170
199
  * Replacement and addition are separate, independently optional fields, and the
171
200
  * pair is admitted on purpose: the effective prompt is `systemPrompt` followed
@@ -306,6 +335,7 @@ export declare const agentProfileDiffRemovalSchema: z.ZodObject<{
306
335
  }, z.core.$strict>]>>;
307
336
  model: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodArray<z.ZodString>]>>;
308
337
  harness: z.ZodOptional<z.ZodLiteral<true>>;
338
+ seats: z.ZodOptional<z.ZodLiteral<true>>;
309
339
  permissions: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodArray<z.ZodString>]>>;
310
340
  tools: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodArray<z.ZodString>]>>;
311
341
  mcp: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodArray<z.ZodString>]>>;
@@ -487,6 +517,34 @@ export declare const agentProfileSchema: z.ZodObject<{
487
517
  pi: "pi";
488
518
  prime: "prime";
489
519
  }>>;
520
+ seats: z.ZodOptional<z.ZodArray<z.ZodObject<{
521
+ harness: z.ZodEnum<{
522
+ acp: "acp";
523
+ amp: "amp";
524
+ "claude-code": "claude-code";
525
+ "cli-base": "cli-base";
526
+ codex: "codex";
527
+ cursor: "cursor";
528
+ "factory-droids": "factory-droids";
529
+ forge: "forge";
530
+ gemini: "gemini";
531
+ hermes: "hermes";
532
+ "kimi-code": "kimi-code";
533
+ nanoclaw: "nanoclaw";
534
+ openclaw: "openclaw";
535
+ opencode: "opencode";
536
+ pi: "pi";
537
+ prime: "prime";
538
+ }>;
539
+ provider: z.ZodString;
540
+ model: z.ZodString;
541
+ selector: z.ZodUnion<readonly [z.ZodObject<{
542
+ kind: z.ZodLiteral<"all-eligible">;
543
+ }, z.core.$strict>, z.ZodObject<{
544
+ kind: z.ZodLiteral<"seat">;
545
+ id: z.ZodString;
546
+ }, z.core.$strict>]>;
547
+ }, z.core.$strict>>>;
490
548
  permissions: z.ZodOptional<z.ZodType<Record<string, "allow" | "ask" | "deny" | Record<string, "allow" | "ask" | "deny">>, unknown, z.core.$ZodTypeInternals<Record<string, "allow" | "ask" | "deny" | Record<string, "allow" | "ask" | "deny">>, unknown>>>;
491
549
  tools: z.ZodOptional<z.ZodType<Record<string, boolean>, unknown, z.core.$ZodTypeInternals<Record<string, boolean>, unknown>>>;
492
550
  mcp: z.ZodOptional<z.ZodType<Record<string, AgentProfileMcpServer>, unknown, z.core.$ZodTypeInternals<Record<string, AgentProfileMcpServer>, unknown>>>;
@@ -2,6 +2,7 @@ import { z } from "zod";
2
2
  import { REASONING_EFFORTS, TRAINED_MODEL_PREFIX, trainedModelIdForArtifact, } from "./agent-profile.js";
3
3
  import { canonicalCandidateDigest, sha256DigestSchema, environmentNameSchema, headerNameSchema, isSafeExecutable, isSafeRelativePath, isWellFormedUnicode, looksLikeCredential, } from "./agent-candidate-schema-common.js";
4
4
  import { harnessTypeSchema } from "./harness.js";
5
+ import { harnessHonorsEffort, harnessHonorsModel, harnessModelSupport, harnessReasoningEfforts, harnessSystemPromptIntents, resolveModelProvider, } from "./harness-capabilities.js";
5
6
  import { SANDBOX_SIZE_PRESET_NAMES, } from "./sandbox-size.js";
6
7
  /**
7
8
  * Zod records currently assign parsed values onto an ordinary object. The
@@ -130,6 +131,16 @@ export const agentProfileModelHintsBaseSchema = z.strictObject({
130
131
  metadata: ownPropertyRecordSchema(z.unknown()).optional(),
131
132
  });
132
133
  export const agentProfileModelHintsSchema = agentProfileModelHintsBaseSchema.superRefine(enforceModelTokenBounds);
134
+ /** Ordered account selection policy, without credentials or ambient model defaults. */
135
+ export const agentProfileSeatSchema = z.strictObject({
136
+ harness: harnessTypeSchema,
137
+ provider: z.string().regex(/^[a-z][a-z0-9-]*$/),
138
+ model: z.string().min(1).refine((value) => value.trim() === value, "model must be canonical"),
139
+ selector: z.union([
140
+ z.strictObject({ kind: z.literal("all-eligible") }),
141
+ z.strictObject({ kind: z.literal("seat"), id: z.string().min(1).refine((value) => value.trim() === value, "seat id must be canonical") }),
142
+ ]),
143
+ });
133
144
  /**
134
145
  * Replacement and addition are separate, independently optional fields, and the
135
146
  * pair is admitted on purpose: the effective prompt is `systemPrompt` followed
@@ -308,6 +319,7 @@ export const agentProfileDiffRemovalSchema = z.strictObject({
308
319
  .optional(),
309
320
  model: removeListSchema.optional(),
310
321
  harness: z.literal(true).optional(),
322
+ seats: z.literal(true).optional(),
311
323
  permissions: removeListSchema.optional(),
312
324
  tools: removeListSchema.optional(),
313
325
  mcp: removeListSchema.optional(),
@@ -418,6 +430,7 @@ export const agentProfileSchema = z
418
430
  prompt: agentProfilePromptSchema.optional(),
419
431
  model: agentProfileModelHintsSchema.optional(),
420
432
  harness: harnessTypeSchema.optional(),
433
+ seats: z.array(agentProfileSeatSchema).nonempty().optional(),
421
434
  permissions: ownPropertyRecordSchema(agentProfilePermissionSchema).optional(),
422
435
  tools: ownPropertyRecordSchema(z.boolean()).optional(),
423
436
  mcp: ownPropertyRecordSchema(agentProfileMcpServerSchema).optional(),
@@ -432,6 +445,38 @@ export const agentProfileSchema = z
432
445
  })
433
446
  .superRefine((profile, context) => {
434
447
  validateNestedRecordKeys(profile, context, [], new Set());
448
+ if (profile.seats?.length) {
449
+ const first = profile.seats[0];
450
+ if (first.harness !== profile.harness || first.provider !== profile.model?.provider ||
451
+ first.model !== profile.model?.default) {
452
+ context.addIssue({ code: "custom", path: ["seats", 0], message: "first seat must match profile harness, model.provider, and model.default" });
453
+ }
454
+ for (const [index, seat] of profile.seats.entries()) {
455
+ const provider = resolveModelProvider(seat.model);
456
+ if (provider !== seat.provider) {
457
+ context.addIssue({ code: "custom", path: ["seats", index, "provider"], message: "seat provider must match the model provider" });
458
+ }
459
+ if (!harnessHonorsModel(seat.harness)) {
460
+ context.addIssue({ code: "custom", path: ["seats", index, "harness"], message: "seat harness does not honor an exact model choice" });
461
+ }
462
+ const support = harnessModelSupport(seat.harness, seat.model, { reasoningEffort: profile.model?.reasoningEffort });
463
+ if (!support.supported) {
464
+ context.addIssue({ code: "custom", path: ["seats", index, "model"], message: support.message });
465
+ }
466
+ const effort = profile.model?.reasoningEffort;
467
+ if (effort !== undefined && (!harnessHonorsEffort(seat.harness) ||
468
+ !harnessReasoningEfforts(seat.harness).includes(effort))) {
469
+ context.addIssue({ code: "custom", path: ["seats", index, "harness"], message: "seat harness cannot honor profile reasoning effort" });
470
+ }
471
+ const prompt = harnessSystemPromptIntents(seat.harness);
472
+ if (profile.prompt?.systemPrompt !== undefined && !prompt.replace) {
473
+ context.addIssue({ code: "custom", path: ["seats", index, "harness"], message: "seat harness cannot replace the system prompt" });
474
+ }
475
+ if (profile.prompt?.appendSystemPrompt !== undefined && !prompt.append) {
476
+ context.addIssue({ code: "custom", path: ["seats", index, "harness"], message: "seat harness cannot append the system prompt" });
477
+ }
478
+ }
479
+ }
435
480
  const training = agentProfileTrainingSchema.safeParse(profile.metadata?.training);
436
481
  if (profile.model?.default?.startsWith(TRAINED_MODEL_PREFIX) && !training.success) {
437
482
  context.addIssue({ code: "custom", path: ["metadata", "training"], message: "trained model requires a checkpoint receipt" });
@@ -103,67 +103,6 @@ export declare const AgentRunCancellationAcknowledgementSchema: z.ZodObject<{
103
103
  existingRequestDigest: z.ZodOptional<z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>>;
104
104
  }, z.core.$strict>;
105
105
  export declare function agentRunCancellationAcknowledgementMatchesRequest(request: AgentRunCancellationRequest, acknowledgement: AgentRunCancellationAcknowledgement): boolean;
106
- export type AgentRunControlAction = "steer" | "cancel" | "status" | "reconnect";
107
- export interface AgentRunControlRequestMaterial {
108
- operationId: string;
109
- action: AgentRunControlAction;
110
- run: AgentExactRunControlRef;
111
- payload?: Record<string, unknown>;
112
- }
113
- export interface AgentRunControlRequest extends AgentRunControlRequestMaterial {
114
- requestDigest: Sha256Digest;
115
- }
116
- export declare function agentRunControlRequestDigest(request: AgentRunControlRequestMaterial): Sha256Digest;
117
- export declare const AgentRunControlRequestSchema: z.ZodObject<{
118
- operationId: z.ZodString;
119
- action: z.ZodEnum<{
120
- cancel: "cancel";
121
- reconnect: "reconnect";
122
- status: "status";
123
- steer: "steer";
124
- }>;
125
- run: z.ZodObject<{
126
- runId: z.ZodString;
127
- provider: z.ZodString;
128
- environmentId: z.ZodString;
129
- sessionId: z.ZodString;
130
- executionId: z.ZodString;
131
- requestDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
132
- }, z.core.$strict>;
133
- payload: z.ZodOptional<z.ZodCustom<Record<string, unknown>, Record<string, unknown>>>;
134
- requestDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
135
- }, z.core.$strict>;
136
- export interface AgentRunControlAcknowledgement {
137
- operationId: string;
138
- requestDigest: Sha256Digest;
139
- run: AgentExactRunControlRef;
140
- status: "accepted" | "replayed" | "conflict" | "unknown";
141
- message?: string;
142
- retryable?: boolean;
143
- existingRequestDigest?: Sha256Digest;
144
- }
145
- export declare const AgentRunControlAcknowledgementSchema: z.ZodObject<{
146
- operationId: z.ZodString;
147
- requestDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
148
- run: z.ZodObject<{
149
- runId: z.ZodString;
150
- provider: z.ZodString;
151
- environmentId: z.ZodString;
152
- sessionId: z.ZodString;
153
- executionId: z.ZodString;
154
- requestDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
155
- }, z.core.$strict>;
156
- status: z.ZodEnum<{
157
- accepted: "accepted";
158
- conflict: "conflict";
159
- replayed: "replayed";
160
- unknown: "unknown";
161
- }>;
162
- message: z.ZodOptional<z.ZodString>;
163
- retryable: z.ZodOptional<z.ZodBoolean>;
164
- existingRequestDigest: z.ZodOptional<z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>>;
165
- }, z.core.$strict>;
166
- export declare function agentRunControlAcknowledgementMatchesRequest(request: AgentRunControlRequest, acknowledgement: AgentRunControlAcknowledgement): boolean;
167
106
  export declare const CanonicalStreamEventSchema: z.ZodType<StreamEvent>;
168
107
  /** Ordered, replayable envelope around the existing canonical event union. */
169
108
  export interface RuntimeEventEnvelope {
@@ -125,82 +125,6 @@ export function agentRunCancellationAcknowledgementMatchesRequest(request, ackno
125
125
  exactAcknowledgement.data.requestDigest === exactRequest.data.requestDigest &&
126
126
  sameAgentRunControlRef(exactAcknowledgement.data.run, exactRequest.data.run));
127
127
  }
128
- export function agentRunControlRequestDigest(request) {
129
- const parsed = AgentRunControlRequestMaterialSchema.parse(request);
130
- return canonicalCandidateDigest({
131
- operationId: parsed.operationId,
132
- action: parsed.action,
133
- run: parsed.run,
134
- ...(parsed.payload === undefined ? {} : { payload: parsed.payload }),
135
- });
136
- }
137
- const AgentRunControlRequestMaterialSchema = z.strictObject({
138
- operationId: stableIdSchema,
139
- action: z.enum(["steer", "cancel", "status", "reconnect"]),
140
- run: AgentExactRunControlRefSchema,
141
- payload: boundedJsonRecordSchema.optional(),
142
- });
143
- export const AgentRunControlRequestSchema = z
144
- .strictObject({
145
- ...AgentRunControlRequestMaterialSchema.shape,
146
- requestDigest: sha256DigestSchema,
147
- })
148
- .superRefine((request, refinement) => {
149
- const { requestDigest: _requestDigest, ...material } = request;
150
- if (request.requestDigest !== agentRunControlRequestDigest(material)) {
151
- refinement.addIssue({
152
- code: "custom",
153
- path: ["requestDigest"],
154
- message: "run control request digest does not match its content",
155
- });
156
- }
157
- });
158
- export const AgentRunControlAcknowledgementSchema = z
159
- .strictObject({
160
- operationId: stableIdSchema,
161
- requestDigest: sha256DigestSchema,
162
- run: AgentExactRunControlRefSchema,
163
- status: z.enum(["accepted", "replayed", "conflict", "unknown"]),
164
- message: boundedStringSchema.min(1).optional(),
165
- retryable: z.boolean().optional(),
166
- existingRequestDigest: sha256DigestSchema.optional(),
167
- })
168
- .superRefine((acknowledgement, refinement) => {
169
- if (acknowledgement.status === "conflict" &&
170
- (acknowledgement.existingRequestDigest === undefined ||
171
- acknowledgement.existingRequestDigest === acknowledgement.requestDigest)) {
172
- refinement.addIssue({
173
- code: "custom",
174
- path: ["existingRequestDigest"],
175
- message: "a control conflict must identify a different existing request",
176
- });
177
- }
178
- if (acknowledgement.status !== "conflict" &&
179
- acknowledgement.existingRequestDigest !== undefined) {
180
- refinement.addIssue({
181
- code: "custom",
182
- path: ["existingRequestDigest"],
183
- message: "only a control conflict may include an existing digest",
184
- });
185
- }
186
- if (acknowledgement.status === "unknown" &&
187
- (acknowledgement.message === undefined || acknowledgement.retryable !== false)) {
188
- refinement.addIssue({
189
- code: "custom",
190
- path: ["retryable"],
191
- message: "an unknown control outcome must be explicit and non-repeatable",
192
- });
193
- }
194
- });
195
- export function agentRunControlAcknowledgementMatchesRequest(request, acknowledgement) {
196
- const exactRequest = AgentRunControlRequestSchema.safeParse(request);
197
- const exactAcknowledgement = AgentRunControlAcknowledgementSchema.safeParse(acknowledgement);
198
- if (!exactRequest.success || !exactAcknowledgement.success)
199
- return false;
200
- return (exactAcknowledgement.data.operationId === exactRequest.data.operationId &&
201
- exactAcknowledgement.data.requestDigest === exactRequest.data.requestDigest &&
202
- sameAgentRunControlRef(exactAcknowledgement.data.run, exactRequest.data.run));
203
- }
204
128
  const unknownRecordSchema = boundedJsonRecordSchema;
205
129
  const partBase = {
206
130
  id: stableIdSchema,
@@ -41,8 +41,6 @@ export declare const ConfidentialExecutionRequestSchema: z.ZodObject<{
41
41
  profileDigest: z.ZodOptional<z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>>;
42
42
  }, z.core.$strict>;
43
43
  export type ConfidentialExecutionRequest = z.infer<typeof ConfidentialExecutionRequestSchema>;
44
- /** Match one requested TEE against a provider-reported TEE identifier. */
45
- export declare function confidentialTeeMatchesRequest(requested: string | undefined, attested: string | undefined): boolean;
46
44
  export interface ConfidentialExecutionEnvironment {
47
45
  provider: string;
48
46
  environmentId: string;
@@ -101,7 +101,7 @@ function normalizedTeeId(value) {
101
101
  }
102
102
  }
103
103
  /** Match one requested TEE against a provider-reported TEE identifier. */
104
- export function confidentialTeeMatchesRequest(requested, attested) {
104
+ function confidentialTeeMatchesRequest(requested, attested) {
105
105
  if (attested === undefined)
106
106
  return requested === undefined;
107
107
  const normalizedAttested = normalizedTeeId(attested);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-interface",
3
- "version": "2.20.1",
3
+ "version": "3.1.0",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "license": "MIT",
@@ -17,11 +17,6 @@
17
17
  "types": "./dist/environment-provider.d.ts",
18
18
  "default": "./dist/environment-provider.js"
19
19
  },
20
- "./environment-interactive": {
21
- "import": "./dist/environment-interactive.js",
22
- "types": "./dist/environment-interactive.d.ts",
23
- "default": "./dist/environment-interactive.js"
24
- },
25
20
  "./environment-interactive-control": {
26
21
  "import": "./dist/environment-interactive-control.js",
27
22
  "types": "./dist/environment-interactive-control.d.ts",
@@ -32,11 +27,6 @@
32
27
  "types": "./dist/agent-profile.d.ts",
33
28
  "default": "./dist/agent-profile.js"
34
29
  },
35
- "./agent-instance": {
36
- "import": "./dist/agent-instance.js",
37
- "types": "./dist/agent-instance.d.ts",
38
- "default": "./dist/agent-instance.js"
39
- },
40
30
  "./profile-snapshot": {
41
31
  "import": "./dist/agent-profile-snapshot.js",
42
32
  "types": "./dist/agent-profile-snapshot.d.ts",
@@ -1,98 +0,0 @@
1
- import { z } from "zod";
2
- import type { Sha256Digest } from "./agent-candidate.js";
3
- import type { AgentProfile } from "./agent-profile.js";
4
- import type { HarnessType } from "./harness.js";
5
- /** Lifecycle state of one managed Agent inside an execution environment. */
6
- export declare const AGENT_INSTANCE_STATUSES: readonly ["starting", "ready", "busy", "failed", "stopped"];
7
- export type AgentInstanceStatus = (typeof AGENT_INSTANCE_STATUSES)[number];
8
- /**
9
- * How one Agent sees the provider-owned workspace.
10
- *
11
- * `shared` is ordinary same-computer visibility. `isolated` requests a private
12
- * writable view with provider-defined inspect or commit behavior. Neither mode
13
- * is a security boundary between mutually untrusted Agents.
14
- */
15
- export declare const AGENT_INSTANCE_WORKSPACE_MODES: readonly ["shared", "isolated"];
16
- export type AgentInstanceWorkspaceMode = (typeof AGENT_INSTANCE_WORKSPACE_MODES)[number];
17
- export interface AgentInstanceWorkspace {
18
- mode: AgentInstanceWorkspaceMode;
19
- }
20
- /**
21
- * Provider-neutral request to start one managed Agent inside an existing
22
- * execution environment.
23
- *
24
- * Omitting `profile` asks the provider for its default Agent configuration.
25
- * Omitting `workspace` selects the provider's documented default. A profile
26
- * never implies another VM.
27
- */
28
- export interface AgentInstanceSpec {
29
- /** Stable caller-selected id or idempotency key, when supported. */
30
- id?: string;
31
- /** Human-readable label; not immutable identity. */
32
- name?: string;
33
- /** Exact portable profile for this Agent. */
34
- profile?: AgentProfile;
35
- /** Optional execution override; otherwise the profile or provider decides. */
36
- harness?: HarnessType;
37
- workspace?: AgentInstanceWorkspace;
38
- }
39
- /** Credential-free identity of the profile bound to an Agent instance. */
40
- export interface AgentInstanceProfileIdentity {
41
- name?: string;
42
- digest: Sha256Digest;
43
- }
44
- /**
45
- * Public failure summary. Providers must remove credentials and private
46
- * implementation details before publishing this value.
47
- */
48
- export interface AgentInstanceFailure {
49
- code?: string;
50
- message: string;
51
- }
52
- /**
53
- * Portable snapshot of one managed Agent.
54
- *
55
- * The record deliberately excludes the full profile, provider request,
56
- * credentials, grants, process ids, placement, and fencing state.
57
- */
58
- export interface AgentInstanceRecord {
59
- kind: "agent-instance";
60
- schemaVersion: 1;
61
- id: string;
62
- name?: string;
63
- profile?: AgentInstanceProfileIdentity;
64
- /** Effective harness after profile and caller override resolution. */
65
- harness?: HarnessType;
66
- workspace: AgentInstanceWorkspace;
67
- status: AgentInstanceStatus;
68
- failure?: AgentInstanceFailure;
69
- createdAtMs: number;
70
- updatedAtMs: number;
71
- }
72
- export interface AgentInstanceStopRequest {
73
- agentId: string;
74
- /** Provider-defined hard termination after graceful stop cannot complete. */
75
- force?: boolean;
76
- }
77
- export interface AgentInstanceStopAcknowledgement {
78
- agentId: string;
79
- outcome: "stopped" | "already-stopped" | "not-found";
80
- }
81
- export declare const agentInstanceStatusSchema: z.ZodEnum<{
82
- busy: "busy";
83
- failed: "failed";
84
- ready: "ready";
85
- starting: "starting";
86
- stopped: "stopped";
87
- }>;
88
- export declare const agentInstanceWorkspaceModeSchema: z.ZodEnum<{
89
- isolated: "isolated";
90
- shared: "shared";
91
- }>;
92
- export declare const agentInstanceWorkspaceSchema: z.ZodType<AgentInstanceWorkspace>;
93
- export declare const agentInstanceSpecSchema: z.ZodType<AgentInstanceSpec>;
94
- export declare const agentInstanceProfileIdentitySchema: z.ZodType<AgentInstanceProfileIdentity>;
95
- export declare const agentInstanceFailureSchema: z.ZodType<AgentInstanceFailure>;
96
- export declare const agentInstanceRecordSchema: z.ZodType<AgentInstanceRecord>;
97
- export declare const agentInstanceStopRequestSchema: z.ZodType<AgentInstanceStopRequest>;
98
- export declare const agentInstanceStopAcknowledgementSchema: z.ZodType<AgentInstanceStopAcknowledgement>;