@gravity-rail/sdk 0.8.0 → 0.10.1

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.
Files changed (43) hide show
  1. package/README.md +38 -0
  2. package/dist/{chunk-ML55PVP7.js → chunk-2BJG4GYM.js} +641 -541
  3. package/dist/chunk-2BJG4GYM.js.map +1 -0
  4. package/dist/chunk-FSSXKQR5.js +471 -0
  5. package/dist/chunk-FSSXKQR5.js.map +1 -0
  6. package/dist/{chunk-QS6ZRQUZ.js → chunk-TJT7A4CO.js} +8 -1
  7. package/dist/{chunk-QS6ZRQUZ.js.map → chunk-TJT7A4CO.js.map} +1 -1
  8. package/dist/{client-C2aWAalu.d.cts → client-BffM3KcA.d.cts} +1190 -313
  9. package/dist/{client-CLGovEox.d.ts → client-DfjAYbt8.d.ts} +1190 -313
  10. package/dist/helpers.cjs +178 -2
  11. package/dist/helpers.cjs.map +1 -1
  12. package/dist/helpers.d.cts +82 -3
  13. package/dist/helpers.d.ts +82 -3
  14. package/dist/helpers.js +156 -1
  15. package/dist/helpers.js.map +1 -1
  16. package/dist/index.cjs +851 -166
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.cts +14 -8
  19. package/dist/index.d.ts +14 -8
  20. package/dist/index.js +144 -20
  21. package/dist/index.js.map +1 -1
  22. package/dist/{inquiries-CmECZnkl.d.cts → inquiries-UcWNYo-Q.d.cts} +564 -79
  23. package/dist/{inquiries-CmECZnkl.d.ts → inquiries-UcWNYo-Q.d.ts} +564 -79
  24. package/dist/internal.cjs +784 -153
  25. package/dist/internal.cjs.map +1 -1
  26. package/dist/internal.d.cts +241 -5
  27. package/dist/internal.d.ts +241 -5
  28. package/dist/internal.js +71 -7
  29. package/dist/internal.js.map +1 -1
  30. package/dist/realtime.cjs +1 -0
  31. package/dist/realtime.cjs.map +1 -1
  32. package/dist/realtime.js +1 -0
  33. package/dist/realtime.js.map +1 -1
  34. package/dist/schemas.cjs +29 -7
  35. package/dist/schemas.cjs.map +1 -1
  36. package/dist/schemas.d.cts +106 -51
  37. package/dist/schemas.d.ts +106 -51
  38. package/dist/schemas.js +29 -8
  39. package/dist/schemas.js.map +1 -1
  40. package/dist/{scopes-D6a_Mvqr.d.ts → scopes-CjSvITpL.d.cts} +53 -8
  41. package/dist/{scopes-CDaJBQVT.d.cts → scopes-CmNKWrzb.d.ts} +53 -8
  42. package/package.json +5 -5
  43. package/dist/chunk-ML55PVP7.js.map +0 -1
