@finalai/agent-provider 0.5.1 → 0.6.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.
@@ -0,0 +1,370 @@
1
+ import type { HostedBindingsIface } from "./hosted-bindings.mjs";
2
+ import type { ContentBlock, SessionUpdate } from '@agentclientprotocol/sdk/experimental/v2';
3
+ import type { SessionUpdateKind } from '@finalai/acp-session';
4
+ import * as z from 'zod';
5
+ import { type JsonObject, type JsonValue } from "./json.mjs";
6
+ import type { ProviderRef } from "./provider-ref.mjs";
7
+ import type { SemanticChannelEventKind } from "./semantic-events.mjs";
8
+ export declare enum ChannelPrincipalType {
9
+ User = "user",
10
+ Service = "service"
11
+ }
12
+ export interface ChannelAuthIface extends JsonObject {
13
+ principalId: string;
14
+ principalType: ChannelPrincipalType | `${ChannelPrincipalType}`;
15
+ authenticator: string;
16
+ attributes: JsonObject;
17
+ }
18
+ export declare const channelAuthSchema: z.ZodObject<{
19
+ principalId: z.ZodString;
20
+ principalType: z.ZodEnum<typeof ChannelPrincipalType>;
21
+ authenticator: z.ZodString;
22
+ displayName: z.ZodOptional<z.ZodString>;
23
+ attributes: z.ZodDefault<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
24
+ }, z.core.$strip>;
25
+ export declare const principalDisplayName: (auth: ChannelAuthIface) => string;
26
+ export declare enum ConversationKind {
27
+ Direct = "direct",
28
+ Group = "group"
29
+ }
30
+ export declare enum ParticipantKind {
31
+ User = "user",
32
+ Agent = "agent"
33
+ }
34
+ export declare enum RoutingMode {
35
+ Mention = "mention",
36
+ All = "all",
37
+ Default = "default"
38
+ }
39
+ export declare enum TurnPolicy {
40
+ Steer = "steer",
41
+ Queue = "queue"
42
+ }
43
+ export declare enum Delivery {
44
+ Prompt = "prompt",
45
+ Observe = "observe"
46
+ }
47
+ export declare enum MessageKind {
48
+ Message = "message",
49
+ Card = "card"
50
+ }
51
+ export declare enum CardKind {
52
+ Elicitation = "elicitation",
53
+ Permission = "permission",
54
+ Notice = "notice"
55
+ }
56
+ export interface ParticipantIface {
57
+ id: string;
58
+ kind: ParticipantKind;
59
+ displayName: string;
60
+ userId: string | null;
61
+ definitionId: string | null;
62
+ routingMode: RoutingMode | null;
63
+ sessionId: string | null;
64
+ supportsObserve: boolean | null;
65
+ rendersAuthorMeta: boolean | null;
66
+ left: boolean;
67
+ }
68
+ export declare const roomReceiveResultSchema: z.ZodUnion<readonly [z.ZodObject<{
69
+ conversationId: z.ZodString;
70
+ }, z.core.$strip>, z.ZodObject<{
71
+ sessionId: z.ZodString;
72
+ }, z.core.$strip>, z.ZodNull]>;
73
+ export type RoomReceiveResult = z.infer<typeof roomReceiveResultSchema>;
74
+ export interface ConversationRefIface {
75
+ conversationId: string;
76
+ }
77
+ export interface ConversationIface extends ConversationRefIface {
78
+ organizationId: string;
79
+ kind: ConversationKind;
80
+ title: string | null;
81
+ isHome: boolean;
82
+ turnPolicy: TurnPolicy;
83
+ }
84
+ export interface MessageRefIface {
85
+ messageId: string;
86
+ seq: number;
87
+ }
88
+ export interface ConversationMessageIface extends MessageRefIface {
89
+ conversationId: string;
90
+ authorParticipantId: string;
91
+ kind: MessageKind;
92
+ body: string;
93
+ content: ContentBlock[];
94
+ replyToMessageId: string | null;
95
+ threadRootId: string | null;
96
+ quotedMessageIds: string[];
97
+ mentionedParticipantIds: string[];
98
+ hopDepth: number;
99
+ agentAuthorDefinitionId?: string | null;
100
+ createdAt: string;
101
+ }
102
+ export interface RouteArgsIface {
103
+ conversation: ConversationIface;
104
+ message: ConversationMessageIface;
105
+ participants: ParticipantIface[];
106
+ agentParticipantId?: string;
107
+ }
108
+ export interface RouteDecisionIface {
109
+ participantId: string;
110
+ delivery: Delivery;
111
+ }
112
+ export interface PostMessageArgsIface {
113
+ conversationId: string;
114
+ authorParticipantId: string;
115
+ kind?: MessageKind;
116
+ content: ContentBlock[];
117
+ replyToMessageId?: string | null;
118
+ threadRootId?: string | null;
119
+ quotedMessageIds?: string[];
120
+ clientMessageId?: string | null;
121
+ mentionedParticipantIds?: string[];
122
+ attachmentIds?: string[];
123
+ hopDepth?: number;
124
+ originTurnId?: string | null;
125
+ source?: {
126
+ turnId: string;
127
+ fromSeq: number;
128
+ toSeq: number;
129
+ } | null;
130
+ }
131
+ export declare const channelMessageInputSchema: z.ZodObject<{
132
+ conversationId: z.ZodString;
133
+ authorParticipantId: z.ZodString;
134
+ kind: z.ZodDefault<z.ZodEnum<typeof MessageKind>>;
135
+ content: z.ZodArray<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
136
+ clientMessageId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
137
+ replyToMessageId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
138
+ threadRootId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
139
+ quotedMessageIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
140
+ mentionedParticipantIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
141
+ }, z.core.$strip>;
142
+ export interface CardArgsIface {
143
+ conversationId: string;
144
+ authorParticipantId: string;
145
+ kind: CardKind;
146
+ decisionId: string | null;
147
+ state: JsonObject;
148
+ entityLinks: {
149
+ kind: string;
150
+ id: string;
151
+ title?: string;
152
+ url?: string;
153
+ description?: string;
154
+ imageUrl?: string;
155
+ }[];
156
+ }
157
+ export interface PromptArgsIface {
158
+ waitForAcceptance?: boolean;
159
+ channelBinding?: {
160
+ id: string;
161
+ revisionId: string;
162
+ };
163
+ auth?: ChannelAuthIface | null;
164
+ title?: string;
165
+ participantId: string;
166
+ content: ContentBlock[];
167
+ turnPolicy: TurnPolicy;
168
+ replyExpected: boolean;
169
+ idempotencyKey: string;
170
+ authorParticipantId: string;
171
+ actingUserId?: string | null;
172
+ audienceParticipantIds: string[];
173
+ sourceMessageId: string;
174
+ }
175
+ export interface ObserveArgsIface {
176
+ participantId: string;
177
+ content: ContentBlock[];
178
+ idempotencyKey: string;
179
+ }
180
+ export interface RoomPlatformIface {
181
+ conversations: {
182
+ get(conversationId: string): Promise<ConversationIface | null>;
183
+ createAttachmentUpload?(args: {
184
+ conversationId: string;
185
+ name: string;
186
+ contentType: string;
187
+ sizeBytes: number;
188
+ }): Promise<{
189
+ attachmentId: string;
190
+ uploadUrl: string;
191
+ method: string;
192
+ headers: Record<string, string>;
193
+ expiresAt: string;
194
+ }>;
195
+ getAttachmentUrl?(args: {
196
+ conversationId: string;
197
+ attachmentId: string;
198
+ }): Promise<{
199
+ attachmentId: string;
200
+ url: string;
201
+ expiresAt: string;
202
+ }>;
203
+ dispatchMessage?(args: {
204
+ conversationId: string;
205
+ messageId: string;
206
+ participantId?: string;
207
+ requestedDelivery?: Delivery;
208
+ }): Promise<void>;
209
+ participants(conversationId: string): Promise<ParticipantIface[]>;
210
+ postMessage(args: PostMessageArgsIface): Promise<ConversationMessageIface>;
211
+ updateMessage(args: {
212
+ messageId: string;
213
+ content: ContentBlock[];
214
+ final: boolean;
215
+ }): Promise<void>;
216
+ postCard(args: CardArgsIface): Promise<ConversationMessageIface>;
217
+ updateCard(args: {
218
+ messageId: string;
219
+ state: JsonObject;
220
+ }): Promise<void>;
221
+ recentMessages(args: {
222
+ conversationId: string;
223
+ limit: number;
224
+ beforeSeq?: number;
225
+ afterSeq?: number;
226
+ }): Promise<ConversationMessageIface[]>;
227
+ getMessages(args: {
228
+ conversationId: string;
229
+ messageIds: string[];
230
+ }): Promise<ConversationMessageIface[]>;
231
+ };
232
+ sessions: {
233
+ prompt(args: PromptArgsIface): Promise<{
234
+ messageId: string;
235
+ sessionId?: string;
236
+ turnId?: string;
237
+ }>;
238
+ observe(args: ObserveArgsIface): Promise<void>;
239
+ cancel(args: {
240
+ participantId: string;
241
+ reason?: string;
242
+ throughMessageSeq?: number;
243
+ }): Promise<void>;
244
+ respond?(args: ChannelInputResponseIface): Promise<{
245
+ resolved: boolean;
246
+ }>;
247
+ };
248
+ log(message: string, details?: Record<string, JsonValue>): void;
249
+ }
250
+ export interface ChannelInputResponseIface {
251
+ channelBinding?: {
252
+ id: string;
253
+ revisionId: string;
254
+ };
255
+ auth?: ChannelAuthIface | null;
256
+ participantId: string;
257
+ decisionId: string;
258
+ outcome: JsonValue;
259
+ actorParticipantId: string;
260
+ userId: string | null;
261
+ }
262
+ export interface RoomReceiveContextIface {
263
+ bindings?: HostedBindingsIface;
264
+ platform: RoomPlatformIface;
265
+ organizationId: string;
266
+ definitionId: string | null;
267
+ bindingId: string | null;
268
+ config: JsonObject;
269
+ secrets: {
270
+ get(name: string): Promise<string | null>;
271
+ };
272
+ agentParticipantId?: string;
273
+ message?: ConversationMessageIface;
274
+ conversation?: ConversationIface;
275
+ participants?: readonly ParticipantIface[];
276
+ response?: ChannelInputResponseIface;
277
+ conversationId?: string;
278
+ cancelReason?: string;
279
+ cancelThroughMessageSeq?: number;
280
+ requestedDelivery?: Delivery;
281
+ }
282
+ export interface ChannelSocketIface {
283
+ readonly signal: AbortSignal;
284
+ readonly messages: AsyncIterable<string | Uint8Array>;
285
+ accept(options?: {
286
+ protocol?: string;
287
+ }): void;
288
+ send(data: string | Uint8Array): void;
289
+ close(code?: number, reason?: string): void;
290
+ }
291
+ export interface ChannelTurnStateIface<State> {
292
+ get(): State | null;
293
+ set(state: State | null): void;
294
+ }
295
+ export interface ProjectionContextIface<State = JsonValue> {
296
+ bindings?: HostedBindingsIface;
297
+ sessionId?: string;
298
+ platform: RoomPlatformIface;
299
+ config: JsonObject;
300
+ secrets: {
301
+ get(name: string): Promise<string | null>;
302
+ };
303
+ conversation: ConversationIface | null;
304
+ agentParticipant: ParticipantIface | null;
305
+ turn: {
306
+ id: string;
307
+ promptMessageId: string | null;
308
+ authorParticipantId: string | null;
309
+ };
310
+ seq: number;
311
+ state: ChannelTurnStateIface<State>;
312
+ }
313
+ export declare enum DecisionEventKind {
314
+ Created = "decision.created",
315
+ Resolved = "decision.resolved"
316
+ }
317
+ export type AcpUpdateKind = SessionUpdate['sessionUpdate'];
318
+ export type KnownAcpUpdateKind = `${SessionUpdateKind}`;
319
+ export type RoomEventKind = AcpUpdateKind | `${DecisionEventKind}` | `${SemanticChannelEventKind}`;
320
+ export interface ChannelEventIface {
321
+ type: string;
322
+ data: JsonValue;
323
+ seq: number;
324
+ }
325
+ export type RoomEventHandler<State = JsonValue> = (event: ChannelEventIface, ctx: ProjectionContextIface<State>) => Promise<void>;
326
+ export declare enum DecisionKind {
327
+ Permission = "permission",
328
+ Elicitation = "elicitation"
329
+ }
330
+ export declare const decisionCreatedDataSchema: z.ZodObject<{
331
+ decisionId: z.ZodString;
332
+ kind: z.ZodEnum<typeof DecisionKind>;
333
+ audienceParticipantIds: z.ZodArray<z.ZodString>;
334
+ request: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
335
+ }, z.core.$strip>;
336
+ export type DecisionCreatedDataIface = z.infer<typeof decisionCreatedDataSchema>;
337
+ export declare const decisionResolvedDataSchema: z.ZodObject<{
338
+ decisionId: z.ZodString;
339
+ outcome: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
340
+ respondedBy: z.ZodDefault<z.ZodNullable<z.ZodObject<{
341
+ principalId: z.ZodString;
342
+ principalType: z.ZodEnum<typeof ChannelPrincipalType>;
343
+ authenticator: z.ZodString;
344
+ displayName: z.ZodOptional<z.ZodString>;
345
+ attributes: z.ZodDefault<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
346
+ }, z.core.$strip>>>;
347
+ }, z.core.$strip>;
348
+ export type DecisionResolvedDataIface = z.infer<typeof decisionResolvedDataSchema>;
349
+ export declare const PROJECTED_UPDATE_KINDS: ReadonlySet<AcpUpdateKind>;
350
+ export declare const turnEndOf: (update: SessionUpdate) => {
351
+ stopReason: string | null;
352
+ } | null;
353
+ export declare const turnEndUpdate: (stopReason: string | null) => SessionUpdate;
354
+ export interface RoomSurfaceDefinitionIface<Inbound, State = undefined> {
355
+ config?: JsonObject;
356
+ installed?: ProviderRef;
357
+ configure?: (config: JsonObject) => RoomSurfaceDefinitionIface<Inbound, State>;
358
+ respond?(input: ChannelInputResponseIface, ctx: RoomReceiveContextIface): Promise<{
359
+ resolved: boolean;
360
+ }>;
361
+ cancel?(ctx: RoomReceiveContextIface): Promise<{
362
+ accepted: boolean;
363
+ }>;
364
+ receive(input: Inbound, ctx: RoomReceiveContextIface): Promise<RoomReceiveResult>;
365
+ route(args: RouteArgsIface): RouteDecisionIface[] | Promise<RouteDecisionIface[]>;
366
+ turnPolicy: TurnPolicy;
367
+ project(update: SessionUpdate, ctx: ProjectionContextIface<State>): Promise<void>;
368
+ events?: Partial<Record<RoomEventKind, RoomEventHandler<State>>>;
369
+ }
370
+ export declare const defineRoomSurface: <Inbound, State = undefined>(definition: RoomSurfaceDefinitionIface<Inbound, State>) => RoomSurfaceDefinitionIface<Inbound, State>;
@@ -0,0 +1,156 @@
1
+ import * as z from "zod";
2
+ import { jsonObjectSchema, jsonValueSchema } from "./json.mjs";
3
+ var ChannelPrincipalType = /* @__PURE__ */ ((ChannelPrincipalType2) => {
4
+ ChannelPrincipalType2["User"] = "user";
5
+ ChannelPrincipalType2["Service"] = "service";
6
+ return ChannelPrincipalType2;
7
+ })(ChannelPrincipalType || {});
8
+ const channelAuthSchema = z.object({
9
+ principalId: z.string().min(1),
10
+ principalType: z.nativeEnum(ChannelPrincipalType),
11
+ authenticator: z.string().min(1),
12
+ // How the agent and the people reading its reply name the principal.
13
+ displayName: z.string().min(1).max(200).optional(),
14
+ attributes: jsonObjectSchema.default({})
15
+ });
16
+ const principalDisplayName = (auth) => {
17
+ const name = auth["displayName"];
18
+ return typeof name === "string" && name.length > 0 ? name : auth.principalId;
19
+ };
20
+ var ConversationKind = /* @__PURE__ */ ((ConversationKind2) => {
21
+ ConversationKind2["Direct"] = "direct";
22
+ ConversationKind2["Group"] = "group";
23
+ return ConversationKind2;
24
+ })(ConversationKind || {});
25
+ var ParticipantKind = /* @__PURE__ */ ((ParticipantKind2) => {
26
+ ParticipantKind2["User"] = "user";
27
+ ParticipantKind2["Agent"] = "agent";
28
+ return ParticipantKind2;
29
+ })(ParticipantKind || {});
30
+ var RoutingMode = /* @__PURE__ */ ((RoutingMode2) => {
31
+ RoutingMode2["Mention"] = "mention";
32
+ RoutingMode2["All"] = "all";
33
+ RoutingMode2["Default"] = "default";
34
+ return RoutingMode2;
35
+ })(RoutingMode || {});
36
+ var TurnPolicy = /* @__PURE__ */ ((TurnPolicy2) => {
37
+ TurnPolicy2["Steer"] = "steer";
38
+ TurnPolicy2["Queue"] = "queue";
39
+ return TurnPolicy2;
40
+ })(TurnPolicy || {});
41
+ var Delivery = /* @__PURE__ */ ((Delivery2) => {
42
+ Delivery2["Prompt"] = "prompt";
43
+ Delivery2["Observe"] = "observe";
44
+ return Delivery2;
45
+ })(Delivery || {});
46
+ var MessageKind = /* @__PURE__ */ ((MessageKind2) => {
47
+ MessageKind2["Message"] = "message";
48
+ MessageKind2["Card"] = "card";
49
+ return MessageKind2;
50
+ })(MessageKind || {});
51
+ var CardKind = /* @__PURE__ */ ((CardKind2) => {
52
+ CardKind2["Elicitation"] = "elicitation";
53
+ CardKind2["Permission"] = "permission";
54
+ CardKind2["Notice"] = "notice";
55
+ return CardKind2;
56
+ })(CardKind || {});
57
+ const roomReceiveResultSchema = z.union([
58
+ z.object({ conversationId: z.string().min(1) }),
59
+ z.object({ sessionId: z.string().min(1) }),
60
+ z.null()
61
+ ]);
62
+ const channelMessageInputSchema = z.object({
63
+ conversationId: z.string().min(1),
64
+ authorParticipantId: z.string().min(1),
65
+ kind: z.nativeEnum(MessageKind).default("message" /* Message */),
66
+ content: z.array(jsonObjectSchema).min(1),
67
+ clientMessageId: z.string().min(1).nullish(),
68
+ replyToMessageId: z.string().min(1).nullish(),
69
+ threadRootId: z.string().min(1).nullish(),
70
+ quotedMessageIds: z.array(z.string().min(1)).default([]),
71
+ mentionedParticipantIds: z.array(z.string().min(1)).default([])
72
+ });
73
+ var DecisionEventKind = /* @__PURE__ */ ((DecisionEventKind2) => {
74
+ DecisionEventKind2["Created"] = "decision.created";
75
+ DecisionEventKind2["Resolved"] = "decision.resolved";
76
+ return DecisionEventKind2;
77
+ })(DecisionEventKind || {});
78
+ var DecisionKind = /* @__PURE__ */ ((DecisionKind2) => {
79
+ DecisionKind2["Permission"] = "permission";
80
+ DecisionKind2["Elicitation"] = "elicitation";
81
+ return DecisionKind2;
82
+ })(DecisionKind || {});
83
+ const decisionCreatedDataSchema = z.object({
84
+ decisionId: z.string().min(1),
85
+ kind: z.nativeEnum(DecisionKind),
86
+ audienceParticipantIds: z.array(z.string()),
87
+ request: jsonValueSchema
88
+ });
89
+ const decisionResolvedDataSchema = z.object({
90
+ decisionId: z.string().min(1),
91
+ outcome: jsonValueSchema,
92
+ respondedBy: channelAuthSchema.nullable().default(null)
93
+ });
94
+ const PROJECTED_UPDATE_KINDS = /* @__PURE__ */ new Set([
95
+ "agent_message_chunk",
96
+ "agent_message"
97
+ ]);
98
+ const turnEndSchema = z.looseObject({
99
+ sessionUpdate: z.literal("state_update"),
100
+ state: z.literal("idle"),
101
+ stopReason: z.string().nullish(),
102
+ _meta: z.looseObject({ "final.ai": z.looseObject({ stopReason: z.string().nullish() }).nullish() }).nullish()
103
+ });
104
+ const turnEndOf = (update) => {
105
+ const parsed = turnEndSchema.safeParse(update);
106
+ if (!parsed.success) return null;
107
+ return {
108
+ stopReason: parsed.data.stopReason ?? parsed.data._meta?.["final.ai"]?.stopReason ?? null
109
+ };
110
+ };
111
+ const turnEndUpdate = (stopReason) => {
112
+ switch (stopReason) {
113
+ case null:
114
+ return { sessionUpdate: "state_update", state: "idle" };
115
+ case "end_turn":
116
+ return { sessionUpdate: "state_update", state: "idle", stopReason: "end_turn" };
117
+ case "max_tokens":
118
+ return { sessionUpdate: "state_update", state: "idle", stopReason: "max_tokens" };
119
+ case "max_turn_requests":
120
+ return { sessionUpdate: "state_update", state: "idle", stopReason: "max_turn_requests" };
121
+ case "refusal":
122
+ return { sessionUpdate: "state_update", state: "idle", stopReason: "refusal" };
123
+ case "cancelled":
124
+ return { sessionUpdate: "state_update", state: "idle", stopReason: "cancelled" };
125
+ default:
126
+ return {
127
+ sessionUpdate: "state_update",
128
+ state: "idle",
129
+ _meta: { "final.ai": { stopReason } }
130
+ };
131
+ }
132
+ };
133
+ const defineRoomSurface = (definition) => definition;
134
+ export {
135
+ CardKind,
136
+ ChannelPrincipalType,
137
+ ConversationKind,
138
+ DecisionEventKind,
139
+ DecisionKind,
140
+ Delivery,
141
+ MessageKind,
142
+ PROJECTED_UPDATE_KINDS,
143
+ ParticipantKind,
144
+ RoutingMode,
145
+ TurnPolicy,
146
+ channelAuthSchema,
147
+ channelMessageInputSchema,
148
+ decisionCreatedDataSchema,
149
+ decisionResolvedDataSchema,
150
+ defineRoomSurface,
151
+ principalDisplayName,
152
+ roomReceiveResultSchema,
153
+ turnEndOf,
154
+ turnEndUpdate
155
+ };
156
+ //# sourceMappingURL=room-surface.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/room-surface.ts"],
4
+ "sourcesContent": ["import type { HostedBindingsIface } from \"./hosted-bindings.mjs\";\nimport type { ContentBlock, SessionUpdate } from '@agentclientprotocol/sdk/experimental/v2';\nimport type { SessionUpdateKind } from '@finalai/acp-session';\nimport * as z from 'zod';\nimport { jsonObjectSchema, jsonValueSchema, type JsonObject, type JsonValue } from \"./json.mjs\";\nimport type { ProviderRef } from \"./provider-ref.mjs\";\nimport type { SemanticChannelEventKind } from \"./semantic-events.mjs\";\n\n// Contracts for customizing Final chats. Admission callbacks receive the\n// current message and members; renderers and events can post room output.\n// External transports use the separate scoped channel contract.\n\nexport enum ChannelPrincipalType {\n User = 'user',\n Service = 'service',\n}\n\n// Who a channel authenticated for an input or a response. Channels vouch for\n// their principals; one principal per authenticator (`slack:<user>`), so\n// the same person on two surfaces is two principals.\nexport interface ChannelAuthIface extends JsonObject {\n principalId: string;\n principalType: ChannelPrincipalType | `${ChannelPrincipalType}`;\n authenticator: string;\n // `displayName` (a string) when the channel names the principal; see principalDisplayName.\n attributes: JsonObject;\n}\n\nexport const channelAuthSchema = z.object({\n principalId: z.string().min(1),\n principalType: z.nativeEnum(ChannelPrincipalType),\n authenticator: z.string().min(1),\n // How the agent and the people reading its reply name the principal.\n displayName: z.string().min(1).max(200).optional(),\n attributes: jsonObjectSchema.default({}),\n});\n\n// How a principal is named to the agent and in captions: its `displayName`, else its id.\nexport const principalDisplayName = (auth: ChannelAuthIface): string => {\n const name = auth['displayName'];\n return typeof name === 'string' && name.length > 0 ? name : auth.principalId;\n};\n\nexport enum ConversationKind {\n Direct = 'direct',\n Group = 'group',\n}\n\nexport enum ParticipantKind {\n User = 'user',\n Agent = 'agent',\n}\n\nexport enum RoutingMode {\n Mention = 'mention',\n All = 'all',\n Default = 'default',\n}\n\nexport enum TurnPolicy {\n Steer = 'steer',\n Queue = 'queue',\n}\n\nexport enum Delivery {\n Prompt = 'prompt',\n Observe = 'observe',\n}\n\nexport enum MessageKind {\n Message = 'message',\n Card = 'card',\n}\n\nexport enum CardKind {\n Elicitation = 'elicitation',\n Permission = 'permission',\n Notice = 'notice',\n}\n\nexport interface ParticipantIface {\n id: string;\n kind: ParticipantKind;\n displayName: string;\n userId: string | null;\n definitionId: string | null;\n routingMode: RoutingMode | null;\n sessionId: string | null;\n // Whether the agent's harness supports _final/session/observe and renders\n // _meta[\"final.ai\"].author; null for non-agents.\n supportsObserve: boolean | null;\n rendersAuthorMeta: boolean | null;\n left: boolean;\n}\n\nexport const roomReceiveResultSchema = z.union([\n z.object({ conversationId: z.string().min(1) }),\n z.object({ sessionId: z.string().min(1) }),\n z.null(),\n]);\nexport type RoomReceiveResult = z.infer<typeof roomReceiveResultSchema>;\n\nexport interface ConversationRefIface {\n conversationId: string;\n}\n\nexport interface ConversationIface extends ConversationRefIface {\n organizationId: string;\n kind: ConversationKind;\n title: string | null;\n isHome: boolean;\n turnPolicy: TurnPolicy;\n}\n\nexport interface MessageRefIface {\n messageId: string;\n seq: number;\n}\n\nexport interface ConversationMessageIface extends MessageRefIface {\n conversationId: string;\n authorParticipantId: string;\n kind: MessageKind;\n body: string;\n content: ContentBlock[];\n replyToMessageId: string | null;\n threadRootId: string | null;\n // Earlier messages of the conversation the author quoted, in order.\n quotedMessageIds: string[];\n // Agent participant ids explicitly mentioned in the message.\n mentionedParticipantIds: string[];\n // Number of agent-authored hops that led to this message (0 for humans).\n hopDepth: number;\n // The originating agent for a tool-posted message, including linked conversations.\n agentAuthorDefinitionId?: string | null;\n createdAt: string;\n}\n\nexport interface RouteArgsIface {\n conversation: ConversationIface;\n message: ConversationMessageIface;\n participants: ParticipantIface[];\n agentParticipantId?: string;\n}\n\nexport interface RouteDecisionIface {\n participantId: string;\n delivery: Delivery;\n}\n\nexport interface PostMessageArgsIface {\n conversationId: string;\n authorParticipantId: string;\n kind?: MessageKind;\n content: ContentBlock[];\n replyToMessageId?: string | null;\n threadRootId?: string | null;\n quotedMessageIds?: string[];\n clientMessageId?: string | null;\n mentionedParticipantIds?: string[];\n attachmentIds?: string[];\n hopDepth?: number;\n // A tool or linked-conversation event carries the turn that produced it.\n originTurnId?: string | null;\n // Projection provenance for agent replies.\n source?: { turnId: string; fromSeq: number; toSeq: number } | null;\n}\n\nexport const channelMessageInputSchema = z.object({\n conversationId: z.string().min(1),\n authorParticipantId: z.string().min(1),\n kind: z.nativeEnum(MessageKind).default(MessageKind.Message),\n content: z.array(jsonObjectSchema).min(1),\n clientMessageId: z.string().min(1).nullish(),\n replyToMessageId: z.string().min(1).nullish(),\n threadRootId: z.string().min(1).nullish(),\n quotedMessageIds: z.array(z.string().min(1)).default([]),\n mentionedParticipantIds: z.array(z.string().min(1)).default([]),\n});\n\nexport interface CardArgsIface {\n conversationId: string;\n authorParticipantId: string;\n kind: CardKind;\n decisionId: string | null;\n // Generic cards only: a title, body, options, and entity links (a Goal is an\n // entity link, not a card kind).\n state: JsonObject;\n entityLinks: {\n kind: string;\n id: string;\n title?: string;\n url?: string;\n description?: string;\n imageUrl?: string;\n }[];\n}\n\nexport interface PromptArgsIface {\n waitForAcceptance?: boolean;\n channelBinding?: { id: string; revisionId: string };\n auth?: ChannelAuthIface | null;\n title?: string;\n participantId: string;\n content: ContentBlock[];\n turnPolicy: TurnPolicy;\n replyExpected: boolean;\n idempotencyKey: string;\n // Who prompted (for payer resolution and decision audience).\n authorParticipantId: string;\n // The person a prompt from no person acts for (payer and audience).\n actingUserId?: string | null;\n audienceParticipantIds: string[];\n sourceMessageId: string;\n}\n\nexport interface ObserveArgsIface {\n participantId: string;\n content: ContentBlock[];\n idempotencyKey: string;\n}\n\n// Operations available while customizing a Final chat.\nexport interface RoomPlatformIface {\n conversations: {\n get(conversationId: string): Promise<ConversationIface | null>;\n createAttachmentUpload?(args: {\n conversationId: string;\n name: string;\n contentType: string;\n sizeBytes: number;\n }): Promise<{\n attachmentId: string;\n uploadUrl: string;\n method: string;\n headers: Record<string, string>;\n expiresAt: string;\n }>;\n getAttachmentUrl?(args: {\n conversationId: string;\n attachmentId: string;\n }): Promise<{ attachmentId: string; url: string; expiresAt: string }>;\n // Dispatch a stored reply to each recipient's binding; each channel owns routing.\n dispatchMessage?(args: {\n conversationId: string;\n messageId: string;\n participantId?: string;\n requestedDelivery?: Delivery;\n }): Promise<void>;\n participants(conversationId: string): Promise<ParticipantIface[]>;\n postMessage(args: PostMessageArgsIface): Promise<ConversationMessageIface>;\n updateMessage(args: {\n messageId: string;\n content: ContentBlock[];\n final: boolean;\n }): Promise<void>;\n postCard(args: CardArgsIface): Promise<ConversationMessageIface>;\n updateCard(args: { messageId: string; state: JsonObject }): Promise<void>;\n recentMessages(args: {\n conversationId: string;\n limit: number;\n beforeSeq?: number;\n afterSeq?: number;\n }): Promise<ConversationMessageIface[]>;\n // Messages of the conversation by id, however old (reply, thread and quote\n // context outside the recent window); unknown and deleted ones are absent.\n getMessages(args: {\n conversationId: string;\n messageIds: string[];\n }): Promise<ConversationMessageIface[]>;\n };\n sessions: {\n prompt(\n args: PromptArgsIface,\n ): Promise<{ messageId: string; sessionId?: string; turnId?: string }>;\n observe(args: ObserveArgsIface): Promise<void>;\n cancel(args: {\n participantId: string;\n reason?: string;\n throughMessageSeq?: number;\n }): Promise<void>;\n respond?(args: ChannelInputResponseIface): Promise<{ resolved: boolean }>;\n };\n log(message: string, details?: Record<string, JsonValue>): void;\n}\n\nexport interface ChannelInputResponseIface {\n channelBinding?: { id: string; revisionId: string };\n auth?: ChannelAuthIface | null;\n participantId: string;\n decisionId: string;\n outcome: JsonValue;\n actorParticipantId: string;\n userId: string | null;\n}\n\nexport interface RoomReceiveContextIface {\n bindings?: HostedBindingsIface;\n platform: RoomPlatformIface;\n organizationId: string;\n definitionId: string | null;\n bindingId: string | null;\n config: JsonObject;\n secrets: { get(name: string): Promise<string | null> };\n // A stored, authenticated delivery to one agent in a shared conversation.\n agentParticipantId?: string;\n message?: ConversationMessageIface;\n conversation?: ConversationIface;\n participants?: readonly ParticipantIface[];\n response?: ChannelInputResponseIface;\n conversationId?: string;\n cancelReason?: string;\n // Preserve this boundary when forwarding a retryable conversation Stop.\n cancelThroughMessageSeq?: number;\n requestedDelivery?: Delivery;\n}\n\nexport interface ChannelSocketIface {\n readonly signal: AbortSignal;\n readonly messages: AsyncIterable<string | Uint8Array>;\n // Authenticate the request before accepting. The selected protocol must have been offered.\n accept(options?: { protocol?: string }): void;\n send(data: string | Uint8Array): void;\n close(code?: number, reason?: string): void;\n}\n\n// State starts null and persists for the callbacks of one turn.\nexport interface ChannelTurnStateIface<State> {\n get(): State | null;\n set(state: State | null): void;\n}\n\nexport interface ProjectionContextIface<State = JsonValue> {\n bindings?: HostedBindingsIface;\n sessionId?: string;\n platform: RoomPlatformIface;\n // The binding's config and the agent's secrets (manifest.secrets), as receive gets them:\n // a channel posts its replies back to its own service with them.\n config: JsonObject;\n secrets: { get(name: string): Promise<string | null> };\n conversation: ConversationIface | null;\n agentParticipant: ParticipantIface | null;\n turn: { id: string; promptMessageId: string | null; authorParticipantId: string | null };\n seq: number;\n state: ChannelTurnStateIface<State>;\n}\n\nexport enum DecisionEventKind {\n Created = 'decision.created',\n Resolved = 'decision.resolved',\n}\n\nexport type AcpUpdateKind = SessionUpdate['sessionUpdate'];\n// The update kinds ACP v2 names; AcpUpdateKind also admits any other string.\nexport type KnownAcpUpdateKind = `${SessionUpdateKind}`;\n\nexport type RoomEventKind = AcpUpdateKind | `${DecisionEventKind}` | `${SemanticChannelEventKind}`;\n\nexport interface ChannelEventIface {\n type: string;\n data: JsonValue;\n seq: number;\n}\n\nexport type RoomEventHandler<State = JsonValue> = (\n event: ChannelEventIface,\n ctx: ProjectionContextIface<State>,\n) => Promise<void>;\n\nexport enum DecisionKind {\n Permission = 'permission',\n Elicitation = 'elicitation',\n}\n\n// `data` of a decision.created event: an ACP session/request_permission or\n// elicitation/create request awaiting its audience.\nexport const decisionCreatedDataSchema = z.object({\n decisionId: z.string().min(1),\n kind: z.nativeEnum(DecisionKind),\n audienceParticipantIds: z.array(z.string()),\n request: jsonValueSchema,\n});\n\nexport type DecisionCreatedDataIface = z.infer<typeof decisionCreatedDataSchema>;\n\n// `data` of a decision.resolved event: the answer (or cancellation) as recorded,\n// and the principal a channel answered as (null for Final rooms and expiries).\nexport const decisionResolvedDataSchema = z.object({\n decisionId: z.string().min(1),\n outcome: jsonValueSchema,\n respondedBy: channelAuthSchema.nullable().default(null),\n});\n\nexport type DecisionResolvedDataIface = z.infer<typeof decisionResolvedDataSchema>;\n\n// The visible-output updates `project` receives. After them, the\n// turn's projection ends with one ACP v2 idle `state_update` (turnEndUpdate).\n// Thought, tool, plan and every other update, other state updates included,\n// reach a channel only through an `events` handler for its kind.\nexport const PROJECTED_UPDATE_KINDS: ReadonlySet<AcpUpdateKind> = new Set<AcpUpdateKind>([\n 'agent_message_chunk',\n 'agent_message',\n]);\n\nconst turnEndSchema = z.looseObject({\n sessionUpdate: z.literal('state_update'),\n state: z.literal('idle'),\n stopReason: z.string().nullish(),\n _meta: z\n .looseObject({ 'final.ai': z.looseObject({ stopReason: z.string().nullish() }).nullish() })\n .nullish(),\n});\n\n// The stop reason when the update ends the turn (an idle state_update); null otherwise.\nexport const turnEndOf = (update: SessionUpdate): { stopReason: string | null } | null => {\n const parsed = turnEndSchema.safeParse(update);\n if (!parsed.success) return null;\n return {\n stopReason: parsed.data.stopReason ?? parsed.data._meta?.['final.ai']?.stopReason ?? null,\n };\n};\n\n// The idle state_update that ends a turn, as `project` receives it. A stop\n// reason outside ACP's known set rides in `_meta[\"final.ai\"]` (the SDK types\n// only received values as unknown variants).\nexport const turnEndUpdate = (stopReason: string | null): SessionUpdate => {\n switch (stopReason) {\n case null:\n return { sessionUpdate: 'state_update', state: 'idle' };\n case 'end_turn':\n return { sessionUpdate: 'state_update', state: 'idle', stopReason: 'end_turn' };\n case 'max_tokens':\n return { sessionUpdate: 'state_update', state: 'idle', stopReason: 'max_tokens' };\n case 'max_turn_requests':\n return { sessionUpdate: 'state_update', state: 'idle', stopReason: 'max_turn_requests' };\n case 'refusal':\n return { sessionUpdate: 'state_update', state: 'idle', stopReason: 'refusal' };\n case 'cancelled':\n return { sessionUpdate: 'state_update', state: 'idle', stopReason: 'cancelled' };\n default:\n return {\n sessionUpdate: 'state_update',\n state: 'idle',\n _meta: { 'final.ai': { stopReason } },\n };\n }\n};\n\n// The Final chat admission, routing and rendering extension.\nexport interface RoomSurfaceDefinitionIface<Inbound, State = undefined> {\n config?: JsonObject;\n // Installed execution is an optimization for an uncustomized definition.\n installed?: ProviderRef;\n configure?: (config: JsonObject) => RoomSurfaceDefinitionIface<Inbound, State>;\n respond?(\n input: ChannelInputResponseIface,\n ctx: RoomReceiveContextIface,\n ): Promise<{ resolved: boolean }>;\n cancel?(ctx: RoomReceiveContextIface): Promise<{ accepted: boolean }>;\n // Inserts the input into its conversation and routes it. Returns where it went.\n receive(input: Inbound, ctx: RoomReceiveContextIface): Promise<RoomReceiveResult>;\n // Pure: who gets this message, and how. The channel applies it\n // to what it posts, from receive and project.\n route(args: RouteArgsIface): RouteDecisionIface[] | Promise<RouteDecisionIface[]>;\n turnPolicy: TurnPolicy;\n // ACP update \u2192 visible message / card. Called with a turn's\n // PROJECTED_UPDATE_KINDS updates in seq order, then its idle state_update.\n project(update: SessionUpdate, ctx: ProjectionContextIface<State>): Promise<void>;\n events?: Partial<Record<RoomEventKind, RoomEventHandler<State>>>;\n}\n\nexport const defineRoomSurface = <Inbound, State = undefined>(\n definition: RoomSurfaceDefinitionIface<Inbound, State>,\n): RoomSurfaceDefinitionIface<Inbound, State> => definition;\n"],
5
+ "mappings": "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",
6
+ "names": ["ChannelPrincipalType", "ConversationKind", "ParticipantKind", "RoutingMode", "TurnPolicy", "Delivery", "MessageKind", "CardKind", "DecisionEventKind", "DecisionKind"]
7
+ }
@@ -4,7 +4,17 @@ export declare enum SemanticChannelEventKind {
4
4
  MessageDelta = "message.delta",
5
5
  MessageCompleted = "message.completed",
6
6
  TurnStarted = "turn.started",
7
- TurnCompleted = "turn.completed"
7
+ TurnCompleted = "turn.completed",
8
+ ToolStarted = "tool.started",
9
+ ToolCompleted = "tool.completed",
10
+ PlanUpdated = "plan.updated",
11
+ DecisionCreated = "decision.created",
12
+ DecisionResolved = "decision.resolved",
13
+ MessageEdited = "message.edited",
14
+ MessageRemoved = "message.removed",
15
+ MessagePosted = "message.posted",
16
+ ReactionAdded = "reaction.added",
17
+ ReactionRemoved = "reaction.removed"
8
18
  }
