@aintela/chat 0.2.55 → 0.2.57

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/index.js CHANGED
@@ -1,18 +1,18 @@
1
1
  import "reflect-metadata";
2
- import { C as s, F as n, a as o, I as r, L as i, S as c, b as l, c as A, d as S, e as p, T as C, f as g, g as d, h as I, i as h, s as E, j as v } from "./serializer-DNt8QqNO.js";
2
+ import { C as s, F as n, a as o, I as r, L as i, S as c, b as l, c as A, d as p, e as S, T as C, f as d, g, h, i as I, s as E, j as v } from "./serializer-DNt8QqNO.js";
3
3
  import { A as m, a as T, C as L, M as P, b as x, S as U, i as f } from "./Memory-DjLZqgbF.js";
4
4
  import { C as R, C as y } from "./ClientMessage-EKgfuTp8.js";
5
5
  import { C as _, P as B } from "./Prompt-DZb7OaPp.js";
6
6
  import { A as V, a as F, b, c as N, d as H, e as G, C as O, f as W, D as w, E as z, g as J, G as j, h as K, M as q, i as X, R as Y, j as Q, S as Z, l as $, m as ee, n as ae, o as te, p as se, q as ne, r as oe, s as re, t as ie, u as ce } from "./environmentUtils-CUVZ6Dq1.js";
7
- import { A as Ae, a as Se, E as pe, H as Ce, I as ge, L as de, W as Ie } from "./httpArtifactService-JtkC1T7n.js";
7
+ import { A as Ae, a as pe, E as Se, H as Ce, I as de, L as ge, W as he } from "./httpArtifactService-JtkC1T7n.js";
8
8
  import { A as Ee } from "./artifactHtmlHandler-CMQJf1cX.js";
9
9
  import { H as ue, d as me, r as Te } from "./httpSessionService-BDlqebW2.js";
