dooers-agents-client 0.2.7 → 0.3.0

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/dist/main.d.cts CHANGED
@@ -1,6 +1,78 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
3
 
4
+ interface WireFormOption {
5
+ value: string;
6
+ label: string;
7
+ }
8
+ interface WireS2C_FormTextElement {
9
+ type: 'text_input';
10
+ name: string;
11
+ label: string;
12
+ order?: number;
13
+ required?: boolean;
14
+ disabled?: boolean;
15
+ placeholder?: string | null;
16
+ default?: string | null;
17
+ input_type?: 'text' | 'password' | 'email' | 'number';
18
+ }
19
+ interface WireS2C_FormTextareaElement {
20
+ type: 'textarea_input';
21
+ name: string;
22
+ label: string;
23
+ order?: number;
24
+ required?: boolean;
25
+ disabled?: boolean;
26
+ placeholder?: string | null;
27
+ default?: string | null;
28
+ rows?: number | null;
29
+ }
30
+ interface WireS2C_FormSelectElement {
31
+ type: 'select_input';
32
+ name: string;
33
+ label: string;
34
+ options: WireFormOption[];
35
+ order?: number;
36
+ required?: boolean;
37
+ disabled?: boolean;
38
+ default?: string | null;
39
+ placeholder?: string | null;
40
+ }
41
+ interface WireS2C_FormRadioElement {
42
+ type: 'radio_input';
43
+ name: string;
44
+ label: string;
45
+ options: WireFormOption[];
46
+ order?: number;
47
+ required?: boolean;
48
+ disabled?: boolean;
49
+ default?: string | null;
50
+ variant?: 'native' | 'button';
51
+ }
52
+ interface WireS2C_FormCheckboxElement {
53
+ type: 'checkbox_input';
54
+ name: string;
55
+ label: string;
56
+ options: WireFormOption[];
57
+ order?: number;
58
+ required?: boolean;
59
+ disabled?: boolean;
60
+ default?: string[] | null;
61
+ variant?: 'native' | 'button';
62
+ }
63
+ interface WireS2C_FormFileElement {
64
+ type: 'file_input';
65
+ name: string;
66
+ label: string;
67
+ upload_url: string;
68
+ order?: number;
69
+ required?: boolean;
70
+ disabled?: boolean;
71
+ accept?: string | null;
72
+ multiple?: boolean;
73
+ }
74
+ type WireS2C_FormElement = WireS2C_FormTextElement | WireS2C_FormTextareaElement | WireS2C_FormSelectElement | WireS2C_FormRadioElement | WireS2C_FormCheckboxElement | WireS2C_FormFileElement;
75
+
4
76
  interface TextSendPart {
5
77
  type: 'text';
6
78
  text: string;
@@ -52,8 +124,92 @@ type TextPart = TextSendPart;
52
124
  type ImagePart = ImageSendPart;
53
125
  type DocumentPart = DocumentSendPart;
54
126
  type AudioPart = AudioSendPart;
127
+ interface FormOption {
128
+ value: string;
129
+ label: string;
130
+ }
131
+ interface FormTextElement {
132
+ type: 'text_input';
133
+ name: string;
134
+ label: string;
135
+ order: number;
136
+ required: boolean;
137
+ disabled: boolean;
138
+ placeholder: string | null;
139
+ default: string | null;
140
+ inputType: 'text' | 'password' | 'email' | 'number';
141
+ }
142
+ interface FormTextareaElement {
143
+ type: 'textarea_input';
144
+ name: string;
145
+ label: string;
146
+ order: number;
147
+ required: boolean;
148
+ disabled: boolean;
149
+ placeholder: string | null;
150
+ default: string | null;
151
+ rows: number | null;
152
+ }
153
+ interface FormSelectElement {
154
+ type: 'select_input';
155
+ name: string;
156
+ label: string;
157
+ options: FormOption[];
158
+ order: number;
159
+ required: boolean;
160
+ disabled: boolean;
161
+ default: string | null;
162
+ placeholder: string | null;
163
+ }
164
+ interface FormRadioElement {
165
+ type: 'radio_input';
166
+ name: string;
167
+ label: string;
168
+ options: FormOption[];
169
+ order: number;
170
+ required: boolean;
171
+ disabled: boolean;
172
+ default: string | null;
173
+ variant: 'native' | 'button';
174
+ }
175
+ interface FormCheckboxElement {
176
+ type: 'checkbox_input';
177
+ name: string;
178
+ label: string;
179
+ options: FormOption[];
180
+ order: number;
181
+ required: boolean;
182
+ disabled: boolean;
183
+ default: string[] | null;
184
+ variant: 'native' | 'button';
185
+ }
186
+ interface FormFileElement {
187
+ type: 'file_input';
188
+ name: string;
189
+ label: string;
190
+ uploadUrl: string;
191
+ order: number;
192
+ required: boolean;
193
+ disabled: boolean;
194
+ accept: string | null;
195
+ multiple: boolean;
196
+ }
197
+ type FormElement = FormTextElement | FormTextareaElement | FormSelectElement | FormRadioElement | FormCheckboxElement | FormFileElement;
198
+ type FormSize = 'small' | 'medium' | 'large';
199
+ interface FormEventData {
200
+ message: string;
201
+ elements: FormElement[];
202
+ submitLabel: string;
203
+ cancelLabel: string;
204
+ size: FormSize;
205
+ }
206
+ interface FormResponseEventData {
207
+ formEventId: string;
208
+ cancelled: boolean;
209
+ values: Record<string, unknown>;
210
+ }
55
211
  type Actor = 'user' | 'assistant' | 'system' | 'tool';
56
- type EventType = 'message' | 'run.started' | 'run.finished' | 'tool.call' | 'tool.result' | 'tool.transaction';
212
+ type EventType = 'message' | 'run.started' | 'run.finished' | 'tool.call' | 'tool.result' | 'tool.transaction' | 'form' | 'form.response';
57
213
  type RunStatus = 'running' | 'succeeded' | 'failed' | 'canceled';
58
214
  type ConnectionStatus = 'idle' | 'connecting' | 'connected' | 'disconnected' | 'error';
59
215
  interface User {
@@ -148,6 +304,10 @@ interface ThreadState {
148
304
  isWaiting: boolean;
149
305
  }
150
306
 
307
+ declare function toFormElement(w: WireS2C_FormElement): FormElement;
308
+ declare function toFormEventData(data: Record<string, unknown>): FormEventData;
309
+ declare function toFormResponseEventData(data: Record<string, unknown>): FormResponseEventData;
310
+
151
311
  interface WorkerConnectionConfig {
152
312
  organizationId?: string;
153
313
  workspaceId?: string;
@@ -205,6 +365,41 @@ declare function useFeedback(targetId: string, targetType?: FeedbackTarget): {
205
365
  dislike: (reason?: string, classification?: string) => void;
206
366
  };
207
367
 
368
+ declare function useForm(formEventId: string, formData: FormEventData, threadId?: string): {
369
+ values: Record<string, unknown>;
370
+ errors: Record<string, string>;
371
+ setValue: (fieldName: string, value: unknown) => void;
372
+ validate: () => boolean;
373
+ submit: () => Promise<void>;
374
+ cancel: () => Promise<void>;
375
+ isSubmitting: boolean;
376
+ isSubmitted: boolean;
377
+ isCancelled: boolean;
378
+ isDisabled: boolean;
379
+ };
380
+
381
+ interface FormFileMetadata {
382
+ id?: string;
383
+ filename: string;
384
+ public_url?: string;
385
+ mime_type?: string;
386
+ size?: number;
387
+ [key: string]: unknown;
388
+ }
389
+ declare function useFormFileUpload(): {
390
+ upload: (params: {
391
+ file: File;
392
+ uploadUrl: string;
393
+ fieldId: string;
394
+ agentId: string;
395
+ runId: string;
396
+ threadId: string;
397
+ }) => Promise<FormFileMetadata>;
398
+ isUploading: boolean;
399
+ error: string | null;
400
+ clearError: () => void;
401
+ };
402
+
208
403
  declare function useMessage(): {
209
404
  send: (params: {
210
405
  text?: string;
@@ -267,4 +462,4 @@ interface WorkerProviderProps {
267
462
  }
268
463
  declare function WorkerProvider({ url, workerId, organizationId, workspaceId, userId, userName, userEmail, identityIds, systemRole, organizationRole, workspaceRole, authToken, uploadUrl, onError, children, }: WorkerProviderProps): react_jsx_runtime.JSX.Element;
269
464
 
270
- export { type Actor, type AnalyticsEvent, type AudioDisplayPart, type AudioPart, type AudioSendPart, type ConnectionStatus, type ContentPart, type DisplayContentPart, type DocumentDisplayPart, type DocumentPart, type DocumentSendPart, type EventType, type FeedbackTarget, type FeedbackType, type ImageDisplayPart, type ImagePart, type ImageSendPart, type OnErrorCallback, type Run, type RunStatus, type SendContentPart, type SettingsField, type SettingsFieldGroup, type SettingsFieldType, type SettingsItem, type SettingsSelectOption, type TextDisplayPart, type TextPart, type TextSendPart, type Thread, type ThreadEvent, type ThreadState, type UploadResult, type User, type WorkerConnectionConfig, WorkerProvider, type WorkerProviderProps, isSettingsFieldGroup, useAnalytics, useAudioRecorder, useConnection, useFeedback, useMessage, useSettings, useThreadDetails, useThreadEvents, useThreadsActions, useThreadsList, useUpload };
465
+ export { type Actor, type AnalyticsEvent, type AudioDisplayPart, type AudioPart, type AudioSendPart, type ConnectionStatus, type ContentPart, type DisplayContentPart, type DocumentDisplayPart, type DocumentPart, type DocumentSendPart, type EventType, type FeedbackTarget, type FeedbackType, type FormCheckboxElement, type FormElement, type FormEventData, type FormFileElement, type FormFileMetadata, type FormOption, type FormRadioElement, type FormResponseEventData, type FormSelectElement, type FormSize, type FormTextElement, type FormTextareaElement, type ImageDisplayPart, type ImagePart, type ImageSendPart, type OnErrorCallback, type Run, type RunStatus, type SendContentPart, type SettingsField, type SettingsFieldGroup, type SettingsFieldType, type SettingsItem, type SettingsSelectOption, type TextDisplayPart, type TextPart, type TextSendPart, type Thread, type ThreadEvent, type ThreadState, type UploadResult, type User, type WorkerConnectionConfig, WorkerProvider, type WorkerProviderProps, isSettingsFieldGroup, toFormElement, toFormEventData, toFormResponseEventData, useAnalytics, useAudioRecorder, useConnection, useFeedback, useForm, useFormFileUpload, useMessage, useSettings, useThreadDetails, useThreadEvents, useThreadsActions, useThreadsList, useUpload };
package/dist/main.d.ts CHANGED
@@ -1,6 +1,78 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
3
 
4
+ interface WireFormOption {
5
+ value: string;
6
+ label: string;
7
+ }
8
+ interface WireS2C_FormTextElement {
9
+ type: 'text_input';
10
+ name: string;
11
+ label: string;
12
+ order?: number;
13
+ required?: boolean;
14
+ disabled?: boolean;
15
+ placeholder?: string | null;
16
+ default?: string | null;
17
+ input_type?: 'text' | 'password' | 'email' | 'number';
18
+ }
19
+ interface WireS2C_FormTextareaElement {
20
+ type: 'textarea_input';
21
+ name: string;
22
+ label: string;
23
+ order?: number;
24
+ required?: boolean;
25
+ disabled?: boolean;
26
+ placeholder?: string | null;
27
+ default?: string | null;
28
+ rows?: number | null;
29
+ }
30
+ interface WireS2C_FormSelectElement {
31
+ type: 'select_input';
32
+ name: string;
33
+ label: string;
34
+ options: WireFormOption[];
35
+ order?: number;
36
+ required?: boolean;
37
+ disabled?: boolean;
38
+ default?: string | null;
39
+ placeholder?: string | null;
40
+ }
41
+ interface WireS2C_FormRadioElement {
42
+ type: 'radio_input';
43
+ name: string;
44
+ label: string;
45
+ options: WireFormOption[];
46
+ order?: number;
47
+ required?: boolean;
48
+ disabled?: boolean;
49
+ default?: string | null;
50
+ variant?: 'native' | 'button';
51
+ }
52
+ interface WireS2C_FormCheckboxElement {
53
+ type: 'checkbox_input';
54
+ name: string;
55
+ label: string;
56
+ options: WireFormOption[];
57
+ order?: number;
58
+ required?: boolean;
59
+ disabled?: boolean;
60
+ default?: string[] | null;
61
+ variant?: 'native' | 'button';
62
+ }
63
+ interface WireS2C_FormFileElement {
64
+ type: 'file_input';
65
+ name: string;
66
+ label: string;
67
+ upload_url: string;
68
+ order?: number;
69
+ required?: boolean;
70
+ disabled?: boolean;
71
+ accept?: string | null;
72
+ multiple?: boolean;
73
+ }
74
+ type WireS2C_FormElement = WireS2C_FormTextElement | WireS2C_FormTextareaElement | WireS2C_FormSelectElement | WireS2C_FormRadioElement | WireS2C_FormCheckboxElement | WireS2C_FormFileElement;
75
+
4
76
  interface TextSendPart {
5
77
  type: 'text';
6
78
  text: string;
@@ -52,8 +124,92 @@ type TextPart = TextSendPart;
52
124
  type ImagePart = ImageSendPart;
53
125
  type DocumentPart = DocumentSendPart;
54
126
  type AudioPart = AudioSendPart;
127
+ interface FormOption {
128
+ value: string;
129
+ label: string;
130
+ }
131
+ interface FormTextElement {
132
+ type: 'text_input';
133
+ name: string;
134
+ label: string;
135
+ order: number;
136
+ required: boolean;
137
+ disabled: boolean;
138
+ placeholder: string | null;
139
+ default: string | null;
140
+ inputType: 'text' | 'password' | 'email' | 'number';
141
+ }
142
+ interface FormTextareaElement {
143
+ type: 'textarea_input';
144
+ name: string;
145
+ label: string;
146
+ order: number;
147
+ required: boolean;
148
+ disabled: boolean;
149
+ placeholder: string | null;
150
+ default: string | null;
151
+ rows: number | null;
152
+ }
153
+ interface FormSelectElement {
154
+ type: 'select_input';
155
+ name: string;
156
+ label: string;
157
+ options: FormOption[];
158
+ order: number;
159
+ required: boolean;
160
+ disabled: boolean;
161
+ default: string | null;
162
+ placeholder: string | null;
163
+ }
164
+ interface FormRadioElement {
165
+ type: 'radio_input';
166
+ name: string;
167
+ label: string;
168
+ options: FormOption[];
169
+ order: number;
170
+ required: boolean;
171
+ disabled: boolean;
172
+ default: string | null;
173
+ variant: 'native' | 'button';
174
+ }
175
+ interface FormCheckboxElement {
176
+ type: 'checkbox_input';
177
+ name: string;
178
+ label: string;
179
+ options: FormOption[];
180
+ order: number;
181
+ required: boolean;
182
+ disabled: boolean;
183
+ default: string[] | null;
184
+ variant: 'native' | 'button';
185
+ }
186
+ interface FormFileElement {
187
+ type: 'file_input';
188
+ name: string;
189
+ label: string;
190
+ uploadUrl: string;
191
+ order: number;
192
+ required: boolean;
193
+ disabled: boolean;
194
+ accept: string | null;
195
+ multiple: boolean;
196
+ }
197
+ type FormElement = FormTextElement | FormTextareaElement | FormSelectElement | FormRadioElement | FormCheckboxElement | FormFileElement;
198
+ type FormSize = 'small' | 'medium' | 'large';
199
+ interface FormEventData {
200
+ message: string;
201
+ elements: FormElement[];
202
+ submitLabel: string;
203
+ cancelLabel: string;
204
+ size: FormSize;
205
+ }
206
+ interface FormResponseEventData {
207
+ formEventId: string;
208
+ cancelled: boolean;
209
+ values: Record<string, unknown>;
210
+ }
55
211
  type Actor = 'user' | 'assistant' | 'system' | 'tool';
56
- type EventType = 'message' | 'run.started' | 'run.finished' | 'tool.call' | 'tool.result' | 'tool.transaction';
212
+ type EventType = 'message' | 'run.started' | 'run.finished' | 'tool.call' | 'tool.result' | 'tool.transaction' | 'form' | 'form.response';
57
213
  type RunStatus = 'running' | 'succeeded' | 'failed' | 'canceled';
58
214
  type ConnectionStatus = 'idle' | 'connecting' | 'connected' | 'disconnected' | 'error';
59
215
  interface User {
@@ -148,6 +304,10 @@ interface ThreadState {
148
304
  isWaiting: boolean;
149
305
  }
150
306
 
307
+ declare function toFormElement(w: WireS2C_FormElement): FormElement;
308
+ declare function toFormEventData(data: Record<string, unknown>): FormEventData;
309
+ declare function toFormResponseEventData(data: Record<string, unknown>): FormResponseEventData;
310
+
151
311
  interface WorkerConnectionConfig {
152
312
  organizationId?: string;
153
313
  workspaceId?: string;
@@ -205,6 +365,41 @@ declare function useFeedback(targetId: string, targetType?: FeedbackTarget): {
205
365
  dislike: (reason?: string, classification?: string) => void;
206
366
  };
207
367
 
368
+ declare function useForm(formEventId: string, formData: FormEventData, threadId?: string): {
369
+ values: Record<string, unknown>;
370
+ errors: Record<string, string>;
371
+ setValue: (fieldName: string, value: unknown) => void;
372
+ validate: () => boolean;
373
+ submit: () => Promise<void>;
374
+ cancel: () => Promise<void>;
375
+ isSubmitting: boolean;
376
+ isSubmitted: boolean;
377
+ isCancelled: boolean;
378
+ isDisabled: boolean;
379
+ };
380
+
381
+ interface FormFileMetadata {
382
+ id?: string;
383
+ filename: string;
384
+ public_url?: string;
385
+ mime_type?: string;
386
+ size?: number;
387
+ [key: string]: unknown;
388
+ }
389
+ declare function useFormFileUpload(): {
390
+ upload: (params: {
391
+ file: File;
392
+ uploadUrl: string;
393
+ fieldId: string;
394
+ agentId: string;
395
+ runId: string;
396
+ threadId: string;
397
+ }) => Promise<FormFileMetadata>;
398
+ isUploading: boolean;
399
+ error: string | null;
400
+ clearError: () => void;
401
+ };
402
+
208
403
  declare function useMessage(): {
209
404
  send: (params: {
210
405
  text?: string;
@@ -267,4 +462,4 @@ interface WorkerProviderProps {
267
462
  }
268
463
  declare function WorkerProvider({ url, workerId, organizationId, workspaceId, userId, userName, userEmail, identityIds, systemRole, organizationRole, workspaceRole, authToken, uploadUrl, onError, children, }: WorkerProviderProps): react_jsx_runtime.JSX.Element;
269
464
 
270
- export { type Actor, type AnalyticsEvent, type AudioDisplayPart, type AudioPart, type AudioSendPart, type ConnectionStatus, type ContentPart, type DisplayContentPart, type DocumentDisplayPart, type DocumentPart, type DocumentSendPart, type EventType, type FeedbackTarget, type FeedbackType, type ImageDisplayPart, type ImagePart, type ImageSendPart, type OnErrorCallback, type Run, type RunStatus, type SendContentPart, type SettingsField, type SettingsFieldGroup, type SettingsFieldType, type SettingsItem, type SettingsSelectOption, type TextDisplayPart, type TextPart, type TextSendPart, type Thread, type ThreadEvent, type ThreadState, type UploadResult, type User, type WorkerConnectionConfig, WorkerProvider, type WorkerProviderProps, isSettingsFieldGroup, useAnalytics, useAudioRecorder, useConnection, useFeedback, useMessage, useSettings, useThreadDetails, useThreadEvents, useThreadsActions, useThreadsList, useUpload };
465
+ export { type Actor, type AnalyticsEvent, type AudioDisplayPart, type AudioPart, type AudioSendPart, type ConnectionStatus, type ContentPart, type DisplayContentPart, type DocumentDisplayPart, type DocumentPart, type DocumentSendPart, type EventType, type FeedbackTarget, type FeedbackType, type FormCheckboxElement, type FormElement, type FormEventData, type FormFileElement, type FormFileMetadata, type FormOption, type FormRadioElement, type FormResponseEventData, type FormSelectElement, type FormSize, type FormTextElement, type FormTextareaElement, type ImageDisplayPart, type ImagePart, type ImageSendPart, type OnErrorCallback, type Run, type RunStatus, type SendContentPart, type SettingsField, type SettingsFieldGroup, type SettingsFieldType, type SettingsItem, type SettingsSelectOption, type TextDisplayPart, type TextPart, type TextSendPart, type Thread, type ThreadEvent, type ThreadState, type UploadResult, type User, type WorkerConnectionConfig, WorkerProvider, type WorkerProviderProps, isSettingsFieldGroup, toFormElement, toFormEventData, toFormResponseEventData, useAnalytics, useAudioRecorder, useConnection, useFeedback, useForm, useFormFileUpload, useMessage, useSettings, useThreadDetails, useThreadEvents, useThreadsActions, useThreadsList, useUpload };