@gravity-rail/sdk 0.7.4 → 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-ANY7WLOD.js → chunk-2BJG4GYM.js} +778 -545
  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-B_cweJhP.d.cts → client-BffM3KcA.d.cts} +1367 -344
  9. package/dist/{client-C-on7whi.d.ts → client-DfjAYbt8.d.ts} +1367 -344
  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 +992 -174
  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-BX3PuU-7.d.cts → inquiries-UcWNYo-Q.d.cts} +567 -79
  23. package/dist/{inquiries-BX3PuU-7.d.ts → inquiries-UcWNYo-Q.d.ts} +567 -79
  24. package/dist/internal.cjs +925 -161
  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 +40 -7
  35. package/dist/schemas.cjs.map +1 -1
  36. package/dist/schemas.d.cts +134 -51
  37. package/dist/schemas.d.ts +134 -51
  38. package/dist/schemas.js +40 -8
  39. package/dist/schemas.js.map +1 -1
  40. package/dist/{scopes-ColqadkM.d.ts → scopes-CjSvITpL.d.cts} +53 -8
  41. package/dist/{scopes-CNbQi30F.d.cts → scopes-CmNKWrzb.d.ts} +53 -8
  42. package/package.json +6 -6
  43. package/dist/chunk-ANY7WLOD.js.map +0 -1