package/dist/internal.cjs CHANGED
@@ -61,6 +61,12 @@ __export(internal_exports, {
61
61
  ConsentMethod: () => ConsentMethod,
62
62
  CriterionType: () => CriterionType,
63
63
  CustomToolkitsApi: () => CustomToolkitsApi,
64
+ CustomerActivityClassifierDetectorName: () => CustomerActivityClassifierDetectorName,
65
+ CustomerActivityClassifierLabel: () => CustomerActivityClassifierLabel,
66
+ CustomerActivityEventSource: () => CustomerActivityEventSource,
67
+ CustomerActivityEventStatus: () => CustomerActivityEventStatus,
68
+ CustomerActivityReviewOutcome: () => CustomerActivityReviewOutcome,
69
+ CustomerActivitySeverity: () => CustomerActivitySeverity,
64
70
  CustomersApi: () => CustomersApi,
65
71
  DEFAULT_CHAT_MODEL: () => DEFAULT_CHAT_MODEL,
66
72
  DEFAULT_CUSTOM_VOICE_MODEL: () => DEFAULT_CUSTOM_VOICE_MODEL,
@@ -68,6 +74,7 @@ __export(internal_exports, {
68
74
  DEFAULT_VOICE_INFERENCE_MODEL: () => DEFAULT_VOICE_INFERENCE_MODEL,
69
75
  DataCategory: () => DataCategory,
70
76
  DataFieldType: () => DataFieldType,
77
+ DataRecordRetirementResponseReason: () => DataRecordRetirementResponseReason,
71
78
  DataSensitivity: () => DataSensitivity,
72
79
  DataTypeRecordScope: () => DataTypeRecordScope,
73
80
  DataTypesApi: () => DataTypesApi,
@@ -100,6 +107,8 @@ __export(internal_exports, {
100
107
  McpServerState: () => McpServerState,
101
108
  McpServersApi: () => McpServersApi,
102
109
  MemberFeature: () => MemberFeature,
110
+ MemberImportMatchInfoMatchType: () => MemberImportMatchInfoMatchType,
111
+ MemberImportPreviewRowAction: () => MemberImportPreviewRowAction,
103
112
  MemberType: () => MemberType,
104
113
  MembersApi: () => MembersApi,
105
114
  MenuItemResponseItemType: () => MenuItemResponseItemType,
@@ -127,11 +136,14 @@ __export(internal_exports, {
127
136
  PERMISSION_NONE: () => PERMISSION_NONE,
128
137
  PERMISSION_USE: () => PERMISSION_USE,
129
138
  PERMISSION_VERIFY: () => PERMISSION_VERIFY,
139
+ PIDS_DISPOSITIONS: () => PIDS_DISPOSITIONS,
140
+ PIDS_SOURCES: () => PIDS_SOURCES,
130
141
  PersonasApi: () => PersonasApi,
131
142
  PhoneNumbersApi: () => PhoneNumbersApi,
132
143
  ProductType: () => ProductType,
133
144
  PromptsApi: () => PromptsApi,
134
145
  PronunciationsApi: () => PronunciationsApi,
146
+ QUERY_VALUELESS_OPS: () => QUERY_VALUELESS_OPS,
135
147
  QualificationsApi: () => QualificationsApi,
136
148
  REALTIME_MODEL_CUSTOM: () => REALTIME_MODEL_CUSTOM,
137
149
  REALTIME_MODEL_GEMINI: () => REALTIME_MODEL_GEMINI,
@@ -169,7 +181,6 @@ __export(internal_exports, {
169
181
  TTS_MODEL_ELEVENLABS_FLASH: () => TTS_MODEL_ELEVENLABS_FLASH,
170
182
  TTS_MODEL_ELEVENLABS_MULTILINGUAL: () => TTS_MODEL_ELEVENLABS_MULTILINGUAL,
171
183
  TTS_MODEL_ELEVENLABS_TURBO: () => TTS_MODEL_ELEVENLABS_TURBO,
172
- TTS_MODEL_POCKET: () => TTS_MODEL_POCKET,
173
184
  TTS_PREVIEW_PROVIDERS: () => TTS_PREVIEW_PROVIDERS,
174
185
  TasksApi: () => TasksApi,
175
186
  TemplatesApi: () => TemplatesApi,
@@ -209,6 +220,7 @@ __export(internal_exports, {
209
220
  bindPromptsMethods: () => bindPromptsMethods,
210
221
  bindPronunciationsMethods: () => bindPronunciationsMethods,
211
222
  bindQualificationsMethods: () => bindQualificationsMethods,
223
+ bindQueriesMethods: () => bindQueriesMethods,
212
224
  bindResellersMethods: () => bindResellersMethods,
213
225
  bindSitesMethods: () => bindSitesMethods,
214
226
  bindSupportRequestMethods: () => bindSupportRequestMethods,
@@ -373,6 +385,20 @@ var BulkMemberResultStatus = {
373
385
  updated: "updated",
374
386
  failed: "failed"
375
387
  };
388
+ var MemberImportMatchInfoMatchType = {
389
+ external_id: "external_id",
390
+ email: "email",
391
+ phone: "phone",
392
+ account_email: "account_email",
393
+ account_phone: "account_phone"
394
+ };
395
+ var MemberImportPreviewRowAction = {
396
+ create: "create",
397
+ update: "update",
398
+ unchanged: "unchanged",
399
+ conflict: "conflict",
400
+ error: "error"
401
+ };
376
402
 
377
403
  // src/types/member-types.ts
378
404
  var MemberType = /* @__PURE__ */ ((MemberType2) => {
@@ -416,6 +442,9 @@ var EventRuleObjectType = /* @__PURE__ */ ((EventRuleObjectType2) => {
416
442
  })(EventRuleObjectType || {});
417
443
  var EventRuleEventType = /* @__PURE__ */ ((EventRuleEventType2) => {
418
444
  EventRuleEventType2["TASK_EXECUTE"] = "task:execute";
445
+ EventRuleEventType2["TASK_ENTER"] = "task:enter";
446
+ EventRuleEventType2["TASK_COMMAND"] = "task:command";
447
+ EventRuleEventType2["TASK_EXIT"] = "task:exit";
419
448
  EventRuleEventType2["MEMBER_JOINED"] = "workspace:member_joined";
420
449
  EventRuleEventType2["MEMBER_LEFT"] = "workspace:member_left";
421
450
  EventRuleEventType2["DATA_RECORD_CREATED"] = "data_record:created";
@@ -449,6 +478,7 @@ var EventRuleActionType = /* @__PURE__ */ ((EventRuleActionType2) => {
449
478
  EventRuleActionType2["SWITCH_TASK_ACTION"] = "task:switch";
450
479
  EventRuleActionType2["ASSISTANT_MESSAGE"] = "assistant:message";
451
480
  EventRuleActionType2["FORM_FIELD_UPDATE"] = "form:update_field";
481
+ EventRuleActionType2["CEL_MUTATE"] = "record:cel_mutate";
452
482
  EventRuleActionType2["MESSAGE_VALIDATION"] = "message:validation";
453
483
  EventRuleActionType2["CHAT_CREATE"] = "chat:create";
454
484
  EventRuleActionType2["CHAT_CONTINUE"] = "chat:continue";
@@ -590,6 +620,12 @@ var InvitationStatus = /* @__PURE__ */ ((InvitationStatus2) => {
590
620
  return InvitationStatus2;
591
621
  })(InvitationStatus || {});
592
622
 
623
+ // src/types/generated/data.ts
624
+ var DataRecordRetirementResponseReason = {
625
+ monday_item_archived: "monday_item_archived",
626
+ monday_item_deleted: "monday_item_deleted"
627
+ };
628
+
593
629
  // src/types/data-types.ts
594
630
  var DataFieldType = /* @__PURE__ */ ((DataFieldType2) => {
595
631
  DataFieldType2["ENUM"] = "enum";
@@ -651,7 +687,6 @@ var ModelProvider = {
651
687
  aws: "aws",
652
688
  elevenlabs: "elevenlabs",
653
689
  deepgram: "deepgram",
654
- pocket: "pocket",
655
690
  xai: "xai",
656
691
  custom: "custom"
657
692
  };
@@ -681,7 +716,10 @@ var TTS_MODEL_ELEVENLABS_MULTILINGUAL = "elevenlabs:tts:eleven_multilingual_v2";
681
716
  var TTS_MODEL_DEEPGRAM_AURA_2 = "deepgram:tts:aura-2";
682
717
  var TTS_MODEL_AWS_POLLY_GENERATIVE = "aws:tts:polly-generative";
683
718
  var TTS_MODEL_AWS_POLLY_NEURAL = "aws:tts:polly-neural";
684
- var TTS_MODEL_POCKET = "pocket:tts:default";
719
+
720
+ // src/types/pids-types.ts
721
+ var PIDS_DISPOSITIONS = ["true_positive", "false_positive", "needs_more_context"];
722
+ var PIDS_SOURCES = ["scheduled", "backfill", "pre_llm"];
685
723
 
686
724
  // src/types/calendar-types.ts
687
725
  var CalendarPermissionType = /* @__PURE__ */ ((CalendarPermissionType2) => {
@@ -821,15 +859,20 @@ var AbilityTypeSlugs = {
821
859
  TOOLKITS: "tools:toolkits",
822
860
  WEB_SEARCH: "tools:web_search",
823
861
  CONVERSATION_HISTORY: "tools:conversation_history",
862
+ IMAGE_GENERATION: "tools:image_generation",
863
+ CONVERSATION_CONTROL: "tools:conversation_control",
824
864
  // Integration
825
865
  CALENDAR_BOOKING: "integration:calendar_booking",
826
866
  FILE_ACCESS: "integration:file_access",
827
867
  DATA_ACCESS: "integration:data_access",
828
868
  GMAIL: "integration:gmail",
869
+ GOOGLE_CALENDAR: "integration:google_calendar",
870
+ GOOGLE_DRIVE: "integration:google_drive",
829
871
  CHARLESTON_PMD_PAGING: "integration:charleston_pmd_paging",
830
872
  // Communication
831
873
  PHONE_CALL_TOOLS: "communication:phone_call_tools",
832
874
  SEND_SMS: "communication:send_sms",
875
+ SEND_WHATSAPP: "communication:send_whatsapp",
833
876
  MEMBER_ACCESS: "communication:member_access",
834
877
  AUDIO_PLAYBACK: "communication:audio_playback",
835
878
  // Oversight
@@ -838,12 +881,69 @@ var AbilityTypeSlugs = {
838
881
  ESCALATION: "oversight:escalation",
839
882
  // Identity
840
883
  MEMBER_FIELD_VERIFICATION: "identity:member_field_verification",
884
+ // Delegation
885
+ CONTRIBUTOR: "delegation:contributor",
886
+ // Workflow
887
+ WORKFLOW_RUN: "workflow:run",
888
+ // Commerce
889
+ RESELLER: "commerce:reseller",
841
890
  // System (auto-injected, hidden from users)
842
891
  USER_MESSAGE_RULES: "system:user_message_rules",
843
892
  ASSISTANT_MESSAGE_RULES: "chat:assistant_message_rules",
844
893
  CEL_ROUTING: "system:cel_routing"
845
894
  };
846
895
 
896
+ // src/types/query-engine-types.ts
897
+ var QUERY_VALUELESS_OPS = /* @__PURE__ */ new Set([
898
+ "isEmpty",
899
+ "notEmpty",
900
+ "exists"
901
+ ]);
902
+
903
+ // src/types/generated/customer_activity.ts
904
+ var CustomerActivityClassifierDetectorName = {
905
+ assignment_chat_classifier: "assignment_chat_classifier",
906
+ manager_chat_classifier: "manager_chat_classifier",
907
+ concierge_chat_classifier: "concierge_chat_classifier",
908
+ chat_review: "chat_review"
909
+ };
910
+ var CustomerActivityClassifierLabel = {
911
+ user_distress: "user_distress",
912
+ user_confusion: "user_confusion",
913
+ health_topic_mentioned: "health_topic_mentioned",
914
+ health_advice_given: "health_advice_given",
915
+ escalation_failure: "escalation_failure",
916
+ repeated_tool_failure: "repeated_tool_failure",
917
+ transcription_quality: "transcription_quality",
918
+ repetitive_loop: "repetitive_loop"
919
+ };
920
+ var CustomerActivityEventSource = {
921
+ system: "system",
922
+ customer: "customer",
923
+ classifier: "classifier",
924
+ operator: "operator"
925
+ };
926
+ var CustomerActivityEventStatus = {
927
+ new: "new",
928
+ reviewed: "reviewed"
929
+ };
930
+ var CustomerActivityReviewOutcome = {
931
+ no_action_needed: "no_action_needed",
932
+ support_request_created: "support_request_created",
933
+ bug_filed: "bug_filed",
934
+ linked_existing_work: "linked_existing_work",
935
+ classifier_feedback: "classifier_feedback",
936
+ test_activity: "test_activity"
937
+ };
938
+ var CustomerActivitySeverity = {
939
+ none: "none",
940
+ minimal: "minimal",
941
+ low: "low",
942
+ medium: "medium",
943
+ high: "high",
944
+ critical: "critical"
945
+ };
946
+
847
947
  // src/types/model-config-types.ts
848
948
  var DEFAULT_THINKING_SPEECH_PHRASES = [
849
949
  "One moment please",
@@ -859,7 +959,6 @@ var TTS_PREVIEW_PROVIDERS = [
859
959
  "elevenlabs",
860
960
  "google",
861
961
  "aws",
862
- "pocket",
863
962
  "deepgram",
864
963
  "xai"
865
964
  ];
@@ -1305,21 +1404,16 @@ var CHAT_TYPES = {
1305
1404
  ASSIGNMENT: "assignment",
1306
1405
  MANAGER: "manager",
1307
1406
  CONTRIBUTOR: "contributor",
1308
- DEVELOPER: "developer",
1309
- MEMBER: "member",
1310
- /** @deprecated Use MEMBER instead */
1311
- AGENT: "member",
1312
- /** @deprecated Use MEMBER instead */
1313
- DM: "member"
1407
+ DM: "dm"
1314
1408
  };
1315
1409
  var BUILTIN_ASSISTANT_CHAT_TYPES = /* @__PURE__ */ new Set([
1316
1410
  CHAT_TYPES.MANAGER,
1317
- CHAT_TYPES.CONTRIBUTOR,
1318
- CHAT_TYPES.DEVELOPER
1411
+ CHAT_TYPES.CONTRIBUTOR
1319
1412
  ]);
1413
+ var MEMBER_AGENT_CHAT_TYPES = /* @__PURE__ */ new Set([CHAT_TYPES.DM]);
1320
1414
  var NO_ASSISTANT_PARTICIPANT_CHAT_TYPES = /* @__PURE__ */ new Set([
1321
1415
  ...BUILTIN_ASSISTANT_CHAT_TYPES,
1322
- CHAT_TYPES.MEMBER
1416
+ ...MEMBER_AGENT_CHAT_TYPES
1323
1417
  ]);
1324
1418
  function usesBuiltinAssistant(chatType) {
1325
1419
  return BUILTIN_ASSISTANT_CHAT_TYPES.has(chatType);
@@ -2030,6 +2124,22 @@ function parseOrgAuthChallenge(wwwAuthenticate) {
2030
2124
  authUrl: authUrlMatch[1]
2031
2125
  };
2032
2126
  }
2127
+ function getRequestOrgCookieName(cookieName) {
2128
+ if (cookieName.startsWith("orgToken")) {
2129
+ return cookieName.replace(/^orgToken/, "requestOrgToken");
2130
+ }
2131
+ if (cookieName.startsWith("orgSession")) {
2132
+ return cookieName.replace(/^orgSession/, "requestOrgSession");
2133
+ }
2134
+ return null;
2135
+ }
2136
+ function orgAuthHeaderName(token) {
2137
+ return token.startsWith("gr_sess_") ? "X-Org-Session" : "X-Org-Token";
2138
+ }
2139
+ function setOrgAuthHeader(headers, token) {
2140
+ if (!token) return;
2141
+ headers.set(orgAuthHeaderName(token), token);
2142
+ }
2033
2143
  var BaseApiClient = class {
2034
2144
  baseUrl;
2035
2145
  apiKey;
@@ -2040,15 +2150,15 @@ var BaseApiClient = class {
2040
2150
  orgAuthHandler;
2041
2151
  orgAuthInProgress = null;
2042
2152
  actingMemberUuid;
2043
- orgToken;
2153
+ orgSession;
2044
2154
  /**
2045
- * The org_uuid that issued the current orgToken. Tracked so we can detect
2155
+ * The org_uuid that issued the current org auth credential. Tracked so we can detect
2046
2156
  * a 401 challenge from a *different* org and re-fire the handler — the
2047
- * orgToken is an opaque JWE we cannot decrypt client-side, so without this
2048
- * the original guard `!this.orgToken` would prevent re-auth across orgs and
2049
- * surface as a silent 401 in multi-org CLI workflows.
2157
+ * credential is opaque to the client, so without this the original guard
2158
+ * `!this.orgSession` would prevent re-auth across orgs and surface as a silent
2159
+ * 401 in multi-org CLI workflows.
2050
2160
  */
2051
- orgTokenOrgUuid;
2161
+ orgSessionOrgUuid;
2052
2162
  constructor(apiKey, baseUrl, customFetch) {
2053
2163
  this.baseUrl = baseUrl;
2054
2164
  this.apiKey = apiKey;
@@ -2095,18 +2205,25 @@ var BaseApiClient = class {
2095
2205
  return this.actingMemberUuid;
2096
2206
  }
2097
2207
  /**
2098
- * Set the org token for cross-domain requests.
2099
- * When set, all API requests will include the X-Org-Token header,
2100
- * allowing org-level SSO verification without cookies.
2208
+ * Set the opaque org session credential for cross-domain requests.
2209
+ * Opaque gr_sess_ values use X-Org-Session. Legacy orgToken JWE values still
2210
+ * use X-Org-Token through setOrgToken() during the migration window.
2101
2211
  *
2102
- * `orgUuid` is the org that issued the token; passing it lets the 401
2103
- * handler detect a stale token when a subsequent request targets a
2212
+ * `orgUuid` is the org that issued the credential; passing it lets the 401
2213
+ * handler detect a stale session when a subsequent request targets a
2104
2214
  * different org and re-fire the org-auth handler instead of silently
2105
2215
  * 401-ing. Callers without that context (legacy / unknown) may omit it.
2106
2216
  */
2217
+ setOrgSession(session, orgUuid) {
2218
+ this.orgSession = session;
2219
+ this.orgSessionOrgUuid = session ? orgUuid : void 0;
2220
+ }
2221
+ /**
2222
+ * @deprecated Legacy compatibility for stateless orgToken JWE credentials.
2223
+ * Prefer setOrgSession() for opaque org browser sessions.
2224
+ */
2107
2225
  setOrgToken(token, orgUuid) {
2108
- this.orgToken = token;
2109
- this.orgTokenOrgUuid = token ? orgUuid : void 0;
2226
+ this.setOrgSession(token, orgUuid);
2110
2227
  }
2111
2228
  async fetch(endpoint, options) {
2112
2229
  try {
@@ -2127,9 +2244,7 @@ var BaseApiClient = class {
2127
2244
  if (this.actingMemberUuid) {
2128
2245
  headers.set("X-Acting-Member", this.actingMemberUuid);
2129
2246
  }
2130
- if (this.orgToken) {
2131
- headers.set("X-Org-Token", this.orgToken);
2132
- }
2247
+ setOrgAuthHeader(headers, this.orgSession);
2133
2248
  const fullUrl = `${this.baseUrl}/api/v2/${endpoint}`;
2134
2249
  const response = await this.fetchFunction(fullUrl, {
2135
2250
  ...options,
@@ -2153,31 +2268,28 @@ var BaseApiClient = class {
2153
2268
  try {
2154
2269
  return await this.fetch(endpoint, options);
2155
2270
  } catch (retryError) {
2156
- this.orgToken = void 0;
2157
- this.orgTokenOrgUuid = void 0;
2271
+ this.orgSession = void 0;
2272
+ this.orgSessionOrgUuid = void 0;
2158
2273
  throw retryError;
2159
2274
  }
2160
2275
  }
2161
2276
  if (response.status === 401) {
2162
2277
  const orgAuthInfo = parseOrgAuthChallenge(response.headers.get("WWW-Authenticate"));
2163
- if (orgAuthInfo && this.orgToken && this.orgTokenOrgUuid && this.orgTokenOrgUuid !== orgAuthInfo.orgUuid) {
2164
- this.orgToken = void 0;
2165
- this.orgTokenOrgUuid = void 0;
2278
+ if (orgAuthInfo && this.orgSession && this.orgSessionOrgUuid && this.orgSessionOrgUuid !== orgAuthInfo.orgUuid) {
2279
+ this.orgSession = void 0;
2280
+ this.orgSessionOrgUuid = void 0;
2166
2281
  }
2167
- if (orgAuthInfo && !this.orgToken) {
2168
- const requestCookieName = orgAuthInfo.cookieName.replace(
2169
- /^orgToken/,
2170
- "requestOrgToken"
2171
- );
2172
- const cachedOrgToken = getCookieValue(requestCookieName);
2173
- if (cachedOrgToken) {
2174
- this.orgToken = cachedOrgToken;
2175
- this.orgTokenOrgUuid = orgAuthInfo.orgUuid;
2282
+ if (orgAuthInfo && !this.orgSession) {
2283
+ const requestCookieName = getRequestOrgCookieName(orgAuthInfo.cookieName);
2284
+ const cachedOrgSession = requestCookieName ? getCookieValue(requestCookieName) : void 0;
2285
+ if (cachedOrgSession) {
2286
+ this.orgSession = cachedOrgSession;
2287
+ this.orgSessionOrgUuid = orgAuthInfo.orgUuid;
2176
2288
  try {
2177
2289
  return await this.fetch(endpoint, options);
2178
2290
  } catch (retryError) {
2179
- this.orgToken = void 0;
2180
- this.orgTokenOrgUuid = void 0;
2291
+ this.orgSession = void 0;
2292
+ this.orgSessionOrgUuid = void 0;
2181
2293
  throw retryError;
2182
2294
  }
2183
2295
  }
@@ -2193,20 +2305,20 @@ var BaseApiClient = class {
2193
2305
  })();
2194
2306
  }
2195
2307
  await this.orgAuthInProgress;
2196
- const postHandlerToken = getCookieValue(requestCookieName) ?? this.orgToken;
2197
- if (!postHandlerToken) {
2308
+ const postHandlerSession = (requestCookieName ? getCookieValue(requestCookieName) : void 0) ?? this.orgSession;
2309
+ if (!postHandlerSession) {
2198
2310
  throw new ApiError(
2199
- "Organization authentication did not issue a token",
2311
+ "Organization authentication did not issue a session",
2200
2312
  401
2201
2313
  );
2202
2314
  }
2203
- this.orgToken = postHandlerToken;
2204
- this.orgTokenOrgUuid = orgAuthInfo.orgUuid;
2315
+ this.orgSession = postHandlerSession;
2316
+ this.orgSessionOrgUuid = orgAuthInfo.orgUuid;
2205
2317
  try {
2206
2318
  return await this.fetch(endpoint, options);
2207
2319
  } catch (retryError) {
2208
- this.orgToken = void 0;
2209
- this.orgTokenOrgUuid = void 0;
2320
+ this.orgSession = void 0;
2321
+ this.orgSessionOrgUuid = void 0;
2210
2322
  throw retryError;
2211
2323
  }
2212
2324
  }
@@ -2281,9 +2393,7 @@ ${formattedErrors}`, response.status);
2281
2393
  if (this.actingMemberUuid) {
2282
2394
  headers.set("X-Acting-Member", this.actingMemberUuid);
2283
2395
  }
2284
- if (this.orgToken) {
2285
- headers.set("X-Org-Token", this.orgToken);
2286
- }
2396
+ setOrgAuthHeader(headers, this.orgSession);
2287
2397
  const response = await this.fetchFunction(`${this.baseUrl}/api/v2/${endpoint}`, {
2288
2398
  ...options,
2289
2399
  ...this.apiKey ? {} : { credentials: "include" },
@@ -2306,31 +2416,28 @@ ${formattedErrors}`, response.status);
2306
2416
  try {
2307
2417
  return await this.fetchRaw(endpoint, options, allowedErrorStatuses);
2308
2418
  } catch (retryError) {
2309
- this.orgToken = void 0;
2310
- this.orgTokenOrgUuid = void 0;
2419
+ this.orgSession = void 0;
2420
+ this.orgSessionOrgUuid = void 0;
2311
2421
  throw retryError;
2312
2422
  }
2313
2423
  }
2314
2424
  if (response.status === 401) {
2315
2425
  const orgAuthInfo = parseOrgAuthChallenge(response.headers.get("WWW-Authenticate"));
2316
- if (orgAuthInfo && this.orgToken && this.orgTokenOrgUuid && this.orgTokenOrgUuid !== orgAuthInfo.orgUuid) {
2317
- this.orgToken = void 0;
2318
- this.orgTokenOrgUuid = void 0;
2426
+ if (orgAuthInfo && this.orgSession && this.orgSessionOrgUuid && this.orgSessionOrgUuid !== orgAuthInfo.orgUuid) {
2427
+ this.orgSession = void 0;
2428
+ this.orgSessionOrgUuid = void 0;
2319
2429
  }
2320
- if (orgAuthInfo && !this.orgToken) {
2321
- const requestCookieName = orgAuthInfo.cookieName.replace(
2322
- /^orgToken/,
2323
- "requestOrgToken"
2324
- );
2325
- const cachedOrgToken = getCookieValue(requestCookieName);
2326
- if (cachedOrgToken) {
2327
- this.orgToken = cachedOrgToken;
2328
- this.orgTokenOrgUuid = orgAuthInfo.orgUuid;
2430
+ if (orgAuthInfo && !this.orgSession) {
2431
+ const requestCookieName = getRequestOrgCookieName(orgAuthInfo.cookieName);
2432
+ const cachedOrgSession = requestCookieName ? getCookieValue(requestCookieName) : void 0;
2433
+ if (cachedOrgSession) {
2434
+ this.orgSession = cachedOrgSession;
2435
+ this.orgSessionOrgUuid = orgAuthInfo.orgUuid;
2329
2436
  try {
2330
2437
  return await this.fetchRaw(endpoint, options, allowedErrorStatuses);
2331
2438
  } catch (retryError) {
2332
- this.orgToken = void 0;
2333
- this.orgTokenOrgUuid = void 0;
2439
+ this.orgSession = void 0;
2440
+ this.orgSessionOrgUuid = void 0;
2334
2441
  throw retryError;
2335
2442
  }
2336
2443
  }
@@ -2346,20 +2453,20 @@ ${formattedErrors}`, response.status);
2346
2453
  })();
2347
2454
  }
2348
2455
  await this.orgAuthInProgress;
2349
- const postHandlerToken = getCookieValue(requestCookieName) ?? this.orgToken;
2350
- if (!postHandlerToken) {
2456
+ const postHandlerSession = (requestCookieName ? getCookieValue(requestCookieName) : void 0) ?? this.orgSession;
2457
+ if (!postHandlerSession) {
2351
2458
  throw new ApiError(
2352
- "Organization authentication did not issue a token",
2459
+ "Organization authentication did not issue a session",
2353
2460
  401
2354
2461
  );
2355
2462
  }
2356
- this.orgToken = postHandlerToken;
2357
- this.orgTokenOrgUuid = orgAuthInfo.orgUuid;
2463
+ this.orgSession = postHandlerSession;
2464
+ this.orgSessionOrgUuid = orgAuthInfo.orgUuid;
2358
2465
  try {
2359
2466
  return await this.fetchRaw(endpoint, options, allowedErrorStatuses);
2360
2467
  } catch (retryError) {
2361
- this.orgToken = void 0;
2362
- this.orgTokenOrgUuid = void 0;
2468
+ this.orgSession = void 0;
2469
+ this.orgSessionOrgUuid = void 0;
2363
2470
  throw retryError;
2364
2471
  }
2365
2472
  }
@@ -2398,9 +2505,7 @@ ${formattedErrors}`, response.status);
2398
2505
  if (this.actingMemberUuid) {
2399
2506
  headers.set("X-Acting-Member", this.actingMemberUuid);
2400
2507
  }
2401
- if (this.orgToken) {
2402
- headers.set("X-Org-Token", this.orgToken);
2403
- }
2508
+ setOrgAuthHeader(headers, this.orgSession);
2404
2509
  const fullUrl = `${this.baseUrl}/${path}`;
2405
2510
  const response = await this.fetchFunction(fullUrl, {
2406
2511
  ...options,
@@ -3109,15 +3214,11 @@ var AuthApi = class extends BaseApiClient {
3109
3214
  body: JSON.stringify({ email, organizationUuid, redirectUrl })
3110
3215
  });
3111
3216
  }
3112
- /** Validate a magic link token and optional OTP to complete authentication. */
3113
- async validateMagicLink(token, otp) {
3114
- const body = { token };
3115
- if (otp) {
3116
- body.otp = otp;
3117
- }
3217
+ /** Validate a magic link token to complete authentication. */
3218
+ async validateMagicLink(token) {
3118
3219
  return await this.fetch(`auth/validate-magic-link`, {
3119
3220
  method: "POST",
3120
- body: JSON.stringify(body)
3221
+ body: JSON.stringify({ token })
3121
3222
  });
3122
3223
  }
3123
3224
  // ===== EMAIL VERIFICATION METHODS =====
@@ -3623,6 +3724,26 @@ var CallsApi = class extends BaseApiClient {
3623
3724
  async getMessageTiming(wid, chatId) {
3624
3725
  return this.fetch(`w/${wid}/recordings/chat/${chatId}/message-timing`);
3625
3726
  }
3727
+ /** List the recorded audio chunks for a chat (metadata only). */
3728
+ async listChatRecordings(wid, chatId, options = {}) {
3729
+ const params = new URLSearchParams();
3730
+ if (options.role) params.set("role", options.role);
3731
+ return this.fetch(
3732
+ `w/${wid}/recordings/chat/${chatId}${params.toString() ? `?${params.toString()}` : ""}`
3733
+ );
3734
+ }
3735
+ /**
3736
+ * Get a single short-lived presigned URL to download the complete call
3737
+ * recording as one WAV file. The first request assembles + caches the
3738
+ * full-call WAV; later requests reuse it.
3739
+ */
3740
+ async getCallRecordingDownloadUrl(wid, chatId, options = {}) {
3741
+ const params = new URLSearchParams();
3742
+ if (options.expiresIn !== void 0) params.set("expires_in", String(options.expiresIn));
3743
+ return this.fetch(
3744
+ `w/${wid}/recordings/chat/${chatId}/download-url${params.toString() ? `?${params.toString()}` : ""}`
3745
+ );
3746
+ }
3626
3747
  };
3627
3748
 
3628
3749
  // src/api/cel.ts
@@ -3707,6 +3828,17 @@ var ChatsApi = class extends BaseApiClient {
3707
3828
  async getChatTokenUsage(wid, chatId) {
3708
3829
  return this.fetch(`w/${wid}/chats/${chatId}/token-usage`);
3709
3830
  }
3831
+ /** List scheduled callbacks for a chat (newest first). */
3832
+ async getChatCallbacks(wid, chatId) {
3833
+ return this.fetch(`w/${wid}/chats/${chatId}/callbacks`);
3834
+ }
3835
+ /** Cancel a pending scheduled callback on a chat. */
3836
+ async cancelChatCallback(wid, chatId, callbackId) {
3837
+ return this.fetch(
3838
+ `w/${wid}/chats/${chatId}/callbacks/${callbackId}/cancel`,
3839
+ { method: "POST" }
3840
+ );
3841
+ }
3710
3842
  /** Get todo items extracted from a chat. */
3711
3843
  async getChatTodos(wid, chatId) {
3712
3844
  return this.fetch(`w/${wid}/chats/${chatId}/todos`);
@@ -3745,9 +3877,11 @@ var ChatsApi = class extends BaseApiClient {
3745
3877
  }
3746
3878
  /** Create a new chat. */
3747
3879
  async createChat(wid, chat) {
3880
+ const { agentMemberId, ...rest } = chat;
3881
+ const payload = agentMemberId !== void 0 && rest.assistantMemberId === void 0 ? { ...rest, assistantMemberId: agentMemberId } : rest;
3748
3882
  return this.fetch(`w/${wid}/chats`, {
3749
3883
  method: "POST",
3750
- body: JSON.stringify(chat)
3884
+ body: JSON.stringify(payload)
3751
3885
  });
3752
3886
  }
3753
3887
  /**
@@ -3810,7 +3944,8 @@ var ChatsApi = class extends BaseApiClient {
3810
3944
  }
3811
3945
  );
3812
3946
  }
3813
- /** List messages in a chat with optional pagination. */
3947
+ /** List messages in a chat with optional pagination.
3948
+ * ``id`` is the numeric chat id (documented) or the chat uuid (accepted). */
3814
3949
  async getChatMessages(wid, id, limit, offset) {
3815
3950
  const params = new URLSearchParams();
3816
3951
  if (limit) params.append("limit", limit.toString());
@@ -4190,6 +4325,7 @@ var DataTypesApi = class extends BaseApiClient {
4190
4325
  async getDataRecords(wid, dataTypeId, options) {
4191
4326
  const params = new URLSearchParams();
4192
4327
  if (options?.memberId !== void 0) params.append("member_id", options.memberId.toString());
4328
+ if (options?.memberIds?.length) params.append("member_ids", options.memberIds.join(","));
4193
4329
  if (options?.search) params.append("search", options.search);
4194
4330
  if (options?.searchField) params.append("search_field", options.searchField);
4195
4331
  if (options?.page) params.append("page", options.page.toString());
@@ -4594,6 +4730,13 @@ var EventsApi = class extends BaseApiClient {
4594
4730
  method: "DELETE"
4595
4731
  });
4596
4732
  }
4733
+ /** Send a one-off test webhook for an existing webhook event rule. */
4734
+ async testWebhook(wid, id, request) {
4735
+ return this.fetch(`w/${wid}/event-rules/${id}/test-webhook`, {
4736
+ method: "POST",
4737
+ body: JSON.stringify(request)
4738
+ });
4739
+ }
4597
4740
  /** Reorder event rules by specifying the desired rule ID sequence. */
4598
4741
  async reorderEventRules(wid, ruleIds) {
4599
4742
  return this.fetch(`w/${wid}/event-rules/reorder`, {
@@ -5071,6 +5214,25 @@ var FhirConnectionsApi = class extends BaseApiClient {
5071
5214
  }
5072
5215
  };
5073
5216
 
5217
+ // src/api/patientsync-connections.ts
5218
+ var PatientSyncConnectionsApi = class extends BaseApiClient {
5219
+ /** Create or update the workspace's PatientSync connection (singleton). */
5220
+ async configurePatientSync(wid, data) {
5221
+ return this.fetch(
5222
+ `w/${wid}/app-connections/patientsync/configure`,
5223
+ { method: "POST", body: JSON.stringify(data) }
5224
+ );
5225
+ }
5226
+ /** Read the PatientSync connection status (never returns the API key). */
5227
+ async getPatientSyncStatus(wid) {
5228
+ return this.fetch(`w/${wid}/app-connections/patientsync/status`);
5229
+ }
5230
+ /** Delete the workspace's PatientSync connection. */
5231
+ async deletePatientSyncConnection(wid) {
5232
+ return this.fetch(`w/${wid}/app-connections/patientsync/`, { method: "DELETE" });
5233
+ }
5234
+ };
5235
+
5074
5236
  // src/api/healthie.ts
5075
5237
  var HealthieApi = class extends BaseApiClient {
5076
5238
  async configureHealthie(wid, data) {
@@ -5191,6 +5353,18 @@ var FilesApi = class extends BaseApiClient {
5191
5353
  async getFile(wid, id) {
5192
5354
  return this.fetch(`w/${wid}/files/${id}`);
5193
5355
  }
5356
+ /**
5357
+ * Download the given files + folders (folders recursively) as a single ZIP.
5358
+ * Returns the raw archive bytes for the caller to save.
5359
+ */
5360
+ async downloadFilesZip(wid, fileIds, folderIds) {
5361
+ const response = await this.fetchRaw(`w/${wid}/files/download/zip`, {
5362
+ method: "POST",
5363
+ headers: { "Content-Type": "application/json" },
5364
+ body: JSON.stringify({ file_ids: fileIds, folder_ids: folderIds })
5365
+ });
5366
+ return response.blob();
5367
+ }
5194
5368
  /** Create a new file record in the workspace. */
5195
5369
  async createFile(wid, file) {
5196
5370
  return this.fetch(`w/${wid}/files`, {
@@ -5807,6 +5981,31 @@ var McpServersApi = class extends BaseApiClient {
5807
5981
  };
5808
5982
 
5809
5983
  // src/api/members.ts
5984
+ var MemberImportValidationError = class extends Error {
5985
+ validationErrors;
5986
+ constructor(message, validationErrors) {
5987
+ super(message);
5988
+ this.name = "MemberImportValidationError";
5989
+ this.validationErrors = validationErrors;
5990
+ }
5991
+ };
5992
+ function throwMemberImportError(errorBody, fallback) {
5993
+ let detail = errorBody?.detail;
5994
+ if (typeof detail === "string") {
5995
+ try {
5996
+ const parsed = JSON.parse(detail);
5997
+ if (parsed && typeof parsed === "object") detail = parsed;
5998
+ } catch {
5999
+ }
6000
+ }
6001
+ if (detail && typeof detail === "object") {
6002
+ const { message, errors } = detail;
6003
+ if (Array.isArray(errors)) {
6004
+ throw new MemberImportValidationError(message || fallback, errors);
6005
+ }
6006
+ }
6007
+ throw new Error(typeof detail === "string" ? detail : fallback);
6008
+ }
5810
6009
  var MembersApi = class extends BaseApiClient {
5811
6010
  /** Get the currently authenticated member for a workspace. */
5812
6011
  async getCurrentMember(wid) {
@@ -5847,8 +6046,10 @@ var MembersApi = class extends BaseApiClient {
5847
6046
  });
5848
6047
  }
5849
6048
  /** List workspace members with pagination, filtering, and sorting. */
5850
- async getWorkspaceMembers(wid, page = 1, pageSize = 10, filters, search, role, sortBy, sortOrder, memberType, isArchived = false, isManager, memberTypes, hasAccount, excludeIds) {
6049
+ async getWorkspaceMembers(wid, page = 1, pageSize = 10, filters, search, role, sortBy, sortOrder, memberType, isArchived = false, isManager, memberTypes, hasAccount, excludeIds, memberFilterId, query) {
5851
6050
  const params = new URLSearchParams();
6051
+ if (memberFilterId != null) params.append("memberFilterId", memberFilterId.toString());
6052
+ if (query != null) params.append("query", JSON.stringify(query));
5852
6053
  if (page) params.append("page", page.toString());
5853
6054
  if (pageSize) params.append("pageSize", pageSize.toString());
5854
6055
  if (sortBy) params.append("sortBy", sortBy);
@@ -5921,6 +6122,17 @@ var MembersApi = class extends BaseApiClient {
5921
6122
  method: "POST"
5922
6123
  });
5923
6124
  }
6125
+ /**
6126
+ * Send the member an SMS asking them to confirm their phone number. When they
6127
+ * reply, a trusted phone auth binding is created so they can use SMS as
6128
+ * themselves without an account (member-attested alternative to the
6129
+ * members:admin "Trusted" override).
6130
+ */
6131
+ async sendMemberPhoneConfirmation(wid, memberId) {
6132
+ return this.fetch(`w/${wid}/members/${memberId}/phone-confirmation`, {
6133
+ method: "POST"
6134
+ });
6135
+ }
5924
6136
  // Member Filter APIs
5925
6137
  /** List all saved member filters for a workspace. */
5926
6138
  async getMemberFilters(wid) {
@@ -5944,6 +6156,22 @@ var MembersApi = class extends BaseApiClient {
5944
6156
  body: JSON.stringify(data)
5945
6157
  });
5946
6158
  }
6159
+ /**
6160
+ * Convert a legacy rules filter to a query-engine predicate. One-way and
6161
+ * transactional: on success the filter's legacy rules are gone and
6162
+ * `query` holds the equivalent IR predicate. 409 if already query-format;
6163
+ * 422 when rules have no engine equivalent.
6164
+ *
6165
+ * With `dryRun: true` the same validation runs but nothing persists: the
6166
+ * response previews the normalized predicate in `query` while `rules`
6167
+ * stay intact on the filter.
6168
+ */
6169
+ async convertMemberFilterToQuery(wid, filterId, opts) {
6170
+ const suffix = opts?.dryRun ? "?dryRun=true" : "";
6171
+ return this.fetch(`w/${wid}/member-filters/${filterId}/convert${suffix}`, {
6172
+ method: "PUT"
6173
+ });
6174
+ }
5947
6175
  /** Delete a saved member filter. */
5948
6176
  async deleteMemberFilter(wid, filterId) {
5949
6177
  return this.fetch(`w/${wid}/member-filters/${filterId}`, {
@@ -6021,48 +6249,98 @@ var MembersApi = class extends BaseApiClient {
6021
6249
  });
6022
6250
  }
6023
6251
  // Import/Export Members API
6024
- /** Import members from a CSV file, streaming progress updates via callback. */
6025
- async importMembers(wid, file, newMemberRoleId, onProgress) {
6252
+ /**
6253
+ * Read-only preview classifying each CSV row before any write (GRA-5545).
6254
+ *
6255
+ * Returns create/update/unchanged/conflict/error counts. For phone-only
6256
+ * identity conflicts it also returns existing vs incoming identity so the
6257
+ * operator can decide whether to skip or explicitly overwrite before
6258
+ * committing. Requires MEMBERS_ADMIN and is bulk-PHI audited server-side.
6259
+ */
6260
+ async previewImportMembers(wid, file, newMemberRoleId, options) {
6026
6261
  const formData = new FormData();
6027
6262
  formData.append("file", file);
6028
6263
  const params = new URLSearchParams();
6029
6264
  params.append("new_member_role_id", newMemberRoleId.toString());
6030
- const response = await fetch(
6031
- `${this.baseUrl}/api/v2/w/${wid}/members/import?${params.toString()}`,
6265
+ if (options?.trustEmailAddresses) {
6266
+ params.append("trust_email_addresses", "true");
6267
+ }
6268
+ if (options?.trustPhoneNumbers) {
6269
+ params.append("trust_phone_numbers", "true");
6270
+ }
6271
+ const response = await this.fetchRaw(
6272
+ `w/${wid}/members/import/preview?${params.toString()}`,
6032
6273
  {
6033
6274
  method: "POST",
6034
- body: formData,
6035
- credentials: "include"
6036
- }
6275
+ body: formData
6276
+ },
6277
+ [400, 413]
6037
6278
  );
6038
6279
  if (!response.ok) {
6039
- const error = await response.json();
6040
- if (error.detail && typeof error.detail === "object") {
6041
- const { message, errors } = error.detail;
6042
- if (errors && Array.isArray(errors)) {
6043
- const importError = new Error(message || "Import validation failed");
6044
- importError.validationErrors = errors;
6045
- throw importError;
6046
- }
6047
- }
6048
- throw new Error(error.detail || "Import failed");
6280
+ const error = await response.json().catch(() => ({}));
6281
+ throwMemberImportError(error, "Import preview failed");
6282
+ }
6283
+ return response.json();
6284
+ }
6285
+ /**
6286
+ * Import members from a CSV file, streaming progress updates via callback.
6287
+ *
6288
+ * ``identityConflictPolicy`` (default 'skip') controls how a row matching an
6289
+ * existing member ONLY by phone with different identity fields is handled.
6290
+ * Send 'overwrite_identity_fields' only after the operator confirms a preview.
6291
+ */
6292
+ async importMembers(wid, file, newMemberRoleId, onProgress, options) {
6293
+ const formData = new FormData();
6294
+ formData.append("file", file);
6295
+ const params = new URLSearchParams();
6296
+ params.append("new_member_role_id", newMemberRoleId.toString());
6297
+ if (options?.trustEmailAddresses) {
6298
+ params.append("trust_email_addresses", "true");
6299
+ }
6300
+ if (options?.trustPhoneNumbers) {
6301
+ params.append("trust_phone_numbers", "true");
6302
+ }
6303
+ if (options?.identityConflictPolicy) {
6304
+ params.append("identity_conflict_policy", options.identityConflictPolicy);
6305
+ }
6306
+ const response = await this.fetchRaw(
6307
+ `w/${wid}/members/import?${params.toString()}`,
6308
+ {
6309
+ method: "POST",
6310
+ body: formData
6311
+ },
6312
+ [400, 413]
6313
+ );
6314
+ if (!response.ok) {
6315
+ const error = await response.json().catch(() => ({}));
6316
+ throwMemberImportError(error, "Import failed");
6049
6317
  }
6050
6318
  if (onProgress && response.body) {
6051
6319
  const reader = response.body.getReader();
6052
6320
  const decoder = new TextDecoder();
6321
+ let buffer = "";
6053
6322
  while (true) {
6054
6323
  const { done, value } = await reader.read();
6055
6324
  if (done) break;
6056
- const chunk = decoder.decode(value);
6057
- const lines = chunk.split("\n").filter((line) => line.trim());
6325
+ buffer += decoder.decode(value, { stream: true });
6326
+ const lines = buffer.split("\n");
6327
+ buffer = lines.pop() ?? "";
6058
6328
  for (const line of lines) {
6329
+ const trimmed = line.trim();
6330
+ if (!trimmed) continue;
6059
6331
  try {
6060
- const progress = JSON.parse(line);
6061
- onProgress(progress);
6332
+ onProgress(JSON.parse(trimmed));
6062
6333
  } catch {
6063
6334
  }
6064
6335
  }
6065
6336
  }
6337
+ const tail = buffer.trim();
6338
+ if (tail) {
6339
+ try {
6340
+ onProgress(JSON.parse(tail));
6341
+ } catch {
6342
+ }
6343
+ }
6066
6344
  }
6067
6345
  return { success: true };
6068
6346
  }
@@ -6254,6 +6532,17 @@ var MembersApi = class extends BaseApiClient {
6254
6532
  { method: "DELETE" }
6255
6533
  );
6256
6534
  }
6535
+ /** Bulk-create members in a workspace. */
6536
+ async bulkCreateMembers(wid, request) {
6537
+ return this.fetch(`w/${wid}/members/bulk`, {
6538
+ method: "POST",
6539
+ body: JSON.stringify(request)
6540
+ });
6541
+ }
6542
+ /** Get all sync links for a member across app connections. */
6543
+ async getMemberSyncLinks(wid, memberId) {
6544
+ return this.fetch(`w/${wid}/members/${memberId}/sync-links`);
6545
+ }
6257
6546
  };
6258
6547
 
6259
6548
  // src/api/milestones.ts
@@ -6750,6 +7039,7 @@ var OrgApi = class extends BaseApiClient {
6750
7039
  */
6751
7040
  async searchPhoneNumbers(orgUuid, params) {
6752
7041
  const query = new URLSearchParams();
7042
+ if (params?.country) query.set("country", params.country);
6753
7043
  if (params?.numberType) query.set("number_type", params.numberType);
6754
7044
  if (params?.areaCode) query.set("area_code", params.areaCode);
6755
7045
  if (params?.contains) query.set("contains", params.contains);
@@ -6761,11 +7051,20 @@ var OrgApi = class extends BaseApiClient {
6761
7051
  }
6762
7052
  /**
6763
7053
  * Purchase a phone number from Twilio for this org inventory (org admin only).
7054
+ *
7055
+ * Numbers in regulated countries (e.g. Australia) require a Twilio regulatory
7056
+ * bundle and an address — pass `bundleSid` and `addressSid` for those.
6764
7057
  */
6765
- async purchasePhoneNumber(orgUuid, phoneNumber, numberType) {
7058
+ async purchasePhoneNumber(orgUuid, phoneNumber, numberType, opts) {
6766
7059
  return this.fetch(`o/${orgUuid}/phone-numbers/purchase`, {
6767
7060
  method: "POST",
6768
- body: JSON.stringify({ phoneNumber, numberType })
7061
+ body: JSON.stringify({
7062
+ phoneNumber,
7063
+ numberType,
7064
+ country: opts?.country,
7065
+ bundleSid: opts?.bundleSid,
7066
+ addressSid: opts?.addressSid
7067
+ })
6769
7068
  });
6770
7069
  }
6771
7070
  /**
@@ -6973,6 +7272,90 @@ var OrgApi = class extends BaseApiClient {
6973
7272
  method: "POST"
6974
7273
  });
6975
7274
  }
7275
+ /**
7276
+ * List the org's A2P brands (broker resources). The SMS-consent editor uses
7277
+ * this to pick which brand's consent config to edit.
7278
+ */
7279
+ async listA2PBrands(orgUuid) {
7280
+ return this.fetch(`o/${orgUuid}/a2p-brands`);
7281
+ }
7282
+ /**
7283
+ * Fetch a brand's resolved A2P campaign config. The response carries both the
7284
+ * raw `overrides` and the `resolved` payload (defaults + overrides) the editor
7285
+ * previews — including the canonical SMS consent text.
7286
+ */
7287
+ async getA2PCampaignConfig(orgUuid, brandUuid) {
7288
+ return this.fetch(
7289
+ `o/${orgUuid}/a2p-brands/${brandUuid}/campaign-config`
7290
+ );
7291
+ }
7292
+ /**
7293
+ * Partial-update a brand's A2P campaign config. Returns the freshly resolved
7294
+ * config so the editor's live preview updates without a second round-trip.
7295
+ */
7296
+ async updateA2PCampaignConfig(orgUuid, brandUuid, data) {
7297
+ return this.fetch(
7298
+ `o/${orgUuid}/a2p-brands/${brandUuid}/campaign-config`,
7299
+ {
7300
+ method: "PUT",
7301
+ body: JSON.stringify(data)
7302
+ }
7303
+ );
7304
+ }
7305
+ /**
7306
+ * Published Sites across the org's workspaces that can be linked as this
7307
+ * brand's enrollment (opt-in) surface. Org-authorized, so it works even when
7308
+ * the admin isn't a member of the workspace holding the Site.
7309
+ */
7310
+ async listA2PEnrollmentSiteCandidates(orgUuid, brandUuid) {
7311
+ return this.fetch(
7312
+ `o/${orgUuid}/a2p-brands/${brandUuid}/enrollment-site/candidates`
7313
+ );
7314
+ }
7315
+ /**
7316
+ * Link the brand to a published enrollment Site (sets `site_uuid`). Returns
7317
+ * the refreshed campaign config so the editor's link state updates inline.
7318
+ */
7319
+ async linkA2PEnrollmentSite(orgUuid, brandUuid, data) {
7320
+ return this.fetch(
7321
+ `o/${orgUuid}/a2p-brands/${brandUuid}/enrollment-site`,
7322
+ {
7323
+ method: "PUT",
7324
+ body: JSON.stringify(data)
7325
+ }
7326
+ );
7327
+ }
7328
+ /**
7329
+ * Provision (or reuse) a patient-enrollment Site for the brand and link it —
7330
+ * the one-click path behind the SMS Consent tab. `workspaceUuid` is required
7331
+ * only when the org has multiple workspaces. Returns the refreshed campaign
7332
+ * config so the editor's link state updates inline. Idempotent.
7333
+ */
7334
+ async provisionA2PEnrollmentSite(orgUuid, brandUuid, data = {}) {
7335
+ return this.fetch(
7336
+ `o/${orgUuid}/a2p-brands/${brandUuid}/enrollment-site/provision`,
7337
+ {
7338
+ method: "POST",
7339
+ body: JSON.stringify(data)
7340
+ }
7341
+ );
7342
+ }
7343
+ /** Clear the brand's enrollment-site link. */
7344
+ async unlinkA2PEnrollmentSite(orgUuid, brandUuid) {
7345
+ return this.fetch(
7346
+ `o/${orgUuid}/a2p-brands/${brandUuid}/enrollment-site`,
7347
+ { method: "DELETE" }
7348
+ );
7349
+ }
7350
+ /**
7351
+ * The brand-addressable enrollment form URL (carries `?brand=…`). Outreach
7352
+ * appends each patient's `external_id`. `url` is null until a Site is linked.
7353
+ */
7354
+ async getA2PBrandEnrollmentUrl(orgUuid, brandUuid) {
7355
+ return this.fetch(
7356
+ `o/${orgUuid}/a2p-brands/${brandUuid}/enrollment-url`
7357
+ );
7358
+ }
6976
7359
  /**
6977
7360
  * List available member roles for a workspace in the organization.
6978
7361
  */
@@ -6997,58 +7380,53 @@ var OrgApi = class extends BaseApiClient {
6997
7380
  function getOAuthPath(providerSlug, action) {
6998
7381
  if (providerSlug === "google_calendar") {
6999
7382
  return `oauth/google/calendar/${action}`;
7000
- } else if (providerSlug === "gmail") {
7383
+ }
7384
+ if (providerSlug === "gmail") {
7001
7385
  return `oauth/google/gmail/${action}`;
7002
- } else {
7003
- return `oauth/${providerSlug}/${action}`;
7004
7386
  }
7387
+ if (providerSlug === "gdrive") {
7388
+ return `oauth/google/drive/${action}`;
7389
+ }
7390
+ return `oauth/${providerSlug}/${action}`;
7391
+ }
7392
+ function buildAuthorizeQuery(options) {
7393
+ if (!options) return "";
7394
+ const params = new URLSearchParams();
7395
+ if (options.credentialUuid) params.set("credentialUuid", options.credentialUuid);
7396
+ if (options.loginHint) params.set("loginHint", options.loginHint);
7397
+ if (options.redirect) params.set("redirect", options.redirect);
7398
+ const qs = params.toString();
7399
+ return qs ? `?${qs}` : "";
7005
7400
  }
7006
7401
  var OAuthConnectionsApi = class extends BaseApiClient {
7007
- /**
7008
- * Get the connection status for an OAuth provider
7009
- */
7010
7402
  async getConnectionStatus(providerSlug) {
7011
7403
  const path = getOAuthPath(providerSlug, "status");
7012
7404
  return this.fetchRoot(path);
7013
7405
  }
7014
- /**
7015
- * Get the authorization URL to start OAuth flow
7016
- */
7017
- async getAuthorizationUrl(providerSlug) {
7018
- const path = getOAuthPath(providerSlug, "authorize");
7406
+ async listAccounts(providerSlug) {
7407
+ const path = getOAuthPath(providerSlug, "accounts");
7019
7408
  return this.fetchRoot(path);
7020
7409
  }
7021
- /**
7022
- * Disconnect an OAuth provider
7023
- */
7024
- async disconnect(providerSlug) {
7410
+ async getAuthorizationUrl(providerSlug, options) {
7411
+ const path = getOAuthPath(providerSlug, "authorize") + buildAuthorizeQuery(options);
7412
+ return this.fetchRoot(path);
7413
+ }
7414
+ async disconnect(providerSlug, credentialUuid) {
7025
7415
  const path = getOAuthPath(providerSlug, "disconnect");
7026
- return this.fetchRoot(path, { method: "DELETE" });
7416
+ const qs = credentialUuid ? `?credentialUuid=${encodeURIComponent(credentialUuid)}` : "";
7417
+ return this.fetchRoot(`${path}${qs}`, { method: "DELETE" });
7027
7418
  }
7028
7419
  };
7029
7420
  var OAuthApi = class extends BaseApiClient {
7030
- /**
7031
- * Get all available OAuth/API key scopes with metadata.
7032
- *
7033
- * This returns the full scope definitions from the backend,
7034
- * ensuring the UI always shows the correct scopes.
7035
- */
7036
7421
  async getAvailableScopes() {
7037
7422
  return this.fetch("oauth/scopes");
7038
7423
  }
7039
- /**
7040
- * Create an authorization code for OAuth flow
7041
- * This is called after the user approves the authorization request
7042
- */
7043
7424
  async authorize(request) {
7044
7425
  return this.fetch("oauth/authorize", {
7045
7426
  method: "POST",
7046
7427
  body: JSON.stringify(request)
7047
7428
  });
7048
7429
  }
7049
- /**
7050
- * Exchange authorization code for access token
7051
- */
7052
7430
  async exchangeOAuthToken(request) {
7053
7431
  const formData = new URLSearchParams();
7054
7432
  formData.append("grant_type", request.grant_type);
@@ -7342,6 +7720,37 @@ var PersonasApi = class extends BaseApiClient {
7342
7720
  }
7343
7721
  };
7344
7722
 
7723
+ // src/api/queries.ts
7724
+ var QueriesApi = class extends BaseApiClient {
7725
+ /** Queryable namespace: native fields, operators per type, DataType record fields. */
7726
+ async getQueryFields(wid) {
7727
+ return this.fetch(`w/${wid}/queries/fields`, {
7728
+ method: "GET"
7729
+ });
7730
+ }
7731
+ /** Structure / field / access / cost validation without execution. */
7732
+ async validateQuery(wid, query) {
7733
+ return this.fetch(`w/${wid}/queries/validate`, {
7734
+ method: "POST",
7735
+ body: JSON.stringify({ query })
7736
+ });
7737
+ }
7738
+ /** Bounded sample run (limit capped server-side). */
7739
+ async previewQuery(wid, query, mode) {
7740
+ return this.fetch(`w/${wid}/queries/preview`, {
7741
+ method: "POST",
7742
+ body: JSON.stringify({ query, mode })
7743
+ });
7744
+ }
7745
+ /** Execute a query (rows / count / aggregate). */
7746
+ async runQuery(wid, query, mode) {
7747
+ return this.fetch(`w/${wid}/queries/run`, {
7748
+ method: "POST",
7749
+ body: JSON.stringify({ query, mode })
7750
+ });
7751
+ }
7752
+ };
7753
+
7345
7754
  // src/api/qualifications.ts
7346
7755
  var QualificationsApi = class extends BaseApiClient {
7347
7756
  /** List qualifications in a workspace, paginated. */
@@ -7393,6 +7802,9 @@ var QualificationsApi = class extends BaseApiClient {
7393
7802
  async listTestChatRuns(wid, workflowId, params) {
7394
7803
  const query = new URLSearchParams();
7395
7804
  if (params?.scenarioId !== void 0) query.set("scenarioId", String(params.scenarioId));
7805
+ if (params?.assistantChatModelId !== void 0) {
7806
+ query.set("assistantChatModelId", params.assistantChatModelId);
7807
+ }
7396
7808
  if (params?.limit !== void 0) query.set("limit", String(params.limit));
7397
7809
  const qs = query.toString() ? `?${query.toString()}` : "";
7398
7810
  return this.fetch(
@@ -7827,6 +8239,112 @@ var SitesApi = class extends BaseApiClient {
7827
8239
  async getSite(wid, id) {
7828
8240
  return this.fetch(`w/${wid}/sites/${id}`);
7829
8241
  }
8242
+ /** Get a site's sharing settings. */
8243
+ async getSiteSharing(wid, siteId) {
8244
+ return this.fetch(`w/${wid}/sites/${siteId}/sharing`);
8245
+ }
8246
+ /** Update a site's sharing settings. */
8247
+ async updateSiteSharing(wid, siteId, data) {
8248
+ return this.fetch(`w/${wid}/sites/${siteId}/sharing`, {
8249
+ method: "PUT",
8250
+ body: JSON.stringify(data)
8251
+ });
8252
+ }
8253
+ /** Get a site's source tree. */
8254
+ async getSiteSource(wid, siteId) {
8255
+ return this.fetch(`w/${wid}/sites/${siteId}/source`);
8256
+ }
8257
+ /** Starter templates the caller may seed (superuser-only ones filtered server-side). */
8258
+ async getSiteSourceTemplates(wid, siteId) {
8259
+ return this.fetch(`w/${wid}/sites/${siteId}/source/templates`);
8260
+ }
8261
+ /** Create a site's source tree with starter files if it does not exist. */
8262
+ async createSiteSource(wid, siteId) {
8263
+ return this.fetch(`w/${wid}/sites/${siteId}/source`, {
8264
+ method: "POST"
8265
+ });
8266
+ }
8267
+ /** Build a site's source without publishing. */
8268
+ async buildSiteSource(wid, siteId) {
8269
+ return this.fetch(`w/${wid}/sites/${siteId}/source/build`, {
8270
+ method: "POST"
8271
+ });
8272
+ }
8273
+ /**
8274
+ * Build and publish a site's source. Optionally label the published version
8275
+ * with a `name` and `note`; both default to null (the UI then shows
8276
+ * "Version {version}").
8277
+ */
8278
+ async publishSiteSource(wid, siteId, options) {
8279
+ return this.fetch(`w/${wid}/sites/${siteId}/source/publish`, {
8280
+ method: "POST",
8281
+ body: JSON.stringify({
8282
+ name: options?.name ?? null,
8283
+ note: options?.note ?? null
8284
+ })
8285
+ });
8286
+ }
8287
+ /**
8288
+ * Reset a site's source files: load a starter template and/or wipe existing
8289
+ * files. `template` selects which starter to seed when `loadDefaults` is set
8290
+ * (defaults to "hello-world"; "patient-enrollment" is the other built-in).
8291
+ */
8292
+ async resetSiteSource(wid, siteId, options) {
8293
+ return this.fetch(`w/${wid}/sites/${siteId}/source/reset`, {
8294
+ method: "POST",
8295
+ body: JSON.stringify({
8296
+ load_defaults: options.loadDefaults,
8297
+ delete_existing: options.deleteExisting,
8298
+ ...options.template ? { template: options.template } : {}
8299
+ })
8300
+ });
8301
+ }
8302
+ /**
8303
+ * Re-point the published release to a prior version from the history. A pure
8304
+ * pointer move (no rebuild); the other versions stay in the history.
8305
+ */
8306
+ async rollbackSiteSource(wid, siteId, releaseUuid) {
8307
+ return this.fetch(`w/${wid}/sites/${siteId}/source/rollback`, {
8308
+ method: "POST",
8309
+ body: JSON.stringify({ release_uuid: releaseUuid })
8310
+ });
8311
+ }
8312
+ /**
8313
+ * Export the site's source tree as a ZIP archive (editor-gated server-side).
8314
+ * Returns the raw archive bytes for the caller to save.
8315
+ */
8316
+ async downloadSiteSourceZip(wid, siteId) {
8317
+ const response = await this.fetchRaw(`w/${wid}/sites/${siteId}/source/download`);
8318
+ return response.blob();
8319
+ }
8320
+ /**
8321
+ * Replace the site's source tree with the contents of an uploaded ZIP
8322
+ * (clears the existing source first, like a reset that loads a template).
8323
+ */
8324
+ async importSiteSourceZip(wid, siteId, file) {
8325
+ const form = new FormData();
8326
+ form.append("file", file, "source.zip");
8327
+ return this.fetch(`w/${wid}/sites/${siteId}/source/import`, {
8328
+ method: "POST",
8329
+ body: form
8330
+ });
8331
+ }
8332
+ /**
8333
+ * Get a theme's settings schema, the site's saved values, and capabilities.
8334
+ * Pass `theme` to resolve the schema for a theme other than the saved one
8335
+ * (e.g. one the builder has selected but not yet saved).
8336
+ */
8337
+ async getThemeSettings(wid, siteId, theme) {
8338
+ const query = theme ? `?theme=${encodeURIComponent(theme)}` : "";
8339
+ return this.fetch(`w/${wid}/sites/${siteId}/theme-settings${query}`);
8340
+ }
8341
+ /** Save values for the active theme's settings (validated against the schema). */
8342
+ async updateThemeSettings(wid, siteId, values) {
8343
+ return this.fetch(`w/${wid}/sites/${siteId}/theme-settings`, {
8344
+ method: "PUT",
8345
+ body: JSON.stringify({ values })
8346
+ });
8347
+ }
7830
8348
  /** Get a single site by UUID. */
7831
8349
  async getSiteByUuid(wid, uuid) {
7832
8350
  return this.fetch(`s/${wid}/${uuid}`);
@@ -8209,6 +8727,16 @@ var SupportRequestsApi = class extends BaseApiClient {
8209
8727
  body: JSON.stringify(data)
8210
8728
  });
8211
8729
  }
8730
+ /**
8731
+ * Reopen a resolved support request (e.g. staff resolved it prematurely).
8732
+ * The server rejects requests that are not in the `resolved` state.
8733
+ */
8734
+ async reopenWorkspaceSupportRequest(workspaceUuid, uuid, data = {}) {
8735
+ return this.fetch(`w/${workspaceUuid}/support-requests/${uuid}/reopen`, {
8736
+ method: "POST",
8737
+ body: JSON.stringify(data)
8738
+ });
8739
+ }
8212
8740
  /**
8213
8741
  * Record a click on a pushed resource (Proactive Support). For a
8214
8742
  * manager_prompt, pass the Manager Chat UUID it opened so the
@@ -9505,6 +10033,7 @@ function createApiModules(apiKey, baseUrl, customFetch) {
9505
10033
  events: new EventsApi(apiKey, baseUrl, customFetch),
9506
10034
  experiments: new ExperimentsApi(apiKey, baseUrl, customFetch),
9507
10035
  fhirConnections: new FhirConnectionsApi(apiKey, baseUrl, customFetch),
10036
+ patientSyncConnections: new PatientSyncConnectionsApi(apiKey, baseUrl, customFetch),
9508
10037
  healthie: new HealthieApi(apiKey, baseUrl, customFetch),
9509
10038
  hubspot: new HubspotApi(apiKey, baseUrl, customFetch),
9510
10039
  features: new FeaturesApi(apiKey, baseUrl, customFetch),
@@ -9528,6 +10057,7 @@ function createApiModules(apiKey, baseUrl, customFetch) {
9528
10057
  pronunciations: new PronunciationsApi(apiKey, baseUrl, customFetch),
9529
10058
  qualifications: new QualificationsApi(apiKey, baseUrl, customFetch),
9530
10059
  personas: new PersonasApi(apiKey, baseUrl, customFetch),
10060
+ queries: new QueriesApi(apiKey, baseUrl, customFetch),
9531
10061
  reports: new ReportsApi(apiKey, baseUrl, customFetch),
9532
10062
  salesforce: new SalesforceApi(apiKey, baseUrl, customFetch),
9533
10063
  sites: new SitesApi(apiKey, baseUrl, customFetch),
@@ -9572,6 +10102,7 @@ var WORKSPACE_METHOD_NAMES = [
9572
10102
  "cancelAgentTask",
9573
10103
  "cancelAssignment",
9574
10104
  "cancelCalendarEvent",
10105
+ "cancelChatCallback",
9575
10106
  "cancelCredentialUpdateInvite",
9576
10107
  "checkAvailability",
9577
10108
  "checkSiteDomainAvailability",
@@ -9586,6 +10117,7 @@ var WORKSPACE_METHOD_NAMES = [
9586
10117
  "commentOnWorkspaceSupportRequest",
9587
10118
  "configureConfluence",
9588
10119
  "configureHealthie",
10120
+ "configurePatientSync",
9589
10121
  "configureHubspot",
9590
10122
  "configureMondayConnection",
9591
10123
  "configureSalesforce",
@@ -9616,6 +10148,7 @@ var WORKSPACE_METHOD_NAMES = [
9616
10148
  "createExperiment",
9617
10149
  "createExperimentAssignment",
9618
10150
  "createExperimentGroup",
10151
+ "convertMemberFilterToQuery",
9619
10152
  "createFhirConnection",
9620
10153
  "createFile",
9621
10154
  "createFileLabel",
@@ -9680,6 +10213,7 @@ var WORKSPACE_METHOD_NAMES = [
9680
10213
  "deleteExperimentAssignment",
9681
10214
  "deleteExperimentGroup",
9682
10215
  "deleteFhirConnection",
10216
+ "deletePatientSyncConnection",
9683
10217
  "deleteFile",
9684
10218
  "deleteFileLabel",
9685
10219
  "deleteFolder",
@@ -9815,6 +10349,7 @@ var WORKSPACE_METHOD_NAMES = [
9815
10349
  "getCelContext",
9816
10350
  "getChat",
9817
10351
  "getChatAssignmentTasks",
10352
+ "getChatCallbacks",
9818
10353
  "getChatEmails",
9819
10354
  "getChatFilter",
9820
10355
  "getChatFilterByUuid",
@@ -9881,6 +10416,7 @@ var WORKSPACE_METHOD_NAMES = [
9881
10416
  "getHealthieAvailableSlots",
9882
10417
  "getHealthieReconciliationMatches",
9883
10418
  "getHealthieStatus",
10419
+ "getPatientSyncStatus",
9884
10420
  "getHubspotContactProperties",
9885
10421
  "getHubspotManagedRules",
9886
10422
  "getHubspotReconciliationMatches",
@@ -9926,6 +10462,7 @@ var WORKSPACE_METHOD_NAMES = [
9926
10462
  "getMemberRole",
9927
10463
  "getMemberRoleByUuid",
9928
10464
  "getMemberRoles",
10465
+ "getMemberSyncLinks",
9929
10466
  "getMemberSyncSummary",
9930
10467
  "getMemberUsage",
9931
10468
  "getMembersMessageActivity",
@@ -10090,6 +10627,7 @@ var WORKSPACE_METHOD_NAMES = [
10090
10627
  "markEmailAsRead",
10091
10628
  "markEmailAsUnread",
10092
10629
  "markNotificationAsRead",
10630
+ "previewImportMembers",
10093
10631
  "previewImportWorkspace",
10094
10632
  "previewSchedule",
10095
10633
  "previewTTS",
@@ -10316,6 +10854,8 @@ function bindTasksMethods(target, tasks, abilities) {
10316
10854
  function bindChatsMethods(target, chats) {
10317
10855
  target.getChats = chats.getChats.bind(chats);
10318
10856
  target.getChat = chats.getChat.bind(chats);
10857
+ target.getChatCallbacks = chats.getChatCallbacks.bind(chats);
10858
+ target.cancelChatCallback = chats.cancelChatCallback.bind(chats);
10319
10859
  target.getChatTokenUsage = chats.getChatTokenUsage.bind(chats);
10320
10860
  target.getChatTodos = chats.getChatTodos.bind(chats);
10321
10861
  target.getChatSkills = chats.getChatSkills.bind(chats);
@@ -10365,6 +10905,8 @@ function bindCallsMethods(target, calls, cel) {
10365
10905
  target.initiateCall = calls.initiateCall.bind(calls);
10366
10906
  target.getVoiceToken = calls.getVoiceToken.bind(calls);
10367
10907
  target.getMessageTiming = calls.getMessageTiming.bind(calls);
10908
+ target.listChatRecordings = calls.listChatRecordings.bind(calls);
10909
+ target.getCallRecordingDownloadUrl = calls.getCallRecordingDownloadUrl.bind(calls);
10368
10910
  target.getCelContext = cel.getCelContext.bind(cel);
10369
10911
  }
10370
10912
 
@@ -10407,6 +10949,9 @@ function bindMembersMethods(target, members) {
10407
10949
  target.deleteMember = members.deleteMember.bind(members);
10408
10950
  target.archiveMember = members.archiveMember.bind(members);
10409
10951
  target.unarchiveMember = members.unarchiveMember.bind(members);
10952
+ target.sendMemberPhoneConfirmation = members.sendMemberPhoneConfirmation.bind(members);
10953
+ target.bulkCreateMembers = members.bulkCreateMembers.bind(members);
10954
+ target.previewImportMembers = members.previewImportMembers.bind(members);
10410
10955
  target.importMembers = members.importMembers.bind(members);
10411
10956
  target.exportMembers = members.exportMembers.bind(members);
10412
10957
  target.getMembersMessageActivity = members.getMembersMessageActivity.bind(members);
@@ -10414,6 +10959,7 @@ function bindMembersMethods(target, members) {
10414
10959
  target.getMemberFilter = members.getMemberFilter.bind(members);
10415
10960
  target.createMemberFilter = members.createMemberFilter.bind(members);
10416
10961
  target.updateMemberFilter = members.updateMemberFilter.bind(members);
10962
+ target.convertMemberFilterToQuery = members.convertMemberFilterToQuery.bind(members);
10417
10963
  target.deleteMemberFilter = members.deleteMemberFilter.bind(members);
10418
10964
  target.getMemberFilterCount = members.getMemberFilterCount.bind(members);
10419
10965
  target.getMemberLabels = members.getMemberLabels.bind(members);
@@ -10443,6 +10989,7 @@ function bindMembersMethods(target, members) {
10443
10989
  target.getMemberMemories = members.getMemberMemories.bind(members);
10444
10990
  target.createMemberMemory = members.createMemberMemory.bind(members);
10445
10991
  target.deleteMemberMemory = members.deleteMemberMemory.bind(members);
10992
+ target.getMemberSyncLinks = members.getMemberSyncLinks.bind(members);
10446
10993
  }
10447
10994
 
10448
10995
  // src/client/bindings/workspaces.ts
@@ -10576,6 +11123,19 @@ function bindSitesMethods(target, sites) {
10576
11123
  target.checkSiteSlugAvailability = sites.checkSiteSlugAvailability.bind(sites);
10577
11124
  target.checkSiteDomainAvailability = sites.checkSiteDomainAvailability.bind(sites);
10578
11125
  target.getSite = sites.getSite.bind(sites);
11126
+ target.getSiteSharing = sites.getSiteSharing.bind(sites);
11127
+ target.updateSiteSharing = sites.updateSiteSharing.bind(sites);
11128
+ target.getSiteSource = sites.getSiteSource.bind(sites);
11129
+ target.getSiteSourceTemplates = sites.getSiteSourceTemplates.bind(sites);
11130
+ target.createSiteSource = sites.createSiteSource.bind(sites);
11131
+ target.buildSiteSource = sites.buildSiteSource.bind(sites);
11132
+ target.publishSiteSource = sites.publishSiteSource.bind(sites);
11133
+ target.resetSiteSource = sites.resetSiteSource.bind(sites);
11134
+ target.rollbackSiteSource = sites.rollbackSiteSource.bind(sites);
11135
+ target.downloadSiteSourceZip = sites.downloadSiteSourceZip.bind(sites);
11136
+ target.importSiteSourceZip = sites.importSiteSourceZip.bind(sites);
11137
+ target.getThemeSettings = sites.getThemeSettings.bind(sites);
11138
+ target.updateThemeSettings = sites.updateThemeSettings.bind(sites);
10579
11139
  target.getSiteByUuid = sites.getSiteByUuid.bind(sites);
10580
11140
  target.getSiteRenderedPage = sites.getSiteRenderedPage.bind(sites);
10581
11141
  target.getSiteRenderedMenu = sites.getSiteRenderedMenu.bind(sites);
@@ -10608,6 +11168,7 @@ function bindSitesMethods(target, sites) {
10608
11168
  function bindFilesMethods(target, files) {
10609
11169
  target.getFiles = files.getFiles.bind(files);
10610
11170
  target.getFile = files.getFile.bind(files);
11171
+ target.downloadFilesZip = files.downloadFilesZip.bind(files);
10611
11172
  target.createFile = files.createFile.bind(files);
10612
11173
  target.uploadFile = files.uploadFile.bind(files);
10613
11174
  target.updateFile = files.updateFile.bind(files);
@@ -10649,6 +11210,7 @@ function bindEventsMethods(target, events) {
10649
11210
  target.createEventRule = events.createEventRule.bind(events);
10650
11211
  target.updateEventRule = events.updateEventRule.bind(events);
10651
11212
  target.deleteEventRule = events.deleteEventRule.bind(events);
11213
+ target.testWebhook = events.testWebhook.bind(events);
10652
11214
  target.reorderEventRules = events.reorderEventRules.bind(events);
10653
11215
  target.getWebhookLogs = events.getWebhookLogs.bind(events);
10654
11216
  target.getRuleExecutions = events.getRuleExecutions.bind(events);
@@ -10899,12 +11461,13 @@ function bindAppsMethods(target, apps, builders, inquiries, oauth, oauthConnecti
10899
11461
  target.exchangeOAuthToken = oauth.exchangeOAuthToken.bind(oauth);
10900
11462
  target.getAvailableScopes = oauth.getAvailableScopes.bind(oauth);
10901
11463
  target.getOAuthConnectionStatus = oauthConnections.getConnectionStatus.bind(oauthConnections);
11464
+ target.listOAuthAccounts = oauthConnections.listAccounts.bind(oauthConnections);
10902
11465
  target.getOAuthAuthorizationUrl = oauthConnections.getAuthorizationUrl.bind(oauthConnections);
10903
11466
  target.disconnectOAuthProvider = oauthConnections.disconnect.bind(oauthConnections);
10904
11467
  }
10905
11468
 
10906
11469
  // src/client/bindings/integrations.ts
10907
- function bindIntegrationsMethods(target, mondayIntegration, discordBots, slackApps, teamsApps, fhirConnections, healthie, salesforce, hubspot, appConnections, connectionSync, confluence) {
11470
+ function bindIntegrationsMethods(target, mondayIntegration, discordBots, slackApps, teamsApps, fhirConnections, patientSyncConnections, healthie, salesforce, hubspot, appConnections, connectionSync, confluence) {
10908
11471
  target.getMondayBoards = mondayIntegration.getBoards.bind(mondayIntegration);
10909
11472
  target.getMondayBoardColumns = mondayIntegration.getBoardColumns.bind(mondayIntegration);
10910
11473
  target.getMondayBoardGroups = mondayIntegration.getBoardGroups.bind(mondayIntegration);
@@ -10989,6 +11552,9 @@ function bindIntegrationsMethods(target, mondayIntegration, discordBots, slackAp
10989
11552
  target.fhirGetEncounterSyncRuns = fhirConnections.fhirGetEncounterSyncRuns.bind(fhirConnections);
10990
11553
  target.fhirRefreshEncounterPatient = fhirConnections.fhirRefreshEncounterPatient.bind(fhirConnections);
10991
11554
  target.fhirBackfillEncounterSync = fhirConnections.fhirBackfillEncounterSync.bind(fhirConnections);
11555
+ target.configurePatientSync = patientSyncConnections.configurePatientSync.bind(patientSyncConnections);
11556
+ target.getPatientSyncStatus = patientSyncConnections.getPatientSyncStatus.bind(patientSyncConnections);
11557
+ target.deletePatientSyncConnection = patientSyncConnections.deletePatientSyncConnection.bind(patientSyncConnections);
10992
11558
  target.configureHealthie = healthie.configureHealthie.bind(healthie);
10993
11559
  target.getHealthieStatus = healthie.getHealthieStatus.bind(healthie);
10994
11560
  target.listHealthieProviders = healthie.listHealthieProviders.bind(healthie);
@@ -11182,6 +11748,14 @@ function bindPersonasMethods(target, personas) {
11182
11748
  target.deletePersona = personas.deletePersona.bind(personas);
11183
11749
  }
11184
11750
 
11751
+ // src/client/bindings/queries.ts
11752
+ function bindQueriesMethods(target, queries) {
11753
+ target.getQueryFields = queries.getQueryFields.bind(queries);
11754
+ target.validateQuery = queries.validateQuery.bind(queries);
11755
+ target.previewQuery = queries.previewQuery.bind(queries);
11756
+ target.runQuery = queries.runQuery.bind(queries);
11757
+ }
11758
+
11185
11759
  // src/client/bindings/customers.ts
11186
11760
  function bindCustomersMethods(target, customers) {
11187
11761
  target.getMyCustomers = customers.getMyCustomers.bind(customers);
@@ -11228,6 +11802,7 @@ function bindSupportRequestMethods(target, supportRequests) {
11228
11802
  target.createWorkspaceSupportRequest = supportRequests.createWorkspaceSupportRequest.bind(supportRequests);
11229
11803
  target.commentOnWorkspaceSupportRequest = supportRequests.commentOnWorkspaceSupportRequest.bind(supportRequests);
11230
11804
  target.closeWorkspaceSupportRequest = supportRequests.closeWorkspaceSupportRequest.bind(supportRequests);
11805
+ target.reopenWorkspaceSupportRequest = supportRequests.reopenWorkspaceSupportRequest.bind(supportRequests);
11231
11806
  target.clickWorkspaceSupportRequestResource = supportRequests.clickWorkspaceSupportRequestResource.bind(supportRequests);
11232
11807
  }
11233
11808
 
@@ -11255,6 +11830,8 @@ var GravityRailClient = class {
11255
11830
  // Chats API
11256
11831
  getChats;
11257
11832
  getChat;
11833
+ getChatCallbacks;
11834
+ cancelChatCallback;
11258
11835
  getChatTokenUsage;
11259
11836
  getChatTodos;
11260
11837
  getChatSkills;
@@ -11301,6 +11878,8 @@ var GravityRailClient = class {
11301
11878
  initiateCall;
11302
11879
  getVoiceToken;
11303
11880
  getMessageTiming;
11881
+ listChatRecordings;
11882
+ getCallRecordingDownloadUrl;
11304
11883
  getCelContext;
11305
11884
  // Data Types API
11306
11885
  getDataTypes;
@@ -11337,6 +11916,9 @@ var GravityRailClient = class {
11337
11916
  deleteMember;
11338
11917
  archiveMember;
11339
11918
  unarchiveMember;
11919
+ sendMemberPhoneConfirmation;
11920
+ bulkCreateMembers;
11921
+ previewImportMembers;
11340
11922
  importMembers;
11341
11923
  exportMembers;
11342
11924
  getMembersMessageActivity;
@@ -11344,6 +11926,7 @@ var GravityRailClient = class {
11344
11926
  getMemberFilter;
11345
11927
  createMemberFilter;
11346
11928
  updateMemberFilter;
11929
+ convertMemberFilterToQuery;
11347
11930
  deleteMemberFilter;
11348
11931
  getMemberFilterCount;
11349
11932
  getMemberLabels;
@@ -11377,6 +11960,8 @@ var GravityRailClient = class {
11377
11960
  getMemberMemories;
11378
11961
  createMemberMemory;
11379
11962
  deleteMemberMemory;
11963
+ // Member Sync Links
11964
+ getMemberSyncLinks;
11380
11965
  // Agent Tasks API (operator-facing async sub-agent inspection/cancel)
11381
11966
  getAgentTasks;
11382
11967
  getAgentTask;
@@ -11407,6 +11992,11 @@ var GravityRailClient = class {
11407
11992
  evaluateTestChatRun;
11408
11993
  endTestChatRun;
11409
11994
  // Personas API (workspace-scoped test-identity templates)
11995
+ // Unified Query Engine
11996
+ getQueryFields;
11997
+ validateQuery;
11998
+ previewQuery;
11999
+ runQuery;
11410
12000
  listPersonas;
11411
12001
  getPersona;
11412
12002
  createPersona;
@@ -11625,6 +12215,19 @@ var GravityRailClient = class {
11625
12215
  checkSiteSlugAvailability;
11626
12216
  checkSiteDomainAvailability;
11627
12217
  getSite;
12218
+ getSiteSharing;
12219
+ updateSiteSharing;
12220
+ getSiteSource;
12221
+ getSiteSourceTemplates;
12222
+ createSiteSource;
12223
+ buildSiteSource;
12224
+ publishSiteSource;
12225
+ resetSiteSource;
12226
+ rollbackSiteSource;
12227
+ downloadSiteSourceZip;
12228
+ importSiteSourceZip;
12229
+ getThemeSettings;
12230
+ updateThemeSettings;
11628
12231
  getSiteByUuid;
11629
12232
  getSiteRenderedPage;
11630
12233
  getSiteRenderedMenu;
@@ -11654,6 +12257,7 @@ var GravityRailClient = class {
11654
12257
  // Files API
11655
12258
  getFiles;
11656
12259
  getFile;
12260
+ downloadFilesZip;
11657
12261
  createFile;
11658
12262
  uploadFile;
11659
12263
  updateFile;
@@ -11693,6 +12297,7 @@ var GravityRailClient = class {
11693
12297
  createEventRule;
11694
12298
  updateEventRule;
11695
12299
  deleteEventRule;
12300
+ testWebhook;
11696
12301
  reorderEventRules;
11697
12302
  getWebhookLogs;
11698
12303
  getRuleExecutions;
@@ -11908,6 +12513,7 @@ var GravityRailClient = class {
11908
12513
  exchangeOAuthToken;
11909
12514
  getAvailableScopes;
11910
12515
  getOAuthConnectionStatus;
12516
+ listOAuthAccounts;
11911
12517
  getOAuthAuthorizationUrl;
11912
12518
  disconnectOAuthProvider;
11913
12519
  // Integrations API
@@ -12001,6 +12607,9 @@ var GravityRailClient = class {
12001
12607
  fhirRefreshEncounterPatient;
12002
12608
  fhirBackfillEncounterSync;
12003
12609
  // Healthie API
12610
+ configurePatientSync;
12611
+ getPatientSyncStatus;
12612
+ deletePatientSyncConnection;
12004
12613
  configureHealthie;
12005
12614
  getHealthieStatus;
12006
12615
  listHealthieProviders;
@@ -12129,6 +12738,7 @@ var GravityRailClient = class {
12129
12738
  createWorkspaceSupportRequest;
12130
12739
  commentOnWorkspaceSupportRequest;
12131
12740
  closeWorkspaceSupportRequest;
12741
+ reopenWorkspaceSupportRequest;
12132
12742
  clickWorkspaceSupportRequestResource;
12133
12743
  constructor(apiKey, baseUrl, customFetch) {
12134
12744
  const apis = createApiModules(apiKey, baseUrl, customFetch);
@@ -12143,6 +12753,7 @@ var GravityRailClient = class {
12143
12753
  bindAgentsMethods(this, apis.agents);
12144
12754
  bindQualificationsMethods(this, apis.qualifications);
12145
12755
  bindPersonasMethods(this, apis.personas);
12756
+ bindQueriesMethods(this, apis.queries);
12146
12757
  bindJourneysMethods(this, apis.journeys);
12147
12758
  bindExperimentsMethods(this, apis.experiments);
12148
12759
  bindOperatorMethods(this, apis.operatorGroups);
@@ -12182,6 +12793,7 @@ var GravityRailClient = class {
12182
12793
  apis.slackApps,
12183
12794
  apis.teamsApps,
12184
12795
  apis.fhirConnections,
12796
+ apis.patientSyncConnections,
12185
12797
  apis.healthie,
12186
12798
  apis.salesforce,
12187
12799
  apis.hubspot,
@@ -12235,23 +12847,30 @@ var GravityRailClient = class {
12235
12847
  });
12236
12848
  }
12237
12849
  /**
12238
- * Set the org token for cross-domain / non-browser clients (e.g. CLI).
12239
- * When set, all API requests include the X-Org-Token header so the backend
12240
- * accepts the request without requiring a browser cookie.
12850
+ * Set the org session credential for cross-domain / non-browser clients (e.g. CLI).
12851
+ * Opaque gr_sess_ values use X-Org-Session. Legacy orgToken JWE values still
12852
+ * use X-Org-Token during the migration window.
12241
12853
  *
12242
- * `orgUuid` is the org that issued the token. Pass it so the SDK can
12243
- * detect a stale token (e.g. switching orgs mid-session) and re-fire the
12854
+ * `orgUuid` is the org that issued the session. Pass it so the SDK can
12855
+ * detect a stale session (e.g. switching orgs mid-session) and re-fire the
12244
12856
  * org-auth handler instead of silently 401-ing.
12245
12857
  *
12246
12858
  * Propagates to all API modules.
12247
12859
  */
12248
- setOrgToken(token, orgUuid) {
12860
+ setOrgSession(session, orgUuid) {
12249
12861
  Object.values(this.apis).forEach((api) => {
12250
- if (typeof api.setOrgToken === "function") {
12251
- api.setOrgToken(token, orgUuid);
12862
+ if (typeof api.setOrgSession === "function") {
12863
+ api.setOrgSession(session, orgUuid);
12252
12864
  }
12253
12865
  });
12254
12866
  }
12867
+ /**
12868
+ * @deprecated Legacy compatibility for stateless orgToken JWE credentials.
12869
+ * Prefer setOrgSession() for opaque org browser sessions.
12870
+ */
12871
+ setOrgToken(token, orgUuid) {
12872
+ this.setOrgSession(token, orgUuid);
12873
+ }
12255
12874
  /**
12256
12875
  * Update the API key across all modules.
12257
12876
  * Used after successful re-authentication.
@@ -12333,6 +12952,12 @@ var GravityRailClient = class {
12333
12952
  ConsentMethod,
12334
12953
  CriterionType,
12335
12954
  CustomToolkitsApi,
12955
+ CustomerActivityClassifierDetectorName,
12956
+ CustomerActivityClassifierLabel,
12957
+ CustomerActivityEventSource,
12958
+ CustomerActivityEventStatus,
12959
+ CustomerActivityReviewOutcome,
12960
+ CustomerActivitySeverity,
12336
12961
  CustomersApi,
12337
12962
  DEFAULT_CHAT_MODEL,
12338
12963
  DEFAULT_CUSTOM_VOICE_MODEL,
@@ -12340,6 +12965,7 @@ var GravityRailClient = class {
12340
12965
  DEFAULT_VOICE_INFERENCE_MODEL,
12341
12966
  DataCategory,
12342
12967
  DataFieldType,
12968
+ DataRecordRetirementResponseReason,
12343
12969
  DataSensitivity,
12344
12970
  DataTypeRecordScope,
12345
12971
  DataTypesApi,
@@ -12372,6 +12998,8 @@ var GravityRailClient = class {
12372
12998
  McpServerState,
12373
12999
  McpServersApi,
12374
13000
  MemberFeature,
13001
+ MemberImportMatchInfoMatchType,
13002
+ MemberImportPreviewRowAction,
12375
13003
  MemberType,
12376
13004
  MembersApi,
12377
13005
  MenuItemResponseItemType,
@@ -12399,11 +13027,14 @@ var GravityRailClient = class {
12399
13027
  PERMISSION_NONE,
12400
13028
  PERMISSION_USE,
12401
13029
  PERMISSION_VERIFY,
13030
+ PIDS_DISPOSITIONS,
13031
+ PIDS_SOURCES,
12402
13032
  PersonasApi,
12403
13033
  PhoneNumbersApi,
12404
13034
  ProductType,
12405
13035
  PromptsApi,
12406
13036
  PronunciationsApi,
13037
+ QUERY_VALUELESS_OPS,
12407
13038
  QualificationsApi,
12408
13039
  REALTIME_MODEL_CUSTOM,
12409
13040
  REALTIME_MODEL_GEMINI,
@@ -12441,7 +13072,6 @@ var GravityRailClient = class {
12441
13072
  TTS_MODEL_ELEVENLABS_FLASH,
12442
13073
  TTS_MODEL_ELEVENLABS_MULTILINGUAL,
12443
13074
  TTS_MODEL_ELEVENLABS_TURBO,
12444
- TTS_MODEL_POCKET,
12445
13075
  TTS_PREVIEW_PROVIDERS,
12446
13076
  TasksApi,
12447
13077
  TemplatesApi,
@@ -12481,6 +13111,7 @@ var GravityRailClient = class {
12481
13111
  bindPromptsMethods,
12482
13112
  bindPronunciationsMethods,
12483
13113
  bindQualificationsMethods,
13114
+ bindQueriesMethods,
12484
13115
  bindResellersMethods,
12485
13116
  bindSitesMethods,
12486
13117
  bindSupportRequestMethods,