@gravity-rail/cli 0.55.1 → 0.57.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
@@ -3164,7 +3164,7 @@ var init_libphonenumber_js = __esm({
3164
3164
  }
3165
3165
  });
3166
3166
 
3167
- // ../sdk/dist/chunk-7R22EG5F.js
3167
+ // ../sdk/dist/chunk-7ABBH5CC.js
3168
3168
  function resourceWorkflowsPath(wid, ...segments) {
3169
3169
  const tail = segments.map((segment) => encodeURIComponent(String(segment))).join("/");
3170
3170
  const base = `w/${encodeURIComponent(wid)}/resource-workflows`;
@@ -3404,6 +3404,7 @@ function createApiModules(apiKey, baseUrl3, customFetch) {
3404
3404
  patientSyncConnections: new PatientSyncConnectionsApi(apiKey, baseUrl3, customFetch),
3405
3405
  healthie: new HealthieApi(apiKey, baseUrl3, customFetch),
3406
3406
  documoFax: new DocumoFaxApi(apiKey, baseUrl3, customFetch),
3407
+ claimMd: new ClaimMdApi(apiKey, baseUrl3, customFetch),
3407
3408
  hubspot: new HubspotApi(apiKey, baseUrl3, customFetch),
3408
3409
  features: new FeaturesApi(apiKey, baseUrl3, customFetch),
3409
3410
  files: new FilesApi(apiKey, baseUrl3, customFetch),
@@ -3545,6 +3546,7 @@ function bindChatsMethods(target, chats) {
3545
3546
  target.updateChat = chats.updateChat.bind(chats);
3546
3547
  target.getChatModelOverride = chats.getChatModelOverride.bind(chats);
3547
3548
  target.updateChatModelOverride = chats.updateChatModelOverride.bind(chats);
3549
+ target.setChatStar = chats.setChatStar.bind(chats);
3548
3550
  target.updateChatMute = chats.updateChatMute.bind(chats);
3549
3551
  target.summarizeChat = chats.summarizeChat.bind(chats);
3550
3552
  target.getChatMessages = chats.getChatMessages.bind(chats);
@@ -3579,10 +3581,9 @@ function bindChatsMethods(target, chats) {
3579
3581
  }
3580
3582
  function bindCallsMethods(target, calls, cel) {
3581
3583
  target.getPhoneCalls = calls.getPhoneCalls.bind(calls);
3584
+ target.getPhoneCallByUuid = calls.getPhoneCallByUuid.bind(calls);
3582
3585
  target.getMessageTiming = calls.getMessageTiming.bind(calls);
3583
- target.getRecordingInfo = calls.getRecordingInfo.bind(calls);
3584
3586
  target.getEdgeCaptureInfo = calls.getEdgeCaptureInfo.bind(calls);
3585
- target.listChatRecordings = calls.listChatRecordings.bind(calls);
3586
3587
  target.getCallRecordingDownloadUrl = calls.getCallRecordingDownloadUrl.bind(calls);
3587
3588
  target.getCelContext = cel.getCelContext.bind(cel);
3588
3589
  target.validateCelExpression = cel.validateCelExpression.bind(cel);
@@ -3807,6 +3808,7 @@ function bindWorkspacesMethods(target, workspaces, signupRequests) {
3807
3808
  target.getWorkspaceScopes = workspaces.getWorkspaceScopes.bind(workspaces);
3808
3809
  target.getUsageDashboard = workspaces.getUsageDashboard.bind(workspaces);
3809
3810
  target.getVapidPublicKey = workspaces.getVapidPublicKey.bind(workspaces);
3811
+ target.testPushSubscription = workspaces.testPushSubscription.bind(workspaces);
3810
3812
  target.registerPushSubscription = workspaces.registerPushSubscription.bind(workspaces);
3811
3813
  target.unregisterPushSubscription = workspaces.unregisterPushSubscription.bind(workspaces);
3812
3814
  target.listPushSubscriptions = workspaces.listPushSubscriptions.bind(workspaces);
@@ -4115,6 +4117,7 @@ function bindCommunicationsMethods(target, phoneNumbers, inboxes, notificationRu
4115
4117
  target.createPhoneNumber = phoneNumbers.createPhoneNumber.bind(phoneNumbers);
4116
4118
  target.updatePhoneNumber = phoneNumbers.updatePhoneNumber.bind(phoneNumbers);
4117
4119
  target.getArchiveBlockers = phoneNumbers.getArchiveBlockers.bind(phoneNumbers);
4120
+ target.getPhoneNumberSetupStatus = phoneNumbers.getPhoneNumberSetupStatus.bind(phoneNumbers);
4118
4121
  target.archivePhoneNumber = phoneNumbers.archivePhoneNumber.bind(phoneNumbers);
4119
4122
  target.getPhoneNumberCalls = phoneNumbers.getPhoneNumberCalls.bind(phoneNumbers);
4120
4123
  target.getPhoneNumberOutboundAnalyticsSummary = phoneNumbers.getPhoneNumberOutboundAnalyticsSummary.bind(phoneNumbers);
@@ -4147,6 +4150,7 @@ function bindCommunicationsMethods(target, phoneNumbers, inboxes, notificationRu
4147
4150
  target.sendInboxEmail = inboxes.sendInboxEmail.bind(inboxes);
4148
4151
  target.previewInboxEmail = inboxes.previewInboxEmail.bind(inboxes);
4149
4152
  target.previewEmailReply = inboxes.previewEmailReply.bind(inboxes);
4153
+ target.getInboxOutboundEmailStats = inboxes.getInboxOutboundEmailStats.bind(inboxes);
4150
4154
  target.getNotificationRules = notificationRules.getNotificationRules.bind(notificationRules);
4151
4155
  target.createNotificationRule = notificationRules.createNotificationRule.bind(notificationRules);
4152
4156
  target.updateNotificationRule = notificationRules.updateNotificationRule.bind(notificationRules);
@@ -4255,7 +4259,7 @@ function bindAppsMethods(target, apps, builders, inquiries, oauth, oauthConnecti
4255
4259
  target.getOAuthAuthorizationUrl = oauthConnections.getAuthorizationUrl.bind(oauthConnections);
4256
4260
  target.disconnectOAuthProvider = oauthConnections.disconnect.bind(oauthConnections);
4257
4261
  }
4258
- function bindIntegrationsMethods(target, mondayIntegration, discordBots, slackApps, teamsApps, fhirConnections, patientSyncConnections, healthie, documoFax, salesforce, hubspot, appConnections, connectionSync, confluence) {
4262
+ function bindIntegrationsMethods(target, mondayIntegration, discordBots, slackApps, teamsApps, fhirConnections, patientSyncConnections, healthie, documoFax, claimMd, salesforce, hubspot, appConnections, connectionSync, confluence) {
4259
4263
  target.getMondayBoards = mondayIntegration.getBoards.bind(mondayIntegration);
4260
4264
  target.getMondayBoardColumns = mondayIntegration.getBoardColumns.bind(mondayIntegration);
4261
4265
  target.getMondayBoardGroups = mondayIntegration.getBoardGroups.bind(mondayIntegration);
@@ -4305,6 +4309,10 @@ function bindIntegrationsMethods(target, mondayIntegration, discordBots, slackAp
4305
4309
  target.deleteSlackApp = slackApps.deleteSlackApp.bind(slackApps);
4306
4310
  target.getSlackThreads = slackApps.getSlackThreads.bind(slackApps);
4307
4311
  target.getSlackInstallations = slackApps.getSlackInstallations.bind(slackApps);
4312
+ target.removeSlackInstallation = slackApps.removeSlackInstallation.bind(slackApps);
4313
+ target.getSlackChannelChoices = slackApps.getSlackChannelChoices.bind(slackApps);
4314
+ target.getSlackEntryPoints = slackApps.getSlackEntryPoints.bind(slackApps);
4315
+ target.connectSlackEntryPoint = slackApps.connectSlackEntryPoint.bind(slackApps);
4308
4316
  target.getSlackAppAccounts = slackApps.getSlackAppAccounts.bind(slackApps);
4309
4317
  target.getTeamsApps = teamsApps.getTeamsApps.bind(teamsApps);
4310
4318
  target.getTeamsApp = teamsApps.getTeamsApp.bind(teamsApps);
@@ -4345,8 +4353,9 @@ function bindIntegrationsMethods(target, mondayIntegration, discordBots, slackAp
4345
4353
  target.fhirGetEncounterSyncRuns = fhirConnections.fhirGetEncounterSyncRuns.bind(fhirConnections);
4346
4354
  target.fhirRefreshEncounterPatient = fhirConnections.fhirRefreshEncounterPatient.bind(fhirConnections);
4347
4355
  target.fhirBackfillEncounterSync = fhirConnections.fhirBackfillEncounterSync.bind(fhirConnections);
4348
- target.fhirStartOnboardingImport = fhirConnections.fhirStartOnboardingImport.bind(fhirConnections);
4349
- target.fhirGetOnboardingImportStatus = fhirConnections.fhirGetOnboardingImportStatus.bind(fhirConnections);
4356
+ target.getAthenaPlatformApp = fhirConnections.getAthenaPlatformApp.bind(fhirConnections);
4357
+ target.verifyAthenaAccess = fhirConnections.verifyAthenaAccess.bind(fhirConnections);
4358
+ target.connectAthena = fhirConnections.connectAthena.bind(fhirConnections);
4350
4359
  target.configurePatientSync = patientSyncConnections.configurePatientSync.bind(patientSyncConnections);
4351
4360
  target.getPatientSyncStatus = patientSyncConnections.getPatientSyncStatus.bind(patientSyncConnections);
4352
4361
  target.deletePatientSyncConnection = patientSyncConnections.deletePatientSyncConnection.bind(patientSyncConnections);
@@ -4357,6 +4366,10 @@ function bindIntegrationsMethods(target, mondayIntegration, discordBots, slackAp
4357
4366
  target.configureDocumoFax = documoFax.configureDocumoFax.bind(documoFax);
4358
4367
  target.verifyDocumoFax = documoFax.verifyDocumoFax.bind(documoFax);
4359
4368
  target.rotateDocumoFaxCredentials = documoFax.rotateDocumoFaxCredentials.bind(documoFax);
4369
+ target.getClaimMdStatus = claimMd.getClaimMdStatus.bind(claimMd);
4370
+ target.installClaimMd = claimMd.installClaimMd.bind(claimMd);
4371
+ target.configureClaimMd = claimMd.configureClaimMd.bind(claimMd);
4372
+ target.verifyClaimMdKey = claimMd.verifyClaimMdKey.bind(claimMd);
4360
4373
  target.configureHealthie = healthie.configureHealthie.bind(healthie);
4361
4374
  target.getHealthieStatus = healthie.getHealthieStatus.bind(healthie);
4362
4375
  target.listHealthieProviders = healthie.listHealthieProviders.bind(healthie);
@@ -4418,6 +4431,10 @@ function bindIntegrationsMethods(target, mondayIntegration, discordBots, slackAp
4418
4431
  target.searchHubspotRecords = hubspot.searchHubspotRecords.bind(hubspot);
4419
4432
  target.importHubspotMembers = hubspot.importHubspotMembers.bind(hubspot);
4420
4433
  target.getHubspotContactProperties = hubspot.getHubspotContactProperties.bind(hubspot);
4434
+ target.getHubspotDealProperties = hubspot.getHubspotDealProperties.bind(hubspot);
4435
+ target.getHubspotForms = hubspot.getHubspotForms.bind(hubspot);
4436
+ target.getHubspotMeetingLinks = hubspot.getHubspotMeetingLinks.bind(hubspot);
4437
+ target.getHubspotObjectProperties = hubspot.getHubspotObjectProperties.bind(hubspot);
4421
4438
  target.getHubspotManagedRules = hubspot.getHubspotManagedRules.bind(hubspot);
4422
4439
  target.getHubspotSyncLogs = hubspot.getHubspotSyncLogs.bind(hubspot);
4423
4440
  target.getHubspotTransformPresets = hubspot.getHubspotTransformPresets.bind(hubspot);
@@ -4429,7 +4446,23 @@ function bindIntegrationsMethods(target, mondayIntegration, discordBots, slackAp
4429
4446
  target.getSyncRuns = connectionSync.getSyncRuns.bind(connectionSync);
4430
4447
  target.getSyncRunItems = connectionSync.getSyncRunItems.bind(connectionSync);
4431
4448
  target.getMemberSyncSummary = connectionSync.getMemberSyncSummary.bind(connectionSync);
4449
+ target.getConnectionFieldHomes = connectionSync.getConnectionFieldHomes.bind(connectionSync);
4450
+ target.getInboundRecordStatus = connectionSync.getInboundRecordStatus.bind(connectionSync);
4451
+ target.getConnectionWritePreview = connectionSync.getConnectionWritePreview.bind(connectionSync);
4432
4452
  target.clearConnectionMemberExclusion = connectionSync.clearConnectionMemberExclusion.bind(connectionSync);
4453
+ target.linkUnlinkedMembersByIdentity = connectionSync.linkUnlinkedMembersByIdentity.bind(connectionSync);
4454
+ target.listSubsetImports = connectionSync.listSubsetImports.bind(connectionSync);
4455
+ target.getSubsetImport = connectionSync.getSubsetImport.bind(connectionSync);
4456
+ target.createSubsetImport = connectionSync.createSubsetImport.bind(connectionSync);
4457
+ target.updateSubsetImport = connectionSync.updateSubsetImport.bind(connectionSync);
4458
+ target.deleteSubsetImport = connectionSync.deleteSubsetImport.bind(connectionSync);
4459
+ target.previewSubsetImportSelection = connectionSync.previewSubsetImportSelection.bind(connectionSync);
4460
+ target.previewSubsetImport = connectionSync.previewSubsetImport.bind(connectionSync);
4461
+ target.runSubsetImport = connectionSync.runSubsetImport.bind(connectionSync);
4462
+ target.cancelSubsetImport = connectionSync.cancelSubsetImport.bind(connectionSync);
4463
+ target.listSubsetImportRuns = connectionSync.listSubsetImportRuns.bind(connectionSync);
4464
+ target.listSubsetImportVendorLists = connectionSync.listSubsetImportVendorLists.bind(connectionSync);
4465
+ target.listSubsetImportFilterFields = connectionSync.listSubsetImportFilterFields.bind(connectionSync);
4433
4466
  target.listAvailableAppConnections = appConnections.listAvailableAppConnections.bind(appConnections);
4434
4467
  target.listAppConnections = appConnections.listAppConnections.bind(appConnections);
4435
4468
  target.enablePlatformApp = appConnections.enablePlatformApp.bind(appConnections);
@@ -4576,6 +4609,7 @@ function bindJourneysMethods(target, journeys) {
4576
4609
  target.getJourneyV2Validation = journeys.getJourneyV2Validation.bind(journeys);
4577
4610
  target.getJourneyFilterOptions = journeys.getJourneyFilterOptions.bind(journeys);
4578
4611
  target.getJourneyHealth = journeys.getJourneyHealth.bind(journeys);
4612
+ target.getJourneySendEstimate = journeys.getJourneySendEstimate.bind(journeys);
4579
4613
  target.cloneJourneyAsV2 = journeys.cloneJourneyAsV2.bind(journeys);
4580
4614
  target.createJourney = journeys.createJourney.bind(journeys);
4581
4615
  target.updateJourney = journeys.updateJourney.bind(journeys);
@@ -4618,11 +4652,14 @@ function bindQualificationsMethods(target, qualifications) {
4618
4652
  target.deleteScenario = qualifications.deleteScenario.bind(qualifications);
4619
4653
  target.listTestChatRuns = qualifications.listTestChatRuns.bind(qualifications);
4620
4654
  target.listScenarioHealthSummaries = qualifications.listScenarioHealthSummaries.bind(qualifications);
4655
+ target.getChatTestRun = qualifications.getChatTestRun.bind(qualifications);
4621
4656
  target.getTestChatRun = qualifications.getTestChatRun.bind(qualifications);
4622
4657
  target.listChatCapturedEffects = qualifications.listChatCapturedEffects.bind(qualifications);
4623
4658
  target.listChatRecordChanges = qualifications.listChatRecordChanges.bind(qualifications);
4624
4659
  target.takeTestChatRunEmailTurn = qualifications.takeTestChatRunEmailTurn.bind(qualifications);
4625
4660
  target.takeTestChatRunSmsTurn = qualifications.takeTestChatRunSmsTurn.bind(qualifications);
4661
+ target.captureScenarioDraft = qualifications.captureScenarioDraft.bind(qualifications);
4662
+ target.promoteTestChatFeedback = qualifications.promoteTestChatFeedback.bind(qualifications);
4626
4663
  target.startTestChatRun = qualifications.startTestChatRun.bind(qualifications);
4627
4664
  target.evaluateTestChatRun = qualifications.evaluateTestChatRun.bind(qualifications);
4628
4665
  target.endTestChatRun = qualifications.endTestChatRun.bind(qualifications);
@@ -4630,6 +4667,9 @@ function bindQualificationsMethods(target, qualifications) {
4630
4667
  function bindPersonasMethods(target, personas) {
4631
4668
  target.listPersonas = personas.listPersonas.bind(personas);
4632
4669
  target.getPersona = personas.getPersona.bind(personas);
4670
+ target.getPersonaTestMember = personas.getPersonaTestMember.bind(personas);
4671
+ target.createPersonaTestMember = personas.createPersonaTestMember.bind(personas);
4672
+ target.resetPersonaTestMember = personas.resetPersonaTestMember.bind(personas);
4633
4673
  target.createPersona = personas.createPersona.bind(personas);
4634
4674
  target.updatePersona = personas.updatePersona.bind(personas);
4635
4675
  target.archivePersona = personas.archivePersona.bind(personas);
@@ -4718,9 +4758,9 @@ function getRevisionState(workflow, revision) {
4718
4758
  state: revision?.publishedAt != null ? "published" : "draft"
4719
4759
  };
4720
4760
  }
4721
- 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, 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, DashboardsApi, DevicesApi, TeamsAppsApi, ExperimentsApi, PatientSyncConnectionsApi, 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;
4722
- var init_chunk_7R22EG5F = __esm({
4723
- "../sdk/dist/chunk-7R22EG5F.js"() {
4761
+ 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, 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, 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;
4762
+ var init_chunk_7ABBH5CC = __esm({
4763
+ "../sdk/dist/chunk-7ABBH5CC.js"() {
4724
4764
  init_chunk_GCN4OMYU();
4725
4765
  init_libphonenumber_js();
4726
4766
  AbilitiesApi = class extends BaseApiClient {
@@ -5281,11 +5321,15 @@ var init_chunk_7R22EG5F = __esm({
5281
5321
  return this.fetch("ai-models/manager");
5282
5322
  }
5283
5323
  /**
5284
- * Get available realtime AI models
5324
+ * Get available realtime AI models.
5325
+ *
5326
+ * `includeHidden` also lists models no longer offered for new selection
5327
+ * (deprecated, flagged `hidden: true`), so a saved selection can be named.
5285
5328
  */
5286
- async getRealtimeModels(provider) {
5329
+ async getRealtimeModels(provider, options) {
5287
5330
  const searchParams = new URLSearchParams();
5288
5331
  if (provider) searchParams.append("provider", provider);
5332
+ if (options?.includeHidden) searchParams.append("includeHidden", "true");
5289
5333
  const queryString = searchParams.toString();
5290
5334
  const url = queryString ? `ai-models/realtime?${queryString}` : "ai-models/realtime";
5291
5335
  return this.fetch(url);
@@ -6263,6 +6307,18 @@ var init_chunk_7R22EG5F = __esm({
6263
6307
  `w/${wid}/calls${params.toString() ? `?${params.toString()}` : ""}`
6264
6308
  );
6265
6309
  }
6310
+ /**
6311
+ * Get one phone call by uuid — the subject a `call.*` Activity event names.
6312
+ *
6313
+ * Authorization is the call's own chat (`chats:read`, then the chat access
6314
+ * policy), so a call with no chat, or one the caller's chat access does not
6315
+ * reach, is a 404. The response carries `chatId`/`chatUuid`, the terminal
6316
+ * disposition axes and `workflowId`, which is what an Activity call card
6317
+ * needs to show the call's outcome and link to its conversation.
6318
+ */
6319
+ async getPhoneCallByUuid(wid, uuid) {
6320
+ return this.fetch(`w/${wid}/calls/by-uuid/${encodeURIComponent(uuid)}`);
6321
+ }
6266
6322
  /**
6267
6323
  * Get message timing data for a chat recording. `source` selects whose
6268
6324
  * timeline the offsets are measured against; omitted means `standard`.
@@ -6283,27 +6339,11 @@ var init_chunk_7R22EG5F = __esm({
6283
6339
  async getEdgeCaptureInfo(wid, chatId) {
6284
6340
  return this.fetch(`w/${wid}/recordings/chat/${chatId}/edge-capture`);
6285
6341
  }
6286
- /**
6287
- * Get PHI-safe provenance metadata for the recording served by
6288
- * `/audio.wav` — source, encryption, channels, duration, status, etc.
6289
- * Staff-only Twilio SIDs are present only for superusers. Returns 404
6290
- * when the chat has no native recording row (legacy chunk-only playback).
6291
- */
6292
- async getRecordingInfo(wid, chatId) {
6293
- return this.fetch(`w/${wid}/recordings/chat/${chatId}/info`);
6294
- }
6295
- /** List the recorded audio chunks for a chat (metadata only). */
6296
- async listChatRecordings(wid, chatId, options = {}) {
6297
- const params = new URLSearchParams();
6298
- if (options.role) params.set("role", options.role);
6299
- return this.fetch(
6300
- `w/${wid}/recordings/chat/${chatId}${params.toString() ? `?${params.toString()}` : ""}`
6301
- );
6302
- }
6303
6342
  /**
6304
6343
  * Get a single short-lived presigned URL to download the complete call
6305
- * recording as one WAV file. The first request assembles + caches the
6306
- * full-call WAV; later requests reuse it.
6344
+ * recording as one file: the complete internal recording, else the newest
6345
+ * ready stored recording (`twilio_native` or `legacy_chunks`). 404 when
6346
+ * neither is available.
6307
6347
  */
6308
6348
  async getCallRecordingDownloadUrl(wid, chatId, options = {}) {
6309
6349
  const params = new URLSearchParams();
@@ -6616,6 +6656,13 @@ var init_chunk_7R22EG5F = __esm({
6616
6656
  body: JSON.stringify(override)
6617
6657
  });
6618
6658
  }
6659
+ /** Set the authenticated Member's personal star without changing Chat access. */
6660
+ async setChatStar(wid, id, isStarred) {
6661
+ return this.fetch(`w/${wid}/chats/${id}/star`, {
6662
+ method: "PUT",
6663
+ body: JSON.stringify({ isStarred })
6664
+ });
6665
+ }
6619
6666
  /** Update the mute status of a chat. */
6620
6667
  async updateChatMute(wid, id, muted, muteReason, muteExpiresOnInbound) {
6621
6668
  return this.fetch(`w/${wid}/chats/${id}/mute`, {
@@ -7466,6 +7513,32 @@ var init_chunk_7R22EG5F = __esm({
7466
7513
  }
7467
7514
  };
7468
7515
  SlackAppsApi = class extends BaseApiClient {
7516
+ async removeSlackInstallation(wid, appId, installationId) {
7517
+ return this.fetch(
7518
+ `w/${wid}/app-connections/slack/apps/${appId}/installations/${installationId}`,
7519
+ { method: "DELETE" }
7520
+ );
7521
+ }
7522
+ async getSlackChannelChoices(wid, appId, cursor, teamId) {
7523
+ const params = new URLSearchParams({ appId: String(appId) });
7524
+ if (cursor) params.set("cursor", cursor);
7525
+ if (teamId) params.set("teamId", teamId);
7526
+ return this.fetch(
7527
+ `w/${wid}/app-connections/slack/channel-choices?${params}`
7528
+ );
7529
+ }
7530
+ async getSlackEntryPoints(wid, options = {}) {
7531
+ const params = new URLSearchParams();
7532
+ if (options.appId) params.set("appId", String(options.appId));
7533
+ if (options.workflowId) params.set("workflowId", String(options.workflowId));
7534
+ return this.fetch(`w/${wid}/app-connections/slack/entry-points?${params}`);
7535
+ }
7536
+ async connectSlackEntryPoint(wid, data) {
7537
+ return this.fetch(`w/${wid}/app-connections/slack/entry-points`, {
7538
+ method: "POST",
7539
+ body: JSON.stringify(data)
7540
+ });
7541
+ }
7469
7542
  /**
7470
7543
  * List all Slack apps configured for a workspace.
7471
7544
  */
@@ -7530,6 +7603,8 @@ var init_chunk_7R22EG5F = __esm({
7530
7603
  const params = new URLSearchParams();
7531
7604
  if (options.page) params.append("page", options.page.toString());
7532
7605
  if (options.pageSize) params.append("pageSize", options.pageSize.toString());
7606
+ if (options.search) params.set("search", options.search);
7607
+ if (options.connection) params.set("connection", options.connection);
7533
7608
  return this.fetch(
7534
7609
  `w/${wid}/app-connections/slack/apps/${appId}/installations${params.toString() ? `?${params.toString()}` : ""}`
7535
7610
  );
@@ -7818,6 +7893,36 @@ var init_chunk_7R22EG5F = __esm({
7818
7893
  body: JSON.stringify(data)
7819
7894
  });
7820
7895
  }
7896
+ /**
7897
+ * Which environments of the shared Gravity Rail athenahealth app this
7898
+ * deployment can use. Requires `apps:read`.
7899
+ */
7900
+ async getAthenaPlatformApp(wid) {
7901
+ return this.fetch(
7902
+ `w/${wid}/app-connections/fhir/athena/platform-app`
7903
+ );
7904
+ }
7905
+ /**
7906
+ * Check that the Gravity Rail athenahealth app can reach a practice in an
7907
+ * environment. Saves nothing. Requires `apps:write`.
7908
+ */
7909
+ async verifyAthenaAccess(wid, data) {
7910
+ return this.fetch(
7911
+ `w/${wid}/app-connections/fhir/athena/verify-access`,
7912
+ { method: "POST", body: JSON.stringify(data) }
7913
+ );
7914
+ }
7915
+ /**
7916
+ * Create an athenahealth connection through the shared Gravity Rail app.
7917
+ * The server re-runs the access probe and answers 400 with
7918
+ * `detail: { code, message }` when it fails. Requires `apps:write`.
7919
+ */
7920
+ async connectAthena(wid, data) {
7921
+ return this.fetch(`w/${wid}/app-connections/fhir/athena/connections`, {
7922
+ method: "POST",
7923
+ body: JSON.stringify(data)
7924
+ });
7925
+ }
7821
7926
  /**
7822
7927
  * Update an existing FHIR connection configuration.
7823
7928
  */
@@ -8036,36 +8141,6 @@ var init_chunk_7R22EG5F = __esm({
8036
8141
  { method: "POST", body: JSON.stringify(data) }
8037
8142
  );
8038
8143
  }
8039
- /**
8040
- * Start, resume, override or preview (dry run) an athenahealth connection's
8041
- * onboarding import. The body is exactly the three mode flags; the server
8042
- * traverses the connection's configured department/status pairs. Returns
8043
- * 202 with the Temporal workflow and run ids. Requires `workspace:admin`.
8044
- */
8045
- async fhirStartOnboardingImport(wid, connectionId, data = {}) {
8046
- const body = {
8047
- dryRun: data.dryRun ?? false,
8048
- resume: data.resume ?? false,
8049
- override: data.override ?? false
8050
- };
8051
- return this.fetch(
8052
- `w/${wid}/app-connections/fhir/connections/${connectionId}/onboarding-import`,
8053
- {
8054
- method: "POST",
8055
- body: JSON.stringify(body)
8056
- }
8057
- );
8058
- }
8059
- /**
8060
- * Read an athenahealth connection's onboarding-import progress (durable,
8061
- * approximate totals) and its known Temporal execution. GET-only: never
8062
- * starts or resumes work. Requires `workspace:admin`.
8063
- */
8064
- async fhirGetOnboardingImportStatus(wid, connectionId) {
8065
- return this.fetch(
8066
- `w/${wid}/app-connections/fhir/connections/${connectionId}/onboarding-import`
8067
- );
8068
- }
8069
8144
  };
8070
8145
  InboundFaxStatus = {
8071
8146
  pending: "pending",
@@ -8686,6 +8761,23 @@ var init_chunk_7R22EG5F = __esm({
8686
8761
  );
8687
8762
  return response.arrayBuffer();
8688
8763
  }
8764
+ /**
8765
+ * Reply and bounce rates for the emails one inbox sent in a period.
8766
+ *
8767
+ * `dateFrom` (inclusive) and `dateTo` (exclusive) are ISO 8601 instants with
8768
+ * an offset and must be passed together, at most 90 days apart; omit both
8769
+ * for the server's rolling last 30 days. Requires `inboxes:read` and
8770
+ * `analytics:read` plus admin access to the inbox. Aggregates only.
8771
+ */
8772
+ async getInboxOutboundEmailStats(wid, inboxId, period = {}) {
8773
+ const params = new URLSearchParams();
8774
+ if (period.dateFrom) params.append("date_from", period.dateFrom);
8775
+ if (period.dateTo) params.append("date_to", period.dateTo);
8776
+ const query = params.toString();
8777
+ return this.fetch(
8778
+ `w/${wid}/inboxes/${inboxId}/outbound-email-stats${query ? `?${query}` : ""}`
8779
+ );
8780
+ }
8689
8781
  /** List email threads in an inbox. */
8690
8782
  async getInboxThreads(wid, inboxId) {
8691
8783
  return this.fetch(`w/${wid}/inboxes/${inboxId}/threads`);
@@ -10676,6 +10768,18 @@ var init_chunk_7R22EG5F = __esm({
10676
10768
  async listA2PBrands(orgUuid) {
10677
10769
  return this.fetch(`o/${orgUuid}/a2p-brands`);
10678
10770
  }
10771
+ /**
10772
+ * Poll Twilio for one brand now and record its brand and campaign statuses,
10773
+ * as the scheduled sync would. Returns the brand as recorded afterwards,
10774
+ * without the live workflow fields `getA2PBrand` adds.
10775
+ */
10776
+ async syncA2PBrand(orgUuid, brandUuid) {
10777
+ return this.fetch(
10778
+ `o/${orgUuid}/a2p-brands/${brandUuid}/sync`,
10779
+ // Empty JSON body is the CSRF barrier the route requires (GRA-6284).
10780
+ { method: "POST", body: JSON.stringify({}) }
10781
+ );
10782
+ }
10679
10783
  /**
10680
10784
  * Live per-brand campaign use-case eligibility. Approved brands only — a
10681
10785
  * brand still under TCR review comes back as a structured 412 the picker
@@ -11126,6 +11230,14 @@ var init_chunk_7R22EG5F = __esm({
11126
11230
  async getPhoneNumber(wid, id) {
11127
11231
  return this.fetch(`w/${wid}/phone-numbers/${id}`);
11128
11232
  }
11233
+ /**
11234
+ * What this number still needs from its organization: the texting and
11235
+ * caller ID registration states of the business it belongs to. States only —
11236
+ * readable with `phones:read`, so it carries none of the business's forms.
11237
+ */
11238
+ async getPhoneNumberSetupStatus(wid, id) {
11239
+ return this.fetch(`w/${wid}/phone-numbers/${id}/setup-status`);
11240
+ }
11129
11241
  /** Create a new phone number record. */
11130
11242
  async createPhoneNumber(wid, phoneNumber) {
11131
11243
  return this.fetch(`w/${wid}/phone-numbers`, {
@@ -11434,6 +11546,21 @@ var init_chunk_7R22EG5F = __esm({
11434
11546
  async getPersona(wid, id) {
11435
11547
  return this.fetch(`w/${wid}/personas/${id}`);
11436
11548
  }
11549
+ async getPersonaTestMember(wid, id) {
11550
+ return this.fetch(`w/${wid}/personas/${id}/test-member`);
11551
+ }
11552
+ async createPersonaTestMember(wid, id) {
11553
+ return this.fetch(`w/${wid}/personas/${id}/test-member`, {
11554
+ method: "POST",
11555
+ body: JSON.stringify({})
11556
+ });
11557
+ }
11558
+ async resetPersonaTestMember(wid, id) {
11559
+ return this.fetch(`w/${wid}/personas/${id}/test-member/reset`, {
11560
+ method: "POST",
11561
+ body: JSON.stringify({})
11562
+ });
11563
+ }
11437
11564
  async createPersona(wid, data) {
11438
11565
  return this.fetch(`w/${wid}/personas`, {
11439
11566
  method: "POST",
@@ -11492,6 +11619,21 @@ var init_chunk_7R22EG5F = __esm({
11492
11619
  }
11493
11620
  };
11494
11621
  QualificationsApi = class extends BaseApiClient {
11622
+ /** Copy an authorized test Chat prefix into an editable Scenario draft. */
11623
+ async captureScenarioDraft(wid, chatId, throughMessageId) {
11624
+ return this.fetch(`w/${wid}/qualifications/chats/${chatId}/scenario-draft`, {
11625
+ method: "POST",
11626
+ body: JSON.stringify({ throughMessageId })
11627
+ });
11628
+ }
11629
+ /** Pause before the next Persona turn; a current Agent reply may finish. */
11630
+ /** Turn feedback into an explicitly authored rubric on the same Workflow. */
11631
+ async promoteTestChatFeedback(wid, runId, request) {
11632
+ return this.fetch(`w/${wid}/qualifications/test-chat-runs/${runId}/feedback/criterion`, {
11633
+ method: "POST",
11634
+ body: JSON.stringify(request)
11635
+ });
11636
+ }
11495
11637
  /** List qualifications in a workspace, paginated. */
11496
11638
  async getQualifications(wid, params) {
11497
11639
  const query = new URLSearchParams();
@@ -11583,6 +11725,12 @@ var init_chunk_7R22EG5F = __esm({
11583
11725
  `w/${wid}/qualifications/workflows/${workflowId}/scenario-health-summaries${qs}`
11584
11726
  );
11585
11727
  }
11728
+ /** The saved run of a test Chat, including its driver and completion state. */
11729
+ async getChatTestRun(wid, chatId) {
11730
+ return this.fetch(
11731
+ `w/${wid}/qualifications/chats/${chatId}/test-chat-run`
11732
+ );
11733
+ }
11586
11734
  async getTestChatRun(wid, runId) {
11587
11735
  return this.fetch(`w/${wid}/qualifications/test-chat-runs/${runId}`);
11588
11736
  }
@@ -11863,9 +12011,9 @@ var init_chunk_7R22EG5F = __esm({
11863
12011
  });
11864
12012
  }
11865
12013
  /**
11866
- * Start a durable run that links unlinked members by Salesforce Id / email
11867
- * and hydrates them. One run per connection; a second start while one is
11868
- * in flight is 409.
12014
+ * @deprecated Use `linkUnlinkedMembersByIdentity(wid, connectionId)`, which
12015
+ * serves every connector that links by identity. This calls the retained
12016
+ * Salesforce-only route and will be removed once no caller remains.
11869
12017
  */
11870
12018
  async linkUnlinkedSalesforceMembersByIdentity(wid) {
11871
12019
  return this.fetch(
@@ -11990,6 +12138,20 @@ var init_chunk_7R22EG5F = __esm({
11990
12138
  { method: "PUT", body: JSON.stringify(data) }
11991
12139
  );
11992
12140
  }
12141
+ async getConnectionFieldHomes(wid, connectionId) {
12142
+ return this.fetch(`w/${wid}/app-connections/${connectionId}/field-homes`);
12143
+ }
12144
+ /** Each inbound record source's latest pass: closed status, times and counts. */
12145
+ async getInboundRecordStatus(wid, connectionId) {
12146
+ return this.fetch(
12147
+ `w/${wid}/app-connections/${connectionId}/inbound-records/status`
12148
+ );
12149
+ }
12150
+ async getConnectionWritePreview(wid, connectionId, memberId) {
12151
+ return this.fetch(
12152
+ `w/${wid}/app-connections/${connectionId}/write-preview/members/${memberId}`
12153
+ );
12154
+ }
11993
12155
  async getConnectionSyncCheckpoint(wid, connectionId, direction = "inbound", syncKey = "default") {
11994
12156
  const query = new URLSearchParams({
11995
12157
  direction,
@@ -12052,6 +12214,108 @@ var init_chunk_7R22EG5F = __esm({
12052
12214
  { method: "DELETE" }
12053
12215
  );
12054
12216
  }
12217
+ /**
12218
+ * Start a durable run that links the connection's unlinked members to
12219
+ * remote records by identity (email, phone, or the vendor's own key) and
12220
+ * hydrates them. Served for any connector that declares a remote identity
12221
+ * resolver (Salesforce, HubSpot); another connector is 400. One run per
12222
+ * connection: a second start while one is in flight is 409.
12223
+ */
12224
+ async linkUnlinkedMembersByIdentity(wid, connectionId) {
12225
+ return this.fetch(
12226
+ `w/${wid}/app-connections/${connectionId}/link-unlinked-by-identity`,
12227
+ { method: "POST", body: JSON.stringify({}) }
12228
+ );
12229
+ }
12230
+ // --- Saved subset imports (Integration Standard IM-1..IM-4) ---------------
12231
+ subsetImportsPath(wid, connectionId, suffix2 = "") {
12232
+ return `w/${wid}/app-connections/${connectionId}/subset-imports${suffix2}`;
12233
+ }
12234
+ /** The connection's saved imports, newest first, and the kinds it accepts. */
12235
+ async listSubsetImports(wid, connectionId) {
12236
+ return this.fetch(this.subsetImportsPath(wid, connectionId));
12237
+ }
12238
+ async getSubsetImport(wid, connectionId, importId) {
12239
+ return this.fetch(
12240
+ this.subsetImportsPath(wid, connectionId, `/${encodeURIComponent(importId)}`)
12241
+ );
12242
+ }
12243
+ /** Save a named selection. Saving never reads the vendor or imports. */
12244
+ async createSubsetImport(wid, connectionId, data) {
12245
+ return this.fetch(this.subsetImportsPath(wid, connectionId), {
12246
+ method: "POST",
12247
+ body: JSON.stringify(data)
12248
+ });
12249
+ }
12250
+ /** Replace a saved selection. A changed selection resets its progress. */
12251
+ async updateSubsetImport(wid, connectionId, importId, data) {
12252
+ return this.fetch(
12253
+ this.subsetImportsPath(wid, connectionId, `/${encodeURIComponent(importId)}`),
12254
+ { method: "PUT", body: JSON.stringify(data) }
12255
+ );
12256
+ }
12257
+ /** Remove a saved import. Its Members and links stay. */
12258
+ async deleteSubsetImport(wid, connectionId, importId) {
12259
+ await this.fetch(
12260
+ this.subsetImportsPath(wid, connectionId, `/${encodeURIComponent(importId)}`),
12261
+ { method: "DELETE" }
12262
+ );
12263
+ }
12264
+ /** Count and sample an unsaved selection. Never writes. */
12265
+ async previewSubsetImportSelection(wid, connectionId, selection) {
12266
+ return this.fetch(
12267
+ this.subsetImportsPath(wid, connectionId, "/preview"),
12268
+ { method: "POST", body: JSON.stringify({ selection }) }
12269
+ );
12270
+ }
12271
+ /** Count and sample a saved selection. Never writes. */
12272
+ async previewSubsetImport(wid, connectionId, importId) {
12273
+ return this.fetch(
12274
+ this.subsetImportsPath(wid, connectionId, `/${encodeURIComponent(importId)}/preview`),
12275
+ // The CSRF barrier refuses a body-less POST (422); `{}` is the request.
12276
+ { method: "POST", body: JSON.stringify({}) }
12277
+ );
12278
+ }
12279
+ /**
12280
+ * Start the import in the background (202). A failed or cancelled import
12281
+ * resumes where it stopped unless `restart` is true.
12282
+ */
12283
+ async runSubsetImport(wid, connectionId, importId, options) {
12284
+ return this.fetch(
12285
+ this.subsetImportsPath(wid, connectionId, `/${encodeURIComponent(importId)}/run`),
12286
+ { method: "POST", body: JSON.stringify({ restart: options?.restart ?? false }) }
12287
+ );
12288
+ }
12289
+ /** Ask a running import to stop (202); its progress is kept for a resume. */
12290
+ async cancelSubsetImport(wid, connectionId, importId) {
12291
+ return this.fetch(
12292
+ this.subsetImportsPath(wid, connectionId, `/${encodeURIComponent(importId)}/cancel`),
12293
+ // The CSRF barrier refuses a body-less POST (422); `{}` is the request.
12294
+ { method: "POST", body: JSON.stringify({}) }
12295
+ );
12296
+ }
12297
+ /** The connection's import-run history, newest first (counts only). */
12298
+ async listSubsetImportRuns(wid, connectionId, limit = 20) {
12299
+ return this.fetch(
12300
+ this.subsetImportsPath(wid, connectionId, `/runs?limit=${limit}`)
12301
+ );
12302
+ }
12303
+ /** Vendor lists a `vendor_list` import can name (configuration only). */
12304
+ async listSubsetImportVendorLists(wid, connectionId, options) {
12305
+ const query = new URLSearchParams({
12306
+ query: options?.query ?? "",
12307
+ limit: String(options?.limit ?? 50)
12308
+ });
12309
+ return this.fetch(
12310
+ this.subsetImportsPath(wid, connectionId, `/vendor-lists?${query}`)
12311
+ );
12312
+ }
12313
+ /** Remote fields a `field_filter` import can name, with their operators. */
12314
+ async listSubsetImportFilterFields(wid, connectionId) {
12315
+ return this.fetch(
12316
+ this.subsetImportsPath(wid, connectionId, "/filter-fields")
12317
+ );
12318
+ }
12055
12319
  };
12056
12320
  HubspotApi = class extends BaseApiClient {
12057
12321
  /**
@@ -12155,6 +12419,35 @@ var init_chunk_7R22EG5F = __esm({
12155
12419
  `w/${wid}/app-connections/hubspot/sync-settings/hs-properties`
12156
12420
  );
12157
12421
  }
12422
+ /** Mappable HubSpot deal property definitions (deal inbound record sources). */
12423
+ async getHubspotDealProperties(wid) {
12424
+ return this.fetch(
12425
+ `w/${wid}/app-connections/hubspot/sync-settings/hs-properties?objectType=deals`
12426
+ );
12427
+ }
12428
+ /** The portal's Meetings booking links, or `missing_scope` without the scheduler scope. */
12429
+ async getHubspotMeetingLinks(wid) {
12430
+ return this.fetch(
12431
+ `w/${wid}/app-connections/hubspot/sync-settings/meeting-links`
12432
+ );
12433
+ }
12434
+ /** The portal's forms and their fields, or `missing_scope` without the `forms` scope. */
12435
+ async getHubspotForms(wid) {
12436
+ return this.fetch(
12437
+ `w/${wid}/app-connections/hubspot/sync-settings/forms`
12438
+ );
12439
+ }
12440
+ /**
12441
+ * Raw HubSpot property definitions for one CRM object type
12442
+ * (`GET /get_properties/{objectType}`), as HubSpot's properties API
12443
+ * returns them. Use `getHubspotContactProperties` for the sync-mappable
12444
+ * contact property list the field mapper shows.
12445
+ */
12446
+ async getHubspotObjectProperties(wid, objectType) {
12447
+ return this.fetch(
12448
+ `w/${wid}/app-connections/hubspot/get_properties/${encodeURIComponent(objectType)}`
12449
+ );
12450
+ }
12158
12451
  async getHubspotManagedRules(wid) {
12159
12452
  return this.fetch(`w/${wid}/app-connections/hubspot/managed-rules`);
12160
12453
  }
@@ -13173,6 +13466,17 @@ var init_chunk_7R22EG5F = __esm({
13173
13466
  async getJourneyHealth(wid, journeyId) {
13174
13467
  return this.fetch(`w/${wid}/journeys/${journeyId}/health`);
13175
13468
  }
13469
+ /**
13470
+ * How many days the journey's texts take at the workspace's current sending
13471
+ * limits — advice for the publish and enroll confirmations, never a gate.
13472
+ * `additionalMembers` is the size of a batch about to be enrolled.
13473
+ */
13474
+ async getJourneySendEstimate(wid, journeyId, additionalMembers = 0) {
13475
+ const query = new URLSearchParams({ additionalMembers: String(additionalMembers) });
13476
+ return this.fetch(
13477
+ `w/${wid}/journeys/${journeyId}/send-estimate?${query.toString()}`
13478
+ );
13479
+ }
13176
13480
  /** Create a step within a journey. */
13177
13481
  async createStep(wid, journeyId, data) {
13178
13482
  return this.fetch(`w/${wid}/journeys/${journeyId}/steps`, {
@@ -14339,13 +14643,10 @@ var init_chunk_7R22EG5F = __esm({
14339
14643
  }
14340
14644
  /** Register a Web Push subscription for the current user. */
14341
14645
  async registerPushSubscription(wid, subscription) {
14342
- return this.fetch(
14343
- `w/${wid}/push-subscriptions`,
14344
- {
14345
- method: "POST",
14346
- body: JSON.stringify(subscription)
14347
- }
14348
- );
14646
+ return this.fetch(`w/${wid}/push-subscriptions`, {
14647
+ method: "POST",
14648
+ body: JSON.stringify(subscription)
14649
+ });
14349
14650
  }
14350
14651
  /** Unregister a Web Push subscription by endpoint URL. */
14351
14652
  async unregisterPushSubscription(wid, endpoint) {
@@ -14360,6 +14661,14 @@ var init_chunk_7R22EG5F = __esm({
14360
14661
  async listPushSubscriptions(wid) {
14361
14662
  return this.fetch(`w/${wid}/push-subscriptions`);
14362
14663
  }
14664
+ /** Submit a fixed generic test to an owned browser registration. */
14665
+ async testPushSubscription(wid, subscriptionId) {
14666
+ const body = {};
14667
+ return this.fetch(
14668
+ `w/${wid}/push-subscriptions/${subscriptionId}/test`,
14669
+ { method: "POST", body: JSON.stringify(body) }
14670
+ );
14671
+ }
14363
14672
  /** List org domains available for workspace email inbox routing. */
14364
14673
  async getWorkspaceEmailDomains(wid) {
14365
14674
  return this.fetch(`w/${wid}/domains/for-email`);
@@ -15091,6 +15400,31 @@ var init_chunk_7R22EG5F = __esm({
15091
15400
  return this.fetch(`w/${wid}/app-connections/patientsync/`, { method: "DELETE" });
15092
15401
  }
15093
15402
  };
15403
+ ClaimMdApi = class extends BaseApiClient {
15404
+ async getClaimMdStatus(wid) {
15405
+ return this.fetch(`w/${wid}/app-connections/claim-md/status`);
15406
+ }
15407
+ /** Sends `{}` deliberately: the route requires a JSON body as a CSRF barrier. */
15408
+ async installClaimMd(wid) {
15409
+ return this.fetch(`w/${wid}/app-connections/claim-md/install`, {
15410
+ method: "POST",
15411
+ body: JSON.stringify({})
15412
+ });
15413
+ }
15414
+ async configureClaimMd(wid, data) {
15415
+ return this.fetch(`w/${wid}/app-connections/claim-md/configure`, {
15416
+ method: "POST",
15417
+ body: JSON.stringify(data)
15418
+ });
15419
+ }
15420
+ /** Checks a pasted AccountKey without storing it. */
15421
+ async verifyClaimMdKey(wid, data) {
15422
+ return this.fetch(`w/${wid}/app-connections/claim-md/verify`, {
15423
+ method: "POST",
15424
+ body: JSON.stringify(data)
15425
+ });
15426
+ }
15427
+ };
15094
15428
  ActivityApi = class extends BaseApiClient {
15095
15429
  /** The account mount: this caller's whole estate, at any grain. */
15096
15430
  async queryActivity(request) {
@@ -15613,6 +15947,7 @@ var init_chunk_7R22EG5F = __esm({
15613
15947
  "cancelCalendarEvent",
15614
15948
  "cancelChatCallback",
15615
15949
  "cancelCredentialUpdateInvite",
15950
+ "cancelSubsetImport",
15616
15951
  "checkAvailability",
15617
15952
  "checkSiteDomainAvailability",
15618
15953
  "checkSiteSlugAvailability",
@@ -15627,6 +15962,7 @@ var init_chunk_7R22EG5F = __esm({
15627
15962
  "commentOnWorkspaceSupportRequest",
15628
15963
  "completeDiscordLink",
15629
15964
  "configureConfluence",
15965
+ "configureClaimMd",
15630
15966
  "configureDocumoFax",
15631
15967
  "configureHealthie",
15632
15968
  "configurePatientSync",
@@ -15634,6 +15970,7 @@ var init_chunk_7R22EG5F = __esm({
15634
15970
  "configureMondayConnection",
15635
15971
  "configureSalesforce",
15636
15972
  "configureZendeskConnection",
15973
+ "connectAthena",
15637
15974
  "convertEmail",
15638
15975
  "convertFile",
15639
15976
  "createAbility",
@@ -15642,6 +15979,15 @@ var init_chunk_7R22EG5F = __esm({
15642
15979
  "createApiKey",
15643
15980
  "createAssignment",
15644
15981
  "bindInstallationSlots",
15982
+ "createSubsetImport",
15983
+ "deleteSubsetImport",
15984
+ "getSubsetImport",
15985
+ "listSubsetImportFilterFields",
15986
+ "listSubsetImportRuns",
15987
+ "listSubsetImports",
15988
+ "listSubsetImportVendorLists",
15989
+ "previewSubsetImport",
15990
+ "previewSubsetImportSelection",
15645
15991
  "restoreInstallationForm",
15646
15992
  "createBundle",
15647
15993
  "createCalendar",
@@ -15650,6 +15996,7 @@ var init_chunk_7R22EG5F = __esm({
15650
15996
  "createCalendarSchedule",
15651
15997
  "createChat",
15652
15998
  "createChatInteractionSession",
15999
+ "runSubsetImport",
15653
16000
  "transitionChatInteractionSession",
15654
16001
  "createChatCompletion",
15655
16002
  "createChatFilter",
@@ -15830,7 +16177,6 @@ var init_chunk_7R22EG5F = __esm({
15830
16177
  "fhirGetCsvImportSettings",
15831
16178
  "fhirGetEncounterSyncRuns",
15832
16179
  "fhirGetEncounterSyncStatus",
15833
- "fhirGetOnboardingImportStatus",
15834
16180
  "fhirImportPatient",
15835
16181
  "fhirLinkMember",
15836
16182
  "fhirListLinkedMembers",
@@ -15839,7 +16185,6 @@ var init_chunk_7R22EG5F = __esm({
15839
16185
  "fhirSearchLocations",
15840
16186
  "fhirSearchPatients",
15841
16187
  "fhirSearchPractitioners",
15842
- "fhirStartOnboardingImport",
15843
16188
  "fhirSyncMember",
15844
16189
  "fhirUnlinkMember",
15845
16190
  "fhirUpdateCsvImportSettings",
@@ -15865,6 +16210,7 @@ var init_chunk_7R22EG5F = __esm({
15865
16210
  "getAnonymousResolutions",
15866
16211
  "getApiKeys",
15867
16212
  "getArchiveBlockers",
16213
+ "getAthenaPlatformApp",
15868
16214
  "getAssignment",
15869
16215
  "getAssignmentCelContext",
15870
16216
  "getAssignmentMessages",
@@ -15927,9 +16273,12 @@ var init_chunk_7R22EG5F = __esm({
15927
16273
  "getClientWorkspace",
15928
16274
  "getConfigurationHealth",
15929
16275
  "getConfluenceStatus",
16276
+ "getConnectionFieldHomes",
16277
+ "getInboundRecordStatus",
15930
16278
  "getConnectionSyncCapabilities",
15931
16279
  "getConnectionSyncCheckpoint",
15932
16280
  "getConnectionSyncConfig",
16281
+ "getConnectionWritePreview",
15933
16282
  "getCredentialUpdateInvites",
15934
16283
  "getCurrentMember",
15935
16284
  "clearMemberWorkflowVoice",
@@ -15966,6 +16315,7 @@ var init_chunk_7R22EG5F = __esm({
15966
16315
  "getDiscordBots",
15967
16316
  "getDiscordGuilds",
15968
16317
  "getDiscordThreads",
16318
+ "getClaimMdStatus",
15969
16319
  "getDocumoFaxSetup",
15970
16320
  "listDocumoFaxes",
15971
16321
  "getDocumoFaxStatus",
@@ -15994,8 +16344,8 @@ var init_chunk_7R22EG5F = __esm({
15994
16344
  "getSiteSourceTemplates",
15995
16345
  "getThemeSettings",
15996
16346
  "importSiteSourceZip",
16347
+ "installClaimMd",
15997
16348
  "installDocumoFax",
15998
- "listChatRecordings",
15999
16349
  "previewDataReport",
16000
16350
  "previewQuery",
16001
16351
  "publishSiteSource",
@@ -16031,7 +16381,11 @@ var init_chunk_7R22EG5F = __esm({
16031
16381
  "getHealthieStatus",
16032
16382
  "getPatientSyncStatus",
16033
16383
  "getHubspotContactProperties",
16384
+ "getHubspotDealProperties",
16385
+ "getHubspotForms",
16386
+ "getHubspotMeetingLinks",
16034
16387
  "getHubspotManagedRules",
16388
+ "getHubspotObjectProperties",
16035
16389
  "getHubspotReconciliationMatches",
16036
16390
  "getHubspotStatus",
16037
16391
  "getHubspotSyncLogs",
@@ -16043,6 +16397,7 @@ var init_chunk_7R22EG5F = __esm({
16043
16397
  "getInbox",
16044
16398
  "getInboxEmail",
16045
16399
  "getInboxEmails",
16400
+ "getInboxOutboundEmailStats",
16046
16401
  "getInboxThreads",
16047
16402
  "getInboxes",
16048
16403
  "getInterventionRequests",
@@ -16052,6 +16407,7 @@ var init_chunk_7R22EG5F = __esm({
16052
16407
  "getJourneyHealth",
16053
16408
  "getJourneyMembers",
16054
16409
  "getJourneyNotes",
16410
+ "getJourneySendEstimate",
16055
16411
  "getJourneyV2Validation",
16056
16412
  "getJourneys",
16057
16413
  "getLinkablePhones",
@@ -16112,11 +16468,16 @@ var init_chunk_7R22EG5F = __esm({
16112
16468
  "getPage",
16113
16469
  "getPageBySlug",
16114
16470
  "getPersona",
16471
+ "getPersonaTestMember",
16472
+ "createPersonaTestMember",
16473
+ "resetPersonaTestMember",
16115
16474
  "getPhoneCalls",
16475
+ "getPhoneCallByUuid",
16116
16476
  "getPhoneNumber",
16117
16477
  "getPhoneNumberCalls",
16118
16478
  "getPhoneNumberFaxes",
16119
16479
  "getPhoneNumberMessages",
16480
+ "getPhoneNumberSetupStatus",
16120
16481
  "getPhoneNumberVoicemails",
16121
16482
  "getPhoneNumbers",
16122
16483
  "getPhoneUsageReport",
@@ -16132,7 +16493,6 @@ var init_chunk_7R22EG5F = __esm({
16132
16493
  "getPublicProducts",
16133
16494
  "getQualification",
16134
16495
  "getQualifications",
16135
- "getRecordingInfo",
16136
16496
  "getResellerWorkspaces",
16137
16497
  "getRoutine",
16138
16498
  "getRoutineConfigEvents",
@@ -16159,6 +16519,7 @@ var init_chunk_7R22EG5F = __esm({
16159
16519
  "getSlackAppAccounts",
16160
16520
  "getSlackApps",
16161
16521
  "getSlackInstallations",
16522
+ "removeSlackInstallation",
16162
16523
  "getSlackThreads",
16163
16524
  "getStepMemberCounts",
16164
16525
  "getStepMembers",
@@ -16175,6 +16536,7 @@ var init_chunk_7R22EG5F = __esm({
16175
16536
  "getTeamsConversations",
16176
16537
  "getTeamsInstallations",
16177
16538
  "getTemplateContext",
16539
+ "getChatTestRun",
16178
16540
  "getTestChatRun",
16179
16541
  "getThreadEmails",
16180
16542
  "getTool",
@@ -16248,6 +16610,7 @@ var init_chunk_7R22EG5F = __esm({
16248
16610
  "linkMemberToMonday",
16249
16611
  "linkMemberToSalesforce",
16250
16612
  "linkPhoneNumber",
16613
+ "linkUnlinkedMembersByIdentity",
16251
16614
  "linkUnlinkedSalesforceMembersByIdentity",
16252
16615
  "listAbilities",
16253
16616
  "listAnonymousFormSubmissions",
@@ -16331,6 +16694,7 @@ var init_chunk_7R22EG5F = __esm({
16331
16694
  "reenrollMember",
16332
16695
  "renameFieldSlug",
16333
16696
  "registerLinkedRolesMetadata",
16697
+ "testPushSubscription",
16334
16698
  "registerPushSubscription",
16335
16699
  "reindexFolder",
16336
16700
  "releasePhoneNumber",
@@ -16342,6 +16706,7 @@ var init_chunk_7R22EG5F = __esm({
16342
16706
  "reorderMenuItems",
16343
16707
  "reconcileInstallation",
16344
16708
  "setInstallationPolicy",
16709
+ "updateSubsetImport",
16345
16710
  "upgradeInstallation",
16346
16711
  "replaceBundleDraft",
16347
16712
  "replyToEmail",
@@ -16377,6 +16742,8 @@ var init_chunk_7R22EG5F = __esm({
16377
16742
  "startHubspotOAuth",
16378
16743
  "startSalesforceOAuth",
16379
16744
  "startSyncRun",
16745
+ "captureScenarioDraft",
16746
+ "promoteTestChatFeedback",
16380
16747
  "startTestChatRun",
16381
16748
  "summarizeChat",
16382
16749
  "syncCalendarWithGoogle",
@@ -16416,6 +16783,7 @@ var init_chunk_7R22EG5F = __esm({
16416
16783
  "updateChatFilter",
16417
16784
  "updateChatLabel",
16418
16785
  "updateChatModelOverride",
16786
+ "setChatStar",
16419
16787
  "updateChatMute",
16420
16788
  "updateClientWorkspace",
16421
16789
  "updateConnection",
@@ -16495,6 +16863,8 @@ var init_chunk_7R22EG5F = __esm({
16495
16863
  "validateDataTypeSlug",
16496
16864
  "validateQuery",
16497
16865
  "validateWorkflowName",
16866
+ "verifyAthenaAccess",
16867
+ "verifyClaimMdKey",
16498
16868
  "verifyDocumoFax"
16499
16869
  ];
16500
16870
  WORKSPACE_METHOD_NAME_SET = new Set(WORKSPACE_METHOD_NAMES);
@@ -16548,6 +16918,7 @@ var init_chunk_7R22EG5F = __esm({
16548
16918
  updateChat;
16549
16919
  getChatModelOverride;
16550
16920
  updateChatModelOverride;
16921
+ setChatStar;
16551
16922
  updateChatMute;
16552
16923
  summarizeChat;
16553
16924
  getChatMessages;
@@ -16581,10 +16952,9 @@ var init_chunk_7R22EG5F = __esm({
16581
16952
  getChatFilterCount;
16582
16953
  // Calls API
16583
16954
  getPhoneCalls;
16955
+ getPhoneCallByUuid;
16584
16956
  getMessageTiming;
16585
- getRecordingInfo;
16586
16957
  getEdgeCaptureInfo;
16587
- listChatRecordings;
16588
16958
  getCallRecordingDownloadUrl;
16589
16959
  getCelContext;
16590
16960
  validateCelExpression;
@@ -16728,11 +17098,14 @@ var init_chunk_7R22EG5F = __esm({
16728
17098
  deleteScenario;
16729
17099
  listTestChatRuns;
16730
17100
  listScenarioHealthSummaries;
17101
+ getChatTestRun;
16731
17102
  getTestChatRun;
16732
17103
  listChatCapturedEffects;
16733
17104
  listChatRecordChanges;
16734
17105
  takeTestChatRunEmailTurn;
16735
17106
  takeTestChatRunSmsTurn;
17107
+ captureScenarioDraft;
17108
+ promoteTestChatFeedback;
16736
17109
  startTestChatRun;
16737
17110
  evaluateTestChatRun;
16738
17111
  endTestChatRun;
@@ -16746,6 +17119,9 @@ var init_chunk_7R22EG5F = __esm({
16746
17119
  previewDataReport;
16747
17120
  listPersonas;
16748
17121
  getPersona;
17122
+ getPersonaTestMember;
17123
+ createPersonaTestMember;
17124
+ resetPersonaTestMember;
16749
17125
  createPersona;
16750
17126
  updatePersona;
16751
17127
  archivePersona;
@@ -16816,6 +17192,7 @@ var init_chunk_7R22EG5F = __esm({
16816
17192
  getJourneyV2Validation;
16817
17193
  getJourneyFilterOptions;
16818
17194
  getJourneyHealth;
17195
+ getJourneySendEstimate;
16819
17196
  cloneJourneyAsV2;
16820
17197
  createJourney;
16821
17198
  updateJourney;
@@ -17042,6 +17419,7 @@ var init_chunk_7R22EG5F = __esm({
17042
17419
  setWorkspaceLabels;
17043
17420
  previewWorkspaceScope;
17044
17421
  getVapidPublicKey;
17422
+ testPushSubscription;
17045
17423
  registerPushSubscription;
17046
17424
  unregisterPushSubscription;
17047
17425
  listPushSubscriptions;
@@ -17321,6 +17699,7 @@ var init_chunk_7R22EG5F = __esm({
17321
17699
  createPhoneNumber;
17322
17700
  updatePhoneNumber;
17323
17701
  getArchiveBlockers;
17702
+ getPhoneNumberSetupStatus;
17324
17703
  archivePhoneNumber;
17325
17704
  getPhoneNumberCalls;
17326
17705
  getPhoneNumberOutboundAnalyticsSummary;
@@ -17353,6 +17732,7 @@ var init_chunk_7R22EG5F = __esm({
17353
17732
  sendInboxEmail;
17354
17733
  previewInboxEmail;
17355
17734
  previewEmailReply;
17735
+ getInboxOutboundEmailStats;
17356
17736
  getNotificationRules;
17357
17737
  createNotificationRule;
17358
17738
  updateNotificationRule;
@@ -17517,6 +17897,10 @@ var init_chunk_7R22EG5F = __esm({
17517
17897
  deleteSlackApp;
17518
17898
  getSlackThreads;
17519
17899
  getSlackInstallations;
17900
+ removeSlackInstallation;
17901
+ getSlackChannelChoices;
17902
+ getSlackEntryPoints;
17903
+ connectSlackEntryPoint;
17520
17904
  getSlackAppAccounts;
17521
17905
  // Teams Apps API
17522
17906
  getTeamsApps;
@@ -17559,8 +17943,9 @@ var init_chunk_7R22EG5F = __esm({
17559
17943
  fhirGetEncounterSyncRuns;
17560
17944
  fhirRefreshEncounterPatient;
17561
17945
  fhirBackfillEncounterSync;
17562
- fhirStartOnboardingImport;
17563
- fhirGetOnboardingImportStatus;
17946
+ getAthenaPlatformApp;
17947
+ verifyAthenaAccess;
17948
+ connectAthena;
17564
17949
  // Healthie API
17565
17950
  getDocumoFaxStatus;
17566
17951
  getDocumoFaxSetup;
@@ -17569,6 +17954,10 @@ var init_chunk_7R22EG5F = __esm({
17569
17954
  configureDocumoFax;
17570
17955
  verifyDocumoFax;
17571
17956
  rotateDocumoFaxCredentials;
17957
+ getClaimMdStatus;
17958
+ installClaimMd;
17959
+ configureClaimMd;
17960
+ verifyClaimMdKey;
17572
17961
  configurePatientSync;
17573
17962
  getPatientSyncStatus;
17574
17963
  deletePatientSyncConnection;
@@ -17636,6 +18025,10 @@ var init_chunk_7R22EG5F = __esm({
17636
18025
  searchHubspotRecords;
17637
18026
  importHubspotMembers;
17638
18027
  getHubspotContactProperties;
18028
+ getHubspotDealProperties;
18029
+ getHubspotForms;
18030
+ getHubspotMeetingLinks;
18031
+ getHubspotObjectProperties;
17639
18032
  getHubspotManagedRules;
17640
18033
  getHubspotSyncLogs;
17641
18034
  getHubspotTransformPresets;
@@ -17648,7 +18041,23 @@ var init_chunk_7R22EG5F = __esm({
17648
18041
  getSyncRuns;
17649
18042
  getSyncRunItems;
17650
18043
  getMemberSyncSummary;
18044
+ getConnectionFieldHomes;
18045
+ getInboundRecordStatus;
18046
+ getConnectionWritePreview;
17651
18047
  clearConnectionMemberExclusion;
18048
+ linkUnlinkedMembersByIdentity;
18049
+ listSubsetImports;
18050
+ getSubsetImport;
18051
+ createSubsetImport;
18052
+ updateSubsetImport;
18053
+ deleteSubsetImport;
18054
+ previewSubsetImportSelection;
18055
+ previewSubsetImport;
18056
+ runSubsetImport;
18057
+ cancelSubsetImport;
18058
+ listSubsetImportRuns;
18059
+ listSubsetImportVendorLists;
18060
+ listSubsetImportFilterFields;
17652
18061
  // App Connections API
17653
18062
  listAvailableAppConnections;
17654
18063
  listAppConnections;
@@ -17785,6 +18194,7 @@ var init_chunk_7R22EG5F = __esm({
17785
18194
  apis.patientSyncConnections,
17786
18195
  apis.healthie,
17787
18196
  apis.documoFax,
18197
+ apis.claimMd,
17788
18198
  apis.salesforce,
17789
18199
  apis.hubspot,
17790
18200
  apis.appConnections,
@@ -17914,9 +18324,9 @@ var init_chunk_7R22EG5F = __esm({
17914
18324
  }
17915
18325
  });
17916
18326
 
17917
- // ../sdk/dist/chunk-HXVJF54M.js
17918
- var init_chunk_HXVJF54M = __esm({
17919
- "../sdk/dist/chunk-HXVJF54M.js"() {
18327
+ // ../sdk/dist/chunk-D5VNVTUQ.js
18328
+ var init_chunk_D5VNVTUQ = __esm({
18329
+ "../sdk/dist/chunk-D5VNVTUQ.js"() {
17920
18330
  }
17921
18331
  });
17922
18332
 
@@ -17971,8 +18381,8 @@ var init_chunk_6KPGCPGW = __esm({
17971
18381
  var SEARCHABLE_EVENT_RULE_SOURCE_FIELDS, ActivityEventType, EntityKind;
17972
18382
  var init_dist = __esm({
17973
18383
  "../sdk/dist/index.js"() {
17974
- init_chunk_7R22EG5F();
17975
- init_chunk_HXVJF54M();
18384
+ init_chunk_7ABBH5CC();
18385
+ init_chunk_D5VNVTUQ();
17976
18386
  init_chunk_6KPGCPGW();
17977
18387
  init_chunk_GCN4OMYU();
17978
18388
  SEARCHABLE_EVENT_RULE_SOURCE_FIELDS = [
@@ -17997,6 +18407,7 @@ var init_dist = __esm({
17997
18407
  importcompleted: "import.completed",
17998
18408
  assignmentstarted: "assignment.started",
17999
18409
  assignmentconcluded: "assignment.concluded",
18410
+ assignmenttask_entered: "assignment.task_entered",
18000
18411
  journeyenrolled: "journey.enrolled",
18001
18412
  journeyunenrolled: "journey.unenrolled",
18002
18413
  journeycompleted: "journey.completed",
@@ -18007,6 +18418,8 @@ var init_dist = __esm({
18007
18418
  chathuman_replied: "chat.human_replied",
18008
18419
  chatcall_ended: "chat.call_ended",
18009
18420
  chatsummary: "chat.summary",
18421
+ messagesent: "message.sent",
18422
+ membermessage_received: "member.message_received",
18010
18423
  escalationopened: "escalation.opened",
18011
18424
  escalationresolved: "escalation.resolved",
18012
18425
  callstarted: "call.started",
@@ -20556,6 +20969,28 @@ function findNearestGit(startDir) {
20556
20969
  dir = parent;
20557
20970
  }
20558
20971
  }
20972
+ function nativeWorktreePorts(envPath) {
20973
+ let content;
20974
+ try {
20975
+ content = readFileSync(envPath, "utf-8");
20976
+ } catch {
20977
+ return void 0;
20978
+ }
20979
+ const wanted = /* @__PURE__ */ new Set(["GR_PROVISIONED_RUNTIME", "API_NGINX_PORT", "FRONTEND_PORT"]);
20980
+ const values = /* @__PURE__ */ new Map();
20981
+ for (const line of content.split(/\r?\n/)) {
20982
+ const match = /^\s*([A-Z_][A-Z0-9_]*)=(.*)$/.exec(line);
20983
+ const key = match?.[1];
20984
+ const raw = match?.[2];
20985
+ if (key === void 0 || raw === void 0 || !wanted.has(key)) continue;
20986
+ values.set(key, raw.trim().replace(/^(['"])(.*)\1$/, "$2"));
20987
+ }
20988
+ if (values.get("GR_PROVISIONED_RUNTIME") !== "native") return void 0;
20989
+ const apiPort = parsePortToken(values.get("API_NGINX_PORT"));
20990
+ const frontendPort = parsePortToken(values.get("FRONTEND_PORT"));
20991
+ if (apiPort === void 0 || frontendPort === void 0) return void 0;
20992
+ return { envPath, ports: { apiPort, frontendPort } };
20993
+ }
20559
20994
  function unresolved(root, overridePath, reason) {
20560
20995
  return { kind: "unresolved-worktree", root, overridePath, reason };
20561
20996
  }
@@ -20574,7 +21009,17 @@ function classifyCheckout(startDir = process.cwd()) {
20574
21009
  return { kind: "non-worktree", root: git?.root };
20575
21010
  }
20576
21011
  const overridePath = join(git.root, OVERRIDE_FILENAME);
21012
+ const envPath = join(git.root, ENV_FILENAME);
20577
21013
  if (!existsSync(overridePath)) {
21014
+ const native = nativeWorktreePorts(envPath);
21015
+ if (native) {
21016
+ return {
21017
+ kind: "resolved-worktree",
21018
+ root: git.root,
21019
+ overridePath: native.envPath,
21020
+ ...native.ports
21021
+ };
21022
+ }
20578
21023
  return unresolved(
20579
21024
  git.root,
20580
21025
  overridePath,
@@ -20671,6 +21116,12 @@ function getEnvironmentConfig(env, options = {}) {
20671
21116
  frontendUrl: explicitFrontend || config.frontendUrl
20672
21117
  };
20673
21118
  }
21119
+ if (process.env.ENVIRONMENT === "dev-cloud") {
21120
+ return {
21121
+ apiUrl: explicitApi || DEV_CLOUD_POD_DEV.apiUrl,
21122
+ frontendUrl: explicitFrontend || DEV_CLOUD_POD_DEV.frontendUrl
21123
+ };
21124
+ }
20674
21125
  const checkout = classifyCheckout(options.startDir ?? process.cwd());
20675
21126
  if (checkout.kind === "non-worktree") {
20676
21127
  return {
@@ -20693,7 +21144,7 @@ function getEnvironmentConfig(env, options = {}) {
20693
21144
  }
20694
21145
  return { apiUrl: explicitApi, frontendUrl: explicitFrontend };
20695
21146
  }
20696
- var ENVIRONMENTS, CALLBACK_PORT, CALLBACK_PATH, REDIRECT_URI, API_CONTAINER_PORT, FRONTEND_CONTAINER_PORT, WORKTREE_SETUP_MARKER, OVERRIDE_FILENAME, OVERRIDE_SEQUENCE_TAG, COMPOSE_OVERRIDE_SCHEMA, WorktreeConfigError;
21147
+ var ENVIRONMENTS, DEV_CLOUD_POD_DEV, CALLBACK_PORT, CALLBACK_PATH, REDIRECT_URI, API_CONTAINER_PORT, FRONTEND_CONTAINER_PORT, WORKTREE_SETUP_MARKER, OVERRIDE_FILENAME, ENV_FILENAME, OVERRIDE_SEQUENCE_TAG, COMPOSE_OVERRIDE_SCHEMA, WorktreeConfigError;
20697
21148
  var init_config = __esm({
20698
21149
  "src/cli-utils/config.ts"() {
20699
21150
  init_js_yaml();
@@ -20711,6 +21162,10 @@ var init_config = __esm({
20711
21162
  frontendUrl: "https://app.gr-staging.com"
20712
21163
  }
20713
21164
  };
21165
+ DEV_CLOUD_POD_DEV = {
21166
+ apiUrl: "http://127.0.0.1:5050",
21167
+ frontendUrl: "http://127.0.0.1:3000"
21168
+ };
20714
21169
  CALLBACK_PORT = 31337;
20715
21170
  CALLBACK_PATH = "/oauth/callback";
20716
21171
  REDIRECT_URI = `http://localhost:${CALLBACK_PORT}${CALLBACK_PATH}`;
@@ -20718,6 +21173,7 @@ var init_config = __esm({
20718
21173
  FRONTEND_CONTAINER_PORT = 3e3;
20719
21174
  WORKTREE_SETUP_MARKER = "worktree-setup.sh";
20720
21175
  OVERRIDE_FILENAME = "docker-compose.override.yml";
21176
+ ENV_FILENAME = ".env";
20721
21177
  OVERRIDE_SEQUENCE_TAG = defineSequenceTag("!override", {
20722
21178
  create: () => [],
20723
21179
  addItem: (carrier, item) => {
@@ -22317,7 +22773,7 @@ var init_package = __esm({
22317
22773
  "package.json"() {
22318
22774
  package_default = {
22319
22775
  name: "@gravity-rail/cli",
22320
- version: "0.55.1",
22776
+ version: "0.57.0",
22321
22777
  description: "Gravity Rail CLI \u2014 manage workspaces from the command line",
22322
22778
  type: "module",
22323
22779
  bin: {
@@ -22382,10 +22838,11 @@ var init_package = __esm({
22382
22838
  };
22383
22839
  }
22384
22840
  });
22385
- var DEFAULT_PROFILE, CredentialsManager;
22841
+ var DEFAULT_PROFILE, LOOPBACK_HOSTNAMES, CredentialsManager;
22386
22842
  var init_credentials_manager = __esm({
22387
22843
  "src/cli-utils/credentials-manager.ts"() {
22388
22844
  DEFAULT_PROFILE = "default";
22845
+ LOOPBACK_HOSTNAMES = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "[::1]"]);
22389
22846
  CredentialsManager = class {
22390
22847
  cacheDir;
22391
22848
  apiUrl;
@@ -22482,7 +22939,7 @@ var init_credentials_manager = __esm({
22482
22939
  const url = new URL(this.apiUrl);
22483
22940
  const port = url.port;
22484
22941
  if (port && port !== "80" && port !== "443") {
22485
- const isCanonicalLocalDev = url.hostname === "localhost" && port === "5050" || url.hostname.endsWith("gravityrail.test") && port === "5054";
22942
+ const isCanonicalLocalDev = LOOPBACK_HOSTNAMES.has(url.hostname) && port === "5050" || url.hostname.endsWith("gravityrail.test") && port === "5054";
22486
22943
  if (!isCanonicalLocalDev) {
22487
22944
  return join(this.cacheDir, `credentials-${env}-${port}.json`);
22488
22945
  }
@@ -24550,7 +25007,7 @@ function commandNeedsJsonBody(cmd, parsedArgs) {
24550
25007
  }
24551
25008
  return false;
24552
25009
  }
24553
- if (cmd.acceptsJsonInput === true) {
25010
+ if (cmd.acceptsJsonInput === true || cmd.pipesJsonInput !== void 0) {
24554
25011
  return true;
24555
25012
  }
24556
25013
  if (parsedArgs.data !== void 0 || parsedArgs.file !== void 0) {
@@ -24571,7 +25028,19 @@ function commandNeedsJsonBody(cmd, parsedArgs) {
24571
25028
  }
24572
25029
  return false;
24573
25030
  }
24574
- async function readJsonInput(args) {
25031
+ var PIPED_INPUT_FIRST_BYTE_WAIT_MS = 6e4;
25032
+ function commandAwaitsPipedInput(cmd, parsedArgs) {
25033
+ if (parsedArgs.data !== void 0 || parsedArgs.file !== void 0) return false;
25034
+ const declared = cmd.pipesJsonInput;
25035
+ return typeof declared === "function" ? declared(parsedArgs) : declared === true;
25036
+ }
25037
+ async function readCommandJsonInput(cmd, parsedArgs) {
25038
+ if (!commandNeedsJsonBody(cmd, parsedArgs)) return void 0;
25039
+ return readJsonInput(parsedArgs, {
25040
+ pipedInputWaitMs: commandAwaitsPipedInput(cmd, parsedArgs) ? PIPED_INPUT_FIRST_BYTE_WAIT_MS : 0
25041
+ });
25042
+ }
25043
+ async function readJsonInput(args, options = {}) {
24575
25044
  const dataStr = args.data;
24576
25045
  const filePath = args.file;
24577
25046
  if (dataStr) {
@@ -24602,15 +25071,17 @@ async function readJsonInput(args) {
24602
25071
  if (process.stdin.isTTY === true) {
24603
25072
  return void 0;
24604
25073
  }
24605
- return readStdinIfPiped();
25074
+ return readStdinIfPiped(options.pipedInputWaitMs ?? 0);
24606
25075
  }
24607
- function readStdinIfPiped() {
25076
+ function readStdinIfPiped(firstByteWaitMs) {
24608
25077
  return new Promise((resolve3, reject) => {
24609
25078
  let data = "";
24610
25079
  let settled = false;
25080
+ let idleTimer;
24611
25081
  const finish2 = (value) => {
24612
25082
  if (settled) return;
24613
25083
  settled = true;
25084
+ if (idleTimer) clearTimeout(idleTimer);
24614
25085
  resolve3(value);
24615
25086
  };
24616
25087
  const flush = () => {
@@ -24639,6 +25110,15 @@ function readStdinIfPiped() {
24639
25110
  flush();
24640
25111
  return;
24641
25112
  }
25113
+ if (firstByteWaitMs > 0) {
25114
+ idleTimer = setTimeout(() => {
25115
+ if (!data) {
25116
+ process.stdin.pause();
25117
+ finish2(void 0);
25118
+ }
25119
+ }, firstByteWaitMs);
25120
+ return;
25121
+ }
24642
25122
  finish2(void 0);
24643
25123
  });
24644
25124
  });
@@ -25406,9 +25886,9 @@ Optional
25406
25886
  systemPrompt (string) Base instructions / identity
25407
25887
  chatModelConfig (object|null) Chat model overrides (temperature, thinking, \u2026)
25408
25888
  realtimeModelId (string|null) Voice/realtime model (see \`gr ai-models realtime\`)
25409
- e.g. "xai:realtime:voice-agent-2" (Grok Voice Think Fast 2)
25410
- or opt in to "xai:realtime:voice-agent-3" (Grok Voice
25411
- 3.0; not yet cleared for strict-routing workflows)
25889
+ e.g. "xai:realtime:voice-agent-3" (Grok Voice 3, the
25890
+ default; not yet cleared for strict-routing workflows).
25891
+ "xai:realtime:voice-agent-2" is deprecated.
25412
25892
  Native models auto-fill tts=native + default voice when
25413
25893
  realtimeModelConfig is omitted.
25414
25894
  realtimeModelConfig (object|null) Realtime config. Native example:
@@ -25426,11 +25906,7 @@ Attach an agent\u2019s models/identity to a workflow (draft), then publish:
25426
25906
  gr workflows update --id <wf> -d '{"copyFromAgentId": <agentId>}'
25427
25907
  gr workflows publish --workflow-id <wf>
25428
25908
 
25429
- One-shot workflow voice WITHOUT creating an agent (preferred for "use Grok Voice 2"):
25430
- gr workflows update --id <wf> -d '{"realtimeModelId":"xai:realtime:voice-agent-2"}'
25431
- gr workflows publish --workflow-id <wf>
25432
-
25433
- Opt a workflow into Grok Voice 3.0 (same xAI voices as 2.0; not the default):
25909
+ One-shot workflow voice WITHOUT creating an agent (preferred for "use Grok Voice 3"):
25434
25910
  gr workflows update --id <wf> -d '{"realtimeModelId":"xai:realtime:voice-agent-3"}'
25435
25911
  gr workflows publish --workflow-id <wf>
25436
25912
 
@@ -25458,11 +25934,10 @@ ${AGENT_FIELD_REFERENCE}`,
25458
25934
  updateHelp: `Update an agent. All fields optional.
25459
25935
  ${AGENT_FIELD_REFERENCE}`,
25460
25936
  createExamples: [
25461
- `gr agents create -d '{"name":"Support","chatModelId":"openai:chat:gpt-6-luna","realtimeModelId":"xai:realtime:voice-agent-2"}'`,
25937
+ `gr agents create -d '{"name":"Support","chatModelId":"openai:chat:gpt-6-luna","realtimeModelId":"xai:realtime:voice-agent-3"}'`,
25462
25938
  "gr agents create --file agent.json"
25463
25939
  ],
25464
25940
  updateExamples: [
25465
- `gr agents update --id 42 -d '{"realtimeModelId":"xai:realtime:voice-agent-2"}'`,
25466
25941
  `gr agents update --id 42 -d '{"realtimeModelId":"xai:realtime:voice-agent-3"}'`,
25467
25942
  "gr agents update --id 42 --file agent.json"
25468
25943
  ]
@@ -27341,23 +27816,24 @@ Assistant / models (live on the DRAFT revision \u2014 publish to go live)
27341
27816
  chatModelId (string) Text chat model (see \`gr ai-models chat\`)
27342
27817
  chatModelConfig (object|null) Chat model overrides
27343
27818
  realtimeModelId (string|null) Voice/realtime model (see \`gr ai-models realtime\`)
27344
- create: omit \u2192 xai:realtime:voice-agent-2 with
27345
- voice xai:voice:cosmo; null = voice off
27819
+ create: omit \u2192 xai:realtime:voice-agent-3 with
27820
+ voice xai:voice:cosmo; null = voice off.
27821
+ routingMode "strict": omit \u2192 no voice (use
27822
+ custom:realtime:composable)
27346
27823
  update: null = voice off
27347
27824
  One-shot switch (keeps the stored voice and
27348
27825
  call settings; resets only a voice the new
27349
27826
  model cannot use):
27350
- {"realtimeModelId":"xai:realtime:voice-agent-2"}
27351
- Opt in to Grok Voice 3.0 (not the default; not yet
27352
- cleared for routingMode "strict"; same xAI voices):
27353
27827
  {"realtimeModelId":"xai:realtime:voice-agent-3"}
27828
+ Grok Voice 3 is not yet cleared for routingMode
27829
+ "strict". voice-agent-2 is deprecated.
27354
27830
  On create, a native model id with no stored or
27355
27831
  copied config gets tts=native + that
27356
27832
  provider's fallback voice. A composable id
27357
27833
  still needs its own config. On update,
27358
27834
  omitting the config keeps the stored one.
27359
27835
  Explicit config replaces it:
27360
- {"realtimeModelId":"xai:realtime:voice-agent-2",
27836
+ {"realtimeModelId":"xai:realtime:voice-agent-3",
27361
27837
  "realtimeModelConfig":{"ttsModel":"native",
27362
27838
  "voiceModel":"xai:voice:ara"}}
27363
27839
  realtimeModelConfig (object|null) Realtime config. Omit on update to keep the
@@ -32570,7 +33046,7 @@ var bundlesDomain = {
32570
33046
  },
32571
33047
  {
32572
33048
  path: ["bundles", "draft", "set"],
32573
- description: 'Replace draft items from {"items": [...]}; an optional "links": [{"label", "url"}] replaces the draft links. Use --expected-generation from draft get to protect edits.',
33049
+ description: 'Replace draft items from {"items": [...]}. Journey items require {"key", "kind":"journey", "journeyUuid"}; the server captures the source Journey. An optional "links": [{"label", "url"}] replaces the draft links. Use --expected-generation from draft get to protect edits.',
32574
33050
  requiresWorkspace: true,
32575
33051
  mutates: true,
32576
33052
  args: [BUNDLE_ARG, GENERATION_ARG],
@@ -33952,9 +34428,9 @@ var REALTIME_AUDIO_USD_PER_MIN = {
33952
34428
  "xai:realtime:voice-agent": 0.05,
33953
34429
  // Grok Voice Think Fast 1
33954
34430
  "xai:realtime:voice-agent-2": 0.08,
33955
- // Grok Voice Think Fast 2 (pinned grok-voice-2.0)
34431
+ // Grok Voice 2 (pinned grok-voice-2.0)
33956
34432
  "xai:realtime:voice-agent-3": 0.08
33957
- // Grok Voice 3.0 — same audio rate as 2.0
34433
+ // Grok Voice 3 — same audio rate as 2.0
33958
34434
  };
33959
34435
  var DEFAULT_REALTIME_AUDIO_USD_PER_MIN = 0.08;
33960
34436
  var EST_AUDIO_MIN_PER_RUN = 3;
@@ -34033,6 +34509,10 @@ function runToBatchRow(job, workflowId, run, error, batchLabel, pinnedRevisionId
34033
34509
  ...job.realtime ? { realtime_model_id: job.modelId } : {},
34034
34510
  ...batchLabel ? { batch_label: batchLabel } : {},
34035
34511
  run_id: run?.id,
34512
+ lane: run?.lane ?? null,
34513
+ outcome: run?.outcome ?? null,
34514
+ assistant_chat_model_id: run?.assistantChatModelId ?? null,
34515
+ assistant_realtime_model_id: run?.assistantRealtimeModelId ?? null,
34036
34516
  error,
34037
34517
  failure_reason: run?.failureReason ?? null,
34038
34518
  passed: run?.passed ?? null,
@@ -34327,7 +34807,15 @@ var SCENARIO_COLUMNS = [
34327
34807
  COL.id(),
34328
34808
  COL.name(),
34329
34809
  { header: "PERSONA", getValue: (item) => item.personaName ?? "" },
34330
- { header: "CHANNEL", getValue: (item) => item.channel ?? "" }
34810
+ { header: "CHANNEL", getValue: (item) => item.channel ?? "" },
34811
+ {
34812
+ header: "SEED",
34813
+ getValue: (item) => {
34814
+ const turns = Array.isArray(item.seedTurns) ? item.seedTurns.length : 0;
34815
+ if (turns === 0) return "";
34816
+ return item.singleTurn ? `${turns} turns, single-turn` : `${turns} turns`;
34817
+ }
34818
+ }
34331
34819
  ];
34332
34820
  var RUN_COLUMNS = [
34333
34821
  COL.id(),
@@ -34419,7 +34907,7 @@ var qualificationsDomain = {
34419
34907
  },
34420
34908
  {
34421
34909
  path: ["qualifications", "scenarios", "create"],
34422
- description: "Create a scenario on a qualification (pass JSON via --data)",
34910
+ description: 'Create a scenario on a qualification (pass JSON via --data). Seed history: "seedTurns": [{"speaker": "member"|"agent", "content": "..."}]; "singleTurn": true grades only the Agent reply to the last seeded member turn',
34423
34911
  mutates: true,
34424
34912
  requiresWorkspace: true,
34425
34913
  args: [{ name: "qualification-id", description: "Qualification ID", required: true }],
@@ -34434,7 +34922,7 @@ var qualificationsDomain = {
34434
34922
  },
34435
34923
  {
34436
34924
  path: ["qualifications", "scenarios", "update"],
34437
- description: "Update a scenario (pass JSON via --data)",
34925
+ description: 'Update a scenario (pass JSON via --data). "seedTurns": [] clears the seed history; "singleTurn" needs seed turns that end on a member turn',
34438
34926
  mutates: true,
34439
34927
  requiresWorkspace: true,
34440
34928
  args: [{ name: "id", description: "Scenario ID", required: true }],
@@ -37137,7 +37625,7 @@ var COLUMNS15 = [
37137
37625
  ];
37138
37626
  var aiModelsDomain = {
37139
37627
  name: "ai-models",
37140
- description: `List available AI models (chat, realtime/voice stacks, speaker voices). Use realtime ids as workflow/agent realtimeModelId; voice ids go in realtimeModelConfig.voiceModel. One-shot workflow voice: gr workflows update -d '{"realtimeModelId":"xai:realtime:voice-agent-2"}' then publish.`,
37628
+ description: `List available AI models (chat, realtime/voice stacks, speaker voices). Use realtime ids as workflow/agent realtimeModelId; voice ids go in realtimeModelConfig.voiceModel. One-shot workflow voice: gr workflows update -d '{"realtimeModelId":"xai:realtime:voice-agent-3"}' then publish.`,
37141
37629
  commands: [
37142
37630
  {
37143
37631
  path: ["ai-models", "list"],
@@ -37159,7 +37647,7 @@ var aiModelsDomain = {
37159
37647
  },
37160
37648
  {
37161
37649
  path: ["ai-models", "realtime"],
37162
- description: "List realtime/voice stacks (use as realtimeModelId). e.g. xai:realtime:voice-agent-2 = Grok Voice Think Fast 2 (default); xai:realtime:voice-agent-3 = Grok Voice 3.0 (explicit opt-in)",
37650
+ description: "List realtime/voice stacks (use as realtimeModelId). e.g. xai:realtime:voice-agent-3 = Grok Voice 3 (default). Deprecated models (xai:realtime:voice-agent-2) are not listed.",
37163
37651
  requiresWorkspace: false,
37164
37652
  handler: async ({ ctx }) => {
37165
37653
  const result2 = await requireAuth(ctx).apiClient.getRealtimeModels();
@@ -38478,7 +38966,9 @@ var memberMemoriesDomain = {
38478
38966
  { name: "key", description: "Memory key", required: true },
38479
38967
  {
38480
38968
  name: "type",
38481
- description: "Memory type (basic, preferences, semantic, summaries, episodic)"
38969
+ // The API refuses preferences and semantic deletes (a Member cannot
38970
+ // be shown to own those AgentCore records), so they are not offered.
38971
+ description: "Memory type (basic, summaries, episodic)"
38482
38972
  }
38483
38973
  ],
38484
38974
  handler: async ({ ctx, workspace, args }) => {
@@ -41553,13 +42043,6 @@ var pronunciationsDomain = {
41553
42043
  // src/domains/recordings.ts
41554
42044
  init_context();
41555
42045
  init_output();
41556
- var CHUNK_COLUMNS = [
41557
- { header: "IDX", getValue: (item) => String(item.chunkIndex ?? "") },
41558
- { header: "ROLE", getValue: (item) => item.role ?? "" },
41559
- { header: "START", getValue: (item) => item.startTime ?? "" },
41560
- { header: "FORMAT", getValue: (item) => item.audioFormat ?? "" },
41561
- { header: "MIME", getValue: (item) => item.mimeType ?? "" }
41562
- ];
41563
42046
  var URL_COLUMNS = [
41564
42047
  { header: "DOWNLOAD URL", getValue: (item) => item.downloadUrl ?? "" },
41565
42048
  { header: "EXPIRES IN", getValue: (item) => String(item.expiresIn ?? "") },
@@ -41576,24 +42059,6 @@ var recordingsDomain = {
41576
42059
  name: "recordings",
41577
42060
  description: "Download recorded voice-call audio (per chat)",
41578
42061
  commands: [
41579
- {
41580
- path: ["recordings", "list"],
41581
- description: "List recorded audio chunks for a chat (metadata only)",
41582
- requiresWorkspace: true,
41583
- args: [
41584
- { name: "chat-id", aliases: ["id"], description: "Chat ID", required: true },
41585
- { name: "role", description: "Filter by role: 'assistant' or 'member'" }
41586
- ],
41587
- handler: async ({ ctx, workspace, args }) => {
41588
- const role = typeof args.role === "string" ? args.role : void 0;
41589
- const result2 = await requireAuth(ctx).apiClient.listChatRecordings(
41590
- workspace,
41591
- requireNumber(args, "chat-id"),
41592
- role ? { role } : {}
41593
- );
41594
- outputData(result2.items, ctx, CHUNK_COLUMNS);
41595
- }
41596
- },
41597
42062
  {
41598
42063
  path: ["recordings", "download-url"],
41599
42064
  description: "Get a single short-lived presigned URL for the whole-call recording WAV",
@@ -42286,6 +42751,92 @@ async function streamSyncRun(response, verbose) {
42286
42751
  console.log(JSON.stringify(lastRun, null, 2));
42287
42752
  }
42288
42753
  }
42754
+ var SYNC_RUN_OPTION_ARGS = [
42755
+ { name: "dry-run", description: "Test sync without making changes", isFlag: true },
42756
+ {
42757
+ name: "full-resync",
42758
+ description: "Clear checkpoints and re-sync all records",
42759
+ isFlag: true
42760
+ },
42761
+ { name: "quiet", description: "Only output final result JSON", isFlag: true },
42762
+ { name: "entity-type", description: "Scope to entity type: member or record" },
42763
+ {
42764
+ name: "board-id",
42765
+ description: "Scope to a single board mapping (requires --entity-type)"
42766
+ },
42767
+ {
42768
+ name: "record-limit",
42769
+ description: "Cap the run to a preview sample (1..200). Requires --dry-run and --entity-type."
42770
+ }
42771
+ ];
42772
+ var VALID_ENTITY_TYPES = ["member", "record"];
42773
+ function parseSyncRunOptions(args) {
42774
+ const dryRun = args["dry-run"] === true;
42775
+ const fullResync = args["full-resync"] === true;
42776
+ const quiet = args["quiet"] === true;
42777
+ const rawEntityType = args["entity-type"];
42778
+ let entityType;
42779
+ if (rawEntityType) {
42780
+ if (!VALID_ENTITY_TYPES.includes(rawEntityType)) {
42781
+ throw new CLIError(
42782
+ `Invalid --entity-type "${rawEntityType}". Allowed values: ${VALID_ENTITY_TYPES.join(", ")}`
42783
+ );
42784
+ }
42785
+ entityType = rawEntityType;
42786
+ }
42787
+ const boardId = args["board-id"];
42788
+ const rawRecordLimit = args["record-limit"];
42789
+ let recordLimit;
42790
+ if (rawRecordLimit !== void 0 && rawRecordLimit !== "") {
42791
+ const parsed = Number(rawRecordLimit);
42792
+ if (!Number.isInteger(parsed) || parsed < 1 || parsed > 200) {
42793
+ throw new CLIError(
42794
+ `Invalid --record-limit "${rawRecordLimit}". Must be an integer between 1 and 200.`
42795
+ );
42796
+ }
42797
+ if (!dryRun) {
42798
+ throw new CLIError("--record-limit requires --dry-run: capped runs are preview-only.");
42799
+ }
42800
+ if (entityType === void 0) {
42801
+ throw new CLIError(
42802
+ "--record-limit requires --entity-type: capped previews must target a single entity type."
42803
+ );
42804
+ }
42805
+ recordLimit = parsed;
42806
+ }
42807
+ if (fullResync && (dryRun || recordLimit !== void 0)) {
42808
+ throw new CLIError(
42809
+ "--full-resync is incompatible with --dry-run / --record-limit: checkpoint reset must happen on a non-preview run."
42810
+ );
42811
+ }
42812
+ return { dryRun, fullResync, quiet, entityType, boardId, recordLimit };
42813
+ }
42814
+ async function runSyncAndStream(ctx, workspace, connectionId, options) {
42815
+ const { dryRun, fullResync, quiet, entityType, boardId, recordLimit } = options;
42816
+ if (!quiet) {
42817
+ const flags = [
42818
+ dryRun && "(dry run)",
42819
+ fullResync && "(full re-sync)",
42820
+ entityType && `(${entityType} only)`,
42821
+ boardId && `(board ${boardId})`,
42822
+ recordLimit !== void 0 && `(limit ${recordLimit})`
42823
+ ].filter(Boolean).join(" ");
42824
+ console.error(`Starting sync for connection ${connectionId}${flags ? ` ${flags}` : ""}...`);
42825
+ }
42826
+ const response = await requireAuth(ctx).apiClient.startSyncRun(workspace, connectionId, {
42827
+ dryRun,
42828
+ resetCheckpoints: fullResync,
42829
+ entityType,
42830
+ boardId,
42831
+ recordLimit
42832
+ });
42833
+ if (!response.ok) {
42834
+ const text = await response.text();
42835
+ console.error(`Sync failed: ${response.status} ${text}`);
42836
+ process.exit(1);
42837
+ }
42838
+ await streamSyncRun(response, !quiet);
42839
+ }
42289
42840
  var syncDomain = {
42290
42841
  name: "sync",
42291
42842
  description: "Run and monitor connection syncs",
@@ -42295,22 +42846,7 @@ var syncDomain = {
42295
42846
  description: "Start a sync run and stream progress (SSE)",
42296
42847
  args: [
42297
42848
  { name: "connection-id", description: "Connection ID", required: true },
42298
- { name: "dry-run", description: "Test sync without making changes", isFlag: true },
42299
- {
42300
- name: "full-resync",
42301
- description: "Clear checkpoints and re-sync all records",
42302
- isFlag: true
42303
- },
42304
- { name: "quiet", description: "Only output final result JSON", isFlag: true },
42305
- { name: "entity-type", description: "Scope to entity type: member or record" },
42306
- {
42307
- name: "board-id",
42308
- description: "Scope to a single board mapping (requires --entity-type)"
42309
- },
42310
- {
42311
- name: "record-limit",
42312
- description: "Cap the run to a preview sample (1..200). Requires --dry-run and --entity-type."
42313
- }
42849
+ ...SYNC_RUN_OPTION_ARGS
42314
42850
  ],
42315
42851
  examples: [
42316
42852
  "sync run --connection-id 6",
@@ -42324,76 +42860,7 @@ var syncDomain = {
42324
42860
  mutates: true,
42325
42861
  handler: async ({ ctx, args, workspace }) => {
42326
42862
  const connectionId = requireNumber(args, "connection-id");
42327
- const dryRun = args["dry-run"] === true;
42328
- const fullResync = args["full-resync"] === true;
42329
- const quiet = args["quiet"] === true;
42330
- const VALID_ENTITY_TYPES = ["member", "record"];
42331
- const rawEntityType = args["entity-type"];
42332
- let entityType;
42333
- if (rawEntityType) {
42334
- if (!VALID_ENTITY_TYPES.includes(rawEntityType)) {
42335
- throw new CLIError(
42336
- `Invalid --entity-type "${rawEntityType}". Allowed values: ${VALID_ENTITY_TYPES.join(", ")}`
42337
- );
42338
- }
42339
- entityType = rawEntityType;
42340
- }
42341
- const boardId = args["board-id"];
42342
- const rawRecordLimit = args["record-limit"];
42343
- let recordLimit;
42344
- if (rawRecordLimit !== void 0 && rawRecordLimit !== "") {
42345
- const parsed = Number(rawRecordLimit);
42346
- if (!Number.isInteger(parsed) || parsed < 1 || parsed > 200) {
42347
- throw new CLIError(
42348
- `Invalid --record-limit "${rawRecordLimit}". Must be an integer between 1 and 200.`
42349
- );
42350
- }
42351
- if (!dryRun) {
42352
- throw new CLIError(
42353
- "--record-limit requires --dry-run: capped runs are preview-only."
42354
- );
42355
- }
42356
- if (entityType === void 0) {
42357
- throw new CLIError(
42358
- "--record-limit requires --entity-type: capped previews must target a single entity type."
42359
- );
42360
- }
42361
- recordLimit = parsed;
42362
- }
42363
- if (fullResync && (dryRun || recordLimit !== void 0)) {
42364
- throw new CLIError(
42365
- "--full-resync is incompatible with --dry-run / --record-limit: checkpoint reset must happen on a non-preview run."
42366
- );
42367
- }
42368
- if (!quiet) {
42369
- const flags = [
42370
- dryRun && "(dry run)",
42371
- fullResync && "(full re-sync)",
42372
- entityType && `(${entityType} only)`,
42373
- boardId && `(board ${boardId})`,
42374
- recordLimit !== void 0 && `(limit ${recordLimit})`
42375
- ].filter(Boolean).join(" ");
42376
- console.error(
42377
- `Starting sync for connection ${connectionId}${flags ? ` ${flags}` : ""}...`
42378
- );
42379
- }
42380
- const response = await requireAuth(ctx).apiClient.startSyncRun(
42381
- workspace,
42382
- connectionId,
42383
- {
42384
- dryRun,
42385
- resetCheckpoints: fullResync,
42386
- entityType,
42387
- boardId,
42388
- recordLimit
42389
- }
42390
- );
42391
- if (!response.ok) {
42392
- const text = await response.text();
42393
- console.error(`Sync failed: ${response.status} ${text}`);
42394
- process.exit(1);
42395
- }
42396
- await streamSyncRun(response, !quiet);
42863
+ await runSyncAndStream(ctx, workspace, connectionId, parseSyncRunOptions(args));
42397
42864
  }
42398
42865
  },
42399
42866
  {
@@ -43165,71 +43632,6 @@ var ENCOUNTER_RUN_COLUMNS = [
43165
43632
  getValue: (item) => summarizeReasons(item.attribution?.collections, "errorReasonCounts")
43166
43633
  }
43167
43634
  ];
43168
- var ONBOARDING_START_COLUMNS = [
43169
- { header: "MODE", getValue: (item) => item.mode ?? "" },
43170
- { header: "WORKFLOW ID", getValue: (item) => item.workflowId ?? "" },
43171
- { header: "RUN ID", getValue: (item) => item.runId ?? "" }
43172
- ];
43173
- var ONBOARDING_PAIR_COLUMNS = [
43174
- { header: "DEPARTMENT", getValue: (item) => String(item.departmentId ?? "") },
43175
- { header: "PATIENT STATUS", getValue: (item) => item.patientStatus ?? "" },
43176
- { header: "STATUS", getValue: (item) => item.status ?? "" },
43177
- { header: "STOP REASON", getValue: (item) => item.stopReason ?? "" },
43178
- { header: "GEN", getValue: (item) => String(item.generation ?? "") },
43179
- { header: "NEXT OFFSET", getValue: (item) => String(item.nextOffset ?? "") },
43180
- { header: "PAGES (RUN)", getValue: (item) => String(item.pagesDone ?? 0) },
43181
- { header: "~FETCHED", getValue: (item) => String(item.totals?.fetched ?? 0) },
43182
- { header: "~APPLIED", getValue: (item) => String(item.totals?.applied ?? 0) },
43183
- { header: "~SKIPPED", getValue: (item) => String(item.totals?.skipped ?? 0) },
43184
- { header: "~FAILED", getValue: (item) => String(item.totals?.failed ?? 0) },
43185
- { header: "RUN ID", getValue: (item) => item.runId ?? "" }
43186
- ];
43187
- var RESUMABLE_PAIR_STATUSES = /* @__PURE__ */ new Set([
43188
- "failed",
43189
- "aborted",
43190
- "truncated",
43191
- "pending",
43192
- "running",
43193
- "waiting"
43194
- ]);
43195
- function onboardingStatusLines(status, connectionId) {
43196
- const lines = [];
43197
- const execution = status.execution;
43198
- if (execution) {
43199
- const failure = execution.failureCode ? ` (failure: ${execution.failureCode})` : "";
43200
- lines.push(
43201
- `Temporal execution: ${execution.workflowId} run ${execution.runId ?? "-"} \u2014 ${execution.status}${failure}`
43202
- );
43203
- } else {
43204
- lines.push("Temporal execution: none recorded");
43205
- }
43206
- if (status.waitingUntil) {
43207
- lines.push(
43208
- `Waiting for the operator window (21:00\u201308:00 America/New_York) until ${status.waitingUntil}`
43209
- );
43210
- }
43211
- if (status.preview) {
43212
- const previewPairs = status.preview.pairs ?? [];
43213
- const admitted = previewPairs.reduce((n, p) => n + (p.totals?.admitted ?? 0), 0);
43214
- const notAdmitted = previewPairs.reduce(
43215
- (n, p) => n + (p.totals?.notAdmitted ?? 0),
43216
- 0
43217
- );
43218
- lines.push(
43219
- `Latest preview: ${previewPairs.length} pair(s), ~${admitted} admission-eligible (incl. already-linked), ~${notAdmitted} not admitted (read-only)`
43220
- );
43221
- }
43222
- lines.push("Counts are approximate.");
43223
- const unfinished = (status.pairs ?? []).some(
43224
- (p) => p.inCurrentCohort && RESUMABLE_PAIR_STATUSES.has(p.status) && p.runId
43225
- );
43226
- if (unfinished && execution?.status !== "running") {
43227
- lines.push(
43228
- `Unfinished pairs continue only on an explicit resume: gr fhir-connections onboarding-import start --id ${connectionId} --resume --allow-write`
43229
- );
43230
- }
43231
- return lines;
43232
- }
43233
43635
  var fhirConnectionsDomain = {
43234
43636
  name: "fhir-connections",
43235
43637
  description: "Manage FHIR connections",
@@ -43287,77 +43689,6 @@ var fhirConnectionsDomain = {
43287
43689
  );
43288
43690
  outputData(runs, ctx, ENCOUNTER_RUN_COLUMNS);
43289
43691
  }
43290
- },
43291
- {
43292
- // athenahealth onboarding import (PR-C): one explicit, audited
43293
- // operator execution per connection, at most 50 pages per pair per
43294
- // run. Thin over the SDK; the server decides everything.
43295
- path: ["fhir-connections", "onboarding-import", "start"],
43296
- description: "Start an athenahealth onboarding import (or --resume / --override / --dry-run preview)",
43297
- requiresWorkspace: true,
43298
- mutates: true,
43299
- args: [
43300
- { name: "id", description: "FHIR connection ID", required: true },
43301
- {
43302
- name: "dry-run",
43303
- description: "Preview: read and classify admission only, write no Members",
43304
- isFlag: true
43305
- },
43306
- {
43307
- name: "resume",
43308
- description: "Continue unfinished (failed, truncated, aborted) pairs at their stored frontier",
43309
- isFlag: true
43310
- },
43311
- {
43312
- name: "override",
43313
- description: "Rescan completed pairs from offset 0 under a new generation",
43314
- isFlag: true
43315
- }
43316
- ],
43317
- examples: [
43318
- "fhir-connections onboarding-import start --id 12 --dry-run --allow-write",
43319
- "fhir-connections onboarding-import start --id 12 --allow-write",
43320
- "fhir-connections onboarding-import start --id 12 --resume --allow-write"
43321
- ],
43322
- handler: async ({ ctx, workspace, args }) => {
43323
- const connectionId = requireNumber(args, "id");
43324
- const started = await requireAuth(ctx).apiClient.fhirStartOnboardingImport(
43325
- workspace,
43326
- connectionId,
43327
- {
43328
- dryRun: args["dry-run"] === true,
43329
- resume: args["resume"] === true,
43330
- override: args["override"] === true
43331
- }
43332
- );
43333
- outputSingle(started, ctx, ONBOARDING_START_COLUMNS);
43334
- hint(ctx, [
43335
- `Started. Follow progress with: gr fhir-connections onboarding-import status --id ${connectionId}`
43336
- ]);
43337
- }
43338
- },
43339
- {
43340
- path: ["fhir-connections", "onboarding-import", "status"],
43341
- description: "Show athenahealth onboarding-import progress and its Temporal execution (read-only)",
43342
- requiresWorkspace: true,
43343
- args: [{ name: "id", description: "FHIR connection ID", required: true }],
43344
- examples: [
43345
- "fhir-connections onboarding-import status --id 12",
43346
- "fhir-connections onboarding-import status --id 12 --output-format json"
43347
- ],
43348
- handler: async ({ ctx, workspace, args }) => {
43349
- const connectionId = requireNumber(args, "id");
43350
- const status = await requireAuth(ctx).apiClient.fhirGetOnboardingImportStatus(
43351
- workspace,
43352
- connectionId
43353
- );
43354
- if (ctx.jq || (ctx.outputFormat ?? "table") !== "table") {
43355
- outputSingle(status, ctx);
43356
- return;
43357
- }
43358
- outputData(status.pairs, ctx, ONBOARDING_PAIR_COLUMNS);
43359
- hint(ctx, onboardingStatusLines(status, connectionId));
43360
- }
43361
43692
  }
43362
43693
  ]
43363
43694
  };
@@ -43694,6 +44025,316 @@ init_errors();
43694
44025
  init_output();
43695
44026
  init_pagination();
43696
44027
  init_context();
44028
+
44029
+ // src/domains/integrations/connection-commands.ts
44030
+ init_errors();
44031
+ init_output();
44032
+ init_context();
44033
+ var POLL_INTERVAL_MIN_MINUTES = 15;
44034
+ var POLL_INTERVAL_MAX_MINUTES = 1440;
44035
+ function connectionIdArg(target) {
44036
+ return {
44037
+ name: "connection-id",
44038
+ description: `Connection ID (default: the workspace's ${target.label} connection)`
44039
+ };
44040
+ }
44041
+ async function resolveConnectionId(ctx, workspace, target, args) {
44042
+ const explicit = optionalNumber(args, "connection-id");
44043
+ if (explicit !== void 0) return explicit;
44044
+ const connections = await requireAuth(ctx).apiClient.listAppConnections(workspace);
44045
+ const matches = connections.filter((c) => c.connectionType === target.connectionType);
44046
+ if (matches.length === 0) {
44047
+ throw new CLIError(
44048
+ `No ${target.label} connection in this workspace. Run: gr ${target.command} install`
44049
+ );
44050
+ }
44051
+ if (matches.length > 1) {
44052
+ const ids = matches.map((c) => c.id).join(", ");
44053
+ throw new CLIError(
44054
+ `This workspace has ${matches.length} ${target.label} connections (${ids}). Pass --connection-id.`
44055
+ );
44056
+ }
44057
+ return matches[0].id;
44058
+ }
44059
+ function parsePollInterval(raw) {
44060
+ const minutes = Number(raw);
44061
+ if (!Number.isInteger(minutes) || minutes < POLL_INTERVAL_MIN_MINUTES || minutes > POLL_INTERVAL_MAX_MINUTES) {
44062
+ throw new CLIError(
44063
+ `Invalid --poll-interval "${String(raw)}". Must be a whole number of minutes between ${POLL_INTERVAL_MIN_MINUTES} and ${POLL_INTERVAL_MAX_MINUTES}.`
44064
+ );
44065
+ }
44066
+ return minutes;
44067
+ }
44068
+ function connectionCommands(target) {
44069
+ const c = target.command;
44070
+ const connectionId = connectionIdArg(target);
44071
+ return [
44072
+ {
44073
+ path: [c, "sync-config", "get"],
44074
+ description: `Get the ${target.label} sync configuration`,
44075
+ requiresWorkspace: true,
44076
+ args: [connectionId],
44077
+ handler: async ({ ctx, workspace, args }) => {
44078
+ const id = await resolveConnectionId(ctx, workspace, target, args);
44079
+ const result2 = await requireAuth(ctx).apiClient.getConnectionSyncConfig(workspace, id);
44080
+ outputSingle(result2, ctx);
44081
+ }
44082
+ },
44083
+ {
44084
+ path: [c, "sync-config", "set"],
44085
+ // `sync-config get -o json | … | sync-config set` pipes the whole
44086
+ // configuration; with --poll-interval alone there is no body to wait for.
44087
+ pipesJsonInput: (args) => args["poll-interval"] === void 0,
44088
+ description: `Replace the ${target.label} sync configuration (--data), or change one setting of the saved configuration (--poll-interval)`,
44089
+ mutates: true,
44090
+ requiresWorkspace: true,
44091
+ args: [
44092
+ connectionId,
44093
+ {
44094
+ name: "poll-interval",
44095
+ description: `Inbound poll cadence in minutes (${POLL_INTERVAL_MIN_MINUTES}..${POLL_INTERVAL_MAX_MINUTES}). Without --data, updates the saved configuration.`
44096
+ }
44097
+ ],
44098
+ examples: [
44099
+ `gr ${c} sync-config get -w <ws> -o json > sync-config.json`,
44100
+ `gr ${c} sync-config set -w <ws> --allow-write --file sync-config.json`,
44101
+ `gr ${c} sync-config set -w <ws> --allow-write --poll-interval 60`
44102
+ ],
44103
+ handler: async ({ ctx, workspace, args, data }) => {
44104
+ const rawInterval = args["poll-interval"];
44105
+ const hasInterval = rawInterval !== void 0 && rawInterval !== "";
44106
+ if (!data && !hasInterval) {
44107
+ throw new CLIError(
44108
+ "Pass the configuration (--data, --file, or stdin) or --poll-interval"
44109
+ );
44110
+ }
44111
+ if (data !== void 0 && (typeof data !== "object" || data === null || Array.isArray(data) || Object.keys(data).length === 0)) {
44112
+ throw new CLIError(
44113
+ "The configuration must be a non-empty JSON object (start from `sync-config get -o json`)"
44114
+ );
44115
+ }
44116
+ const minutes = hasInterval ? parsePollInterval(rawInterval) : void 0;
44117
+ const api = requireAuth(ctx).apiClient;
44118
+ const id = await resolveConnectionId(ctx, workspace, target, args);
44119
+ const base = data ?? await api.getConnectionSyncConfig(workspace, id);
44120
+ const config = minutes === void 0 ? base : { ...base, inboundPollIntervalMinutes: minutes };
44121
+ const result2 = await api.updateConnectionSyncConfig(workspace, id, config);
44122
+ outputSingle(result2, ctx);
44123
+ }
44124
+ },
44125
+ {
44126
+ path: [c, "sync", "capabilities"],
44127
+ description: `What the ${target.label} sync engine supports (entities, directions, modes)`,
44128
+ requiresWorkspace: true,
44129
+ args: [connectionId],
44130
+ handler: async ({ ctx, workspace, args }) => {
44131
+ const id = await resolveConnectionId(ctx, workspace, target, args);
44132
+ const result2 = await requireAuth(ctx).apiClient.getConnectionSyncCapabilities(
44133
+ workspace,
44134
+ id
44135
+ );
44136
+ outputSingle(result2, ctx);
44137
+ }
44138
+ },
44139
+ {
44140
+ path: [c, "sync", "run"],
44141
+ description: `Start a ${target.label} sync run and stream its progress`,
44142
+ mutates: true,
44143
+ requiresWorkspace: true,
44144
+ args: [connectionId, ...SYNC_RUN_OPTION_ARGS],
44145
+ examples: [
44146
+ `gr ${c} sync run -w <ws> --allow-write --dry-run --entity-type member --record-limit 5`,
44147
+ `gr ${c} sync run -w <ws> --allow-write`,
44148
+ `gr ${c} sync run -w <ws> --allow-write --full-resync --quiet`
44149
+ ],
44150
+ handler: async ({ ctx, workspace, args }) => {
44151
+ const options = parseSyncRunOptions(args);
44152
+ const id = await resolveConnectionId(ctx, workspace, target, args);
44153
+ await runSyncAndStream(ctx, workspace, id, options);
44154
+ }
44155
+ },
44156
+ {
44157
+ path: [c, "sync", "runs"],
44158
+ description: `List recent ${target.label} sync runs`,
44159
+ requiresWorkspace: true,
44160
+ args: [connectionId, { name: "limit", description: "Max runs to return (default 20)" }],
44161
+ handler: async ({ ctx, workspace, args }) => {
44162
+ const id = await resolveConnectionId(ctx, workspace, target, args);
44163
+ const runs = await requireAuth(ctx).apiClient.getSyncRuns(
44164
+ workspace,
44165
+ id,
44166
+ optionalNumber(args, "limit") ?? 20
44167
+ );
44168
+ outputData(runs, ctx, RUN_COLUMNS2);
44169
+ }
44170
+ },
44171
+ {
44172
+ path: [c, "sync", "run-items"],
44173
+ description: `List the items of one ${target.label} sync run`,
44174
+ requiresWorkspace: true,
44175
+ args: [
44176
+ connectionId,
44177
+ { name: "run-id", description: "Run ID (from sync runs)", required: true },
44178
+ { name: "limit", description: "Max items to return (default 500)" }
44179
+ ],
44180
+ handler: async ({ ctx, workspace, args }) => {
44181
+ const runId = requireString(args, "run-id");
44182
+ const id = await resolveConnectionId(ctx, workspace, target, args);
44183
+ const items = await requireAuth(ctx).apiClient.getSyncRunItems(
44184
+ workspace,
44185
+ id,
44186
+ runId,
44187
+ optionalNumber(args, "limit") ?? 500
44188
+ );
44189
+ outputData(items, ctx, ITEM_COLUMNS2);
44190
+ }
44191
+ },
44192
+ {
44193
+ path: [c, "sync", "checkpoint"],
44194
+ description: `Show the ${target.label} sync checkpoint (where the next run resumes)`,
44195
+ requiresWorkspace: true,
44196
+ args: [
44197
+ connectionId,
44198
+ { name: "direction", description: "'inbound' (default) or 'outbound'" },
44199
+ { name: "sync-key", description: "Sync key (default 'default')" }
44200
+ ],
44201
+ handler: async ({ ctx, workspace, args }) => {
44202
+ const direction = args["direction"] ?? "inbound";
44203
+ if (direction !== "inbound" && direction !== "outbound") {
44204
+ throw new CLIError(
44205
+ `--direction must be 'inbound' or 'outbound', got '${direction}'`
44206
+ );
44207
+ }
44208
+ const id = await resolveConnectionId(ctx, workspace, target, args);
44209
+ const result2 = await requireAuth(ctx).apiClient.getConnectionSyncCheckpoint(
44210
+ workspace,
44211
+ id,
44212
+ direction,
44213
+ args["sync-key"] ?? "default"
44214
+ );
44215
+ outputSingle(result2, ctx);
44216
+ }
44217
+ },
44218
+ {
44219
+ path: [c, "sync", "member-summary"],
44220
+ description: `Count members by ${target.label} sync state (linked, failed, never synced)`,
44221
+ requiresWorkspace: true,
44222
+ args: [connectionId],
44223
+ handler: async ({ ctx, workspace, args }) => {
44224
+ const id = await resolveConnectionId(ctx, workspace, target, args);
44225
+ const result2 = await requireAuth(ctx).apiClient.getMemberSyncSummary(workspace, id);
44226
+ outputSingle(result2, ctx);
44227
+ }
44228
+ },
44229
+ {
44230
+ path: [c, "field-keys"],
44231
+ description: `List the Member field keys the ${target.label} connection holds values for`,
44232
+ requiresWorkspace: true,
44233
+ args: [connectionId],
44234
+ handler: async ({ ctx, workspace, args }) => {
44235
+ const id = await resolveConnectionId(ctx, workspace, target, args);
44236
+ const result2 = await requireAuth(ctx).apiClient.listConnectionMemberFieldKeys(
44237
+ workspace,
44238
+ id
44239
+ );
44240
+ outputData(result2.keys, ctx);
44241
+ }
44242
+ },
44243
+ {
44244
+ path: [c, "reconciliation", "relink"],
44245
+ description: `Let sync re-link a member you unlinked from ${target.label} (clears the manual-unlink exclusion). Idempotent: cleared=false when there was none.`,
44246
+ mutates: true,
44247
+ requiresWorkspace: true,
44248
+ args: [connectionId, { name: "member-id", description: "Member ID", required: true }],
44249
+ handler: async ({ ctx, workspace, args }) => {
44250
+ const memberId = requireNumber(args, "member-id");
44251
+ const id = await resolveConnectionId(ctx, workspace, target, args);
44252
+ const result2 = await requireAuth(ctx).apiClient.clearConnectionMemberExclusion(
44253
+ workspace,
44254
+ id,
44255
+ memberId
44256
+ );
44257
+ outputSingle(result2, ctx);
44258
+ }
44259
+ },
44260
+ {
44261
+ path: [c, "reconciliation", "link-by-identity"],
44262
+ description: `Start the background run that links unlinked members to their ${target.label} records by identity, then syncs them. Prints the run's workflowId. Refused (400) when the connector has no identity resolver, and (409) while the connection is disabled or a run is already in flight.`,
44263
+ mutates: true,
44264
+ requiresWorkspace: true,
44265
+ args: [connectionId],
44266
+ examples: [
44267
+ `gr ${c} reconciliation link-by-identity -w <ws> --allow-write`,
44268
+ `gr ${c} reconciliation linked -w <ws> # check the new links afterwards`
44269
+ ],
44270
+ handler: async ({ ctx, workspace, args }) => {
44271
+ const id = await resolveConnectionId(ctx, workspace, target, args);
44272
+ const result2 = await requireAuth(ctx).apiClient.linkUnlinkedMembersByIdentity(
44273
+ workspace,
44274
+ id
44275
+ );
44276
+ outputSingle(result2, ctx);
44277
+ }
44278
+ }
44279
+ ];
44280
+ }
44281
+
44282
+ // src/domains/integrations/hubspot.ts
44283
+ var HUBSPOT = {
44284
+ command: "hubspot",
44285
+ label: "HubSpot",
44286
+ connectionType: "hubspot_connection"
44287
+ };
44288
+ var OBJECT_TYPES = ["contacts", "companies", "deals"];
44289
+ var SEARCHABLE_OBJECT_TYPES = ["contacts", "companies"];
44290
+ var SEARCH_COLUMNS = [
44291
+ { header: "ID", getValue: (item) => item.id ?? "" },
44292
+ { header: "TYPE", getValue: (item) => item.objectType ?? "" },
44293
+ { header: "NAME", getValue: (item) => item.name ?? "" },
44294
+ { header: "EMAIL", getValue: (item) => item.email ?? "" },
44295
+ {
44296
+ header: "MEMBER",
44297
+ getValue: (item) => item.existingMember ? `${item.existingMember.memberId} (${item.existingMember.matchType})` : ""
44298
+ }
44299
+ ];
44300
+ var MATCH_COLUMNS2 = [
44301
+ { header: "MEMBER", getValue: (item) => String(item.memberId ?? "") },
44302
+ { header: "RECORD", getValue: (item) => item.hubspotRecordId ?? "" },
44303
+ { header: "MATCH", getValue: (item) => item.matchType ?? "" },
44304
+ { header: "OBJECT", getValue: (item) => item.objectType ?? "" }
44305
+ ];
44306
+ var LINKED_COLUMNS2 = [
44307
+ { header: "MEMBER", getValue: (item) => String(item.memberId ?? "") },
44308
+ { header: "RECORD", getValue: (item) => item.hubspotRecordId ?? "" },
44309
+ { header: "NAME", getValue: (item) => item.memberName ?? "" },
44310
+ { header: "LAST SYNC", getValue: (item) => item.lastSyncStatus ?? "" }
44311
+ ];
44312
+ var IMPORT_COLUMNS = [
44313
+ { header: "HUBSPOT ID", getValue: (item) => item.hubspotId ?? "" },
44314
+ { header: "MEMBER", getValue: (item) => String(item.memberId ?? "") },
44315
+ { header: "OK", getValue: (item) => item.success ? "yes" : "no" },
44316
+ { header: "ERROR", getValue: (item) => item.error ?? "" }
44317
+ ];
44318
+ function importRecordsFrom(data) {
44319
+ const body = data;
44320
+ const rows = Array.isArray(body) ? body : Array.isArray(body?.records) ? body.records : Array.isArray(body?.results) ? body.results : void 0;
44321
+ if (!rows) {
44322
+ throw new CLIError(
44323
+ 'JSON input must be {"records":[...]}, a `gr hubspot search -o json` response, or an array'
44324
+ );
44325
+ }
44326
+ return rows.map((row, index) => {
44327
+ const hubspotId = row?.hubspotId ?? row?.id;
44328
+ if (!hubspotId) throw new CLIError(`Record ${index} has no hubspotId (or id)`);
44329
+ return {
44330
+ hubspotId: String(hubspotId),
44331
+ name: row.name ?? null,
44332
+ email: row.email ?? null,
44333
+ phone: row.phone ?? null,
44334
+ objectType: row.objectType ?? "contacts"
44335
+ };
44336
+ });
44337
+ }
43697
44338
  var hubspotDomain = {
43698
44339
  name: "hubspot",
43699
44340
  description: "HubSpot CRM integration",
@@ -43705,18 +44346,21 @@ var hubspotDomain = {
43705
44346
  requiresWorkspace: true,
43706
44347
  examples: [
43707
44348
  "# When the response shows platformAppAvailable=true, the workspace connects through",
43708
- "# the shared Gravity Rail HubSpot app: install, then authorize. That's all.",
43709
- "gr hubspot install -w <ws> --allow-write",
43710
- "gr hubspot authorize -w <ws> --allow-write # then open the returned authorizeUrl",
44349
+ "# the shared Gravity Rail HubSpot app: one command, then open the authorizeUrl.",
44350
+ "gr hubspot connect -w <ws> --allow-write",
43711
44351
  "",
43712
44352
  "# To use your own HubSpot app instead (a Projects-platform app; HubSpot no longer",
43713
44353
  "# allows new private or developer apps):",
43714
44354
  '# 1. install -> creates the connection; the response includes the OAuth "callbackUrl"',
43715
44355
  "# 2. in HubSpot: give your app that callbackUrl as a Redirect URL, with CRM scopes",
43716
- "# (contacts/companies/deals read+write). Copy the Client ID + Secret.",
44356
+ "# (contacts/companies/deals read+write), plus crm.lists.read and",
44357
+ "# crm.objects.owners.read, forms, and scheduler.meetings.meeting-link.read",
44358
+ "# as OPTIONAL scopes (HubSpot rejects the authorize",
44359
+ "# request if the app lacks them).",
44360
+ "# Copy the Client ID + Secret.",
43717
44361
  "# 3. configure -> save that Client ID / Secret",
43718
44362
  '# 4. authorize -> returns an "authorizeUrl"; open it to grant access.',
43719
- "gr hubspot status -w <ws> # read back callbackUrl + configured/connected",
44363
+ "gr hubspot install -w <ws> --allow-write",
43720
44364
  `gr hubspot configure -w <ws> --allow-write -d '{"clientId":"...","clientSecret":"..."}'`,
43721
44365
  "gr hubspot authorize -w <ws> --allow-write # then open the returned authorizeUrl"
43722
44366
  ],
@@ -43725,6 +44369,33 @@ var hubspotDomain = {
43725
44369
  outputSingle(result2, ctx);
43726
44370
  }
43727
44371
  },
44372
+ {
44373
+ path: ["hubspot", "connect"],
44374
+ description: "Install HubSpot if needed and start OAuth: prints the authorizeUrl to open and the exact callbackUrl the HubSpot app must allow",
44375
+ mutates: true,
44376
+ requiresWorkspace: true,
44377
+ examples: ["gr hubspot connect -w <ws> --allow-write"],
44378
+ handler: async ({ ctx, workspace }) => {
44379
+ const api = requireAuth(ctx).apiClient;
44380
+ const installed = await api.installHubspot(workspace);
44381
+ if (!installed.configured) {
44382
+ outputSingle(installed, ctx);
44383
+ throw new CLIError(
44384
+ "HubSpot is installed but has no app credentials. Register the callbackUrl above on your HubSpot app, then run: gr hubspot configure, then gr hubspot connect"
44385
+ );
44386
+ }
44387
+ const started = await api.startHubspotOAuth(workspace);
44388
+ outputSingle(
44389
+ {
44390
+ connectionId: started.connectionId,
44391
+ usesPlatformApp: started.usesPlatformApp,
44392
+ callbackUrl: started.callbackUrl,
44393
+ authorizeUrl: started.authorizeUrl
44394
+ },
44395
+ ctx
44396
+ );
44397
+ }
44398
+ },
43728
44399
  {
43729
44400
  path: ["hubspot", "status"],
43730
44401
  description: "Get HubSpot connection status (shows configured/connected state + the OAuth callback URL)",
@@ -43736,6 +44407,8 @@ var hubspotDomain = {
43736
44407
  },
43737
44408
  {
43738
44409
  path: ["hubspot", "configure"],
44410
+ // Reads its body from --data, --file or piped stdin.
44411
+ acceptsJsonInput: true,
43739
44412
  description: "Configure HubSpot credentials (setup step 3): save the Client ID / Secret",
43740
44413
  mutates: true,
43741
44414
  requiresWorkspace: true,
@@ -43763,7 +44436,7 @@ var hubspotDomain = {
43763
44436
  },
43764
44437
  {
43765
44438
  path: ["hubspot", "disconnect"],
43766
- description: "Disconnect HubSpot",
44439
+ description: "Disconnect HubSpot: clear the stored OAuth tokens and return the connection to setup (HubSpot keeps the app install)",
43767
44440
  mutates: true,
43768
44441
  requiresWorkspace: true,
43769
44442
  handler: async ({ ctx, workspace }) => {
@@ -43802,121 +44475,270 @@ var hubspotDomain = {
43802
44475
  }
43803
44476
  },
43804
44477
  {
43805
- path: ["hubspot", "sync-config"],
43806
- description: "Get HubSpot sync configuration",
44478
+ path: ["hubspot", "search"],
44479
+ description: "Search HubSpot contacts or companies; each result shows the workspace member it matches",
43807
44480
  requiresWorkspace: true,
43808
- handler: async ({ ctx, workspace }) => {
43809
- const conns = await requireAuth(ctx).apiClient.listAppConnections(workspace);
43810
- const conn = conns.find((c) => c.connectionType === "hubspot_connection");
43811
- if (!conn) throw new CLIError("No HubSpot connection found");
43812
- const result2 = await requireAuth(ctx).apiClient.getConnectionSyncConfig(
43813
- workspace,
43814
- conn.id
43815
- );
43816
- outputSingle(result2, ctx);
44481
+ args: [
44482
+ {
44483
+ name: "query",
44484
+ description: "Contacts whose email, or companies whose name, contains this text; empty lists all"
44485
+ },
44486
+ { name: "object-type", description: "'contacts' (default) or 'companies'" },
44487
+ { name: "limit", description: "Max results (1..100, default 20)" },
44488
+ {
44489
+ name: "after",
44490
+ description: "Cursor from a previous page (nextCursor); only without --query"
44491
+ }
44492
+ ],
44493
+ examples: [
44494
+ "gr hubspot search -w <ws> --query smith",
44495
+ "gr hubspot search -w <ws> --object-type companies --limit 50"
44496
+ ],
44497
+ handler: async ({ ctx, workspace, args }) => {
44498
+ const objectType = args["object-type"] ?? "contacts";
44499
+ if (!SEARCHABLE_OBJECT_TYPES.includes(objectType)) {
44500
+ throw new CLIError(
44501
+ `--object-type must be one of ${SEARCHABLE_OBJECT_TYPES.join(", ")}, got '${objectType}'`
44502
+ );
44503
+ }
44504
+ if (args["query"] && args["after"]) {
44505
+ throw new CLIError("--after pages only the listing without --query");
44506
+ }
44507
+ const result2 = await requireAuth(ctx).apiClient.searchHubspotRecords(workspace, {
44508
+ query: args["query"] ?? "",
44509
+ objectType,
44510
+ limit: optionalNumber(args, "limit") ?? 20,
44511
+ ...args["after"] ? { after: String(args["after"]) } : {}
44512
+ });
44513
+ if (ctx.outputFormat !== "table") {
44514
+ outputSingle(result2, ctx);
44515
+ return;
44516
+ }
44517
+ outputData(result2.results, ctx, SEARCH_COLUMNS);
44518
+ if (result2.hasMore && result2.nextCursor && !args["query"]) {
44519
+ console.error(`More results: --after ${result2.nextCursor}`);
44520
+ }
43817
44521
  }
43818
44522
  },
43819
44523
  {
43820
- path: ["hubspot", "update-sync-config"],
43821
- description: "Update HubSpot sync configuration",
44524
+ path: ["hubspot", "import-members"],
44525
+ // Its input is usually the previous command's output: wait for the pipe.
44526
+ pipesJsonInput: true,
44527
+ description: "Create (or update and link) workspace members from HubSpot records (max 100 per call)",
43822
44528
  mutates: true,
43823
44529
  requiresWorkspace: true,
43824
- handler: async ({ ctx, workspace, data }) => {
43825
- if (!data) throw new CLIError("JSON data required (--data, --file, or stdin)");
43826
- const conns = await requireAuth(ctx).apiClient.listAppConnections(workspace);
43827
- const conn = conns.find((c) => c.connectionType === "hubspot_connection");
43828
- if (!conn) throw new CLIError("No HubSpot connection found");
43829
- const result2 = await requireAuth(ctx).apiClient.updateConnectionSyncConfig(
43830
- workspace,
43831
- conn.id,
43832
- data
43833
- );
43834
- outputSingle(result2, ctx);
44530
+ args: [
44531
+ {
44532
+ name: "member-role-id",
44533
+ description: "Member role for new members (overrides memberRoleId in the body)"
44534
+ },
44535
+ {
44536
+ name: "ids",
44537
+ description: "Comma-separated HubSpot IDs: import only these rows of the input"
44538
+ },
44539
+ { name: "add-to-org", description: "Also add new members to the org", isFlag: true },
44540
+ {
44541
+ name: "org-role",
44542
+ description: "Org role with --add-to-org: 'member' (default), 'admin', 'owner'"
44543
+ }
44544
+ ],
44545
+ examples: [
44546
+ "gr hubspot search -w <ws> --query smith -o json \\",
44547
+ " | gr hubspot import-members -w <ws> --member-role-id 3 --allow-write",
44548
+ "gr hubspot search -w <ws> -o json > found.json",
44549
+ "gr hubspot import-members -w <ws> --file found.json --ids 101,102 --member-role-id 3 --allow-write"
44550
+ ],
44551
+ handler: async ({ ctx, workspace, args, data }) => {
44552
+ if (!data) {
44553
+ throw new CLIError(
44554
+ "JSON input required (--data, --file, or stdin): pipe `gr hubspot search -o json`"
44555
+ );
44556
+ }
44557
+ let records = importRecordsFrom(data);
44558
+ const rawIds = args["ids"];
44559
+ if (rawIds) {
44560
+ const wanted = new Set(
44561
+ rawIds.split(",").map((id) => id.trim()).filter(Boolean)
44562
+ );
44563
+ records = records.filter((r) => wanted.has(r.hubspotId));
44564
+ const missing = [...wanted].filter((id) => !records.some((r) => r.hubspotId === id));
44565
+ if (missing.length > 0) {
44566
+ throw new CLIError(`--ids not found in the input: ${missing.join(", ")}`);
44567
+ }
44568
+ }
44569
+ if (records.length === 0) throw new CLIError("No records to import");
44570
+ if (records.length > 100) {
44571
+ throw new CLIError(`At most 100 records per import; got ${records.length}`);
44572
+ }
44573
+ const bodyRoleId = data?.memberRoleId;
44574
+ const memberRoleId = optionalNumber(args, "member-role-id") ?? (typeof bodyRoleId === "number" ? bodyRoleId : void 0);
44575
+ if (memberRoleId === void 0) {
44576
+ throw new CLIError("--member-role-id is required (see: gr member-roles list)");
44577
+ }
44578
+ const addToOrg = args["add-to-org"] === true || data?.addToOrg === true;
44579
+ const orgRole = args["org-role"] ?? data?.orgRole;
44580
+ const result2 = await requireAuth(ctx).apiClient.importHubspotMembers(workspace, {
44581
+ records,
44582
+ memberRoleId,
44583
+ addToOrg,
44584
+ ...orgRole ? { orgRole } : {}
44585
+ });
44586
+ if (ctx.outputFormat !== "table") {
44587
+ outputSingle(result2, ctx);
44588
+ return;
44589
+ }
44590
+ outputData(result2.results, ctx, IMPORT_COLUMNS);
44591
+ console.error(`Imported ${result2.imported}, failed ${result2.failed}`);
43835
44592
  }
43836
44593
  },
43837
44594
  {
43838
- path: ["hubspot", "reconciliation"],
43839
- description: "Find matching HubSpot contacts for workspace members",
44595
+ path: ["hubspot", "reconciliation", "matches"],
44596
+ description: "Find unlinked members with a likely HubSpot record (by email/phone); queries HubSpot",
43840
44597
  requiresWorkspace: true,
43841
44598
  args: [
43842
- { name: "offset", description: "Pagination offset" },
43843
- { name: "limit", description: "Max results" }
44599
+ { name: "offset", description: "Scan offset (default 0)" },
44600
+ { name: "limit", description: "Max members to scan (default 50, max 200)" }
43844
44601
  ],
43845
44602
  handler: async ({ ctx, workspace, args }) => {
43846
- const offset = args["offset"] ? Number(args["offset"]) : void 0;
43847
- const limit = args["limit"] ? Number(args["limit"]) : void 0;
43848
44603
  const result2 = await requireAuth(ctx).apiClient.getHubspotReconciliationMatches(
43849
44604
  workspace,
43850
- {
43851
- offset,
43852
- limit
43853
- }
44605
+ { offset: optionalNumber(args, "offset"), limit: optionalNumber(args, "limit") }
43854
44606
  );
43855
- outputData(result2, ctx);
44607
+ outputData(result2, ctx, MATCH_COLUMNS2);
43856
44608
  }
43857
44609
  },
43858
44610
  {
43859
- path: ["hubspot", "linked-members"],
43860
- description: "List members linked to HubSpot contacts",
44611
+ path: ["hubspot", "reconciliation", "linked"],
44612
+ description: "List members linked to HubSpot records",
43861
44613
  requiresWorkspace: true,
43862
- args: LIST_PAGINATION_ARGS,
44614
+ args: [
44615
+ ...LIST_PAGINATION_ARGS,
44616
+ { name: "search", description: "Filter by member name/email/phone or HubSpot ID" }
44617
+ ],
43863
44618
  handler: async ({ ctx, workspace, args }) => {
43864
44619
  const pag = parsePaginationArgs(args);
44620
+ const search = args["search"] ? String(args["search"]) : void 0;
44621
+ const api = requireAuth(ctx).apiClient;
43865
44622
  if (pag.all) {
43866
44623
  const allItems = await fetchAllPages(
43867
- ({ page, pageSize }) => requireAuth(ctx).apiClient.getLinkedHubspotMembers(workspace, { page, pageSize })
44624
+ ({ page, pageSize }) => api.getLinkedHubspotMembers(workspace, { page, pageSize, search })
43868
44625
  );
43869
- outputData(allItems, ctx);
44626
+ outputData(allItems, ctx, LINKED_COLUMNS2);
43870
44627
  return;
43871
44628
  }
43872
- const options = {};
43873
- if (pag.page) options.page = pag.page;
43874
- if (pag.pageSize) options.pageSize = pag.pageSize;
43875
- const result2 = await requireAuth(ctx).apiClient.getLinkedHubspotMembers(
43876
- workspace,
43877
- options
43878
- );
43879
- outputData(listResult(result2, true), ctx);
44629
+ const result2 = await api.getLinkedHubspotMembers(workspace, {
44630
+ ...pag.page ? { page: pag.page } : {},
44631
+ ...pag.pageSize ? { pageSize: pag.pageSize } : {},
44632
+ ...search ? { search } : {}
44633
+ });
44634
+ outputData(listResult(result2, true), ctx, LINKED_COLUMNS2);
43880
44635
  }
43881
44636
  },
43882
44637
  {
43883
- path: ["hubspot", "link-member"],
43884
- description: "Link a member to a HubSpot contact",
44638
+ path: ["hubspot", "reconciliation", "link"],
44639
+ description: "Link a member to a HubSpot record",
43885
44640
  mutates: true,
43886
44641
  requiresWorkspace: true,
43887
44642
  args: [
43888
44643
  { name: "member-id", description: "Member ID", required: true },
43889
- { name: "contact-id", description: "HubSpot contact ID", required: true }
44644
+ { name: "record-id", description: "HubSpot record ID", required: true },
44645
+ { name: "object-type", description: "HubSpot object type (default 'contacts')" }
44646
+ ],
44647
+ examples: [
44648
+ "gr hubspot reconciliation link -w <ws> --member-id 42 --record-id 101 --allow-write"
43890
44649
  ],
43891
44650
  handler: async ({ ctx, workspace, args }) => {
44651
+ const objectType = args["object-type"] ? String(args["object-type"]) : void 0;
43892
44652
  const result2 = await requireAuth(ctx).apiClient.linkMemberToHubspot(workspace, {
43893
44653
  memberId: requireNumber(args, "member-id"),
43894
- hubspotRecordId: requireString(args, "contact-id")
44654
+ hubspotRecordId: requireString(args, "record-id"),
44655
+ ...objectType ? { objectType } : {}
43895
44656
  });
43896
44657
  outputSingle(result2, ctx);
43897
44658
  }
43898
44659
  },
43899
44660
  {
43900
- path: ["hubspot", "unlink-member"],
43901
- description: "Unlink a member from HubSpot",
44661
+ path: ["hubspot", "reconciliation", "link-bulk"],
44662
+ // Its input is usually the previous command's output: wait for the pipe.
44663
+ pipesJsonInput: true,
44664
+ description: 'Link many members at once. Body: {"links":[{"memberId":1,"recordId":"101"}]} (hubspotRecordId is accepted too); `reconciliation matches -o json` pipes in',
44665
+ mutates: true,
44666
+ requiresWorkspace: true,
44667
+ examples: [
44668
+ "gr hubspot reconciliation matches -w <ws> -o json \\",
44669
+ " | gr hubspot reconciliation link-bulk -w <ws> --allow-write"
44670
+ ],
44671
+ handler: async ({ ctx, workspace, data }) => {
44672
+ const body = data;
44673
+ const rows = Array.isArray(body) ? body : body?.links;
44674
+ if (!Array.isArray(rows) || rows.length === 0) {
44675
+ throw new CLIError('JSON input must be {"links":[...]} or an array of matches');
44676
+ }
44677
+ const links = rows.map((row, index) => {
44678
+ const memberId = Number(row?.memberId);
44679
+ const recordId = row?.recordId ?? row?.hubspotRecordId;
44680
+ if (!Number.isInteger(memberId) || !recordId) {
44681
+ throw new CLIError(
44682
+ `links[${index}] needs a numeric memberId and a recordId (or hubspotRecordId)`
44683
+ );
44684
+ }
44685
+ return {
44686
+ memberId,
44687
+ hubspotRecordId: String(recordId),
44688
+ ...row.objectType ? { objectType: String(row.objectType) } : {}
44689
+ };
44690
+ });
44691
+ const result2 = await requireAuth(ctx).apiClient.bulkLinkMembersToHubspot(workspace, {
44692
+ links
44693
+ });
44694
+ outputSingle(result2, ctx);
44695
+ }
44696
+ },
44697
+ {
44698
+ path: ["hubspot", "reconciliation", "unlink"],
44699
+ description: "Unlink a member from HubSpot (sync will not re-link them until reconciliation relink)",
43902
44700
  mutates: true,
43903
44701
  requiresWorkspace: true,
43904
44702
  args: [{ name: "member-id", description: "Member ID", required: true }],
43905
44703
  handler: async ({ ctx, workspace, args }) => {
43906
- await requireAuth(ctx).apiClient.unlinkMemberFromHubspot(
44704
+ const result2 = await requireAuth(ctx).apiClient.unlinkMemberFromHubspot(
43907
44705
  workspace,
43908
44706
  requireNumber(args, "member-id")
43909
44707
  );
43910
- process.stdout.write("Unlinked member from HubSpot\n");
44708
+ outputSingle(result2, ctx);
43911
44709
  }
43912
44710
  },
43913
44711
  {
43914
- path: ["hubspot", "contact-properties"],
43915
- description: "List available HubSpot contact properties",
44712
+ path: ["hubspot", "properties"],
44713
+ description: "List HubSpot property definitions: the sync-mappable contact properties by default, or every property of --object-type as HubSpot defines it",
43916
44714
  requiresWorkspace: true,
43917
- handler: async ({ ctx, workspace }) => {
43918
- const result2 = await requireAuth(ctx).apiClient.getHubspotContactProperties(workspace);
43919
- outputData(result2, ctx);
44715
+ args: [
44716
+ {
44717
+ name: "object-type",
44718
+ description: "Raw HubSpot schema for 'contacts', 'companies' or 'deals'"
44719
+ }
44720
+ ],
44721
+ examples: [
44722
+ "gr hubspot properties -w <ws>",
44723
+ "gr hubspot properties -w <ws> --object-type deals -o json"
44724
+ ],
44725
+ handler: async ({ ctx, workspace, args }) => {
44726
+ const objectType = args["object-type"];
44727
+ const api = requireAuth(ctx).apiClient;
44728
+ if (objectType === void 0) {
44729
+ outputData(await api.getHubspotContactProperties(workspace), ctx);
44730
+ return;
44731
+ }
44732
+ if (!OBJECT_TYPES.includes(objectType)) {
44733
+ throw new CLIError(
44734
+ `--object-type must be one of ${OBJECT_TYPES.join(", ")}, got '${objectType}'`
44735
+ );
44736
+ }
44737
+ const result2 = await api.getHubspotObjectProperties(
44738
+ workspace,
44739
+ objectType
44740
+ );
44741
+ outputSingle(result2, ctx);
43920
44742
  }
43921
44743
  },
43922
44744
  {
@@ -43928,6 +44750,22 @@ var hubspotDomain = {
43928
44750
  outputData(result2, ctx);
43929
44751
  }
43930
44752
  },
44753
+ {
44754
+ path: ["hubspot", "sync", "logs"],
44755
+ description: "List HubSpot managed-rule executions (newest first, cursor-paged)",
44756
+ requiresWorkspace: true,
44757
+ args: [
44758
+ { name: "page-size", description: "Rows per page" },
44759
+ { name: "cursor", description: "Cursor from a previous page (nextCursor)" }
44760
+ ],
44761
+ handler: async ({ ctx, workspace, args }) => {
44762
+ const result2 = await requireAuth(ctx).apiClient.getHubspotSyncLogs(workspace, {
44763
+ pageSize: optionalNumber(args, "page-size"),
44764
+ cursor: args["cursor"] ? String(args["cursor"]) : void 0
44765
+ });
44766
+ outputSingle(result2, ctx);
44767
+ }
44768
+ },
43931
44769
  {
43932
44770
  path: ["hubspot", "transform-presets"],
43933
44771
  description: "List available HubSpot field transform presets",
@@ -43936,7 +44774,8 @@ var hubspotDomain = {
43936
44774
  const result2 = await requireAuth(ctx).apiClient.getHubspotTransformPresets(workspace);
43937
44775
  outputData(result2, ctx);
43938
44776
  }
43939
- }
44777
+ },
44778
+ ...connectionCommands(HUBSPOT)
43940
44779
  ]
43941
44780
  };
43942
44781
 
@@ -44220,37 +45059,39 @@ var salesforceDomain = {
44220
45059
  commands: [
44221
45060
  {
44222
45061
  path: ["salesforce", "install"],
44223
- description: "Install Salesforce (setup step 1): create the connection and get its OAuth callback URL",
45062
+ description: "Install Salesforce (setup step 1): create the connection for an environment, then authorize",
44224
45063
  mutates: true,
44225
45064
  requiresWorkspace: true,
44226
45065
  args: [
44227
45066
  {
44228
- name: "instance-url",
44229
- description: "Salesforce login host (default https://login.salesforce.com; sandbox: https://test.salesforce.com; Developer Edition/custom domain: your org's My Domain login URL)"
45067
+ name: "environment",
45068
+ description: "Salesforce environment: production (default) or sandbox"
45069
+ },
45070
+ {
45071
+ name: "my-domain",
45072
+ description: "The org's My Domain host (e.g. acme.my.salesforce.com), only for an org that blocks login.salesforce.com / test.salesforce.com"
44230
45073
  }
44231
45074
  ],
44232
45075
  examples: [
44233
- "# Salesforce setup is a 4-step flow \u2014 this command is step 1:",
44234
- '# 1. install -> creates the connection; the response includes the OAuth "callbackUrl"',
44235
- "# 2. in Salesforce: create a Connected App (or External Client App) whose Callback URL",
44236
- "# is that callbackUrl, with OAuth scopes: api, refresh_token offline_access, openid,",
44237
- "# id profile email address phone. Copy the Consumer Key + Consumer Secret.",
44238
- "# 3. configure -> save that Client ID / Secret (and instance URL)",
44239
- '# 4. authorize -> returns an "authorizeUrl"; open it to grant access. status then',
44240
- "# reports configured=true and connected=true.",
45076
+ "# One-click setup through the shared Gravity Rail Salesforce app:",
45077
+ "# 1. install -> creates the connection for the chosen environment",
45078
+ '# 2. authorize -> returns an "authorizeUrl"; open it, sign in and approve access.',
45079
+ "# status then reports connected=true.",
45080
+ "# Advanced (own app): run configure between install and authorize, with an app whose",
45081
+ '# Callback URL is the status "callbackUrl".',
44241
45082
  "",
44242
45083
  "gr salesforce install -w <ws> --allow-write",
44243
- "gr salesforce install -w <ws> --instance-url https://test.salesforce.com --allow-write # sandbox",
44244
- "gr salesforce status -w <ws> # read back callbackUrl + configured/connected",
44245
- `gr salesforce configure -w <ws> --allow-write -d '{"clientId":"...","clientSecret":"...","instanceUrl":"https://login.salesforce.com"}'`,
44246
- "gr salesforce authorize -w <ws> --allow-write # then open the returned authorizeUrl"
45084
+ "gr salesforce install -w <ws> --environment sandbox --allow-write",
45085
+ "gr salesforce authorize -w <ws> --allow-write # then open the returned authorizeUrl",
45086
+ "gr salesforce status -w <ws>"
44247
45087
  ],
44248
45088
  handler: async ({ ctx, workspace, args }) => {
44249
- const instanceUrl = args["instance-url"];
44250
- const result2 = await requireAuth(ctx).apiClient.installSalesforce(
44251
- workspace,
44252
- typeof instanceUrl === "string" ? { instanceUrl } : void 0
44253
- );
45089
+ const environment = args["environment"];
45090
+ const myDomain = args["my-domain"];
45091
+ const result2 = await requireAuth(ctx).apiClient.installSalesforce(workspace, {
45092
+ ...typeof environment === "string" ? { environment } : {},
45093
+ ...typeof myDomain === "string" ? { myDomain } : {}
45094
+ });
44254
45095
  outputSingle(result2, ctx);
44255
45096
  }
44256
45097
  },
@@ -44265,12 +45106,12 @@ var salesforceDomain = {
44265
45106
  },
44266
45107
  {
44267
45108
  path: ["salesforce", "configure"],
44268
- description: "Configure Salesforce credentials (setup step 3): save the Client ID / Secret + instance URL",
45109
+ description: "Advanced: save your own Salesforce app's Client ID / Secret and environment, then open the returned authorizeUrl",
44269
45110
  mutates: true,
44270
45111
  requiresWorkspace: true,
44271
45112
  examples: [
44272
45113
  "gr salesforce configure -w <ws> --allow-write \\",
44273
- ` -d '{"clientId":"3MVG9...","clientSecret":"1A2B...","instanceUrl":"https://login.salesforce.com"}'`
45114
+ ` -d '{"clientId":"3MVG9...","clientSecret":"1A2B...","environment":"production"}'`
44274
45115
  ],
44275
45116
  handler: async ({ ctx, workspace, data }) => {
44276
45117
  if (!data) throw new CLIError("JSON data required (--data, --file, or stdin)");
@@ -44283,7 +45124,7 @@ var salesforceDomain = {
44283
45124
  },
44284
45125
  {
44285
45126
  path: ["salesforce", "authorize"],
44286
- description: "Authorize Salesforce via OAuth (setup step 4): returns an authorizeUrl to open in a browser",
45127
+ description: "Authorize Salesforce via OAuth (setup step 2): returns an authorizeUrl to open in a browser",
44287
45128
  mutates: true,
44288
45129
  requiresWorkspace: true,
44289
45130
  handler: async ({ ctx, workspace }) => {
@@ -46488,10 +47329,15 @@ var RealtimeClient = class extends EventEmitter {
46488
47329
  message: { role: "user", content }
46489
47330
  });
46490
47331
  }
46491
- /** Send interrupt signal with playback position */
47332
+ /**
47333
+ * Send interrupt signal with playback position.
47334
+ *
47335
+ * The position goes out as whole non-negative milliseconds, as the browser
47336
+ * sends it: the player reports fractional sample durations.
47337
+ */
46492
47338
  sendInterrupt(audioEndMs, messageId) {
46493
47339
  this.sendCustom("voice.interrupt", {
46494
- audio_end_ms: audioEndMs,
47340
+ audio_end_ms: Math.max(0, Math.floor(audioEndMs)),
46495
47341
  message_id: messageId
46496
47342
  });
46497
47343
  }
@@ -49365,7 +50211,7 @@ async function main() {
49365
50211
  process.stderr.write("Error: --workspace (-w) is required\n");
49366
50212
  process.exit(1);
49367
50213
  }
49368
- const data = commandNeedsJsonBody(cmd, parsedArgs) ? await readJsonInput(parsedArgs) : void 0;
50214
+ const data = await readCommandJsonInput(cmd, parsedArgs);
49369
50215
  hctx = { ctx, args: parsedArgs, workspace, data };
49370
50216
  } else {
49371
50217
  const baseCtx = createPublicContext(opts);