@wippy-fe/types-global-proxy 0.0.16 → 0.0.18
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 +39 -0
- package/index.d.ts +351 -274
- package/package.json +2 -1
package/README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# @wippy-fe/types-global-proxy
|
|
2
|
+
|
|
3
|
+
TypeScript ambient declarations for the Wippy iframe proxy globals.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -D @wippy-fe/types-global-proxy
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## What it declares
|
|
12
|
+
|
|
13
|
+
- `window.getWippyApi()` — returns `Promise<ProxyApiInstance>`
|
|
14
|
+
- `window.$W.*` — lazy async accessors for `config`, `api`, `host`, `on`, `state`, `ws`, `loadWebComponent`
|
|
15
|
+
- `window.__WIPPY_APP_CONFIG__` — `AppConfig`
|
|
16
|
+
- `window.__WIPPY_APP_API__` — `ProxyApiInstance`
|
|
17
|
+
- `window.__WIPPY_PROXY_CONFIG__` — `ProxyConfig`
|
|
18
|
+
|
|
19
|
+
## Exported types
|
|
20
|
+
|
|
21
|
+
`ProxyApiInstance`, `AppConfig`, `AppFeatures`, `AppCustomization`, `StateApi`, `ProxyWsApi`, `WsMessage`, `WsCommand`, `Artifact`, `PageApi`, `UploadApi`, `ApiRoutes`, and all WebSocket message/topic types.
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
Add to your `tsconfig.json`:
|
|
26
|
+
|
|
27
|
+
```json
|
|
28
|
+
{
|
|
29
|
+
"compilerOptions": {
|
|
30
|
+
"types": ["@wippy-fe/types-global-proxy"]
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Or use a triple-slash reference:
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
/// <reference types="@wippy-fe/types-global-proxy" />
|
|
39
|
+
```
|
package/index.d.ts
CHANGED
|
@@ -4,6 +4,284 @@ import { ConfirmationOptions } from 'primevue/confirmationoptions';
|
|
|
4
4
|
import { ToastMessageOptions } from 'primevue/toast';
|
|
5
5
|
import * as tailwindcss_types_config from 'tailwindcss/types/config';
|
|
6
6
|
|
|
7
|
+
var chat = {
|
|
8
|
+
emptyState: {
|
|
9
|
+
title: "No chat session selected",
|
|
10
|
+
description: "Please select a session from the dropdown above or start a new conversation.",
|
|
11
|
+
goToHome: "Go to Home Page",
|
|
12
|
+
loadingAgents: "Loading agents...",
|
|
13
|
+
selectAgent: "Select Agent",
|
|
14
|
+
startChat: "Start Chat",
|
|
15
|
+
startChatError: "Failed to start chat",
|
|
16
|
+
noAgents: "No agents available. Please contact your administrator.",
|
|
17
|
+
dropFiles: "Drop files here to upload"
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
var customPage = {
|
|
21
|
+
loading: {
|
|
22
|
+
title: "Loading page content..."
|
|
23
|
+
},
|
|
24
|
+
error: {
|
|
25
|
+
title: "Failed to load page content"
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
var home = {
|
|
29
|
+
loading: "Application is Loading",
|
|
30
|
+
error: {
|
|
31
|
+
title: "Error Loading Application"
|
|
32
|
+
},
|
|
33
|
+
noHomePage: {
|
|
34
|
+
title: "No Home Page Detected",
|
|
35
|
+
message: "Probably backend configuration is malformed"
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var app = {
|
|
39
|
+
title: "Wippy App",
|
|
40
|
+
appName: "Wippy",
|
|
41
|
+
icon: "wippy:logo"
|
|
42
|
+
};
|
|
43
|
+
var login = {
|
|
44
|
+
error: {
|
|
45
|
+
title: "Session Token Expired",
|
|
46
|
+
description: "Your session has expired or is no longer valid. Please close this window and log in again to continue."
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var logout = {
|
|
50
|
+
title: "Logout",
|
|
51
|
+
description: "Logging out..."
|
|
52
|
+
};
|
|
53
|
+
var keeper = {
|
|
54
|
+
controls: {
|
|
55
|
+
newChat: "New Chat",
|
|
56
|
+
searchAgents: "Search agents...",
|
|
57
|
+
undo: "Undo",
|
|
58
|
+
redo: "Redo",
|
|
59
|
+
download: "Registry To File System",
|
|
60
|
+
upload: "File System To Registry",
|
|
61
|
+
codeAssistant: "Wippy Code Assistant",
|
|
62
|
+
syncControls: "Sync Controls",
|
|
63
|
+
confirmUpload: {
|
|
64
|
+
title: "Confirm Upload",
|
|
65
|
+
message: "Do you wish to upload file system changes to registry? This will overwrite current state",
|
|
66
|
+
cancel: "Cancel",
|
|
67
|
+
upload: "Upload",
|
|
68
|
+
cancelled: {
|
|
69
|
+
title: "Upload cancelled",
|
|
70
|
+
message: "The upload operation was cancelled"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
version: {
|
|
75
|
+
label: "Version:",
|
|
76
|
+
tooltip: "Version {{version}}"
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
var textRS = {
|
|
80
|
+
chat: chat,
|
|
81
|
+
customPage: customPage,
|
|
82
|
+
home: home,
|
|
83
|
+
app: app,
|
|
84
|
+
login: login,
|
|
85
|
+
logout: logout,
|
|
86
|
+
keeper: keeper
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
type I18NTextTypes = typeof textRS;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* All API route templates, grouped by domain.
|
|
93
|
+
* Dynamic path segments use `{paramName}` placeholders (OpenAPI-style).
|
|
94
|
+
* Each leaf value is a flat, fully-formed route — no concatenation needed at call site.
|
|
95
|
+
*
|
|
96
|
+
* Internally, routes use `@/…` shorthand that resolves against the group's `@prefix`.
|
|
97
|
+
* Resolution happens once inside `getApiRoutes()`, so consumers always receive clean strings.
|
|
98
|
+
*
|
|
99
|
+
* Base URL resolution:
|
|
100
|
+
* - HTTP routes: `getEnv().APP_API_URL` + route (handled by axios baseURL)
|
|
101
|
+
* - WebSocket: `getEnv().APP_WEBSOCKET_URL` + `getApiRoutes().ws.join` (composed in ws/client.ts)
|
|
102
|
+
*/
|
|
103
|
+
interface ApiRoutes {
|
|
104
|
+
agents: {
|
|
105
|
+
list: string;
|
|
106
|
+
details: string;
|
|
107
|
+
byName: string;
|
|
108
|
+
};
|
|
109
|
+
sessions: {
|
|
110
|
+
list: string;
|
|
111
|
+
get: string;
|
|
112
|
+
messages: string;
|
|
113
|
+
};
|
|
114
|
+
models: {
|
|
115
|
+
list: string;
|
|
116
|
+
byName: string;
|
|
117
|
+
};
|
|
118
|
+
uploads: {
|
|
119
|
+
list: string;
|
|
120
|
+
get: string;
|
|
121
|
+
create: string;
|
|
122
|
+
};
|
|
123
|
+
artifacts: {
|
|
124
|
+
get: string;
|
|
125
|
+
content: string;
|
|
126
|
+
state: string;
|
|
127
|
+
baseUrl: string;
|
|
128
|
+
};
|
|
129
|
+
pages: {
|
|
130
|
+
list: string;
|
|
131
|
+
get: string;
|
|
132
|
+
content: string;
|
|
133
|
+
baseUrl: string;
|
|
134
|
+
};
|
|
135
|
+
registry: {
|
|
136
|
+
namespaces: string;
|
|
137
|
+
entries: string;
|
|
138
|
+
entry: string;
|
|
139
|
+
entryCreate: string;
|
|
140
|
+
entryEditors: string;
|
|
141
|
+
versions: string;
|
|
142
|
+
versionApply: string;
|
|
143
|
+
};
|
|
144
|
+
keeperSync: {
|
|
145
|
+
state: string;
|
|
146
|
+
download: string;
|
|
147
|
+
upload: string;
|
|
148
|
+
undo: string;
|
|
149
|
+
redo: string;
|
|
150
|
+
};
|
|
151
|
+
components: {
|
|
152
|
+
list: string;
|
|
153
|
+
};
|
|
154
|
+
tools: {
|
|
155
|
+
byName: string;
|
|
156
|
+
};
|
|
157
|
+
ws: {
|
|
158
|
+
join: string;
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Override type for `AppConfig.feature.apiRoutes`.
|
|
163
|
+
*
|
|
164
|
+
* Each group is optional and partially overridable.
|
|
165
|
+
* Set `@prefix` to rebase all `@/…` routes in that group at once,
|
|
166
|
+
* or override individual routes with absolute paths.
|
|
167
|
+
*/
|
|
168
|
+
type ApiRoutesOverride = {
|
|
169
|
+
[K in keyof ApiRoutes]?: Partial<ApiRoutes[K]> & {
|
|
170
|
+
'@prefix'?: string;
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
interface IconDef {
|
|
175
|
+
body: string;
|
|
176
|
+
width: number;
|
|
177
|
+
height: number;
|
|
178
|
+
}
|
|
179
|
+
interface CssVariablesMap {
|
|
180
|
+
[key: string]: string | Record<string, string> | undefined;
|
|
181
|
+
'@dark'?: Record<string, string>;
|
|
182
|
+
'@light'?: Record<string, string>;
|
|
183
|
+
}
|
|
184
|
+
interface AppAuthConfig {
|
|
185
|
+
token: string;
|
|
186
|
+
expiresAt: string;
|
|
187
|
+
}
|
|
188
|
+
interface ThemingScope {
|
|
189
|
+
cssVariables?: CssVariablesMap;
|
|
190
|
+
customCSS?: string;
|
|
191
|
+
/** @deprecated Use `iconSets` instead */
|
|
192
|
+
icons?: Record<string, IconDef>;
|
|
193
|
+
/** Named icon collections. Each key is an Iconify prefix. */
|
|
194
|
+
iconSets?: Record<string, Record<string, IconDef>>;
|
|
195
|
+
}
|
|
196
|
+
interface HostThemingScope extends ThemingScope {
|
|
197
|
+
i18n?: Partial<I18NTextTypes>;
|
|
198
|
+
}
|
|
199
|
+
interface ChildrenThemingScope {
|
|
200
|
+
cssVariables?: CssVariablesMap;
|
|
201
|
+
customCSS?: string;
|
|
202
|
+
}
|
|
203
|
+
interface AppCustomization {
|
|
204
|
+
customCSS?: string;
|
|
205
|
+
cssVariables?: CssVariablesMap;
|
|
206
|
+
i18n?: Partial<I18NTextTypes>;
|
|
207
|
+
/** @deprecated Use `iconSets` instead. Icons registered under the 'custom' prefix. */
|
|
208
|
+
icons?: Record<string, IconDef>;
|
|
209
|
+
/** Named icon collections. Each key is an Iconify prefix, value is a map of icon name → definition. */
|
|
210
|
+
iconSets?: Record<string, Record<string, IconDef>>;
|
|
211
|
+
}
|
|
212
|
+
interface HostConfig {
|
|
213
|
+
showAdmin?: boolean;
|
|
214
|
+
allowSelectModel?: boolean;
|
|
215
|
+
startNavOpen?: boolean;
|
|
216
|
+
hideNavBar?: boolean;
|
|
217
|
+
disableRightPanel?: boolean;
|
|
218
|
+
hideSessionSelector?: boolean;
|
|
219
|
+
additionalNavItems?: Array<PageApi.Page>;
|
|
220
|
+
chat?: {
|
|
221
|
+
convertPasteToFile?: {
|
|
222
|
+
enabled: boolean;
|
|
223
|
+
minFileSize: number;
|
|
224
|
+
allowHtml: boolean;
|
|
225
|
+
};
|
|
226
|
+
};
|
|
227
|
+
apiRoutes?: ApiRoutesOverride;
|
|
228
|
+
stateCache?: {
|
|
229
|
+
maxPages?: number;
|
|
230
|
+
maxSizePerPage?: number;
|
|
231
|
+
};
|
|
232
|
+
allowAdditionalTags?: Record<string, string[]>;
|
|
233
|
+
session?: {
|
|
234
|
+
type: 'non-persistent' | 'cookie';
|
|
235
|
+
};
|
|
236
|
+
history?: 'browser' | 'hash';
|
|
237
|
+
}
|
|
238
|
+
interface AppContext {
|
|
239
|
+
resourceId: string;
|
|
240
|
+
resourceType: 'page' | 'artifact';
|
|
241
|
+
route?: string;
|
|
242
|
+
parentResourceId?: string;
|
|
243
|
+
nestingDepth?: number;
|
|
244
|
+
layoutPanelId?: string;
|
|
245
|
+
layoutId?: string;
|
|
246
|
+
extensions?: Record<string, unknown>;
|
|
247
|
+
}
|
|
248
|
+
interface AppEnv {
|
|
249
|
+
APP_API_URL: string;
|
|
250
|
+
APP_AUTH_API_URL: string;
|
|
251
|
+
APP_WEBSOCKET_URL: string;
|
|
252
|
+
}
|
|
253
|
+
interface AppConfig {
|
|
254
|
+
$schema: string;
|
|
255
|
+
auth: AppAuthConfig;
|
|
256
|
+
env: AppEnv;
|
|
257
|
+
axiosDefaults?: Partial<AxiosDefaults>;
|
|
258
|
+
routePrefix?: string;
|
|
259
|
+
theming: {
|
|
260
|
+
global?: ThemingScope;
|
|
261
|
+
host?: HostThemingScope;
|
|
262
|
+
children?: ChildrenThemingScope;
|
|
263
|
+
};
|
|
264
|
+
hostConfig: HostConfig;
|
|
265
|
+
context: AppContext;
|
|
266
|
+
}
|
|
267
|
+
interface ChildAppConfig {
|
|
268
|
+
$schema: string;
|
|
269
|
+
auth: AppAuthConfig;
|
|
270
|
+
env: AppEnv;
|
|
271
|
+
axiosDefaults?: Partial<AxiosDefaults>;
|
|
272
|
+
routePrefix?: string;
|
|
273
|
+
apiRoutes?: ApiRoutesOverride;
|
|
274
|
+
customization: AppCustomization;
|
|
275
|
+
context: AppContext;
|
|
276
|
+
configOverrides?: AppConfigOverrides;
|
|
277
|
+
}
|
|
278
|
+
interface AppConfigOverrides {
|
|
279
|
+
customization?: Partial<AppCustomization>;
|
|
280
|
+
axiosDefaults?: Partial<AxiosDefaults>;
|
|
281
|
+
routePrefix?: string;
|
|
282
|
+
apiRoutes?: ApiRoutesOverride;
|
|
283
|
+
}
|
|
284
|
+
|
|
7
285
|
declare namespace PageApi {
|
|
8
286
|
interface Page {
|
|
9
287
|
icon: string;
|
|
@@ -23,6 +301,8 @@ declare namespace PageApi {
|
|
|
23
301
|
content_version?: string;
|
|
24
302
|
/** The content of the page artifact, which can be HTML, Markdown, or JSON with wippy specific package.json info */
|
|
25
303
|
content_type?: 'text/html' | 'text/markdown' | 'application/json';
|
|
304
|
+
/** Per-page config overrides — merged into AppConfig before CSS injection. Populated from registry entry config_overrides. */
|
|
305
|
+
configOverrides?: AppConfigOverrides;
|
|
26
306
|
}
|
|
27
307
|
interface PagesResponse {
|
|
28
308
|
count: number;
|
|
@@ -402,6 +682,57 @@ interface WsMessage_Upload extends WsMessageBase {
|
|
|
402
682
|
}
|
|
403
683
|
type WsMessage = WsMessage_Welcome | WsMessage_Pages | WsMessage_Page | WsMessage_SessionMessage | WsMessage_Session | WsMessage_SessionClosed | WsMessage_Error | WsMessage_Artifact | WsMessage_SessionOpen | WsMessage_Action | WsMessage_Registry | WsMessage_RegistryEntry | WsMessage_Upload;
|
|
404
684
|
|
|
685
|
+
interface BaseWsCommand {
|
|
686
|
+
type: string;
|
|
687
|
+
/**
|
|
688
|
+
* If used, WsService will await a response with the same request_id
|
|
689
|
+
*/
|
|
690
|
+
request_id?: string;
|
|
691
|
+
}
|
|
692
|
+
interface SessionOpenCommand extends BaseWsCommand {
|
|
693
|
+
type: 'session_open';
|
|
694
|
+
session_id?: string;
|
|
695
|
+
start_token?: string;
|
|
696
|
+
}
|
|
697
|
+
interface SessionCloseCommand extends BaseWsCommand {
|
|
698
|
+
type: 'session_close';
|
|
699
|
+
session_id: string;
|
|
700
|
+
}
|
|
701
|
+
interface SessionMessageCommand extends BaseWsCommand {
|
|
702
|
+
type: 'session_message';
|
|
703
|
+
session_id: string;
|
|
704
|
+
message_id: string;
|
|
705
|
+
data: {
|
|
706
|
+
text: string;
|
|
707
|
+
file_uuids?: string[];
|
|
708
|
+
};
|
|
709
|
+
}
|
|
710
|
+
interface SessionCommandCommand extends BaseWsCommand {
|
|
711
|
+
type: 'session_command';
|
|
712
|
+
session_id: string;
|
|
713
|
+
data: StopCommand | ModelCommand | OtherCommand | AgentCommand;
|
|
714
|
+
}
|
|
715
|
+
interface StopCommand {
|
|
716
|
+
command: 'stop';
|
|
717
|
+
}
|
|
718
|
+
interface ModelCommand {
|
|
719
|
+
command: 'model';
|
|
720
|
+
name: string;
|
|
721
|
+
}
|
|
722
|
+
interface AgentCommand {
|
|
723
|
+
command: 'agent';
|
|
724
|
+
name: string;
|
|
725
|
+
}
|
|
726
|
+
interface ExternalEventCommand extends BaseWsCommand {
|
|
727
|
+
type: string;
|
|
728
|
+
data: Record<string, unknown>;
|
|
729
|
+
}
|
|
730
|
+
interface OtherCommand {
|
|
731
|
+
command: string;
|
|
732
|
+
[key: string]: unknown;
|
|
733
|
+
}
|
|
734
|
+
type WsCommand = SessionOpenCommand | SessionCloseCommand | SessionMessageCommand | SessionCommandCommand | ExternalEventCommand;
|
|
735
|
+
|
|
405
736
|
type KnownTopics = '@history' | '@visibility' | '@message' | '@state-error';
|
|
406
737
|
type Events = {
|
|
407
738
|
/** Emitted when pages are updated */
|
|
@@ -431,283 +762,25 @@ interface StateApi {
|
|
|
431
762
|
getAll: (options?: StateApiOptions) => Promise<Record<string, unknown>>;
|
|
432
763
|
}
|
|
433
764
|
|
|
434
|
-
|
|
435
|
-
type: "non-persistent"
|
|
436
|
-
};
|
|
437
|
-
var history = "browser";
|
|
438
|
-
var env = {
|
|
439
|
-
APP_API_URL: "",
|
|
440
|
-
APP_AUTH_API_URL: "",
|
|
441
|
-
APP_WEBSOCKET_URL: ""
|
|
442
|
-
};
|
|
443
|
-
var featureRS = {
|
|
444
|
-
session: session,
|
|
445
|
-
history: history,
|
|
446
|
-
env: env
|
|
447
|
-
};
|
|
448
|
-
|
|
449
|
-
var chat = {
|
|
450
|
-
emptyState: {
|
|
451
|
-
title: "No chat session selected",
|
|
452
|
-
description: "Please select a session from the dropdown above or start a new conversation.",
|
|
453
|
-
goToHome: "Go to Home Page",
|
|
454
|
-
loadingAgents: "Loading agents...",
|
|
455
|
-
selectAgent: "Select Agent",
|
|
456
|
-
startChat: "Start Chat",
|
|
457
|
-
startChatError: "Failed to start chat",
|
|
458
|
-
noAgents: "No agents available. Please contact your administrator.",
|
|
459
|
-
dropFiles: "Drop files here to upload"
|
|
460
|
-
}
|
|
461
|
-
};
|
|
462
|
-
var customPage = {
|
|
463
|
-
loading: {
|
|
464
|
-
title: "Loading page content..."
|
|
465
|
-
},
|
|
466
|
-
error: {
|
|
467
|
-
title: "Failed to load page content"
|
|
468
|
-
}
|
|
469
|
-
};
|
|
470
|
-
var home = {
|
|
471
|
-
loading: "Application is Loading",
|
|
472
|
-
error: {
|
|
473
|
-
title: "Error Loading Application"
|
|
474
|
-
},
|
|
475
|
-
noHomePage: {
|
|
476
|
-
title: "No Home Page Detected",
|
|
477
|
-
message: "Probably backend configuration is malformed"
|
|
478
|
-
}
|
|
479
|
-
};
|
|
480
|
-
var app = {
|
|
481
|
-
title: "Wippy App",
|
|
482
|
-
appName: "Wippy",
|
|
483
|
-
icon: "wippy:logo"
|
|
484
|
-
};
|
|
485
|
-
var login = {
|
|
486
|
-
error: {
|
|
487
|
-
title: "Session Token Expired",
|
|
488
|
-
description: "Your session has expired or is no longer valid. Please close this window and log in again to continue."
|
|
489
|
-
}
|
|
490
|
-
};
|
|
491
|
-
var logout = {
|
|
492
|
-
title: "Logout",
|
|
493
|
-
description: "Logging out..."
|
|
494
|
-
};
|
|
495
|
-
var keeper = {
|
|
496
|
-
controls: {
|
|
497
|
-
newChat: "New Chat",
|
|
498
|
-
searchAgents: "Search agents...",
|
|
499
|
-
undo: "Undo",
|
|
500
|
-
redo: "Redo",
|
|
501
|
-
download: "Registry To File System",
|
|
502
|
-
upload: "File System To Registry",
|
|
503
|
-
codeAssistant: "Wippy Code Assistant",
|
|
504
|
-
syncControls: "Sync Controls",
|
|
505
|
-
confirmUpload: {
|
|
506
|
-
title: "Confirm Upload",
|
|
507
|
-
message: "Do you wish to upload file system changes to registry? This will overwrite current state",
|
|
508
|
-
cancel: "Cancel",
|
|
509
|
-
upload: "Upload",
|
|
510
|
-
cancelled: {
|
|
511
|
-
title: "Upload cancelled",
|
|
512
|
-
message: "The upload operation was cancelled"
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
},
|
|
516
|
-
version: {
|
|
517
|
-
label: "Version:",
|
|
518
|
-
tooltip: "Version {{version}}"
|
|
519
|
-
}
|
|
520
|
-
};
|
|
521
|
-
var textRS = {
|
|
522
|
-
chat: chat,
|
|
523
|
-
customPage: customPage,
|
|
524
|
-
home: home,
|
|
525
|
-
app: app,
|
|
526
|
-
login: login,
|
|
527
|
-
logout: logout,
|
|
528
|
-
keeper: keeper
|
|
529
|
-
};
|
|
530
|
-
|
|
531
|
-
type I18NFeatureTypes = typeof featureRS;
|
|
532
|
-
type I18NTextTypes = typeof textRS;
|
|
533
|
-
|
|
534
|
-
/**
|
|
535
|
-
* All API route templates, grouped by domain.
|
|
536
|
-
* Dynamic path segments use `{paramName}` placeholders (OpenAPI-style).
|
|
537
|
-
* Each leaf value is a flat, fully-formed route — no concatenation needed at call site.
|
|
538
|
-
*
|
|
539
|
-
* Internally, routes use `@/…` shorthand that resolves against the group's `@prefix`.
|
|
540
|
-
* Resolution happens once inside `getApiRoutes()`, so consumers always receive clean strings.
|
|
541
|
-
*
|
|
542
|
-
* Base URL resolution:
|
|
543
|
-
* - HTTP routes: `getEnv().APP_API_URL` + route (handled by axios baseURL)
|
|
544
|
-
* - WebSocket: `getEnv().APP_WEBSOCKET_URL` + `getApiRoutes().ws.join` (composed in ws/client.ts)
|
|
545
|
-
*/
|
|
546
|
-
interface ApiRoutes {
|
|
547
|
-
agents: {
|
|
548
|
-
list: string;
|
|
549
|
-
details: string;
|
|
550
|
-
byName: string;
|
|
551
|
-
};
|
|
552
|
-
sessions: {
|
|
553
|
-
list: string;
|
|
554
|
-
get: string;
|
|
555
|
-
messages: string;
|
|
556
|
-
};
|
|
557
|
-
models: {
|
|
558
|
-
list: string;
|
|
559
|
-
byName: string;
|
|
560
|
-
};
|
|
561
|
-
uploads: {
|
|
562
|
-
list: string;
|
|
563
|
-
get: string;
|
|
564
|
-
create: string;
|
|
565
|
-
};
|
|
566
|
-
artifacts: {
|
|
567
|
-
get: string;
|
|
568
|
-
content: string;
|
|
569
|
-
state: string;
|
|
570
|
-
baseUrl: string;
|
|
571
|
-
};
|
|
572
|
-
pages: {
|
|
573
|
-
list: string;
|
|
574
|
-
get: string;
|
|
575
|
-
content: string;
|
|
576
|
-
baseUrl: string;
|
|
577
|
-
};
|
|
578
|
-
registry: {
|
|
579
|
-
namespaces: string;
|
|
580
|
-
entries: string;
|
|
581
|
-
entry: string;
|
|
582
|
-
entryCreate: string;
|
|
583
|
-
entryEditors: string;
|
|
584
|
-
versions: string;
|
|
585
|
-
versionApply: string;
|
|
586
|
-
};
|
|
587
|
-
keeperSync: {
|
|
588
|
-
state: string;
|
|
589
|
-
download: string;
|
|
590
|
-
upload: string;
|
|
591
|
-
undo: string;
|
|
592
|
-
redo: string;
|
|
593
|
-
};
|
|
594
|
-
components: {
|
|
595
|
-
list: string;
|
|
596
|
-
};
|
|
597
|
-
tools: {
|
|
598
|
-
byName: string;
|
|
599
|
-
};
|
|
600
|
-
ws: {
|
|
601
|
-
join: string;
|
|
602
|
-
};
|
|
603
|
-
}
|
|
604
|
-
/**
|
|
605
|
-
* Override type for `AppConfig.feature.apiRoutes`.
|
|
606
|
-
*
|
|
607
|
-
* Each group is optional and partially overridable.
|
|
608
|
-
* Set `@prefix` to rebase all `@/…` routes in that group at once,
|
|
609
|
-
* or override individual routes with absolute paths.
|
|
610
|
-
*/
|
|
611
|
-
type ApiRoutesOverride = {
|
|
612
|
-
[K in keyof ApiRoutes]?: Partial<ApiRoutes[K]> & {
|
|
613
|
-
'@prefix'?: string;
|
|
614
|
-
};
|
|
615
|
-
};
|
|
616
|
-
|
|
617
|
-
interface AppFeatures extends I18NFeatureTypes {
|
|
618
|
-
/**
|
|
619
|
-
* If to remember auth details or not
|
|
620
|
-
*/
|
|
621
|
-
session: {
|
|
622
|
-
type: 'non-persistent' | 'cookie';
|
|
623
|
-
};
|
|
624
|
-
history: 'browser' | 'hash';
|
|
625
|
-
env: {
|
|
626
|
-
APP_API_URL: string;
|
|
627
|
-
APP_AUTH_API_URL: string;
|
|
628
|
-
APP_WEBSOCKET_URL: string;
|
|
629
|
-
};
|
|
630
|
-
axiosDefaults?: Partial<AxiosDefaults>;
|
|
631
|
-
routePrefix?: string;
|
|
632
|
-
showAdmin?: boolean;
|
|
633
|
-
allowSelectModel?: boolean;
|
|
634
|
-
startNavOpen?: boolean;
|
|
635
|
-
hideNavBar?: boolean;
|
|
636
|
-
disableRightPanel?: boolean;
|
|
637
|
-
/**
|
|
638
|
-
* Hide the session selector dropdown in chat views
|
|
639
|
-
* @default false
|
|
640
|
-
*/
|
|
641
|
-
hideSessionSelector?: boolean;
|
|
642
|
-
additionalNavItems?: Array<PageApi.Page>;
|
|
643
|
-
chat?: {
|
|
644
|
-
convertPasteToFile?: {
|
|
645
|
-
enabled: boolean;
|
|
646
|
-
minFileSize: number;
|
|
647
|
-
allowHtml: boolean;
|
|
648
|
-
};
|
|
649
|
-
};
|
|
650
|
-
apiRoutes?: ApiRoutesOverride;
|
|
651
|
-
/**
|
|
652
|
-
* Additional HTML tags to whitelist in the sanitizer.
|
|
653
|
-
* Map of tag name to allowed attribute names.
|
|
654
|
-
* 'class' is always implicitly allowed for every tag.
|
|
655
|
-
*/
|
|
656
|
-
allowAdditionalTags?: Record<string, string[]>;
|
|
765
|
+
interface ProxyWsApi {
|
|
657
766
|
/**
|
|
658
|
-
*
|
|
659
|
-
*
|
|
767
|
+
* Send a raw WebSocket command through the host's WebSocket connection.
|
|
768
|
+
* Fire-and-forget — responses arrive via `on()` event subscriptions.
|
|
660
769
|
*/
|
|
661
|
-
|
|
662
|
-
/** Maximum number of page/artifact state buckets to keep. @default 50 */
|
|
663
|
-
maxPages?: number;
|
|
664
|
-
/** Maximum JSON-serialized size per page in bytes. @default 2097152 (2 MB) */
|
|
665
|
-
maxSizePerPage?: number;
|
|
666
|
-
};
|
|
667
|
-
}
|
|
668
|
-
interface AppAuthConfig {
|
|
669
|
-
token: string;
|
|
670
|
-
expiresAt: string;
|
|
671
|
-
}
|
|
672
|
-
interface CssVariablesMap {
|
|
673
|
-
[key: string]: string | Record<string, string> | undefined;
|
|
674
|
-
'@dark'?: Record<string, string>;
|
|
675
|
-
'@light'?: Record<string, string>;
|
|
676
|
-
}
|
|
677
|
-
interface AppCustomization {
|
|
678
|
-
customCSS?: string;
|
|
679
|
-
cssVariables?: CssVariablesMap;
|
|
680
|
-
i18n?: Partial<I18NTextTypes>;
|
|
681
|
-
icons?: Record<string, {
|
|
682
|
-
body: string;
|
|
683
|
-
width: number;
|
|
684
|
-
height: number;
|
|
685
|
-
}>;
|
|
686
|
-
}
|
|
687
|
-
interface AppConfig {
|
|
688
|
-
artifactId?: string;
|
|
770
|
+
send: (command: WsCommand) => void;
|
|
689
771
|
/**
|
|
690
|
-
*
|
|
772
|
+
* Send a WebSocket command and wait for the server's response.
|
|
773
|
+
* The command is sent with a `request_id`; the promise resolves when the server echoes it back.
|
|
774
|
+
* Times out after 30 seconds.
|
|
691
775
|
*/
|
|
692
|
-
|
|
776
|
+
sendWithResponse: (command: WsCommand) => Promise<WsMessage>;
|
|
693
777
|
/**
|
|
694
|
-
*
|
|
778
|
+
* Convenience method to send a session command (stop, model, agent, etc.)
|
|
695
779
|
*/
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
auth: AppAuthConfig;
|
|
701
|
-
/**
|
|
702
|
-
* App customization like i18n texts, css variables, custom css, etc.
|
|
703
|
-
*/
|
|
704
|
-
customization?: AppCustomization;
|
|
705
|
-
externalEvents?: {
|
|
706
|
-
enabled: boolean;
|
|
707
|
-
wsType: string;
|
|
708
|
-
allowedOrigins: string[];
|
|
709
|
-
allowedTypes: string[];
|
|
710
|
-
};
|
|
780
|
+
sendCommand: (sessionId: string, data: {
|
|
781
|
+
command: string;
|
|
782
|
+
[key: string]: unknown;
|
|
783
|
+
}) => void;
|
|
711
784
|
}
|
|
712
785
|
|
|
713
786
|
interface FormState {
|
|
@@ -721,7 +794,7 @@ interface FormResult {
|
|
|
721
794
|
}
|
|
722
795
|
type LimitedConfirmationOptions = Omit<ConfirmationOptions, 'target' | 'appendTo' | 'onShow' | 'onHide'>;
|
|
723
796
|
interface ProxyApiInstance {
|
|
724
|
-
config:
|
|
797
|
+
config: ChildAppConfig;
|
|
725
798
|
/** @deprecated, use `host` instead */
|
|
726
799
|
iframe: {
|
|
727
800
|
toast: (message: ToastMessageOptions) => void;
|
|
@@ -769,6 +842,7 @@ interface ProxyApiInstance {
|
|
|
769
842
|
};
|
|
770
843
|
on: ReturnType<typeof createEvents>;
|
|
771
844
|
state: StateApi;
|
|
845
|
+
ws: ProxyWsApi;
|
|
772
846
|
loadWebComponent: (componentId: string, tagName?: string) => Promise<void>;
|
|
773
847
|
}
|
|
774
848
|
|
|
@@ -795,13 +869,15 @@ interface ProxyConfig {
|
|
|
795
869
|
|
|
796
870
|
declare const GLOBAL_CONFIG_VAR: "__WIPPY_APP_CONFIG__";
|
|
797
871
|
declare const GLOBAL_PROXY_CONFIG_VAR: "__WIPPY_PROXY_CONFIG__";
|
|
872
|
+
declare const GLOBAL_CONFIG_OVERRIDES_VAR: "__WIPPY_CONFIG_OVERRIDES__";
|
|
798
873
|
declare const GLOBAL_API_PROVIDER: "__WIPPY_APP_API__";
|
|
799
874
|
declare const GLOBAL_WEB_COMPONENT_CACHE: "__WIPPY_WEB_COMPONENT_CACHE__";
|
|
800
875
|
declare global {
|
|
801
876
|
interface Window {
|
|
802
|
-
[GLOBAL_CONFIG_VAR]: AppConfig;
|
|
877
|
+
[GLOBAL_CONFIG_VAR]: AppConfig | ChildAppConfig;
|
|
803
878
|
[GLOBAL_API_PROVIDER]: ProxyApiInstance;
|
|
804
879
|
[GLOBAL_PROXY_CONFIG_VAR]?: ProxyConfig;
|
|
880
|
+
[GLOBAL_CONFIG_OVERRIDES_VAR]?: AppConfigOverrides;
|
|
805
881
|
[GLOBAL_WEB_COMPONENT_CACHE]: Record<string, {
|
|
806
882
|
usedAt: number;
|
|
807
883
|
data: string;
|
|
@@ -845,7 +921,7 @@ declare global {
|
|
|
845
921
|
*/
|
|
846
922
|
initWippyApi: () => Promise<ProxyApiInstance>;
|
|
847
923
|
$W: {
|
|
848
|
-
config: () => Promise<
|
|
924
|
+
config: () => Promise<ChildAppConfig>;
|
|
849
925
|
instance: () => Promise<ProxyApiInstance>;
|
|
850
926
|
api: () => Promise<ProxyApiInstance['api']>;
|
|
851
927
|
/** @deprecated Use `$W.api` instead */
|
|
@@ -855,6 +931,7 @@ declare global {
|
|
|
855
931
|
iframe: () => Promise<ProxyApiInstance['host']>;
|
|
856
932
|
on: () => Promise<ProxyApiInstance['on']>;
|
|
857
933
|
state: () => Promise<ProxyApiInstance['state']>;
|
|
934
|
+
ws: () => Promise<ProxyApiInstance['ws']>;
|
|
858
935
|
loadWebComponent: () => Promise<ProxyApiInstance['loadWebComponent']>;
|
|
859
936
|
};
|
|
860
937
|
tailwind?: {
|
package/package.json
CHANGED