@wippy-fe/types-global-proxy 0.0.59 → 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.
Files changed (2) hide show
  1. package/index.d.ts +163 -4
  2. 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 {
@@ -874,6 +979,7 @@ declare const WsTopicPrefixes: {
874
979
  readonly Action: "action";
875
980
  readonly Registry: "registry";
876
981
  readonly RegistryEntry: "entry";
982
+ readonly UiActionRequest: "session_ui_action_request";
877
983
  };
878
984
  interface WsTopicTypes {
879
985
  /**
@@ -928,6 +1034,8 @@ interface WsTopicTypes {
928
1034
  * Upload was created or updated
929
1035
  */
930
1036
  Upload: `${typeof WsTopicPrefixes.Upload}:${string}`;
1037
+ /** Agent-requested host overlay action. */
1038
+ UiActionRequest: typeof WsTopicPrefixes.UiActionRequest;
931
1039
  }
932
1040
  type WsTopic = WsTopicTypes[keyof WsTopicTypes];
933
1041
  declare enum WsMessageType {
@@ -1049,8 +1157,32 @@ interface WsMessageDataUser extends WsMessageDataBase {
1049
1157
  text: string;
1050
1158
  message_id: MessageUUID;
1051
1159
  file_uuids?: string[];
1160
+ context_attachments?: ContextAttachmentEnvelope[];
1052
1161
  input?: SessionInput;
1053
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
+ }
1054
1186
  interface WsMessageDataUpdate extends WsMessageDataBase {
1055
1187
  type: WsMessageType.UPDATE;
1056
1188
  message_id: MessageUUID;
@@ -1100,7 +1232,7 @@ interface WsMessage_SessionMessage extends WsMessageBase {
1100
1232
  }
1101
1233
  interface WsMessage_Session extends WsMessageBase {
1102
1234
  topic: WsTopicTypes['Session'];
1103
- data: {
1235
+ data: WsMessageDataCommandResponse | {
1104
1236
  request_id?: string;
1105
1237
  session_id?: SessionUUID;
1106
1238
  agent?: string;
@@ -1116,6 +1248,10 @@ interface WsMessage_Session extends WsMessageBase {
1116
1248
  title: string;
1117
1249
  url?: string;
1118
1250
  }>;
1251
+ attention_context?: {
1252
+ enabled: boolean;
1253
+ revision: number;
1254
+ };
1119
1255
  } | (WsMessageDataError & {
1120
1256
  request_id?: string;
1121
1257
  session_id?: SessionUUID;
@@ -1133,8 +1269,14 @@ interface WsMessage_Upload extends WsMessageBase {
1133
1269
  request_id?: string;
1134
1270
  };
1135
1271
  }
1136
- 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;
1137
1273
 
1274
+ interface ContextAttachmentsReference {
1275
+ version: 1;
1276
+ id: string;
1277
+ content_hash: string;
1278
+ content_bytes: number;
1279
+ }
1138
1280
  interface BaseWsCommand {
1139
1281
  type: string;
1140
1282
  /**
@@ -1146,6 +1288,7 @@ interface SessionOpenCommand extends BaseWsCommand {
1146
1288
  type: 'session_open';
1147
1289
  session_id?: string;
1148
1290
  start_token?: string;
1291
+ attention_context_enabled?: boolean;
1149
1292
  }
1150
1293
  interface SessionCloseCommand extends BaseWsCommand {
1151
1294
  type: 'session_close';
@@ -1159,6 +1302,14 @@ interface SessionMessageCommand extends BaseWsCommand {
1159
1302
  data: {
1160
1303
  text: string;
1161
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
+ };
1162
1313
  };
1163
1314
  }
1164
1315
  interface SessionCommandCommand extends BaseWsCommand {
@@ -1166,6 +1317,11 @@ interface SessionCommandCommand extends BaseWsCommand {
1166
1317
  session_id: string;
1167
1318
  data: StopCommand | ModelCommand | OtherCommand | AgentCommand;
1168
1319
  }
1320
+ interface UiActionResultCommand extends BaseWsCommand {
1321
+ type: 'session_ui_action_result';
1322
+ session_id: string;
1323
+ data: AttentionUiActionResultV1 | InspectionControlResult;
1324
+ }
1169
1325
  interface StopCommand {
1170
1326
  command: 'stop';
1171
1327
  }
@@ -1185,7 +1341,7 @@ interface OtherCommand {
1185
1341
  command: string;
1186
1342
  [key: string]: unknown;
1187
1343
  }
1188
- type WsCommand = SessionOpenCommand | SessionCloseCommand | SessionMessageCommand | SessionCommandCommand | ExternalEventCommand;
1344
+ type WsCommand = SessionOpenCommand | SessionCloseCommand | SessionMessageCommand | SessionCommandCommand | UiActionResultCommand | ExternalEventCommand;
1189
1345
 
1190
1346
  /**
1191
1347
  * Read-only mirror of the current host `HostLayoutDeclaration`, minus
@@ -1345,6 +1501,7 @@ interface HtmlInjectOptions {
1345
1501
  isNavOwner?: boolean;
1346
1502
  configOverrides?: AppConfigOverrides;
1347
1503
  proxyConfig?: ProxyConfig;
1504
+ attentionBootstrap?: AttentionRuntimeBootstrapV1;
1348
1505
  }
1349
1506
  interface ProxyHtmlApi {
1350
1507
  inject: (sourceHtml: string, options?: HtmlInjectOptions) => Promise<string>;
@@ -1456,6 +1613,7 @@ interface FormResult {
1456
1613
  type LimitedConfirmationOptions = Omit<ConfirmationOptions, 'target' | 'appendTo' | 'onShow' | 'onHide'>;
1457
1614
  interface ProxyApiInstance {
1458
1615
  config: ChildAppConfig;
1616
+ attention: AttentionApi;
1459
1617
  /** @deprecated, use `host` instead */
1460
1618
  iframe: {
1461
1619
  toast: (message: ToastMessageOptions) => void;
@@ -1622,6 +1780,7 @@ declare global {
1622
1780
  config: () => Promise<ChildAppConfig>;
1623
1781
  instance: () => Promise<ProxyApiInstance>;
1624
1782
  api: () => Promise<ProxyApiInstance['api']>;
1783
+ attention: () => Promise<ProxyApiInstance['attention']>;
1625
1784
  /** @deprecated Use `$W.api` instead */
1626
1785
  form: () => Promise<ProxyApiInstance['api']>;
1627
1786
  host: () => Promise<ProxyApiInstance['host']>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wippy-fe/types-global-proxy",
3
- "version": "0.0.59",
3
+ "version": "0.0.60",
4
4
  "description": "Global type declarations for Wippy iframe proxy (window.getWippyApi, $W, etc.)",
5
5
  "license": "UNLICENSED",
6
6
  "types": "index.d.ts",