@vinaverse/client 0.1.0-alpha.3 → 0.1.0-alpha.5
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/README.md +46 -0
- package/dist/agent/index.cjs +2852 -0
- package/dist/agent/index.cjs.map +1 -0
- package/dist/agent/index.d.cts +57 -0
- package/dist/agent/index.d.ts +57 -0
- package/dist/agent/index.js +99 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/chunk-3WR2SUG2.js +416 -0
- package/dist/chunk-3WR2SUG2.js.map +1 -0
- package/dist/{chunk-AWHPWRGT.js → chunk-GWLLUOFY.js} +71 -15
- package/dist/chunk-GWLLUOFY.js.map +1 -0
- package/dist/chunk-VSJDVLCP.js +9 -0
- package/dist/chunk-VSJDVLCP.js.map +1 -0
- package/dist/chunk-ZWG2TMUL.js +975 -0
- package/dist/chunk-ZWG2TMUL.js.map +1 -0
- package/dist/contract-_NMdPjgN.d.cts +6 -0
- package/dist/contract-_NMdPjgN.d.ts +6 -0
- package/dist/conversation/index.cjs +198 -27
- package/dist/conversation/index.cjs.map +1 -1
- package/dist/conversation/index.d.cts +23 -343
- package/dist/conversation/index.d.ts +23 -343
- package/dist/conversation/index.js +36 -896
- package/dist/conversation/index.js.map +1 -1
- package/dist/index.cjs +70 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/runtime-B4nKwOTF.d.ts +232 -0
- package/dist/runtime-DDxwWBBr.d.cts +232 -0
- package/dist/{session--W6JXfwo.d.cts → session-8W3fRNeb.d.cts} +1635 -251
- package/dist/{session--W6JXfwo.d.ts → session-8W3fRNeb.d.ts} +1635 -251
- package/dist/store-C7FtS5AY.d.cts +384 -0
- package/dist/store-DFk0ayh8.d.ts +384 -0
- package/dist/testing/index.cjs +237 -0
- package/dist/testing/index.cjs.map +1 -0
- package/dist/testing/index.d.cts +49 -0
- package/dist/testing/index.d.ts +49 -0
- package/dist/testing/index.js +222 -0
- package/dist/testing/index.js.map +1 -0
- package/package.json +36 -4
- package/dist/chunk-AWHPWRGT.js.map +0 -1
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export { C as CONTRACT } from '../contract-_NMdPjgN.js';
|
|
2
|
+
import { Q as Question, A as AnswerInput } from '../session-8W3fRNeb.js';
|
|
3
|
+
export { a as Card, b as CardGroup, c as CardImage, d as CardKind, C as CardLink, e as ClientErrorCode, H as HeldCard, f as HeldQuestion, P as Proposal, g as ProposalOutcome, T as ToolLine, V as VinaverseClientError, W as Welcome, i as isKnownCard } from '../session-8W3fRNeb.js';
|
|
4
|
+
import { C as ConversationStore, a as ConversationOptions, S as SessionRequest, b as ConversationSession } from '../store-DFk0ayh8.js';
|
|
5
|
+
export { c as CardItem, d as ConversationBanner, e as ConversationPersistence, f as ConversationStatus, g as ConversationView, F as FrameScheduler, M as MAX_TEXT, h as MessageItem, i as MessageState, j as SessionReason, k as StreamingText, l as SystemEvent, m as SystemItem, T as TimelineItem, n as createConversation } from '../store-DFk0ayh8.js';
|
|
3
6
|
|
|
4
7
|
type AnswerProblem =
|
|
5
8
|
/** Nothing chosen or typed, and the question is required (or skipped while required). */
|
|
@@ -34,352 +37,29 @@ declare function isValidLinkPrefix(prefix: string): boolean;
|
|
|
34
37
|
*/
|
|
35
38
|
declare function isAllowedLink(link: string, prefixes: readonly string[]): boolean;
|
|
36
39
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
/** The backend gave no session (`getSession` failed): `start()` tries again. */
|
|
41
|
-
| 'unavailable' | 'connecting' | 'ready' | 'reconnecting'
|
|
42
|
-
/** Disconnected after a normal close: the next action connects again. */
|
|
43
|
-
| 'idle'
|
|
44
|
-
/** The reconnect attempts are spent, or the app reported no network: the next action, or `setOnline(true)`, connects. */
|
|
45
|
-
| 'offline'
|
|
46
|
-
/** Turns run over SSE: answers to question cards need the WebSocket (`answersNeedWebSocket`). */
|
|
47
|
-
| 'sse'
|
|
48
|
-
/** The session ended; `next` says how the conversation goes on. */
|
|
49
|
-
| 'ended'
|
|
50
|
-
/** The client secret was refused and no fresh one could be had. */
|
|
51
|
-
| 'unauthorized'
|
|
52
|
-
/** `dispose()` or `clear()` closed it. */
|
|
53
|
-
| 'closed';
|
|
54
|
-
/** What the UI shows above the conversation, if anything. Copy is the UI's. */
|
|
55
|
-
type ConversationBanner = 'connecting' | 'reconnecting' | 'offline' | 'continued_elsewhere' | 'unavailable' | null;
|
|
56
|
-
type MessageState =
|
|
57
|
-
/** On the server (a turn started with it, or the agent's or staff's reply). */
|
|
58
|
-
'sent'
|
|
59
|
-
/** Recorded for the business during a takeover (`input.received`). */
|
|
60
|
-
| 'delivered'
|
|
61
|
-
/** Sent, not acknowledged yet. */
|
|
62
|
-
| 'sending'
|
|
63
|
-
/** Held for the next session: "sends when you continue", never a failure. */
|
|
64
|
-
| 'held'
|
|
65
|
-
/** Refused for good, or its retries spent: shown with `rejection`; `retry(key)` sends it again. */
|
|
66
|
-
| 'not_sent'
|
|
67
|
-
/** The agent's reply still streaming: its text comes from `getStreaming()`. */
|
|
68
|
-
| 'streaming';
|
|
69
|
-
interface MessageItem {
|
|
70
|
-
readonly type: 'message';
|
|
71
|
-
readonly key: string;
|
|
72
|
-
/** `agent` for the protocol's `assistant`; `staff` is a person from the business. */
|
|
73
|
-
readonly role: 'agent' | 'person' | 'staff' | (string & {});
|
|
74
|
-
readonly text: string;
|
|
75
|
-
readonly state: MessageState;
|
|
76
|
-
/** A reply cut off after part of it streamed: `blocked`, `interrupted` or `failed`. */
|
|
77
|
-
readonly partial?: 'blocked' | 'interrupted' | 'failed';
|
|
78
|
-
/** The agent's reply is a guardrail refusal of the person's message. */
|
|
79
|
-
readonly refusal?: true;
|
|
80
|
-
/** Why a `not_sent` message was refused (`input.rejected`, or the client's own reason). */
|
|
81
|
-
readonly rejection?: {
|
|
82
|
-
readonly code: string;
|
|
83
|
-
readonly message: string;
|
|
84
|
-
};
|
|
40
|
+
/** A session request, with the mode it is for. */
|
|
41
|
+
interface ModeSessionRequest extends SessionRequest {
|
|
42
|
+
readonly mode: string;
|
|
85
43
|
}
|
|
86
|
-
interface
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
readonly
|
|
91
|
-
/** A proposal being decided by the tenant's handler (`decideProposal`): draw its buttons busy. */
|
|
92
|
-
readonly busy: boolean;
|
|
93
|
-
/** Restored from `persistence` after a restart: drawn as it was, taking no answer or action. */
|
|
94
|
-
readonly restored?: true;
|
|
95
|
-
/** The tenant's decision on this proposal failed (`decideProposal` threw): nothing was reported; it may be tried again. */
|
|
96
|
-
readonly decisionError?: true;
|
|
44
|
+
interface ConversationsByModeOptions extends Omit<ConversationOptions, 'getSession'> {
|
|
45
|
+
/** Your backend creates the session for the mode's agent (its `subject.type`, its agent), with its service key. */
|
|
46
|
+
readonly getSession: (request: ModeSessionRequest) => Promise<ConversationSession>;
|
|
47
|
+
/** Every mode the app has, so `clear()` forgets each one's kept history, even one not opened since launch. */
|
|
48
|
+
readonly modes?: readonly string[];
|
|
97
49
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
readonly key: string;
|
|
102
|
-
readonly event: SystemEvent;
|
|
50
|
+
interface ConversationsByMode {
|
|
51
|
+
/** The mode's store, made the first time it is asked for; the same store after that. */
|
|
52
|
+
get(mode: string): ConversationStore;
|
|
103
53
|
/**
|
|
104
|
-
*
|
|
105
|
-
* `
|
|
106
|
-
* the server allows a retry and the person's text that started the turn is known, so `retryTurn(key)` sends it
|
|
107
|
-
* again (false once it did).
|
|
54
|
+
* The mode the person switched to: its store, with every other mode's sent to the background (no pings; closed
|
|
55
|
+
* with `closeInBackground`). The kit then drives the selected one with the app's foreground and background.
|
|
108
56
|
*/
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
type TimelineItem = MessageItem | CardItem | SystemItem;
|
|
112
|
-
interface ConversationView {
|
|
113
|
-
readonly status: ConversationStatus;
|
|
114
|
-
/** The conversation the sessions belong to, once a session named it; for the tenant's own records and support. */
|
|
115
|
-
readonly conversationId: string | null;
|
|
116
|
-
readonly banner: ConversationBanner;
|
|
117
|
-
/**
|
|
118
|
-
* How the conversation goes on after the session ended: `continue` on the person's next action (it resumes on its
|
|
119
|
-
* own), `continue_here` only when the person asks (`continueHere()`: it continued on another device).
|
|
120
|
-
*/
|
|
121
|
-
readonly next: 'continue' | 'continue_here' | null;
|
|
122
|
-
readonly agent: {
|
|
123
|
-
readonly name: string | null;
|
|
124
|
-
readonly avatarUrl: string | null;
|
|
125
|
-
};
|
|
126
|
-
/** The server's AI disclosure; null until the first one, when the UI shows its own line. Never hidden. */
|
|
127
|
-
readonly disclosure: string | null;
|
|
128
|
-
/** While a person from the business replies: their role (`by`, never a name). */
|
|
129
|
-
readonly takeover: {
|
|
130
|
-
readonly by: string | null;
|
|
131
|
-
readonly at: string;
|
|
132
|
-
} | null;
|
|
133
|
-
/** Oldest first: history restored from `persistence`, then the conversation. */
|
|
134
|
-
readonly items: readonly TimelineItem[];
|
|
135
|
-
/** The turn's tool lines while it runs ("Searching professionals…"); empty otherwise. */
|
|
136
|
-
readonly activity: readonly ToolLine[];
|
|
137
|
-
/** A turn is in progress: the agent is working or replying (`cancel()` stops it). */
|
|
138
|
-
readonly responding: boolean;
|
|
139
|
-
/** The newest open question card's `id`. */
|
|
140
|
-
readonly openQuestion: string | null;
|
|
141
|
-
/** Over SSE: question cards cannot be answered, so the UI points to the composer. */
|
|
142
|
-
readonly answersNeedWebSocket: boolean;
|
|
143
|
-
readonly turnsLeft: number | null;
|
|
144
|
-
/**
|
|
145
|
-
* The conversation kept on the device (`persistence`): `none` without it, `restoring` while async storage is read
|
|
146
|
-
* (draw a skeleton, not an empty conversation), `restored` once read, whatever it held.
|
|
147
|
-
*/
|
|
148
|
-
readonly history: 'none' | 'restoring' | 'restored';
|
|
149
|
-
}
|
|
150
|
-
/** The reply streaming now, flushed at most once per frame. */
|
|
151
|
-
interface StreamingText {
|
|
152
|
-
/** The streaming message item's `key`. */
|
|
153
|
-
readonly key: string;
|
|
154
|
-
readonly turnId: string;
|
|
155
|
-
readonly text: string;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/** Why the store asks the tenant's backend for a session. */
|
|
159
|
-
type SessionReason =
|
|
160
|
-
/** The conversation opens (`start()`). */
|
|
161
|
-
'open'
|
|
162
|
-
/** The session ended (idle, expired, its turn limit) and the person acted again. */
|
|
163
|
-
| 'resume'
|
|
164
|
-
/** The conversation continued on another device, and the person chose to continue here. */
|
|
165
|
-
| 'continue_here';
|
|
166
|
-
interface SessionRequest {
|
|
167
|
-
readonly reason: SessionReason;
|
|
168
|
-
/** The conversation so far, when known: the backend names it (with its `conversation_key`) to resume it. */
|
|
169
|
-
readonly conversationId: string | null;
|
|
170
|
-
/** For `subject.locale` and `subject.timezone`, which the backend sets. */
|
|
171
|
-
readonly locale?: string;
|
|
172
|
-
readonly timeZone?: string;
|
|
173
|
-
/**
|
|
174
|
-
* Aborted when the answer is no longer wanted (the conversation was disposed or cleared, or a newer request took
|
|
175
|
-
* its place): pass it to `fetch`, so a late answer never opens a socket after the person left.
|
|
176
|
-
*/
|
|
177
|
-
readonly signal?: AbortSignal;
|
|
178
|
-
}
|
|
179
|
-
/** What `createSession` gave the tenant's backend, as it passes it on: the session, its agent and disclosure. */
|
|
180
|
-
type ConversationSession = SessionInfo & {
|
|
181
|
-
readonly agent?: {
|
|
182
|
-
readonly display_name?: string;
|
|
183
|
-
readonly avatar_url?: string;
|
|
184
|
-
};
|
|
185
|
-
readonly disclosure?: string;
|
|
186
|
-
};
|
|
187
|
-
/**
|
|
188
|
-
* Runs a callback before the next frame; `requestAnimationFrame` where there is one. Every listener, of the view and
|
|
189
|
-
* of the streaming text, is called from it, at most once per frame: a zone.js app re-enters its zone here once. A
|
|
190
|
-
* test passes one that runs the callback at once.
|
|
191
|
-
*/
|
|
192
|
-
interface FrameScheduler {
|
|
193
|
-
request(callback: () => void): unknown;
|
|
194
|
-
cancel(handle: unknown): void;
|
|
195
|
-
}
|
|
196
|
-
/** Where the drawn conversation is kept across app restarts (opt-in; prefer encrypted storage). */
|
|
197
|
-
interface ConversationPersistence {
|
|
198
|
-
getItem(key: string): string | null | Promise<string | null>;
|
|
199
|
-
setItem(key: string, value: string): void | Promise<void>;
|
|
200
|
-
removeItem(key: string): void | Promise<void>;
|
|
201
|
-
}
|
|
202
|
-
interface ConversationOptions {
|
|
203
|
-
/**
|
|
204
|
-
* A session from the tenant's backend, which creates it with its service key (the app never holds one). Asked once
|
|
205
|
-
* per need: when the conversation opens, and on the person's action after a session ended.
|
|
206
|
-
*/
|
|
207
|
-
readonly getSession: (request: SessionRequest) => Promise<ConversationSession>;
|
|
208
|
-
/** A fresh client secret for a session (on 4401), from the tenant's backend. */
|
|
209
|
-
readonly refreshSecret?: (sessionId: string) => Promise<ClientSecret | string>;
|
|
210
|
-
readonly locale?: string;
|
|
211
|
-
readonly timeZone?: string;
|
|
212
|
-
/** The prefixes the tenant registered for card links (`checkLink`). */
|
|
213
|
-
readonly deepLinkPrefixes?: readonly string[];
|
|
214
|
-
/** Keep the drawn conversation across restarts (off unless given). */
|
|
215
|
-
readonly persistence?: ConversationPersistence;
|
|
216
|
-
/** Its key; one per signed-in person. Default `vinaverse.conversation`. */
|
|
217
|
-
readonly persistenceKey?: string;
|
|
218
|
-
/** Default: `requestAnimationFrame`, else a 16 ms timer, resolved when first used (never at import or creation). */
|
|
219
|
-
readonly scheduler?: FrameScheduler;
|
|
220
|
-
/** The transport's own options (`auth`, `webSocket`, `fetch`, delays…). */
|
|
221
|
-
readonly transport?: Omit<SessionOptions, 'session' | 'refreshSecret' | 'engine' | 'createId'>;
|
|
222
|
-
/** New `client_event_id`s. Default: random, `ce_` and 22 characters. */
|
|
223
|
-
readonly createId?: () => string;
|
|
224
|
-
/** Something failed that no call returned: getting a session, an input that could not be delivered. */
|
|
225
|
-
readonly onError?: (error: unknown) => void;
|
|
226
|
-
/**
|
|
227
|
-
* Close the connection while the app is in the background, and open it again in the foreground (a backend that
|
|
228
|
-
* mints a client secret per connection: with `refreshSecret`, a fresh one is asked for first). Default false: the
|
|
229
|
-
* connection stays, with no pings, until the session idles out. Nothing typed or answered is lost either way.
|
|
230
|
-
*/
|
|
231
|
-
readonly closeInBackground?: boolean;
|
|
232
|
-
}
|
|
233
|
-
/** A text is at most 2000 code points (`TurnInput`). */
|
|
234
|
-
declare const MAX_TEXT = 2000;
|
|
235
|
-
declare class ConversationStore {
|
|
236
|
-
private readonly options;
|
|
237
|
-
private readonly engine;
|
|
238
|
-
private session;
|
|
239
|
-
private info;
|
|
240
|
-
private getting;
|
|
241
|
-
private failed;
|
|
242
|
-
private disposed;
|
|
243
|
-
private online;
|
|
244
|
-
private foreground;
|
|
245
|
-
private lastStatus;
|
|
246
|
-
private offlineAfterRetries;
|
|
247
|
-
/** The id the next send gets, so a text typed before the session keeps its key. */
|
|
248
|
-
private nextId;
|
|
249
|
-
private readonly sent;
|
|
250
|
-
private readonly early;
|
|
251
|
-
private readonly retried;
|
|
252
|
-
private readonly busy;
|
|
253
|
-
/** Proposals whose tenant decision threw: shown as recoverable, the person may decide again. */
|
|
254
|
-
private readonly decisionErrors;
|
|
255
|
-
private system;
|
|
256
|
-
/** The person's text that started each recent turn, by `turn_id` (`turn.started` echoes its `client_event_id`). */
|
|
257
|
-
private readonly turnInputs;
|
|
258
|
-
/** Numbers system rows that carry no id of their own. */
|
|
259
|
-
private systemSeq;
|
|
260
|
-
private history;
|
|
261
|
-
private historyState;
|
|
262
|
-
/** A resumed session.ready carried a transcript: the server's history replaced what the device kept. */
|
|
263
|
-
private transcriptSeen;
|
|
264
|
-
/** The session of the last session.ready: a card of another one takes no tap (§6). */
|
|
265
|
-
private readySession;
|
|
266
|
-
private cardOrder;
|
|
267
|
-
private kept;
|
|
268
|
-
private locale;
|
|
269
|
-
/** The request for a session in flight, to abort when it is no longer wanted. */
|
|
270
|
-
private fetching;
|
|
271
|
-
private view;
|
|
272
|
-
private readonly listeners;
|
|
273
|
-
private streaming;
|
|
274
|
-
private readonly streamListeners;
|
|
275
|
-
/** The frame that will notify, and what it will notify about. */
|
|
276
|
-
private frame;
|
|
277
|
-
private framePending;
|
|
278
|
-
private viewDirty;
|
|
279
|
-
private streamDirty;
|
|
280
|
-
private persistTimer;
|
|
281
|
-
private unsubscribe;
|
|
282
|
-
constructor(options: ConversationOptions);
|
|
283
|
-
getSnapshot: () => ConversationView;
|
|
284
|
-
subscribe: (listener: () => void) => (() => void);
|
|
285
|
-
getStreaming: () => StreamingText | null;
|
|
286
|
-
subscribeStreaming: (listener: () => void) => (() => void);
|
|
287
|
-
/** Whether a card's link may be opened (the deep-link rule, against `deepLinkPrefixes`). */
|
|
288
|
-
checkLink(link: string): boolean;
|
|
289
|
-
/** Ask for a session and connect, early: a client secret must open its first connection within two minutes. */
|
|
290
|
-
start(): void;
|
|
291
|
-
/** Close for good. */
|
|
57
|
+
select(mode: string): ConversationStore;
|
|
58
|
+
/** Close every mode's store. */
|
|
292
59
|
dispose(): void;
|
|
293
|
-
/** Close
|
|
60
|
+
/** Close every mode's store and forget what each kept on the device (sign-out). */
|
|
294
61
|
clear(): void;
|
|
295
|
-
/**
|
|
296
|
-
* The person switched the app's language: the UI's words change at once (the kit's own locale); the next session
|
|
297
|
-
* asks for this locale (`subject.locale`). The open session keeps its language: the agent answers in the new one
|
|
298
|
-
* from the next session, and the store never starts a session for it.
|
|
299
|
-
*/
|
|
300
|
-
setLocale(locale: string | undefined): void;
|
|
301
|
-
/** The app came to the foreground or went to the background (AppState, `visibilitychange`). */
|
|
302
|
-
setForeground(foreground: boolean): void;
|
|
303
|
-
/** In the background (`closeInBackground`): the connection is closed; the engine keeps what was sent, to resend. */
|
|
304
|
-
private suspended;
|
|
305
|
-
private suspend;
|
|
306
|
-
/** Back in the foreground: a new connection to the same session, with a fresh secret when the backend gives one. */
|
|
307
|
-
private wake;
|
|
308
|
-
/** The network as the app sees it; null when unknown. Back online reconnects a connection that gave up. */
|
|
309
|
-
setOnline(online: boolean | null): void;
|
|
310
|
-
/** Send a typed message; returns its `client_event_id`. Typed before a session exists, it is sent once one does. */
|
|
311
|
-
send(text: string): string;
|
|
312
|
-
/** Answer a question card (a `rate_each` row by its `question_id`); returns the `client_event_id`. */
|
|
313
|
-
answer(cardId: string, questionId: string, answer: AnswerInput): string;
|
|
314
|
-
/** A card action (`ui.action`) other than a proposal's outcome. */
|
|
315
|
-
cardAction(cardId: string, action: string): string;
|
|
316
|
-
/**
|
|
317
|
-
* Decide a proposal: `decide` is the tenant's own call (its backend, the person's token), which confirms or
|
|
318
|
-
* declines it and says the outcome; the store then reports it. One decision per card; the card is busy meanwhile.
|
|
319
|
-
* Resolves to the outcome reported, or null when the card was busy or already decided.
|
|
320
|
-
*
|
|
321
|
-
* Only an outcome `decide` resolves with is reported (§6: the first is final). When `decide` throws, or resolves
|
|
322
|
-
* with anything but `confirmed`, `declined`, `failed` or `expired`, nothing is reported: the backend may have
|
|
323
|
-
* applied the change, so the outcome stays unknown; the card shows `decisionError` and the person may decide
|
|
324
|
-
* again. When the conversation is disposed meanwhile (sign-out), the outcome is not reported either: the tenant's
|
|
325
|
-
* backend holds it, and the session takes it as unknown.
|
|
326
|
-
*/
|
|
327
|
-
decideProposal(cardId: string, decide: () => Promise<ProposalOutcome>): Promise<ProposalOutcome | null>;
|
|
328
|
-
/** Send a "not sent" message again, as a new message (the person's action). Returns the new id. */
|
|
329
|
-
retry(key: string): string | null;
|
|
330
|
-
/**
|
|
331
|
-
* Send again the person's text whose turn failed before any reply (a `turn_failed` row with `data.retry`), as a new
|
|
332
|
-
* message (the person's action). Once per row: its `retry` turns false. Returns the new id, or null when the row
|
|
333
|
-
* allows no retry.
|
|
334
|
-
*/
|
|
335
|
-
retryTurn(key: string): string | null;
|
|
336
|
-
/** After the conversation continued on another device: continue it here (the person's choice). */
|
|
337
|
-
continueHere(): Promise<void>;
|
|
338
|
-
/** Stop the turn in progress. */
|
|
339
|
-
cancel(): void;
|
|
340
|
-
private ensureSession;
|
|
341
|
-
private fetchSession;
|
|
342
|
-
private open;
|
|
343
|
-
/** What was typed before there was a session to take it. */
|
|
344
|
-
private flushEarly;
|
|
345
|
-
/** A new session for the conversation, then `resume()`: once per person action, never in a loop. */
|
|
346
|
-
private resuming;
|
|
347
|
-
private resumeWith;
|
|
348
|
-
/** The person acted after the session ended idle, expired or at its limit: the next session takes what they sent. */
|
|
349
|
-
private continueIfEnded;
|
|
350
|
-
private reconnectIfDown;
|
|
351
|
-
private statusChanged;
|
|
352
|
-
private event;
|
|
353
|
-
/** The person's text that started a turn, while its message is on screen. */
|
|
354
|
-
private turnText;
|
|
355
|
-
/**
|
|
356
|
-
* A resumed session's transcript replaced the messages, and a chat transcript carries text only: the engine drops
|
|
357
|
-
* the cards it drew, and draws the pending ones again at the end. Each card on screen is anchored just after the
|
|
358
|
-
* message it followed (by key; the transcript keeps the live keys), so a pending proposal stays where it was, and a
|
|
359
|
-
* card the transcript dropped stays drawn there; taking no tap when it belongs to an earlier session.
|
|
360
|
-
*/
|
|
361
|
-
private anchorCards;
|
|
362
|
-
/**
|
|
363
|
-
* Recomputes now (getSnapshot and getStreaming are always current) and notifies from the scheduler, at most once
|
|
364
|
-
* per frame, both channels in the same flush: a streamed reply that completes becomes its message in one frame.
|
|
365
|
-
*/
|
|
366
|
-
private update;
|
|
367
|
-
private scheduleNotify;
|
|
368
|
-
/** Calls the listeners of what changed since the last flush. */
|
|
369
|
-
private flush;
|
|
370
|
-
private compute;
|
|
371
|
-
private status;
|
|
372
|
-
private nextFrom;
|
|
373
|
-
/** The streamed text, current at once; its listeners hear of it with the next flush. */
|
|
374
|
-
private stream;
|
|
375
|
-
private scheduler;
|
|
376
|
-
private key;
|
|
377
|
-
private restore;
|
|
378
|
-
private schedulePersist;
|
|
379
|
-
private live;
|
|
380
|
-
private required;
|
|
381
62
|
}
|
|
382
|
-
|
|
383
|
-
declare function createConversation(options: ConversationOptions): ConversationStore;
|
|
63
|
+
declare function createConversationsByMode(options: ConversationsByModeOptions): ConversationsByMode;
|
|
384
64
|
|
|
385
|
-
export { AnswerInput, type AnswerProblem,
|
|
65
|
+
export { AnswerInput, type AnswerProblem, ConversationOptions, ConversationSession, ConversationStore, type ConversationsByMode, type ConversationsByModeOptions, type ModeSessionRequest, Question, SessionRequest, answerProblem, codePoints, createConversationsByMode, isAllowedLink, isValidLinkPrefix };
|