10
- import { APPBAR_V2_HEIGHT as Pe, ASK_USER_CANCELLED as xe, AgentActivityV2 as Ue, AiChat as fe, AiChatDrawer as Me, AiChatFloating as Re, AiChatFloatingV2 as ye, AiChatProvider as De, AiChatServiceContext as _e, AiChatV2Pane as Be, AppBarV2 as ke, AppRailV2 as Ve, AppShellV2 as Fe, ArtifactRender as be, AskUserDialog as Ne, AskUserSheet as He, BoxedPart as Ge, BrainIcon as Oe, ChartIcon as We, ChatIcon as we, ChatPane as ze, ChatsHistoryV2 as Je, CheckIcon as je, ChevronIcon as Ke, ChevronRightIcon as qe, CloseIcon as Xe, CodeIcon as Ye, ComposerIcon as Qe, CurrentMessage as Ze, DEFAULT_PART_RENDERERS as $e, DashboardIcon as ea, DataExplorerIcon as aa, DelayTextComponent as ta, EnvironmentProvider as sa, FileIcon as na, FunctionPart as oa, GlobeIcon as ra, HistoryIcon as ia, IDLE_TIMEOUT as ca, InertEnvironmentProvider as la, JsxErrorBoundary as Aa, LIVE_TSX_DEFAULT_MAX_CHARS_FOR_FULL as Sa, LastPromptsV2 as pa, LinearBackgroundProgress as Ca, LinearProgressBarWithMarkers as ga, ListCheckIcon as da, LiveJsxBlock as Ia, LiveTsxConfigProvider as ha, LlmResponseRender as Ea, LoadingDots as va, LockClosedIcon as ua, LockOpenIcon as ma, MOBILE_NAV_DEFAULT as Ta, MarkdownExtended as La, MentionPickerPanel as Pa, MenuIcon as xa, Message as Ua, MobileDrawerV2 as fa, PanelIcon as Ma, PauseIcon as Ra, PinIcon as ya, PlusIcon as Da, PromptDateMarkers as _a, PromptGhostHint as Ba, PromptV2 as ka, RunProgressPanelV2 as Va, RunProgressStripV2 as Fa, SearchIcon as ba, SendIcon as Na, SessionStateManagerService as Ha, SparkleIcon as Ga, Sparkline as Oa, StopIcon as Wa, Stopwatch as wa, SubAgentBox as za, SubAgentBoxV2 as Ja, SuspendedPart as ja, TableIcon as Ka, TaskListV2 as qa, TerminalIcon as Xa, TextPart as Ya, ThoughtPart as Qa, ToolIcon as Za, TrashIcon as $a, TriggerDropdown as et, TurnAwareButton as at, UiToolDispatcher as tt, UsersIcon as st, V2_CHART_PALETTE as nt, WARNING_THRESHOLD as ot, WaitingPart as rt, classifyPart as it, configureFriendlyMapping as ct, createAiChatEngine as lt, createAiChatSessionStore as At, createAiChatSessionStore as St, createUiToolRegistry as pt, disposeSharedAiChatEngine as Ct, extendDefaultScope as gt, extendModuleRegistry as dt, getDefaultJsxScope as It, getFriendlyLabel as ht, getSharedAiChatEngine as Et, parseClientOutput as vt, parseContentBlocks as ut, parseUiArgs as mt, useAiChatServices as Tt, useAiChatSessionStore as Lt, useCoarsePointer as Pt, useEnvironment as xt, useEnvironmentOptional as Ut, useLiveSession as ft, useLiveTsxMaxCharsForFull as Mt, useParkedAskUser as Rt, useResponsiveLayout as yt, useTurnOpen as Dt, v2Card as _t, v2Chip as Bt, v2IconBtn as kt, v2MonoMeta as Vt, v2SectionLabel as Ft, v2Theme as bt } from "./components.js";
10
+ import { APPBAR_V2_HEIGHT as Pe, ASK_USER_CANCELLED as xe, AgentActivityV2 as Ue, AiChat as fe, AiChatDrawer as Me, AiChatFloating as Re, AiChatFloatingV2 as ye, AiChatProvider as De, AiChatServiceContext as _e, AiChatV2Pane as Be, AppBarV2 as ke, AppRailV2 as Ve, AppShellV2 as Fe, ArtifactRender as be, AskUserDialog as Ne, AskUserSheet as He, BoxedPart as Ge, BrainIcon as Oe, ChartIcon as We, ChatIcon as we, ChatPane as ze, ChatsHistoryV2 as Je, CheckIcon as je, ChevronIcon as Ke, ChevronRightIcon as qe, CloseIcon as Xe, CodeIcon as Ye, ComposerIcon as Qe, CurrentMessage as Ze, DEFAULT_PART_RENDERERS as $e, DashboardIcon as ea, DataExplorerIcon as aa, DelayTextComponent as ta, EnvironmentProvider as sa, FileIcon as na, FunctionPart as oa, GlobeIcon as ra, HistoryIcon as ia, IDLE_TIMEOUT as ca, InertEnvironmentProvider as la, JsxErrorBoundary as Aa, LIVE_TSX_DEFAULT_MAX_CHARS_FOR_FULL as pa, LastPromptsV2 as Sa, LinearBackgroundProgress as Ca, LinearProgressBarWithMarkers as da, ListCheckIcon as ga, LiveJsxBlock as ha, LiveTsxConfigProvider as Ia, LlmResponseRender as Ea, LoadingDots as va, LockClosedIcon as ua, LockOpenIcon as ma, MOBILE_NAV_DEFAULT as Ta, MarkdownExtended as La, MentionPickerPanel as Pa, MenuIcon as xa, Message as Ua, MobileDrawerV2 as fa, PanelIcon as Ma, PauseIcon as Ra, PinIcon as ya, PlusIcon as Da, PromptDateMarkers as _a, PromptGhostHint as Ba, PromptV2 as ka, RunProgressPanelV2 as Va, RunProgressStripV2 as Fa, SearchIcon as ba, SendIcon as Na, SessionStateManagerService as Ha, SparkleIcon as Ga, Sparkline as Oa, StopIcon as Wa, Stopwatch as wa, SubAgentBox as za, SubAgentBoxV2 as Ja, SuspendedPart as ja, TableIcon as Ka, TaskListV2 as qa, TerminalIcon as Xa, TextPart as Ya, ThoughtPart as Qa, ToolIcon as Za, TrashIcon as $a, TriggerDropdown as et, TurnAwareButton as at, UiToolDispatcher as tt, UsersIcon as st, V2_CHART_PALETTE as nt, WARNING_THRESHOLD as ot, WaitingPart as rt, classifyPart as it, configureFriendlyMapping as ct, createAiChatEngine as lt, createAiChatSessionStore as At, createAiChatSessionStore as pt, createUiToolRegistry as St, disposeSharedAiChatEngine as Ct, extendDefaultScope as dt, extendModuleRegistry as gt, getDefaultJsxScope as ht, getFriendlyLabel as It, getSharedAiChatEngine as Et, parseClientOutput as vt, parseContentBlocks as ut, parseUiArgs as mt, useAiChatServices as Tt, useAiChatSessionStore as Lt, useCoarsePointer as Pt, useEnvironment as xt, useEnvironmentOptional as Ut, useLiveSession as ft, useLiveTsxMaxCharsForFull as Mt, useParkedAskUser as Rt, useResponsiveLayout as yt, useTurnOpen as Dt, v2Card as _t, v2Chip as Bt, v2IconBtn as kt, v2MonoMeta as Vt, v2SectionLabel as Ft, v2Theme as bt } from "./components.js";
11
11
  import { u as Ht, a as Gt, b as Ot, c as Wt } from "./useContainerWidth-B3t1ZTlo.js";
