@tangle-network/agent-interface 5.0.0 → 5.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.
@@ -37,6 +37,18 @@ export interface AgentCandidateArtifactRef {
37
37
  sha256: Sha256Digest;
38
38
  byteLength: number;
39
39
  }
40
+ /** Reads one content-addressed object through an authorized closed-locator resolver. */
41
+ export interface AgentCandidateArtifactPort {
42
+ read(ref: AgentCandidateArtifactRef): Promise<Uint8Array>;
43
+ /** Stream an artifact without materializing its complete contents. */
44
+ readStream?(ref: AgentCandidateArtifactRef, options?: {
45
+ signal?: AbortSignal;
46
+ }): AsyncIterable<Uint8Array>;
47
+ /** Find an already stored object by its exact content digest and length. */
48
+ locate?(object: Pick<AgentCandidateArtifactRef, "sha256" | "byteLength">, options?: {
49
+ signal?: AbortSignal;
50
+ }): Promise<AgentCandidateArtifactRef | undefined>;
51
+ }
40
52
  /** Bytes embedded directly in a candidate manifest. */
41
53
  export interface AgentCandidateEmbeddedArtifact {
42
54
  encoding: "base64";
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import type { AgentRuntimeAttachments } from "./runtime-attachments.js";
3
3
  export { AgentRuntimeAttachmentsSchema, type AgentRuntimeAttachments } from "./runtime-attachments.js";
4
- import type { Sha256Digest } from "./agent-candidate.js";
4
+ import type { AgentCandidateArtifactPort, Sha256Digest } from "./agent-candidate.js";
5
5
  import type { AgentProfile, AgentProfileCapabilities, AgentProfileValidationResult } from "./agent-profile.js";
6
6
  import type { InputPart } from "./parts.js";
7
7
  import type { StreamEvent } from "./stream-events.js";
@@ -1358,13 +1358,15 @@ export interface AgentEnvironmentCapabilities {
1358
1358
  /** The provider exposes the exact continued run before terminal output. */
1359
1359
  admissionControl?: boolean;
1360
1360
  };
1361
- /** Present only when fresh-session portable context transfer is durable. */
1361
+ /** Durable portable-context lookup and independently qualified fresh-session admission. */
1362
1362
  contextTransfer?: {
1363
1363
  freshSession: boolean;
1364
1364
  requestIdempotency: boolean;
1365
1365
  lookup: boolean;
1366
1366
  /** get(id, { contextTransfer }) verifies the durable receipt and enables only its first turn. */
1367
1367
  attach?: boolean;
1368
+ /** Restores accepted snapshot refs before native admission. Absent or false means unsupported. */
1369
+ workspaceSnapshot?: boolean;
1368
1370
  };
1369
1371
  /** Absent when the provider cannot originate or answer interactions. */
1370
1372
  interactions?: InteractionCapabilities;
@@ -1521,6 +1523,7 @@ export declare const AgentEnvironmentCapabilitiesSchema: z.ZodObject<{
1521
1523
  requestIdempotency: z.ZodBoolean;
1522
1524
  lookup: z.ZodBoolean;
1523
1525
  attach: z.ZodOptional<z.ZodBoolean>;
1526
+ workspaceSnapshot: z.ZodOptional<z.ZodBoolean>;
1524
1527
  }, z.core.$strict>>;
1525
1528
  interactions: z.ZodOptional<z.ZodObject<{
1526
1529
  kinds: z.ZodArray<z.ZodString>;
@@ -2185,6 +2188,8 @@ export interface AgentEnvironmentProvider {
2185
2188
  export interface AgentContextTransferProvider {
2186
2189
  transfer(request: ContextTransferRequest, options?: {
2187
2190
  signal?: AbortSignal;
2191
+ /** Authorized source artifacts for this attempt; never part of the accepted wire request. */
2192
+ artifacts?: AgentCandidateArtifactPort;
2188
2193
  }): Promise<ContextTransferResult>;
2189
2194
  lookup(request: ContextTransferRequest, options?: {
2190
2195
  signal?: AbortSignal;
@@ -199,6 +199,7 @@ export const AgentEnvironmentCapabilitiesSchema = z
199
199
  requestIdempotency: z.boolean(),
200
200
  lookup: z.boolean(),
201
201
  attach: z.boolean().optional(),
202
+ workspaceSnapshot: z.boolean().optional(),
202
203
  })
203
204
  .optional(),
204
205
  interactions: InteractionCapabilitiesSchema.optional(),
@@ -318,14 +319,16 @@ export const AgentEnvironmentCapabilitiesSchema = z
318
319
  message: "native continuation requires retained control for early admission",
319
320
  });
320
321
  }
321
- if (capabilities.contextTransfer !== undefined &&
322
- (!capabilities.contextTransfer.freshSession ||
323
- !capabilities.contextTransfer.requestIdempotency ||
324
- !capabilities.contextTransfer.lookup)) {
322
+ const contextTransfer = capabilities.contextTransfer;
323
+ if (contextTransfer !== undefined &&
324
+ (!contextTransfer.lookup ||
325
+ (contextTransfer.freshSession && !contextTransfer.requestIdempotency) ||
326
+ ((contextTransfer.attach === true || contextTransfer.workspaceSnapshot === true) &&
327
+ (!contextTransfer.freshSession || !contextTransfer.requestIdempotency)))) {
325
328
  refinement.addIssue({
326
329
  code: "custom",
327
330
  path: ["contextTransfer"],
328
- message: "context transfer requires fresh-session admission, request idempotency, and lookup together",
331
+ message: "context transfer requires durable lookup; fresh admission, attachment, and snapshot transfer require fresh-session admission and request idempotency together",
329
332
  });
330
333
  }
331
334
  const durableBranching = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-interface",
3
- "version": "5.0.0",
3
+ "version": "5.1.0",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "license": "MIT",