@pitcher/js-api 1.22.0-beta.4 → 1.22.0-beta.6
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 +13 -1
- 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 +6 -0
- 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>;
|
|
@@ -65,10 +65,14 @@ export type UiSelectCanvasesResponse = {
|
|
|
65
65
|
canvases?: Canvas[];
|
|
66
66
|
};
|
|
67
67
|
export type UiPromptPiaRequest = {
|
|
68
|
+
/** Unique identifier of this prompt (needed for streaming event) */
|
|
69
|
+
id: string;
|
|
68
70
|
/** Prompt to send to PIA */
|
|
69
71
|
prompt: string;
|
|
70
72
|
};
|
|
71
73
|
export type UiPromptPiaResponse = {
|
|
74
|
+
/** Unique identifier of this prompt (needed for streaming event) */
|
|
75
|
+
id: string;
|
|
72
76
|
/** PIA response */
|
|
73
77
|
response: string;
|
|
74
78
|
};
|
|
@@ -199,6 +203,8 @@ export type UiSectionListUpdatedPayload = {
|
|
|
199
203
|
canvas: CanvasRetrieve | null;
|
|
200
204
|
};
|
|
201
205
|
export type UiPromptPiaResponseStreamedPayload = {
|
|
206
|
+
/** Unique identifier of this prompt */
|
|
207
|
+
id: string;
|
|
202
208
|
/** PIA response so far */
|
|
203
209
|
partial_response: string;
|
|
204
210
|
/** 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>;
|