@gravity-rail/cli 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/gr.js CHANGED
@@ -38,9 +38,11 @@ function handleError(err) {
38
38
  }
39
39
  }
40
40
  if ("statusCode" in err && err.statusCode === 401) {
41
- process.stderr.write(`
42
- Hint: Run "yarn gr login" or use "--realm <name>" (dev only)
43
- `);
41
+ process.stderr.write(
42
+ `
43
+ Hint: Run "gr login" to authenticate, or set GRAVITY_RAIL_API_KEY for non-interactive use.
44
+ `
45
+ );
44
46
  }
45
47
  process.exit(1);
46
48
  }
@@ -2390,7 +2392,7 @@ function parsePhoneNumber4() {
2390
2392
  return withMetadataArgument(parsePhoneNumber3, arguments);
2391
2393
  }
2392
2394
 
2393
- // ../sdk/dist/chunk-3BG2GMJZ.js
2395
+ // ../sdk/dist/chunk-QZC4QPP2.js
2394
2396
  function getCookieValue(name) {
2395
2397
  if (typeof document === "undefined") return void 0;
2396
2398
  const cookies = document.cookie.split(";");
@@ -2438,7 +2440,7 @@ function parseOrgAuthChallenge(wwwAuthenticate) {
2438
2440
  const cookieNameMatch = wwwAuthenticate.match(/cookie_name="([^"]+)"/);
2439
2441
  const authUrlMatch = wwwAuthenticate.match(/auth_url="([^"]+)"/);
2440
2442
  if (!orgUuidMatch?.[1] || !cookieNameMatch?.[1] || !authUrlMatch?.[1]) {
2441
- console.warn("Invalid org auth challenge header:", wwwAuthenticate);
2443
+ console.warn("Invalid org auth challenge header: missing required fields");
2442
2444
  return null;
2443
2445
  }
