@adminide-stack/clock-tik-browser 12.0.34 → 12.0.35
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/lib/pages/Home/__tests__/calls.test.d.ts +2 -0
- package/lib/pages/Home/__tests__/calls.test.d.ts.map +1 -0
- package/lib/pages/Home/__tests__/queue.test.d.ts +2 -0
- package/lib/pages/Home/__tests__/queue.test.d.ts.map +1 -0
- package/lib/pages/Home/__tests__/results.test.d.ts +2 -0
- package/lib/pages/Home/__tests__/results.test.d.ts.map +1 -0
- package/lib/pages/Home/__tests__/surfaces.test.d.ts +2 -0
- package/lib/pages/Home/__tests__/surfaces.test.d.ts.map +1 -0
- package/lib/pages/Home/chat/CallsCard.d.ts +22 -0
- package/lib/pages/Home/chat/CallsCard.d.ts.map +1 -0
- package/lib/pages/Home/chat/CallsCard.js +352 -0
- package/lib/pages/Home/chat/CallsCard.js.map +1 -0
- package/lib/pages/Home/chat/ChoresChat.d.ts.map +1 -1
- package/lib/pages/Home/chat/ChoresChat.js +293 -58
- package/lib/pages/Home/chat/ChoresChat.js.map +1 -1
- package/lib/pages/Home/chat/ChoresPanel.d.ts.map +1 -1
- package/lib/pages/Home/chat/ChoresPanel.js +4 -2
- package/lib/pages/Home/chat/ChoresPanel.js.map +1 -1
- package/lib/pages/Home/chat/ResultCards.d.ts +16 -0
- package/lib/pages/Home/chat/ResultCards.d.ts.map +1 -0
- package/lib/pages/Home/chat/ResultCards.js +509 -0
- package/lib/pages/Home/chat/ResultCards.js.map +1 -0
- package/lib/pages/Home/chat/calls.d.ts +124 -0
- package/lib/pages/Home/chat/calls.d.ts.map +1 -0
- package/lib/pages/Home/chat/calls.js +278 -0
- package/lib/pages/Home/chat/calls.js.map +1 -0
- package/lib/pages/Home/chat/callsApi.d.ts +10 -0
- package/lib/pages/Home/chat/callsApi.d.ts.map +1 -0
- package/lib/pages/Home/chat/callsApi.js +31 -0
- package/lib/pages/Home/chat/callsApi.js.map +1 -0
- package/lib/pages/Home/chat/chatTheme.d.ts.map +1 -1
- package/lib/pages/Home/chat/chatTheme.js +746 -1
- package/lib/pages/Home/chat/chatTheme.js.map +1 -1
- package/lib/pages/Home/chat/chores.d.ts +10 -3
- package/lib/pages/Home/chat/chores.d.ts.map +1 -1
- package/lib/pages/Home/chat/chores.js +22 -5
- package/lib/pages/Home/chat/chores.js.map +1 -1
- package/lib/pages/Home/chat/queue.d.ts +94 -0
- package/lib/pages/Home/chat/queue.d.ts.map +1 -0
- package/lib/pages/Home/chat/queue.js +88 -0
- package/lib/pages/Home/chat/queue.js.map +1 -0
- package/lib/pages/Home/chat/results.d.ts +207 -0
- package/lib/pages/Home/chat/results.d.ts.map +1 -0
- package/lib/pages/Home/chat/results.js +823 -0
- package/lib/pages/Home/chat/results.js.map +1 -0
- package/lib/pages/Home/chat/stop.d.ts +7 -6
- package/lib/pages/Home/chat/stop.d.ts.map +1 -1
- package/lib/pages/Home/chat/stop.js +7 -6
- package/lib/pages/Home/chat/stop.js.map +1 -1
- package/lib/pages/Home/chat/surfaces.d.ts +34 -0
- package/lib/pages/Home/chat/surfaces.d.ts.map +1 -0
- package/lib/pages/Home/chat/surfaces.js +165 -0
- package/lib/pages/Home/chat/surfaces.js.map +1 -0
- package/lib/pages/Home/chat/thread.d.ts +7 -3
- package/lib/pages/Home/chat/thread.d.ts.map +1 -1
- package/lib/pages/Home/chat/thread.js +11 -3
- package/lib/pages/Home/chat/thread.js.map +1 -1
- package/lib/pages/Home/chat/useCallLog.d.ts +17 -0
- package/lib/pages/Home/chat/useCallLog.d.ts.map +1 -0
- package/lib/pages/Home/chat/useCallLog.js +85 -0
- package/lib/pages/Home/chat/useCallLog.js.map +1 -0
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatTheme.js","sources":["../../../../src/pages/Home/chat/chatTheme.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":"oCASA,MAAM,QAAQ,GAAG
|
|
1
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+/ChB;SAEe,SAAS,GAAA;;SAEdA,GAAA,CAAA,OAAA,EAAA;AACX,IAAC,qBAAA,EAAA,IAAA;;;;;"}
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* records.
|
|
12
12
|
*/
|
|
13
13
|
import type { JobRecord, SurfaceTask } from '@yantra/surface-kit/tasks';
|
|
14
|
+
import type { QueuedMessage } from './queue';
|
|
14
15
|
/** The slug every Clockbook chore is recorded under, on the Task API too (`surface:clockbook`). */
|
|
15
16
|
export declare const CLOCKBOOK_SURFACE = "clockbook";
|
|
16
17
|
/** The lane a chore's turns are recorded in. */
|
|
@@ -68,6 +69,8 @@ export interface ChoreTurnsOptions {
|
|
|
68
69
|
* is that task, by its id or its server id.
|
|
69
70
|
*/
|
|
70
71
|
export declare function choreTurns(tasks: readonly SurfaceTask[], jobs: readonly JobRecord[], { isLive, owner }: ChoreTurnsOptions): ChoreTurn[];
|
|
72
|
+
/** The agent's own word that it holds a turn behind the one it is on ("Queued…"). */
|
|
73
|
+
export declare function isQueuedLine(line: string): boolean;
|
|
71
74
|
/** Where a chore stands, in the person's terms. */
|
|
72
75
|
export type ChoreStatus = 'asking' | 'working' | 'queued' | 'done' | 'failed';
|
|
73
76
|
export interface Chore {
|
|
@@ -111,15 +114,19 @@ export interface ChoreList {
|
|
|
111
114
|
export interface ChoreListOptions {
|
|
112
115
|
/** The turn whose reply holds the question still waiting for an answer (askingTurn). */
|
|
113
116
|
asking?: string;
|
|
117
|
+
/** Messages the page holds until Lucy is free (queue.ts), oldest first. */
|
|
118
|
+
waiting?: readonly QueuedMessage[];
|
|
114
119
|
now?: number;
|
|
115
120
|
}
|
|
116
121
|
/**
|
|
117
122
|
* The panel's chores from their turns.
|
|
118
123
|
*
|
|
119
124
|
* The agent runs one turn at a time, so a turn handed over while another of this browser's turns
|
|
120
|
-
* runs waits for it: until anything
|
|
121
|
-
*
|
|
122
|
-
*
|
|
125
|
+
* runs waits for it: until anything but the agent's own "Queued…" is heard of it, its chore is
|
|
126
|
+
* queued. A message the page holds until Lucy is free (`waiting`) is next after those, in the order
|
|
127
|
+
* it was sent. A question waiting for an answer puts its chore first, whatever else its turns are
|
|
128
|
+
* doing. A finished chore ended the way its last turn to end did: an answer can be done before the
|
|
129
|
+
* turn it let carry on.
|
|
123
130
|
*/
|
|
124
131
|
export declare function choreList(turns: readonly ChoreTurn[], options?: ChoreListOptions): ChoreList;
|
|
125
132
|
/** A chore's name in the list: the first line of what the person typed, kept short. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chores.d.ts","sourceRoot":"","sources":["../../../../src/pages/Home/chat/chores.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC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
|
|
106
106
|
return turns;
|
|
107
107
|
}
|
|
108
|
+
/** The agent's own word that it holds a turn behind the one it is on ("Queued…"). */
|
|
109
|
+
function isQueuedLine(line) {
|
|
110
|
+
return /^queued\b/i.test(line.trim());
|
|
111
|
+
}
|
|
108
112
|
const byCreated = (a, b) => a.createdAt - b.createdAt;
|
|
109
113
|
const endOf = turn => turn.endedAt ?? turn.createdAt;
|
|
110
114
|
/** Running long past its deadline with nothing in this page streaming it. */
|
|
@@ -115,9 +119,11 @@ function isStale(turn, now) {
|
|
|
115
119
|
* The panel's chores from their turns.
|
|
116
120
|
*
|
|
117
121
|
* The agent runs one turn at a time, so a turn handed over while another of this browser's turns
|
|
118
|
-
* runs waits for it: until anything
|
|
119
|
-
*
|
|
120
|
-
*
|
|
122
|
+
* runs waits for it: until anything but the agent's own "Queued…" is heard of it, its chore is
|
|
123
|
+
* queued. A message the page holds until Lucy is free (`waiting`) is next after those, in the order
|
|
124
|
+
* it was sent. A question waiting for an answer puts its chore first, whatever else its turns are
|
|
125
|
+
* doing. A finished chore ended the way its last turn to end did: an answer can be done before the
|
|
126
|
+
* turn it let carry on.
|
|
121
127
|
*/
|
|
122
128
|
function choreList(turns, options = {}) {
|
|
123
129
|
const now = options.now ?? Date.now();
|
|
@@ -164,7 +170,7 @@ function choreList(turns, options = {}) {
|
|
|
164
170
|
}
|
|
165
171
|
const running = group.filter(t => t.state === 'running' && !isStale(t, now));
|
|
166
172
|
if (running.length) {
|
|
167
|
-
const waiting = running.every(t => t.live && !t.progress && t.id !== first);
|
|
173
|
+
const waiting = running.every(t => t.live && (!t.progress || isQueuedLine(t.progress)) && t.id !== first);
|
|
168
174
|
const progress = [...running].reverse().find(t => t.progress)?.progress;
|
|
169
175
|
const shown = {
|
|
170
176
|
...chore,
|
|
@@ -196,6 +202,17 @@ function choreList(turns, options = {}) {
|
|
|
196
202
|
list.asking.sort(byStart);
|
|
197
203
|
list.working.sort(byStart);
|
|
198
204
|
list.queued.sort(byStart);
|
|
205
|
+
// Held in the page: it goes to Lucy only once nothing of this chat is on her, so after all of the above.
|
|
206
|
+
for (const message of options.waiting ?? []) {
|
|
207
|
+
list.queued.push({
|
|
208
|
+
id: message.id,
|
|
209
|
+
title: choreTitle(message.text),
|
|
210
|
+
brief: message.text,
|
|
211
|
+
status: 'queued',
|
|
212
|
+
startedAt: message.at,
|
|
213
|
+
turns: []
|
|
214
|
+
});
|
|
215
|
+
}
|
|
199
216
|
list.done = list.done.filter(c => c.status === 'failed' || (c.endedAt ?? c.startedAt) - c.startedAt >= QUICK_ANSWER_MS).filter(c => now - (c.endedAt ?? c.startedAt) < DONE_FOR_MS).sort((a, b) => (b.endedAt ?? b.startedAt) - (a.endedAt ?? a.startedAt)).slice(0, DONE_SHOWN);
|
|
200
217
|
list.active = list.asking.length + list.working.length + list.queued.length;
|
|
201
218
|
return list;
|
|
@@ -266,4 +283,4 @@ function agoLabel(at, now = Date.now()) {
|
|
|
266
283
|
function plainText(markdown, max = 600) {
|
|
267
284
|
const text = markdown.replace(/!\[[^\]]*\]\([^)]*\)/g, '').replace(/\[([^\]]*)\]\([^)]*\)/g, '$1').replace(/^[ \t]{0,3}#{1,6}[ \t]+/gm, '').replace(/^[ \t]*[-*+][ \t]+/gm, '• ').replace(/\*|__|`/g, '').replace(/[ \t]+\n/g, '\n').replace(/\n{3,}/g, '\n\n').trim();
|
|
268
285
|
return shorten(text, max, 0.8);
|
|
269
|
-
}export{ANSWER_KEPT,CHORE_LANE,CHORE_TURN_BUDGET_MS,CLOCKBOOK_SURFACE,DONE_FOR_MS,DONE_SHOWN,QUICK_ANSWER_MS,STOPPED,agoLabel,choreLine,choreList,choreTitle,choreTurns,elapsedLabel,plainText,turnFromJob,turnFromTask};//# sourceMappingURL=chores.js.map
|
|
286
|
+
}export{ANSWER_KEPT,CHORE_LANE,CHORE_TURN_BUDGET_MS,CLOCKBOOK_SURFACE,DONE_FOR_MS,DONE_SHOWN,QUICK_ANSWER_MS,STOPPED,agoLabel,choreLine,choreList,choreTitle,choreTurns,elapsedLabel,isQueuedLine,plainText,turnFromJob,turnFromTask};//# sourceMappingURL=chores.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chores.js","sources":["../../../../src/pages/Home/chat/chores.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chores.js","sources":["../../../../src/pages/Home/chat/chores.ts"],"sourcesContent":[null],"names":[],"mappings":"AAeA;AACO,MAAM,iBAAiB,GAAG;AACjC;AACO,MAAM,UAAU,GAAG;AAC1B;;;AAGG;AACU,MAAA,oBAAoB,GAAG,EAAE,GAAG;AACzC;AACO,MAAM,WAAW,GAAG;AAC3B;AACO,MAAM,UAAU,GAAG;AAC1B;AACa,MAAA,WAAW,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG;AACzC;;;AAGG;AACI,MAAM,eAAe,GAAG;AA2B/B;AACA,SAAS,OAAO,CAAC,MAAe,EAAA;AAC5B,EAAA,MAAA,IAAU,GAAA,MAAoD,EAAA;AAC9D,EAAA,OAAA,WAAkB,KAAA,QAAa,IAAA,SAAS,EAAI,GAAG,IAAE,GAAK;AAC1D;AAEgB,SAAA,YAAY,CAAC,IAAiB,EAAE,IAAa,EAAA;AACzD,EAAA,MAAA,IAAU,GAAA,OAAU,CAAA,IAAK,CAAA,MAAO,CAAA,IAAK,IAAA,CAAA,IAAK;SACnC;QACH,IAAI,CAAI,EAAA;SACH,EAAA,IAAE,OAAK,CAAA,OAAc,IAAA,IAAI,CAAI,EAAA;SAC7B,EAAA,IAAE,CAAI,KAAM;SACZ,EAAA,IAAE,CAAI,KAAM;SACZ,EAAA,IAAE,CAAI,KAAM;aACR,EAAA,IAAE,CAAI,SAAU;AACzB,IAAA,IAAA,IAAI,CAAI;AACR,MAAA,OAAQ,EAAA;AACR,KAAA,GAAA,EAAA,CAAG;AACH,IAAA,IAAA,IAAI,CAAI,WAAQ;AAChB,MAAA,QAAI,EAAI,IAAK,CAAA;AAC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,0CAAA;;;AAGG,QAAA,MAAA,KAAA,GAAA,KAAA,CAAA,QAAA,KAAA,KAAA,CAAA,UAAA,GAAA,aAAA,GAAA,kBAAA,CAAA;AACH,gBAAgB,EAAS,KAAA,CAAA,kBAAyB,GAAG,GAAA,KAAA,CAAA,SAAA,CAAA,CAAA,CAAA;;AAE5C,IAAA,KAAA,MAAA;AACA,MAAA,OAAA,CAAA,OAAQ,EAAA,KAAA,CAAA,CAAA;AACR,IAAA;AACA,MAAA,IAAA,KAAA,CAAO,KAAC,EAAA,OAAA,CAAA,qBAA6B,EAAA,KAAA,CAAA,CAAA;AACrC,MAAA,OAAA,CAAA,EAAO,KAAC,CAAA,KAAU,KAAK,OAAA,GAAA,SAAA,GAAA,eAAA,CAAA,GAAA,EAAA,KAAA,CAAA,CAAA;AACvB;AACA;AACA;AACE,SAAA,QAAY,CAAE,IAAK,GAAA,GAAK,IAAA,CAAA,GAAA,EAAA,EAAA;AACnC,EAAC,MAAA,OAAA,GAAA,IAAA,CAAA,KAAA,CAAA,IAAA,CAAA,GAAA,CAAA,CAAA,EAAA,GAAA,GAAA,EAAA,CAAA,GAAA,MAAA,CAAA;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the person sends while Lucy is on a chore this page is following waits here, in the page,
|
|
3
|
+
* and goes to her once that turn is over: one message at a time, each on the chat's own session,
|
|
4
|
+
* so she has the whole conversation for it.
|
|
5
|
+
*
|
|
6
|
+
* The agent runs one turn at a time per session and holds one more behind it. It refuses the next
|
|
7
|
+
* (`session_busy`), and the kit's answer to a refusal - fork the session and cancel the turn it is
|
|
8
|
+
* on (`postAgentChatStream`'s stuck-session recovery) - stopped the chore Lucy was on. So a third
|
|
9
|
+
* message sent while she worked killed her current chore, and the one queued behind it ran on the
|
|
10
|
+
* old session without the rest of the conversation. Now the page sends nothing more to a session
|
|
11
|
+
* while a turn it streams is on it, and the chat turns that recovery off.
|
|
12
|
+
*
|
|
13
|
+
* Two kinds of message go at once:
|
|
14
|
+
* - an answer to Lucy's question card: the turn that asked waits for it (ChoresChat);
|
|
15
|
+
* - the first one sent while a chore goes on without the page (it was closed and opened again, or
|
|
16
|
+
* the line to Lucy dropped). The page cannot see whether she is still at it or parked on a
|
|
17
|
+
* question it never showed, so the agent gets it: it holds it behind that chore, or takes it as
|
|
18
|
+
* the answer. The page streams that one, and the rest wait behind it here.
|
|
19
|
+
*
|
|
20
|
+
* What waits is kept with the thread (thread.ts), so closing the page does not lose it: it goes
|
|
21
|
+
* once the chat is open again, unless it has waited too long (`restoreQueue`), and from one tab
|
|
22
|
+
* only (`sentElsewhere`). Stop and New chat hand it back to the composer instead. Stop means Lucy
|
|
23
|
+
* stops, not that she moves on to the next thing.
|
|
24
|
+
*
|
|
25
|
+
* Nothing here touches the network or storage.
|
|
26
|
+
*/
|
|
27
|
+
/** A message waiting for Lucy to finish the chore she is on. */
|
|
28
|
+
export interface QueuedMessage {
|
|
29
|
+
/** Also the id of the chore it becomes once it goes out, so the Chores panel follows it. */
|
|
30
|
+
id: string;
|
|
31
|
+
text: string;
|
|
32
|
+
/** When it was sent (ms). */
|
|
33
|
+
at: number;
|
|
34
|
+
}
|
|
35
|
+
/** A waiting message as it comes back from storage, checked like everything kept there. */
|
|
36
|
+
export declare function isQueuedMessage(value: unknown): value is QueuedMessage;
|
|
37
|
+
/** A turn this page streams, as the queue reads it. */
|
|
38
|
+
export interface StreamedTurn {
|
|
39
|
+
/** The chat it was sent in (ChoresChat's thread generation, which New chat moves on). */
|
|
40
|
+
gen: number;
|
|
41
|
+
/** Set once it is being stopped (stop.ts). */
|
|
42
|
+
stopped?: unknown;
|
|
43
|
+
}
|
|
44
|
+
export interface ChatActivity {
|
|
45
|
+
/** The turns this page streams. */
|
|
46
|
+
streaming: Iterable<StreamedTurn>;
|
|
47
|
+
/** The chat on screen. */
|
|
48
|
+
gen: number;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Whether Lucy is on a turn this page streams in the chat on screen: what a message sent now waits
|
|
52
|
+
* behind. Not one being stopped: what is sent next goes once the agent has the word to stop
|
|
53
|
+
* (ChoresChat's `stoppingRef`). Not one from before a New chat, which runs on another session. Nor
|
|
54
|
+
* a chore going on without the page (see the header).
|
|
55
|
+
*/
|
|
56
|
+
export declare function lucyIsOnIt({ streaming, gen }: ChatActivity): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* The message to hand Lucy now, or null: the one that waited longest, once she is on nothing this
|
|
59
|
+
* page streams. One at a time, because the one that goes is such a turn in turn, which the rest
|
|
60
|
+
* wait behind.
|
|
61
|
+
*/
|
|
62
|
+
export declare function nextToSend(queue: readonly QueuedMessage[], chat: ChatActivity): QueuedMessage | null;
|
|
63
|
+
/** A chore turn in this browser's task store, as `sentElsewhere` reads it. */
|
|
64
|
+
export interface StoredTurn {
|
|
65
|
+
/** The chore it is filed under: a waiting message's id, once that message went out. */
|
|
66
|
+
handle?: {
|
|
67
|
+
boardId?: string;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Waiting messages another tab of this chat already handed to Lucy. Two tabs can hold the same one:
|
|
72
|
+
* each reads what a closed page left waiting. The tab that sends it files its chore under the
|
|
73
|
+
* message's id in the task store, which the tabs share, so the other drops it rather than send it
|
|
74
|
+
* twice.
|
|
75
|
+
*/
|
|
76
|
+
export declare function sentElsewhere(queue: readonly QueuedMessage[], tasks: readonly StoredTurn[]): QueuedMessage[];
|
|
77
|
+
/**
|
|
78
|
+
* How long a message a closed page left waiting still goes to Lucy once the chat is open again.
|
|
79
|
+
* Older, it was left behind rather than held up (a "cancel the 7 pm" days later could hit a newer
|
|
80
|
+
* booking), so it comes back to the composer instead: the person sends it or not.
|
|
81
|
+
*/
|
|
82
|
+
export declare const QUEUE_MAX_AGE_MS: number;
|
|
83
|
+
/** What a closed page left waiting: what still goes to Lucy, and what comes back to the composer. */
|
|
84
|
+
export declare function restoreQueue(saved: readonly QueuedMessage[], now: number): {
|
|
85
|
+
waiting: QueuedMessage[];
|
|
86
|
+
stale: QueuedMessage[];
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* The composer's text once the waiting messages come back to it (Stop, New chat, a closed page's
|
|
90
|
+
* that waited too long): theirs first, oldest first, then anything typed since, a blank line
|
|
91
|
+
* between each.
|
|
92
|
+
*/
|
|
93
|
+
export declare function draftWith(draft: string, waiting: readonly QueuedMessage[]): string;
|
|
94
|
+
//# sourceMappingURL=queue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../../../src/pages/Home/chat/queue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,gEAAgE;AAChE,MAAM,WAAW,aAAa;IAC1B,4FAA4F;IAC5F,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,6BAA6B;IAC7B,EAAE,EAAE,MAAM,CAAC;CACd;AAED,2FAA2F;AAC3F,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAWtE;AAED,uDAAuD;AACvD,MAAM,WAAW,YAAY;IACzB,yFAAyF;IACzF,GAAG,EAAE,MAAM,CAAC;IACZ,8CAA8C;IAC9C,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IACzB,mCAAmC;IACnC,SAAS,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAC;IAClC,0BAA0B;IAC1B,GAAG,EAAE,MAAM,CAAC;CACf;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,EAAE,YAAY,GAAG,OAAO,CAGpE;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,EAAE,IAAI,EAAE,YAAY,GAAG,aAAa,GAAG,IAAI,CAEpG;AAED,8EAA8E;AAC9E,MAAM,WAAW,UAAU;IACvB,uFAAuF;IACvF,MAAM,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACjC;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,EAAE,KAAK,EAAE,SAAS,UAAU,EAAE,GAAG,aAAa,EAAE,CAG5G;AAED;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,QAAc,CAAC;AAE5C,qGAAqG;AACrG,wBAAgB,YAAY,CACxB,KAAK,EAAE,SAAS,aAAa,EAAE,EAC/B,GAAG,EAAE,MAAM,GACZ;IAAE,OAAO,EAAE,aAAa,EAAE,CAAC;IAAC,KAAK,EAAE,aAAa,EAAE,CAAA;CAAE,CAItD;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,aAAa,EAAE,GAAG,MAAM,CAIlF"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the person sends while Lucy is on a chore this page is following waits here, in the page,
|
|
3
|
+
* and goes to her once that turn is over: one message at a time, each on the chat's own session,
|
|
4
|
+
* so she has the whole conversation for it.
|
|
5
|
+
*
|
|
6
|
+
* The agent runs one turn at a time per session and holds one more behind it. It refuses the next
|
|
7
|
+
* (`session_busy`), and the kit's answer to a refusal - fork the session and cancel the turn it is
|
|
8
|
+
* on (`postAgentChatStream`'s stuck-session recovery) - stopped the chore Lucy was on. So a third
|
|
9
|
+
* message sent while she worked killed her current chore, and the one queued behind it ran on the
|
|
10
|
+
* old session without the rest of the conversation. Now the page sends nothing more to a session
|
|
11
|
+
* while a turn it streams is on it, and the chat turns that recovery off.
|
|
12
|
+
*
|
|
13
|
+
* Two kinds of message go at once:
|
|
14
|
+
* - an answer to Lucy's question card: the turn that asked waits for it (ChoresChat);
|
|
15
|
+
* - the first one sent while a chore goes on without the page (it was closed and opened again, or
|
|
16
|
+
* the line to Lucy dropped). The page cannot see whether she is still at it or parked on a
|
|
17
|
+
* question it never showed, so the agent gets it: it holds it behind that chore, or takes it as
|
|
18
|
+
* the answer. The page streams that one, and the rest wait behind it here.
|
|
19
|
+
*
|
|
20
|
+
* What waits is kept with the thread (thread.ts), so closing the page does not lose it: it goes
|
|
21
|
+
* once the chat is open again, unless it has waited too long (`restoreQueue`), and from one tab
|
|
22
|
+
* only (`sentElsewhere`). Stop and New chat hand it back to the composer instead. Stop means Lucy
|
|
23
|
+
* stops, not that she moves on to the next thing.
|
|
24
|
+
*
|
|
25
|
+
* Nothing here touches the network or storage.
|
|
26
|
+
*/
|
|
27
|
+
/** A waiting message as it comes back from storage, checked like everything kept there. */
|
|
28
|
+
function isQueuedMessage(value) {
|
|
29
|
+
if (!value || typeof value !== 'object') return false;
|
|
30
|
+
const m = value;
|
|
31
|
+
return typeof m.id === 'string' && m.id !== '' && typeof m.text === 'string' && m.text.trim() !== '' && typeof m.at === 'number' && Number.isFinite(m.at);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Whether Lucy is on a turn this page streams in the chat on screen: what a message sent now waits
|
|
35
|
+
* behind. Not one being stopped: what is sent next goes once the agent has the word to stop
|
|
36
|
+
* (ChoresChat's `stoppingRef`). Not one from before a New chat, which runs on another session. Nor
|
|
37
|
+
* a chore going on without the page (see the header).
|
|
38
|
+
*/
|
|
39
|
+
function lucyIsOnIt({
|
|
40
|
+
streaming,
|
|
41
|
+
gen
|
|
42
|
+
}) {
|
|
43
|
+
for (const turn of streaming) if (turn.gen === gen && !turn.stopped) return true;
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The message to hand Lucy now, or null: the one that waited longest, once she is on nothing this
|
|
48
|
+
* page streams. One at a time, because the one that goes is such a turn in turn, which the rest
|
|
49
|
+
* wait behind.
|
|
50
|
+
*/
|
|
51
|
+
function nextToSend(queue, chat) {
|
|
52
|
+
return queue.length && !lucyIsOnIt(chat) ? queue[0] : null;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Waiting messages another tab of this chat already handed to Lucy. Two tabs can hold the same one:
|
|
56
|
+
* each reads what a closed page left waiting. The tab that sends it files its chore under the
|
|
57
|
+
* message's id in the task store, which the tabs share, so the other drops it rather than send it
|
|
58
|
+
* twice.
|
|
59
|
+
*/
|
|
60
|
+
function sentElsewhere(queue, tasks) {
|
|
61
|
+
const chores = new Set(tasks.map(task => task.handle?.boardId).filter(Boolean));
|
|
62
|
+
return queue.filter(message => chores.has(message.id));
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* How long a message a closed page left waiting still goes to Lucy once the chat is open again.
|
|
66
|
+
* Older, it was left behind rather than held up (a "cancel the 7 pm" days later could hit a newer
|
|
67
|
+
* booking), so it comes back to the composer instead: the person sends it or not.
|
|
68
|
+
*/
|
|
69
|
+
const QUEUE_MAX_AGE_MS = 30 * 60_000;
|
|
70
|
+
/** What a closed page left waiting: what still goes to Lucy, and what comes back to the composer. */
|
|
71
|
+
function restoreQueue(saved, now) {
|
|
72
|
+
// A clock that jumped makes a message from the future: it was not sent a moment ago either.
|
|
73
|
+
const fresh = m => now - m.at <= QUEUE_MAX_AGE_MS && m.at <= now + 60_000;
|
|
74
|
+
return {
|
|
75
|
+
waiting: saved.filter(fresh),
|
|
76
|
+
stale: saved.filter(m => !fresh(m))
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* The composer's text once the waiting messages come back to it (Stop, New chat, a closed page's
|
|
81
|
+
* that waited too long): theirs first, oldest first, then anything typed since, a blank line
|
|
82
|
+
* between each.
|
|
83
|
+
*/
|
|
84
|
+
function draftWith(draft, waiting) {
|
|
85
|
+
const parts = waiting.map(m => m.text.trim()).filter(Boolean);
|
|
86
|
+
if (draft.trim()) parts.push(draft);
|
|
87
|
+
return parts.join('\n\n');
|
|
88
|
+
}export{QUEUE_MAX_AGE_MS,draftWith,isQueuedMessage,lucyIsOnIt,nextToSend,restoreQueue,sentElsewhere};//# sourceMappingURL=queue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queue.js","sources":["../../../../src/pages/Home/chat/queue.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;AAyBG;AAWH;AACM,SAAU,eAAe,CAAC,KAAc,EAAA;AAC1C,EAAA,IAAA,CAAA,KAAU,IAAA,OAAW,KAAA,aAAkB,EAAA,OAAA,KAAA;AAAE,EAAA,MAAA,CAAA,GAAA;SACnC,OAAI,CAAA,CAAA,EAAiC,KAAA,QAAA,IAAA,CAAA,CAAA,EAAA,KAAA,EAAA,IAAA,OAAA,CAAA,CAAA,IAAA,KAAA,QAAA,IAAA,CAAA,CAAA,IAAA,CAAA,IAAA,EAAA,KAAA,EAAA,IAAA,OAAA,CAAA,CAAA,EAAA,KAAA,QAAA,IAAA,MAAA,CAAA,QAAA,CAAA,CAAA,CAAA,EAAA,CAAA;AAC3C;;AAGI;AACA;AACA;;AAGR;AAiBA,SAAA,UAAA,CAAA;;;;;AAKG,EAAA,OAAA,KAAA;AACH;;;AACyE;AACrE;AACJ;AAEA,SAAA,UAAA,CAAA,KAAA,EAAA,IAAA,EAAA;;;;AAIG;AACH;;AAEA;AAQA;;;;;AAKG;AACH;;AAEI;AACJ;AAEA,MAAA,gBAAA,GAAA,EAAA,GAAA;;;;AAIG,EAAA,MAAA,KAAA,GAAA,CAAA,IAAA,GAAA,GAAA,CAAA,CAAA,EAAA,IAAA,gBAAA,IAAA,CAAA,CAAA,EAAA,IAAA,GAAA,GAAA,MAAA;AACH,EAAA,OAAa;AAEb,IAAqG,OAAA,EAAA,KAAA,CAAA,MAAA,CAAA,KAAA,CAAA;AACrG,IAAA,KAAgB,EAAA,KAAA,CAAA,MAAA,CAAA,CAAA,IACZ,CAAA,MACA,CAAW,CAAA;;;AAIX;AACJ;AAEA;;;;AAIG,EAAA,MAAA,KAAA,GAAA,OAAA,CAAA,GAAA,CAAA,CAAA,IAAA,CAAA,CAAA,IAAA,CAAA,IAAA,EAAA,CAAA,CAAA,MAAA,CAAA,OAAA,CAAA;AACH,EAAA,IAAM,KAAU,CAAA,IAAA,EAAA,EAAA,KAAS,CAAC,IAAA,CAAa,KAAmC,CAAA;SAChE,KAAA,CAAK,IAAU,CAAA,MAAC;"}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lucy's search results as cards, the way the Yantra app shows them. Yantra's chat tells the agent to
|
|
3
|
+
* add one fenced `yantra:widget` block whenever a reply lists flights (or stays, cars, trains) or
|
|
4
|
+
* products to choose from (yantra-app `features/chat/result-cards/resultsCardContext.ts`), and draws a
|
|
5
|
+
* card from it. This chat asks for the same block (RESULT_CARDS_PROMPT, sent with Lucy's system
|
|
6
|
+
* prompt) and keeps what it carries: the kit's parseChatWidget strips every envelope but draws only
|
|
7
|
+
* media, so a `travel` or `shopping` block used to vanish, and the results with it.
|
|
8
|
+
*
|
|
9
|
+
* Each reply's result blocks come out of its words here (takeResults) and become the cards' view
|
|
10
|
+
* models: the copy, the badges, the links and the reply a tap sends are all decided in this file, so
|
|
11
|
+
* the tests pin them. ResultCards.tsx only draws them.
|
|
12
|
+
*
|
|
13
|
+
* Input shapes follow the agent's widget attachments as Yantra's cards read them (yantra-app
|
|
14
|
+
* `result-cards/resultCardModels.ts`): a `travel` offer carries `flight` as `@admin-layout/client`'s
|
|
15
|
+
* TravelFlightDetails (slices with airport-local `departAt` / `arriveAt`, never moved to the viewer's
|
|
16
|
+
* zone, and `connections` for the stops on the way); a stay, car or train has no `flight`; a
|
|
17
|
+
* `shopping` item is a result row. Every field is optional: a card shows what arrived. Kept free of
|
|
18
|
+
* the kit, so Jest can load it.
|
|
19
|
+
*/
|
|
20
|
+
export type ResultComponent = 'travel' | 'shopping';
|
|
21
|
+
/** One result block Lucy wrote: which card draws it, and what it carries. */
|
|
22
|
+
export interface ResultWidget {
|
|
23
|
+
component: ResultComponent;
|
|
24
|
+
attachment: Record<string, unknown>;
|
|
25
|
+
}
|
|
26
|
+
export interface TakenWidgets {
|
|
27
|
+
/** The reply without its result blocks, and without one still being written. */
|
|
28
|
+
content: string;
|
|
29
|
+
widgets: ResultWidget[];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Takes Lucy's travel and shopping blocks out of a reply: fenced, under a bare marker line, or bare.
|
|
33
|
+
* Any other envelope is left for the kit (media.ts draws its pictures). A reply with none comes back
|
|
34
|
+
* as the very same string.
|
|
35
|
+
*/
|
|
36
|
+
export declare function takeResultWidgets(content: string): TakenWidgets;
|
|
37
|
+
/** "$435" from (435, "USD"); the agent's own label wins when it sent one. */
|
|
38
|
+
export declare function formatAmount(value: unknown, currency?: unknown, label?: unknown): string | undefined;
|
|
39
|
+
/** "10:00 PM" from an airport-local "2026-12-12T22:00": the wall clock as written. */
|
|
40
|
+
export declare function wallClock(iso?: unknown): string | undefined;
|
|
41
|
+
/** "Sat, Dec 12" for the date an ISO string names, whatever the viewer's zone. */
|
|
42
|
+
export declare function dateLabel(iso?: unknown): string | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* "+1" when a flight lands on a later calendar day than it left, "-1" when it lands on the day
|
|
45
|
+
* before (west to east over the date line).
|
|
46
|
+
*/
|
|
47
|
+
export declare function dayOffset(departAt?: unknown, arriveAt?: unknown): string | undefined;
|
|
48
|
+
/** "28h 10m", "45m", "3h". */
|
|
49
|
+
export declare function durationLabel(minutes?: unknown): string | undefined;
|
|
50
|
+
export declare function stopsLabel(stops?: number): string | undefined;
|
|
51
|
+
/** "21.5K" for 21500 reviews. */
|
|
52
|
+
export declare function compactCount(count?: unknown): string | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* A link worth opening: http(s) only, so a `javascript:` or `data:` value never reaches an href. A
|
|
55
|
+
* long one is kept whole or not at all: a clipped link goes nowhere.
|
|
56
|
+
*/
|
|
57
|
+
export declare function safeLink(value: unknown): string | undefined;
|
|
58
|
+
/** An image worth loading: https only, so the page never loads one in the clear. */
|
|
59
|
+
export declare function safeImage(value: unknown): string | undefined;
|
|
60
|
+
/** A bare hostname from a domain or URL; undefined when it is not one. */
|
|
61
|
+
export declare function cleanDomain(raw: unknown): string | undefined;
|
|
62
|
+
/** The site icon for a hostname, from the favicon service Yantra's cards use. */
|
|
63
|
+
export declare function faviconUrl(domain: string): string;
|
|
64
|
+
/**
|
|
65
|
+
* True for the favicon service's stand-in: a site it has no icon for comes back as a 16px globe
|
|
66
|
+
* behind a 404 the page cannot see. Real icons asked for at 64px come back at 32px or more.
|
|
67
|
+
*/
|
|
68
|
+
export declare function isFallbackFavicon(image: {
|
|
69
|
+
src: string;
|
|
70
|
+
naturalWidth: number;
|
|
71
|
+
}): boolean;
|
|
72
|
+
/** A brand's mark: an explicit https image, else its site's icon, else nothing (the card draws a monogram). */
|
|
73
|
+
export declare function brandLogo(logo: unknown, domain: unknown): string | undefined;
|
|
74
|
+
/** Up to two letters for a brand tile: a flight number's carrier code, else the name's initials. */
|
|
75
|
+
export declare function monogram(name: string, flightNumber?: string): string;
|
|
76
|
+
export declare function airlineDomain(airline?: string): string | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* Google Flights opened on a route and day: its `q` reads "Flights from BLR to ATL on 2026-12-12 one
|
|
79
|
+
* way" (or "... through 2026-12-19") into the from, to, dates and trip type.
|
|
80
|
+
*/
|
|
81
|
+
export declare function flightSearchUrl(from: string, to: string, departDate: string, returnDate?: string): string;
|
|
82
|
+
/** Lucy's own pick (the one she put first), the cheapest, the quickest. */
|
|
83
|
+
export type ResultBadge = 'pick' | 'cheapest' | 'fastest';
|
|
84
|
+
/** Somewhere to book or see a result yourself, and what the link says it does. */
|
|
85
|
+
export interface ResultLink {
|
|
86
|
+
href: string;
|
|
87
|
+
/** "Book Etihad EY 217 on Google Flights", read out for the link. */
|
|
88
|
+
label: string;
|
|
89
|
+
}
|
|
90
|
+
/** One direction of a flight, as a row draws it. */
|
|
91
|
+
export interface FlightLeg {
|
|
92
|
+
from?: string;
|
|
93
|
+
to?: string;
|
|
94
|
+
departs?: string;
|
|
95
|
+
arrives?: string;
|
|
96
|
+
/** "+1": it lands on a later day; "-1": on the day before, over the date line. */
|
|
97
|
+
dayShift?: string;
|
|
98
|
+
/** "Sat, Dec 12": the day it leaves. */
|
|
99
|
+
date?: string;
|
|
100
|
+
duration?: string;
|
|
101
|
+
stops?: string;
|
|
102
|
+
/** How many stops, for the dots on its line (at most 3 are drawn). */
|
|
103
|
+
stopCount?: number;
|
|
104
|
+
/** The stops on the way and the wait at each: "AUH 8h 20m". */
|
|
105
|
+
via?: string;
|
|
106
|
+
/** Separate tickets change at a stop on this leg. */
|
|
107
|
+
selfTransfer: boolean;
|
|
108
|
+
}
|
|
109
|
+
/** What every row answers with: what a tap sends Lucy, and the button's name for a screen reader. */
|
|
110
|
+
interface Answerable {
|
|
111
|
+
/** What a tap sends Lucy: "Book the 10:00 PM Etihad flight EY 217 from BLR to ATL on Sat, Dec 12 ($435)." */
|
|
112
|
+
reply: string;
|
|
113
|
+
/** The button's accessible name; it starts with the word on the button (Book, Choose). */
|
|
114
|
+
action: string;
|
|
115
|
+
}
|
|
116
|
+
export interface FlightRow extends Answerable {
|
|
117
|
+
key: string;
|
|
118
|
+
airline: string;
|
|
119
|
+
logo?: string;
|
|
120
|
+
monogram: string;
|
|
121
|
+
flightNumber?: string;
|
|
122
|
+
/** The outbound, then the return on a round trip. */
|
|
123
|
+
legs: FlightLeg[];
|
|
124
|
+
price?: string;
|
|
125
|
+
/** What the fare includes: "Basic · No checked bag". */
|
|
126
|
+
fare?: string;
|
|
127
|
+
/** Separate tickets: the person collects bags and checks in again, and a missed connection is theirs. */
|
|
128
|
+
selfTransfer: boolean;
|
|
129
|
+
badges: ResultBadge[];
|
|
130
|
+
link?: ResultLink;
|
|
131
|
+
}
|
|
132
|
+
export interface FlightsCard {
|
|
133
|
+
kind: 'flights';
|
|
134
|
+
key: string;
|
|
135
|
+
title: string;
|
|
136
|
+
subtitle?: string;
|
|
137
|
+
rows: FlightRow[];
|
|
138
|
+
/** Every row leaves on its own day: each shows its date (one shared day is in the title line). */
|
|
139
|
+
datedRows: boolean;
|
|
140
|
+
/** The route on Google Flights, for more than the card shows. */
|
|
141
|
+
more?: ResultLink;
|
|
142
|
+
}
|
|
143
|
+
/** A product, a stay, a car or a train: a picture, what it is, its price and a tap to choose it. */
|
|
144
|
+
export interface ListRow extends Answerable {
|
|
145
|
+
key: string;
|
|
146
|
+
title: string;
|
|
147
|
+
imageUrl?: string;
|
|
148
|
+
/** "4.2" stars, and how many reviews: "21.5K". */
|
|
149
|
+
rating?: string;
|
|
150
|
+
reviews?: string;
|
|
151
|
+
/** One short line: the agent's note, or a place, or a train's times. */
|
|
152
|
+
detail?: string;
|
|
153
|
+
/** "€320". */
|
|
154
|
+
price?: string;
|
|
155
|
+
/** "/ night", drawn under the price. */
|
|
156
|
+
priceUnit?: string;
|
|
157
|
+
/** The price before a sale. */
|
|
158
|
+
wasPrice?: string;
|
|
159
|
+
/** Who sells it: "Amazon", "Hertz". */
|
|
160
|
+
seller?: string;
|
|
161
|
+
badges: ResultBadge[];
|
|
162
|
+
link?: ResultLink;
|
|
163
|
+
}
|
|
164
|
+
export type ListKind = 'products' | 'stays' | 'cars' | 'trains' | 'buses' | 'travel';
|
|
165
|
+
export interface ListCard {
|
|
166
|
+
kind: ListKind;
|
|
167
|
+
key: string;
|
|
168
|
+
title: string;
|
|
169
|
+
subtitle?: string;
|
|
170
|
+
rows: ListRow[];
|
|
171
|
+
}
|
|
172
|
+
export type ResultCard = FlightsCard | ListCard;
|
|
173
|
+
/** The flights in a `travel` block as rows, Lucy's pick first; null when it has none. */
|
|
174
|
+
export declare function toFlightsCard(attachment: Record<string, unknown>, key: string): FlightsCard | null;
|
|
175
|
+
/**
|
|
176
|
+
* The products in a `shopping` block, or the stays, cars and trains in a `travel` one (its rows with
|
|
177
|
+
* no `flight`), as list rows with Lucy's pick first; null when there are none. Next to a flights card
|
|
178
|
+
* from the same block, the block's title and count are the flights' own: this card names itself and
|
|
179
|
+
* counts its rows.
|
|
180
|
+
*/
|
|
181
|
+
export declare function toListCard(component: ResultComponent, attachment: Record<string, unknown>, key: string, nextToFlights?: boolean): ListCard | null;
|
|
182
|
+
/** The cards for a reply's result blocks, in the order she wrote them. */
|
|
183
|
+
export declare function resultCards(widgets: ResultWidget[], keyPrefix?: string): ResultCard[];
|
|
184
|
+
export interface TakenResults {
|
|
185
|
+
/** The reply without its result blocks. */
|
|
186
|
+
content: string;
|
|
187
|
+
cards: ResultCard[];
|
|
188
|
+
}
|
|
189
|
+
/** A reply's words, and the cards its result blocks draw. A reply with none comes back as the same string. */
|
|
190
|
+
export declare function takeResults(content: string, keyPrefix?: string): TakenResults;
|
|
191
|
+
/**
|
|
192
|
+
* The pick each card already sent, by card: the first message the person sent after the cards (in
|
|
193
|
+
* the order sent) that is one of the card's rows' words - a tap sends exactly those. A card with a
|
|
194
|
+
* pick takes no other; the other cards of the same reply still take theirs.
|
|
195
|
+
*/
|
|
196
|
+
export declare function cardPicks(cards: ResultCard[], later: readonly string[]): Record<string, string>;
|
|
197
|
+
/**
|
|
198
|
+
* How to present results so the chat can draw them, appended to Lucy's system prompt. Yantra's chat
|
|
199
|
+
* sends the same note on the turns its router labels travel or shopping (resultsCardContext.ts);
|
|
200
|
+
* this chat has no router, so it rides every session. It only says how to present results when a
|
|
201
|
+
* reply has them. The flight example also shows `connections` (a stop and its wait), which this
|
|
202
|
+
* chat's card draws. Lucy's brief asks for a question card whenever there is a choice to make; the
|
|
203
|
+
* last line keeps her from asking the same choice twice.
|
|
204
|
+
*/
|
|
205
|
+
export declare const RESULT_CARDS_PROMPT: string;
|
|
206
|
+
export {};
|
|
207
|
+
//# sourceMappingURL=results.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"results.d.ts","sourceRoot":"","sources":["../../../../src/pages/Home/chat/results.ts"],"names":[],"mappings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