@wippy-fe/types-global-proxy 0.0.15 → 0.0.17
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 +546 -464
- 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,286 @@ 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 session = {
|
|
8
|
+
type: "non-persistent"
|
|
9
|
+
};
|
|
10
|
+
var history = "browser";
|
|
11
|
+
var env = {
|
|
12
|
+
APP_API_URL: "",
|
|
13
|
+
APP_AUTH_API_URL: "",
|
|
14
|
+
APP_WEBSOCKET_URL: ""
|
|
15
|
+
};
|
|
16
|
+
var featureRS = {
|
|
17
|
+
session: session,
|
|
18
|
+
history: history,
|
|
19
|
+
env: env
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
var chat = {
|
|
23
|
+
emptyState: {
|
|
24
|
+
title: "No chat session selected",
|
|
25
|
+
description: "Please select a session from the dropdown above or start a new conversation.",
|
|
26
|
+
goToHome: "Go to Home Page",
|
|
27
|
+
loadingAgents: "Loading agents...",
|
|
28
|
+
selectAgent: "Select Agent",
|
|
29
|
+
startChat: "Start Chat",
|
|
30
|
+
startChatError: "Failed to start chat",
|
|
31
|
+
noAgents: "No agents available. Please contact your administrator.",
|
|
32
|
+
dropFiles: "Drop files here to upload"
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
var customPage = {
|
|
36
|
+
loading: {
|
|
37
|
+
title: "Loading page content..."
|
|
38
|
+
},
|
|
39
|
+
error: {
|
|
40
|
+
title: "Failed to load page content"
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
var home = {
|
|
44
|
+
loading: "Application is Loading",
|
|
45
|
+
error: {
|
|
46
|
+
title: "Error Loading Application"
|
|
47
|
+
},
|
|
48
|
+
noHomePage: {
|
|
49
|
+
title: "No Home Page Detected",
|
|
50
|
+
message: "Probably backend configuration is malformed"
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
var app = {
|
|
54
|
+
title: "Wippy App",
|
|
55
|
+
appName: "Wippy",
|
|
56
|
+
icon: "wippy:logo"
|
|
57
|
+
};
|
|
58
|
+
var login = {
|
|
59
|
+
error: {
|
|
60
|
+
title: "Session Token Expired",
|
|
61
|
+
description: "Your session has expired or is no longer valid. Please close this window and log in again to continue."
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
var logout = {
|
|
65
|
+
title: "Logout",
|
|
66
|
+
description: "Logging out..."
|
|
67
|
+
};
|
|
68
|
+
var keeper = {
|
|
69
|
+
controls: {
|
|
70
|
+
newChat: "New Chat",
|
|
71
|
+
searchAgents: "Search agents...",
|
|
72
|
+
undo: "Undo",
|
|
73
|
+
redo: "Redo",
|
|
74
|
+
download: "Registry To File System",
|
|
75
|
+
upload: "File System To Registry",
|
|
76
|
+
codeAssistant: "Wippy Code Assistant",
|
|
77
|
+
syncControls: "Sync Controls",
|
|
78
|
+
confirmUpload: {
|
|
79
|
+
title: "Confirm Upload",
|
|
80
|
+
message: "Do you wish to upload file system changes to registry? This will overwrite current state",
|
|
81
|
+
cancel: "Cancel",
|
|
82
|
+
upload: "Upload",
|
|
83
|
+
cancelled: {
|
|
84
|
+
title: "Upload cancelled",
|
|
85
|
+
message: "The upload operation was cancelled"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
version: {
|
|
90
|
+
label: "Version:",
|
|
91
|
+
tooltip: "Version {{version}}"
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
var textRS = {
|
|
95
|
+
chat: chat,
|
|
96
|
+
customPage: customPage,
|
|
97
|
+
home: home,
|
|
98
|
+
app: app,
|
|
99
|
+
login: login,
|
|
100
|
+
logout: logout,
|
|
101
|
+
keeper: keeper
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
type I18NFeatureTypes = typeof featureRS;
|
|
105
|
+
type I18NTextTypes = typeof textRS;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* All API route templates, grouped by domain.
|
|
109
|
+
* Dynamic path segments use `{paramName}` placeholders (OpenAPI-style).
|
|
110
|
+
* Each leaf value is a flat, fully-formed route — no concatenation needed at call site.
|
|
111
|
+
*
|
|
112
|
+
* Internally, routes use `@/…` shorthand that resolves against the group's `@prefix`.
|
|
113
|
+
* Resolution happens once inside `getApiRoutes()`, so consumers always receive clean strings.
|
|
114
|
+
*
|
|
115
|
+
* Base URL resolution:
|
|
116
|
+
* - HTTP routes: `getEnv().APP_API_URL` + route (handled by axios baseURL)
|
|
117
|
+
* - WebSocket: `getEnv().APP_WEBSOCKET_URL` + `getApiRoutes().ws.join` (composed in ws/client.ts)
|
|
118
|
+
*/
|
|
119
|
+
interface ApiRoutes {
|
|
120
|
+
agents: {
|
|
121
|
+
list: string;
|
|
122
|
+
details: string;
|
|
123
|
+
byName: string;
|
|
124
|
+
};
|
|
125
|
+
sessions: {
|
|
126
|
+
list: string;
|
|
127
|
+
get: string;
|
|
128
|
+
messages: string;
|
|
129
|
+
};
|
|
130
|
+
models: {
|
|
131
|
+
list: string;
|
|
132
|
+
byName: string;
|
|
133
|
+
};
|
|
134
|
+
uploads: {
|
|
135
|
+
list: string;
|
|
136
|
+
get: string;
|
|
137
|
+
create: string;
|
|
138
|
+
};
|
|
139
|
+
artifacts: {
|
|
140
|
+
get: string;
|
|
141
|
+
content: string;
|
|
142
|
+
state: string;
|
|
143
|
+
baseUrl: string;
|
|
144
|
+
};
|
|
145
|
+
pages: {
|
|
146
|
+
list: string;
|
|
147
|
+
get: string;
|
|
148
|
+
content: string;
|
|
149
|
+
baseUrl: string;
|
|
150
|
+
};
|
|
151
|
+
registry: {
|
|
152
|
+
namespaces: string;
|
|
153
|
+
entries: string;
|
|
154
|
+
entry: string;
|
|
155
|
+
entryCreate: string;
|
|
156
|
+
entryEditors: string;
|
|
157
|
+
versions: string;
|
|
158
|
+
versionApply: string;
|
|
159
|
+
};
|
|
160
|
+
keeperSync: {
|
|
161
|
+
state: string;
|
|
162
|
+
download: string;
|
|
163
|
+
upload: string;
|
|
164
|
+
undo: string;
|
|
165
|
+
redo: string;
|
|
166
|
+
};
|
|
167
|
+
components: {
|
|
168
|
+
list: string;
|
|
169
|
+
};
|
|
170
|
+
tools: {
|
|
171
|
+
byName: string;
|
|
172
|
+
};
|
|
173
|
+
ws: {
|
|
174
|
+
join: string;
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Override type for `AppConfig.feature.apiRoutes`.
|
|
179
|
+
*
|
|
180
|
+
* Each group is optional and partially overridable.
|
|
181
|
+
* Set `@prefix` to rebase all `@/…` routes in that group at once,
|
|
182
|
+
* or override individual routes with absolute paths.
|
|
183
|
+
*/
|
|
184
|
+
type ApiRoutesOverride = {
|
|
185
|
+
[K in keyof ApiRoutes]?: Partial<ApiRoutes[K]> & {
|
|
186
|
+
'@prefix'?: string;
|
|
187
|
+
};
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
interface AppFeatures extends I18NFeatureTypes {
|
|
191
|
+
/**
|
|
192
|
+
* If to remember auth details or not
|
|
193
|
+
*/
|
|
194
|
+
session: {
|
|
195
|
+
type: 'non-persistent' | 'cookie';
|
|
196
|
+
};
|
|
197
|
+
history: 'browser' | 'hash';
|
|
198
|
+
env: {
|
|
199
|
+
APP_API_URL: string;
|
|
200
|
+
APP_AUTH_API_URL: string;
|
|
201
|
+
APP_WEBSOCKET_URL: string;
|
|
202
|
+
};
|
|
203
|
+
axiosDefaults?: Partial<AxiosDefaults>;
|
|
204
|
+
routePrefix?: string;
|
|
205
|
+
showAdmin?: boolean;
|
|
206
|
+
allowSelectModel?: boolean;
|
|
207
|
+
startNavOpen?: boolean;
|
|
208
|
+
hideNavBar?: boolean;
|
|
209
|
+
disableRightPanel?: boolean;
|
|
210
|
+
/**
|
|
211
|
+
* Hide the session selector dropdown in chat views
|
|
212
|
+
* @default false
|
|
213
|
+
*/
|
|
214
|
+
hideSessionSelector?: boolean;
|
|
215
|
+
additionalNavItems?: Array<PageApi.Page>;
|
|
216
|
+
chat?: {
|
|
217
|
+
convertPasteToFile?: {
|
|
218
|
+
enabled: boolean;
|
|
219
|
+
minFileSize: number;
|
|
220
|
+
allowHtml: boolean;
|
|
221
|
+
};
|
|
222
|
+
};
|
|
223
|
+
apiRoutes?: ApiRoutesOverride;
|
|
224
|
+
/**
|
|
225
|
+
* Additional HTML tags to whitelist in the sanitizer.
|
|
226
|
+
* Map of tag name to allowed attribute names.
|
|
227
|
+
* 'class' is always implicitly allowed for every tag.
|
|
228
|
+
*/
|
|
229
|
+
allowAdditionalTags?: Record<string, string[]>;
|
|
230
|
+
/**
|
|
231
|
+
* LRU cache configuration for child iframe state preservation.
|
|
232
|
+
* @default { maxPages: 50, maxSizePerPage: 2097152 }
|
|
233
|
+
*/
|
|
234
|
+
stateCache?: {
|
|
235
|
+
/** Maximum number of page/artifact state buckets to keep. @default 50 */
|
|
236
|
+
maxPages?: number;
|
|
237
|
+
/** Maximum JSON-serialized size per page in bytes. @default 2097152 (2 MB) */
|
|
238
|
+
maxSizePerPage?: number;
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
interface AppAuthConfig {
|
|
242
|
+
token: string;
|
|
243
|
+
expiresAt: string;
|
|
244
|
+
}
|
|
245
|
+
interface CssVariablesMap {
|
|
246
|
+
[key: string]: string | Record<string, string> | undefined;
|
|
247
|
+
'@dark'?: Record<string, string>;
|
|
248
|
+
'@light'?: Record<string, string>;
|
|
249
|
+
}
|
|
250
|
+
interface AppCustomization {
|
|
251
|
+
customCSS?: string;
|
|
252
|
+
cssVariables?: CssVariablesMap;
|
|
253
|
+
i18n?: Partial<I18NTextTypes>;
|
|
254
|
+
icons?: Record<string, {
|
|
255
|
+
body: string;
|
|
256
|
+
width: number;
|
|
257
|
+
height: number;
|
|
258
|
+
}>;
|
|
259
|
+
}
|
|
260
|
+
type DeepPartial<T> = T extends object ? {
|
|
261
|
+
[P in keyof T]?: DeepPartial<T[P]>;
|
|
262
|
+
} : T;
|
|
263
|
+
interface AppConfigOverrides {
|
|
264
|
+
customization?: Partial<AppCustomization>;
|
|
265
|
+
feature?: DeepPartial<AppFeatures>;
|
|
266
|
+
}
|
|
267
|
+
interface AppConfig {
|
|
268
|
+
artifactId?: string;
|
|
269
|
+
/**
|
|
270
|
+
* Starting app or artifact/page path
|
|
271
|
+
*/
|
|
272
|
+
path?: string;
|
|
273
|
+
/**
|
|
274
|
+
* App features like history mode, session type, etc.
|
|
275
|
+
*/
|
|
276
|
+
feature?: AppFeatures;
|
|
277
|
+
/**
|
|
278
|
+
* Auth configuration
|
|
279
|
+
*/
|
|
280
|
+
auth: AppAuthConfig;
|
|
281
|
+
/**
|
|
282
|
+
* App customization like i18n texts, css variables, custom css, etc.
|
|
283
|
+
*/
|
|
284
|
+
customization?: AppCustomization;
|
|
285
|
+
}
|
|
286
|
+
|
|
7
287
|
declare namespace PageApi {
|
|
8
288
|
interface Page {
|
|
9
289
|
icon: string;
|
|
@@ -23,6 +303,8 @@ declare namespace PageApi {
|
|
|
23
303
|
content_version?: string;
|
|
24
304
|
/** The content of the page artifact, which can be HTML, Markdown, or JSON with wippy specific package.json info */
|
|
25
305
|
content_type?: 'text/html' | 'text/markdown' | 'application/json';
|
|
306
|
+
/** Per-page config overrides — merged into AppConfig before CSS injection. Populated from registry entry config_overrides. */
|
|
307
|
+
configOverrides?: AppConfigOverrides;
|
|
26
308
|
}
|
|
27
309
|
interface PagesResponse {
|
|
28
310
|
count: number;
|
|
@@ -207,507 +489,300 @@ interface WsTopicTypes {
|
|
|
207
489
|
/**
|
|
208
490
|
* Upload was created or updated
|
|
209
491
|
*/
|
|
210
|
-
Upload: `${typeof WsTopicPrefixes.Upload}:${string}`;
|
|
211
|
-
}
|
|
212
|
-
type WsTopic = WsTopicTypes[keyof WsTopicTypes];
|
|
213
|
-
declare enum WsMessageType {
|
|
214
|
-
/** Contains the actual content of the message */
|
|
215
|
-
CONTENT = "content",
|
|
216
|
-
/** Contains content of the message to append to current one */
|
|
217
|
-
CHUNK = "chunk",
|
|
218
|
-
/** User message with contents */
|
|
219
|
-
USER = "received",
|
|
220
|
-
/** Response started, can create a message placeholder */
|
|
221
|
-
RESPONSE_STARTED = "response_started",
|
|
222
|
-
/** Kill the message */
|
|
223
|
-
INVALIDATE = "invalidate",
|
|
224
|
-
/** from to agent, get agent names */
|
|
225
|
-
DELEGATION = "delegation",
|
|
226
|
-
/** Tool/fn was called */
|
|
227
|
-
TOOL_CALL = "tool_call",
|
|
228
|
-
FUNCTION_CALL = "function_call",
|
|
229
|
-
/** Tool/fn was succesfull */
|
|
230
|
-
TOOL_SUCCESS = "tool_success",
|
|
231
|
-
FUNCTION_SUCCESS = "function_success",
|
|
232
|
-
/** Tool/fn failed */
|
|
233
|
-
TOOL_ERROR = "tool_error",
|
|
234
|
-
FUNCTION_ERROR = "function_error",
|
|
235
|
-
/** Error */
|
|
236
|
-
ERROR = "error",
|
|
237
|
-
/** Error */
|
|
238
|
-
ARTIFACT = "artifact"
|
|
239
|
-
}
|
|
240
|
-
interface WsMessageBase {
|
|
241
|
-
topic: WsTopic;
|
|
242
|
-
data?: {
|
|
243
|
-
request_id?: string;
|
|
244
|
-
};
|
|
245
|
-
}
|
|
246
|
-
interface WsMessage_Welcome extends WsMessageBase {
|
|
247
|
-
topic: WsTopicTypes['Welcome'];
|
|
248
|
-
data: {
|
|
249
|
-
request_id?: string;
|
|
250
|
-
active_session_ids: Array<string>;
|
|
251
|
-
active_sessions: number;
|
|
252
|
-
client_count: number;
|
|
253
|
-
user_id: string;
|
|
254
|
-
};
|
|
255
|
-
}
|
|
256
|
-
interface WsMessage_Action extends WsMessageBase {
|
|
257
|
-
topic: WsTopicTypes['Action'];
|
|
258
|
-
data: {
|
|
259
|
-
request_id?: string;
|
|
260
|
-
artifact_uuid?: string;
|
|
261
|
-
artifact_content_type?: string;
|
|
262
|
-
session_uuid?: string;
|
|
263
|
-
path?: string;
|
|
264
|
-
};
|
|
265
|
-
}
|
|
266
|
-
interface WsMessage_Registry extends WsMessageBase {
|
|
267
|
-
topic: WsTopicTypes['Registry'];
|
|
268
|
-
data: {
|
|
269
|
-
request_id?: string;
|
|
270
|
-
};
|
|
271
|
-
}
|
|
272
|
-
interface WsMessage_RegistryEntry extends WsMessageBase {
|
|
273
|
-
topic: WsTopicTypes['RegistryEntry'];
|
|
274
|
-
data: {
|
|
275
|
-
request_id?: string;
|
|
276
|
-
content_version?: string;
|
|
277
|
-
};
|
|
278
|
-
}
|
|
279
|
-
interface WsMessage_Pages extends WsMessageBase {
|
|
280
|
-
topic: WsTopicTypes['Pages'];
|
|
281
|
-
}
|
|
282
|
-
interface WsMessage_Page extends WsMessageBase {
|
|
283
|
-
topic: WsTopicTypes['Page'];
|
|
284
|
-
data: PageApi.Page & {
|
|
285
|
-
request_id?: string;
|
|
286
|
-
};
|
|
287
|
-
}
|
|
288
|
-
interface WsMessage_SessionOpen extends WsMessageBase {
|
|
289
|
-
topic: WsTopicTypes['SessionOpened'];
|
|
290
|
-
data: {
|
|
291
|
-
request_id?: string;
|
|
292
|
-
active_session_ids: Array<string>;
|
|
293
|
-
session_id: string;
|
|
294
|
-
};
|
|
295
|
-
}
|
|
296
|
-
interface WsMessage_Error extends WsMessageBase {
|
|
297
|
-
topic: WsTopicTypes['Error'];
|
|
298
|
-
data: {
|
|
299
|
-
request_id?: string;
|
|
300
|
-
error: string;
|
|
301
|
-
message: string;
|
|
302
|
-
};
|
|
303
|
-
}
|
|
304
|
-
interface WsMessage_SessionClosed extends WsMessageBase {
|
|
305
|
-
topic: WsTopicTypes['SessionClosed'];
|
|
306
|
-
data: {
|
|
307
|
-
request_id?: string;
|
|
308
|
-
active_session_ids: Array<string>;
|
|
309
|
-
session_id: string;
|
|
310
|
-
};
|
|
311
|
-
}
|
|
312
|
-
interface WsMessageDataBase {
|
|
313
|
-
type: WsMessageType;
|
|
314
|
-
}
|
|
315
|
-
interface WsMessageDataChunk extends WsMessageDataBase {
|
|
316
|
-
type: WsMessageType.CHUNK;
|
|
317
|
-
content: string;
|
|
318
|
-
}
|
|
319
|
-
interface WsMessageDataContent extends WsMessageDataBase {
|
|
320
|
-
type: WsMessageType.CONTENT;
|
|
321
|
-
content: string;
|
|
322
|
-
message_id: MessageUUID;
|
|
323
|
-
file_uuids?: string[];
|
|
324
|
-
}
|
|
325
|
-
interface WsMessageDataUser extends WsMessageDataBase {
|
|
326
|
-
type: WsMessageType.USER;
|
|
327
|
-
text: string;
|
|
328
|
-
message_id: MessageUUID;
|
|
329
|
-
file_uuids?: string[];
|
|
330
|
-
}
|
|
331
|
-
interface WsMessageDataDelegation extends WsMessageDataBase {
|
|
332
|
-
type: WsMessageType.DELEGATION;
|
|
333
|
-
from: string;
|
|
334
|
-
to: string;
|
|
335
|
-
}
|
|
336
|
-
interface WsMessageDataInvalidate extends WsMessageDataBase {
|
|
337
|
-
type: WsMessageType.INVALIDATE;
|
|
338
|
-
}
|
|
339
|
-
interface WsMessageDataStarted extends WsMessageDataBase {
|
|
340
|
-
type: WsMessageType.RESPONSE_STARTED;
|
|
341
|
-
message_id: MessageUUID;
|
|
342
|
-
}
|
|
343
|
-
interface WsMessageDataToolCall extends WsMessageDataBase {
|
|
344
|
-
type: WsMessageType.TOOL_CALL | WsMessageType.FUNCTION_CALL;
|
|
345
|
-
function_name: string;
|
|
346
|
-
artifact_id?: string;
|
|
347
|
-
}
|
|
348
|
-
interface WsMessageDataArtifact extends WsMessageDataBase {
|
|
349
|
-
type: WsMessageType.ARTIFACT;
|
|
350
|
-
artifact_id?: string;
|
|
351
|
-
}
|
|
352
|
-
interface WsMessageDataToolSuccess extends WsMessageDataBase {
|
|
353
|
-
type: WsMessageType.TOOL_SUCCESS | WsMessageType.FUNCTION_SUCCESS;
|
|
354
|
-
function_name: string;
|
|
355
|
-
artifact_id?: string;
|
|
356
|
-
}
|
|
357
|
-
interface WsMessageDataToolError extends WsMessageDataBase {
|
|
358
|
-
type: WsMessageType.TOOL_ERROR | WsMessageType.FUNCTION_ERROR;
|
|
359
|
-
function_name: string;
|
|
360
|
-
artifact_id?: string;
|
|
361
|
-
}
|
|
362
|
-
interface WsMessageDataError extends WsMessageDataBase {
|
|
363
|
-
type: WsMessageType.ERROR;
|
|
364
|
-
message: string;
|
|
365
|
-
code: string;
|
|
492
|
+
Upload: `${typeof WsTopicPrefixes.Upload}:${string}`;
|
|
366
493
|
}
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
494
|
+
type WsTopic = WsTopicTypes[keyof WsTopicTypes];
|
|
495
|
+
declare enum WsMessageType {
|
|
496
|
+
/** Contains the actual content of the message */
|
|
497
|
+
CONTENT = "content",
|
|
498
|
+
/** Contains content of the message to append to current one */
|
|
499
|
+
CHUNK = "chunk",
|
|
500
|
+
/** User message with contents */
|
|
501
|
+
USER = "received",
|
|
502
|
+
/** Response started, can create a message placeholder */
|
|
503
|
+
RESPONSE_STARTED = "response_started",
|
|
504
|
+
/** Kill the message */
|
|
505
|
+
INVALIDATE = "invalidate",
|
|
506
|
+
/** from to agent, get agent names */
|
|
507
|
+
DELEGATION = "delegation",
|
|
508
|
+
/** Tool/fn was called */
|
|
509
|
+
TOOL_CALL = "tool_call",
|
|
510
|
+
FUNCTION_CALL = "function_call",
|
|
511
|
+
/** Tool/fn was succesfull */
|
|
512
|
+
TOOL_SUCCESS = "tool_success",
|
|
513
|
+
FUNCTION_SUCCESS = "function_success",
|
|
514
|
+
/** Tool/fn failed */
|
|
515
|
+
TOOL_ERROR = "tool_error",
|
|
516
|
+
FUNCTION_ERROR = "function_error",
|
|
517
|
+
/** Error */
|
|
518
|
+
ERROR = "error",
|
|
519
|
+
/** Error */
|
|
520
|
+
ARTIFACT = "artifact"
|
|
521
|
+
}
|
|
522
|
+
interface WsMessageBase {
|
|
523
|
+
topic: WsTopic;
|
|
524
|
+
data?: {
|
|
370
525
|
request_id?: string;
|
|
371
526
|
};
|
|
372
527
|
}
|
|
373
|
-
interface
|
|
374
|
-
topic: WsTopicTypes['
|
|
528
|
+
interface WsMessage_Welcome extends WsMessageBase {
|
|
529
|
+
topic: WsTopicTypes['Welcome'];
|
|
375
530
|
data: {
|
|
376
531
|
request_id?: string;
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
title?: string;
|
|
382
|
-
type: 'update';
|
|
383
|
-
public_meta?: Array<{
|
|
384
|
-
icon?: string;
|
|
385
|
-
id: string;
|
|
386
|
-
title: string;
|
|
387
|
-
url?: string;
|
|
388
|
-
}>;
|
|
532
|
+
active_session_ids: Array<string>;
|
|
533
|
+
active_sessions: number;
|
|
534
|
+
client_count: number;
|
|
535
|
+
user_id: string;
|
|
389
536
|
};
|
|
390
537
|
}
|
|
391
|
-
interface
|
|
392
|
-
topic: WsTopicTypes['
|
|
393
|
-
data:
|
|
538
|
+
interface WsMessage_Action extends WsMessageBase {
|
|
539
|
+
topic: WsTopicTypes['Action'];
|
|
540
|
+
data: {
|
|
394
541
|
request_id?: string;
|
|
542
|
+
artifact_uuid?: string;
|
|
543
|
+
artifact_content_type?: string;
|
|
544
|
+
session_uuid?: string;
|
|
545
|
+
path?: string;
|
|
395
546
|
};
|
|
396
547
|
}
|
|
397
|
-
interface
|
|
398
|
-
topic: WsTopicTypes['
|
|
399
|
-
data:
|
|
548
|
+
interface WsMessage_Registry extends WsMessageBase {
|
|
549
|
+
topic: WsTopicTypes['Registry'];
|
|
550
|
+
data: {
|
|
400
551
|
request_id?: string;
|
|
401
552
|
};
|
|
402
553
|
}
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
'@history': (data: {
|
|
409
|
-
path: string;
|
|
410
|
-
}) => void;
|
|
411
|
-
'@visibility': (visible: boolean) => void;
|
|
412
|
-
'@message': (data: WsMessage) => void;
|
|
413
|
-
'@state-error': (data: {
|
|
414
|
-
error: string;
|
|
415
|
-
key?: string;
|
|
416
|
-
}) => void;
|
|
417
|
-
} & {
|
|
418
|
-
[K in string as K extends KnownTopics ? never : K]: (data: WsMessage) => void;
|
|
419
|
-
};
|
|
420
|
-
declare function createEvents(): <T extends string>(topicPattern: T, callback: T extends KnownTopics ? Events[T] : Events["@message"]) => nanoevents.Unsubscribe;
|
|
421
|
-
|
|
422
|
-
interface StateApiOptions {
|
|
423
|
-
/** Override the default page-level scope. Used by web components with persist-key or nested artifacts. */
|
|
424
|
-
scope?: string;
|
|
425
|
-
}
|
|
426
|
-
interface StateApi {
|
|
427
|
-
get: <T = unknown>(key: string, options?: StateApiOptions) => Promise<T | null>;
|
|
428
|
-
set: (key: string, value: unknown, options?: StateApiOptions) => Promise<void>;
|
|
429
|
-
remove: (key: string, options?: StateApiOptions) => Promise<void>;
|
|
430
|
-
clear: (options?: StateApiOptions) => Promise<void>;
|
|
431
|
-
getAll: (options?: StateApiOptions) => Promise<Record<string, unknown>>;
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
var session = {
|
|
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;
|
|
554
|
+
interface WsMessage_RegistryEntry extends WsMessageBase {
|
|
555
|
+
topic: WsTopicTypes['RegistryEntry'];
|
|
556
|
+
data: {
|
|
557
|
+
request_id?: string;
|
|
558
|
+
content_version?: string;
|
|
586
559
|
};
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
560
|
+
}
|
|
561
|
+
interface WsMessage_Pages extends WsMessageBase {
|
|
562
|
+
topic: WsTopicTypes['Pages'];
|
|
563
|
+
}
|
|
564
|
+
interface WsMessage_Page extends WsMessageBase {
|
|
565
|
+
topic: WsTopicTypes['Page'];
|
|
566
|
+
data: PageApi.Page & {
|
|
567
|
+
request_id?: string;
|
|
593
568
|
};
|
|
594
|
-
|
|
595
|
-
|
|
569
|
+
}
|
|
570
|
+
interface WsMessage_SessionOpen extends WsMessageBase {
|
|
571
|
+
topic: WsTopicTypes['SessionOpened'];
|
|
572
|
+
data: {
|
|
573
|
+
request_id?: string;
|
|
574
|
+
active_session_ids: Array<string>;
|
|
575
|
+
session_id: string;
|
|
596
576
|
};
|
|
597
|
-
|
|
598
|
-
|
|
577
|
+
}
|
|
578
|
+
interface WsMessage_Error extends WsMessageBase {
|
|
579
|
+
topic: WsTopicTypes['Error'];
|
|
580
|
+
data: {
|
|
581
|
+
request_id?: string;
|
|
582
|
+
error: string;
|
|
583
|
+
message: string;
|
|
599
584
|
};
|
|
600
|
-
|
|
601
|
-
|
|
585
|
+
}
|
|
586
|
+
interface WsMessage_SessionClosed extends WsMessageBase {
|
|
587
|
+
topic: WsTopicTypes['SessionClosed'];
|
|
588
|
+
data: {
|
|
589
|
+
request_id?: string;
|
|
590
|
+
active_session_ids: Array<string>;
|
|
591
|
+
session_id: string;
|
|
602
592
|
};
|
|
603
593
|
}
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
594
|
+
interface WsMessageDataBase {
|
|
595
|
+
type: WsMessageType;
|
|
596
|
+
}
|
|
597
|
+
interface WsMessageDataChunk extends WsMessageDataBase {
|
|
598
|
+
type: WsMessageType.CHUNK;
|
|
599
|
+
content: string;
|
|
600
|
+
}
|
|
601
|
+
interface WsMessageDataContent extends WsMessageDataBase {
|
|
602
|
+
type: WsMessageType.CONTENT;
|
|
603
|
+
content: string;
|
|
604
|
+
message_id: MessageUUID;
|
|
605
|
+
file_uuids?: string[];
|
|
606
|
+
}
|
|
607
|
+
interface WsMessageDataUser extends WsMessageDataBase {
|
|
608
|
+
type: WsMessageType.USER;
|
|
609
|
+
text: string;
|
|
610
|
+
message_id: MessageUUID;
|
|
611
|
+
file_uuids?: string[];
|
|
612
|
+
}
|
|
613
|
+
interface WsMessageDataDelegation extends WsMessageDataBase {
|
|
614
|
+
type: WsMessageType.DELEGATION;
|
|
615
|
+
from: string;
|
|
616
|
+
to: string;
|
|
617
|
+
}
|
|
618
|
+
interface WsMessageDataInvalidate extends WsMessageDataBase {
|
|
619
|
+
type: WsMessageType.INVALIDATE;
|
|
620
|
+
}
|
|
621
|
+
interface WsMessageDataStarted extends WsMessageDataBase {
|
|
622
|
+
type: WsMessageType.RESPONSE_STARTED;
|
|
623
|
+
message_id: MessageUUID;
|
|
624
|
+
}
|
|
625
|
+
interface WsMessageDataToolCall extends WsMessageDataBase {
|
|
626
|
+
type: WsMessageType.TOOL_CALL | WsMessageType.FUNCTION_CALL;
|
|
627
|
+
function_name: string;
|
|
628
|
+
artifact_id?: string;
|
|
629
|
+
}
|
|
630
|
+
interface WsMessageDataArtifact extends WsMessageDataBase {
|
|
631
|
+
type: WsMessageType.ARTIFACT;
|
|
632
|
+
artifact_id?: string;
|
|
633
|
+
}
|
|
634
|
+
interface WsMessageDataToolSuccess extends WsMessageDataBase {
|
|
635
|
+
type: WsMessageType.TOOL_SUCCESS | WsMessageType.FUNCTION_SUCCESS;
|
|
636
|
+
function_name: string;
|
|
637
|
+
artifact_id?: string;
|
|
638
|
+
}
|
|
639
|
+
interface WsMessageDataToolError extends WsMessageDataBase {
|
|
640
|
+
type: WsMessageType.TOOL_ERROR | WsMessageType.FUNCTION_ERROR;
|
|
641
|
+
function_name: string;
|
|
642
|
+
artifact_id?: string;
|
|
643
|
+
}
|
|
644
|
+
interface WsMessageDataError extends WsMessageDataBase {
|
|
645
|
+
type: WsMessageType.ERROR;
|
|
646
|
+
message: string;
|
|
647
|
+
code: string;
|
|
648
|
+
}
|
|
649
|
+
interface WsMessage_SessionMessage extends WsMessageBase {
|
|
650
|
+
topic: WsTopicTypes['SessionMessage'];
|
|
651
|
+
data: (WsMessageDataUser | WsMessageDataContent | WsMessageDataChunk | WsMessageDataDelegation | WsMessageDataToolCall | WsMessageDataError | WsMessageDataInvalidate | WsMessageDataStarted | WsMessageDataToolSuccess | WsMessageDataArtifact | WsMessageDataToolError) & {
|
|
652
|
+
request_id?: string;
|
|
614
653
|
};
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
654
|
+
}
|
|
655
|
+
interface WsMessage_Session extends WsMessageBase {
|
|
656
|
+
topic: WsTopicTypes['Session'];
|
|
657
|
+
data: {
|
|
658
|
+
request_id?: string;
|
|
659
|
+
agent?: string;
|
|
660
|
+
last_message_date?: number;
|
|
661
|
+
model?: string;
|
|
662
|
+
status?: string;
|
|
663
|
+
title?: string;
|
|
664
|
+
type: 'update';
|
|
665
|
+
public_meta?: Array<{
|
|
666
|
+
icon?: string;
|
|
667
|
+
id: string;
|
|
668
|
+
title: string;
|
|
669
|
+
url?: string;
|
|
670
|
+
}>;
|
|
623
671
|
};
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
672
|
+
}
|
|
673
|
+
interface WsMessage_Artifact extends WsMessageBase {
|
|
674
|
+
topic: WsTopicTypes['Artifact'];
|
|
675
|
+
data: Partial<Artifact> & {
|
|
676
|
+
request_id?: string;
|
|
629
677
|
};
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
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
|
-
};
|
|
678
|
+
}
|
|
679
|
+
interface WsMessage_Upload extends WsMessageBase {
|
|
680
|
+
topic: WsTopicTypes['Upload'];
|
|
681
|
+
data: UploadApi.Upload & {
|
|
682
|
+
request_id?: string;
|
|
649
683
|
};
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
*/
|
|
656
|
-
allowAdditionalTags?: Record<string, string[]>;
|
|
684
|
+
}
|
|
685
|
+
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;
|
|
686
|
+
|
|
687
|
+
interface BaseWsCommand {
|
|
688
|
+
type: string;
|
|
657
689
|
/**
|
|
658
|
-
*
|
|
659
|
-
* @default { maxPages: 50, maxSizePerPage: 2097152 }
|
|
690
|
+
* If used, WsService will await a response with the same request_id
|
|
660
691
|
*/
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
692
|
+
request_id?: string;
|
|
693
|
+
}
|
|
694
|
+
interface SessionOpenCommand extends BaseWsCommand {
|
|
695
|
+
type: 'session_open';
|
|
696
|
+
session_id?: string;
|
|
697
|
+
start_token?: string;
|
|
698
|
+
}
|
|
699
|
+
interface SessionCloseCommand extends BaseWsCommand {
|
|
700
|
+
type: 'session_close';
|
|
701
|
+
session_id: string;
|
|
702
|
+
}
|
|
703
|
+
interface SessionMessageCommand extends BaseWsCommand {
|
|
704
|
+
type: 'session_message';
|
|
705
|
+
session_id: string;
|
|
706
|
+
message_id: string;
|
|
707
|
+
data: {
|
|
708
|
+
text: string;
|
|
709
|
+
file_uuids?: string[];
|
|
666
710
|
};
|
|
667
711
|
}
|
|
668
|
-
interface
|
|
669
|
-
|
|
670
|
-
|
|
712
|
+
interface SessionCommandCommand extends BaseWsCommand {
|
|
713
|
+
type: 'session_command';
|
|
714
|
+
session_id: string;
|
|
715
|
+
data: StopCommand | ModelCommand | OtherCommand | AgentCommand;
|
|
671
716
|
}
|
|
672
|
-
interface
|
|
673
|
-
|
|
674
|
-
'@dark'?: Record<string, string>;
|
|
675
|
-
'@light'?: Record<string, string>;
|
|
717
|
+
interface StopCommand {
|
|
718
|
+
command: 'stop';
|
|
676
719
|
}
|
|
677
|
-
interface
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
i18n?: Partial<I18NTextTypes>;
|
|
681
|
-
icons?: Record<string, {
|
|
682
|
-
body: string;
|
|
683
|
-
width: number;
|
|
684
|
-
height: number;
|
|
685
|
-
}>;
|
|
720
|
+
interface ModelCommand {
|
|
721
|
+
command: 'model';
|
|
722
|
+
name: string;
|
|
686
723
|
}
|
|
687
|
-
interface
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
724
|
+
interface AgentCommand {
|
|
725
|
+
command: 'agent';
|
|
726
|
+
name: string;
|
|
727
|
+
}
|
|
728
|
+
interface ExternalEventCommand extends BaseWsCommand {
|
|
729
|
+
type: string;
|
|
730
|
+
data: Record<string, unknown>;
|
|
731
|
+
}
|
|
732
|
+
interface OtherCommand {
|
|
733
|
+
command: string;
|
|
734
|
+
[key: string]: unknown;
|
|
735
|
+
}
|
|
736
|
+
type WsCommand = SessionOpenCommand | SessionCloseCommand | SessionMessageCommand | SessionCommandCommand | ExternalEventCommand;
|
|
737
|
+
|
|
738
|
+
type KnownTopics = '@history' | '@visibility' | '@message' | '@state-error';
|
|
739
|
+
type Events = {
|
|
740
|
+
/** Emitted when pages are updated */
|
|
741
|
+
'@history': (data: {
|
|
742
|
+
path: string;
|
|
743
|
+
}) => void;
|
|
744
|
+
'@visibility': (visible: boolean) => void;
|
|
745
|
+
'@message': (data: WsMessage) => void;
|
|
746
|
+
'@state-error': (data: {
|
|
747
|
+
error: string;
|
|
748
|
+
key?: string;
|
|
749
|
+
}) => void;
|
|
750
|
+
} & {
|
|
751
|
+
[K in string as K extends KnownTopics ? never : K]: (data: WsMessage) => void;
|
|
752
|
+
};
|
|
753
|
+
declare function createEvents(): <T extends string>(topicPattern: T, callback: T extends KnownTopics ? Events[T] : Events["@message"]) => nanoevents.Unsubscribe;
|
|
754
|
+
|
|
755
|
+
interface StateApiOptions {
|
|
756
|
+
/** Override the default page-level scope. Used by web components with persist-key or nested artifacts. */
|
|
757
|
+
scope?: string;
|
|
758
|
+
}
|
|
759
|
+
interface StateApi {
|
|
760
|
+
get: <T = unknown>(key: string, options?: StateApiOptions) => Promise<T | null>;
|
|
761
|
+
set: (key: string, value: unknown, options?: StateApiOptions) => Promise<void>;
|
|
762
|
+
remove: (key: string, options?: StateApiOptions) => Promise<void>;
|
|
763
|
+
clear: (options?: StateApiOptions) => Promise<void>;
|
|
764
|
+
getAll: (options?: StateApiOptions) => Promise<Record<string, unknown>>;
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
interface ProxyWsApi {
|
|
693
768
|
/**
|
|
694
|
-
*
|
|
769
|
+
* Send a raw WebSocket command through the host's WebSocket connection.
|
|
770
|
+
* Fire-and-forget — responses arrive via `on()` event subscriptions.
|
|
695
771
|
*/
|
|
696
|
-
|
|
772
|
+
send: (command: WsCommand) => void;
|
|
697
773
|
/**
|
|
698
|
-
*
|
|
774
|
+
* Send a WebSocket command and wait for the server's response.
|
|
775
|
+
* The command is sent with a `request_id`; the promise resolves when the server echoes it back.
|
|
776
|
+
* Times out after 30 seconds.
|
|
699
777
|
*/
|
|
700
|
-
|
|
778
|
+
sendWithResponse: (command: WsCommand) => Promise<WsMessage>;
|
|
701
779
|
/**
|
|
702
|
-
*
|
|
780
|
+
* Convenience method to send a session command (stop, model, agent, etc.)
|
|
703
781
|
*/
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
allowedOrigins: string[];
|
|
709
|
-
allowedTypes: string[];
|
|
710
|
-
};
|
|
782
|
+
sendCommand: (sessionId: string, data: {
|
|
783
|
+
command: string;
|
|
784
|
+
[key: string]: unknown;
|
|
785
|
+
}) => void;
|
|
711
786
|
}
|
|
712
787
|
|
|
713
788
|
interface FormState {
|
|
@@ -769,6 +844,7 @@ interface ProxyApiInstance {
|
|
|
769
844
|
};
|
|
770
845
|
on: ReturnType<typeof createEvents>;
|
|
771
846
|
state: StateApi;
|
|
847
|
+
ws: ProxyWsApi;
|
|
772
848
|
loadWebComponent: (componentId: string, tagName?: string) => Promise<void>;
|
|
773
849
|
}
|
|
774
850
|
|
|
@@ -795,6 +871,7 @@ interface ProxyConfig {
|
|
|
795
871
|
|
|
796
872
|
declare const GLOBAL_CONFIG_VAR: "__WIPPY_APP_CONFIG__";
|
|
797
873
|
declare const GLOBAL_PROXY_CONFIG_VAR: "__WIPPY_PROXY_CONFIG__";
|
|
874
|
+
declare const GLOBAL_CONFIG_OVERRIDES_VAR: "__WIPPY_CONFIG_OVERRIDES__";
|
|
798
875
|
declare const GLOBAL_API_PROVIDER: "__WIPPY_APP_API__";
|
|
799
876
|
declare const GLOBAL_WEB_COMPONENT_CACHE: "__WIPPY_WEB_COMPONENT_CACHE__";
|
|
800
877
|
declare global {
|
|
@@ -802,6 +879,7 @@ declare global {
|
|
|
802
879
|
[GLOBAL_CONFIG_VAR]: AppConfig;
|
|
803
880
|
[GLOBAL_API_PROVIDER]: ProxyApiInstance;
|
|
804
881
|
[GLOBAL_PROXY_CONFIG_VAR]?: ProxyConfig;
|
|
882
|
+
[GLOBAL_CONFIG_OVERRIDES_VAR]?: AppConfigOverrides;
|
|
805
883
|
[GLOBAL_WEB_COMPONENT_CACHE]: Record<string, {
|
|
806
884
|
usedAt: number;
|
|
807
885
|
data: string;
|
|
@@ -823,6 +901,9 @@ declare const _default: {
|
|
|
823
901
|
info: Record<string, string>;
|
|
824
902
|
help: Record<string, string>;
|
|
825
903
|
accent: Record<string, string>;
|
|
904
|
+
surface: {
|
|
905
|
+
850: string;
|
|
906
|
+
};
|
|
826
907
|
};
|
|
827
908
|
};
|
|
828
909
|
};
|
|
@@ -852,6 +933,7 @@ declare global {
|
|
|
852
933
|
iframe: () => Promise<ProxyApiInstance['host']>;
|
|
853
934
|
on: () => Promise<ProxyApiInstance['on']>;
|
|
854
935
|
state: () => Promise<ProxyApiInstance['state']>;
|
|
936
|
+
ws: () => Promise<ProxyApiInstance['ws']>;
|
|
855
937
|
loadWebComponent: () => Promise<ProxyApiInstance['loadWebComponent']>;
|
|
856
938
|
};
|
|
857
939
|
tailwind?: {
|
package/package.json
CHANGED