@burdenoff/fe-libs 2026.924.1 → 2026.924.3
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/dist/shared/assistant/autoRouting.d.ts +197 -0
- package/dist/shared/assistant/autoRouting.d.ts.map +1 -0
- package/dist/shared/assistant/autoRouting.js +854 -0
- package/dist/shared/assistant/conversation.d.ts +13 -0
- package/dist/shared/assistant/conversation.d.ts.map +1 -1
- package/dist/shared/assistant/i18nManifest.d.ts +2 -0
- package/dist/shared/assistant/i18nManifest.d.ts.map +1 -1
- package/dist/shared/assistant/i18nManifest.js +2 -0
- package/dist/shared/assistant/index.d.ts +1 -0
- package/dist/shared/assistant/index.d.ts.map +1 -1
- package/dist/shared/assistant/store.d.ts +32 -2
- package/dist/shared/assistant/store.d.ts.map +1 -1
- package/dist/shared/assistant/store.js +69 -29
- package/dist/shared/assistant/ui/AssistantChatArea.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantChatArea.js +428 -341
- package/dist/shared/assistant/ui/AssistantEmptyState.d.ts +17 -1
- package/dist/shared/assistant/ui/AssistantEmptyState.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantEmptyState.js +14 -9
- package/dist/shared/assistant/ui/composer/AssistantComposer.d.ts +3 -0
- package/dist/shared/assistant/ui/composer/AssistantComposer.d.ts.map +1 -1
- package/dist/shared/assistant/ui/composer/AssistantComposer.js +110 -109
- package/dist/shared/assistant/ui/composer/AssistantModeSelector.d.ts +20 -0
- package/dist/shared/assistant/ui/composer/AssistantModeSelector.d.ts.map +1 -1
- package/dist/shared/assistant/ui/composer/AssistantModeSelector.js +89 -45
- package/dist/shared/config/products.d.ts.map +1 -1
- package/dist/shared/config/products.js +1 -2
- package/dist/shared-assistant.js +80 -79
- package/package.json +1 -1
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { AssistantModeConfig, ConversationRouting } from './conversation';
|
|
2
|
+
import { AssistantMode } from './types';
|
|
3
|
+
/** The read-only mode Auto routes questions, explanations and navigation to. */
|
|
4
|
+
export declare const AUTO_READ_MODE = "assistant";
|
|
5
|
+
/**
|
|
6
|
+
* The write mode Auto routes requests for a change to — the only id whose
|
|
7
|
+
* sandbox proposes each change and waits for approval before saving it.
|
|
8
|
+
*
|
|
9
|
+
* ★ Deliberately not `vibe-plugins` or any product-declared builder. Those make
|
|
10
|
+
* artifacts, not records, and are chosen on purpose; Auto does not guess them.
|
|
11
|
+
*/
|
|
12
|
+
export declare const AUTO_WRITE_MODE = "api-calls";
|
|
13
|
+
/** What a message asks for: a change to be made, or anything else. */
|
|
14
|
+
export type AssistantIntent = "act" | "read";
|
|
15
|
+
/**
|
|
16
|
+
* Auto is offered only where there is something to route between: the product
|
|
17
|
+
* offers BOTH the read mode and the write mode to this person. `modes` must be
|
|
18
|
+
* the role-filtered list the selector shows, not the product's full list.
|
|
19
|
+
*/
|
|
20
|
+
export declare function isAutoRoutingOffered(modes: readonly Pick<AssistantModeConfig, "id">[]): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Does this message ask for a change to be made?
|
|
23
|
+
*
|
|
24
|
+
* Conservative by design: "act" only when a clause asks for a change — opens
|
|
25
|
+
* with a verb of change ("create a tomato crop in Field 3"), asks the assistant
|
|
26
|
+
* to ("can you add a chart", "would you mind deleting the parser", "I'd like
|
|
27
|
+
* the sink renamed"), or confirms ("go ahead"). A question about how to change
|
|
28
|
+
* something ("how do I create a crop"), a request to see or go somewhere ("open
|
|
29
|
+
* the crop page"), a statement ("import errors keep showing up"), and anything
|
|
30
|
+
* the rules do not recognise are "read".
|
|
31
|
+
*
|
|
32
|
+
* ★ Any sentence or clause that asks for a change makes the message a request:
|
|
33
|
+
* "I have a CSV of attendance. Build a dashboard from it." is one, and so is
|
|
34
|
+
* "show me the widgets and remove the empty one". A question stays one unless
|
|
35
|
+
* its last clause asks the assistant to act ("why is this failing, can you fix
|
|
36
|
+
* it?").
|
|
37
|
+
*
|
|
38
|
+
* ★★ One message at a time, by design. A follow-up with nothing to go on — a
|
|
39
|
+
* bare "yes", "same for field 4" — reads as "read", which in an open Auto
|
|
40
|
+
* conversation means CONTINUE in the mode it is in: it inherits the
|
|
41
|
+
* conversation's route (`resolveAutoRoute`), which is what it refers to.
|
|
42
|
+
*
|
|
43
|
+
* ★★ English only. A request in another language routes to Ask and is answered
|
|
44
|
+
* read-only — the behaviour before Auto existed, never a wrong write.
|
|
45
|
+
*/
|
|
46
|
+
export declare function classifyAssistantIntent(text: string): AssistantIntent;
|
|
47
|
+
/** The part of a conversation routing reads. */
|
|
48
|
+
export interface AutoRouteConversation {
|
|
49
|
+
mode: AssistantMode;
|
|
50
|
+
routedBy?: ConversationRouting;
|
|
51
|
+
/** Any message, or a live backend session: something a new mode would lose. */
|
|
52
|
+
hasHistory: boolean;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* What an Auto send does with the conversation it lands in.
|
|
56
|
+
*
|
|
57
|
+
* - `new`: start a new conversation in `mode`. There is none, or the one open
|
|
58
|
+
* is a conversation whose mode the person chose — never converted.
|
|
59
|
+
* - `adopt`: the open conversation is empty; give it `mode` and mark it Auto's.
|
|
60
|
+
* - `continue`: send into the open Auto conversation as it stands.
|
|
61
|
+
* - `escalate`: move the open Auto conversation from Ask to the write mode, in
|
|
62
|
+
* place, with a fresh backend session.
|
|
63
|
+
*/
|
|
64
|
+
export type AutoRoute = {
|
|
65
|
+
action: "new";
|
|
66
|
+
mode: AssistantMode;
|
|
67
|
+
} | {
|
|
68
|
+
action: "adopt";
|
|
69
|
+
mode: AssistantMode;
|
|
70
|
+
} | {
|
|
71
|
+
action: "continue";
|
|
72
|
+
mode: AssistantMode;
|
|
73
|
+
} | {
|
|
74
|
+
action: "escalate";
|
|
75
|
+
mode: AssistantMode;
|
|
76
|
+
};
|
|
77
|
+
export interface AutoRouteInput {
|
|
78
|
+
intent: AssistantIntent;
|
|
79
|
+
/**
|
|
80
|
+
* The turn was spoken. A spoken turn is never routed to the write mode:
|
|
81
|
+
* voice is refused in any mode that can change data
|
|
82
|
+
* (`writeModeSendRefusal`), so routing it there would turn a question into a
|
|
83
|
+
* refusal.
|
|
84
|
+
*/
|
|
85
|
+
dictated: boolean;
|
|
86
|
+
conversation: AutoRouteConversation | null;
|
|
87
|
+
}
|
|
88
|
+
export declare function resolveAutoRoute({ intent, dictated, conversation, }: AutoRouteInput): AutoRoute;
|
|
89
|
+
/** Where an escalated conversation came from. */
|
|
90
|
+
export interface EscalationOrigin {
|
|
91
|
+
mode: AssistantMode;
|
|
92
|
+
backendSessionId: string | null;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* After an escalated turn ends, however it ended: the state to put back, or
|
|
96
|
+
* null to keep the escalation.
|
|
97
|
+
*
|
|
98
|
+
* ★★ The escalation is committed before the write mode's sandbox is reached —
|
|
99
|
+
* it has to be, since the send it makes is what reaches it. If that turn never
|
|
100
|
+
* got a session in the write mode (no sandbox, quota, a timeout, the person
|
|
101
|
+
* stopping it), nothing there knows this conversation, and leaving it moved
|
|
102
|
+
* would pin a conversation to the write mode for good ("never moves back"). So
|
|
103
|
+
* it goes back to the mode it came from; the next request escalates again.
|
|
104
|
+
*
|
|
105
|
+
* ★★ Its old session comes back only while that mode's sandbox is still ours
|
|
106
|
+
* (`sandboxAlive`). Provisioning the write mode can STOP it to free the
|
|
107
|
+
* workspace's slot, and a session id outlives its sandbox: restored, it would
|
|
108
|
+
* suppress the carry-over (a conversation with a session gets none) while the
|
|
109
|
+
* next turn discovers the session is gone and starts an empty one. Without it,
|
|
110
|
+
* that turn starts a session AND hands it the person's earlier messages.
|
|
111
|
+
*
|
|
112
|
+
* Once the write mode HAS a session, it holds this turn, and the escalation
|
|
113
|
+
* stands whatever the turn's outcome. A conversation someone has since moved
|
|
114
|
+
* (a pick, a different route) is left alone.
|
|
115
|
+
*/
|
|
116
|
+
export declare function escalationToUndo(origin: EscalationOrigin | null, escalatedTo: AssistantMode, after: {
|
|
117
|
+
mode: AssistantMode;
|
|
118
|
+
routedBy?: ConversationRouting;
|
|
119
|
+
backendSessionId?: string | null;
|
|
120
|
+
} | undefined, sandboxAlive: (mode: AssistantMode) => boolean): EscalationOrigin | null;
|
|
121
|
+
/** At most this many of the person's earlier messages are carried over. */
|
|
122
|
+
export declare const AUTO_CARRY_OVER_MAX_MESSAGES = 6;
|
|
123
|
+
/** Each carried message is cut to this many characters. */
|
|
124
|
+
export declare const AUTO_CARRY_OVER_MAX_CHARS_PER_MESSAGE = 500;
|
|
125
|
+
/** The carried messages together stay within this many characters. */
|
|
126
|
+
export declare const AUTO_CARRY_OVER_MAX_CHARS = 3000;
|
|
127
|
+
/**
|
|
128
|
+
* The preamble that hands a NEW backend session the person's earlier messages,
|
|
129
|
+
* or "" when there are none.
|
|
130
|
+
*
|
|
131
|
+
* ★★ The person's messages only — never the assistant's replies. Those carry
|
|
132
|
+
* text read out of business data, and handing them to the write mode as
|
|
133
|
+
* conversation context would let whatever a record says reach the one agent
|
|
134
|
+
* that can change records, dressed as something the person said. What the
|
|
135
|
+
* person wrote is what they asked for, which is all the new session needs to
|
|
136
|
+
* resolve "add it there too".
|
|
137
|
+
*
|
|
138
|
+
* ★ Trailing copies of `content` are dropped: Retry sends the same text again,
|
|
139
|
+
* and the failed attempt is already in the history.
|
|
140
|
+
*/
|
|
141
|
+
export declare function buildAutoCarryOver(priorUserMessages: readonly string[], content: string): string;
|
|
142
|
+
/** The part of a conversation the carry-over reads. */
|
|
143
|
+
export interface AutoCarryOverConversation {
|
|
144
|
+
routedBy?: ConversationRouting;
|
|
145
|
+
messages: readonly {
|
|
146
|
+
role: string;
|
|
147
|
+
content: string;
|
|
148
|
+
}[];
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* The carry-over for a turn in `conversation`, or "".
|
|
152
|
+
*
|
|
153
|
+
* Only for an Auto conversation whose turn is going to a NEW backend session
|
|
154
|
+
* while it already has history — the escalation, the recovery after its
|
|
155
|
+
* sandbox was lost, and a session the backend reaped overnight.
|
|
156
|
+
*
|
|
157
|
+
* ★★ `sessionIsNew` comes from the runtime, AFTER it validated the session,
|
|
158
|
+
* never from the stored id: a reaped session's id is still stored when the
|
|
159
|
+
* send starts, and is only found dead and replaced while the runtime prepares
|
|
160
|
+
* the turn. Reading the stored id gave that fresh session no history, so "add
|
|
161
|
+
* it there too" arrived with nothing to refer to.
|
|
162
|
+
*
|
|
163
|
+
* The turn's own message may already be in `conversation`; it is dropped as a
|
|
164
|
+
* trailing copy of `content` (`buildAutoCarryOver`). A conversation the person
|
|
165
|
+
* routed by hand behaves as it always has.
|
|
166
|
+
*/
|
|
167
|
+
export declare function autoCarryOverFor(conversation: AutoCarryOverConversation | undefined, content: string, sessionIsNew: boolean): string;
|
|
168
|
+
export interface AutoSuggestion {
|
|
169
|
+
text: string;
|
|
170
|
+
/**
|
|
171
|
+
* Which list it came from. Clicking it routes by THIS, not by classifying its
|
|
172
|
+
* text: a product's suggestions are translated, and the classifier reads only
|
|
173
|
+
* English, so a translated write suggestion would otherwise land in Ask.
|
|
174
|
+
*/
|
|
175
|
+
intent: AssistantIntent;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* The chips an empty Auto conversation offers: the read mode's and the write
|
|
179
|
+
* mode's suggestions, alternating, so the person sees both kinds of thing Auto
|
|
180
|
+
* can do. Duplicates are shown once, as the read mode's.
|
|
181
|
+
*/
|
|
182
|
+
export declare function autoSuggestions(read: readonly string[], write: readonly string[], limit?: number): AutoSuggestion[];
|
|
183
|
+
/**
|
|
184
|
+
* Whether Auto is selected, restored from a persisted store.
|
|
185
|
+
*
|
|
186
|
+
* A stored answer wins. A store saved before Auto existed has none, so it is
|
|
187
|
+
* derived from what was on screen:
|
|
188
|
+
*
|
|
189
|
+
* - an open conversation with history keeps the mode it was having — the
|
|
190
|
+
* person's next message continues it rather than being moved elsewhere;
|
|
191
|
+
* - otherwise (none open, or an empty one) the selected MODE decides. The
|
|
192
|
+
* default Ask, or nothing recorded, is a mode nobody chose, so Auto. Any
|
|
193
|
+
* other mode was picked and stays: in a product that does not offer Auto,
|
|
194
|
+
* Auto-by-default turned a picked builder into Ask on the next New.
|
|
195
|
+
*/
|
|
196
|
+
export declare function restoreAutoRouting(persisted: unknown): boolean;
|
|
197
|
+
//# sourceMappingURL=autoRouting.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autoRouting.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/autoRouting.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC/E,OAAO,KAAK,EAAE,aAAa,EAAwB,MAAM,SAAS,CAAC;AAEnE,gFAAgF;AAChF,eAAO,MAAM,cAAc,cAA6C,CAAC;AAEzE;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,cAA6C,CAAC;AAE1E,sEAAsE;AACtE,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,MAAM,CAAC;AAE7C;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,SAAS,IAAI,CAAC,mBAAmB,EAAE,IAAI,CAAC,EAAE,GAChD,OAAO,CAKT;AAslBD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAmBrE;AA+BD,gDAAgD;AAChD,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,aAAa,CAAC;IACpB,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IAC/B,+EAA+E;IAC/E,UAAU,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,SAAS,GACjB;IAAE,MAAM,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,aAAa,CAAA;CAAE,GACtC;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,aAAa,C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