@molecule/app-react 1.6.1 → 1.6.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/README.md +1224 -1215
- package/dist/hooks/useChat.d.ts.map +1 -1
- package/dist/hooks/useChat.js +18 -1
- package/dist/hooks/useChat.js.map +1 -1
- package/dist/types.d.ts +7 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
|
3
3
|
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
4
|
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
5
|
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
-
Generated: 2026-
|
|
6
|
+
Generated: 2026-10-16T00:51:41.781Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-react
|
|
@@ -80,19 +80,32 @@ npm install -D @types/react
|
|
|
80
80
|
|
|
81
81
|
### Interfaces
|
|
82
82
|
|
|
83
|
-
#### `
|
|
83
|
+
#### `AuthState`
|
|
84
84
|
|
|
85
|
-
|
|
86
|
-
interpolate the `{{agentName}}` / `{{productName}}` tokens in shared chat/IDE
|
|
87
|
-
copy. A consuming app sets these to its own agent + product brand names; the
|
|
88
|
-
shared packages fall back to {@link DEFAULT_AGENT_IDENTITY} when it does not.
|
|
85
|
+
Reactive authentication state snapshot (initialized, authenticated, user, loading, and error).
|
|
89
86
|
|
|
90
87
|
```typescript
|
|
91
|
-
interface
|
|
92
|
-
/**
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
88
|
+
interface AuthState<T = UserProfile> {
|
|
89
|
+
/**
|
|
90
|
+
* Whether auth state has been initialized.
|
|
91
|
+
*/
|
|
92
|
+
initialized: boolean
|
|
93
|
+
/**
|
|
94
|
+
* Whether the user is authenticated.
|
|
95
|
+
*/
|
|
96
|
+
authenticated: boolean
|
|
97
|
+
/**
|
|
98
|
+
* Current user (if authenticated).
|
|
99
|
+
*/
|
|
100
|
+
user: T | null
|
|
101
|
+
/**
|
|
102
|
+
* Whether an auth operation is in progress.
|
|
103
|
+
*/
|
|
104
|
+
loading: boolean
|
|
105
|
+
/**
|
|
106
|
+
* Last auth error (if any).
|
|
107
|
+
*/
|
|
108
|
+
error: string | null
|
|
96
109
|
}
|
|
97
110
|
```
|
|
98
111
|
|
|
@@ -198,65 +211,6 @@ interface AuthClient<T = UserProfile> {
|
|
|
198
211
|
}
|
|
199
212
|
```
|
|
200
213
|
|
|
201
|
-
#### `AuthProviderProps`
|
|
202
|
-
|
|
203
|
-
Props for auth provider component.
|
|
204
|
-
|
|
205
|
-
```typescript
|
|
206
|
-
interface AuthProviderProps<T = unknown> extends ProviderProps {
|
|
207
|
-
client: AuthClient<T>
|
|
208
|
-
}
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
#### `AuthState`
|
|
212
|
-
|
|
213
|
-
Reactive authentication state snapshot (initialized, authenticated, user, loading, and error).
|
|
214
|
-
|
|
215
|
-
```typescript
|
|
216
|
-
interface AuthState<T = UserProfile> {
|
|
217
|
-
/**
|
|
218
|
-
* Whether auth state has been initialized.
|
|
219
|
-
*/
|
|
220
|
-
initialized: boolean
|
|
221
|
-
/**
|
|
222
|
-
* Whether the user is authenticated.
|
|
223
|
-
*/
|
|
224
|
-
authenticated: boolean
|
|
225
|
-
/**
|
|
226
|
-
* Current user (if authenticated).
|
|
227
|
-
*/
|
|
228
|
-
user: T | null
|
|
229
|
-
/**
|
|
230
|
-
* Whether an auth operation is in progress.
|
|
231
|
-
*/
|
|
232
|
-
loading: boolean
|
|
233
|
-
/**
|
|
234
|
-
* Last auth error (if any).
|
|
235
|
-
*/
|
|
236
|
-
error: string | null
|
|
237
|
-
}
|
|
238
|
-
```
|
|
239
|
-
|
|
240
|
-
#### `ChatProviderProps`
|
|
241
|
-
|
|
242
|
-
Props for the ChatProvider React component.
|
|
243
|
-
|
|
244
|
-
```typescript
|
|
245
|
-
interface ChatProviderProps extends ProviderProps {
|
|
246
|
-
provider: ChatProvider
|
|
247
|
-
}
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
#### `EditorProviderProps`
|
|
251
|
-
|
|
252
|
-
Props for editor provider component.
|
|
253
|
-
|
|
254
|
-
```typescript
|
|
255
|
-
interface EditorProviderProps extends ProviderProps {
|
|
256
|
-
provider: EditorProvider
|
|
257
|
-
}
|
|
258
|
-
```
|
|
259
|
-
|
|
260
214
|
#### `FormController`
|
|
261
215
|
|
|
262
216
|
Form controller interface.
|
|
@@ -464,77 +418,6 @@ interface HttpClient {
|
|
|
464
418
|
}
|
|
465
419
|
```
|
|
466
420
|
|
|
467
|
-
#### `HttpProviderProps`
|
|
468
|
-
|
|
469
|
-
Props for http provider component.
|
|
470
|
-
|
|
471
|
-
```typescript
|
|
472
|
-
interface HttpProviderProps extends ProviderProps {
|
|
473
|
-
client: HttpClient
|
|
474
|
-
}
|
|
475
|
-
```
|
|
476
|
-
|
|
477
|
-
#### `I18nProviderProps`
|
|
478
|
-
|
|
479
|
-
Props for i18n provider component.
|
|
480
|
-
|
|
481
|
-
```typescript
|
|
482
|
-
interface I18nProviderProps extends ProviderProps {
|
|
483
|
-
provider: I18nProvider
|
|
484
|
-
}
|
|
485
|
-
```
|
|
486
|
-
|
|
487
|
-
#### `LoggerProviderProps`
|
|
488
|
-
|
|
489
|
-
Props for logger provider component.
|
|
490
|
-
|
|
491
|
-
```typescript
|
|
492
|
-
interface LoggerProviderProps extends ProviderProps {
|
|
493
|
-
provider: LoggerProvider
|
|
494
|
-
}
|
|
495
|
-
```
|
|
496
|
-
|
|
497
|
-
#### `MoleculeProviderProps`
|
|
498
|
-
|
|
499
|
-
Properties for molecule provider.
|
|
500
|
-
|
|
501
|
-
```typescript
|
|
502
|
-
interface MoleculeProviderProps extends ProviderProps {
|
|
503
|
-
state?: StateProvider
|
|
504
|
-
auth?: AuthClient<unknown>
|
|
505
|
-
theme?: ThemeProvider
|
|
506
|
-
router?: Router
|
|
507
|
-
i18n?: I18nProvider
|
|
508
|
-
http?: HttpClient
|
|
509
|
-
storage?: StorageProvider
|
|
510
|
-
logger?: LoggerProvider
|
|
511
|
-
chat?: ChatProvider
|
|
512
|
-
workspace?: WorkspaceProvider
|
|
513
|
-
editor?: EditorProvider
|
|
514
|
-
preview?: PreviewProvider
|
|
515
|
-
}
|
|
516
|
-
```
|
|
517
|
-
|
|
518
|
-
#### `PreviewProviderProps`
|
|
519
|
-
|
|
520
|
-
Props for preview provider component.
|
|
521
|
-
|
|
522
|
-
```typescript
|
|
523
|
-
interface PreviewProviderProps extends ProviderProps {
|
|
524
|
-
provider: PreviewProvider
|
|
525
|
-
}
|
|
526
|
-
```
|
|
527
|
-
|
|
528
|
-
#### `ProviderProps`
|
|
529
|
-
|
|
530
|
-
Props for provider components.
|
|
531
|
-
|
|
532
|
-
```typescript
|
|
533
|
-
interface ProviderProps {
|
|
534
|
-
children: ReactNode
|
|
535
|
-
}
|
|
536
|
-
```
|
|
537
|
-
|
|
538
421
|
#### `Router`
|
|
539
422
|
|
|
540
423
|
Client-side router providing navigation, guards, route matching, and history control.
|
|
@@ -661,84 +544,24 @@ interface RouterConfig {
|
|
|
661
544
|
}
|
|
662
545
|
```
|
|
663
546
|
|
|
664
|
-
#### `
|
|
665
|
-
|
|
666
|
-
Props for router provider component.
|
|
667
|
-
|
|
668
|
-
```typescript
|
|
669
|
-
interface RouterProviderProps extends ProviderProps {
|
|
670
|
-
router: Router
|
|
671
|
-
}
|
|
672
|
-
```
|
|
673
|
-
|
|
674
|
-
#### `SendMessageOptions`
|
|
547
|
+
#### `StoreConfig`
|
|
675
548
|
|
|
676
|
-
|
|
549
|
+
Configuration for creating a store (initial state, optional name, and middleware chain).
|
|
677
550
|
|
|
678
551
|
```typescript
|
|
679
|
-
interface
|
|
680
|
-
/**
|
|
681
|
-
* Skip the optimistic local user-message bubble. The text is still sent to
|
|
682
|
-
* the server. Used for ask_user responses: the answer is folded into the
|
|
683
|
-
* ask_user tool card (a checkmark on the chosen option, or the custom text
|
|
684
|
-
* shown in-card) rather than echoed as a separate message below it.
|
|
685
|
-
*/
|
|
686
|
-
suppressUserMessage?: boolean
|
|
687
|
-
/**
|
|
688
|
-
* Mark this send as issued automatically on the user's behalf (e.g. an
|
|
689
|
-
* auto-fix prompt). The optimistic local bubble and the persisted message are
|
|
690
|
-
* flagged `automatic` so the chat renders it in the distinct auto-sent style
|
|
691
|
-
* (agent avatar + accent border) instead of looking like the user typed it.
|
|
692
|
-
*/
|
|
693
|
-
automatic?: boolean
|
|
552
|
+
interface StoreConfig<T> {
|
|
694
553
|
/**
|
|
695
|
-
*
|
|
696
|
-
* recent unanswered `ask_user` tool call in the store is resolved in place —
|
|
697
|
-
* its `output` is set to this answer — so the chosen option stays checked
|
|
698
|
-
* across remounts (e.g. the discovery→IDE transition) instead of relying on
|
|
699
|
-
* ephemeral component state that the answer's selection would otherwise lose.
|
|
700
|
-
* Distinct from {@link suppressUserMessage} (which the post-boot kickoff also
|
|
701
|
-
* sets) so resolving never misfires on a non-ask_user suppressed send.
|
|
554
|
+
* Initial state value.
|
|
702
555
|
*/
|
|
703
|
-
|
|
556
|
+
initialState: T
|
|
704
557
|
/**
|
|
705
|
-
*
|
|
706
|
-
* editor's "Fix with AI" action, the broken-preview overlay's "Fix with AI"
|
|
707
|
-
* button) rather than dispatched autonomously by the platform. A user Stop
|
|
708
|
-
* suppresses autonomous automatic sends until the user re-engages; a
|
|
709
|
-
* user-initiated one IS that re-engagement — it clears the stop and sends.
|
|
558
|
+
* Optional name for debugging.
|
|
710
559
|
*/
|
|
711
|
-
|
|
560
|
+
name?: string
|
|
712
561
|
/**
|
|
713
|
-
*
|
|
714
|
-
* server intercepts before running any agent turn. When the provider supports
|
|
715
|
-
* `sendSideMessage`, the send goes out IMMEDIATELY on an independent request —
|
|
716
|
-
* it never queues behind an active turn, never takes over the streaming
|
|
717
|
-
* state, and never tears down remote-turn tracking (a viewer's note while
|
|
718
|
-
* watching a teammate's turn must not stop the watching). Falls back to the
|
|
719
|
-
* normal send path on providers without side-channel support.
|
|
562
|
+
* Optional middleware functions.
|
|
720
563
|
*/
|
|
721
|
-
|
|
722
|
-
}
|
|
723
|
-
```
|
|
724
|
-
|
|
725
|
-
#### `StateProviderProps`
|
|
726
|
-
|
|
727
|
-
Props for state provider component.
|
|
728
|
-
|
|
729
|
-
```typescript
|
|
730
|
-
interface StateProviderProps extends ProviderProps {
|
|
731
|
-
provider: StateProvider
|
|
732
|
-
}
|
|
733
|
-
```
|
|
734
|
-
|
|
735
|
-
#### `StorageProviderProps`
|
|
736
|
-
|
|
737
|
-
Props for storage provider component.
|
|
738
|
-
|
|
739
|
-
```typescript
|
|
740
|
-
interface StorageProviderProps extends ProviderProps {
|
|
741
|
-
provider: StorageProvider
|
|
564
|
+
middleware?: StoreMiddleware<T>[]
|
|
742
565
|
}
|
|
743
566
|
```
|
|
744
567
|
|
|
@@ -770,30 +593,9 @@ interface Store<T> {
|
|
|
770
593
|
}
|
|
771
594
|
```
|
|
772
595
|
|
|
773
|
-
#### `
|
|
596
|
+
#### `Theme`
|
|
774
597
|
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
```typescript
|
|
778
|
-
interface StoreConfig<T> {
|
|
779
|
-
/**
|
|
780
|
-
* Initial state value.
|
|
781
|
-
*/
|
|
782
|
-
initialState: T
|
|
783
|
-
/**
|
|
784
|
-
* Optional name for debugging.
|
|
785
|
-
*/
|
|
786
|
-
name?: string
|
|
787
|
-
/**
|
|
788
|
-
* Optional middleware functions.
|
|
789
|
-
*/
|
|
790
|
-
middleware?: StoreMiddleware<T>[]
|
|
791
|
-
}
|
|
792
|
-
```
|
|
793
|
-
|
|
794
|
-
#### `Theme`
|
|
795
|
-
|
|
796
|
-
Complete theme definition.
|
|
598
|
+
Complete theme definition.
|
|
797
599
|
|
|
798
600
|
```typescript
|
|
799
601
|
interface Theme {
|
|
@@ -810,14 +612,19 @@ interface Theme {
|
|
|
810
612
|
}
|
|
811
613
|
```
|
|
812
614
|
|
|
813
|
-
#### `
|
|
615
|
+
#### `AgentIdentity`
|
|
814
616
|
|
|
815
|
-
|
|
617
|
+
Display identity for the AI coding agent and the host product, used to
|
|
618
|
+
interpolate the `{{agentName}}` / `{{productName}}` tokens in shared chat/IDE
|
|
619
|
+
copy. A consuming app sets these to its own agent + product brand names; the
|
|
620
|
+
shared packages fall back to {@link DEFAULT_AGENT_IDENTITY} when it does not.
|
|
816
621
|
|
|
817
622
|
```typescript
|
|
818
|
-
interface
|
|
819
|
-
|
|
820
|
-
|
|
623
|
+
interface AgentIdentity {
|
|
624
|
+
/** Display name of the AI coding agent. Defaults to {@link DEFAULT_AGENT_NAME}. */
|
|
625
|
+
agentName: string
|
|
626
|
+
/** Display name of the host product / IDE. Defaults to {@link DEFAULT_PRODUCT_NAME}. */
|
|
627
|
+
productName: string
|
|
821
628
|
}
|
|
822
629
|
```
|
|
823
630
|
|
|
@@ -843,37 +650,6 @@ interface UseAIModelsResult {
|
|
|
843
650
|
}
|
|
844
651
|
```
|
|
845
652
|
|
|
846
|
-
#### `UseAuthOptions`
|
|
847
|
-
|
|
848
|
-
Hook options for useAuth.
|
|
849
|
-
|
|
850
|
-
```typescript
|
|
851
|
-
interface UseAuthOptions {
|
|
852
|
-
/**
|
|
853
|
-
* Whether to automatically refresh the token on mount.
|
|
854
|
-
*/
|
|
855
|
-
autoRefresh?: boolean
|
|
856
|
-
}
|
|
857
|
-
```
|
|
858
|
-
|
|
859
|
-
#### `UseAuthResult`
|
|
860
|
-
|
|
861
|
-
Hook result for useAuth.
|
|
862
|
-
|
|
863
|
-
```typescript
|
|
864
|
-
interface UseAuthResult<T = unknown> {
|
|
865
|
-
state: AuthState<T>
|
|
866
|
-
login: AuthClient<T>['login']
|
|
867
|
-
logout: AuthClient<T>['logout']
|
|
868
|
-
register: AuthClient<T>['register']
|
|
869
|
-
refresh: AuthClient<T>['refresh']
|
|
870
|
-
setUser: AuthClient<T>['setUser']
|
|
871
|
-
isAuthenticated: boolean
|
|
872
|
-
isLoading: boolean
|
|
873
|
-
user: T | null
|
|
874
|
-
}
|
|
875
|
-
```
|
|
876
|
-
|
|
877
653
|
#### `UseChangePasswordReturn`
|
|
878
654
|
|
|
879
655
|
Return type for useChangePassword hook.
|
|
@@ -887,182 +663,6 @@ interface UseChangePasswordReturn {
|
|
|
887
663
|
}
|
|
888
664
|
```
|
|
889
665
|
|
|
890
|
-
#### `UseChatOptions`
|
|
891
|
-
|
|
892
|
-
Hook options for useChat.
|
|
893
|
-
|
|
894
|
-
```typescript
|
|
895
|
-
interface UseChatOptions {
|
|
896
|
-
/** Chat endpoint (e.g., '/projects/123/chat'). */
|
|
897
|
-
endpoint: string
|
|
898
|
-
/** Project ID for context. */
|
|
899
|
-
projectId?: string
|
|
900
|
-
/**
|
|
901
|
-
* Display name of the AI coding agent, interpolated into user-facing chat
|
|
902
|
-
* copy (e.g. the stalled-stream notice). The host passes its own agent brand
|
|
903
|
-
* name; defaults to the neutral `DEFAULT_AGENT_NAME` so the shared hook never
|
|
904
|
-
* names a specific product.
|
|
905
|
-
*/
|
|
906
|
-
agentName?: string
|
|
907
|
-
/** Load history on mount. */
|
|
908
|
-
loadOnMount?: boolean
|
|
909
|
-
/**
|
|
910
|
-
* This client may only WATCH the conversation (e.g. a read-only project
|
|
911
|
-
* viewer): the hook never issues chat POSTs on its behalf — no resume
|
|
912
|
-
* request after a reload, no auto-retries. A live turn is followed through
|
|
913
|
-
* the remote-watch path instead: pushed broadcast frames (applyRemoteEvent)
|
|
914
|
-
* render it in real time and the history reconcile poll backstops gaps, with
|
|
915
|
-
* `isRemoteStreaming` driving the activity indicator.
|
|
916
|
-
*/
|
|
917
|
-
readOnly?: boolean
|
|
918
|
-
/** Called when a file is created or modified by a tool call (path + new content). */
|
|
919
|
-
onFileChange?: (path: string, content: string) => void
|
|
920
|
-
/** Called when the AI switches between plan and execute modes. */
|
|
921
|
-
onModeChange?: (mode: 'plan' | 'execute') => void
|
|
922
|
-
/** Called when the backend assigns or confirms a conversation ID. */
|
|
923
|
-
onConversationId?: (id: string) => void
|
|
924
|
-
/** Called for every streaming event — useful for notifications, sounds, etc. */
|
|
925
|
-
onStreamEvent?: (event: ChatStreamEvent) => void
|
|
926
|
-
}
|
|
927
|
-
```
|
|
928
|
-
|
|
929
|
-
#### `UseChatResult`
|
|
930
|
-
|
|
931
|
-
Hook result for useChat.
|
|
932
|
-
|
|
933
|
-
```typescript
|
|
934
|
-
interface UseChatResult {
|
|
935
|
-
messages: ChatMessage[]
|
|
936
|
-
isLoading: boolean
|
|
937
|
-
/**
|
|
938
|
-
* True while a backend turn for this conversation streams WITHOUT this client
|
|
939
|
-
* owning the request — a turn started in another tab, by a teammate, or any
|
|
940
|
-
* server-side continuation. Detected from pushed (broadcast) chat events and
|
|
941
|
-
* confirmed/cleared against the server's `streaming` history flag, so the Stop
|
|
942
|
-
* control can stay visible and functional whenever ANY backend turn is live —
|
|
943
|
-
* not only for sends this hook instance made.
|
|
944
|
-
*/
|
|
945
|
-
isRemoteStreaming: boolean
|
|
946
|
-
/**
|
|
947
|
-
* Tell the hook a pushed (broadcast) chat event arrived for this conversation.
|
|
948
|
-
* The host (ChatPanel) calls this from its push-channel handler; the hook then
|
|
949
|
-
* confirms against the server's `streaming` flag and, while a remote turn is
|
|
950
|
-
* live, keeps `isRemoteStreaming` true until the server reports it finished.
|
|
951
|
-
*/
|
|
952
|
-
noteRemoteStreamEvent: () => void
|
|
953
|
-
error: string | null
|
|
954
|
-
/**
|
|
955
|
-
* Metadata about a limit-related error, for a contextual call-to-action.
|
|
956
|
-
* `limitType` names the RULE the backend enforced; `billingAction` names the
|
|
957
|
-
* REMEDY it resolved (e.g. `add_funds`, `add_payment_method`,
|
|
958
|
-
* `raise_spend_cap`, `upgrade`, `none`) and is what the button should be
|
|
959
|
-
* built from — the same limit needs a different button per account.
|
|
960
|
-
* `upgradeTier` is the plan an upgrade would move to, explicitly `null` when
|
|
961
|
-
* there is no higher tier. The backend owns these vocabularies, so the
|
|
962
|
-
* action/tier are plain strings here.
|
|
963
|
-
*/
|
|
964
|
-
errorMeta: {
|
|
965
|
-
limitType?: string
|
|
966
|
-
requiresSignup?: boolean
|
|
967
|
-
billingAction?: string
|
|
968
|
-
upgradeTier?: string | null
|
|
969
|
-
} | null
|
|
970
|
-
/** Current agent mode — plan (read-only research) or execute (full access). */
|
|
971
|
-
mode: 'plan' | 'execute'
|
|
972
|
-
/**
|
|
973
|
-
* Whether the conversation runs at the provider's fast/priority speed tier
|
|
974
|
-
* (server-persisted per conversation; hydrated from the history load's
|
|
975
|
-
* `fastMode` meta field, when the server provides one). Only meaningful for
|
|
976
|
-
* models that support a fast tier — the server ignores it otherwise.
|
|
977
|
-
*/
|
|
978
|
-
fastMode: boolean
|
|
979
|
-
/**
|
|
980
|
-
* Transient label for a background phase (e.g. the post-response verification
|
|
981
|
-
* pass — "Type-checking the API", "Linting"), set by `status` stream events.
|
|
982
|
-
* The UI shows it in place of the spinner's generic rotating messages; `null`
|
|
983
|
-
* when no such phase is active.
|
|
984
|
-
*/
|
|
985
|
-
streamingStatus: string | null
|
|
986
|
-
/**
|
|
987
|
-
* Commands the executor detached with `run_in_background`, newest last. Each
|
|
988
|
-
* appears here the moment it starts and is replaced in place when it finishes,
|
|
989
|
-
* so the UI can show work that outlives the tool call that started it.
|
|
990
|
-
*/
|
|
991
|
-
backgroundTasks: BackgroundTaskState[]
|
|
992
|
-
/**
|
|
993
|
-
* Active 5XX backoff-retry countdown, or `null` when none is pending. After a
|
|
994
|
-
* backend server error (HTTP 5XX) the hook does NOT surface a terminal error —
|
|
995
|
-
* it shows this cancelable countdown and, when it elapses, auto-resumes the
|
|
996
|
-
* turn where the user left off (`resume:true`). `secondsRemaining` ticks down
|
|
997
|
-
* once per second; `attempt` is the 1-based retry number (capped at 3). 4XX,
|
|
998
|
-
* limit/quota, and signup-required errors never auto-retry.
|
|
999
|
-
*/
|
|
1000
|
-
retryCountdown: { secondsRemaining: number; attempt: number } | null
|
|
1001
|
-
/** Update the local mode state (for instant mode toggle without an AI turn). */
|
|
1002
|
-
setMode: (mode: 'plan' | 'execute') => void
|
|
1003
|
-
/** Update the local fast-mode state (for instant toggle without an AI turn). */
|
|
1004
|
-
setFastMode: (fastMode: boolean) => void
|
|
1005
|
-
sendMessage: (
|
|
1006
|
-
message: string,
|
|
1007
|
-
attachments?: ChatAttachment[],
|
|
1008
|
-
options?: SendMessageOptions,
|
|
1009
|
-
) => Promise<void>
|
|
1010
|
-
abort: () => void
|
|
1011
|
-
/**
|
|
1012
|
-
* Cancel a pending 5XX auto-retry. Clears the countdown and surfaces the
|
|
1013
|
-
* original error (via `error`) so the user sees why the turn failed.
|
|
1014
|
-
*/
|
|
1015
|
-
cancelRetry: () => void
|
|
1016
|
-
clearHistory: () => Promise<void>
|
|
1017
|
-
/** Edit the content of a queued (not yet sent) message. */
|
|
1018
|
-
editQueuedMessage: (msgId: string, newContent: string) => void
|
|
1019
|
-
/** Remove a queued (not yet sent) message from the queue. */
|
|
1020
|
-
deleteQueuedMessage: (msgId: string) => void
|
|
1021
|
-
/** Remove queued auto-fix messages whose content references the given file path. */
|
|
1022
|
-
clearQueuedForFile: (filePath: string) => void
|
|
1023
|
-
/**
|
|
1024
|
-
* Append an inline transcript card (model / mode / skills / custom notice) as a
|
|
1025
|
-
* `role:'system'` card-message in the ONE message store. Used by the host (ChatPanel)
|
|
1026
|
-
* to render a TEAMMATE's broadcast `card` event live — this client's OWN cards arrive
|
|
1027
|
-
* through the stream and are appended internally. De-duped by the server-assigned id.
|
|
1028
|
-
*/
|
|
1029
|
-
appendCardMessage: (
|
|
1030
|
-
id: string,
|
|
1031
|
-
timestamp: number,
|
|
1032
|
-
card: NonNullable<ChatMessage['cardEvent']>,
|
|
1033
|
-
) => void
|
|
1034
|
-
/**
|
|
1035
|
-
* Append a COMPLETE, non-streaming chat message (a `message` stream event — e.g.
|
|
1036
|
-
* a teammate's human-only team note) to the ONE message store. Used by the host
|
|
1037
|
-
* (ChatPanel) to render a TEAMMATE's broadcast `message` event live — this
|
|
1038
|
-
* client's OWN `message` events arrive through the stream and are appended
|
|
1039
|
-
* internally. De-duped by the server-assigned message id.
|
|
1040
|
-
*/
|
|
1041
|
-
appendCompleteMessage: (message: ChatMessage) => void
|
|
1042
|
-
/**
|
|
1043
|
-
* Ingest ONE pushed (broadcast) stream frame from a turn running elsewhere —
|
|
1044
|
-
* a teammate's send, another tab, a server-side continuation — into the ONE
|
|
1045
|
-
* message store, through the same content applier as an own SSE stream: text/
|
|
1046
|
-
* thinking deltas, tool events, verification, cards, complete messages, done.
|
|
1047
|
-
* The host (ChatPanel) calls this from its push-channel handler for every
|
|
1048
|
-
* broadcast frame of the OPEN conversation. Own echoes are dropped while a
|
|
1049
|
-
* local send is in flight (the SSE stream is authoritative for the sender);
|
|
1050
|
-
* complete id-carrying items (cards, team notes) always apply, de-duped.
|
|
1051
|
-
*/
|
|
1052
|
-
applyRemoteEvent: (event: ChatStreamEvent) => void
|
|
1053
|
-
/**
|
|
1054
|
-
* Reload history and converge the local view on the server transcript (and
|
|
1055
|
-
* re-enter a still-streaming turn). The page-lifecycle events run this
|
|
1056
|
-
* automatically; the host should ALSO call it whenever its chat push channel
|
|
1057
|
-
* (re)connects — a broadcast sent while that socket was down (a teammate's
|
|
1058
|
-
* team note against a backgrounded tab or a slept laptop) is otherwise lost
|
|
1059
|
-
* until the next lifecycle event happens to fire. Cheap when nothing changed:
|
|
1060
|
-
* an identical transcript is never re-applied.
|
|
1061
|
-
*/
|
|
1062
|
-
reconcileHistory: () => Promise<void>
|
|
1063
|
-
}
|
|
1064
|
-
```
|
|
1065
|
-
|
|
1066
666
|
#### `UseDeviceResult`
|
|
1067
667
|
|
|
1068
668
|
Hook return type.
|
|
@@ -1081,30 +681,6 @@ interface UseDeviceResult {
|
|
|
1081
681
|
}
|
|
1082
682
|
```
|
|
1083
683
|
|
|
1084
|
-
#### `UseEditorResult`
|
|
1085
|
-
|
|
1086
|
-
Hook result for useEditor.
|
|
1087
|
-
|
|
1088
|
-
```typescript
|
|
1089
|
-
interface UseEditorResult {
|
|
1090
|
-
tabs: EditorTab[]
|
|
1091
|
-
activeFile: string | null
|
|
1092
|
-
openFile: (file: EditorFile) => void
|
|
1093
|
-
closeFile: (path: string) => void
|
|
1094
|
-
getContent: () => string | null
|
|
1095
|
-
setContent: (path: string, content: string) => void
|
|
1096
|
-
setActiveTab: (path: string) => void
|
|
1097
|
-
mount: EditorProvider['mount']
|
|
1098
|
-
dispose: () => void
|
|
1099
|
-
focus: () => void
|
|
1100
|
-
openDiff: (file: DiffFile) => void
|
|
1101
|
-
closeDiff: () => void
|
|
1102
|
-
pinTab: (path: string) => void
|
|
1103
|
-
addExtraLib: (content: string, filePath: string) => void
|
|
1104
|
-
onFixWithAI: (callback: (request: FixWithAIRequest) => void) => () => void
|
|
1105
|
-
}
|
|
1106
|
-
```
|
|
1107
|
-
|
|
1108
684
|
#### `UseFormOptions`
|
|
1109
685
|
|
|
1110
686
|
Options for useForm hook.
|
|
@@ -1145,24 +721,15 @@ interface UseFormResult<T extends Record<string, unknown>> {
|
|
|
1145
721
|
}
|
|
1146
722
|
```
|
|
1147
723
|
|
|
1148
|
-
#### `
|
|
724
|
+
#### `UseHttpState`
|
|
1149
725
|
|
|
1150
|
-
|
|
726
|
+
State for async HTTP operations.
|
|
1151
727
|
|
|
1152
728
|
```typescript
|
|
1153
|
-
interface
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
immediate?: boolean
|
|
1158
|
-
/**
|
|
1159
|
-
* Callback when request succeeds.
|
|
1160
|
-
*/
|
|
1161
|
-
onSuccess?: (data: T) => void
|
|
1162
|
-
/**
|
|
1163
|
-
* Callback when request fails.
|
|
1164
|
-
*/
|
|
1165
|
-
onError?: (error: Error) => void
|
|
729
|
+
interface UseHttpState<T> {
|
|
730
|
+
data: T | null
|
|
731
|
+
loading: boolean
|
|
732
|
+
error: Error | null
|
|
1166
733
|
}
|
|
1167
734
|
```
|
|
1168
735
|
|
|
@@ -1177,15 +744,24 @@ interface UseHttpResult<T> extends UseHttpState<T> {
|
|
|
1177
744
|
}
|
|
1178
745
|
```
|
|
1179
746
|
|
|
1180
|
-
#### `
|
|
747
|
+
#### `UseHttpOptions`
|
|
1181
748
|
|
|
1182
|
-
|
|
749
|
+
Options for useHttp hook.
|
|
1183
750
|
|
|
1184
751
|
```typescript
|
|
1185
|
-
interface
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
752
|
+
interface UseHttpOptions<T> extends RequestConfig {
|
|
753
|
+
/**
|
|
754
|
+
* Whether to execute the request immediately on mount.
|
|
755
|
+
*/
|
|
756
|
+
immediate?: boolean
|
|
757
|
+
/**
|
|
758
|
+
* Callback when request succeeds.
|
|
759
|
+
*/
|
|
760
|
+
onSuccess?: (data: T) => void
|
|
761
|
+
/**
|
|
762
|
+
* Callback when request fails.
|
|
763
|
+
*/
|
|
764
|
+
onError?: (error: Error) => void
|
|
1189
765
|
}
|
|
1190
766
|
```
|
|
1191
767
|
|
|
@@ -1256,32 +832,6 @@ interface UsePlatformResult {
|
|
|
1256
832
|
}
|
|
1257
833
|
```
|
|
1258
834
|
|
|
1259
|
-
#### `UsePreviewResult`
|
|
1260
|
-
|
|
1261
|
-
Hook result for usePreview.
|
|
1262
|
-
|
|
1263
|
-
```typescript
|
|
1264
|
-
interface UsePreviewResult {
|
|
1265
|
-
state: PreviewState
|
|
1266
|
-
setUrl: (url: string) => void
|
|
1267
|
-
refresh: () => void
|
|
1268
|
-
setDevice: (device: DeviceFrame) => void
|
|
1269
|
-
openExternal: () => void
|
|
1270
|
-
/**
|
|
1271
|
-
* Records a navigation the running preview reported via its `molecule:navigate`
|
|
1272
|
-
* message — updates the displayed current location without reloading the iframe.
|
|
1273
|
-
* Pass `isReplace` when the preview REPLACED its current history entry (a
|
|
1274
|
-
* `replaceState` redirect/canonicalization) so the forward stack is preserved
|
|
1275
|
-
* instead of truncated (a `pushState`, the default, truncates forward).
|
|
1276
|
-
*/
|
|
1277
|
-
recordNavigation: (url: string, isReplace?: boolean) => void
|
|
1278
|
-
/** Navigates the preview to the previous navigation-history entry (Back). */
|
|
1279
|
-
back: () => void
|
|
1280
|
-
/** Navigates the preview to the next navigation-history entry (Forward). */
|
|
1281
|
-
forward: () => void
|
|
1282
|
-
}
|
|
1283
|
-
```
|
|
1284
|
-
|
|
1285
835
|
#### `UsePromiseState`
|
|
1286
836
|
|
|
1287
837
|
Extended promise state with actions.
|
|
@@ -1296,19 +846,6 @@ interface UsePromiseState<T> {
|
|
|
1296
846
|
}
|
|
1297
847
|
```
|
|
1298
848
|
|
|
1299
|
-
#### `UsePushOptions`
|
|
1300
|
-
|
|
1301
|
-
Options for the usePush hook (e.g. check permission on mount).
|
|
1302
|
-
|
|
1303
|
-
```typescript
|
|
1304
|
-
interface UsePushOptions {
|
|
1305
|
-
/**
|
|
1306
|
-
* Whether to check permission status on mount.
|
|
1307
|
-
*/
|
|
1308
|
-
checkOnMount?: boolean
|
|
1309
|
-
}
|
|
1310
|
-
```
|
|
1311
|
-
|
|
1312
849
|
#### `UsePushResult`
|
|
1313
850
|
|
|
1314
851
|
Hook return type.
|
|
@@ -1329,20 +866,16 @@ interface UsePushResult {
|
|
|
1329
866
|
}
|
|
1330
867
|
```
|
|
1331
868
|
|
|
1332
|
-
#### `
|
|
869
|
+
#### `UsePushOptions`
|
|
1333
870
|
|
|
1334
|
-
|
|
871
|
+
Options for the usePush hook (e.g. check permission on mount).
|
|
1335
872
|
|
|
1336
873
|
```typescript
|
|
1337
|
-
interface
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
navigateTo: Router['navigateTo']
|
|
1343
|
-
back: Router['back']
|
|
1344
|
-
forward: Router['forward']
|
|
1345
|
-
isActive: Router['isActive']
|
|
874
|
+
interface UsePushOptions {
|
|
875
|
+
/**
|
|
876
|
+
* Whether to check permission status on mount.
|
|
877
|
+
*/
|
|
878
|
+
checkOnMount?: boolean
|
|
1346
879
|
}
|
|
1347
880
|
```
|
|
1348
881
|
|
|
@@ -1391,47 +924,6 @@ interface UseStorageValueResult<T> {
|
|
|
1391
924
|
}
|
|
1392
925
|
```
|
|
1393
926
|
|
|
1394
|
-
#### `UseStoreOptions`
|
|
1395
|
-
|
|
1396
|
-
Hook options for useStore.
|
|
1397
|
-
|
|
1398
|
-
```typescript
|
|
1399
|
-
interface UseStoreOptions<T, S> {
|
|
1400
|
-
selector?: (state: T) => S
|
|
1401
|
-
equalityFn?: (a: S, b: S) => boolean
|
|
1402
|
-
}
|
|
1403
|
-
```
|
|
1404
|
-
|
|
1405
|
-
#### `UseThemeResult`
|
|
1406
|
-
|
|
1407
|
-
Hook result for useTheme.
|
|
1408
|
-
|
|
1409
|
-
```typescript
|
|
1410
|
-
interface UseThemeResult {
|
|
1411
|
-
theme: Theme
|
|
1412
|
-
themeName: string
|
|
1413
|
-
setTheme: (name: string) => void
|
|
1414
|
-
toggleTheme: () => void
|
|
1415
|
-
mode: 'light' | 'dark'
|
|
1416
|
-
}
|
|
1417
|
-
```
|
|
1418
|
-
|
|
1419
|
-
#### `UseTranslationResult`
|
|
1420
|
-
|
|
1421
|
-
Hook result for useTranslation.
|
|
1422
|
-
|
|
1423
|
-
```typescript
|
|
1424
|
-
interface UseTranslationResult {
|
|
1425
|
-
t: I18nProvider['t']
|
|
1426
|
-
locale: string
|
|
1427
|
-
setLocale: I18nProvider['setLocale']
|
|
1428
|
-
locales: ReturnType<I18nProvider['getLocales']>
|
|
1429
|
-
formatNumber: I18nProvider['formatNumber']
|
|
1430
|
-
formatDate: I18nProvider['formatDate']
|
|
1431
|
-
direction: 'ltr' | 'rtl'
|
|
1432
|
-
}
|
|
1433
|
-
```
|
|
1434
|
-
|
|
1435
927
|
#### `UseVerifyPaymentReturnOptions`
|
|
1436
928
|
|
|
1437
929
|
Options for {@link useVerifyPaymentReturn}.
|
|
@@ -1469,45 +961,520 @@ State of the post-checkout verification.
|
|
|
1469
961
|
```typescript
|
|
1470
962
|
interface UseVerifyPaymentReturnResult {
|
|
1471
963
|
/**
|
|
1472
|
-
* `idle` when this page load is not a checkout return (no transaction id in
|
|
1473
|
-
* the URL) or auth is still hydrating; `verifying` while the API call is in
|
|
1474
|
-
* flight; then `verified` or `failed`.
|
|
964
|
+
* `idle` when this page load is not a checkout return (no transaction id in
|
|
965
|
+
* the URL) or auth is still hydrating; `verifying` while the API call is in
|
|
966
|
+
* flight; then `verified` or `failed`.
|
|
967
|
+
*/
|
|
968
|
+
status: VerifyPaymentReturnStatus
|
|
969
|
+
|
|
970
|
+
/** `true` when the URL identifies a purchase to verify. */
|
|
971
|
+
isReturn: boolean
|
|
972
|
+
|
|
973
|
+
/** The provider named by the URL (or the `provider` option). */
|
|
974
|
+
provider: string | null
|
|
975
|
+
|
|
976
|
+
/** The provider transaction/session id read from the URL. */
|
|
977
|
+
transactionId: string | null
|
|
978
|
+
|
|
979
|
+
/** Why verification failed, when it did. */
|
|
980
|
+
error: Error | null
|
|
981
|
+
|
|
982
|
+
/** Re-run the verification — wire this to a retry button. */
|
|
983
|
+
retry: () => void
|
|
984
|
+
}
|
|
985
|
+
```
|
|
986
|
+
|
|
987
|
+
#### `UseVersionResult`
|
|
988
|
+
|
|
989
|
+
Hook return type.
|
|
990
|
+
|
|
991
|
+
```typescript
|
|
992
|
+
interface UseVersionResult {
|
|
993
|
+
state: VersionState
|
|
994
|
+
isUpdateAvailable: boolean
|
|
995
|
+
isChecking: boolean
|
|
996
|
+
isServiceWorkerWaiting: boolean
|
|
997
|
+
newVersion: string | undefined
|
|
998
|
+
checkForUpdates: () => Promise<boolean>
|
|
999
|
+
applyUpdate: (options?: { force?: boolean }) => void
|
|
1000
|
+
dismissUpdate: () => void
|
|
1001
|
+
startPeriodicChecks: (options?: UpdateCheckOptions) => void
|
|
1002
|
+
stopPeriodicChecks: () => void
|
|
1003
|
+
}
|
|
1004
|
+
```
|
|
1005
|
+
|
|
1006
|
+
#### `ProviderProps`
|
|
1007
|
+
|
|
1008
|
+
Props for provider components.
|
|
1009
|
+
|
|
1010
|
+
```typescript
|
|
1011
|
+
interface ProviderProps {
|
|
1012
|
+
children: ReactNode
|
|
1013
|
+
}
|
|
1014
|
+
```
|
|
1015
|
+
|
|
1016
|
+
#### `StateProviderProps`
|
|
1017
|
+
|
|
1018
|
+
Props for state provider component.
|
|
1019
|
+
|
|
1020
|
+
```typescript
|
|
1021
|
+
interface StateProviderProps extends ProviderProps {
|
|
1022
|
+
provider: StateProvider
|
|
1023
|
+
}
|
|
1024
|
+
```
|
|
1025
|
+
|
|
1026
|
+
#### `AuthProviderProps`
|
|
1027
|
+
|
|
1028
|
+
Props for auth provider component.
|
|
1029
|
+
|
|
1030
|
+
```typescript
|
|
1031
|
+
interface AuthProviderProps<T = unknown> extends ProviderProps {
|
|
1032
|
+
client: AuthClient<T>
|
|
1033
|
+
}
|
|
1034
|
+
```
|
|
1035
|
+
|
|
1036
|
+
#### `ThemeProviderProps`
|
|
1037
|
+
|
|
1038
|
+
Props for theme provider component.
|
|
1039
|
+
|
|
1040
|
+
```typescript
|
|
1041
|
+
interface ThemeProviderProps extends ProviderProps {
|
|
1042
|
+
provider: ThemeProvider
|
|
1043
|
+
initialTheme?: string
|
|
1044
|
+
}
|
|
1045
|
+
```
|
|
1046
|
+
|
|
1047
|
+
#### `RouterProviderProps`
|
|
1048
|
+
|
|
1049
|
+
Props for router provider component.
|
|
1050
|
+
|
|
1051
|
+
```typescript
|
|
1052
|
+
interface RouterProviderProps extends ProviderProps {
|
|
1053
|
+
router: Router
|
|
1054
|
+
}
|
|
1055
|
+
```
|
|
1056
|
+
|
|
1057
|
+
#### `I18nProviderProps`
|
|
1058
|
+
|
|
1059
|
+
Props for i18n provider component.
|
|
1060
|
+
|
|
1061
|
+
```typescript
|
|
1062
|
+
interface I18nProviderProps extends ProviderProps {
|
|
1063
|
+
provider: I18nProvider
|
|
1064
|
+
}
|
|
1065
|
+
```
|
|
1066
|
+
|
|
1067
|
+
#### `HttpProviderProps`
|
|
1068
|
+
|
|
1069
|
+
Props for http provider component.
|
|
1070
|
+
|
|
1071
|
+
```typescript
|
|
1072
|
+
interface HttpProviderProps extends ProviderProps {
|
|
1073
|
+
client: HttpClient
|
|
1074
|
+
}
|
|
1075
|
+
```
|
|
1076
|
+
|
|
1077
|
+
#### `StorageProviderProps`
|
|
1078
|
+
|
|
1079
|
+
Props for storage provider component.
|
|
1080
|
+
|
|
1081
|
+
```typescript
|
|
1082
|
+
interface StorageProviderProps extends ProviderProps {
|
|
1083
|
+
provider: StorageProvider
|
|
1084
|
+
}
|
|
1085
|
+
```
|
|
1086
|
+
|
|
1087
|
+
#### `LoggerProviderProps`
|
|
1088
|
+
|
|
1089
|
+
Props for logger provider component.
|
|
1090
|
+
|
|
1091
|
+
```typescript
|
|
1092
|
+
interface LoggerProviderProps extends ProviderProps {
|
|
1093
|
+
provider: LoggerProvider
|
|
1094
|
+
}
|
|
1095
|
+
```
|
|
1096
|
+
|
|
1097
|
+
#### `ChatProviderProps`
|
|
1098
|
+
|
|
1099
|
+
Props for the ChatProvider React component.
|
|
1100
|
+
|
|
1101
|
+
```typescript
|
|
1102
|
+
interface ChatProviderProps extends ProviderProps {
|
|
1103
|
+
provider: ChatProvider
|
|
1104
|
+
}
|
|
1105
|
+
```
|
|
1106
|
+
|
|
1107
|
+
#### `WorkspaceProviderProps`
|
|
1108
|
+
|
|
1109
|
+
Props for workspace provider component.
|
|
1110
|
+
|
|
1111
|
+
```typescript
|
|
1112
|
+
interface WorkspaceProviderProps extends ProviderProps {
|
|
1113
|
+
provider: WorkspaceProvider
|
|
1114
|
+
}
|
|
1115
|
+
```
|
|
1116
|
+
|
|
1117
|
+
#### `EditorProviderProps`
|
|
1118
|
+
|
|
1119
|
+
Props for editor provider component.
|
|
1120
|
+
|
|
1121
|
+
```typescript
|
|
1122
|
+
interface EditorProviderProps extends ProviderProps {
|
|
1123
|
+
provider: EditorProvider
|
|
1124
|
+
}
|
|
1125
|
+
```
|
|
1126
|
+
|
|
1127
|
+
#### `PreviewProviderProps`
|
|
1128
|
+
|
|
1129
|
+
Props for preview provider component.
|
|
1130
|
+
|
|
1131
|
+
```typescript
|
|
1132
|
+
interface PreviewProviderProps extends ProviderProps {
|
|
1133
|
+
provider: PreviewProvider
|
|
1134
|
+
}
|
|
1135
|
+
```
|
|
1136
|
+
|
|
1137
|
+
#### `MoleculeProviderProps`
|
|
1138
|
+
|
|
1139
|
+
Properties for molecule provider.
|
|
1140
|
+
|
|
1141
|
+
```typescript
|
|
1142
|
+
interface MoleculeProviderProps extends ProviderProps {
|
|
1143
|
+
state?: StateProvider
|
|
1144
|
+
auth?: AuthClient<unknown>
|
|
1145
|
+
theme?: ThemeProvider
|
|
1146
|
+
router?: Router
|
|
1147
|
+
i18n?: I18nProvider
|
|
1148
|
+
http?: HttpClient
|
|
1149
|
+
storage?: StorageProvider
|
|
1150
|
+
logger?: LoggerProvider
|
|
1151
|
+
chat?: ChatProvider
|
|
1152
|
+
workspace?: WorkspaceProvider
|
|
1153
|
+
editor?: EditorProvider
|
|
1154
|
+
preview?: PreviewProvider
|
|
1155
|
+
}
|
|
1156
|
+
```
|
|
1157
|
+
|
|
1158
|
+
#### `UseStoreOptions`
|
|
1159
|
+
|
|
1160
|
+
Hook options for useStore.
|
|
1161
|
+
|
|
1162
|
+
```typescript
|
|
1163
|
+
interface UseStoreOptions<T, S> {
|
|
1164
|
+
selector?: (state: T) => S
|
|
1165
|
+
equalityFn?: (a: S, b: S) => boolean
|
|
1166
|
+
}
|
|
1167
|
+
```
|
|
1168
|
+
|
|
1169
|
+
#### `UseAuthOptions`
|
|
1170
|
+
|
|
1171
|
+
Hook options for useAuth.
|
|
1172
|
+
|
|
1173
|
+
```typescript
|
|
1174
|
+
interface UseAuthOptions {
|
|
1175
|
+
/**
|
|
1176
|
+
* Whether to automatically refresh the token on mount.
|
|
1177
|
+
*/
|
|
1178
|
+
autoRefresh?: boolean
|
|
1179
|
+
}
|
|
1180
|
+
```
|
|
1181
|
+
|
|
1182
|
+
#### `UseAuthResult`
|
|
1183
|
+
|
|
1184
|
+
Hook result for useAuth.
|
|
1185
|
+
|
|
1186
|
+
```typescript
|
|
1187
|
+
interface UseAuthResult<T = unknown> {
|
|
1188
|
+
state: AuthState<T>
|
|
1189
|
+
login: AuthClient<T>['login']
|
|
1190
|
+
logout: AuthClient<T>['logout']
|
|
1191
|
+
register: AuthClient<T>['register']
|
|
1192
|
+
refresh: AuthClient<T>['refresh']
|
|
1193
|
+
setUser: AuthClient<T>['setUser']
|
|
1194
|
+
isAuthenticated: boolean
|
|
1195
|
+
isLoading: boolean
|
|
1196
|
+
user: T | null
|
|
1197
|
+
}
|
|
1198
|
+
```
|
|
1199
|
+
|
|
1200
|
+
#### `UseThemeResult`
|
|
1201
|
+
|
|
1202
|
+
Hook result for useTheme.
|
|
1203
|
+
|
|
1204
|
+
```typescript
|
|
1205
|
+
interface UseThemeResult {
|
|
1206
|
+
theme: Theme
|
|
1207
|
+
themeName: string
|
|
1208
|
+
setTheme: (name: string) => void
|
|
1209
|
+
toggleTheme: () => void
|
|
1210
|
+
mode: 'light' | 'dark'
|
|
1211
|
+
}
|
|
1212
|
+
```
|
|
1213
|
+
|
|
1214
|
+
#### `UseRouterResult`
|
|
1215
|
+
|
|
1216
|
+
Hook result for useRouter.
|
|
1217
|
+
|
|
1218
|
+
```typescript
|
|
1219
|
+
interface UseRouterResult {
|
|
1220
|
+
location: Router['getLocation'] extends () => infer R ? R : never
|
|
1221
|
+
params: Record<string, string>
|
|
1222
|
+
query: QueryParams
|
|
1223
|
+
navigate: Router['navigate']
|
|
1224
|
+
navigateTo: Router['navigateTo']
|
|
1225
|
+
back: Router['back']
|
|
1226
|
+
forward: Router['forward']
|
|
1227
|
+
isActive: Router['isActive']
|
|
1228
|
+
}
|
|
1229
|
+
```
|
|
1230
|
+
|
|
1231
|
+
#### `UseTranslationResult`
|
|
1232
|
+
|
|
1233
|
+
Hook result for useTranslation.
|
|
1234
|
+
|
|
1235
|
+
```typescript
|
|
1236
|
+
interface UseTranslationResult {
|
|
1237
|
+
t: I18nProvider['t']
|
|
1238
|
+
locale: string
|
|
1239
|
+
setLocale: I18nProvider['setLocale']
|
|
1240
|
+
locales: ReturnType<I18nProvider['getLocales']>
|
|
1241
|
+
formatNumber: I18nProvider['formatNumber']
|
|
1242
|
+
formatDate: I18nProvider['formatDate']
|
|
1243
|
+
direction: 'ltr' | 'rtl'
|
|
1244
|
+
}
|
|
1245
|
+
```
|
|
1246
|
+
|
|
1247
|
+
#### `UseChatOptions`
|
|
1248
|
+
|
|
1249
|
+
Hook options for useChat.
|
|
1250
|
+
|
|
1251
|
+
```typescript
|
|
1252
|
+
interface UseChatOptions {
|
|
1253
|
+
/** Chat endpoint (e.g., '/projects/123/chat'). */
|
|
1254
|
+
endpoint: string
|
|
1255
|
+
/** Project ID for context. */
|
|
1256
|
+
projectId?: string
|
|
1257
|
+
/**
|
|
1258
|
+
* Display name of the AI coding agent, interpolated into user-facing chat
|
|
1259
|
+
* copy (e.g. the stalled-stream notice). The host passes its own agent brand
|
|
1260
|
+
* name; defaults to the neutral `DEFAULT_AGENT_NAME` so the shared hook never
|
|
1261
|
+
* names a specific product.
|
|
1262
|
+
*/
|
|
1263
|
+
agentName?: string
|
|
1264
|
+
/** Load history on mount. */
|
|
1265
|
+
loadOnMount?: boolean
|
|
1266
|
+
/**
|
|
1267
|
+
* This client may only WATCH the conversation (e.g. a read-only project
|
|
1268
|
+
* viewer): the hook never issues chat POSTs on its behalf — no resume
|
|
1269
|
+
* request after a reload, no auto-retries. A live turn is followed through
|
|
1270
|
+
* the remote-watch path instead: pushed broadcast frames (applyRemoteEvent)
|
|
1271
|
+
* render it in real time and the history reconcile poll backstops gaps, with
|
|
1272
|
+
* `isRemoteStreaming` driving the activity indicator.
|
|
1273
|
+
*/
|
|
1274
|
+
readOnly?: boolean
|
|
1275
|
+
/** Called when a file is created or modified by a tool call (path + new content). */
|
|
1276
|
+
onFileChange?: (path: string, content: string) => void
|
|
1277
|
+
/** Called when the AI switches between plan and execute modes. */
|
|
1278
|
+
onModeChange?: (mode: 'plan' | 'execute') => void
|
|
1279
|
+
/** Called when the backend assigns or confirms a conversation ID. */
|
|
1280
|
+
onConversationId?: (id: string) => void
|
|
1281
|
+
/** Called for every streaming event — useful for notifications, sounds, etc. */
|
|
1282
|
+
onStreamEvent?: (event: ChatStreamEvent) => void
|
|
1283
|
+
}
|
|
1284
|
+
```
|
|
1285
|
+
|
|
1286
|
+
#### `SendMessageOptions`
|
|
1287
|
+
|
|
1288
|
+
Options for {@link UseChatResult.sendMessage}.
|
|
1289
|
+
|
|
1290
|
+
```typescript
|
|
1291
|
+
interface SendMessageOptions {
|
|
1292
|
+
/**
|
|
1293
|
+
* Skip the optimistic local user-message bubble. The text is still sent to
|
|
1294
|
+
* the server. Used for ask_user responses: the answer is folded into the
|
|
1295
|
+
* ask_user tool card (a checkmark on the chosen option, or the custom text
|
|
1296
|
+
* shown in-card) rather than echoed as a separate message below it.
|
|
1297
|
+
*/
|
|
1298
|
+
suppressUserMessage?: boolean
|
|
1299
|
+
/**
|
|
1300
|
+
* Mark this send as issued automatically on the user's behalf (e.g. an
|
|
1301
|
+
* auto-fix prompt). The optimistic local bubble and the persisted message are
|
|
1302
|
+
* flagged `automatic` so the chat renders it in the distinct auto-sent style
|
|
1303
|
+
* (agent avatar + accent border) instead of looking like the user typed it.
|
|
1304
|
+
*/
|
|
1305
|
+
automatic?: boolean
|
|
1306
|
+
/**
|
|
1307
|
+
* Mark this send as the answer to the pending `ask_user` question. The most
|
|
1308
|
+
* recent unanswered `ask_user` tool call in the store is resolved in place —
|
|
1309
|
+
* its `output` is set to this answer — so the chosen option stays checked
|
|
1310
|
+
* across remounts (e.g. the discovery→IDE transition) instead of relying on
|
|
1311
|
+
* ephemeral component state that the answer's selection would otherwise lose.
|
|
1312
|
+
* Distinct from {@link suppressUserMessage} (which the post-boot kickoff also
|
|
1313
|
+
* sets) so resolving never misfires on a non-ask_user suppressed send.
|
|
1314
|
+
*/
|
|
1315
|
+
askUserAnswer?: boolean
|
|
1316
|
+
/**
|
|
1317
|
+
* Mark an {@link automatic} send as directly requested by the user (e.g. the
|
|
1318
|
+
* editor's "Fix with AI" action, the broken-preview overlay's "Fix with AI"
|
|
1319
|
+
* button) rather than dispatched autonomously by the platform. A user Stop
|
|
1320
|
+
* suppresses autonomous automatic sends until the user re-engages; a
|
|
1321
|
+
* user-initiated one IS that re-engagement — it clears the stop and sends.
|
|
1322
|
+
*/
|
|
1323
|
+
userInitiated?: boolean
|
|
1324
|
+
/**
|
|
1325
|
+
* Send on the SIDE CHANNEL: a human-to-human message (e.g. a team note) the
|
|
1326
|
+
* server intercepts before running any agent turn. When the provider supports
|
|
1327
|
+
* `sendSideMessage`, the send goes out IMMEDIATELY on an independent request —
|
|
1328
|
+
* it never queues behind an active turn, never takes over the streaming
|
|
1329
|
+
* state, and never tears down remote-turn tracking (a viewer's note while
|
|
1330
|
+
* watching a teammate's turn must not stop the watching). Falls back to the
|
|
1331
|
+
* normal send path on providers without side-channel support.
|
|
1332
|
+
*/
|
|
1333
|
+
sideChannel?: boolean
|
|
1334
|
+
/**
|
|
1335
|
+
* Mark this send as composed through voice dictation — the mic button's
|
|
1336
|
+
* transcript was still present in the composer at submit. The optimistic
|
|
1337
|
+
* bubble and the persisted message are flagged `viaDictation` so the chat
|
|
1338
|
+
* renders a mic badge on the message, live and after a reload.
|
|
1339
|
+
*/
|
|
1340
|
+
viaDictation?: boolean
|
|
1341
|
+
}
|
|
1342
|
+
```
|
|
1343
|
+
|
|
1344
|
+
#### `UseChatResult`
|
|
1345
|
+
|
|
1346
|
+
Hook result for useChat.
|
|
1347
|
+
|
|
1348
|
+
```typescript
|
|
1349
|
+
interface UseChatResult {
|
|
1350
|
+
messages: ChatMessage[]
|
|
1351
|
+
isLoading: boolean
|
|
1352
|
+
/**
|
|
1353
|
+
* True while a backend turn for this conversation streams WITHOUT this client
|
|
1354
|
+
* owning the request — a turn started in another tab, by a teammate, or any
|
|
1355
|
+
* server-side continuation. Detected from pushed (broadcast) chat events and
|
|
1356
|
+
* confirmed/cleared against the server's `streaming` history flag, so the Stop
|
|
1357
|
+
* control can stay visible and functional whenever ANY backend turn is live —
|
|
1358
|
+
* not only for sends this hook instance made.
|
|
1359
|
+
*/
|
|
1360
|
+
isRemoteStreaming: boolean
|
|
1361
|
+
/**
|
|
1362
|
+
* Tell the hook a pushed (broadcast) chat event arrived for this conversation.
|
|
1363
|
+
* The host (ChatPanel) calls this from its push-channel handler; the hook then
|
|
1364
|
+
* confirms against the server's `streaming` flag and, while a remote turn is
|
|
1365
|
+
* live, keeps `isRemoteStreaming` true until the server reports it finished.
|
|
1366
|
+
*/
|
|
1367
|
+
noteRemoteStreamEvent: () => void
|
|
1368
|
+
error: string | null
|
|
1369
|
+
/**
|
|
1370
|
+
* Metadata about a limit-related error, for a contextual call-to-action.
|
|
1371
|
+
* `limitType` names the RULE the backend enforced; `billingAction` names the
|
|
1372
|
+
* REMEDY it resolved (e.g. `add_funds`, `add_payment_method`,
|
|
1373
|
+
* `raise_spend_cap`, `upgrade`, `none`) and is what the button should be
|
|
1374
|
+
* built from — the same limit needs a different button per account.
|
|
1375
|
+
* `upgradeTier` is the plan an upgrade would move to, explicitly `null` when
|
|
1376
|
+
* there is no higher tier. The backend owns these vocabularies, so the
|
|
1377
|
+
* action/tier are plain strings here.
|
|
1378
|
+
*/
|
|
1379
|
+
errorMeta: {
|
|
1380
|
+
limitType?: string
|
|
1381
|
+
requiresSignup?: boolean
|
|
1382
|
+
billingAction?: string
|
|
1383
|
+
upgradeTier?: string | null
|
|
1384
|
+
} | null
|
|
1385
|
+
/** Current agent mode — plan (read-only research) or execute (full access). */
|
|
1386
|
+
mode: 'plan' | 'execute'
|
|
1387
|
+
/**
|
|
1388
|
+
* Whether the conversation runs at the provider's fast/priority speed tier
|
|
1389
|
+
* (server-persisted per conversation; hydrated from the history load's
|
|
1390
|
+
* `fastMode` meta field, when the server provides one). Only meaningful for
|
|
1391
|
+
* models that support a fast tier — the server ignores it otherwise.
|
|
1392
|
+
*/
|
|
1393
|
+
fastMode: boolean
|
|
1394
|
+
/**
|
|
1395
|
+
* Transient label for a background phase (e.g. the post-response verification
|
|
1396
|
+
* pass — "Type-checking the API", "Linting"), set by `status` stream events.
|
|
1397
|
+
* The UI shows it in place of the spinner's generic rotating messages; `null`
|
|
1398
|
+
* when no such phase is active.
|
|
1399
|
+
*/
|
|
1400
|
+
streamingStatus: string | null
|
|
1401
|
+
/**
|
|
1402
|
+
* Commands the executor detached with `run_in_background`, newest last. Each
|
|
1403
|
+
* appears here the moment it starts and is replaced in place when it finishes,
|
|
1404
|
+
* so the UI can show work that outlives the tool call that started it.
|
|
1405
|
+
*/
|
|
1406
|
+
backgroundTasks: BackgroundTaskState[]
|
|
1407
|
+
/**
|
|
1408
|
+
* Active 5XX backoff-retry countdown, or `null` when none is pending. After a
|
|
1409
|
+
* backend server error (HTTP 5XX) the hook does NOT surface a terminal error —
|
|
1410
|
+
* it shows this cancelable countdown and, when it elapses, auto-resumes the
|
|
1411
|
+
* turn where the user left off (`resume:true`). `secondsRemaining` ticks down
|
|
1412
|
+
* once per second; `attempt` is the 1-based retry number (capped at 3). 4XX,
|
|
1413
|
+
* limit/quota, and signup-required errors never auto-retry.
|
|
1414
|
+
*/
|
|
1415
|
+
retryCountdown: { secondsRemaining: number; attempt: number } | null
|
|
1416
|
+
/** Update the local mode state (for instant mode toggle without an AI turn). */
|
|
1417
|
+
setMode: (mode: 'plan' | 'execute') => void
|
|
1418
|
+
/** Update the local fast-mode state (for instant toggle without an AI turn). */
|
|
1419
|
+
setFastMode: (fastMode: boolean) => void
|
|
1420
|
+
sendMessage: (
|
|
1421
|
+
message: string,
|
|
1422
|
+
attachments?: ChatAttachment[],
|
|
1423
|
+
options?: SendMessageOptions,
|
|
1424
|
+
) => Promise<void>
|
|
1425
|
+
abort: () => void
|
|
1426
|
+
/**
|
|
1427
|
+
* Cancel a pending 5XX auto-retry. Clears the countdown and surfaces the
|
|
1428
|
+
* original error (via `error`) so the user sees why the turn failed.
|
|
1429
|
+
*/
|
|
1430
|
+
cancelRetry: () => void
|
|
1431
|
+
clearHistory: () => Promise<void>
|
|
1432
|
+
/** Edit the content of a queued (not yet sent) message. */
|
|
1433
|
+
editQueuedMessage: (msgId: string, newContent: string) => void
|
|
1434
|
+
/** Remove a queued (not yet sent) message from the queue. */
|
|
1435
|
+
deleteQueuedMessage: (msgId: string) => void
|
|
1436
|
+
/** Remove queued auto-fix messages whose content references the given file path. */
|
|
1437
|
+
clearQueuedForFile: (filePath: string) => void
|
|
1438
|
+
/**
|
|
1439
|
+
* Append an inline transcript card (model / mode / skills / custom notice) as a
|
|
1440
|
+
* `role:'system'` card-message in the ONE message store. Used by the host (ChatPanel)
|
|
1441
|
+
* to render a TEAMMATE's broadcast `card` event live — this client's OWN cards arrive
|
|
1442
|
+
* through the stream and are appended internally. De-duped by the server-assigned id.
|
|
1443
|
+
*/
|
|
1444
|
+
appendCardMessage: (
|
|
1445
|
+
id: string,
|
|
1446
|
+
timestamp: number,
|
|
1447
|
+
card: NonNullable<ChatMessage['cardEvent']>,
|
|
1448
|
+
) => void
|
|
1449
|
+
/**
|
|
1450
|
+
* Append a COMPLETE, non-streaming chat message (a `message` stream event — e.g.
|
|
1451
|
+
* a teammate's human-only team note) to the ONE message store. Used by the host
|
|
1452
|
+
* (ChatPanel) to render a TEAMMATE's broadcast `message` event live — this
|
|
1453
|
+
* client's OWN `message` events arrive through the stream and are appended
|
|
1454
|
+
* internally. De-duped by the server-assigned message id.
|
|
1455
|
+
*/
|
|
1456
|
+
appendCompleteMessage: (message: ChatMessage) => void
|
|
1457
|
+
/**
|
|
1458
|
+
* Ingest ONE pushed (broadcast) stream frame from a turn running elsewhere —
|
|
1459
|
+
* a teammate's send, another tab, a server-side continuation — into the ONE
|
|
1460
|
+
* message store, through the same content applier as an own SSE stream: text/
|
|
1461
|
+
* thinking deltas, tool events, verification, cards, complete messages, done.
|
|
1462
|
+
* The host (ChatPanel) calls this from its push-channel handler for every
|
|
1463
|
+
* broadcast frame of the OPEN conversation. Own echoes are dropped while a
|
|
1464
|
+
* local send is in flight (the SSE stream is authoritative for the sender);
|
|
1465
|
+
* complete id-carrying items (cards, team notes) always apply, de-duped.
|
|
1466
|
+
*/
|
|
1467
|
+
applyRemoteEvent: (event: ChatStreamEvent) => void
|
|
1468
|
+
/**
|
|
1469
|
+
* Reload history and converge the local view on the server transcript (and
|
|
1470
|
+
* re-enter a still-streaming turn). The page-lifecycle events run this
|
|
1471
|
+
* automatically; the host should ALSO call it whenever its chat push channel
|
|
1472
|
+
* (re)connects — a broadcast sent while that socket was down (a teammate's
|
|
1473
|
+
* team note against a backgrounded tab or a slept laptop) is otherwise lost
|
|
1474
|
+
* until the next lifecycle event happens to fire. Cheap when nothing changed:
|
|
1475
|
+
* an identical transcript is never re-applied.
|
|
1475
1476
|
*/
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
/** `true` when the URL identifies a purchase to verify. */
|
|
1479
|
-
isReturn: boolean
|
|
1480
|
-
|
|
1481
|
-
/** The provider named by the URL (or the `provider` option). */
|
|
1482
|
-
provider: string | null
|
|
1483
|
-
|
|
1484
|
-
/** The provider transaction/session id read from the URL. */
|
|
1485
|
-
transactionId: string | null
|
|
1486
|
-
|
|
1487
|
-
/** Why verification failed, when it did. */
|
|
1488
|
-
error: Error | null
|
|
1489
|
-
|
|
1490
|
-
/** Re-run the verification — wire this to a retry button. */
|
|
1491
|
-
retry: () => void
|
|
1492
|
-
}
|
|
1493
|
-
```
|
|
1494
|
-
|
|
1495
|
-
#### `UseVersionResult`
|
|
1496
|
-
|
|
1497
|
-
Hook return type.
|
|
1498
|
-
|
|
1499
|
-
```typescript
|
|
1500
|
-
interface UseVersionResult {
|
|
1501
|
-
state: VersionState
|
|
1502
|
-
isUpdateAvailable: boolean
|
|
1503
|
-
isChecking: boolean
|
|
1504
|
-
isServiceWorkerWaiting: boolean
|
|
1505
|
-
newVersion: string | undefined
|
|
1506
|
-
checkForUpdates: () => Promise<boolean>
|
|
1507
|
-
applyUpdate: (options?: { force?: boolean }) => void
|
|
1508
|
-
dismissUpdate: () => void
|
|
1509
|
-
startPeriodicChecks: (options?: UpdateCheckOptions) => void
|
|
1510
|
-
stopPeriodicChecks: () => void
|
|
1477
|
+
reconcileHistory: () => Promise<void>
|
|
1511
1478
|
}
|
|
1512
1479
|
```
|
|
1513
1480
|
|
|
@@ -1527,28 +1494,58 @@ interface UseWorkspaceResult {
|
|
|
1527
1494
|
}
|
|
1528
1495
|
```
|
|
1529
1496
|
|
|
1530
|
-
#### `
|
|
1497
|
+
#### `UseEditorResult`
|
|
1531
1498
|
|
|
1532
|
-
|
|
1499
|
+
Hook result for useEditor.
|
|
1533
1500
|
|
|
1534
1501
|
```typescript
|
|
1535
|
-
interface
|
|
1536
|
-
|
|
1502
|
+
interface UseEditorResult {
|
|
1503
|
+
tabs: EditorTab[]
|
|
1504
|
+
activeFile: string | null
|
|
1505
|
+
openFile: (file: EditorFile) => void
|
|
1506
|
+
closeFile: (path: string) => void
|
|
1507
|
+
getContent: () => string | null
|
|
1508
|
+
setContent: (path: string, content: string) => void
|
|
1509
|
+
setActiveTab: (path: string) => void
|
|
1510
|
+
mount: EditorProvider['mount']
|
|
1511
|
+
dispose: () => void
|
|
1512
|
+
focus: () => void
|
|
1513
|
+
openDiff: (file: DiffFile) => void
|
|
1514
|
+
closeDiff: () => void
|
|
1515
|
+
pinTab: (path: string) => void
|
|
1516
|
+
addExtraLib: (content: string, filePath: string) => void
|
|
1517
|
+
onFixWithAI: (callback: (request: FixWithAIRequest) => void) => () => void
|
|
1537
1518
|
}
|
|
1538
1519
|
```
|
|
1539
1520
|
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
#### `AsyncExtendState`
|
|
1521
|
+
#### `UsePreviewResult`
|
|
1543
1522
|
|
|
1544
|
-
|
|
1523
|
+
Hook result for usePreview.
|
|
1545
1524
|
|
|
1546
1525
|
```typescript
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
) => void
|
|
1526
|
+
interface UsePreviewResult {
|
|
1527
|
+
state: PreviewState
|
|
1528
|
+
setUrl: (url: string) => void
|
|
1529
|
+
refresh: () => void
|
|
1530
|
+
setDevice: (device: DeviceFrame) => void
|
|
1531
|
+
openExternal: () => void
|
|
1532
|
+
/**
|
|
1533
|
+
* Records a navigation the running preview reported via its `molecule:navigate`
|
|
1534
|
+
* message — updates the displayed current location without reloading the iframe.
|
|
1535
|
+
* Pass `isReplace` when the preview REPLACED its current history entry (a
|
|
1536
|
+
* `replaceState` redirect/canonicalization) so the forward stack is preserved
|
|
1537
|
+
* instead of truncated (a `pushState`, the default, truncates forward).
|
|
1538
|
+
*/
|
|
1539
|
+
recordNavigation: (url: string, isReplace?: boolean) => void
|
|
1540
|
+
/** Navigates the preview to the previous navigation-history entry (Back). */
|
|
1541
|
+
back: () => void
|
|
1542
|
+
/** Navigates the preview to the next navigation-history entry (Forward). */
|
|
1543
|
+
forward: () => void
|
|
1544
|
+
}
|
|
1550
1545
|
```
|
|
1551
1546
|
|
|
1547
|
+
### Types
|
|
1548
|
+
|
|
1552
1549
|
#### `AsyncSetState`
|
|
1553
1550
|
|
|
1554
1551
|
Async-capable setState function.
|
|
@@ -1557,6 +1554,18 @@ Async-capable setState function.
|
|
|
1557
1554
|
type AsyncSetState<T> = (value: T | ((prev: T) => T) | Promise<T | ((prev: T) => T)>) => void
|
|
1558
1555
|
```
|
|
1559
1556
|
|
|
1557
|
+
- `value` — The new state value, an updater function receiving previous state, or a Promise resolving to either.
|
|
1558
|
+
|
|
1559
|
+
#### `AsyncExtendState`
|
|
1560
|
+
|
|
1561
|
+
Async-capable extendState function for partial updates.
|
|
1562
|
+
|
|
1563
|
+
```typescript
|
|
1564
|
+
type AsyncExtendState<T> = (
|
|
1565
|
+
partial: Partial<T> | ((prev: T) => Partial<T>) | Promise<Partial<T> | ((prev: T) => Partial<T>)>,
|
|
1566
|
+
) => void
|
|
1567
|
+
```
|
|
1568
|
+
|
|
1560
1569
|
#### `UseCapacitorAppResult`
|
|
1561
1570
|
|
|
1562
1571
|
Hook return type.
|
|
@@ -1577,194 +1586,153 @@ type VerifyPaymentReturnStatus = 'idle' | 'verifying' | 'verified' | 'failed'
|
|
|
1577
1586
|
|
|
1578
1587
|
### Functions
|
|
1579
1588
|
|
|
1580
|
-
#### `
|
|
1589
|
+
#### `resetAIModelsCache()`
|
|
1581
1590
|
|
|
1582
|
-
|
|
1591
|
+
Test-only: drops every cached model list so the next `useAIModels` call
|
|
1592
|
+
refetches. Exposed for unit tests; do not call from production code.
|
|
1583
1593
|
|
|
1584
1594
|
```typescript
|
|
1585
|
-
function
|
|
1586
|
-
client,
|
|
1587
|
-
children,
|
|
1588
|
-
}: AuthProviderProps<T>): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>
|
|
1595
|
+
function resetAIModelsCache(): void
|
|
1589
1596
|
```
|
|
1590
1597
|
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
**Returns:** The rendered auth provider element.
|
|
1594
|
-
|
|
1595
|
-
#### `ChatProvider(props)`
|
|
1598
|
+
#### `useAIModels(projectId)`
|
|
1596
1599
|
|
|
1597
|
-
|
|
1600
|
+
Subscribes to the cached AI model catalog. The first mount of a scope
|
|
1601
|
+
triggers a single `GET /ai/models` fetch; subsequent mounts return the
|
|
1602
|
+
cached result.
|
|
1598
1603
|
|
|
1599
1604
|
```typescript
|
|
1600
|
-
function
|
|
1601
|
-
provider,
|
|
1602
|
-
children,
|
|
1603
|
-
}: ChatProviderProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>
|
|
1605
|
+
function useAIModels(projectId?: string): UseAIModelsResult
|
|
1604
1606
|
```
|
|
1605
1607
|
|
|
1606
|
-
- `
|
|
1607
|
-
|
|
1608
|
-
**Returns:** The rendered chat provider element.
|
|
1608
|
+
- `projectId` — Optional project scope: includes that project's custom ("bring your own AI") models on servers that support them.
|
|
1609
1609
|
|
|
1610
|
-
|
|
1610
|
+
**Returns:** Models, free-tier model, loading flag, and error.
|
|
1611
1611
|
|
|
1612
|
-
|
|
1613
|
-
already on screen. This is the ONE place a server transcript is applied to a
|
|
1614
|
-
local view — the page-lifecycle/push reconcile, the remote-turn poll, the
|
|
1615
|
-
dropped-stream reconcile and the resume poll all go through it, because two
|
|
1616
|
-
paths that almost agree is how a message came to vanish and come back
|
|
1617
|
-
(reported 2026-09-21).
|
|
1612
|
+
#### `useAsyncState(initialState)`
|
|
1618
1613
|
|
|
1619
|
-
|
|
1620
|
-
keeps the local copy, so an unchanged transcript returns the same object
|
|
1621
|
-
references and a poll neither churns React nor rewinds. Messages only the
|
|
1622
|
-
server has are added in the server's order (filling gaps a watcher missed);
|
|
1623
|
-
messages only the store has ({@link localOnlyMessages} — an answer still
|
|
1624
|
-
carrying its local id, a session-local card, a turn the server has not
|
|
1625
|
-
persisted yet) are kept after them.
|
|
1614
|
+
Hook like useState but accepts Promises and supports partial state extension.
|
|
1626
1615
|
|
|
1627
1616
|
```typescript
|
|
1628
|
-
function
|
|
1617
|
+
function useAsyncState(initialState: T): [T, AsyncSetState<T>, AsyncExtendState<T>]
|
|
1629
1618
|
```
|
|
1630
1619
|
|
|
1631
|
-
- `
|
|
1632
|
-
- `history` — The messages from the server's history endpoint.
|
|
1620
|
+
- `initialState` — Initial state value
|
|
1633
1621
|
|
|
1634
|
-
**Returns:**
|
|
1622
|
+
**Returns:** Tuple of [state, asyncSetState, asyncExtendState]
|
|
1635
1623
|
|
|
1636
|
-
#### `
|
|
1624
|
+
#### `useAuthClient()`
|
|
1637
1625
|
|
|
1638
|
-
|
|
1626
|
+
Hook to access the auth client from context.
|
|
1639
1627
|
|
|
1640
1628
|
```typescript
|
|
1641
|
-
function
|
|
1642
|
-
provider,
|
|
1643
|
-
children,
|
|
1644
|
-
}: EditorProviderProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>
|
|
1629
|
+
function useAuthClient(): AuthClient<T>
|
|
1645
1630
|
```
|
|
1646
1631
|
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
**Returns:** The rendered editor provider element.
|
|
1632
|
+
**Returns:** The auth client from context
|
|
1650
1633
|
|
|
1651
|
-
#### `
|
|
1634
|
+
#### `useAuth(options)`
|
|
1652
1635
|
|
|
1653
|
-
|
|
1636
|
+
Hook for authentication state and actions.
|
|
1654
1637
|
|
|
1655
1638
|
```typescript
|
|
1656
|
-
function
|
|
1657
|
-
client,
|
|
1658
|
-
children,
|
|
1659
|
-
}: HttpProviderProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>
|
|
1639
|
+
function useAuth(options?: UseAuthOptions): UseAuthResult<T>
|
|
1660
1640
|
```
|
|
1661
1641
|
|
|
1662
|
-
- `
|
|
1642
|
+
- `options` — Hook options
|
|
1663
1643
|
|
|
1664
|
-
**Returns:**
|
|
1644
|
+
**Returns:** Auth state and action methods
|
|
1665
1645
|
|
|
1666
|
-
#### `
|
|
1646
|
+
#### `useUser()`
|
|
1667
1647
|
|
|
1668
|
-
|
|
1648
|
+
Hook to get just the authenticated user.
|
|
1669
1649
|
|
|
1670
1650
|
```typescript
|
|
1671
|
-
function
|
|
1672
|
-
provider,
|
|
1673
|
-
children,
|
|
1674
|
-
}: I18nProviderProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>
|
|
1651
|
+
function useUser(): T | null
|
|
1675
1652
|
```
|
|
1676
1653
|
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
**Returns:** The rendered i18n provider element.
|
|
1654
|
+
**Returns:** The authenticated user or null
|
|
1680
1655
|
|
|
1681
|
-
#### `
|
|
1656
|
+
#### `useIsAuthenticated()`
|
|
1682
1657
|
|
|
1683
|
-
|
|
1684
|
-
bubbles and session-local cards, minus the optimistic ECHO of a send the
|
|
1685
|
-
server already persisted. A local user message carries a local id
|
|
1686
|
-
(`user-N`), the server's copy a server id, so ids never match — content does.
|
|
1687
|
-
Without this, the dashboard's first prompt (auto-sent by the workspace,
|
|
1688
|
-
then merged back in from history by the remote-stream poll) rendered as two
|
|
1689
|
-
identical user bubbles in every new project (2026-09-08).
|
|
1658
|
+
Hook to check if user is authenticated.
|
|
1690
1659
|
|
|
1691
1660
|
```typescript
|
|
1692
|
-
function
|
|
1661
|
+
function useIsAuthenticated(): boolean
|
|
1693
1662
|
```
|
|
1694
1663
|
|
|
1695
|
-
|
|
1696
|
-
- `history` — The server's history.
|
|
1664
|
+
**Returns:** Whether the user is authenticated
|
|
1697
1665
|
|
|
1698
|
-
|
|
1666
|
+
#### `useCapacitorApp(options)`
|
|
1699
1667
|
|
|
1700
|
-
|
|
1668
|
+
Hook for Capacitor app initialization and state management.
|
|
1701
1669
|
|
|
1702
|
-
|
|
1670
|
+
Creates a `CapacitorApp` coordinator on mount, subscribes to state changes,
|
|
1671
|
+
and auto-initializes. Cleans up listeners on unmount via `destroy()`.
|
|
1703
1672
|
|
|
1704
1673
|
```typescript
|
|
1705
|
-
function
|
|
1706
|
-
provider,
|
|
1707
|
-
children,
|
|
1708
|
-
}: LoggerProviderProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>
|
|
1674
|
+
function useCapacitorApp(options?: CapacitorAppOptions): UseCapacitorAppResult
|
|
1709
1675
|
```
|
|
1710
1676
|
|
|
1711
|
-
- `
|
|
1712
|
-
|
|
1713
|
-
**Returns:** The rendered logger provider element.
|
|
1677
|
+
- `options` — Capacitor app configuration options
|
|
1714
1678
|
|
|
1715
|
-
|
|
1679
|
+
**Returns:** Current app state and an `initialize` function for manual re-initialization
|
|
1716
1680
|
|
|
1717
|
-
|
|
1681
|
+
#### `useChangePassword()`
|
|
1718
1682
|
|
|
1719
|
-
|
|
1720
|
-
Only providers that are passed will be included.
|
|
1683
|
+
Hook for changing password with async state tracking.
|
|
1721
1684
|
|
|
1722
1685
|
```typescript
|
|
1723
|
-
function
|
|
1724
|
-
children,
|
|
1725
|
-
state,
|
|
1726
|
-
auth,
|
|
1727
|
-
theme,
|
|
1728
|
-
router,
|
|
1729
|
-
i18n,
|
|
1730
|
-
http,
|
|
1731
|
-
storage,
|
|
1732
|
-
logger,
|
|
1733
|
-
chat,
|
|
1734
|
-
workspace,
|
|
1735
|
-
editor,
|
|
1736
|
-
preview,
|
|
1737
|
-
}: MoleculeProviderProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>
|
|
1686
|
+
function useChangePassword(): UseChangePasswordReturn
|
|
1738
1687
|
```
|
|
1739
1688
|
|
|
1740
|
-
|
|
1689
|
+
**Returns:** Change password state and action
|
|
1741
1690
|
|
|
1742
|
-
|
|
1691
|
+
#### `convergeHistory(prev, history)`
|
|
1743
1692
|
|
|
1744
|
-
|
|
1693
|
+
Converge a live store on a fresh server history WITHOUT rewinding anything
|
|
1694
|
+
already on screen. This is the ONE place a server transcript is applied to a
|
|
1695
|
+
local view — the page-lifecycle/push reconcile, the remote-turn poll, the
|
|
1696
|
+
dropped-stream reconcile and the resume poll all go through it, because two
|
|
1697
|
+
paths that almost agree is how a message came to vanish and come back
|
|
1698
|
+
(reported 2026-09-21).
|
|
1745
1699
|
|
|
1746
|
-
|
|
1700
|
+
Per message id the further-along copy wins ({@link messageProgress}); a TIE
|
|
1701
|
+
keeps the local copy, so an unchanged transcript returns the same object
|
|
1702
|
+
references and a poll neither churns React nor rewinds. Messages only the
|
|
1703
|
+
server has are added in the server's order (filling gaps a watcher missed);
|
|
1704
|
+
messages only the store has ({@link localOnlyMessages} — an answer still
|
|
1705
|
+
carrying its local id, a session-local card, a turn the server has not
|
|
1706
|
+
persisted yet) are kept after them.
|
|
1747
1707
|
|
|
1748
1708
|
```typescript
|
|
1749
|
-
function
|
|
1750
|
-
provider,
|
|
1751
|
-
children,
|
|
1752
|
-
}: PreviewProviderProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>
|
|
1709
|
+
function convergeHistory(prev: ChatMessage[], history: ChatMessage[]): ChatMessage[]
|
|
1753
1710
|
```
|
|
1754
1711
|
|
|
1755
|
-
- `
|
|
1712
|
+
- `prev` — The store's current messages.
|
|
1713
|
+
- `history` — The messages from the server's history endpoint.
|
|
1756
1714
|
|
|
1757
|
-
**Returns:** The
|
|
1715
|
+
**Returns:** The converged message list.
|
|
1758
1716
|
|
|
1759
|
-
#### `
|
|
1717
|
+
#### `localOnlyMessages(prev, history)`
|
|
1760
1718
|
|
|
1761
|
-
|
|
1762
|
-
|
|
1719
|
+
The messages only the local store holds, given a server history: optimistic
|
|
1720
|
+
bubbles and session-local cards, minus the optimistic ECHO of a send the
|
|
1721
|
+
server already persisted. A local user message carries a local id
|
|
1722
|
+
(`user-N`), the server's copy a server id, so ids never match — content does.
|
|
1723
|
+
Without this, the dashboard's first prompt (auto-sent by the workspace,
|
|
1724
|
+
then merged back in from history by the remote-stream poll) rendered as two
|
|
1725
|
+
identical user bubbles in every new project (2026-09-08).
|
|
1763
1726
|
|
|
1764
1727
|
```typescript
|
|
1765
|
-
function
|
|
1728
|
+
function localOnlyMessages(prev: ChatMessage[], history: ChatMessage[]): ChatMessage[]
|
|
1766
1729
|
```
|
|
1767
1730
|
|
|
1731
|
+
- `prev` — The store's current messages.
|
|
1732
|
+
- `history` — The server's history.
|
|
1733
|
+
|
|
1734
|
+
**Returns:** The local-only messages to keep after the merged history.
|
|
1735
|
+
|
|
1768
1736
|
#### `resetChatStoresForTests()`
|
|
1769
1737
|
|
|
1770
1738
|
Test-only: clear all conversation stores. The store is module-level (it must
|
|
@@ -1775,186 +1743,181 @@ outlive component mounts), so it persists across test cases — reset it in a
|
|
|
1775
1743
|
function resetChatStoresForTests(): void
|
|
1776
1744
|
```
|
|
1777
1745
|
|
|
1778
|
-
#### `
|
|
1746
|
+
#### `useChatProvider()`
|
|
1779
1747
|
|
|
1780
|
-
|
|
1748
|
+
Access the chat provider from context.
|
|
1781
1749
|
|
|
1782
1750
|
```typescript
|
|
1783
|
-
function
|
|
1784
|
-
router,
|
|
1785
|
-
children,
|
|
1786
|
-
}: RouterProviderProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>
|
|
1751
|
+
function useChatProvider(): ChatProvider
|
|
1787
1752
|
```
|
|
1788
1753
|
|
|
1789
|
-
|
|
1754
|
+
**Returns:** The ChatProvider instance from the nearest ChatContext.
|
|
1790
1755
|
|
|
1791
|
-
|
|
1756
|
+
#### `useChat(options)`
|
|
1792
1757
|
|
|
1793
|
-
|
|
1758
|
+
Hook for AI chat with streaming support.
|
|
1794
1759
|
|
|
1795
|
-
|
|
1760
|
+
Manages message state, sends messages to the backend, and handles
|
|
1761
|
+
SSE streaming responses.
|
|
1796
1762
|
|
|
1797
1763
|
```typescript
|
|
1798
|
-
function
|
|
1799
|
-
provider,
|
|
1800
|
-
children,
|
|
1801
|
-
}: StateProviderProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>
|
|
1764
|
+
function useChat(options: UseChatOptions): UseChatResult
|
|
1802
1765
|
```
|
|
1803
1766
|
|
|
1804
|
-
- `
|
|
1767
|
+
- `options` — Chat configuration including endpoint URL, project ID, and whether to load history on mount.
|
|
1805
1768
|
|
|
1806
|
-
**Returns:**
|
|
1769
|
+
**Returns:** Chat state and controls: messages, isLoading, error, sendMessage, abort, and clearHistory.
|
|
1807
1770
|
|
|
1808
|
-
#### `
|
|
1771
|
+
#### `useDevice()`
|
|
1809
1772
|
|
|
1810
|
-
|
|
1773
|
+
Hook for device information.
|
|
1774
|
+
|
|
1775
|
+
Uses module-level `getProvider()` — device info is a singleton, not context-provided.
|
|
1776
|
+
Device info is static and doesn't change at runtime, so this uses `useMemo`.
|
|
1811
1777
|
|
|
1812
1778
|
```typescript
|
|
1813
|
-
function
|
|
1814
|
-
provider,
|
|
1815
|
-
children,
|
|
1816
|
-
}: StorageProviderProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>
|
|
1779
|
+
function useDevice(): UseDeviceResult
|
|
1817
1780
|
```
|
|
1818
1781
|
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
**Returns:** The rendered storage provider element.
|
|
1782
|
+
**Returns:** Device information and utility methods
|
|
1822
1783
|
|
|
1823
|
-
#### `
|
|
1784
|
+
#### `useEditorProvider()`
|
|
1824
1785
|
|
|
1825
|
-
|
|
1786
|
+
Access the editor provider from context.
|
|
1826
1787
|
|
|
1827
1788
|
```typescript
|
|
1828
|
-
function
|
|
1829
|
-
provider,
|
|
1830
|
-
children,
|
|
1831
|
-
}: ThemeProviderProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>
|
|
1789
|
+
function useEditorProvider(): EditorProvider
|
|
1832
1790
|
```
|
|
1833
1791
|
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
**Returns:** The rendered theme provider element.
|
|
1792
|
+
**Returns:** The EditorProvider instance from the nearest EditorContext.
|
|
1837
1793
|
|
|
1838
|
-
#### `
|
|
1794
|
+
#### `useEditor()`
|
|
1839
1795
|
|
|
1840
|
-
|
|
1841
|
-
triggers a single `GET /ai/models` fetch; subsequent mounts return the
|
|
1842
|
-
cached result.
|
|
1796
|
+
Hook for code editor management.
|
|
1843
1797
|
|
|
1844
1798
|
```typescript
|
|
1845
|
-
function
|
|
1799
|
+
function useEditor(): UseEditorResult
|
|
1846
1800
|
```
|
|
1847
1801
|
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
**Returns:** Models, free-tier model, loading flag, and error.
|
|
1802
|
+
**Returns:** Editor state and controls: tabs, activeFile, openFile, closeFile, getContent, setContent, setActiveTab, mount, dispose, and focus.
|
|
1851
1803
|
|
|
1852
|
-
#### `
|
|
1804
|
+
#### `useForm(options)`
|
|
1853
1805
|
|
|
1854
|
-
Hook
|
|
1806
|
+
Hook for form state management.
|
|
1855
1807
|
|
|
1856
1808
|
```typescript
|
|
1857
|
-
function
|
|
1809
|
+
function useForm(options: UseFormOptions<T>): UseFormResult<T>
|
|
1858
1810
|
```
|
|
1859
1811
|
|
|
1860
|
-
- `
|
|
1812
|
+
- `options` — Form options including createForm from a forms provider
|
|
1861
1813
|
|
|
1862
|
-
**Returns:**
|
|
1814
|
+
**Returns:** Form state and methods
|
|
1863
1815
|
|
|
1864
|
-
#### `
|
|
1816
|
+
#### `useWatch(form, name)`
|
|
1865
1817
|
|
|
1866
|
-
Hook
|
|
1818
|
+
Hook to watch a specific field value.
|
|
1867
1819
|
|
|
1868
1820
|
```typescript
|
|
1869
|
-
function
|
|
1821
|
+
function useWatch(form: FormController<T>, name: K): T[K]
|
|
1870
1822
|
```
|
|
1871
1823
|
|
|
1872
|
-
- `
|
|
1824
|
+
- `form` — Form controller
|
|
1825
|
+
- `name` — Field name to watch
|
|
1873
1826
|
|
|
1874
|
-
**Returns:**
|
|
1827
|
+
**Returns:** Current field value
|
|
1875
1828
|
|
|
1876
|
-
#### `
|
|
1829
|
+
#### `useFieldState(form, name)`
|
|
1877
1830
|
|
|
1878
|
-
Hook to
|
|
1831
|
+
Hook to get field-level state.
|
|
1879
1832
|
|
|
1880
1833
|
```typescript
|
|
1881
|
-
function
|
|
1834
|
+
function useFieldState(form: FormController<T>, name: keyof T): FieldState<T[keyof T]>
|
|
1882
1835
|
```
|
|
1883
1836
|
|
|
1884
|
-
|
|
1837
|
+
- `form` — Form controller
|
|
1838
|
+
- `name` — Field name
|
|
1885
1839
|
|
|
1886
|
-
|
|
1840
|
+
**Returns:** Field state (value, error, touched, dirty, valid)
|
|
1887
1841
|
|
|
1888
|
-
|
|
1842
|
+
#### `useHttpClient()`
|
|
1889
1843
|
|
|
1890
|
-
|
|
1891
|
-
and auto-initializes. Cleans up listeners on unmount via `destroy()`.
|
|
1844
|
+
Hook to access the HTTP client from context.
|
|
1892
1845
|
|
|
1893
1846
|
```typescript
|
|
1894
|
-
function
|
|
1847
|
+
function useHttpClient(): HttpClient
|
|
1895
1848
|
```
|
|
1896
1849
|
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
**Returns:** Current app state and an `initialize` function for manual re-initialization
|
|
1850
|
+
**Returns:** The HTTP client from context
|
|
1900
1851
|
|
|
1901
|
-
#### `
|
|
1852
|
+
#### `useHttp(method, url, options)`
|
|
1902
1853
|
|
|
1903
|
-
Hook for
|
|
1854
|
+
Hook for making HTTP requests with state management.
|
|
1904
1855
|
|
|
1905
1856
|
```typescript
|
|
1906
|
-
function
|
|
1857
|
+
function useHttp(
|
|
1858
|
+
method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE',
|
|
1859
|
+
url: string,
|
|
1860
|
+
options?: UseHttpOptions<T>,
|
|
1861
|
+
): UseHttpResult<T>
|
|
1907
1862
|
```
|
|
1908
1863
|
|
|
1909
|
-
|
|
1864
|
+
- `method` — HTTP method
|
|
1865
|
+
- `url` — Request URL
|
|
1866
|
+
- `options` — Request options
|
|
1910
1867
|
|
|
1911
|
-
|
|
1868
|
+
**Returns:** Request state and execute function
|
|
1912
1869
|
|
|
1913
|
-
|
|
1870
|
+
#### `useGet(url, options)`
|
|
1914
1871
|
|
|
1915
|
-
|
|
1916
|
-
SSE streaming responses.
|
|
1872
|
+
Hook for GET requests.
|
|
1917
1873
|
|
|
1918
1874
|
```typescript
|
|
1919
|
-
function
|
|
1875
|
+
function useGet(url: string, options?: UseHttpOptions<T>): UseHttpResult<T>
|
|
1920
1876
|
```
|
|
1921
1877
|
|
|
1922
|
-
- `
|
|
1878
|
+
- `url` — Request URL to fetch from.
|
|
1879
|
+
- `options` — HTTP request options including callbacks and request config.
|
|
1923
1880
|
|
|
1924
|
-
**Returns:**
|
|
1881
|
+
**Returns:** Request state (data, loading, error) and controls (execute, reset).
|
|
1925
1882
|
|
|
1926
|
-
#### `
|
|
1883
|
+
#### `usePost(url, options)`
|
|
1927
1884
|
|
|
1928
|
-
|
|
1885
|
+
Hook for POST requests.
|
|
1929
1886
|
|
|
1930
1887
|
```typescript
|
|
1931
|
-
function
|
|
1888
|
+
function usePost(url: string, options?: UseHttpOptions<T>): UseHttpResult<T>
|
|
1932
1889
|
```
|
|
1933
1890
|
|
|
1934
|
-
|
|
1891
|
+
- `url` — Request URL to post to.
|
|
1892
|
+
- `options` — HTTP request options including body data and callbacks.
|
|
1935
1893
|
|
|
1936
|
-
|
|
1894
|
+
**Returns:** Request state (data, loading, error) and controls (execute, reset).
|
|
1937
1895
|
|
|
1938
|
-
|
|
1896
|
+
#### `usePut(url, options)`
|
|
1897
|
+
|
|
1898
|
+
Hook for PUT requests.
|
|
1939
1899
|
|
|
1940
1900
|
```typescript
|
|
1941
|
-
function
|
|
1901
|
+
function usePut(url: string, options?: UseHttpOptions<T>): UseHttpResult<T>
|
|
1942
1902
|
```
|
|
1943
1903
|
|
|
1944
|
-
- `
|
|
1945
|
-
- `
|
|
1904
|
+
- `url` — Request URL to send the PUT request to.
|
|
1905
|
+
- `options` — HTTP request options including body data and callbacks.
|
|
1946
1906
|
|
|
1947
|
-
**Returns:**
|
|
1907
|
+
**Returns:** Request state (data, loading, error) and controls (execute, reset).
|
|
1948
1908
|
|
|
1949
|
-
#### `
|
|
1909
|
+
#### `usePatch(url, options)`
|
|
1950
1910
|
|
|
1951
|
-
Hook
|
|
1911
|
+
Hook for PATCH requests.
|
|
1952
1912
|
|
|
1953
1913
|
```typescript
|
|
1954
|
-
function
|
|
1914
|
+
function usePatch(url: string, options?: UseHttpOptions<T>): UseHttpResult<T>
|
|
1955
1915
|
```
|
|
1956
1916
|
|
|
1957
|
-
|
|
1917
|
+
- `url` — Request URL to send the PATCH request to.
|
|
1918
|
+
- `options` — HTTP request options including partial body data and callbacks.
|
|
1919
|
+
|
|
1920
|
+
**Returns:** Request state (data, loading, error) and controls (execute, reset).
|
|
1958
1921
|
|
|
1959
1922
|
#### `useDelete(url, options)`
|
|
1960
1923
|
|
|
@@ -1969,219 +1932,218 @@ function useDelete(url: string, options?: UseHttpOptions<T>): UseHttpResult<T>
|
|
|
1969
1932
|
|
|
1970
1933
|
**Returns:** Request state (data, loading, error) and controls (execute, reset).
|
|
1971
1934
|
|
|
1972
|
-
#### `
|
|
1973
|
-
|
|
1974
|
-
Hook for device information.
|
|
1935
|
+
#### `useLoggerProvider()`
|
|
1975
1936
|
|
|
1976
|
-
|
|
1977
|
-
Device info is static and doesn't change at runtime, so this uses `useMemo`.
|
|
1937
|
+
Hook to access the logger provider from context.
|
|
1978
1938
|
|
|
1979
1939
|
```typescript
|
|
1980
|
-
function
|
|
1940
|
+
function useLoggerProvider(): LoggerProvider
|
|
1981
1941
|
```
|
|
1982
1942
|
|
|
1983
|
-
**Returns:**
|
|
1943
|
+
**Returns:** The logger provider from context
|
|
1984
1944
|
|
|
1985
|
-
#### `
|
|
1945
|
+
#### `useLogger(name, config)`
|
|
1986
1946
|
|
|
1987
|
-
Hook to get
|
|
1947
|
+
Hook to get a logger instance.
|
|
1988
1948
|
|
|
1989
1949
|
```typescript
|
|
1990
|
-
function
|
|
1950
|
+
function useLogger(name: string, config?: Partial<LoggerConfig>): Logger
|
|
1991
1951
|
```
|
|
1992
1952
|
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
#### `useEditor()`
|
|
1996
|
-
|
|
1997
|
-
Hook for code editor management.
|
|
1998
|
-
|
|
1999
|
-
```typescript
|
|
2000
|
-
function useEditor(): UseEditorResult
|
|
2001
|
-
```
|
|
1953
|
+
- `name` — Logger name (usually component or module name)
|
|
1954
|
+
- `config` — Optional logger configuration
|
|
2002
1955
|
|
|
2003
|
-
**Returns:**
|
|
1956
|
+
**Returns:** Logger instance
|
|
2004
1957
|
|
|
2005
|
-
#### `
|
|
1958
|
+
#### `useRootLogger()`
|
|
2006
1959
|
|
|
2007
|
-
|
|
1960
|
+
Hook to get the root logger.
|
|
2008
1961
|
|
|
2009
1962
|
```typescript
|
|
2010
|
-
function
|
|
1963
|
+
function useRootLogger(): Logger
|
|
2011
1964
|
```
|
|
2012
1965
|
|
|
2013
|
-
**Returns:**
|
|
1966
|
+
**Returns:** Root logger instance
|
|
2014
1967
|
|
|
2015
|
-
#### `
|
|
1968
|
+
#### `useChildLogger(parentName, context)`
|
|
2016
1969
|
|
|
2017
|
-
Hook to
|
|
1970
|
+
Hook to create a child logger with additional context.
|
|
2018
1971
|
|
|
2019
1972
|
```typescript
|
|
2020
|
-
function
|
|
1973
|
+
function useChildLogger(parentName: string, context: Record<string, unknown>): Logger
|
|
2021
1974
|
```
|
|
2022
1975
|
|
|
2023
|
-
- `
|
|
2024
|
-
- `
|
|
1976
|
+
- `parentName` — Parent logger name
|
|
1977
|
+
- `context` — Additional context to include in logs
|
|
2025
1978
|
|
|
2026
|
-
**Returns:**
|
|
1979
|
+
**Returns:** Child logger instance
|
|
2027
1980
|
|
|
2028
|
-
#### `
|
|
1981
|
+
#### `useLogin()`
|
|
2029
1982
|
|
|
2030
|
-
Hook for
|
|
1983
|
+
Hook for login with async state tracking.
|
|
2031
1984
|
|
|
2032
1985
|
```typescript
|
|
2033
|
-
function
|
|
1986
|
+
function useLogin(): UseLoginReturn<T>
|
|
2034
1987
|
```
|
|
2035
1988
|
|
|
2036
|
-
|
|
1989
|
+
**Returns:** Login state and action
|
|
2037
1990
|
|
|
2038
|
-
|
|
1991
|
+
#### `useOAuth(config)`
|
|
2039
1992
|
|
|
2040
|
-
|
|
1993
|
+
Hook for OAuth authentication.
|
|
2041
1994
|
|
|
2042
|
-
|
|
1995
|
+
Reads OAuth configuration from the provided config and provides
|
|
1996
|
+
helpers to build OAuth URLs and start a login (full-page or popup).
|
|
1997
|
+
Automatically handles OAuth callbacks by detecting `code` and `state`
|
|
1998
|
+
URL parameters and exchanging them for a session — and, when the callback is
|
|
1999
|
+
running inside a popup we opened, relaying the result to the opener instead.
|
|
2043
2000
|
|
|
2044
2001
|
```typescript
|
|
2045
|
-
function
|
|
2002
|
+
function useOAuth(config?: {
|
|
2003
|
+
baseURL?: string
|
|
2004
|
+
oauthProviders?: string[]
|
|
2005
|
+
oauthEndpoint?: string
|
|
2006
|
+
loginEndpoint?: string
|
|
2007
|
+
onSuccess?: () => void
|
|
2008
|
+
onError?: (error: string) => void
|
|
2009
|
+
}): UseOAuthReturn
|
|
2046
2010
|
```
|
|
2047
2011
|
|
|
2048
|
-
- `
|
|
2049
|
-
- `
|
|
2012
|
+
- `config` — Optional OAuth configuration override.
|
|
2013
|
+
- `config.baseURL` — Base URL for the API server (e.g. "https://api.example.com").
|
|
2014
|
+
- `config.oauthProviders` — List of supported OAuth provider names (e.g. ["google", "github"]).
|
|
2015
|
+
- `config.oauthEndpoint` — Path prefix for OAuth routes (defaults to "/oauth").
|
|
2016
|
+
- `config.loginEndpoint` — Path for the OAuth login POST endpoint (defaults to "/users/log-in/oauth").
|
|
2017
|
+
- `config.onSuccess` — Callback after successful OAuth login.
|
|
2018
|
+
- `config.onError` — Callback on OAuth login failure.
|
|
2050
2019
|
|
|
2051
|
-
**Returns:**
|
|
2020
|
+
**Returns:** OAuth helpers: providers, getOAuthUrl, redirect, and loginViaPopup.
|
|
2052
2021
|
|
|
2053
|
-
#### `
|
|
2022
|
+
#### `usePasswordReset()`
|
|
2054
2023
|
|
|
2055
|
-
Hook for
|
|
2024
|
+
Hook for password reset flow with async state tracking.
|
|
2025
|
+
|
|
2026
|
+
Provides separate tracking for the request and confirm steps.
|
|
2056
2027
|
|
|
2057
2028
|
```typescript
|
|
2058
|
-
function
|
|
2059
|
-
method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE',
|
|
2060
|
-
url: string,
|
|
2061
|
-
options?: UseHttpOptions<T>,
|
|
2062
|
-
): UseHttpResult<T>
|
|
2029
|
+
function usePasswordReset(): UsePasswordResetReturn
|
|
2063
2030
|
```
|
|
2064
2031
|
|
|
2065
|
-
|
|
2066
|
-
- `url` — Request URL
|
|
2067
|
-
- `options` — Request options
|
|
2032
|
+
**Returns:** Password reset state and actions
|
|
2068
2033
|
|
|
2069
|
-
|
|
2034
|
+
#### `usePlatform()`
|
|
2070
2035
|
|
|
2071
|
-
|
|
2036
|
+
Hook for platform detection.
|
|
2072
2037
|
|
|
2073
|
-
|
|
2038
|
+
Uses module-level functions — platform is a singleton, not context-provided.
|
|
2039
|
+
Platform info is static and doesn't change at runtime, so this uses `useMemo`.
|
|
2074
2040
|
|
|
2075
2041
|
```typescript
|
|
2076
|
-
function
|
|
2042
|
+
function usePlatform(): UsePlatformResult
|
|
2077
2043
|
```
|
|
2078
2044
|
|
|
2079
|
-
**Returns:**
|
|
2080
|
-
|
|
2081
|
-
#### `useI18nError(error)`
|
|
2045
|
+
**Returns:** Platform information and utility methods
|
|
2082
2046
|
|
|
2083
|
-
|
|
2084
|
-
when the locale changes.
|
|
2047
|
+
#### `usePreviewProvider()`
|
|
2085
2048
|
|
|
2086
|
-
|
|
2087
|
-
`error.message` directly bypasses re-translation and leaves stale text after a
|
|
2088
|
-
locale switch. If `error` is an `I18nError` (thrown via `throw new I18nError(key)`),
|
|
2089
|
-
its key is translated using the current locale. For plain `Error` instances,
|
|
2090
|
-
`error.message` is returned unchanged.
|
|
2049
|
+
Access the preview provider from context.
|
|
2091
2050
|
|
|
2092
2051
|
```typescript
|
|
2093
|
-
function
|
|
2052
|
+
function usePreviewProvider(): PreviewProvider
|
|
2094
2053
|
```
|
|
2095
2054
|
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
**Returns:** The translated error string, or `null` if no error.
|
|
2055
|
+
**Returns:** The PreviewProvider instance from the nearest PreviewContext.
|
|
2099
2056
|
|
|
2100
|
-
#### `
|
|
2057
|
+
#### `usePreview()`
|
|
2101
2058
|
|
|
2102
|
-
Hook
|
|
2059
|
+
Hook for live preview management.
|
|
2103
2060
|
|
|
2104
2061
|
```typescript
|
|
2105
|
-
function
|
|
2062
|
+
function usePreview(): UsePreviewResult
|
|
2106
2063
|
```
|
|
2107
2064
|
|
|
2108
|
-
**Returns:**
|
|
2065
|
+
**Returns:** Preview state and controls: state (url, isLoading, device, error, isConnected), setUrl, refresh, setDevice, and openExternal.
|
|
2109
2066
|
|
|
2110
|
-
#### `
|
|
2067
|
+
#### `usePromise(asyncFn)`
|
|
2111
2068
|
|
|
2112
|
-
Hook
|
|
2069
|
+
Hook that wraps an async function with state tracking.
|
|
2113
2070
|
|
|
2114
2071
|
```typescript
|
|
2115
|
-
function
|
|
2072
|
+
function usePromise(
|
|
2073
|
+
asyncFn: T,
|
|
2074
|
+
): [
|
|
2075
|
+
UsePromiseState<Awaited<ReturnType<T>>>,
|
|
2076
|
+
(...args: Parameters<T>) => Promise<Awaited<ReturnType<T>>>,
|
|
2077
|
+
]
|
|
2116
2078
|
```
|
|
2117
2079
|
|
|
2118
|
-
- `
|
|
2119
|
-
- `exact` — Whether to match exactly (default: false)
|
|
2080
|
+
- `asyncFn` — The async function to wrap
|
|
2120
2081
|
|
|
2121
|
-
**Returns:**
|
|
2082
|
+
**Returns:** Tuple of [state, wrappedFunction]
|
|
2122
2083
|
|
|
2123
|
-
#### `
|
|
2084
|
+
#### `usePush(options)`
|
|
2124
2085
|
|
|
2125
|
-
Hook
|
|
2086
|
+
Hook for push notification state and actions.
|
|
2087
|
+
|
|
2088
|
+
Uses module-level `getProvider()` — push is a singleton, not context-provided.
|
|
2126
2089
|
|
|
2127
2090
|
```typescript
|
|
2128
|
-
function
|
|
2091
|
+
function usePush(options?: UsePushOptions): UsePushResult
|
|
2129
2092
|
```
|
|
2130
2093
|
|
|
2131
|
-
|
|
2094
|
+
- `options` — Hook options
|
|
2132
2095
|
|
|
2133
|
-
|
|
2096
|
+
**Returns:** Push notification state and action methods
|
|
2134
2097
|
|
|
2135
|
-
|
|
2098
|
+
#### `useRouterInstance()`
|
|
2099
|
+
|
|
2100
|
+
Hook to access the router from context.
|
|
2136
2101
|
|
|
2137
2102
|
```typescript
|
|
2138
|
-
function
|
|
2103
|
+
function useRouterInstance(): Router
|
|
2139
2104
|
```
|
|
2140
2105
|
|
|
2141
|
-
**Returns:** The
|
|
2106
|
+
**Returns:** The router from context
|
|
2142
2107
|
|
|
2143
|
-
#### `
|
|
2108
|
+
#### `useRouter()`
|
|
2144
2109
|
|
|
2145
|
-
Hook
|
|
2110
|
+
Hook for routing state and actions.
|
|
2146
2111
|
|
|
2147
2112
|
```typescript
|
|
2148
|
-
function
|
|
2113
|
+
function useRouter(): UseRouterResult
|
|
2149
2114
|
```
|
|
2150
2115
|
|
|
2151
|
-
**Returns:**
|
|
2116
|
+
**Returns:** Router state and navigation methods
|
|
2152
2117
|
|
|
2153
|
-
#### `
|
|
2118
|
+
#### `useLocation()`
|
|
2154
2119
|
|
|
2155
|
-
Hook to get
|
|
2120
|
+
Hook to get the current location.
|
|
2156
2121
|
|
|
2157
2122
|
```typescript
|
|
2158
|
-
function
|
|
2123
|
+
function useLocation(): RouteLocation
|
|
2159
2124
|
```
|
|
2160
2125
|
|
|
2161
|
-
|
|
2162
|
-
- `config` — Optional logger configuration
|
|
2163
|
-
|
|
2164
|
-
**Returns:** Logger instance
|
|
2126
|
+
**Returns:** The current route location
|
|
2165
2127
|
|
|
2166
|
-
#### `
|
|
2128
|
+
#### `useParams()`
|
|
2167
2129
|
|
|
2168
|
-
Hook to
|
|
2130
|
+
Hook to get route parameters.
|
|
2169
2131
|
|
|
2170
2132
|
```typescript
|
|
2171
|
-
function
|
|
2133
|
+
function useParams(): T
|
|
2172
2134
|
```
|
|
2173
2135
|
|
|
2174
|
-
**Returns:** The
|
|
2136
|
+
**Returns:** The current route parameters
|
|
2175
2137
|
|
|
2176
|
-
#### `
|
|
2138
|
+
#### `useQuery()`
|
|
2177
2139
|
|
|
2178
|
-
Hook
|
|
2140
|
+
Hook to get query parameters.
|
|
2179
2141
|
|
|
2180
2142
|
```typescript
|
|
2181
|
-
function
|
|
2143
|
+
function useQuery(): T
|
|
2182
2144
|
```
|
|
2183
2145
|
|
|
2184
|
-
**Returns:**
|
|
2146
|
+
**Returns:** The current query parameters
|
|
2185
2147
|
|
|
2186
2148
|
#### `useNavigate()`
|
|
2187
2149
|
|
|
@@ -2193,481 +2155,528 @@ function useNavigate(): (path: string, options?: NavigateOptions) => void
|
|
|
2193
2155
|
|
|
2194
2156
|
**Returns:** The navigate function
|
|
2195
2157
|
|
|
2196
|
-
#### `
|
|
2197
|
-
|
|
2198
|
-
Hook for OAuth authentication.
|
|
2158
|
+
#### `useIsActive(path, exact)`
|
|
2199
2159
|
|
|
2200
|
-
|
|
2201
|
-
helpers to build OAuth URLs and start a login (full-page or popup).
|
|
2202
|
-
Automatically handles OAuth callbacks by detecting `code` and `state`
|
|
2203
|
-
URL parameters and exchanging them for a session — and, when the callback is
|
|
2204
|
-
running inside a popup we opened, relaying the result to the opener instead.
|
|
2160
|
+
Hook to check if a path is active.
|
|
2205
2161
|
|
|
2206
2162
|
```typescript
|
|
2207
|
-
function
|
|
2208
|
-
baseURL?: string
|
|
2209
|
-
oauthProviders?: string[]
|
|
2210
|
-
oauthEndpoint?: string
|
|
2211
|
-
loginEndpoint?: string
|
|
2212
|
-
onSuccess?: () => void
|
|
2213
|
-
onError?: (error: string) => void
|
|
2214
|
-
}): UseOAuthReturn
|
|
2163
|
+
function useIsActive(path: string, exact?: boolean): boolean
|
|
2215
2164
|
```
|
|
2216
2165
|
|
|
2217
|
-
- `
|
|
2218
|
-
- `
|
|
2219
|
-
- `config.oauthProviders` — List of supported OAuth provider names (e.g. ["google", "github"]).
|
|
2220
|
-
- `config.oauthEndpoint` — Path prefix for OAuth routes (defaults to "/oauth").
|
|
2221
|
-
- `config.loginEndpoint` — Path for the OAuth login POST endpoint (defaults to "/users/log-in/oauth").
|
|
2222
|
-
- `config.onSuccess` — Callback after successful OAuth login.
|
|
2223
|
-
- `config.onError` — Callback on OAuth login failure.
|
|
2166
|
+
- `path` — The path to check
|
|
2167
|
+
- `exact` — Whether to match exactly (default: false)
|
|
2224
2168
|
|
|
2225
|
-
**Returns:**
|
|
2169
|
+
**Returns:** Whether the path is active
|
|
2226
2170
|
|
|
2227
|
-
#### `
|
|
2171
|
+
#### `useSignup()`
|
|
2228
2172
|
|
|
2229
|
-
Hook
|
|
2173
|
+
Hook for user registration with async state tracking.
|
|
2230
2174
|
|
|
2231
2175
|
```typescript
|
|
2232
|
-
function
|
|
2176
|
+
function useSignup(): UseSignupReturn<T>
|
|
2233
2177
|
```
|
|
2234
2178
|
|
|
2235
|
-
**Returns:**
|
|
2236
|
-
|
|
2237
|
-
#### `usePasswordReset()`
|
|
2179
|
+
**Returns:** Signup state and action
|
|
2238
2180
|
|
|
2239
|
-
|
|
2181
|
+
#### `useStorageProvider()`
|
|
2240
2182
|
|
|
2241
|
-
|
|
2183
|
+
Hook to access the storage provider from context.
|
|
2242
2184
|
|
|
2243
2185
|
```typescript
|
|
2244
|
-
function
|
|
2186
|
+
function useStorageProvider(): StorageProvider
|
|
2245
2187
|
```
|
|
2246
2188
|
|
|
2247
|
-
**Returns:**
|
|
2189
|
+
**Returns:** The storage provider from context
|
|
2248
2190
|
|
|
2249
|
-
#### `
|
|
2191
|
+
#### `useStorageValue(key, options)`
|
|
2250
2192
|
|
|
2251
|
-
Hook
|
|
2193
|
+
Hook to manage a single storage value with React state sync.
|
|
2252
2194
|
|
|
2253
2195
|
```typescript
|
|
2254
|
-
function
|
|
2196
|
+
function useStorageValue(key: string, options?: UseStorageValueOptions<T>): UseStorageValueResult<T>
|
|
2255
2197
|
```
|
|
2256
2198
|
|
|
2257
|
-
- `
|
|
2258
|
-
- `options` —
|
|
2199
|
+
- `key` — Storage key
|
|
2200
|
+
- `options` — Hook options
|
|
2259
2201
|
|
|
2260
|
-
**Returns:**
|
|
2202
|
+
**Returns:** Storage value state (value, loading, error) and mutators (setValue, removeValue).
|
|
2261
2203
|
|
|
2262
|
-
#### `
|
|
2204
|
+
#### `useStorage()`
|
|
2263
2205
|
|
|
2264
|
-
Hook for
|
|
2206
|
+
Hook for simple storage operations without React state sync.
|
|
2265
2207
|
|
|
2266
|
-
|
|
2267
|
-
|
|
2208
|
+
```typescript
|
|
2209
|
+
function useStorage(): {
|
|
2210
|
+
get: <T>(key: string) => Promise<T | null>
|
|
2211
|
+
set: <T>(key: string, value: T) => Promise<void>
|
|
2212
|
+
remove: (key: string) => Promise<void>
|
|
2213
|
+
clear: () => Promise<void>
|
|
2214
|
+
keys: () => Promise<string[]>
|
|
2215
|
+
}
|
|
2216
|
+
```
|
|
2217
|
+
|
|
2218
|
+
**Returns:** Storage operation methods
|
|
2219
|
+
|
|
2220
|
+
#### `useStateProvider()`
|
|
2221
|
+
|
|
2222
|
+
Hook to access the state provider from context.
|
|
2268
2223
|
|
|
2269
2224
|
```typescript
|
|
2270
|
-
function
|
|
2225
|
+
function useStateProvider(): StateProvider
|
|
2271
2226
|
```
|
|
2272
2227
|
|
|
2273
|
-
**Returns:**
|
|
2228
|
+
**Returns:** The state provider from context
|
|
2274
2229
|
|
|
2275
|
-
#### `
|
|
2230
|
+
#### `useStore(store, options)`
|
|
2276
2231
|
|
|
2277
|
-
Hook
|
|
2232
|
+
Hook to subscribe to a store with optional selector and equality function.
|
|
2278
2233
|
|
|
2279
2234
|
```typescript
|
|
2280
|
-
function
|
|
2235
|
+
function useStore(store: Store<T>, options?: UseStoreOptions<T, S>): S
|
|
2281
2236
|
```
|
|
2282
2237
|
|
|
2283
|
-
- `
|
|
2284
|
-
- `options` —
|
|
2238
|
+
- `store` — The store to subscribe to
|
|
2239
|
+
- `options` — Hook options (selector, equalityFn)
|
|
2285
2240
|
|
|
2286
|
-
**Returns:**
|
|
2241
|
+
**Returns:** The selected state
|
|
2287
2242
|
|
|
2288
|
-
#### `
|
|
2243
|
+
#### `useSetStore(store)`
|
|
2289
2244
|
|
|
2290
|
-
Hook
|
|
2245
|
+
Hook to get the store's setState function.
|
|
2291
2246
|
|
|
2292
2247
|
```typescript
|
|
2293
|
-
function
|
|
2248
|
+
function useSetStore(store: Store<T>): (partial: Partial<T> | ((state: T) => Partial<T>)) => void
|
|
2294
2249
|
```
|
|
2295
2250
|
|
|
2296
|
-
|
|
2251
|
+
- `store` — The store to get setState from
|
|
2297
2252
|
|
|
2298
|
-
|
|
2253
|
+
**Returns:** The setState function
|
|
2299
2254
|
|
|
2300
|
-
|
|
2255
|
+
#### `useStoreAction(store, action)`
|
|
2256
|
+
|
|
2257
|
+
Hook to create a bound action for a store.
|
|
2301
2258
|
|
|
2302
2259
|
```typescript
|
|
2303
|
-
function
|
|
2260
|
+
function useStoreAction(
|
|
2261
|
+
store: Store<T>,
|
|
2262
|
+
action: (setState: Store<T>['setState'], getState: Store<T>['getState']) => (...args: Args) => R,
|
|
2263
|
+
): (...args: Args) => R
|
|
2304
2264
|
```
|
|
2305
2265
|
|
|
2306
|
-
|
|
2266
|
+
- `store` — The store to bind to
|
|
2267
|
+
- `action` — The action function that receives setState and getState
|
|
2307
2268
|
|
|
2308
|
-
|
|
2269
|
+
**Returns:** A bound action function
|
|
2309
2270
|
|
|
2310
|
-
|
|
2271
|
+
#### `useThemeProvider()`
|
|
2272
|
+
|
|
2273
|
+
Hook to access the theme provider from context.
|
|
2311
2274
|
|
|
2312
2275
|
```typescript
|
|
2313
|
-
function
|
|
2314
|
-
asyncFn: T,
|
|
2315
|
-
): [
|
|
2316
|
-
UsePromiseState<Awaited<ReturnType<T>>>,
|
|
2317
|
-
(...args: Parameters<T>) => Promise<Awaited<ReturnType<T>>>,
|
|
2318
|
-
]
|
|
2276
|
+
function useThemeProvider(): ThemeProvider
|
|
2319
2277
|
```
|
|
2320
2278
|
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
**Returns:** Tuple of [state, wrappedFunction]
|
|
2324
|
-
|
|
2325
|
-
#### `usePush(options)`
|
|
2279
|
+
**Returns:** The theme provider from context
|
|
2326
2280
|
|
|
2327
|
-
|
|
2281
|
+
#### `useTheme()`
|
|
2328
2282
|
|
|
2329
|
-
|
|
2283
|
+
Hook for theme state and actions.
|
|
2330
2284
|
|
|
2331
2285
|
```typescript
|
|
2332
|
-
function
|
|
2286
|
+
function useTheme(): UseThemeResult
|
|
2333
2287
|
```
|
|
2334
2288
|
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
**Returns:** Push notification state and action methods
|
|
2289
|
+
**Returns:** Theme state and actions
|
|
2338
2290
|
|
|
2339
|
-
#### `
|
|
2291
|
+
#### `useCurrentTheme()`
|
|
2340
2292
|
|
|
2341
|
-
Hook
|
|
2293
|
+
Hook to get just the current theme object.
|
|
2342
2294
|
|
|
2343
2295
|
```typescript
|
|
2344
|
-
function
|
|
2296
|
+
function useCurrentTheme(): Theme
|
|
2345
2297
|
```
|
|
2346
2298
|
|
|
2347
|
-
|
|
2348
|
-
- `options` — HTTP request options including body data and callbacks.
|
|
2349
|
-
|
|
2350
|
-
**Returns:** Request state (data, loading, error) and controls (execute, reset).
|
|
2299
|
+
**Returns:** The current theme
|
|
2351
2300
|
|
|
2352
|
-
#### `
|
|
2301
|
+
#### `useThemeMode()`
|
|
2353
2302
|
|
|
2354
|
-
Hook to get
|
|
2303
|
+
Hook to get just the theme mode (light/dark).
|
|
2355
2304
|
|
|
2356
2305
|
```typescript
|
|
2357
|
-
function
|
|
2306
|
+
function useThemeMode(): 'light' | 'dark'
|
|
2358
2307
|
```
|
|
2359
2308
|
|
|
2360
|
-
**Returns:** The current
|
|
2309
|
+
**Returns:** The current theme mode
|
|
2361
2310
|
|
|
2362
|
-
#### `
|
|
2311
|
+
#### `useThemeColors()`
|
|
2363
2312
|
|
|
2364
|
-
Hook to get
|
|
2313
|
+
Hook to get theme colors.
|
|
2365
2314
|
|
|
2366
2315
|
```typescript
|
|
2367
|
-
function
|
|
2316
|
+
function useThemeColors(): ThemeColors
|
|
2368
2317
|
```
|
|
2369
2318
|
|
|
2370
|
-
**Returns:**
|
|
2319
|
+
**Returns:** The current theme colors
|
|
2371
2320
|
|
|
2372
|
-
#### `
|
|
2321
|
+
#### `useI18nProvider()`
|
|
2373
2322
|
|
|
2374
|
-
Hook
|
|
2323
|
+
Hook to access the i18n provider from context.
|
|
2375
2324
|
|
|
2376
2325
|
```typescript
|
|
2377
|
-
function
|
|
2326
|
+
function useI18nProvider(): I18nProvider
|
|
2378
2327
|
```
|
|
2379
2328
|
|
|
2380
|
-
**Returns:**
|
|
2329
|
+
**Returns:** The i18n provider from context
|
|
2381
2330
|
|
|
2382
|
-
#### `
|
|
2331
|
+
#### `useTranslation()`
|
|
2383
2332
|
|
|
2384
|
-
Hook
|
|
2333
|
+
Hook for internationalization.
|
|
2385
2334
|
|
|
2386
2335
|
```typescript
|
|
2387
|
-
function
|
|
2336
|
+
function useTranslation(): UseTranslationResult
|
|
2388
2337
|
```
|
|
2389
2338
|
|
|
2390
|
-
**Returns:**
|
|
2339
|
+
**Returns:** Translation function and locale management
|
|
2391
2340
|
|
|
2392
|
-
#### `
|
|
2341
|
+
#### `useT()`
|
|
2393
2342
|
|
|
2394
|
-
Hook to get the
|
|
2343
|
+
Hook to get just the translation function.
|
|
2395
2344
|
|
|
2396
2345
|
```typescript
|
|
2397
|
-
function
|
|
2346
|
+
function useT(): (
|
|
2347
|
+
key: string,
|
|
2348
|
+
values?: InterpolationValues,
|
|
2349
|
+
options?: { defaultValue?: string; count?: number },
|
|
2350
|
+
) => string
|
|
2398
2351
|
```
|
|
2399
2352
|
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
**Returns:** The setState function
|
|
2353
|
+
**Returns:** The translation function
|
|
2403
2354
|
|
|
2404
|
-
#### `
|
|
2355
|
+
#### `useLocale()`
|
|
2405
2356
|
|
|
2406
|
-
Hook
|
|
2357
|
+
Hook to get the current locale.
|
|
2407
2358
|
|
|
2408
2359
|
```typescript
|
|
2409
|
-
function
|
|
2360
|
+
function useLocale(): string
|
|
2410
2361
|
```
|
|
2411
2362
|
|
|
2412
|
-
**Returns:**
|
|
2363
|
+
**Returns:** The current locale code
|
|
2413
2364
|
|
|
2414
|
-
#### `
|
|
2365
|
+
#### `useDirection()`
|
|
2415
2366
|
|
|
2416
|
-
Hook to
|
|
2367
|
+
Hook to get the text direction.
|
|
2417
2368
|
|
|
2418
2369
|
```typescript
|
|
2419
|
-
function
|
|
2370
|
+
function useDirection(): 'ltr' | 'rtl'
|
|
2420
2371
|
```
|
|
2421
2372
|
|
|
2422
|
-
**Returns:** The
|
|
2373
|
+
**Returns:** The text direction ('ltr' or 'rtl')
|
|
2423
2374
|
|
|
2424
|
-
#### `
|
|
2375
|
+
#### `useI18nError(error)`
|
|
2425
2376
|
|
|
2426
|
-
|
|
2377
|
+
Translates an error at render time so the displayed message updates automatically
|
|
2378
|
+
when the locale changes.
|
|
2379
|
+
|
|
2380
|
+
**Always use this hook to display errors in React components** — accessing
|
|
2381
|
+
`error.message` directly bypasses re-translation and leaves stale text after a
|
|
2382
|
+
locale switch. If `error` is an `I18nError` (thrown via `throw new I18nError(key)`),
|
|
2383
|
+
its key is translated using the current locale. For plain `Error` instances,
|
|
2384
|
+
`error.message` is returned unchanged.
|
|
2427
2385
|
|
|
2428
2386
|
```typescript
|
|
2429
|
-
function
|
|
2430
|
-
get: <T>(key: string) => Promise<T | null>
|
|
2431
|
-
set: <T>(key: string, value: T) => Promise<void>
|
|
2432
|
-
remove: (key: string) => Promise<void>
|
|
2433
|
-
clear: () => Promise<void>
|
|
2434
|
-
keys: () => Promise<string[]>
|
|
2435
|
-
}
|
|
2387
|
+
function useI18nError(error: Error | null | undefined): string | null
|
|
2436
2388
|
```
|
|
2437
2389
|
|
|
2438
|
-
|
|
2390
|
+
- `error` — The error to translate, or `null`/`undefined`.
|
|
2439
2391
|
|
|
2440
|
-
|
|
2392
|
+
**Returns:** The translated error string, or `null` if no error.
|
|
2441
2393
|
|
|
2442
|
-
|
|
2394
|
+
#### `useVerifyPaymentReturn(options)`
|
|
2395
|
+
|
|
2396
|
+
Reads the payment id a provider put in the return URL and confirms the
|
|
2397
|
+
purchase server-side with `POST /users/:id/verify-payment/:provider`.
|
|
2398
|
+
|
|
2399
|
+
**This is why a hosted checkout returns the buyer to the APP and not the
|
|
2400
|
+
API.** Session cookies are host-only on the app's origin, so a top-level
|
|
2401
|
+
redirect from the provider straight to an authenticated API callback on a
|
|
2402
|
+
different host arrives with NO credentials — it answers 401 and the paid plan
|
|
2403
|
+
is never granted. The request this hook makes is a same-origin call from a
|
|
2404
|
+
loaded app page, so the credentials apply. It waits for auth to hydrate
|
|
2405
|
+
first: after the redirect the page is a cold load, and the session is
|
|
2406
|
+
restored from the httpOnly cookie via `GET /users/me`.
|
|
2407
|
+
|
|
2408
|
+
Verification is idempotent server-side (first-claim-wins on the transaction),
|
|
2409
|
+
and this hook additionally runs at most once per transaction id per page.
|
|
2410
|
+
Safe on pages that are also reached normally: with no id in the URL it stays
|
|
2411
|
+
`idle` and issues no request.
|
|
2443
2412
|
|
|
2444
2413
|
```typescript
|
|
2445
|
-
function
|
|
2414
|
+
function useVerifyPaymentReturn(
|
|
2415
|
+
options?: UseVerifyPaymentReturnOptions,
|
|
2416
|
+
): UseVerifyPaymentReturnResult
|
|
2446
2417
|
```
|
|
2447
2418
|
|
|
2448
|
-
|
|
2419
|
+
- `options` — Provider fallback + lifecycle callbacks (see {@link UseVerifyPaymentReturnOptions}).
|
|
2449
2420
|
|
|
2450
|
-
|
|
2421
|
+
**Returns:** The verification state (see {@link UseVerifyPaymentReturnResult}).
|
|
2451
2422
|
|
|
2452
|
-
|
|
2423
|
+
#### `useVersion()`
|
|
2424
|
+
|
|
2425
|
+
Hook for version state and update actions.
|
|
2426
|
+
|
|
2427
|
+
Uses module-level `getProvider()` — version is a singleton, not context-provided.
|
|
2453
2428
|
|
|
2454
2429
|
```typescript
|
|
2455
|
-
function
|
|
2430
|
+
function useVersion(): UseVersionResult
|
|
2456
2431
|
```
|
|
2457
2432
|
|
|
2458
|
-
|
|
2459
|
-
- `options` — Hook options
|
|
2460
|
-
|
|
2461
|
-
**Returns:** Storage value state (value, loading, error) and mutators (setValue, removeValue).
|
|
2433
|
+
**Returns:** Version state and action methods
|
|
2462
2434
|
|
|
2463
|
-
#### `
|
|
2435
|
+
#### `useWorkspaceProvider()`
|
|
2464
2436
|
|
|
2465
|
-
|
|
2437
|
+
Access the workspace provider from context.
|
|
2466
2438
|
|
|
2467
2439
|
```typescript
|
|
2468
|
-
function
|
|
2440
|
+
function useWorkspaceProvider(): WorkspaceProvider
|
|
2469
2441
|
```
|
|
2470
2442
|
|
|
2471
|
-
|
|
2472
|
-
- `options` — Hook options (selector, equalityFn)
|
|
2473
|
-
|
|
2474
|
-
**Returns:** The selected state
|
|
2443
|
+
**Returns:** The result.
|
|
2475
2444
|
|
|
2476
|
-
#### `
|
|
2445
|
+
#### `useWorkspace()`
|
|
2477
2446
|
|
|
2478
|
-
Hook
|
|
2447
|
+
Hook for IDE workspace layout management.
|
|
2479
2448
|
|
|
2480
2449
|
```typescript
|
|
2481
|
-
function
|
|
2482
|
-
store: Store<T>,
|
|
2483
|
-
action: (setState: Store<T>['setState'], getState: Store<T>['getState']) => (...args: Args) => R,
|
|
2484
|
-
): (...args: Args) => R
|
|
2450
|
+
function useWorkspace(): UseWorkspaceResult
|
|
2485
2451
|
```
|
|
2486
2452
|
|
|
2487
|
-
|
|
2488
|
-
- `action` — The action function that receives setState and getState
|
|
2489
|
-
|
|
2490
|
-
**Returns:** A bound action function
|
|
2453
|
+
**Returns:** The workspace state and management methods.
|
|
2491
2454
|
|
|
2492
|
-
#### `
|
|
2455
|
+
#### `StateProvider(props)`
|
|
2493
2456
|
|
|
2494
|
-
|
|
2457
|
+
Provider for state management.
|
|
2495
2458
|
|
|
2496
2459
|
```typescript
|
|
2497
|
-
function
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
) => string
|
|
2460
|
+
function StateProvider({
|
|
2461
|
+
provider,
|
|
2462
|
+
children,
|
|
2463
|
+
}: StateProviderProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>
|
|
2502
2464
|
```
|
|
2503
2465
|
|
|
2504
|
-
|
|
2466
|
+
- `props` — Component props (see {@link StateProviderProps}).
|
|
2505
2467
|
|
|
2506
|
-
|
|
2468
|
+
**Returns:** The rendered state provider element.
|
|
2507
2469
|
|
|
2508
|
-
|
|
2470
|
+
#### `AuthProvider(props)`
|
|
2471
|
+
|
|
2472
|
+
Provider for authentication.
|
|
2509
2473
|
|
|
2510
2474
|
```typescript
|
|
2511
|
-
function
|
|
2475
|
+
function AuthProvider({
|
|
2476
|
+
client,
|
|
2477
|
+
children,
|
|
2478
|
+
}: AuthProviderProps<T>): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>
|
|
2512
2479
|
```
|
|
2513
2480
|
|
|
2514
|
-
|
|
2481
|
+
- `props` — Component props (see {@link AuthProviderProps}).
|
|
2482
|
+
|
|
2483
|
+
**Returns:** The rendered auth provider element.
|
|
2515
2484
|
|
|
2516
|
-
#### `
|
|
2485
|
+
#### `ThemeProvider(props)`
|
|
2517
2486
|
|
|
2518
|
-
|
|
2487
|
+
Provider for theming.
|
|
2519
2488
|
|
|
2520
2489
|
```typescript
|
|
2521
|
-
function
|
|
2490
|
+
function ThemeProvider({
|
|
2491
|
+
provider,
|
|
2492
|
+
children,
|
|
2493
|
+
}: ThemeProviderProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>
|
|
2522
2494
|
```
|
|
2523
2495
|
|
|
2524
|
-
|
|
2496
|
+
- `props` — Component props (see {@link ThemeProviderProps}).
|
|
2525
2497
|
|
|
2526
|
-
|
|
2498
|
+
**Returns:** The rendered theme provider element.
|
|
2527
2499
|
|
|
2528
|
-
|
|
2500
|
+
#### `RouterProvider(props)`
|
|
2501
|
+
|
|
2502
|
+
Provider for routing.
|
|
2529
2503
|
|
|
2530
2504
|
```typescript
|
|
2531
|
-
function
|
|
2505
|
+
function RouterProvider({
|
|
2506
|
+
router,
|
|
2507
|
+
children,
|
|
2508
|
+
}: RouterProviderProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>
|
|
2532
2509
|
```
|
|
2533
2510
|
|
|
2534
|
-
|
|
2511
|
+
- `props` — Component props (see {@link RouterProviderProps}).
|
|
2535
2512
|
|
|
2536
|
-
|
|
2513
|
+
**Returns:** The rendered router provider element.
|
|
2537
2514
|
|
|
2538
|
-
|
|
2515
|
+
#### `I18nProvider(props)`
|
|
2516
|
+
|
|
2517
|
+
Provider for internationalization.
|
|
2539
2518
|
|
|
2540
2519
|
```typescript
|
|
2541
|
-
function
|
|
2520
|
+
function I18nProvider({
|
|
2521
|
+
provider,
|
|
2522
|
+
children,
|
|
2523
|
+
}: I18nProviderProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>
|
|
2542
2524
|
```
|
|
2543
2525
|
|
|
2544
|
-
|
|
2526
|
+
- `props` — Component props (see {@link I18nProviderProps}).
|
|
2545
2527
|
|
|
2546
|
-
|
|
2528
|
+
**Returns:** The rendered i18n provider element.
|
|
2547
2529
|
|
|
2548
|
-
|
|
2530
|
+
#### `HttpProvider(props)`
|
|
2531
|
+
|
|
2532
|
+
Provider for HTTP client.
|
|
2549
2533
|
|
|
2550
2534
|
```typescript
|
|
2551
|
-
function
|
|
2535
|
+
function HttpProvider({
|
|
2536
|
+
client,
|
|
2537
|
+
children,
|
|
2538
|
+
}: HttpProviderProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>
|
|
2552
2539
|
```
|
|
2553
2540
|
|
|
2554
|
-
|
|
2541
|
+
- `props` — Component props (see {@link HttpProviderProps}).
|
|
2555
2542
|
|
|
2556
|
-
|
|
2543
|
+
**Returns:** The rendered HTTP provider element.
|
|
2557
2544
|
|
|
2558
|
-
|
|
2545
|
+
#### `StorageProvider(props)`
|
|
2546
|
+
|
|
2547
|
+
Provider for storage.
|
|
2559
2548
|
|
|
2560
2549
|
```typescript
|
|
2561
|
-
function
|
|
2550
|
+
function StorageProvider({
|
|
2551
|
+
provider,
|
|
2552
|
+
children,
|
|
2553
|
+
}: StorageProviderProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>
|
|
2562
2554
|
```
|
|
2563
2555
|
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
#### `useVerifyPaymentReturn(options)`
|
|
2556
|
+
- `props` — Component props (see {@link StorageProviderProps}).
|
|
2567
2557
|
|
|
2568
|
-
|
|
2569
|
-
purchase server-side with `POST /users/:id/verify-payment/:provider`.
|
|
2558
|
+
**Returns:** The rendered storage provider element.
|
|
2570
2559
|
|
|
2571
|
-
|
|
2572
|
-
API.** Session cookies are host-only on the app's origin, so a top-level
|
|
2573
|
-
redirect from the provider straight to an authenticated API callback on a
|
|
2574
|
-
different host arrives with NO credentials — it answers 401 and the paid plan
|
|
2575
|
-
is never granted. The request this hook makes is a same-origin call from a
|
|
2576
|
-
loaded app page, so the credentials apply. It waits for auth to hydrate
|
|
2577
|
-
first: after the redirect the page is a cold load, and the session is
|
|
2578
|
-
restored from the httpOnly cookie via `GET /users/me`.
|
|
2560
|
+
#### `LoggerProvider(props)`
|
|
2579
2561
|
|
|
2580
|
-
|
|
2581
|
-
and this hook additionally runs at most once per transaction id per page.
|
|
2582
|
-
Safe on pages that are also reached normally: with no id in the URL it stays
|
|
2583
|
-
`idle` and issues no request.
|
|
2562
|
+
Provider for logging.
|
|
2584
2563
|
|
|
2585
2564
|
```typescript
|
|
2586
|
-
function
|
|
2587
|
-
|
|
2588
|
-
|
|
2565
|
+
function LoggerProvider({
|
|
2566
|
+
provider,
|
|
2567
|
+
children,
|
|
2568
|
+
}: LoggerProviderProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>
|
|
2589
2569
|
```
|
|
2590
2570
|
|
|
2591
|
-
- `
|
|
2592
|
-
|
|
2593
|
-
**Returns:** The verification state (see {@link UseVerifyPaymentReturnResult}).
|
|
2571
|
+
- `props` — Component props (see {@link LoggerProviderProps}).
|
|
2594
2572
|
|
|
2595
|
-
|
|
2573
|
+
**Returns:** The rendered logger provider element.
|
|
2596
2574
|
|
|
2597
|
-
|
|
2575
|
+
#### `ChatProvider(props)`
|
|
2598
2576
|
|
|
2599
|
-
|
|
2577
|
+
Provider for AI chat.
|
|
2600
2578
|
|
|
2601
2579
|
```typescript
|
|
2602
|
-
function
|
|
2580
|
+
function ChatProvider({
|
|
2581
|
+
provider,
|
|
2582
|
+
children,
|
|
2583
|
+
}: ChatProviderProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>
|
|
2603
2584
|
```
|
|
2604
2585
|
|
|
2605
|
-
|
|
2586
|
+
- `props` — Component props (see {@link ChatProviderProps}).
|
|
2606
2587
|
|
|
2607
|
-
|
|
2588
|
+
**Returns:** The rendered chat provider element.
|
|
2608
2589
|
|
|
2609
|
-
|
|
2590
|
+
#### `WorkspaceProvider(props)`
|
|
2591
|
+
|
|
2592
|
+
Provider for IDE workspace.
|
|
2610
2593
|
|
|
2611
2594
|
```typescript
|
|
2612
|
-
function
|
|
2595
|
+
function WorkspaceProvider({
|
|
2596
|
+
provider,
|
|
2597
|
+
children,
|
|
2598
|
+
}: WorkspaceProviderProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>
|
|
2613
2599
|
```
|
|
2614
2600
|
|
|
2615
|
-
- `
|
|
2616
|
-
- `name` — Field name to watch
|
|
2601
|
+
- `props` — Component props (see {@link WorkspaceProviderProps}).
|
|
2617
2602
|
|
|
2618
|
-
**Returns:**
|
|
2603
|
+
**Returns:** The rendered workspace provider element.
|
|
2619
2604
|
|
|
2620
|
-
#### `
|
|
2605
|
+
#### `EditorProvider(props)`
|
|
2621
2606
|
|
|
2622
|
-
|
|
2607
|
+
Provider for code editor.
|
|
2623
2608
|
|
|
2624
2609
|
```typescript
|
|
2625
|
-
function
|
|
2610
|
+
function EditorProvider({
|
|
2611
|
+
provider,
|
|
2612
|
+
children,
|
|
2613
|
+
}: EditorProviderProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>
|
|
2626
2614
|
```
|
|
2627
2615
|
|
|
2628
|
-
|
|
2616
|
+
- `props` — Component props (see {@link EditorProviderProps}).
|
|
2629
2617
|
|
|
2630
|
-
|
|
2618
|
+
**Returns:** The rendered editor provider element.
|
|
2631
2619
|
|
|
2632
|
-
|
|
2620
|
+
#### `PreviewProvider(props)`
|
|
2621
|
+
|
|
2622
|
+
Provider for live preview.
|
|
2633
2623
|
|
|
2634
2624
|
```typescript
|
|
2635
|
-
function
|
|
2625
|
+
function PreviewProvider({
|
|
2626
|
+
provider,
|
|
2627
|
+
children,
|
|
2628
|
+
}: PreviewProviderProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>
|
|
2636
2629
|
```
|
|
2637
2630
|
|
|
2638
|
-
|
|
2631
|
+
- `props` — Component props (see {@link PreviewProviderProps}).
|
|
2639
2632
|
|
|
2640
|
-
|
|
2633
|
+
**Returns:** The rendered preview provider element.
|
|
2641
2634
|
|
|
2642
|
-
|
|
2635
|
+
#### `MoleculeProvider(props)`
|
|
2636
|
+
|
|
2637
|
+
Combined provider for all molecule services.
|
|
2638
|
+
|
|
2639
|
+
Provides a convenient way to wrap your app with all molecule providers at once.
|
|
2640
|
+
Only providers that are passed will be included.
|
|
2643
2641
|
|
|
2644
2642
|
```typescript
|
|
2645
|
-
function
|
|
2646
|
-
provider,
|
|
2643
|
+
function MoleculeProvider({
|
|
2647
2644
|
children,
|
|
2648
|
-
|
|
2645
|
+
state,
|
|
2646
|
+
auth,
|
|
2647
|
+
theme,
|
|
2648
|
+
router,
|
|
2649
|
+
i18n,
|
|
2650
|
+
http,
|
|
2651
|
+
storage,
|
|
2652
|
+
logger,
|
|
2653
|
+
chat,
|
|
2654
|
+
workspace,
|
|
2655
|
+
editor,
|
|
2656
|
+
preview,
|
|
2657
|
+
}: MoleculeProviderProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>
|
|
2649
2658
|
```
|
|
2650
2659
|
|
|
2651
|
-
- `props` — Component props (see {@link
|
|
2660
|
+
- `props` — Component props (see {@link MoleculeProviderProps}) — each service is optional, and ONLY the services passed are provided to the tree.
|
|
2652
2661
|
|
|
2653
|
-
**Returns:** The rendered
|
|
2662
|
+
**Returns:** The rendered combined provider element.
|
|
2654
2663
|
|
|
2655
2664
|
### Constants
|
|
2656
2665
|
|
|
2657
|
-
#### `
|
|
2666
|
+
#### `DEFAULT_AGENT_NAME`
|
|
2658
2667
|
|
|
2659
|
-
|
|
2668
|
+
Neutral, product-agnostic agent name used when the host supplies none.
|
|
2660
2669
|
|
|
2661
2670
|
```typescript
|
|
2662
|
-
const
|
|
2671
|
+
const DEFAULT_AGENT_NAME: 'the assistant'
|
|
2663
2672
|
```
|
|
2664
2673
|
|
|
2665
|
-
#### `
|
|
2674
|
+
#### `DEFAULT_PRODUCT_NAME`
|
|
2666
2675
|
|
|
2667
|
-
|
|
2676
|
+
Neutral, product-agnostic product/IDE name used when the host supplies none.
|
|
2668
2677
|
|
|
2669
2678
|
```typescript
|
|
2670
|
-
const
|
|
2679
|
+
const DEFAULT_PRODUCT_NAME: 'the IDE'
|
|
2671
2680
|
```
|
|
2672
2681
|
|
|
2673
2682
|
#### `DEFAULT_AGENT_IDENTITY`
|
|
@@ -2680,36 +2689,36 @@ passes its own.
|
|
|
2680
2689
|
const DEFAULT_AGENT_IDENTITY: AgentIdentity
|
|
2681
2690
|
```
|
|
2682
2691
|
|
|
2683
|
-
#### `
|
|
2692
|
+
#### `StateContext`
|
|
2684
2693
|
|
|
2685
|
-
|
|
2694
|
+
Context for state management provider.
|
|
2686
2695
|
|
|
2687
2696
|
```typescript
|
|
2688
|
-
const
|
|
2697
|
+
const StateContext: Context<StateProvider | null>
|
|
2689
2698
|
```
|
|
2690
2699
|
|
|
2691
|
-
#### `
|
|
2700
|
+
#### `AuthContext`
|
|
2692
2701
|
|
|
2693
|
-
|
|
2702
|
+
Context for authentication client.
|
|
2694
2703
|
|
|
2695
2704
|
```typescript
|
|
2696
|
-
const
|
|
2705
|
+
const AuthContext: Context<AuthClient<unknown> | null>
|
|
2697
2706
|
```
|
|
2698
2707
|
|
|
2699
|
-
#### `
|
|
2708
|
+
#### `ThemeContext`
|
|
2700
2709
|
|
|
2701
|
-
Context for
|
|
2710
|
+
Context for theme provider.
|
|
2702
2711
|
|
|
2703
2712
|
```typescript
|
|
2704
|
-
const
|
|
2713
|
+
const ThemeContext: Context<ThemeProvider | null>
|
|
2705
2714
|
```
|
|
2706
2715
|
|
|
2707
|
-
#### `
|
|
2716
|
+
#### `RouterContext`
|
|
2708
2717
|
|
|
2709
|
-
Context for
|
|
2718
|
+
Context for router.
|
|
2710
2719
|
|
|
2711
2720
|
```typescript
|
|
2712
|
-
const
|
|
2721
|
+
const RouterContext: Context<Router | null>
|
|
2713
2722
|
```
|
|
2714
2723
|
|
|
2715
2724
|
#### `I18nContext`
|
|
@@ -2720,60 +2729,60 @@ Context for internationalization provider.
|
|
|
2720
2729
|
const I18nContext: Context<I18nProvider | null>
|
|
2721
2730
|
```
|
|
2722
2731
|
|
|
2723
|
-
#### `
|
|
2732
|
+
#### `HttpContext`
|
|
2724
2733
|
|
|
2725
|
-
Context for
|
|
2734
|
+
Context for HTTP client.
|
|
2726
2735
|
|
|
2727
2736
|
```typescript
|
|
2728
|
-
const
|
|
2737
|
+
const HttpContext: Context<HttpClient | null>
|
|
2729
2738
|
```
|
|
2730
2739
|
|
|
2731
|
-
#### `
|
|
2740
|
+
#### `StorageContext`
|
|
2732
2741
|
|
|
2733
|
-
Context for
|
|
2742
|
+
Context for storage provider.
|
|
2734
2743
|
|
|
2735
2744
|
```typescript
|
|
2736
|
-
const
|
|
2745
|
+
const StorageContext: Context<StorageProvider | null>
|
|
2737
2746
|
```
|
|
2738
2747
|
|
|
2739
|
-
#### `
|
|
2748
|
+
#### `LoggerContext`
|
|
2740
2749
|
|
|
2741
|
-
Context for
|
|
2750
|
+
Context for logger provider.
|
|
2742
2751
|
|
|
2743
2752
|
```typescript
|
|
2744
|
-
const
|
|
2753
|
+
const LoggerContext: Context<LoggerProvider | null>
|
|
2745
2754
|
```
|
|
2746
2755
|
|
|
2747
|
-
#### `
|
|
2756
|
+
#### `ChatContext`
|
|
2748
2757
|
|
|
2749
|
-
Context for
|
|
2758
|
+
Context for AI chat provider.
|
|
2750
2759
|
|
|
2751
2760
|
```typescript
|
|
2752
|
-
const
|
|
2761
|
+
const ChatContext: Context<ChatProvider | null>
|
|
2753
2762
|
```
|
|
2754
2763
|
|
|
2755
|
-
#### `
|
|
2764
|
+
#### `WorkspaceContext`
|
|
2756
2765
|
|
|
2757
|
-
Context for
|
|
2766
|
+
Context for IDE workspace provider.
|
|
2758
2767
|
|
|
2759
2768
|
```typescript
|
|
2760
|
-
const
|
|
2769
|
+
const WorkspaceContext: Context<WorkspaceProvider | null>
|
|
2761
2770
|
```
|
|
2762
2771
|
|
|
2763
|
-
#### `
|
|
2772
|
+
#### `EditorContext`
|
|
2764
2773
|
|
|
2765
|
-
Context for
|
|
2774
|
+
Context for code editor provider.
|
|
2766
2775
|
|
|
2767
2776
|
```typescript
|
|
2768
|
-
const
|
|
2777
|
+
const EditorContext: Context<EditorProvider | null>
|
|
2769
2778
|
```
|
|
2770
2779
|
|
|
2771
|
-
#### `
|
|
2780
|
+
#### `PreviewContext`
|
|
2772
2781
|
|
|
2773
|
-
Context for
|
|
2782
|
+
Context for live preview provider.
|
|
2774
2783
|
|
|
2775
2784
|
```typescript
|
|
2776
|
-
const
|
|
2785
|
+
const PreviewContext: Context<PreviewProvider | null>
|
|
2777
2786
|
```
|
|
2778
2787
|
|
|
2779
2788
|
## Injection Notes
|