@pitcher/js-api 1.22.0-beta.3 → 1.22.0-beta.5
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/js-api.esm.js +14 -2
- package/js-api.esm.js.map +1 -1
- package/js-api.umd.min.js +9 -9
- package/js-api.umd.min.js.map +1 -1
- package/lib/sdk/api/modules/ui/index.d.ts +1 -0
- package/lib/sdk/api/modules/ui/pia.ui.d.ts +11 -1
- package/lib/sdk/api/modules/ui/types.ui.d.ts +3 -3
- package/lib/sdk/main.d.ts +3 -0
- package/lib/util/network.d.ts +1 -0
- package/package.json +1 -1
|
@@ -113,6 +113,7 @@ declare function onAppUpdateData(handler: (data: UiAppUpdateDataPayload) => Prom
|
|
|
113
113
|
*/
|
|
114
114
|
declare function uiBroadcast(payload: UiBroadcastRequest): Promise<void>;
|
|
115
115
|
declare const _default: {
|
|
116
|
+
promptPia(payload: import('../../../../main.lib').UiPromptPiaRequest): Promise<import('../../../../main.lib').UiPromptPiaResponse>;
|
|
116
117
|
completePostcall(payload: import('../../../../main.lib').UiCompletePostcallRequest): Promise<void>;
|
|
117
118
|
cancelMeeting(): Promise<void>;
|
|
118
119
|
resumeMeeting(): Promise<void>;
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
import { UiPromptPiaRequest, UiPromptPiaResponse } from './types.ui';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Sends a query to the Pitcher Intelligent Assistant (PIA) and handles the streamed response.
|
|
4
4
|
*
|
|
5
5
|
* @example
|
|
6
|
+
* // Subscribe to PIA's streamed responses
|
|
7
|
+
* const cleanup = await useUi().on(
|
|
8
|
+
* UI_MESSAGE_TYPES.UI_PROMPT_PIA_RESPONSE_STREAMED,
|
|
9
|
+
* async ({ chunk, partial_response }) => {
|
|
10
|
+
* console.log('PIA response chunk:', chunk);
|
|
11
|
+
* console.log('PIA partial response:', partial_response);
|
|
12
|
+
* }
|
|
13
|
+
* );
|
|
14
|
+
* // Prompt PIA with a question and ensure cleanup is called afterwards
|
|
6
15
|
* useUi().promptPia({ prompt: "What's my most presented file?" })
|
|
16
|
+
* .finally(cleanup);
|
|
7
17
|
*/
|
|
8
18
|
export declare function promptPia(payload: UiPromptPiaRequest): Promise<UiPromptPiaResponse>;
|
|
@@ -39,7 +39,7 @@ export declare const UI_MESSAGE_TYPES: {
|
|
|
39
39
|
readonly UI_SECTION_LIST_UPDATED: "ui_section_list_updated";
|
|
40
40
|
readonly UI_APP_SET_DATA: "ui_app_set_data";
|
|
41
41
|
readonly UI_APP_UPDATE_DATA: "ui_app_update_data";
|
|
42
|
-
readonly
|
|
42
|
+
readonly UI_PROMPT_PIA_RESPONSE_STREAMED: "ui_prompt_pia_response_streamed";
|
|
43
43
|
};
|
|
44
44
|
export declare const UI_NATIVE_MESSAGE_TYPES: readonly ["ui_app_set_data", "ui_app_update_data", "ui_canvas_updated"];
|
|
45
45
|
export type UiBroadcastRequest = Record<string, any>;
|
|
@@ -140,7 +140,7 @@ export type UiMessagePayloads = {
|
|
|
140
140
|
[UI_MESSAGE_TYPES.UI_APP_UPDATE_DATA]: UiAppUpdateDataPayload;
|
|
141
141
|
[UI_MESSAGE_TYPES.UI_CANVAS_UPDATED]: UiCanvasUpdatedPayload;
|
|
142
142
|
[UI_MESSAGE_TYPES.UI_SECTION_LIST_UPDATED]: UiSectionListUpdatedPayload;
|
|
143
|
-
[UI_MESSAGE_TYPES.
|
|
143
|
+
[UI_MESSAGE_TYPES.UI_PROMPT_PIA_RESPONSE_STREAMED]: UiPromptPiaResponseStreamedPayload;
|
|
144
144
|
};
|
|
145
145
|
export type UiMessageEnvelope<T extends (typeof UI_MESSAGE_TYPES)[keyof typeof UI_MESSAGE_TYPES] = (typeof UI_MESSAGE_TYPES)[keyof typeof UI_MESSAGE_TYPES]> = {
|
|
146
146
|
/** Message type */
|
|
@@ -198,7 +198,7 @@ export type UiSectionListUpdatedPayload = {
|
|
|
198
198
|
/** Canvas data */
|
|
199
199
|
canvas: CanvasRetrieve | null;
|
|
200
200
|
};
|
|
201
|
-
export type
|
|
201
|
+
export type UiPromptPiaResponseStreamedPayload = {
|
|
202
202
|
/** PIA response so far */
|
|
203
203
|
partial_response: string;
|
|
204
204
|
/** Current chunk of the response */
|
package/lib/sdk/main.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export declare function usePitcherApi(options?: ApiOptions): ReturnType<typeof c
|
|
|
24
24
|
* @returns UI API object with methods described below.
|
|
25
25
|
*/
|
|
26
26
|
export declare function useUi(): {
|
|
27
|
+
promptPia(payload: import('./api/modules/ui/types.ui').UiPromptPiaRequest): Promise<import('./api/modules/ui/types.ui').UiPromptPiaResponse>;
|
|
27
28
|
completePostcall(payload: import('./api/modules/ui/types.ui').UiCompletePostcallRequest): Promise<void>;
|
|
28
29
|
cancelMeeting(): Promise<void>;
|
|
29
30
|
resumeMeeting(): Promise<void>;
|
|
@@ -311,6 +312,7 @@ export declare function useApi(options?: ApiOptions): {
|
|
|
311
312
|
on: (type: typeof import('./api/modules/dsr/types.dsr').DSR_MESSAGE_TYPES[keyof typeof import('./api/modules/dsr/types.dsr').DSR_MESSAGE_TYPES], handler: (data: import('./api/modules/dsr/types.dsr').DsrMessagePayloads[typeof type]) => Promise<void>) => Promise<() => void>;
|
|
312
313
|
} | {
|
|
313
314
|
ui: {
|
|
315
|
+
promptPia(payload: import('./api/modules/ui/types.ui').UiPromptPiaRequest): Promise<import('./api/modules/ui/types.ui').UiPromptPiaResponse>;
|
|
314
316
|
completePostcall(payload: import('./api/modules/ui/types.ui').UiCompletePostcallRequest): Promise<void>;
|
|
315
317
|
cancelMeeting(): Promise<void>;
|
|
316
318
|
resumeMeeting(): Promise<void>;
|
|
@@ -476,6 +478,7 @@ export declare function useApi(options?: ApiOptions): {
|
|
|
476
478
|
openWebViewAlwaysOnTop(payload: import('./payload.types').OpenWebViewAlwaysOnTop): Promise<void>;
|
|
477
479
|
API: import('./api/LowLevelApi').LowLevelApi;
|
|
478
480
|
};
|
|
481
|
+
promptPia(payload: import('./api/modules/ui/types.ui').UiPromptPiaRequest): Promise<import('./api/modules/ui/types.ui').UiPromptPiaResponse>;
|
|
479
482
|
completePostcall(payload: import('./api/modules/ui/types.ui').UiCompletePostcallRequest): Promise<void>;
|
|
480
483
|
cancelMeeting(): Promise<void>;
|
|
481
484
|
resumeMeeting(): Promise<void>;
|
package/lib/util/network.d.ts
CHANGED
|
@@ -13,3 +13,4 @@ export declare function derivePatchRequestFields<T extends object>(current: T, u
|
|
|
13
13
|
updatedFields: string[];
|
|
14
14
|
payload: Partial<T>;
|
|
15
15
|
};
|
|
16
|
+
export declare function requestStream(url: string, body: Record<string, any>, token: string, onStreamedChunk?: (chunk: string, response: string) => void): Promise<string>;
|