@tangle-network/agent-interface 0.51.0 → 0.52.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 CHANGED
@@ -9,6 +9,7 @@ shapes; higher-level packages import from here rather than redefining them.
9
9
 
10
10
  `AgentRunControlRef` identifies a retained run without depending on a live JavaScript object and may carry the provider's admission digest so reconstruction can reject changed-input reuse.
11
11
  `RuntimeEventEnvelope` adds stable run, event, sequence, cursor, and timestamp fields around the existing `StreamEvent` union, and its runtime schema validates every canonical event variant.
12
+ The canonical `cancelled` status identifies caller cancellation and remains distinct from `failed`.
12
13
  Providers advertise `retainedControl` only when exact run, result, event, cancellation, replay, detach, turn, and session identity are all implemented together.
13
14
  `AgentEnvironment.metadata` is the detached snapshot returned by create or get, so recovery can check persisted annotations without listing environments.
14
15
  Metadata can include caller-authored values and does not prove authorization or authorship.
@@ -147,11 +147,23 @@ export declare function terminalSessionUsable(ref: TerminalSessionRef, nowIso: s
147
147
  /** Bind an attach result to the parent execution and terminal it targeted. */
148
148
  export declare function terminalAttachResultMatchesRequest(request: TerminalAttachRequest, result: TerminalAttachResult): boolean;
149
149
  /**
150
- * Live handle for one interactive terminal. Signatures only; a provider adapter
151
- * binds the transport in phase two.
150
+ * The replay cursors a terminal handle can serve.
151
+ *
152
+ * `earliest` is the oldest cursor `events` accepts and `latest` is the newest
153
+ * frame the handle holds. A handle retains a bounded number of frames, so a
154
+ * consumer that holds no cursor, or holds one the handle dropped, reads this
155
+ * window to resume from a cursor that still exists.
152
156
  */
157
+ export declare const TerminalReplayWindowSchema: z.ZodObject<{
158
+ earliest: z.ZodNumber;
159
+ latest: z.ZodNumber;
160
+ }, z.core.$strict>;
161
+ export type TerminalReplayWindow = z.infer<typeof TerminalReplayWindowSchema>;
162
+ /** Live handle for one interactive terminal. */
153
163
  export interface AgentTerminalSession {
154
164
  readonly ref: TerminalSessionRef;
165
+ /** Cursors this handle can serve, so an evicted cursor is recoverable. */
166
+ readonly cursors: TerminalReplayWindow;
155
167
  input(input: TerminalInput, options?: {
156
168
  signal?: AbortSignal;
157
169
  }): Promise<void>;
@@ -160,3 +160,15 @@ export function terminalAttachResultMatchesRequest(request, result) {
160
160
  }
161
161
  return true;
162
162
  }
163
+ /**
164
+ * The replay cursors a terminal handle can serve.
165
+ *
166
+ * `earliest` is the oldest cursor `events` accepts and `latest` is the newest
167
+ * frame the handle holds. A handle retains a bounded number of frames, so a
168
+ * consumer that holds no cursor, or holds one the handle dropped, reads this
169
+ * window to resume from a cursor that still exists.
170
+ */
171
+ export const TerminalReplayWindowSchema = z.strictObject({
172
+ earliest: z.number().int().nonnegative(),
173
+ latest: z.number().int().nonnegative(),
174
+ });
package/dist/index.d.ts CHANGED
@@ -8,7 +8,7 @@ export * from "./host-services.js";
8
8
  export * from "./mcp.js";
9
9
  export * from "./provider-adapter.js";
10
10
  export type * from "./environment-provider.js";
11
- export { AgentEnvironmentCapabilitiesSchema, AgentNativeContextContinuationResultSchema, AgentTurnInputSchema, AgentTurnResultSchema, agentNativeContextContinuationResultMatchesRequest, AccountUsageSchema, AgentEnvironmentObservationSchema, AgentEnvironmentStatusSchema, ComputeBillingSchema, EnvironmentLifecycleSchema, ModelUsageSchema, ObservationProvenanceSchema, ObservationStateSchema, PlacementDescriptorSchema, ProviderIdentitySchema, ResourceProfileSchema, ResourceUseSampleSchema, SafeEndpointSchema, agentEnvironmentObservationIdentityMatches, assertObservationCredentialFree, observationContainsCredential, observationOf, TerminalAttachRequestSchema, TerminalAttachResultSchema, TerminalDetachAckSchema, TerminalInputSchema, TerminalOutputEventSchema, TerminalResizeSchema, TerminalSessionRefSchema, terminalAttachResultMatchesRequest, terminalSessionUsable, } from "./environment-provider.js";
11
+ export { AgentEnvironmentCapabilitiesSchema, AgentNativeContextContinuationResultSchema, AgentTurnInputSchema, AgentTurnResultSchema, agentNativeContextContinuationResultMatchesRequest, AccountUsageSchema, AgentEnvironmentObservationSchema, AgentEnvironmentStatusSchema, ComputeBillingSchema, EnvironmentLifecycleSchema, ModelUsageSchema, ObservationProvenanceSchema, ObservationStateSchema, PlacementDescriptorSchema, ProviderIdentitySchema, ResourceProfileSchema, ResourceUseSampleSchema, SafeEndpointSchema, agentEnvironmentObservationIdentityMatches, assertObservationCredentialFree, observationContainsCredential, observationOf, TerminalAttachRequestSchema, TerminalAttachResultSchema, TerminalDetachAckSchema, TerminalInputSchema, TerminalOutputEventSchema, TerminalReplayWindowSchema, TerminalResizeSchema, TerminalSessionRefSchema, terminalAttachResultMatchesRequest, terminalSessionUsable, } from "./environment-provider.js";
12
12
  export * from "./plan.js";
13
13
  export * from "./runtime-control.js";
14
14
  export * from "./portable-context.js";
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ export * from "./provider-config.js";
7
7
  export * from "./host-services.js";
8
8
  export * from "./mcp.js";
9
9
  export * from "./provider-adapter.js";
10
- export { AgentEnvironmentCapabilitiesSchema, AgentNativeContextContinuationResultSchema, AgentTurnInputSchema, AgentTurnResultSchema, agentNativeContextContinuationResultMatchesRequest, AccountUsageSchema, AgentEnvironmentObservationSchema, AgentEnvironmentStatusSchema, ComputeBillingSchema, EnvironmentLifecycleSchema, ModelUsageSchema, ObservationProvenanceSchema, ObservationStateSchema, PlacementDescriptorSchema, ProviderIdentitySchema, ResourceProfileSchema, ResourceUseSampleSchema, SafeEndpointSchema, agentEnvironmentObservationIdentityMatches, assertObservationCredentialFree, observationContainsCredential, observationOf, TerminalAttachRequestSchema, TerminalAttachResultSchema, TerminalDetachAckSchema, TerminalInputSchema, TerminalOutputEventSchema, TerminalResizeSchema, TerminalSessionRefSchema, terminalAttachResultMatchesRequest, terminalSessionUsable, } from "./environment-provider.js";
10
+ export { AgentEnvironmentCapabilitiesSchema, AgentNativeContextContinuationResultSchema, AgentTurnInputSchema, AgentTurnResultSchema, agentNativeContextContinuationResultMatchesRequest, AccountUsageSchema, AgentEnvironmentObservationSchema, AgentEnvironmentStatusSchema, ComputeBillingSchema, EnvironmentLifecycleSchema, ModelUsageSchema, ObservationProvenanceSchema, ObservationStateSchema, PlacementDescriptorSchema, ProviderIdentitySchema, ResourceProfileSchema, ResourceUseSampleSchema, SafeEndpointSchema, agentEnvironmentObservationIdentityMatches, assertObservationCredentialFree, observationContainsCredential, observationOf, TerminalAttachRequestSchema, TerminalAttachResultSchema, TerminalDetachAckSchema, TerminalInputSchema, TerminalOutputEventSchema, TerminalReplayWindowSchema, TerminalResizeSchema, TerminalSessionRefSchema, terminalAttachResultMatchesRequest, terminalSessionUsable, } from "./environment-provider.js";
11
11
  export * from "./plan.js";
12
12
  export * from "./runtime-control.js";
13
13
  export * from "./portable-context.js";
@@ -291,7 +291,13 @@ export const CanonicalStreamEventSchema = z.discriminatedUnion("type", [
291
291
  }),
292
292
  z.strictObject({
293
293
  type: z.literal("status"),
294
- status: z.enum(["started", "processing", "completed", "failed"]),
294
+ status: z.enum([
295
+ "started",
296
+ "processing",
297
+ "completed",
298
+ "failed",
299
+ "cancelled",
300
+ ]),
295
301
  detail: boundedStringSchema.optional(),
296
302
  }),
297
303
  z.strictObject({
@@ -6,6 +6,7 @@ export type MessagePartUpdatedEvent = {
6
6
  part: Part;
7
7
  delta?: string;
8
8
  };
9
+ export type StreamStatus = "started" | "processing" | "completed" | "failed" | "cancelled";
9
10
  export type StreamEvent = MessagePartUpdatedEvent | {
10
11
  type: "tool-heartbeat";
11
12
  toolName: string;
@@ -24,7 +25,7 @@ export type StreamEvent = MessagePartUpdatedEvent | {
24
25
  elapsedMs?: number;
25
26
  } | {
26
27
  type: "status";
27
- status: "started" | "processing" | "completed" | "failed";
28
+ status: StreamStatus;
28
29
  detail?: string;
29
30
  } | {
30
31
  type: "warning";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-interface",
3
- "version": "0.51.0",
3
+ "version": "0.52.0",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "license": "MIT",