@gravity-rail/cli 2.0.0 → 3.1.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
@@ -241,7 +241,7 @@ var init_pagination = __esm({
241
241
  }
242
242
  });
243
243
 
244
- // ../sdk/dist/chunk-GCN4OMYU.js
244
+ // ../sdk/dist/chunk-RLFS7O2L.js
245
245
  function isApiValidationError(value) {
246
246
  if (!value || typeof value !== "object") return false;
247
247
  const v = value;
@@ -276,8 +276,8 @@ function setOrgAuthHeader(headers2, token) {
276
276
  headers2.set(orgAuthHeaderName(token), token);
277
277
  }
278
278
  var ApiError, BaseApiClient;
279
- var init_chunk_GCN4OMYU = __esm({
280
- "../sdk/dist/chunk-GCN4OMYU.js"() {
279
+ var init_chunk_RLFS7O2L = __esm({
280
+ "../sdk/dist/chunk-RLFS7O2L.js"() {
281
281
  ApiError = class extends Error {
282
282
  statusCode;
283
283
  /** Legacy string-array errors — kept for non-validation callers. */
@@ -526,6 +526,9 @@ ${formattedErrors}`, response.status);
526
526
  const headers2 = new Headers({
527
527
  ...options?.headers || {}
528
528
  });
529
+ if (typeof options?.body === "string" && !headers2.has("Content-Type")) {
530
+ headers2.set("Content-Type", "application/json");
531
+ }
529
532
  if (this.apiKey) {
530
533
  headers2.set("Authorization", `Bearer ${this.apiKey}`);
531
534
  }
@@ -3164,7 +3167,7 @@ var init_libphonenumber_js = __esm({
3164
3167
  }
3165
3168
  });
3166
3169
 
3167
- // ../sdk/dist/chunk-SVRE6KIM.js
3170
+ // ../sdk/dist/chunk-ANVLMZLD.js
3168
3171
  function resourceWorkflowsPath(wid, ...segments) {
3169
3172
  const tail = segments.map((segment) => encodeURIComponent(String(segment))).join("/");
3170
3173
  const base = `w/${encodeURIComponent(wid)}/resource-workflows`;
@@ -3268,6 +3271,9 @@ function memberImportUpload(file, roleId, options) {
3268
3271
  function businessProfilePath(orgUuid, legalEntityUuid) {
3269
3272
  return legalEntityUuid ? `o/${orgUuid}/legal-entities/${legalEntityUuid}/business-profile` : `o/${orgUuid}/business-profile`;
3270
3273
  }
3274
+ function campaignQuery(options) {
3275
+ return options?.campaignUuid ? `?campaignUuid=${encodeURIComponent(options.campaignUuid)}` : "";
3276
+ }
3271
3277
  function getOAuthPath(providerSlug, action) {
3272
3278
  if (providerSlug === "google_calendar") {
3273
3279
  return `api/v2/oauth/google/calendar/${action}`;
@@ -3300,6 +3306,13 @@ function appendAnalyticsFilters(params, filters) {
3300
3306
  filters.answeredBy?.forEach((v) => params.append("answeredBy", v));
3301
3307
  filters.memberLabel?.forEach((v) => params.append("memberLabel", v));
3302
3308
  }
3309
+ function appendPhoneLogFilters(params, filters) {
3310
+ if (!filters) return;
3311
+ if (filters.inbound !== void 0) params.set("inbound", String(filters.inbound));
3312
+ if (filters.dateFrom) params.set("dateFrom", filters.dateFrom);
3313
+ if (filters.dateTo) params.set("dateTo", filters.dateTo);
3314
+ if (filters.otherNumber) params.set("otherNumber", filters.otherNumber);
3315
+ }
3303
3316
  function appendFilters(params, filters) {
3304
3317
  if (!filters) return;
3305
3318
  if (filters.channel !== void 0) params.set("channel", filters.channel);
@@ -3561,7 +3574,6 @@ function bindChatsMethods(target, chats) {
3561
3574
  target.summarizeChat = chats.summarizeChat.bind(chats);
3562
3575
  target.getChatMessages = chats.getChatMessages.bind(chats);
3563
3576
  target.getChatTaskTransitions = chats.getChatTaskTransitions.bind(chats);
3564
- target.getChildThreadMessages = chats.getChildThreadMessages.bind(chats);
3565
3577
  target.getChatToolCallMessages = chats.getChatToolCallMessages.bind(chats);
3566
3578
  target.getChatTools = chats.getChatTools.bind(chats);
3567
3579
  target.initiateOutboundCall = chats.initiateOutboundCall.bind(chats);
@@ -3761,6 +3773,7 @@ function bindMembersMethods(target, members) {
3761
3773
  }
3762
3774
  function bindWorkspacesMethods(target, workspaces, signupRequests) {
3763
3775
  target.getWorkspaces = workspaces.getWorkspaces.bind(workspaces);
3776
+ target.getWorkspaceOrganizationDirectory = workspaces.getWorkspaceOrganizationDirectory.bind(workspaces);
3764
3777
  target.getOrganizationWorkspacePages = workspaces.getOrganizationWorkspacePages.bind(workspaces);
3765
3778
  target.getDeviceAdmissibleWorkspaces = workspaces.getDeviceAdmissibleWorkspaces.bind(workspaces);
3766
3779
  target.getPublicWorkspaces = workspaces.getPublicWorkspaces.bind(workspaces);
@@ -3777,6 +3790,9 @@ function bindWorkspacesMethods(target, workspaces, signupRequests) {
3777
3790
  target.getBusinessHoursStatus = workspaces.getBusinessHoursStatus.bind(workspaces);
3778
3791
  target.getAvailableWorkspaceFeatures = workspaces.getAvailableWorkspaceFeatures.bind(workspaces);
3779
3792
  target.getWorkspaceNotices = workspaces.getWorkspaceNotices.bind(workspaces);
3793
+ target.getNotificationSubscriptions = workspaces.getNotificationSubscriptions.bind(workspaces);
3794
+ target.updateNotificationSubscription = workspaces.updateNotificationSubscription.bind(workspaces);
3795
+ target.getNotificationAudience = workspaces.getNotificationAudience.bind(workspaces);
3780
3796
  target.getNotifications = workspaces.getNotifications.bind(workspaces);
3781
3797
  target.getNotification = workspaces.getNotification.bind(workspaces);
3782
3798
  target.getUnreadNotificationCount = workspaces.getUnreadNotificationCount.bind(workspaces);
@@ -3784,7 +3800,6 @@ function bindWorkspacesMethods(target, workspaces, signupRequests) {
3784
3800
  target.dismissNotification = workspaces.dismissNotification.bind(workspaces);
3785
3801
  target.dismissAllNotifications = workspaces.dismissAllNotifications.bind(workspaces);
3786
3802
  target.getResellerWorkspaces = workspaces.getResellerWorkspaces.bind(workspaces);
3787
- target.createClientWorkspace = workspaces.createClientWorkspace.bind(workspaces);
3788
3803
  target.getClientWorkspace = workspaces.getClientWorkspace.bind(workspaces);
3789
3804
  target.updateClientWorkspace = workspaces.updateClientWorkspace.bind(workspaces);
3790
3805
  target.deleteClientWorkspace = workspaces.deleteClientWorkspace.bind(workspaces);
@@ -3839,6 +3854,9 @@ function bindWorkspacesMethods(target, workspaces, signupRequests) {
3839
3854
  target.declineInvitation = signupRequests.declineInvitation.bind(signupRequests);
3840
3855
  }
3841
3856
  function bindAuthMethods(target, auth, assignments) {
3857
+ target.getAccountNotices = auth.getAccountNotices.bind(auth);
3858
+ target.viewAccountNotice = auth.viewAccountNotice.bind(auth);
3859
+ target.dismissAccountNotice = auth.dismissAccountNotice.bind(auth);
3842
3860
  target.getUserAccount = auth.getUserAccount.bind(auth);
3843
3861
  target.updateUserAccount = auth.updateUserAccount.bind(auth);
3844
3862
  target.recordAcquisition = auth.recordAcquisition.bind(auth);
@@ -3898,6 +3916,11 @@ function bindAuthMethods(target, auth, assignments) {
3898
3916
  target.executeAssignmentTool = assignments.executeAssignmentTool.bind(assignments);
3899
3917
  }
3900
3918
  function bindSitesMethods(target, sites) {
3919
+ target.endPublicDemo = sites.endPublicDemo.bind(sites);
3920
+ target.startPublicDemo = sites.startPublicDemo.bind(sites);
3921
+ target.getPublicDemo = sites.getPublicDemo.bind(sites);
3922
+ target.sendPublicDemoMessage = sites.sendPublicDemoMessage.bind(sites);
3923
+ target.submitPublicDemoForm = sites.submitPublicDemoForm.bind(sites);
3901
3924
  target.getSites = sites.getSites.bind(sites);
3902
3925
  target.checkSiteSlugAvailability = sites.checkSiteSlugAvailability.bind(sites);
3903
3926
  target.checkSiteDomainAvailability = sites.checkSiteDomainAvailability.bind(sites);
@@ -3905,6 +3928,7 @@ function bindSitesMethods(target, sites) {
3905
3928
  target.getSiteSharing = sites.getSiteSharing.bind(sites);
3906
3929
  target.updateSiteSharing = sites.updateSiteSharing.bind(sites);
3907
3930
  target.getSiteSource = sites.getSiteSource.bind(sites);
3931
+ target.getSiteSourceReleases = sites.getSiteSourceReleases.bind(sites);
3908
3932
  target.getSiteSourceTemplates = sites.getSiteSourceTemplates.bind(sites);
3909
3933
  target.createSiteSource = sites.createSiteSource.bind(sites);
3910
3934
  target.buildSiteSource = sites.buildSiteSource.bind(sites);
@@ -3963,6 +3987,8 @@ function bindFilesMethods(target, files) {
3963
3987
  target.createFolder = files.createFolder.bind(files);
3964
3988
  target.updateFolder = files.updateFolder.bind(files);
3965
3989
  target.deleteFolder = files.deleteFolder.bind(files);
3990
+ target.reindexFile = files.reindexFile.bind(files);
3991
+ target.searchFile = files.searchFile.bind(files);
3966
3992
  target.reindexFolder = files.reindexFolder.bind(files);
3967
3993
  target.searchFolder = files.searchFolder.bind(files);
3968
3994
  target.getFileLabels = files.getFileLabels.bind(files);
@@ -4042,6 +4068,7 @@ function bindWorkflowsMethods(target, workflows, workflowNotes, voice, superviso
4042
4068
  target.getWorkflowsOutlineBatch = workflows.getWorkflowsOutlineBatch.bind(workflows);
4043
4069
  target.createWorkflow = workflows.createWorkflow.bind(workflows);
4044
4070
  target.updateWorkflow = workflows.updateWorkflow.bind(workflows);
4071
+ target.uploadWorkflowKnowledge = workflows.uploadWorkflowKnowledge.bind(workflows);
4045
4072
  target.getWorkflowDeletionPreview = workflows.getWorkflowDeletionPreview.bind(workflows);
4046
4073
  target.deleteWorkflow = workflows.deleteWorkflow.bind(workflows);
4047
4074
  target.archiveWorkflow = workflows.archiveWorkflow.bind(workflows);
@@ -4129,6 +4156,7 @@ function bindCommunicationsMethods(target, phoneNumbers, inboxes, notificationRu
4129
4156
  target.getPhoneNumberOutboundAnalyticsSummary = phoneNumbers.getPhoneNumberOutboundAnalyticsSummary.bind(phoneNumbers);
4130
4157
  target.getPhoneNumberOutboundAnalyticsCalls = phoneNumbers.getPhoneNumberOutboundAnalyticsCalls.bind(phoneNumbers);
4131
4158
  target.exportPhoneNumberOutboundAnalyticsCsv = phoneNumbers.exportPhoneNumberOutboundAnalyticsCsv.bind(phoneNumbers);
4159
+ target.getPhoneNumberActivity = phoneNumbers.getPhoneNumberActivity.bind(phoneNumbers);
4132
4160
  target.getPhoneNumberMessages = phoneNumbers.getPhoneNumberMessages.bind(phoneNumbers);
4133
4161
  target.getPhoneNumberFaxes = phoneNumbers.getPhoneNumberFaxes.bind(phoneNumbers);
4134
4162
  target.getPhoneNumberVoicemails = phoneNumbers.getPhoneNumberVoicemails.bind(phoneNumbers);
@@ -4142,6 +4170,8 @@ function bindCommunicationsMethods(target, phoneNumbers, inboxes, notificationRu
4142
4170
  target.createInbox = inboxes.createInbox.bind(inboxes);
4143
4171
  target.updateInbox = inboxes.updateInbox.bind(inboxes);
4144
4172
  target.deleteInbox = inboxes.deleteInbox.bind(inboxes);
4173
+ target.archiveInbox = inboxes.archiveInbox.bind(inboxes);
4174
+ target.getInboxArchiveBlockers = inboxes.getInboxArchiveBlockers.bind(inboxes);
4145
4175
  target.getInboxEmails = inboxes.getInboxEmails.bind(inboxes);
4146
4176
  target.getInboxEmail = inboxes.getInboxEmail.bind(inboxes);
4147
4177
  target.markEmailAsRead = inboxes.markEmailAsRead.bind(inboxes);
@@ -4295,7 +4325,6 @@ function bindIntegrationsMethods(target, mondayIntegration, discordBots, slackAp
4295
4325
  target.autoCreateDataTypeFromBoard = mondayIntegration.autoCreateDataTypeFromBoard.bind(mondayIntegration);
4296
4326
  target.getDiscordBots = discordBots.getDiscordBots.bind(discordBots);
4297
4327
  target.getDiscordBot = discordBots.getDiscordBot.bind(discordBots);
4298
- target.getDiscordBotByUuid = discordBots.getDiscordBotByUuid.bind(discordBots);
4299
4328
  target.createDiscordBot = discordBots.createDiscordBot.bind(discordBots);
4300
4329
  target.updateDiscordBot = discordBots.updateDiscordBot.bind(discordBots);
4301
4330
  target.deleteDiscordBot = discordBots.deleteDiscordBot.bind(discordBots);
@@ -4360,6 +4389,7 @@ function bindIntegrationsMethods(target, mondayIntegration, discordBots, slackAp
4360
4389
  target.fhirGetEncounterSyncRuns = fhirConnections.fhirGetEncounterSyncRuns.bind(fhirConnections);
4361
4390
  target.fhirRefreshEncounterPatient = fhirConnections.fhirRefreshEncounterPatient.bind(fhirConnections);
4362
4391
  target.fhirBackfillEncounterSync = fhirConnections.fhirBackfillEncounterSync.bind(fhirConnections);
4392
+ target.getFhirConnectionSyncConfig = fhirConnections.getFhirConnectionSyncConfig.bind(fhirConnections);
4363
4393
  target.getAthenaPlatformApp = fhirConnections.getAthenaPlatformApp.bind(fhirConnections);
4364
4394
  target.verifyAthenaAccess = fhirConnections.verifyAthenaAccess.bind(fhirConnections);
4365
4395
  target.connectAthena = fhirConnections.connectAthena.bind(fhirConnections);
@@ -4424,6 +4454,8 @@ function bindIntegrationsMethods(target, mondayIntegration, discordBots, slackAp
4424
4454
  target.describeSalesforceObject = salesforce.describeSalesforceObject.bind(salesforce);
4425
4455
  target.searchSalesforceRecords = salesforce.searchSalesforceRecords.bind(salesforce);
4426
4456
  target.importSalesforceMembers = salesforce.importSalesforceMembers.bind(salesforce);
4457
+ target.getHubspotBookingReceipt = hubspot.getHubspotBookingReceipt.bind(hubspot);
4458
+ target.releaseHubspotBookingAttempt = hubspot.releaseHubspotBookingAttempt.bind(hubspot);
4427
4459
  target.installHubspot = hubspot.installHubspot.bind(hubspot);
4428
4460
  target.configureHubspot = hubspot.configureHubspot.bind(hubspot);
4429
4461
  target.startHubspotOAuth = hubspot.startHubspotOAuth.bind(hubspot);
@@ -4454,6 +4486,7 @@ function bindIntegrationsMethods(target, mondayIntegration, discordBots, slackAp
4454
4486
  target.startSyncRun = connectionSync.startSyncRun.bind(connectionSync);
4455
4487
  target.getSyncRuns = connectionSync.getSyncRuns.bind(connectionSync);
4456
4488
  target.getSyncRunItems = connectionSync.getSyncRunItems.bind(connectionSync);
4489
+ target.getSyncRunItemsPage = connectionSync.getSyncRunItemsPage.bind(connectionSync);
4457
4490
  target.getMemberSyncSummary = connectionSync.getMemberSyncSummary.bind(connectionSync);
4458
4491
  target.getConnectionFieldHomes = connectionSync.getConnectionFieldHomes.bind(connectionSync);
4459
4492
  target.getInboundRecordStatus = connectionSync.getInboundRecordStatus.bind(connectionSync);
@@ -4496,6 +4529,13 @@ function bindOperatorMethods(target, operatorGroups) {
4496
4529
  target.sendOperatorMessage = operatorGroups.sendOperatorMessage.bind(operatorGroups);
4497
4530
  }
4498
4531
  function bindOrgMethods(target, org) {
4532
+ target.authorizeOrgManagerDelegation = org.authorizeOrgManagerDelegation.bind(org);
4533
+ target.getOrgManagerCredentialResponse = org.getOrgManagerCredentialResponse.bind(org);
4534
+ target.stopOrgManagerTurn = org.stopOrgManagerTurn.bind(org);
4535
+ target.getOrgManagerChats = org.getOrgManagerChats.bind(org);
4536
+ target.createOrgManagerChat = org.createOrgManagerChat.bind(org);
4537
+ target.getOrgManagerMessages = org.getOrgManagerMessages.bind(org);
4538
+ target.startOrgManagerTurn = org.startOrgManagerTurn.bind(org);
4499
4539
  target.listOrgDomains = org.listOrgDomains.bind(org);
4500
4540
  target.registerOrgDomain = org.registerOrgDomain.bind(org);
4501
4541
  target.getOrgDomain = org.getOrgDomain.bind(org);
@@ -4693,6 +4733,7 @@ function bindMetricsMethods(target, metrics) {
4693
4733
  target.deleteMetric = metrics.deleteMetric.bind(metrics);
4694
4734
  target.listMetricObservations = metrics.listMetricObservations.bind(metrics);
4695
4735
  target.getMetricSeries = metrics.getMetricSeries.bind(metrics);
4736
+ target.getMetricSeriesBatch = metrics.getMetricSeriesBatch.bind(metrics);
4696
4737
  target.computeChatMetrics = metrics.computeChatMetrics.bind(metrics);
4697
4738
  }
4698
4739
  function bindDataReportsMethods(target, dataReports) {
@@ -4768,9 +4809,9 @@ function getRevisionState(workflow, revision) {
4768
4809
  };
4769
4810
  }
4770
4811
  var AbilitiesApi, ResourceWorkflowsApi, BundlesApi, InstallationsApi, AccessGrantsApi, AgentTasksApi, AgentsApi, AIModelsApi, ApiKeysApi, AppsApi, AssignmentsApi, VoiceApi, AuthApi, BuildersApi, CalendarsApi, CallsApi, CELApi, ChatsApi, ConfluenceApi, CustomToolkitsApi, DataTypesApi, DiscordBotsApi, SlackAppsApi, EventsApi, FeaturesApi, FhirConnectionsApi, StediApi, InboundFaxStatus, DocumoFaxApi, HealthieApi, FilesApi, InboxesApi, InquiriesApi, AppConnectionsApi, McpServersApi, MemberImportValidationError, MembersApi, MondayIntegrationApi, NotificationRulesApi, OperatorApi, OrgApi, OAuthConnectionsApi, OAuthApi, PhoneNumbersApi, PronunciationsApi, PromptsApi, PersonasApi, QueriesApi, QualificationsApi, ReportsApi, RoutingRulesApi, SalesforceApi, ConnectionSyncApi, HubspotApi, SitesApi, SubscriptionsApi, SupportRequestsApi, CustomersApi, ResellersApi, SupervisorsApi, TasksApi, TemplatesApi, ToolkitsApi, JourneysApi, WorkflowsApi, WorkflowNotesApi, EventRuleObjectType, EventRuleEventType, EventRuleActionType, DriverMode, MEMBER_RELATIONSHIP_KINDS, WorkspaceInvitationsApi, WorkspacesApi, MedicalBillingApi, DashboardsApi, DevicesApi, TeamsAppsApi, ExperimentsApi, PatientSyncConnectionsApi, ClaimMdApi, ActivityApi, MotdApi, InterventionRequestsApi, MetricsApi, DataReportsApi, ProjectsApi, TrackedLinksApi, WORKSPACE_METHOD_NAMES, WORKSPACE_METHOD_NAME_SET, GravityRailClient, WIDGET_SLUGS, CHAT_TYPES, BUILTIN_ASSISTANT_CHAT_TYPES, MEMBER_AGENT_CHAT_TYPES, ActivityGrain, ActivityGroupBy, ActivityOpenItemOrder, ActivityWindowBasis;
4771
- var init_chunk_SVRE6KIM = __esm({
4772
- "../sdk/dist/chunk-SVRE6KIM.js"() {
4773
- init_chunk_GCN4OMYU();
4812
+ var init_chunk_ANVLMZLD = __esm({
4813
+ "../sdk/dist/chunk-ANVLMZLD.js"() {
4814
+ init_chunk_RLFS7O2L();
4774
4815
  init_libphonenumber_js();
4775
4816
  AbilitiesApi = class extends BaseApiClient {
4776
4817
  /**
@@ -5625,6 +5666,18 @@ var init_chunk_SVRE6KIM = __esm({
5625
5666
  async getUserAccount() {
5626
5667
  return this.fetch("account");
5627
5668
  }
5669
+ /** Active, undismissed product notices for this account across workspaces. */
5670
+ async getAccountNotices() {
5671
+ return this.fetch("account/notices");
5672
+ }
5673
+ async viewAccountNotice(id) {
5674
+ return this.fetch(`account/notices/${encodeURIComponent(id)}/view`, { method: "PUT" });
5675
+ }
5676
+ async dismissAccountNotice(id) {
5677
+ return this.fetch(`account/notices/${encodeURIComponent(id)}/dismiss`, {
5678
+ method: "PUT"
5679
+ });
5680
+ }
5628
5681
  /** Update the authenticated user's account information. */
5629
5682
  async updateUserAccount(info) {
5630
5683
  return this.fetch("account", {
@@ -6716,24 +6769,6 @@ var init_chunk_SVRE6KIM = __esm({
6716
6769
  `w/${wid}/chats/${id}/task-transitions${params.toString() ? `?${params.toString()}` : ""}`
6717
6770
  );
6718
6771
  }
6719
- /** List the background-work thread hanging off a message.
6720
- *
6721
- * When a tool trajectory outgrows its turn it detaches and runs in the
6722
- * background (ADR-11 / forked trajectories), writing its messages as a
6723
- * child thread parented at the fork point. Main-history reads exclude
6724
- * them, so this is how the "show work" affordance fetches them — lazily,
6725
- * only when a message with a non-zero `childMessageCount` is expanded.
6726
- * Returns the thread in chronological order, empty when there is none.
6727
- *
6728
- * `messageUuid` is the fork point's `ChatMessage.id`. */
6729
- async getChildThreadMessages(wid, chatId, messageUuid, limit = 200, offset = 0) {
6730
- const params = new URLSearchParams();
6731
- params.append("limit", limit.toString());
6732
- params.append("offset", offset.toString());
6733
- return this.fetch(
6734
- `w/${wid}/chats/${chatId}/messages/${messageUuid}/children?${params.toString()}`
6735
- );
6736
- }
6737
6772
  /** List messages associated with a specific tool call in a chat. */
6738
6773
  async getChatToolCallMessages(wid, chatId, callId, limit = 100, offset = 0) {
6739
6774
  const params = new URLSearchParams();
@@ -7389,12 +7424,6 @@ var init_chunk_SVRE6KIM = __esm({
7389
7424
  async getDiscordBot(wid, botId) {
7390
7425
  return this.fetch(`w/${wid}/app-connections/discord/bots/${botId}`);
7391
7426
  }
7392
- /**
7393
- * Get a Discord bot by UUID.
7394
- */
7395
- async getDiscordBotByUuid(wid, uuid) {
7396
- return this.fetch(`w/${wid}/app-connections/discord/bots/uuid/${uuid}`);
7397
- }
7398
7427
  /**
7399
7428
  * Create a new Discord bot configuration.
7400
7429
  */
@@ -7646,6 +7675,7 @@ var init_chunk_SVRE6KIM = __esm({
7646
7675
  /** List event rules in the workspace, paginated. */
7647
7676
  async getEventRules(wid, params) {
7648
7677
  const query2 = new URLSearchParams();
7678
+ if (params?.search) query2.set("search", params.search);
7649
7679
  if (params?.page !== void 0) query2.set("page", String(params.page));
7650
7680
  if (params?.pageSize !== void 0) query2.set("pageSize", String(params.pageSize));
7651
7681
  const qs = query2.toString() ? `?${query2.toString()}` : "";
@@ -7905,6 +7935,22 @@ var init_chunk_SVRE6KIM = __esm({
7905
7935
  async getFhirConnectionByUuid(wid, uuid) {
7906
7936
  return this.fetch(`w/${wid}/app-connections/fhir/connections/uuid/${uuid}`);
7907
7937
  }
7938
+ /**
7939
+ * The connection's sync configuration, with the eCW encounter-sync runtime
7940
+ * state (`connectionParams.ecwEncounterSyncState`) typed.
7941
+ *
7942
+ * This is the generic connector sync-config route (the same one
7943
+ * `ConnectionSyncApi.getConnectionSyncConfig` wraps), not a FHIR-only
7944
+ * path. It is the one read that still returns the encounter
7945
+ * watermark for a workspace whose eCW feature flag is off: the
7946
+ * encounter-sync status route is flag-gated, while this route requires
7947
+ * only `apps:read`.
7948
+ */
7949
+ async getFhirConnectionSyncConfig(wid, connectionId) {
7950
+ return this.fetch(
7951
+ `w/${wid}/app-connections/${connectionId}/sync-config`
7952
+ );
7953
+ }
7908
7954
  /**
7909
7955
  * Create a new FHIR connection configuration.
7910
7956
  */
@@ -8530,6 +8576,21 @@ var init_chunk_SVRE6KIM = __esm({
8530
8576
  method: "DELETE"
8531
8577
  });
8532
8578
  }
8579
+ /** Queue indexing of an individual File, including a File without a folder. */
8580
+ async reindexFile(wid, id) {
8581
+ return this.fetch(`w/${wid}/files/${id}/reindex`, {
8582
+ method: "POST",
8583
+ body: JSON.stringify({})
8584
+ });
8585
+ }
8586
+ /** Search the current indexed version of an individual File. */
8587
+ async searchFile(wid, id, params) {
8588
+ const searchParams = new URLSearchParams({ query: params.query });
8589
+ if (params.topK !== void 0) searchParams.append("top_k", params.topK.toString());
8590
+ return this.fetch(
8591
+ `w/${wid}/files/${id}/search?${searchParams.toString()}`
8592
+ );
8593
+ }
8533
8594
  /** Trigger reindexing of a folder's contents for search. */
8534
8595
  async reindexFolder(wid, id) {
8535
8596
  return this.fetch(`w/${wid}/folders/${id}/reindex`, {
@@ -8656,9 +8717,20 @@ var init_chunk_SVRE6KIM = __esm({
8656
8717
  }
8657
8718
  };
8658
8719
  InboxesApi = class extends BaseApiClient {
8659
- /** List all inboxes in a workspace. */
8660
- async getInboxes(wid) {
8661
- return this.fetch(`w/${wid}/inboxes`);
8720
+ /**
8721
+ * List inboxes in a workspace.
8722
+ *
8723
+ * `isArchived` picks the half of the archive switch: omitted (or `false`) is
8724
+ * the Active list, `true` the Archived one. The server defaults to active,
8725
+ * so a caller that never passes it sees usable inboxes only.
8726
+ */
8727
+ async getInboxes(wid, options) {
8728
+ const params = new URLSearchParams();
8729
+ if (options?.isArchived !== void 0) {
8730
+ params.set("is_archived", String(options.isArchived));
8731
+ }
8732
+ const query2 = params.toString();
8733
+ return this.fetch(`w/${wid}/inboxes${query2 ? `?${query2}` : ""}`);
8662
8734
  }
8663
8735
  /**
8664
8736
  * Get an inbox by ID or UUID.
@@ -8685,17 +8757,45 @@ var init_chunk_SVRE6KIM = __esm({
8685
8757
  body: JSON.stringify(inbox)
8686
8758
  });
8687
8759
  }
8688
- /** Delete an inbox. */
8760
+ /** Delete an inbox and its emails. Prefer {@link archiveInbox}. */
8689
8761
  async deleteInbox(wid, id) {
8690
8762
  return this.fetch(`w/${wid}/inboxes/${id}`, {
8691
8763
  method: "DELETE"
8692
8764
  });
8693
8765
  }
8694
- /** List emails in an inbox with pagination and optional attachment inclusion. */
8766
+ /**
8767
+ * Archive an inbox: it leaves the Active list, refuses new mail and new
8768
+ * sends, and keeps every email it already holds. One-way.
8769
+ *
8770
+ * Refused with a 400 while a Workflow uses the inbox as its default or an
8771
+ * EventRule sends from it — read {@link getInboxArchiveBlockers} first to
8772
+ * explain that before committing.
8773
+ */
8774
+ async archiveInbox(wid, id) {
8775
+ return this.fetch(`w/${wid}/inboxes/${id}/archive`, {
8776
+ method: "POST",
8777
+ // The route requires a JSON body as a CSRF barrier; `{}` is enough.
8778
+ body: JSON.stringify({})
8779
+ });
8780
+ }
8781
+ /**
8782
+ * What still points at this inbox: Workflows whose default inbox it is, and
8783
+ * EventRules that send from it. `canArchive` is the authoritative answer.
8784
+ */
8785
+ async getInboxArchiveBlockers(wid, id) {
8786
+ return this.fetch(`w/${wid}/inboxes/${id}/archive-blockers`);
8787
+ }
8788
+ /**
8789
+ * List emails in an inbox with pagination, optional attachment inclusion,
8790
+ * a `search` term (sender or subject) and a sort.
8791
+ */
8695
8792
  async getInboxEmails(wid, inboxId, options = {}) {
8696
8793
  const params = new URLSearchParams();
8697
8794
  if (options.page) params.append("page", options.page.toString());
8698
8795
  if (options.pageSize) params.append("pageSize", options.pageSize.toString());
8796
+ if (options.search) params.append("search", options.search);
8797
+ if (options.sortBy) params.append("sortBy", options.sortBy);
8798
+ if (options.sortOrder) params.append("sortOrder", options.sortOrder);
8699
8799
  if (options.includeAttachments)
8700
8800
  params.append("include_attachments", options.includeAttachments.toString());
8701
8801
  return this.fetch(
@@ -8809,9 +8909,15 @@ var init_chunk_SVRE6KIM = __esm({
8809
8909
  `w/${wid}/inboxes/${inboxId}/outbound-email-stats${query2 ? `?${query2}` : ""}`
8810
8910
  );
8811
8911
  }
8812
- /** List email threads in an inbox. */
8813
- async getInboxThreads(wid, inboxId) {
8814
- return this.fetch(`w/${wid}/inboxes/${inboxId}/threads`);
8912
+ /** List email threads in an inbox, `limit` threads from `offset`. */
8913
+ async getInboxThreads(wid, inboxId, options = {}) {
8914
+ const params = new URLSearchParams();
8915
+ if (options.limit !== void 0) params.append("limit", options.limit.toString());
8916
+ if (options.offset) params.append("offset", options.offset.toString());
8917
+ const query2 = params.toString();
8918
+ return this.fetch(
8919
+ `w/${wid}/inboxes/${inboxId}/threads${query2 ? `?${query2}` : ""}`
8920
+ );
8815
8921
  }
8816
8922
  /** List emails in a thread by assignment ID with pagination. */
8817
8923
  async getThreadEmails(wid, inboxId, assignmentId, options = {}) {
@@ -10031,6 +10137,47 @@ var init_chunk_SVRE6KIM = __esm({
10031
10137
  }
10032
10138
  };
10033
10139
  OrgApi = class extends BaseApiClient {
10140
+ async getOrgManagerChats(org, cursor) {
10141
+ return this.fetch(
10142
+ `o/${encodeURIComponent(org)}/manager/chats${cursor === void 0 ? "" : `?cursor=${encodeURIComponent(cursor)}`}`
10143
+ );
10144
+ }
10145
+ async createOrgManagerChat(org, title) {
10146
+ return this.fetch(`o/${encodeURIComponent(org)}/manager/chats`, {
10147
+ method: "POST",
10148
+ body: JSON.stringify({ title })
10149
+ });
10150
+ }
10151
+ async authorizeOrgManagerDelegation(workspace, orgUuid, chatId, callId) {
10152
+ return this.fetch(`w/${encodeURIComponent(workspace)}/a2a/manager/delegation-credential`, {
10153
+ method: "POST",
10154
+ body: JSON.stringify({ orgUuid, chatId, callId }),
10155
+ cache: "no-store"
10156
+ });
10157
+ }
10158
+ async getOrgManagerCredentialResponse(org, chatId, deliveryId) {
10159
+ return this.fetch(
10160
+ `o/${encodeURIComponent(org)}/manager/chats/${chatId}/credentials/${encodeURIComponent(deliveryId)}`,
10161
+ { cache: "no-store" }
10162
+ );
10163
+ }
10164
+ async getOrgManagerMessages(org, chatId, before) {
10165
+ return this.fetch(
10166
+ `o/${encodeURIComponent(org)}/manager/chats/${chatId}/messages${before ? `?before=${before}` : ""}`
10167
+ );
10168
+ }
10169
+ async stopOrgManagerTurn(org, chatId) {
10170
+ return this.fetch(`o/${encodeURIComponent(org)}/manager/chats/${chatId}/stop`, {
10171
+ method: "POST",
10172
+ body: JSON.stringify({})
10173
+ });
10174
+ }
10175
+ async startOrgManagerTurn(org, chatId, body) {
10176
+ return this.fetch(`o/${encodeURIComponent(org)}/manager/chats/${chatId}/turns`, {
10177
+ method: "POST",
10178
+ body: JSON.stringify(body)
10179
+ });
10180
+ }
10034
10181
  /**
10035
10182
  * Get organization by ID or UUID.
10036
10183
  * Returns different response based on user's role:
@@ -10280,6 +10427,7 @@ var init_chunk_SVRE6KIM = __esm({
10280
10427
  if (options?.page) params.set("page", String(options.page));
10281
10428
  if (options?.pageSize) params.set("pageSize", String(options.pageSize));
10282
10429
  if (options?.search) params.set("search", options.search);
10430
+ if (options?.label) params.set("label", options.label);
10283
10431
  return this.fetch(
10284
10432
  `o/${orgIdOrUuid}/workspaces/summary?${params}`
10285
10433
  );
@@ -10347,7 +10495,8 @@ var init_chunk_SVRE6KIM = __esm({
10347
10495
  });
10348
10496
  }
10349
10497
  /**
10350
- * Search for available phone numbers to purchase from Twilio.
10498
+ * Search available numbers. Use `mobile` for AU and `local` or `toll_free`
10499
+ * for US; the server defaults to US local when the type is omitted.
10351
10500
  */
10352
10501
  async searchPhoneNumbers(orgUuid, params) {
10353
10502
  const query2 = new URLSearchParams();
@@ -10364,8 +10513,9 @@ var init_chunk_SVRE6KIM = __esm({
10364
10513
  /**
10365
10514
  * Purchase a phone number from Twilio for this org inventory (org admin only).
10366
10515
  *
10367
- * Numbers in regulated countries (e.g. Australia) require a Twilio regulatory
10368
- * bundle and an address — pass `bundleSid` and `addressSid` for those.
10516
+ * Australian mobile numbers require an approved business registration. Pass
10517
+ * `legalEntityUuid`; the server resolves its bundle and address. Do not pass
10518
+ * `bundleSid` or `addressSid` for Australian purchases.
10369
10519
  */
10370
10520
  async purchasePhoneNumber(orgUuid, phoneNumber, numberType, opts) {
10371
10521
  return this.fetch(`o/${orgUuid}/phone-numbers/purchase`, {
@@ -10374,11 +10524,31 @@ var init_chunk_SVRE6KIM = __esm({
10374
10524
  phoneNumber,
10375
10525
  numberType,
10376
10526
  country: opts?.country,
10527
+ legalEntityUuid: opts?.legalEntityUuid,
10377
10528
  bundleSid: opts?.bundleSid,
10378
10529
  addressSid: opts?.addressSid
10379
10530
  })
10380
10531
  });
10381
10532
  }
10533
+ async getNumberRegistration(orgUuid, entityUuid) {
10534
+ return this.fetch(`o/${orgUuid}/legal-entities/${entityUuid}/number-registration`);
10535
+ }
10536
+ async uploadNumberRegistrationDocument(orgUuid, entityUuid, file, documentType, requirementName) {
10537
+ const body = new FormData();
10538
+ body.append("file", file);
10539
+ body.append("documentType", documentType);
10540
+ body.append("requirementName", requirementName);
10541
+ return this.fetch(`o/${orgUuid}/legal-entities/${entityUuid}/number-registration/documents`, {
10542
+ method: "POST",
10543
+ body
10544
+ });
10545
+ }
10546
+ async submitNumberRegistration(orgUuid, entityUuid) {
10547
+ return this.fetch(`o/${orgUuid}/legal-entities/${entityUuid}/number-registration/submit`, {
10548
+ method: "POST",
10549
+ body: JSON.stringify({})
10550
+ });
10551
+ }
10382
10552
  /**
10383
10553
  * Delete a phone number from the org (releases from Twilio).
10384
10554
  */
@@ -10425,7 +10595,9 @@ var init_chunk_SVRE6KIM = __esm({
10425
10595
  * Delete a registered organization domain.
10426
10596
  */
10427
10597
  async deleteOrgDomain(orgIdOrUuid, domainUuid) {
10428
- await this.fetch(`o/${orgIdOrUuid}/domains/${domainUuid}`, { method: "DELETE" });
10598
+ await this.fetch(`o/${orgIdOrUuid}/domains/${domainUuid}`, {
10599
+ method: "DELETE"
10600
+ });
10429
10601
  }
10430
10602
  /**
10431
10603
  * Enable email DNS provisioning for a verified org domain.
@@ -10599,17 +10771,20 @@ var init_chunk_SVRE6KIM = __esm({
10599
10771
  });
10600
10772
  }
10601
10773
  /**
10602
- * Activate SMS on a workspace-assigned number: attach it to the given
10603
- * brand's Messaging Service (A2P 10DLC). Preconditions (412 otherwise):
10604
- * campaign VERIFIED, brand has a Messaging Service, phone assigned to a
10605
- * workspace with a Twilio SID.
10774
+ * Enable sending on a workspace-assigned number: attach it to the
10775
+ * Messaging Service of the given brand's campaign (A2P 10DLC).
10776
+ *
10777
+ * `campaignUuid` names the campaign to attach the number to, including the
10778
+ * brand's first; omit it to target the brand's first campaign. Preconditions
10779
+ * (412 otherwise): campaign VERIFIED, brand has a Messaging Service, phone
10780
+ * assigned to a workspace with a Twilio SID.
10606
10781
  */
10607
- async activateA2PNumber(orgUuid, providerPhoneUuid, brandUuid) {
10782
+ async activateA2PNumber(orgUuid, providerPhoneUuid, brandUuid, campaignUuid) {
10608
10783
  return this.fetch(
10609
10784
  `o/${orgUuid}/phone-numbers/a2p/activate-number`,
10610
10785
  {
10611
10786
  method: "POST",
10612
- body: JSON.stringify({ providerPhoneUuid, brandUuid })
10787
+ body: JSON.stringify({ providerPhoneUuid, brandUuid, campaignUuid })
10613
10788
  }
10614
10789
  );
10615
10790
  }
@@ -10626,7 +10801,10 @@ var init_chunk_SVRE6KIM = __esm({
10626
10801
  * entity's business profile must be approved (400 otherwise).
10627
10802
  */
10628
10803
  async attachPhoneVoiceTrust(orgUuid, providerPhoneUuid, legalEntityUuid) {
10629
- const body = { providerPhoneUuid, legalEntityUuid };
10804
+ const body = {
10805
+ providerPhoneUuid,
10806
+ legalEntityUuid
10807
+ };
10630
10808
  return this.fetch(`o/${orgUuid}/phone-numbers/voice-trust/attach`, {
10631
10809
  method: "POST",
10632
10810
  body: JSON.stringify(body)
@@ -10790,23 +10968,53 @@ var init_chunk_SVRE6KIM = __esm({
10790
10968
  `o/${orgUuid}/a2p-brands/${brandUuid}/use-cases`
10791
10969
  );
10792
10970
  }
10971
+ /**
10972
+ * Add a draft campaign to a brand. `sourceCampaignUuid` goes in an optional
10973
+ * JSON body; omitting it copies the brand's first campaign. The draft
10974
+ * reaches no provider until it is submitted. A sole-proprietor brand is
10975
+ * refused.
10976
+ */
10977
+ async createA2PCampaign(orgUuid, brandUuid, data = {}) {
10978
+ return this.fetch(`o/${orgUuid}/a2p-brands/${brandUuid}/campaigns`, {
10979
+ method: "POST",
10980
+ body: JSON.stringify(data)
10981
+ });
10982
+ }
10983
+ /**
10984
+ * Submit a later campaign that has never been submitted. The caller must be
10985
+ * an org admin with recent 2FA, and the billing owner on subscription
10986
+ * billing (the submission buys the campaign's vetting). The brand's first
10987
+ * campaign is submitted by approving its sample messages during registration;
10988
+ * an ineligible campaign comes back as a structured 409 with a `code`. A brand
10989
+ * that no longer reads approved at the carrier, or a use case it no longer
10990
+ * allows, is a 400 with no `code`.
10991
+ */
10992
+ async submitA2PCampaign(orgUuid, brandUuid, campaignUuid) {
10993
+ return this.fetch(
10994
+ `o/${orgUuid}/a2p-brands/${brandUuid}/campaigns/${encodeURIComponent(campaignUuid)}/submit`,
10995
+ { method: "POST" }
10996
+ );
10997
+ }
10793
10998
  /**
10794
10999
  * Fetch a brand's resolved A2P campaign config. The response carries both the
10795
11000
  * raw `overrides` and the `resolved` payload (defaults + overrides) the editor
10796
- * previews — including the canonical SMS consent text.
11001
+ * previews — including the canonical SMS consent text. `campaignUuid` names
11002
+ * one of the brand's campaigns; without it the brand's first is read.
10797
11003
  */
10798
- async getA2PCampaignConfig(orgUuid, brandUuid) {
11004
+ async getA2PCampaignConfig(orgUuid, brandUuid, options) {
10799
11005
  return this.fetch(
10800
- `o/${orgUuid}/a2p-brands/${brandUuid}/campaign-config`
11006
+ `o/${orgUuid}/a2p-brands/${brandUuid}/campaign-config${campaignQuery(options)}`
10801
11007
  );
10802
11008
  }
10803
11009
  /**
10804
11010
  * Partial-update a brand's A2P campaign config. Returns the freshly resolved
10805
11011
  * config so the editor's live preview updates without a second round-trip.
11012
+ * `campaignUuid` names one of the brand's campaigns; without it the brand's
11013
+ * first is updated.
10806
11014
  */
10807
- async updateA2PCampaignConfig(orgUuid, brandUuid, data) {
11015
+ async updateA2PCampaignConfig(orgUuid, brandUuid, data, options) {
10808
11016
  return this.fetch(
10809
- `o/${orgUuid}/a2p-brands/${brandUuid}/campaign-config`,
11017
+ `o/${orgUuid}/a2p-brands/${brandUuid}/campaign-config${campaignQuery(options)}`,
10810
11018
  {
10811
11019
  method: "PUT",
10812
11020
  body: JSON.stringify(data)
@@ -10816,10 +11024,12 @@ var init_chunk_SVRE6KIM = __esm({
10816
11024
  /**
10817
11025
  * Resubmit a campaign the carrier rejected, with the brand's current
10818
11026
  * campaign copy. Edits the campaign in place, so no second vetting fee.
11027
+ * `campaignUuid` names one of the brand's campaigns; without it the brand's
11028
+ * first is resubmitted.
10819
11029
  */
10820
- async resubmitA2PCampaign(orgUuid, brandUuid) {
11030
+ async resubmitA2PCampaign(orgUuid, brandUuid, options) {
10821
11031
  return this.fetch(
10822
- `o/${orgUuid}/a2p-brands/${brandUuid}/resubmit-campaign`,
11032
+ `o/${orgUuid}/a2p-brands/${brandUuid}/resubmit-campaign${campaignQuery(options)}`,
10823
11033
  { method: "POST" }
10824
11034
  );
10825
11035
  }
@@ -10835,11 +11045,13 @@ var init_chunk_SVRE6KIM = __esm({
10835
11045
  }
10836
11046
  /**
10837
11047
  * Link the brand to a published enrollment Site (sets `site_uuid`). Returns
10838
- * the refreshed campaign config.
11048
+ * the refreshed campaign config. `campaignUuid` names one of the brand's
11049
+ * campaigns; without it the brand's first campaign is written. Only a first
11050
+ * campaign may link a site.
10839
11051
  */
10840
- async linkA2PEnrollmentSite(orgUuid, brandUuid, data) {
11052
+ async linkA2PEnrollmentSite(orgUuid, brandUuid, data, options) {
10841
11053
  return this.fetch(
10842
- `o/${orgUuid}/a2p-brands/${brandUuid}/enrollment-site`,
11054
+ `o/${orgUuid}/a2p-brands/${brandUuid}/enrollment-site${campaignQuery(options)}`,
10843
11055
  {
10844
11056
  method: "PUT",
10845
11057
  body: JSON.stringify(data)
@@ -10851,20 +11063,25 @@ var init_chunk_SVRE6KIM = __esm({
10851
11063
  * the explicit counterpart to the automatic provisioning at brand
10852
11064
  * registration. `workspaceUuid` is required only when the org has multiple
10853
11065
  * workspaces. Returns the refreshed campaign config. Idempotent.
11066
+ * `campaignUuid` names one of the brand's campaigns; without it the brand's
11067
+ * first campaign is written. Only a first campaign may link a site.
10854
11068
  */
10855
- async provisionA2PEnrollmentSite(orgUuid, brandUuid, data = {}) {
11069
+ async provisionA2PEnrollmentSite(orgUuid, brandUuid, data = {}, options) {
10856
11070
  return this.fetch(
10857
- `o/${orgUuid}/a2p-brands/${brandUuid}/enrollment-site/provision`,
11071
+ `o/${orgUuid}/a2p-brands/${brandUuid}/enrollment-site/provision${campaignQuery(options)}`,
10858
11072
  {
10859
11073
  method: "POST",
10860
11074
  body: JSON.stringify(data)
10861
11075
  }
10862
11076
  );
10863
11077
  }
10864
- /** Clear the brand's enrollment-site link. */
10865
- async unlinkA2PEnrollmentSite(orgUuid, brandUuid) {
11078
+ /**
11079
+ * Clear the brand's enrollment-site link. `campaignUuid` names one of the
11080
+ * brand's campaigns; without it the brand's first campaign is cleared.
11081
+ */
11082
+ async unlinkA2PEnrollmentSite(orgUuid, brandUuid, options) {
10866
11083
  return this.fetch(
10867
- `o/${orgUuid}/a2p-brands/${brandUuid}/enrollment-site`,
11084
+ `o/${orgUuid}/a2p-brands/${brandUuid}/enrollment-site${campaignQuery(options)}`,
10868
11085
  { method: "DELETE" }
10869
11086
  );
10870
11087
  }
@@ -10872,10 +11089,12 @@ var init_chunk_SVRE6KIM = __esm({
10872
11089
  * Stage one A2P opt-in evidence file: get a presigned POST to send the bytes
10873
11090
  * straight to storage. Nothing is recorded on the brand until
10874
11091
  * {@link registerA2PEvidenceUpload} reads the object back and normalizes it.
11092
+ * `campaignUuid` names one of the brand's campaigns; without it the brand's
11093
+ * first campaign is written.
10875
11094
  */
10876
- async createA2PEvidenceUploadUrl(orgUuid, brandUuid, data) {
11095
+ async createA2PEvidenceUploadUrl(orgUuid, brandUuid, data, options) {
10877
11096
  return this.fetch(
10878
- `o/${orgUuid}/a2p-brands/${brandUuid}/evidence-attachments/upload-url`,
11097
+ `o/${orgUuid}/a2p-brands/${brandUuid}/evidence-attachments/upload-url${campaignQuery(options)}`,
10879
11098
  {
10880
11099
  method: "POST",
10881
11100
  body: JSON.stringify(data)
@@ -10883,25 +11102,29 @@ var init_chunk_SVRE6KIM = __esm({
10883
11102
  );
10884
11103
  }
10885
11104
  /**
10886
- * Normalize a staged evidence upload and record it on the brand. Returns the
10887
- * refreshed campaign config, so the editor's evidence list updates without a
10888
- * second round trip.
11105
+ * Normalize a staged evidence upload and record it on the campaign. Returns
11106
+ * the refreshed campaign config, so the editor's evidence list updates
11107
+ * without a second round trip. `campaignUuid` names one of the brand's
11108
+ * campaigns; without it the brand's first campaign is written.
10889
11109
  */
10890
- async registerA2PEvidenceUpload(orgUuid, brandUuid, data) {
11110
+ async registerA2PEvidenceUpload(orgUuid, brandUuid, data, options) {
10891
11111
  return this.fetch(
10892
- `o/${orgUuid}/a2p-brands/${brandUuid}/evidence-attachments`,
11112
+ `o/${orgUuid}/a2p-brands/${brandUuid}/evidence-attachments${campaignQuery(options)}`,
10893
11113
  {
10894
11114
  method: "POST",
10895
11115
  body: JSON.stringify(data)
10896
11116
  }
10897
11117
  );
10898
11118
  }
10899
- /** Remove one uploaded evidence artifact. */
10900
- async deleteA2PEvidenceUpload(orgUuid, brandUuid, attachmentUuid) {
11119
+ /**
11120
+ * Remove one uploaded evidence artifact. `campaignUuid` names one of the
11121
+ * brand's campaigns; without it the brand's first campaign is written.
11122
+ */
11123
+ async deleteA2PEvidenceUpload(orgUuid, brandUuid, attachmentUuid, options) {
10901
11124
  return this.fetch(
10902
11125
  `o/${orgUuid}/a2p-brands/${brandUuid}/evidence-attachments/${encodeURIComponent(
10903
11126
  attachmentUuid
10904
- )}`,
11127
+ )}${campaignQuery(options)}`,
10905
11128
  { method: "DELETE" }
10906
11129
  );
10907
11130
  }
@@ -10957,9 +11180,13 @@ var init_chunk_SVRE6KIM = __esm({
10957
11180
  method: "DELETE"
10958
11181
  });
10959
11182
  }
10960
- async listOrgWebhookEndpointDeliveries(orgIdOrUuid, endpointUuid, limit = 50, offset = 0) {
11183
+ async listOrgWebhookEndpointDeliveries(orgIdOrUuid, endpointUuid, limit = 50, offset = 0, filters = {}) {
11184
+ const params = new URLSearchParams({ limit: String(limit), offset: String(offset) });
11185
+ if (filters.status) params.set("status", filters.status);
11186
+ if (filters.occurredAfter) params.set("occurredAfter", filters.occurredAfter);
11187
+ if (filters.occurredBefore) params.set("occurredBefore", filters.occurredBefore);
10961
11188
  return this.fetch(
10962
- `o/${orgIdOrUuid}/webhooks/${endpointUuid}/deliveries?limit=${limit}&offset=${offset}`
11189
+ `o/${orgIdOrUuid}/webhooks/${endpointUuid}/deliveries?${params}`
10963
11190
  );
10964
11191
  }
10965
11192
  async getOrgWebhookDeliveryDetail(orgIdOrUuid, endpointUuid, deliveryId) {
@@ -11277,16 +11504,32 @@ var init_chunk_SVRE6KIM = __esm({
11277
11504
  if (filters?.inbound !== void 0) params.set("inbound", String(filters.inbound));
11278
11505
  if (filters?.dateFrom) params.set("dateFrom", filters.dateFrom);
11279
11506
  if (filters?.dateTo) params.set("dateTo", filters.dateTo);
11507
+ if (filters?.otherNumber) params.set("otherNumber", filters.otherNumber);
11280
11508
  if (filters?.callId !== void 0) params.set("callId", String(filters.callId));
11281
11509
  return this.fetch(`w/${wid}/calls?${params}`);
11282
11510
  }
11511
+ /**
11512
+ * One time-ordered page over a number's calls, texts and voicemails.
11513
+ *
11514
+ * Paged by keyset: pass the previous page's `nextCursor` as `cursor` to get
11515
+ * the entries after it. A new entry at the head cannot repeat or skip one.
11516
+ * `modalities` limits the feed to some of the logs.
11517
+ */
11518
+ async getPhoneNumberActivity(wid, id, options = {}) {
11519
+ const params = new URLSearchParams({ pageSize: String(options.pageSize ?? 25) });
11520
+ if (options.cursor) params.set("cursor", options.cursor);
11521
+ options.modalities?.forEach((modality) => params.append("modality", modality));
11522
+ appendPhoneLogFilters(params, options);
11523
+ return this.fetch(`w/${wid}/phone-numbers/${id}/activity?${params}`);
11524
+ }
11283
11525
  /** List paginated voicemails for a phone number. */
11284
- async getPhoneNumberVoicemails(wid, id, page = 1, pageSize = 10, status) {
11526
+ async getPhoneNumberVoicemails(wid, id, page = 1, pageSize = 10, status, filters) {
11285
11527
  const params = new URLSearchParams({
11286
11528
  page: String(page),
11287
11529
  page_size: String(pageSize)
11288
11530
  });
11289
11531
  if (status) params.set("status", status);
11532
+ appendPhoneLogFilters(params, filters);
11290
11533
  return this.fetch(
11291
11534
  `w/${wid}/phone-numbers/${id}/voicemails?${params}`
11292
11535
  );
@@ -11312,9 +11555,7 @@ var init_chunk_SVRE6KIM = __esm({
11312
11555
  pageSize: String(pageSize)
11313
11556
  });
11314
11557
  if (filters?.status) params.set("status", filters.status);
11315
- if (filters?.inbound !== void 0) params.set("inbound", String(filters.inbound));
11316
- if (filters?.dateFrom) params.set("dateFrom", filters.dateFrom);
11317
- if (filters?.dateTo) params.set("dateTo", filters.dateTo);
11558
+ appendPhoneLogFilters(params, filters);
11318
11559
  return this.fetch(
11319
11560
  `w/${wid}/phone-numbers/${id}/messages?${params}`
11320
11561
  );
@@ -11573,6 +11814,7 @@ var init_chunk_SVRE6KIM = __esm({
11573
11814
  body: JSON.stringify(data)
11574
11815
  });
11575
11816
  }
11817
+ /** Archives the Persona and its current test Member. Returns 409 while a test chat is open. */
11576
11818
  async archivePersona(wid, id) {
11577
11819
  return this.fetch(`w/${wid}/personas/${id}/archive`, {
11578
11820
  method: "POST",
@@ -11800,9 +12042,12 @@ var init_chunk_SVRE6KIM = __esm({
11800
12042
  );
11801
12043
  }
11802
12044
  async evaluateTestChatRun(wid, runId) {
11803
- await this.fetch(`w/${wid}/qualifications/test-chat-runs/${runId}/evaluate`, {
11804
- method: "POST"
11805
- });
12045
+ return this.fetch(
12046
+ `w/${wid}/qualifications/test-chat-runs/${runId}/evaluate`,
12047
+ {
12048
+ method: "POST"
12049
+ }
12050
+ );
11806
12051
  }
11807
12052
  /** Manually end a test chat run (for human-driven runs, which have no
11808
12053
  * simulator workflow to mark them completed). */
@@ -12196,11 +12441,29 @@ var init_chunk_SVRE6KIM = __esm({
12196
12441
  `w/${wid}/app-connections/${connectionId}/sync/member-summary`
12197
12442
  );
12198
12443
  }
12199
- async getSyncRunItems(wid, connectionId, runId, limit = 500) {
12444
+ /**
12445
+ * One page of a run's items. ``cursor`` is the previous page's
12446
+ * ``nextCursor`` and continues in the requested direction; exhaustion comes
12447
+ * from ``hasMore``, never from the returned row count.
12448
+ */
12449
+ async getSyncRunItemsPage(wid, connectionId, runId, options) {
12450
+ const params = new URLSearchParams();
12451
+ if (options?.limit != null) params.set("limit", String(options.limit));
12452
+ if (options?.newestFirst) params.set("newest_first", "true");
12453
+ if (options?.cursor) params.set("cursor", options.cursor);
12454
+ const qs = params.toString() ? `?${params.toString()}` : "";
12200
12455
  return this.fetch(
12201
- `w/${wid}/app-connections/${connectionId}/sync/runs/${runId}/items?limit=${limit}`
12456
+ `w/${wid}/app-connections/${connectionId}/sync/runs/${runId}/items${qs}`
12202
12457
  );
12203
12458
  }
12459
+ /**
12460
+ * The run's items as a flat list. Kept for the published CLI surface; the
12461
+ * server returns the canonical cursor page, and this unwraps its ``items``.
12462
+ */
12463
+ async getSyncRunItems(wid, connectionId, runId, limit = 500) {
12464
+ const page = await this.getSyncRunItemsPage(wid, connectionId, runId, { limit });
12465
+ return page.items;
12466
+ }
12204
12467
  /**
12205
12468
  * Clear a manual-unlink exclusion for a member on a connection so
12206
12469
  * subsequent outbound syncs stop silently skipping them. Idempotent:
@@ -12318,6 +12581,20 @@ var init_chunk_SVRE6KIM = __esm({
12318
12581
  }
12319
12582
  };
12320
12583
  HubspotApi = class extends BaseApiClient {
12584
+ async getHubspotBookingReceipt(wid, meetingId) {
12585
+ return this.fetch(
12586
+ `w/${wid}/app-connections/hubspot/booking-deals/${encodeURIComponent(meetingId)}/receipt`
12587
+ );
12588
+ }
12589
+ async releaseHubspotBookingAttempt(wid, meetingId, data) {
12590
+ return this.fetch(
12591
+ `w/${wid}/app-connections/hubspot/booking-deals/${encodeURIComponent(meetingId)}/release`,
12592
+ {
12593
+ method: "POST",
12594
+ body: JSON.stringify(data)
12595
+ }
12596
+ );
12597
+ }
12321
12598
  /**
12322
12599
  * Create the HubSpot connection shell (no credentials yet).
12323
12600
  *
@@ -12472,6 +12749,37 @@ var init_chunk_SVRE6KIM = __esm({
12472
12749
  }
12473
12750
  };
12474
12751
  SitesApi = class extends BaseApiClient {
12752
+ /** Start a fresh synthetic patient session on the Site's configured Workflow. */
12753
+ async startPublicDemo(wid, siteUuid, request) {
12754
+ return this.fetch(`w/${wid}/demos/${encodeURIComponent(siteUuid)}/runs`, {
12755
+ method: "POST",
12756
+ body: JSON.stringify(request)
12757
+ });
12758
+ }
12759
+ /** Read only a demo the acting Member drives. */
12760
+ async getPublicDemo(wid, siteUuid, runId) {
12761
+ return this.fetch(`w/${wid}/demos/${encodeURIComponent(siteUuid)}/runs/${runId}`);
12762
+ }
12763
+ /** End this visitor's run and release its test resources. */
12764
+ async endPublicDemo(wid, siteUuid, runId) {
12765
+ return this.fetch(`w/${wid}/demos/${encodeURIComponent(siteUuid)}/runs/${runId}/end`, {
12766
+ method: "POST",
12767
+ keepalive: true,
12768
+ body: JSON.stringify({})
12769
+ });
12770
+ }
12771
+ async sendPublicDemoMessage(wid, siteUuid, runId, request) {
12772
+ return this.fetch(`w/${wid}/demos/${encodeURIComponent(siteUuid)}/runs/${runId}/messages`, {
12773
+ method: "POST",
12774
+ body: JSON.stringify(request)
12775
+ });
12776
+ }
12777
+ async submitPublicDemoForm(wid, siteUuid, runId, request) {
12778
+ return this.fetch(`w/${wid}/demos/${encodeURIComponent(siteUuid)}/runs/${runId}/form`, {
12779
+ method: "PUT",
12780
+ body: JSON.stringify(request)
12781
+ });
12782
+ }
12475
12783
  /** List all sites in a workspace. */
12476
12784
  async getSites(wid) {
12477
12785
  return this.fetch(`w/${wid}/sites`);
@@ -12511,6 +12819,15 @@ var init_chunk_SVRE6KIM = __esm({
12511
12819
  async getSiteSource(wid, siteId) {
12512
12820
  return this.fetch(`w/${wid}/sites/${siteId}/source`);
12513
12821
  }
12822
+ /** List source release revisions from newest to oldest. */
12823
+ async getSiteSourceReleases(wid, siteId, options = {}) {
12824
+ const params = new URLSearchParams();
12825
+ if (options.beforeVersion != null) params.set("beforeVersion", String(options.beforeVersion));
12826
+ if (options.limit != null) params.set("limit", String(options.limit));
12827
+ return this.fetch(
12828
+ `w/${wid}/sites/${siteId}/source/releases${params.size ? `?${params}` : ""}`
12829
+ );
12830
+ }
12514
12831
  /** Starter templates the caller may seed (superuser-only ones filtered server-side). */
12515
12832
  async getSiteSourceTemplates(wid, siteId) {
12516
12833
  return this.fetch(`w/${wid}/sites/${siteId}/source/templates`);
@@ -13344,6 +13661,8 @@ var init_chunk_SVRE6KIM = __esm({
13344
13661
  async getJourneys(wid, includeArchived = false, pageOpts) {
13345
13662
  const query2 = new URLSearchParams();
13346
13663
  if (includeArchived) query2.set("include_archived", "true");
13664
+ if (pageOpts?.search) query2.set("search", pageOpts.search);
13665
+ if (pageOpts?.archivedOnly) query2.set("archived_only", "true");
13347
13666
  if (pageOpts?.page !== void 0) query2.set("page", String(pageOpts.page));
13348
13667
  if (pageOpts?.pageSize !== void 0) query2.set("pageSize", String(pageOpts.pageSize));
13349
13668
  const qs = query2.toString() ? `?${query2.toString()}` : "";
@@ -13698,6 +14017,12 @@ var init_chunk_SVRE6KIM = __esm({
13698
14017
  }
13699
14018
  };
13700
14019
  WorkflowsApi = class extends BaseApiClient {
14020
+ async uploadWorkflowKnowledge(wid, id, file, relativePath) {
14021
+ const body = new FormData();
14022
+ body.append("file", file, relativePath.split("/").pop());
14023
+ body.append("relativePath", relativePath);
14024
+ return this.fetch(`w/${wid}/workflows/${id}/knowledge/uploads`, { method: "POST", body });
14025
+ }
13701
14026
  /** List all workflows in a workspace, optionally including archived ones. */
13702
14027
  async getWorkflows(wid, options = {}) {
13703
14028
  const params = new URLSearchParams();
@@ -14115,6 +14440,7 @@ var init_chunk_SVRE6KIM = __esm({
14115
14440
  EventRuleEventType2["CHAT_SUMMARY"] = "chat:summary";
14116
14441
  EventRuleEventType2["MESSAGE_CREATED"] = "message:created";
14117
14442
  EventRuleEventType2["LINK_CLICKED"] = "link:clicked";
14443
+ EventRuleEventType2["SMS_DELIVERY_FAILED"] = "sms:delivery_failed";
14118
14444
  EventRuleEventType2["CHAT_CALLBACK"] = "chat:callback";
14119
14445
  EventRuleEventType2["MEMBER_UPDATED"] = "member:updated";
14120
14446
  EventRuleEventType2["ROUTINE_TRIGGERED"] = "routine:triggered";
@@ -14160,6 +14486,7 @@ var init_chunk_SVRE6KIM = __esm({
14160
14486
  EventRuleActionType2["INVOKE_CUSTOM_TOOL"] = "custom_tool:invoke";
14161
14487
  EventRuleActionType2["MONDAY_UPSERT_ITEM"] = "monday:upsert_item";
14162
14488
  EventRuleActionType2["MONDAY_REFRESH"] = "monday:refresh";
14489
+ EventRuleActionType2["HUBSPOT_CREATE_DEAL_FROM_BOOKING"] = "hubspot:create_deal_from_booking";
14163
14490
  EventRuleActionType2["ASSIGNMENT_CONCLUDE"] = "assignment:conclude";
14164
14491
  EventRuleActionType2["JOURNEY_ENROLL"] = "journey:enroll";
14165
14492
  EventRuleActionType2["SMS_SEND"] = "sms:send";
@@ -14508,6 +14835,12 @@ var init_chunk_SVRE6KIM = __esm({
14508
14835
  async getWorkspaces(options) {
14509
14836
  return this.fetch(`w/?${workspaceDirectoryParams(options)}`);
14510
14837
  }
14838
+ /** One organization page reached through organization or workspace membership. */
14839
+ async getWorkspaceOrganizationDirectory(options) {
14840
+ return this.fetch(
14841
+ `w/organizations?${workspaceDirectoryParams(options)}`
14842
+ );
14843
+ }
14511
14844
  /**
14512
14845
  * Page 1 of each organization's workspace directory, in one request.
14513
14846
  * Later pages stay on ``getWorkspaces({ organizationUuid, page })``.
@@ -14609,6 +14942,18 @@ var init_chunk_SVRE6KIM = __esm({
14609
14942
  const url = `w/${wid}/notifications${queryString ? `?${queryString}` : ""}`;
14610
14943
  return this.fetch(url);
14611
14944
  }
14945
+ async getNotificationSubscriptions(wid) {
14946
+ return this.fetch(`w/${wid}/notifications/subscriptions`);
14947
+ }
14948
+ async updateNotificationSubscription(wid, id, enabled) {
14949
+ return this.fetch(`w/${wid}/notifications/subscriptions/${id}`, {
14950
+ method: "PATCH",
14951
+ body: JSON.stringify({ enabled })
14952
+ });
14953
+ }
14954
+ async getNotificationAudience(wid, id) {
14955
+ return this.fetch(`w/${wid}/notifications/audiences/${id}`);
14956
+ }
14612
14957
  /** Get a single notification by ID. */
14613
14958
  async getNotification(wid, id) {
14614
14959
  return this.fetch(`w/${wid}/notifications/${id}`);
@@ -14714,13 +15059,6 @@ var init_chunk_SVRE6KIM = __esm({
14714
15059
  const qs = query2.toString() ? `?${query2.toString()}` : "";
14715
15060
  return this.fetch(`w/${wid}/reseller/workspaces${qs}`);
14716
15061
  }
14717
- /** Create a new client workspace under a reseller workspace. */
14718
- async createClientWorkspace(wid, data) {
14719
- return this.fetch(`w/${wid}/reseller/workspaces`, {
14720
- method: "POST",
14721
- body: JSON.stringify(data)
14722
- });
14723
- }
14724
15062
  /** Get a single client workspace by ID. */
14725
15063
  async getClientWorkspace(wid, workspaceId) {
14726
15064
  return this.fetch(`w/${wid}/reseller/workspaces/${workspaceId}`);
@@ -14830,7 +15168,9 @@ var init_chunk_SVRE6KIM = __esm({
14830
15168
  searchParams.set("revision_mode", "active");
14831
15169
  }
14832
15170
  const qs = searchParams.toString();
14833
- const data = await this.fetch(`w/${wid}/export${qs ? `?${qs}` : ""}`);
15171
+ const data = await this.fetch(
15172
+ `w/${wid}/export${qs ? `?${qs}` : ""}`
15173
+ );
14834
15174
  this.verifyExportSelection(data, workflowId, options);
14835
15175
  return data;
14836
15176
  }
@@ -15363,7 +15703,7 @@ var init_chunk_SVRE6KIM = __esm({
15363
15703
  const query2 = new URLSearchParams();
15364
15704
  if (params?.page !== void 0) query2.set("page", String(params.page));
15365
15705
  if (params?.pageSize !== void 0) query2.set("pageSize", String(params.pageSize));
15366
- if (params?.includeArchived) query2.set("includeArchived", "true");
15706
+ if (params?.archived !== void 0) query2.set("archived", String(params.archived));
15367
15707
  const qs = query2.toString() ? `?${query2.toString()}` : "";
15368
15708
  return this.fetch(`w/${wid}/experiments${qs}`);
15369
15709
  }
@@ -15778,8 +16118,7 @@ var init_chunk_SVRE6KIM = __esm({
15778
16118
  const q = new URLSearchParams();
15779
16119
  if (params?.page !== void 0) q.set("page", String(params.page));
15780
16120
  if (params?.pageSize !== void 0) q.set("pageSize", String(params.pageSize));
15781
- if (params?.includeArchived !== void 0)
15782
- q.set("includeArchived", String(params.includeArchived));
16121
+ if (params?.archived !== void 0) q.set("archived", String(params.archived));
15783
16122
  if (params?.source) q.set("source", params.source);
15784
16123
  const qs = q.toString() ? `?${q.toString()}` : "";
15785
16124
  return this.fetch(`w/${wid}/metrics${qs}`);
@@ -15823,6 +16162,18 @@ var init_chunk_SVRE6KIM = __esm({
15823
16162
  `w/${wid}/metrics/${metricId}/series?${q.toString()}`
15824
16163
  );
15825
16164
  }
16165
+ /**
16166
+ * Series for several metrics in one request, each with its default
16167
+ * aggregation. Items come back in the order the ids were given.
16168
+ */
16169
+ async getMetricSeriesBatch(wid, params) {
16170
+ const q = new URLSearchParams();
16171
+ for (const id of params.metricIds) q.append("metricIds", String(id));
16172
+ q.set("start", params.start);
16173
+ q.set("end", params.end);
16174
+ if (params.bucket) q.set("bucket", params.bucket);
16175
+ return this.fetch(`w/${wid}/metrics/series?${q.toString()}`);
16176
+ }
15826
16177
  /** On-demand compute of enabled chat-source metrics for one chat. */
15827
16178
  async computeChatMetrics(wid, data) {
15828
16179
  return this.fetch(`w/${wid}/metrics/compute-for-chat`, {
@@ -15993,6 +16344,7 @@ var init_chunk_SVRE6KIM = __esm({
15993
16344
  "archiveMemberByExternalId",
15994
16345
  "archiveMemberRelationship",
15995
16346
  "archivePersona",
16347
+ "archiveInbox",
15996
16348
  "archivePhoneNumber",
15997
16349
  "archiveStep",
15998
16350
  "archiveTask",
@@ -16066,7 +16418,6 @@ var init_chunk_SVRE6KIM = __esm({
16066
16418
  "createChatCompletion",
16067
16419
  "createChatFilter",
16068
16420
  "createChatLabel",
16069
- "createClientWorkspace",
16070
16421
  "createConnection",
16071
16422
  "createContactPermission",
16072
16423
  "createCustomTool",
@@ -16274,6 +16625,7 @@ var init_chunk_SVRE6KIM = __esm({
16274
16625
  "getApiKeys",
16275
16626
  "getArchiveBlockers",
16276
16627
  "getAthenaPlatformApp",
16628
+ "getFhirConnectionSyncConfig",
16277
16629
  "getAssignment",
16278
16630
  "getAssignmentCelContext",
16279
16631
  "getAssignmentMessages",
@@ -16332,7 +16684,6 @@ var init_chunk_SVRE6KIM = __esm({
16332
16684
  "getChats",
16333
16685
  "getChatsDailyCreationStats",
16334
16686
  "getChatsNeedsResponse",
16335
- "getChildThreadMessages",
16336
16687
  "getClientWorkspace",
16337
16688
  "getConfigurationHealth",
16338
16689
  "getConfluenceStatus",
@@ -16374,7 +16725,6 @@ var init_chunk_SVRE6KIM = __esm({
16374
16725
  "getDevices",
16375
16726
  "getDiscordBot",
16376
16727
  "getDiscordBotAccounts",
16377
- "getDiscordBotByUuid",
16378
16728
  "getDiscordBots",
16379
16729
  "getDiscordGuilds",
16380
16730
  "getDiscordThreads",
@@ -16421,6 +16771,7 @@ var init_chunk_SVRE6KIM = __esm({
16421
16771
  "getQueryFields",
16422
16772
  "getSiteSharing",
16423
16773
  "getSiteSource",
16774
+ "getSiteSourceReleases",
16424
16775
  "getSiteSourceTemplates",
16425
16776
  "getThemeSettings",
16426
16777
  "importSiteSourceZip",
@@ -16468,6 +16819,8 @@ var init_chunk_SVRE6KIM = __esm({
16468
16819
  "getHubspotObjectProperties",
16469
16820
  "getHubspotReconciliationMatches",
16470
16821
  "getHubspotStatus",
16822
+ "getHubspotBookingReceipt",
16823
+ "releaseHubspotBookingAttempt",
16471
16824
  "getHubspotSyncLogs",
16472
16825
  "getHubspotTransformPresets",
16473
16826
  "getICalFeedUrl",
@@ -16477,6 +16830,7 @@ var init_chunk_SVRE6KIM = __esm({
16477
16830
  "getInbox",
16478
16831
  "getInboxEmail",
16479
16832
  "getInboxEmails",
16833
+ "getInboxArchiveBlockers",
16480
16834
  "getInboxOutboundEmailStats",
16481
16835
  "getInboxThreads",
16482
16836
  "getInboxes",
@@ -16552,6 +16906,7 @@ var init_chunk_SVRE6KIM = __esm({
16552
16906
  "getPhoneCalls",
16553
16907
  "getPhoneCallByUuid",
16554
16908
  "getPhoneNumber",
16909
+ "getPhoneNumberActivity",
16555
16910
  "getPhoneNumberCalls",
16556
16911
  "getPhoneNumberFaxes",
16557
16912
  "getPhoneNumberMessages",
@@ -16605,6 +16960,7 @@ var init_chunk_SVRE6KIM = __esm({
16605
16960
  "getSupervisor",
16606
16961
  "getSupervisors",
16607
16962
  "getSyncRunItems",
16963
+ "getSyncRunItemsPage",
16608
16964
  "getSyncRuns",
16609
16965
  "getTask",
16610
16966
  "getTaskChats",
@@ -16727,6 +17083,7 @@ var init_chunk_SVRE6KIM = __esm({
16727
17083
  "deleteMetric",
16728
17084
  "listMetricObservations",
16729
17085
  "getMetricSeries",
17086
+ "getMetricSeriesBatch",
16730
17087
  "computeChatMetrics",
16731
17088
  "listPushSubscriptions",
16732
17089
  "listResourceWorkflows",
@@ -17017,7 +17374,6 @@ var init_chunk_SVRE6KIM = __esm({
17017
17374
  summarizeChat;
17018
17375
  getChatMessages;
17019
17376
  getChatTaskTransitions;
17020
- getChildThreadMessages;
17021
17377
  getChatToolCallMessages;
17022
17378
  getChatTools;
17023
17379
  initiateOutboundCall;
@@ -17225,6 +17581,7 @@ var init_chunk_SVRE6KIM = __esm({
17225
17581
  deleteMetric;
17226
17582
  listMetricObservations;
17227
17583
  getMetricSeries;
17584
+ getMetricSeriesBatch;
17228
17585
  computeChatMetrics;
17229
17586
  // Dashboards API
17230
17587
  getDashboards;
@@ -17395,6 +17752,7 @@ var init_chunk_SVRE6KIM = __esm({
17395
17752
  inspectPrompt;
17396
17753
  // Workspaces API
17397
17754
  getWorkspaces;
17755
+ getWorkspaceOrganizationDirectory;
17398
17756
  getOrganizationWorkspacePages;
17399
17757
  getDeviceAdmissibleWorkspaces;
17400
17758
  getPublicWorkspaces;
@@ -17411,6 +17769,9 @@ var init_chunk_SVRE6KIM = __esm({
17411
17769
  getBusinessHoursStatus;
17412
17770
  getAvailableWorkspaceFeatures;
17413
17771
  getWorkspaceNotices;
17772
+ getNotificationSubscriptions;
17773
+ updateNotificationSubscription;
17774
+ getNotificationAudience;
17414
17775
  getNotifications;
17415
17776
  getNotification;
17416
17777
  getUnreadNotificationCount;
@@ -17418,7 +17779,6 @@ var init_chunk_SVRE6KIM = __esm({
17418
17779
  dismissNotification;
17419
17780
  dismissAllNotifications;
17420
17781
  getResellerWorkspaces;
17421
- createClientWorkspace;
17422
17782
  getClientWorkspace;
17423
17783
  updateClientWorkspace;
17424
17784
  deleteClientWorkspace;
@@ -17454,6 +17814,13 @@ var init_chunk_SVRE6KIM = __esm({
17454
17814
  upsertWidgetDomain;
17455
17815
  deleteWidgetDomain;
17456
17816
  // Org API
17817
+ getOrgManagerCredentialResponse;
17818
+ authorizeOrgManagerDelegation;
17819
+ getOrgManagerChats;
17820
+ createOrgManagerChat;
17821
+ getOrgManagerMessages;
17822
+ startOrgManagerTurn;
17823
+ stopOrgManagerTurn;
17457
17824
  listOrgDomains;
17458
17825
  registerOrgDomain;
17459
17826
  getOrgDomain;
@@ -17528,6 +17895,9 @@ var init_chunk_SVRE6KIM = __esm({
17528
17895
  declineInvitation;
17529
17896
  // Auth API
17530
17897
  getUserAccount;
17898
+ getAccountNotices;
17899
+ viewAccountNotice;
17900
+ dismissAccountNotice;
17531
17901
  updateUserAccount;
17532
17902
  recordAcquisition;
17533
17903
  login;
@@ -17585,6 +17955,11 @@ var init_chunk_SVRE6KIM = __esm({
17585
17955
  getAssignmentTools;
17586
17956
  executeAssignmentTool;
17587
17957
  // Sites API
17958
+ startPublicDemo;
17959
+ endPublicDemo;
17960
+ getPublicDemo;
17961
+ sendPublicDemoMessage;
17962
+ submitPublicDemoForm;
17588
17963
  getSites;
17589
17964
  checkSiteSlugAvailability;
17590
17965
  checkSiteDomainAvailability;
@@ -17592,6 +17967,7 @@ var init_chunk_SVRE6KIM = __esm({
17592
17967
  getSiteSharing;
17593
17968
  updateSiteSharing;
17594
17969
  getSiteSource;
17970
+ getSiteSourceReleases;
17595
17971
  getSiteSourceTemplates;
17596
17972
  createSiteSource;
17597
17973
  buildSiteSource;
@@ -17654,6 +18030,8 @@ var init_chunk_SVRE6KIM = __esm({
17654
18030
  createFolder;
17655
18031
  updateFolder;
17656
18032
  deleteFolder;
18033
+ reindexFile;
18034
+ searchFile;
17657
18035
  reindexFolder;
17658
18036
  searchFolder;
17659
18037
  getFileLabels;
@@ -17710,6 +18088,7 @@ var init_chunk_SVRE6KIM = __esm({
17710
18088
  getWorkflowsOutlineBatch;
17711
18089
  createWorkflow;
17712
18090
  updateWorkflow;
18091
+ uploadWorkflowKnowledge;
17713
18092
  getWorkflowDeletionPreview;
17714
18093
  deleteWorkflow;
17715
18094
  archiveWorkflow;
@@ -17795,6 +18174,7 @@ var init_chunk_SVRE6KIM = __esm({
17795
18174
  getPhoneNumberOutboundAnalyticsSummary;
17796
18175
  getPhoneNumberOutboundAnalyticsCalls;
17797
18176
  exportPhoneNumberOutboundAnalyticsCsv;
18177
+ getPhoneNumberActivity;
17798
18178
  getPhoneNumberMessages;
17799
18179
  getPhoneNumberFaxes;
17800
18180
  getPhoneNumberVoicemails;
@@ -17808,6 +18188,8 @@ var init_chunk_SVRE6KIM = __esm({
17808
18188
  createInbox;
17809
18189
  updateInbox;
17810
18190
  deleteInbox;
18191
+ archiveInbox;
18192
+ getInboxArchiveBlockers;
17811
18193
  getInboxEmails;
17812
18194
  getInboxEmail;
17813
18195
  markEmailAsRead;
@@ -17966,7 +18348,6 @@ var init_chunk_SVRE6KIM = __esm({
17966
18348
  // Discord Bots API
17967
18349
  getDiscordBots;
17968
18350
  getDiscordBot;
17969
- getDiscordBotByUuid;
17970
18351
  createDiscordBot;
17971
18352
  updateDiscordBot;
17972
18353
  deleteDiscordBot;
@@ -18034,6 +18415,7 @@ var init_chunk_SVRE6KIM = __esm({
18034
18415
  fhirGetEncounterSyncRuns;
18035
18416
  fhirRefreshEncounterPatient;
18036
18417
  fhirBackfillEncounterSync;
18418
+ getFhirConnectionSyncConfig;
18037
18419
  getAthenaPlatformApp;
18038
18420
  verifyAthenaAccess;
18039
18421
  connectAthena;
@@ -18102,6 +18484,8 @@ var init_chunk_SVRE6KIM = __esm({
18102
18484
  searchSalesforceRecords;
18103
18485
  importSalesforceMembers;
18104
18486
  // HubSpot API
18487
+ getHubspotBookingReceipt;
18488
+ releaseHubspotBookingAttempt;
18105
18489
  installHubspot;
18106
18490
  configureHubspot;
18107
18491
  startHubspotOAuth;
@@ -18133,6 +18517,7 @@ var init_chunk_SVRE6KIM = __esm({
18133
18517
  startSyncRun;
18134
18518
  getSyncRuns;
18135
18519
  getSyncRunItems;
18520
+ getSyncRunItemsPage;
18136
18521
  getMemberSyncSummary;
18137
18522
  getConnectionFieldHomes;
18138
18523
  getInboundRecordStatus;
@@ -18508,10 +18893,10 @@ var init_chunk_6KPGCPGW = __esm({
18508
18893
  var SEARCHABLE_EVENT_RULE_SOURCE_FIELDS, ActivityEventType, EntityKind;
18509
18894
  var init_dist = __esm({
18510
18895
  "../sdk/dist/index.js"() {
18511
- init_chunk_SVRE6KIM();
18896
+ init_chunk_ANVLMZLD();
18512
18897
  init_chunk_D5VNVTUQ();
18513
18898
  init_chunk_6KPGCPGW();
18514
- init_chunk_GCN4OMYU();
18899
+ init_chunk_RLFS7O2L();
18515
18900
  SEARCHABLE_EVENT_RULE_SOURCE_FIELDS = [
18516
18901
  "taskId",
18517
18902
  "dataTypeId",
@@ -18546,6 +18931,7 @@ var init_dist = __esm({
18546
18931
  chatcall_ended: "chat.call_ended",
18547
18932
  chatsummary: "chat.summary",
18548
18933
  messagesent: "message.sent",
18934
+ messagesend_failed: "message.send_failed",
18549
18935
  membermessage_received: "member.message_received",
18550
18936
  escalationopened: "escalation.opened",
18551
18937
  escalationresolved: "escalation.resolved",
@@ -18553,6 +18939,8 @@ var init_dist = __esm({
18553
18939
  callcompleted: "call.completed",
18554
18940
  callmissed: "call.missed",
18555
18941
  callsummary: "call.summary",
18942
+ callqueued: "call.queued",
18943
+ callnot_placed: "call.not_placed",
18556
18944
  presencewent_online: "presence.went_online",
18557
18945
  presencewent_offline: "presence.went_offline",
18558
18946
  operator_groupmember_added: "operator_group.member_added",
@@ -22932,7 +23320,7 @@ var init_package = __esm({
22932
23320
  "package.json"() {
22933
23321
  package_default = {
22934
23322
  name: "@gravity-rail/cli",
22935
- version: "2.0.0",
23323
+ version: "3.1.0",
22936
23324
  description: "Gravity Rail CLI \u2014 manage workspaces from the command line",
22937
23325
  type: "module",
22938
23326
  bin: {
@@ -22958,7 +23346,8 @@ var init_package = __esm({
22958
23346
  license: "MIT",
22959
23347
  repository: {
22960
23348
  type: "git",
22961
- url: "https://developer.gravityrail.com"
23349
+ url: "git+https://github.com/Gravity-Rail/gravity-team.git",
23350
+ directory: "packages/cli"
22962
23351
  },
22963
23352
  homepage: "https://developer.gravityrail.com",
22964
23353
  keywords: [
@@ -22994,7 +23383,7 @@ var init_package = __esm({
22994
23383
  tsup: "^9.0.0",
22995
23384
  typescript: "^6.0.3",
22996
23385
  "typescript-native": "npm:typescript@7.0.2",
22997
- undici: "6.28.1"
23386
+ undici: "6.29.1"
22998
23387
  }
22999
23388
  };
23000
23389
  }
@@ -25287,6 +25676,10 @@ function readStdinIfPiped(firstByteWaitMs) {
25287
25676
 
25288
25677
  // src/lib/phone-voice.ts
25289
25678
  init_errors();
25679
+ function describeOutboundCallReceipt(receipt) {
25680
+ if (!receipt) return "";
25681
+ return `queued (intent ${receipt.intentUuid}, ${receipt.intentState})`;
25682
+ }
25290
25683
 
25291
25684
  // src/lib.ts
25292
25685
  init_output();
@@ -26111,6 +26504,7 @@ init_output();
26111
26504
  init_cli_utils();
26112
26505
  init_context();
26113
26506
  init_concierge_api();
26507
+ init_errors();
26114
26508
  var COLUMNS2 = [
26115
26509
  COL.id(),
26116
26510
  COL.uuid(),
@@ -26124,6 +26518,13 @@ var COLUMNS2 = [
26124
26518
  { header: "CHANNEL", getValue: (item) => item.channel ?? "" },
26125
26519
  COL.created()
26126
26520
  ];
26521
+ var CREATE_COLUMNS = [
26522
+ ...COLUMNS2,
26523
+ {
26524
+ header: "OUTBOUND_CALL",
26525
+ getValue: (item) => describeOutboundCallReceipt(item.outboundCallReceipt)
26526
+ }
26527
+ ];
26127
26528
  var LABEL_COLUMNS = [
26128
26529
  COL.id(),
26129
26530
  COL.uuid(),
@@ -26275,7 +26676,7 @@ var chatsDomain = {
26275
26676
  entityName: "chat",
26276
26677
  listMethod: "getChats",
26277
26678
  // getMethod omitted — the custom get below takes --id or --uuid
26278
- createMethod: "createChat",
26679
+ // createMethod omitted — the custom create below shows the call receipt
26279
26680
  updateMethod: "updateChat",
26280
26681
  deleteMethod: "deleteChat",
26281
26682
  archiveMethod: "archiveChat",
@@ -26283,8 +26684,23 @@ var chatsDomain = {
26283
26684
  columns: COLUMNS2,
26284
26685
  paginationSupport: "full",
26285
26686
  listArgs: [
26286
- { name: "search", description: "Search by name" },
26687
+ {
26688
+ name: "search",
26689
+ description: "Search chat titles, summaries, message content, participant names, emails and phone numbers"
26690
+ },
26287
26691
  { name: "channel", description: "Filter by channel (phone, sms, web, email)" },
26692
+ {
26693
+ name: "workflow-id",
26694
+ description: "Only chats whose assignment pins any revision of this workflow"
26695
+ },
26696
+ {
26697
+ name: "created-after",
26698
+ description: "Only chats created on or after this ISO-8601 timestamp"
26699
+ },
26700
+ {
26701
+ name: "created-before",
26702
+ description: "Only chats created on or before this ISO-8601 timestamp"
26703
+ },
26288
26704
  {
26289
26705
  name: "is-anonymous",
26290
26706
  description: "Show only anonymous chats (requires CHATS_ADMIN)",
@@ -26298,6 +26714,21 @@ var chatsDomain = {
26298
26714
  }
26299
26715
  ]
26300
26716
  }),
26717
+ {
26718
+ path: ["chats", "create"],
26719
+ description: "Create a chat",
26720
+ mutates: true,
26721
+ requiresWorkspace: true,
26722
+ examples: [
26723
+ `gr chats create -w $WORKSPACE_UUID --data '{"channel":"phone-voice","workflowId":12,"memberId":34}' --allow-write`
26724
+ ],
26725
+ handler: async ({ ctx, workspace, data }) => {
26726
+ if (!data) throw new CLIError("JSON data required (--data, --file, or stdin)");
26727
+ const client3 = requireAuth(ctx).apiClient;
26728
+ const chat = await client3.createChat(workspace, data);
26729
+ outputSingle(chat, ctx, CREATE_COLUMNS);
26730
+ }
26731
+ },
26301
26732
  {
26302
26733
  path: ["chats", "get"],
26303
26734
  description: "Get a chat by ID or UUID",
@@ -26838,7 +27269,7 @@ var chatsDomain = {
26838
27269
 
26839
27270
  // ../sdk/dist/helpers.js
26840
27271
  init_chunk_6KPGCPGW();
26841
- init_chunk_GCN4OMYU();
27272
+ init_chunk_RLFS7O2L();
26842
27273
  new TextEncoder();
26843
27274
  var WORKSPACE_EXPORT_JSON_MEMBER = "export.json";
26844
27275
  var MAX_EXPORT_JSON_BYTES = 8 * 1024 * 1024;
@@ -27999,6 +28430,12 @@ Assistant / models (live on the DRAFT revision \u2014 publish to go live)
27999
28430
  "voiceModel":"xai:voice:ara"}}
28000
28431
  realtimeModelConfig (object|null) Realtime config. Omit on update to keep the
28001
28432
  stored config. null replaces it.
28433
+ enableVoicemailDetection (bool|null) Wait for a voicemail greeting to end on
28434
+ outbound calls (adds 3-5 s on a human
28435
+ pickup). null inherits the workspace
28436
+ phone setting. Omit on update to keep
28437
+ the stored choice; null resets it to
28438
+ inherit.
28002
28439
  copyFromAgentId (number) Copy full assistant settings from an agent
28003
28440
  copyFromWorkflowRevisionId (number) Copy assistant settings from a revision
28004
28441
 
@@ -31245,11 +31682,12 @@ var ACTION_PARAM_HINTS = {
31245
31682
  ]
31246
31683
  },
31247
31684
  "webhook:send": {
31248
- summary: "POST the event payload to a URL",
31685
+ summary: "legacy: existing rules only \u2014 POST the event payload to a URL",
31249
31686
  shape: ['{"webhookUrl":"https://example.com/hook"}'],
31250
31687
  notes: [
31251
- "webhookUrl is required and must be https in production.",
31252
- "signingSecret is generated for you when omitted on create; an update that omits it keeps the stored secret."
31688
+ "New webhook:send rules are refused; set up new integrations under Organization \u2192 Webhooks.",
31689
+ "This shape is for updating an existing rule: webhookUrl must be https in production,",
31690
+ "and an update that omits signingSecret keeps the stored secret."
31253
31691
  ]
31254
31692
  },
31255
31693
  "assistant:message": {
@@ -31302,7 +31740,7 @@ Field reference for --data JSON (create/update):
31302
31740
  Required
31303
31741
  objectType (string) task | routine | journey | workflow | calendar | ...
31304
31742
  eventType (string) e.g. routine:triggered, journey_step:execute, chat:created
31305
- actionType (string) e.g. chat:create, member:label, sms:send, webhook:send
31743
+ actionType (string) e.g. chat:create, member:label, sms:send, email:send
31306
31744
 
31307
31745
  Common optional
31308
31746
  name (string)
@@ -31555,8 +31993,11 @@ ${EVENT_RULE_FIELD_REFERENCE}`,
31555
31993
  "Common eventTypes: journey_step:execute, journey:enrolled, routine:triggered,",
31556
31994
  " task:created, chat:created, data_record:created, member:created",
31557
31995
  "",
31558
- "Common actionTypes: member:label, member:notify, webhook:send, email:send,",
31559
- " sms:send, chat:create, member:upsert",
31996
+ "Common actionTypes: member:label, member:notify, email:send, sms:send,",
31997
+ " chat:create, member:upsert",
31998
+ "",
31999
+ "New webhook:send rules are refused: set up outbound webhooks under",
32000
+ "Organization \u2192 Webhooks. Existing webhook:send rules can still be updated or disabled.",
31560
32001
  "",
31561
32002
  'member:label actionParams: {"addLabelIds":["uuid"],"removeLabelIds":["uuid"]}'
31562
32003
  ]
@@ -31662,8 +32103,8 @@ var createRoutineRuleCmd = {
31662
32103
  { name: "delay", description: "Seconds to wait before running the action (default: 0)" }
31663
32104
  ],
31664
32105
  examples: [
31665
- "Trigger: routine:triggered. Common actions: chat:create, webhook:send,",
31666
- "email:send, member:notify.",
32106
+ "Trigger: routine:triggered. Common actions: chat:create, email:send,",
32107
+ "member:notify.",
31667
32108
  "",
31668
32109
  "Scheduled outbound voice check-in:",
31669
32110
  "gr events rules create-routine-rule -w $WID --allow-write \\",
@@ -31671,12 +32112,12 @@ var createRoutineRuleCmd = {
31671
32112
  ' --workflow-uuid "$(gr workflows get --id 3 -w $WID --jq .uuid)" \\',
31672
32113
  ` --action-params '{"channel":"phone-voice","phoneNumberUUID":"<uuid>"}'`,
31673
32114
  "",
31674
- "Webhook on every fire, only for high-priority members:",
32115
+ "Notify the member on every fire, only for high-priority members:",
31675
32116
  "gr events rules create-routine-rule -w $WID --allow-write \\",
31676
- " --routine-id 12 --action-type webhook:send \\",
31677
- ` --action-params '{"webhookUrl":"https://example.com/hook"}' \\`,
32117
+ " --routine-id 12 --action-type member:notify \\",
32118
+ ` --action-params '{"recipientMode":"target_member","messageTemplate":"Time for your check-in."}' \\`,
31678
32119
  ` --conditions 'member.labels.exists(l, l == "priority")'`,
31679
- ...actionParamExampleLines(["chat:create", "webhook:send", "email:send", "member:notify"]),
32120
+ ...actionParamExampleLines(["chat:create", "email:send", "member:notify"]),
31680
32121
  ...VERIFY_EXAMPLE_LINES
31681
32122
  ],
31682
32123
  handler: async (hctx) => {
@@ -31753,7 +32194,8 @@ var createDataRecordRuleCmd = {
31753
32194
  ],
31754
32195
  examples: [
31755
32196
  "Triggers: data_record:created, data_record:updated. Common actions:",
31756
- "chat:create, webhook:send, email:send, member:label.",
32197
+ "chat:create, email:send, member:label. To tell an external system about",
32198
+ "record changes, use Organization \u2192 Webhooks, not an event rule.",
31757
32199
  "",
31758
32200
  "CEL conditions read record fields as record.data.<fieldname>:",
31759
32201
  "gr events rules create-data-record-rule -w $WID --allow-write \\",
@@ -31762,11 +32204,11 @@ var createDataRecordRuleCmd = {
31762
32204
  " --conditions 'record.data.total_score >= 15' \\",
31763
32205
  ` --action-params '{"recipientMode":"specific_member","memberId":<staff-member-id>,"messageTemplate":"High-risk screening submitted."}'`,
31764
32206
  "",
31765
- "Webhook on every update of the form:",
32207
+ "Label the member on every update of the form:",
31766
32208
  "gr events rules create-data-record-rule -w $WID --allow-write \\",
31767
32209
  " --data-type-id 45 --event-type data_record:updated \\",
31768
- ` --action-type webhook:send --action-params '{"webhookUrl":"https://example.com/hook"}'`,
31769
- ...actionParamExampleLines(["chat:create", "webhook:send", "email:send", "member:label"]),
32210
+ ` --action-type member:label --action-params '{"addLabelIds":["<label-uuid>"]}'`,
32211
+ ...actionParamExampleLines(["chat:create", "email:send", "member:label"]),
31770
32212
  ...VERIFY_EXAMPLE_LINES
31771
32213
  ],
31772
32214
  handler: async (hctx) => {
@@ -32003,18 +32445,19 @@ var experimentsDomain = {
32003
32445
  args: [
32004
32446
  ...LIST_PAGINATION_ARGS,
32005
32447
  {
32006
- name: "include-archived",
32007
- description: "Include archived experiments",
32448
+ name: "archived",
32449
+ description: "List archived experiments instead of active experiments",
32450
+ isFlag: true,
32008
32451
  required: false
32009
32452
  }
32010
32453
  ],
32011
32454
  handler: async ({ ctx, workspace, args }) => {
32012
- const includeArchived = args["include-archived"] === "true";
32455
+ const archived = args.archived === true;
32013
32456
  const pag = parsePaginationArgs(args);
32014
32457
  const result3 = await requireAuth(ctx).apiClient.getExperiments(workspace, {
32015
32458
  ...pag.page ? { page: pag.page } : {},
32016
32459
  ...pag.pageSize ? { pageSize: pag.pageSize } : {},
32017
- includeArchived
32460
+ archived
32018
32461
  });
32019
32462
  outputData(listResult(result3, true), ctx, EXPERIMENT_COLUMNS);
32020
32463
  }
@@ -33500,10 +33943,11 @@ var journeysDomain = {
33500
33943
  mutates: true,
33501
33944
  requiresWorkspace: true,
33502
33945
  examples: [
33503
- `gr journeys create -w $WID --data '{"name":"Onboarding","description":"New patient flow","status":"draft"}'`,
33946
+ `gr journeys create -w $WID --data '{"name":"Onboarding","description":"New patient flow","status":"draft","executionModel":"v2"}'`,
33504
33947
  "",
33505
33948
  "Fields: name (required), description, status (draft|active|paused)",
33506
- " ownerId (member ID), autoEnrollFilterId (legacy filter ID), executionModel (legacy|v2)",
33949
+ " ownerId (member ID), autoEnrollFilterId (legacy filter ID)",
33950
+ " executionModel: v2 (the default when omitted; new legacy Journeys cannot be created)",
33507
33951
  " enrollmentConditions (V2): array of {uuid?, name?, filterId OR memberPredicate}"
33508
33952
  ],
33509
33953
  handler: async ({ ctx, workspace, data }) => {
@@ -34338,6 +34782,13 @@ var metricsDomain = {
34338
34782
  prefix: ["metrics"],
34339
34783
  entityName: "metric",
34340
34784
  listMethod: "listMetrics",
34785
+ listArgs: [
34786
+ {
34787
+ name: "archived",
34788
+ description: "List archived metrics instead of active metrics",
34789
+ isFlag: true
34790
+ }
34791
+ ],
34341
34792
  getMethod: "getMetric",
34342
34793
  createMethod: "createMetric",
34343
34794
  updateMethod: "updateMetric",
@@ -34637,11 +35088,45 @@ function parseMaxBudgetUsd(raw, flagName) {
34637
35088
  var REALTIME_MAX_CONCURRENCY = 4;
34638
35089
  function summarizeCriterionResults(run) {
34639
35090
  if (!run.criterionResults?.length) return void 0;
34640
- return run.criterionResults.map((c) => ({
34641
- name: c.criterionName ?? `criterion-${c.criterionId}`,
34642
- passed: c.passed ?? null,
34643
- score: c.score ?? null
34644
- }));
35091
+ return run.criterionResults.map((c) => {
35092
+ const data = c.evaluationData ?? {};
35093
+ const status = data.status === "skipped" && data.reason === "expression_criterion_failed" ? "skipped" : data.error_type != null || data.error != null ? "grading_error" : c.passed === true ? "passed" : c.passed === false ? "failed" : "not_graded";
35094
+ return {
35095
+ name: c.criterionName ?? `criterion-${c.criterionId}`,
35096
+ passed: c.passed ?? null,
35097
+ score: c.score ?? null,
35098
+ status
35099
+ };
35100
+ });
35101
+ }
35102
+ function batchEvaluationStatus(row) {
35103
+ if (row.batch_skipped) return "skipped";
35104
+ if (row.launch_refused) return "launch_refused";
35105
+ if (isConfigurationBlockerFailure(row.failure_reason)) return "configuration_blocker";
35106
+ if (row.outcome === "instrument_failure") return "instrument_failure";
35107
+ if (row.failure_reason?.startsWith("Grading did not finish:") || row.criterion_results?.some((c) => c.status === "grading_error"))
35108
+ return "grading_error";
35109
+ if (row.error || row.failure_reason) return "execution_error";
35110
+ if (!row.evaluated_at) return "not_evaluated";
35111
+ if (row.passed === true) return "passed";
35112
+ if (row.passed === false) return "criterion_failed";
35113
+ return "not_evaluated";
35114
+ }
35115
+ function qualificationRunDiagnostics(run) {
35116
+ const row = runToBatchRow(
35117
+ { round: 0, warmup: false, scenarioId: run.scenarioId ?? 0, modelId: "" },
35118
+ run.workflowId ?? 0,
35119
+ run
35120
+ );
35121
+ const criterionCounts = {};
35122
+ for (const criterion of row.criterion_results ?? []) {
35123
+ criterionCounts[criterion.status] = (criterionCounts[criterion.status] ?? 0) + 1;
35124
+ }
35125
+ return { evaluationStatus: batchEvaluationStatus(row), criterionCounts };
35126
+ }
35127
+ function isLaunchRefusal(error) {
35128
+ if (typeof error !== "object" || error === null || !("statusCode" in error)) return false;
35129
+ return [400, 401, 403, 404, 409, 422].includes(Number(error.statusCode));
34645
35130
  }
34646
35131
  function formatRevisionLabel(row) {
34647
35132
  const pin = row.workflow_revision_pinned ? "(pinned)" : "";
@@ -34676,6 +35161,8 @@ function runToBatchRow(job, workflowId, run, error, batchLabel, pinnedRevisionId
34676
35161
  assistant_realtime_model_id: run?.assistantRealtimeModelId ?? null,
34677
35162
  error,
34678
35163
  failure_reason: run?.failureReason ?? null,
35164
+ simulated_datetime: run?.simulatedDatetime ?? null,
35165
+ simulated_timezone: run?.simulatedTimezone ?? null,
34679
35166
  passed: run?.passed ?? null,
34680
35167
  overall_score: run?.overallScore ?? null,
34681
35168
  timing_summary: run?.timingSummary ?? null,
@@ -34712,13 +35199,13 @@ async function waitForRunTerminal(api, workspace, runId, timeoutMs, pollMs, slee
34712
35199
  }
34713
35200
  throw new BatchWaitTimeoutError(`Timed out waiting for run ${runId} to complete`, lastPolled);
34714
35201
  }
34715
- async function waitForEvaluation(api, workspace, runId, timeoutMs, pollMs, sleep) {
35202
+ async function waitForEvaluation(api, workspace, runId, timeoutMs, pollMs, sleep, previousEvaluatedAt, previousFailureReason) {
34716
35203
  let lastPolled;
34717
35204
  const deadline = Date.now() + timeoutMs;
34718
35205
  while (Date.now() < deadline) {
34719
35206
  const run = await api.getTestChatRun(workspace, runId);
34720
35207
  lastPolled = run;
34721
- if (run.evaluatedAt) {
35208
+ if (run.evaluatedAt && run.evaluatedAt !== previousEvaluatedAt || run.failureReason?.startsWith("Grading did not finish:") && run.failureReason !== previousFailureReason) {
34722
35209
  return run;
34723
35210
  }
34724
35211
  if (run.failedAt) {
@@ -34732,10 +35219,11 @@ function formatBatchProgressLine(job, row) {
34732
35219
  const ttftP50 = row.timing_summary && typeof row.timing_summary === "object" && row.timing_summary.ttft_ms && typeof row.timing_summary.ttft_ms === "object" && "p50" in row.timing_summary.ttft_ms ? String(row.timing_summary.ttft_ms.p50) : "-";
34733
35220
  const cfg = isConfigurationBlockerFailure(row.failure_reason) ? " CONFIG_BLOCKER" : "";
34734
35221
  const skipped = row.batch_skipped ? " SKIPPED" : "";
34735
- return `r${job.round} ${job.modelId} scenario=${job.scenarioId} rev=${formatRevisionLabel(row)} run=${row.run_id ?? "ERR"} passed=${row.passed ?? "-"} score=${row.overall_score != null ? row.overall_score.toFixed(2) : "-"} ttft_p50=${ttftP50}ms${row.error ? ` [${formatProgressError(row.error)}]` : ""}${cfg}${skipped}${job.warmup ? " WARM" : ""}`;
35222
+ return `r${job.round} ${job.modelId} scenario=${job.scenarioId} rev=${formatRevisionLabel(row)} run=${row.run_id ?? "ERR"} lane=${row.lane ?? "?"} status=${row.evaluation_status ?? batchEvaluationStatus(row)} passed=${row.passed ?? "-"} ` + (row.evaluation_request ? `evaluation=${row.evaluation_request} ` : "") + `score=${row.overall_score != null ? row.overall_score.toFixed(2) : "-"} ttft_p50=${ttftP50}ms${row.error ? ` [${formatProgressError(row.error, 60)}]` : ""}${cfg}${skipped}${job.warmup ? " WARM" : ""}`;
34736
35223
  }
34737
35224
  async function executeModelEvalJob(api, options, job, waitTimeoutMs, pollMs, sleep) {
34738
35225
  let run;
35226
+ let evaluationRequest;
34739
35227
  try {
34740
35228
  const started = await api.startTestChatRun(options.workspace, options.workflowId, {
34741
35229
  scenarioId: job.scenarioId,
@@ -34746,6 +35234,7 @@ async function executeModelEvalJob(api, options, job, waitTimeoutMs, pollMs, sle
34746
35234
  ...options.realtimeConfig ? { assistantRealtimeModelConfig: options.realtimeConfig } : {}
34747
35235
  } : { assistantChatModelId: job.modelId }
34748
35236
  });
35237
+ run = started.run;
34749
35238
  run = await waitForRunTerminal(
34750
35239
  api,
34751
35240
  options.workspace,
@@ -34755,35 +35244,49 @@ async function executeModelEvalJob(api, options, job, waitTimeoutMs, pollMs, sle
34755
35244
  sleep
34756
35245
  );
34757
35246
  if (options.evaluate && run.completedAt && !run.failedAt) {
34758
- await api.evaluateTestChatRun(options.workspace, run.id);
34759
- run = await waitForEvaluation(
34760
- api,
34761
- options.workspace,
34762
- run.id,
34763
- waitTimeoutMs,
34764
- pollMs,
34765
- sleep
34766
- );
35247
+ const previousEvaluatedAt = run.evaluatedAt;
35248
+ const previousFailureReason = run.failureReason;
35249
+ const response = await api.evaluateTestChatRun(options.workspace, run.id);
35250
+ evaluationRequest = response?.alreadyEvaluated ? "retained_existing_grade" : "requested";
35251
+ if (!response?.alreadyEvaluated) {
35252
+ run = await waitForEvaluation(
35253
+ api,
35254
+ options.workspace,
35255
+ run.id,
35256
+ waitTimeoutMs,
35257
+ pollMs,
35258
+ sleep,
35259
+ previousEvaluatedAt,
35260
+ previousFailureReason
35261
+ );
35262
+ }
34767
35263
  }
34768
- return runToBatchRow(
34769
- job,
34770
- options.workflowId,
34771
- run,
34772
- void 0,
34773
- options.batchLabel,
34774
- options.workflowRevisionId
34775
- );
35264
+ return {
35265
+ ...runToBatchRow(
35266
+ job,
35267
+ options.workflowId,
35268
+ run,
35269
+ void 0,
35270
+ options.batchLabel,
35271
+ options.workflowRevisionId
35272
+ ),
35273
+ ...evaluationRequest ? { evaluation_request: evaluationRequest } : {}
35274
+ };
34776
35275
  } catch (e) {
34777
35276
  const message = e instanceof Error ? e.message : String(e);
34778
35277
  const lastKnown = (e instanceof BatchWaitTimeoutError ? e.lastPolledRun : void 0) ?? run ?? null;
34779
- return runToBatchRow(
34780
- job,
34781
- options.workflowId,
34782
- lastKnown,
34783
- message,
34784
- options.batchLabel,
34785
- options.workflowRevisionId
34786
- );
35278
+ return {
35279
+ ...runToBatchRow(
35280
+ job,
35281
+ options.workflowId,
35282
+ lastKnown,
35283
+ message,
35284
+ options.batchLabel,
35285
+ options.workflowRevisionId
35286
+ ),
35287
+ ...!run && isLaunchRefusal(e) ? { launch_refused: true } : {},
35288
+ ...evaluationRequest ? { evaluation_request: evaluationRequest } : {}
35289
+ };
34787
35290
  }
34788
35291
  }
34789
35292
  function createSpacingGate(spacingSec, sleep) {
@@ -34823,6 +35326,9 @@ async function executeModelEvalBatch(api, options) {
34823
35326
  `);
34824
35327
  }
34825
35328
  };
35329
+ emitProgress(
35330
+ `Batch: ${jobs.length} run(s), Workflow ${options.workflowId}, revision ${options.workflowRevisionId != null ? `id${options.workflowRevisionId} (pinned)` : "active at each launch (use --workflow-revision-id for a fixed comparison)"}.`
35331
+ );
34826
35332
  const realtimeJobCount = jobs.filter((j) => j.realtime).length;
34827
35333
  let concurrency = options.concurrency ?? 1;
34828
35334
  if (realtimeJobCount > 0 && concurrency > REALTIME_MAX_CONCURRENCY) {
@@ -34844,6 +35350,7 @@ async function executeModelEvalBatch(api, options) {
34844
35350
  }
34845
35351
  }
34846
35352
  const recordRow = (job, row) => {
35353
+ row.evaluation_status = batchEvaluationStatus(row);
34847
35354
  rows.push(row);
34848
35355
  if (options.outPath) {
34849
35356
  appendFileSync(options.outPath, `${JSON.stringify(row)}
@@ -34868,16 +35375,16 @@ async function executeModelEvalBatch(api, options) {
34868
35375
  return makeSkippedRow(job);
34869
35376
  }
34870
35377
  const row = await executeModelEvalJob(api, options, job, waitTimeoutMs, pollMs, sleep);
34871
- if (isConfigurationBlockerFailure(row.failure_reason)) {
35378
+ if (row.launch_refused || isConfigurationBlockerFailure(row.failure_reason)) {
34872
35379
  stopBatch = true;
34873
35380
  }
34874
- if (job.realtime && !row.batch_skipped) {
35381
+ if (job.realtime && !row.batch_skipped && !row.launch_refused) {
34875
35382
  actualSpendUsd += actualRealtimeRowCostUsd(row, job.modelId);
34876
35383
  if (options.maxBudgetUsd != null && actualSpendUsd >= options.maxBudgetUsd && !stopBatch) {
34877
35384
  stopBatch = true;
34878
35385
  budgetStopped = true;
34879
35386
  emitProgress(
34880
- `realtime budget: actual spend ~$${actualSpendUsd.toFixed(2)} reached cap $${options.maxBudgetUsd.toFixed(2)} \u2014 stopping dispatch`
35387
+ `realtime budget: attributed spend ~$${actualSpendUsd.toFixed(2)} reached cap $${options.maxBudgetUsd.toFixed(2)} \u2014 stopping dispatch`
34881
35388
  );
34882
35389
  }
34883
35390
  }
@@ -34898,7 +35405,14 @@ async function executeModelEvalBatch(api, options) {
34898
35405
  }
34899
35406
  } else {
34900
35407
  const results = new Array(jobs.length);
34901
- let nextIndex = 0;
35408
+ const firstJob = jobs[0];
35409
+ if (firstJob) {
35410
+ emitProgress("Checking the first run before parallel dispatch (no extra test run).");
35411
+ const firstRow = await runOne(firstJob);
35412
+ results[0] = firstRow;
35413
+ recordRow(firstJob, firstRow);
35414
+ }
35415
+ let nextIndex = 1;
34902
35416
  const worker = async () => {
34903
35417
  while (true) {
34904
35418
  if (stopBatch) {
@@ -34932,7 +35446,45 @@ async function executeModelEvalBatch(api, options) {
34932
35446
  }
34933
35447
  }
34934
35448
  if (realtimeJobCount > 0) {
34935
- emitProgress(`realtime budget: total actual spend ~$${actualSpendUsd.toFixed(2)}`);
35449
+ emitProgress(
35450
+ `realtime budget: total attributed spend ~$${actualSpendUsd.toFixed(2)} (measured duration where available; estimated otherwise)`
35451
+ );
35452
+ }
35453
+ const counts = rows.reduce((result3, row) => {
35454
+ const status = row.evaluation_status ?? batchEvaluationStatus(row);
35455
+ result3[status] = (result3[status] ?? 0) + 1;
35456
+ return result3;
35457
+ }, {});
35458
+ emitProgress(
35459
+ `Batch results: ${Object.entries(counts).map(([status, count]) => `${status}=${count}`).join(" ")}. Criterion failures are not necessarily model defects.`
35460
+ );
35461
+ const criteria = rows.flatMap((row) => row.criterion_results ?? []);
35462
+ if (criteria.length) {
35463
+ const criterionCounts = criteria.reduce((result3, criterion) => {
35464
+ result3[criterion.status] = (result3[criterion.status] ?? 0) + 1;
35465
+ return result3;
35466
+ }, {});
35467
+ emitProgress(
35468
+ `Criteria: ${Object.entries(criterionCounts).map(([status, count]) => `${status}=${count}`).join(
35469
+ " "
35470
+ )}. Inspect individual criteria; runtime/setup checks can fail independently of the Agent.`
35471
+ );
35472
+ }
35473
+ const skippedCriteria = criteria.filter((c) => c.status === "skipped").length;
35474
+ if (skippedCriteria)
35475
+ emitProgress(
35476
+ `Rubric criteria skipped after expression failure: ${skippedCriteria}; these are not failing grades.`
35477
+ );
35478
+ if (rows.some((row) => row.simulated_datetime)) {
35479
+ emitProgress(
35480
+ "Simulated time does not change external service clocks. Verify captured routing time separately."
35481
+ );
35482
+ }
35483
+ const refusalRow = rows.find((row) => row.launch_refused);
35484
+ if (refusalRow) {
35485
+ throw new CLIError(
35486
+ `Batch stopped: the API refused a run before launch. Check the scenario persona Member role or the workspace default role, request permissions, and Workflow/model settings. No role or permission was changed. Remaining jobs were not started. Last refusal: ${formatProgressError(refusalRow.error ?? "", 200)}`
35487
+ );
34936
35488
  }
34937
35489
  const blockerRow = rows.find((r) => isConfigurationBlockerFailure(r.failure_reason));
34938
35490
  if (blockerRow) {
@@ -34989,6 +35541,16 @@ var RUN_COLUMNS = [
34989
35541
  header: "DRIVER",
34990
35542
  getValue: (item) => item.driverMemberId == null ? "auto" : item.driverMemberName ?? `member #${item.driverMemberId}`
34991
35543
  },
35544
+ { header: "STATUS", getValue: (item) => item.evaluationStatus ?? "" },
35545
+ {
35546
+ header: "MODEL",
35547
+ getValue: (item) => item.assistantRealtimeModelId ?? item.assistantChatModelId ?? ""
35548
+ },
35549
+ {
35550
+ header: "REVISION",
35551
+ getValue: (item) => String(item.workflowRevisionNumber ?? item.workflowRevisionId ?? "")
35552
+ },
35553
+ { header: "LANE", getValue: (item) => item.lane ?? "" },
34992
35554
  { header: "STARTED", getValue: (item) => item.startedAt ?? "" },
34993
35555
  { header: "COMPLETED", getValue: (item) => item.completedAt ?? "" },
34994
35556
  {
@@ -35133,7 +35695,14 @@ var qualificationsDomain = {
35133
35695
  ...assistantChatModelId ? { assistantChatModelId } : {}
35134
35696
  }
35135
35697
  );
35136
- outputData(result3, ctx, RUN_COLUMNS);
35698
+ outputData(
35699
+ result3.map((run) => ({
35700
+ ...run,
35701
+ ...qualificationRunDiagnostics(run)
35702
+ })),
35703
+ ctx,
35704
+ RUN_COLUMNS
35705
+ );
35137
35706
  }
35138
35707
  },
35139
35708
  {
@@ -35146,7 +35715,7 @@ var qualificationsDomain = {
35146
35715
  workspace,
35147
35716
  requireNumber(args, "id")
35148
35717
  );
35149
- outputSingle(result3, ctx);
35718
+ outputSingle({ ...result3, ...qualificationRunDiagnostics(result3) }, ctx);
35150
35719
  }
35151
35720
  },
35152
35721
  {
@@ -35263,11 +35832,12 @@ var qualificationsDomain = {
35263
35832
  requiresWorkspace: true,
35264
35833
  args: [{ name: "id", description: "Test chat run ID", required: true }],
35265
35834
  handler: async ({ ctx, workspace, args }) => {
35266
- await requireAuth(ctx).apiClient.evaluateTestChatRun(
35835
+ const result3 = await requireAuth(ctx).apiClient.evaluateTestChatRun(
35267
35836
  workspace,
35268
35837
  requireNumber(args, "id")
35269
35838
  );
35270
- process.stdout.write(`Evaluation started for test chat run ${args["id"]}
35839
+ const message = result3.alreadyEvaluated ? `Test chat run ${args["id"]} is already evaluated; its stored grade is unchanged.` : `Evaluation requested for test chat run ${args["id"]}.`;
35840
+ process.stdout.write(`${message}
35271
35841
  `);
35272
35842
  }
35273
35843
  },
@@ -36879,9 +37449,9 @@ function buildQueryRequest(args, now) {
36879
37449
  if (groupBy) request.groupBy = groupBy;
36880
37450
  const eventTypes = parseEventTypes(args);
36881
37451
  if (eventTypes.length > 0) request.eventTypes = eventTypes;
36882
- const subject = parseSubject(args);
36883
- if (subject) {
36884
- request.subject = subject;
37452
+ const subject2 = parseSubject(args);
37453
+ if (subject2) {
37454
+ request.subject = subject2;
36885
37455
  if (!request.grain) request.grain = ActivityGrain.event;
36886
37456
  }
36887
37457
  const scope = parseScope(args);
@@ -37849,7 +38419,7 @@ var COLUMNS16 = [
37849
38419
  { header: "PREFIX", getValue: (item) => item.prefix ?? "" },
37850
38420
  COL.created()
37851
38421
  ];
37852
- var CREATE_COLUMNS = [
38422
+ var CREATE_COLUMNS2 = [
37853
38423
  COL.id(),
37854
38424
  COL.name(),
37855
38425
  { header: "KEY", getValue: (item) => item.key ?? "" },
@@ -37876,7 +38446,7 @@ var apiKeysDomain = {
37876
38446
  requiresWorkspace: true,
37877
38447
  handler: async ({ ctx, workspace, data }) => {
37878
38448
  const result3 = await requireAuth(ctx).apiClient.createApiKey(workspace, data);
37879
- outputSingle(result3, ctx, CREATE_COLUMNS);
38449
+ outputSingle(result3, ctx, CREATE_COLUMNS2);
37880
38450
  if (ctx.outputFormat === "table") {
37881
38451
  process.stdout.write("\n\u26A0 This key will not be shown again. Copy it now.\n");
37882
38452
  }
@@ -37911,7 +38481,7 @@ var apiKeysDomain = {
37911
38481
  requiresWorkspace: false,
37912
38482
  handler: async ({ ctx, data }) => {
37913
38483
  const result3 = await requireAuth(ctx).apiClient.createGlobalApiKey(data);
37914
- outputSingle(result3, ctx, CREATE_COLUMNS);
38484
+ outputSingle(result3, ctx, CREATE_COLUMNS2);
37915
38485
  if (ctx.outputFormat === "table") {
37916
38486
  process.stdout.write("\n\u26A0 This key will not be shown again. Copy it now.\n");
37917
38487
  }
@@ -38795,6 +39365,10 @@ var inboxesDomain = {
38795
39365
  createMethod: "createInbox",
38796
39366
  updateMethod: "updateInbox",
38797
39367
  deleteMethod: "deleteInbox",
39368
+ // One-way, like a phone number: the inbox leaves the Active list,
39369
+ // refuses new mail, and keeps its emails. Delete stays the verb that
39370
+ // finally removes it.
39371
+ archiveMethod: "archiveInbox",
38798
39372
  columns: COLUMNS19
38799
39373
  }),
38800
39374
  {
@@ -39243,6 +39817,131 @@ var operatorGroupsDomain = {
39243
39817
  ]
39244
39818
  };
39245
39819
 
39820
+ // src/domains/org-billing.ts
39821
+ init_context();
39822
+ init_errors();
39823
+ init_output();
39824
+ async function subject(hctx) {
39825
+ const auth = requireAuth(hctx.ctx);
39826
+ const billing = await auth.apiClient.getOrgBillingCustomer(requireOrgRef(hctx.args));
39827
+ if (!billing.hasAccess || !billing.customerUuid || !billing.subscriptionId) {
39828
+ throw new CLIError("A billing role on this organization\u2019s billing customer is required");
39829
+ }
39830
+ return { auth, billing };
39831
+ }
39832
+ var orgBillingCommands = [
39833
+ {
39834
+ path: ["org", "billing", "get"],
39835
+ description: "Read only this organization\u2019s billable subscription",
39836
+ args: [ORG_UUID_ARG],
39837
+ handler: async (hctx) => {
39838
+ const { auth, billing } = await subject(hctx);
39839
+ outputSingle(
39840
+ await auth.apiClient.getMyCustomerSubscriptions(billing.customerUuid, {
39841
+ subscriptionId: billing.subscriptionId,
39842
+ pageSize: 1
39843
+ }),
39844
+ hctx.ctx
39845
+ );
39846
+ }
39847
+ },
39848
+ {
39849
+ path: ["org", "billing", "update"],
39850
+ description: "Update this organization\u2019s subscription credit settings (billing owner required)",
39851
+ args: [ORG_UUID_ARG],
39852
+ mutates: true,
39853
+ acceptsJsonInput: true,
39854
+ handler: async (hctx) => {
39855
+ const { auth, billing } = await subject(hctx);
39856
+ if (!hctx.data || typeof hctx.data !== "object" || Array.isArray(hctx.data))
39857
+ throw new CLIError("Provide credit settings as a JSON object with --data");
39858
+ outputSingle(
39859
+ await auth.apiClient.updateSubscription(billing.subscriptionId, hctx.data),
39860
+ hctx.ctx
39861
+ );
39862
+ }
39863
+ },
39864
+ {
39865
+ path: ["org", "billing", "purchase-credits"],
39866
+ description: "Purchase extra credits for this organization (charges the billing owner\u2019s payment method)",
39867
+ args: [
39868
+ ORG_UUID_ARG,
39869
+ { name: "amount-cents", description: "Amount to charge in cents", required: true },
39870
+ {
39871
+ name: "idempotency-key",
39872
+ description: "Stable operation key to prevent a duplicate charge"
39873
+ }
39874
+ ],
39875
+ mutates: true,
39876
+ handler: async (hctx) => {
39877
+ const { auth, billing } = await subject(hctx);
39878
+ const amount = Number(hctx.args["amount-cents"]);
39879
+ if (!Number.isInteger(amount) || amount < 100 || amount > 1e7)
39880
+ throw new CLIError("Use an integer amount between 100 and 10000000 cents");
39881
+ outputSingle(
39882
+ await auth.apiClient.purchaseCredits(
39883
+ billing.subscriptionId,
39884
+ amount,
39885
+ hctx.args["idempotency-key"]
39886
+ ),
39887
+ hctx.ctx
39888
+ );
39889
+ }
39890
+ }
39891
+ ];
39892
+
39893
+ // src/domains/org-api.ts
39894
+ init_context();
39895
+ init_errors();
39896
+ init_output();
39897
+ var orgApiCommands = [
39898
+ {
39899
+ path: ["org", "api"],
39900
+ description: "Call an organization management endpoint. --path is relative to /o/{org}. Use the same method and JSON body as the org UI. Covers members, invitations, workspaces, brands/campaigns, phone numbers, domains, SSO, connectors, billing policy and webhooks. Workspace data and credential changes keep their existing authorization gates.",
39901
+ args: [
39902
+ ORG_UUID_ARG,
39903
+ {
39904
+ name: "path",
39905
+ description: "Org-relative API path, e.g. /members or /a2p-brands",
39906
+ required: true
39907
+ },
39908
+ { name: "method", description: "GET, POST, PUT, PATCH or DELETE", default: "GET" }
39909
+ ],
39910
+ mutates: true,
39911
+ acceptsJsonInput: true,
39912
+ examples: [
39913
+ "gr org api --org $ORG_UUID --path /members --allow-write",
39914
+ `gr org api --org $ORG_UUID --path /invitations --method POST --data '{"email":"colleague@example.test","role":"member"}' --allow-write`
39915
+ ],
39916
+ handler: async ({ ctx, args, data }) => {
39917
+ const auth = requireAuth(ctx);
39918
+ const method = String(args.method).toUpperCase();
39919
+ if (!["GET", "POST", "PUT", "PATCH", "DELETE"].includes(method)) {
39920
+ throw new CLIError("Use GET, POST, PUT, PATCH or DELETE");
39921
+ }
39922
+ const org = encodeURIComponent(requireOrgRef(args));
39923
+ const path4 = String(args.path);
39924
+ const prefix = `/api/v2/o/${org}`;
39925
+ const base = new URL(auth.envConfig.apiUrl);
39926
+ const url = new URL(`${prefix}${path4}`, base);
39927
+ if (!path4.startsWith("/") || path4.startsWith("//") || path4.includes("\\") || /%(?:2e|2f|5c)/i.test(path4.split("?")[0] ?? "") || url.origin !== base.origin || url.pathname !== prefix && !url.pathname.startsWith(prefix + "/")) {
39928
+ throw new CLIError("Use a path within this organization");
39929
+ }
39930
+ const response = await fetch(url, {
39931
+ method,
39932
+ redirect: "error",
39933
+ headers: {
39934
+ Authorization: `Bearer ${auth.accessToken}`,
39935
+ "Content-Type": "application/json"
39936
+ },
39937
+ ...data !== void 0 && method !== "GET" ? { body: JSON.stringify(data) } : {}
39938
+ });
39939
+ if (!response.ok) throw new CLIError(`Organization request failed (${response.status})`);
39940
+ outputSingle(response.status === 204 ? { success: true } : await response.json(), ctx);
39941
+ }
39942
+ }
39943
+ ];
39944
+
39246
39945
  // src/domains/org.ts
39247
39946
  init_dist();
39248
39947
  init_context();
@@ -39453,7 +40152,7 @@ var ORG_MEMBER_ID_ARG = {
39453
40152
  };
39454
40153
  var ORG_MEMBER_ROLE_ARG = {
39455
40154
  name: "role",
39456
- description: "New role: member, admin, owner, or platform_support"
40155
+ description: "New role: member, developer, admin, owner, or platform_support"
39457
40156
  };
39458
40157
  var ORG_MEMBER_NAME_ARG = {
39459
40158
  name: "name",
@@ -40311,6 +41010,8 @@ var orgDomain = {
40311
41010
  name: "org",
40312
41011
  description: "Organization membership, domains, webhook endpoints, and workspace labels",
40313
41012
  commands: [
41013
+ ...orgApiCommands,
41014
+ ...orgBillingCommands,
40314
41015
  {
40315
41016
  path: ["org", "list"],
40316
41017
  description: "List my organizations",
@@ -40347,6 +41048,7 @@ init_errors();
40347
41048
  init_output();
40348
41049
  var LEGAL_ENTITY_COLUMNS = [
40349
41050
  { header: "UUID", getValue: (e) => e.uuid ?? "" },
41051
+ { header: "LABEL", getValue: (e) => e.displayName ?? e.legalName ?? "" },
40350
41052
  { header: "LEGAL NAME", getValue: (e) => e.legalName ?? "" },
40351
41053
  { header: "PRIMARY", getValue: (e) => e.isPrimary ? "yes" : "" },
40352
41054
  { header: "ID TYPE", getValue: (e) => e.registrationIdentifierType ?? "" },
@@ -40430,12 +41132,13 @@ var commands2 = [
40430
41132
  },
40431
41133
  {
40432
41134
  path: ["org", "legal-entities", "create"],
40433
- description: "Create a legal entity (its business profile is filled in separately)",
41135
+ description: "Create a legal entity (its business profile is filled in separately). displayName defaults to legalName; give a second entity for the same business (another region) a distinct label.",
40434
41136
  mutates: true,
40435
41137
  requiresWorkspace: false,
40436
41138
  args: [ORG_UUID_ARG],
40437
41139
  examples: [
40438
- `yarn gr org legal-entities create --org-uuid $ORG_UUID --data '{"legalName":"Acme Health"}' --allow-write`
41140
+ `yarn gr org legal-entities create --org-uuid $ORG_UUID --data '{"legalName":"Acme Health"}' --allow-write`,
41141
+ `yarn gr org legal-entities create --org-uuid $ORG_UUID --data '{"legalName":"Leapcure","displayName":"Leapcure (Australia)"}' --allow-write`
40439
41142
  ],
40440
41143
  handler: async (hctx) => {
40441
41144
  const result3 = await requireAuth(hctx.ctx).apiClient.createLegalEntity(
@@ -40618,11 +41321,14 @@ var commands3 = [
40618
41321
  { name: "org-uuid", aliases: ["org"], description: "Organization UUID", required: true },
40619
41322
  {
40620
41323
  name: "country",
40621
- description: "ISO country code, e.g. US, AU, GB (default: US)",
41324
+ description: "Country: US or AU (default: US)",
40622
41325
  default: "US"
40623
41326
  },
40624
- { name: "number-type", description: "Number type: local or toll_free", default: "local" },
40625
- { name: "area-code", description: "Area code filter" },
41327
+ {
41328
+ name: "number-type",
41329
+ description: "US: local or toll_free (default: local); AU: mobile (default: mobile)"
41330
+ },
41331
+ { name: "area-code", description: "US local area code filter" },
40626
41332
  { name: "contains", description: "Phone number pattern to match" },
40627
41333
  { name: "limit", description: "Maximum results (default: 20)" }
40628
41334
  ],
@@ -40630,9 +41336,10 @@ var commands3 = [
40630
41336
  columns: AVAILABLE_PHONE_COLUMNS,
40631
41337
  handler: async (hctx) => {
40632
41338
  const orgUuid = requireOrgRef(hctx.args);
41339
+ const country = hctx.args.country ?? "US";
40633
41340
  const result3 = await getOrgApi(hctx).searchPhoneNumbers(orgUuid, {
40634
- country: hctx.args.country ?? "US",
40635
- numberType: hctx.args["number-type"] ?? "local",
41341
+ country,
41342
+ numberType: hctx.args["number-type"] ?? (country.toUpperCase() === "AU" ? "mobile" : "local"),
40636
41343
  areaCode: hctx.args["area-code"],
40637
41344
  contains: hctx.args.contains,
40638
41345
  limit: hctx.args.limit ? Number(hctx.args.limit) : void 0
@@ -40647,19 +41354,26 @@ var commands3 = [
40647
41354
  args: [
40648
41355
  { name: "org-uuid", aliases: ["org"], description: "Organization UUID", required: true },
40649
41356
  { name: "phone-number", description: "E.164 phone number to purchase", required: true },
40650
- { name: "number-type", description: "Number type: local or toll_free", default: "local" },
41357
+ {
41358
+ name: "number-type",
41359
+ description: "US: local or toll_free (default: local); AU: mobile (default: mobile)"
41360
+ },
40651
41361
  {
40652
41362
  name: "country",
40653
- description: "ISO country code of the number, e.g. US, AU (default: US)",
41363
+ description: "Country: US or AU (default: US)",
40654
41364
  default: "US"
40655
41365
  },
41366
+ {
41367
+ name: "legal-entity",
41368
+ description: "Approved business UUID for Australian mobile numbers"
41369
+ },
40656
41370
  {
40657
41371
  name: "bundle-sid",
40658
- description: "Twilio regulatory bundle SID (BUxxxx) \u2014 required for regulated countries like AU"
41372
+ description: "Twilio regulatory bundle SID (BUxxxx); not accepted for AU, use --legal-entity"
40659
41373
  },
40660
41374
  {
40661
41375
  name: "address-sid",
40662
- description: "Twilio address SID (ADxxxx) \u2014 required alongside the bundle for regulated countries"
41376
+ description: "Twilio address SID (ADxxxx); not accepted for AU, use --legal-entity"
40663
41377
  }
40664
41378
  ],
40665
41379
  requiresWorkspace: false,
@@ -40668,13 +41382,15 @@ var commands3 = [
40668
41382
  const orgUuid = requireOrgRef(hctx.args);
40669
41383
  const phoneNumber = hctx.args["phone-number"];
40670
41384
  if (!phoneNumber) throw new CLIError("Missing required argument: --phone-number");
40671
- const numberType = hctx.args["number-type"] ?? "local";
41385
+ const country = hctx.args.country ?? "US";
41386
+ const numberType = hctx.args["number-type"] ?? (country.toUpperCase() === "AU" ? "mobile" : "local");
40672
41387
  const result3 = await getOrgApi(hctx).purchasePhoneNumber(
40673
41388
  orgUuid,
40674
41389
  phoneNumber,
40675
41390
  numberType,
40676
41391
  {
40677
- country: hctx.args.country ?? "US",
41392
+ country,
41393
+ legalEntityUuid: hctx.args["legal-entity"],
40678
41394
  bundleSid: hctx.args["bundle-sid"],
40679
41395
  addressSid: hctx.args["address-sid"]
40680
41396
  }
@@ -45868,6 +46584,44 @@ var COLUMNS31 = [
45868
46584
  { header: "URL", getValue: (item) => item.baseUrl ?? "" },
45869
46585
  COL.status()
45870
46586
  ];
46587
+ var COLUMNS_WITH_SYNC_STATE = [
46588
+ ...COLUMNS31,
46589
+ {
46590
+ header: "LAST SYNC OK",
46591
+ getValue: (item) => item.syncState?.lastSuccessfulAt ?? ""
46592
+ },
46593
+ {
46594
+ header: "SYNC STATUS",
46595
+ getValue: (item) => item.syncState?.lastStatus ?? ""
46596
+ }
46597
+ ];
46598
+ var SYNC_CONFIG_COLUMNS = [
46599
+ { header: "SYNC KEY", getValue: (config) => config.syncKey ?? "default" },
46600
+ {
46601
+ header: "POLL (MIN)",
46602
+ getValue: (config) => config.inboundPollIntervalMinutes == null ? "" : String(config.inboundPollIntervalMinutes)
46603
+ },
46604
+ {
46605
+ header: "LAST ATTEMPTED",
46606
+ getValue: (config) => config.connectionParams?.ecwEncounterSyncState?.lastAttemptedAt ?? ""
46607
+ },
46608
+ {
46609
+ header: "LAST SUCCESSFUL",
46610
+ getValue: (config) => config.connectionParams?.ecwEncounterSyncState?.lastSuccessfulAt ?? ""
46611
+ },
46612
+ {
46613
+ header: "STATUS",
46614
+ getValue: (config) => config.connectionParams?.ecwEncounterSyncState?.lastStatus ?? ""
46615
+ },
46616
+ {
46617
+ header: "LAST ERROR",
46618
+ getValue: (config) => config.connectionParams?.ecwEncounterSyncState?.lastError ?? ""
46619
+ },
46620
+ {
46621
+ header: "PATIENT REFRESH",
46622
+ getValue: (config) => config.connectionParams?.ecwEncounterSyncState?.lastPatientRefreshStatus ?? ""
46623
+ }
46624
+ ];
45871
46625
  function summarizeReasons(collections, key) {
45872
46626
  if (!collections?.length) return "";
45873
46627
  const parts = [];
@@ -45909,13 +46663,61 @@ var fhirConnectionsDomain = {
45909
46663
  prefix: ["fhir-connections"],
45910
46664
  entityName: "FHIR connection",
45911
46665
  listMethod: "getFhirConnections",
45912
- getMethod: "getFhirConnection",
45913
46666
  createMethod: "createFhirConnection",
45914
46667
  updateMethod: "updateFhirConnection",
45915
46668
  deleteMethod: "deleteFhirConnection",
45916
46669
  columns: COLUMNS31,
45917
46670
  paginationSupport: "full"
45918
46671
  }),
46672
+ {
46673
+ path: ["fhir-connections", "get"],
46674
+ description: "Get a FHIR connection by ID, optionally with its eCW encounter-sync state",
46675
+ requiresWorkspace: true,
46676
+ args: [
46677
+ { name: "id", description: "FHIR connection ID", required: true },
46678
+ {
46679
+ name: "with-sync-state",
46680
+ description: "Also read the connection sync config and include syncState (one extra request)",
46681
+ isFlag: true
46682
+ }
46683
+ ],
46684
+ examples: [
46685
+ "fhir-connections get --id 12",
46686
+ "fhir-connections get --id 12 --with-sync-state --output-format json"
46687
+ ],
46688
+ handler: async ({ ctx, workspace, args }) => {
46689
+ const api = requireAuth(ctx).apiClient;
46690
+ const id = requireNumber(args, "id");
46691
+ const connection = await api.getFhirConnection(workspace, id);
46692
+ if (!args["with-sync-state"]) {
46693
+ outputSingle(connection, ctx, COLUMNS31);
46694
+ return;
46695
+ }
46696
+ const config = await api.getFhirConnectionSyncConfig(workspace, id);
46697
+ const withState = {
46698
+ ...connection,
46699
+ syncState: config.connectionParams?.ecwEncounterSyncState ?? null
46700
+ };
46701
+ outputSingle(withState, ctx, COLUMNS_WITH_SYNC_STATE);
46702
+ }
46703
+ },
46704
+ {
46705
+ path: ["fhir-connections", "sync-config"],
46706
+ description: "Get the FHIR connection sync configuration and its eCW encounter-sync watermark",
46707
+ requiresWorkspace: true,
46708
+ args: [{ name: "id", description: "FHIR connection ID", required: true }],
46709
+ examples: [
46710
+ "fhir-connections sync-config --id 12",
46711
+ "fhir-connections sync-config --id 12 --output-format json"
46712
+ ],
46713
+ handler: async ({ ctx, workspace, args }) => {
46714
+ const config = await requireAuth(ctx).apiClient.getFhirConnectionSyncConfig(
46715
+ workspace,
46716
+ requireNumber(args, "id")
46717
+ );
46718
+ outputSingle(config, ctx, SYNC_CONFIG_COLUMNS);
46719
+ }
46720
+ },
45919
46721
  {
45920
46722
  path: ["fhir-connections", "test"],
45921
46723
  description: "Test a FHIR connection",
@@ -46608,6 +47410,60 @@ var hubspotDomain = {
46608
47410
  name: "hubspot",
46609
47411
  description: "HubSpot CRM integration",
46610
47412
  commands: [
47413
+ {
47414
+ path: ["hubspot", "booking-deals", "receipt"],
47415
+ description: "Inspect a booking receipt before operator recovery",
47416
+ requiresWorkspace: true,
47417
+ args: [{ name: "meeting-id", description: "HubSpot meeting ID", required: true }],
47418
+ handler: async ({ ctx, workspace, args }) => {
47419
+ outputSingle(
47420
+ await requireAuth(ctx).apiClient.getHubspotBookingReceipt(
47421
+ workspace,
47422
+ requireString(args, "meeting-id")
47423
+ ),
47424
+ ctx
47425
+ );
47426
+ }
47427
+ },
47428
+ {
47429
+ path: ["hubspot", "booking-deals", "release"],
47430
+ description: "Release an uncertain attempt after checking HubSpot and stopping any running attempt. Does not create a deal; replay the booking record afterward.",
47431
+ requiresWorkspace: true,
47432
+ mutates: true,
47433
+ args: [
47434
+ { name: "meeting-id", description: "HubSpot meeting ID", required: true },
47435
+ { name: "portal-id", description: "Inspected receipt portal ID", required: true },
47436
+ { name: "attempt-id", description: "Inspected receipt attempt UUID", required: true },
47437
+ {
47438
+ name: "confirm-no-deal-and-no-running-attempt",
47439
+ description: "Enter yes after verifying both conditions in HubSpot and Gravity Rail",
47440
+ required: true
47441
+ }
47442
+ ],
47443
+ handler: async ({ ctx, workspace, args }) => {
47444
+ if (args["confirm-no-deal-and-no-running-attempt"] !== "yes") {
47445
+ throw new CLIError(
47446
+ "Confirm no existing deal and no running attempt with --confirm-no-deal-and-no-running-attempt yes"
47447
+ );
47448
+ }
47449
+ await requireAuth(ctx).apiClient.releaseHubspotBookingAttempt(
47450
+ workspace,
47451
+ requireString(args, "meeting-id"),
47452
+ {
47453
+ portalId: requireString(args, "portal-id"),
47454
+ attemptId: requireString(args, "attempt-id"),
47455
+ confirmedNoDealAndNoRunningAttempt: true
47456
+ }
47457
+ );
47458
+ outputSingle(
47459
+ {
47460
+ status: "released",
47461
+ nextStep: "Replay the booking record through its record-updated Action"
47462
+ },
47463
+ ctx
47464
+ );
47465
+ }
47466
+ },
46611
47467
  {
46612
47468
  path: ["hubspot", "install"],
46613
47469
  description: "Install HubSpot (setup step 1): create the connection and get its OAuth callback URL",
@@ -49718,6 +50574,7 @@ var ChatTUI = class {
49718
50574
  activeToolName = "";
49719
50575
  pausedForPrompt = false;
49720
50576
  turnInProgress = false;
50577
+ queuedMessageCount = 0;
49721
50578
  constructor(options) {
49722
50579
  this.options = options;
49723
50580
  this.debugPanelVisible = !!options.debug;
@@ -49801,6 +50658,10 @@ var ChatTUI = class {
49801
50658
  this.activeToolName = "";
49802
50659
  this.dirty();
49803
50660
  }
50661
+ setQueuedMessageCount(count) {
50662
+ this.queuedMessageCount = count;
50663
+ this.dirty();
50664
+ }
49804
50665
  /** Whether a local user→assistant turn is currently in progress. */
49805
50666
  get isTurnInProgress() {
49806
50667
  return this.turnInProgress;
@@ -50155,10 +51016,6 @@ var ChatTUI = class {
50155
51016
  this.dirty();
50156
51017
  }
50157
51018
  handleEnter() {
50158
- if (this.turnInProgress) {
50159
- this.dirty();
50160
- return;
50161
- }
50162
51019
  const text = this.inputBuffer.trim();
50163
51020
  this.inputBuffer = "";
50164
51021
  if (!text) {
@@ -50314,6 +51171,7 @@ var ChatTUI = class {
50314
51171
  break;
50315
51172
  }
50316
51173
  if (status) parts.push(status);
51174
+ if (this.queuedMessageCount) parts.push(`${this.queuedMessageCount} queued`);
50317
51175
  const line = parts.join(` ${DIM3}|${RESET3} `);
50318
51176
  return truncateAnsi(line, this.cols);
50319
51177
  }
@@ -50567,6 +51425,49 @@ function buildDebugSummary(_direction, msg) {
50567
51425
  return type;
50568
51426
  }
50569
51427
 
51428
+ // src/lib/chat-turn-queue.ts
51429
+ var ChatTurnQueue = class {
51430
+ constructor(send, onCount, onError) {
51431
+ this.send = send;
51432
+ this.onCount = onCount;
51433
+ this.onError = onError;
51434
+ }
51435
+ send;
51436
+ onCount;
51437
+ onError;
51438
+ pending = [];
51439
+ running = false;
51440
+ closed = false;
51441
+ enqueue(text) {
51442
+ if (this.closed) return;
51443
+ this.pending.push(text);
51444
+ this.onCount(this.running ? this.pending.length : Math.max(0, this.pending.length - 1));
51445
+ void this.drain();
51446
+ }
51447
+ close() {
51448
+ this.closed = true;
51449
+ this.pending = [];
51450
+ this.onCount(0);
51451
+ }
51452
+ async drain() {
51453
+ if (this.running || this.closed) return;
51454
+ this.running = true;
51455
+ try {
51456
+ while (!this.closed && this.pending.length) {
51457
+ const text = this.pending.shift();
51458
+ this.onCount(this.pending.length);
51459
+ try {
51460
+ await this.send(text);
51461
+ } catch (error) {
51462
+ if (!this.closed) this.onError(error);
51463
+ }
51464
+ }
51465
+ } finally {
51466
+ this.running = false;
51467
+ }
51468
+ }
51469
+ };
51470
+
50570
51471
  // src/lib/agui-tui-events.ts
50571
51472
  init_agui();
50572
51473
  function handleAguiEvent(tui, event) {
@@ -51169,14 +52070,20 @@ async function interactiveChatSession(session, debug, autoApprove, allowWrite) {
51169
52070
  };
51170
52071
  const feedController = new AbortController();
51171
52072
  const canSubscribeToFeed = !!session.workspaceUuid && session.chatId > 0;
52073
+ const queue = new ChatTurnQueue(
52074
+ sendTurn,
52075
+ (count) => tui.setQueuedMessageCount(count),
52076
+ (error) => tui.showError(error instanceof Error ? error.message : String(error))
52077
+ );
51172
52078
  await new Promise((resolve3) => {
51173
52079
  tui = new ChatTUI({
51174
52080
  title: session.label,
51175
52081
  subtitle: session.chatTitle,
51176
52082
  onSend: (text) => {
51177
- void sendTurn(text);
52083
+ queue.enqueue(text);
51178
52084
  },
51179
52085
  onExit: () => {
52086
+ queue.close();
51180
52087
  feedController.abort();
51181
52088
  tui.stop();
51182
52089
  resolve3();