12
- import { A as zt, a as Jt, b as jt, G as Kt, d as qt, c as Xt, e as Yt, f as Qt, g as Zt, h as $t, i as es, j as as, k as ts, l as ss, m as ns, n as os, o as rs, p as is, q as cs, r as ls, s as As, t as Ss, u as ps, v as Cs } from "./auth-Bx_DLZsc.js";
13
- import { S as ds, a as Is, c as hs, b as Es, d as vs, e as us, f as ms, g as Ts, i as Ls, h as Ps, p as xs, j as Us, k as fs, s as Ms, n as Rs, t as ys } from "./atMentions-DgYt2JSK.js";
14
- import { u as _s } from "./useChatSessions-sbBneRk9.js";
15
- import { Score as ks } from "./interfaces.js";
12
+ import { A as zt, a as Jt, b as jt, G as Kt, d as qt, c as Xt, e as Yt, f as Qt, g as Zt, h as $t, i as es, j as as, k as ts, l as ss, m as ns, n as os, o as rs, p as is, q as cs, r as ls, s as As, t as ps, u as Ss, v as Cs } from "./auth-lluJZyQO.js";
13
+ import { S as gs, a as hs, b as Is, c as Es, d as vs, e as us, f as ms, g as Ts, h as Ls, i as Ps, j as xs, k as Us, l as fs, p as Ms, m as Rs, n as ys, o as Ds, s as _s, t as Bs, u as ks } from "./atMentions-C0dza8DD.js";
14
+ import { u as Fs } from "./useChatSessions-sbBneRk9.js";
15
+ import { Score as Ns } from "./interfaces.js";
16
16
  export {
17
17
  zt as ALLOWED_DOMAINS,
18
18
  Jt as ALLOWED_EMAILS,
@@ -24,7 +24,7 @@ export {
24
24
  Ue as AgentActivityV2,
25
25
  F as AgentConfig,
26
26
  Ae as AgentGatewayService,
27
- Se as AgentGatewayWSAsync,
27
+ pe as AgentGatewayWSAsync,
28
28
  T as AgentKind,
29
29
  b as AgentMode,
30
30
  N as AgentType,
@@ -70,7 +70,7 @@ export {
70
70
  aa as DataExplorerIcon,
71
71
  ta as DelayTextComponent,
72
72
  sa as EnvironmentProvider,
73
- pe as EventBusService,
73
+ Se as EventBusService,
74
74
  z as EventType,
75
75
  J as EventTypeDescriptions,
76
76
  na as FileIcon,
@@ -87,19 +87,19 @@ export {
87
87
  ca as IDLE_TIMEOUT,
88
88
  la as InertEnvironmentProvider,
89
89
  r as InteractionPartUtils,
90
- ge as InteractionService,
90
+ de as InteractionService,
91
91
  Aa as JsxErrorBoundary,
92
- Sa as LIVE_TSX_DEFAULT_MAX_CHARS_FOR_FULL,
93
- pa as LastPromptsV2,
92
+ pa as LIVE_TSX_DEFAULT_MAX_CHARS_FOR_FULL,
93
+ Sa as LastPromptsV2,
94
94
  Ca as LinearBackgroundProgress,
95
- ga as LinearProgressBarWithMarkers,
96
- da as ListCheckIcon,
97
- Ia as LiveJsxBlock,
98
- ha as LiveTsxConfigProvider,
95
+ da as LinearProgressBarWithMarkers,
96
+ ga as ListCheckIcon,
97
+ ha as LiveJsxBlock,
98
+ Ia as LiveTsxConfigProvider,
99
99
  i as LlmEvent,
100
100
  Ea as LlmResponseRender,
101
101
  va as LoadingDots,
102
- de as LocalStorageService,
102
+ ge as LocalStorageService,
103
103
  ua as LockClosedIcon,
104
104
  ma as LockOpenIcon,
105
105
  Ta as MOBILE_NAV_DEFAULT,
@@ -125,21 +125,21 @@ export {
125
125
  Va as RunProgressPanelV2,
126
126
  Fa as RunProgressStripV2,
127
127
  U as SUB_AGENT_TERMINAL_STATUSES,
128
- ks as Score,
128
+ Ns as Score,
129
129
  ba as SearchIcon,
130
130
  Na as SendIcon,
131
131
  c as ServerEvent,
132
132
  Ha as SessionStateManagerService,
133
133
  Z as SkillLevel,
134
- ds as SortableTable,
134
+ gs as SortableTable,
135
135
  Ga as SparkleIcon,
136
136
  Oa as Sparkline,
137
137
  Wa as StopIcon,
138
138
  wa as Stopwatch,
139
139
  l as StreamingFunctionCallUpdateContent,
140
140
  A as StreamingReasoningContent,
141
- S as StreamingResponse,
142
- p as StreamingTextContent,
141
+ p as StreamingResponse,
142
+ S as StreamingTextContent,
143
143
  za as SubAgentBox,
144
144
  Ja as SubAgentBoxV2,
145
145
  ja as SuspendedPart,
@@ -158,43 +158,46 @@ export {
158
158
  nt as V2_CHART_PALETTE,
159
159
  ot as WARNING_THRESHOLD,
160
160
  rt as WaitingPart,
161
- Ie as WebSocketConnecionV2,
162
- Is as applyTriggerInsertion,
163
- hs as chipLocations,
164
- Es as chunkArray,
161
+ he as WebSocketConnecionV2,
162
+ hs as activatePlaceholder,
163
+ Is as advanceToPlaceholder,
164
+ Es as applyTriggerInsertion,
165
+ vs as chipLocations,
166
+ us as chunkArray,
165
167
  it as classifyPart,
166
168
  ct as configureFriendlyMapping,
167
169
  lt as createAiChatEngine,
168
170
  At as createAiChatSessionStore,
169
- St as createAiChatStore,
170
- g as createEventSerializer,
171
- d as createStreamingResponseSerializer,
172
- pt as createUiToolRegistry,
171
+ pt as createAiChatStore,
172
+ d as createEventSerializer,
173
+ g as createStreamingResponseSerializer,
174
+ St as createUiToolRegistry,
173
175
  qt as dateReviver,
174
176
  Xt as decodeBase64,
175
177
  me as decodeSessionEvents,
176
178
  Yt as decodeUri,
177
179
  Qt as decodeUriFromPython,
178
- I as deserializeEvent,
179
- h as deserializePayload,
180
- vs as detectTrigger,
180
+ h as deserializeEvent,
181
+ I as deserializePayload,
182
+ ms as detectTrigger,
181
183
  Ct as disposeSharedAiChatEngine,
182
184
  Zt as encodeBase64,
183
185
  $t as encodeUri,
184
- gt as extendDefaultScope,
185
- dt as extendModuleRegistry,
186
- us as extractInteractionId,
187
- ms as extractLinkAction,
188
- Ts as fetchAtMentions,
186
+ dt as extendDefaultScope,
187
+ gt as extendModuleRegistry,
188
+ Ts as extractInteractionId,
189
+ Ls as extractLinkAction,
190
+ Ps as fetchAtMentions,
191
+ xs as findPlaceholder,
189
192
  es as getAgentBaseUrl,
190
193
  $ as getAgentServerBaseUrl,
191
194
  as as getArtifactsBaseUrl,
192
195
  ee as getConnectionStateColor,
193
- It as getDefaultJsxScope,
196
+ ht as getDefaultJsxScope,
194
197
  ts as getDotNetBaseUrl,
195
198
  ae as getEnvVar,
196
199
  te as getEnvironmentInfo,
197
- ht as getFriendlyLabel,
200
+ It as getFriendlyLabel,
198
201
  ss as getIconByName,
199
202
  se as getModelVendor,
200
203
  ne as getRandomUUID,
@@ -203,34 +206,35 @@ export {
203
206
  Et as getSharedAiChatEngine,
204
207
  ns as iconCategories,
205
208
  os as isBase64Encoded,
206
- Ls as isSectionStart,
209
+ Us as isSectionStart,
207
210
  ie as isServer,
208
211
  f as isSubAgentTerminalStatus,
209
212
  rs as isUriEncoded,
210
- Ps as isValidInteractionId,
213
+ fs as isValidInteractionId,
211
214
  is as isValidUri,
212
215
  cs as materialIcons,
213
- xs as parseAndValidateArtifactUrl,
216
+ Ms as parseAndValidateArtifactUrl,
214
217
  ls as parseArtifactFromJson,
215
218
  vt as parseClientOutput,
216
219
  ut as parseContentBlocks,
217
- Us as parseKnownNumbers,
220
+ Rs as parseKnownNumbers,
218
221
  mt as parseUiArgs,
219
222
  As as parseUriParams,
220
- fs as placeCaret,
223
+ ys as placeCaret,
224
+ Ds as placeholderAt,
221
225
  Te as resolveAccessToken,
222
226
  ce as resolveApiUrl,
223
227
  E as sanitizeJsonString,
224
- Ss as searchIcons,
228
+ ps as searchIcons,
225
229
  v as serializeEvent,
226
- ps as setEbiContextData,
230
+ Ss as setEbiContextData,
227
231
  Cs as setEbiContextSessionId,
228
- Ms as splitBigLinesWithSpaces,
229
- Rs as startsWithInteractionId,
230
- ys as tokenizeForHighlight,
232
+ _s as splitBigLinesWithSpaces,
233
+ Bs as startsWithInteractionId,
234
+ ks as tokenizeForHighlight,
231
235
  Tt as useAiChatServices,
232
236
  Lt as useAiChatSessionStore,
233
- _s as useChatSessions,
237
+ Fs as useChatSessions,
234
238
  Pt as useCoarsePointer,
235
239
  Ht as useContainerRectangle,
236
240
  Gt as useContainerWidth,
@@ -40,6 +40,13 @@ export interface AiChatContextState {
40
40
  * drawn twice (issue #235).
41
41
  */
42
42
  autoRenderAskUserSheet: boolean;
43
+ /** Where a parked ask-user prompt is presented — docked sheet, or inline in the transcript. */
44
+ askUserPresentation: 'sheet' | 'inline';
45
+ /** Host chrome around the inline question (see {@link askUserPresentation}). */
46
+ askUserInlineContainer?: ComponentType<{
47
+ children: ReactNode;
48
+ toolName?: string;
49
+ }>;
43
50
  setShowToolCalls: (show: boolean) => void;
44
51
  friendlyMode: boolean;
45
52
  setFriendlyMode: (enabled: boolean) => void;
@@ -168,6 +168,40 @@ export interface AiChatProps extends AiChatStyleProps {
168
168
  * such hosts can drop it into their own positioned wrapper.
169
169
  */
170
170
  autoRenderAskUserSheet?: boolean;
171
+ /**
172
+ * WHERE a parked ask_user / askauth prompt is presented. Same tool call, same park, same
173
+ * answer — only the format changes.
174
+ *
175
+ * <p>`'sheet'` (default) is the docked {@link AskUserSheet}: it slides up over the conversation,
176
+ * above the composer. `'inline'` draws the question IN THE TURN instead — the parked part stops
177
+ * being suppressed in the transcript and renders at its own position, after the tool call that
178
+ * asked and above the turn's trailing "…" dots, like any other part. That is the shape a phone
179
+ * needs: a sheet there opens to 400px over a transcript that has none to spare, and it carries a
180
+ * grabber, a collapse and a close for a call the server has PARKED and that must be answered
181
+ * rather than dismissed.</p>
182
+ *
183
+ * <p>Because it is the part's own position, the answered summary later replaces the question
184
+ * exactly where the question stood — nothing moves, and the transcript is never scrolled to
185
+ * reveal anything.</p>
186
+ *
187
+ * <p>The two are mutually exclusive by construction: `'inline'` suppresses ChatPane's sheet
188
+ * whatever {@link autoRenderAskUserSheet} says. A host that also docks its OWN
189
+ * {@link AskUserSheet} must stop doing so when it asks for `'inline'`, or the same question is
190
+ * on screen twice.</p>
191
+ */
192
+ askUserPresentation?: 'sheet' | 'inline';
193
+ /**
194
+ * Chrome around the inline question — the host's card. Receives the rendered question face as
195
+ * `children` and the asking tool's name (already stripped of the connector's plugin qualifier).
196
+ * Given one, the question face is drawn `embedded`, so the card's border and padding are the
197
+ * only ones. Optional: with none, the question renders with its own default chrome. Ignored
198
+ * unless {@link askUserPresentation} is `'inline'`, and never applied inside a sheet or dialog,
199
+ * which own their chrome already.
200
+ */
201
+ askUserInlineContainer?: React.ComponentType<{
202
+ children: React.ReactNode;
203
+ toolName?: string;
204
+ }>;
171
205
  friendlyMode?: boolean;
172
206
  /**
173
207
  * Per-part renderer overrides. Map a `PartKind` ('text' | 'thought' |
@@ -1,5 +1,12 @@
1
1
  import { default as React } from 'react';
2
2
  import { Interaction } from '../../../models/Interaction';
3
+ import { InteractionPart } from '../../../models/InteractionPart';
4
+ export declare function hideUnfinishedUiParts(parts: InteractionPart[], onGoing: boolean,
5
+ /**
6
+ * `askUserPresentation === 'inline'`: the parked question has no other surface, so it must stay in
7
+ * the stream and render HERE, at its own position in the turn. See the filter below.
8
+ */
9
+ keepParkedAskUser?: boolean): InteractionPart[];
3
10
  interface MessageAgentProps {
4
11
  message: Interaction;
5
12
  onGoing: boolean;
@@ -26,6 +26,13 @@ export declare const isAskUser: (name?: string | null) => boolean;
26
26
  * bare `askauth`; live LLM connectors qualify it as `{Plugin}-askauth` / `{Plugin}_askauth`.
27
27
  */
28
28
  export declare const isAskAuth: (name?: string | null) => boolean;
29
+ /**
30
+ * The tool name as a HUMAN should read it. Live LLM connectors qualify the SDK's built-ins with the
31
+ * plugin that carries them — `HumanInteractionTool-ask_user` — which is an implementation detail of
32
+ * the connector, and a mouthful in a 360px header. Host-registered names (`ask_for_reason`) are
33
+ * already what their author called them and pass through untouched.
34
+ */
35
+ export declare const askUserDisplayName: (name?: string | null) => string | undefined;
29
36
  /** Built-in ask-user component names (the server's [KernelUIComponent] values for the SDK tools). */
30
37
  export declare const ASK_USER_COMPONENT = "AskUserPart";
31
38
  export declare const ASK_AUTH_COMPONENT = "AskAuthPart";
@@ -191,6 +191,20 @@ interface PromptV2Props {
191
191
  * - `'popover'` / `'panel'` — force one, for hosts that know better than the media query.
192
192
  */
193
193
  mentionPicker?: 'auto' | 'popover' | 'panel';
194
+ /** Chip tint for unfilled `[template placeholders]` (#447). Falls back to `slashColor`, then `hashColor`. */
195
+ placeholderColor?: string;
196
+ /**
197
+ * How the `[template placeholders]` of a `/`-command are walked (#447).
198
+ * - `'guided'` — after each completed pick the NEXT placeholder activates by itself: a typed one
199
+ * (`[@origem]`, `[#data]`) collapses to its trigger char and opens its picker, a plain one
200
+ * (`[Codigo do Trip]`) is left selected for overtype. Tab also jumps to the next slot. The default
201
+ * where there's a mouse.
202
+ * - `'tap'` — nothing moves on its own; each chip is activated by tapping it. The default on a coarse
203
+ * pointer, where programmatic caret moves are alien (and fight the platform — see placeCaret).
204
+ * In BOTH modes the first placeholder of a just-inserted template activates immediately, and
205
+ * tapping/clicking a chip activates it.
206
+ */
207
+ templateFill?: 'guided' | 'tap';
194
208
  borderRadius?: number;
195
209
  }
196
210
  export declare const PromptV2: React.ForwardRefExoticComponent<PromptV2Props & React.RefAttributes<HTMLDivElement>>;
@@ -18,7 +18,7 @@ export { default as SortableTable } from './sortable-table';
18
18
  export { tokenizeForHighlight, chipLocations } from './promptHighlight';
19
19
  export type { HighlightToken } from './promptHighlight';
20
20
  export { placeCaret } from './placeCaret';
21
- export { detectTrigger, applyTriggerInsertion } from './promptTriggers';
22
- export type { TriggerChar, ActiveTrigger, TriggerInsertion } from './promptTriggers';
21
+ export { detectTrigger, applyTriggerInsertion, findPlaceholder, placeholderAt, activatePlaceholder, advanceToPlaceholder, } from './promptTriggers';
22
+ export type { TriggerChar, ActiveTrigger, TriggerInsertion, TemplatePlaceholder } from './promptTriggers';
23
23
  export { fetchAtMentions, isSectionStart } from './atMentions';
24
24
  export type { AtMentionItem, MentionGroup, AtMentionFetchers, AtMentionOptions } from './atMentions';
@@ -1,11 +1,13 @@
1
1
  export type HighlightToken = {
2
- type: 'plain' | 'slash' | 'at' | 'hash';
2
+ type: 'plain' | 'slash' | 'at' | 'hash' | 'placeholder';
3
3
  text: string;
4
4
  };
5
5
  /**
6
6
  * Splits `text` into a flat list of runs so the overlay can paint chip styling around `/cmd` / `@user` / `#date`
7
7
  * tokens while keeping surrounding text plain. Boundary rule mirrors the autocomplete trigger detection (trigger
8
8
  * char at line start or after whitespace), so a `/` inside `http://` or `@` inside an email stays plain.
9
+ * `[bracketed placeholders]` (#447) pre-empt the whitespace walk — they may contain spaces and become their own
10
+ * `placeholder` runs, which hosts paint as "fill me" chips (and may make tappable).
9
11
  */
10
12
  export declare const tokenizeForHighlight: (text: string) => HighlightToken[];
11
13
  /**
@@ -45,11 +45,42 @@ export type TriggerInsertion = {
45
45
  /** True when the inserted value ends in a trigger char — the host should re-run detection so that picker opens. */
46
46
  reopenTrigger: boolean;
47
47
  };
48
+ /** A `[placeholder]` in a template — optionally typed by a leading trigger char. */
49
+ export type TemplatePlaceholder = {
50
+ /** Which picker fills this slot, or `null` for free-text overtype. */
51
+ trigger: TriggerChar | null;
52
+ /** The text between the brackets, trigger char stripped, trimmed — host UIs may show it as a hint. */
53
+ label: string;
54
+ /** Index of the `[` within the text it was found in. */
55
+ startIdx: number;
56
+ /** Index just past the `]`. */
57
+ endIdx: number;
58
+ };
59
+ /** First placeholder at or after `fromIdx`, parsed — or null. */
60
+ export declare function findPlaceholder(text: string, fromIdx?: number): TemplatePlaceholder | null;
61
+ /** The placeholder whose brackets contain `pos` (boundaries inclusive — a tap is imprecise), or null. */
62
+ export declare function placeholderAt(text: string, pos: number): TemplatePlaceholder | null;
63
+ /**
64
+ * Make `ph` the slot being filled. A TYPED placeholder collapses to its bare trigger char with the caret after
65
+ * it and `reopenTrigger` set — the host re-runs detection and the right picker opens with an empty query. A
66
+ * plain one stays as text, SELECTED, so the next keystroke overwrites it.
67
+ */
68
+ export declare function activatePlaceholder(text: string, ph: TemplatePlaceholder): TriggerInsertion;
69
+ /**
70
+ * Walk to the next unfilled placeholder — the guided (desktop) template flow calls this after each completed
71
+ * pick. Looks forward from `fromIdx` first, then wraps to the start (the user may have filled a later slot out
72
+ * of order). Null when the template is fully filled — the host does nothing and the caret stays where the last
73
+ * insertion put it.
74
+ */
75
+ export declare function advanceToPlaceholder(text: string, fromIdx: number): TriggerInsertion | null;
48
76
  /**
49
77
  * Splice `value` over the trigger token `[startIdx, endIdx)` of `draft`.
50
78
  *
51
- * Three shapes, chosen by what the value looks like (issue #422 — the `/` command templates need all three):
52
- * 1. `"…pedido número [Codigo do Trip]"` → inserted as-is, the placeholder left SELECTED, no trailing space.
79
+ * Three shapes, chosen by what the value looks like (issue #422 — the `/` command templates need all three;
80
+ * #447 adds the typed-placeholder variant of shape 1):
81
+ * 1. `"…saindo de [@origem] …"` → inserted with the FIRST placeholder activated: a typed one collapses
82
+ * to its trigger char and re-opens that picker; a plain one
83
+ * (`[Codigo do Trip]`) is left SELECTED. No trailing space.
53
84
  * 2. `"Busque vôos saindo de @"` → inserted as-is, caret at the end, `reopenTrigger` so the `@` picker
54
85
  * opens straight away. A trailing space would break the token.
55
86
  * 3. `"@(GRU) Guarulhos"` (everything else) → inserted plus ONE trailing space, caret after it.
package/dist/utils.js CHANGED
@@ -1,56 +1,60 @@
1
- import { A as e, D as t, l as r, n as i, o as n, q as o, r as c, s as d, t as g, u as l } from "./environmentUtils-CUVZ6Dq1.js";
2
- import { A as I, a as U, b as p, G as E, d as S, c as m, e as h, f as B, g as L, h as f, i as v, j as N, k as C, l as D, m as _, n as b, o as x, p as O, q as T, r as G, s as V, t as k, u as F, v as u } from "./auth-Bx_DLZsc.js";
3
- import { S as M, a as R, c as W, b as j, d as q, e as H, f as P, g as w, i as z, h as J, p as K, j as Y, k as Q, s as X, n as Z, t as $ } from "./atMentions-DgYt2JSK.js";
1
+ import { A as s, D as t, l as r, n as i, o, q as n, r as c, s as d, t as l, u as g } from "./environmentUtils-CUVZ6Dq1.js";
2
+ import { A as I, a as p, b as U, G as E, d as h, c as S, e as m, f as v, g as f, h as B, i as L, j as N, k as C, l as D, m as _, n as T, o as b, p as x, q as O, r as G, s as V, t as k, u, v as F } from "./auth-lluJZyQO.js";
3
+ import { S as y, a as M, b as R, c as W, d as j, e as q, f as H, g as w, h as z, i as J, j as K, k as Y, l as Q, p as X, m as Z, n as $, o as aa, s as ea, t as sa, u as ta } from "./atMentions-C0dza8DD.js";
4
4
  export {
5
5
  I as ALLOWED_DOMAINS,
6
- U as ALLOWED_EMAILS,
7
- e as ANALYTICS_AGENT_NAME,
8
- p as AUTH_CONFIG,
6
+ p as ALLOWED_EMAILS,
7
+ s as ANALYTICS_AGENT_NAME,
8
+ U as AUTH_CONFIG,
9
9
  t as DEV_SERVER_CONFIG,
10
10
  E as GOOGLE_CLIENT_ID,
11
- M as SortableTable,
12
- R as applyTriggerInsertion,
13
- W as chipLocations,
14
- j as chunkArray,
15
- S as dateReviver,
16
- m as decodeBase64,
17
- h as decodeUri,
18
- B as decodeUriFromPython,
19
- q as detectTrigger,
20
- L as encodeBase64,
21
- f as encodeUri,
22
- H as extractInteractionId,
23
- P as extractLinkAction,
24
- w as fetchAtMentions,
25
- v as getAgentBaseUrl,
11
+ y as SortableTable,
12
+ M as activatePlaceholder,
13
+ R as advanceToPlaceholder,
14
+ W as applyTriggerInsertion,
15
+ j as chipLocations,
16
+ q as chunkArray,
17
+ h as dateReviver,
18
+ S as decodeBase64,
19
+ m as decodeUri,
20
+ v as decodeUriFromPython,
21
+ H as detectTrigger,
22
+ f as encodeBase64,
23
+ B as encodeUri,
24
+ w as extractInteractionId,
25
+ z as extractLinkAction,
26
+ J as fetchAtMentions,
27
+ K as findPlaceholder,
28
+ L as getAgentBaseUrl,
26
29
  r as getAgentServerBaseUrl,
27
30
  N as getArtifactsBaseUrl,
28
31
  C as getDotNetBaseUrl,
29
32
  i as getEnvVar,
30
- n as getEnvironmentInfo,
33
+ o as getEnvironmentInfo,
31
34
  D as getIconByName,
32
- o as getRandomUUID,
35
+ n as getRandomUUID,
33
36
  c as getServerBaseUrl,
34
37
  d as getServerClientBaseUrl,
35
38
  _ as iconCategories,
36
- b as isBase64Encoded,
37
- z as isSectionStart,
38
- g as isServer,
39
- x as isUriEncoded,
40
- J as isValidInteractionId,
41
- O as isValidUri,
42
- T as materialIcons,
43
- K as parseAndValidateArtifactUrl,
39
+ T as isBase64Encoded,
40
+ Y as isSectionStart,
41
+ l as isServer,
42
+ b as isUriEncoded,
43
+ Q as isValidInteractionId,
44
+ x as isValidUri,
45
+ O as materialIcons,
46
+ X as parseAndValidateArtifactUrl,
44
47
  G as parseArtifactFromJson,
45
- Y as parseKnownNumbers,
48
+ Z as parseKnownNumbers,
46
49
  V as parseUriParams,
47
- Q as placeCaret,
48
- l as resolveApiUrl,
50
+ $ as placeCaret,
51
+ aa as placeholderAt,
52
+ g as resolveApiUrl,
49
53
  k as searchIcons,
50
- F as setEbiContextData,
51
- u as setEbiContextSessionId,
52
- X as splitBigLinesWithSpaces,
53
- Z as startsWithInteractionId,
54
- $ as tokenizeForHighlight
54
+ u as setEbiContextData,
55
+ F as setEbiContextSessionId,
56
+ ea as splitBigLinesWithSpaces,
57
+ sa as startsWithInteractionId,
58
+ ta as tokenizeForHighlight
55
59
  };
56
60
  //# sourceMappingURL=utils.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aintela/chat",
3
- "version": "0.2.55",
3
+ "version": "0.2.57",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"