@wippy-fe/types-global-proxy 0.0.58 → 0.0.60
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/index.d.ts +189 -7
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PanelTree, FloatingAnchor, ModalSize, SizeValue, PanelTarget } from '@wippy-fe/layout';
|
|
2
|
+
import { AttentionConfig, AttentionSubscriptionOptions, AttentionNotification, AttentionSubscription, AttentionInspectionScope, AttentionInspectionResult, AttentionNodeRef, AttentionSearch, AttentionLayoutRegistration, AttentionLayoutHandle, AttentionInspectionCall, AttentionTargetRefV1, ContextAttachmentEnvelope, AttentionUiActionRequestV1, AttentionUiActionResultV1, AttentionRuntimeBootstrapV1, SurfaceApi, GLOBAL_CONFIG_VAR, GLOBAL_API_PROVIDER, GLOBAL_PROXY_CONFIG_VAR, GLOBAL_WEB_COMPONENT_CACHE } from '@wippy-fe/shared';
|
|
2
3
|
import { AxiosDefaults, AxiosInstance } from 'axios';
|
|
3
|
-
import { SurfaceApi, GLOBAL_CONFIG_VAR, GLOBAL_API_PROVIDER, GLOBAL_PROXY_CONFIG_VAR, GLOBAL_WEB_COMPONENT_CACHE } from '@wippy-fe/shared';
|
|
4
4
|
import { ConfirmationOptions } from 'primevue/confirmationoptions';
|
|
5
5
|
import { ToastMessageOptions } from 'primevue/toast';
|
|
6
6
|
import * as nanoevents from 'nanoevents';
|
|
@@ -273,6 +273,7 @@ interface ApiRoutes {
|
|
|
273
273
|
list: string;
|
|
274
274
|
get: string;
|
|
275
275
|
messages: string;
|
|
276
|
+
context: string;
|
|
276
277
|
};
|
|
277
278
|
models: {
|
|
278
279
|
list: string;
|
|
@@ -282,6 +283,7 @@ interface ApiRoutes {
|
|
|
282
283
|
list: string;
|
|
283
284
|
get: string;
|
|
284
285
|
create: string;
|
|
286
|
+
delete: string;
|
|
285
287
|
};
|
|
286
288
|
artifacts: {
|
|
287
289
|
get: string;
|
|
@@ -640,6 +642,7 @@ interface AppConfig {
|
|
|
640
642
|
axiosDefaults?: Partial<AxiosDefaults>;
|
|
641
643
|
routePrefix?: string;
|
|
642
644
|
apiRoutes?: ApiRoutesOverride;
|
|
645
|
+
attention?: AttentionConfig;
|
|
643
646
|
tanstack?: TanstackConfig;
|
|
644
647
|
themeMode?: ThemeMode;
|
|
645
648
|
theming: {
|
|
@@ -737,6 +740,78 @@ interface SanitizeOptions {
|
|
|
737
740
|
extraTags?: Record<string, string[]>;
|
|
738
741
|
}
|
|
739
742
|
|
|
743
|
+
interface AttentionInspectionApi {
|
|
744
|
+
subscribe: (options: AttentionSubscriptionOptions, listener: (notification: AttentionNotification) => void) => AttentionSubscription;
|
|
745
|
+
getCursor: (scope?: AttentionInspectionScope) => Promise<AttentionInspectionResult>;
|
|
746
|
+
getFocus: (scope?: AttentionInspectionScope) => Promise<AttentionInspectionResult>;
|
|
747
|
+
getSelection: (scope?: AttentionInspectionScope) => Promise<AttentionInspectionResult>;
|
|
748
|
+
atPoint: (point: {
|
|
749
|
+
x: number;
|
|
750
|
+
y: number;
|
|
751
|
+
coordinate_space?: 'host-viewport' | AttentionNodeRef;
|
|
752
|
+
radius_css_px?: number;
|
|
753
|
+
step_css_px?: number;
|
|
754
|
+
}, scope?: AttentionInspectionScope) => Promise<AttentionInspectionResult>;
|
|
755
|
+
getTree: (options?: AttentionInspectionScope & {
|
|
756
|
+
limit?: number;
|
|
757
|
+
depth?: number;
|
|
758
|
+
continuation?: string;
|
|
759
|
+
}) => Promise<AttentionInspectionResult>;
|
|
760
|
+
find: (query: AttentionSearch, options?: AttentionInspectionScope & {
|
|
761
|
+
limit?: number;
|
|
762
|
+
continuation?: string;
|
|
763
|
+
}) => Promise<AttentionInspectionResult>;
|
|
764
|
+
getGeometry: (node: AttentionNodeRef, scope?: AttentionInspectionScope) => Promise<AttentionInspectionResult>;
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
interface AttentionSemanticLabels {
|
|
768
|
+
role?: string;
|
|
769
|
+
name?: string;
|
|
770
|
+
text?: string;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
interface AttentionApi extends AttentionInspectionApi {
|
|
774
|
+
registerSemantic: (element: Element, labels: AttentionSemanticLabels) => () => void;
|
|
775
|
+
registerLayoutProvider: (input: AttentionLayoutRegistration) => AttentionLayoutHandle;
|
|
776
|
+
readonly enabled: boolean;
|
|
777
|
+
supports: (feature: 'message-context' | 'agent-actions' | 'visual-capture') => boolean;
|
|
778
|
+
prepareMessageContext: (request: {
|
|
779
|
+
requestId: string;
|
|
780
|
+
text: string;
|
|
781
|
+
sessionId?: string;
|
|
782
|
+
startToken?: string;
|
|
783
|
+
attentionContextEnabled?: boolean;
|
|
784
|
+
}) => Promise<{
|
|
785
|
+
session_id: string;
|
|
786
|
+
attention_context?: {
|
|
787
|
+
enabled: boolean;
|
|
788
|
+
revision: number;
|
|
789
|
+
};
|
|
790
|
+
context_attachments_ref?: unknown;
|
|
791
|
+
ui_action_intent_nonce?: string;
|
|
792
|
+
}>;
|
|
793
|
+
registerComposerDrafts?: (request: AttentionComposerDraftRegistrationRequest) => AttentionComposerDraftRegistration;
|
|
794
|
+
}
|
|
795
|
+
interface AttentionComposerDraftFile {
|
|
796
|
+
id: string;
|
|
797
|
+
uuid?: string;
|
|
798
|
+
filename: string;
|
|
799
|
+
mime_type: string;
|
|
800
|
+
size: number;
|
|
801
|
+
status: 'uploading' | 'ready' | 'error';
|
|
802
|
+
}
|
|
803
|
+
interface AttentionComposerDraftRegistrationRequest {
|
|
804
|
+
sessionId?: string;
|
|
805
|
+
visible?: boolean;
|
|
806
|
+
onChange: (files: AttentionComposerDraftFile[]) => void;
|
|
807
|
+
}
|
|
808
|
+
interface AttentionComposerDraftRegistration {
|
|
809
|
+
update: (sessionId?: string, visible?: boolean) => void;
|
|
810
|
+
remove: (id: string) => Promise<void>;
|
|
811
|
+
commit: (uuids: string[]) => void;
|
|
812
|
+
dispose: () => void;
|
|
813
|
+
}
|
|
814
|
+
|
|
740
815
|
interface BridgeRequestOptions {
|
|
741
816
|
timeoutMs?: number;
|
|
742
817
|
}
|
|
@@ -781,6 +856,36 @@ declare namespace UploadApi {
|
|
|
781
856
|
success: boolean;
|
|
782
857
|
uuid: string;
|
|
783
858
|
}
|
|
859
|
+
interface DeleteResponse {
|
|
860
|
+
success: boolean;
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
interface InspectionControlRequest {
|
|
865
|
+
schema: 'wippy.ui-action.v1';
|
|
866
|
+
message_type: 'request';
|
|
867
|
+
mode: 'inspect';
|
|
868
|
+
action_id: string;
|
|
869
|
+
request_id: string;
|
|
870
|
+
session_id: string;
|
|
871
|
+
host_instance_id: string;
|
|
872
|
+
created_at: string;
|
|
873
|
+
expires_at: string;
|
|
874
|
+
query: AttentionInspectionCall;
|
|
875
|
+
}
|
|
876
|
+
interface InspectionControlResult {
|
|
877
|
+
schema: 'wippy.ui-action.v1';
|
|
878
|
+
message_type: 'result';
|
|
879
|
+
result_id: string;
|
|
880
|
+
in_reply_to_action_id: string;
|
|
881
|
+
request_id: string;
|
|
882
|
+
session_id: string;
|
|
883
|
+
host_instance_id: string;
|
|
884
|
+
completed_at: string;
|
|
885
|
+
status: 'inspected' | 'unavailable' | 'expired' | 'stale' | 'error';
|
|
886
|
+
inspection?: AttentionInspectionResult;
|
|
887
|
+
targets?: AttentionTargetRefV1[];
|
|
888
|
+
reason?: string;
|
|
784
889
|
}
|
|
785
890
|
|
|
786
891
|
declare enum ArtifactStatus {
|
|
@@ -845,6 +950,15 @@ interface Artifact {
|
|
|
845
950
|
status: ArtifactStatus;
|
|
846
951
|
}
|
|
847
952
|
|
|
953
|
+
interface SessionInteraction {
|
|
954
|
+
can_send: boolean;
|
|
955
|
+
revision: number;
|
|
956
|
+
}
|
|
957
|
+
interface SessionInput {
|
|
958
|
+
state: 'pending' | 'applied';
|
|
959
|
+
after_message_id?: string;
|
|
960
|
+
}
|
|
961
|
+
|
|
848
962
|
type ArtifactUUID = string;
|
|
849
963
|
type PageUUID = string;
|
|
850
964
|
type SessionUUID = string;
|
|
@@ -865,6 +979,7 @@ declare const WsTopicPrefixes: {
|
|
|
865
979
|
readonly Action: "action";
|
|
866
980
|
readonly Registry: "registry";
|
|
867
981
|
readonly RegistryEntry: "entry";
|
|
982
|
+
readonly UiActionRequest: "session_ui_action_request";
|
|
868
983
|
};
|
|
869
984
|
interface WsTopicTypes {
|
|
870
985
|
/**
|
|
@@ -919,9 +1034,13 @@ interface WsTopicTypes {
|
|
|
919
1034
|
* Upload was created or updated
|
|
920
1035
|
*/
|
|
921
1036
|
Upload: `${typeof WsTopicPrefixes.Upload}:${string}`;
|
|
1037
|
+
/** Agent-requested host overlay action. */
|
|
1038
|
+
UiActionRequest: typeof WsTopicPrefixes.UiActionRequest;
|
|
922
1039
|
}
|
|
923
1040
|
type WsTopic = WsTopicTypes[keyof WsTopicTypes];
|
|
924
1041
|
declare enum WsMessageType {
|
|
1042
|
+
/** Patch an existing message or session. */
|
|
1043
|
+
UPDATE = "update",
|
|
925
1044
|
/** Contains the actual content of the message */
|
|
926
1045
|
CONTENT = "content",
|
|
927
1046
|
/** Contains content of the message to append to current one */
|
|
@@ -1038,6 +1157,36 @@ interface WsMessageDataUser extends WsMessageDataBase {
|
|
|
1038
1157
|
text: string;
|
|
1039
1158
|
message_id: MessageUUID;
|
|
1040
1159
|
file_uuids?: string[];
|
|
1160
|
+
context_attachments?: ContextAttachmentEnvelope[];
|
|
1161
|
+
input?: SessionInput;
|
|
1162
|
+
}
|
|
1163
|
+
interface WsMessage_UiActionRequest extends WsMessageBase {
|
|
1164
|
+
topic: WsTopicTypes['UiActionRequest'];
|
|
1165
|
+
data: AttentionUiActionRequestV1 | InspectionControlRequest;
|
|
1166
|
+
}
|
|
1167
|
+
interface WsMessageDataCommandResponse {
|
|
1168
|
+
type: 'command_response';
|
|
1169
|
+
request_id: string;
|
|
1170
|
+
success: boolean;
|
|
1171
|
+
code?: string;
|
|
1172
|
+
message?: string;
|
|
1173
|
+
context_attachments_transport?: {
|
|
1174
|
+
version: number;
|
|
1175
|
+
staging: boolean;
|
|
1176
|
+
max_context_bytes: number;
|
|
1177
|
+
};
|
|
1178
|
+
context_attachments_capabilities?: {
|
|
1179
|
+
version: number;
|
|
1180
|
+
handlers: Array<{
|
|
1181
|
+
kind: string;
|
|
1182
|
+
versions: number[];
|
|
1183
|
+
}>;
|
|
1184
|
+
};
|
|
1185
|
+
}
|
|
1186
|
+
interface WsMessageDataUpdate extends WsMessageDataBase {
|
|
1187
|
+
type: WsMessageType.UPDATE;
|
|
1188
|
+
message_id: MessageUUID;
|
|
1189
|
+
input: SessionInput;
|
|
1041
1190
|
}
|
|
1042
1191
|
interface WsMessageDataDelegation extends WsMessageDataBase {
|
|
1043
1192
|
type: WsMessageType.DELEGATION;
|
|
@@ -1077,27 +1226,36 @@ interface WsMessageDataError extends WsMessageDataBase {
|
|
|
1077
1226
|
}
|
|
1078
1227
|
interface WsMessage_SessionMessage extends WsMessageBase {
|
|
1079
1228
|
topic: WsTopicTypes['SessionMessage'];
|
|
1080
|
-
data: (WsMessageDataUser | WsMessageDataContent | WsMessageDataChunk | WsMessageDataDelegation | WsMessageDataToolCall | WsMessageDataError | WsMessageDataInvalidate | WsMessageDataStarted | WsMessageDataToolSuccess | WsMessageDataArtifact | WsMessageDataToolError) & {
|
|
1229
|
+
data: (WsMessageDataUser | WsMessageDataContent | WsMessageDataChunk | WsMessageDataDelegation | WsMessageDataToolCall | WsMessageDataError | WsMessageDataInvalidate | WsMessageDataStarted | WsMessageDataToolSuccess | WsMessageDataArtifact | WsMessageDataToolError | WsMessageDataUpdate) & {
|
|
1081
1230
|
request_id?: string;
|
|
1082
1231
|
};
|
|
1083
1232
|
}
|
|
1084
1233
|
interface WsMessage_Session extends WsMessageBase {
|
|
1085
1234
|
topic: WsTopicTypes['Session'];
|
|
1086
|
-
data: {
|
|
1235
|
+
data: WsMessageDataCommandResponse | {
|
|
1087
1236
|
request_id?: string;
|
|
1237
|
+
session_id?: SessionUUID;
|
|
1088
1238
|
agent?: string;
|
|
1089
1239
|
last_message_date?: number;
|
|
1090
1240
|
model?: string;
|
|
1091
1241
|
status?: string;
|
|
1092
1242
|
title?: string;
|
|
1093
1243
|
type: 'update';
|
|
1244
|
+
interaction?: SessionInteraction;
|
|
1094
1245
|
public_meta?: Array<{
|
|
1095
1246
|
icon?: string;
|
|
1096
1247
|
id: string;
|
|
1097
1248
|
title: string;
|
|
1098
1249
|
url?: string;
|
|
1099
1250
|
}>;
|
|
1100
|
-
|
|
1251
|
+
attention_context?: {
|
|
1252
|
+
enabled: boolean;
|
|
1253
|
+
revision: number;
|
|
1254
|
+
};
|
|
1255
|
+
} | (WsMessageDataError & {
|
|
1256
|
+
request_id?: string;
|
|
1257
|
+
session_id?: SessionUUID;
|
|
1258
|
+
});
|
|
1101
1259
|
}
|
|
1102
1260
|
interface WsMessage_Artifact extends WsMessageBase {
|
|
1103
1261
|
topic: WsTopicTypes['Artifact'];
|
|
@@ -1111,8 +1269,14 @@ interface WsMessage_Upload extends WsMessageBase {
|
|
|
1111
1269
|
request_id?: string;
|
|
1112
1270
|
};
|
|
1113
1271
|
}
|
|
1114
|
-
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;
|
|
1272
|
+
type WsMessage = WsMessage_Welcome | WsMessage_Pages | WsMessage_Page | WsMessage_SessionMessage | WsMessage_Session | WsMessage_SessionClosed | WsMessage_Error | WsMessage_Artifact | WsMessage_SessionOpen | WsMessage_Action | WsMessage_UiActionRequest | WsMessage_Registry | WsMessage_RegistryEntry | WsMessage_Upload;
|
|
1115
1273
|
|
|
1274
|
+
interface ContextAttachmentsReference {
|
|
1275
|
+
version: 1;
|
|
1276
|
+
id: string;
|
|
1277
|
+
content_hash: string;
|
|
1278
|
+
content_bytes: number;
|
|
1279
|
+
}
|
|
1116
1280
|
interface BaseWsCommand {
|
|
1117
1281
|
type: string;
|
|
1118
1282
|
/**
|
|
@@ -1124,6 +1288,7 @@ interface SessionOpenCommand extends BaseWsCommand {
|
|
|
1124
1288
|
type: 'session_open';
|
|
1125
1289
|
session_id?: string;
|
|
1126
1290
|
start_token?: string;
|
|
1291
|
+
attention_context_enabled?: boolean;
|
|
1127
1292
|
}
|
|
1128
1293
|
interface SessionCloseCommand extends BaseWsCommand {
|
|
1129
1294
|
type: 'session_close';
|
|
@@ -1132,10 +1297,19 @@ interface SessionCloseCommand extends BaseWsCommand {
|
|
|
1132
1297
|
interface SessionMessageCommand extends BaseWsCommand {
|
|
1133
1298
|
type: 'session_message';
|
|
1134
1299
|
session_id: string;
|
|
1135
|
-
|
|
1300
|
+
/** Legacy fire-and-forget servers require this client-generated ID. */
|
|
1301
|
+
message_id?: string;
|
|
1136
1302
|
data: {
|
|
1137
1303
|
text: string;
|
|
1138
1304
|
file_uuids?: string[];
|
|
1305
|
+
context_attachments?: ContextAttachmentEnvelope[];
|
|
1306
|
+
context_attachments_ref?: ContextAttachmentsReference;
|
|
1307
|
+
runtime_context?: {
|
|
1308
|
+
attention?: {
|
|
1309
|
+
host_instance_id: string;
|
|
1310
|
+
agent_actions_enabled: boolean;
|
|
1311
|
+
};
|
|
1312
|
+
};
|
|
1139
1313
|
};
|
|
1140
1314
|
}
|
|
1141
1315
|
interface SessionCommandCommand extends BaseWsCommand {
|
|
@@ -1143,6 +1317,11 @@ interface SessionCommandCommand extends BaseWsCommand {
|
|
|
1143
1317
|
session_id: string;
|
|
1144
1318
|
data: StopCommand | ModelCommand | OtherCommand | AgentCommand;
|
|
1145
1319
|
}
|
|
1320
|
+
interface UiActionResultCommand extends BaseWsCommand {
|
|
1321
|
+
type: 'session_ui_action_result';
|
|
1322
|
+
session_id: string;
|
|
1323
|
+
data: AttentionUiActionResultV1 | InspectionControlResult;
|
|
1324
|
+
}
|
|
1146
1325
|
interface StopCommand {
|
|
1147
1326
|
command: 'stop';
|
|
1148
1327
|
}
|
|
@@ -1162,7 +1341,7 @@ interface OtherCommand {
|
|
|
1162
1341
|
command: string;
|
|
1163
1342
|
[key: string]: unknown;
|
|
1164
1343
|
}
|
|
1165
|
-
type WsCommand = SessionOpenCommand | SessionCloseCommand | SessionMessageCommand | SessionCommandCommand | ExternalEventCommand;
|
|
1344
|
+
type WsCommand = SessionOpenCommand | SessionCloseCommand | SessionMessageCommand | SessionCommandCommand | UiActionResultCommand | ExternalEventCommand;
|
|
1166
1345
|
|
|
1167
1346
|
/**
|
|
1168
1347
|
* Read-only mirror of the current host `HostLayoutDeclaration`, minus
|
|
@@ -1322,6 +1501,7 @@ interface HtmlInjectOptions {
|
|
|
1322
1501
|
isNavOwner?: boolean;
|
|
1323
1502
|
configOverrides?: AppConfigOverrides;
|
|
1324
1503
|
proxyConfig?: ProxyConfig;
|
|
1504
|
+
attentionBootstrap?: AttentionRuntimeBootstrapV1;
|
|
1325
1505
|
}
|
|
1326
1506
|
interface ProxyHtmlApi {
|
|
1327
1507
|
inject: (sourceHtml: string, options?: HtmlInjectOptions) => Promise<string>;
|
|
@@ -1433,6 +1613,7 @@ interface FormResult {
|
|
|
1433
1613
|
type LimitedConfirmationOptions = Omit<ConfirmationOptions, 'target' | 'appendTo' | 'onShow' | 'onHide'>;
|
|
1434
1614
|
interface ProxyApiInstance {
|
|
1435
1615
|
config: ChildAppConfig;
|
|
1616
|
+
attention: AttentionApi;
|
|
1436
1617
|
/** @deprecated, use `host` instead */
|
|
1437
1618
|
iframe: {
|
|
1438
1619
|
toast: (message: ToastMessageOptions) => void;
|
|
@@ -1599,6 +1780,7 @@ declare global {
|
|
|
1599
1780
|
config: () => Promise<ChildAppConfig>;
|
|
1600
1781
|
instance: () => Promise<ProxyApiInstance>;
|
|
1601
1782
|
api: () => Promise<ProxyApiInstance['api']>;
|
|
1783
|
+
attention: () => Promise<ProxyApiInstance['attention']>;
|
|
1602
1784
|
/** @deprecated Use `$W.api` instead */
|
|
1603
1785
|
form: () => Promise<ProxyApiInstance['api']>;
|
|
1604
1786
|
host: () => Promise<ProxyApiInstance['host']>;
|
package/package.json
CHANGED