@vinaverse/client 0.1.0-alpha.11 → 0.1.0-alpha.13
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 +3 -1
- package/dist/agent/index.cjs +187 -24
- package/dist/agent/index.cjs.map +1 -1
- package/dist/agent/index.d.cts +3 -3
- package/dist/agent/index.d.ts +3 -3
- package/dist/agent/index.js +3 -3
- package/dist/backend/index.cjs +3 -0
- package/dist/backend/index.cjs.map +1 -1
- package/dist/backend/index.d.cts +3 -3
- package/dist/backend/index.d.ts +3 -3
- package/dist/backend/index.js +6 -3
- package/dist/backend/index.js.map +1 -1
- package/dist/{chunk-46D3FSLU.js → chunk-5HKZB2CJ.js} +14 -6
- package/dist/chunk-5HKZB2CJ.js.map +1 -0
- package/dist/{chunk-GWLLUOFY.js → chunk-LAB2FPXF.js} +31 -8
- package/dist/chunk-LAB2FPXF.js.map +1 -0
- package/dist/{chunk-JI6HUXH3.js → chunk-WOMAGTI5.js} +149 -20
- package/dist/chunk-WOMAGTI5.js.map +1 -0
- package/dist/conversation/index.cjs +40 -9
- package/dist/conversation/index.cjs.map +1 -1
- package/dist/conversation/index.d.cts +4 -4
- package/dist/conversation/index.d.ts +4 -4
- package/dist/conversation/index.js +3 -3
- package/dist/history/index.cjs +7 -1
- package/dist/history/index.cjs.map +1 -1
- package/dist/history/index.d.cts +10 -4
- package/dist/history/index.d.ts +10 -4
- package/dist/history/index.js +10 -5
- package/dist/history/index.js.map +1 -1
- package/dist/index.cjs +29 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{runtime-CNgz2_8G.d.ts → runtime-44JlV32O.d.ts} +92 -14
- package/dist/{runtime-6O0qIPmo.d.cts → runtime-DWiB-XHX.d.cts} +92 -14
- package/dist/{session-D0ijOQX3.d.ts → session-lPGrKdhf.d.cts} +5 -0
- package/dist/{session-D0ijOQX3.d.cts → session-lPGrKdhf.d.ts} +5 -0
- package/dist/{store-CGRSxVcL.d.ts → store-Cjw9YmXA.d.ts} +6 -1
- package/dist/{store-CxoHwd64.d.cts → store-D-an5vch.d.cts} +6 -1
- package/dist/testing/index.cjs.map +1 -1
- package/dist/testing/index.d.cts +3 -3
- package/dist/testing/index.d.ts +3 -3
- package/dist/testing/index.js +3 -3
- package/package.json +2 -2
- package/dist/chunk-46D3FSLU.js.map +0 -1
- package/dist/chunk-GWLLUOFY.js.map +0 -1
- package/dist/chunk-JI6HUXH3.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { C as CONTRACT } from './contract-Be2oVHNr.cjs';
|
|
2
|
-
export { A as AnswerInput, h as AuthMode, a as Card, d as CardKind, e as ClientErrorCode, j as ClientEvent, k as ClientSecret, l as Connection, m as ConversationEngine, n as ConversationState, F as FetchLike, o as Frame, H as HeldCard, f as HeldQuestion, M as Message, P as Proposal, g as ProposalOutcome, Q as Question, R as Reconnect, S as Schemas, p as ServerEvent, q as ServerEventOf, r as ServerEventType, s as SessionEvents, t as SessionInfo, u as SessionOptions, v as SessionStatus, w as SseTarget, T as ToolLine, x as TranscriptItem, y as TurnInput, V as VinaverseClientError, z as VinaverseSession, B as WebSocketFactory, D as WebSocketLike, E as cardActionSse, G as components, i as isKnownCard, I as operations, J as paths, K as sseFrames, L as turnSse } from './session-
|
|
2
|
+
export { A as AnswerInput, h as AuthMode, a as Card, d as CardKind, e as ClientErrorCode, j as ClientEvent, k as ClientSecret, l as Connection, m as ConversationEngine, n as ConversationState, F as FetchLike, o as Frame, H as HeldCard, f as HeldQuestion, M as Message, P as Proposal, g as ProposalOutcome, Q as Question, R as Reconnect, S as Schemas, p as ServerEvent, q as ServerEventOf, r as ServerEventType, s as SessionEvents, t as SessionInfo, u as SessionOptions, v as SessionStatus, w as SseTarget, T as ToolLine, x as TranscriptItem, y as TurnInput, V as VinaverseClientError, z as VinaverseSession, B as WebSocketFactory, D as WebSocketLike, E as cardActionSse, G as components, i as isKnownCard, I as operations, J as paths, K as sseFrames, L as turnSse } from './session-lPGrKdhf.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The client secret, checked: an app holds only the session's `vv_cs_` secret, which the tenant's backend got from
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { C as CONTRACT } from './contract-Be2oVHNr.js';
|
|
2
|
-
export { A as AnswerInput, h as AuthMode, a as Card, d as CardKind, e as ClientErrorCode, j as ClientEvent, k as ClientSecret, l as Connection, m as ConversationEngine, n as ConversationState, F as FetchLike, o as Frame, H as HeldCard, f as HeldQuestion, M as Message, P as Proposal, g as ProposalOutcome, Q as Question, R as Reconnect, S as Schemas, p as ServerEvent, q as ServerEventOf, r as ServerEventType, s as SessionEvents, t as SessionInfo, u as SessionOptions, v as SessionStatus, w as SseTarget, T as ToolLine, x as TranscriptItem, y as TurnInput, V as VinaverseClientError, z as VinaverseSession, B as WebSocketFactory, D as WebSocketLike, E as cardActionSse, G as components, i as isKnownCard, I as operations, J as paths, K as sseFrames, L as turnSse } from './session-
|
|
2
|
+
export { A as AnswerInput, h as AuthMode, a as Card, d as CardKind, e as ClientErrorCode, j as ClientEvent, k as ClientSecret, l as Connection, m as ConversationEngine, n as ConversationState, F as FetchLike, o as Frame, H as HeldCard, f as HeldQuestion, M as Message, P as Proposal, g as ProposalOutcome, Q as Question, R as Reconnect, S as Schemas, p as ServerEvent, q as ServerEventOf, r as ServerEventType, s as SessionEvents, t as SessionInfo, u as SessionOptions, v as SessionStatus, w as SseTarget, T as ToolLine, x as TranscriptItem, y as TurnInput, V as VinaverseClientError, z as VinaverseSession, B as WebSocketFactory, D as WebSocketLike, E as cardActionSse, G as components, i as isKnownCard, I as operations, J as paths, K as sseFrames, L as turnSse } from './session-lPGrKdhf.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The client secret, checked: an app holds only the session's `vv_cs_` secret, which the tenant's backend got from
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { CONTRACT } from './chunk-D56MNG3E.js';
|
|
2
|
-
export { ConversationEngine, VinaverseClientError, VinaverseSession, cardActionSse, clientSecret, isKnownCard, sseFrames, turnSse } from './chunk-
|
|
2
|
+
export { ConversationEngine, VinaverseClientError, VinaverseSession, cardActionSse, clientSecret, isKnownCard, sseFrames, turnSse } from './chunk-LAB2FPXF.js';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as SessionRequest, b as ConversationSession, C as ConversationStore, f as ConversationPersistence, a as ConversationOptions } from './store-
|
|
2
|
-
import { S as Schemas, k as ClientSecret } from './session-
|
|
1
|
+
import { S as SessionRequest, b as ConversationSession, C as ConversationStore, f as ConversationPersistence, a as ConversationOptions } from './store-Cjw9YmXA.js';
|
|
2
|
+
import { S as Schemas, k as ClientSecret } from './session-lPGrKdhf.js';
|
|
3
3
|
|
|
4
4
|
/** Whose conversation: a person (null for a guest), the app's side, the business acted for, and the thread. */
|
|
5
5
|
interface AgentKey {
|
|
@@ -22,6 +22,58 @@ interface AgentPlace {
|
|
|
22
22
|
} | null;
|
|
23
23
|
readonly filters?: ScreenContext['filters'];
|
|
24
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* The object a conversation is about, as the contract's anchor names it (vinaverse-v1 v1-draft.37 `createSession.anchor`,
|
|
27
|
+
* contracts#86): its type and id. The tenant's backend builds the anchor itself, from its own reads.
|
|
28
|
+
*/
|
|
29
|
+
interface AgentAnchorRef {
|
|
30
|
+
readonly type: AgentAnchorType;
|
|
31
|
+
readonly id: string;
|
|
32
|
+
}
|
|
33
|
+
/** The contract's closed list of objects a conversation can be about (`AnchorType`). */
|
|
34
|
+
type AgentAnchorType = 'booking' | 'rental' | 'professional' | 'workspace' | 'service' | 'class' | 'policy';
|
|
35
|
+
/** The anchor reference for an object, or null when its type is not the contract's or its id not a tool id. */
|
|
36
|
+
declare function anchorRef(type: string, id: string): AgentAnchorRef | null;
|
|
37
|
+
/**
|
|
38
|
+
* An entry label as the contract takes it (`SessionEntry.label`): trimmed, at most 60 code points, cut at a whole
|
|
39
|
+
* character so no accent or emoji is split; undefined when nothing is left. The same rule as the .NET SDK's.
|
|
40
|
+
*/
|
|
41
|
+
declare function entryLabel(label: string): string | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* How the person came in, as the contract will carry it (`entry_point`, `entry_label`): `ask_about` from an "ask about
|
|
44
|
+
* this" row, with the app's own word for analytics (`label`, at most 64 characters).
|
|
45
|
+
*/
|
|
46
|
+
interface AgentEntry {
|
|
47
|
+
readonly point: 'ask_about' | (string & Record<never, never>);
|
|
48
|
+
readonly label?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The object as the screen the person just left showed it: drawn, marked provisional, until the agent's verified card
|
|
52
|
+
* arrives. Never sent.
|
|
53
|
+
*/
|
|
54
|
+
interface AgentPlacePreview {
|
|
55
|
+
readonly title: string;
|
|
56
|
+
readonly image_url?: string;
|
|
57
|
+
readonly kind?: string;
|
|
58
|
+
}
|
|
59
|
+
/** A place at one of the app's objects (a booking, a professional, a space), where "ask about this" opens a conversation. */
|
|
60
|
+
interface AskAboutPlace extends AgentPlace {
|
|
61
|
+
readonly entity: {
|
|
62
|
+
readonly type: string;
|
|
63
|
+
readonly id: string;
|
|
64
|
+
};
|
|
65
|
+
readonly preview?: AgentPlacePreview;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* The key of the conversation about one object: the app's key (its person, mode and business as they are), on a thread
|
|
69
|
+
* of the object's own (`ask:<type>:<id>`), so each object gets its own conversation and the app's main one is left alone.
|
|
70
|
+
*/
|
|
71
|
+
declare function askAboutKey(key: AgentKey, place: {
|
|
72
|
+
readonly entity: {
|
|
73
|
+
readonly type: string;
|
|
74
|
+
readonly id: string;
|
|
75
|
+
};
|
|
76
|
+
}): AgentKey;
|
|
25
77
|
/** How the person came in: the kit's parts say `launcher` and `ask`; an app adds `deep_link` or its own words. */
|
|
26
78
|
type AgentEntryPoint = 'launcher' | 'ask' | 'deep_link' | (string & Record<never, never>);
|
|
27
79
|
/** What the runtime asks the tenant's backend for: a session, for this key, told this place. */
|
|
@@ -44,6 +96,10 @@ interface AgentSessionRequest extends SessionRequest {
|
|
|
44
96
|
readonly placeRevision: number;
|
|
45
97
|
/** How the person came in (`launcher`, `ask`, `deep_link`, the app's own words), passed through. */
|
|
46
98
|
readonly entryPoint: AgentEntryPoint | null;
|
|
99
|
+
/** The object the conversation is about; only with `sendAnchor`. */
|
|
100
|
+
readonly anchor?: AgentAnchorRef;
|
|
101
|
+
/** How the person came in, in the contract's words; only with `sendAnchor`. */
|
|
102
|
+
readonly entry?: AgentEntry;
|
|
47
103
|
}
|
|
48
104
|
/** Why there is no session, typed, so an app never needs sentinel errors of its own. */
|
|
49
105
|
type AgentFailureReason =
|
|
@@ -198,6 +254,15 @@ interface AgentConversationState {
|
|
|
198
254
|
/** The open the backend could not settle (`unknown_open`), for support; null otherwise. */
|
|
199
255
|
readonly openId: string | null;
|
|
200
256
|
}
|
|
257
|
+
/** Where and how a view opens a conversation. `undefined` keeps what was told; `null` clears it. */
|
|
258
|
+
interface AgentOpen {
|
|
259
|
+
readonly place?: AgentPlace | null;
|
|
260
|
+
readonly entryPoint?: AgentEntryPoint | null;
|
|
261
|
+
/** The object the conversation is about; sent only with `sendAnchor`. */
|
|
262
|
+
readonly anchor?: AgentAnchorRef | null;
|
|
263
|
+
/** How the person came in, in the contract's words; sent only with `sendAnchor`. */
|
|
264
|
+
readonly entry?: AgentEntry | null;
|
|
265
|
+
}
|
|
201
266
|
interface AgentConversation {
|
|
202
267
|
/** The key as a string, for the app's own maps and the events. */
|
|
203
268
|
readonly key: string;
|
|
@@ -208,18 +273,12 @@ interface AgentConversation {
|
|
|
208
273
|
* (`keepAlive: 'session'`), and let go when it has none, is past its end, or `keepAlive` is `'view'`. Separate from the
|
|
209
274
|
* app's background, which the platform adapter tells the store.
|
|
210
275
|
*/
|
|
211
|
-
show(open?:
|
|
212
|
-
readonly place?: AgentPlace | null;
|
|
213
|
-
readonly entryPoint?: AgentEntryPoint | null;
|
|
214
|
-
}): () => void;
|
|
276
|
+
show(open?: AgentOpen): () => void;
|
|
215
277
|
/**
|
|
216
278
|
* The place and the way in changed while a view is attached: told live where the backend can, else on the next
|
|
217
279
|
* session. `undefined` keeps what was told; `null` clears it.
|
|
218
280
|
*/
|
|
219
|
-
tell(open:
|
|
220
|
-
readonly place?: AgentPlace | null;
|
|
221
|
-
readonly entryPoint?: AgentEntryPoint | null;
|
|
222
|
-
}): void;
|
|
281
|
+
tell(open: AgentOpen): void;
|
|
223
282
|
getState(): AgentConversationState;
|
|
224
283
|
subscribe(listener: () => void): () => void;
|
|
225
284
|
/** Asks for a session again, after the backend could not be reached. */
|
|
@@ -261,6 +320,12 @@ interface AgentRuntimeOptions {
|
|
|
261
320
|
readonly clock?: AgentClock;
|
|
262
321
|
/** `session` (default): kept while its session lives with no view attached; `view`: let go when the last view goes. */
|
|
263
322
|
readonly keepAlive?: 'session' | 'view';
|
|
323
|
+
/**
|
|
324
|
+
* How long a conversation no view shows stays connected before it is suspended, so a quick reopen (back, then in
|
|
325
|
+
* again) is instant: no reconnect, no new secret. Default 60 s; 0 suspends at once. The app going to the background
|
|
326
|
+
* ends the grace at once (`background()`).
|
|
327
|
+
*/
|
|
328
|
+
readonly graceMs?: number;
|
|
264
329
|
/** How long a status read stays fresh. Default 5 minutes. */
|
|
265
330
|
readonly statusStaleMs?: number;
|
|
266
331
|
/**
|
|
@@ -283,6 +348,11 @@ interface AgentRuntimeOptions {
|
|
|
283
348
|
readonly legacyKeys?: readonly string[];
|
|
284
349
|
/** Where the runtime's warnings go (the app's logger, crash reporter); default `console.warn`. */
|
|
285
350
|
readonly onWarning?: (message: string, warning: AgentWarning) => void;
|
|
351
|
+
/**
|
|
352
|
+
* Sends `anchor` and `entry` in the session request, for the tenant's backend to pass on once the gateway reads them
|
|
353
|
+
* (vinaverse-v1 v1-draft.37, contracts#86). Default false: kept with the conversation, never sent.
|
|
354
|
+
*/
|
|
355
|
+
readonly sendAnchor?: boolean;
|
|
286
356
|
}
|
|
287
357
|
/**
|
|
288
358
|
* What a warning is about, for an app's logger to count without reading the message: `insecure_addresses` (a leg let
|
|
@@ -290,7 +360,7 @@ interface AgentRuntimeOptions {
|
|
|
290
360
|
* `callback` names it), `events_dropped` (the oldest analytics events, while the salt is read).
|
|
291
361
|
*/
|
|
292
362
|
interface AgentWarning {
|
|
293
|
-
readonly code: 'insecure_addresses' | 'callback_threw' | 'events_dropped';
|
|
363
|
+
readonly code: 'insecure_addresses' | 'callback_threw' | 'events_dropped' | 'context_refused';
|
|
294
364
|
readonly callback?: 'onEvent' | 'onActivity';
|
|
295
365
|
}
|
|
296
366
|
/** The legs whose session address may be plaintext: `realtime` (the WebSocket), `turns` (HTTP). */
|
|
@@ -322,6 +392,11 @@ interface AgentRuntime {
|
|
|
322
392
|
forget(key: AgentKey): void;
|
|
323
393
|
/** Ends every conversation no view shows that is past its session's end. The kits call it when the app comes back. */
|
|
324
394
|
sweep(): void;
|
|
395
|
+
/**
|
|
396
|
+
* The app went to the background: every conversation no view shows is suspended now, its grace cut short (its socket
|
|
397
|
+
* closes with `closeInBackground`). The kits' parts call it; an app with none mounted calls it from its own listener.
|
|
398
|
+
*/
|
|
399
|
+
background(): void;
|
|
325
400
|
/**
|
|
326
401
|
* History's delete: the backend deletes the conversation, then the device forgets it, only where the key still
|
|
327
402
|
* continues that conversation (an older history entry never forgets the key's newer one).
|
|
@@ -361,8 +436,11 @@ interface AgentRuntime {
|
|
|
361
436
|
* older one (a history page, a transcript) is dropped when it lands.
|
|
362
437
|
*/
|
|
363
438
|
epoch(): number;
|
|
364
|
-
/**
|
|
365
|
-
|
|
439
|
+
/**
|
|
440
|
+
* The agent's name: from the newest session, else from the status. With `mode`, only that mode's sessions count: a
|
|
441
|
+
* business agent's name never names the customer side's agent.
|
|
442
|
+
*/
|
|
443
|
+
getName(mode?: string): string | null;
|
|
366
444
|
/** Told when the status or name changes, and when a key's conversation is let go (its next one is another). */
|
|
367
445
|
subscribe(listener: () => void): () => void;
|
|
368
446
|
/** An event from a kit or the app, passed to `onEvent`. */
|
|
@@ -391,4 +469,4 @@ declare function createAgentRuntime(options: AgentRuntimeOptions): AgentRuntime;
|
|
|
391
469
|
*/
|
|
392
470
|
declare function isRefusal(error: unknown): error is AgentRefusal;
|
|
393
471
|
|
|
394
|
-
export { type
|
|
472
|
+
export { type AgentAnchorRef as A, type AskAboutPlace as B, agentKey as C, anchorRef as D, askAboutKey as E, createAgentRuntime as F, entryLabel as G, greetedKey as H, hashKey as I, isRefusal as J, type AgentAnchorType as a, type AgentBackend as b, type AgentClock as c, type AgentConversation as d, type AgentConversationState as e, type AgentEntry as f, type AgentEntryPoint as g, type AgentEvent as h, type AgentEventType as i, type AgentFailure as j, type AgentFailureReason as k, type AgentInsecureAddresses as l, type AgentKey as m, type AgentOpen as n, type AgentPlace as o, type AgentPlacePreview as p, type AgentRating as q, AgentRefusal as r, type AgentRetryPolicy as s, type AgentRuntime as t, type AgentRuntimeOptions as u, type AgentSessionRequest as v, type AgentStatus as w, type AgentStatusRead as x, type AgentStatusState as y, type AgentWarning as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as SessionRequest, b as ConversationSession, C as ConversationStore, f as ConversationPersistence, a as ConversationOptions } from './store-
|
|
2
|
-
import { S as Schemas, k as ClientSecret } from './session-
|
|
1
|
+
import { S as SessionRequest, b as ConversationSession, C as ConversationStore, f as ConversationPersistence, a as ConversationOptions } from './store-D-an5vch.cjs';
|
|
2
|
+
import { S as Schemas, k as ClientSecret } from './session-lPGrKdhf.cjs';
|
|
3
3
|
|
|
4
4
|
/** Whose conversation: a person (null for a guest), the app's side, the business acted for, and the thread. */
|
|
5
5
|
interface AgentKey {
|
|
@@ -22,6 +22,58 @@ interface AgentPlace {
|
|
|
22
22
|
} | null;
|
|
23
23
|
readonly filters?: ScreenContext['filters'];
|
|
24
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* The object a conversation is about, as the contract's anchor names it (vinaverse-v1 v1-draft.37 `createSession.anchor`,
|
|
27
|
+
* contracts#86): its type and id. The tenant's backend builds the anchor itself, from its own reads.
|
|
28
|
+
*/
|
|
29
|
+
interface AgentAnchorRef {
|
|
30
|
+
readonly type: AgentAnchorType;
|
|
31
|
+
readonly id: string;
|
|
32
|
+
}
|
|
33
|
+
/** The contract's closed list of objects a conversation can be about (`AnchorType`). */
|
|
34
|
+
type AgentAnchorType = 'booking' | 'rental' | 'professional' | 'workspace' | 'service' | 'class' | 'policy';
|
|
35
|
+
/** The anchor reference for an object, or null when its type is not the contract's or its id not a tool id. */
|
|
36
|
+
declare function anchorRef(type: string, id: string): AgentAnchorRef | null;
|
|
37
|
+
/**
|
|
38
|
+
* An entry label as the contract takes it (`SessionEntry.label`): trimmed, at most 60 code points, cut at a whole
|
|
39
|
+
* character so no accent or emoji is split; undefined when nothing is left. The same rule as the .NET SDK's.
|
|
40
|
+
*/
|
|
41
|
+
declare function entryLabel(label: string): string | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* How the person came in, as the contract will carry it (`entry_point`, `entry_label`): `ask_about` from an "ask about
|
|
44
|
+
* this" row, with the app's own word for analytics (`label`, at most 64 characters).
|
|
45
|
+
*/
|
|
46
|
+
interface AgentEntry {
|
|
47
|
+
readonly point: 'ask_about' | (string & Record<never, never>);
|
|
48
|
+
readonly label?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The object as the screen the person just left showed it: drawn, marked provisional, until the agent's verified card
|
|
52
|
+
* arrives. Never sent.
|
|
53
|
+
*/
|
|
54
|
+
interface AgentPlacePreview {
|
|
55
|
+
readonly title: string;
|
|
56
|
+
readonly image_url?: string;
|
|
57
|
+
readonly kind?: string;
|
|
58
|
+
}
|
|
59
|
+
/** A place at one of the app's objects (a booking, a professional, a space), where "ask about this" opens a conversation. */
|
|
60
|
+
interface AskAboutPlace extends AgentPlace {
|
|
61
|
+
readonly entity: {
|
|
62
|
+
readonly type: string;
|
|
63
|
+
readonly id: string;
|
|
64
|
+
};
|
|
65
|
+
readonly preview?: AgentPlacePreview;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* The key of the conversation about one object: the app's key (its person, mode and business as they are), on a thread
|
|
69
|
+
* of the object's own (`ask:<type>:<id>`), so each object gets its own conversation and the app's main one is left alone.
|
|
70
|
+
*/
|
|
71
|
+
declare function askAboutKey(key: AgentKey, place: {
|
|
72
|
+
readonly entity: {
|
|
73
|
+
readonly type: string;
|
|
74
|
+
readonly id: string;
|
|
75
|
+
};
|
|
76
|
+
}): AgentKey;
|
|
25
77
|
/** How the person came in: the kit's parts say `launcher` and `ask`; an app adds `deep_link` or its own words. */
|
|
26
78
|
type AgentEntryPoint = 'launcher' | 'ask' | 'deep_link' | (string & Record<never, never>);
|
|
27
79
|
/** What the runtime asks the tenant's backend for: a session, for this key, told this place. */
|
|
@@ -44,6 +96,10 @@ interface AgentSessionRequest extends SessionRequest {
|
|
|
44
96
|
readonly placeRevision: number;
|
|
45
97
|
/** How the person came in (`launcher`, `ask`, `deep_link`, the app's own words), passed through. */
|
|
46
98
|
readonly entryPoint: AgentEntryPoint | null;
|
|
99
|
+
/** The object the conversation is about; only with `sendAnchor`. */
|
|
100
|
+
readonly anchor?: AgentAnchorRef;
|
|
101
|
+
/** How the person came in, in the contract's words; only with `sendAnchor`. */
|
|
102
|
+
readonly entry?: AgentEntry;
|
|
47
103
|
}
|
|
48
104
|
/** Why there is no session, typed, so an app never needs sentinel errors of its own. */
|
|
49
105
|
type AgentFailureReason =
|
|
@@ -198,6 +254,15 @@ interface AgentConversationState {
|
|
|
198
254
|
/** The open the backend could not settle (`unknown_open`), for support; null otherwise. */
|
|
199
255
|
readonly openId: string | null;
|
|
200
256
|
}
|
|
257
|
+
/** Where and how a view opens a conversation. `undefined` keeps what was told; `null` clears it. */
|
|
258
|
+
interface AgentOpen {
|
|
259
|
+
readonly place?: AgentPlace | null;
|
|
260
|
+
readonly entryPoint?: AgentEntryPoint | null;
|
|
261
|
+
/** The object the conversation is about; sent only with `sendAnchor`. */
|
|
262
|
+
readonly anchor?: AgentAnchorRef | null;
|
|
263
|
+
/** How the person came in, in the contract's words; sent only with `sendAnchor`. */
|
|
264
|
+
readonly entry?: AgentEntry | null;
|
|
265
|
+
}
|
|
201
266
|
interface AgentConversation {
|
|
202
267
|
/** The key as a string, for the app's own maps and the events. */
|
|
203
268
|
readonly key: string;
|
|
@@ -208,18 +273,12 @@ interface AgentConversation {
|
|
|
208
273
|
* (`keepAlive: 'session'`), and let go when it has none, is past its end, or `keepAlive` is `'view'`. Separate from the
|
|
209
274
|
* app's background, which the platform adapter tells the store.
|
|
210
275
|
*/
|
|
211
|
-
show(open?:
|
|
212
|
-
readonly place?: AgentPlace | null;
|
|
213
|
-
readonly entryPoint?: AgentEntryPoint | null;
|
|
214
|
-
}): () => void;
|
|
276
|
+
show(open?: AgentOpen): () => void;
|
|
215
277
|
/**
|
|
216
278
|
* The place and the way in changed while a view is attached: told live where the backend can, else on the next
|
|
217
279
|
* session. `undefined` keeps what was told; `null` clears it.
|
|
218
280
|
*/
|
|
219
|
-
tell(open:
|
|
220
|
-
readonly place?: AgentPlace | null;
|
|
221
|
-
readonly entryPoint?: AgentEntryPoint | null;
|
|
222
|
-
}): void;
|
|
281
|
+
tell(open: AgentOpen): void;
|
|
223
282
|
getState(): AgentConversationState;
|
|
224
283
|
subscribe(listener: () => void): () => void;
|
|
225
284
|
/** Asks for a session again, after the backend could not be reached. */
|
|
@@ -261,6 +320,12 @@ interface AgentRuntimeOptions {
|
|
|
261
320
|
readonly clock?: AgentClock;
|
|
262
321
|
/** `session` (default): kept while its session lives with no view attached; `view`: let go when the last view goes. */
|
|
263
322
|
readonly keepAlive?: 'session' | 'view';
|
|
323
|
+
/**
|
|
324
|
+
* How long a conversation no view shows stays connected before it is suspended, so a quick reopen (back, then in
|
|
325
|
+
* again) is instant: no reconnect, no new secret. Default 60 s; 0 suspends at once. The app going to the background
|
|
326
|
+
* ends the grace at once (`background()`).
|
|
327
|
+
*/
|
|
328
|
+
readonly graceMs?: number;
|
|
264
329
|
/** How long a status read stays fresh. Default 5 minutes. */
|
|
265
330
|
readonly statusStaleMs?: number;
|
|
266
331
|
/**
|
|
@@ -283,6 +348,11 @@ interface AgentRuntimeOptions {
|
|
|
283
348
|
readonly legacyKeys?: readonly string[];
|
|
284
349
|
/** Where the runtime's warnings go (the app's logger, crash reporter); default `console.warn`. */
|
|
285
350
|
readonly onWarning?: (message: string, warning: AgentWarning) => void;
|
|
351
|
+
/**
|
|
352
|
+
* Sends `anchor` and `entry` in the session request, for the tenant's backend to pass on once the gateway reads them
|
|
353
|
+
* (vinaverse-v1 v1-draft.37, contracts#86). Default false: kept with the conversation, never sent.
|
|
354
|
+
*/
|
|
355
|
+
readonly sendAnchor?: boolean;
|
|
286
356
|
}
|
|
287
357
|
/**
|
|
288
358
|
* What a warning is about, for an app's logger to count without reading the message: `insecure_addresses` (a leg let
|
|
@@ -290,7 +360,7 @@ interface AgentRuntimeOptions {
|
|
|
290
360
|
* `callback` names it), `events_dropped` (the oldest analytics events, while the salt is read).
|
|
291
361
|
*/
|
|
292
362
|
interface AgentWarning {
|
|
293
|
-
readonly code: 'insecure_addresses' | 'callback_threw' | 'events_dropped';
|
|
363
|
+
readonly code: 'insecure_addresses' | 'callback_threw' | 'events_dropped' | 'context_refused';
|
|
294
364
|
readonly callback?: 'onEvent' | 'onActivity';
|
|
295
365
|
}
|
|
296
366
|
/** The legs whose session address may be plaintext: `realtime` (the WebSocket), `turns` (HTTP). */
|
|
@@ -322,6 +392,11 @@ interface AgentRuntime {
|
|
|
322
392
|
forget(key: AgentKey): void;
|
|
323
393
|
/** Ends every conversation no view shows that is past its session's end. The kits call it when the app comes back. */
|
|
324
394
|
sweep(): void;
|
|
395
|
+
/**
|
|
396
|
+
* The app went to the background: every conversation no view shows is suspended now, its grace cut short (its socket
|
|
397
|
+
* closes with `closeInBackground`). The kits' parts call it; an app with none mounted calls it from its own listener.
|
|
398
|
+
*/
|
|
399
|
+
background(): void;
|
|
325
400
|
/**
|
|
326
401
|
* History's delete: the backend deletes the conversation, then the device forgets it, only where the key still
|
|
327
402
|
* continues that conversation (an older history entry never forgets the key's newer one).
|
|
@@ -361,8 +436,11 @@ interface AgentRuntime {
|
|
|
361
436
|
* older one (a history page, a transcript) is dropped when it lands.
|
|
362
437
|
*/
|
|
363
438
|
epoch(): number;
|
|
364
|
-
/**
|
|
365
|
-
|
|
439
|
+
/**
|
|
440
|
+
* The agent's name: from the newest session, else from the status. With `mode`, only that mode's sessions count: a
|
|
441
|
+
* business agent's name never names the customer side's agent.
|
|
442
|
+
*/
|
|
443
|
+
getName(mode?: string): string | null;
|
|
366
444
|
/** Told when the status or name changes, and when a key's conversation is let go (its next one is another). */
|
|
367
445
|
subscribe(listener: () => void): () => void;
|
|
368
446
|
/** An event from a kit or the app, passed to `onEvent`. */
|
|
@@ -391,4 +469,4 @@ declare function createAgentRuntime(options: AgentRuntimeOptions): AgentRuntime;
|
|
|
391
469
|
*/
|
|
392
470
|
declare function isRefusal(error: unknown): error is AgentRefusal;
|
|
393
471
|
|
|
394
|
-
export { type
|
|
472
|
+
export { type AgentAnchorRef as A, type AskAboutPlace as B, agentKey as C, anchorRef as D, askAboutKey as E, createAgentRuntime as F, entryLabel as G, greetedKey as H, hashKey as I, isRefusal as J, type AgentAnchorType as a, type AgentBackend as b, type AgentClock as c, type AgentConversation as d, type AgentConversationState as e, type AgentEntry as f, type AgentEntryPoint as g, type AgentEvent as h, type AgentEventType as i, type AgentFailure as j, type AgentFailureReason as k, type AgentInsecureAddresses as l, type AgentKey as m, type AgentOpen as n, type AgentPlace as o, type AgentPlacePreview as p, type AgentRating as q, AgentRefusal as r, type AgentRetryPolicy as s, type AgentRuntime as t, type AgentRuntimeOptions as u, type AgentSessionRequest as v, type AgentStatus as w, type AgentStatusRead as x, type AgentStatusState as y, type AgentWarning as z };
|
|
@@ -3326,6 +3326,8 @@ interface Message {
|
|
|
3326
3326
|
readonly received?: true;
|
|
3327
3327
|
/** The agent's reply is a guardrail refusal (`input.rejected` `guardrail`, its `message`). */
|
|
3328
3328
|
readonly refusal?: true;
|
|
3329
|
+
/** When it was said (ISO 8601): the server's time where the event or transcript gives one, else when it arrived. */
|
|
3330
|
+
readonly at: string;
|
|
3329
3331
|
}
|
|
3330
3332
|
/** A person from the business is replying (`takeover.started`); `by` is their role as the person sees it. */
|
|
3331
3333
|
interface Takeover {
|
|
@@ -3418,6 +3420,9 @@ interface ConversationState {
|
|
|
3418
3420
|
readonly turnsLeft: number | null;
|
|
3419
3421
|
}
|
|
3420
3422
|
declare class ConversationEngine {
|
|
3423
|
+
private readonly now;
|
|
3424
|
+
/** `now`: the clock a message is stamped by when the server gives no time. */
|
|
3425
|
+
constructor(now?: () => number);
|
|
3421
3426
|
private sessionId;
|
|
3422
3427
|
private conversationId;
|
|
3423
3428
|
private connection;
|
|
@@ -3326,6 +3326,8 @@ interface Message {
|
|
|
3326
3326
|
readonly received?: true;
|
|
3327
3327
|
/** The agent's reply is a guardrail refusal (`input.rejected` `guardrail`, its `message`). */
|
|
3328
3328
|
readonly refusal?: true;
|
|
3329
|
+
/** When it was said (ISO 8601): the server's time where the event or transcript gives one, else when it arrived. */
|
|
3330
|
+
readonly at: string;
|
|
3329
3331
|
}
|
|
3330
3332
|
/** A person from the business is replying (`takeover.started`); `by` is their role as the person sees it. */
|
|
3331
3333
|
interface Takeover {
|
|
@@ -3418,6 +3420,9 @@ interface ConversationState {
|
|
|
3418
3420
|
readonly turnsLeft: number | null;
|
|
3419
3421
|
}
|
|
3420
3422
|
declare class ConversationEngine {
|
|
3423
|
+
private readonly now;
|
|
3424
|
+
/** `now`: the clock a message is stamped by when the server gives no time. */
|
|
3425
|
+
constructor(now?: () => number);
|
|
3421
3426
|
private sessionId;
|
|
3422
3427
|
private conversationId;
|
|
3423
3428
|
private connection;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { W as Welcome, H as HeldCard, T as ToolLine, t as SessionInfo, k as ClientSecret, u as SessionOptions, A as AnswerInput, g as ProposalOutcome } from './session-
|
|
1
|
+
import { W as Welcome, H as HeldCard, T as ToolLine, t as SessionInfo, k as ClientSecret, u as SessionOptions, A as AnswerInput, g as ProposalOutcome } from './session-lPGrKdhf.js';
|
|
2
2
|
|
|
3
3
|
type ConversationStatus =
|
|
4
4
|
/** Asking the tenant's backend for a session. */
|
|
@@ -51,6 +51,11 @@ interface MessageItem {
|
|
|
51
51
|
readonly code: string;
|
|
52
52
|
readonly message: string;
|
|
53
53
|
};
|
|
54
|
+
/**
|
|
55
|
+
* When it was said (ISO 8601): the server's time where it gives one (a resumed transcript, history, a business's
|
|
56
|
+
* reply), else when this device sent or received it. Absent on a message kept by a version before alpha.13.
|
|
57
|
+
*/
|
|
58
|
+
readonly at?: string;
|
|
54
59
|
}
|
|
55
60
|
interface CardItem {
|
|
56
61
|
readonly type: 'card';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { W as Welcome, H as HeldCard, T as ToolLine, t as SessionInfo, k as ClientSecret, u as SessionOptions, A as AnswerInput, g as ProposalOutcome } from './session-
|
|
1
|
+
import { W as Welcome, H as HeldCard, T as ToolLine, t as SessionInfo, k as ClientSecret, u as SessionOptions, A as AnswerInput, g as ProposalOutcome } from './session-lPGrKdhf.cjs';
|
|
2
2
|
|
|
3
3
|
type ConversationStatus =
|
|
4
4
|
/** Asking the tenant's backend for a session. */
|
|
@@ -51,6 +51,11 @@ interface MessageItem {
|
|
|
51
51
|
readonly code: string;
|
|
52
52
|
readonly message: string;
|
|
53
53
|
};
|
|
54
|
+
/**
|
|
55
|
+
* When it was said (ISO 8601): the server's time where it gives one (a resumed transcript, history, a business's
|
|
56
|
+
* reply), else when this device sent or received it. Absent on a message kept by a version before alpha.13.
|
|
57
|
+
*/
|
|
58
|
+
readonly at?: string;
|
|
54
59
|
}
|
|
55
60
|
interface CardItem {
|
|
56
61
|
readonly type: 'card';
|