9
19
  export declare const channelMessageCompletedSchema: z.ZodObject<{
10
20
  message: z.ZodObject<{
@@ -21,6 +31,12 @@ export interface ChannelMessageDeltaDataIface {
21
31
  export declare const channelTurnEventSchema: z.ZodObject<{
22
32
  turnId: z.ZodString;
23
33
  stopReason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
34
+ content: z.ZodOptional<z.ZodArray<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>>;
35
+ messages: z.ZodOptional<z.ZodArray<z.ZodObject<{
36
+ id: z.ZodString;
37
+ content: z.ZodArray<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
38
+ }, z.core.$strip>>>;
39
+ externalKey: z.ZodOptional<z.ZodString>;
24
40
  }, z.core.$strip>;
25
41
  export type ChannelTurnEventDataIface = z.infer<typeof channelTurnEventSchema>;
26
42
  export interface ChannelSemanticDataByKindIface {
@@ -29,3 +45,55 @@ export interface ChannelSemanticDataByKindIface {
29
45
  'turn.started': ChannelTurnEventDataIface;
30
46
  'turn.completed': ChannelTurnEventDataIface;
31
47
  }
48
+ export interface ChannelToolEventDataIface {
49
+ toolCallId: string;
50
+ title: string;
51
+ status: string;
52
+ content?: JsonObject[];
53
+ }
54
+ export interface ChannelPlanUpdatedDataIface {
55
+ entries: JsonObject[];
56
+ }
57
+ export interface ChannelDecisionEventDataIface {
58
+ decisionId: string;
59
+ kind: string;
60
+ request: JsonObject;
61
+ requester?: import("./channel.mjs").PrincipalRef;
62
+ outcome?: import("./json.mjs").JsonValue;
63
+ }
64
+ export interface ChannelOriginMessageDataIface {
65
+ externalKey: string;
66
+ message: {
67
+ id: string;
68
+ content: JsonObject[];
69
+ };
70
+ author: {
71
+ displayName: string;
72
+ kind: string;
73
+ };
74
+ replyOf?: {
75
+ externalKey: string;
76
+ turnId: string;
77
+ };
78
+ }
79
+ export interface ChannelReactionEventDataIface {
80
+ externalKey: string;
81
+ emoji: string;
82
+ principal: import("./channel.mjs").PrincipalRef;
83
+ replyOf?: {
84
+ externalKey: string;
85
+ turnId: string;
86
+ };
87
+ }
88
+ export interface ChannelSemanticDataByKindIface {
89
+ 'tool.started': ChannelToolEventDataIface;
90
+ 'tool.completed': ChannelToolEventDataIface;
91
+ 'plan.updated': ChannelPlanUpdatedDataIface;
92
+ 'decision.created': ChannelDecisionEventDataIface;
93
+ 'decision.resolved': ChannelDecisionEventDataIface;
94
+ 'message.edited': ChannelOriginMessageDataIface;
95
+ 'message.removed': ChannelOriginMessageDataIface;
96
+ 'message.posted': ChannelOriginMessageDataIface;
97
+ 'reaction.added': ChannelReactionEventDataIface;
98
+ 'reaction.removed': ChannelReactionEventDataIface;
99
+ }