@tangle-network/agent-interface 5.10.3 → 5.10.4
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.
|
@@ -7,7 +7,7 @@ import type { AgentProfile, AgentProfileCapabilities, AgentProfileValidationResu
|
|
|
7
7
|
import type { InputPart } from "./parts.js";
|
|
8
8
|
import type { StreamEvent } from "./stream-events.js";
|
|
9
9
|
import { type TokenUsage } from "./execution-types.js";
|
|
10
|
-
import { type InteractionAcknowledgement, type InteractionCapabilities, type InteractionResponseCommand, type RequestedInteractions } from "./interaction.js";
|
|
10
|
+
import { type InteractionAcknowledgement, type InteractionCapabilities, type InteractionResponseCommand, type InteractionStateReader, type RequestedInteractions } from "./interaction.js";
|
|
11
11
|
import { type ContextTransferReceipt, type ContextTransferRequest, type ContextTransferResult, type NativeContextBoundaryProof, type NativeContextContinuationRequest, type NativeContextContinuationTurn } from "./portable-context.js";
|
|
12
12
|
import { type AgentExactRunControlRef, type AgentRunCancellationAcknowledgement, type AgentRunCancellationRequest, type AgentRunControlRef } from "./runtime-control.js";
|
|
13
13
|
import type { AgentWorkspaceBranching, AgentWorkspaceBranchingProvider } from "./workspace-branching.js";
|
|
@@ -1280,7 +1280,7 @@ export interface AgentEnvironmentEvent {
|
|
|
1280
1280
|
usageMode?: "delta" | "cumulative";
|
|
1281
1281
|
providerEvent?: unknown;
|
|
1282
1282
|
}
|
|
1283
|
-
export interface AgentSession {
|
|
1283
|
+
export interface AgentSession extends InteractionStateReader {
|
|
1284
1284
|
readonly id: string;
|
|
1285
1285
|
readonly controlRef?: AgentRunControlRef;
|
|
1286
1286
|
status(options?: {
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** Delivery is independent of recording a response; only delivered proves its native effect. */
|
|
3
|
+
export declare const InteractionResolutionDeliveryStateSchema: z.ZodEnum<{
|
|
4
|
+
pending: "pending";
|
|
5
|
+
delivering: "delivering";
|
|
6
|
+
delivered: "delivered";
|
|
7
|
+
delivery_failed: "delivery_failed";
|
|
8
|
+
backend_lost: "backend_lost";
|
|
9
|
+
effect_unknown: "effect_unknown";
|
|
10
|
+
}>;
|
|
11
|
+
export type InteractionResolutionDeliveryState = z.infer<typeof InteractionResolutionDeliveryStateSchema>;
|
|
12
|
+
/** Durable resolution metadata, including legacy records without an exact binding. */
|
|
13
|
+
export declare const InteractionResolutionAcknowledgementSchema: z.ZodObject<{
|
|
14
|
+
status: z.ZodEnum<{
|
|
15
|
+
accepted: "accepted";
|
|
16
|
+
already_resolved_same: "already_resolved_same";
|
|
17
|
+
}>;
|
|
18
|
+
operationId: z.ZodString;
|
|
19
|
+
responseDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
20
|
+
interactionId: z.ZodString;
|
|
21
|
+
sessionId: z.ZodString;
|
|
22
|
+
outcome: z.ZodEnum<{
|
|
23
|
+
cancelled: "cancelled";
|
|
24
|
+
accepted: "accepted";
|
|
25
|
+
declined: "declined";
|
|
26
|
+
}>;
|
|
27
|
+
deliveryState: z.ZodEnum<{
|
|
28
|
+
pending: "pending";
|
|
29
|
+
delivering: "delivering";
|
|
30
|
+
delivered: "delivered";
|
|
31
|
+
delivery_failed: "delivery_failed";
|
|
32
|
+
backend_lost: "backend_lost";
|
|
33
|
+
effect_unknown: "effect_unknown";
|
|
34
|
+
}>;
|
|
35
|
+
delivered: z.ZodBoolean;
|
|
36
|
+
resolvedAt: z.ZodString;
|
|
37
|
+
binding: z.ZodOptional<z.ZodObject<{
|
|
38
|
+
requestDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
39
|
+
runId: z.ZodString;
|
|
40
|
+
provider: z.ZodString;
|
|
41
|
+
environmentId: z.ZodString;
|
|
42
|
+
sessionId: z.ZodString;
|
|
43
|
+
executionId: z.ZodString;
|
|
44
|
+
interactionId: z.ZodString;
|
|
45
|
+
}, z.core.$strict>>;
|
|
46
|
+
}, z.core.$strict>;
|
|
47
|
+
export type InteractionResolutionAcknowledgement = z.infer<typeof InteractionResolutionAcknowledgementSchema>;
|
|
48
|
+
/** Owner truth at one read; an absent owner and an empty outstanding set are different facts. */
|
|
49
|
+
export declare const InteractionSnapshotSchema: z.ZodObject<{
|
|
50
|
+
availability: z.ZodEnum<{
|
|
51
|
+
unavailable: "unavailable";
|
|
52
|
+
available: "available";
|
|
53
|
+
missing: "missing";
|
|
54
|
+
}>;
|
|
55
|
+
sessionId: z.ZodString;
|
|
56
|
+
executionId: z.ZodOptional<z.ZodString>;
|
|
57
|
+
interactions: z.ZodArray<z.ZodObject<{
|
|
58
|
+
requestDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
59
|
+
id: z.ZodString;
|
|
60
|
+
kind: z.ZodString;
|
|
61
|
+
title: z.ZodString;
|
|
62
|
+
body: z.ZodOptional<z.ZodString>;
|
|
63
|
+
subject: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
64
|
+
type: z.ZodLiteral<"tool">;
|
|
65
|
+
toolName: z.ZodString;
|
|
66
|
+
input: z.ZodOptional<z.ZodCustom<unknown, unknown>>;
|
|
67
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
68
|
+
type: z.ZodLiteral<"command">;
|
|
69
|
+
command: z.ZodString;
|
|
70
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
71
|
+
type: z.ZodLiteral<"file">;
|
|
72
|
+
path: z.ZodString;
|
|
73
|
+
preview: z.ZodOptional<z.ZodString>;
|
|
74
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
75
|
+
type: z.ZodLiteral<"resource">;
|
|
76
|
+
uri: z.ZodString;
|
|
77
|
+
}, z.core.$strict>], "type">>;
|
|
78
|
+
answerSpec: z.ZodObject<{
|
|
79
|
+
fields: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
80
|
+
type: z.ZodLiteral<"text">;
|
|
81
|
+
multiline: z.ZodOptional<z.ZodBoolean>;
|
|
82
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
83
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
84
|
+
default: z.ZodOptional<z.ZodString>;
|
|
85
|
+
name: z.ZodString;
|
|
86
|
+
label: z.ZodString;
|
|
87
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
88
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
89
|
+
type: z.ZodLiteral<"number">;
|
|
90
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
91
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
92
|
+
default: z.ZodOptional<z.ZodNumber>;
|
|
93
|
+
name: z.ZodString;
|
|
94
|
+
label: z.ZodString;
|
|
95
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
96
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
97
|
+
type: z.ZodLiteral<"boolean">;
|
|
98
|
+
default: z.ZodOptional<z.ZodBoolean>;
|
|
99
|
+
name: z.ZodString;
|
|
100
|
+
label: z.ZodString;
|
|
101
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
102
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
103
|
+
type: z.ZodLiteral<"select">;
|
|
104
|
+
options: z.ZodArray<z.ZodObject<{
|
|
105
|
+
value: z.ZodString;
|
|
106
|
+
label: z.ZodString;
|
|
107
|
+
description: z.ZodOptional<z.ZodString>;
|
|
108
|
+
}, z.core.$strict>>;
|
|
109
|
+
multi: z.ZodOptional<z.ZodBoolean>;
|
|
110
|
+
allowCustom: z.ZodOptional<z.ZodBoolean>;
|
|
111
|
+
default: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
112
|
+
name: z.ZodString;
|
|
113
|
+
label: z.ZodString;
|
|
114
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
115
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
116
|
+
type: z.ZodLiteral<"secret">;
|
|
117
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
118
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
119
|
+
name: z.ZodString;
|
|
120
|
+
label: z.ZodString;
|
|
121
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
122
|
+
}, z.core.$strict>], "type">>;
|
|
123
|
+
}, z.core.$strict>;
|
|
124
|
+
responseScopes: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
125
|
+
interaction: "interaction";
|
|
126
|
+
session: "session";
|
|
127
|
+
persistent: "persistent";
|
|
128
|
+
}>>>;
|
|
129
|
+
allowedOutcomes: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
130
|
+
cancelled: "cancelled";
|
|
131
|
+
accepted: "accepted";
|
|
132
|
+
declined: "declined";
|
|
133
|
+
}>>>;
|
|
134
|
+
default: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
135
|
+
outcome: z.ZodLiteral<"accepted">;
|
|
136
|
+
data: z.ZodOptional<z.ZodType<Record<string, import("./interaction-data.js").InteractionDataValue>, unknown, z.core.$ZodTypeInternals<Record<string, import("./interaction-data.js").InteractionDataValue>, unknown>>>;
|
|
137
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
138
|
+
outcome: z.ZodLiteral<"declined">;
|
|
139
|
+
data: z.ZodOptional<z.ZodType<Record<string, import("./interaction-data.js").InteractionDataValue>, unknown, z.core.$ZodTypeInternals<Record<string, import("./interaction-data.js").InteractionDataValue>, unknown>>>;
|
|
140
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
141
|
+
outcome: z.ZodLiteral<"cancelled">;
|
|
142
|
+
data: z.ZodOptional<z.ZodType<Record<string, import("./interaction-data.js").InteractionDataValue>, unknown, z.core.$ZodTypeInternals<Record<string, import("./interaction-data.js").InteractionDataValue>, unknown>>>;
|
|
143
|
+
}, z.core.$strict>], "outcome">>;
|
|
144
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
145
|
+
onTimeout: z.ZodOptional<z.ZodEnum<{
|
|
146
|
+
default: "default";
|
|
147
|
+
fail: "fail";
|
|
148
|
+
wait: "wait";
|
|
149
|
+
}>>;
|
|
150
|
+
binding: z.ZodObject<{
|
|
151
|
+
runId: z.ZodString;
|
|
152
|
+
provider: z.ZodString;
|
|
153
|
+
environmentId: z.ZodString;
|
|
154
|
+
sessionId: z.ZodString;
|
|
155
|
+
executionId: z.ZodString;
|
|
156
|
+
interactionId: z.ZodString;
|
|
157
|
+
}, z.core.$strict>;
|
|
158
|
+
}, z.core.$strict>>;
|
|
159
|
+
resolutions: z.ZodArray<z.ZodObject<{
|
|
160
|
+
status: z.ZodEnum<{
|
|
161
|
+
accepted: "accepted";
|
|
162
|
+
already_resolved_same: "already_resolved_same";
|
|
163
|
+
}>;
|
|
164
|
+
operationId: z.ZodString;
|
|
165
|
+
responseDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
166
|
+
interactionId: z.ZodString;
|
|
167
|
+
sessionId: z.ZodString;
|
|
168
|
+
outcome: z.ZodEnum<{
|
|
169
|
+
cancelled: "cancelled";
|
|
170
|
+
accepted: "accepted";
|
|
171
|
+
declined: "declined";
|
|
172
|
+
}>;
|
|
173
|
+
deliveryState: z.ZodEnum<{
|
|
174
|
+
pending: "pending";
|
|
175
|
+
delivering: "delivering";
|
|
176
|
+
delivered: "delivered";
|
|
177
|
+
delivery_failed: "delivery_failed";
|
|
178
|
+
backend_lost: "backend_lost";
|
|
179
|
+
effect_unknown: "effect_unknown";
|
|
180
|
+
}>;
|
|
181
|
+
delivered: z.ZodBoolean;
|
|
182
|
+
resolvedAt: z.ZodString;
|
|
183
|
+
binding: z.ZodOptional<z.ZodObject<{
|
|
184
|
+
requestDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
185
|
+
runId: z.ZodString;
|
|
186
|
+
provider: z.ZodString;
|
|
187
|
+
environmentId: z.ZodString;
|
|
188
|
+
sessionId: z.ZodString;
|
|
189
|
+
executionId: z.ZodString;
|
|
190
|
+
interactionId: z.ZodString;
|
|
191
|
+
}, z.core.$strict>>;
|
|
192
|
+
}, z.core.$strict>>;
|
|
193
|
+
}, z.core.$strict>;
|
|
194
|
+
export type InteractionSnapshot = z.infer<typeof InteractionSnapshotSchema>;
|
|
195
|
+
export interface InteractionReadOptions {
|
|
196
|
+
state: true;
|
|
197
|
+
executionId?: string;
|
|
198
|
+
signal?: AbortSignal;
|
|
199
|
+
}
|
|
200
|
+
/** Optional owner-read capability; existing session implementations remain valid. */
|
|
201
|
+
export interface InteractionStateReader {
|
|
202
|
+
interactions?(options: InteractionReadOptions): Promise<InteractionSnapshot>;
|
|
203
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { sha256DigestSchema } from "./agent-candidate-schema-common.js";
|
|
3
|
+
import { CONTRACT_MAX_ARRAY_LENGTH } from "./contract-limits.js";
|
|
4
|
+
import { InteractionBindingSchema, InteractionRequestSchema } from "./interaction-envelope.js";
|
|
5
|
+
/** Delivery is independent of recording a response; only delivered proves its native effect. */
|
|
6
|
+
export const InteractionResolutionDeliveryStateSchema = z.enum([
|
|
7
|
+
"pending", "delivering", "delivered", "delivery_failed", "backend_lost", "effect_unknown",
|
|
8
|
+
]);
|
|
9
|
+
/** Durable resolution metadata, including legacy records without an exact binding. */
|
|
10
|
+
export const InteractionResolutionAcknowledgementSchema = z.strictObject({
|
|
11
|
+
status: z.enum(["accepted", "already_resolved_same"]),
|
|
12
|
+
operationId: z.string().min(1),
|
|
13
|
+
responseDigest: sha256DigestSchema,
|
|
14
|
+
interactionId: z.string().min(1),
|
|
15
|
+
sessionId: z.string().min(1),
|
|
16
|
+
outcome: z.enum(["accepted", "declined", "cancelled"]),
|
|
17
|
+
deliveryState: InteractionResolutionDeliveryStateSchema,
|
|
18
|
+
delivered: z.boolean(),
|
|
19
|
+
resolvedAt: z.string().min(1),
|
|
20
|
+
binding: InteractionBindingSchema.optional(),
|
|
21
|
+
});
|
|
22
|
+
/** Owner truth at one read; an absent owner and an empty outstanding set are different facts. */
|
|
23
|
+
export const InteractionSnapshotSchema = z.strictObject({
|
|
24
|
+
availability: z.enum(["available", "missing", "unavailable"]),
|
|
25
|
+
sessionId: InteractionBindingSchema.shape.sessionId,
|
|
26
|
+
executionId: InteractionBindingSchema.shape.executionId.optional(),
|
|
27
|
+
interactions: z.array(InteractionRequestSchema).max(CONTRACT_MAX_ARRAY_LENGTH),
|
|
28
|
+
resolutions: z.array(InteractionResolutionAcknowledgementSchema).max(CONTRACT_MAX_ARRAY_LENGTH),
|
|
29
|
+
});
|
package/dist/interaction.d.ts
CHANGED
package/dist/interaction.js
CHANGED