@appilots/sdk 0.2.0 → 0.4.0
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/{chunk-GEM6TPAK.mjs → chunk-42WI3UDB.mjs} +312 -1635
- package/dist/{chunk-KGN3DNGX.js → chunk-CHY5D2PV.js} +5 -5
- package/dist/{chunk-KCDNL4HV.mjs → chunk-GEKCGVJN.mjs} +1 -1
- package/dist/{chunk-HDLZGXNF.mjs → chunk-JBOLV5AM.mjs} +2016 -96
- package/dist/{chunk-SIBKF7AA.js → chunk-V3TUIIT2.js} +2036 -97
- package/dist/{chunk-IASJ7YHC.js → chunk-Y7EA6R2G.js} +412 -1735
- package/dist/hooks/index.d.mts +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +11 -11
- package/dist/hooks/index.mjs +2 -2
- package/dist/{index-BDb1WVNo.d.mts → index-Cb0D6uKH.d.mts} +367 -124
- package/dist/{index-BDb1WVNo.d.ts → index-Cb0D6uKH.d.ts} +367 -124
- package/dist/index.d.mts +109 -341
- package/dist/index.d.ts +109 -341
- package/dist/index.js +84 -462
- package/dist/index.mjs +10 -403
- package/dist/navigation/index.js +13 -13
- package/dist/navigation/index.mjs +2 -2
- package/hooks/package.json +9 -0
- package/metro.d.ts +49 -0
- package/metro.js +0 -37
- package/navigation/package.json +9 -0
- package/package.json +45 -25
|
@@ -119,113 +119,20 @@ type PartialThemeTokens = {
|
|
|
119
119
|
declare function mergeThemeTokens(base: AppilotsThemeTokens, partial?: PartialThemeTokens | null): AppilotsThemeTokens;
|
|
120
120
|
|
|
121
121
|
/**
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
/** Empty state heading. */
|
|
135
|
-
emptyTitle: string;
|
|
136
|
-
/** Empty state subtitle / one-liner under the heading. */
|
|
137
|
-
emptySubtitle: string;
|
|
138
|
-
/** "Thinking..." placeholder shown while the assistant is replying. */
|
|
139
|
-
thinking: string;
|
|
140
|
-
/** Status shown while the assistant is planning from the current screen. */
|
|
141
|
-
statusAnalyzing: string;
|
|
142
|
-
/** Status shown while the SDK waits for the app to settle after an action. */
|
|
143
|
-
statusWaitingApp: string;
|
|
144
|
-
/** Status shown while the assistant adjusts after a recoverable failure. */
|
|
145
|
-
statusAdjusting: string;
|
|
146
|
-
/** Footer line shown when poweredByVisible !== false. */
|
|
147
|
-
poweredBy: string;
|
|
148
|
-
/** Approve button on a pending action row in the breadcrumb. */
|
|
149
|
-
approve: string;
|
|
150
|
-
/** Reject button on a pending action row in the breadcrumb. */
|
|
151
|
-
reject: string;
|
|
152
|
-
/** Generic "cancelled by the user" message after a reject. */
|
|
153
|
-
cancelledByUser: string;
|
|
154
|
-
/** Fallback humanised name for an unknown action type. */
|
|
155
|
-
unknownAction: string;
|
|
156
|
-
/** Generic friendly error when nothing else fits. */
|
|
157
|
-
somethingWentWrong: string;
|
|
158
|
-
/** Open chat accessibility label for the floating bubble. */
|
|
159
|
-
openChatA11y: string;
|
|
160
|
-
/** Close chat accessibility label. */
|
|
161
|
-
closeChatA11y: string;
|
|
162
|
-
/** A11y label for the stop-generation button (OKR-008 KR4). */
|
|
163
|
-
stopGeneratingA11y: string;
|
|
164
|
-
/** A11y label for the "talk to a human" header button. */
|
|
165
|
-
talkToHumanA11y: string;
|
|
166
|
-
/** Sender label above a human operator's bubble. */
|
|
167
|
-
humanAgentLabel: string;
|
|
168
|
-
/** System line right after the user (or the offer chip) escalates. */
|
|
169
|
-
escalationRequested: string;
|
|
170
|
-
/** System line when an operator claims the conversation. */
|
|
171
|
-
escalationConnected: string;
|
|
172
|
-
/** System line when the operator resolves — AI takes over again. */
|
|
173
|
-
escalationResolved: string;
|
|
174
|
-
/** System line offering the handoff after the agent gives up. */
|
|
175
|
-
escalationOffer: string;
|
|
176
|
-
/** Label of the tappable chip under the offer line. */
|
|
177
|
-
escalationOfferChip: string;
|
|
178
|
-
/** Thin banner under the header while waiting in the queue. */
|
|
179
|
-
escalationPendingBanner: string;
|
|
180
|
-
/** Thin banner under the header while connected to an operator. */
|
|
181
|
-
escalationActiveBanner: string;
|
|
182
|
-
}
|
|
183
|
-
type AppilotsStringKey = keyof AppilotsStrings;
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* SDK locale code. Adding a locale = adding a bundle file in
|
|
187
|
-
* `./bundles/` AND a branch in `BUNDLES` below. BACKLOG 4.1.
|
|
122
|
+
* SDK locale code. Canonical source of truth for `AppilotsLocale` — moved
|
|
123
|
+
* here (out of the React Native-coupled `i18n/I18nProvider`) so that
|
|
124
|
+
* platform-agnostic contract types (`RemotePersonalization.defaultLocale`)
|
|
125
|
+
* don't pull in a React/React Native import just for a string union type.
|
|
126
|
+
*
|
|
127
|
+
* `@appilots/sdk`'s `i18n/I18nProvider.tsx` re-exports this type from its
|
|
128
|
+
* original public path (`@appilots/sdk`'s `./i18n` barrel) so nothing
|
|
129
|
+
* downstream of the SDK's public API changes.
|
|
130
|
+
*
|
|
131
|
+
* Adding a locale = adding a bundle file in `@appilots/sdk`'s
|
|
132
|
+
* `i18n/bundles/` AND a branch in `i18n/I18nProvider.tsx`'s `BUNDLES`
|
|
133
|
+
* map AND a variant here. BACKLOG 4.1.
|
|
188
134
|
*/
|
|
189
135
|
type AppilotsLocale = 'pt-BR' | 'en' | 'es';
|
|
190
|
-
/**
|
|
191
|
-
* Best-effort device-locale detection. Returns the closest supported
|
|
192
|
-
* locale or `null` if we can't tell. Designed to never throw — RN's
|
|
193
|
-
* native modules are platform-specific and can be missing in test
|
|
194
|
-
* harnesses.
|
|
195
|
-
*/
|
|
196
|
-
declare function detectDeviceLocale(): AppilotsLocale | null;
|
|
197
|
-
/**
|
|
198
|
-
* Resolve the locale to use given the prop and the device default.
|
|
199
|
-
* Order: explicit prop → device-detected → DEFAULT_LOCALE.
|
|
200
|
-
*/
|
|
201
|
-
declare function resolveLocale(prop?: AppilotsLocale | null): AppilotsLocale;
|
|
202
|
-
interface I18nContextValue {
|
|
203
|
-
locale: AppilotsLocale;
|
|
204
|
-
strings: AppilotsStrings;
|
|
205
|
-
/**
|
|
206
|
-
* Helper to read a single key. Components can also destructure
|
|
207
|
-
* `strings` directly if they need many in one render.
|
|
208
|
-
*/
|
|
209
|
-
t: (key: AppilotsStringKey) => string;
|
|
210
|
-
}
|
|
211
|
-
interface AppilotsI18nProviderProps {
|
|
212
|
-
/** Force a locale. Falls through to device detection when omitted. */
|
|
213
|
-
locale?: AppilotsLocale | null;
|
|
214
|
-
/**
|
|
215
|
-
* Per-key overrides to merge on top of the bundle. Useful when the
|
|
216
|
-
* dev wants to rename only "Powered by Appilots" while keeping the
|
|
217
|
-
* rest in the default language.
|
|
218
|
-
*/
|
|
219
|
-
overrides?: Partial<AppilotsStrings> | null;
|
|
220
|
-
children: React__default.ReactNode;
|
|
221
|
-
}
|
|
222
|
-
declare function AppilotsI18nProvider({ locale, overrides, children, }: AppilotsI18nProviderProps): React__default.JSX.Element;
|
|
223
|
-
/**
|
|
224
|
-
* Read the locale + strings from context. Falls back to the default
|
|
225
|
-
* locale bundle if no provider is mounted, so components don't need a
|
|
226
|
-
* provider to be safe — they just lose the dev's overrides.
|
|
227
|
-
*/
|
|
228
|
-
declare function useAppilotsI18n(): I18nContextValue;
|
|
229
136
|
|
|
230
137
|
/**
|
|
231
138
|
* Core types for the Appilots SDK.
|
|
@@ -459,6 +366,16 @@ interface SendMessageStreamOptions {
|
|
|
459
366
|
}
|
|
460
367
|
/** Runtime context sent with every user message. */
|
|
461
368
|
interface SendMessageContext {
|
|
369
|
+
/**
|
|
370
|
+
* Which client platform this observation came from — `'react-native'`,
|
|
371
|
+
* `'web'`, `'android'`, `'ios'`, or any other client-defined string.
|
|
372
|
+
* The server treats an absent value as `'react-native'` (see
|
|
373
|
+
* `docs/agent-contract.md`'s "The `platform` field" section), so
|
|
374
|
+
* setting it is optional but forward-compatible: a client that sends
|
|
375
|
+
* it explicitly isn't relying on that default staying `'react-native'`
|
|
376
|
+
* forever.
|
|
377
|
+
*/
|
|
378
|
+
platform?: string;
|
|
462
379
|
currentScreen?: string;
|
|
463
380
|
formState?: Record<string, unknown>;
|
|
464
381
|
/** Design-time screen metadata from registerScreen() or the MCP doc */
|
|
@@ -684,6 +601,339 @@ declare class AppilotsClient {
|
|
|
684
601
|
}): () => void;
|
|
685
602
|
}
|
|
686
603
|
|
|
604
|
+
/**
|
|
605
|
+
* Snapshot types — the platform-agnostic "view model" of what the user
|
|
606
|
+
* is currently seeing on screen, sent to the AI agent so it has
|
|
607
|
+
* accurate visible state.
|
|
608
|
+
*
|
|
609
|
+
* Every platform walker (React Native fiber walk, web DOM walk, ...)
|
|
610
|
+
* produces this same shape; the wire contract it feeds is
|
|
611
|
+
* `agentSnapshotSchema` in `@appilots/shared`.
|
|
612
|
+
*/
|
|
613
|
+
interface InputSnapshot {
|
|
614
|
+
/** Best identifier — testID/data-testid, accessibilityLabel/aria-label, or placeholder */
|
|
615
|
+
id?: string;
|
|
616
|
+
/** Human-readable label inferred from accessibility metadata or sibling text */
|
|
617
|
+
label?: string;
|
|
618
|
+
/** Current value (only present for controlled inputs) */
|
|
619
|
+
value?: string;
|
|
620
|
+
/** Placeholder text */
|
|
621
|
+
placeholder?: string;
|
|
622
|
+
/** Whether the input is editable */
|
|
623
|
+
editable?: boolean;
|
|
624
|
+
/** Whether the input is secure (password field) */
|
|
625
|
+
secure?: boolean;
|
|
626
|
+
/** Inferred type based on the platform's input-type metadata */
|
|
627
|
+
type?: 'text' | 'email' | 'number' | 'phone' | 'password';
|
|
628
|
+
/**
|
|
629
|
+
* True when this input lives inside a currently-visible modal. When a
|
|
630
|
+
* modal is open, only inModal elements can actually receive input —
|
|
631
|
+
* everything else is behind the overlay.
|
|
632
|
+
*/
|
|
633
|
+
inModal?: boolean;
|
|
634
|
+
}
|
|
635
|
+
interface ButtonSnapshot {
|
|
636
|
+
/** Best identifier — testID/data-testid, accessibilityLabel/aria-label, or inferred from child text */
|
|
637
|
+
id?: string;
|
|
638
|
+
/** Human-readable label — usually the visible text inside the button */
|
|
639
|
+
label?: string;
|
|
640
|
+
/** Whether the button is disabled */
|
|
641
|
+
disabled?: boolean;
|
|
642
|
+
/**
|
|
643
|
+
* Whether the button currently appears selected/active — set by
|
|
644
|
+
* grouped, mutually-exclusive controls (segmented controls, radio
|
|
645
|
+
* groups) where each option is its own pressable target.
|
|
646
|
+
*/
|
|
647
|
+
selected?: boolean;
|
|
648
|
+
/** True when this button lives inside a currently-visible modal. */
|
|
649
|
+
inModal?: boolean;
|
|
650
|
+
}
|
|
651
|
+
interface ToggleSnapshot {
|
|
652
|
+
/** Best identifier */
|
|
653
|
+
id?: string;
|
|
654
|
+
/** Human-readable label */
|
|
655
|
+
label?: string;
|
|
656
|
+
/** Current on/off state */
|
|
657
|
+
value?: boolean;
|
|
658
|
+
/** True when this toggle lives inside a currently-visible modal. */
|
|
659
|
+
inModal?: boolean;
|
|
660
|
+
}
|
|
661
|
+
interface SliderSnapshot {
|
|
662
|
+
/** Registry id — the executable handle. */
|
|
663
|
+
id?: string;
|
|
664
|
+
/** Human-readable label */
|
|
665
|
+
label?: string;
|
|
666
|
+
/** Current numeric value */
|
|
667
|
+
value?: number;
|
|
668
|
+
/** Lower bound the executor clamps to */
|
|
669
|
+
min?: number;
|
|
670
|
+
/** Upper bound the executor clamps to */
|
|
671
|
+
max?: number;
|
|
672
|
+
/** Step the executor snaps to (omitted = continuous) */
|
|
673
|
+
step?: number;
|
|
674
|
+
/** Whether the slider is currently disabled */
|
|
675
|
+
disabled?: boolean;
|
|
676
|
+
/** True when this slider lives inside a currently-visible modal. */
|
|
677
|
+
inModal?: boolean;
|
|
678
|
+
}
|
|
679
|
+
interface ListItemSnapshot {
|
|
680
|
+
/** 1-indexed position within the parent list (matches "selecione o terceiro"). */
|
|
681
|
+
index: number;
|
|
682
|
+
/**
|
|
683
|
+
* 0-based index of this row in the list's backing DATA, when known.
|
|
684
|
+
* For scrolled/virtualized lists this differs from `index`.
|
|
685
|
+
*/
|
|
686
|
+
dataIndex?: number;
|
|
687
|
+
/** Framework key of the row, if present (typically the item's domain id). */
|
|
688
|
+
reactKey?: string;
|
|
689
|
+
/** Runtime key supplied by list tracking, if available. */
|
|
690
|
+
itemKey?: string;
|
|
691
|
+
/** Texts captured from this item's subtree, preserving row association. */
|
|
692
|
+
texts: string[];
|
|
693
|
+
/** Buttons inside this item — e.g. an inline "Edit" button on a row. */
|
|
694
|
+
buttons: ButtonSnapshot[];
|
|
695
|
+
/** Inputs inside this item — rare but possible (inline edit row). */
|
|
696
|
+
inputs: InputSnapshot[];
|
|
697
|
+
/** Toggles inside this item. */
|
|
698
|
+
toggles: ToggleSnapshot[];
|
|
699
|
+
/**
|
|
700
|
+
* Synthetic id assigned by the walker. Stable within a single
|
|
701
|
+
* snapshot; format `list-<L>-item-<I>` (0-indexed L, 1-indexed I).
|
|
702
|
+
* Used by tap-by-ordinal resolution in the executor.
|
|
703
|
+
*/
|
|
704
|
+
syntheticId: string;
|
|
705
|
+
}
|
|
706
|
+
interface ListSnapshot {
|
|
707
|
+
/** 0-indexed list ordinal — multiple lists on one screen get 0, 1, 2... */
|
|
708
|
+
index: number;
|
|
709
|
+
/** Runtime list id when tracking or explicit props provide one. */
|
|
710
|
+
id?: string;
|
|
711
|
+
/** The container component/tag name as observed by the walker. */
|
|
712
|
+
containerType: string;
|
|
713
|
+
/**
|
|
714
|
+
* Source that identified this list. `'fiber'`/`'auto-tracked'` are
|
|
715
|
+
* the walker's own discovery tags (a DOM walker reports
|
|
716
|
+
* `'auto-tracked'` for app-annotated lists and omits the field for
|
|
717
|
+
* heuristically-detected ones); `'registry'` means the list came
|
|
718
|
+
* from the SDK's list registry rather than the tree walk.
|
|
719
|
+
*/
|
|
720
|
+
source?: 'fiber' | 'auto-tracked' | 'registry';
|
|
721
|
+
/** Total data-set count when the list exposes it. */
|
|
722
|
+
itemCount?: number;
|
|
723
|
+
/** Number of row items captured in this snapshot. */
|
|
724
|
+
visibleItemCount?: number;
|
|
725
|
+
/** True when the list reports a refresh/loading state. */
|
|
726
|
+
refreshing?: boolean;
|
|
727
|
+
/** True when total item count is known and zero. */
|
|
728
|
+
empty?: boolean;
|
|
729
|
+
/** Human-readable label if the app supplied one. */
|
|
730
|
+
label?: string;
|
|
731
|
+
/** Items in visible order. */
|
|
732
|
+
items: ListItemSnapshot[];
|
|
733
|
+
/**
|
|
734
|
+
* Lightweight text projection of the list's FULL data set (capped),
|
|
735
|
+
* so the agent can see/search rows that virtualization keeps
|
|
736
|
+
* unmounted. Each entry: 0-based data index, stable key, short text.
|
|
737
|
+
*/
|
|
738
|
+
dataPreview?: ListDataPreviewEntry[];
|
|
739
|
+
/** Current vertical scroll offset in px, when readable. */
|
|
740
|
+
scrollOffsetY?: number;
|
|
741
|
+
/** True when there is scrollable content above the viewport. */
|
|
742
|
+
canScrollUp?: boolean;
|
|
743
|
+
/** True when there is scrollable content below the viewport. */
|
|
744
|
+
canScrollDown?: boolean;
|
|
745
|
+
}
|
|
746
|
+
interface ListDataPreviewEntry {
|
|
747
|
+
/** 0-based index in the list's backing data. */
|
|
748
|
+
index: number;
|
|
749
|
+
/** Stable key from the item's domain id when available. */
|
|
750
|
+
key?: string;
|
|
751
|
+
/** Short human-readable projection of the item (capped length). */
|
|
752
|
+
text: string;
|
|
753
|
+
}
|
|
754
|
+
interface ChoiceOptionSnapshot {
|
|
755
|
+
/** 1-indexed option position within this group. */
|
|
756
|
+
index: number;
|
|
757
|
+
/** Stable-enough id for the current snapshot/action turn. */
|
|
758
|
+
syntheticId: string;
|
|
759
|
+
/** Best target id if this option is backed by a pressable component. */
|
|
760
|
+
targetId?: string;
|
|
761
|
+
/** Human-readable option label. */
|
|
762
|
+
label?: string;
|
|
763
|
+
/** Text segments that belong to this option. */
|
|
764
|
+
texts: string[];
|
|
765
|
+
/** Whether this option appears selected. */
|
|
766
|
+
selected?: boolean;
|
|
767
|
+
/** Whether this option appears disabled. */
|
|
768
|
+
disabled?: boolean;
|
|
769
|
+
}
|
|
770
|
+
interface ChoiceGroupSnapshot {
|
|
771
|
+
/** 0-indexed group ordinal on the current screen. */
|
|
772
|
+
index: number;
|
|
773
|
+
/** Runtime id when known, usually inherited from a list/collection. */
|
|
774
|
+
id?: string;
|
|
775
|
+
/** Human-readable label when known. */
|
|
776
|
+
label?: string;
|
|
777
|
+
/** Source that produced this choice group. */
|
|
778
|
+
source?: 'list' | 'buttons' | 'heuristic';
|
|
779
|
+
/** Visible options in order. */
|
|
780
|
+
options: ChoiceOptionSnapshot[];
|
|
781
|
+
}
|
|
782
|
+
interface InteractionElementListContext {
|
|
783
|
+
listIndex?: number;
|
|
784
|
+
listId?: string;
|
|
785
|
+
listLabel?: string;
|
|
786
|
+
itemIndex?: number;
|
|
787
|
+
itemKey?: string;
|
|
788
|
+
reactKey?: string;
|
|
789
|
+
syntheticId?: string;
|
|
790
|
+
}
|
|
791
|
+
interface InteractionElementSnapshot {
|
|
792
|
+
/** Stable id for the current screen/content, preferred for tool calls. */
|
|
793
|
+
id: string;
|
|
794
|
+
/** Semantic UI role. */
|
|
795
|
+
role: 'option' | 'button' | 'input' | 'toggle' | 'slider' | 'listItem';
|
|
796
|
+
/** Human-readable label. */
|
|
797
|
+
label?: string;
|
|
798
|
+
/** Text segments associated with this element. */
|
|
799
|
+
texts: string[];
|
|
800
|
+
/** Actions supported by this element. */
|
|
801
|
+
actions: Array<'press' | 'focus' | 'toggle' | 'setValue'>;
|
|
802
|
+
/** Whether the element is currently disabled. */
|
|
803
|
+
disabled?: boolean;
|
|
804
|
+
/** Whether the element appears selected. */
|
|
805
|
+
selected?: boolean;
|
|
806
|
+
/** Source that produced the element. */
|
|
807
|
+
source?: 'list' | 'button' | 'input' | 'toggle' | 'slider' | 'choice';
|
|
808
|
+
/** Legacy/fallback target id, if any. */
|
|
809
|
+
targetId?: string;
|
|
810
|
+
/** Context for row/list options. */
|
|
811
|
+
listContext?: InteractionElementListContext;
|
|
812
|
+
/**
|
|
813
|
+
* True when the underlying component lives inside a currently-visible
|
|
814
|
+
* modal — the only targets actually touchable while the overlay is up.
|
|
815
|
+
*/
|
|
816
|
+
inModal?: boolean;
|
|
817
|
+
}
|
|
818
|
+
interface ScreenSnapshot {
|
|
819
|
+
/** The currently active route name, if known */
|
|
820
|
+
route: string | null;
|
|
821
|
+
/** All visible static text */
|
|
822
|
+
texts: string[];
|
|
823
|
+
/** All text inputs currently rendered (and visible) */
|
|
824
|
+
inputs: InputSnapshot[];
|
|
825
|
+
/** All button-like components */
|
|
826
|
+
buttons: ButtonSnapshot[];
|
|
827
|
+
/** All toggle components */
|
|
828
|
+
toggles: ToggleSnapshot[];
|
|
829
|
+
/** Sliders / adjustable numeric controls. */
|
|
830
|
+
sliders: SliderSnapshot[];
|
|
831
|
+
/** Whether a loading indicator is visible */
|
|
832
|
+
loading: boolean;
|
|
833
|
+
/** Whether a modal is currently open */
|
|
834
|
+
modalOpen: boolean;
|
|
835
|
+
/**
|
|
836
|
+
* Lists detected in the visible tree. Each list's items have their
|
|
837
|
+
* own per-item texts/buttons/inputs/toggles, NOT duplicated in the
|
|
838
|
+
* flat top-level arrays — preserving the row association the flat
|
|
839
|
+
* shape destroys.
|
|
840
|
+
*/
|
|
841
|
+
lists: ListSnapshot[];
|
|
842
|
+
/**
|
|
843
|
+
* Choice groups detected from visible cards/rows/chips/buttons, used
|
|
844
|
+
* for select-like flows where no text input exists.
|
|
845
|
+
*/
|
|
846
|
+
choiceGroups: ChoiceGroupSnapshot[];
|
|
847
|
+
/**
|
|
848
|
+
* Interaction graph: visible actionable elements with stable ids,
|
|
849
|
+
* semantic roles, labels, and execution fallbacks. Agents should
|
|
850
|
+
* prefer these ids over synthetic ordinal handles.
|
|
851
|
+
*/
|
|
852
|
+
elements: InteractionElementSnapshot[];
|
|
853
|
+
/** Diagnostic counts for debugging */
|
|
854
|
+
stats?: {
|
|
855
|
+
visitedFibers: number;
|
|
856
|
+
skippedHidden: number;
|
|
857
|
+
};
|
|
858
|
+
}
|
|
859
|
+
/**
|
|
860
|
+
* Localized copy for escalation system messages, injected by the chat
|
|
861
|
+
* surface (the machine has no i18n access — same pattern as errorPrefix).
|
|
862
|
+
* When omitted, no system messages are appended but the state machine
|
|
863
|
+
* still works.
|
|
864
|
+
*/
|
|
865
|
+
interface EscalationStrings {
|
|
866
|
+
/** Appended right after the escalation is created. */
|
|
867
|
+
requested: string;
|
|
868
|
+
/** Appended when an operator claims the conversation. */
|
|
869
|
+
connected: string;
|
|
870
|
+
/** Appended when the operator resolves — AI takes over again. */
|
|
871
|
+
resolved: string;
|
|
872
|
+
/** Content of the offer chip message appended when the agent gives up. */
|
|
873
|
+
offer: string;
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
type TraceListener = (entries: AppilotsTraceEntry[]) => void;
|
|
877
|
+
declare function recordAppilotsDebugTrace(entry: Omit<AppilotsTraceEntry, 'id'> & {
|
|
878
|
+
id?: string;
|
|
879
|
+
}): void;
|
|
880
|
+
declare function getAppilotsDebugTraces(): AppilotsTraceEntry[];
|
|
881
|
+
declare function clearAppilotsDebugTraces(): void;
|
|
882
|
+
declare function subscribeAppilotsDebugTraces(listener: TraceListener): () => void;
|
|
883
|
+
|
|
884
|
+
/**
|
|
885
|
+
* Human-readable labels and error messages for the action breadcrumb.
|
|
886
|
+
*
|
|
887
|
+
* Strings are PT-BR hardcoded for now. i18n is planned for backlog item
|
|
888
|
+
* 4.1 (Personalização) — when that lands, these strings move into the
|
|
889
|
+
* locale bundles.
|
|
890
|
+
*
|
|
891
|
+
* Two responsibilities:
|
|
892
|
+
* 1. `describeAction(action)` — turns a typed AgentAction into a label
|
|
893
|
+
* that varies by lifecycle state (pending/running/done/failed).
|
|
894
|
+
* 2. `humanizeError(raw, action)` — sanitises the raw error string from
|
|
895
|
+
* the executor into a short user-facing reason. Stack traces and
|
|
896
|
+
* protocol errors are collapsed into "algo deu errado" so users
|
|
897
|
+
* aren't shown technical noise.
|
|
898
|
+
*/
|
|
899
|
+
|
|
900
|
+
type BreadcrumbState = 'pending' | 'running' | 'success' | 'failed';
|
|
901
|
+
interface BreadcrumbItem {
|
|
902
|
+
/** What to render on the line. */
|
|
903
|
+
label: string;
|
|
904
|
+
/** Lifecycle state — drives icon + colour in the breadcrumb. */
|
|
905
|
+
state: BreadcrumbState;
|
|
906
|
+
}
|
|
907
|
+
/**
|
|
908
|
+
* Map an AgentAction + its current status to a breadcrumb item ready to
|
|
909
|
+
* render. The function is intentionally defensive — both the native-tools
|
|
910
|
+
* and JSON-fallback code paths feed actions through here, and the JSON
|
|
911
|
+
* path is loose with payload shapes, so every field access has to assume
|
|
912
|
+
* `unknown`.
|
|
913
|
+
*/
|
|
914
|
+
declare function describeAction(action: AgentAction): BreadcrumbItem;
|
|
915
|
+
/**
|
|
916
|
+
* Convert the executor's raw error string into a short, user-facing
|
|
917
|
+
* reason that fits inside parentheses on the breadcrumb line. Returns
|
|
918
|
+
* `undefined` when there's no useful information to show — caller can
|
|
919
|
+
* then drop the parenthetical entirely.
|
|
920
|
+
*
|
|
921
|
+
* Heuristics:
|
|
922
|
+
* - Apply known-pattern rewrites (rejected, not found, network, etc.)
|
|
923
|
+
* - If the result looks technical (stack frame, HTTP status, JSON
|
|
924
|
+
* dump) or is suspiciously long, fall back to "algo deu errado".
|
|
925
|
+
* - Trim and lowercase the first letter so it reads naturally inside
|
|
926
|
+
* the parens after the action verb.
|
|
927
|
+
*/
|
|
928
|
+
declare function humanizeError(raw: string | undefined, _action?: AgentAction): string | undefined;
|
|
929
|
+
|
|
930
|
+
/**
|
|
931
|
+
* SDK version — bumped by changesets on release. Lives in its own module
|
|
932
|
+
* so runtime code (AppilotsClient) can import it without pulling the whole
|
|
933
|
+
* public barrel in and creating an import cycle.
|
|
934
|
+
*/
|
|
935
|
+
declare const SDK_VERSION = "0.1.0";
|
|
936
|
+
|
|
687
937
|
interface AppilotsConfig {
|
|
688
938
|
/** Project ID from the Appilots dashboard */
|
|
689
939
|
projectId: string;
|
|
@@ -800,22 +1050,6 @@ interface UseAppilotsNavigationReturn {
|
|
|
800
1050
|
*/
|
|
801
1051
|
declare function useAppilotsNavigation(): UseAppilotsNavigationReturn;
|
|
802
1052
|
|
|
803
|
-
/**
|
|
804
|
-
* Localized copy for escalation system messages, injected by the chat
|
|
805
|
-
* surface (the hook has no i18n access — same pattern as errorPrefix).
|
|
806
|
-
* When omitted, no system messages are appended but the state machine
|
|
807
|
-
* still works.
|
|
808
|
-
*/
|
|
809
|
-
interface EscalationStrings {
|
|
810
|
-
/** Appended right after the escalation is created. */
|
|
811
|
-
requested: string;
|
|
812
|
-
/** Appended when an operator claims the conversation. */
|
|
813
|
-
connected: string;
|
|
814
|
-
/** Appended when the operator resolves — AI takes over again. */
|
|
815
|
-
resolved: string;
|
|
816
|
-
/** Content of the offer chip message appended when the agent gives up. */
|
|
817
|
-
offer: string;
|
|
818
|
-
}
|
|
819
1053
|
interface UseAppilotsChatReturn {
|
|
820
1054
|
messages: ChatMessage[];
|
|
821
1055
|
isLoading: boolean;
|
|
@@ -860,6 +1094,12 @@ interface UseAppilotsChatOptions {
|
|
|
860
1094
|
/**
|
|
861
1095
|
* Hook for managing chat state and sending messages to the Appilots agent.
|
|
862
1096
|
*
|
|
1097
|
+
* This is a thin React binding over `ChatSessionMachine` from
|
|
1098
|
+
* `@appilots/client-core` — the turn/continuation/recovery orchestration
|
|
1099
|
+
* itself is platform-agnostic and shared with the web client. Everything
|
|
1100
|
+
* React Native-specific (Fiber snapshotting, React Navigation settling)
|
|
1101
|
+
* enters through `reactNativeChatAdapter`.
|
|
1102
|
+
*
|
|
863
1103
|
* @example
|
|
864
1104
|
* ```tsx
|
|
865
1105
|
* const { messages, sendMessage, isLoading } = useAppilotsChat();
|
|
@@ -894,8 +1134,11 @@ interface UseAppilotsActionsReturn {
|
|
|
894
1134
|
/**
|
|
895
1135
|
* Hook for monitoring and controlling agent actions.
|
|
896
1136
|
*
|
|
897
|
-
*
|
|
898
|
-
*
|
|
1137
|
+
* A thin React binding over `ActionQueueMachine` from
|
|
1138
|
+
* `@appilots/client-core`: the queue, its status transitions, the
|
|
1139
|
+
* confirm gate (server-injected and locally synthesized) and sequential
|
|
1140
|
+
* auto-execution are platform-agnostic. React Native execution goes
|
|
1141
|
+
* through the ActionExecutor via `createReactNativeActionRunner`.
|
|
899
1142
|
*
|
|
900
1143
|
* @example
|
|
901
1144
|
* ```tsx
|
|
@@ -1297,4 +1540,4 @@ interface UseSuggestedPromptsReturn {
|
|
|
1297
1540
|
*/
|
|
1298
1541
|
declare function useSuggestedPrompts(options: UseSuggestedPromptsOptions): UseSuggestedPromptsReturn;
|
|
1299
1542
|
|
|
1300
|
-
export {
|
|
1543
|
+
export { createComponentRegistry as $, type AppilotsThemeTokens as A, type BreadcrumbItem as B, type ComponentRegistry as C, SDK_VERSION as D, type EscalationState as E, type FieldEntry as F, type SliderEntry as G, type SuggestedPrompt as H, type InteractionElementSnapshot as I, type ToggleEntry as J, type ToggleSnapshot as K, type ListItemSnapshot as L, type MessageRole as M, type NavigationPayload as N, type UseAppilotsFieldOptions as O, type PartialThemeTokens as P, type UseAppilotsSliderOptions as Q, type RemotePersonalization as R, type ScreenSnapshot as S, type TargetEntry as T, type UIInteractionPayload as U, type UseAppilotsTargetOptions as V, type UseAppilotsToggleOptions as W, type UseSuggestedPromptsOptions as X, type UseSuggestedPromptsReturn as Y, clearAppilotsDebugTraces as Z, componentRegistry as _, type AppilotsLocale as a, defaultDarkTheme as a0, defaultLightTheme as a1, describeAction as a2, getAppilotsDebugTraces as a3, humanizeError as a4, mergeThemeTokens as a5, recordAppilotsDebugTrace as a6, subscribeAppilotsDebugTraces as a7, useAppilots as a8, useAppilotsActions as a9, useAppilotsChat as aa, useAppilotsContext as ab, useAppilotsField as ac, useAppilotsNavigation as ad, useAppilotsSlider as ae, useAppilotsTarget as af, useAppilotsToggle as ag, useSuggestedPrompts as ah, type AgentAction as b, type AgentPermissions as c, type AppilotsEvent as d, type AgentActionType as e, type AgentMessage as f, AppilotsClient as g, type AppilotsClientOptions as h, type AppilotsConfig as i, type AppilotsEventHandler as j, type AppilotsEventType as k, AppilotsProvider as l, type AppilotsProviderProps as m, type AppilotsTraceEntry as n, type AppilotsUser as o, type BreadcrumbState as p, type ButtonSnapshot as q, type ChatMessage as r, type ChoiceGroupSnapshot as s, type ChoiceOptionSnapshot as t, type ComponentEntry as u, type ComponentKind as v, type FormFillPayload as w, type InputSnapshot as x, type InteractionElementListContext as y, type ListSnapshot as z };
|