@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.
Files changed (269) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +141 -0
  3. package/dist/ambient.d.ts +80 -0
  4. package/dist/ambient.d.ts.map +1 -0
  5. package/dist/ambient.js +281 -0
  6. package/dist/ambient.js.map +1 -0
  7. package/dist/attachments.d.ts +149 -0
  8. package/dist/attachments.d.ts.map +1 -0
  9. package/dist/attachments.js +451 -0
  10. package/dist/attachments.js.map +1 -0
  11. package/dist/audio.d.ts +80 -0
  12. package/dist/audio.d.ts.map +1 -0
  13. package/dist/audio.js +170 -0
  14. package/dist/audio.js.map +1 -0
  15. package/dist/avatar.d.ts +111 -0
  16. package/dist/avatar.d.ts.map +1 -0
  17. package/dist/avatar.js +201 -0
  18. package/dist/avatar.js.map +1 -0
  19. package/dist/callServer.d.ts +151 -0
  20. package/dist/callServer.d.ts.map +1 -0
  21. package/dist/callServer.js +1097 -0
  22. package/dist/callServer.js.map +1 -0
  23. package/dist/callTools.d.ts +154 -0
  24. package/dist/callTools.d.ts.map +1 -0
  25. package/dist/callTools.js +255 -0
  26. package/dist/callTools.js.map +1 -0
  27. package/dist/chat.d.ts +226 -0
  28. package/dist/chat.d.ts.map +1 -0
  29. package/dist/chat.js +574 -0
  30. package/dist/chat.js.map +1 -0
  31. package/dist/config.d.ts +32 -0
  32. package/dist/config.d.ts.map +1 -0
  33. package/dist/config.js +86 -0
  34. package/dist/config.js.map +1 -0
  35. package/dist/consult.d.ts +147 -0
  36. package/dist/consult.d.ts.map +1 -0
  37. package/dist/consult.js +388 -0
  38. package/dist/consult.js.map +1 -0
  39. package/dist/delivery.d.ts +81 -0
  40. package/dist/delivery.d.ts.map +1 -0
  41. package/dist/delivery.js +187 -0
  42. package/dist/delivery.js.map +1 -0
  43. package/dist/echoGuard.d.ts +56 -0
  44. package/dist/echoGuard.d.ts.map +1 -0
  45. package/dist/echoGuard.js +57 -0
  46. package/dist/echoGuard.js.map +1 -0
  47. package/dist/errors.d.ts +5 -0
  48. package/dist/errors.d.ts.map +1 -0
  49. package/dist/errors.js +10 -0
  50. package/dist/errors.js.map +1 -0
  51. package/dist/fetch.d.ts +40 -0
  52. package/dist/fetch.d.ts.map +1 -0
  53. package/dist/fetch.js +240 -0
  54. package/dist/fetch.js.map +1 -0
  55. package/dist/gate.d.ts +80 -0
  56. package/dist/gate.d.ts.map +1 -0
  57. package/dist/gate.js +249 -0
  58. package/dist/gate.js.map +1 -0
  59. package/dist/handler.d.ts +283 -0
  60. package/dist/handler.d.ts.map +1 -0
  61. package/dist/handler.js +4 -0
  62. package/dist/handler.js.map +1 -0
  63. package/dist/hmac.d.ts +32 -0
  64. package/dist/hmac.d.ts.map +1 -0
  65. package/dist/hmac.js +108 -0
  66. package/dist/hmac.js.map +1 -0
  67. package/dist/index.d.ts +59 -0
  68. package/dist/index.d.ts.map +1 -0
  69. package/dist/index.js +60 -0
  70. package/dist/index.js.map +1 -0
  71. package/dist/lane.d.ts +92 -0
  72. package/dist/lane.d.ts.map +1 -0
  73. package/dist/lane.js +269 -0
  74. package/dist/lane.js.map +1 -0
  75. package/dist/lipsync.d.ts +136 -0
  76. package/dist/lipsync.d.ts.map +1 -0
  77. package/dist/lipsync.js +310 -0
  78. package/dist/lipsync.js.map +1 -0
  79. package/dist/log.d.ts +18 -0
  80. package/dist/log.d.ts.map +1 -0
  81. package/dist/log.js +20 -0
  82. package/dist/log.js.map +1 -0
  83. package/dist/media.d.ts +43 -0
  84. package/dist/media.d.ts.map +1 -0
  85. package/dist/media.js +190 -0
  86. package/dist/media.js.map +1 -0
  87. package/dist/minutes.d.ts +398 -0
  88. package/dist/minutes.d.ts.map +1 -0
  89. package/dist/minutes.js +805 -0
  90. package/dist/minutes.js.map +1 -0
  91. package/dist/outbound.d.ts +388 -0
  92. package/dist/outbound.d.ts.map +1 -0
  93. package/dist/outbound.js +933 -0
  94. package/dist/outbound.js.map +1 -0
  95. package/dist/plugins/cartesia/agent.d.ts +58 -0
  96. package/dist/plugins/cartesia/agent.d.ts.map +1 -0
  97. package/dist/plugins/cartesia/agent.js +254 -0
  98. package/dist/plugins/cartesia/agent.js.map +1 -0
  99. package/dist/plugins/cartesia/cli.d.ts +3 -0
  100. package/dist/plugins/cartesia/cli.d.ts.map +1 -0
  101. package/dist/plugins/cartesia/cli.js +10 -0
  102. package/dist/plugins/cartesia/cli.js.map +1 -0
  103. package/dist/plugins/cartesia/config.d.ts +30 -0
  104. package/dist/plugins/cartesia/config.d.ts.map +1 -0
  105. package/dist/plugins/cartesia/config.js +29 -0
  106. package/dist/plugins/cartesia/config.js.map +1 -0
  107. package/dist/plugins/cartesia/handler.d.ts +40 -0
  108. package/dist/plugins/cartesia/handler.d.ts.map +1 -0
  109. package/dist/plugins/cartesia/handler.js +142 -0
  110. package/dist/plugins/cartesia/handler.js.map +1 -0
  111. package/dist/plugins/cartesia/index.d.ts +6 -0
  112. package/dist/plugins/cartesia/index.d.ts.map +1 -0
  113. package/dist/plugins/cartesia/index.js +54 -0
  114. package/dist/plugins/cartesia/index.js.map +1 -0
  115. package/dist/plugins/deepgram/agent.d.ts +60 -0
  116. package/dist/plugins/deepgram/agent.d.ts.map +1 -0
  117. package/dist/plugins/deepgram/agent.js +302 -0
  118. package/dist/plugins/deepgram/agent.js.map +1 -0
  119. package/dist/plugins/deepgram/cli.d.ts +3 -0
  120. package/dist/plugins/deepgram/cli.d.ts.map +1 -0
  121. package/dist/plugins/deepgram/cli.js +10 -0
  122. package/dist/plugins/deepgram/cli.js.map +1 -0
  123. package/dist/plugins/deepgram/config.d.ts +39 -0
  124. package/dist/plugins/deepgram/config.d.ts.map +1 -0
  125. package/dist/plugins/deepgram/config.js +66 -0
  126. package/dist/plugins/deepgram/config.js.map +1 -0
  127. package/dist/plugins/deepgram/handler.d.ts +87 -0
  128. package/dist/plugins/deepgram/handler.d.ts.map +1 -0
  129. package/dist/plugins/deepgram/handler.js +268 -0
  130. package/dist/plugins/deepgram/handler.js.map +1 -0
  131. package/dist/plugins/deepgram/index.d.ts +11 -0
  132. package/dist/plugins/deepgram/index.d.ts.map +1 -0
  133. package/dist/plugins/deepgram/index.js +76 -0
  134. package/dist/plugins/deepgram/index.js.map +1 -0
  135. package/dist/plugins/echo/cli.d.ts +3 -0
  136. package/dist/plugins/echo/cli.d.ts.map +1 -0
  137. package/dist/plugins/echo/cli.js +10 -0
  138. package/dist/plugins/echo/cli.js.map +1 -0
  139. package/dist/plugins/echo/index.d.ts +37 -0
  140. package/dist/plugins/echo/index.d.ts.map +1 -0
  141. package/dist/plugins/echo/index.js +61 -0
  142. package/dist/plugins/echo/index.js.map +1 -0
  143. package/dist/plugins/elevenlabs/agent.d.ts +72 -0
  144. package/dist/plugins/elevenlabs/agent.d.ts.map +1 -0
  145. package/dist/plugins/elevenlabs/agent.js +305 -0
  146. package/dist/plugins/elevenlabs/agent.js.map +1 -0
  147. package/dist/plugins/elevenlabs/cli.d.ts +3 -0
  148. package/dist/plugins/elevenlabs/cli.d.ts.map +1 -0
  149. package/dist/plugins/elevenlabs/cli.js +10 -0
  150. package/dist/plugins/elevenlabs/cli.js.map +1 -0
  151. package/dist/plugins/elevenlabs/config.d.ts +27 -0
  152. package/dist/plugins/elevenlabs/config.d.ts.map +1 -0
  153. package/dist/plugins/elevenlabs/config.js +42 -0
  154. package/dist/plugins/elevenlabs/config.js.map +1 -0
  155. package/dist/plugins/elevenlabs/handler.d.ts +67 -0
  156. package/dist/plugins/elevenlabs/handler.d.ts.map +1 -0
  157. package/dist/plugins/elevenlabs/handler.js +419 -0
  158. package/dist/plugins/elevenlabs/handler.js.map +1 -0
  159. package/dist/plugins/elevenlabs/index.d.ts +11 -0
  160. package/dist/plugins/elevenlabs/index.d.ts.map +1 -0
  161. package/dist/plugins/elevenlabs/index.js +72 -0
  162. package/dist/plugins/elevenlabs/index.js.map +1 -0
  163. package/dist/plugins/livekit/cli.d.ts +3 -0
  164. package/dist/plugins/livekit/cli.d.ts.map +1 -0
  165. package/dist/plugins/livekit/cli.js +10 -0
  166. package/dist/plugins/livekit/cli.js.map +1 -0
  167. package/dist/plugins/livekit/config.d.ts +47 -0
  168. package/dist/plugins/livekit/config.d.ts.map +1 -0
  169. package/dist/plugins/livekit/config.js +46 -0
  170. package/dist/plugins/livekit/config.js.map +1 -0
  171. package/dist/plugins/livekit/handler.d.ts +59 -0
  172. package/dist/plugins/livekit/handler.d.ts.map +1 -0
  173. package/dist/plugins/livekit/handler.js +211 -0
  174. package/dist/plugins/livekit/handler.js.map +1 -0
  175. package/dist/plugins/livekit/index.d.ts +6 -0
  176. package/dist/plugins/livekit/index.d.ts.map +1 -0
  177. package/dist/plugins/livekit/index.js +68 -0
  178. package/dist/plugins/livekit/index.js.map +1 -0
  179. package/dist/plugins/livekit/room.d.ts +117 -0
  180. package/dist/plugins/livekit/room.d.ts.map +1 -0
  181. package/dist/plugins/livekit/room.js +449 -0
  182. package/dist/plugins/livekit/room.js.map +1 -0
  183. package/dist/plugins/openai/agent.d.ts +74 -0
  184. package/dist/plugins/openai/agent.d.ts.map +1 -0
  185. package/dist/plugins/openai/agent.js +264 -0
  186. package/dist/plugins/openai/agent.js.map +1 -0
  187. package/dist/plugins/openai/cli.d.ts +3 -0
  188. package/dist/plugins/openai/cli.d.ts.map +1 -0
  189. package/dist/plugins/openai/cli.js +10 -0
  190. package/dist/plugins/openai/cli.js.map +1 -0
  191. package/dist/plugins/openai/config.d.ts +29 -0
  192. package/dist/plugins/openai/config.d.ts.map +1 -0
  193. package/dist/plugins/openai/config.js +37 -0
  194. package/dist/plugins/openai/config.js.map +1 -0
  195. package/dist/plugins/openai/handler.d.ts +65 -0
  196. package/dist/plugins/openai/handler.d.ts.map +1 -0
  197. package/dist/plugins/openai/handler.js +297 -0
  198. package/dist/plugins/openai/handler.js.map +1 -0
  199. package/dist/plugins/openai/index.d.ts +6 -0
  200. package/dist/plugins/openai/index.d.ts.map +1 -0
  201. package/dist/plugins/openai/index.js +72 -0
  202. package/dist/plugins/openai/index.js.map +1 -0
  203. package/dist/plugins/openclaw/allowlist.d.ts +9 -0
  204. package/dist/plugins/openclaw/allowlist.d.ts.map +1 -0
  205. package/dist/plugins/openclaw/allowlist.js +11 -0
  206. package/dist/plugins/openclaw/allowlist.js.map +1 -0
  207. package/dist/plugins/openclaw/config.d.ts +50 -0
  208. package/dist/plugins/openclaw/config.d.ts.map +1 -0
  209. package/dist/plugins/openclaw/config.js +53 -0
  210. package/dist/plugins/openclaw/config.js.map +1 -0
  211. package/dist/plugins/openclaw/handler.d.ts +90 -0
  212. package/dist/plugins/openclaw/handler.d.ts.map +1 -0
  213. package/dist/plugins/openclaw/handler.js +146 -0
  214. package/dist/plugins/openclaw/handler.js.map +1 -0
  215. package/dist/plugins/openclaw/index.d.ts +55 -0
  216. package/dist/plugins/openclaw/index.d.ts.map +1 -0
  217. package/dist/plugins/openclaw/index.js +89 -0
  218. package/dist/plugins/openclaw/index.js.map +1 -0
  219. package/dist/plugins/openclaw/openclaw.plugin.json +74 -0
  220. package/dist/plugins/openclaw/package.json +14 -0
  221. package/dist/plugins/openclaw/realtime.d.ts +82 -0
  222. package/dist/plugins/openclaw/realtime.d.ts.map +1 -0
  223. package/dist/plugins/openclaw/realtime.js +238 -0
  224. package/dist/plugins/openclaw/realtime.js.map +1 -0
  225. package/dist/plugins/openclaw/runtime.d.ts +19 -0
  226. package/dist/plugins/openclaw/runtime.d.ts.map +1 -0
  227. package/dist/plugins/openclaw/runtime.js +160 -0
  228. package/dist/plugins/openclaw/runtime.js.map +1 -0
  229. package/dist/policy.d.ts +38 -0
  230. package/dist/policy.d.ts.map +1 -0
  231. package/dist/policy.js +95 -0
  232. package/dist/policy.js.map +1 -0
  233. package/dist/protocol.d.ts +44 -0
  234. package/dist/protocol.d.ts.map +1 -0
  235. package/dist/protocol.js +77 -0
  236. package/dist/protocol.js.map +1 -0
  237. package/dist/protocolRuntime.d.ts +19 -0
  238. package/dist/protocolRuntime.d.ts.map +1 -0
  239. package/dist/protocolRuntime.js +78 -0
  240. package/dist/protocolRuntime.js.map +1 -0
  241. package/dist/smoke.d.ts +65 -0
  242. package/dist/smoke.d.ts.map +1 -0
  243. package/dist/smoke.js +293 -0
  244. package/dist/smoke.js.map +1 -0
  245. package/dist/startup.d.ts +74 -0
  246. package/dist/startup.d.ts.map +1 -0
  247. package/dist/startup.js +112 -0
  248. package/dist/startup.js.map +1 -0
  249. package/dist/tile.d.ts +101 -0
  250. package/dist/tile.d.ts.map +1 -0
  251. package/dist/tile.js +195 -0
  252. package/dist/tile.js.map +1 -0
  253. package/dist/version.d.ts +2 -0
  254. package/dist/version.d.ts.map +1 -0
  255. package/dist/version.js +4 -0
  256. package/dist/version.js.map +1 -0
  257. package/dist/vision.d.ts +160 -0
  258. package/dist/vision.d.ts.map +1 -0
  259. package/dist/vision.js +301 -0
  260. package/dist/vision.js.map +1 -0
  261. package/dist/visionTools.d.ts +237 -0
  262. package/dist/visionTools.d.ts.map +1 -0
  263. package/dist/visionTools.js +578 -0
  264. package/dist/visionTools.js.map +1 -0
  265. package/dist/voice.d.ts +143 -0
  266. package/dist/voice.d.ts.map +1 -0
  267. package/dist/voice.js +403 -0
  268. package/dist/voice.js.map +1 -0
  269. package/package.json +129 -0
