@komaa/standin-sdk 0.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.
- package/LICENSE +21 -0
- package/README.md +141 -0
- package/dist/ambient.d.ts +80 -0
- package/dist/ambient.d.ts.map +1 -0
- package/dist/ambient.js +281 -0
- package/dist/ambient.js.map +1 -0
- package/dist/attachments.d.ts +149 -0
- package/dist/attachments.d.ts.map +1 -0
- package/dist/attachments.js +451 -0
- package/dist/attachments.js.map +1 -0
- package/dist/audio.d.ts +80 -0
- package/dist/audio.d.ts.map +1 -0
- package/dist/audio.js +170 -0
- package/dist/audio.js.map +1 -0
- package/dist/avatar.d.ts +111 -0
- package/dist/avatar.d.ts.map +1 -0
- package/dist/avatar.js +201 -0
- package/dist/avatar.js.map +1 -0
- package/dist/callServer.d.ts +151 -0
- package/dist/callServer.d.ts.map +1 -0
- package/dist/callServer.js +1097 -0
- package/dist/callServer.js.map +1 -0
- package/dist/callTools.d.ts +154 -0
- package/dist/callTools.d.ts.map +1 -0
- package/dist/callTools.js +255 -0
- package/dist/callTools.js.map +1 -0
- package/dist/chat.d.ts +226 -0
- package/dist/chat.d.ts.map +1 -0
- package/dist/chat.js +574 -0
- package/dist/chat.js.map +1 -0
- package/dist/config.d.ts +32 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +86 -0
- package/dist/config.js.map +1 -0
- package/dist/consult.d.ts +147 -0
- package/dist/consult.d.ts.map +1 -0
- package/dist/consult.js +388 -0
- package/dist/consult.js.map +1 -0
- package/dist/delivery.d.ts +81 -0
- package/dist/delivery.d.ts.map +1 -0
- package/dist/delivery.js +187 -0
- package/dist/delivery.js.map +1 -0
- package/dist/echoGuard.d.ts +56 -0
- package/dist/echoGuard.d.ts.map +1 -0
- package/dist/echoGuard.js +57 -0
- package/dist/echoGuard.js.map +1 -0
- package/dist/errors.d.ts +5 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +10 -0
- package/dist/errors.js.map +1 -0
- package/dist/fetch.d.ts +40 -0
- package/dist/fetch.d.ts.map +1 -0
- package/dist/fetch.js +240 -0
- package/dist/fetch.js.map +1 -0
- package/dist/gate.d.ts +80 -0
- package/dist/gate.d.ts.map +1 -0
- package/dist/gate.js +249 -0
- package/dist/gate.js.map +1 -0
- package/dist/handler.d.ts +283 -0
- package/dist/handler.d.ts.map +1 -0
- package/dist/handler.js +4 -0
- package/dist/handler.js.map +1 -0
- package/dist/hmac.d.ts +32 -0
- package/dist/hmac.d.ts.map +1 -0
- package/dist/hmac.js +108 -0
- package/dist/hmac.js.map +1 -0
- package/dist/index.d.ts +59 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +60 -0
- package/dist/index.js.map +1 -0
- package/dist/lane.d.ts +92 -0
- package/dist/lane.d.ts.map +1 -0
- package/dist/lane.js +269 -0
- package/dist/lane.js.map +1 -0
- package/dist/lipsync.d.ts +136 -0
- package/dist/lipsync.d.ts.map +1 -0
- package/dist/lipsync.js +310 -0
- package/dist/lipsync.js.map +1 -0
- package/dist/log.d.ts +18 -0
- package/dist/log.d.ts.map +1 -0
- package/dist/log.js +20 -0
- package/dist/log.js.map +1 -0
- package/dist/media.d.ts +43 -0
- package/dist/media.d.ts.map +1 -0
- package/dist/media.js +190 -0
- package/dist/media.js.map +1 -0
- package/dist/minutes.d.ts +398 -0
- package/dist/minutes.d.ts.map +1 -0
- package/dist/minutes.js +805 -0
- package/dist/minutes.js.map +1 -0
- package/dist/outbound.d.ts +388 -0
- package/dist/outbound.d.ts.map +1 -0
- package/dist/outbound.js +933 -0
- package/dist/outbound.js.map +1 -0
- package/dist/plugins/cartesia/agent.d.ts +58 -0
- package/dist/plugins/cartesia/agent.d.ts.map +1 -0
- package/dist/plugins/cartesia/agent.js +254 -0
- package/dist/plugins/cartesia/agent.js.map +1 -0
- package/dist/plugins/cartesia/cli.d.ts +3 -0
- package/dist/plugins/cartesia/cli.d.ts.map +1 -0
- package/dist/plugins/cartesia/cli.js +10 -0
- package/dist/plugins/cartesia/cli.js.map +1 -0
- package/dist/plugins/cartesia/config.d.ts +30 -0
- package/dist/plugins/cartesia/config.d.ts.map +1 -0
- package/dist/plugins/cartesia/config.js +29 -0
- package/dist/plugins/cartesia/config.js.map +1 -0
- package/dist/plugins/cartesia/handler.d.ts +40 -0
- package/dist/plugins/cartesia/handler.d.ts.map +1 -0
- package/dist/plugins/cartesia/handler.js +142 -0
- package/dist/plugins/cartesia/handler.js.map +1 -0
- package/dist/plugins/cartesia/index.d.ts +6 -0
- package/dist/plugins/cartesia/index.d.ts.map +1 -0
- package/dist/plugins/cartesia/index.js +54 -0
- package/dist/plugins/cartesia/index.js.map +1 -0
- package/dist/plugins/deepgram/agent.d.ts +60 -0
- package/dist/plugins/deepgram/agent.d.ts.map +1 -0
- package/dist/plugins/deepgram/agent.js +302 -0
- package/dist/plugins/deepgram/agent.js.map +1 -0
- package/dist/plugins/deepgram/cli.d.ts +3 -0
- package/dist/plugins/deepgram/cli.d.ts.map +1 -0
- package/dist/plugins/deepgram/cli.js +10 -0
- package/dist/plugins/deepgram/cli.js.map +1 -0
- package/dist/plugins/deepgram/config.d.ts +39 -0
- package/dist/plugins/deepgram/config.d.ts.map +1 -0
- package/dist/plugins/deepgram/config.js +66 -0
- package/dist/plugins/deepgram/config.js.map +1 -0
- package/dist/plugins/deepgram/handler.d.ts +87 -0
- package/dist/plugins/deepgram/handler.d.ts.map +1 -0
- package/dist/plugins/deepgram/handler.js +268 -0
- package/dist/plugins/deepgram/handler.js.map +1 -0
- package/dist/plugins/deepgram/index.d.ts +11 -0
- package/dist/plugins/deepgram/index.d.ts.map +1 -0
- package/dist/plugins/deepgram/index.js +76 -0
- package/dist/plugins/deepgram/index.js.map +1 -0
- package/dist/plugins/echo/cli.d.ts +3 -0
- package/dist/plugins/echo/cli.d.ts.map +1 -0
- package/dist/plugins/echo/cli.js +10 -0
- package/dist/plugins/echo/cli.js.map +1 -0
- package/dist/plugins/echo/index.d.ts +37 -0
- package/dist/plugins/echo/index.d.ts.map +1 -0
- package/dist/plugins/echo/index.js +61 -0
- package/dist/plugins/echo/index.js.map +1 -0
- package/dist/plugins/elevenlabs/agent.d.ts +72 -0
- package/dist/plugins/elevenlabs/agent.d.ts.map +1 -0
- package/dist/plugins/elevenlabs/agent.js +305 -0
- package/dist/plugins/elevenlabs/agent.js.map +1 -0
- package/dist/plugins/elevenlabs/cli.d.ts +3 -0
- package/dist/plugins/elevenlabs/cli.d.ts.map +1 -0
- package/dist/plugins/elevenlabs/cli.js +10 -0
- package/dist/plugins/elevenlabs/cli.js.map +1 -0
- package/dist/plugins/elevenlabs/config.d.ts +27 -0
- package/dist/plugins/elevenlabs/config.d.ts.map +1 -0
- package/dist/plugins/elevenlabs/config.js +42 -0
- package/dist/plugins/elevenlabs/config.js.map +1 -0
- package/dist/plugins/elevenlabs/handler.d.ts +67 -0
- package/dist/plugins/elevenlabs/handler.d.ts.map +1 -0
- package/dist/plugins/elevenlabs/handler.js +419 -0
- package/dist/plugins/elevenlabs/handler.js.map +1 -0
- package/dist/plugins/elevenlabs/index.d.ts +11 -0
- package/dist/plugins/elevenlabs/index.d.ts.map +1 -0
- package/dist/plugins/elevenlabs/index.js +72 -0
- package/dist/plugins/elevenlabs/index.js.map +1 -0
- package/dist/plugins/livekit/cli.d.ts +3 -0
- package/dist/plugins/livekit/cli.d.ts.map +1 -0
- package/dist/plugins/livekit/cli.js +10 -0
- package/dist/plugins/livekit/cli.js.map +1 -0
- package/dist/plugins/livekit/config.d.ts +47 -0
- package/dist/plugins/livekit/config.d.ts.map +1 -0
- package/dist/plugins/livekit/config.js +46 -0
- package/dist/plugins/livekit/config.js.map +1 -0
- package/dist/plugins/livekit/handler.d.ts +59 -0
- package/dist/plugins/livekit/handler.d.ts.map +1 -0
- package/dist/plugins/livekit/handler.js +211 -0
- package/dist/plugins/livekit/handler.js.map +1 -0
- package/dist/plugins/livekit/index.d.ts +6 -0
- package/dist/plugins/livekit/index.d.ts.map +1 -0
- package/dist/plugins/livekit/index.js +68 -0
- package/dist/plugins/livekit/index.js.map +1 -0
- package/dist/plugins/livekit/room.d.ts +117 -0
- package/dist/plugins/livekit/room.d.ts.map +1 -0
- package/dist/plugins/livekit/room.js +449 -0
- package/dist/plugins/livekit/room.js.map +1 -0
- package/dist/plugins/openai/agent.d.ts +74 -0
- package/dist/plugins/openai/agent.d.ts.map +1 -0
- package/dist/plugins/openai/agent.js +264 -0
- package/dist/plugins/openai/agent.js.map +1 -0
- package/dist/plugins/openai/cli.d.ts +3 -0
- package/dist/plugins/openai/cli.d.ts.map +1 -0
- package/dist/plugins/openai/cli.js +10 -0
- package/dist/plugins/openai/cli.js.map +1 -0
- package/dist/plugins/openai/config.d.ts +29 -0
- package/dist/plugins/openai/config.d.ts.map +1 -0
- package/dist/plugins/openai/config.js +37 -0
- package/dist/plugins/openai/config.js.map +1 -0
- package/dist/plugins/openai/handler.d.ts +65 -0
- package/dist/plugins/openai/handler.d.ts.map +1 -0
- package/dist/plugins/openai/handler.js +297 -0
- package/dist/plugins/openai/handler.js.map +1 -0
- package/dist/plugins/openai/index.d.ts +6 -0
- package/dist/plugins/openai/index.d.ts.map +1 -0
- package/dist/plugins/openai/index.js +72 -0
- package/dist/plugins/openai/index.js.map +1 -0
- package/dist/plugins/openclaw/allowlist.d.ts +9 -0
- package/dist/plugins/openclaw/allowlist.d.ts.map +1 -0
- package/dist/plugins/openclaw/allowlist.js +11 -0
- package/dist/plugins/openclaw/allowlist.js.map +1 -0
- package/dist/plugins/openclaw/config.d.ts +50 -0
- package/dist/plugins/openclaw/config.d.ts.map +1 -0
- package/dist/plugins/openclaw/config.js +53 -0
- package/dist/plugins/openclaw/config.js.map +1 -0
- package/dist/plugins/openclaw/handler.d.ts +90 -0
- package/dist/plugins/openclaw/handler.d.ts.map +1 -0
- package/dist/plugins/openclaw/handler.js +146 -0
- package/dist/plugins/openclaw/handler.js.map +1 -0
- package/dist/plugins/openclaw/index.d.ts +55 -0
- package/dist/plugins/openclaw/index.d.ts.map +1 -0
- package/dist/plugins/openclaw/index.js +89 -0
- package/dist/plugins/openclaw/index.js.map +1 -0
- package/dist/plugins/openclaw/openclaw.plugin.json +74 -0
- package/dist/plugins/openclaw/package.json +14 -0
- package/dist/plugins/openclaw/realtime.d.ts +82 -0
- package/dist/plugins/openclaw/realtime.d.ts.map +1 -0
- package/dist/plugins/openclaw/realtime.js +238 -0
- package/dist/plugins/openclaw/realtime.js.map +1 -0
- package/dist/plugins/openclaw/runtime.d.ts +19 -0
- package/dist/plugins/openclaw/runtime.d.ts.map +1 -0
- package/dist/plugins/openclaw/runtime.js +160 -0
- package/dist/plugins/openclaw/runtime.js.map +1 -0
- package/dist/policy.d.ts +38 -0
- package/dist/policy.d.ts.map +1 -0
- package/dist/policy.js +95 -0
- package/dist/policy.js.map +1 -0
- package/dist/protocol.d.ts +44 -0
- package/dist/protocol.d.ts.map +1 -0
- package/dist/protocol.js +77 -0
- package/dist/protocol.js.map +1 -0
- package/dist/protocolRuntime.d.ts +19 -0
- package/dist/protocolRuntime.d.ts.map +1 -0
- package/dist/protocolRuntime.js +78 -0
- package/dist/protocolRuntime.js.map +1 -0
- package/dist/smoke.d.ts +65 -0
- package/dist/smoke.d.ts.map +1 -0
- package/dist/smoke.js +293 -0
- package/dist/smoke.js.map +1 -0
- package/dist/startup.d.ts +74 -0
- package/dist/startup.d.ts.map +1 -0
- package/dist/startup.js +112 -0
- package/dist/startup.js.map +1 -0
- package/dist/tile.d.ts +101 -0
- package/dist/tile.d.ts.map +1 -0
- package/dist/tile.js +195 -0
- package/dist/tile.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +4 -0
- package/dist/version.js.map +1 -0
- package/dist/vision.d.ts +160 -0
- package/dist/vision.d.ts.map +1 -0
- package/dist/vision.js +301 -0
- package/dist/vision.js.map +1 -0
- package/dist/visionTools.d.ts +237 -0
- package/dist/visionTools.d.ts.map +1 -0
- package/dist/visionTools.js +578 -0
- package/dist/visionTools.js.map +1 -0
- package/dist/voice.d.ts +143 -0
- package/dist/voice.d.ts.map +1 -0
- package/dist/voice.js +403 -0
- package/dist/voice.js.map +1 -0
- package/package.json +129 -0
package/dist/chat.d.ts
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* chat-schema.yaml SCHEMA_VERSION. A MAJOR version: additive evolution does not
|
|
3
|
+
* bump it, because the schema already requires receivers to ignore unknown
|
|
4
|
+
* fields. An integer above ours therefore means incompatible semantics.
|
|
5
|
+
*/
|
|
6
|
+
export declare const SCHEMA_VERSION = 1;
|
|
7
|
+
export declare const DEFAULT_CHAT_URL = "wss://teams.standin.komaa.com/api/chat/channel";
|
|
8
|
+
/**
|
|
9
|
+
* What may be rendered inline in a reply. Raster only, and the decoded bytes
|
|
10
|
+
* must actually carry the type's signature.
|
|
11
|
+
*
|
|
12
|
+
* `image/svg+xml` is deliberately absent and is not a gap to fill later. SVG is
|
|
13
|
+
* scriptable XML, which is precisely what "an image" must not be.
|
|
14
|
+
*/
|
|
15
|
+
export declare const OUTBOUND_IMAGE_CONTENT_TYPES: readonly ["image/png", "image/jpeg", "image/gif", "image/webp"];
|
|
16
|
+
/** What an inline image may weigh, decoded. */
|
|
17
|
+
export declare const OUTBOUND_IMAGE_MAX_BYTES: number;
|
|
18
|
+
/**
|
|
19
|
+
* A picture to render inline in a reply, carried as bytes.
|
|
20
|
+
*
|
|
21
|
+
* Bytes rather than a link, because a link is a beacon: an off-domain image
|
|
22
|
+
* loads with no click, under this bot's name, and what it serves can be swapped
|
|
23
|
+
* after anyone looked at it. Bytes can be checked, and {@link outboundImage}
|
|
24
|
+
* checks them.
|
|
25
|
+
*/
|
|
26
|
+
export interface OutboundImage {
|
|
27
|
+
readonly contentType: string;
|
|
28
|
+
readonly contentBase64: string;
|
|
29
|
+
readonly name?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* One path-free segment, bounded, or undefined.
|
|
33
|
+
*
|
|
34
|
+
* A filename reaches a chat as a download under this bot's identity, and the
|
|
35
|
+
* model that chose it is being steered by whoever is in the conversation.
|
|
36
|
+
*/
|
|
37
|
+
export declare function sanitizeImageName(name: string | undefined): string | undefined;
|
|
38
|
+
/** What these bytes actually are, or undefined. */
|
|
39
|
+
export declare function sniffImageType(data: Buffer): string | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Check a picture and build the wire form. Throws on anything it will not send.
|
|
42
|
+
*
|
|
43
|
+
* Three checks, and the second is the one that matters. A declared type is a
|
|
44
|
+
* claim made by whatever produced the bytes; the signature is what they are.
|
|
45
|
+
* Without it an HTML document or an SVG labelled `image/png` is posted into
|
|
46
|
+
* somebody's chat under this bot's name.
|
|
47
|
+
*/
|
|
48
|
+
export declare function outboundImage(data: Buffer | string, contentType: string, name?: string): OutboundImage;
|
|
49
|
+
/**
|
|
50
|
+
* One user message, already authenticated and resolved to your connection.
|
|
51
|
+
*
|
|
52
|
+
* Reserved bot commands are handled by StandIn and never arrive here. In group
|
|
53
|
+
* and channel scope only messages that @mention the bot are relayed, and the
|
|
54
|
+
* mention is already stripped from `text`.
|
|
55
|
+
*/
|
|
56
|
+
export interface InboundMessage {
|
|
57
|
+
readonly tenantId: string;
|
|
58
|
+
readonly conversationId: string;
|
|
59
|
+
readonly activityId: string;
|
|
60
|
+
readonly scope: string;
|
|
61
|
+
readonly text: string;
|
|
62
|
+
readonly senderName?: string;
|
|
63
|
+
readonly senderAadId?: string;
|
|
64
|
+
readonly senderIsGuest: boolean;
|
|
65
|
+
readonly senderIsLinkedOwner: boolean;
|
|
66
|
+
readonly attachments: Record<string, unknown>[];
|
|
67
|
+
readonly mentions: string[];
|
|
68
|
+
readonly locale?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Submit payload of an Action.Submit on a card this agent sent. `text` is
|
|
71
|
+
* empty on these messages.
|
|
72
|
+
*/
|
|
73
|
+
readonly cardAction?: Record<string, unknown>;
|
|
74
|
+
/**
|
|
75
|
+
* Which StandIn connection this conversation resolved to. Stable for a
|
|
76
|
+
* tenant, and {@link buildReply} echoes it: one tenant can have several
|
|
77
|
+
* connections, so the tenant alone no longer says who a reply is from.
|
|
78
|
+
*/
|
|
79
|
+
readonly bindingId?: string;
|
|
80
|
+
}
|
|
81
|
+
/** True when the message came from a 1:1 chat rather than a group or channel. */
|
|
82
|
+
export declare function isPersonal(message: InboundMessage): boolean;
|
|
83
|
+
/**
|
|
84
|
+
* How long a remembered 1:1 chat stays usable as a delivery target: 12 hours.
|
|
85
|
+
*
|
|
86
|
+
* Long enough to cover a working day, short enough that a conversation from
|
|
87
|
+
* last week is not treated as evidence of who is on the phone today.
|
|
88
|
+
*/
|
|
89
|
+
export declare const CHAT_FALLBACK_WINDOW_MS: number;
|
|
90
|
+
/** Somebody's own 1:1 chat with this bot, as last seen. */
|
|
91
|
+
export interface PersonalChat {
|
|
92
|
+
readonly conversationId: string;
|
|
93
|
+
readonly tenantId: string;
|
|
94
|
+
/** The sender's AAD object id, or "" when the message carried none. */
|
|
95
|
+
readonly aadId: string;
|
|
96
|
+
readonly displayName: string;
|
|
97
|
+
/** When this chat was last seen, in epoch milliseconds. */
|
|
98
|
+
readonly atMs: number;
|
|
99
|
+
}
|
|
100
|
+
/** What {@link PersonalChats.forCaller} needs to admit a chat. */
|
|
101
|
+
export interface ForCallerOptions {
|
|
102
|
+
/** The caller's AAD object id, from the call. */
|
|
103
|
+
callerAadId?: string;
|
|
104
|
+
/** The tenant this worker is bound to. Never the caller's own tenant id. */
|
|
105
|
+
tenantId: string;
|
|
106
|
+
/** Now, in epoch milliseconds. Defaults to the clock. */
|
|
107
|
+
nowMs?: number;
|
|
108
|
+
/**
|
|
109
|
+
* Drop the identity rule alone, for a single-operator install where the only
|
|
110
|
+
* person who ever chats with the bot is the only person who ever calls it.
|
|
111
|
+
* Default false, and every use is warned about by name, because with it on an
|
|
112
|
+
* unidentified caller's minutes go to whoever messaged this bot last.
|
|
113
|
+
*/
|
|
114
|
+
allowUnidentified?: boolean;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* The 1:1 chats this bot has been messaged in, so a call can be answered in one.
|
|
118
|
+
*
|
|
119
|
+
* A 1:1 CALL carries no thread id and no conversation to post into, so the only
|
|
120
|
+
* honest source of the caller's own chat is a message they sent the bot from
|
|
121
|
+
* it. Feed this from the chat lane and read it from the call lane:
|
|
122
|
+
*
|
|
123
|
+
* ```ts
|
|
124
|
+
* const chats = new PersonalChats();
|
|
125
|
+
* const channel = new ChatChannel({ respond, chats });
|
|
126
|
+
* // later, on a call:
|
|
127
|
+
* const mine = chats.forCaller({ callerAadId, tenantId });
|
|
128
|
+
* ```
|
|
129
|
+
*
|
|
130
|
+
* Both lanes have to be in one process for that to work, or the memory has to
|
|
131
|
+
* be shared some other way. Until it is, a 1:1 recap can only be delivered to
|
|
132
|
+
* somebody who has messaged this bot inside {@link CHAT_FALLBACK_WINDOW_MS}.
|
|
133
|
+
*
|
|
134
|
+
* Nothing is remembered from a group or a channel. That is decided by the
|
|
135
|
+
* message's SCOPE and by nothing else: an @mention in a team channel would
|
|
136
|
+
* otherwise make that channel the caller's "chat" and put a private escalation
|
|
137
|
+
* in front of their whole team.
|
|
138
|
+
*/
|
|
139
|
+
export declare class PersonalChats {
|
|
140
|
+
#private;
|
|
141
|
+
constructor(windowMs?: number);
|
|
142
|
+
/**
|
|
143
|
+
* Record a 1:1 chat. Anything else is ignored, including a message whose
|
|
144
|
+
* conversation id merely looks personal.
|
|
145
|
+
*/
|
|
146
|
+
remember(message: InboundMessage, atMs?: number): void;
|
|
147
|
+
/**
|
|
148
|
+
* The chat a call may be answered in, or undefined when there is not one.
|
|
149
|
+
*
|
|
150
|
+
* Four things have to hold, and posting call content into the wrong
|
|
151
|
+
* conversation is the failure all four exist to prevent: the chat was a 1:1
|
|
152
|
+
* chat, it is in this tenant, it was seen inside
|
|
153
|
+
* {@link CHAT_FALLBACK_WINDOW_MS}, and the call names a caller whose AAD id
|
|
154
|
+
* is the one that sent it. Without that last rule every anonymous caller
|
|
155
|
+
* collapses onto whoever chatted last.
|
|
156
|
+
*/
|
|
157
|
+
forCaller(options: ForCallerOptions): PersonalChat | undefined;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Parse and validate an inbound message. Throws naming the problem; the caller
|
|
161
|
+
* maps that to HTTP 400.
|
|
162
|
+
*/
|
|
163
|
+
export declare function parseInbound(body: string): InboundMessage;
|
|
164
|
+
/**
|
|
165
|
+
* The gateway-bound reply. tenantId and conversationId echo the inbound
|
|
166
|
+
* EXACTLY: the gateway rejects a mismatch, and that check is the cross-tenant
|
|
167
|
+
* leak guard the whole relay rests on.
|
|
168
|
+
*/
|
|
169
|
+
export declare function buildReply(message: InboundMessage, text: string, kind?: string, image?: OutboundImage): Record<string, unknown>;
|
|
170
|
+
/** Options for {@link ChatChannel}. */
|
|
171
|
+
export interface ChatChannelOptions {
|
|
172
|
+
/**
|
|
173
|
+
* Async callable taking an {@link InboundMessage} and returning the reply
|
|
174
|
+
* text. An empty string makes the channel say so rather than leaving the user
|
|
175
|
+
* watching a typing indicator forever.
|
|
176
|
+
*/
|
|
177
|
+
respond: (message: InboundMessage) => Promise<string>;
|
|
178
|
+
/** Your StandIn connection secret, defaulting to `STANDIN_SECRET`. */
|
|
179
|
+
secret?: string;
|
|
180
|
+
/** The chat channel URL, defaulting to `STANDIN_CHAT_URL`. */
|
|
181
|
+
url?: string;
|
|
182
|
+
/**
|
|
183
|
+
* Remembers who has a 1:1 chat with this bot, fed on every inbound message.
|
|
184
|
+
* Share one instance with the call lane and a 1:1 call has somewhere to post
|
|
185
|
+
* its minutes.
|
|
186
|
+
*/
|
|
187
|
+
chats?: PersonalChats;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Answer Microsoft Teams messages with your agent.
|
|
191
|
+
*
|
|
192
|
+
* Dialed out from the worker, like the call lane, so nothing listens and there
|
|
193
|
+
* is nothing to expose. Managed connections only, and that needs no flag: the
|
|
194
|
+
* socket authenticates with your connection secret, so if it opens at all you
|
|
195
|
+
* are managed.
|
|
196
|
+
*
|
|
197
|
+
* ```ts
|
|
198
|
+
* const chat = new ChatChannel({
|
|
199
|
+
* respond: async (msg) => `You said: ${msg.text}`,
|
|
200
|
+
* });
|
|
201
|
+
* await chat.start();
|
|
202
|
+
* ```
|
|
203
|
+
*/
|
|
204
|
+
export declare class ChatChannel {
|
|
205
|
+
#private;
|
|
206
|
+
constructor(options: ChatChannelOptions);
|
|
207
|
+
/** Dial StandIn and begin taking messages. */
|
|
208
|
+
start(): Promise<void>;
|
|
209
|
+
/** Stop taking messages and close the socket. */
|
|
210
|
+
aclose(): Promise<void>;
|
|
211
|
+
/**
|
|
212
|
+
* Post into a Microsoft Teams conversation with no inbound message to answer.
|
|
213
|
+
*
|
|
214
|
+
* Useful from inside a call. Best-effort: returns false rather than throwing,
|
|
215
|
+
* because a failed post must never break a live call.
|
|
216
|
+
*/
|
|
217
|
+
send(options: {
|
|
218
|
+
tenantId: string;
|
|
219
|
+
conversationId: string;
|
|
220
|
+
text: string;
|
|
221
|
+
image?: OutboundImage;
|
|
222
|
+
bindingId?: string;
|
|
223
|
+
idempotencyKey?: string;
|
|
224
|
+
}): Promise<boolean>;
|
|
225
|
+
}
|
|
226
|
+
//# sourceMappingURL=chat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../src/chat.ts"],"names":[],"mappings":"AAyCA;;;;GAIG;AACH,eAAO,MAAM,cAAc,IAAI,CAAC;AAEhC,eAAO,MAAM,gBAAgB,mDACqB,CAAC;AAEnD;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,iEAK/B,CAAC;AAEX,+CAA+C;AAC/C,eAAO,MAAM,wBAAwB,QAAc,CAAC;AAiBpD;;;;;;;GAOG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,aAA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