package/dist/index.cjs CHANGED
@@ -54,6 +54,7 @@ __export(src_exports, {
54
54
  DEFAULT_VOICE_INFERENCE_MODEL: () => DEFAULT_VOICE_INFERENCE_MODEL,
55
55
  DataCategory: () => DataCategory,
56
56
  DataFieldType: () => DataFieldType,
57
+ DataRecordRetirementResponseReason: () => DataRecordRetirementResponseReason,
57
58
  DataSensitivity: () => DataSensitivity,
58
59
  DataTypeRecordScope: () => DataTypeRecordScope,
59
60
  DriverMode: () => DriverMode,
@@ -77,6 +78,9 @@ __export(src_exports, {
77
78
  McpServerState: () => McpServerState,
78
79
  MemberFeature: () => MemberFeature,
79
80
  MemberFilterBuilder: () => MemberFilterBuilder,
81
+ MemberImportMatchInfoMatchType: () => MemberImportMatchInfoMatchType,
82
+ MemberImportPreviewRowAction: () => MemberImportPreviewRowAction,
83
+ MemberImportValidationError: () => MemberImportValidationError,
80
84
  MemberLabelBuilder: () => MemberLabelBuilder,
81
85
  MemberType: () => MemberType,
82
86
  MenuItemResponseItemType: () => MenuItemResponseItemType,
@@ -99,7 +103,11 @@ __export(src_exports, {
99
103
  PERMISSION_NONE: () => PERMISSION_NONE,
100
104
  PERMISSION_USE: () => PERMISSION_USE,
101
105
  PERMISSION_VERIFY: () => PERMISSION_VERIFY,
106
+ PIDS_DISPOSITIONS: () => PIDS_DISPOSITIONS,
107
+ PIDS_SOURCES: () => PIDS_SOURCES,
102
108
  ProductType: () => ProductType,
109
+ QUERY_VALUELESS_OPS: () => QUERY_VALUELESS_OPS,
110
+ QueriesApi: () => QueriesApi,
103
111
  REALTIME_MODEL_CUSTOM: () => REALTIME_MODEL_CUSTOM,
104
112
  REALTIME_MODEL_GEMINI: () => REALTIME_MODEL_GEMINI,
105
113
  REALTIME_MODEL_GEMINI_VERTEX: () => REALTIME_MODEL_GEMINI_VERTEX,
@@ -129,7 +137,6 @@ __export(src_exports, {
129
137
  TTS_MODEL_ELEVENLABS_FLASH: () => TTS_MODEL_ELEVENLABS_FLASH,
130
138
  TTS_MODEL_ELEVENLABS_MULTILINGUAL: () => TTS_MODEL_ELEVENLABS_MULTILINGUAL,
131
139
  TTS_MODEL_ELEVENLABS_TURBO: () => TTS_MODEL_ELEVENLABS_TURBO,
132
- TTS_MODEL_POCKET: () => TTS_MODEL_POCKET,
133
140
  TTS_PREVIEW_PROVIDERS: () => TTS_PREVIEW_PROVIDERS,
134
141
  TaskBuilder: () => TaskBuilder,
135
142
  TemplatesApi: () => TemplatesApi,
@@ -231,6 +238,22 @@ function parseOrgAuthChallenge(wwwAuthenticate) {
231
238
  authUrl: authUrlMatch[1]
232
239
  };
233
240
  }
241
+ function getRequestOrgCookieName(cookieName) {
242
+ if (cookieName.startsWith("orgToken")) {
243
+ return cookieName.replace(/^orgToken/, "requestOrgToken");
244
+ }
245
+ if (cookieName.startsWith("orgSession")) {
246
+ return cookieName.replace(/^orgSession/, "requestOrgSession");
247
+ }
248
+ return null;
249
+ }
250
+ function orgAuthHeaderName(token) {
251
+ return token.startsWith("gr_sess_") ? "X-Org-Session" : "X-Org-Token";
252
+ }
253
+ function setOrgAuthHeader(headers, token) {
254
+ if (!token) return;
255
+ headers.set(orgAuthHeaderName(token), token);
256
+ }
234
257
  var BaseApiClient = class {
235
258
  baseUrl;
236
259
  apiKey;
@@ -241,15 +264,15 @@ var BaseApiClient = class {
241
264
  orgAuthHandler;
242
265
  orgAuthInProgress = null;
243
266
  actingMemberUuid;
244
- orgToken;
267
+ orgSession;
245
268
  /**
246
- * The org_uuid that issued the current orgToken. Tracked so we can detect
269
+ * The org_uuid that issued the current org auth credential. Tracked so we can detect
247
270
  * a 401 challenge from a *different* org and re-fire the handler — the
248
- * orgToken is an opaque JWE we cannot decrypt client-side, so without this
249
- * the original guard `!this.orgToken` would prevent re-auth across orgs and
250
- * surface as a silent 401 in multi-org CLI workflows.
271
+ * credential is opaque to the client, so without this the original guard
272
+ * `!this.orgSession` would prevent re-auth across orgs and surface as a silent
273
+ * 401 in multi-org CLI workflows.
251
274
  */
252
- orgTokenOrgUuid;
275
+ orgSessionOrgUuid;
253
276
  constructor(apiKey, baseUrl, customFetch) {
254
277
  this.baseUrl = baseUrl;
255
278
  this.apiKey = apiKey;
@@ -296,18 +319,25 @@ var BaseApiClient = class {
296
319
  return this.actingMemberUuid;
297
320
  }
298
321
  /**
299
- * Set the org token for cross-domain requests.
300
- * When set, all API requests will include the X-Org-Token header,
301
- * allowing org-level SSO verification without cookies.
322
+ * Set the opaque org session credential for cross-domain requests.
323
+ * Opaque gr_sess_ values use X-Org-Session. Legacy orgToken JWE values still
324
+ * use X-Org-Token through setOrgToken() during the migration window.
302
325
  *
303
- * `orgUuid` is the org that issued the token; passing it lets the 401
304
- * handler detect a stale token when a subsequent request targets a
326
+ * `orgUuid` is the org that issued the credential; passing it lets the 401
327
+ * handler detect a stale session when a subsequent request targets a
305
328
  * different org and re-fire the org-auth handler instead of silently
306
329
  * 401-ing. Callers without that context (legacy / unknown) may omit it.
307
330
  */
331
+ setOrgSession(session, orgUuid) {
332
+ this.orgSession = session;
333
+ this.orgSessionOrgUuid = session ? orgUuid : void 0;
334
+ }
335
+ /**
336
+ * @deprecated Legacy compatibility for stateless orgToken JWE credentials.
337
+ * Prefer setOrgSession() for opaque org browser sessions.
338
+ */
308
339
  setOrgToken(token, orgUuid) {
309
- this.orgToken = token;
310
- this.orgTokenOrgUuid = token ? orgUuid : void 0;
340
+ this.setOrgSession(token, orgUuid);
311
341
  }
312
342
  async fetch(endpoint, options) {
313
343
  try {
@@ -328,9 +358,7 @@ var BaseApiClient = class {
328
358
  if (this.actingMemberUuid) {
329
359
  headers.set("X-Acting-Member", this.actingMemberUuid);
330
360
  }
331
- if (this.orgToken) {
332
- headers.set("X-Org-Token", this.orgToken);
333
- }
361
+ setOrgAuthHeader(headers, this.orgSession);
334
362
  const fullUrl = `${this.baseUrl}/api/v2/${endpoint}`;
335
363
  const response = await this.fetchFunction(fullUrl, {
336
364
  ...options,
@@ -354,31 +382,28 @@ var BaseApiClient = class {
354
382
  try {
355
383
  return await this.fetch(endpoint, options);
356
384
  } catch (retryError) {
357
- this.orgToken = void 0;
358
- this.orgTokenOrgUuid = void 0;
385
+ this.orgSession = void 0;
386
+ this.orgSessionOrgUuid = void 0;
359
387
  throw retryError;
360
388
  }
361
389
  }
362
390
  if (response.status === 401) {
363
391
  const orgAuthInfo = parseOrgAuthChallenge(response.headers.get("WWW-Authenticate"));
364
- if (orgAuthInfo && this.orgToken && this.orgTokenOrgUuid && this.orgTokenOrgUuid !== orgAuthInfo.orgUuid) {
365
- this.orgToken = void 0;
366
- this.orgTokenOrgUuid = void 0;
392
+ if (orgAuthInfo && this.orgSession && this.orgSessionOrgUuid && this.orgSessionOrgUuid !== orgAuthInfo.orgUuid) {
393
+ this.orgSession = void 0;
394
+ this.orgSessionOrgUuid = void 0;
367
395
  }
368
- if (orgAuthInfo && !this.orgToken) {
369
- const requestCookieName = orgAuthInfo.cookieName.replace(
370
- /^orgToken/,
371
- "requestOrgToken"
372
- );
373
- const cachedOrgToken = getCookieValue(requestCookieName);
374
- if (cachedOrgToken) {
375
- this.orgToken = cachedOrgToken;
376
- this.orgTokenOrgUuid = orgAuthInfo.orgUuid;
396
+ if (orgAuthInfo && !this.orgSession) {
397
+ const requestCookieName = getRequestOrgCookieName(orgAuthInfo.cookieName);
398
+ const cachedOrgSession = requestCookieName ? getCookieValue(requestCookieName) : void 0;
399
+ if (cachedOrgSession) {
400
+ this.orgSession = cachedOrgSession;
401
+ this.orgSessionOrgUuid = orgAuthInfo.orgUuid;
377
402
  try {
378
403
  return await this.fetch(endpoint, options);
379
404
  } catch (retryError) {
380
- this.orgToken = void 0;
381
- this.orgTokenOrgUuid = void 0;
405
+ this.orgSession = void 0;
406
+ this.orgSessionOrgUuid = void 0;
382
407
  throw retryError;
383
408
  }
384
409
  }
@@ -394,20 +419,20 @@ var BaseApiClient = class {
394
419
  })();
395
420
  }
396
421
  await this.orgAuthInProgress;
397
- const postHandlerToken = getCookieValue(requestCookieName) ?? this.orgToken;
398
- if (!postHandlerToken) {
422
+ const postHandlerSession = (requestCookieName ? getCookieValue(requestCookieName) : void 0) ?? this.orgSession;
423
+ if (!postHandlerSession) {
399
424
  throw new ApiError(
400
- "Organization authentication did not issue a token",
425
+ "Organization authentication did not issue a session",
401
426
  401
402
427
  );
403
428
  }
404
- this.orgToken = postHandlerToken;
405
- this.orgTokenOrgUuid = orgAuthInfo.orgUuid;
429
+ this.orgSession = postHandlerSession;
430
+ this.orgSessionOrgUuid = orgAuthInfo.orgUuid;
406
431
  try {
407
432
  return await this.fetch(endpoint, options);
408
433
  } catch (retryError) {
409
- this.orgToken = void 0;
410
- this.orgTokenOrgUuid = void 0;
434
+ this.orgSession = void 0;
435
+ this.orgSessionOrgUuid = void 0;
411
436
  throw retryError;
412
437
  }
413
438
  }
@@ -482,9 +507,7 @@ ${formattedErrors}`, response.status);
482
507
  if (this.actingMemberUuid) {
483
508
  headers.set("X-Acting-Member", this.actingMemberUuid);
484
509
  }
485
- if (this.orgToken) {
486
- headers.set("X-Org-Token", this.orgToken);
487
- }
510
+ setOrgAuthHeader(headers, this.orgSession);
488
511
  const response = await this.fetchFunction(`${this.baseUrl}/api/v2/${endpoint}`, {
489
512
  ...options,
490
513
  ...this.apiKey ? {} : { credentials: "include" },
@@ -507,31 +530,28 @@ ${formattedErrors}`, response.status);
507
530
  try {
508
531
  return await this.fetchRaw(endpoint, options, allowedErrorStatuses);
509
532
  } catch (retryError) {
510
- this.orgToken = void 0;
511
- this.orgTokenOrgUuid = void 0;
533
+ this.orgSession = void 0;
534
+ this.orgSessionOrgUuid = void 0;
512
535
  throw retryError;
513
536
  }
514
537
  }
515
538
  if (response.status === 401) {
516
539
  const orgAuthInfo = parseOrgAuthChallenge(response.headers.get("WWW-Authenticate"));
517
- if (orgAuthInfo && this.orgToken && this.orgTokenOrgUuid && this.orgTokenOrgUuid !== orgAuthInfo.orgUuid) {
518
- this.orgToken = void 0;
519
- this.orgTokenOrgUuid = void 0;
540
+ if (orgAuthInfo && this.orgSession && this.orgSessionOrgUuid && this.orgSessionOrgUuid !== orgAuthInfo.orgUuid) {
541
+ this.orgSession = void 0;
542
+ this.orgSessionOrgUuid = void 0;
520
543
  }
521
- if (orgAuthInfo && !this.orgToken) {
522
- const requestCookieName = orgAuthInfo.cookieName.replace(
523
- /^orgToken/,
524
- "requestOrgToken"
525
- );
526
- const cachedOrgToken = getCookieValue(requestCookieName);
527
- if (cachedOrgToken) {
528
- this.orgToken = cachedOrgToken;
529
- this.orgTokenOrgUuid = orgAuthInfo.orgUuid;
544
+ if (orgAuthInfo && !this.orgSession) {
545
+ const requestCookieName = getRequestOrgCookieName(orgAuthInfo.cookieName);
546
+ const cachedOrgSession = requestCookieName ? getCookieValue(requestCookieName) : void 0;
547
+ if (cachedOrgSession) {
548
+ this.orgSession = cachedOrgSession;
549
+ this.orgSessionOrgUuid = orgAuthInfo.orgUuid;
530
550
  try {
531
551
  return await this.fetchRaw(endpoint, options, allowedErrorStatuses);
532
552
  } catch (retryError) {
533
- this.orgToken = void 0;
534
- this.orgTokenOrgUuid = void 0;
553
+ this.orgSession = void 0;
554
+ this.orgSessionOrgUuid = void 0;
535
555
  throw retryError;
536
556
  }
537
557
  }
@@ -547,20 +567,20 @@ ${formattedErrors}`, response.status);
547
567
  })();
548
568
  }
549
569
  await this.orgAuthInProgress;
550
- const postHandlerToken = getCookieValue(requestCookieName) ?? this.orgToken;
551
- if (!postHandlerToken) {
570
+ const postHandlerSession = (requestCookieName ? getCookieValue(requestCookieName) : void 0) ?? this.orgSession;
571
+ if (!postHandlerSession) {
552
572
  throw new ApiError(
553
- "Organization authentication did not issue a token",
573
+ "Organization authentication did not issue a session",
554
574
  401
555
575
  );
556
576
  }
557
- this.orgToken = postHandlerToken;
558
- this.orgTokenOrgUuid = orgAuthInfo.orgUuid;
577
+ this.orgSession = postHandlerSession;
578
+ this.orgSessionOrgUuid = orgAuthInfo.orgUuid;
559
579
  try {
560
580
  return await this.fetchRaw(endpoint, options, allowedErrorStatuses);
561
581
  } catch (retryError) {
562
- this.orgToken = void 0;
563
- this.orgTokenOrgUuid = void 0;
582
+ this.orgSession = void 0;
583
+ this.orgSessionOrgUuid = void 0;
564
584
  throw retryError;
565
585
  }
566
586
  }
@@ -599,9 +619,7 @@ ${formattedErrors}`, response.status);
599
619
  if (this.actingMemberUuid) {
600
620
  headers.set("X-Acting-Member", this.actingMemberUuid);
601
621
  }
602
- if (this.orgToken) {
603
- headers.set("X-Org-Token", this.orgToken);
604
- }
622
+ setOrgAuthHeader(headers, this.orgSession);
605
623
  const fullUrl = `${this.baseUrl}/${path}`;
606
624
  const response = await this.fetchFunction(fullUrl, {
607
625
  ...options,
@@ -631,10 +649,52 @@ ${formattedErrors}`, response.status);
631
649
  // src/api/abilities.ts
632
650
  var AbilitiesApi = class extends BaseApiClient {
633
651
  /**
634
- * List all available ability types from the registry.
652
+ * List available ability types from the registry.
653
+ * Pass includeSystem to also return auto-injected system abilities.
635
654
  */
636
- async getAbilityTypes(wid) {
637
- return this.fetch(`w/${wid}/abilities/types`);
655
+ async getAbilityTypes(wid, options = {}) {
656
+ const params = new URLSearchParams();
657
+ if (options.includeSystem) params.append("includeSystem", "true");
658
+ const qs = params.toString() ? `?${params.toString()}` : "";
659
+ return this.fetch(`w/${wid}/abilities/types${qs}`);
660
+ }
661
+ /** Get the full spec for a single ability type by slug. */
662
+ async getAbilityType(wid, slug) {
663
+ return this.fetch(
664
+ `w/${wid}/abilities/types/${encodeURIComponent(slug)}`
665
+ );
666
+ }
667
+ /**
668
+ * List configured ability instances for a workflow or task scope.
669
+ * Exactly one of workflowId / taskId must be provided.
670
+ */
671
+ async listAbilities(wid, options) {
672
+ const params = new URLSearchParams();
673
+ if (options.workflowId !== void 0)
674
+ params.append("workflowId", options.workflowId.toString());
675
+ if (options.taskId !== void 0)
676
+ params.append("taskId", options.taskId.toString());
677
+ return this.fetch(`w/${wid}/abilities?${params}`);
678
+ }
679
+ /** Create (enable) a configured ability on a workflow or task scope. */
680
+ async createAbility(wid, body) {
681
+ return this.fetch(`w/${wid}/abilities`, {
682
+ method: "POST",
683
+ body: JSON.stringify(body)
684
+ });
685
+ }
686
+ /** Update a configured ability (configure / enable / disable) by UUID. */
687
+ async updateAbility(wid, abilityUuid, body) {
688
+ return this.fetch(`w/${wid}/abilities/${abilityUuid}`, {
689
+ method: "PATCH",
690
+ body: JSON.stringify(body)
691
+ });
692
+ }
693
+ /** Delete a configured ability instance by UUID. */
694
+ async deleteAbility(wid, abilityUuid) {
695
+ return this.fetch(`w/${wid}/abilities/${abilityUuid}`, {
696
+ method: "DELETE"
697
+ });
638
698
  }
639
699
  };
640
700
 
@@ -797,9 +857,21 @@ var AgentsApi = class extends BaseApiClient {
797
857
  async resolveAgentTools(wid, id, options) {
798
858
  const params = new URLSearchParams();
799
859
  params.append("channel", options.channel);
800
- params.append("taskId", options.taskId.toString());
860
+ if (options.taskId !== void 0) params.append("taskId", options.taskId.toString());
861
+ if (options.taskUuid !== void 0) params.append("taskUuid", options.taskUuid);
801
862
  return this.fetch(`w/${wid}/agents/${id}/resolve-tools?${params}`);
802
863
  }
864
+ /**
865
+ * List the configured abilities effective for an agent via a task's workflow.
866
+ * Requires taskId because abilities are scoped to workflows/tasks, not agents.
867
+ */
868
+ async listAgentAbilities(wid, id, options) {
869
+ const params = new URLSearchParams();
870
+ params.append("taskId", options.taskId.toString());
871
+ return this.fetch(
872
+ `w/${wid}/agents/${id}/abilities?${params}`
873
+ );
874
+ }
803
875
  };
804
876
 
805
877
  // src/api/ai-models.ts
@@ -857,7 +929,11 @@ var AIModelsApi = class extends BaseApiClient {
857
929
  return this.fetch(url);
858
930
  }
859
931
  /**
860
- * Get available speech-to-text models
932
+ * Get available speech-to-text models.
933
+ *
934
+ * Returns the per-shape `STTModelsResponse` so callers see `languages` and
935
+ * `capabilities` on each model (the chat-shape `AIModelsResponse` it used
936
+ * to return doesn't include either).
861
937
  */
862
938
  async getSTTModels(provider) {
863
939
  const searchParams = new URLSearchParams();
@@ -1252,15 +1328,11 @@ var AuthApi = class extends BaseApiClient {
1252
1328
  body: JSON.stringify({ email, organizationUuid, redirectUrl })
1253
1329
  });
1254
1330
  }
1255
- /** Validate a magic link token and optional OTP to complete authentication. */
1256
- async validateMagicLink(token, otp) {
1257
- const body = { token };
1258
- if (otp) {
1259
- body.otp = otp;
1260
- }
1331
+ /** Validate a magic link token to complete authentication. */
1332
+ async validateMagicLink(token) {
1261
1333
  return await this.fetch(`auth/validate-magic-link`, {
1262
1334
  method: "POST",
1263
- body: JSON.stringify(body)
1335
+ body: JSON.stringify({ token })
1264
1336
  });
1265
1337
  }
1266
1338
  // ===== EMAIL VERIFICATION METHODS =====
@@ -1766,6 +1838,26 @@ var CallsApi = class extends BaseApiClient {
1766
1838
  async getMessageTiming(wid, chatId) {
1767
1839
  return this.fetch(`w/${wid}/recordings/chat/${chatId}/message-timing`);
1768
1840
  }
1841
+ /** List the recorded audio chunks for a chat (metadata only). */
1842
+ async listChatRecordings(wid, chatId, options = {}) {
1843
+ const params = new URLSearchParams();
1844
+ if (options.role) params.set("role", options.role);
1845
+ return this.fetch(
1846
+ `w/${wid}/recordings/chat/${chatId}${params.toString() ? `?${params.toString()}` : ""}`
1847
+ );
1848
+ }
1849
+ /**
1850
+ * Get a single short-lived presigned URL to download the complete call
1851
+ * recording as one WAV file. The first request assembles + caches the
1852
+ * full-call WAV; later requests reuse it.
1853
+ */
1854
+ async getCallRecordingDownloadUrl(wid, chatId, options = {}) {
1855
+ const params = new URLSearchParams();
1856
+ if (options.expiresIn !== void 0) params.set("expires_in", String(options.expiresIn));
1857
+ return this.fetch(
1858
+ `w/${wid}/recordings/chat/${chatId}/download-url${params.toString() ? `?${params.toString()}` : ""}`
1859
+ );
1860
+ }
1769
1861
  };
1770
1862
 
1771
1863
  // src/api/cel.ts
@@ -1850,6 +1942,17 @@ var ChatsApi = class extends BaseApiClient {
1850
1942
  async getChatTokenUsage(wid, chatId) {
1851
1943
  return this.fetch(`w/${wid}/chats/${chatId}/token-usage`);
1852
1944
  }
1945
+ /** List scheduled callbacks for a chat (newest first). */
1946
+ async getChatCallbacks(wid, chatId) {
1947
+ return this.fetch(`w/${wid}/chats/${chatId}/callbacks`);
1948
+ }
1949
+ /** Cancel a pending scheduled callback on a chat. */
1950
+ async cancelChatCallback(wid, chatId, callbackId) {
1951
+ return this.fetch(
1952
+ `w/${wid}/chats/${chatId}/callbacks/${callbackId}/cancel`,
1953
+ { method: "POST" }
1954
+ );
1955
+ }
1853
1956
  /** Get todo items extracted from a chat. */
1854
1957
  async getChatTodos(wid, chatId) {
1855
1958
  return this.fetch(`w/${wid}/chats/${chatId}/todos`);
@@ -1888,9 +1991,11 @@ var ChatsApi = class extends BaseApiClient {
1888
1991
  }
1889
1992
  /** Create a new chat. */
1890
1993
  async createChat(wid, chat) {
1994
+ const { agentMemberId, ...rest } = chat;
1995
+ const payload = agentMemberId !== void 0 && rest.assistantMemberId === void 0 ? { ...rest, assistantMemberId: agentMemberId } : rest;
1891
1996
  return this.fetch(`w/${wid}/chats`, {
1892
1997
  method: "POST",
1893
- body: JSON.stringify(chat)
1998
+ body: JSON.stringify(payload)
1894
1999
  });
1895
2000
  }
1896
2001
  /**
@@ -1953,7 +2058,8 @@ var ChatsApi = class extends BaseApiClient {
1953
2058
  }
1954
2059
  );
1955
2060
  }
1956
- /** List messages in a chat with optional pagination. */
2061
+ /** List messages in a chat with optional pagination.
2062
+ * ``id`` is the numeric chat id (documented) or the chat uuid (accepted). */
1957
2063
  async getChatMessages(wid, id, limit, offset) {
1958
2064
  const params = new URLSearchParams();
1959
2065
  if (limit) params.append("limit", limit.toString());
@@ -2333,6 +2439,7 @@ var DataTypesApi = class extends BaseApiClient {
2333
2439
  async getDataRecords(wid, dataTypeId, options) {
2334
2440
  const params = new URLSearchParams();
2335
2441
  if (options?.memberId !== void 0) params.append("member_id", options.memberId.toString());
2442
+ if (options?.memberIds?.length) params.append("member_ids", options.memberIds.join(","));
2336
2443
  if (options?.search) params.append("search", options.search);
2337
2444
  if (options?.searchField) params.append("search_field", options.searchField);
2338
2445
  if (options?.page) params.append("page", options.page.toString());
@@ -2737,6 +2844,13 @@ var EventsApi = class extends BaseApiClient {
2737
2844
  method: "DELETE"
2738
2845
  });
2739
2846
  }
2847
+ /** Send a one-off test webhook for an existing webhook event rule. */
2848
+ async testWebhook(wid, id, request) {
2849
+ return this.fetch(`w/${wid}/event-rules/${id}/test-webhook`, {
2850
+ method: "POST",
2851
+ body: JSON.stringify(request)
2852
+ });
2853
+ }
2740
2854
  /** Reorder event rules by specifying the desired rule ID sequence. */
2741
2855
  async reorderEventRules(wid, ruleIds) {
2742
2856
  return this.fetch(`w/${wid}/event-rules/reorder`, {
@@ -3214,6 +3328,25 @@ var FhirConnectionsApi = class extends BaseApiClient {
3214
3328
  }
3215
3329
  };
3216
3330
 
3331
+ // src/api/patientsync-connections.ts
3332
+ var PatientSyncConnectionsApi = class extends BaseApiClient {
3333
+ /** Create or update the workspace's PatientSync connection (singleton). */
3334
+ async configurePatientSync(wid, data) {
3335
+ return this.fetch(
3336
+ `w/${wid}/app-connections/patientsync/configure`,
3337
+ { method: "POST", body: JSON.stringify(data) }
3338
+ );
3339
+ }
3340
+ /** Read the PatientSync connection status (never returns the API key). */
3341
+ async getPatientSyncStatus(wid) {
3342
+ return this.fetch(`w/${wid}/app-connections/patientsync/status`);
3343
+ }
3344
+ /** Delete the workspace's PatientSync connection. */
3345
+ async deletePatientSyncConnection(wid) {
3346
+ return this.fetch(`w/${wid}/app-connections/patientsync/`, { method: "DELETE" });
3347
+ }
3348
+ };
3349
+
3217
3350
  // src/api/healthie.ts
3218
3351
  var HealthieApi = class extends BaseApiClient {
3219
3352
  async configureHealthie(wid, data) {
@@ -3334,6 +3467,18 @@ var FilesApi = class extends BaseApiClient {
3334
3467
  async getFile(wid, id) {
3335
3468
  return this.fetch(`w/${wid}/files/${id}`);
3336
3469
  }
3470
+ /**
3471
+ * Download the given files + folders (folders recursively) as a single ZIP.
3472
+ * Returns the raw archive bytes for the caller to save.
3473
+ */
3474
+ async downloadFilesZip(wid, fileIds, folderIds) {
3475
+ const response = await this.fetchRaw(`w/${wid}/files/download/zip`, {
3476
+ method: "POST",
3477
+ headers: { "Content-Type": "application/json" },
3478
+ body: JSON.stringify({ file_ids: fileIds, folder_ids: folderIds })
3479
+ });
3480
+ return response.blob();
3481
+ }
3337
3482
  /** Create a new file record in the workspace. */
3338
3483
  async createFile(wid, file) {
3339
3484
  return this.fetch(`w/${wid}/files`, {
@@ -3824,6 +3969,12 @@ var AppConnectionsApi = class extends BaseApiClient {
3824
3969
  * values are intentionally never exposed. Operators can also add a
3825
3970
  * new key via the UI's "Add custom field key" free-text action.
3826
3971
  */
3972
+ async setDefaultGooglePlatformAccount(wid, connectionUuid, credentialUuid) {
3973
+ return this.fetch(
3974
+ `w/${wid}/app-connections/google/platform-apps/${connectionUuid}/accounts/${credentialUuid}/default`,
3975
+ { method: "POST" }
3976
+ );
3977
+ }
3827
3978
  async listConnectionMemberFieldKeys(wid, connectionId) {
3828
3979
  return this.fetch(
3829
3980
  `w/${wid}/app-connections/${connectionId}/member-field-keys`
@@ -3944,6 +4095,31 @@ var McpServersApi = class extends BaseApiClient {
3944
4095
  };
3945
4096
 
3946
4097
  // src/api/members.ts
4098
+ var MemberImportValidationError = class extends Error {
4099
+ validationErrors;
4100
+ constructor(message, validationErrors) {
4101
+ super(message);
4102
+ this.name = "MemberImportValidationError";
4103
+ this.validationErrors = validationErrors;
4104
+ }
4105
+ };
4106
+ function throwMemberImportError(errorBody, fallback) {
4107
+ let detail = errorBody?.detail;
4108
+ if (typeof detail === "string") {
4109
+ try {
4110
+ const parsed = JSON.parse(detail);
4111
+ if (parsed && typeof parsed === "object") detail = parsed;
4112
+ } catch {
4113
+ }
4114
+ }
4115
+ if (detail && typeof detail === "object") {
4116
+ const { message, errors } = detail;
4117
+ if (Array.isArray(errors)) {
4118
+ throw new MemberImportValidationError(message || fallback, errors);
4119
+ }
4120
+ }
4121
+ throw new Error(typeof detail === "string" ? detail : fallback);
4122
+ }
3947
4123
  var MembersApi = class extends BaseApiClient {
3948
4124
  /** Get the currently authenticated member for a workspace. */
3949
4125
  async getCurrentMember(wid) {
@@ -3984,8 +4160,10 @@ var MembersApi = class extends BaseApiClient {
3984
4160
  });
3985
4161
  }
3986
4162
  /** List workspace members with pagination, filtering, and sorting. */
3987
- async getWorkspaceMembers(wid, page = 1, pageSize = 10, filters, search, role, sortBy, sortOrder, memberType, isArchived = false, isManager, memberTypes, hasAccount, excludeIds) {
4163
+ async getWorkspaceMembers(wid, page = 1, pageSize = 10, filters, search, role, sortBy, sortOrder, memberType, isArchived = false, isManager, memberTypes, hasAccount, excludeIds, memberFilterId, query) {
3988
4164
  const params = new URLSearchParams();
4165
+ if (memberFilterId != null) params.append("memberFilterId", memberFilterId.toString());
4166
+ if (query != null) params.append("query", JSON.stringify(query));
3989
4167
  if (page) params.append("page", page.toString());
3990
4168
  if (pageSize) params.append("pageSize", pageSize.toString());
3991
4169
  if (sortBy) params.append("sortBy", sortBy);
@@ -4058,6 +4236,17 @@ var MembersApi = class extends BaseApiClient {
4058
4236
  method: "POST"
4059
4237
  });
4060
4238
  }
4239
+ /**
4240
+ * Send the member an SMS asking them to confirm their phone number. When they
4241
+ * reply, a trusted phone auth binding is created so they can use SMS as
4242
+ * themselves without an account (member-attested alternative to the
4243
+ * members:admin "Trusted" override).
4244
+ */
4245
+ async sendMemberPhoneConfirmation(wid, memberId) {
4246
+ return this.fetch(`w/${wid}/members/${memberId}/phone-confirmation`, {
4247
+ method: "POST"
4248
+ });
4249
+ }
4061
4250
  // Member Filter APIs
4062
4251
  /** List all saved member filters for a workspace. */
4063
4252
  async getMemberFilters(wid) {
@@ -4081,6 +4270,22 @@ var MembersApi = class extends BaseApiClient {
4081
4270
  body: JSON.stringify(data)
4082
4271
  });
4083
4272
  }
4273
+ /**
4274
+ * Convert a legacy rules filter to a query-engine predicate. One-way and
4275
+ * transactional: on success the filter's legacy rules are gone and
4276
+ * `query` holds the equivalent IR predicate. 409 if already query-format;
4277
+ * 422 when rules have no engine equivalent.
4278
+ *
4279
+ * With `dryRun: true` the same validation runs but nothing persists: the
4280
+ * response previews the normalized predicate in `query` while `rules`
4281
+ * stay intact on the filter.
4282
+ */
4283
+ async convertMemberFilterToQuery(wid, filterId, opts) {
4284
+ const suffix = opts?.dryRun ? "?dryRun=true" : "";
4285
+ return this.fetch(`w/${wid}/member-filters/${filterId}/convert${suffix}`, {
4286
+ method: "PUT"
4287
+ });
4288
+ }
4084
4289
  /** Delete a saved member filter. */
4085
4290
  async deleteMemberFilter(wid, filterId) {
4086
4291
  return this.fetch(`w/${wid}/member-filters/${filterId}`, {
@@ -4158,48 +4363,98 @@ var MembersApi = class extends BaseApiClient {
4158
4363
  });
4159
4364
  }
4160
4365
  // Import/Export Members API
4161
- /** Import members from a CSV file, streaming progress updates via callback. */
4162
- async importMembers(wid, file, newMemberRoleId, onProgress) {
4366
+ /**
4367
+ * Read-only preview classifying each CSV row before any write (GRA-5545).
4368
+ *
4369
+ * Returns create/update/unchanged/conflict/error counts. For phone-only
4370
+ * identity conflicts it also returns existing vs incoming identity so the
4371
+ * operator can decide whether to skip or explicitly overwrite before
4372
+ * committing. Requires MEMBERS_ADMIN and is bulk-PHI audited server-side.
4373
+ */
4374
+ async previewImportMembers(wid, file, newMemberRoleId, options) {
4163
4375
  const formData = new FormData();
4164
4376
  formData.append("file", file);
4165
4377
  const params = new URLSearchParams();
4166
4378
  params.append("new_member_role_id", newMemberRoleId.toString());
4167
- const response = await fetch(
4168
- `${this.baseUrl}/api/v2/w/${wid}/members/import?${params.toString()}`,
4379
+ if (options?.trustEmailAddresses) {
4380
+ params.append("trust_email_addresses", "true");
4381
+ }
4382
+ if (options?.trustPhoneNumbers) {
4383
+ params.append("trust_phone_numbers", "true");
4384
+ }
4385
+ const response = await this.fetchRaw(
4386
+ `w/${wid}/members/import/preview?${params.toString()}`,
4169
4387
  {
4170
4388
  method: "POST",
4171
- body: formData,
4172
- credentials: "include"
4173
- }
4389
+ body: formData
4390
+ },
4391
+ [400, 413]
4174
4392
  );
4175
4393
  if (!response.ok) {
4176
- const error = await response.json();
4177
- if (error.detail && typeof error.detail === "object") {
4178
- const { message, errors } = error.detail;
4179
- if (errors && Array.isArray(errors)) {
4180
- const importError = new Error(message || "Import validation failed");
4181
- importError.validationErrors = errors;
4182
- throw importError;
4183
- }
4184
- }
4185
- throw new Error(error.detail || "Import failed");
4394
+ const error = await response.json().catch(() => ({}));
4395
+ throwMemberImportError(error, "Import preview failed");
4396
+ }
4397
+ return response.json();
4398
+ }
4399
+ /**
4400
+ * Import members from a CSV file, streaming progress updates via callback.
4401
+ *
4402
+ * ``identityConflictPolicy`` (default 'skip') controls how a row matching an
4403
+ * existing member ONLY by phone with different identity fields is handled.
4404
+ * Send 'overwrite_identity_fields' only after the operator confirms a preview.
4405
+ */
4406
+ async importMembers(wid, file, newMemberRoleId, onProgress, options) {
4407
+ const formData = new FormData();
4408
+ formData.append("file", file);
4409
+ const params = new URLSearchParams();
4410
+ params.append("new_member_role_id", newMemberRoleId.toString());
4411
+ if (options?.trustEmailAddresses) {
4412
+ params.append("trust_email_addresses", "true");
4413
+ }
4414
+ if (options?.trustPhoneNumbers) {
4415
+ params.append("trust_phone_numbers", "true");
4416
+ }
4417
+ if (options?.identityConflictPolicy) {
4418
+ params.append("identity_conflict_policy", options.identityConflictPolicy);
4419
+ }
4420
+ const response = await this.fetchRaw(
4421
+ `w/${wid}/members/import?${params.toString()}`,
4422
+ {
4423
+ method: "POST",
4424
+ body: formData
4425
+ },
4426
+ [400, 413]
4427
+ );
4428
+ if (!response.ok) {
4429
+ const error = await response.json().catch(() => ({}));
4430
+ throwMemberImportError(error, "Import failed");
4186
4431
  }
4187
4432
  if (onProgress && response.body) {
4188
4433
  const reader = response.body.getReader();
4189
4434
  const decoder = new TextDecoder();
4435
+ let buffer = "";
4190
4436
  while (true) {
4191
4437
  const { done, value } = await reader.read();
4192
4438
  if (done) break;
4193
- const chunk = decoder.decode(value);
4194
- const lines = chunk.split("\n").filter((line) => line.trim());
4439
+ buffer += decoder.decode(value, { stream: true });
4440
+ const lines = buffer.split("\n");
4441
+ buffer = lines.pop() ?? "";
4195
4442
  for (const line of lines) {
4443
+ const trimmed = line.trim();
4444
+ if (!trimmed) continue;
4196
4445
  try {
4197
- const progress = JSON.parse(line);
4198
- onProgress(progress);
4446
+ onProgress(JSON.parse(trimmed));
4199
4447
  } catch {
4200
4448
  }
4201
4449
  }
4202
4450
  }
4451
+ const tail = buffer.trim();
4452
+ if (tail) {
4453
+ try {
4454
+ onProgress(JSON.parse(tail));
4455
+ } catch {
4456
+ }
4457
+ }
4203
4458
  }
4204
4459
  return { success: true };
4205
4460
  }
@@ -4391,6 +4646,17 @@ var MembersApi = class extends BaseApiClient {
4391
4646
  { method: "DELETE" }
4392
4647
  );
4393
4648
  }
4649
+ /** Bulk-create members in a workspace. */
4650
+ async bulkCreateMembers(wid, request) {
4651
+ return this.fetch(`w/${wid}/members/bulk`, {
4652
+ method: "POST",
4653
+ body: JSON.stringify(request)
4654
+ });
4655
+ }
4656
+ /** Get all sync links for a member across app connections. */
4657
+ async getMemberSyncLinks(wid, memberId) {
4658
+ return this.fetch(`w/${wid}/members/${memberId}/sync-links`);
4659
+ }
4394
4660
  };
4395
4661
 
4396
4662
  // src/api/milestones.ts
@@ -4887,6 +5153,7 @@ var OrgApi = class extends BaseApiClient {
4887
5153
  */
4888
5154
  async searchPhoneNumbers(orgUuid, params) {
4889
5155
  const query = new URLSearchParams();
5156
+ if (params?.country) query.set("country", params.country);
4890
5157
  if (params?.numberType) query.set("number_type", params.numberType);
4891
5158
  if (params?.areaCode) query.set("area_code", params.areaCode);
4892
5159
  if (params?.contains) query.set("contains", params.contains);
@@ -4898,11 +5165,20 @@ var OrgApi = class extends BaseApiClient {
4898
5165
  }
4899
5166
  /**
4900
5167
  * Purchase a phone number from Twilio for this org inventory (org admin only).
5168
+ *
5169
+ * Numbers in regulated countries (e.g. Australia) require a Twilio regulatory
5170
+ * bundle and an address — pass `bundleSid` and `addressSid` for those.
4901
5171
  */
4902
- async purchasePhoneNumber(orgUuid, phoneNumber, numberType) {
5172
+ async purchasePhoneNumber(orgUuid, phoneNumber, numberType, opts) {
4903
5173
  return this.fetch(`o/${orgUuid}/phone-numbers/purchase`, {
4904
5174
  method: "POST",
4905
- body: JSON.stringify({ phoneNumber, numberType })
5175
+ body: JSON.stringify({
5176
+ phoneNumber,
5177
+ numberType,
5178
+ country: opts?.country,
5179
+ bundleSid: opts?.bundleSid,
5180
+ addressSid: opts?.addressSid
5181
+ })
4906
5182
  });
4907
5183
  }
4908
5184
  /**
@@ -5110,6 +5386,90 @@ var OrgApi = class extends BaseApiClient {
5110
5386
  method: "POST"
5111
5387
  });
5112
5388
  }
5389
+ /**
5390
+ * List the org's A2P brands (broker resources). The SMS-consent editor uses
5391
+ * this to pick which brand's consent config to edit.
5392
+ */
5393
+ async listA2PBrands(orgUuid) {
5394
+ return this.fetch(`o/${orgUuid}/a2p-brands`);
5395
+ }
5396
+ /**
5397
+ * Fetch a brand's resolved A2P campaign config. The response carries both the
5398
+ * raw `overrides` and the `resolved` payload (defaults + overrides) the editor
5399
+ * previews — including the canonical SMS consent text.
5400
+ */
5401
+ async getA2PCampaignConfig(orgUuid, brandUuid) {
5402
+ return this.fetch(
5403
+ `o/${orgUuid}/a2p-brands/${brandUuid}/campaign-config`
5404
+ );
5405
+ }
5406
+ /**
5407
+ * Partial-update a brand's A2P campaign config. Returns the freshly resolved
5408
+ * config so the editor's live preview updates without a second round-trip.
5409
+ */
5410
+ async updateA2PCampaignConfig(orgUuid, brandUuid, data) {
5411
+ return this.fetch(
5412
+ `o/${orgUuid}/a2p-brands/${brandUuid}/campaign-config`,
5413
+ {
5414
+ method: "PUT",
5415
+ body: JSON.stringify(data)
5416
+ }
5417
+ );
5418
+ }
5419
+ /**
5420
+ * Published Sites across the org's workspaces that can be linked as this
5421
+ * brand's enrollment (opt-in) surface. Org-authorized, so it works even when
5422
+ * the admin isn't a member of the workspace holding the Site.
5423
+ */
5424
+ async listA2PEnrollmentSiteCandidates(orgUuid, brandUuid) {
5425
+ return this.fetch(
5426
+ `o/${orgUuid}/a2p-brands/${brandUuid}/enrollment-site/candidates`
5427
+ );
5428
+ }
5429
+ /**
5430
+ * Link the brand to a published enrollment Site (sets `site_uuid`). Returns
5431
+ * the refreshed campaign config so the editor's link state updates inline.
5432
+ */
5433
+ async linkA2PEnrollmentSite(orgUuid, brandUuid, data) {
5434
+ return this.fetch(
5435
+ `o/${orgUuid}/a2p-brands/${brandUuid}/enrollment-site`,
5436
+ {
5437
+ method: "PUT",
5438
+ body: JSON.stringify(data)
5439
+ }
5440
+ );
5441
+ }
5442
+ /**
5443
+ * Provision (or reuse) a patient-enrollment Site for the brand and link it —
5444
+ * the one-click path behind the SMS Consent tab. `workspaceUuid` is required
5445
+ * only when the org has multiple workspaces. Returns the refreshed campaign
5446
+ * config so the editor's link state updates inline. Idempotent.
5447
+ */
5448
+ async provisionA2PEnrollmentSite(orgUuid, brandUuid, data = {}) {
5449
+ return this.fetch(
5450
+ `o/${orgUuid}/a2p-brands/${brandUuid}/enrollment-site/provision`,
5451
+ {
5452
+ method: "POST",
5453
+ body: JSON.stringify(data)
5454
+ }
5455
+ );
5456
+ }
5457
+ /** Clear the brand's enrollment-site link. */
5458
+ async unlinkA2PEnrollmentSite(orgUuid, brandUuid) {
5459
+ return this.fetch(
5460
+ `o/${orgUuid}/a2p-brands/${brandUuid}/enrollment-site`,
5461
+ { method: "DELETE" }
5462
+ );
5463
+ }
5464
+ /**
5465
+ * The brand-addressable enrollment form URL (carries `?brand=…`). Outreach
5466
+ * appends each patient's `external_id`. `url` is null until a Site is linked.
5467
+ */
5468
+ async getA2PBrandEnrollmentUrl(orgUuid, brandUuid) {
5469
+ return this.fetch(
5470
+ `o/${orgUuid}/a2p-brands/${brandUuid}/enrollment-url`
5471
+ );
5472
+ }
5113
5473
  /**
5114
5474
  * List available member roles for a workspace in the organization.
5115
5475
  */
@@ -5134,58 +5494,53 @@ var OrgApi = class extends BaseApiClient {
5134
5494
  function getOAuthPath(providerSlug, action) {
5135
5495
  if (providerSlug === "google_calendar") {
5136
5496
  return `oauth/google/calendar/${action}`;
5137
- } else if (providerSlug === "gmail") {
5497
+ }
5498
+ if (providerSlug === "gmail") {
5138
5499
  return `oauth/google/gmail/${action}`;
5139
- } else {
5140
- return `oauth/${providerSlug}/${action}`;
5141
5500
  }
5501
+ if (providerSlug === "gdrive") {
5502
+ return `oauth/google/drive/${action}`;
5503
+ }
5504
+ return `oauth/${providerSlug}/${action}`;
5505
+ }
5506
+ function buildAuthorizeQuery(options) {
5507
+ if (!options) return "";
5508
+ const params = new URLSearchParams();
5509
+ if (options.credentialUuid) params.set("credentialUuid", options.credentialUuid);
5510
+ if (options.loginHint) params.set("loginHint", options.loginHint);
5511
+ if (options.redirect) params.set("redirect", options.redirect);
5512
+ const qs = params.toString();
5513
+ return qs ? `?${qs}` : "";
5142
5514
  }
5143
5515
  var OAuthConnectionsApi = class extends BaseApiClient {
5144
- /**
5145
- * Get the connection status for an OAuth provider
5146
- */
5147
5516
  async getConnectionStatus(providerSlug) {
5148
5517
  const path = getOAuthPath(providerSlug, "status");
5149
5518
  return this.fetchRoot(path);
5150
5519
  }
5151
- /**
5152
- * Get the authorization URL to start OAuth flow
5153
- */
5154
- async getAuthorizationUrl(providerSlug) {
5155
- const path = getOAuthPath(providerSlug, "authorize");
5520
+ async listAccounts(providerSlug) {
5521
+ const path = getOAuthPath(providerSlug, "accounts");
5156
5522
  return this.fetchRoot(path);
5157
5523
  }
5158
- /**
5159
- * Disconnect an OAuth provider
5160
- */
5161
- async disconnect(providerSlug) {
5524
+ async getAuthorizationUrl(providerSlug, options) {
5525
+ const path = getOAuthPath(providerSlug, "authorize") + buildAuthorizeQuery(options);
5526
+ return this.fetchRoot(path);
5527
+ }
5528
+ async disconnect(providerSlug, credentialUuid) {
5162
5529
  const path = getOAuthPath(providerSlug, "disconnect");
5163
- return this.fetchRoot(path, { method: "DELETE" });
5530
+ const qs = credentialUuid ? `?credentialUuid=${encodeURIComponent(credentialUuid)}` : "";
5531
+ return this.fetchRoot(`${path}${qs}`, { method: "DELETE" });
5164
5532
  }
5165
5533
  };
5166
5534
  var OAuthApi = class extends BaseApiClient {
5167
- /**
5168
- * Get all available OAuth/API key scopes with metadata.
5169
- *
5170
- * This returns the full scope definitions from the backend,
5171
- * ensuring the UI always shows the correct scopes.
5172
- */
5173
5535
  async getAvailableScopes() {
5174
5536
  return this.fetch("oauth/scopes");
5175
5537
  }
5176
- /**
5177
- * Create an authorization code for OAuth flow
5178
- * This is called after the user approves the authorization request
5179
- */
5180
5538
  async authorize(request) {
5181
5539
  return this.fetch("oauth/authorize", {
5182
5540
  method: "POST",
5183
5541
  body: JSON.stringify(request)
5184
5542
  });
5185
5543
  }
5186
- /**
5187
- * Exchange authorization code for access token
5188
- */
5189
5544
  async exchangeOAuthToken(request) {
5190
5545
  const formData = new URLSearchParams();
5191
5546
  formData.append("grant_type", request.grant_type);
@@ -5479,6 +5834,37 @@ var PersonasApi = class extends BaseApiClient {
5479
5834
  }
5480
5835
  };
5481
5836
 
5837
+ // src/api/queries.ts
5838
+ var QueriesApi = class extends BaseApiClient {
5839
+ /** Queryable namespace: native fields, operators per type, DataType record fields. */
5840
+ async getQueryFields(wid) {
5841
+ return this.fetch(`w/${wid}/queries/fields`, {
5842
+ method: "GET"
5843
+ });
5844
+ }
5845
+ /** Structure / field / access / cost validation without execution. */
5846
+ async validateQuery(wid, query) {
5847
+ return this.fetch(`w/${wid}/queries/validate`, {
5848
+ method: "POST",
5849
+ body: JSON.stringify({ query })
5850
+ });
5851
+ }
5852
+ /** Bounded sample run (limit capped server-side). */
5853
+ async previewQuery(wid, query, mode) {
5854
+ return this.fetch(`w/${wid}/queries/preview`, {
5855
+ method: "POST",
5856
+ body: JSON.stringify({ query, mode })
5857
+ });
5858
+ }
5859
+ /** Execute a query (rows / count / aggregate). */
5860
+ async runQuery(wid, query, mode) {
5861
+ return this.fetch(`w/${wid}/queries/run`, {
5862
+ method: "POST",
5863
+ body: JSON.stringify({ query, mode })
5864
+ });
5865
+ }
5866
+ };
5867
+
5482
5868
  // src/api/qualifications.ts
5483
5869
  var QualificationsApi = class extends BaseApiClient {
5484
5870
  /** List qualifications in a workspace, paginated. */
@@ -5530,6 +5916,9 @@ var QualificationsApi = class extends BaseApiClient {
5530
5916
  async listTestChatRuns(wid, workflowId, params) {
5531
5917
  const query = new URLSearchParams();
5532
5918
  if (params?.scenarioId !== void 0) query.set("scenarioId", String(params.scenarioId));
5919
+ if (params?.assistantChatModelId !== void 0) {
5920
+ query.set("assistantChatModelId", params.assistantChatModelId);
5921
+ }
5533
5922
  if (params?.limit !== void 0) query.set("limit", String(params.limit));
5534
5923
  const qs = query.toString() ? `?${query.toString()}` : "";
5535
5924
  return this.fetch(
@@ -5964,6 +6353,112 @@ var SitesApi = class extends BaseApiClient {
5964
6353
  async getSite(wid, id) {
5965
6354
  return this.fetch(`w/${wid}/sites/${id}`);
5966
6355
  }
6356
+ /** Get a site's sharing settings. */
6357
+ async getSiteSharing(wid, siteId) {
6358
+ return this.fetch(`w/${wid}/sites/${siteId}/sharing`);
6359
+ }
6360
+ /** Update a site's sharing settings. */
6361
+ async updateSiteSharing(wid, siteId, data) {
6362
+ return this.fetch(`w/${wid}/sites/${siteId}/sharing`, {
6363
+ method: "PUT",
6364
+ body: JSON.stringify(data)
6365
+ });
6366
+ }
6367
+ /** Get a site's source tree. */
6368
+ async getSiteSource(wid, siteId) {
6369
+ return this.fetch(`w/${wid}/sites/${siteId}/source`);
6370
+ }
6371
+ /** Starter templates the caller may seed (superuser-only ones filtered server-side). */
6372
+ async getSiteSourceTemplates(wid, siteId) {
6373
+ return this.fetch(`w/${wid}/sites/${siteId}/source/templates`);
6374
+ }
6375
+ /** Create a site's source tree with starter files if it does not exist. */
6376
+ async createSiteSource(wid, siteId) {
6377
+ return this.fetch(`w/${wid}/sites/${siteId}/source`, {
6378
+ method: "POST"
6379
+ });
6380
+ }
6381
+ /** Build a site's source without publishing. */
6382
+ async buildSiteSource(wid, siteId) {
6383
+ return this.fetch(`w/${wid}/sites/${siteId}/source/build`, {
6384
+ method: "POST"
6385
+ });
6386
+ }
6387
+ /**
6388
+ * Build and publish a site's source. Optionally label the published version
6389
+ * with a `name` and `note`; both default to null (the UI then shows
6390
+ * "Version {version}").
6391
+ */
6392
+ async publishSiteSource(wid, siteId, options) {
6393
+ return this.fetch(`w/${wid}/sites/${siteId}/source/publish`, {
6394
+ method: "POST",
6395
+ body: JSON.stringify({
6396
+ name: options?.name ?? null,
6397
+ note: options?.note ?? null
6398
+ })
6399
+ });
6400
+ }
6401
+ /**
6402
+ * Reset a site's source files: load a starter template and/or wipe existing
6403
+ * files. `template` selects which starter to seed when `loadDefaults` is set
6404
+ * (defaults to "hello-world"; "patient-enrollment" is the other built-in).
6405
+ */
6406
+ async resetSiteSource(wid, siteId, options) {
6407
+ return this.fetch(`w/${wid}/sites/${siteId}/source/reset`, {
6408
+ method: "POST",
6409
+ body: JSON.stringify({
6410
+ load_defaults: options.loadDefaults,
6411
+ delete_existing: options.deleteExisting,
6412
+ ...options.template ? { template: options.template } : {}
6413
+ })
6414
+ });
6415
+ }
6416
+ /**
6417
+ * Re-point the published release to a prior version from the history. A pure
6418
+ * pointer move (no rebuild); the other versions stay in the history.
6419
+ */
6420
+ async rollbackSiteSource(wid, siteId, releaseUuid) {
6421
+ return this.fetch(`w/${wid}/sites/${siteId}/source/rollback`, {
6422
+ method: "POST",
6423
+ body: JSON.stringify({ release_uuid: releaseUuid })
6424
+ });
6425
+ }
6426
+ /**
6427
+ * Export the site's source tree as a ZIP archive (editor-gated server-side).
6428
+ * Returns the raw archive bytes for the caller to save.
6429
+ */
6430
+ async downloadSiteSourceZip(wid, siteId) {
6431
+ const response = await this.fetchRaw(`w/${wid}/sites/${siteId}/source/download`);
6432
+ return response.blob();
6433
+ }
6434
+ /**
6435
+ * Replace the site's source tree with the contents of an uploaded ZIP
6436
+ * (clears the existing source first, like a reset that loads a template).
6437
+ */
6438
+ async importSiteSourceZip(wid, siteId, file) {
6439
+ const form = new FormData();
6440
+ form.append("file", file, "source.zip");
6441
+ return this.fetch(`w/${wid}/sites/${siteId}/source/import`, {
6442
+ method: "POST",
6443
+ body: form
6444
+ });
6445
+ }
6446
+ /**
6447
+ * Get a theme's settings schema, the site's saved values, and capabilities.
6448
+ * Pass `theme` to resolve the schema for a theme other than the saved one
6449
+ * (e.g. one the builder has selected but not yet saved).
6450
+ */
6451
+ async getThemeSettings(wid, siteId, theme) {
6452
+ const query = theme ? `?theme=${encodeURIComponent(theme)}` : "";
6453
+ return this.fetch(`w/${wid}/sites/${siteId}/theme-settings${query}`);
6454
+ }
6455
+ /** Save values for the active theme's settings (validated against the schema). */
6456
+ async updateThemeSettings(wid, siteId, values) {
6457
+ return this.fetch(`w/${wid}/sites/${siteId}/theme-settings`, {
6458
+ method: "PUT",
6459
+ body: JSON.stringify({ values })
6460
+ });
6461
+ }
5967
6462
  /** Get a single site by UUID. */
5968
6463
  async getSiteByUuid(wid, uuid) {
5969
6464
  return this.fetch(`s/${wid}/${uuid}`);
@@ -6152,6 +6647,28 @@ var SubscriptionsApi = class extends BaseApiClient {
6152
6647
  async getSubscriptions() {
6153
6648
  return this.fetch("subscriptions");
6154
6649
  }
6650
+ /**
6651
+ * Create a Stripe Checkout session to purchase an organization plan.
6652
+ * Returns the checkout URL to open in a browser. The organization, billing
6653
+ * customer, and subscription are created on payment by the checkout
6654
+ * completion handler.
6655
+ */
6656
+ async createCheckoutSession(productId, planPeriod = "month") {
6657
+ return this.fetch(`subscriptions/checkout-session`, {
6658
+ method: "POST",
6659
+ credentials: "include",
6660
+ body: JSON.stringify({ productId, planPeriod }),
6661
+ headers: { "Content-Type": "application/json" }
6662
+ });
6663
+ }
6664
+ /**
6665
+ * List self-service, purchasable plans (org or workspace). Only plans with a
6666
+ * paid Stripe price are returned. No auth required.
6667
+ */
6668
+ async listSelfServeProducts(productType) {
6669
+ const qs = productType ? `?product_type=${productType}` : "";
6670
+ return this.fetch(`products/self-service${qs}`);
6671
+ }
6155
6672
  /** List all subscriptions associated with a workspace. */
6156
6673
  async getWorkspaceSubscriptions(wid) {
6157
6674
  return this.fetch(`w/${wid}/subscriptions`);
@@ -6192,6 +6709,10 @@ var SubscriptionsApi = class extends BaseApiClient {
6192
6709
  }
6193
6710
  });
6194
6711
  }
6712
+ /** List line items for a subscription. */
6713
+ async getSubscriptionItems(subscriptionId) {
6714
+ return this.fetch(`subscriptions/${subscriptionId}/items`);
6715
+ }
6195
6716
  /** Purchase extra credits on a subscription (org-level). */
6196
6717
  async purchaseCredits(subscriptionId, amountCents) {
6197
6718
  return this.fetch(`subscriptions/${subscriptionId}/purchase-credits`, {
@@ -6293,6 +6814,16 @@ var SupportRequestsApi = class extends BaseApiClient {
6293
6814
  body: JSON.stringify(data)
6294
6815
  });
6295
6816
  }
6817
+ /**
6818
+ * Reopen a resolved support request (e.g. staff resolved it prematurely).
6819
+ * The server rejects requests that are not in the `resolved` state.
6820
+ */
6821
+ async reopenWorkspaceSupportRequest(workspaceUuid, uuid, data = {}) {
6822
+ return this.fetch(`w/${workspaceUuid}/support-requests/${uuid}/reopen`, {
6823
+ method: "POST",
6824
+ body: JSON.stringify(data)
6825
+ });
6826
+ }
6296
6827
  /**
6297
6828
  * Record a click on a pushed resource (Proactive Support). For a
6298
6829
  * manager_prompt, pass the Manager Chat UUID it opened so the
@@ -6447,6 +6978,12 @@ var TasksApi = class extends BaseApiClient {
6447
6978
  if (options.workflowId) {
6448
6979
  params.append("workflow_id", options.workflowId.toString());
6449
6980
  }
6981
+ if (options.sortBy) {
6982
+ params.append("sortBy", options.sortBy);
6983
+ }
6984
+ if (options.sortOrder) {
6985
+ params.append("sortOrder", options.sortOrder);
6986
+ }
6450
6987
  return this.fetch(
6451
6988
  `w/${wid}/tasks${params.toString() ? `?${params.toString()}` : ""}`
6452
6989
  );
@@ -6817,9 +7354,17 @@ var WorkflowsApi = class extends BaseApiClient {
6817
7354
  `w/${wid}/workflows/activity/batch?${params.toString()}`
6818
7355
  );
6819
7356
  }
6820
- /** Get the Mermaid diagram representation of a workflow. */
6821
- async getWorkflowDiagram(wid, id) {
6822
- return this.fetch(`w/${wid}/workflows/${id}/diagram`);
7357
+ /**
7358
+ * Get the Mermaid diagram representation of a workflow.
7359
+ *
7360
+ * By default only active tasks are rendered. Pass `includeArchived: true`
7361
+ * to also render archived tasks (distinctly styled). `taskCount` is always
7362
+ * the total (active + archived); `archivedTaskCount` breaks out the archived
7363
+ * portion so the active count can be derived.
7364
+ */
7365
+ async getWorkflowDiagram(wid, id, options = {}) {
7366
+ const query = options.includeArchived ? "?include_archived=true" : "";
7367
+ return this.fetch(`w/${wid}/workflows/${id}/diagram${query}`);
6823
7368
  }
6824
7369
  /**
6825
7370
  * Get workflow thumbnail URL.
@@ -7213,6 +7758,20 @@ var BulkMemberResultStatus = {
7213
7758
  updated: "updated",
7214
7759
  failed: "failed"
7215
7760
  };
7761
+ var MemberImportMatchInfoMatchType = {
7762
+ external_id: "external_id",
7763
+ email: "email",
7764
+ phone: "phone",
7765
+ account_email: "account_email",
7766
+ account_phone: "account_phone"
7767
+ };
7768
+ var MemberImportPreviewRowAction = {
7769
+ create: "create",
7770
+ update: "update",
7771
+ unchanged: "unchanged",
7772
+ conflict: "conflict",
7773
+ error: "error"
7774
+ };
7216
7775
 
7217
7776
  // src/types/member-types.ts
7218
7777
  var MemberType = /* @__PURE__ */ ((MemberType2) => {
@@ -7256,6 +7815,9 @@ var EventRuleObjectType = /* @__PURE__ */ ((EventRuleObjectType2) => {
7256
7815
  })(EventRuleObjectType || {});
7257
7816
  var EventRuleEventType = /* @__PURE__ */ ((EventRuleEventType2) => {
7258
7817
  EventRuleEventType2["TASK_EXECUTE"] = "task:execute";
7818
+ EventRuleEventType2["TASK_ENTER"] = "task:enter";
7819
+ EventRuleEventType2["TASK_COMMAND"] = "task:command";
7820
+ EventRuleEventType2["TASK_EXIT"] = "task:exit";
7259
7821
  EventRuleEventType2["MEMBER_JOINED"] = "workspace:member_joined";
7260
7822
  EventRuleEventType2["MEMBER_LEFT"] = "workspace:member_left";
7261
7823
  EventRuleEventType2["DATA_RECORD_CREATED"] = "data_record:created";
@@ -7289,6 +7851,7 @@ var EventRuleActionType = /* @__PURE__ */ ((EventRuleActionType2) => {
7289
7851
  EventRuleActionType2["SWITCH_TASK_ACTION"] = "task:switch";
7290
7852
  EventRuleActionType2["ASSISTANT_MESSAGE"] = "assistant:message";
7291
7853
  EventRuleActionType2["FORM_FIELD_UPDATE"] = "form:update_field";
7854
+ EventRuleActionType2["CEL_MUTATE"] = "record:cel_mutate";
7292
7855
  EventRuleActionType2["MESSAGE_VALIDATION"] = "message:validation";
7293
7856
  EventRuleActionType2["CHAT_CREATE"] = "chat:create";
7294
7857
  EventRuleActionType2["CHAT_CONTINUE"] = "chat:continue";
@@ -7421,6 +7984,12 @@ var InvitationStatus = /* @__PURE__ */ ((InvitationStatus2) => {
7421
7984
  return InvitationStatus2;
7422
7985
  })(InvitationStatus || {});
7423
7986
 
7987
+ // src/types/generated/data.ts
7988
+ var DataRecordRetirementResponseReason = {
7989
+ monday_item_archived: "monday_item_archived",
7990
+ monday_item_deleted: "monday_item_deleted"
7991
+ };
7992
+
7424
7993
  // src/types/data-types.ts
7425
7994
  var DataFieldType = /* @__PURE__ */ ((DataFieldType2) => {
7426
7995
  DataFieldType2["ENUM"] = "enum";
@@ -7482,7 +8051,6 @@ var ModelProvider = {
7482
8051
  aws: "aws",
7483
8052
  elevenlabs: "elevenlabs",
7484
8053
  deepgram: "deepgram",
7485
- pocket: "pocket",
7486
8054
  xai: "xai",
7487
8055
  custom: "custom"
7488
8056
  };
@@ -7512,7 +8080,10 @@ var TTS_MODEL_ELEVENLABS_MULTILINGUAL = "elevenlabs:tts:eleven_multilingual_v2";
7512
8080
  var TTS_MODEL_DEEPGRAM_AURA_2 = "deepgram:tts:aura-2";
7513
8081
  var TTS_MODEL_AWS_POLLY_GENERATIVE = "aws:tts:polly-generative";
7514
8082
  var TTS_MODEL_AWS_POLLY_NEURAL = "aws:tts:polly-neural";
7515
- var TTS_MODEL_POCKET = "pocket:tts:default";
8083
+
8084
+ // src/types/pids-types.ts
8085
+ var PIDS_DISPOSITIONS = ["true_positive", "false_positive", "needs_more_context"];
8086
+ var PIDS_SOURCES = ["scheduled", "backfill", "pre_llm"];
7516
8087
 
7517
8088
  // src/types/calendar-types.ts
7518
8089
  var CalendarPermissionType = /* @__PURE__ */ ((CalendarPermissionType2) => {
@@ -8181,6 +8752,7 @@ function createApiModules(apiKey, baseUrl, customFetch) {
8181
8752
  events: new EventsApi(apiKey, baseUrl, customFetch),
8182
8753
  experiments: new ExperimentsApi(apiKey, baseUrl, customFetch),
8183
8754
  fhirConnections: new FhirConnectionsApi(apiKey, baseUrl, customFetch),
8755
+ patientSyncConnections: new PatientSyncConnectionsApi(apiKey, baseUrl, customFetch),
8184
8756
  healthie: new HealthieApi(apiKey, baseUrl, customFetch),
8185
8757
  hubspot: new HubspotApi(apiKey, baseUrl, customFetch),
8186
8758
  features: new FeaturesApi(apiKey, baseUrl, customFetch),
@@ -8204,6 +8776,7 @@ function createApiModules(apiKey, baseUrl, customFetch) {
8204
8776
  pronunciations: new PronunciationsApi(apiKey, baseUrl, customFetch),
8205
8777
  qualifications: new QualificationsApi(apiKey, baseUrl, customFetch),
8206
8778
  personas: new PersonasApi(apiKey, baseUrl, customFetch),
8779
+ queries: new QueriesApi(apiKey, baseUrl, customFetch),
8207
8780
  reports: new ReportsApi(apiKey, baseUrl, customFetch),
8208
8781
  salesforce: new SalesforceApi(apiKey, baseUrl, customFetch),
8209
8782
  sites: new SitesApi(apiKey, baseUrl, customFetch),
@@ -8248,6 +8821,7 @@ var WORKSPACE_METHOD_NAMES = [
8248
8821
  "cancelAgentTask",
8249
8822
  "cancelAssignment",
8250
8823
  "cancelCalendarEvent",
8824
+ "cancelChatCallback",
8251
8825
  "cancelCredentialUpdateInvite",
8252
8826
  "checkAvailability",
8253
8827
  "checkSiteDomainAvailability",
@@ -8262,12 +8836,14 @@ var WORKSPACE_METHOD_NAMES = [
8262
8836
  "commentOnWorkspaceSupportRequest",
8263
8837
  "configureConfluence",
8264
8838
  "configureHealthie",
8839
+ "configurePatientSync",
8265
8840
  "configureHubspot",
8266
8841
  "configureMondayConnection",
8267
8842
  "configureSalesforce",
8268
8843
  "convertEmail",
8269
8844
  "convertFile",
8270
8845
  "crawlSite",
8846
+ "createAbility",
8271
8847
  "createAccessGrant",
8272
8848
  "createAgent",
8273
8849
  "createApiKey",
@@ -8291,6 +8867,7 @@ var WORKSPACE_METHOD_NAMES = [
8291
8867
  "createExperiment",
8292
8868
  "createExperimentAssignment",
8293
8869
  "createExperimentGroup",
8870
+ "convertMemberFilterToQuery",
8294
8871
  "createFhirConnection",
8295
8872
  "createFile",
8296
8873
  "createFileLabel",
@@ -8331,6 +8908,7 @@ var WORKSPACE_METHOD_NAMES = [
8331
8908
  "createWorkspaceMember",
8332
8909
  "createWorkspaceSupportRequest",
8333
8910
  "deactivateWorkflowVersion",
8911
+ "deleteAbility",
8334
8912
  "deleteAgent",
8335
8913
  "deleteAssignment",
8336
8914
  "deleteCalendar",
@@ -8354,6 +8932,7 @@ var WORKSPACE_METHOD_NAMES = [
8354
8932
  "deleteExperimentAssignment",
8355
8933
  "deleteExperimentGroup",
8356
8934
  "deleteFhirConnection",
8935
+ "deletePatientSyncConnection",
8357
8936
  "deleteFile",
8358
8937
  "deleteFileLabel",
8359
8938
  "deleteFolder",
@@ -8454,6 +9033,7 @@ var WORKSPACE_METHOD_NAMES = [
8454
9033
  "generateICalToken",
8455
9034
  "generateSiteMediaUploadUrl",
8456
9035
  "getAIUsageReport",
9036
+ "getAbilityType",
8457
9037
  "getAbilityTypes",
8458
9038
  "getAccessGrant",
8459
9039
  "getAccessGrants",
@@ -8488,6 +9068,7 @@ var WORKSPACE_METHOD_NAMES = [
8488
9068
  "getCelContext",
8489
9069
  "getChat",
8490
9070
  "getChatAssignmentTasks",
9071
+ "getChatCallbacks",
8491
9072
  "getChatEmails",
8492
9073
  "getChatFilter",
8493
9074
  "getChatFilterByUuid",
@@ -8554,6 +9135,7 @@ var WORKSPACE_METHOD_NAMES = [
8554
9135
  "getHealthieAvailableSlots",
8555
9136
  "getHealthieReconciliationMatches",
8556
9137
  "getHealthieStatus",
9138
+ "getPatientSyncStatus",
8557
9139
  "getHubspotContactProperties",
8558
9140
  "getHubspotManagedRules",
8559
9141
  "getHubspotReconciliationMatches",
@@ -8599,6 +9181,7 @@ var WORKSPACE_METHOD_NAMES = [
8599
9181
  "getMemberRole",
8600
9182
  "getMemberRoleByUuid",
8601
9183
  "getMemberRoles",
9184
+ "getMemberSyncLinks",
8602
9185
  "getMemberSyncSummary",
8603
9186
  "getMemberUsage",
8604
9187
  "getMembersMessageActivity",
@@ -8741,11 +9324,14 @@ var WORKSPACE_METHOD_NAMES = [
8741
9324
  "linkMemberToMonday",
8742
9325
  "linkMemberToSalesforce",
8743
9326
  "linkPhoneNumber",
9327
+ "listAbilities",
9328
+ "listAgentAbilities",
8744
9329
  "listAppConnections",
8745
9330
  "listAvailableAppConnections",
8746
9331
  "listConfluencePages",
8747
9332
  "listConfluenceSpaces",
8748
9333
  "listConnectionMemberFieldKeys",
9334
+ "setDefaultGooglePlatformAccount",
8749
9335
  "listGoogleCalendars",
8750
9336
  "listHealthieAppointmentTypes",
8751
9337
  "listHealthiePatients",
@@ -8760,6 +9346,7 @@ var WORKSPACE_METHOD_NAMES = [
8760
9346
  "markEmailAsRead",
8761
9347
  "markEmailAsUnread",
8762
9348
  "markNotificationAsRead",
9349
+ "previewImportMembers",
8763
9350
  "previewImportWorkspace",
8764
9351
  "previewSchedule",
8765
9352
  "previewTTS",
@@ -8834,6 +9421,7 @@ var WORKSPACE_METHOD_NAMES = [
8834
9421
  "unlinkMemberFromMonday",
8835
9422
  "unlinkMemberFromSalesforce",
8836
9423
  "unregisterPushSubscription",
9424
+ "updateAbility",
8837
9425
  "updateAgent",
8838
9426
  "updateAssignment",
8839
9427
  "updateCalendar",
@@ -8960,6 +9548,7 @@ function bindAgentsMethods(target, agents) {
8960
9548
  target.archiveAgent = agents.archiveAgent.bind(agents);
8961
9549
  target.unarchiveAgent = agents.unarchiveAgent.bind(agents);
8962
9550
  target.resolveAgentTools = agents.resolveAgentTools.bind(agents);
9551
+ target.listAgentAbilities = agents.listAgentAbilities.bind(agents);
8963
9552
  }
8964
9553
 
8965
9554
  // src/client/bindings/tasks.ts
@@ -8973,12 +9562,19 @@ function bindTasksMethods(target, tasks, abilities) {
8973
9562
  target.unarchiveTask = tasks.unarchiveTask.bind(tasks);
8974
9563
  target.cloneTask = tasks.cloneTask.bind(tasks);
8975
9564
  target.getAbilityTypes = abilities.getAbilityTypes.bind(abilities);
9565
+ target.getAbilityType = abilities.getAbilityType.bind(abilities);
9566
+ target.listAbilities = abilities.listAbilities.bind(abilities);
9567
+ target.createAbility = abilities.createAbility.bind(abilities);
9568
+ target.updateAbility = abilities.updateAbility.bind(abilities);
9569
+ target.deleteAbility = abilities.deleteAbility.bind(abilities);
8976
9570
  }
8977
9571
 
8978
9572
  // src/client/bindings/chats.ts
8979
9573
  function bindChatsMethods(target, chats) {
8980
9574
  target.getChats = chats.getChats.bind(chats);
8981
9575
  target.getChat = chats.getChat.bind(chats);
9576
+ target.getChatCallbacks = chats.getChatCallbacks.bind(chats);
9577
+ target.cancelChatCallback = chats.cancelChatCallback.bind(chats);
8982
9578
  target.getChatTokenUsage = chats.getChatTokenUsage.bind(chats);
8983
9579
  target.getChatTodos = chats.getChatTodos.bind(chats);
8984
9580
  target.getChatSkills = chats.getChatSkills.bind(chats);
@@ -9028,6 +9624,8 @@ function bindCallsMethods(target, calls, cel) {
9028
9624
  target.initiateCall = calls.initiateCall.bind(calls);
9029
9625
  target.getVoiceToken = calls.getVoiceToken.bind(calls);
9030
9626
  target.getMessageTiming = calls.getMessageTiming.bind(calls);
9627
+ target.listChatRecordings = calls.listChatRecordings.bind(calls);
9628
+ target.getCallRecordingDownloadUrl = calls.getCallRecordingDownloadUrl.bind(calls);
9031
9629
  target.getCelContext = cel.getCelContext.bind(cel);
9032
9630
  }
9033
9631
 
@@ -9070,6 +9668,9 @@ function bindMembersMethods(target, members) {
9070
9668
  target.deleteMember = members.deleteMember.bind(members);
9071
9669
  target.archiveMember = members.archiveMember.bind(members);
9072
9670
  target.unarchiveMember = members.unarchiveMember.bind(members);
9671
+ target.sendMemberPhoneConfirmation = members.sendMemberPhoneConfirmation.bind(members);
9672
+ target.bulkCreateMembers = members.bulkCreateMembers.bind(members);
9673
+ target.previewImportMembers = members.previewImportMembers.bind(members);
9073
9674
  target.importMembers = members.importMembers.bind(members);
9074
9675
  target.exportMembers = members.exportMembers.bind(members);
9075
9676
  target.getMembersMessageActivity = members.getMembersMessageActivity.bind(members);
@@ -9077,6 +9678,7 @@ function bindMembersMethods(target, members) {
9077
9678
  target.getMemberFilter = members.getMemberFilter.bind(members);
9078
9679
  target.createMemberFilter = members.createMemberFilter.bind(members);
9079
9680
  target.updateMemberFilter = members.updateMemberFilter.bind(members);
9681
+ target.convertMemberFilterToQuery = members.convertMemberFilterToQuery.bind(members);
9080
9682
  target.deleteMemberFilter = members.deleteMemberFilter.bind(members);
9081
9683
  target.getMemberFilterCount = members.getMemberFilterCount.bind(members);
9082
9684
  target.getMemberLabels = members.getMemberLabels.bind(members);
@@ -9106,6 +9708,7 @@ function bindMembersMethods(target, members) {
9106
9708
  target.getMemberMemories = members.getMemberMemories.bind(members);
9107
9709
  target.createMemberMemory = members.createMemberMemory.bind(members);
9108
9710
  target.deleteMemberMemory = members.deleteMemberMemory.bind(members);
9711
+ target.getMemberSyncLinks = members.getMemberSyncLinks.bind(members);
9109
9712
  }
9110
9713
 
9111
9714
  // src/client/bindings/workspaces.ts
@@ -9239,6 +9842,19 @@ function bindSitesMethods(target, sites) {
9239
9842
  target.checkSiteSlugAvailability = sites.checkSiteSlugAvailability.bind(sites);
9240
9843
  target.checkSiteDomainAvailability = sites.checkSiteDomainAvailability.bind(sites);
9241
9844
  target.getSite = sites.getSite.bind(sites);
9845
+ target.getSiteSharing = sites.getSiteSharing.bind(sites);
9846
+ target.updateSiteSharing = sites.updateSiteSharing.bind(sites);
9847
+ target.getSiteSource = sites.getSiteSource.bind(sites);
9848
+ target.getSiteSourceTemplates = sites.getSiteSourceTemplates.bind(sites);
9849
+ target.createSiteSource = sites.createSiteSource.bind(sites);
9850
+ target.buildSiteSource = sites.buildSiteSource.bind(sites);
9851
+ target.publishSiteSource = sites.publishSiteSource.bind(sites);
9852
+ target.resetSiteSource = sites.resetSiteSource.bind(sites);
9853
+ target.rollbackSiteSource = sites.rollbackSiteSource.bind(sites);
9854
+ target.downloadSiteSourceZip = sites.downloadSiteSourceZip.bind(sites);
9855
+ target.importSiteSourceZip = sites.importSiteSourceZip.bind(sites);
9856
+ target.getThemeSettings = sites.getThemeSettings.bind(sites);
9857
+ target.updateThemeSettings = sites.updateThemeSettings.bind(sites);
9242
9858
  target.getSiteByUuid = sites.getSiteByUuid.bind(sites);
9243
9859
  target.getSiteRenderedPage = sites.getSiteRenderedPage.bind(sites);
9244
9860
  target.getSiteRenderedMenu = sites.getSiteRenderedMenu.bind(sites);
@@ -9271,6 +9887,7 @@ function bindSitesMethods(target, sites) {
9271
9887
  function bindFilesMethods(target, files) {
9272
9888
  target.getFiles = files.getFiles.bind(files);
9273
9889
  target.getFile = files.getFile.bind(files);
9890
+ target.downloadFilesZip = files.downloadFilesZip.bind(files);
9274
9891
  target.createFile = files.createFile.bind(files);
9275
9892
  target.uploadFile = files.uploadFile.bind(files);
9276
9893
  target.updateFile = files.updateFile.bind(files);
@@ -9312,6 +9929,7 @@ function bindEventsMethods(target, events) {
9312
9929
  target.createEventRule = events.createEventRule.bind(events);
9313
9930
  target.updateEventRule = events.updateEventRule.bind(events);
9314
9931
  target.deleteEventRule = events.deleteEventRule.bind(events);
9932
+ target.testWebhook = events.testWebhook.bind(events);
9315
9933
  target.reorderEventRules = events.reorderEventRules.bind(events);
9316
9934
  target.getWebhookLogs = events.getWebhookLogs.bind(events);
9317
9935
  target.getRuleExecutions = events.getRuleExecutions.bind(events);
@@ -9527,6 +10145,8 @@ function bindBillingMethods(target, apiKeys, subscriptions, reports) {
9527
10145
  target.updateSubscription = subscriptions.updateSubscription.bind(subscriptions);
9528
10146
  target.addWorkspaceToSubscription = subscriptions.addWorkspaceToSubscription.bind(subscriptions);
9529
10147
  target.purchaseCredits = subscriptions.purchaseCredits.bind(subscriptions);
10148
+ target.createCheckoutSession = subscriptions.createCheckoutSession.bind(subscriptions);
10149
+ target.listSelfServeProducts = subscriptions.listSelfServeProducts.bind(subscriptions);
9530
10150
  target.getAIUsageReport = reports.getAIUsageReport.bind(reports);
9531
10151
  target.getSMSUsageReport = reports.getSMSUsageReport.bind(reports);
9532
10152
  target.getPhoneUsageReport = reports.getPhoneUsageReport.bind(reports);
@@ -9560,12 +10180,13 @@ function bindAppsMethods(target, apps, builders, inquiries, oauth, oauthConnecti
9560
10180
  target.exchangeOAuthToken = oauth.exchangeOAuthToken.bind(oauth);
9561
10181
  target.getAvailableScopes = oauth.getAvailableScopes.bind(oauth);
9562
10182
  target.getOAuthConnectionStatus = oauthConnections.getConnectionStatus.bind(oauthConnections);
10183
+ target.listOAuthAccounts = oauthConnections.listAccounts.bind(oauthConnections);
9563
10184
  target.getOAuthAuthorizationUrl = oauthConnections.getAuthorizationUrl.bind(oauthConnections);
9564
10185
  target.disconnectOAuthProvider = oauthConnections.disconnect.bind(oauthConnections);
9565
10186
  }
9566
10187
 
9567
10188
  // src/client/bindings/integrations.ts
9568
- function bindIntegrationsMethods(target, mondayIntegration, discordBots, slackApps, teamsApps, fhirConnections, healthie, salesforce, hubspot, appConnections, connectionSync, confluence) {
10189
+ function bindIntegrationsMethods(target, mondayIntegration, discordBots, slackApps, teamsApps, fhirConnections, patientSyncConnections, healthie, salesforce, hubspot, appConnections, connectionSync, confluence) {
9569
10190
  target.getMondayBoards = mondayIntegration.getBoards.bind(mondayIntegration);
9570
10191
  target.getMondayBoardColumns = mondayIntegration.getBoardColumns.bind(mondayIntegration);
9571
10192
  target.getMondayBoardGroups = mondayIntegration.getBoardGroups.bind(mondayIntegration);
@@ -9650,6 +10271,9 @@ function bindIntegrationsMethods(target, mondayIntegration, discordBots, slackAp
9650
10271
  target.fhirGetEncounterSyncRuns = fhirConnections.fhirGetEncounterSyncRuns.bind(fhirConnections);
9651
10272
  target.fhirRefreshEncounterPatient = fhirConnections.fhirRefreshEncounterPatient.bind(fhirConnections);
9652
10273
  target.fhirBackfillEncounterSync = fhirConnections.fhirBackfillEncounterSync.bind(fhirConnections);
10274
+ target.configurePatientSync = patientSyncConnections.configurePatientSync.bind(patientSyncConnections);
10275
+ target.getPatientSyncStatus = patientSyncConnections.getPatientSyncStatus.bind(patientSyncConnections);
10276
+ target.deletePatientSyncConnection = patientSyncConnections.deletePatientSyncConnection.bind(patientSyncConnections);
9653
10277
  target.configureHealthie = healthie.configureHealthie.bind(healthie);
9654
10278
  target.getHealthieStatus = healthie.getHealthieStatus.bind(healthie);
9655
10279
  target.listHealthieProviders = healthie.listHealthieProviders.bind(healthie);
@@ -9724,6 +10348,7 @@ function bindIntegrationsMethods(target, mondayIntegration, discordBots, slackAp
9724
10348
  target.updatePlatformApp = appConnections.updatePlatformApp.bind(appConnections);
9725
10349
  target.deletePlatformApp = appConnections.deletePlatformApp.bind(appConnections);
9726
10350
  target.listConnectionMemberFieldKeys = appConnections.listConnectionMemberFieldKeys.bind(appConnections);
10351
+ target.setDefaultGooglePlatformAccount = appConnections.setDefaultGooglePlatformAccount.bind(appConnections);
9727
10352
  }
9728
10353
 
9729
10354
  // src/client/bindings/operator-groups.ts
@@ -9761,6 +10386,8 @@ function bindOrgMethods(target, org) {
9761
10386
  target.updateBusinessProfile = org.updateBusinessProfile.bind(org);
9762
10387
  target.submitBusinessProfile = org.submitBusinessProfile.bind(org);
9763
10388
  target.cancelBusinessProfile = org.cancelBusinessProfile.bind(org);
10389
+ target.createOrganizationWorkspace = org.createOrganizationWorkspace.bind(org);
10390
+ target.getOrgBillingCustomer = org.getOrgBillingCustomer.bind(org);
9764
10391
  }
9765
10392
 
9766
10393
  // src/client/bindings/pronunciations.ts
@@ -9840,6 +10467,14 @@ function bindPersonasMethods(target, personas) {
9840
10467
  target.deletePersona = personas.deletePersona.bind(personas);
9841
10468
  }
9842
10469
 
10470
+ // src/client/bindings/queries.ts
10471
+ function bindQueriesMethods(target, queries) {
10472
+ target.getQueryFields = queries.getQueryFields.bind(queries);
10473
+ target.validateQuery = queries.validateQuery.bind(queries);
10474
+ target.previewQuery = queries.previewQuery.bind(queries);
10475
+ target.runQuery = queries.runQuery.bind(queries);
10476
+ }
10477
+
9843
10478
  // src/client/bindings/customers.ts
9844
10479
  function bindCustomersMethods(target, customers) {
9845
10480
  target.getMyCustomers = customers.getMyCustomers.bind(customers);
@@ -9886,6 +10521,7 @@ function bindSupportRequestMethods(target, supportRequests) {
9886
10521
  target.createWorkspaceSupportRequest = supportRequests.createWorkspaceSupportRequest.bind(supportRequests);
9887
10522
  target.commentOnWorkspaceSupportRequest = supportRequests.commentOnWorkspaceSupportRequest.bind(supportRequests);
9888
10523
  target.closeWorkspaceSupportRequest = supportRequests.closeWorkspaceSupportRequest.bind(supportRequests);
10524
+ target.reopenWorkspaceSupportRequest = supportRequests.reopenWorkspaceSupportRequest.bind(supportRequests);
9889
10525
  target.clickWorkspaceSupportRequestResource = supportRequests.clickWorkspaceSupportRequestResource.bind(supportRequests);
9890
10526
  }
9891
10527
 
@@ -9905,9 +10541,16 @@ var GravityRailClient = class {
9905
10541
  unarchiveTask;
9906
10542
  cloneTask;
9907
10543
  getAbilityTypes;
10544
+ getAbilityType;
10545
+ listAbilities;
10546
+ createAbility;
10547
+ updateAbility;
10548
+ deleteAbility;
9908
10549
  // Chats API
9909
10550
  getChats;
9910
10551
  getChat;
10552
+ getChatCallbacks;
10553
+ cancelChatCallback;
9911
10554
  getChatTokenUsage;
9912
10555
  getChatTodos;
9913
10556
  getChatSkills;
@@ -9954,6 +10597,8 @@ var GravityRailClient = class {
9954
10597
  initiateCall;
9955
10598
  getVoiceToken;
9956
10599
  getMessageTiming;
10600
+ listChatRecordings;
10601
+ getCallRecordingDownloadUrl;
9957
10602
  getCelContext;
9958
10603
  // Data Types API
9959
10604
  getDataTypes;
@@ -9990,6 +10635,9 @@ var GravityRailClient = class {
9990
10635
  deleteMember;
9991
10636
  archiveMember;
9992
10637
  unarchiveMember;
10638
+ sendMemberPhoneConfirmation;
10639
+ bulkCreateMembers;
10640
+ previewImportMembers;
9993
10641
  importMembers;
9994
10642
  exportMembers;
9995
10643
  getMembersMessageActivity;
@@ -9997,6 +10645,7 @@ var GravityRailClient = class {
9997
10645
  getMemberFilter;
9998
10646
  createMemberFilter;
9999
10647
  updateMemberFilter;
10648
+ convertMemberFilterToQuery;
10000
10649
  deleteMemberFilter;
10001
10650
  getMemberFilterCount;
10002
10651
  getMemberLabels;
@@ -10030,6 +10679,8 @@ var GravityRailClient = class {
10030
10679
  getMemberMemories;
10031
10680
  createMemberMemory;
10032
10681
  deleteMemberMemory;
10682
+ // Member Sync Links
10683
+ getMemberSyncLinks;
10033
10684
  // Agent Tasks API (operator-facing async sub-agent inspection/cancel)
10034
10685
  getAgentTasks;
10035
10686
  getAgentTask;
@@ -10044,6 +10695,7 @@ var GravityRailClient = class {
10044
10695
  archiveAgent;
10045
10696
  unarchiveAgent;
10046
10697
  resolveAgentTools;
10698
+ listAgentAbilities;
10047
10699
  // Qualifications API
10048
10700
  getQualifications;
10049
10701
  getQualification;
@@ -10059,6 +10711,11 @@ var GravityRailClient = class {
10059
10711
  evaluateTestChatRun;
10060
10712
  endTestChatRun;
10061
10713
  // Personas API (workspace-scoped test-identity templates)
10714
+ // Unified Query Engine
10715
+ getQueryFields;
10716
+ validateQuery;
10717
+ previewQuery;
10718
+ runQuery;
10062
10719
  listPersonas;
10063
10720
  getPersona;
10064
10721
  createPersona;
@@ -10198,6 +10855,8 @@ var GravityRailClient = class {
10198
10855
  updateBusinessProfile;
10199
10856
  submitBusinessProfile;
10200
10857
  cancelBusinessProfile;
10858
+ createOrganizationWorkspace;
10859
+ getOrgBillingCustomer;
10201
10860
  getVapidPublicKey;
10202
10861
  registerPushSubscription;
10203
10862
  unregisterPushSubscription;
@@ -10275,6 +10934,19 @@ var GravityRailClient = class {
10275
10934
  checkSiteSlugAvailability;
10276
10935
  checkSiteDomainAvailability;
10277
10936
  getSite;
10937
+ getSiteSharing;
10938
+ updateSiteSharing;
10939
+ getSiteSource;
10940
+ getSiteSourceTemplates;
10941
+ createSiteSource;
10942
+ buildSiteSource;
10943
+ publishSiteSource;
10944
+ resetSiteSource;
10945
+ rollbackSiteSource;
10946
+ downloadSiteSourceZip;
10947
+ importSiteSourceZip;
10948
+ getThemeSettings;
10949
+ updateThemeSettings;
10278
10950
  getSiteByUuid;
10279
10951
  getSiteRenderedPage;
10280
10952
  getSiteRenderedMenu;
@@ -10304,6 +10976,7 @@ var GravityRailClient = class {
10304
10976
  // Files API
10305
10977
  getFiles;
10306
10978
  getFile;
10979
+ downloadFilesZip;
10307
10980
  createFile;
10308
10981
  uploadFile;
10309
10982
  updateFile;
@@ -10343,6 +11016,7 @@ var GravityRailClient = class {
10343
11016
  createEventRule;
10344
11017
  updateEventRule;
10345
11018
  deleteEventRule;
11019
+ testWebhook;
10346
11020
  reorderEventRules;
10347
11021
  getWebhookLogs;
10348
11022
  getRuleExecutions;
@@ -10526,6 +11200,8 @@ var GravityRailClient = class {
10526
11200
  updateSubscription;
10527
11201
  addWorkspaceToSubscription;
10528
11202
  purchaseCredits;
11203
+ createCheckoutSession;
11204
+ listSelfServeProducts;
10529
11205
  getAIUsageReport;
10530
11206
  getSMSUsageReport;
10531
11207
  getPhoneUsageReport;
@@ -10556,6 +11232,7 @@ var GravityRailClient = class {
10556
11232
  exchangeOAuthToken;
10557
11233
  getAvailableScopes;
10558
11234
  getOAuthConnectionStatus;
11235
+ listOAuthAccounts;
10559
11236
  getOAuthAuthorizationUrl;
10560
11237
  disconnectOAuthProvider;
10561
11238
  // Integrations API
@@ -10649,6 +11326,9 @@ var GravityRailClient = class {
10649
11326
  fhirRefreshEncounterPatient;
10650
11327
  fhirBackfillEncounterSync;
10651
11328
  // Healthie API
11329
+ configurePatientSync;
11330
+ getPatientSyncStatus;
11331
+ deletePatientSyncConnection;
10652
11332
  configureHealthie;
10653
11333
  getHealthieStatus;
10654
11334
  listHealthieProviders;
@@ -10728,6 +11408,7 @@ var GravityRailClient = class {
10728
11408
  updatePlatformApp;
10729
11409
  deletePlatformApp;
10730
11410
  listConnectionMemberFieldKeys;
11411
+ setDefaultGooglePlatformAccount;
10731
11412
  // Pronunciations API
10732
11413
  getPronunciationEntries;
10733
11414
  createPronunciationEntry;
@@ -10776,6 +11457,7 @@ var GravityRailClient = class {
10776
11457
  createWorkspaceSupportRequest;
10777
11458
  commentOnWorkspaceSupportRequest;
10778
11459
  closeWorkspaceSupportRequest;
11460
+ reopenWorkspaceSupportRequest;
10779
11461
  clickWorkspaceSupportRequestResource;
10780
11462
  constructor(apiKey, baseUrl, customFetch) {
10781
11463
  const apis = createApiModules(apiKey, baseUrl, customFetch);
@@ -10790,6 +11472,7 @@ var GravityRailClient = class {
10790
11472
  bindAgentsMethods(this, apis.agents);
10791
11473
  bindQualificationsMethods(this, apis.qualifications);
10792
11474
  bindPersonasMethods(this, apis.personas);
11475
+ bindQueriesMethods(this, apis.queries);
10793
11476
  bindJourneysMethods(this, apis.journeys);
10794
11477
  bindExperimentsMethods(this, apis.experiments);
10795
11478
  bindOperatorMethods(this, apis.operatorGroups);
@@ -10829,6 +11512,7 @@ var GravityRailClient = class {
10829
11512
  apis.slackApps,
10830
11513
  apis.teamsApps,
10831
11514
  apis.fhirConnections,
11515
+ apis.patientSyncConnections,
10832
11516
  apis.healthie,
10833
11517
  apis.salesforce,
10834
11518
  apis.hubspot,
@@ -10882,23 +11566,30 @@ var GravityRailClient = class {
10882
11566
  });
10883
11567
  }
10884
11568
  /**
10885
- * Set the org token for cross-domain / non-browser clients (e.g. CLI).
10886
- * When set, all API requests include the X-Org-Token header so the backend
10887
- * accepts the request without requiring a browser cookie.
11569
+ * Set the org session credential for cross-domain / non-browser clients (e.g. CLI).
11570
+ * Opaque gr_sess_ values use X-Org-Session. Legacy orgToken JWE values still
11571
+ * use X-Org-Token during the migration window.
10888
11572
  *
10889
- * `orgUuid` is the org that issued the token. Pass it so the SDK can
10890
- * detect a stale token (e.g. switching orgs mid-session) and re-fire the
11573
+ * `orgUuid` is the org that issued the session. Pass it so the SDK can
11574
+ * detect a stale session (e.g. switching orgs mid-session) and re-fire the
10891
11575
  * org-auth handler instead of silently 401-ing.
10892
11576
  *
10893
11577
  * Propagates to all API modules.
10894
11578
  */
10895
- setOrgToken(token, orgUuid) {
11579
+ setOrgSession(session, orgUuid) {
10896
11580
  Object.values(this.apis).forEach((api) => {
10897
- if (typeof api.setOrgToken === "function") {
10898
- api.setOrgToken(token, orgUuid);
11581
+ if (typeof api.setOrgSession === "function") {
11582
+ api.setOrgSession(session, orgUuid);
10899
11583
  }
10900
11584
  });
10901
11585
  }
11586
+ /**
11587
+ * @deprecated Legacy compatibility for stateless orgToken JWE credentials.
11588
+ * Prefer setOrgSession() for opaque org browser sessions.
11589
+ */
11590
+ setOrgToken(token, orgUuid) {
11591
+ this.setOrgSession(token, orgUuid);
11592
+ }
10902
11593
  /**
10903
11594
  * Update the API key across all modules.
10904
11595
  * Used after successful re-authentication.
@@ -10955,6 +11646,24 @@ var WorkspaceBuilderResource = class {
10955
11646
  _uuid;
10956
11647
  _created = false;
10957
11648
  _existed = false;
11649
+ /** Server-assigned numeric id — available after apply() or adopt(). */
11650
+ get id() {
11651
+ if (this._id === void 0) {
11652
+ throw new Error(
11653
+ `${this.constructor.name} has no id yet \u2014 ids are assigned during apply(). Pass the builder object itself where a reference is needed; refs resolve at apply time.`
11654
+ );
11655
+ }
11656
+ return this._id;
11657
+ }
11658
+ /** Server-assigned uuid — available after apply() or adopt(). */
11659
+ get uuid() {
11660
+ if (this._uuid === void 0) {
11661
+ throw new Error(
11662
+ `${this.constructor.name} has no uuid yet \u2014 uuids are assigned during apply(). Pass the builder object itself where a reference is needed; refs resolve at apply time.`
11663
+ );
11664
+ }
11665
+ return this._uuid;
11666
+ }
10958
11667
  matchKey() {
10959
11668
  return void 0;
10960
11669
  }
@@ -10985,6 +11694,7 @@ var MemberFilterBuilder = class extends WorkspaceBuilderResource {
10985
11694
  this.name = name;
10986
11695
  this.description = options.description ?? "";
10987
11696
  }
11697
+ name;
10988
11698
  description;
10989
11699
  rules = [];
10990
11700
  addRule(objectType, filterType, options = {}) {
@@ -11019,6 +11729,8 @@ var RoutineBuilder = class extends WorkspaceBuilderResource {
11019
11729
  this.active = options.active ?? false;
11020
11730
  this.description = options.description ?? "";
11021
11731
  }
11732
+ name;
11733
+ cronSchedule;
11022
11734
  active;
11023
11735
  description;
11024
11736
  rules = [];
@@ -11080,6 +11792,7 @@ var NotificationRuleBuilder = class extends WorkspaceBuilderResource {
11080
11792
  this.notifyEmail = Boolean(options.notifyEmail ?? options.notify_email);
11081
11793
  this.notifyVoice = Boolean(options.notifyVoice ?? options.notify_voice);
11082
11794
  }
11795
+ name;
11083
11796
  noticeType;
11084
11797
  memberId;
11085
11798
  workflow;
@@ -11304,6 +12017,11 @@ var JourneyStepBuilder = class extends WorkspaceBuilderResource {
11304
12017
  this.workflow = workflow;
11305
12018
  this.description = description;
11306
12019
  }
12020
+ name;
12021
+ journey;
12022
+ order;
12023
+ workflow;
12024
+ description;
11307
12025
  connections = [];
11308
12026
  connectsTo(child, condition, required = false, timeoutSeconds) {
11309
12027
  this.connections.push({ parent: this, child, condition, required, timeoutSeconds });
@@ -11332,6 +12050,7 @@ var JourneyBuilder = class extends WorkspaceBuilderResource {
11332
12050
  this.name = name;
11333
12051
  this.description = options.description ?? "";
11334
12052
  }
12053
+ name;
11335
12054
  description;
11336
12055
  steps = [];
11337
12056
  goals = [];
@@ -11402,6 +12121,9 @@ var RoleUpdate = class extends WorkspaceBuilderResource {
11402
12121
  this.workflowIds = workflowIds;
11403
12122
  this.dataTypeIds = dataTypeIds;
11404
12123
  }
12124
+ roleId;
12125
+ workflowIds;
12126
+ dataTypeIds;
11405
12127
  planLine() {
11406
12128
  const parts = [];
11407
12129
  if (this.workflowIds) parts.push(`workflows=${JSON.stringify(this.workflowIds)}`);
@@ -11448,6 +12170,7 @@ var AbilityDef = class {
11448
12170
  if (inputKey in options) this.perms[outputKey] = options[inputKey];
11449
12171
  }
11450
12172
  }
12173
+ abilityType;
11451
12174
  uuid = crypto.randomUUID();
11452
12175
  config;
11453
12176
  enabled;
@@ -11478,13 +12201,25 @@ var TaskBuilder = class extends WorkspaceBuilderResource {
11478
12201
  this.start = start;
11479
12202
  this.description = description;
11480
12203
  }
12204
+ name;
12205
+ workflow;
12206
+ prompt;
12207
+ start;
12208
+ description;
11481
12209
  transitions = [];
11482
12210
  eventRules = [];
11483
- transitionsTo(child, when, autoNext = false, required = false) {
12211
+ transitionsTo(child, when, autoNext = false, required = false, celCondition) {
11484
12212
  if (child === this) {
11485
12213
  throw new Error(`Task '${this.name}' cannot transition to itself`);
11486
12214
  }
11487
- this.transitions.push({ parent: this, child, when, autoNext, required });
12215
+ this.transitions.push({
12216
+ parent: this,
12217
+ child,
12218
+ when,
12219
+ autoNext,
12220
+ required,
12221
+ celCondition
12222
+ });
11488
12223
  return this;
11489
12224
  }
11490
12225
  onEnter(action, params = {}, name) {
@@ -11526,6 +12261,7 @@ var WorkflowBuilder = class extends WorkspaceBuilderResource {
11526
12261
  this.prompt = options.prompt;
11527
12262
  this.agentId = options.agentId ?? options.agent_id;
11528
12263
  }
12264
+ name;
11529
12265
  description;
11530
12266
  prompt;
11531
12267
  agentId;
@@ -11646,6 +12382,7 @@ var AgentBuilder = class extends WorkspaceBuilderResource {
11646
12382
  this.tools = options.tools ?? [];
11647
12383
  this.codeInterpreterEnabled = options.codeInterpreterEnabled ?? options.code_interpreter_enabled ?? false;
11648
12384
  }
12385
+ name;
11649
12386
  chatModelId;
11650
12387
  systemPrompt;
11651
12388
  memberRoleId;
@@ -11697,6 +12434,7 @@ var WorkspaceBuilder = class {
11697
12434
  constructor(client) {
11698
12435
  this.client = client;
11699
12436
  }
12437
+ client;
11700
12438
  resources = [];
11701
12439
  form(name, options = {}) {
11702
12440
  const form = new FormBuilder(name, options.slug, options);
@@ -11821,7 +12559,7 @@ ${"=".repeat(50)}`);
11821
12559
  writeLine(` Skipped: ${resource.planLine()}`);
11822
12560
  }
11823
12561
  } catch (err) {
11824
- writeLine(` FAILED: ${resource.planLine()}: ${summarizeError(err)}`);
12562
+ writeLine(formatApplyFailureLine(resource, err));
11825
12563
  throw new ApplyError(resource, err, summary);
11826
12564
  }
11827
12565
  }
@@ -11972,7 +12710,7 @@ Done! Created ${count} resources.`);
11972
12710
  {
11973
12711
  taskId,
11974
12712
  choicePrompt: transition.when,
11975
- celCondition: null,
12713
+ celCondition: transition.celCondition ?? null,
11976
12714
  autoNext: transition.autoNext,
11977
12715
  required: transition.required
11978
12716
  }
@@ -12078,16 +12816,21 @@ Done! Created ${count} resources.`);
12078
12816
  }
12079
12817
  };
12080
12818
  var ApplyError = class extends Error {
12819
+ createdSoFar;
12820
+ #resource;
12821
+ #cause;
12081
12822
  constructor(resource, cause, createdSoFar) {
12082
- super(
12083
- `Failed creating ${resource.planLine()}: ${summarizeError(cause)}
12084
- Already created: ${JSON.stringify(
12085
- createdSoFar
12086
- )}`
12087
- );
12088
- this.resource = resource;
12089
- this.cause = cause;
12823
+ super(formatApplyErrorMessage(resource, cause, createdSoFar));
12824
+ this.name = "ApplyError";
12090
12825
  this.createdSoFar = createdSoFar;
12826
+ this.#resource = resource;
12827
+ this.#cause = cause;
12828
+ }
12829
+ get resource() {
12830
+ return this.#resource;
12831
+ }
12832
+ get cause() {
12833
+ return this.#cause;
12091
12834
  }
12092
12835
  };
12093
12836
  function resourceKey(resource) {
@@ -12198,8 +12941,64 @@ function handleEventRuleApplyFailure(resourceName, err) {
12198
12941
  writeLine(` FAILED: Event rule on '${resourceName}': ${summary}`);
12199
12942
  throw new Error(`Failed wiring event rule on '${resourceName}': ${summary}`);
12200
12943
  }
12944
+ function writeScopeForResource(resource) {
12945
+ if (resource instanceof FormBuilder) return "datatypes:write";
12946
+ if (resource instanceof WorkflowBuilder || resource instanceof TaskBuilder) {
12947
+ return "workflows:write";
12948
+ }
12949
+ if (resource instanceof AgentBuilder) return "agents:write";
12950
+ if (resource instanceof MemberLabelBuilder || resource instanceof MemberFilterBuilder) {
12951
+ return "members:write";
12952
+ }
12953
+ if (resource instanceof RoutineBuilder || resource instanceof NotificationRuleBuilder) {
12954
+ return "automations:admin";
12955
+ }
12956
+ if (resource instanceof JourneyBuilder || resource instanceof JourneyStepBuilder) {
12957
+ return "journeys:write";
12958
+ }
12959
+ if (resource instanceof RoleUpdate) return "member_roles:write";
12960
+ return null;
12961
+ }
12962
+ function scopeRetryHint(resource) {
12963
+ const scope = writeScopeForResource(resource);
12964
+ return scope ? ` (retry exec with scopes=['${scope}'])` : "";
12965
+ }
12966
+ function formatApplyFailureLine(resource, err) {
12967
+ const line = ` FAILED: ${resource.planLine()}: ${summarizeError(err)}`;
12968
+ return hasStatus(err, 403) ? `${line}${scopeRetryHint(resource)}` : line;
12969
+ }
12970
+ function formatApplyErrorMessage(resource, cause, createdSoFar) {
12971
+ let message = `Failed creating ${resource.planLine()}: ${summarizeError(cause)}`;
12972
+ if (hasStatus(cause, 403)) {
12973
+ const scope = writeScopeForResource(resource);
12974
+ if (scope) {
12975
+ message += `
12976
+ Retry exec with scopes=['${scope}']`;
12977
+ }
12978
+ }
12979
+ const createdKeys = Object.keys(createdSoFar);
12980
+ if (createdKeys.length > 0) {
12981
+ message += `
12982
+ Already created: ${JSON.stringify(createdSoFar)}`;
12983
+ }
12984
+ return message;
12985
+ }
12201
12986
  function summarizeError(err) {
12202
- if (err instanceof Error) return err.name || "Error";
12987
+ if (hasStatus(err, 403)) {
12988
+ return "Insufficient permissions for this operation";
12989
+ }
12990
+ if (err instanceof ApiError) {
12991
+ const msg = err.message.trim();
12992
+ const availableTypesIdx = msg.indexOf("Available types:");
12993
+ if (availableTypesIdx !== -1) {
12994
+ const head = msg.slice(0, availableTypesIdx).trim().replace(/\.$/, "");
12995
+ return head ? `${head}.` : "Request failed";
12996
+ }
12997
+ return msg.length > 240 ? `${msg.slice(0, 237)}...` : msg;
12998
+ }
12999
+ if (err instanceof Error) {
13000
+ return err.name || "Error";
13001
+ }
12203
13002
  return typeof err;
12204
13003
  }
12205
13004
  function hasStatus(err, status) {
@@ -12225,15 +13024,20 @@ var AbilityTypeSlugs = {
12225
13024
  TOOLKITS: "tools:toolkits",
12226
13025
  WEB_SEARCH: "tools:web_search",
12227
13026
  CONVERSATION_HISTORY: "tools:conversation_history",
13027
+ IMAGE_GENERATION: "tools:image_generation",
13028
+ CONVERSATION_CONTROL: "tools:conversation_control",
12228
13029
  // Integration
12229
13030
  CALENDAR_BOOKING: "integration:calendar_booking",
12230
13031
  FILE_ACCESS: "integration:file_access",
12231
13032
  DATA_ACCESS: "integration:data_access",
12232
13033
  GMAIL: "integration:gmail",
13034
+ GOOGLE_CALENDAR: "integration:google_calendar",
13035
+ GOOGLE_DRIVE: "integration:google_drive",
12233
13036
  CHARLESTON_PMD_PAGING: "integration:charleston_pmd_paging",
12234
13037
  // Communication
12235
13038
  PHONE_CALL_TOOLS: "communication:phone_call_tools",
12236
13039
  SEND_SMS: "communication:send_sms",
13040
+ SEND_WHATSAPP: "communication:send_whatsapp",
12237
13041
  MEMBER_ACCESS: "communication:member_access",
12238
13042
  AUDIO_PLAYBACK: "communication:audio_playback",
12239
13043
  // Oversight
@@ -12242,6 +13046,12 @@ var AbilityTypeSlugs = {
12242
13046
  ESCALATION: "oversight:escalation",
12243
13047
  // Identity
12244
13048
  MEMBER_FIELD_VERIFICATION: "identity:member_field_verification",
13049
+ // Delegation
13050
+ CONTRIBUTOR: "delegation:contributor",
13051
+ // Workflow
13052
+ WORKFLOW_RUN: "workflow:run",
13053
+ // Commerce
13054
+ RESELLER: "commerce:reseller",
12245
13055
  // System (auto-injected, hidden from users)
12246
13056
  USER_MESSAGE_RULES: "system:user_message_rules",
12247
13057
  ASSISTANT_MESSAGE_RULES: "chat:assistant_message_rules",
@@ -12263,7 +13073,6 @@ var TTS_PREVIEW_PROVIDERS = [
12263
13073
  "elevenlabs",
12264
13074
  "google",
12265
13075
  "aws",
12266
- "pocket",
12267
13076
  "deepgram",
12268
13077
  "xai"
12269
13078
  ];
@@ -12278,6 +13087,13 @@ function canPreviewVoice(entity) {
12278
13087
  return TTS_PREVIEW_PROVIDERS.includes(provider);
12279
13088
  }
12280
13089
 
13090
+ // src/types/query-engine-types.ts
13091
+ var QUERY_VALUELESS_OPS = /* @__PURE__ */ new Set([
13092
+ "isEmpty",
13093
+ "notEmpty",
13094
+ "exists"
13095
+ ]);
13096
+
12281
13097
  // src/types/chat-types.ts
12282
13098
  var SMS_DELIVERY_FAILURE_STATUSES = /* @__PURE__ */ new Set([
12283
13099
  "failed",
@@ -12503,21 +13319,16 @@ var CHAT_TYPES = {
12503
13319
  ASSIGNMENT: "assignment",
12504
13320
  MANAGER: "manager",
12505
13321
  CONTRIBUTOR: "contributor",
12506
- DEVELOPER: "developer",
12507
- MEMBER: "member",
12508
- /** @deprecated Use MEMBER instead */
12509
- AGENT: "member",
12510
- /** @deprecated Use MEMBER instead */
12511
- DM: "member"
13322
+ DM: "dm"
12512
13323
  };
12513
13324
  var BUILTIN_ASSISTANT_CHAT_TYPES = /* @__PURE__ */ new Set([
12514
13325
  CHAT_TYPES.MANAGER,
12515
- CHAT_TYPES.CONTRIBUTOR,
12516
- CHAT_TYPES.DEVELOPER
13326
+ CHAT_TYPES.CONTRIBUTOR
12517
13327
  ]);
13328
+ var MEMBER_AGENT_CHAT_TYPES = /* @__PURE__ */ new Set([CHAT_TYPES.DM]);
12518
13329
  var NO_ASSISTANT_PARTICIPANT_CHAT_TYPES = /* @__PURE__ */ new Set([
12519
13330
  ...BUILTIN_ASSISTANT_CHAT_TYPES,
12520
- CHAT_TYPES.MEMBER
13331
+ ...MEMBER_AGENT_CHAT_TYPES
12521
13332
  ]);
12522
13333
  function usesBuiltinAssistant(chatType) {
12523
13334
  return BUILTIN_ASSISTANT_CHAT_TYPES.has(chatType);
@@ -13344,6 +14155,7 @@ var SCOPE_PRESETS = {
13344
14155
  DEFAULT_VOICE_INFERENCE_MODEL,
13345
14156
  DataCategory,
13346
14157
  DataFieldType,
14158
+ DataRecordRetirementResponseReason,
13347
14159
  DataSensitivity,
13348
14160
  DataTypeRecordScope,
13349
14161
  DriverMode,
@@ -13367,6 +14179,9 @@ var SCOPE_PRESETS = {
13367
14179
  McpServerState,
13368
14180
  MemberFeature,
13369
14181
  MemberFilterBuilder,
14182
+ MemberImportMatchInfoMatchType,
14183
+ MemberImportPreviewRowAction,
14184
+ MemberImportValidationError,
13370
14185
  MemberLabelBuilder,
13371
14186
  MemberType,
13372
14187
  MenuItemResponseItemType,
@@ -13389,7 +14204,11 @@ var SCOPE_PRESETS = {
13389
14204
  PERMISSION_NONE,
13390
14205
  PERMISSION_USE,
13391
14206
  PERMISSION_VERIFY,
14207
+ PIDS_DISPOSITIONS,
14208
+ PIDS_SOURCES,
13392
14209
  ProductType,
14210
+ QUERY_VALUELESS_OPS,
14211
+ QueriesApi,
13393
14212
  REALTIME_MODEL_CUSTOM,
13394
14213
  REALTIME_MODEL_GEMINI,
13395
14214
  REALTIME_MODEL_GEMINI_VERTEX,
@@ -13419,7 +14238,6 @@ var SCOPE_PRESETS = {
13419
14238
  TTS_MODEL_ELEVENLABS_FLASH,
13420
14239
  TTS_MODEL_ELEVENLABS_MULTILINGUAL,
13421
14240
  TTS_MODEL_ELEVENLABS_TURBO,
13422
- TTS_MODEL_POCKET,
13423
14241
  TTS_PREVIEW_PROVIDERS,
13424
14242
  TaskBuilder,
13425
14243
  TemplatesApi,