@@ -0,0 +1,398 @@
1
+ import type { ToolSpec } from "./callTools.js";
2
+ import type { PersonalChat } from "./chat.js";
3
+ /**
4
+ * Turns kept. A long meeting must not grow without limit inside a process that
5
+ * is also carrying live audio.
6
+ */
7
+ export declare const MAX_TRANSCRIPT_TURNS = 600;
8
+ /** Things shown. Far fewer than turns, because a screen changes slowly. */
9
+ export declare const MAX_TRANSCRIPT_VISUALS = 60;
10
+ /**
11
+ * What the summarising model is given. The tail, not the head: the end of a
12
+ * meeting is what the minutes are mostly about.
13
+ */
14
+ export declare const MAX_TRANSCRIPT_CHARS = 12000;
15
+ /**
16
+ * How long one entry may grow before the next fragment starts a new one.
17
+ *
18
+ * Streaming transcripts arrive as fragments and {@link Transcript.add} joins
19
+ * them back up. Without this cap, one long same-speaker run - an hour of a
20
+ * group call heard as a single stream - becomes one ever-growing entry that the
21
+ * entry count can never trim.
22
+ */
23
+ export declare const MAX_TRANSCRIPT_ENTRY_CHARS = 1000;
24
+ /**
25
+ * Entries a recap is written from. {@link MAX_TRANSCRIPT_TURNS} is the hard
26
+ * bound on what is HELD; this is the window that reaches the model, and
27
+ * {@link Transcript.render} applies it.
28
+ */
29
+ export declare const MAX_TRANSCRIPT_ENTRIES = 40;
30
+ /**
31
+ * Entries below which a recap is not worth running: under four turns there is
32
+ * no meeting to summarise, only a greeting.
33
+ */
34
+ export declare const RECAP_MIN_TURNS = 4;
35
+ /** Which side of the call a turn came from. */
36
+ export type TurnRole = "assistant" | "caller";
37
+ /** One turn: who said it, what they said, and which side they are on. */
38
+ export interface Turn {
39
+ readonly speaker: string;
40
+ readonly text: string;
41
+ /**
42
+ * Kept apart from {@link Turn.speaker} because the document labels the two
43
+ * sides differently, and because a fragment must never continue an entry from
44
+ * the other side. Absent on a turn built by hand, and absent means "caller".
45
+ */
46
+ readonly role?: TurnRole;
47
+ }
48
+ /** Options for {@link Transcript}. */
49
+ export interface TranscriptOptions {
50
+ /**
51
+ * Entries HELD before the oldest is discarded. Defaults to the hard bound,
52
+ * {@link MAX_TRANSCRIPT_TURNS}. Lower it only to hold less of a long call in
53
+ * memory: what reaches the model is {@link Transcript.render}'s own window.
54
+ */
55
+ maxEntries?: number;
56
+ }
57
+ /**
58
+ * What was said, and what was shown, in the order it happened.
59
+ *
60
+ * The audio track records who SAID what. The visual track records who SHOWED
61
+ * what, and it is the half a transcript-first recap structurally cannot have:
62
+ * the agent was on the call and looked at the screen.
63
+ *
64
+ * Both are bounded. Feed it as the call runs:
65
+ *
66
+ * ```ts
67
+ * transcript.add(callerName, "we should push the launch to March");
68
+ * transcript.addVisual("Sara's shared screen: the Q3 revenue dashboard");
69
+ * ```
70
+ */
71
+ export declare class Transcript {
72
+ #private;
73
+ constructor(options?: TranscriptOptions);
74
+ /** What was said, oldest first. */
75
+ get turns(): readonly Turn[];
76
+ /** What was shown, oldest first. */
77
+ get visuals(): readonly string[];
78
+ /**
79
+ * Record one turn. Empty text is ignored rather than recorded blank.
80
+ *
81
+ * A fragment continues the entry before it when the SAME speaker is still
82
+ * talking and the entry has room. Speech arrives in pieces, and a model fed
83
+ * half-sentences as separate turns writes minutes that read like a stutter.
84
+ *
85
+ * Merging across speakers is the case worth being careful about: every later
86
+ * person's words would be filed under the first speaker's name, which is
87
+ * worse than no attribution because it is confidently wrong. The role is
88
+ * checked with it, so the agent's own words never continue a caller's entry
89
+ * even on a call where both are recorded under one name.
90
+ */
91
+ add(speaker: string, text: string, role?: TurnRole): void;
92
+ /**
93
+ * Record something shown, for example a slide or a shared screen.
94
+ *
95
+ * Consecutive repeats are collapsed. The vision lane describes whatever is on
96
+ * screen each time it is asked, and a screen that has not changed would
97
+ * otherwise fill the record with the same line.
98
+ */
99
+ addVisual(what: string): void;
100
+ get empty(): boolean;
101
+ /**
102
+ * The transcript as the summarising model sees it.
103
+ *
104
+ * The last `maxEntries` entries, tailed again to `maxChars`. Both ends are
105
+ * deliberate: the recap window is small because a summary is mostly about how
106
+ * the meeting ENDED, and the character tail is what stops one long entry
107
+ * crowding out everything before it.
108
+ */
109
+ render(maxChars?: number, maxEntries?: number): string;
110
+ }
111
+ /**
112
+ * Whether somebody just asked for the meeting to be written up.
113
+ *
114
+ * Both halves are needed. "Summarise" alone is asked about a document, an email,
115
+ * or a page the agent is looking at; only paired with a word for the meeting
116
+ * itself does it mean minutes.
117
+ */
118
+ export declare function isSummaryRequest(text: string): boolean;
119
+ /**
120
+ * Ask a model for minutes, and only minutes.
121
+ *
122
+ * The instruction not to infer what was on screen is the load-bearing one. A
123
+ * model handed "Sara shared a dashboard" will happily invent the numbers on it,
124
+ * and minutes that invent numbers are worse than minutes with a gap.
125
+ */
126
+ export declare function minutesPrompt(transcript: string): string;
127
+ /**
128
+ * The tool a model calls to write the meeting up mid-call. Registered by a
129
+ * plugin that has somewhere to post it, which is why it is not a built-in: an
130
+ * agent on a one-to-one call has no chat to post minutes into.
131
+ */
132
+ export declare const MINUTES_TOOL: ToolSpec;
133
+ /**
134
+ * Where the minutes go. One value, decided once, before anything is written.
135
+ *
136
+ * Resolve it with {@link resolveMinutesTarget} at the start of a recap and pass
137
+ * this same object to every step after it: the summarising run, the document
138
+ * write and the send. No step downstream may work out a recipient of its own.
139
+ *
140
+ * That belt-and-braces reads as overkill until it happens: a message tool with
141
+ * no pinned target falls back to the operator's own chat when a reference is
142
+ * missing, and a customer's meeting minutes - the most sensitive thing this
143
+ * feature produces - are then delivered to the vendor. When the pinned target
144
+ * cannot be reached, not sending is the correct outcome. Sending somewhere else
145
+ * is not.
146
+ */
147
+ export interface DeliveryTarget {
148
+ /** The meeting chat, or the caller's own 1:1 chat with this bot. */
149
+ readonly kind: "thread" | "caller-dm";
150
+ readonly conversationId: string;
151
+ readonly tenantId: string;
152
+ }
153
+ /** What {@link resolveMinutesTarget} needs to decide where minutes go. */
154
+ export interface MinutesTargetOptions {
155
+ /** The call's thread id, as `session.start` gave it. */
156
+ threadId?: string;
157
+ /** Humans on the call, when a participants frame carried one. */
158
+ humanCount?: number;
159
+ /** The caller's AAD object id. A call that names nobody gets no target. */
160
+ callerAadId?: string;
161
+ /**
162
+ * The caller's remembered 1:1 chat, from `PersonalChats.forCaller()`, which
163
+ * is where the four narrowing rules live.
164
+ */
165
+ callerChat?: PersonalChat;
166
+ /** The tenant from `session.start`. The first choice, and normally the one. */
167
+ sessionTenantId?: string;
168
+ /** The tenant this worker is configured for. */
169
+ configTenantId?: string;
170
+ }
171
+ /**
172
+ * Decide where a recap should be posted, before a single token is generated.
173
+ *
174
+ * ```ts
175
+ * const target = resolveMinutesTarget({
176
+ * threadId: session.threadId,
177
+ * humanCount: session.humanCount,
178
+ * callerAadId: session.caller.aadId,
179
+ * callerChat: chats.forCaller({ callerAadId, tenantId }),
180
+ * sessionTenantId: session.tenantId,
181
+ * });
182
+ * ```
183
+ *
184
+ * A group call is minuted into the meeting it summarises. Two signals say it is
185
+ * one, and either will do: a human count of two or more, and a meeting thread
186
+ * id. The count only arrives on topologies that send a participants frame - on
187
+ * a hosted worker it stays pinned at 1 - so a count-only test sent every
188
+ * MEETING recap to the caller's private chat instead, which is the minutes of a
189
+ * group call landing in one attendee's DM. The thread id is on `session.start`
190
+ * already and needs no roster.
191
+ *
192
+ * Anything else is a 1:1 call, and the target is the caller's own chat with
193
+ * this bot, which is admitted by `PersonalChats.forCaller()` and its four
194
+ * narrowing rules. The first of those is worth restating here: a chat counts as
195
+ * personal because its SCOPE says so, never because of how its conversation id
196
+ * is spelled. A bot's personal chat is addressed `a:1...`, while `19:...` is
197
+ * precisely the group and channel shape the rule exists to exclude, so an
198
+ * id-prefix test admits nothing at all.
199
+ *
200
+ * The tenant is taken from `session.start`, then from configuration, then from
201
+ * the remembered chat's sender. All three describe the tenant this worker is
202
+ * bound to. The caller's own tenant id is deliberately not one of them and is
203
+ * not even accepted here: it describes whoever is on the phone, and for a guest
204
+ * it is foreign or absent, so addressing a conversation with it reaches into an
205
+ * organisation this worker was never bound to. It is the one plausible-looking
206
+ * source that is actively wrong.
207
+ *
208
+ * Returns undefined when there is nowhere safe to post, which is a real answer:
209
+ * a call that identifies nobody and has no thread gets no minutes rather than
210
+ * minutes in a stranger's chat.
211
+ *
212
+ * One target comes back, the best one. When a caller keeps more than one
213
+ * admissible target - the thread first, the caller's chat behind it - the rule
214
+ * for walking to the next is: advance on an HTTP 404 and on nothing else. A
215
+ * gateway posts through a stored conversation reference and holds one only for
216
+ * conversations it has seen an activity from, so a meeting joined over the
217
+ * calling path answers 404 while the caller's own chat is perfectly reachable.
218
+ * A 401 is our signing and a 5xx is the gateway, and both would fail the same
219
+ * way at the next target; 404 is also the only status that proves nothing was
220
+ * delivered, so it is the only one where trying again cannot double-post.
221
+ */
222
+ export declare function resolveMinutesTarget(options: MinutesTargetOptions): DeliveryTarget | undefined;
223
+ /** What happened when the meeting was written up. */
224
+ export interface RecapResult {
225
+ /** One sentence for the agent to say. Always present, including on failure. */
226
+ readonly spoken: string;
227
+ /** The minutes themselves, empty when none were produced. */
228
+ readonly minutes: string;
229
+ /** Where the Word document was written, when one was. */
230
+ readonly document?: string;
231
+ /** Whether the minutes actually reached the chat. */
232
+ readonly delivered: boolean;
233
+ /** Which target took them, when one did. */
234
+ readonly target?: DeliveryTarget;
235
+ }
236
+ /** Turn a transcript into minutes. Normally a {@link Consultant}. */
237
+ export type Summariser = (prompt: string) => Promise<string>;
238
+ /**
239
+ * What the gateway said about one attempted post.
240
+ *
241
+ * Branch on {@link PostOutcome.ok}, and never test the outcome itself for
242
+ * truth: an object is always truthy, so a recap the gateway rejected with a 404
243
+ * or a 401 reads as delivered, which is the very failure the log line exists to
244
+ * catch.
245
+ */
246
+ export interface PostOutcome {
247
+ /** Whether the message actually landed. */
248
+ readonly ok: boolean;
249
+ /**
250
+ * The HTTP status behind it, when there was one. 404 is the only status that
251
+ * means this conversation cannot be reached, and the only one on which a
252
+ * second target is tried.
253
+ */
254
+ readonly status?: number;
255
+ }
256
+ /**
257
+ * Post the minutes into ONE named conversation.
258
+ *
259
+ * The target is handed over with the text rather than looked up again, because
260
+ * the recipient was settled before the summarising run and nothing downstream
261
+ * may choose another one. Return a {@link PostOutcome}, or a bare boolean where
262
+ * no status is available.
263
+ */
264
+ export type Poster = (target: DeliveryTarget, text: string) => Promise<PostOutcome | boolean>;
265
+ /**
266
+ * Said in the message when a document was written but could not ride along.
267
+ *
268
+ * A chat reply carries text and cards, not files. Somebody who was told the
269
+ * minutes were coming with a document, and gets text with no explanation,
270
+ * assumes the attachment was lost in transit and goes looking for it.
271
+ */
272
+ export declare const DOCUMENT_NOT_ATTACHED: string;
273
+ /** Options for {@link postMinutes}. */
274
+ export interface PostMinutesOptions {
275
+ /** Where to keep the Word document. Omit and none is written. */
276
+ documentDir?: string;
277
+ /** The line under the document title, naming the call. */
278
+ subtitle?: string;
279
+ /** What the agent is called in the attributed transcript. */
280
+ assistantLabel?: string;
281
+ /** What an unnamed caller is called in the attributed transcript. */
282
+ callerLabel?: string;
283
+ }
284
+ /**
285
+ * Write the meeting up and post it. Never throws.
286
+ *
287
+ * This normally runs during teardown, where an exception takes the whole
288
+ * teardown with it, so every failure here comes back as a sentence instead.
289
+ *
290
+ * A call with nowhere to post is told apart from a call with nothing to say.
291
+ * Conflating them tells people their conversation did not count when it did.
292
+ *
293
+ * The target comes in already resolved, by {@link resolveMinutesTarget}, and is
294
+ * passed on to the delivery unchanged. A 1:1 call is no longer a refusal: it
295
+ * has a caller with their own chat, and that chat is a real target. Only an
296
+ * undefined target, which means nowhere safe was found, still says so out loud.
297
+ *
298
+ * Pass several targets, best first, when more than one conversation is
299
+ * admissible. The next is tried ONLY when the gateway answers 404.
300
+ */
301
+ export declare function postMinutes(summarise: Summariser, transcript: Transcript, target: DeliveryTarget | readonly DeliveryTarget[] | undefined, deliver: Poster, options?: PostMinutesOptions): Promise<RecapResult>;
302
+ /** One headed block of minutes: a heading, and the lines under it. */
303
+ export interface MinutesSection {
304
+ readonly heading: string;
305
+ readonly items: readonly string[];
306
+ }
307
+ /**
308
+ * Read a model's markdown minutes into sections, for the document writer.
309
+ *
310
+ * Pure and total: every line of the input reaches the output, no line is
311
+ * dropped silently, and nothing here reads or writes anything.
312
+ *
313
+ * ```ts
314
+ * parseMinutesSections("### Decisions\n- the launch moves to March");
315
+ * // [{ heading: "Decisions", items: ["the launch moves to March"] }]
316
+ * ```
317
+ *
318
+ * Every form a summarising model actually emits is accepted. Asked for
319
+ * "### Key points" it returns "## Key points", "# Key points" or
320
+ * "**Key points:**" depending on the model and the day, and accepting one form
321
+ * only produced a single unheaded blob: the document still built, with every
322
+ * section break gone and nothing raised anywhere.
323
+ *
324
+ * The same goes for bullets. Models mix "- ", "* ", "• " and "1. " inside one
325
+ * answer, and often write a whole section as one prose paragraph with no bullet
326
+ * at all, so a line under a heading that carries no marker is kept as written
327
+ * rather than discarded.
328
+ *
329
+ * Content that arrives before any heading opens a section called "Summary",
330
+ * because a model that ignores the format instruction and answers in one
331
+ * paragraph would otherwise parse to nothing and produce a document with a
332
+ * title and no body.
333
+ *
334
+ * Sections with no items survive here on purpose. Omitting them is the
335
+ * DOCUMENT's job ({@link writeMinutesDocx}), which keeps this function
336
+ * round-trippable and leaves one place that decides what is worth printing.
337
+ */
338
+ export declare function parseMinutesSections(text: string): MinutesSection[];
339
+ /**
340
+ * Speaker attribution the text already carries: a name, a colon and a space.
341
+ *
342
+ * ```ts
343
+ * hasSpeakerPrefix("Sara: we should ship on Friday"); // true
344
+ * ```
345
+ *
346
+ * Only for the compatibility case where a caller hands in turns with the name
347
+ * baked into the text. A {@link Turn} carries its speaker in its own field,
348
+ * which is better, and needs no test.
349
+ *
350
+ * A leading colon and a leading space are both rejected, so ": ok" and
351
+ * " Sara: ok" are not mistaken for attribution.
352
+ */
353
+ export declare function hasSpeakerPrefix(text: string): boolean;
354
+ /** Options for {@link writeMinutesDocx}. All optional: old calls still hold. */
355
+ export interface WriteMinutesDocxOptions {
356
+ /** One line under the title, naming the call. */
357
+ subtitle?: string;
358
+ /**
359
+ * Sections from {@link parseMinutesSections}. Given these, the `minutes`
360
+ * string is not read line by line: these are what gets written.
361
+ */
362
+ sections?: readonly MinutesSection[];
363
+ /**
364
+ * Turns to write up as an attributed transcript after the sections. A turn is
365
+ * named by its own speaker; one recorded as "assistant" takes
366
+ * `assistantLabel`, and one with no speaker at all takes `callerLabel`.
367
+ */
368
+ transcript?: Iterable<Turn>;
369
+ /** What the agent is called. Default "Assistant". */
370
+ assistantLabel?: string;
371
+ /** What an unnamed caller is called. Default "Caller". */
372
+ callerLabel?: string;
373
+ }
374
+ /**
375
+ * Write minutes to a Word-openable document, with no dependencies.
376
+ *
377
+ * ```ts
378
+ * writeMinutesDocx("Meeting minutes", minutes, path, {
379
+ * subtitle: "Call with Dana - ~12 min, 3 human participants.",
380
+ * sections: parseMinutesSections(minutes),
381
+ * transcript: transcript.turns,
382
+ * });
383
+ * ```
384
+ *
385
+ * A .docx is a zip of four XML parts, and emitting them directly is a few dozen
386
+ * lines. A document format library would be a dependency every install pays for
387
+ * so that the small fraction who ask for minutes get a file, which is the wrong
388
+ * trade for an SDK.
389
+ *
390
+ * With no options it behaves as it always has: markdown emphasis around a whole
391
+ * line becomes a bold heading, because that is what a model reaches for.
392
+ *
393
+ * A section whose items are all blank is left out entirely, heading and all. A
394
+ * bare "Decisions" over white space reads as a section the agent failed to
395
+ * fill, rather than one that had nothing in it.
396
+ */
397
+ export declare function writeMinutesDocx(title: string, minutes: string, path: string, options?: WriteMinutesDocxOptions): void;
398
+ //# sourceMappingURL=minutes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"minutes.d.ts","sourceRoot":"","sources":["../src/minutes.ts"],"names":[],"mappings":"AAqCA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAI9C;;;GAGG;AACH,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC,2EAA2E;AAC3E,eAAO,MAAM,sBAAsB,KAAK,CAAC;AAEzC;;;GAGG;AACH,eAAO,MAAM,oBAAoB,QAAS,CAAC;AAE3C;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B,OAAO,CAAC;AAE/C;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,KAAK,CAAC;AAEzC;;;GAGG;AACH,eAAO,MAAM,eAAe,IAAI,CAAC;AAKjC,+CAA+C;AAC/C,MAAM,MAAM,QAAQ,GAAG,WAAW,GAAG,QAAQ,CAAC;AAE9C,yEAAyE;AACzE,MAAM,WAAW,IAAI;IACnB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,CAA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