dooers-agents-client 0.9.2 → 0.9.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/dist/main.d.cts CHANGED
@@ -115,6 +115,8 @@ interface AudioDisplayPart {
115
115
  mimeType?: string;
116
116
  duration?: number;
117
117
  filename?: string;
118
+ /** Upload ref when present on the wire (replay / blob key correlation). */
119
+ refId?: string;
118
120
  }
119
121
  interface ImageDisplayPart {
120
122
  type: 'image';
@@ -124,6 +126,7 @@ interface ImageDisplayPart {
124
126
  height?: number;
125
127
  alt?: string;
126
128
  filename?: string;
129
+ refId?: string;
127
130
  }
128
131
  interface DocumentDisplayPart {
129
132
  type: 'document';
@@ -131,6 +134,7 @@ interface DocumentDisplayPart {
131
134
  filename?: string;
132
135
  mimeType?: string;
133
136
  sizeBytes?: number;
137
+ refId?: string;
134
138
  }
135
139
  type DisplayContentPart = TextDisplayPart | AudioDisplayPart | ImageDisplayPart | DocumentDisplayPart;
136
140
  type ContentPart = SendContentPart;
@@ -230,6 +234,8 @@ interface User {
230
234
  userId: string;
231
235
  userName?: string | null;
232
236
  userEmail?: string | null;
237
+ userMobileNumber?: string | null;
238
+ userWhatsappNumber?: string | null;
233
239
  identityIds?: string[];
234
240
  systemRole: string;
235
241
  organizationRole: string;
@@ -414,11 +420,15 @@ interface AgentConnectionConfig {
414
420
  userId?: string;
415
421
  userName?: string;
416
422
  userEmail?: string;
423
+ userMobileNumber?: string;
424
+ userWhatsappNumber?: string;
417
425
  identityIds?: string[];
418
426
  systemRole?: string;
419
427
  organizationRole?: string;
420
428
  workspaceRole?: string;
421
429
  authToken?: string;
430
+ channel?: string;
431
+ channelMeta?: Record<string, unknown>;
422
432
  }
423
433
  type OnErrorCallback = (error: {
424
434
  code: string;
@@ -523,6 +533,7 @@ declare class AgentClient {
523
533
  formEventId: string;
524
534
  cancelled: boolean;
525
535
  values: Record<string, unknown>;
536
+ metadata?: Record<string, unknown>;
526
537
  }): Promise<{
527
538
  threadId: string;
528
539
  }>;
@@ -532,6 +543,7 @@ declare class AgentClient {
532
543
  private route;
533
544
  private scheduleReconnect;
534
545
  private send;
546
+ private withChannelMetadata;
535
547
  private sendRaw;
536
548
  /** Resolve relative URLs in event content parts against the agent's HTTP base. */
537
549
  private resolveEventUrls;
@@ -694,16 +706,23 @@ interface AgentProviderProps {
694
706
  userId?: string;
695
707
  userName?: string;
696
708
  userEmail?: string;
709
+ userMobileNumber?: string;
710
+ userWhatsappNumber?: string;
697
711
  identityIds?: string[];
698
712
  systemRole?: string;
699
713
  organizationRole?: string;
700
714
  workspaceRole?: string;
701
715
  authToken?: string;
716
+ channel?: string;
717
+ channelMeta?: Record<string, unknown>;
702
718
  uploadUrl?: string;
703
719
  onError?: OnErrorCallback;
704
720
  children: ReactNode;
705
721
  }
706
- declare function AgentProvider({ url, agentId, organizationId, workspaceId, userId, userName, userEmail, identityIds, systemRole, organizationRole, workspaceRole, authToken, uploadUrl, onError, children, }: AgentProviderProps): react_jsx_runtime.JSX.Element;
722
+ declare function AgentProvider({ url, agentId, organizationId, workspaceId, userId, userName, userEmail, userMobileNumber, userWhatsappNumber, identityIds, systemRole, organizationRole, workspaceRole, authToken, channel, channelMeta, uploadUrl, onError, children, }: AgentProviderProps): react_jsx_runtime.JSX.Element;
707
723
  declare function useAgentContext(): AgentContextValue;
708
724
 
709
- export { type Actor, type AgentConnectionConfig, AgentProvider, type AgentProviderProps, AgentServerClient, 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 PublicSettingsSchemaResult, type Run, type RunStatus, type SendContentPart, type SettingsField, type SettingsFieldGroup, type SettingsFieldType, type SettingsFieldVisibility, type SettingsFileMetadata, type SettingsItem, type SettingsSelectOption, type TextDisplayPart, type TextPart, type TextSendPart, type Thread, type ThreadEvent, type ThreadState, type UploadResult, type User, apiMessagesUrlToWebSocketUrl, isSettingsFieldGroup, toFormElement, toFormEventData, toFormResponseEventData, useAgentContext, useAnalytics, useAudioRecorder, useConnection, useFeedback, useForm, useFormFileUpload, useMessage, useSettings, useSettingsFileUpload, useThreadDetails, useThreadEvents, useThreadsActions, useThreadsList, useUpload };
725
+ /** Must match `package.json` `"version"` (connect frame telemetry). */
726
+ declare const PACKAGE_VERSION: "0.9.3";
727
+
728
+ export { type Actor, type AgentConnectionConfig, AgentProvider, type AgentProviderProps, AgentServerClient, 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, PACKAGE_VERSION, type PublicSettingsSchemaResult, type Run, type RunStatus, type SendContentPart, type SettingsField, type SettingsFieldGroup, type SettingsFieldType, type SettingsFieldVisibility, type SettingsFileMetadata, type SettingsItem, type SettingsSelectOption, type TextDisplayPart, type TextPart, type TextSendPart, type Thread, type ThreadEvent, type ThreadState, type UploadResult, type User, apiMessagesUrlToWebSocketUrl, isSettingsFieldGroup, toFormElement, toFormEventData, toFormResponseEventData, useAgentContext, useAnalytics, useAudioRecorder, useConnection, useFeedback, useForm, useFormFileUpload, useMessage, useSettings, useSettingsFileUpload, useThreadDetails, useThreadEvents, useThreadsActions, useThreadsList, useUpload };
package/dist/main.d.ts CHANGED
@@ -115,6 +115,8 @@ interface AudioDisplayPart {
115
115
  mimeType?: string;
116
116
  duration?: number;
117
117
  filename?: string;
118
+ /** Upload ref when present on the wire (replay / blob key correlation). */
119
+ refId?: string;
118
120
  }
119
121
  interface ImageDisplayPart {
120
122
  type: 'image';
@@ -124,6 +126,7 @@ interface ImageDisplayPart {
124
126
  height?: number;
125
127
  alt?: string;
126
128
  filename?: string;
129
+ refId?: string;
127
130
  }
128
131
  interface DocumentDisplayPart {
129
132
  type: 'document';
@@ -131,6 +134,7 @@ interface DocumentDisplayPart {
131
134
  filename?: string;
132
135
  mimeType?: string;
133
136
  sizeBytes?: number;
137
+ refId?: string;
134
138
  }
135
139
  type DisplayContentPart = TextDisplayPart | AudioDisplayPart | ImageDisplayPart | DocumentDisplayPart;
136
140
  type ContentPart = SendContentPart;
@@ -230,6 +234,8 @@ interface User {
230
234
  userId: string;
231
235
  userName?: string | null;
232
236
  userEmail?: string | null;
237
+ userMobileNumber?: string | null;
238
+ userWhatsappNumber?: string | null;
233
239
  identityIds?: string[];
234
240
  systemRole: string;
235
241
  organizationRole: string;
@@ -414,11 +420,15 @@ interface AgentConnectionConfig {
414
420
  userId?: string;
415
421
  userName?: string;
416
422
  userEmail?: string;
423
+ userMobileNumber?: string;
424
+ userWhatsappNumber?: string;
417
425
  identityIds?: string[];
418
426
  systemRole?: string;
419
427
  organizationRole?: string;
420
428
  workspaceRole?: string;
421
429
  authToken?: string;
430
+ channel?: string;
431
+ channelMeta?: Record<string, unknown>;
422
432
  }
423
433
  type OnErrorCallback = (error: {
424
434
  code: string;
@@ -523,6 +533,7 @@ declare class AgentClient {
523
533
  formEventId: string;
524
534
  cancelled: boolean;
525
535
  values: Record<string, unknown>;
536
+ metadata?: Record<string, unknown>;
526
537
  }): Promise<{
527
538
  threadId: string;
528
539
  }>;
@@ -532,6 +543,7 @@ declare class AgentClient {
532
543
  private route;
533
544
  private scheduleReconnect;
534
545
  private send;
546
+ private withChannelMetadata;
535
547
  private sendRaw;
536
548
  /** Resolve relative URLs in event content parts against the agent's HTTP base. */
537
549
  private resolveEventUrls;
@@ -694,16 +706,23 @@ interface AgentProviderProps {
694
706
  userId?: string;
695
707
  userName?: string;
696
708
  userEmail?: string;
709
+ userMobileNumber?: string;
710
+ userWhatsappNumber?: string;
697
711
  identityIds?: string[];
698
712
  systemRole?: string;
699
713
  organizationRole?: string;
700
714
  workspaceRole?: string;
701
715
  authToken?: string;
716
+ channel?: string;
717
+ channelMeta?: Record<string, unknown>;
702
718
  uploadUrl?: string;
703
719
  onError?: OnErrorCallback;
704
720
  children: ReactNode;
705
721
  }
706
- declare function AgentProvider({ url, agentId, organizationId, workspaceId, userId, userName, userEmail, identityIds, systemRole, organizationRole, workspaceRole, authToken, uploadUrl, onError, children, }: AgentProviderProps): react_jsx_runtime.JSX.Element;
722
+ declare function AgentProvider({ url, agentId, organizationId, workspaceId, userId, userName, userEmail, userMobileNumber, userWhatsappNumber, identityIds, systemRole, organizationRole, workspaceRole, authToken, channel, channelMeta, uploadUrl, onError, children, }: AgentProviderProps): react_jsx_runtime.JSX.Element;
707
723
  declare function useAgentContext(): AgentContextValue;
708
724
 
709
- export { type Actor, type AgentConnectionConfig, AgentProvider, type AgentProviderProps, AgentServerClient, 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 PublicSettingsSchemaResult, type Run, type RunStatus, type SendContentPart, type SettingsField, type SettingsFieldGroup, type SettingsFieldType, type SettingsFieldVisibility, type SettingsFileMetadata, type SettingsItem, type SettingsSelectOption, type TextDisplayPart, type TextPart, type TextSendPart, type Thread, type ThreadEvent, type ThreadState, type UploadResult, type User, apiMessagesUrlToWebSocketUrl, isSettingsFieldGroup, toFormElement, toFormEventData, toFormResponseEventData, useAgentContext, useAnalytics, useAudioRecorder, useConnection, useFeedback, useForm, useFormFileUpload, useMessage, useSettings, useSettingsFileUpload, useThreadDetails, useThreadEvents, useThreadsActions, useThreadsList, useUpload };
725
+ /** Must match `package.json` `"version"` (connect frame telemetry). */
726
+ declare const PACKAGE_VERSION: "0.9.3";
727
+
728
+ export { type Actor, type AgentConnectionConfig, AgentProvider, type AgentProviderProps, AgentServerClient, 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, PACKAGE_VERSION, type PublicSettingsSchemaResult, type Run, type RunStatus, type SendContentPart, type SettingsField, type SettingsFieldGroup, type SettingsFieldType, type SettingsFieldVisibility, type SettingsFileMetadata, type SettingsItem, type SettingsSelectOption, type TextDisplayPart, type TextPart, type TextSendPart, type Thread, type ThreadEvent, type ThreadState, type UploadResult, type User, apiMessagesUrlToWebSocketUrl, isSettingsFieldGroup, toFormElement, toFormEventData, toFormResponseEventData, useAgentContext, useAnalytics, useAudioRecorder, useConnection, useFeedback, useForm, useFormFileUpload, useMessage, useSettings, useSettingsFileUpload, useThreadDetails, useThreadEvents, useThreadsActions, useThreadsList, useUpload };
package/dist/main.js CHANGED
@@ -22,6 +22,9 @@ function apiMessagesUrlToWebSocketUrl(url) {
22
22
  throw new Error("API Messages URL must start with http://, https://, ws://, or wss://");
23
23
  }
24
24
 
25
+ // src/version.ts
26
+ var PACKAGE_VERSION = "0.9.3";
27
+
25
28
  // src/types.ts
26
29
  function isSettingsFieldGroup(item) {
27
30
  return "fields" in item && Array.isArray(item.fields);
@@ -32,6 +35,8 @@ function toUser(w) {
32
35
  userId: w.user_id,
33
36
  userName: w.user_name,
34
37
  userEmail: w.user_email,
38
+ userMobileNumber: w.user_mobile_number,
39
+ userWhatsappNumber: w.user_whatsapp_number,
35
40
  identityIds: w.identity_ids,
36
41
  systemRole: w.system_role,
37
42
  organizationRole: w.organization_role,
@@ -63,7 +68,8 @@ function toDisplayContentPart(w) {
63
68
  url: w.url,
64
69
  mimeType: w.mime_type,
65
70
  duration: w.duration,
66
- filename: w.filename
71
+ filename: w.filename,
72
+ ...w.ref_id ? { refId: w.ref_id } : {}
67
73
  };
68
74
  case "image":
69
75
  return {
@@ -73,7 +79,8 @@ function toDisplayContentPart(w) {
73
79
  width: w.width,
74
80
  height: w.height,
75
81
  alt: w.alt,
76
- filename: w.filename
82
+ filename: w.filename,
83
+ ...w.ref_id ? { refId: w.ref_id } : {}
77
84
  };
78
85
  case "document":
79
86
  return {
@@ -81,7 +88,8 @@ function toDisplayContentPart(w) {
81
88
  url: w.url,
82
89
  filename: w.filename,
83
90
  mimeType: w.mime_type,
84
- sizeBytes: w.size_bytes
91
+ sizeBytes: w.size_bytes,
92
+ ...w.ref_id ? { refId: w.ref_id } : {}
85
93
  };
86
94
  }
87
95
  }
@@ -408,7 +416,8 @@ var AgentClient = class {
408
416
  config = {
409
417
  organizationId: "",
410
418
  workspaceId: "",
411
- userId: ""
419
+ userId: "",
420
+ channel: "dooers-platform"
412
421
  };
413
422
  connectFrameId = "";
414
423
  isIntentionallyClosed = false;
@@ -695,9 +704,7 @@ var AgentClient = class {
695
704
  content
696
705
  }
697
706
  };
698
- if (params.metadata) {
699
- payload.metadata = params.metadata;
700
- }
707
+ payload.metadata = this.withChannelMetadata(params.metadata);
701
708
  this.sendRaw({
702
709
  id: clientEventId,
703
710
  type: "event.create",
@@ -725,7 +732,8 @@ var AgentClient = class {
725
732
  values: params.values
726
733
  }
727
734
  }
728
- }
735
+ },
736
+ metadata: this.withChannelMetadata(params.metadata)
729
737
  });
730
738
  return promise;
731
739
  }
@@ -785,13 +793,15 @@ var AgentClient = class {
785
793
  user_id: this.config.userId ?? "",
786
794
  user_name: this.config.userName ?? null,
787
795
  user_email: this.config.userEmail ?? null,
796
+ user_mobile_number: this.config.userMobileNumber ?? null,
797
+ user_whatsapp_number: this.config.userWhatsappNumber ?? null,
788
798
  identity_ids: this.config.identityIds ?? [],
789
799
  system_role: this.config.systemRole ?? "user",
790
800
  organization_role: this.config.organizationRole ?? "member",
791
801
  workspace_role: this.config.workspaceRole ?? "member"
792
802
  },
793
803
  auth_token: this.config.authToken,
794
- client: { name: "dooers-agents-client", version: "0.1.0" }
804
+ client: { name: "dooers-agents-client", version: PACKAGE_VERSION }
795
805
  }
796
806
  });
797
807
  }
@@ -969,6 +979,17 @@ var AgentClient = class {
969
979
  send(type, payload) {
970
980
  this.sendRaw({ id: crypto.randomUUID(), type, payload });
971
981
  }
982
+ withChannelMetadata(metadata) {
983
+ const channel = (this.config.channel || "dooers-platform").trim() || "dooers-platform";
984
+ const base = metadata ? { ...metadata } : {};
985
+ if (!("channel" in base)) {
986
+ base.channel = channel;
987
+ }
988
+ if (this.config.channelMeta && !("channel_meta" in base)) {
989
+ base.channel_meta = this.config.channelMeta;
990
+ }
991
+ return Object.keys(base).length > 0 ? base : void 0;
992
+ }
972
993
  sendRaw(frame) {
973
994
  if (!this.ws || this.ws.readyState !== WebSocket.OPEN) return;
974
995
  this.ws.send(JSON.stringify(frame));
@@ -1410,11 +1431,15 @@ function AgentProvider({
1410
1431
  userId,
1411
1432
  userName,
1412
1433
  userEmail,
1434
+ userMobileNumber,
1435
+ userWhatsappNumber,
1413
1436
  identityIds,
1414
1437
  systemRole,
1415
1438
  organizationRole,
1416
1439
  workspaceRole,
1417
1440
  authToken,
1441
+ channel,
1442
+ channelMeta,
1418
1443
  uploadUrl,
1419
1444
  onError,
1420
1445
  children
@@ -1443,11 +1468,15 @@ function AgentProvider({
1443
1468
  userId,
1444
1469
  userName,
1445
1470
  userEmail,
1471
+ userMobileNumber,
1472
+ userWhatsappNumber,
1446
1473
  identityIds: identityIdsKey ? identityIdsKey.split(",") : void 0,
1447
1474
  systemRole,
1448
1475
  organizationRole,
1449
1476
  workspaceRole,
1450
- authToken
1477
+ authToken,
1478
+ channel,
1479
+ channelMeta
1451
1480
  });
1452
1481
  return () => clientRef.current?.disconnect();
1453
1482
  }, [
@@ -1458,11 +1487,15 @@ function AgentProvider({
1458
1487
  userId,
1459
1488
  userName,
1460
1489
  userEmail,
1490
+ userMobileNumber,
1491
+ userWhatsappNumber,
1461
1492
  identityIdsKey,
1462
1493
  systemRole,
1463
1494
  organizationRole,
1464
1495
  workspaceRole,
1465
- authToken
1496
+ authToken,
1497
+ channel,
1498
+ channelMeta
1466
1499
  ]);
1467
1500
  const contextValue = useMemo(
1468
1501
  () => ({ store: storeRef.current, client: clientRef.current }),
@@ -1915,6 +1948,6 @@ function useUpload() {
1915
1948
  return { upload, isUploading };
1916
1949
  }
1917
1950
 
1918
- export { AgentProvider, AgentServerClient, apiMessagesUrlToWebSocketUrl, isSettingsFieldGroup, toFormElement, toFormEventData, toFormResponseEventData, useAgentContext, useAnalytics, useAudioRecorder, useConnection, useFeedback, useForm, useFormFileUpload, useMessage, useSettings, useSettingsFileUpload, useThreadDetails, useThreadEvents, useThreadsActions, useThreadsList, useUpload };
1951
+ export { AgentProvider, AgentServerClient, PACKAGE_VERSION, apiMessagesUrlToWebSocketUrl, isSettingsFieldGroup, toFormElement, toFormEventData, toFormResponseEventData, useAgentContext, useAnalytics, useAudioRecorder, useConnection, useFeedback, useForm, useFormFileUpload, useMessage, useSettings, useSettingsFileUpload, useThreadDetails, useThreadEvents, useThreadsActions, useThreadsList, useUpload };
1919
1952
  //# sourceMappingURL=main.js.map
1920
1953
  //# sourceMappingURL=main.js.map