2444
2446
  return {
@@ -2455,8 +2457,17 @@ var BaseApiClient = class {
2455
2457
  enhancedAuthHandler;
2456
2458
  enhancedAuthInProgress = null;
2457
2459
  orgAuthHandler;
2460
+ orgAuthInProgress = null;
2458
2461
  actingMemberUuid;
2459
2462
  orgToken;
2463
+ /**
2464
+ * The org_uuid that issued the current orgToken. Tracked so we can detect
2465
+ * a 401 challenge from a *different* org and re-fire the handler — the
2466
+ * orgToken is an opaque JWE we cannot decrypt client-side, so without this
2467
+ * the original guard `!this.orgToken` would prevent re-auth across orgs and
2468
+ * surface as a silent 401 in multi-org CLI workflows.
2469
+ */
2470
+ orgTokenOrgUuid;
2460
2471
  constructor(apiKey, baseUrl3, customFetch) {
2461
2472
  this.baseUrl = baseUrl3;
2462
2473
  this.apiKey = apiKey;
@@ -2506,9 +2517,15 @@ var BaseApiClient = class {
2506
2517
  * Set the org token for cross-domain requests.
2507
2518
  * When set, all API requests will include the X-Org-Token header,
2508
2519
  * allowing org-level SSO verification without cookies.
2520
+ *
2521
+ * `orgUuid` is the org that issued the token; passing it lets the 401
2522
+ * handler detect a stale token when a subsequent request targets a
2523
+ * different org and re-fire the org-auth handler instead of silently
2524
+ * 401-ing. Callers without that context (legacy / unknown) may omit it.
2509
2525
  */
2510
- setOrgToken(token) {
2526
+ setOrgToken(token, orgUuid) {
2511
2527
  this.orgToken = token;
2528
+ this.orgTokenOrgUuid = token ? orgUuid : void 0;
2512
2529
  }
2513
2530
  async fetch(endpoint, options) {
2514
2531
  try {
@@ -2556,29 +2573,61 @@ var BaseApiClient = class {
2556
2573
  return await this.fetch(endpoint, options);
2557
2574
  } catch (retryError) {
2558
2575
  this.orgToken = void 0;
2576
+ this.orgTokenOrgUuid = void 0;
2559
2577
  throw retryError;
2560
2578
  }
2561
2579
  }
2562
2580
  if (response.status === 401) {
2563
2581
  const orgAuthInfo = parseOrgAuthChallenge(response.headers.get("WWW-Authenticate"));
2582
+ if (orgAuthInfo && this.orgToken && this.orgTokenOrgUuid && this.orgTokenOrgUuid !== orgAuthInfo.orgUuid) {
2583
+ this.orgToken = void 0;
2584
+ this.orgTokenOrgUuid = void 0;
2585
+ }
2564
2586
  if (orgAuthInfo && !this.orgToken) {
2565
2587
  const requestCookieName = orgAuthInfo.cookieName.replace(
2566
- "orgToken",
2588
+ /^orgToken/,
2567
2589
  "requestOrgToken"
2568
2590
  );
2569
2591
  const cachedOrgToken = getCookieValue(requestCookieName);
2570
2592
  if (cachedOrgToken) {
2571
2593
  this.orgToken = cachedOrgToken;
2594
+ this.orgTokenOrgUuid = orgAuthInfo.orgUuid;
2572
2595
  try {
2573
2596
  return await this.fetch(endpoint, options);
2574
2597
  } catch (retryError) {
2575
2598
  this.orgToken = void 0;
2599
+ this.orgTokenOrgUuid = void 0;
2576
2600
  throw retryError;
2577
2601
  }
2578
2602
  }
2579
2603
  if (this.orgAuthHandler) {
2580
- await this.orgAuthHandler(orgAuthInfo);
2581
- throw new ApiError("Organization authentication required", 401);
2604
+ if (!this.orgAuthInProgress) {
2605
+ const handler = this.orgAuthHandler;
2606
+ this.orgAuthInProgress = (async () => {
2607
+ try {
2608
+ await handler(orgAuthInfo);
2609
+ } finally {
2610
+ this.orgAuthInProgress = null;
2611
+ }
2612
+ })();
2613
+ }
2614
+ await this.orgAuthInProgress;
2615
+ const postHandlerToken = getCookieValue(requestCookieName) ?? this.orgToken;
2616
+ if (!postHandlerToken) {
2617
+ throw new ApiError(
2618
+ "Organization authentication did not issue a token",
2619
+ 401
2620
+ );
2621
+ }
2622
+ this.orgToken = postHandlerToken;
2623
+ this.orgTokenOrgUuid = orgAuthInfo.orgUuid;
2624
+ try {
2625
+ return await this.fetch(endpoint, options);
2626
+ } catch (retryError) {
2627
+ this.orgToken = void 0;
2628
+ this.orgTokenOrgUuid = void 0;
2629
+ throw retryError;
2630
+ }
2582
2631
  }
2583
2632
  }
2584
2633
  }
@@ -2677,29 +2726,61 @@ ${formattedErrors}`, response.status);
2677
2726
  return await this.fetchRaw(endpoint, options, allowedErrorStatuses);
2678
2727
  } catch (retryError) {
2679
2728
  this.orgToken = void 0;
2729
+ this.orgTokenOrgUuid = void 0;
2680
2730
  throw retryError;
2681
2731
  }
2682
2732
  }
2683
2733
  if (response.status === 401) {
2684
2734
  const orgAuthInfo = parseOrgAuthChallenge(response.headers.get("WWW-Authenticate"));
2735
+ if (orgAuthInfo && this.orgToken && this.orgTokenOrgUuid && this.orgTokenOrgUuid !== orgAuthInfo.orgUuid) {
2736
+ this.orgToken = void 0;
2737
+ this.orgTokenOrgUuid = void 0;
2738
+ }
2685
2739
  if (orgAuthInfo && !this.orgToken) {
2686
2740
  const requestCookieName = orgAuthInfo.cookieName.replace(
2687
- "orgToken",
2741
+ /^orgToken/,
2688
2742
  "requestOrgToken"
2689
2743
  );
2690
2744
  const cachedOrgToken = getCookieValue(requestCookieName);
2691
2745
  if (cachedOrgToken) {
2692
2746
  this.orgToken = cachedOrgToken;
2747
+ this.orgTokenOrgUuid = orgAuthInfo.orgUuid;
2693
2748
  try {
2694
2749
  return await this.fetchRaw(endpoint, options, allowedErrorStatuses);
2695
2750
  } catch (retryError) {
2696
2751
  this.orgToken = void 0;
2752
+ this.orgTokenOrgUuid = void 0;
2697
2753
  throw retryError;
2698
2754
  }
2699
2755
  }
2700
2756
  if (this.orgAuthHandler) {
2701
- await this.orgAuthHandler(orgAuthInfo);
2702
- throw new ApiError("Organization authentication required", 401);
2757
+ if (!this.orgAuthInProgress) {
2758
+ const handler = this.orgAuthHandler;
2759
+ this.orgAuthInProgress = (async () => {
2760
+ try {
2761
+ await handler(orgAuthInfo);
2762
+ } finally {
2763
+ this.orgAuthInProgress = null;
2764
+ }
2765
+ })();
2766
+ }
2767
+ await this.orgAuthInProgress;
2768
+ const postHandlerToken = getCookieValue(requestCookieName) ?? this.orgToken;
2769
+ if (!postHandlerToken) {
2770
+ throw new ApiError(
2771
+ "Organization authentication did not issue a token",
2772
+ 401
2773
+ );
2774
+ }
2775
+ this.orgToken = postHandlerToken;
2776
+ this.orgTokenOrgUuid = orgAuthInfo.orgUuid;
2777
+ try {
2778
+ return await this.fetchRaw(endpoint, options, allowedErrorStatuses);
2779
+ } catch (retryError) {
2780
+ this.orgToken = void 0;
2781
+ this.orgTokenOrgUuid = void 0;
2782
+ throw retryError;
2783
+ }
2703
2784
  }
2704
2785
  }
2705
2786
  }
@@ -3106,7 +3187,8 @@ var AssignmentsApi = class extends BaseApiClient {
3106
3187
  if (options.sortOrder) params.append("sortOrder", options.sortOrder);
3107
3188
  if (options.mine) params.append("mine", options.mine.toString());
3108
3189
  if (options.taskId) params.append("taskId", options.taskId.toString());
3109
- if (options.memberId) params.append("memberId", options.memberId.toString());
3190
+ if (options.memberId !== void 0)
3191
+ params.append("memberId", options.memberId.toString());
3110
3192
  if (options.status) params.append("status", options.status);
3111
3193
  return this.fetch(
3112
3194
  `w/${wid}/assignments${params.toString() ? `?${params.toString()}` : ""}`
@@ -3897,6 +3979,8 @@ var ChatsApi = class extends BaseApiClient {
3897
3979
  if (options.filters && options.filters.length > 0) {
3898
3980
  params.append("filters", JSON.stringify(options.filters));
3899
3981
  }
3982
+ if (options.createdAfter) params.append("createdAfter", options.createdAfter);
3983
+ if (options.createdBefore) params.append("createdBefore", options.createdBefore);
3900
3984
  return params;
3901
3985
  }
3902
3986
  /** List chats with optional filtering, sorting, and pagination. */
@@ -5159,6 +5243,40 @@ var HealthieApi = class extends BaseApiClient {
5159
5243
  method: "DELETE"
5160
5244
  });
5161
5245
  }
5246
+ async listHealthieAppointmentTypes(wid, providerId) {
5247
+ const query = new URLSearchParams();
5248
+ if (providerId) query.set("provider_id", providerId);
5249
+ const qs = query.toString() ? `?${query.toString()}` : "";
5250
+ return this.fetch(
5251
+ `w/${wid}/app-connections/healthie/appointment-types${qs}`
5252
+ );
5253
+ }
5254
+ async listHealthiePatients(wid, keywords) {
5255
+ const query = new URLSearchParams();
5256
+ if (keywords?.trim()) query.set("keywords", keywords.trim());
5257
+ const qs = query.toString() ? `?${query.toString()}` : "";
5258
+ return this.fetch(
5259
+ `w/${wid}/app-connections/healthie/patients${qs}`
5260
+ );
5261
+ }
5262
+ async getHealthieAvailableSlots(wid, request) {
5263
+ return this.fetch(
5264
+ `w/${wid}/app-connections/healthie/scheduling/available-slots`,
5265
+ {
5266
+ method: "POST",
5267
+ body: JSON.stringify(request)
5268
+ }
5269
+ );
5270
+ }
5271
+ async bookHealthieAppointment(wid, request) {
5272
+ return this.fetch(
5273
+ `w/${wid}/app-connections/healthie/scheduling/book`,
5274
+ {
5275
+ method: "POST",
5276
+ body: JSON.stringify(request)
5277
+ }
5278
+ );
5279
+ }
5162
5280
  };
5163
5281
  var FilesApi = class extends BaseApiClient {
5164
5282
  /** List files in a workspace with optional folder filtering, sorting, and search. */
@@ -5422,10 +5540,17 @@ var InboxesApi = class extends BaseApiClient {
5422
5540
  method: "POST"
5423
5541
  });
5424
5542
  }
5543
+ /** Reply to an email from the inbox. */
5544
+ async replyToEmail(wid, inboxId, emailId, content) {
5545
+ return this.fetch(`w/${wid}/inboxes/${inboxId}/emails/${emailId}/reply`, {
5546
+ method: "POST",
5547
+ body: JSON.stringify({ content })
5548
+ });
5549
+ }
5425
5550
  /** Convert an email to text, markdown, or PDF format. */
5426
- async convertEmail(wid, emailId, format = "pdf") {
5551
+ async convertEmail(wid, inboxId, emailId, format = "pdf") {
5427
5552
  return this.fetch(
5428
- `w/${wid}/inboxes/emails/${emailId}/convert?format=${format}`,
5553
+ `w/${wid}/inboxes/${inboxId}/emails/${emailId}/convert?format=${format}`,
5429
5554
  {
5430
5555
  method: "POST"
5431
5556
  }
@@ -5596,6 +5721,19 @@ var AppConnectionsApi = class extends BaseApiClient {
5596
5721
  { method: "DELETE" }
5597
5722
  );
5598
5723
  }
5724
+ /**
5725
+ * List distinct ``MemberField.key`` values scoped to a connection
5726
+ * (GRA-2920). Drives the Monday custom-match "Custom fields" picker.
5727
+ *
5728
+ * Returns only the set of keys already in use on this connection;
5729
+ * values are intentionally never exposed. Operators can also add a
5730
+ * new key via the UI's "Add custom field key" free-text action.
5731
+ */
5732
+ async listConnectionMemberFieldKeys(wid, connectionId) {
5733
+ return this.fetch(
5734
+ `w/${wid}/app-connections/${connectionId}/member-field-keys`
5735
+ );
5736
+ }
5599
5737
  };
5600
5738
  var McpServersApi = class extends BaseApiClient {
5601
5739
  /**
@@ -6210,33 +6348,6 @@ var MondayIntegrationApi = class extends BaseApiClient {
6210
6348
  );
6211
6349
  return { columns };
6212
6350
  }
6213
- /**
6214
- * Create a webhook in Monday.com
6215
- */
6216
- async createWebhook(wid, params) {
6217
- return this.fetch(`w/${wid}/app-connections/monday/webhooks`, {
6218
- method: "POST",
6219
- body: JSON.stringify(params)
6220
- });
6221
- }
6222
- /**
6223
- * Delete a webhook from Monday.com
6224
- */
6225
- async deleteWebhook(wid, webhookId) {
6226
- return this.fetch(
6227
- `w/${wid}/app-connections/monday/webhooks/${webhookId}`,
6228
- { method: "DELETE" }
6229
- );
6230
- }
6231
- /**
6232
- * Get details of a specific webhook from Monday.com
6233
- * Returns 404 if the webhook no longer exists
6234
- */
6235
- async getWebhook(wid, boardId, webhookId) {
6236
- return this.fetch(
6237
- `w/${wid}/app-connections/monday/boards/${boardId}/webhooks/${webhookId}`
6238
- );
6239
- }
6240
6351
  /**
6241
6352
  * Get groups for a specific Monday.com board
6242
6353
  */
@@ -6843,6 +6954,53 @@ var OrgApi = class extends BaseApiClient {
6843
6954
  body: JSON.stringify({ sampleMessages })
6844
6955
  });
6845
6956
  }
6957
+ // ============================================================================
6958
+ // Organization Business Profile API (Twilio Trust Hub Secondary CP)
6959
+ // ============================================================================
6960
+ /**
6961
+ * Live fetch of the org's Twilio Customer Profile + related entities.
6962
+ *
6963
+ * Response carries both the lifecycle `status` and the compliance
6964
+ * `evaluationStatus`. Twilio models lifecycle and evaluation as two
6965
+ * separate enums on two separate resources, so the Submit-button gate
6966
+ * is `evaluationStatus === 'compliant'` — never `status === 'compliant'`,
6967
+ * which is impossible (lifecycle status is one of `draft` /
6968
+ * `pending-review` / `in-review` / `twilio-approved` / `twilio-rejected`).
6969
+ */
6970
+ async getBusinessProfile(orgUuid) {
6971
+ return this.fetch(`o/${orgUuid}/business-profile`);
6972
+ }
6973
+ /**
6974
+ * Upsert the org's business profile. Idempotent via cached SIDs.
6975
+ * Returns a fresh BusinessProfileResponse on success — including the
6976
+ * compliance evaluation result so the frontend can immediately enable
6977
+ * Submit without a second round-trip.
6978
+ */
6979
+ async updateBusinessProfile(orgUuid, data) {
6980
+ return this.fetch(`o/${orgUuid}/business-profile`, {
6981
+ method: "PUT",
6982
+ body: JSON.stringify(data)
6983
+ });
6984
+ }
6985
+ /**
6986
+ * Submit the business profile to Twilio for review. Server re-evaluates
6987
+ * compliance live and returns 412 if the profile is not currently
6988
+ * `compliant`; returns 409 if a review is already in flight.
6989
+ */
6990
+ async submitBusinessProfile(orgUuid) {
6991
+ return this.fetch(`o/${orgUuid}/business-profile/submit`, {
6992
+ method: "POST"
6993
+ });
6994
+ }
6995
+ /**
6996
+ * Cancel an in-flight Twilio review. Resets the cached profile state
6997
+ * to `draft` so the user can edit and resubmit.
6998
+ */
6999
+ async cancelBusinessProfile(orgUuid) {
7000
+ return this.fetch(`o/${orgUuid}/business-profile/cancel`, {
7001
+ method: "POST"
7002
+ });
7003
+ }
6846
7004
  /**
6847
7005
  * List available member roles for a workspace in the organization.
6848
7006
  */
@@ -7186,15 +7344,15 @@ var PronunciationsApi = class extends BaseApiClient {
7186
7344
  };
7187
7345
  var PromptsApi = class extends BaseApiClient {
7188
7346
  /** Inspect the full composed prompt for a task (static) or chat (live). */
7189
- async inspectPrompt(wid, taskId, options = {}) {
7347
+ async inspectPrompt(wid, options) {
7190
7348
  const params = new URLSearchParams();
7191
- if (options.chatId) {
7349
+ if (options.chatId !== void 0) {
7192
7350
  params.append("chat_id", options.chatId.toString());
7193
- } else {
7194
- params.append("task_id", taskId.toString());
7351
+ } else if (options.taskId !== void 0) {
7352
+ params.append("task_id", options.taskId.toString());
7195
7353
  }
7196
7354
  if (options.channel) params.append("channel", options.channel);
7197
- if (options.turn) params.append("turn", options.turn.toString());
7355
+ if (options.turn !== void 0) params.append("turn", options.turn.toString());
7198
7356
  return this.fetch(`w/${wid}/prompts/inspect?${params}`);
7199
7357
  }
7200
7358
  };
@@ -7537,7 +7695,8 @@ var ConnectionSyncApi = class extends BaseApiClient {
7537
7695
  dryRun: options?.dryRun ?? false,
7538
7696
  resetCheckpoints: options?.resetCheckpoints ?? false,
7539
7697
  ...options?.entityType ? { entityType: options.entityType } : {},
7540
- ...options?.boardId ? { boardId: options.boardId } : {}
7698
+ ...options?.boardId ? { boardId: options.boardId } : {},
7699
+ ...typeof options?.recordLimit === "number" ? { recordLimit: options.recordLimit } : {}
7541
7700
  })
7542
7701
  });
7543
7702
  }
@@ -7556,6 +7715,19 @@ var ConnectionSyncApi = class extends BaseApiClient {
7556
7715
  `w/${wid}/app-connections/${connectionId}/sync/runs/${runId}/items?limit=${limit}`
7557
7716
  );
7558
7717
  }
7718
+ /**
7719
+ * Clear a manual-unlink exclusion for a member on a connection so
7720
+ * subsequent outbound syncs stop silently skipping them. Idempotent:
7721
+ * returns ``cleared=false`` when no matching exclusion exists.
7722
+ * ``boardId`` is only meaningful for multi-scope connectors (Monday).
7723
+ */
7724
+ async clearConnectionMemberExclusion(wid, connectionId, memberId, options) {
7725
+ const query = options?.boardId ? `?board_id=${encodeURIComponent(options.boardId)}` : "";
7726
+ return this.fetch(
7727
+ `w/${wid}/app-connections/${connectionId}/member-exclusions/${memberId}${query}`,
7728
+ { method: "DELETE" }
7729
+ );
7730
+ }
7559
7731
  };
7560
7732
  var HubspotApi = class extends BaseApiClient {
7561
7733
  async configureHubspot(wid, data) {
@@ -7922,6 +8094,96 @@ var SubscriptionsApi = class extends BaseApiClient {
7922
8094
  });
7923
8095
  }
7924
8096
  };
8097
+ function supportRequestParams(params) {
8098
+ const searchParams = new URLSearchParams();
8099
+ if (params?.page) searchParams.append("page", params.page.toString());
8100
+ if (params?.pageSize) searchParams.append("pageSize", params.pageSize.toString());
8101
+ if (params?.status) searchParams.append("status", params.status);
8102
+ if (params?.supportRequestType) {
8103
+ searchParams.append("supportRequestType", params.supportRequestType);
8104
+ }
8105
+ if (params?.severity) searchParams.append("severity", params.severity);
8106
+ if (params?.source) searchParams.append("source", params.source);
8107
+ if (params?.organizationId !== void 0) {
8108
+ searchParams.append("organizationId", params.organizationId.toString());
8109
+ }
8110
+ if (params?.workspaceId !== void 0) {
8111
+ searchParams.append("workspaceId", params.workspaceId.toString());
8112
+ }
8113
+ if (params?.linearLinked !== void 0) {
8114
+ searchParams.append("linearLinked", params.linearLinked.toString());
8115
+ }
8116
+ const query = searchParams.toString();
8117
+ return query ? `?${query}` : "";
8118
+ }
8119
+ var SupportRequestsApi = class extends BaseApiClient {
8120
+ async listSupportRequests(params) {
8121
+ return this.fetch(
8122
+ `support-requests${supportRequestParams(params)}`
8123
+ );
8124
+ }
8125
+ async getSupportRequest(uuid) {
8126
+ return this.fetch(`support-requests/${uuid}`);
8127
+ }
8128
+ async createSupportRequest(data) {
8129
+ return this.fetch("support-requests", {
8130
+ method: "POST",
8131
+ body: JSON.stringify(data)
8132
+ });
8133
+ }
8134
+ async commentOnSupportRequest(uuid, data) {
8135
+ return this.fetch(`support-requests/${uuid}/comments`, {
8136
+ method: "POST",
8137
+ body: JSON.stringify(data)
8138
+ });
8139
+ }
8140
+ async listOrgSupportRequests(orgUuid, params) {
8141
+ return this.fetch(
8142
+ `o/${orgUuid}/support-requests${supportRequestParams(params)}`
8143
+ );
8144
+ }
8145
+ async getOrgSupportRequest(orgUuid, uuid) {
8146
+ return this.fetch(`o/${orgUuid}/support-requests/${uuid}`);
8147
+ }
8148
+ async createOrgSupportRequest(orgUuid, data) {
8149
+ return this.fetch(`o/${orgUuid}/support-requests`, {
8150
+ method: "POST",
8151
+ body: JSON.stringify(data)
8152
+ });
8153
+ }
8154
+ async commentOnOrgSupportRequest(orgUuid, uuid, data) {
8155
+ return this.fetch(`o/${orgUuid}/support-requests/${uuid}/comments`, {
8156
+ method: "POST",
8157
+ body: JSON.stringify(data)
8158
+ });
8159
+ }
8160
+ async listWorkspaceSupportRequests(workspaceUuid, params) {
8161
+ return this.fetch(
8162
+ `w/${workspaceUuid}/support-requests${supportRequestParams(params)}`
8163
+ );
8164
+ }
8165
+ async getWorkspaceSupportRequest(workspaceUuid, uuid) {
8166
+ return this.fetch(`w/${workspaceUuid}/support-requests/${uuid}`);
8167
+ }
8168
+ async createWorkspaceSupportRequest(workspaceUuid, data) {
8169
+ return this.fetch(`w/${workspaceUuid}/support-requests`, {
8170
+ method: "POST",
8171
+ body: JSON.stringify(data)
8172
+ });
8173
+ }
8174
+ async commentOnWorkspaceSupportRequest(workspaceUuid, uuid, data) {
8175
+ return this.fetch(`w/${workspaceUuid}/support-requests/${uuid}/comments`, {
8176
+ method: "POST",
8177
+ body: JSON.stringify(data)
8178
+ });
8179
+ }
8180
+ async closeWorkspaceSupportRequest(workspaceUuid, uuid, data = {}) {
8181
+ return this.fetch(`w/${workspaceUuid}/support-requests/${uuid}/close`, {
8182
+ method: "POST",
8183
+ body: JSON.stringify(data)
8184
+ });
8185
+ }
8186
+ };
7925
8187
  var CustomersApi = class extends BaseApiClient {
7926
8188
  async getMyCustomers() {
7927
8189
  return this.fetch("customers");
@@ -7935,8 +8197,8 @@ var CustomersApi = class extends BaseApiClient {
7935
8197
  async getMyCustomerSubscriptions(uuid, opts) {
7936
8198
  const params = new URLSearchParams();
7937
8199
  if (opts?.status) params.set("status", opts.status);
7938
- if (opts?.page) params.set("page", String(opts.page));
7939
- if (opts?.pageSize) params.set("page_size", String(opts.pageSize));
8200
+ if (opts?.page !== void 0) params.set("page", String(opts.page));
8201
+ if (opts?.pageSize !== void 0) params.set("page_size", String(opts.pageSize));
7940
8202
  const qs = params.toString();
7941
8203
  return this.fetch(`customers/${uuid}/subscriptions${qs ? "?" + qs : ""}`);
7942
8204
  }
@@ -7973,6 +8235,16 @@ var CustomersApi = class extends BaseApiClient {
7973
8235
  method: "PUT"
7974
8236
  });
7975
8237
  }
8238
+ async getMyCustomerCreditGrants(uuid, opts) {
8239
+ const params = new URLSearchParams();
8240
+ if (opts?.subscriptionId !== void 0) {
8241
+ params.set("subscription_id", String(opts.subscriptionId));
8242
+ }
8243
+ if (opts?.page !== void 0) params.set("page", String(opts.page));
8244
+ if (opts?.pageSize !== void 0) params.set("page_size", String(opts.pageSize));
8245
+ const qs = params.toString();
8246
+ return this.fetch(`customers/${uuid}/credit-grants${qs ? "?" + qs : ""}`);
8247
+ }
7976
8248
  };
7977
8249
  var ResellersApi = class extends BaseApiClient {
7978
8250
  async getMyResellers() {
@@ -8195,6 +8467,14 @@ var JourneysApi = class extends BaseApiClient {
8195
8467
  method: "DELETE"
8196
8468
  });
8197
8469
  }
8470
+ /**
8471
+ * Get Journey Health diagnostics — authoring issues and runtime
8472
+ * failures for a single journey. PHI-safe: response carries IDs,
8473
+ * counts, error_type strings, and timestamps only.
8474
+ */
8475
+ async getJourneyHealth(wid, journeyId) {
8476
+ return this.fetch(`w/${wid}/journeys/${journeyId}/health`);
8477
+ }
8198
8478
  /** Create a step within a journey. */
8199
8479
  async createStep(wid, journeyId, data) {
8200
8480
  return this.fetch(`w/${wid}/journeys/${journeyId}/steps`, {
@@ -8262,6 +8542,13 @@ var JourneysApi = class extends BaseApiClient {
8262
8542
  if (params?.page) qs.set("page", String(params.page));
8263
8543
  if (params?.pageSize) qs.set("pageSize", String(params.pageSize));
8264
8544
  if (params?.search) qs.set("search", params.search);
8545
+ if (params?.status) qs.set("status", params.status);
8546
+ if (params?.enrolledAfter) qs.set("enrolledAfter", params.enrolledAfter);
8547
+ if (params?.enrolledBefore) qs.set("enrolledBefore", params.enrolledBefore);
8548
+ if (params?.currentTaskId !== void 0)
8549
+ qs.set("currentTaskId", String(params.currentTaskId));
8550
+ if (params?.runtimeFailureEdgeId !== void 0)
8551
+ qs.set("runtimeFailureEdgeId", String(params.runtimeFailureEdgeId));
8265
8552
  const query = qs.toString();
8266
8553
  return this.fetch(
8267
8554
  `w/${wid}/journeys/${journeyId}/members${query ? `?${query}` : ""}`
@@ -8282,10 +8569,10 @@ var JourneysApi = class extends BaseApiClient {
8282
8569
  });
8283
8570
  }
8284
8571
  /** Re-enroll a canceled member back to enrolled status. */
8285
- async reenrollMember(wid, journeyId, memberId) {
8572
+ async reenrollMember(wid, journeyId, data) {
8286
8573
  return this.fetch(`w/${wid}/journeys/${journeyId}/reenroll`, {
8287
8574
  method: "POST",
8288
- body: JSON.stringify({ memberId })
8575
+ body: JSON.stringify(data)
8289
8576
  });
8290
8577
  }
8291
8578
  /** Hard-delete a canceled enrollment so the member can be re-enrolled fresh. */
@@ -8298,6 +8585,18 @@ var JourneysApi = class extends BaseApiClient {
8298
8585
  async getMemberJourneys(wid, memberId) {
8299
8586
  return this.fetch(`w/${wid}/journeys/by-member/${memberId}`);
8300
8587
  }
8588
+ /**
8589
+ * Dry-run heartbeat CEL evaluation for an enrolled member.
8590
+ *
8591
+ * Evaluates all PENDING steps exactly as the heartbeat would, but writes no
8592
+ * state changes. Returns step-by-step results for debugging stuck members.
8593
+ */
8594
+ async testRunJourney(wid, journeyId, memberId) {
8595
+ return this.fetch(
8596
+ `w/${wid}/journeys/${journeyId}/members/${memberId}/test-run`,
8597
+ { method: "POST" }
8598
+ );
8599
+ }
8301
8600
  // ===== JOURNEY NOTES =====
8302
8601
  /** List notes for a journey. */
8303
8602
  async getJourneyNotes(wid, journeyId) {
@@ -8448,6 +8747,30 @@ var WorkflowsApi = class extends BaseApiClient {
8448
8747
  `w/${wid}/workflows/${workflowId}/validate-config`
8449
8748
  );
8450
8749
  }
8750
+ /**
8751
+ * Replay automatic routing for a Chat without performing the transition.
8752
+ *
8753
+ * Operator tool: returns a PHI-safe trace describing what the
8754
+ * automatic-edge evaluator would do at the next turn. Never returns
8755
+ * raw CEL, Form values, Member values, Chat content, or raw
8756
+ * exception strings — only IDs, status labels, and the exception
8757
+ * class name when the evaluator raises.
8758
+ *
8759
+ * Requires Workflow edit permission.
8760
+ */
8761
+ async getWorkflowRouteDryRun(wid, workflowId, args) {
8762
+ const params = new URLSearchParams();
8763
+ params.set("chat_id", String(args.chatId));
8764
+ if (args.currentTaskId !== void 0) {
8765
+ params.set("current_task_id", String(args.currentTaskId));
8766
+ }
8767
+ if (args.currentAssignmentTaskId !== void 0) {
8768
+ params.set("current_assignment_task_id", String(args.currentAssignmentTaskId));
8769
+ }
8770
+ return this.fetch(
8771
+ `w/${wid}/workflows/${workflowId}/route-dry-run?${params.toString()}`
8772
+ );
8773
+ }
8451
8774
  // Workflow Contributors API
8452
8775
  /** List all contributors for a workflow. */
8453
8776
  async getWorkflowContributors(wid, workflowId) {
@@ -8594,6 +8917,33 @@ var WorkflowNotesApi = class extends BaseApiClient {
8594
8917
  });
8595
8918
  }
8596
8919
  };
8920
+ var EventRuleEventType = /* @__PURE__ */ ((EventRuleEventType2) => {
8921
+ EventRuleEventType2["TASK_EXECUTE"] = "task:execute";
8922
+ EventRuleEventType2["MEMBER_JOINED"] = "workspace:member_joined";
8923
+ EventRuleEventType2["MEMBER_LEFT"] = "workspace:member_left";
8924
+ EventRuleEventType2["DATA_RECORD_CREATED"] = "data_record:created";
8925
+ EventRuleEventType2["DATA_RECORD_UPDATED"] = "data_record:updated";
8926
+ EventRuleEventType2["CHAT_CREATED"] = "chat:created";
8927
+ EventRuleEventType2["CHAT_CALLBACK"] = "chat:callback";
8928
+ EventRuleEventType2["MEMBER_UPDATED"] = "member:updated";
8929
+ EventRuleEventType2["ROUTINE_TRIGGERED"] = "routine:triggered";
8930
+ EventRuleEventType2["ASSISTANT_MESSAGE"] = "workflow:assistant_message";
8931
+ EventRuleEventType2["USER_MESSAGE"] = "workflow:user_message";
8932
+ EventRuleEventType2["CALENDAR_EVENT_CREATED"] = "calendar_event:created";
8933
+ EventRuleEventType2["CALENDAR_EVENT_UPDATED"] = "calendar_event:updated";
8934
+ EventRuleEventType2["CALENDAR_EVENT_CANCELLED"] = "calendar_event:cancelled";
8935
+ EventRuleEventType2["CALENDAR_EVENT_STARTING"] = "calendar_event:starting";
8936
+ EventRuleEventType2["CALENDAR_EVENT_ENDED"] = "calendar_event:ended";
8937
+ EventRuleEventType2["CONNECTOR_EVENT"] = "connector:event";
8938
+ EventRuleEventType2["ASSIGNMENT_CONCLUDED"] = "assignment:concluded";
8939
+ EventRuleEventType2["JOURNEY_STEP_EXECUTE"] = "journey_step:execute";
8940
+ EventRuleEventType2["JOURNEY_ENROLLED"] = "journey:enrolled";
8941
+ EventRuleEventType2["JOURNEY_COMPLETED"] = "journey:completed";
8942
+ EventRuleEventType2["CALL_STARTED"] = "call:started";
8943
+ EventRuleEventType2["CALL_COMPLETED"] = "call:completed";
8944
+ EventRuleEventType2["CALL_SUMMARY"] = "call:summary";
8945
+ return EventRuleEventType2;
8946
+ })(EventRuleEventType || {});
8597
8947
  var WorkspaceInvitationsApi = class extends BaseApiClient {
8598
8948
  /**
8599
8949
  * List user's own invitations (both org and workspace).
@@ -9051,6 +9401,66 @@ var WorkspacesApi = class extends BaseApiClient {
9051
9401
  return this.fetch(`w/${wid}/usage/dashboard`);
9052
9402
  }
9053
9403
  };
9404
+ var TeamsAppsApi = class extends BaseApiClient {
9405
+ /**
9406
+ * List all Teams apps configured for a workspace.
9407
+ */
9408
+ async getTeamsApps(wid, options = {}) {
9409
+ const params = new URLSearchParams();
9410
+ if (options.page) params.append("page", options.page.toString());
9411
+ if (options.pageSize) params.append("pageSize", options.pageSize.toString());
9412
+ if (options.sortBy) params.append("sortBy", options.sortBy);
9413
+ if (options.sortOrder) params.append("sortOrder", options.sortOrder);
9414
+ if (options.search) params.append("search", options.search);
9415
+ return this.fetch(
9416
+ `w/${wid}/app-connections/teams/apps${params.toString() ? `?${params.toString()}` : ""}`
9417
+ );
9418
+ }
9419
+ async getTeamsApp(wid, appId) {
9420
+ return this.fetch(`w/${wid}/app-connections/teams/apps/${appId}`);
9421
+ }
9422
+ async createTeamsApp(wid, data) {
9423
+ return this.fetch(`w/${wid}/app-connections/teams/apps`, {
9424
+ method: "POST",
9425
+ body: JSON.stringify(data)
9426
+ });
9427
+ }
9428
+ async updateTeamsApp(wid, appId, data) {
9429
+ return this.fetch(`w/${wid}/app-connections/teams/apps/${appId}`, {
9430
+ method: "PUT",
9431
+ body: JSON.stringify(data)
9432
+ });
9433
+ }
9434
+ async deleteTeamsApp(wid, appId) {
9435
+ return this.fetch(`w/${wid}/app-connections/teams/apps/${appId}`, {
9436
+ method: "DELETE"
9437
+ });
9438
+ }
9439
+ async getTeamsConversations(wid, appId, options = {}) {
9440
+ const params = new URLSearchParams();
9441
+ if (options.page) params.append("page", options.page.toString());
9442
+ if (options.pageSize) params.append("pageSize", options.pageSize.toString());
9443
+ return this.fetch(
9444
+ `w/${wid}/app-connections/teams/apps/${appId}/conversations${params.toString() ? `?${params.toString()}` : ""}`
9445
+ );
9446
+ }
9447
+ async getTeamsInstallations(wid, appId, options = {}) {
9448
+ const params = new URLSearchParams();
9449
+ if (options.page) params.append("page", options.page.toString());
9450
+ if (options.pageSize) params.append("pageSize", options.pageSize.toString());
9451
+ return this.fetch(
9452
+ `w/${wid}/app-connections/teams/apps/${appId}/installations${params.toString() ? `?${params.toString()}` : ""}`
9453
+ );
9454
+ }
9455
+ async getTeamsAppAccounts(wid, appId, options = {}) {
9456
+ const params = new URLSearchParams();
9457
+ if (options.page) params.append("page", options.page.toString());
9458
+ if (options.pageSize) params.append("pageSize", options.pageSize.toString());
9459
+ return this.fetch(
9460
+ `w/${wid}/app-connections/teams/apps/${appId}/accounts${params.toString() ? `?${params.toString()}` : ""}`
9461
+ );
9462
+ }
9463
+ };
9054
9464
  function createApiModules(apiKey, baseUrl3, customFetch) {
9055
9465
  return {
9056
9466
  abilities: new AbilitiesApi(apiKey, baseUrl3, customFetch),
@@ -9073,6 +9483,7 @@ function createApiModules(apiKey, baseUrl3, customFetch) {
9073
9483
  dataTypes: new DataTypesApi(apiKey, baseUrl3, customFetch),
9074
9484
  discordBots: new DiscordBotsApi(apiKey, baseUrl3, customFetch),
9075
9485
  slackApps: new SlackAppsApi(apiKey, baseUrl3, customFetch),
9486
+ teamsApps: new TeamsAppsApi(apiKey, baseUrl3, customFetch),
9076
9487
  events: new EventsApi(apiKey, baseUrl3, customFetch),
9077
9488
  fhirConnections: new FhirConnectionsApi(apiKey, baseUrl3, customFetch),
9078
9489
  healthie: new HealthieApi(apiKey, baseUrl3, customFetch),
@@ -9102,6 +9513,7 @@ function createApiModules(apiKey, baseUrl3, customFetch) {
9102
9513
  salesforce: new SalesforceApi(apiKey, baseUrl3, customFetch),
9103
9514
  sites: new SitesApi(apiKey, baseUrl3, customFetch),
9104
9515
  subscriptions: new SubscriptionsApi(apiKey, baseUrl3, customFetch),
9516
+ supportRequests: new SupportRequestsApi(apiKey, baseUrl3, customFetch),
9105
9517
  supervisors: new SupervisorsApi(apiKey, baseUrl3, customFetch),
9106
9518
  tasks: new TasksApi(apiKey, baseUrl3, customFetch),
9107
9519
  templates: new TemplatesApi(apiKey, baseUrl3, customFetch),
@@ -9598,6 +10010,7 @@ function bindCommunicationsMethods(target, phoneNumbers, inboxes, notificationRu
9598
10010
  target.getInboxThreads = inboxes.getInboxThreads.bind(inboxes);
9599
10011
  target.getThreadEmails = inboxes.getThreadEmails.bind(inboxes);
9600
10012
  target.getChatEmails = inboxes.getChatEmails.bind(inboxes);
10013
+ target.replyToEmail = inboxes.replyToEmail.bind(inboxes);
9601
10014
  target.getNotificationRules = notificationRules.getNotificationRules.bind(notificationRules);
9602
10015
  target.createNotificationRule = notificationRules.createNotificationRule.bind(notificationRules);
9603
10016
  target.updateNotificationRule = notificationRules.updateNotificationRule.bind(notificationRules);
@@ -9689,13 +10102,10 @@ function bindAppsMethods(target, apps, builders, inquiries, oauth, oauthConnecti
9689
10102
  target.getOAuthAuthorizationUrl = oauthConnections.getAuthorizationUrl.bind(oauthConnections);
9690
10103
  target.disconnectOAuthProvider = oauthConnections.disconnect.bind(oauthConnections);
9691
10104
  }
9692
- function bindIntegrationsMethods(target, mondayIntegration, discordBots, slackApps, fhirConnections, healthie, salesforce, hubspot, appConnections, connectionSync, confluence) {
10105
+ function bindIntegrationsMethods(target, mondayIntegration, discordBots, slackApps, teamsApps, fhirConnections, healthie, salesforce, hubspot, appConnections, connectionSync, confluence) {
9693
10106
  target.getMondayBoards = mondayIntegration.getBoards.bind(mondayIntegration);
9694
10107
  target.getMondayBoardColumns = mondayIntegration.getBoardColumns.bind(mondayIntegration);
9695
10108
  target.getMondayBoardGroups = mondayIntegration.getBoardGroups.bind(mondayIntegration);
9696
- target.createMondayWebhook = mondayIntegration.createWebhook.bind(mondayIntegration);
9697
- target.deleteMondayWebhook = mondayIntegration.deleteWebhook.bind(mondayIntegration);
9698
- target.getMondayWebhook = mondayIntegration.getWebhook.bind(mondayIntegration);
9699
10109
  target.getMondayCurrentUserInfo = mondayIntegration.getCurrentUserInfo.bind(mondayIntegration);
9700
10110
  target.configureMondayConnection = mondayIntegration.configureMondayConnection.bind(mondayIntegration);
9701
10111
  target.getMondayConnectionStatus = mondayIntegration.getMondayConnectionStatus.bind(mondayIntegration);
@@ -9739,6 +10149,14 @@ function bindIntegrationsMethods(target, mondayIntegration, discordBots, slackAp
9739
10149
  target.getSlackThreads = slackApps.getSlackThreads.bind(slackApps);
9740
10150
  target.getSlackInstallations = slackApps.getSlackInstallations.bind(slackApps);
9741
10151
  target.getSlackAppAccounts = slackApps.getSlackAppAccounts.bind(slackApps);
10152
+ target.getTeamsApps = teamsApps.getTeamsApps.bind(teamsApps);
10153
+ target.getTeamsApp = teamsApps.getTeamsApp.bind(teamsApps);
10154
+ target.createTeamsApp = teamsApps.createTeamsApp.bind(teamsApps);
10155
+ target.updateTeamsApp = teamsApps.updateTeamsApp.bind(teamsApps);
10156
+ target.deleteTeamsApp = teamsApps.deleteTeamsApp.bind(teamsApps);
10157
+ target.getTeamsConversations = teamsApps.getTeamsConversations.bind(teamsApps);
10158
+ target.getTeamsInstallations = teamsApps.getTeamsInstallations.bind(teamsApps);
10159
+ target.getTeamsAppAccounts = teamsApps.getTeamsAppAccounts.bind(teamsApps);
9742
10160
  target.getFhirConnections = fhirConnections.getFhirConnections.bind(fhirConnections);
9743
10161
  target.getFhirConnection = fhirConnections.getFhirConnection.bind(fhirConnections);
9744
10162
  target.getFhirConnectionByUuid = fhirConnections.getFhirConnectionByUuid.bind(fhirConnections);
@@ -9779,6 +10197,10 @@ function bindIntegrationsMethods(target, mondayIntegration, discordBots, slackAp
9779
10197
  target.getHealthieReconciliationMatches = healthie.getHealthieReconciliationMatches.bind(healthie);
9780
10198
  target.linkMemberToHealthie = healthie.linkMemberToHealthie.bind(healthie);
9781
10199
  target.unlinkMemberFromHealthie = healthie.unlinkMemberFromHealthie.bind(healthie);
10200
+ target.listHealthieAppointmentTypes = healthie.listHealthieAppointmentTypes.bind(healthie);
10201
+ target.listHealthiePatients = healthie.listHealthiePatients.bind(healthie);
10202
+ target.getHealthieAvailableSlots = healthie.getHealthieAvailableSlots.bind(healthie);
10203
+ target.bookHealthieAppointment = healthie.bookHealthieAppointment.bind(healthie);
9782
10204
  target.configureConfluence = confluence.configureConfluence.bind(confluence);
9783
10205
  target.startConfluenceOAuth = confluence.startConfluenceOAuth.bind(confluence);
9784
10206
  target.getConfluenceStatus = confluence.getConfluenceStatus.bind(confluence);
@@ -9831,12 +10253,14 @@ function bindIntegrationsMethods(target, mondayIntegration, discordBots, slackAp
9831
10253
  target.getSyncRuns = connectionSync.getSyncRuns.bind(connectionSync);
9832
10254
  target.getSyncRunItems = connectionSync.getSyncRunItems.bind(connectionSync);
9833
10255
  target.getMemberSyncSummary = connectionSync.getMemberSyncSummary.bind(connectionSync);
10256
+ target.clearConnectionMemberExclusion = connectionSync.clearConnectionMemberExclusion.bind(connectionSync);
9834
10257
  target.listAvailableAppConnections = appConnections.listAvailableAppConnections.bind(appConnections);
9835
10258
  target.listAppConnections = appConnections.listAppConnections.bind(appConnections);
9836
10259
  target.enablePlatformApp = appConnections.enablePlatformApp.bind(appConnections);
9837
10260
  target.getPlatformApp = appConnections.getPlatformApp.bind(appConnections);
9838
10261
  target.updatePlatformApp = appConnections.updatePlatformApp.bind(appConnections);
9839
10262
  target.deletePlatformApp = appConnections.deletePlatformApp.bind(appConnections);
10263
+ target.listConnectionMemberFieldKeys = appConnections.listConnectionMemberFieldKeys.bind(appConnections);
9840
10264
  }
9841
10265
  function bindOperatorMethods(target, operatorGroups) {
9842
10266
  target.getOperatorGroups = operatorGroups.getOperatorGroups.bind(operatorGroups);
@@ -9866,6 +10290,10 @@ function bindOrgMethods(target, org) {
9866
10290
  target.getOrgDomainSite = org.getOrgDomainSite.bind(org);
9867
10291
  target.verifyOrgDomainSite = org.verifyOrgDomainSite.bind(org);
9868
10292
  target.disableOrgDomainSite = org.disableOrgDomainSite.bind(org);
10293
+ target.getBusinessProfile = org.getBusinessProfile.bind(org);
10294
+ target.updateBusinessProfile = org.updateBusinessProfile.bind(org);
10295
+ target.submitBusinessProfile = org.submitBusinessProfile.bind(org);
10296
+ target.cancelBusinessProfile = org.cancelBusinessProfile.bind(org);
9869
10297
  }
9870
10298
  function bindPronunciationsMethods(target, pronunciations) {
9871
10299
  target.getPronunciationEntries = pronunciations.getPronunciationEntries.bind(pronunciations);
@@ -9885,6 +10313,7 @@ function bindPronunciationsMethods(target, pronunciations) {
9885
10313
  function bindJourneysMethods(target, journeys) {
9886
10314
  target.getJourneys = journeys.getJourneys.bind(journeys);
9887
10315
  target.getJourney = journeys.getJourney.bind(journeys);
10316
+ target.getJourneyHealth = journeys.getJourneyHealth.bind(journeys);
9888
10317
  target.createJourney = journeys.createJourney.bind(journeys);
9889
10318
  target.updateJourney = journeys.updateJourney.bind(journeys);
9890
10319
  target.archiveJourney = journeys.archiveJourney.bind(journeys);
@@ -9903,6 +10332,7 @@ function bindJourneysMethods(target, journeys) {
9903
10332
  target.reenrollMember = journeys.reenrollMember.bind(journeys);
9904
10333
  target.deleteEnrollment = journeys.deleteEnrollment.bind(journeys);
9905
10334
  target.getMemberJourneys = journeys.getMemberJourneys.bind(journeys);
10335
+ target.testRunJourney = journeys.testRunJourney.bind(journeys);
9906
10336
  target.getJourneyNotes = journeys.getJourneyNotes.bind(journeys);
9907
10337
  target.createJourneyNote = journeys.createJourneyNote.bind(journeys);
9908
10338
  target.updateJourneyNote = journeys.updateJourneyNote.bind(journeys);
@@ -9942,6 +10372,7 @@ function bindCustomersMethods(target, customers) {
9942
10372
  target.attachMyCustomerPaymentMethod = customers.attachMyCustomerPaymentMethod.bind(customers);
9943
10373
  target.detachMyCustomerPaymentMethod = customers.detachMyCustomerPaymentMethod.bind(customers);
9944
10374
  target.setDefaultMyCustomerPaymentMethod = customers.setDefaultMyCustomerPaymentMethod.bind(customers);
10375
+ target.getMyCustomerCreditGrants = customers.getMyCustomerCreditGrants.bind(customers);
9945
10376
  }
9946
10377
  function bindResellersMethods(target, resellers) {
9947
10378
  target.getMyResellers = resellers.getMyResellers.bind(resellers);
@@ -9954,6 +10385,21 @@ function bindResellersMethods(target, resellers) {
9954
10385
  function bindPromptsMethods(target, prompts) {
9955
10386
  target.inspectPrompt = prompts.inspectPrompt.bind(prompts);
9956
10387
  }
10388
+ function bindSupportRequestMethods(target, supportRequests) {
10389
+ target.listSupportRequests = supportRequests.listSupportRequests.bind(supportRequests);
10390
+ target.getSupportRequest = supportRequests.getSupportRequest.bind(supportRequests);
10391
+ target.createSupportRequest = supportRequests.createSupportRequest.bind(supportRequests);
10392
+ target.commentOnSupportRequest = supportRequests.commentOnSupportRequest.bind(supportRequests);
10393
+ target.listOrgSupportRequests = supportRequests.listOrgSupportRequests.bind(supportRequests);
10394
+ target.getOrgSupportRequest = supportRequests.getOrgSupportRequest.bind(supportRequests);
10395
+ target.createOrgSupportRequest = supportRequests.createOrgSupportRequest.bind(supportRequests);
10396
+ target.commentOnOrgSupportRequest = supportRequests.commentOnOrgSupportRequest.bind(supportRequests);
10397
+ target.listWorkspaceSupportRequests = supportRequests.listWorkspaceSupportRequests.bind(supportRequests);
10398
+ target.getWorkspaceSupportRequest = supportRequests.getWorkspaceSupportRequest.bind(supportRequests);
10399
+ target.createWorkspaceSupportRequest = supportRequests.createWorkspaceSupportRequest.bind(supportRequests);
10400
+ target.commentOnWorkspaceSupportRequest = supportRequests.commentOnWorkspaceSupportRequest.bind(supportRequests);
10401
+ target.closeWorkspaceSupportRequest = supportRequests.closeWorkspaceSupportRequest.bind(supportRequests);
10402
+ }
9957
10403
  var GravityRailClient = class {
9958
10404
  // WorkspaceInvitations is exposed publicly for backward compatibility
9959
10405
  workspaceInvitations;
@@ -10127,6 +10573,7 @@ var GravityRailClient = class {
10127
10573
  // Journeys API
10128
10574
  getJourneys;
10129
10575
  getJourney;
10576
+ getJourneyHealth;
10130
10577
  createJourney;
10131
10578
  updateJourney;
10132
10579
  archiveJourney;
@@ -10145,6 +10592,7 @@ var GravityRailClient = class {
10145
10592
  reenrollMember;
10146
10593
  deleteEnrollment;
10147
10594
  getMemberJourneys;
10595
+ testRunJourney;
10148
10596
  getJourneyNotes;
10149
10597
  createJourneyNote;
10150
10598
  updateJourneyNote;
@@ -10234,6 +10682,10 @@ var GravityRailClient = class {
10234
10682
  getOrgDomainSite;
10235
10683
  verifyOrgDomainSite;
10236
10684
  disableOrgDomainSite;
10685
+ getBusinessProfile;
10686
+ updateBusinessProfile;
10687
+ submitBusinessProfile;
10688
+ cancelBusinessProfile;
10237
10689
  getVapidPublicKey;
10238
10690
  registerPushSubscription;
10239
10691
  unregisterPushSubscription;
@@ -10507,6 +10959,7 @@ var GravityRailClient = class {
10507
10959
  getInboxThreads;
10508
10960
  getThreadEmails;
10509
10961
  getChatEmails;
10962
+ replyToEmail;
10510
10963
  getNotificationRules;
10511
10964
  createNotificationRule;
10512
10965
  updateNotificationRule;
@@ -10598,9 +11051,6 @@ var GravityRailClient = class {
10598
11051
  getMondayBoards;
10599
11052
  getMondayBoardColumns;
10600
11053
  getMondayBoardGroups;
10601
- createMondayWebhook;
10602
- deleteMondayWebhook;
10603
- getMondayWebhook;
10604
11054
  getMondayCurrentUserInfo;
10605
11055
  // Monday.com Connection API
10606
11056
  configureMondayConnection;
@@ -10647,6 +11097,15 @@ var GravityRailClient = class {
10647
11097
  getSlackThreads;
10648
11098
  getSlackInstallations;
10649
11099
  getSlackAppAccounts;
11100
+ // Teams Apps API
11101
+ getTeamsApps;
11102
+ getTeamsApp;
11103
+ createTeamsApp;
11104
+ updateTeamsApp;
11105
+ deleteTeamsApp;
11106
+ getTeamsConversations;
11107
+ getTeamsInstallations;
11108
+ getTeamsAppAccounts;
10650
11109
  // FHIR Connections API
10651
11110
  getFhirConnections;
10652
11111
  getFhirConnection;
@@ -10689,6 +11148,10 @@ var GravityRailClient = class {
10689
11148
  getHealthieReconciliationMatches;
10690
11149
  linkMemberToHealthie;
10691
11150
  unlinkMemberFromHealthie;
11151
+ listHealthieAppointmentTypes;
11152
+ listHealthiePatients;
11153
+ getHealthieAvailableSlots;
11154
+ bookHealthieAppointment;
10692
11155
  // Confluence API
10693
11156
  configureConfluence;
10694
11157
  startConfluenceOAuth;
@@ -10745,6 +11208,7 @@ var GravityRailClient = class {
10745
11208
  getSyncRuns;
10746
11209
  getSyncRunItems;
10747
11210
  getMemberSyncSummary;
11211
+ clearConnectionMemberExclusion;
10748
11212
  // App Connections API
10749
11213
  listAvailableAppConnections;
10750
11214
  listAppConnections;
@@ -10752,6 +11216,7 @@ var GravityRailClient = class {
10752
11216
  getPlatformApp;
10753
11217
  updatePlatformApp;
10754
11218
  deletePlatformApp;
11219
+ listConnectionMemberFieldKeys;
10755
11220
  // Pronunciations API
10756
11221
  getPronunciationEntries;
10757
11222
  createPronunciationEntry;
@@ -10778,6 +11243,7 @@ var GravityRailClient = class {
10778
11243
  attachMyCustomerPaymentMethod;
10779
11244
  detachMyCustomerPaymentMethod;
10780
11245
  setDefaultMyCustomerPaymentMethod;
11246
+ getMyCustomerCreditGrants;
10781
11247
  // Resellers API (self-service reseller portal)
10782
11248
  getMyResellers;
10783
11249
  getMyReseller;
@@ -10785,6 +11251,20 @@ var GravityRailClient = class {
10785
11251
  getMyResellerProducts;
10786
11252
  getMyResellerSubscriptions;
10787
11253
  updateMyReseller;
11254
+ // Support Requests API
11255
+ listSupportRequests;
11256
+ getSupportRequest;
11257
+ createSupportRequest;
11258
+ commentOnSupportRequest;
11259
+ listOrgSupportRequests;
11260
+ getOrgSupportRequest;
11261
+ createOrgSupportRequest;
11262
+ commentOnOrgSupportRequest;
11263
+ listWorkspaceSupportRequests;
11264
+ getWorkspaceSupportRequest;
11265
+ createWorkspaceSupportRequest;
11266
+ commentOnWorkspaceSupportRequest;
11267
+ closeWorkspaceSupportRequest;
10788
11268
  constructor(apiKey, baseUrl3, customFetch) {
10789
11269
  const apis = createApiModules(apiKey, baseUrl3, customFetch);
10790
11270
  this.apis = apis;
@@ -10834,6 +11314,7 @@ var GravityRailClient = class {
10834
11314
  apis.mondayIntegration,
10835
11315
  apis.discordBots,
10836
11316
  apis.slackApps,
11317
+ apis.teamsApps,
10837
11318
  apis.fhirConnections,
10838
11319
  apis.healthie,
10839
11320
  apis.salesforce,
@@ -10845,6 +11326,7 @@ var GravityRailClient = class {
10845
11326
  bindPronunciationsMethods(this, apis.pronunciations);
10846
11327
  bindCustomersMethods(this, apis.customers);
10847
11328
  bindResellersMethods(this, apis.resellers);
11329
+ bindSupportRequestMethods(this, apis.supportRequests);
10848
11330
  }
10849
11331
  /**
10850
11332
  * Set the handler for enhanced authentication requirements (RFC 9470 Step-Up Auth).
@@ -10872,6 +11354,24 @@ var GravityRailClient = class {
10872
11354
  }
10873
11355
  });
10874
11356
  }
11357
+ /**
11358
+ * Set the org token for cross-domain / non-browser clients (e.g. CLI).
11359
+ * When set, all API requests include the X-Org-Token header so the backend
11360
+ * accepts the request without requiring a browser cookie.
11361
+ *
11362
+ * `orgUuid` is the org that issued the token. Pass it so the SDK can
11363
+ * detect a stale token (e.g. switching orgs mid-session) and re-fire the
11364
+ * org-auth handler instead of silently 401-ing.
11365
+ *
11366
+ * Propagates to all API modules.
11367
+ */
11368
+ setOrgToken(token, orgUuid) {
11369
+ Object.values(this.apis).forEach((api) => {
11370
+ if (typeof api.setOrgToken === "function") {
11371
+ api.setOrgToken(token, orgUuid);
11372
+ }
11373
+ });
11374
+ }
10875
11375
  /**
10876
11376
  * Update the API key across all modules.
10877
11377
  * Used after successful re-authentication.
@@ -10926,7 +11426,67 @@ var BUILTIN_ASSISTANT_CHAT_TYPES = /* @__PURE__ */ new Set([
10926
11426
  ]);
10927
11427
 
10928
11428
  // ../client/dist/index.mjs
11429
+ function supportRequestParams2(params) {
11430
+ const searchParams = new URLSearchParams();
11431
+ if (params?.page) searchParams.append("page", params.page.toString());
11432
+ if (params?.pageSize) searchParams.append("pageSize", params.pageSize.toString());
11433
+ if (params?.status) searchParams.append("status", params.status);
11434
+ if (params?.supportRequestType) {
11435
+ searchParams.append("supportRequestType", params.supportRequestType);
11436
+ }
11437
+ if (params?.severity) searchParams.append("severity", params.severity);
11438
+ if (params?.source) searchParams.append("source", params.source);
11439
+ if (params?.organizationId !== void 0) {
11440
+ searchParams.append("organizationId", params.organizationId.toString());
11441
+ }
11442
+ if (params?.workspaceId !== void 0) {
11443
+ searchParams.append("workspaceId", params.workspaceId.toString());
11444
+ }
11445
+ if (params?.linearLinked !== void 0) {
11446
+ searchParams.append("linearLinked", params.linearLinked.toString());
11447
+ }
11448
+ const query = searchParams.toString();
11449
+ return query ? `?${query}` : "";
11450
+ }
10929
11451
  var AdminApi = class extends BaseApiClient {
11452
+ // Support Requests API
11453
+ async listSupportRequestsAsAdmin(params) {
11454
+ return this.fetch(
11455
+ `admin/support-requests${supportRequestParams2(params)}`
11456
+ );
11457
+ }
11458
+ async getSupportRequestAsAdmin(uuid) {
11459
+ return this.fetch(`admin/support-requests/${uuid}`);
11460
+ }
11461
+ async commentOnSupportRequestAsAdmin(uuid, data) {
11462
+ return this.fetch(`admin/support-requests/${uuid}/comments`, {
11463
+ method: "POST",
11464
+ body: JSON.stringify(data)
11465
+ });
11466
+ }
11467
+ async noteOnSupportRequestAsAdmin(uuid, data) {
11468
+ return this.fetch(`admin/support-requests/${uuid}/notes`, {
11469
+ method: "POST",
11470
+ body: JSON.stringify(data)
11471
+ });
11472
+ }
11473
+ async updateSupportRequestStatusAsAdmin(uuid, data) {
11474
+ return this.fetch(`admin/support-requests/${uuid}/status`, {
11475
+ method: "POST",
11476
+ body: JSON.stringify(data)
11477
+ });
11478
+ }
11479
+ async updateSupportRequestAttributesAsAdmin(uuid, data) {
11480
+ return this.fetch(`admin/support-requests/${uuid}/attributes`, {
11481
+ method: "POST",
11482
+ body: JSON.stringify(data)
11483
+ });
11484
+ }
11485
+ async createSupportRequestLinearIssueAsAdmin(uuid) {
11486
+ return this.fetch(`admin/support-requests/${uuid}/linear-issue`, {
11487
+ method: "POST"
11488
+ });
11489
+ }
10930
11490
  // Admin Accounts API
10931
11491
  async getAccounts(options) {
10932
11492
  const params = new URLSearchParams();
@@ -11065,11 +11625,11 @@ var AdminApi = class extends BaseApiClient {
11065
11625
  return this.fetch(`o/${idOrUuid}`);
11066
11626
  }
11067
11627
  /**
11068
- * Get organization by numeric ID via admin endpoint.
11628
+ * Get organization by numeric ID or UUID via admin endpoint.
11069
11629
  * Does NOT require organization membership — superuser-only.
11070
11630
  */
11071
- async getOrganizationAsAdmin(id) {
11072
- return this.fetch(`admin/organizations/${id}`);
11631
+ async getOrganizationAsAdmin(idOrUuid) {
11632
+ return this.fetch(`admin/organizations/${idOrUuid}`);
11073
11633
  }
11074
11634
  async getOrganizationMembersAsAdmin(organizationId, options) {
11075
11635
  const params = new URLSearchParams();
@@ -11246,7 +11806,27 @@ var AdminApi = class extends BaseApiClient {
11246
11806
  body: JSON.stringify(request || {})
11247
11807
  });
11248
11808
  }
11249
- // ===== Workflow Access Validation =====
11809
+ /**
11810
+ * Switch a workspace's plan product on its active SubscriptionItem.
11811
+ *
11812
+ * Superuser only. Re-syncs ``workspace.features`` from the new product
11813
+ * and emits a ``WORKSPACE_PRODUCT_CHANGED`` audit event identifying the
11814
+ * actor, target workspace, prior and new product, and feature diff.
11815
+ *
11816
+ * Stripe is not touched here; price-id changes belong to the dedicated
11817
+ * Stripe sync surface (``syncProductToStripe``).
11818
+ */
11819
+ async changeWorkspaceProduct(workspaceUuid, productId) {
11820
+ const body = { productId };
11821
+ return this.fetch(
11822
+ `admin/workspaces/${workspaceUuid}/product`,
11823
+ {
11824
+ method: "POST",
11825
+ body: JSON.stringify(body)
11826
+ }
11827
+ );
11828
+ }
11829
+ // ===== Workflow Access Validation =====
11250
11830
  async validateWorkflowAccessAsAdmin(workspaceUuid) {
11251
11831
  const params = new URLSearchParams();
11252
11832
  if (workspaceUuid) params.append("workspace_uuid", workspaceUuid);
@@ -11278,6 +11858,11 @@ var AdminApi = class extends BaseApiClient {
11278
11858
  body: JSON.stringify(data)
11279
11859
  });
11280
11860
  }
11861
+ async unarchiveAdminWorkspaceMember(wid) {
11862
+ return this.fetch(`admin/workspaces/${wid}/me/unarchive`, {
11863
+ method: "POST"
11864
+ });
11865
+ }
11281
11866
  async getAdminWorkspaceMemberRoles(wid) {
11282
11867
  return this.fetch(`admin/workspaces/${wid}/member-roles`);
11283
11868
  }
@@ -11289,8 +11874,8 @@ var AdminApi = class extends BaseApiClient {
11289
11874
  `admin/phone-numbers/workspace/${workspaceId}/unmapped`
11290
11875
  );
11291
11876
  }
11292
- async getWorkspacePhoneNumbersAsAdmin(workspaceId) {
11293
- return this.fetch(`admin/workspace/${workspaceId}/phone-numbers`);
11877
+ async getWorkspacePhoneNumbersAsAdmin(workspaceRef) {
11878
+ return this.fetch(`admin/workspaces/${workspaceRef}/phone-numbers`);
11294
11879
  }
11295
11880
  // Phone Numbers API (Provider phone numbers from Twilio, AWS, etc.)
11296
11881
  async getProviderPhoneNumbers(options = {}) {
@@ -11399,6 +11984,11 @@ var AdminApi = class extends BaseApiClient {
11399
11984
  method: "DELETE"
11400
11985
  });
11401
11986
  }
11987
+ async getWorkspaceInboxesAsAdmin(workspaceUuid) {
11988
+ return this.fetch(
11989
+ `admin/workspaces/${workspaceUuid}/inboxes`
11990
+ );
11991
+ }
11402
11992
  // Admin Inbox Mappings API
11403
11993
  async getInboxMappings(options = {}) {
11404
11994
  const params = new URLSearchParams();
@@ -11443,21 +12033,30 @@ var AdminApi = class extends BaseApiClient {
11443
12033
  })
11444
12034
  });
11445
12035
  }
11446
- // Admin Themes API
11447
- async listAllThemes() {
11448
- return this.fetch("admin/themes/list");
11449
- }
11450
- // One-off Redis cadence-key migration (periodiq_* → routine_*). See
11451
- // lib/routes/admin/admin_routine_cadence_api.py for context.
11452
- async migrateRoutineCadenceKeys(options) {
11453
- return this.fetch("admin/redis/routine-cadence/migrate", {
12036
+ /**
12037
+ * Resolve a Langfuse trace UI URL from a trace ID, chat ID, or message ID.
12038
+ *
12039
+ * URL-only: never fetches Langfuse payloads, Message content, or
12040
+ * tool arguments. Exactly one of ``traceId``, ``chatId``, or
12041
+ * ``messageId`` must be set; chat/message forms require a
12042
+ * workspaceUuid. See
12043
+ * docs/development/observability/llm-call-investigation.md.
12044
+ */
12045
+ async getTraceUrl(options) {
12046
+ return this.fetch("admin/trace/url", {
11454
12047
  method: "POST",
11455
12048
  body: JSON.stringify({
11456
- dryRun: options.dryRun ?? true,
11457
- deleteLegacy: options.deleteLegacy ?? false
12049
+ trace_id: options.traceId,
12050
+ chat_id: options.chatId,
12051
+ message_id: options.messageId,
12052
+ workspace_uuid: options.workspaceUuid
11458
12053
  })
11459
12054
  });
11460
12055
  }
12056
+ // Admin Themes API
12057
+ async listAllThemes() {
12058
+ return this.fetch("admin/themes/list");
12059
+ }
11461
12060
  // Missing Memberships API
11462
12061
  async getMissingMemberships(workspaceId) {
11463
12062
  return this.fetch(
@@ -12030,6 +12629,13 @@ function appendTemporalWorkspaceParams(params, options) {
12030
12629
  push(options.workspaceUuid);
12031
12630
  }
12032
12631
  function bindAdminMethods(target, admin) {
12632
+ target.listSupportRequestsAsAdmin = admin.listSupportRequestsAsAdmin.bind(admin);
12633
+ target.getSupportRequestAsAdmin = admin.getSupportRequestAsAdmin.bind(admin);
12634
+ target.commentOnSupportRequestAsAdmin = admin.commentOnSupportRequestAsAdmin.bind(admin);
12635
+ target.noteOnSupportRequestAsAdmin = admin.noteOnSupportRequestAsAdmin.bind(admin);
12636
+ target.updateSupportRequestStatusAsAdmin = admin.updateSupportRequestStatusAsAdmin.bind(admin);
12637
+ target.updateSupportRequestAttributesAsAdmin = admin.updateSupportRequestAttributesAsAdmin.bind(admin);
12638
+ target.createSupportRequestLinearIssueAsAdmin = admin.createSupportRequestLinearIssueAsAdmin.bind(admin);
12033
12639
  target.getAccounts = admin.getAccounts.bind(admin);
12034
12640
  target.getAccountDetails = admin.getAccountDetails.bind(admin);
12035
12641
  target.getAccountByUuid = admin.getAccountByUuid.bind(admin);
@@ -12078,11 +12684,13 @@ function bindAdminMethods(target, admin) {
12078
12684
  target.disableMaintenanceMode = admin.disableMaintenanceMode.bind(admin);
12079
12685
  target.getWorkspaceHealth = admin.getWorkspaceHealth.bind(admin);
12080
12686
  target.provisionPlanFeatures = admin.provisionPlanFeatures.bind(admin);
12687
+ target.changeWorkspaceProduct = admin.changeWorkspaceProduct.bind(admin);
12081
12688
  target.validateWorkflowAccessAsAdmin = admin.validateWorkflowAccessAsAdmin.bind(admin);
12082
12689
  target.mergeMembers = admin.mergeMembers.bind(admin);
12083
12690
  target.getAdminWorkspaceMember = admin.getAdminWorkspaceMember.bind(admin);
12084
12691
  target.createAdminWorkspaceMember = admin.createAdminWorkspaceMember.bind(admin);
12085
12692
  target.updateAdminWorkspaceMember = admin.updateAdminWorkspaceMember.bind(admin);
12693
+ target.unarchiveAdminWorkspaceMember = admin.unarchiveAdminWorkspaceMember.bind(admin);
12086
12694
  target.getAdminWorkspaceMemberRoles = admin.getAdminWorkspaceMemberRoles.bind(admin);
12087
12695
  target.getMissingMemberships = admin.getMissingMemberships.bind(admin);
12088
12696
  target.linkMissingMembership = admin.linkMissingMembership.bind(admin);
@@ -12113,8 +12721,8 @@ function bindAdminMethods(target, admin) {
12113
12721
  target.deleteAdminInboxMapping = admin.deleteAdminInboxMapping.bind(admin);
12114
12722
  target.generateChatSummaries = admin.generateChatSummaries.bind(admin);
12115
12723
  target.executeQuery = admin.executeQuery.bind(admin);
12724
+ target.getTraceUrl = admin.getTraceUrl.bind(admin);
12116
12725
  target.listAllThemes = admin.listAllThemes.bind(admin);
12117
- target.migrateRoutineCadenceKeys = admin.migrateRoutineCadenceKeys.bind(admin);
12118
12726
  target.startBulkTOSAcceptance = admin.startBulkTOSAcceptance.bind(admin);
12119
12727
  target.startTokenUsageBackfill = admin.startTokenUsageBackfill.bind(admin);
12120
12728
  target.updateChatMessage = admin.updateChatMessage.bind(admin);
@@ -12174,6 +12782,7 @@ function bindAdminMethods(target, admin) {
12174
12782
  target.getVoiceMetrics = admin.getVoiceMetrics.bind(admin);
12175
12783
  target.getHealthMetrics = admin.getHealthMetrics.bind(admin);
12176
12784
  target.getHealthDetail = admin.getHealthDetail.bind(admin);
12785
+ target.getWorkspaceInboxesAsAdmin = admin.getWorkspaceInboxesAsAdmin.bind(admin);
12177
12786
  target.listWorkspaceChats = admin.listWorkspaceChats.bind(admin);
12178
12787
  target.getWorkspaceChat = admin.getWorkspaceChat.bind(admin);
12179
12788
  target.rateWorkspaceChatMessage = admin.rateWorkspaceChatMessage.bind(admin);
@@ -12192,6 +12801,13 @@ function bindAdminMethods(target, admin) {
12192
12801
  }
12193
12802
  var ApiClient = class extends GravityRailClient {
12194
12803
  // Admin API
12804
+ listSupportRequestsAsAdmin;
12805
+ getSupportRequestAsAdmin;
12806
+ commentOnSupportRequestAsAdmin;
12807
+ noteOnSupportRequestAsAdmin;
12808
+ updateSupportRequestStatusAsAdmin;
12809
+ updateSupportRequestAttributesAsAdmin;
12810
+ createSupportRequestLinearIssueAsAdmin;
12195
12811
  getAccounts;
12196
12812
  getAccountDetails;
12197
12813
  getAccountByUuid;
@@ -12240,11 +12856,13 @@ var ApiClient = class extends GravityRailClient {
12240
12856
  disableMaintenanceMode;
12241
12857
  getWorkspaceHealth;
12242
12858
  provisionPlanFeatures;
12859
+ changeWorkspaceProduct;
12243
12860
  validateWorkflowAccessAsAdmin;
12244
12861
  mergeMembers;
12245
12862
  getAdminWorkspaceMember;
12246
12863
  createAdminWorkspaceMember;
12247
12864
  updateAdminWorkspaceMember;
12865
+ unarchiveAdminWorkspaceMember;
12248
12866
  getAdminWorkspaceMemberRoles;
12249
12867
  getMissingMemberships;
12250
12868
  linkMissingMembership;
@@ -12275,8 +12893,8 @@ var ApiClient = class extends GravityRailClient {
12275
12893
  deleteAdminInboxMapping;
12276
12894
  generateChatSummaries;
12277
12895
  executeQuery;
12896
+ getTraceUrl;
12278
12897
  listAllThemes;
12279
- migrateRoutineCadenceKeys;
12280
12898
  startBulkTOSAcceptance;
12281
12899
  startTokenUsageBackfill;
12282
12900
  updateChatMessage;
@@ -12330,6 +12948,7 @@ var ApiClient = class extends GravityRailClient {
12330
12948
  getVoiceMetrics;
12331
12949
  getHealthMetrics;
12332
12950
  getHealthDetail;
12951
+ getWorkspaceInboxesAsAdmin;
12333
12952
  listWorkspaceChats;
12334
12953
  getWorkspaceChat;
12335
12954
  rateWorkspaceChatMessage;
@@ -12366,6 +12985,10 @@ var ApiClient = class extends GravityRailClient {
12366
12985
  this.adminApi.setActingMember(memberUuid);
12367
12986
  }
12368
12987
  }
12988
+ // setOrgToken is intentionally NOT overridden here. Admin routes
12989
+ // (/api/v2/admin/*) are protected by the bearer token's superuser claim and
12990
+ // ignore X-Org-Token entirely, so propagating an org token to adminApi is
12991
+ // dead code that would only obscure auth flow if admin route logic changes.
12369
12992
  };
12370
12993
 
12371
12994
  // src/cli-utils/config.ts
@@ -13108,8 +13731,129 @@ var COL = {
13108
13731
  function stderr2(msg) {
13109
13732
  process.stderr.write(msg + "\n");
13110
13733
  }
13734
+ var ORG_AUTH_TIMEOUT_MS = 5 * 60 * 1e3;
13735
+ function extractOrgTokenFromSetCookies(setCookieValues, preferredCookieName) {
13736
+ let fallback;
13737
+ for (const value of setCookieValues) {
13738
+ const nameValue = value.split(";")[0]?.trim() ?? "";
13739
+ const eqIdx = nameValue.indexOf("=");
13740
+ if (eqIdx === -1) continue;
13741
+ const name = nameValue.slice(0, eqIdx).trim();
13742
+ const tokenValue = nameValue.slice(eqIdx + 1).trim() || void 0;
13743
+ if (!tokenValue) continue;
13744
+ if (name === preferredCookieName) return tokenValue;
13745
+ if (!fallback && (name.startsWith("orgToken") || name.startsWith("orgSession"))) {
13746
+ fallback = tokenValue;
13747
+ }
13748
+ }
13749
+ return fallback;
13750
+ }
13751
+ async function tryDirectJoin(apiUrl, accessToken, orgAuthInfo) {
13752
+ const response = await fetch(`${apiUrl}/api/v2/o/${orgAuthInfo.orgUuid}/join`, {
13753
+ method: "POST",
13754
+ headers: {
13755
+ "Content-Type": "application/json",
13756
+ Authorization: `Bearer ${accessToken}`
13757
+ },
13758
+ body: "{}"
13759
+ });
13760
+ if (response.status === 400) {
13761
+ return null;
13762
+ }
13763
+ if (!response.ok) {
13764
+ throw new Error(`Org join failed (HTTP ${response.status})`);
13765
+ }
13766
+ const rawHeaders = response.headers;
13767
+ const setCookies = rawHeaders.getSetCookie?.() ?? (rawHeaders.get("set-cookie") ? [rawHeaders.get("set-cookie")] : []);
13768
+ if (setCookies.length === 0) {
13769
+ throw new Error("Org join succeeded but no Set-Cookie header returned");
13770
+ }
13771
+ const orgToken = extractOrgTokenFromSetCookies(setCookies, orgAuthInfo.cookieName);
13772
+ if (!orgToken) {
13773
+ throw new Error("Org join succeeded but org token cookie not found in Set-Cookie");
13774
+ }
13775
+ return orgToken;
13776
+ }
13777
+ function isAllowedAuthUrl(url, apiUrl) {
13778
+ try {
13779
+ const parsed = new URL(url);
13780
+ const api = new URL(apiUrl);
13781
+ if (parsed.protocol !== "https:" && parsed.protocol !== "http:") return false;
13782
+ if (parsed.hostname === api.hostname) return true;
13783
+ const lastTwo = (host) => {
13784
+ const parts = host.split(".").filter(Boolean);
13785
+ return parts.length >= 2 ? parts.slice(-2).join(".") : host;
13786
+ };
13787
+ const isIp = /^[0-9.]+$|^\[.*\]$/.test(parsed.hostname);
13788
+ if (isIp) return false;
13789
+ return lastTwo(parsed.hostname) === lastTwo(api.hostname);
13790
+ } catch {
13791
+ return false;
13792
+ }
13793
+ }
13794
+ function openBrowser2(url) {
13795
+ let command;
13796
+ let args;
13797
+ if (process.platform === "darwin") {
13798
+ command = "open";
13799
+ args = [url];
13800
+ } else if (process.platform === "win32") {
13801
+ command = "cmd.exe";
13802
+ args = ["/c", "start", "", url];
13803
+ } else {
13804
+ command = "xdg-open";
13805
+ args = [url];
13806
+ }
13807
+ execFile(command, args, (_err) => {
13808
+ });
13809
+ }
13810
+ function registerOrgAuthHandler(apiClient, apiUrl, accessToken) {
13811
+ apiClient.setOrgAuthHandler(async (orgAuthInfo) => {
13812
+ try {
13813
+ const orgToken = await tryDirectJoin(apiUrl, accessToken, orgAuthInfo);
13814
+ if (orgToken !== null) {
13815
+ apiClient.setOrgToken(orgToken, orgAuthInfo.orgUuid);
13816
+ return;
13817
+ }
13818
+ } catch (err) {
13819
+ const msg = err instanceof Error ? err.message : String(err);
13820
+ stderr2(`Warning: org direct-join failed (${msg}); trying browser auth`);
13821
+ }
13822
+ if (!isAllowedAuthUrl(orgAuthInfo.authUrl, apiUrl)) {
13823
+ throw new Error(
13824
+ `Refusing to open organization auth URL: scheme/host does not match the configured API host. Re-run with the expected --api-url, or contact support.`
13825
+ );
13826
+ }
13827
+ stderr2(`
13828
+ This workspace requires organization SSO authentication.`);
13829
+ stderr2(`Opening browser to complete authentication...`);
13830
+ stderr2(` ${orgAuthInfo.authUrl}
13831
+ `);
13832
+ stderr2(`If the browser does not open, visit the URL above manually.`);
13833
+ stderr2(
13834
+ `After signing in, re-run the command \u2014 the CLI cannot receive the SSO token directly.`
13835
+ );
13836
+ openBrowser2(orgAuthInfo.authUrl);
13837
+ await new Promise((_, reject) => {
13838
+ const t = setTimeout(
13839
+ () => reject(
13840
+ new Error(
13841
+ "Organization authentication timed out.\nPlease complete authentication in the browser, then re-run the command."
13842
+ )
13843
+ ),
13844
+ ORG_AUTH_TIMEOUT_MS
13845
+ );
13846
+ t.unref?.();
13847
+ });
13848
+ });
13849
+ }
13111
13850
 
13112
13851
  // src/lib/context.ts
13852
+ function makeApiClient(accessToken, apiUrl) {
13853
+ const apiClient = new ApiClient(accessToken, apiUrl);
13854
+ registerOrgAuthHandler(apiClient, apiUrl, accessToken);
13855
+ return apiClient;
13856
+ }
13113
13857
  async function tryTokenRefresh(ctx, creds) {
13114
13858
  if (!creds.refreshToken) return null;
13115
13859
  const refreshed = await refreshAccessToken(
@@ -13119,7 +13863,7 @@ async function tryTokenRefresh(ctx, creds) {
13119
13863
  ctx.env
13120
13864
  );
13121
13865
  if (!refreshed?.accessToken) return null;
13122
- const apiClient = new ApiClient(refreshed.accessToken, ctx.envConfig.apiUrl);
13866
+ const apiClient = makeApiClient(refreshed.accessToken, ctx.envConfig.apiUrl);
13123
13867
  return { ...ctx, accessToken: refreshed.accessToken, apiClient };
13124
13868
  }
13125
13869
  function requireAuth(ctx) {
@@ -13146,7 +13890,7 @@ async function createPublicAuthenticatedContext(opts) {
13146
13890
  const ctx = createPublicContext(opts);
13147
13891
  const apiKey = process.env.GRAVITY_RAIL_API_KEY;
13148
13892
  if (apiKey) {
13149
- const apiClient = new ApiClient(apiKey, ctx.envConfig.apiUrl);
13893
+ const apiClient = makeApiClient(apiKey, ctx.envConfig.apiUrl);
13150
13894
  return { ...ctx, accessToken: apiKey, apiClient };
13151
13895
  }
13152
13896
  const creds = ctx.credentialsManager.load(ctx.env);
@@ -13154,7 +13898,7 @@ async function createPublicAuthenticatedContext(opts) {
13154
13898
  const buffer = 5 * 60 * 1e3;
13155
13899
  const notExpired = !creds.expiresAt || new Date(creds.expiresAt) > new Date(Date.now() + buffer);
13156
13900
  if (notExpired) {
13157
- const apiClient = new ApiClient(creds.accessToken, ctx.envConfig.apiUrl);
13901
+ const apiClient = makeApiClient(creds.accessToken, ctx.envConfig.apiUrl);
13158
13902
  return { ...ctx, accessToken: creds.accessToken, apiClient };
13159
13903
  }
13160
13904
  const refreshed = await tryTokenRefresh(ctx, creds);
@@ -15957,8 +16701,8 @@ var dataTypesDomain = {
15957
16701
  var RULE_COLUMNS = [
15958
16702
  COL.id(),
15959
16703
  COL.name(),
15960
- { header: "EVENT", getValue: (item) => item.event_type ?? "" },
15961
- COL.enabled()
16704
+ { header: "EVENT", getValue: (item) => item.eventType ?? "" },
16705
+ { header: "ACTIVE", getValue: (item) => String(item.active ?? "") }
15962
16706
  ];
15963
16707
  var EVENT_COLUMNS2 = [
15964
16708
  COL.id(),
@@ -15966,19 +16710,13 @@ var EVENT_COLUMNS2 = [
15966
16710
  { header: "SLUG", getValue: (item) => item.slug ?? "" },
15967
16711
  COL.status()
15968
16712
  ];
15969
- var eventRulesCrud = crudCommands({
16713
+ var eventRulesCrudNoList = crudCommands({
15970
16714
  prefix: ["events", "rules"],
15971
16715
  entityName: "event rule",
15972
- listMethod: "getEventRules",
15973
16716
  getMethod: "getEventRule",
15974
16717
  createMethod: "createEventRule",
15975
16718
  updateMethod: "updateEventRule",
15976
16719
  deleteMethod: "deleteEventRule",
15977
- // The endpoint is paginated and excludes nothing by object_type. Without
15978
- // 'full', the CLI silently returned only page 1 (default 25 rules), which
15979
- // hid routine/journey/calendar-scoped rules in workspaces with many
15980
- // task-scoped rules. 'full' wires up --page/--page-size and --all.
15981
- paginationSupport: "full",
15982
16720
  columns: RULE_COLUMNS,
15983
16721
  createExamples: [
15984
16722
  `gr events rules create -w $WID --data '{"name":"Label on step","objectType":"journey",`,
@@ -15997,6 +16735,57 @@ var eventRulesCrud = crudCommands({
15997
16735
  'member:label actionParams: {"addLabelIds":["uuid"],"removeLabelIds":["uuid"]}'
15998
16736
  ]
15999
16737
  });
16738
+ var eventRulesListCmd = {
16739
+ path: ["events", "rules", "list"],
16740
+ description: "List event rules (use --journey-step-id or --event-type to filter)",
16741
+ requiresWorkspace: true,
16742
+ columns: RULE_COLUMNS,
16743
+ args: [
16744
+ { name: "journey-step-id", description: "Filter by journey step ID" },
16745
+ { name: "event-type", description: "Filter by event type (e.g. journey_step:execute)" },
16746
+ { name: "object-type", description: "Filter by object type (e.g. journey, task)" },
16747
+ { name: "include-disabled", description: "Include inactive rules", isFlag: true },
16748
+ { name: "page", description: "Page number (without filters)" },
16749
+ { name: "page-size", description: "Page size (without filters)" },
16750
+ {
16751
+ name: "all",
16752
+ description: "Fetch all pages (without filters)",
16753
+ isFlag: true
16754
+ }
16755
+ ],
16756
+ handler: async ({ ctx, workspace, args }) => {
16757
+ const client = requireAuth(ctx).apiClient;
16758
+ const journeyStepId = args["journey-step-id"] ? requireNumber(args, "journey-step-id") : void 0;
16759
+ const eventType = args["event-type"];
16760
+ const objectType = args["object-type"];
16761
+ const includeDisabled = args["include-disabled"] === true;
16762
+ if (journeyStepId !== void 0 || eventType !== void 0 || objectType !== void 0 || includeDisabled) {
16763
+ const result3 = await client.searchEventRules(workspace, {
16764
+ ...journeyStepId !== void 0 ? { journeyStepId } : {},
16765
+ ...eventType ? { eventType } : {},
16766
+ ...objectType ? { objectType } : {},
16767
+ ...includeDisabled ? { includeDisabled: true } : {}
16768
+ });
16769
+ outputData(listResult(result3, false), ctx, RULE_COLUMNS);
16770
+ return;
16771
+ }
16772
+ if (args["all"]) {
16773
+ const allItems = await fetchAllPages(
16774
+ async ({ page: page2, pageSize: pageSize2 }) => client.getEventRules(workspace, { page: page2, pageSize: pageSize2 })
16775
+ );
16776
+ outputData(allItems, ctx, RULE_COLUMNS);
16777
+ return;
16778
+ }
16779
+ const page = args["page"] ? requireNumber(args, "page") : void 0;
16780
+ const pageSize = args["page-size"] ? requireNumber(args, "page-size") : void 0;
16781
+ const result2 = await client.getEventRules(workspace, {
16782
+ ...page !== void 0 ? { page } : {},
16783
+ ...pageSize !== void 0 ? { pageSize } : {}
16784
+ });
16785
+ outputData(listResult(result2, true), ctx, RULE_COLUMNS);
16786
+ }
16787
+ };
16788
+ var eventRulesCrud = [eventRulesListCmd, ...eventRulesCrudNoList];
16000
16789
  var eventRulesAliases = eventRulesCrud.filter((cmd) => {
16001
16790
  const verb = cmd.path[cmd.path.length - 1];
16002
16791
  return verb === "list" || verb === "get";
@@ -16269,6 +17058,15 @@ var NOTE_COLUMNS2 = [
16269
17058
  { header: "CONTENT", getValue: (item) => (item.contents ?? "").slice(0, 60) },
16270
17059
  { header: "CREATED", getValue: (item) => item.createdAt ?? "" }
16271
17060
  ];
17061
+ var ACTION_COLUMNS = [
17062
+ COL.id(),
17063
+ { header: "UUID", getValue: (item) => (item.uuid ?? "").slice(0, 8) },
17064
+ COL.name(),
17065
+ { header: "EVENT", getValue: (item) => item.eventType ?? "" },
17066
+ { header: "ACTION", getValue: (item) => item.actionType ?? "" },
17067
+ { header: "ACTIVE", getValue: (item) => String(item.active ?? "") },
17068
+ { header: "CONDITIONS", getValue: (item) => (item.conditions ?? "").slice(0, 40) }
17069
+ ];
16272
17070
  function baseUrl(ctx, wid) {
16273
17071
  return `${ctx.envConfig.apiUrl}/api/v2/w/${wid}/journeys`;
16274
17072
  }
@@ -16983,6 +17781,70 @@ var journeysDomain = {
16983
17781
  process.stdout.write(`Deleted note ${noteId}
16984
17782
  `);
16985
17783
  }
17784
+ },
17785
+ // ── Step execute actions (event rules scoped to a step) ────────
17786
+ {
17787
+ path: ["journeys", "steps", "actions", "list"],
17788
+ description: "List event rules (actions) attached to a journey step",
17789
+ requiresWorkspace: true,
17790
+ args: [
17791
+ { name: "step-id", description: "Journey step ID (numeric)", required: true },
17792
+ {
17793
+ name: "include-disabled",
17794
+ description: "Include inactive/disabled rules",
17795
+ isFlag: true
17796
+ }
17797
+ ],
17798
+ examples: [
17799
+ "gr journeys steps actions list -w $WID --step-id <step-id>",
17800
+ "gr journeys steps actions list -w $WID --step-id <step-id> --include-disabled"
17801
+ ],
17802
+ handler: async ({ ctx, workspace, args }) => {
17803
+ const stepId = requireNumber(args, "step-id");
17804
+ const includeDisabled = args["include-disabled"] === true;
17805
+ const result2 = await requireAuth(ctx).apiClient.searchEventRules(workspace, {
17806
+ eventType: EventRuleEventType.JOURNEY_STEP_EXECUTE,
17807
+ journeyStepId: stepId,
17808
+ ...includeDisabled ? { includeDisabled: true } : {}
17809
+ });
17810
+ outputData(listResult(result2, false), ctx, ACTION_COLUMNS);
17811
+ }
17812
+ },
17813
+ {
17814
+ path: ["journeys", "steps", "actions", "get"],
17815
+ description: "Get a journey step action (event rule) by ID",
17816
+ requiresWorkspace: true,
17817
+ args: [{ name: "id", description: "Event rule ID", required: true }],
17818
+ examples: ["gr journeys steps actions get -w $WID --id <rule-id>"],
17819
+ handler: async ({ ctx, workspace, args }) => {
17820
+ const id = requireNumber(args, "id");
17821
+ const result2 = await requireAuth(ctx).apiClient.getEventRule(workspace, id);
17822
+ outputSingle(result2, ctx, ACTION_COLUMNS);
17823
+ }
17824
+ },
17825
+ {
17826
+ path: ["journeys", "steps", "actions", "update"],
17827
+ description: "Update a journey step action \u2014 modify template, conditions, or active state",
17828
+ mutates: true,
17829
+ requiresWorkspace: true,
17830
+ args: [{ name: "id", description: "Event rule ID", required: true }],
17831
+ examples: [
17832
+ "gr journeys steps actions update -w $WID --id <rule-id> \\",
17833
+ ` --data '{"actionParams":{"messageTemplate":"Hello {{member.name}}"}}' --allow-write`,
17834
+ "",
17835
+ "Updatable fields: name, conditions (CEL), actionParams, active, delay, order",
17836
+ "Non-updatable: objectType, eventType, actionType, journeyStepId"
17837
+ ],
17838
+ handler: async ({ ctx, workspace, args, data }) => {
17839
+ if (!data) throw new CLIError("JSON data required (--data, --file, or stdin)");
17840
+ const id = requireNumber(args, "id");
17841
+ const result2 = await requireAuth(ctx).apiClient.updateEventRule(
17842
+ workspace,
17843
+ id,
17844
+ data
17845
+ );
17846
+ outputSingle(result2, ctx, ACTION_COLUMNS);
17847
+ }
16986
17848
  }
16987
17849
  ]
16988
17850
  };
@@ -17608,6 +18470,13 @@ var COLUMNS16 = [
17608
18470
  { header: "PREFIX", getValue: (item) => item.prefix ?? "" },
17609
18471
  COL.created()
17610
18472
  ];
18473
+ var CREATE_COLUMNS = [
18474
+ COL.id(),
18475
+ COL.name(),
18476
+ { header: "KEY", getValue: (item) => item.key ?? "" },
18477
+ { header: "PREFIX", getValue: (item) => item.prefix ?? "" },
18478
+ COL.created()
18479
+ ];
17611
18480
  var apiKeysDomain = {
17612
18481
  name: "api-keys",
17613
18482
  description: "Manage API keys",
@@ -17628,7 +18497,10 @@ var apiKeysDomain = {
17628
18497
  requiresWorkspace: true,
17629
18498
  handler: async ({ ctx, workspace, data }) => {
17630
18499
  const result2 = await requireAuth(ctx).apiClient.createApiKey(workspace, data);
17631
- outputSingle(result2, ctx, COLUMNS16);
18500
+ outputSingle(result2, ctx, CREATE_COLUMNS);
18501
+ if (ctx.outputFormat === "table") {
18502
+ process.stdout.write("\n\u26A0 This key will not be shown again. Copy it now.\n");
18503
+ }
17632
18504
  }
17633
18505
  },
17634
18506
  {
@@ -17660,7 +18532,10 @@ var apiKeysDomain = {
17660
18532
  requiresWorkspace: false,
17661
18533
  handler: async ({ ctx, data }) => {
17662
18534
  const result2 = await requireAuth(ctx).apiClient.createGlobalApiKey(data);
17663
- outputSingle(result2, ctx, COLUMNS16);
18535
+ outputSingle(result2, ctx, CREATE_COLUMNS);
18536
+ if (ctx.outputFormat === "table") {
18537
+ process.stdout.write("\n\u26A0 This key will not be shown again. Copy it now.\n");
18538
+ }
17664
18539
  }
17665
18540
  },
17666
18541
  {
@@ -18566,7 +19441,7 @@ var milestonesDomain = {
18566
19441
  var COLUMNS23 = [
18567
19442
  COL.id(),
18568
19443
  COL.name(),
18569
- { header: "TYPE", getValue: (item) => item.type ?? "" },
19444
+ { header: "TYPE", getValue: (item) => item.noticeType ?? "" },
18570
19445
  COL.enabled()
18571
19446
  ];
18572
19447
  var notificationRulesDomain = {
@@ -19584,20 +20459,20 @@ var promptsDomain = {
19584
20459
  "gr prompts inspect --chat-id 789 --turn 3"
19585
20460
  ],
19586
20461
  handler: async ({ ctx, workspace, args }) => {
19587
- const taskId = args["task-id"] ? requireNumber(args, "task-id") : void 0;
19588
- const chatId = args["chat-id"] ? requireNumber(args, "chat-id") : void 0;
19589
- if (!taskId && !chatId) {
20462
+ const taskId = args["task-id"] !== void 0 ? requireNumber(args, "task-id") : void 0;
20463
+ const chatId = args["chat-id"] !== void 0 ? requireNumber(args, "chat-id") : void 0;
20464
+ if (taskId === void 0 && chatId === void 0) {
19590
20465
  throw new Error("Provide --task-id or --chat-id");
19591
20466
  }
19592
- if (taskId && chatId) {
20467
+ if (taskId !== void 0 && chatId !== void 0) {
19593
20468
  throw new Error("Provide --task-id or --chat-id, not both");
19594
20469
  }
19595
20470
  const channel = args.channel || void 0;
19596
- const turn = args.turn ? requireNumber(args, "turn") : void 0;
19597
- const result2 = await requireAuth(ctx).apiClient.inspectPrompt(workspace, taskId ?? 0, {
19598
- channel,
19599
- ...chatId ? { chatId } : {},
19600
- ...turn ? { turn } : {}
20471
+ const turn = args.turn !== void 0 ? requireNumber(args, "turn") : void 0;
20472
+ const result2 = await requireAuth(ctx).apiClient.inspectPrompt(workspace, {
20473
+ ...taskId !== void 0 ? { taskId } : { chatId },
20474
+ ...channel ? { channel } : {},
20475
+ ...turn !== void 0 ? { turn } : {}
19601
20476
  });
19602
20477
  outputSingle(result2, ctx);
19603
20478
  }
@@ -19605,6 +20480,128 @@ var promptsDomain = {
19605
20480
  ]
19606
20481
  };
19607
20482
 
20483
+ // src/domains/support.ts
20484
+ var SUPPORT_COLUMNS = [
20485
+ COL.uuid(),
20486
+ { header: "STATUS", getValue: (item) => item.status ?? "" },
20487
+ { header: "TYPE", getValue: (item) => item.supportRequestType ?? "" },
20488
+ { header: "SEVERITY", getValue: (item) => item.severity ?? "" },
20489
+ { header: "SOURCE", getValue: (item) => item.source ?? "" },
20490
+ { header: "CREATED", getValue: (item) => (item.createdAt ?? "").slice(0, 19) },
20491
+ { header: "TITLE", getValue: (item) => item.title ?? "" }
20492
+ ];
20493
+ var CONTEXT_ARGS = [
20494
+ { name: "workspace", aliases: ["w"], description: "Workspace UUID" },
20495
+ { name: "org-uuid", description: "Organization UUID" }
20496
+ ];
20497
+ function listParams(args) {
20498
+ return {
20499
+ page: args.page ? Number(args.page) : void 0,
20500
+ pageSize: args["page-size"] ? Number(args["page-size"]) : void 0,
20501
+ status: args.status,
20502
+ supportRequestType: args.type,
20503
+ severity: args.severity,
20504
+ source: args.source
20505
+ };
20506
+ }
20507
+ function requestPayload(data, args) {
20508
+ const input = data ?? {};
20509
+ return {
20510
+ supportRequestType: input.supportRequestType ?? input.support_request_type ?? args.type ?? "question",
20511
+ title: input.title ?? requireString(args, "title"),
20512
+ description: input.description ?? requireString(args, "description"),
20513
+ severity: input.severity ?? args.severity
20514
+ };
20515
+ }
20516
+ function commentPayload(data, args) {
20517
+ const input = data ?? {};
20518
+ return {
20519
+ body: input.body ?? requireString(args, "body")
20520
+ };
20521
+ }
20522
+ var supportDomain = {
20523
+ name: "support",
20524
+ description: "Manage support requests",
20525
+ commands: [
20526
+ {
20527
+ path: ["support", "list"],
20528
+ description: "List support requests",
20529
+ args: [
20530
+ ...CONTEXT_ARGS,
20531
+ { name: "status", description: "Filter by status" },
20532
+ { name: "type", description: "Filter by type: bug, feature_request, question" },
20533
+ { name: "severity", description: "Filter by severity" },
20534
+ { name: "source", description: "Filter by source" },
20535
+ { name: "page", description: "Page number" },
20536
+ { name: "page-size", description: "Page size" }
20537
+ ],
20538
+ columns: SUPPORT_COLUMNS,
20539
+ handler: async ({ ctx, args, workspace }) => {
20540
+ const client = requireAuth(ctx).apiClient;
20541
+ const wid = args.workspace ?? workspace;
20542
+ const orgUuid = args["org-uuid"];
20543
+ const result2 = wid ? await client.listWorkspaceSupportRequests(wid, listParams(args)) : orgUuid ? await client.listOrgSupportRequests(orgUuid, listParams(args)) : await client.listSupportRequests(listParams(args));
20544
+ outputData(result2, ctx, SUPPORT_COLUMNS);
20545
+ }
20546
+ },
20547
+ {
20548
+ path: ["support", "get"],
20549
+ description: "Get a support request",
20550
+ args: [
20551
+ ...CONTEXT_ARGS,
20552
+ { name: "id", aliases: ["uuid"], description: "Support request UUID", required: true }
20553
+ ],
20554
+ handler: async ({ ctx, args, workspace }) => {
20555
+ const client = requireAuth(ctx).apiClient;
20556
+ const id = requireString(args, "id");
20557
+ const wid = args.workspace ?? workspace;
20558
+ const orgUuid = args["org-uuid"];
20559
+ const result2 = wid ? await client.getWorkspaceSupportRequest(wid, id) : orgUuid ? await client.getOrgSupportRequest(orgUuid, id) : await client.getSupportRequest(id);
20560
+ outputSingle(result2, ctx, SUPPORT_COLUMNS);
20561
+ }
20562
+ },
20563
+ {
20564
+ path: ["support", "create"],
20565
+ description: "Create a support request",
20566
+ mutates: true,
20567
+ args: [
20568
+ ...CONTEXT_ARGS,
20569
+ { name: "type", description: "Request type: bug, feature_request, question" },
20570
+ { name: "title", description: "Support request title" },
20571
+ { name: "description", description: "Support request description" },
20572
+ { name: "severity", description: "Optional severity" }
20573
+ ],
20574
+ handler: async ({ ctx, args, workspace, data }) => {
20575
+ const client = requireAuth(ctx).apiClient;
20576
+ const wid = args.workspace ?? workspace;
20577
+ const orgUuid = args["org-uuid"];
20578
+ const payload = requestPayload(data, args);
20579
+ const result2 = wid ? await client.createWorkspaceSupportRequest(wid, payload) : orgUuid ? await client.createOrgSupportRequest(orgUuid, payload) : await client.createSupportRequest(payload);
20580
+ outputSingle(result2, ctx, SUPPORT_COLUMNS);
20581
+ }
20582
+ },
20583
+ {
20584
+ path: ["support", "comment"],
20585
+ description: "Add a customer comment to a support request",
20586
+ mutates: true,
20587
+ args: [
20588
+ ...CONTEXT_ARGS,
20589
+ { name: "id", aliases: ["uuid"], description: "Support request UUID", required: true },
20590
+ { name: "body", description: "Comment body" }
20591
+ ],
20592
+ handler: async ({ ctx, args, workspace, data }) => {
20593
+ const client = requireAuth(ctx).apiClient;
20594
+ const id = requireString(args, "id");
20595
+ const wid = args.workspace ?? workspace;
20596
+ const orgUuid = args["org-uuid"];
20597
+ const payload = commentPayload(data, args);
20598
+ const result2 = wid ? await client.commentOnWorkspaceSupportRequest(wid, id, payload) : orgUuid ? await client.commentOnOrgSupportRequest(orgUuid, id, payload) : await client.commentOnSupportRequest(id, payload);
20599
+ outputSingle(result2, ctx, SUPPORT_COLUMNS);
20600
+ }
20601
+ }
20602
+ ]
20603
+ };
20604
+
19608
20605
  // src/domains/supervisors.ts
19609
20606
  var COLUMNS28 = [
19610
20607
  COL.id(),
@@ -19721,6 +20718,10 @@ var syncDomain = {
19721
20718
  {
19722
20719
  name: "board-id",
19723
20720
  description: "Scope to a single board mapping (requires --entity-type)"
20721
+ },
20722
+ {
20723
+ name: "record-limit",
20724
+ description: "Cap the run to a preview sample (1..200). Requires --dry-run and --entity-type."
19724
20725
  }
19725
20726
  ],
19726
20727
  examples: [
@@ -19729,7 +20730,8 @@ var syncDomain = {
19729
20730
  "sync run --connection-id 6 --full-resync",
19730
20731
  "sync run --connection-id 6 --quiet",
19731
20732
  "sync run --connection-id 6 --entity-type member",
19732
- "sync run --connection-id 6 --entity-type member --board-id 18406694561"
20733
+ "sync run --connection-id 6 --entity-type member --board-id 18406694561",
20734
+ "sync run --connection-id 6 --dry-run --entity-type member --record-limit 20"
19733
20735
  ],
19734
20736
  mutates: true,
19735
20737
  handler: async ({ ctx, args, workspace }) => {
@@ -19749,12 +20751,39 @@ var syncDomain = {
19749
20751
  entityType = rawEntityType;
19750
20752
  }
19751
20753
  const boardId = args["board-id"];
20754
+ const rawRecordLimit = args["record-limit"];
20755
+ let recordLimit;
20756
+ if (rawRecordLimit !== void 0 && rawRecordLimit !== "") {
20757
+ const parsed = Number(rawRecordLimit);
20758
+ if (!Number.isInteger(parsed) || parsed < 1 || parsed > 200) {
20759
+ throw new CLIError(
20760
+ `Invalid --record-limit "${rawRecordLimit}". Must be an integer between 1 and 200.`
20761
+ );
20762
+ }
20763
+ if (!dryRun) {
20764
+ throw new CLIError(
20765
+ "--record-limit requires --dry-run: capped runs are preview-only."
20766
+ );
20767
+ }
20768
+ if (entityType === void 0) {
20769
+ throw new CLIError(
20770
+ "--record-limit requires --entity-type: capped previews must target a single entity type."
20771
+ );
20772
+ }
20773
+ recordLimit = parsed;
20774
+ }
20775
+ if (fullResync && (dryRun || recordLimit !== void 0)) {
20776
+ throw new CLIError(
20777
+ "--full-resync is incompatible with --dry-run / --record-limit: checkpoint reset must happen on a non-preview run."
20778
+ );
20779
+ }
19752
20780
  if (!quiet) {
19753
20781
  const flags = [
19754
20782
  dryRun && "(dry run)",
19755
20783
  fullResync && "(full re-sync)",
19756
20784
  entityType && `(${entityType} only)`,
19757
- boardId && `(board ${boardId})`
20785
+ boardId && `(board ${boardId})`,
20786
+ recordLimit !== void 0 && `(limit ${recordLimit})`
19758
20787
  ].filter(Boolean).join(" ");
19759
20788
  console.error(
19760
20789
  `Starting sync for connection ${connectionId}${flags ? ` ${flags}` : ""}...`
@@ -19767,7 +20796,8 @@ var syncDomain = {
19767
20796
  dryRun,
19768
20797
  resetCheckpoints: fullResync,
19769
20798
  entityType,
19770
- boardId
20799
+ boardId,
20800
+ recordLimit
19771
20801
  }
19772
20802
  );
19773
20803
  if (!response.ok) {
@@ -19961,6 +20991,31 @@ var appConnectionsDomain = {
19961
20991
  );
19962
20992
  outputSingle(result2, ctx);
19963
20993
  }
20994
+ },
20995
+ {
20996
+ path: ["app-connections", "relink-member"],
20997
+ description: "Re-enable sync for a previously unlinked member by clearing the manual-unlink exclusion on this connection. Idempotent: returns cleared=false when no exclusion exists.",
20998
+ mutates: true,
20999
+ requiresWorkspace: true,
21000
+ args: [
21001
+ { name: "id", description: "Connection ID (numeric)", required: true },
21002
+ { name: "member-id", description: "Member ID (numeric)", required: true },
21003
+ {
21004
+ name: "board-id",
21005
+ description: "Optional Monday board ID. Required for Monday connections where exclusions are board-scoped; omit for single-scope connectors."
21006
+ }
21007
+ ],
21008
+ handler: async ({ ctx, workspace, args }) => {
21009
+ const boardIdRaw = args["board-id"];
21010
+ const options = boardIdRaw !== void 0 && boardIdRaw !== "" ? { boardId: String(boardIdRaw) } : void 0;
21011
+ const result2 = await requireAuth(ctx).apiClient.clearConnectionMemberExclusion(
21012
+ workspace,
21013
+ requireNumber(args, "id"),
21014
+ requireNumber(args, "member-id"),
21015
+ options
21016
+ );
21017
+ outputSingle(result2, ctx);
21018
+ }
19964
21019
  }
19965
21020
  ]
19966
21021
  };
@@ -20653,49 +21708,6 @@ var mondayDomain = {
20653
21708
  outputData(result2, ctx);
20654
21709
  }
20655
21710
  },
20656
- {
20657
- path: ["monday", "webhook-get"],
20658
- description: "Get a Monday.com webhook",
20659
- requiresWorkspace: true,
20660
- args: [
20661
- { name: "board-id", description: "Board ID", required: true },
20662
- { name: "id", description: "Webhook ID", required: true }
20663
- ],
20664
- handler: async ({ ctx, args, workspace }) => {
20665
- const result2 = await requireAuth(ctx).apiClient.getMondayWebhook(
20666
- workspace,
20667
- requireString(args, "board-id"),
20668
- requireString(args, "id")
20669
- );
20670
- outputSingle(result2, ctx);
20671
- }
20672
- },
20673
- {
20674
- path: ["monday", "webhook-create"],
20675
- description: "Create a Monday.com webhook",
20676
- mutates: true,
20677
- requiresWorkspace: true,
20678
- handler: async ({ ctx, data, workspace }) => {
20679
- const result2 = await requireAuth(ctx).apiClient.createMondayWebhook(
20680
- workspace,
20681
- data
20682
- );
20683
- outputSingle(result2, ctx);
20684
- }
20685
- },
20686
- {
20687
- path: ["monday", "webhook-delete"],
20688
- description: "Delete a Monday.com webhook",
20689
- mutates: true,
20690
- requiresWorkspace: true,
20691
- args: [{ name: "id", description: "Webhook ID", required: true }],
20692
- handler: async ({ ctx, args, workspace }) => {
20693
- const id = requireString(args, "id");
20694
- await requireAuth(ctx).apiClient.deleteMondayWebhook(workspace, id);
20695
- process.stdout.write(`Deleted Monday webhook ${id}
20696
- `);
20697
- }
20698
- },
20699
21711
  {
20700
21712
  path: ["monday", "user-info"],
20701
21713
  description: "Get current Monday.com user info",
@@ -21035,6 +22047,113 @@ var slackAppsDomain = {
21035
22047
  ]
21036
22048
  };
21037
22049
 
22050
+ // src/domains/integrations/teams-apps.ts
22051
+ var COLUMNS33 = [COL.id(), COL.name(), COL.status()];
22052
+ function addTeamsUrls(data, apiUrl, workspaceUuid) {
22053
+ const base = `${apiUrl}/api/v2/w/${workspaceUuid}/app-connections/teams`;
22054
+ return {
22055
+ ...data,
22056
+ _urls: {
22057
+ eventsEndpoint: `${base}/events`,
22058
+ oauthUserAuthorize: `${base}/oauth/user/authorize?app_id=${data.id ?? ""}`,
22059
+ oauthUserCallback: `${base}/oauth/user/callback`
22060
+ }
22061
+ };
22062
+ }
22063
+ var teamsAppsDomain = {
22064
+ name: "teams-apps",
22065
+ description: "Manage Microsoft Teams app integrations",
22066
+ commands: [
22067
+ ...crudCommands({
22068
+ prefix: ["teams-apps"],
22069
+ entityName: "Teams app",
22070
+ listMethod: "getTeamsApps",
22071
+ deleteMethod: "deleteTeamsApp",
22072
+ columns: COLUMNS33,
22073
+ paginationSupport: "full"
22074
+ }),
22075
+ {
22076
+ path: ["teams-apps", "get"],
22077
+ description: "Get a Teams app by ID",
22078
+ args: [{ name: "id", description: "Teams app ID", required: true }],
22079
+ requiresWorkspace: true,
22080
+ handler: async ({ ctx, workspace, args }) => {
22081
+ const result2 = await requireAuth(ctx).apiClient.getTeamsApp(
22082
+ workspace,
22083
+ requireNumber(args, "id")
22084
+ );
22085
+ outputSingle(addTeamsUrls(result2, ctx.envConfig.apiUrl, workspace), ctx);
22086
+ }
22087
+ },
22088
+ {
22089
+ path: ["teams-apps", "create"],
22090
+ description: "Create a Teams app",
22091
+ mutates: true,
22092
+ requiresWorkspace: true,
22093
+ handler: async ({ ctx, workspace, data }) => {
22094
+ if (!data) throw new CLIError("JSON data required (--data, --file, or stdin)");
22095
+ const result2 = await requireAuth(ctx).apiClient.createTeamsApp(workspace, data);
22096
+ outputSingle(addTeamsUrls(result2, ctx.envConfig.apiUrl, workspace), ctx);
22097
+ }
22098
+ },
22099
+ {
22100
+ path: ["teams-apps", "update"],
22101
+ description: "Update a Teams app",
22102
+ mutates: true,
22103
+ args: [{ name: "id", description: "Teams app ID", required: true }],
22104
+ requiresWorkspace: true,
22105
+ handler: async ({ ctx, workspace, args, data }) => {
22106
+ if (!data) throw new CLIError("JSON data required (--data, --file, or stdin)");
22107
+ const result2 = await requireAuth(ctx).apiClient.updateTeamsApp(
22108
+ workspace,
22109
+ requireNumber(args, "id"),
22110
+ data
22111
+ );
22112
+ outputSingle(addTeamsUrls(result2, ctx.envConfig.apiUrl, workspace), ctx);
22113
+ }
22114
+ },
22115
+ {
22116
+ path: ["teams-apps", "conversations"],
22117
+ description: "List Teams conversations linked to chats",
22118
+ requiresWorkspace: true,
22119
+ args: [{ name: "id", description: "Teams app ID", required: true }],
22120
+ handler: async ({ ctx, workspace, args }) => {
22121
+ const result2 = await requireAuth(ctx).apiClient.getTeamsConversations(
22122
+ workspace,
22123
+ requireNumber(args, "id")
22124
+ );
22125
+ outputData(result2, ctx);
22126
+ }
22127
+ },
22128
+ {
22129
+ path: ["teams-apps", "installations"],
22130
+ description: "List per-tenant Teams installations",
22131
+ requiresWorkspace: true,
22132
+ args: [{ name: "id", description: "Teams app ID", required: true }],
22133
+ handler: async ({ ctx, workspace, args }) => {
22134
+ const result2 = await requireAuth(ctx).apiClient.getTeamsInstallations(
22135
+ workspace,
22136
+ requireNumber(args, "id")
22137
+ );
22138
+ outputData(result2, ctx);
22139
+ }
22140
+ },
22141
+ {
22142
+ path: ["teams-apps", "accounts"],
22143
+ description: "List linked Teams (Entra) accounts for this app",
22144
+ requiresWorkspace: true,
22145
+ args: [{ name: "id", description: "Teams app ID", required: true }],
22146
+ handler: async ({ ctx, workspace, args }) => {
22147
+ const result2 = await requireAuth(ctx).apiClient.getTeamsAppAccounts(
22148
+ workspace,
22149
+ requireNumber(args, "id")
22150
+ );
22151
+ outputData(result2, ctx);
22152
+ }
22153
+ }
22154
+ ]
22155
+ };
22156
+
21038
22157
  // src/domains/index.ts
21039
22158
  function registerPublicDomains(registry) {
21040
22159
  registry.register(tasksDomain);
@@ -21066,6 +22185,7 @@ function registerPublicDomains(registry) {
21066
22185
  registry.register(mcpServersDomain);
21067
22186
  registry.register(apiKeysDomain);
21068
22187
  registry.register(subscriptionsDomain);
22188
+ registry.register(supportDomain);
21069
22189
  registry.register(reportsDomain);
21070
22190
  registry.register(aiModelsDomain);
21071
22191
  registry.register(featuresDomain);
@@ -21081,6 +22201,7 @@ function registerPublicDomains(registry) {
21081
22201
  registry.register(confluenceDomain);
21082
22202
  registry.register(discordBotsDomain);
21083
22203
  registry.register(slackAppsDomain);
22204
+ registry.register(teamsAppsDomain);
21084
22205
  registry.register(fhirConnectionsDomain);
21085
22206
  registry.register(appConnectionsDomain);
21086
22207
  registry.register(hubspotDomain);
@@ -23134,7 +24255,7 @@ async function createMemberChat(apiClient, workspace, memberId) {
23134
24255
  }
23135
24256
 
23136
24257
  // src/commands/organizations.ts
23137
- var COLUMNS33 = [
24258
+ var COLUMNS34 = [
23138
24259
  { header: "NAME", getValue: (o) => o.organizationName || "", maxWidth: 35 },
23139
24260
  { header: "SLUG", getValue: (o) => o.organizationSlug || "", maxWidth: 25 },
23140
24261
  { header: "UUID", getValue: (o) => o.organizationUuid },
@@ -23142,11 +24263,11 @@ var COLUMNS33 = [
23142
24263
  ];
23143
24264
  async function organizationsListCommand(ctx) {
23144
24265
  const organizations = await ctx.apiClient.getMyOrganizations();
23145
- outputData(organizations, ctx, COLUMNS33);
24266
+ outputData(organizations, ctx, COLUMNS34);
23146
24267
  }
23147
24268
 
23148
24269
  // src/commands/whoami.ts
23149
- var COLUMNS34 = [
24270
+ var COLUMNS35 = [
23150
24271
  { header: "NAME", getValue: (a) => a.name || "", maxWidth: 30 },
23151
24272
  { header: "EMAIL", getValue: (a) => a.email || "", maxWidth: 40 },
23152
24273
  { header: "UUID", getValue: (a) => a.uuid },
@@ -23154,12 +24275,12 @@ var COLUMNS34 = [
23154
24275
  ];
23155
24276
  async function whoamiCommand(ctx) {
23156
24277
  const account = await ctx.apiClient.getUserAccount();
23157
- outputSingle(account, ctx, COLUMNS34);
24278
+ outputSingle(account, ctx, COLUMNS35);
23158
24279
  }
23159
24280
 
23160
24281
  // package.json
23161
24282
  var package_default = {
23162
- version: "0.4.0"};
24283
+ version: "0.5.0"};
23163
24284
 
23164
24285
  // src/gr.ts
23165
24286
  var VERSION = package_default.version;