@wippy-fe/types-global-proxy 0.0.59 → 0.0.61

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 +165 -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,8 @@ interface ApiRoutes {
273
273
  list: string;
274
274
  get: string;
275
275
  messages: string;
276
+ context: string;
277
+ capabilities: string;
276
278
  };
277
279
  models: {
278
280
  list: string;
@@ -282,6 +284,7 @@ interface ApiRoutes {
282
284
  list: string;
283
285
  get: string;
284
286
  create: string;
287
+ delete: string;
285
288
  };
286
289
  artifacts: {
287
290
  get: string;
@@ -640,6 +643,7 @@ interface AppConfig {
640
643
  axiosDefaults?: Partial<AxiosDefaults>;
641
644
  routePrefix?: string;
642
645
  apiRoutes?: ApiRoutesOverride;
646
+ attention?: AttentionConfig;
643
647
  tanstack?: TanstackConfig;
644
648
  themeMode?: ThemeMode;
645
649
  theming: {
@@ -737,6 +741,78 @@ interface SanitizeOptions {
737
741
  extraTags?: Record<string, string[]>;
738
742
  }
739
743
 
744
+ interface AttentionInspectionApi {
745
+ subscribe: (options: AttentionSubscriptionOptions, listener: (notification: AttentionNotification) => void) => AttentionSubscription;
746
+ getCursor: (scope?: AttentionInspectionScope) => Promise<AttentionInspectionResult>;
747
+ getFocus: (scope?: AttentionInspectionScope) => Promise<AttentionInspectionResult>;
748
+ getSelection: (scope?: AttentionInspectionScope) => Promise<AttentionInspectionResult>;
749
+ atPoint: (point: {
750
+ x: number;
751
+ y: number;
752
+ coordinate_space?: 'host-viewport' | AttentionNodeRef;
753
+ radius_css_px?: number;
754
+ step_css_px?: number;
755
+ }, scope?: AttentionInspectionScope) => Promise<AttentionInspectionResult>;
756
+ getTree: (options?: AttentionInspectionScope & {
757
+ limit?: number;
758
+ depth?: number;
759
+ continuation?: string;
760
+ }) => Promise<AttentionInspectionResult>;
761
+ find: (query: AttentionSearch, options?: AttentionInspectionScope & {
762
+ limit?: number;
763
+ continuation?: string;
764
+ }) => Promise<AttentionInspectionResult>;
765
+ getGeometry: (node: AttentionNodeRef, scope?: AttentionInspectionScope) => Promise<AttentionInspectionResult>;
766
+ }
767
+
768
+ interface AttentionSemanticLabels {
769
+ role?: string;
770
+ name?: string;
771
+ text?: string;
772
+ }
773
+
774
+ interface AttentionApi extends AttentionInspectionApi {
775
+ registerSemantic: (element: Element, labels: AttentionSemanticLabels) => () => void;
776
+ registerLayoutProvider: (input: AttentionLayoutRegistration) => AttentionLayoutHandle;
777
+ readonly enabled: boolean;
778
+ supports: (feature: 'message-context' | 'agent-actions' | 'visual-capture') => boolean;
779
+ prepareMessageContext: (request: {
780
+ requestId: string;
781
+ text: string;
782
+ sessionId?: string;
783
+ startToken?: string;
784
+ attentionContextEnabled?: boolean;
785
+ }) => Promise<{
786
+ session_id: string;
787
+ attention_context?: {
788
+ enabled: boolean;
789
+ revision: number;
790
+ };
791
+ context_attachments_ref?: unknown;
792
+ ui_action_intent_nonce?: string;
793
+ }>;
794
+ registerComposerDrafts?: (request: AttentionComposerDraftRegistrationRequest) => AttentionComposerDraftRegistration;
795
+ }
796
+ interface AttentionComposerDraftFile {
797
+ id: string;
798
+ uuid?: string;
799
+ filename: string;
800
+ mime_type: string;
801
+ size: number;
802
+ status: 'uploading' | 'ready' | 'error';
803
+ }
804
+ interface AttentionComposerDraftRegistrationRequest {
805
+ sessionId?: string;
806
+ visible?: boolean;
807
+ onChange: (files: AttentionComposerDraftFile[]) => void;
808
+ }
809
+ interface AttentionComposerDraftRegistration {
810
+ update: (sessionId?: string, visible?: boolean) => void;
811
+ remove: (id: string) => Promise<void>;
812
+ commit: (uuids: string[]) => void;
813
+ dispose: () => void;
814
+ }
815
+
740
816
  interface BridgeRequestOptions {
741
817
  timeoutMs?: number;
742
818
  }
@@ -781,6 +857,36 @@ declare namespace UploadApi {
781
857
  success: boolean;
782
858
  uuid: string;
783
859
  }
860
+ interface DeleteResponse {
861
+ success: boolean;
862
+ }
863
+ }
864
+
865
+ interface InspectionControlRequest {
866
+ schema: 'wippy.ui-action.v1';
867
+ message_type: 'request';
868
+ mode: 'inspect';
869
+ action_id: string;
870
+ request_id: string;
871
+ session_id: string;
872
+ host_instance_id: string;
873
+ created_at: string;
874
+ expires_at: string;
875
+ query: AttentionInspectionCall;
876
+ }
877
+ interface InspectionControlResult {
878
+ schema: 'wippy.ui-action.v1';
879
+ message_type: 'result';
880
+ result_id: string;
881
+ in_reply_to_action_id: string;
882
+ request_id: string;
883
+ session_id: string;
884
+ host_instance_id: string;
885
+ completed_at: string;
886
+ status: 'inspected' | 'unavailable' | 'expired' | 'stale' | 'error';
887
+ inspection?: AttentionInspectionResult;
888
+ targets?: AttentionTargetRefV1[];
889
+ reason?: string;
784
890
  }
785
891
 
786
892
  declare enum ArtifactStatus {
@@ -874,6 +980,7 @@ declare const WsTopicPrefixes: {
874
980
  readonly Action: "action";
875
981
  readonly Registry: "registry";
876
982
  readonly RegistryEntry: "entry";
983
+ readonly UiActionRequest: "session_ui_action_request";
877
984
  };
878
985
  interface WsTopicTypes {
879
986
  /**
@@ -928,6 +1035,8 @@ interface WsTopicTypes {
928
1035
  * Upload was created or updated
929
1036
  */
930
1037
  Upload: `${typeof WsTopicPrefixes.Upload}:${string}`;
1038
+ /** Agent-requested host overlay action. */
1039
+ UiActionRequest: typeof WsTopicPrefixes.UiActionRequest;
931
1040
  }
932
1041
  type WsTopic = WsTopicTypes[keyof WsTopicTypes];
933
1042
  declare enum WsMessageType {
@@ -1047,10 +1156,35 @@ interface WsMessageDataContent extends WsMessageDataBase {
1047
1156
  interface WsMessageDataUser extends WsMessageDataBase {
1048
1157
  type: WsMessageType.USER;
1049
1158
  text: string;
1159
+ timestamp?: number;
1050
1160
  message_id: MessageUUID;
1051
1161
  file_uuids?: string[];
1162
+ context_attachments?: ContextAttachmentEnvelope[];
1052
1163
  input?: SessionInput;
1053
1164
  }
1165
+ interface WsMessage_UiActionRequest extends WsMessageBase {
1166
+ topic: WsTopicTypes['UiActionRequest'];
1167
+ data: AttentionUiActionRequestV1 | InspectionControlRequest;
1168
+ }
1169
+ interface WsMessageDataCommandResponse {
1170
+ type: 'command_response';
1171
+ request_id: string;
1172
+ success: boolean;
1173
+ code?: string;
1174
+ message?: string;
1175
+ context_attachments_transport?: {
1176
+ version: number;
1177
+ staging: boolean;
1178
+ max_context_bytes: number;
1179
+ };
1180
+ context_attachments_capabilities?: {
1181
+ version: number;
1182
+ handlers: Array<{
1183
+ kind: string;
1184
+ versions: number[];
1185
+ }>;
1186
+ };
1187
+ }
1054
1188
  interface WsMessageDataUpdate extends WsMessageDataBase {
1055
1189
  type: WsMessageType.UPDATE;
1056
1190
  message_id: MessageUUID;
@@ -1100,7 +1234,7 @@ interface WsMessage_SessionMessage extends WsMessageBase {
1100
1234
  }
1101
1235
  interface WsMessage_Session extends WsMessageBase {
1102
1236
  topic: WsTopicTypes['Session'];
1103
- data: {
1237
+ data: WsMessageDataCommandResponse | {
1104
1238
  request_id?: string;
1105
1239
  session_id?: SessionUUID;
1106
1240
  agent?: string;
@@ -1116,6 +1250,10 @@ interface WsMessage_Session extends WsMessageBase {
1116
1250
  title: string;
1117
1251
  url?: string;
1118
1252
  }>;
1253
+ attention_context?: {
1254
+ enabled: boolean;
1255
+ revision: number;
1256
+ };
1119
1257
  } | (WsMessageDataError & {
1120
1258
  request_id?: string;
1121
1259
  session_id?: SessionUUID;
@@ -1133,8 +1271,14 @@ interface WsMessage_Upload extends WsMessageBase {
1133
1271
  request_id?: string;
1134
1272
  };
1135
1273
  }
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;
1274
+ 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
1275
 
1276
+ interface ContextAttachmentsReference {
1277
+ version: 1;
1278
+ id: string;
1279
+ content_hash: string;
1280
+ content_bytes: number;
1281
+ }
1138
1282
  interface BaseWsCommand {
1139
1283
  type: string;
1140
1284
  /**
@@ -1146,6 +1290,7 @@ interface SessionOpenCommand extends BaseWsCommand {
1146
1290
  type: 'session_open';
1147
1291
  session_id?: string;
1148
1292
  start_token?: string;
1293
+ attention_context_enabled?: boolean;
1149
1294
  }
1150
1295
  interface SessionCloseCommand extends BaseWsCommand {
1151
1296
  type: 'session_close';
@@ -1159,6 +1304,14 @@ interface SessionMessageCommand extends BaseWsCommand {
1159
1304
  data: {
1160
1305
  text: string;
1161
1306
  file_uuids?: string[];
1307
+ context_attachments?: ContextAttachmentEnvelope[];
1308
+ context_attachments_ref?: ContextAttachmentsReference;
1309
+ runtime_context?: {
1310
+ attention?: {
1311
+ host_instance_id: string;
1312
+ agent_actions_enabled: boolean;
1313
+ };
1314
+ };
1162
1315
  };
1163
1316
  }
1164
1317
  interface SessionCommandCommand extends BaseWsCommand {
@@ -1166,6 +1319,11 @@ interface SessionCommandCommand extends BaseWsCommand {
1166
1319
  session_id: string;
1167
1320
  data: StopCommand | ModelCommand | OtherCommand | AgentCommand;
1168
1321
  }
1322
+ interface UiActionResultCommand extends BaseWsCommand {
1323
+ type: 'session_ui_action_result';
1324
+ session_id: string;
1325
+ data: AttentionUiActionResultV1 | InspectionControlResult;
1326
+ }
1169
1327
  interface StopCommand {
1170
1328
  command: 'stop';
1171
1329
  }
@@ -1185,7 +1343,7 @@ interface OtherCommand {
1185
1343
  command: string;
1186
1344
  [key: string]: unknown;
1187
1345
  }
1188
- type WsCommand = SessionOpenCommand | SessionCloseCommand | SessionMessageCommand | SessionCommandCommand | ExternalEventCommand;
1346
+ type WsCommand = SessionOpenCommand | SessionCloseCommand | SessionMessageCommand | SessionCommandCommand | UiActionResultCommand | ExternalEventCommand;
1189
1347
 
1190
1348
  /**
1191
1349
  * Read-only mirror of the current host `HostLayoutDeclaration`, minus
@@ -1345,6 +1503,7 @@ interface HtmlInjectOptions {
1345
1503
  isNavOwner?: boolean;
1346
1504
  configOverrides?: AppConfigOverrides;
1347
1505
  proxyConfig?: ProxyConfig;
1506
+ attentionBootstrap?: AttentionRuntimeBootstrapV1;
1348
1507
  }
1349
1508
  interface ProxyHtmlApi {
1350
1509
  inject: (sourceHtml: string, options?: HtmlInjectOptions) => Promise<string>;
@@ -1456,6 +1615,7 @@ interface FormResult {
1456
1615
  type LimitedConfirmationOptions = Omit<ConfirmationOptions, 'target' | 'appendTo' | 'onShow' | 'onHide'>;
1457
1616
  interface ProxyApiInstance {
1458
1617
  config: ChildAppConfig;
1618
+ attention: AttentionApi;
1459
1619
  /** @deprecated, use `host` instead */
1460
1620
  iframe: {
1461
1621
  toast: (message: ToastMessageOptions) => void;
@@ -1622,6 +1782,7 @@ declare global {
1622
1782
  config: () => Promise<ChildAppConfig>;
1623
1783
  instance: () => Promise<ProxyApiInstance>;
1624
1784
  api: () => Promise<ProxyApiInstance['api']>;
1785
+ attention: () => Promise<ProxyApiInstance['attention']>;
1625
1786
  /** @deprecated Use `$W.api` instead */
1626
1787
  form: () => Promise<ProxyApiInstance['api']>;
1627
1788
  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.61",
4
4
  "description": "Global type declarations for Wippy iframe proxy (window.getWippyApi, $W, etc.)",
5
5
  "license": "UNLICENSED",
6
6
  "types": "index.d.ts",