@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.
- package/HOSTING.md +4 -4
- package/README.md +49 -0
- package/dist/modules/channel-socket.d.mts +8 -4
- package/dist/modules/channel-socket.mjs +39 -2
- package/dist/modules/channel-socket.mjs.map +2 -2
- package/dist/modules/channel.d.mts +323 -363
- package/dist/modules/channel.mjs +60 -145
- package/dist/modules/channel.mjs.map +3 -3
- package/dist/modules/credentials.mjs.map +2 -2
- package/dist/modules/index.d.mts +0 -1
- package/dist/modules/index.mjs +0 -1
- package/dist/modules/index.mjs.map +2 -2
- package/dist/modules/local-channel-context.d.mts +10 -0
- package/dist/modules/local-channel-context.mjs +55 -0
- package/dist/modules/local-channel-context.mjs.map +7 -0
- package/dist/modules/local-channel-socket.d.mts +8 -4
- package/dist/modules/local-channel-socket.mjs +1 -13
- package/dist/modules/local-channel-socket.mjs.map +2 -2
- package/dist/modules/manifest.d.mts +88 -4
- package/dist/modules/manifest.mjs +23 -6
- package/dist/modules/manifest.mjs.map +2 -2
- package/dist/modules/room-surface.d.mts +370 -0
- package/dist/modules/room-surface.mjs +156 -0
- package/dist/modules/room-surface.mjs.map +7 -0
- package/dist/modules/semantic-events.d.mts +69 -1
- package/dist/modules/semantic-events.mjs +14 -1
- package/dist/modules/semantic-events.mjs.map +2 -2
- package/package.json +14 -9
- package/dist/modules/channel-context.d.mts +0 -106
- package/dist/modules/channel-context.mjs +0 -45
- package/dist/modules/channel-context.mjs.map +0 -7
|
@@ -5,6 +5,16 @@ var SemanticChannelEventKind = /* @__PURE__ */ ((SemanticChannelEventKind2) => {
|
|
|
5
5
|
SemanticChannelEventKind2["MessageCompleted"] = "message.completed";
|
|
6
6
|
SemanticChannelEventKind2["TurnStarted"] = "turn.started";
|
|
7
7
|
SemanticChannelEventKind2["TurnCompleted"] = "turn.completed";
|
|
8
|
+
SemanticChannelEventKind2["ToolStarted"] = "tool.started";
|
|
9
|
+
SemanticChannelEventKind2["ToolCompleted"] = "tool.completed";
|
|
10
|
+
SemanticChannelEventKind2["PlanUpdated"] = "plan.updated";
|
|
11
|
+
SemanticChannelEventKind2["DecisionCreated"] = "decision.created";
|
|
12
|
+
SemanticChannelEventKind2["DecisionResolved"] = "decision.resolved";
|
|
13
|
+
SemanticChannelEventKind2["MessageEdited"] = "message.edited";
|
|
14
|
+
SemanticChannelEventKind2["MessageRemoved"] = "message.removed";
|
|
15
|
+
SemanticChannelEventKind2["MessagePosted"] = "message.posted";
|
|
16
|
+
SemanticChannelEventKind2["ReactionAdded"] = "reaction.added";
|
|
17
|
+
SemanticChannelEventKind2["ReactionRemoved"] = "reaction.removed";
|
|
8
18
|
return SemanticChannelEventKind2;
|
|
9
19
|
})(SemanticChannelEventKind || {});
|
|
10
20
|
const channelMessageCompletedSchema = z.object({
|
|
@@ -13,7 +23,10 @@ const channelMessageCompletedSchema = z.object({
|
|
|
13
23
|
});
|
|
14
24
|
const channelTurnEventSchema = z.object({
|
|
15
25
|
turnId: z.string(),
|
|
16
|
-
stopReason: z.string().nullable().optional()
|
|
26
|
+
stopReason: z.string().nullable().optional(),
|
|
27
|
+
content: z.array(jsonObjectSchema).optional(),
|
|
28
|
+
messages: z.array(z.object({ id: z.string(), content: z.array(jsonObjectSchema) })).optional(),
|
|
29
|
+
externalKey: z.string().optional()
|
|
17
30
|
});
|
|
18
31
|
export {
|
|
19
32
|
SemanticChannelEventKind,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/semantic-events.ts"],
|
|
4
|
-
"sourcesContent": ["import * as z from 'zod';\nimport { jsonObjectSchema, type JsonObject } from \"./json.mjs\";\n\nexport enum SemanticChannelEventKind {\n MessageDelta = 'message.delta',\n MessageCompleted = 'message.completed',\n TurnStarted = 'turn.started',\n TurnCompleted = 'turn.completed',\n}\n\nexport const channelMessageCompletedSchema = z.object({\n message: z.object({ id: z.string(), content: z.array(jsonObjectSchema) }),\n finishReason: z.string().nullable(),\n});\nexport type ChannelMessageCompletedDataIface = z.infer<typeof channelMessageCompletedSchema>;\nexport interface ChannelMessageDeltaDataIface {\n messageId: string;\n delta: JsonObject;\n}\nexport const channelTurnEventSchema = z.object({\n turnId: z.string(),\n stopReason: z.string().nullable().optional(),\n});\nexport type ChannelTurnEventDataIface = z.infer<typeof channelTurnEventSchema>;\nexport interface ChannelSemanticDataByKindIface {\n 'message.delta': ChannelMessageDeltaDataIface;\n 'message.completed': ChannelMessageCompletedDataIface;\n 'turn.started': ChannelTurnEventDataIface;\n 'turn.completed': ChannelTurnEventDataIface;\n}\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,OAAO;AACnB,SAAS,wBAAyC;AAE3C,IAAK,2BAAL,kBAAKA,8BAAL;AACL,EAAAA,0BAAA,kBAAe;AACf,EAAAA,0BAAA,sBAAmB;AACnB,EAAAA,0BAAA,iBAAc;AACd,EAAAA,0BAAA,mBAAgB;
|
|
4
|
+
"sourcesContent": ["import * as z from 'zod';\nimport { jsonObjectSchema, type JsonObject } from \"./json.mjs\";\n\nexport enum SemanticChannelEventKind {\n MessageDelta = 'message.delta',\n MessageCompleted = 'message.completed',\n TurnStarted = 'turn.started',\n TurnCompleted = 'turn.completed',\n ToolStarted = 'tool.started',\n ToolCompleted = 'tool.completed',\n PlanUpdated = 'plan.updated',\n DecisionCreated = 'decision.created',\n DecisionResolved = 'decision.resolved',\n MessageEdited = 'message.edited',\n MessageRemoved = 'message.removed',\n MessagePosted = 'message.posted',\n ReactionAdded = 'reaction.added',\n ReactionRemoved = 'reaction.removed',\n}\n\nexport const channelMessageCompletedSchema = z.object({\n message: z.object({ id: z.string(), content: z.array(jsonObjectSchema) }),\n finishReason: z.string().nullable(),\n});\nexport type ChannelMessageCompletedDataIface = z.infer<typeof channelMessageCompletedSchema>;\nexport interface ChannelMessageDeltaDataIface {\n messageId: string;\n delta: JsonObject;\n}\nexport const channelTurnEventSchema = z.object({\n turnId: z.string(),\n stopReason: z.string().nullable().optional(),\n content: z.array(jsonObjectSchema).optional(),\n messages: z.array(z.object({ id: z.string(), content: z.array(jsonObjectSchema) })).optional(),\n externalKey: z.string().optional(),\n});\nexport type ChannelTurnEventDataIface = z.infer<typeof channelTurnEventSchema>;\nexport interface ChannelSemanticDataByKindIface {\n 'message.delta': ChannelMessageDeltaDataIface;\n 'message.completed': ChannelMessageCompletedDataIface;\n 'turn.started': ChannelTurnEventDataIface;\n 'turn.completed': ChannelTurnEventDataIface;\n}\n\nexport interface ChannelToolEventDataIface {\n toolCallId: string;\n title: string;\n status: string;\n content?: JsonObject[];\n}\nexport interface ChannelPlanUpdatedDataIface {\n entries: JsonObject[];\n}\nexport interface ChannelDecisionEventDataIface {\n decisionId: string;\n kind: string;\n request: JsonObject;\n requester?: import(\"./channel.mjs\").PrincipalRef;\n outcome?: import(\"./json.mjs\").JsonValue;\n}\nexport interface ChannelOriginMessageDataIface {\n externalKey: string;\n message: { id: string; content: JsonObject[] };\n author: { displayName: string; kind: string };\n replyOf?: { externalKey: string; turnId: string };\n}\nexport interface ChannelReactionEventDataIface {\n externalKey: string;\n emoji: string;\n principal: import(\"./channel.mjs\").PrincipalRef;\n replyOf?: { externalKey: string; turnId: string };\n}\nexport interface ChannelSemanticDataByKindIface {\n 'tool.started': ChannelToolEventDataIface;\n 'tool.completed': ChannelToolEventDataIface;\n 'plan.updated': ChannelPlanUpdatedDataIface;\n 'decision.created': ChannelDecisionEventDataIface;\n 'decision.resolved': ChannelDecisionEventDataIface;\n 'message.edited': ChannelOriginMessageDataIface;\n 'message.removed': ChannelOriginMessageDataIface;\n 'message.posted': ChannelOriginMessageDataIface;\n 'reaction.added': ChannelReactionEventDataIface;\n 'reaction.removed': ChannelReactionEventDataIface;\n}\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,OAAO;AACnB,SAAS,wBAAyC;AAE3C,IAAK,2BAAL,kBAAKA,8BAAL;AACL,EAAAA,0BAAA,kBAAe;AACf,EAAAA,0BAAA,sBAAmB;AACnB,EAAAA,0BAAA,iBAAc;AACd,EAAAA,0BAAA,mBAAgB;AAChB,EAAAA,0BAAA,iBAAc;AACd,EAAAA,0BAAA,mBAAgB;AAChB,EAAAA,0BAAA,iBAAc;AACd,EAAAA,0BAAA,qBAAkB;AAClB,EAAAA,0BAAA,sBAAmB;AACnB,EAAAA,0BAAA,mBAAgB;AAChB,EAAAA,0BAAA,oBAAiB;AACjB,EAAAA,0BAAA,mBAAgB;AAChB,EAAAA,0BAAA,mBAAgB;AAChB,EAAAA,0BAAA,qBAAkB;AAdR,SAAAA;AAAA,GAAA;AAiBL,MAAM,gCAAgC,EAAE,OAAO;AAAA,EACpD,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAG,SAAS,EAAE,MAAM,gBAAgB,EAAE,CAAC;AAAA,EACxE,cAAc,EAAE,OAAO,EAAE,SAAS;AACpC,CAAC;AAMM,MAAM,yBAAyB,EAAE,OAAO;AAAA,EAC7C,QAAQ,EAAE,OAAO;AAAA,EACjB,YAAY,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AAAA,EAC3C,SAAS,EAAE,MAAM,gBAAgB,EAAE,SAAS;AAAA,EAC5C,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAG,SAAS,EAAE,MAAM,gBAAgB,EAAE,CAAC,CAAC,EAAE,SAAS;AAAA,EAC7F,aAAa,EAAE,OAAO,EAAE,SAAS;AACnC,CAAC;",
|
|
6
6
|
"names": ["SemanticChannelEventKind"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@finalai/agent-provider",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Provider contracts for the agent stack: harnesses, sandboxes (handle, wire, MCP projection), channels, credential policies, and the conformance kit.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -131,11 +131,6 @@
|
|
|
131
131
|
"import": "./dist/modules/semantic-events.mjs",
|
|
132
132
|
"default": "./dist/modules/semantic-events.mjs"
|
|
133
133
|
},
|
|
134
|
-
"./channel-context": {
|
|
135
|
-
"types": "./dist/modules/channel-context.d.mts",
|
|
136
|
-
"import": "./dist/modules/channel-context.mjs",
|
|
137
|
-
"default": "./dist/modules/channel-context.mjs"
|
|
138
|
-
},
|
|
139
134
|
"./sandbox/types": {
|
|
140
135
|
"types": "./dist/modules/sandbox/types.d.mts",
|
|
141
136
|
"import": "./dist/modules/sandbox/types.mjs",
|
|
@@ -175,6 +170,16 @@
|
|
|
175
170
|
"types": "./dist/modules/local-channel-socket.d.mts",
|
|
176
171
|
"import": "./dist/modules/local-channel-socket.mjs",
|
|
177
172
|
"default": "./dist/modules/local-channel-socket.mjs"
|
|
173
|
+
},
|
|
174
|
+
"./room-surface": {
|
|
175
|
+
"types": "./dist/modules/room-surface.d.mts",
|
|
176
|
+
"import": "./dist/modules/room-surface.mjs",
|
|
177
|
+
"default": "./dist/modules/room-surface.mjs"
|
|
178
|
+
},
|
|
179
|
+
"./local-channel-context": {
|
|
180
|
+
"types": "./dist/modules/local-channel-context.d.mts",
|
|
181
|
+
"import": "./dist/modules/local-channel-context.mjs",
|
|
182
|
+
"default": "./dist/modules/local-channel-context.mjs"
|
|
178
183
|
}
|
|
179
184
|
},
|
|
180
185
|
"publishConfig": {
|
|
@@ -183,13 +188,13 @@
|
|
|
183
188
|
},
|
|
184
189
|
"dependencies": {
|
|
185
190
|
"@agentclientprotocol/sdk": "1.8.0",
|
|
186
|
-
"@finalai/acp-session": "0.1.
|
|
187
|
-
"@finalai/agent-protocol": "0.
|
|
191
|
+
"@finalai/acp-session": "0.1.11",
|
|
192
|
+
"@finalai/agent-protocol": "0.7.0",
|
|
188
193
|
"@modelcontextprotocol/client": "^2.1.0",
|
|
189
194
|
"@modelcontextprotocol/core": "^2.1.0",
|
|
190
195
|
"@modelcontextprotocol/server": "^2.1.0",
|
|
191
196
|
"re2js": "2.8.6",
|
|
192
|
-
"zod": "4.6.
|
|
197
|
+
"zod": "4.6.6"
|
|
193
198
|
},
|
|
194
199
|
"engines": {
|
|
195
200
|
"node": ">=26"
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import type { ContentBlock } from '@agentclientprotocol/sdk/experimental/v2';
|
|
2
|
-
import * as z from 'zod';
|
|
3
|
-
import { type ChannelAuthIface, type ChannelPlatformIface, type TurnPolicy } from "./channel.mjs";
|
|
4
|
-
import type { JsonObject, JsonValue } from "./json.mjs";
|
|
5
|
-
export { ChannelPrincipalType, channelAuthSchema, type ChannelAuthIface } from "./channel.mjs";
|
|
6
|
-
export interface ChannelInputSourceIface {
|
|
7
|
-
label: string;
|
|
8
|
-
}
|
|
9
|
-
export interface ChannelSendInputIface {
|
|
10
|
-
content: ContentBlock[];
|
|
11
|
-
idempotencyKey: string;
|
|
12
|
-
auth: ChannelAuthIface;
|
|
13
|
-
context?: string[];
|
|
14
|
-
title?: string;
|
|
15
|
-
turnPolicy?: TurnPolicy | `${TurnPolicy}`;
|
|
16
|
-
actingUserId?: string;
|
|
17
|
-
originTurnId?: string;
|
|
18
|
-
source?: ChannelInputSourceIface;
|
|
19
|
-
}
|
|
20
|
-
export interface ChannelResponseInputIface {
|
|
21
|
-
decisionId: string;
|
|
22
|
-
outcome: JsonValue;
|
|
23
|
-
auth: ChannelAuthIface;
|
|
24
|
-
}
|
|
25
|
-
export interface ChannelSessionTargetIface {
|
|
26
|
-
address?: string;
|
|
27
|
-
sessionId?: string;
|
|
28
|
-
conversationId?: string;
|
|
29
|
-
participantId?: string;
|
|
30
|
-
}
|
|
31
|
-
export interface ChannelInputReceiptIface {
|
|
32
|
-
inputId: string;
|
|
33
|
-
sessionId: string;
|
|
34
|
-
}
|
|
35
|
-
export declare const channelInputReceiptSchema: z.ZodObject<{
|
|
36
|
-
inputId: z.ZodString;
|
|
37
|
-
sessionId: z.ZodString;
|
|
38
|
-
}, z.core.$strip>;
|
|
39
|
-
export interface ChannelHandoffReceiptIface {
|
|
40
|
-
inputId: string | null;
|
|
41
|
-
sessionId: string | null;
|
|
42
|
-
}
|
|
43
|
-
export declare const channelHandoffReceiptSchema: z.ZodObject<{
|
|
44
|
-
inputId: z.ZodNullable<z.ZodString>;
|
|
45
|
-
sessionId: z.ZodNullable<z.ZodString>;
|
|
46
|
-
}, z.core.$strip>;
|
|
47
|
-
export interface ChannelSessionSnapshotIface {
|
|
48
|
-
sessionId: string;
|
|
49
|
-
conversationId: string | null;
|
|
50
|
-
}
|
|
51
|
-
export interface ChannelCancelInputIface {
|
|
52
|
-
reason?: string;
|
|
53
|
-
throughMessageSeq?: number;
|
|
54
|
-
}
|
|
55
|
-
export interface ChannelSessionOperationsIface {
|
|
56
|
-
inspect(target: ChannelSessionTargetIface): Promise<ChannelSessionSnapshotIface | null>;
|
|
57
|
-
resolve(target: ChannelSessionTargetIface): Promise<string | null>;
|
|
58
|
-
send(target: ChannelSessionTargetIface, input: ChannelSendInputIface): Promise<ChannelInputReceiptIface>;
|
|
59
|
-
respond(target: ChannelSessionTargetIface, input: ChannelResponseInputIface): Promise<{
|
|
60
|
-
resolved: boolean;
|
|
61
|
-
}>;
|
|
62
|
-
cancel(target: ChannelSessionTargetIface, input?: ChannelCancelInputIface): Promise<{
|
|
63
|
-
accepted: boolean;
|
|
64
|
-
}>;
|
|
65
|
-
close(target: ChannelSessionTargetIface): Promise<void>;
|
|
66
|
-
observe(target: ChannelSessionTargetIface, input: {
|
|
67
|
-
content: ContentBlock[];
|
|
68
|
-
idempotencyKey: string;
|
|
69
|
-
}): Promise<void>;
|
|
70
|
-
setConfigOption(target: ChannelSessionTargetIface, input: {
|
|
71
|
-
configId: string;
|
|
72
|
-
value: JsonValue;
|
|
73
|
-
}): Promise<void>;
|
|
74
|
-
park(target: ChannelSessionTargetIface): Promise<void>;
|
|
75
|
-
getState(target: ChannelSessionTargetIface): Promise<JsonObject>;
|
|
76
|
-
setState(target: ChannelSessionTargetIface, state: JsonObject): Promise<void>;
|
|
77
|
-
handoff(channel: string, target: JsonValue, input: ChannelSendInputIface): Promise<ChannelHandoffReceiptIface>;
|
|
78
|
-
}
|
|
79
|
-
export interface ChannelSessionHandleIface {
|
|
80
|
-
inspect(): Promise<ChannelSessionSnapshotIface | null>;
|
|
81
|
-
resolveSession(): Promise<string | null>;
|
|
82
|
-
send(input: ChannelSendInputIface): ReturnType<ChannelSessionOperationsIface['send']>;
|
|
83
|
-
respond(input: ChannelResponseInputIface): ReturnType<ChannelSessionOperationsIface['respond']>;
|
|
84
|
-
cancel(input?: ChannelCancelInputIface): ReturnType<ChannelSessionOperationsIface['cancel']>;
|
|
85
|
-
close(): Promise<void>;
|
|
86
|
-
observe(input: {
|
|
87
|
-
content: ContentBlock[];
|
|
88
|
-
idempotencyKey: string;
|
|
89
|
-
}): Promise<void>;
|
|
90
|
-
setConfigOption(input: {
|
|
91
|
-
configId: string;
|
|
92
|
-
value: JsonValue;
|
|
93
|
-
}): Promise<void>;
|
|
94
|
-
park(): Promise<void>;
|
|
95
|
-
getState(): Promise<JsonObject>;
|
|
96
|
-
setState(state: JsonObject): Promise<void>;
|
|
97
|
-
}
|
|
98
|
-
export interface ChannelAddressContextIface {
|
|
99
|
-
from(address: string): ChannelSessionHandleIface;
|
|
100
|
-
resolveSession(address: string): Promise<string | null>;
|
|
101
|
-
attachSession(id: string): ChannelSessionHandleIface;
|
|
102
|
-
to(channel: string, target: JsonValue): {
|
|
103
|
-
send(input: ChannelSendInputIface): Promise<ChannelHandoffReceiptIface>;
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
export declare const channelAccessors: (platform: Pick<ChannelPlatformIface, "channelSessions">) => ChannelAddressContextIface;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import * as z from "zod";
|
|
2
|
-
import {} from "./channel.mjs";
|
|
3
|
-
import { ChannelPrincipalType, channelAuthSchema } from "./channel.mjs";
|
|
4
|
-
const channelInputReceiptSchema = z.object({
|
|
5
|
-
inputId: z.string().min(1),
|
|
6
|
-
sessionId: z.string().min(1)
|
|
7
|
-
});
|
|
8
|
-
const channelHandoffReceiptSchema = z.object({
|
|
9
|
-
inputId: z.string().min(1).nullable(),
|
|
10
|
-
sessionId: z.string().min(1).nullable()
|
|
11
|
-
});
|
|
12
|
-
const channelAccessors = (platform) => {
|
|
13
|
-
const operations = () => {
|
|
14
|
-
if (platform.channelSessions == null)
|
|
15
|
-
throw new Error("channel session operations are unavailable");
|
|
16
|
-
return platform.channelSessions;
|
|
17
|
-
};
|
|
18
|
-
const handle = (target) => ({
|
|
19
|
-
inspect: () => operations().inspect(target),
|
|
20
|
-
resolveSession: () => operations().resolve(target),
|
|
21
|
-
send: (input) => operations().send(target, input),
|
|
22
|
-
respond: (input) => operations().respond(target, input),
|
|
23
|
-
cancel: (input) => operations().cancel(target, input),
|
|
24
|
-
close: () => operations().close(target),
|
|
25
|
-
observe: (input) => operations().observe(target, input),
|
|
26
|
-
setConfigOption: (input) => operations().setConfigOption(target, input),
|
|
27
|
-
park: () => operations().park(target),
|
|
28
|
-
getState: () => operations().getState(target),
|
|
29
|
-
setState: (state) => operations().setState(target, state)
|
|
30
|
-
});
|
|
31
|
-
return {
|
|
32
|
-
from: (address) => handle({ address }),
|
|
33
|
-
resolveSession: (address) => operations().resolve({ address }),
|
|
34
|
-
attachSession: (sessionId) => handle({ sessionId }),
|
|
35
|
-
to: (channel, target) => ({ send: (input) => operations().handoff(channel, target, input) })
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
export {
|
|
39
|
-
ChannelPrincipalType,
|
|
40
|
-
channelAccessors,
|
|
41
|
-
channelAuthSchema,
|
|
42
|
-
channelHandoffReceiptSchema,
|
|
43
|
-
channelInputReceiptSchema
|
|
44
|
-
};
|
|
45
|
-
//# sourceMappingURL=channel-context.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/channel-context.ts"],
|
|
4
|
-
"sourcesContent": ["import type { ContentBlock } from '@agentclientprotocol/sdk/experimental/v2';\nimport * as z from 'zod';\nimport { type ChannelAuthIface, type ChannelPlatformIface, type TurnPolicy } from \"./channel.mjs\";\nimport type { JsonObject, JsonValue } from \"./json.mjs\";\n\nexport { ChannelPrincipalType, channelAuthSchema, type ChannelAuthIface } from \"./channel.mjs\";\n\n// How a Final room captions the agent's reply to the input (\"After the 9:00\n// schedule\", \"From Dana in #support\"); the platform names the principal when absent.\nexport interface ChannelInputSourceIface {\n label: string;\n}\n\nexport interface ChannelSendInputIface {\n content: ContentBlock[];\n idempotencyKey: string;\n // Required: the platform records the principal of every input.\n auth: ChannelAuthIface;\n context?: string[];\n title?: string;\n turnPolicy?: TurnPolicy | `${TurnPolicy}`;\n // The person the input acts for when its principal is a service: who pays and answers.\n actingUserId?: string;\n // The turn whose work produced the input (a relay or handoff), for loop limits.\n originTurnId?: string;\n source?: ChannelInputSourceIface;\n}\n\nexport interface ChannelResponseInputIface {\n decisionId: string;\n outcome: JsonValue;\n // Who answered; the channel decides who may (its audience policy) before responding.\n auth: ChannelAuthIface;\n}\n\n// Exactly one of an address (the channel's own), an attached session, or a\n// Final room (`conversationId`, optionally one agent `participantId` in it).\nexport interface ChannelSessionTargetIface {\n address?: string;\n sessionId?: string;\n conversationId?: string;\n participantId?: string;\n}\n\n// `send` accepts the input before any agent runs: the prompt follows, retried\n// by the platform, and the reply arrives through the channel's events.\nexport interface ChannelInputReceiptIface {\n inputId: string;\n sessionId: string;\n}\n\nexport const channelInputReceiptSchema = z.object({\n inputId: z.string().min(1),\n sessionId: z.string().min(1),\n});\n\n// Where a handoff went: a Final room's input, or another channel's own receive\n// (which names a session or nothing).\nexport interface ChannelHandoffReceiptIface {\n inputId: string | null;\n sessionId: string | null;\n}\n\nexport const channelHandoffReceiptSchema = z.object({\n inputId: z.string().min(1).nullable(),\n sessionId: z.string().min(1).nullable(),\n});\n\nexport interface ChannelSessionSnapshotIface {\n sessionId: string;\n conversationId: string | null;\n}\n\nexport interface ChannelCancelInputIface {\n reason?: string;\n throughMessageSeq?: number;\n}\n\nexport interface ChannelSessionOperationsIface {\n inspect(target: ChannelSessionTargetIface): Promise<ChannelSessionSnapshotIface | null>;\n resolve(target: ChannelSessionTargetIface): Promise<string | null>;\n send(\n target: ChannelSessionTargetIface,\n input: ChannelSendInputIface,\n ): Promise<ChannelInputReceiptIface>;\n respond(\n target: ChannelSessionTargetIface,\n input: ChannelResponseInputIface,\n ): Promise<{ resolved: boolean }>;\n cancel(\n target: ChannelSessionTargetIface,\n input?: ChannelCancelInputIface,\n ): Promise<{ accepted: boolean }>;\n close(target: ChannelSessionTargetIface): Promise<void>;\n observe(\n target: ChannelSessionTargetIface,\n input: { content: ContentBlock[]; idempotencyKey: string },\n ): Promise<void>;\n setConfigOption(\n target: ChannelSessionTargetIface,\n input: { configId: string; value: JsonValue },\n ): Promise<void>;\n park(target: ChannelSessionTargetIface): Promise<void>;\n getState(target: ChannelSessionTargetIface): Promise<JsonObject>;\n setState(target: ChannelSessionTargetIface, state: JsonObject): Promise<void>;\n // Input for another of the agent's channels: `final` targets `{ conversationId, participantId? }`.\n handoff(\n channel: string,\n target: JsonValue,\n input: ChannelSendInputIface,\n ): Promise<ChannelHandoffReceiptIface>;\n}\n\nexport interface ChannelSessionHandleIface {\n inspect(): Promise<ChannelSessionSnapshotIface | null>;\n resolveSession(): Promise<string | null>;\n send(input: ChannelSendInputIface): ReturnType<ChannelSessionOperationsIface['send']>;\n respond(input: ChannelResponseInputIface): ReturnType<ChannelSessionOperationsIface['respond']>;\n cancel(input?: ChannelCancelInputIface): ReturnType<ChannelSessionOperationsIface['cancel']>;\n close(): Promise<void>;\n observe(input: { content: ContentBlock[]; idempotencyKey: string }): Promise<void>;\n setConfigOption(input: { configId: string; value: JsonValue }): Promise<void>;\n park(): Promise<void>;\n getState(): Promise<JsonObject>;\n setState(state: JsonObject): Promise<void>;\n}\n\nexport interface ChannelAddressContextIface {\n from(address: string): ChannelSessionHandleIface;\n resolveSession(address: string): Promise<string | null>;\n attachSession(id: string): ChannelSessionHandleIface;\n to(\n channel: string,\n target: JsonValue,\n ): { send(input: ChannelSendInputIface): Promise<ChannelHandoffReceiptIface> };\n}\n\n// Handles resolve at operation time. Only attachSession captures a session ID.\nexport const channelAccessors = (\n platform: Pick<ChannelPlatformIface, 'channelSessions'>,\n): ChannelAddressContextIface => {\n const operations = () => {\n if (platform.channelSessions == null)\n throw new Error('channel session operations are unavailable');\n return platform.channelSessions;\n };\n const handle = (target: ChannelSessionTargetIface): ChannelSessionHandleIface => ({\n inspect: () => operations().inspect(target),\n resolveSession: () => operations().resolve(target),\n send: (input) => operations().send(target, input),\n respond: (input) => operations().respond(target, input),\n cancel: (input) => operations().cancel(target, input),\n close: () => operations().close(target),\n observe: (input) => operations().observe(target, input),\n setConfigOption: (input) => operations().setConfigOption(target, input),\n park: () => operations().park(target),\n getState: () => operations().getState(target),\n setState: (state) => operations().setState(target, state),\n });\n return {\n from: (address) => handle({ address }),\n resolveSession: (address) => operations().resolve({ address }),\n attachSession: (sessionId) => handle({ sessionId }),\n to: (channel, target) => ({ send: (input) => operations().handoff(channel, target, input) }),\n };\n};\n"],
|
|
5
|
-
"mappings": "AACA,YAAY,OAAO;AACnB,eAAkF;AAGlF,SAAS,sBAAsB,yBAAgD;AA8CxE,MAAM,4BAA4B,EAAE,OAAO;AAAA,EAChD,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACzB,WAAW,EAAE,OAAO,EAAE,IAAI,CAAC;AAC7B,CAAC;AASM,MAAM,8BAA8B,EAAE,OAAO;AAAA,EAClD,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,SAAS;AAAA,EACpC,WAAW,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,SAAS;AACxC,CAAC;AAwEM,MAAM,mBAAmB,CAC9B,aAC+B;AAC/B,QAAM,aAAa,MAAM;AACvB,QAAI,SAAS,mBAAmB;AAC9B,YAAM,IAAI,MAAM,4CAA4C;AAC9D,WAAO,SAAS;AAAA,EAClB;AACA,QAAM,SAAS,CAAC,YAAkE;AAAA,IAChF,SAAS,MAAM,WAAW,EAAE,QAAQ,MAAM;AAAA,IAC1C,gBAAgB,MAAM,WAAW,EAAE,QAAQ,MAAM;AAAA,IACjD,MAAM,CAAC,UAAU,WAAW,EAAE,KAAK,QAAQ,KAAK;AAAA,IAChD,SAAS,CAAC,UAAU,WAAW,EAAE,QAAQ,QAAQ,KAAK;AAAA,IACtD,QAAQ,CAAC,UAAU,WAAW,EAAE,OAAO,QAAQ,KAAK;AAAA,IACpD,OAAO,MAAM,WAAW,EAAE,MAAM,MAAM;AAAA,IACtC,SAAS,CAAC,UAAU,WAAW,EAAE,QAAQ,QAAQ,KAAK;AAAA,IACtD,iBAAiB,CAAC,UAAU,WAAW,EAAE,gBAAgB,QAAQ,KAAK;AAAA,IACtE,MAAM,MAAM,WAAW,EAAE,KAAK,MAAM;AAAA,IACpC,UAAU,MAAM,WAAW,EAAE,SAAS,MAAM;AAAA,IAC5C,UAAU,CAAC,UAAU,WAAW,EAAE,SAAS,QAAQ,KAAK;AAAA,EAC1D;AACA,SAAO;AAAA,IACL,MAAM,CAAC,YAAY,OAAO,EAAE,QAAQ,CAAC;AAAA,IACrC,gBAAgB,CAAC,YAAY,WAAW,EAAE,QAAQ,EAAE,QAAQ,CAAC;AAAA,IAC7D,eAAe,CAAC,cAAc,OAAO,EAAE,UAAU,CAAC;AAAA,IAClD,IAAI,CAAC,SAAS,YAAY,EAAE,MAAM,CAAC,UAAU,WAAW,EAAE,QAAQ,SAAS,QAAQ,KAAK,EAAE;AAAA,EAC5F;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|