@automattic/jetpack-ai-client 0.1.1 → 0.1.3

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/src/types.ts CHANGED
@@ -3,13 +3,15 @@ export const ERROR_QUOTA_EXCEEDED = 'error_quota_exceeded' as const;
3
3
  export const ERROR_MODERATION = 'error_moderation' as const;
4
4
  export const ERROR_NETWORK = 'error_network' as const;
5
5
  export const ERROR_UNCLEAR_PROMPT = 'error_unclear_prompt' as const;
6
+ export const ERROR_RESPONSE = 'error_response' as const;
6
7
 
7
8
  export type SuggestionErrorCode =
8
9
  | typeof ERROR_SERVICE_UNAVAILABLE
9
10
  | typeof ERROR_QUOTA_EXCEEDED
10
11
  | typeof ERROR_MODERATION
11
12
  | typeof ERROR_NETWORK
12
- | typeof ERROR_UNCLEAR_PROMPT;
13
+ | typeof ERROR_UNCLEAR_PROMPT
14
+ | typeof ERROR_RESPONSE;
13
15
 
14
16
  /*
15
17
  * Prompt types
@@ -22,3 +24,29 @@ export type PromptItemProps = {
22
24
  export type PromptMessagesProp = Array< PromptItemProps >;
23
25
 
24
26
  export type PromptProp = PromptMessagesProp | string;
27
+
28
+ /*
29
+ * Data Flow types
30
+ */
31
+ export type { UseAiContextOptions } from './data-flow/use-ai-context';
32
+ export type { RequestingErrorProps } from './hooks/use-ai-suggestions';
33
+
34
+ /*
35
+ * Requests types
36
+ */
37
+
38
+ const REQUESTING_STATE_INIT = 'init' as const;
39
+ const REQUESTING_STATE_REQUESTING = 'requesting' as const;
40
+ const REQUESTING_STATE_SUGGESTING = 'suggesting' as const;
41
+ const REQUESTING_STATE_DONE = 'done' as const;
42
+ const REQUESTING_STATE_ERROR = 'error' as const;
43
+
44
+ export const REQUESTING_STATES = [
45
+ REQUESTING_STATE_INIT,
46
+ REQUESTING_STATE_REQUESTING,
47
+ REQUESTING_STATE_SUGGESTING,
48
+ REQUESTING_STATE_DONE,
49
+ REQUESTING_STATE_ERROR,
50
+ ] as const;
51
+
52
+ export type RequestingStateProp = ( typeof REQUESTING_STATES )[ number ];