@gravity-rail/cli 0.16.0 → 0.17.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
@@ -207,7 +207,7 @@ var init_pagination = __esm({
207
207
  }
208
208
  });
209
209
 
210
- // ../sdk/dist/chunk-GP6ICMWF.js
210
+ // ../sdk/dist/chunk-PJFEGUHM.js
211
211
  function getCookieValue(name) {
212
212
  if (typeof document === "undefined") return void 0;
213
213
  const cookies = document.cookie.split(";");
@@ -265,8 +265,8 @@ function setOrgAuthHeader(headers2, token) {
265
265
  headers2.set(orgAuthHeaderName(token), token);
266
266
  }
267
267
  var ApiError, BaseApiClient;
268
- var init_chunk_GP6ICMWF = __esm({
269
- "../sdk/dist/chunk-GP6ICMWF.js"() {
268
+ var init_chunk_PJFEGUHM = __esm({
269
+ "../sdk/dist/chunk-PJFEGUHM.js"() {
270
270
  ApiError = class extends Error {
271
271
  statusCode;
272
272
  /** Legacy string-array errors — kept for non-validation callers. */
@@ -276,6 +276,13 @@ var init_chunk_GP6ICMWF = __esm({
276
276
  * Populated when the backend returns a WorkflowValidationErrorResponse.
277
277
  */
278
278
  validationErrors;
279
+ /**
280
+ * The raw structured `detail` object when the backend returned one (a body
281
+ * with `error: true` or a `code`). Declared here rather than bolted on with
282
+ * `as any` at the throw site so consumers can narrow it with a type guard —
283
+ * see `isMemberContactConflict` in `types/member-types`.
284
+ */
285
+ errorData;
279
286
  constructor(message, statusCode, errors, validationErrors) {
280
287
  super(message);
281
288
  this.statusCode = statusCode;
@@ -3213,7 +3220,7 @@ var init_libphonenumber_js = __esm({
3213
3220
  }
3214
3221
  });
3215
3222
 
3216
- // ../sdk/dist/chunk-4B7T6MBH.js
3223
+ // ../sdk/dist/chunk-CEFOCGYO.js
3217
3224
  function sanitizePhoneForBackend(phoneNumber) {
3218
3225
  try {
3219
3226
  let parsed = parsePhoneNumber4(phoneNumber);
@@ -3386,11 +3393,11 @@ function createApiModules(apiKey, baseUrl3, customFetch) {
3386
3393
  connectionSync: new ConnectionSyncApi(apiKey, baseUrl3, customFetch),
3387
3394
  mcpServers: new McpServersApi(apiKey, baseUrl3, customFetch),
3388
3395
  members: new MembersApi(apiKey, baseUrl3, customFetch),
3389
- milestones: new MilestonesApi(apiKey, baseUrl3, customFetch),
3390
3396
  motd: new MotdApi(apiKey, baseUrl3, customFetch),
3391
3397
  trackedLinks: new TrackedLinksApi(apiKey, baseUrl3, customFetch),
3392
3398
  confluence: new ConfluenceApi(apiKey, baseUrl3, customFetch),
3393
3399
  mondayIntegration: new MondayIntegrationApi(apiKey, baseUrl3, customFetch),
3400
+ interventionRequests: new InterventionRequestsApi(apiKey, baseUrl3, customFetch),
3394
3401
  notificationRules: new NotificationRulesApi(apiKey, baseUrl3, customFetch),
3395
3402
  oauth: new OAuthApi(apiKey, baseUrl3, customFetch),
3396
3403
  operatorGroups: new OperatorApi(apiKey, baseUrl3, customFetch),
@@ -3400,6 +3407,7 @@ function createApiModules(apiKey, baseUrl3, customFetch) {
3400
3407
  pronunciations: new PronunciationsApi(apiKey, baseUrl3, customFetch),
3401
3408
  qualifications: new QualificationsApi(apiKey, baseUrl3, customFetch),
3402
3409
  personas: new PersonasApi(apiKey, baseUrl3, customFetch),
3410
+ metrics: new MetricsApi(apiKey, baseUrl3, customFetch),
3403
3411
  queries: new QueriesApi(apiKey, baseUrl3, customFetch),
3404
3412
  reports: new ReportsApi(apiKey, baseUrl3, customFetch),
3405
3413
  salesforce: new SalesforceApi(apiKey, baseUrl3, customFetch),
@@ -3549,6 +3557,7 @@ function bindDashboardsMethods(target, dashboards) {
3549
3557
  target.deleteDashboard = dashboards.deleteDashboard.bind(dashboards);
3550
3558
  target.getDashboardChannelStats = dashboards.getDashboardChannelStats.bind(dashboards);
3551
3559
  target.getDashboardWorkflowAssignmentStats = dashboards.getDashboardWorkflowAssignmentStats.bind(dashboards);
3560
+ target.getConfigurationHealth = dashboards.getConfigurationHealth.bind(dashboards);
3552
3561
  }
3553
3562
  function bindMotdMethods(target, motd) {
3554
3563
  target.getMotd = motd.getMotd.bind(motd);
@@ -3945,7 +3954,7 @@ function bindWorkflowsMethods(target, workflows, workflowNotes, voice, superviso
3945
3954
  target.updateSupervisor = supervisors.updateSupervisor.bind(supervisors);
3946
3955
  target.deleteSupervisor = supervisors.deleteSupervisor.bind(supervisors);
3947
3956
  }
3948
- function bindCalendarsMethods(target, calendars, milestones) {
3957
+ function bindCalendarsMethods(target, calendars) {
3949
3958
  target.getCalendars = calendars.getCalendars.bind(calendars);
3950
3959
  target.getCalendar = calendars.getCalendar.bind(calendars);
3951
3960
  target.createCalendar = calendars.createCalendar.bind(calendars);
@@ -3977,11 +3986,6 @@ function bindCalendarsMethods(target, calendars, milestones) {
3977
3986
  target.linkCalendarToGoogle = calendars.linkCalendarToGoogle.bind(calendars);
3978
3987
  target.unlinkCalendarFromGoogle = calendars.unlinkCalendarFromGoogle.bind(calendars);
3979
3988
  target.syncCalendarWithGoogle = calendars.syncCalendarWithGoogle.bind(calendars);
3980
- target.getMilestones = milestones.getMilestones.bind(milestones);
3981
- target.getMilestone = milestones.getMilestone.bind(milestones);
3982
- target.createMilestone = milestones.createMilestone.bind(milestones);
3983
- target.updateMilestone = milestones.updateMilestone.bind(milestones);
3984
- target.deleteMilestone = milestones.deleteMilestone.bind(milestones);
3985
3989
  }
3986
3990
  function bindCommunicationsMethods(target, phoneNumbers, inboxes, notificationRules) {
3987
3991
  target.getPhoneNumbers = phoneNumbers.getPhoneNumbers.bind(phoneNumbers);
@@ -4324,6 +4328,11 @@ function bindOrgMethods(target, org) {
4324
4328
  target.updateBusinessProfile = org.updateBusinessProfile.bind(org);
4325
4329
  target.submitBusinessProfile = org.submitBusinessProfile.bind(org);
4326
4330
  target.cancelBusinessProfile = org.cancelBusinessProfile.bind(org);
4331
+ target.listLegalEntities = org.listLegalEntities.bind(org);
4332
+ target.getLegalEntity = org.getLegalEntity.bind(org);
4333
+ target.createLegalEntity = org.createLegalEntity.bind(org);
4334
+ target.getVoiceTrustProducts = org.getVoiceTrustProducts.bind(org);
4335
+ target.syncVoiceTrustProducts = org.syncVoiceTrustProducts.bind(org);
4327
4336
  target.createOrganizationWorkspace = org.createOrganizationWorkspace.bind(org);
4328
4337
  target.getOrgBillingCustomer = org.getOrgBillingCustomer.bind(org);
4329
4338
  }
@@ -4398,6 +4407,16 @@ function bindPersonasMethods(target, personas) {
4398
4407
  target.updatePersona = personas.updatePersona.bind(personas);
4399
4408
  target.deletePersona = personas.deletePersona.bind(personas);
4400
4409
  }
4410
+ function bindMetricsMethods(target, metrics) {
4411
+ target.listMetrics = metrics.listMetrics.bind(metrics);
4412
+ target.getMetric = metrics.getMetric.bind(metrics);
4413
+ target.createMetric = metrics.createMetric.bind(metrics);
4414
+ target.updateMetric = metrics.updateMetric.bind(metrics);
4415
+ target.deleteMetric = metrics.deleteMetric.bind(metrics);
4416
+ target.listMetricObservations = metrics.listMetricObservations.bind(metrics);
4417
+ target.getMetricSeries = metrics.getMetricSeries.bind(metrics);
4418
+ target.computeChatMetrics = metrics.computeChatMetrics.bind(metrics);
4419
+ }
4401
4420
  function bindQueriesMethods(target, queries) {
4402
4421
  target.getQueryFields = queries.getQueryFields.bind(queries);
4403
4422
  target.validateQuery = queries.validateQuery.bind(queries);
@@ -4447,10 +4466,10 @@ function bindSupportRequestMethods(target, supportRequests) {
4447
4466
  target.reopenWorkspaceSupportRequest = supportRequests.reopenWorkspaceSupportRequest.bind(supportRequests);
4448
4467
  target.clickWorkspaceSupportRequestResource = supportRequests.clickWorkspaceSupportRequestResource.bind(supportRequests);
4449
4468
  }
4450
- var AbilitiesApi, 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, MilestonesApi, MondayIntegrationApi, NotificationRulesApi, OperatorApi, OrgApi, OAuthConnectionsApi, OAuthApi, PhoneNumbersApi, PronunciationsApi, PromptsApi, PersonasApi, QueriesApi, QualificationsApi, ReportsApi, SalesforceApi, ConnectionSyncApi, HubspotApi, SitesApi, SubscriptionsApi, SupportRequestsApi, CustomersApi, ResellersApi, SupervisorsApi, TasksApi, TemplatesApi, ToolkitsApi, JourneysApi, WorkflowsApi, WorkflowNotesApi, EventRuleEventType, DriverMode, WorkspaceInvitationsApi, WorkspacesApi, DashboardsApi, TeamsAppsApi, ExperimentsApi, PatientSyncConnectionsApi, MotdApi, TrackedLinksApi, WORKSPACE_METHOD_NAMES, WORKSPACE_METHOD_NAME_SET, GravityRailClient, WIDGET_SLUGS, CHAT_TYPES, BUILTIN_ASSISTANT_CHAT_TYPES, MEMBER_AGENT_CHAT_TYPES;
4451
- var init_chunk_4B7T6MBH = __esm({
4452
- "../sdk/dist/chunk-4B7T6MBH.js"() {
4453
- init_chunk_GP6ICMWF();
4469
+ var AbilitiesApi, 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, SalesforceApi, ConnectionSyncApi, HubspotApi, SitesApi, SubscriptionsApi, SupportRequestsApi, CustomersApi, ResellersApi, SupervisorsApi, TasksApi, TemplatesApi, ToolkitsApi, JourneysApi, WorkflowsApi, WorkflowNotesApi, EventRuleEventType, DriverMode, WorkspaceInvitationsApi, WorkspacesApi, DashboardsApi, TeamsAppsApi, ExperimentsApi, PatientSyncConnectionsApi, MotdApi, InterventionRequestsApi, MetricsApi, TrackedLinksApi, WORKSPACE_METHOD_NAMES, WORKSPACE_METHOD_NAME_SET, GravityRailClient, WIDGET_SLUGS, CHAT_TYPES, BUILTIN_ASSISTANT_CHAT_TYPES, MEMBER_AGENT_CHAT_TYPES;
4470
+ var init_chunk_CEFOCGYO = __esm({
4471
+ "../sdk/dist/chunk-CEFOCGYO.js"() {
4472
+ init_chunk_PJFEGUHM();
4454
4473
  init_libphonenumber_js();
4455
4474
  AbilitiesApi = class extends BaseApiClient {
4456
4475
  /**
@@ -5815,7 +5834,7 @@ var init_chunk_4B7T6MBH = __esm({
5815
5834
  `w/${wid}/chats/${chatId}/skills`
5816
5835
  );
5817
5836
  }
5818
- /** List built-in skills that can be selected before starting a Manager Chat. */
5837
+ /** List built-in skills selectable before a Manager Chat (and on Routine manager tasks). */
5819
5838
  async getManagerSkills(wid) {
5820
5839
  return this.fetch(`w/${wid}/chats/manager/skills`);
5821
5840
  }
@@ -8217,12 +8236,34 @@ var init_chunk_4B7T6MBH = __esm({
8217
8236
  body: JSON.stringify(memberRole)
8218
8237
  });
8219
8238
  }
8220
- /** Delete a member role. */
8239
+ /** Delete a member role. Default roles (``systemKey`` set) return 403. */
8221
8240
  async deleteMemberRole(wid, id) {
8222
8241
  return this.fetch(`w/${wid}/member-roles/${id}`, {
8223
8242
  method: "DELETE"
8224
8243
  });
8225
8244
  }
8245
+ /**
8246
+ * Describe legacy duplicate default roles in this workspace. Read-only.
8247
+ *
8248
+ * Workspaces seeded by older versions of the product can carry the same
8249
+ * default role under several spellings ("manager" next to "Manager"). This
8250
+ * reports which ones should be merged and exactly how many members and
8251
+ * references each merge would move.
8252
+ */
8253
+ async getMemberRoleCleanupPlan(wid) {
8254
+ return this.fetch(`w/${wid}/member-roles/cleanup-plan`);
8255
+ }
8256
+ /**
8257
+ * Move every member and reference from one role to another, then delete the
8258
+ * source role. Requires `member_roles:admin`. The source cannot be a default
8259
+ * role.
8260
+ */
8261
+ async mergeMemberRoles(wid, request) {
8262
+ return this.fetch(`w/${wid}/member-roles/cleanup/merge`, {
8263
+ method: "POST",
8264
+ body: JSON.stringify(request)
8265
+ });
8266
+ }
8226
8267
  // Import/Export Members API
8227
8268
  /**
8228
8269
  * Read-only preview classifying each CSV row before any write (GRA-5545).
@@ -8524,44 +8565,6 @@ var init_chunk_4B7T6MBH = __esm({
8524
8565
  return this.fetch(`w/${wid}/members/${memberId}/sync-links`);
8525
8566
  }
8526
8567
  };
8527
- MilestonesApi = class extends BaseApiClient {
8528
- /** List milestones in a workspace with optional pagination and sorting. */
8529
- async getMilestones(wid, options = {}) {
8530
- const params = new URLSearchParams();
8531
- if (options.page) params.append("page", options.page.toString());
8532
- if (options.pageSize) params.append("pageSize", options.pageSize.toString());
8533
- if (options.sortBy) params.append("sortBy", options.sortBy);
8534
- if (options.sortOrder) params.append("sortOrder", options.sortOrder);
8535
- if (options.search) params.append("search", options.search);
8536
- return this.fetch(
8537
- `w/${wid}/milestones${params.toString() ? `?${params.toString()}` : ""}`
8538
- );
8539
- }
8540
- /** Get a single milestone by ID. */
8541
- async getMilestone(wid, id) {
8542
- return this.fetch(`w/${wid}/milestones/${id}`);
8543
- }
8544
- /** Create a new milestone in a workspace. */
8545
- async createMilestone(wid, milestone) {
8546
- return this.fetch(`w/${wid}/milestones`, {
8547
- method: "POST",
8548
- body: JSON.stringify(milestone)
8549
- });
8550
- }
8551
- /** Update an existing milestone with partial data. */
8552
- async updateMilestone(wid, id, milestone) {
8553
- return this.fetch(`w/${wid}/milestones/${id}`, {
8554
- method: "PUT",
8555
- body: JSON.stringify(milestone)
8556
- });
8557
- }
8558
- /** Delete a milestone by ID. */
8559
- async deleteMilestone(wid, id) {
8560
- return this.fetch(`w/${wid}/milestones/${id}`, {
8561
- method: "DELETE"
8562
- });
8563
- }
8564
- };
8565
8568
  MondayIntegrationApi = class extends BaseApiClient {
8566
8569
  /**
8567
8570
  * Get list of boards from the workspace Monday.com connection
@@ -8844,6 +8847,41 @@ var init_chunk_4B7T6MBH = __esm({
8844
8847
  async getCurrentOrgMember(orgIdOrUuid) {
8845
8848
  return this.fetch(`o/${orgIdOrUuid}/me`);
8846
8849
  }
8850
+ /**
8851
+ * Update the settings an org admin owns: name, slug and contact details.
8852
+ *
8853
+ * Deliberately NOT the admin organization update — `primary` and
8854
+ * `enforceCreditLimit` are superuser-only and are not fields on this
8855
+ * endpoint's request model at all.
8856
+ */
8857
+ async updateOrganizationSettings(orgIdOrUuid, data) {
8858
+ return this.fetch(`o/${orgIdOrUuid}`, {
8859
+ method: "PATCH",
8860
+ body: JSON.stringify(data)
8861
+ });
8862
+ }
8863
+ /**
8864
+ * Read this organization's SSO configuration.
8865
+ *
8866
+ * Org-scoped (`org:admin`), unlike the SSO fields on the superuser admin
8867
+ * organization update — an org admin owns their own identity provider.
8868
+ */
8869
+ async getOrgSsoConfig(orgIdOrUuid) {
8870
+ return this.fetch(`o/${orgIdOrUuid}/sso`);
8871
+ }
8872
+ /** Configure this organization's SSO. Requires `org:admin`. */
8873
+ async updateOrgSsoConfig(orgIdOrUuid, data) {
8874
+ return this.fetch(`o/${orgIdOrUuid}/sso`, {
8875
+ method: "PUT",
8876
+ body: JSON.stringify(data)
8877
+ });
8878
+ }
8879
+ /** Remove this organization's SSO configuration. Requires `org:admin`. */
8880
+ async deleteOrgSsoConfig(orgIdOrUuid) {
8881
+ return this.fetch(`o/${orgIdOrUuid}/sso`, {
8882
+ method: "DELETE"
8883
+ });
8884
+ }
8847
8885
  /**
8848
8886
  * Get the billing customer UUID for an organization.
8849
8887
  */
@@ -8964,6 +9002,22 @@ var init_chunk_4B7T6MBH = __esm({
8964
9002
  async getOrganizationWorkspace(orgIdOrUuid, workspaceUuid) {
8965
9003
  return this.fetch(`o/${orgIdOrUuid}/workspaces/${workspaceUuid}`);
8966
9004
  }
9005
+ /**
9006
+ * Workspace cards for the organization page: identity plus the GLB-side
9007
+ * counts. Any org member may call it — members get the workspaces they
9008
+ * belong to, org:read holders get all of them.
9009
+ */
9010
+ async getOrganizationWorkspaceSummaries(orgIdOrUuid) {
9011
+ return this.fetch(`o/${orgIdOrUuid}/workspaces/summary`);
9012
+ }
9013
+ /**
9014
+ * Workspace-schema aggregates for one card, plus the caller's own member
9015
+ * role. Separate from the list because it opens a session against the
9016
+ * workspace's own schema — each card fetches its own.
9017
+ */
9018
+ async getOrganizationWorkspaceStats(orgIdOrUuid, workspaceUuid) {
9019
+ return this.fetch(`o/${orgIdOrUuid}/workspaces/${workspaceUuid}/stats`);
9020
+ }
8967
9021
  /**
8968
9022
  * Create a workspace in an organization.
8969
9023
  */
@@ -12330,6 +12384,32 @@ var init_chunk_4B7T6MBH = __esm({
12330
12384
  `w/${wid}/dashboards/stats/workflow-assignments`
12331
12385
  );
12332
12386
  }
12387
+ /**
12388
+ * Current saved-configuration health across every family (Workflow
12389
+ * configuration, Journey authoring, Workflow access, Routine → Workflow
12390
+ * access, and the workspace lint).
12391
+ *
12392
+ * Requires ALL of `workflows:read`, `journeys:read`, `automations:read`,
12393
+ * `datatypes:read`, `members:read`, and `member_roles:read` — a pruned
12394
+ * subset would render as "all configuration is healthy".
12395
+ *
12396
+ * `page`/`pageSize` bound the response only; every family is evaluated in
12397
+ * full before the issue list is sliced. `check`/`severity` narrow the issue
12398
+ * list server-side, before pagination — filtering a single page in the
12399
+ * client cannot find a match that lives on a later one. `summary` and
12400
+ * `checks` are always workspace-global.
12401
+ */
12402
+ async getConfigurationHealth(wid, options) {
12403
+ const params = new URLSearchParams();
12404
+ if (options?.page !== void 0) params.append("page", options.page.toString());
12405
+ if (options?.pageSize !== void 0) params.append("pageSize", options.pageSize.toString());
12406
+ if (options?.check !== void 0) params.append("check", options.check);
12407
+ if (options?.severity !== void 0) params.append("severity", options.severity);
12408
+ const query = params.toString();
12409
+ return this.fetch(
12410
+ `w/${wid}/configuration-health${query ? `?${query}` : ""}`
12411
+ );
12412
+ }
12333
12413
  };
12334
12414
  TeamsAppsApi = class extends BaseApiClient {
12335
12415
  /**
@@ -12516,6 +12596,80 @@ var init_chunk_4B7T6MBH = __esm({
12516
12596
  return this.fetch(`w/${wid}/motd${query ? `?${query}` : ""}`);
12517
12597
  }
12518
12598
  };
12599
+ InterventionRequestsApi = class extends BaseApiClient {
12600
+ /** List intervention requests in a workspace, newest first. */
12601
+ async getInterventionRequests(wid, params = {}) {
12602
+ const query = new URLSearchParams();
12603
+ if (params.kind) query.set("kind", params.kind);
12604
+ if (params.openOnly) query.set("openOnly", "true");
12605
+ if (params.chatId !== void 0) query.set("chatId", String(params.chatId));
12606
+ if (params.unroutedOnly) query.set("unroutedOnly", "true");
12607
+ if (params.limit !== void 0) query.set("limit", String(params.limit));
12608
+ const qs = query.toString();
12609
+ return this.fetch(
12610
+ `w/${wid}/intervention-requests${qs ? `?${qs}` : ""}`
12611
+ );
12612
+ }
12613
+ };
12614
+ MetricsApi = class extends BaseApiClient {
12615
+ /** List metric definitions in the workspace, paginated. */
12616
+ async listMetrics(wid, params) {
12617
+ const q = new URLSearchParams();
12618
+ if (params?.page !== void 0) q.set("page", String(params.page));
12619
+ if (params?.pageSize !== void 0) q.set("pageSize", String(params.pageSize));
12620
+ if (params?.includeArchived !== void 0)
12621
+ q.set("includeArchived", String(params.includeArchived));
12622
+ if (params?.source) q.set("source", params.source);
12623
+ const qs = q.toString() ? `?${q.toString()}` : "";
12624
+ return this.fetch(`w/${wid}/metrics${qs}`);
12625
+ }
12626
+ async getMetric(wid, id) {
12627
+ return this.fetch(`w/${wid}/metrics/${id}`);
12628
+ }
12629
+ async createMetric(wid, data) {
12630
+ return this.fetch(`w/${wid}/metrics`, {
12631
+ method: "POST",
12632
+ body: JSON.stringify(data)
12633
+ });
12634
+ }
12635
+ async updateMetric(wid, id, data) {
12636
+ return this.fetch(`w/${wid}/metrics/${id}`, {
12637
+ method: "PUT",
12638
+ body: JSON.stringify(data)
12639
+ });
12640
+ }
12641
+ /** Soft-archive a metric (observations retained). */
12642
+ async deleteMetric(wid, id) {
12643
+ return this.fetch(`w/${wid}/metrics/${id}`, { method: "DELETE" });
12644
+ }
12645
+ async listMetricObservations(wid, metricId, params) {
12646
+ const q = new URLSearchParams();
12647
+ q.set("start", params.start);
12648
+ q.set("end", params.end);
12649
+ if (params.page !== void 0) q.set("page", String(params.page));
12650
+ if (params.pageSize !== void 0) q.set("pageSize", String(params.pageSize));
12651
+ return this.fetch(
12652
+ `w/${wid}/metrics/${metricId}/observations?${q.toString()}`
12653
+ );
12654
+ }
12655
+ async getMetricSeries(wid, metricId, params) {
12656
+ const q = new URLSearchParams();
12657
+ q.set("start", params.start);
12658
+ q.set("end", params.end);
12659
+ if (params.bucket) q.set("bucket", params.bucket);
12660
+ if (params.aggregation) q.set("aggregation", params.aggregation);
12661
+ return this.fetch(
12662
+ `w/${wid}/metrics/${metricId}/series?${q.toString()}`
12663
+ );
12664
+ }
12665
+ /** On-demand compute of enabled chat-source metrics for one chat. */
12666
+ async computeChatMetrics(wid, data) {
12667
+ return this.fetch(`w/${wid}/metrics/compute-for-chat`, {
12668
+ method: "POST",
12669
+ body: JSON.stringify(data)
12670
+ });
12671
+ }
12672
+ };
12519
12673
  TrackedLinksApi = class extends BaseApiClient {
12520
12674
  /** Header counters plus whether shortening is configured and enabled. */
12521
12675
  async getTrackedLinkSummary(wid, options = {}) {
@@ -12709,7 +12863,6 @@ var init_chunk_4B7T6MBH = __esm({
12709
12863
  "createMemberMemory",
12710
12864
  "createMemberRole",
12711
12865
  "createMenuItem",
12712
- "createMilestone",
12713
12866
  "createNotificationRule",
12714
12867
  "createOperatorGroup",
12715
12868
  "createPage",
@@ -12776,7 +12929,6 @@ var init_chunk_4B7T6MBH = __esm({
12776
12929
  "deleteMemberMemory",
12777
12930
  "deleteMemberRole",
12778
12931
  "deleteMenuItem",
12779
- "deleteMilestone",
12780
12932
  "deleteMondayConnection",
12781
12933
  "deleteNotificationRule",
12782
12934
  "deleteOperatorGroup",
@@ -12927,6 +13079,7 @@ var init_chunk_4B7T6MBH = __esm({
12927
13079
  "getChatsNeedsResponse",
12928
13080
  "getChildThreadMessages",
12929
13081
  "getClientWorkspace",
13082
+ "getConfigurationHealth",
12930
13083
  "getConfluenceStatus",
12931
13084
  "getConnectionSyncCapabilities",
12932
13085
  "getConnectionSyncCheckpoint",
@@ -13053,6 +13206,7 @@ var init_chunk_4B7T6MBH = __esm({
13053
13206
  "getMemberMemory",
13054
13207
  "getMemberRecordCounts",
13055
13208
  "getMemberRole",
13209
+ "getMemberRoleCleanupPlan",
13056
13210
  "getMemberRoleByUuid",
13057
13211
  "getMemberRoles",
13058
13212
  "getMemberSyncLinks",
@@ -13061,8 +13215,6 @@ var init_chunk_4B7T6MBH = __esm({
13061
13215
  "getMembersMessageActivity",
13062
13216
  "getMenuItems",
13063
13217
  "getMessageTiming",
13064
- "getMilestone",
13065
- "getMilestones",
13066
13218
  "getMondayConnectionBoardColumns",
13067
13219
  "getMondayConnectionBoardGroups",
13068
13220
  "getMondayConnectionBoards",
@@ -13225,6 +13377,14 @@ var init_chunk_4B7T6MBH = __esm({
13225
13377
  "listHealthiePatients",
13226
13378
  "listHealthieProviders",
13227
13379
  "listPersonas",
13380
+ "listMetrics",
13381
+ "getMetric",
13382
+ "createMetric",
13383
+ "updateMetric",
13384
+ "deleteMetric",
13385
+ "listMetricObservations",
13386
+ "getMetricSeries",
13387
+ "computeChatMetrics",
13228
13388
  "listPushSubscriptions",
13229
13389
  "listSalesforceObjects",
13230
13390
  "listScenarios",
@@ -13235,6 +13395,7 @@ var init_chunk_4B7T6MBH = __esm({
13235
13395
  "markEmailAsRead",
13236
13396
  "markEmailAsUnread",
13237
13397
  "markNotificationAsRead",
13398
+ "mergeMemberRoles",
13238
13399
  "previewImportMembers",
13239
13400
  "previewImportWorkspace",
13240
13401
  "previewRoutineWorkflowAccess",
@@ -13363,7 +13524,6 @@ var init_chunk_4B7T6MBH = __esm({
13363
13524
  "updateMemberLabel",
13364
13525
  "updateMemberRole",
13365
13526
  "updateMenuItem",
13366
- "updateMilestone",
13367
13527
  "updateMondaySyncConfig",
13368
13528
  "updateNotificationRule",
13369
13529
  "updateOperatorGroup",
@@ -13551,6 +13711,8 @@ var init_chunk_4B7T6MBH = __esm({
13551
13711
  createMemberRole;
13552
13712
  updateMemberRole;
13553
13713
  deleteMemberRole;
13714
+ getMemberRoleCleanupPlan;
13715
+ mergeMemberRoles;
13554
13716
  // Member Fields
13555
13717
  getMemberFields;
13556
13718
  getMemberFieldDefinitions;
@@ -13611,6 +13773,15 @@ var init_chunk_4B7T6MBH = __esm({
13611
13773
  createPersona;
13612
13774
  updatePersona;
13613
13775
  deletePersona;
13776
+ // Metrics API (customer-defined outcome metrics)
13777
+ listMetrics;
13778
+ getMetric;
13779
+ createMetric;
13780
+ updateMetric;
13781
+ deleteMetric;
13782
+ listMetricObservations;
13783
+ getMetricSeries;
13784
+ computeChatMetrics;
13614
13785
  // Dashboards API
13615
13786
  getDashboards;
13616
13787
  getDashboard;
@@ -13619,6 +13790,7 @@ var init_chunk_4B7T6MBH = __esm({
13619
13790
  deleteDashboard;
13620
13791
  getDashboardChannelStats;
13621
13792
  getDashboardWorkflowAssignmentStats;
13793
+ getConfigurationHealth;
13622
13794
  // MOTD API
13623
13795
  getMotd;
13624
13796
  // Tracked Links analytics (#10934)
@@ -13772,6 +13944,11 @@ var init_chunk_4B7T6MBH = __esm({
13772
13944
  updateBusinessProfile;
13773
13945
  submitBusinessProfile;
13774
13946
  cancelBusinessProfile;
13947
+ listLegalEntities;
13948
+ getLegalEntity;
13949
+ createLegalEntity;
13950
+ getVoiceTrustProducts;
13951
+ syncVoiceTrustProducts;
13775
13952
  createOrganizationWorkspace;
13776
13953
  getOrgBillingCustomer;
13777
13954
  getVapidPublicKey;
@@ -14033,11 +14210,6 @@ var init_chunk_4B7T6MBH = __esm({
14033
14210
  linkCalendarToGoogle;
14034
14211
  unlinkCalendarFromGoogle;
14035
14212
  syncCalendarWithGoogle;
14036
- getMilestones;
14037
- getMilestone;
14038
- createMilestone;
14039
- updateMilestone;
14040
- deleteMilestone;
14041
14213
  // Communications API
14042
14214
  getPhoneNumbers;
14043
14215
  getAvailablePhoneNumbers;
@@ -14417,6 +14589,7 @@ var init_chunk_4B7T6MBH = __esm({
14417
14589
  bindAgentsMethods(this, apis.agents);
14418
14590
  bindQualificationsMethods(this, apis.qualifications);
14419
14591
  bindPersonasMethods(this, apis.personas);
14592
+ bindMetricsMethods(this, apis.metrics);
14420
14593
  bindQueriesMethods(this, apis.queries);
14421
14594
  bindDashboardsMethods(this, apis.dashboards);
14422
14595
  bindMotdMethods(this, apis.motd);
@@ -14433,7 +14606,7 @@ var init_chunk_4B7T6MBH = __esm({
14433
14606
  bindFilesMethods(this, apis.files);
14434
14607
  bindEventsMethods(this, apis.events);
14435
14608
  bindWorkflowsMethods(this, apis.workflows, apis.workflowNotes, apis.voice, apis.supervisors);
14436
- bindCalendarsMethods(this, apis.calendars, apis.milestones);
14609
+ bindCalendarsMethods(this, apis.calendars);
14437
14610
  bindCommunicationsMethods(this, apis.phoneNumbers, apis.inboxes, apis.notificationRules);
14438
14611
  bindToolkitsMethods(
14439
14612
  this,
@@ -14606,9 +14779,9 @@ var init_chunk_2YLKG4TT = __esm({
14606
14779
  var SEARCHABLE_EVENT_RULE_SOURCE_FIELDS;
14607
14780
  var init_dist = __esm({
14608
14781
  "../sdk/dist/index.js"() {
14609
- init_chunk_4B7T6MBH();
14782
+ init_chunk_CEFOCGYO();
14610
14783
  init_chunk_2YLKG4TT();
14611
- init_chunk_GP6ICMWF();
14784
+ init_chunk_PJFEGUHM();
14612
14785
  SEARCHABLE_EVENT_RULE_SOURCE_FIELDS = [
14613
14786
  "taskId",
14614
14787
  "dataTypeId",
@@ -16469,6 +16642,19 @@ var COMMON_ARGS = [
16469
16642
  { name: "id", description: "Entity ID" },
16470
16643
  { name: "uuid", description: "Entity UUID" }
16471
16644
  ];
16645
+ var ORG_UUID_ARG = {
16646
+ name: "org-uuid",
16647
+ aliases: ["org"],
16648
+ description: "Organization UUID or ID",
16649
+ required: true
16650
+ };
16651
+ function requireOrgRef(args) {
16652
+ const val = args["org-uuid"] ?? args.org;
16653
+ if (typeof val !== "string" || !val) {
16654
+ throw new CLIError("Missing required argument: --org-uuid");
16655
+ }
16656
+ return val;
16657
+ }
16472
16658
  function parseArgs(defs, argv) {
16473
16659
  const allDefs = [...defs, ...COMMON_ARGS];
16474
16660
  const result3 = {};
@@ -16980,8 +17166,8 @@ var CommandRegistry = class {
16980
17166
  const key = cmd.path.join(" ");
16981
17167
  this.commands.set(key, cmd);
16982
17168
  }
16983
- registerCommands(commands3) {
16984
- for (const cmd of commands3) {
17169
+ registerCommands(commands4) {
17170
+ for (const cmd of commands4) {
16985
17171
  this.registerCommand(cmd);
16986
17172
  }
16987
17173
  }
@@ -17500,6 +17686,42 @@ var FEEDBACK_COLUMNS = [
17500
17686
  },
17501
17687
  COL.created()
17502
17688
  ];
17689
+ async function respondWithValue(ctx, workspace, args) {
17690
+ const chatId = requireIdOrUuidFrom(args, "chat-id", "id");
17691
+ const chat = await requireAuth(ctx).apiClient.getChat(workspace, chatId);
17692
+ const interrupt = chat?.interrupt;
17693
+ if (!interrupt || !interrupt.interruptId) {
17694
+ throw new Error("No pending interrupt on this chat.");
17695
+ }
17696
+ const raw = args.value;
17697
+ if (typeof raw !== "string" || !raw.length) {
17698
+ throw new Error(
17699
+ `A --value is required. For a form pass the field map as JSON, e.g. --value '{"channels":"sms,voice","days":"2"}'; for a choice list pass the chosen value.`
17700
+ );
17701
+ }
17702
+ const url = `${ctx.envConfig.apiUrl}/api/v2/w/${workspace}/chats/${chat.id}/inference/hitl`;
17703
+ const response = await fetch(url, {
17704
+ method: "POST",
17705
+ headers: {
17706
+ Authorization: `Bearer ${requireAuth(ctx).accessToken}`,
17707
+ "Content-Type": "application/json"
17708
+ },
17709
+ body: JSON.stringify({ chosenValue: raw, interruptId: interrupt.interruptId })
17710
+ });
17711
+ if (!response.ok) {
17712
+ throw new Error(
17713
+ `Resume failed (${response.status}): ${(await response.text()).slice(0, 400)}`
17714
+ );
17715
+ }
17716
+ outputSingle(
17717
+ {
17718
+ status: "resumed",
17719
+ chatId: chat.id,
17720
+ next: `gr chats inspect --id ${chat.id} -w ${workspace}`
17721
+ },
17722
+ ctx
17723
+ );
17724
+ }
17503
17725
  async function respondToInterrupt(ctx, workspace, args, decisionType) {
17504
17726
  const chatId = requireIdOrUuidFrom(args, "chat-id", "id");
17505
17727
  const chat = await requireAuth(ctx).apiClient.getChat(workspace, chatId);
@@ -17532,6 +17754,27 @@ async function respondToInterrupt(ctx, workspace, args, decisionType) {
17532
17754
  if (streamError) throw new Error(`Inference error: ${streamError}`);
17533
17755
  outputSingle({ role: "assistant", content: buffered }, ctx, MESSAGE_COLUMNS2);
17534
17756
  }
17757
+ function isDevProfile(env) {
17758
+ return env === "dev" || env === "development" || env === "local";
17759
+ }
17760
+ function isLocalApiOrigin(apiUrl) {
17761
+ if (!apiUrl) return false;
17762
+ try {
17763
+ const host = new URL(apiUrl).hostname.replace(/^\[|\]$/g, "");
17764
+ return host === "localhost" || host === "127.0.0.1" || host === "::1" || host.endsWith(".gravityrail.test");
17765
+ } catch {
17766
+ return false;
17767
+ }
17768
+ }
17769
+ async function shouldRedactChatContent(ctx, apiClient, workspace) {
17770
+ if (isDevProfile(ctx.env) && isLocalApiOrigin(ctx.envConfig?.apiUrl)) return false;
17771
+ try {
17772
+ const ws = await apiClient.getWorkspace(workspace);
17773
+ return ws.phiPostureDecision !== "allow_non_phi";
17774
+ } catch {
17775
+ return true;
17776
+ }
17777
+ }
17535
17778
  var chatsDomain = {
17536
17779
  name: "chats",
17537
17780
  description: "Manage chats",
@@ -17728,6 +17971,28 @@ var chatsDomain = {
17728
17971
  await respondToInterrupt(ctx, workspace, args, decisionType);
17729
17972
  }
17730
17973
  },
17974
+ {
17975
+ path: ["chats", "interrupt", "respond"],
17976
+ description: "Answer a chat's pending UI interrupt (form or choice list) with a value, and stream the continued reply.",
17977
+ mutates: true,
17978
+ requiresWorkspace: true,
17979
+ args: [
17980
+ {
17981
+ name: "chat-id",
17982
+ aliases: ["id"],
17983
+ description: "Chat ID (numeric id preferred; uuid accepted)",
17984
+ required: true
17985
+ },
17986
+ {
17987
+ name: "value",
17988
+ description: `The answer. For a form, the field map as JSON (e.g. '{"channels":"sms,voice","days":"2"}'); for a choice list, the chosen value.`,
17989
+ required: true
17990
+ }
17991
+ ],
17992
+ handler: async ({ ctx, workspace, args }) => {
17993
+ await respondWithValue(ctx, workspace, args);
17994
+ }
17995
+ },
17731
17996
  {
17732
17997
  path: ["chats", "interrupt", "deny"],
17733
17998
  description: "Reject a chat's pending approval request with a reason.",
@@ -17758,7 +18023,17 @@ var chatsDomain = {
17758
18023
  description: "Chat ID (numeric id preferred; uuid accepted)",
17759
18024
  required: true
17760
18025
  },
17761
- { name: "stream", description: "Stream the AI response via AG-UI", isFlag: true }
18026
+ { name: "stream", description: "Stream the AI response via AG-UI", isFlag: true },
18027
+ {
18028
+ // Read by the handler below since this command was written, but
18029
+ // never declared — so `--auto-approve` parsed as nothing and the
18030
+ // turn stopped on every tool call anyway. Driving a manager turn
18031
+ // from the CLI meant approving each exec by hand, which is why
18032
+ // multi-turn QA was impractical.
18033
+ name: "auto-approve",
18034
+ description: "Approve tool calls automatically for this turn (development QA). Capability round-trips (screenshots, browser, forms) still prompt.",
18035
+ isFlag: true
18036
+ }
17762
18037
  ],
17763
18038
  handler: async ({ ctx, workspace, args, data }) => {
17764
18039
  const content = typeof data === "string" ? data : data?.content;
@@ -17793,7 +18068,11 @@ var chatsDomain = {
17793
18068
  );
17794
18069
  process.stdout.write("\n");
17795
18070
  if (!streamed.trim()) {
17796
- await printPendingApproval(ctx, workspace, chatId);
18071
+ if (!await printPendingApproval(ctx, workspace, chatId)) {
18072
+ throw new Error(
18073
+ `No response was produced for chat ${chatId}, and no approval is pending. The inference stream ended without emitting anything \u2014 usually the turn never started.`
18074
+ );
18075
+ }
17797
18076
  }
17798
18077
  } else {
17799
18078
  const aguiClient = new AGUIClient({
@@ -17823,6 +18102,9 @@ var chatsDomain = {
17823
18102
  chatId
17824
18103
  );
17825
18104
  if (await printPendingApproval(ctx, workspace, chatId, chat)) return;
18105
+ throw new Error(
18106
+ `No response was produced for chat ${chatId}, and no approval is pending. The inference stream ended without emitting anything \u2014 usually the turn never started. Check the API log for "Inference stream timed out for key inference:${workspace}:${chatId}" and the temporal-worker log for an "inference-${workspace}-${chatId}" workflow.`
18107
+ );
17826
18108
  }
17827
18109
  outputSingle(
17828
18110
  {
@@ -17965,6 +18247,8 @@ var chatsDomain = {
17965
18247
  authed.apiClient.getChat(workspace, chatId),
17966
18248
  authed.apiClient.getChatMessages(workspace, chatId)
17967
18249
  ]);
18250
+ const redact = await shouldRedactChatContent(ctx, authed.apiClient, workspace);
18251
+ const hide = (value) => redact ? "[REDACTED]" : value;
17968
18252
  const result3 = {
17969
18253
  chat: {
17970
18254
  id: chat.id,
@@ -17980,7 +18264,7 @@ var chatsDomain = {
17980
18264
  // field projections (#20262). Always an array so the key
17981
18265
  // survives JSON serialization even when the API omits it.
17982
18266
  participants: (chat.participants ?? []).map((p) => ({
17983
- name: "[REDACTED]",
18267
+ name: hide(p.name),
17984
18268
  role: p.role,
17985
18269
  memberId: p.memberId ?? null,
17986
18270
  memberType: p.memberType ?? null
@@ -17988,11 +18272,13 @@ var chatsDomain = {
17988
18272
  },
17989
18273
  // Deliberate allow-list — never spread the API message. PHI
17990
18274
  // lives in content and (if ever added) sttMetadata.words
17991
- // (#21973); both must stay out of inspect output.
18275
+ // (#21973), so nothing beyond these three keys is emitted; the
18276
+ // content itself is gated on posture (see
18277
+ // shouldRedactChatContent), not blanket-hidden.
17992
18278
  messages: messages.map((m) => ({
17993
18279
  id: m.id,
17994
18280
  role: m.role,
17995
- content: "[REDACTED]"
18281
+ content: hide(m.content)
17996
18282
  }))
17997
18283
  };
17998
18284
  const assignmentId = chat.assignmentId;
@@ -18010,7 +18296,7 @@ var chatsDomain = {
18010
18296
  dataRecords: assignment.dataRecords?.map((dr) => ({
18011
18297
  id: dr.id,
18012
18298
  dataTypeId: dr.dataTypeId,
18013
- fieldValues: "[REDACTED]"
18299
+ fieldValues: hide(dr.fieldValues)
18014
18300
  }))
18015
18301
  };
18016
18302
  }
@@ -19370,8 +19656,6 @@ Provisioning started. Watch it come up with:
19370
19656
  "inboxes",
19371
19657
  "routines",
19372
19658
  "memberFilters",
19373
- "milestones",
19374
- "milestoneGoals",
19375
19659
  "customToolkits",
19376
19660
  "customTools",
19377
19661
  "pages",
@@ -19452,8 +19736,6 @@ Provisioning started. Watch it come up with:
19452
19736
  "inboxes",
19453
19737
  "routines",
19454
19738
  "memberFilters",
19455
- "milestones",
19456
- "milestoneGoals",
19457
19739
  "customToolkits",
19458
19740
  "customTools",
19459
19741
  "pages",
@@ -21865,9 +22147,160 @@ var journeysDomain = {
21865
22147
  ]
21866
22148
  };
21867
22149
 
21868
- // src/domains/personas.ts
22150
+ // src/domains/metrics.ts
21869
22151
  init_output();
22152
+ init_context();
22153
+ init_errors();
21870
22154
  var COLUMNS11 = [
22155
+ COL.id(),
22156
+ COL.name(),
22157
+ { header: "SLUG", getValue: (item) => item.slug ?? "" },
22158
+ { header: "TYPE", getValue: (item) => item.metricType ?? "" },
22159
+ { header: "SOURCE", getValue: (item) => item.source ?? "" },
22160
+ { header: "UNIT", getValue: (item) => item.unit ?? "" },
22161
+ {
22162
+ header: "ENABLED",
22163
+ getValue: (item) => item.enabled ? "yes" : "no"
22164
+ },
22165
+ COL.created()
22166
+ ];
22167
+ var OBS_COLUMNS = [
22168
+ COL.id(),
22169
+ { header: "VALUE", getValue: (item) => String(item.value ?? "") },
22170
+ { header: "OBSERVED_AT", getValue: (item) => item.observedAt ?? "" },
22171
+ {
22172
+ header: "CHAT_ID",
22173
+ getValue: (item) => item.chatId != null ? String(item.chatId) : ""
22174
+ },
22175
+ {
22176
+ header: "MEMBER_ID",
22177
+ getValue: (item) => item.memberId != null ? String(item.memberId) : ""
22178
+ }
22179
+ ];
22180
+ var metricsDomain = {
22181
+ name: "metrics",
22182
+ description: "Customer-defined outcome metrics (CEL expression or LLM rubric) with time-series readout",
22183
+ commands: [
22184
+ ...crudCommands({
22185
+ prefix: ["metrics"],
22186
+ entityName: "metric",
22187
+ listMethod: "listMetrics",
22188
+ getMethod: "getMetric",
22189
+ createMethod: "createMetric",
22190
+ updateMethod: "updateMetric",
22191
+ deleteMethod: "deleteMetric",
22192
+ columns: COLUMNS11,
22193
+ paginationSupport: "full",
22194
+ createExamples: [
22195
+ `yarn gr metrics create -w $WID --allow-write --data '{"name":"SMS Channel Rate","metricType":"expression","celExpression":"chat.channel == \\"phone-sms\\"","unit":"rate"}'`,
22196
+ `yarn gr metrics create -w $WID --allow-write --data '{"name":"Qualified Engagement","metricType":"rubric","evaluationPrompt":"Did the user show buying intent?","unit":"rate"}'`
22197
+ ],
22198
+ createHelp: "Create a metric definition. metricType is expression (CEL) or rubric (LLM). MVP source is chat only."
22199
+ }),
22200
+ {
22201
+ path: ["metrics", "observations"],
22202
+ description: "List raw observations for a metric in a date range (may include PHI reason)",
22203
+ args: [
22204
+ { name: "id", required: true, description: "Metric ID" },
22205
+ {
22206
+ name: "start",
22207
+ required: true,
22208
+ description: "ISO-8601 inclusive lower bound on observed_at"
22209
+ },
22210
+ {
22211
+ name: "end",
22212
+ required: true,
22213
+ description: "ISO-8601 exclusive upper bound on observed_at"
22214
+ },
22215
+ { name: "page", description: "Page number (default 1)" },
22216
+ { name: "page-size", description: "Page size (default 100)" }
22217
+ ],
22218
+ requiresWorkspace: true,
22219
+ examples: [
22220
+ "yarn gr metrics observations --id 1 --start 2026-07-01T00:00:00Z --end 2026-08-01T00:00:00Z"
22221
+ ],
22222
+ handler: async (hctx) => {
22223
+ const client = requireAuth(hctx.ctx).apiClient;
22224
+ const id = requireNumber(hctx.args, "id");
22225
+ const start = requireString(hctx.args, "start");
22226
+ const end = requireString(hctx.args, "end");
22227
+ const page = hctx.args["page"] != null ? Number(hctx.args["page"]) : void 0;
22228
+ const pageSize = hctx.args["page-size"] != null ? Number(hctx.args["page-size"]) : void 0;
22229
+ const result3 = await client.listMetricObservations(hctx.workspace, id, {
22230
+ start,
22231
+ end,
22232
+ page,
22233
+ pageSize
22234
+ });
22235
+ outputData(result3.items ?? result3, hctx.ctx, OBS_COLUMNS);
22236
+ }
22237
+ },
22238
+ {
22239
+ path: ["metrics", "series"],
22240
+ description: "Time-bucketed aggregation for a metric (numeric only)",
22241
+ args: [
22242
+ { name: "id", required: true, description: "Metric ID" },
22243
+ {
22244
+ name: "start",
22245
+ required: true,
22246
+ description: "ISO-8601 inclusive lower bound on observed_at"
22247
+ },
22248
+ {
22249
+ name: "end",
22250
+ required: true,
22251
+ description: "ISO-8601 exclusive upper bound on observed_at"
22252
+ },
22253
+ { name: "bucket", description: "day | week (default day)" },
22254
+ {
22255
+ name: "aggregation",
22256
+ description: "avg | sum | count | rate (default avg)"
22257
+ }
22258
+ ],
22259
+ requiresWorkspace: true,
22260
+ examples: [
22261
+ "yarn gr metrics series --id 1 --start 2026-07-01T00:00:00Z --end 2026-08-01T00:00:00Z --bucket day"
22262
+ ],
22263
+ handler: async (hctx) => {
22264
+ const client = requireAuth(hctx.ctx).apiClient;
22265
+ const id = requireNumber(hctx.args, "id");
22266
+ const result3 = await client.getMetricSeries(hctx.workspace, id, {
22267
+ start: requireString(hctx.args, "start"),
22268
+ end: requireString(hctx.args, "end"),
22269
+ bucket: hctx.args["bucket"] ?? "day",
22270
+ aggregation: hctx.args["aggregation"] ?? "avg"
22271
+ });
22272
+ outputSingle(result3, hctx.ctx);
22273
+ }
22274
+ },
22275
+ {
22276
+ path: ["metrics", "compute-for-chat"],
22277
+ description: "On-demand evaluate enabled chat-source metrics for one chat (writes observations + dual-write feedback)",
22278
+ args: [
22279
+ {
22280
+ name: "chat-id",
22281
+ required: true,
22282
+ description: "Chat ID to evaluate"
22283
+ }
22284
+ ],
22285
+ requiresWorkspace: true,
22286
+ mutates: true,
22287
+ examples: ["yarn gr metrics compute-for-chat --chat-id 42 --allow-write"],
22288
+ handler: async (hctx) => {
22289
+ const client = requireAuth(hctx.ctx).apiClient;
22290
+ const chatId = requireNumber(hctx.args, "chat-id");
22291
+ if (chatId < 1) {
22292
+ throw new CLIError("--chat-id must be a positive number");
22293
+ }
22294
+ const result3 = await client.computeChatMetrics(hctx.workspace, { chatId });
22295
+ outputSingle(result3, hctx.ctx);
22296
+ }
22297
+ }
22298
+ ]
22299
+ };
22300
+
22301
+ // src/domains/personas.ts
22302
+ init_output();
22303
+ var COLUMNS12 = [
21871
22304
  COL.id(),
21872
22305
  COL.name(),
21873
22306
  { header: "AGE", getValue: (item) => item.age != null ? String(item.age) : "" },
@@ -21897,7 +22330,7 @@ var personasDomain = {
21897
22330
  createMethod: "createPersona",
21898
22331
  updateMethod: "updatePersona",
21899
22332
  deleteMethod: "deletePersona",
21900
- columns: COLUMNS11,
22333
+ columns: COLUMNS12,
21901
22334
  paginationSupport: "full"
21902
22335
  })
21903
22336
  ]
@@ -21956,11 +22389,11 @@ function shuffleInPlace(items) {
21956
22389
  }
21957
22390
  return items;
21958
22391
  }
21959
- function buildModelEvalBatchJobs(scenarios, models, rounds, warmup) {
22392
+ function buildModelEvalBatchJobs(scenarios, models, rounds, warmup, realtimeModels = []) {
21960
22393
  if (scenarios.length === 0) {
21961
22394
  throw new CLIError("At least one scenario is required");
21962
22395
  }
21963
- if (models.length === 0) {
22396
+ if (models.length === 0 && realtimeModels.length === 0) {
21964
22397
  throw new CLIError("At least one model is required");
21965
22398
  }
21966
22399
  if (rounds < 1) {
@@ -21981,12 +22414,60 @@ function buildModelEvalBatchJobs(scenarios, models, rounds, warmup) {
21981
22414
  modelId
21982
22415
  });
21983
22416
  }
22417
+ for (const modelId of realtimeModels) {
22418
+ roundJobs.push({
22419
+ round,
22420
+ warmup: warm,
22421
+ scenarioId: scenario.id,
22422
+ scenarioSlug: scenario.slug,
22423
+ scenarioName: scenario.name,
22424
+ modelId,
22425
+ realtime: true
22426
+ });
22427
+ }
21984
22428
  }
21985
22429
  shuffleInPlace(roundJobs);
21986
22430
  jobs.push(...roundJobs);
21987
22431
  }
21988
22432
  return jobs;
21989
22433
  }
22434
+ var REALTIME_AUDIO_USD_PER_MIN = {
22435
+ "xai:realtime:voice-agent": 0.05,
22436
+ // Grok Voice Think Fast 1
22437
+ "xai:realtime:voice-agent-2": 0.08
22438
+ // Grok Voice Think Fast 2
22439
+ };
22440
+ var DEFAULT_REALTIME_AUDIO_USD_PER_MIN = 0.08;
22441
+ var EST_AUDIO_MIN_PER_RUN = 3;
22442
+ var EST_TEXT_USD_PER_RUN = 0.012;
22443
+ function realtimeAudioUsdPerMin(modelId) {
22444
+ return REALTIME_AUDIO_USD_PER_MIN[modelId] ?? DEFAULT_REALTIME_AUDIO_USD_PER_MIN;
22445
+ }
22446
+ function estimateRealtimeRunCostUsd(modelId) {
22447
+ return EST_AUDIO_MIN_PER_RUN * realtimeAudioUsdPerMin(modelId) + EST_TEXT_USD_PER_RUN;
22448
+ }
22449
+ function projectRealtimeBatchCostUsd(jobs) {
22450
+ return jobs.filter((j) => j.realtime).reduce((sum, j) => sum + estimateRealtimeRunCostUsd(j.modelId), 0);
22451
+ }
22452
+ function actualRealtimeRowCostUsd(row, modelId) {
22453
+ const summary = row.timing_summary;
22454
+ const audioMs = summary ? summary["audio_output_ms_total"] : void 0;
22455
+ if (typeof audioMs === "number" && Number.isFinite(audioMs) && audioMs >= 0) {
22456
+ return audioMs / 6e4 * realtimeAudioUsdPerMin(modelId) + EST_TEXT_USD_PER_RUN;
22457
+ }
22458
+ return estimateRealtimeRunCostUsd(modelId);
22459
+ }
22460
+ function parseMaxBudgetUsd(raw, flagName) {
22461
+ if (raw === void 0 || raw === null || raw === "") {
22462
+ return void 0;
22463
+ }
22464
+ const value = Number(raw);
22465
+ if (!Number.isFinite(value) || value <= 0) {
22466
+ throw new CLIError(`${flagName} must be a positive number of USD`);
22467
+ }
22468
+ return value;
22469
+ }
22470
+ var REALTIME_MAX_CONCURRENCY = 4;
21990
22471
  function summarizeCriterionResults(run) {
21991
22472
  if (!run.criterionResults?.length) return void 0;
21992
22473
  return run.criterionResults.map((c) => ({
@@ -21995,7 +22476,7 @@ function summarizeCriterionResults(run) {
21995
22476
  score: c.score ?? null
21996
22477
  }));
21997
22478
  }
21998
- function runToBatchRow(job, workflowId, run, error) {
22479
+ function runToBatchRow(job, workflowId, run, error, batchLabel) {
21999
22480
  return {
22000
22481
  ts: (/* @__PURE__ */ new Date()).toISOString(),
22001
22482
  round: job.round,
@@ -22005,6 +22486,8 @@ function runToBatchRow(job, workflowId, run, error) {
22005
22486
  scenario_slug: job.scenarioSlug,
22006
22487
  scenario_name: job.scenarioName,
22007
22488
  model_id: job.modelId,
22489
+ ...job.realtime ? { realtime_model_id: job.modelId } : {},
22490
+ ...batchLabel ? { batch_label: batchLabel } : {},
22008
22491
  run_id: run?.id,
22009
22492
  error,
22010
22493
  failure_reason: run?.failureReason ?? null,
@@ -22059,7 +22542,10 @@ async function executeModelEvalJob(api, options, job, waitTimeoutMs, pollMs, sle
22059
22542
  const started = await api.startTestChatRun(options.workspace, options.workflowId, {
22060
22543
  scenarioId: job.scenarioId,
22061
22544
  driver: DriverMode.AUTO,
22062
- assistantChatModelId: job.modelId
22545
+ ...job.realtime ? {
22546
+ assistantRealtimeModelId: job.modelId,
22547
+ ...options.realtimeConfig ? { assistantRealtimeModelConfig: options.realtimeConfig } : {}
22548
+ } : { assistantChatModelId: job.modelId }
22063
22549
  });
22064
22550
  let run = await waitForRunTerminal(
22065
22551
  api,
@@ -22080,10 +22566,10 @@ async function executeModelEvalJob(api, options, job, waitTimeoutMs, pollMs, sle
22080
22566
  sleep
22081
22567
  );
22082
22568
  }
22083
- return runToBatchRow(job, options.workflowId, run);
22569
+ return runToBatchRow(job, options.workflowId, run, void 0, options.batchLabel);
22084
22570
  } catch (e) {
22085
22571
  const message = e instanceof Error ? e.message : String(e);
22086
- return runToBatchRow(job, options.workflowId, null, message);
22572
+ return runToBatchRow(job, options.workflowId, null, message, options.batchLabel);
22087
22573
  }
22088
22574
  }
22089
22575
  function createSpacingGate(spacingSec, sleep) {
@@ -22101,56 +22587,99 @@ function createSpacingGate(spacingSec, sleep) {
22101
22587
  }
22102
22588
  async function executeModelEvalBatch(api, options) {
22103
22589
  const sleep = options.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
22104
- const concurrency = options.concurrency ?? 1;
22105
22590
  const jobs = buildModelEvalBatchJobs(
22106
22591
  options.scenarios,
22107
22592
  options.models,
22108
22593
  options.rounds,
22109
- options.warmup
22594
+ options.warmup,
22595
+ options.realtimeModels ?? []
22110
22596
  );
22111
22597
  const waitTimeoutMs = options.waitTimeoutSec * 1e3;
22112
22598
  const pollMs = options.pollIntervalSec * 1e3;
22113
22599
  const rows = [];
22114
22600
  let stopBatch = false;
22601
+ let budgetStopped = false;
22602
+ let actualSpendUsd = 0;
22115
22603
  const awaitSpacing = createSpacingGate(options.spacingSec, sleep);
22604
+ const emitProgress = (line) => {
22605
+ if (options.onProgress) {
22606
+ options.onProgress(line);
22607
+ } else {
22608
+ process.stdout.write(`${line}
22609
+ `);
22610
+ }
22611
+ };
22612
+ const realtimeJobCount = jobs.filter((j) => j.realtime).length;
22613
+ let concurrency = options.concurrency ?? 1;
22614
+ if (realtimeJobCount > 0 && concurrency > REALTIME_MAX_CONCURRENCY) {
22615
+ emitProgress(
22616
+ `concurrency clamped ${concurrency} -> ${REALTIME_MAX_CONCURRENCY} (realtime models share the provider session pool)`
22617
+ );
22618
+ concurrency = REALTIME_MAX_CONCURRENCY;
22619
+ }
22620
+ if (realtimeJobCount > 0) {
22621
+ const projectedUsd = projectRealtimeBatchCostUsd(jobs);
22622
+ const cap = options.maxBudgetUsd;
22623
+ emitProgress(
22624
+ `realtime budget: projected ~$${projectedUsd.toFixed(2)} for ${realtimeJobCount} realtime run(s)${cap != null ? ` (cap $${cap.toFixed(2)})` : ""}`
22625
+ );
22626
+ if (cap != null && projectedUsd > cap) {
22627
+ throw new CLIError(
22628
+ `Batch aborted before dispatch: projected realtime cost $${projectedUsd.toFixed(2)} exceeds --max-budget-usd $${cap.toFixed(2)}. Reduce rounds/scenarios/models or raise the cap.`
22629
+ );
22630
+ }
22631
+ }
22116
22632
  const recordRow = (job, row) => {
22117
22633
  rows.push(row);
22118
22634
  if (options.outPath) {
22119
22635
  appendFileSync(options.outPath, `${JSON.stringify(row)}
22120
22636
  `);
22121
22637
  }
22122
- const progress = formatBatchProgressLine(job, row);
22123
- if (options.onProgress) {
22124
- options.onProgress(progress);
22125
- } else {
22126
- process.stdout.write(`${progress}
22127
- `);
22128
- }
22638
+ emitProgress(formatBatchProgressLine(job, row));
22129
22639
  };
22640
+ const makeSkippedRow = (job) => ({
22641
+ ...runToBatchRow(
22642
+ job,
22643
+ options.workflowId,
22644
+ null,
22645
+ budgetStopped ? "batch stopped: realtime budget cap reached" : "batch aborted before start",
22646
+ options.batchLabel
22647
+ ),
22648
+ batch_skipped: true
22649
+ });
22130
22650
  const runOne = async (job) => {
22131
22651
  await awaitSpacing();
22132
22652
  if (stopBatch) {
22133
- return {
22134
- ...runToBatchRow(job, options.workflowId, null, "batch aborted before start"),
22135
- batch_skipped: true
22136
- };
22653
+ return makeSkippedRow(job);
22137
22654
  }
22138
22655
  const row = await executeModelEvalJob(api, options, job, waitTimeoutMs, pollMs, sleep);
22139
22656
  if (isConfigurationBlockerFailure(row.failure_reason)) {
22140
22657
  stopBatch = true;
22141
22658
  }
22659
+ if (job.realtime && !row.batch_skipped) {
22660
+ actualSpendUsd += actualRealtimeRowCostUsd(row, job.modelId);
22661
+ if (options.maxBudgetUsd != null && actualSpendUsd >= options.maxBudgetUsd && !stopBatch) {
22662
+ stopBatch = true;
22663
+ budgetStopped = true;
22664
+ emitProgress(
22665
+ `realtime budget: actual spend ~$${actualSpendUsd.toFixed(2)} reached cap $${options.maxBudgetUsd.toFixed(2)} \u2014 stopping dispatch`
22666
+ );
22667
+ }
22668
+ }
22142
22669
  return row;
22143
22670
  };
22144
22671
  if (concurrency <= 1) {
22145
- for (const job of jobs) {
22672
+ let stoppedAt = jobs.length;
22673
+ for (const [index, job] of jobs.entries()) {
22146
22674
  if (stopBatch) {
22675
+ stoppedAt = index;
22147
22676
  break;
22148
22677
  }
22149
22678
  const row = await runOne(job);
22150
22679
  recordRow(job, row);
22151
- if (stopBatch) {
22152
- break;
22153
- }
22680
+ }
22681
+ for (const job of jobs.slice(stoppedAt)) {
22682
+ recordRow(job, makeSkippedRow(job));
22154
22683
  }
22155
22684
  } else {
22156
22685
  const results = new Array(jobs.length);
@@ -22166,6 +22695,9 @@ async function executeModelEvalBatch(api, options) {
22166
22695
  return;
22167
22696
  }
22168
22697
  const job = jobs[index];
22698
+ if (job === void 0) {
22699
+ return;
22700
+ }
22169
22701
  const row = await runOne(job);
22170
22702
  results[index] = row;
22171
22703
  recordRow(job, row);
@@ -22174,20 +22706,19 @@ async function executeModelEvalBatch(api, options) {
22174
22706
  const workers = Array.from({ length: Math.min(concurrency, jobs.length) }, () => worker());
22175
22707
  await Promise.all(workers);
22176
22708
  if (stopBatch) {
22177
- for (let index = 0; index < jobs.length; index++) {
22709
+ jobs.forEach((job, index) => {
22178
22710
  if (results[index] !== void 0) {
22179
- continue;
22711
+ return;
22180
22712
  }
22181
- const job = jobs[index];
22182
- const skipped = {
22183
- ...runToBatchRow(job, options.workflowId, null, "batch aborted before start"),
22184
- batch_skipped: true
22185
- };
22713
+ const skipped = makeSkippedRow(job);
22186
22714
  results[index] = skipped;
22187
22715
  recordRow(job, skipped);
22188
- }
22716
+ });
22189
22717
  }
22190
22718
  }
22719
+ if (realtimeJobCount > 0) {
22720
+ emitProgress(`realtime budget: total actual spend ~$${actualSpendUsd.toFixed(2)}`);
22721
+ }
22191
22722
  const blockerRow = rows.find((r) => isConfigurationBlockerFailure(r.failure_reason));
22192
22723
  if (blockerRow) {
22193
22724
  throw new CLIError(
@@ -22489,9 +23020,29 @@ var qualificationsDomain = {
22489
23020
  { name: "workflow-id", description: "Workflow ID", required: true },
22490
23021
  {
22491
23022
  name: "models",
22492
- description: "Comma-separated assistant chat model IDs",
23023
+ description: "Comma-separated assistant chat model IDs (optional with --realtime-models)",
22493
23024
  alias: "m",
22494
- required: true
23025
+ required: false
23026
+ },
23027
+ {
23028
+ name: "realtime-models",
23029
+ description: "Comma-separated native realtime model IDs (each forwarded as assistantRealtimeModelId)",
23030
+ required: false
23031
+ },
23032
+ {
23033
+ name: "realtime-config",
23034
+ description: "JSON object forwarded as assistantRealtimeModelConfig on realtime jobs",
23035
+ required: false
23036
+ },
23037
+ {
23038
+ name: "batch-label",
23039
+ description: "Label recorded on every JSONL row for cross-batch comparison",
23040
+ required: false
23041
+ },
23042
+ {
23043
+ name: "max-budget-usd",
23044
+ description: "Dispatch cap in USD on realtime spend: abort if pre-flight projection exceeds it, stop dispatching when actuals cross it (in-flight runs still finish and bill)",
23045
+ required: false
22495
23046
  },
22496
23047
  {
22497
23048
  name: "scenario-ids",
@@ -22531,7 +23082,31 @@ var qualificationsDomain = {
22531
23082
  { name: "out", description: "Append JSONL rows to this file" }
22532
23083
  ],
22533
23084
  handler: async ({ ctx, workspace, args }) => {
22534
- const models = parseCommaSeparatedList(requireString(args, "models"), "--models");
23085
+ const models = args.models ? parseCommaSeparatedList(String(args.models), "--models") : [];
23086
+ const realtimeModels = args["realtime-models"] ? parseCommaSeparatedList(String(args["realtime-models"]), "--realtime-models") : [];
23087
+ if (models.length === 0 && realtimeModels.length === 0) {
23088
+ throw new CLIError("Specify --models and/or --realtime-models");
23089
+ }
23090
+ let realtimeConfig;
23091
+ if (args["realtime-config"]) {
23092
+ if (realtimeModels.length === 0) {
23093
+ throw new CLIError("--realtime-config requires --realtime-models");
23094
+ }
23095
+ let parsed;
23096
+ try {
23097
+ parsed = JSON.parse(String(args["realtime-config"]));
23098
+ } catch {
23099
+ throw new CLIError("--realtime-config is not valid JSON");
23100
+ }
23101
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
23102
+ throw new CLIError(
23103
+ "--realtime-config must be a JSON object (not an array or null)"
23104
+ );
23105
+ }
23106
+ realtimeConfig = parsed;
23107
+ }
23108
+ const batchLabel = args["batch-label"] ? String(args["batch-label"]) : void 0;
23109
+ const maxBudgetUsd = parseMaxBudgetUsd(args["max-budget-usd"], "--max-budget-usd");
22535
23110
  const allScenarios = Boolean(args["all-scenarios"]);
22536
23111
  const scenarioIdsRaw = args["scenario-ids"];
22537
23112
  if (allScenarios && scenarioIdsRaw) {
@@ -22572,6 +23147,10 @@ var qualificationsDomain = {
22572
23147
  workspace,
22573
23148
  workflowId,
22574
23149
  models,
23150
+ realtimeModels,
23151
+ realtimeConfig,
23152
+ batchLabel,
23153
+ maxBudgetUsd,
22575
23154
  scenarios,
22576
23155
  rounds,
22577
23156
  warmup,
@@ -22888,7 +23467,7 @@ Relations (relationMatch): ${relations.join(", ")}`);
22888
23467
  };
22889
23468
  init_output();
22890
23469
  init_context();
22891
- var COLUMNS12 = [
23470
+ var COLUMNS13 = [
22892
23471
  COL.id(),
22893
23472
  COL.name(),
22894
23473
  { header: "SLUG", getValue: (item) => item.slug ?? "" },
@@ -22942,7 +23521,7 @@ var sitesDomain = {
22942
23521
  createMethod: "createSite",
22943
23522
  updateMethod: "updateSite",
22944
23523
  deleteMethod: "deleteSite",
22945
- columns: COLUMNS12
23524
+ columns: COLUMNS13
22946
23525
  }),
22947
23526
  // Pages sub-resource
22948
23527
  {
@@ -23616,7 +24195,7 @@ var abilitiesDomain = {
23616
24195
  init_output();
23617
24196
  init_pagination();
23618
24197
  init_context();
23619
- var COLUMNS13 = [
24198
+ var COLUMNS14 = [
23620
24199
  COL.id(),
23621
24200
  COL.status(),
23622
24201
  { header: "GRANTOR", getValue: (item) => String(item.grantorMemberId ?? "") },
@@ -23633,7 +24212,7 @@ var accessGrantsDomain = {
23633
24212
  requiresWorkspace: true,
23634
24213
  handler: async ({ ctx, workspace }) => {
23635
24214
  const result3 = await requireAuth(ctx).apiClient.getAccessGrants(workspace);
23636
- outputData(listResult(result3, false), ctx, COLUMNS13);
24215
+ outputData(listResult(result3, false), ctx, COLUMNS14);
23637
24216
  }
23638
24217
  },
23639
24218
  {
@@ -23646,7 +24225,7 @@ var accessGrantsDomain = {
23646
24225
  workspace,
23647
24226
  requireString(args, "id")
23648
24227
  );
23649
- outputSingle(result3, ctx, COLUMNS13);
24228
+ outputSingle(result3, ctx, COLUMNS14);
23650
24229
  }
23651
24230
  },
23652
24231
  {
@@ -23659,7 +24238,7 @@ var accessGrantsDomain = {
23659
24238
  workspace,
23660
24239
  data
23661
24240
  );
23662
- outputSingle(result3, ctx, COLUMNS13);
24241
+ outputSingle(result3, ctx, COLUMNS14);
23663
24242
  }
23664
24243
  },
23665
24244
  {
@@ -23670,7 +24249,7 @@ var accessGrantsDomain = {
23670
24249
  const result3 = await requireAuth(ctx).apiClient.getMyReceivedGrants(workspace, {
23671
24250
  pageSize: 200
23672
24251
  });
23673
- outputData(listResult(result3, false), ctx, COLUMNS13);
24252
+ outputData(listResult(result3, false), ctx, COLUMNS14);
23674
24253
  }
23675
24254
  },
23676
24255
  {
@@ -23681,7 +24260,7 @@ var accessGrantsDomain = {
23681
24260
  const result3 = await requireAuth(ctx).apiClient.getMyGivenGrants(workspace, {
23682
24261
  pageSize: 200
23683
24262
  });
23684
- outputData(listResult(result3, false), ctx, COLUMNS13);
24263
+ outputData(listResult(result3, false), ctx, COLUMNS14);
23685
24264
  }
23686
24265
  },
23687
24266
  {
@@ -23696,7 +24275,7 @@ var accessGrantsDomain = {
23696
24275
  requireString(args, "id"),
23697
24276
  data ?? {}
23698
24277
  );
23699
- outputSingle(result3, ctx, COLUMNS13);
24278
+ outputSingle(result3, ctx, COLUMNS14);
23700
24279
  }
23701
24280
  },
23702
24281
  {
@@ -23711,7 +24290,7 @@ var accessGrantsDomain = {
23711
24290
  requireString(args, "id"),
23712
24291
  data ?? {}
23713
24292
  );
23714
- outputSingle(result3, ctx, COLUMNS13);
24293
+ outputSingle(result3, ctx, COLUMNS14);
23715
24294
  }
23716
24295
  },
23717
24296
  {
@@ -23724,7 +24303,7 @@ var accessGrantsDomain = {
23724
24303
  workspace,
23725
24304
  requireNumber(args, "member-id")
23726
24305
  );
23727
- outputData(listResult(result3, false), ctx, COLUMNS13);
24306
+ outputData(listResult(result3, false), ctx, COLUMNS14);
23728
24307
  }
23729
24308
  },
23730
24309
  {
@@ -23749,7 +24328,7 @@ var accessGrantsDomain = {
23749
24328
  pageSize: 200
23750
24329
  }
23751
24330
  );
23752
- outputData(listResult(result3, false), ctx, COLUMNS13);
24331
+ outputData(listResult(result3, false), ctx, COLUMNS14);
23753
24332
  }
23754
24333
  }
23755
24334
  ]
@@ -23758,7 +24337,7 @@ var accessGrantsDomain = {
23758
24337
  // src/domains/ai-models.ts
23759
24338
  init_output();
23760
24339
  init_context();
23761
- var COLUMNS14 = [
24340
+ var COLUMNS15 = [
23762
24341
  { header: "ID", getValue: (item) => String(item.id ?? item.modelId ?? "") },
23763
24342
  { header: "NAME", getValue: (item) => item.name ?? item.displayName ?? "" },
23764
24343
  { header: "PROVIDER", getValue: (item) => item.provider ?? "" },
@@ -23774,7 +24353,7 @@ var aiModelsDomain = {
23774
24353
  requiresWorkspace: false,
23775
24354
  handler: async ({ ctx }) => {
23776
24355
  const result3 = await requireAuth(ctx).apiClient.getAllModels();
23777
- outputData(result3, ctx, COLUMNS14);
24356
+ outputData(result3, ctx, COLUMNS15);
23778
24357
  }
23779
24358
  },
23780
24359
  {
@@ -23783,7 +24362,7 @@ var aiModelsDomain = {
23783
24362
  requiresWorkspace: false,
23784
24363
  handler: async ({ ctx }) => {
23785
24364
  const result3 = await requireAuth(ctx).apiClient.getChatModels();
23786
- outputData(result3, ctx, COLUMNS14);
24365
+ outputData(result3, ctx, COLUMNS15);
23787
24366
  }
23788
24367
  },
23789
24368
  {
@@ -23792,7 +24371,7 @@ var aiModelsDomain = {
23792
24371
  requiresWorkspace: false,
23793
24372
  handler: async ({ ctx }) => {
23794
24373
  const result3 = await requireAuth(ctx).apiClient.getRealtimeModels();
23795
- outputData(result3, ctx, COLUMNS14);
24374
+ outputData(result3, ctx, COLUMNS15);
23796
24375
  }
23797
24376
  },
23798
24377
  {
@@ -23801,7 +24380,7 @@ var aiModelsDomain = {
23801
24380
  requiresWorkspace: false,
23802
24381
  handler: async ({ ctx }) => {
23803
24382
  const result3 = await requireAuth(ctx).apiClient.getVoiceModels();
23804
- outputData(result3, ctx, COLUMNS14);
24383
+ outputData(result3, ctx, COLUMNS15);
23805
24384
  }
23806
24385
  }
23807
24386
  ]
@@ -23810,7 +24389,7 @@ var aiModelsDomain = {
23810
24389
  // src/domains/api-keys.ts
23811
24390
  init_output();
23812
24391
  init_context();
23813
- var COLUMNS15 = [
24392
+ var COLUMNS16 = [
23814
24393
  COL.id(),
23815
24394
  COL.name(),
23816
24395
  { header: "PREFIX", getValue: (item) => item.prefix ?? "" },
@@ -23833,7 +24412,7 @@ var apiKeysDomain = {
23833
24412
  requiresWorkspace: true,
23834
24413
  handler: async ({ ctx, workspace }) => {
23835
24414
  const result3 = await requireAuth(ctx).apiClient.getApiKeys(workspace);
23836
- outputData(result3, ctx, COLUMNS15);
24415
+ outputData(result3, ctx, COLUMNS16);
23837
24416
  }
23838
24417
  },
23839
24418
  {
@@ -23868,7 +24447,7 @@ var apiKeysDomain = {
23868
24447
  requiresWorkspace: false,
23869
24448
  handler: async ({ ctx }) => {
23870
24449
  const result3 = await requireAuth(ctx).apiClient.getGlobalApiKeys();
23871
- outputData(result3, ctx, COLUMNS15);
24450
+ outputData(result3, ctx, COLUMNS16);
23872
24451
  }
23873
24452
  },
23874
24453
  {
@@ -24534,7 +25113,7 @@ var conciergeDomain = {
24534
25113
  init_errors();
24535
25114
  init_output();
24536
25115
  init_context();
24537
- var COLUMNS16 = [COL.id(), COL.name(), COL.description(), COL.enabled()];
25116
+ var COLUMNS17 = [COL.id(), COL.name(), COL.description(), COL.enabled()];
24538
25117
  var TOOL_COLUMNS2 = [COL.id(), COL.name(), COL.description()];
24539
25118
  var customToolkitsDomain = {
24540
25119
  name: "custom-toolkits",
@@ -24548,7 +25127,7 @@ var customToolkitsDomain = {
24548
25127
  createMethod: "createCustomToolkit",
24549
25128
  updateMethod: "updateCustomToolkit",
24550
25129
  deleteMethod: "deleteCustomToolkit",
24551
- columns: COLUMNS16
25130
+ columns: COLUMNS17
24552
25131
  }),
24553
25132
  {
24554
25133
  path: ["custom-toolkits", "enable"],
@@ -24561,7 +25140,7 @@ var customToolkitsDomain = {
24561
25140
  workspace,
24562
25141
  requireNumber(args, "id")
24563
25142
  );
24564
- outputSingle(result3, ctx, COLUMNS16);
25143
+ outputSingle(result3, ctx, COLUMNS17);
24565
25144
  }
24566
25145
  },
24567
25146
  {
@@ -24575,7 +25154,7 @@ var customToolkitsDomain = {
24575
25154
  workspace,
24576
25155
  requireNumber(args, "id")
24577
25156
  );
24578
- outputSingle(result3, ctx, COLUMNS16);
25157
+ outputSingle(result3, ctx, COLUMNS17);
24579
25158
  }
24580
25159
  },
24581
25160
  // Tools — nested resource requiring toolkitId
@@ -24693,7 +25272,7 @@ var docsDomain = {
24693
25272
  // src/domains/features.ts
24694
25273
  init_output();
24695
25274
  init_context();
24696
- var COLUMNS17 = [
25275
+ var COLUMNS18 = [
24697
25276
  { header: "SLUG", getValue: (item) => item.slug ?? "" },
24698
25277
  COL.name(),
24699
25278
  COL.description()
@@ -24708,7 +25287,7 @@ var featuresDomain = {
24708
25287
  requiresWorkspace: false,
24709
25288
  handler: async ({ ctx }) => {
24710
25289
  const result3 = await requireAuth(ctx).apiClient.getFeatureRegistry();
24711
- outputData(result3, ctx, COLUMNS17);
25290
+ outputData(result3, ctx, COLUMNS18);
24712
25291
  }
24713
25292
  },
24714
25293
  {
@@ -24720,7 +25299,7 @@ var featuresDomain = {
24720
25299
  const result3 = await requireAuth(ctx).apiClient.getFeatureBySlug(
24721
25300
  requireString(args, "slug")
24722
25301
  );
24723
- outputSingle(result3, ctx, COLUMNS17);
25302
+ outputSingle(result3, ctx, COLUMNS18);
24724
25303
  }
24725
25304
  },
24726
25305
  {
@@ -24729,7 +25308,7 @@ var featuresDomain = {
24729
25308
  requiresWorkspace: true,
24730
25309
  handler: async ({ ctx }) => {
24731
25310
  const result3 = await requireAuth(ctx).apiClient.getAvailableWorkspaceFeatures();
24732
- outputData(result3, ctx, COLUMNS17);
25311
+ outputData(result3, ctx, COLUMNS18);
24733
25312
  }
24734
25313
  }
24735
25314
  ]
@@ -24738,7 +25317,7 @@ var featuresDomain = {
24738
25317
  // src/domains/inboxes.ts
24739
25318
  init_output();
24740
25319
  init_context();
24741
- var COLUMNS18 = [
25320
+ var COLUMNS19 = [
24742
25321
  COL.id(),
24743
25322
  COL.name(),
24744
25323
  { header: "EMAIL", getValue: (item) => item.emailAddress ?? "" },
@@ -24763,7 +25342,7 @@ var inboxesDomain = {
24763
25342
  createMethod: "createInbox",
24764
25343
  updateMethod: "updateInbox",
24765
25344
  deleteMethod: "deleteInbox",
24766
- columns: COLUMNS18
25345
+ columns: COLUMNS19
24767
25346
  }),
24768
25347
  {
24769
25348
  path: ["inboxes", "emails", "list"],
@@ -24850,7 +25429,7 @@ var inboxesDomain = {
24850
25429
  // src/domains/mcp-servers.ts
24851
25430
  init_output();
24852
25431
  init_context();
24853
- var COLUMNS19 = [
25432
+ var COLUMNS20 = [
24854
25433
  COL.id(),
24855
25434
  COL.name(),
24856
25435
  { header: "URL", getValue: (item) => item.url ?? "" },
@@ -24868,7 +25447,7 @@ var mcpServersDomain = {
24868
25447
  createMethod: "createMcpServer",
24869
25448
  updateMethod: "updateMcpServer",
24870
25449
  deleteMethod: "deleteMcpServer",
24871
- columns: COLUMNS19
25450
+ columns: COLUMNS20
24872
25451
  }),
24873
25452
  {
24874
25453
  path: ["mcp-servers", "enable"],
@@ -24881,7 +25460,7 @@ var mcpServersDomain = {
24881
25460
  workspace,
24882
25461
  requireNumber(args, "id")
24883
25462
  );
24884
- outputSingle(result3, ctx, COLUMNS19);
25463
+ outputSingle(result3, ctx, COLUMNS20);
24885
25464
  }
24886
25465
  },
24887
25466
  {
@@ -24895,7 +25474,7 @@ var mcpServersDomain = {
24895
25474
  workspace,
24896
25475
  requireNumber(args, "id")
24897
25476
  );
24898
- outputSingle(result3, ctx, COLUMNS19);
25477
+ outputSingle(result3, ctx, COLUMNS20);
24899
25478
  }
24900
25479
  },
24901
25480
  {
@@ -24918,7 +25497,7 @@ var mcpServersDomain = {
24918
25497
  init_output();
24919
25498
  init_pagination();
24920
25499
  init_context();
24921
- var COLUMNS20 = [
25500
+ var COLUMNS21 = [
24922
25501
  { header: "KEY", getValue: (item) => item.key ?? "" },
24923
25502
  { header: "TYPE", getValue: (item) => item.type ?? "basic" },
24924
25503
  { header: "DESCRIPTION", getValue: (item) => truncate(item.description ?? "", 60) },
@@ -24952,7 +25531,7 @@ var memberMemoriesDomain = {
24952
25531
  type,
24953
25532
  query
24954
25533
  });
24955
- outputData(listResult(result3, false), ctx, COLUMNS20);
25534
+ outputData(listResult(result3, false), ctx, COLUMNS21);
24956
25535
  }
24957
25536
  },
24958
25537
  {
@@ -24971,7 +25550,7 @@ var memberMemoriesDomain = {
24971
25550
  memberId,
24972
25551
  key
24973
25552
  );
24974
- outputData(result3, ctx, COLUMNS20);
25553
+ outputData(result3, ctx, COLUMNS21);
24975
25554
  }
24976
25555
  },
24977
25556
  {
@@ -25002,7 +25581,7 @@ var memberMemoriesDomain = {
25002
25581
  ...priority !== void 0 && { priority }
25003
25582
  }
25004
25583
  );
25005
- outputData(result3, ctx, COLUMNS20);
25584
+ outputData(result3, ctx, COLUMNS21);
25006
25585
  }
25007
25586
  },
25008
25587
  {
@@ -25035,35 +25614,58 @@ var memberMemoriesDomain = {
25035
25614
  ]
25036
25615
  };
25037
25616
 
25038
- // src/domains/milestones.ts
25617
+ // src/domains/intervention-requests.ts
25039
25618
  init_output();
25040
- var COLUMNS21 = [
25619
+ var COLUMNS22 = [
25041
25620
  COL.id(),
25042
- COL.name(),
25043
- COL.status(),
25044
- { header: "DUE DATE", getValue: (item) => item.dueDate ?? "" }
25621
+ { header: "KIND", getValue: (item) => item.kind ?? "" },
25622
+ { header: "CHAT", getValue: (item) => item.chatId ?? "" },
25623
+ {
25624
+ header: "STATUS",
25625
+ getValue: (item) => item.resolvedAt ? item.resolution ?? "resolved" : "open"
25626
+ },
25627
+ // Zero is the interesting value: the intervention was requested and nobody
25628
+ // was told, which is what `--unrouted` filters for.
25629
+ { header: "NOTIFIED", getValue: (item) => item.notifiedCount ?? 0 },
25630
+ { header: "REASON", getValue: (item) => item.reasonCode ?? "" },
25631
+ { header: "CREATED", getValue: (item) => item.createdAt ?? "" }
25045
25632
  ];
25046
- var milestonesDomain = {
25047
- name: "milestones",
25048
- description: "Manage milestones",
25633
+ var interventionRequestsDomain = {
25634
+ name: "interventions",
25635
+ description: "Inspect intervention requests \u2014 escalations and other asks for a person",
25049
25636
  commands: [
25050
- ...crudCommands({
25051
- prefix: ["milestones"],
25052
- entityName: "milestone",
25053
- listMethod: "getMilestones",
25054
- getMethod: "getMilestone",
25055
- createMethod: "createMilestone",
25056
- updateMethod: "updateMilestone",
25057
- deleteMethod: "deleteMilestone",
25058
- columns: COLUMNS21,
25059
- paginationSupport: "full"
25060
- })
25637
+ {
25638
+ path: ["interventions", "list"],
25639
+ description: "List intervention requests (escalations etc). Newest first. Read-only.",
25640
+ requiresWorkspace: true,
25641
+ args: [
25642
+ { name: "kind", description: "escalation | contributor_input | approval" },
25643
+ { name: "open", description: "Only unresolved requests", isFlag: true },
25644
+ { name: "chat-id", description: "Only requests for this chat" },
25645
+ {
25646
+ name: "unrouted",
25647
+ description: "Only requests that notified NOBODY \u2014 escalations that reached no one",
25648
+ isFlag: true
25649
+ },
25650
+ { name: "limit", description: "Max rows (default 50, max 200)" }
25651
+ ],
25652
+ handler: async ({ ctx, workspace, args, requireAuth: requireAuth2, outputData: outputData2 }) => {
25653
+ const result3 = await requireAuth2(ctx).apiClient.getInterventionRequests(workspace, {
25654
+ kind: args["kind"],
25655
+ openOnly: Boolean(args["open"]),
25656
+ chatId: args["chat-id"] ? Number(args["chat-id"]) : void 0,
25657
+ unroutedOnly: Boolean(args["unrouted"]),
25658
+ limit: args["limit"] ? Number(args["limit"]) : void 0
25659
+ });
25660
+ outputData2(result3, ctx, COLUMNS22);
25661
+ }
25662
+ }
25061
25663
  ]
25062
25664
  };
25063
25665
 
25064
25666
  // src/domains/notification-rules.ts
25065
25667
  init_output();
25066
- var COLUMNS22 = [
25668
+ var COLUMNS23 = [
25067
25669
  COL.id(),
25068
25670
  COL.name(),
25069
25671
  { header: "TYPE", getValue: (item) => item.noticeType ?? "" },
@@ -25080,7 +25682,7 @@ var notificationRulesDomain = {
25080
25682
  createMethod: "createNotificationRule",
25081
25683
  updateMethod: "updateNotificationRule",
25082
25684
  deleteMethod: "deleteNotificationRule",
25083
- columns: COLUMNS22
25685
+ columns: COLUMNS23
25084
25686
  })
25085
25687
  ]
25086
25688
  };
@@ -25144,7 +25746,7 @@ var oauthDomain = {
25144
25746
  // src/domains/operator-groups.ts
25145
25747
  init_output();
25146
25748
  init_context();
25147
- var COLUMNS23 = [COL.id(), COL.name(), COL.description()];
25749
+ var COLUMNS24 = [COL.id(), COL.name(), COL.description()];
25148
25750
  var operatorGroupsDomain = {
25149
25751
  name: "operator-groups",
25150
25752
  description: "Manage operator groups",
@@ -25157,7 +25759,7 @@ var operatorGroupsDomain = {
25157
25759
  createMethod: "createOperatorGroup",
25158
25760
  updateMethod: "updateOperatorGroup",
25159
25761
  deleteMethod: "deleteOperatorGroup",
25160
- columns: COLUMNS23
25762
+ columns: COLUMNS24
25161
25763
  }),
25162
25764
  {
25163
25765
  path: ["operator-groups", "add-member"],
@@ -25238,13 +25840,6 @@ var ORG_DOMAIN_COLUMNS = [
25238
25840
  maxWidth: 80
25239
25841
  }
25240
25842
  ];
25241
- function requireOrgId(args) {
25242
- const val = args["org-uuid"] ?? args.org;
25243
- if (typeof val !== "string" || !val) {
25244
- throw new CLIError("Missing required argument: --org-uuid");
25245
- }
25246
- return val;
25247
- }
25248
25843
  function requireDomainUuid(args) {
25249
25844
  const val = args["domain-uuid"] ?? args.uuid;
25250
25845
  if (typeof val !== "string" || !val) {
@@ -25259,7 +25854,7 @@ function requireDomain(args) {
25259
25854
  }
25260
25855
  return val;
25261
25856
  }
25262
- var ORG_UUID_ARG = {
25857
+ var ORG_UUID_ARG2 = {
25263
25858
  name: "org-uuid",
25264
25859
  aliases: ["org"],
25265
25860
  description: "Organization UUID or ID",
@@ -25280,13 +25875,13 @@ function emailVerifyCommand(path4, description) {
25280
25875
  description,
25281
25876
  mutates: true,
25282
25877
  requiresWorkspace: false,
25283
- args: [ORG_UUID_ARG, DOMAIN_UUID_ARG],
25878
+ args: [ORG_UUID_ARG2, DOMAIN_UUID_ARG],
25284
25879
  examples: [
25285
25880
  `yarn gr ${path4.join(" ")} --org-uuid $ORG_UUID --domain-uuid $DOMAIN_UUID --allow-write`
25286
25881
  ],
25287
25882
  handler: async (hctx) => {
25288
25883
  const result3 = await requireAuth(hctx.ctx).apiClient.verifyOrgDomainEmail(
25289
- requireOrgId(hctx.args),
25884
+ requireOrgRef(hctx.args),
25290
25885
  requireDomainUuid(hctx.args)
25291
25886
  );
25292
25887
  outputSingle(result3, hctx.ctx);
@@ -25299,13 +25894,13 @@ function siteVerifyCommand(path4, description) {
25299
25894
  description,
25300
25895
  mutates: true,
25301
25896
  requiresWorkspace: false,
25302
- args: [ORG_UUID_ARG, DOMAIN_UUID_ARG],
25897
+ args: [ORG_UUID_ARG2, DOMAIN_UUID_ARG],
25303
25898
  examples: [
25304
25899
  `yarn gr ${path4.join(" ")} --org-uuid $ORG_UUID --domain-uuid $DOMAIN_UUID --allow-write`
25305
25900
  ],
25306
25901
  handler: async (hctx) => {
25307
25902
  const result3 = await requireAuth(hctx.ctx).apiClient.verifyOrgDomainSite(
25308
- requireOrgId(hctx.args),
25903
+ requireOrgRef(hctx.args),
25309
25904
  requireDomainUuid(hctx.args)
25310
25905
  );
25311
25906
  outputSingle(result3, hctx.ctx);
@@ -25319,7 +25914,7 @@ function registerDomainCommand(path4) {
25319
25914
  mutates: true,
25320
25915
  requiresWorkspace: false,
25321
25916
  args: [
25322
- ORG_UUID_ARG,
25917
+ ORG_UUID_ARG2,
25323
25918
  { name: "domain", description: "Domain to register, e.g. example.com", required: true }
25324
25919
  ],
25325
25920
  examples: [
@@ -25327,7 +25922,7 @@ function registerDomainCommand(path4) {
25327
25922
  ],
25328
25923
  handler: async (hctx) => {
25329
25924
  const result3 = await requireAuth(hctx.ctx).apiClient.registerOrgDomain(
25330
- requireOrgId(hctx.args),
25925
+ requireOrgRef(hctx.args),
25331
25926
  requireDomain(hctx.args)
25332
25927
  );
25333
25928
  outputSingle(result3, hctx.ctx, ORG_DOMAIN_COLUMNS);
@@ -25339,11 +25934,11 @@ var domainCommands = [
25339
25934
  path: ["org", "domains", "list"],
25340
25935
  description: "List domains registered to an organization",
25341
25936
  requiresWorkspace: false,
25342
- args: [ORG_UUID_ARG],
25937
+ args: [ORG_UUID_ARG2],
25343
25938
  examples: ["yarn gr org domains list --org-uuid $ORG_UUID"],
25344
25939
  handler: async (hctx) => {
25345
25940
  const result3 = await requireAuth(hctx.ctx).apiClient.listOrgDomains(
25346
- requireOrgId(hctx.args)
25941
+ requireOrgRef(hctx.args)
25347
25942
  );
25348
25943
  outputData(result3, hctx.ctx, ORG_DOMAIN_COLUMNS);
25349
25944
  }
@@ -25352,11 +25947,11 @@ var domainCommands = [
25352
25947
  path: ["org", "domains", "get"],
25353
25948
  description: "Get a registered organization domain",
25354
25949
  requiresWorkspace: false,
25355
- args: [ORG_UUID_ARG, DOMAIN_UUID_ARG],
25950
+ args: [ORG_UUID_ARG2, DOMAIN_UUID_ARG],
25356
25951
  examples: ["yarn gr org domains get --org-uuid $ORG_UUID --domain-uuid $DOMAIN_UUID"],
25357
25952
  handler: async (hctx) => {
25358
25953
  const result3 = await requireAuth(hctx.ctx).apiClient.getOrgDomain(
25359
- requireOrgId(hctx.args),
25954
+ requireOrgRef(hctx.args),
25360
25955
  requireDomainUuid(hctx.args)
25361
25956
  );
25362
25957
  outputSingle(result3, hctx.ctx, ORG_DOMAIN_COLUMNS);
@@ -25369,13 +25964,13 @@ var domainCommands = [
25369
25964
  description: "Verify domain ownership by checking the _gravity-verify TXT record",
25370
25965
  mutates: true,
25371
25966
  requiresWorkspace: false,
25372
- args: [ORG_UUID_ARG, DOMAIN_UUID_ARG],
25967
+ args: [ORG_UUID_ARG2, DOMAIN_UUID_ARG],
25373
25968
  examples: [
25374
25969
  "yarn gr org domains verify-ownership --org-uuid $ORG_UUID --domain-uuid $DOMAIN_UUID --allow-write"
25375
25970
  ],
25376
25971
  handler: async (hctx) => {
25377
25972
  const result3 = await requireAuth(hctx.ctx).apiClient.verifyOrgDomainOwnership(
25378
- requireOrgId(hctx.args),
25973
+ requireOrgRef(hctx.args),
25379
25974
  requireDomainUuid(hctx.args)
25380
25975
  );
25381
25976
  outputSingle(result3, hctx.ctx);
@@ -25386,13 +25981,16 @@ var domainCommands = [
25386
25981
  description: "Delete a registered organization domain",
25387
25982
  mutates: true,
25388
25983
  requiresWorkspace: false,
25389
- args: [ORG_UUID_ARG, DOMAIN_UUID_ARG],
25984
+ args: [ORG_UUID_ARG2, DOMAIN_UUID_ARG],
25390
25985
  examples: [
25391
25986
  "yarn gr org domains delete --org-uuid $ORG_UUID --domain-uuid $DOMAIN_UUID --allow-write"
25392
25987
  ],
25393
25988
  handler: async (hctx) => {
25394
25989
  const domainUuid = requireDomainUuid(hctx.args);
25395
- await requireAuth(hctx.ctx).apiClient.deleteOrgDomain(requireOrgId(hctx.args), domainUuid);
25990
+ await requireAuth(hctx.ctx).apiClient.deleteOrgDomain(
25991
+ requireOrgRef(hctx.args),
25992
+ domainUuid
25993
+ );
25396
25994
  process.stdout.write(`Deleted org domain ${domainUuid}
25397
25995
  `);
25398
25996
  }
@@ -25402,13 +26000,13 @@ var domainCommands = [
25402
26000
  description: "Enable email DNS records on a verified organization domain",
25403
26001
  mutates: true,
25404
26002
  requiresWorkspace: false,
25405
- args: [ORG_UUID_ARG, DOMAIN_UUID_ARG],
26003
+ args: [ORG_UUID_ARG2, DOMAIN_UUID_ARG],
25406
26004
  examples: [
25407
26005
  "yarn gr org domains email enable --org-uuid $ORG_UUID --domain-uuid $DOMAIN_UUID --allow-write"
25408
26006
  ],
25409
26007
  handler: async (hctx) => {
25410
26008
  const result3 = await requireAuth(hctx.ctx).apiClient.enableOrgDomainEmail(
25411
- requireOrgId(hctx.args),
26009
+ requireOrgRef(hctx.args),
25412
26010
  requireDomainUuid(hctx.args)
25413
26011
  );
25414
26012
  outputSingle(result3, hctx.ctx);
@@ -25418,11 +26016,11 @@ var domainCommands = [
25418
26016
  path: ["org", "domains", "email", "get"],
25419
26017
  description: "Get email DNS setup and status for an organization domain",
25420
26018
  requiresWorkspace: false,
25421
- args: [ORG_UUID_ARG, DOMAIN_UUID_ARG],
26019
+ args: [ORG_UUID_ARG2, DOMAIN_UUID_ARG],
25422
26020
  examples: ["yarn gr org domains email get --org-uuid $ORG_UUID --domain-uuid $DOMAIN_UUID"],
25423
26021
  handler: async (hctx) => {
25424
26022
  const result3 = await requireAuth(hctx.ctx).apiClient.getOrgDomainEmail(
25425
- requireOrgId(hctx.args),
26023
+ requireOrgRef(hctx.args),
25426
26024
  requireDomainUuid(hctx.args)
25427
26025
  );
25428
26026
  outputSingle(result3, hctx.ctx);
@@ -25442,7 +26040,7 @@ var domainCommands = [
25442
26040
  mutates: true,
25443
26041
  requiresWorkspace: false,
25444
26042
  args: [
25445
- ORG_UUID_ARG,
26043
+ ORG_UUID_ARG2,
25446
26044
  DOMAIN_UUID_ARG,
25447
26045
  {
25448
26046
  name: "confirm",
@@ -25456,7 +26054,7 @@ var domainCommands = [
25456
26054
  handler: async (hctx) => {
25457
26055
  const domainUuid = requireDomainUuid(hctx.args);
25458
26056
  const result3 = await requireAuth(hctx.ctx).apiClient.disableOrgDomainEmail(
25459
- requireOrgId(hctx.args),
26057
+ requireOrgRef(hctx.args),
25460
26058
  domainUuid,
25461
26059
  hctx.args.confirm === true
25462
26060
  );
@@ -25479,13 +26077,13 @@ var domainCommands = [
25479
26077
  description: "Enable custom site CNAME verification on a verified organization domain",
25480
26078
  mutates: true,
25481
26079
  requiresWorkspace: false,
25482
- args: [ORG_UUID_ARG, DOMAIN_UUID_ARG],
26080
+ args: [ORG_UUID_ARG2, DOMAIN_UUID_ARG],
25483
26081
  examples: [
25484
26082
  "yarn gr org domains site enable --org-uuid $ORG_UUID --domain-uuid $DOMAIN_UUID --allow-write"
25485
26083
  ],
25486
26084
  handler: async (hctx) => {
25487
26085
  const result3 = await requireAuth(hctx.ctx).apiClient.enableOrgDomainSite(
25488
- requireOrgId(hctx.args),
26086
+ requireOrgRef(hctx.args),
25489
26087
  requireDomainUuid(hctx.args)
25490
26088
  );
25491
26089
  outputSingle(result3, hctx.ctx);
@@ -25495,11 +26093,11 @@ var domainCommands = [
25495
26093
  path: ["org", "domains", "site", "get"],
25496
26094
  description: "Get custom site CNAME setup and status for an organization domain",
25497
26095
  requiresWorkspace: false,
25498
- args: [ORG_UUID_ARG, DOMAIN_UUID_ARG],
26096
+ args: [ORG_UUID_ARG2, DOMAIN_UUID_ARG],
25499
26097
  examples: ["yarn gr org domains site get --org-uuid $ORG_UUID --domain-uuid $DOMAIN_UUID"],
25500
26098
  handler: async (hctx) => {
25501
26099
  const result3 = await requireAuth(hctx.ctx).apiClient.getOrgDomainSite(
25502
- requireOrgId(hctx.args),
26100
+ requireOrgRef(hctx.args),
25503
26101
  requireDomainUuid(hctx.args)
25504
26102
  );
25505
26103
  outputSingle(result3, hctx.ctx);
@@ -25519,7 +26117,7 @@ var domainCommands = [
25519
26117
  mutates: true,
25520
26118
  requiresWorkspace: false,
25521
26119
  args: [
25522
- ORG_UUID_ARG,
26120
+ ORG_UUID_ARG2,
25523
26121
  DOMAIN_UUID_ARG,
25524
26122
  {
25525
26123
  name: "confirm",
@@ -25533,7 +26131,7 @@ var domainCommands = [
25533
26131
  handler: async (hctx) => {
25534
26132
  const domainUuid = requireDomainUuid(hctx.args);
25535
26133
  const result3 = await requireAuth(hctx.ctx).apiClient.disableOrgDomainSite(
25536
- requireOrgId(hctx.args),
26134
+ requireOrgRef(hctx.args),
25537
26135
  domainUuid,
25538
26136
  hctx.args.confirm === true
25539
26137
  );
@@ -25568,6 +26166,229 @@ var orgDomain = {
25568
26166
  ]
25569
26167
  };
25570
26168
 
26169
+ // src/domains/org-legal-entities.ts
26170
+ init_context();
26171
+ init_errors();
26172
+ init_output();
26173
+ var LEGAL_ENTITY_COLUMNS = [
26174
+ { header: "UUID", getValue: (e) => e.uuid ?? "" },
26175
+ { header: "LEGAL NAME", getValue: (e) => e.legalName ?? "" },
26176
+ { header: "PRIMARY", getValue: (e) => e.isPrimary ? "yes" : "" },
26177
+ { header: "ID TYPE", getValue: (e) => e.registrationIdentifierType ?? "" },
26178
+ { header: "PROFILE SID", getValue: (e) => e.customerProfileSid ?? "" },
26179
+ // The CACHED status hint. `org business-profile get` reads Twilio live.
26180
+ { header: "PROFILE STATUS (cached)", getValue: (e) => e.customerProfileStatus ?? "" }
26181
+ ];
26182
+ var LEGAL_ENTITY_UUID_ARG = {
26183
+ name: "legal-entity-uuid",
26184
+ aliases: ["legal-entity", "entity-uuid"],
26185
+ description: "Legal entity UUID (omit to use the org primary entity)",
26186
+ required: false
26187
+ };
26188
+ var TRUST_PRODUCT_ENTITY_UUID_ARG = { ...LEGAL_ENTITY_UUID_ARG, required: true };
26189
+ var TRUST_PRODUCT_COLUMNS = [
26190
+ { header: "PRODUCT", getValue: (p) => p.product ?? "" },
26191
+ { header: "STATUS", getValue: (p) => p.status ?? "(none)" },
26192
+ { header: "TRUST PRODUCT SID", getValue: (p) => p.trustProductSid ?? "(none)" },
26193
+ // CNAM only; blank for the other two rather than absent, so the column lines up.
26194
+ { header: "DISPLAY NAME", getValue: (p) => p.displayName ?? "" }
26195
+ ];
26196
+ function optionalEntityUuid(args) {
26197
+ const val = args["legal-entity-uuid"] ?? args["legal-entity"] ?? args["entity-uuid"];
26198
+ return typeof val === "string" && val ? val : void 0;
26199
+ }
26200
+ function requireEntityUuid(args) {
26201
+ const val = optionalEntityUuid(args);
26202
+ if (!val) {
26203
+ throw new CLIError("Missing required argument: --legal-entity-uuid");
26204
+ }
26205
+ return val;
26206
+ }
26207
+ function requireBody(data) {
26208
+ if (data && typeof data === "object" && !Array.isArray(data)) return data;
26209
+ throw new CLIError(
26210
+ `Missing or invalid --data. Pass a JSON object, e.g. --data '{"key":"value"}' (or --file body.json). Arrays are not accepted.`
26211
+ );
26212
+ }
26213
+ function submittability(profile) {
26214
+ if (profile.evaluationStatus === "compliant") return "yes";
26215
+ if (profile.evaluationStatus === "noncompliant") return "no (noncompliant)";
26216
+ if (profile.status && profile.status !== "draft") return `n/a (${profile.status})`;
26217
+ return "no (never evaluated)";
26218
+ }
26219
+ var commands2 = [
26220
+ {
26221
+ path: ["org", "legal-entities", "list"],
26222
+ description: "List an org's legal entities (one Twilio Customer Profile each). Requires org admin \u2014 staff join via `gr admin organizations join --role platform_support`.",
26223
+ requiresWorkspace: false,
26224
+ args: [ORG_UUID_ARG],
26225
+ examples: ["yarn gr org legal-entities list --org-uuid $ORG_UUID"],
26226
+ handler: async (hctx) => {
26227
+ const result3 = await requireAuth(hctx.ctx).apiClient.listLegalEntities(
26228
+ requireOrgRef(hctx.args)
26229
+ );
26230
+ outputData(result3.legalEntities ?? [], hctx.ctx, LEGAL_ENTITY_COLUMNS);
26231
+ }
26232
+ },
26233
+ {
26234
+ path: ["org", "legal-entities", "get"],
26235
+ description: "Get one legal entity",
26236
+ requiresWorkspace: false,
26237
+ args: [ORG_UUID_ARG, { ...LEGAL_ENTITY_UUID_ARG, required: true }],
26238
+ examples: [
26239
+ "yarn gr org legal-entities get --org-uuid $ORG_UUID --legal-entity-uuid $ENTITY_UUID"
26240
+ ],
26241
+ handler: async (hctx) => {
26242
+ const result3 = await requireAuth(hctx.ctx).apiClient.getLegalEntity(
26243
+ requireOrgRef(hctx.args),
26244
+ requireEntityUuid(hctx.args)
26245
+ );
26246
+ outputSingle(result3, hctx.ctx);
26247
+ }
26248
+ },
26249
+ {
26250
+ path: ["org", "legal-entities", "create"],
26251
+ description: "Create a legal entity (its business profile is filled in separately)",
26252
+ mutates: true,
26253
+ requiresWorkspace: false,
26254
+ args: [ORG_UUID_ARG],
26255
+ examples: [
26256
+ `yarn gr org legal-entities create --org-uuid $ORG_UUID --data '{"legalName":"Acme Health"}' --allow-write`
26257
+ ],
26258
+ handler: async (hctx) => {
26259
+ const result3 = await requireAuth(hctx.ctx).apiClient.createLegalEntity(
26260
+ requireOrgRef(hctx.args),
26261
+ requireBody(hctx.data)
26262
+ );
26263
+ outputSingle(result3, hctx.ctx);
26264
+ }
26265
+ },
26266
+ {
26267
+ path: ["org", "business-profile", "get"],
26268
+ description: "Read a legal entity's business profile LIVE from Twilio. SUBMITTABLE is derived from evaluationStatus, not status.",
26269
+ requiresWorkspace: false,
26270
+ args: [ORG_UUID_ARG, LEGAL_ENTITY_UUID_ARG],
26271
+ examples: ["yarn gr org business-profile get --org-uuid $ORG_UUID"],
26272
+ handler: async (hctx) => {
26273
+ const profile = await requireAuth(hctx.ctx).apiClient.getBusinessProfile(
26274
+ requireOrgRef(hctx.args),
26275
+ optionalEntityUuid(hctx.args)
26276
+ );
26277
+ outputSingle(
26278
+ hctx.ctx.outputFormat === "json" ? profile : {
26279
+ status: profile.status ?? "(none)",
26280
+ evaluationStatus: profile.evaluationStatus ?? "(not evaluated)",
26281
+ SUBMITTABLE: submittability(profile),
26282
+ customerProfileSid: profile.customerProfileSid ?? "(none)",
26283
+ legalName: profile.businessInfo?.legalName ?? "(missing)",
26284
+ authorizedReps: (profile.authorizedReps ?? []).length,
26285
+ hasAddress: profile.address ? "yes" : "no",
26286
+ failureReasons: (profile.failureReasons ?? []).join("; ") || "(none)",
26287
+ profileRecoveryFailed: profile.profileRecoveryFailed ? "YES" : "no"
26288
+ },
26289
+ hctx.ctx
26290
+ );
26291
+ }
26292
+ },
26293
+ {
26294
+ path: ["org", "business-profile", "update"],
26295
+ description: "Upsert the business profile (idempotent via cached SIDs). Returns the fresh compliance evaluation.",
26296
+ mutates: true,
26297
+ requiresWorkspace: false,
26298
+ args: [ORG_UUID_ARG, LEGAL_ENTITY_UUID_ARG],
26299
+ examples: [
26300
+ "yarn gr org business-profile update --org-uuid $ORG_UUID --file profile.json --allow-write"
26301
+ ],
26302
+ handler: async (hctx) => {
26303
+ const result3 = await requireAuth(hctx.ctx).apiClient.updateBusinessProfile(
26304
+ requireOrgRef(hctx.args),
26305
+ requireBody(hctx.data),
26306
+ optionalEntityUuid(hctx.args)
26307
+ );
26308
+ outputSingle(result3, hctx.ctx);
26309
+ }
26310
+ },
26311
+ {
26312
+ path: ["org", "business-profile", "submit"],
26313
+ description: "Submit the business profile to Twilio for review. Free \u2014 the paid step is brand registration, which is separate. 412 if not currently compliant, 409 if a review is already in flight.",
26314
+ mutates: true,
26315
+ requiresWorkspace: false,
26316
+ args: [ORG_UUID_ARG, LEGAL_ENTITY_UUID_ARG],
26317
+ examples: ["yarn gr org business-profile submit --org-uuid $ORG_UUID --allow-write"],
26318
+ handler: async (hctx) => {
26319
+ const result3 = await requireAuth(hctx.ctx).apiClient.submitBusinessProfile(
26320
+ requireOrgRef(hctx.args),
26321
+ optionalEntityUuid(hctx.args)
26322
+ );
26323
+ outputSingle(result3, hctx.ctx);
26324
+ }
26325
+ },
26326
+ {
26327
+ path: ["org", "business-profile", "cancel"],
26328
+ description: "Cancel an in-flight Twilio review, resetting the profile to draft so it can be edited and resubmitted",
26329
+ mutates: true,
26330
+ requiresWorkspace: false,
26331
+ args: [ORG_UUID_ARG, LEGAL_ENTITY_UUID_ARG],
26332
+ examples: ["yarn gr org business-profile cancel --org-uuid $ORG_UUID --allow-write"],
26333
+ handler: async (hctx) => {
26334
+ const result3 = await requireAuth(hctx.ctx).apiClient.cancelBusinessProfile(
26335
+ requireOrgRef(hctx.args),
26336
+ optionalEntityUuid(hctx.args)
26337
+ );
26338
+ outputSingle(result3, hctx.ctx);
26339
+ }
26340
+ },
26341
+ {
26342
+ path: ["org", "trust-products", "list"],
26343
+ description: "Read an entity's CACHED voice trust product state (CNAM / SHAKEN-STIR / Voice Integrity) from trust_hub_state. No Twilio calls \u2014 run `sync` to reconcile.",
26344
+ requiresWorkspace: false,
26345
+ args: [ORG_UUID_ARG, TRUST_PRODUCT_ENTITY_UUID_ARG],
26346
+ examples: [
26347
+ "yarn gr org trust-products list --org-uuid $ORG_UUID --legal-entity-uuid $ENTITY_UUID --env prod"
26348
+ ],
26349
+ handler: async (hctx) => {
26350
+ const result3 = await requireAuth(hctx.ctx).apiClient.getVoiceTrustProducts(
26351
+ requireOrgRef(hctx.args),
26352
+ requireEntityUuid(hctx.args)
26353
+ );
26354
+ outputData(result3.products, hctx.ctx, TRUST_PRODUCT_COLUMNS);
26355
+ }
26356
+ },
26357
+ {
26358
+ path: ["org", "trust-products", "sync"],
26359
+ description: "Reconcile voice trust products against Twilio: claim products staged outside the app and refresh non-terminal statuses. This is the prerequisite for `admin phone-numbers migrate`, whose preflight reads the cached state. 409 if another Trust Hub operation holds the org lock \u2014 retry shortly.",
26360
+ // Writes trust_hub_state and calls Twilio. Read-only in business terms
26361
+ // (it discovers, it does not create or submit), but it mutates our cache,
26362
+ // so it takes --allow-write like every other state-changing verb.
26363
+ mutates: true,
26364
+ requiresWorkspace: false,
26365
+ args: [ORG_UUID_ARG, TRUST_PRODUCT_ENTITY_UUID_ARG],
26366
+ examples: [
26367
+ "yarn gr org trust-products sync --org-uuid $ORG_UUID --legal-entity-uuid $ENTITY_UUID --env prod --allow-write"
26368
+ ],
26369
+ handler: async (hctx) => {
26370
+ const result3 = await requireAuth(hctx.ctx).apiClient.syncVoiceTrustProducts(
26371
+ requireOrgRef(hctx.args),
26372
+ requireEntityUuid(hctx.args)
26373
+ );
26374
+ if (hctx.ctx.outputFormat !== "table") {
26375
+ outputSingle(result3, hctx.ctx);
26376
+ return;
26377
+ }
26378
+ const discovered = result3.discovered ?? [];
26379
+ console.log(
26380
+ discovered.length > 0 ? `Discovered ${discovered.length} product(s): ${discovered.join(", ")}` : "No new products discovered \u2014 already up to date."
26381
+ );
26382
+ outputData(result3.products, hctx.ctx, TRUST_PRODUCT_COLUMNS);
26383
+ }
26384
+ }
26385
+ ];
26386
+ var orgLegalEntitiesDomain = {
26387
+ name: "org",
26388
+ description: "Legal entities and business profiles (Twilio Customer Profiles)",
26389
+ commands: commands2
26390
+ };
26391
+
25571
26392
  // src/domains/org-phone-numbers.ts
25572
26393
  init_dist();
25573
26394
  init_context();
@@ -25592,14 +26413,7 @@ var AVAILABLE_PHONE_COLUMNS = [
25592
26413
  { header: "Region", getValue: (p) => p.region ?? "" },
25593
26414
  { header: "Type", getValue: (p) => p.phoneNumberType ?? "" }
25594
26415
  ];
25595
- function requireOrgUuid(args) {
25596
- const val = args["org-uuid"] ?? args["org"];
25597
- if (typeof val !== "string" || !val) {
25598
- throw new CLIError("Missing required argument: --org-uuid");
25599
- }
25600
- return val;
25601
- }
25602
- var commands2 = [
26416
+ var commands3 = [
25603
26417
  {
25604
26418
  path: ["org", "phone-numbers", "list"],
25605
26419
  description: "List all phone numbers owned by an organization",
@@ -25609,7 +26423,7 @@ var commands2 = [
25609
26423
  requiresWorkspace: false,
25610
26424
  columns: PROVIDER_PHONE_COLUMNS,
25611
26425
  handler: async (hctx) => {
25612
- const orgUuid = requireOrgUuid(hctx.args);
26426
+ const orgUuid = requireOrgRef(hctx.args);
25613
26427
  const result3 = await getOrgApi(hctx).listPhoneNumbers(orgUuid);
25614
26428
  outputData(result3, hctx.ctx, PROVIDER_PHONE_COLUMNS);
25615
26429
  }
@@ -25632,7 +26446,7 @@ var commands2 = [
25632
26446
  requiresWorkspace: false,
25633
26447
  columns: AVAILABLE_PHONE_COLUMNS,
25634
26448
  handler: async (hctx) => {
25635
- const orgUuid = requireOrgUuid(hctx.args);
26449
+ const orgUuid = requireOrgRef(hctx.args);
25636
26450
  const result3 = await getOrgApi(hctx).searchPhoneNumbers(orgUuid, {
25637
26451
  country: hctx.args.country ?? "US",
25638
26452
  numberType: hctx.args["number-type"] ?? "local",
@@ -25668,7 +26482,7 @@ var commands2 = [
25668
26482
  requiresWorkspace: false,
25669
26483
  columns: PROVIDER_PHONE_COLUMNS,
25670
26484
  handler: async (hctx) => {
25671
- const orgUuid = requireOrgUuid(hctx.args);
26485
+ const orgUuid = requireOrgRef(hctx.args);
25672
26486
  const phoneNumber = hctx.args["phone-number"];
25673
26487
  if (!phoneNumber) throw new CLIError("Missing required argument: --phone-number");
25674
26488
  const numberType = hctx.args["number-type"] ?? "local";
@@ -25697,7 +26511,7 @@ var commands2 = [
25697
26511
  requiresWorkspace: false,
25698
26512
  columns: PROVIDER_PHONE_COLUMNS,
25699
26513
  handler: async (hctx) => {
25700
- const orgUuid = requireOrgUuid(hctx.args);
26514
+ const orgUuid = requireOrgRef(hctx.args);
25701
26515
  const providerPhoneUuid = hctx.args["provider-phone-uuid"];
25702
26516
  const workspaceUuid = hctx.args["workspace-uuid"];
25703
26517
  if (!providerPhoneUuid)
@@ -25729,7 +26543,7 @@ Create a workspace phone linked to this provider number (sets Twilio webhooks):
25729
26543
  requiresWorkspace: false,
25730
26544
  columns: PROVIDER_PHONE_COLUMNS,
25731
26545
  handler: async (hctx) => {
25732
- const orgUuid = requireOrgUuid(hctx.args);
26546
+ const orgUuid = requireOrgRef(hctx.args);
25733
26547
  const providerPhoneUuid = hctx.args["provider-phone-uuid"];
25734
26548
  const newWorkspaceUuid = hctx.args["new-workspace-uuid"];
25735
26549
  if (!providerPhoneUuid)
@@ -25755,7 +26569,7 @@ Create a workspace phone linked to this provider number (sets Twilio webhooks):
25755
26569
  requiresWorkspace: false,
25756
26570
  columns: PROVIDER_PHONE_COLUMNS,
25757
26571
  handler: async (hctx) => {
25758
- const orgUuid = requireOrgUuid(hctx.args);
26572
+ const orgUuid = requireOrgRef(hctx.args);
25759
26573
  const providerPhoneUuid = hctx.args["provider-phone-uuid"];
25760
26574
  if (!providerPhoneUuid)
25761
26575
  throw new CLIError("Missing required argument: --provider-phone-uuid");
@@ -25773,7 +26587,7 @@ Create a workspace phone linked to this provider number (sets Twilio webhooks):
25773
26587
  ],
25774
26588
  requiresWorkspace: false,
25775
26589
  handler: async (hctx) => {
25776
- const orgUuid = requireOrgUuid(hctx.args);
26590
+ const orgUuid = requireOrgRef(hctx.args);
25777
26591
  const providerPhoneUuid = hctx.args["provider-phone-uuid"];
25778
26592
  if (!providerPhoneUuid)
25779
26593
  throw new CLIError("Missing required argument: --provider-phone-uuid");
@@ -25785,7 +26599,7 @@ Create a workspace phone linked to this provider number (sets Twilio webhooks):
25785
26599
  var orgPhoneNumbersDomain = {
25786
26600
  name: "org",
25787
26601
  description: "Organization management",
25788
- commands: commands2
26602
+ commands: commands3
25789
26603
  };
25790
26604
 
25791
26605
  // src/domains/phone-numbers.ts
@@ -28700,7 +29514,7 @@ function requireCallerRole(args, flag) {
28700
29514
  }
28701
29515
  return role;
28702
29516
  }
28703
- var COLUMNS24 = [
29517
+ var COLUMNS25 = [
28704
29518
  COL.id(),
28705
29519
  { header: "NUMBER", getValue: (item) => item.phoneNumber ?? item.number ?? "" },
28706
29520
  { header: "LABEL", getValue: (item) => item.label ?? item.name ?? "" },
@@ -28727,7 +29541,7 @@ var phoneNumbersDomain = {
28727
29541
  entityName: "phone number",
28728
29542
  listMethod: "getPhoneNumbers",
28729
29543
  archiveMethod: "archivePhoneNumber",
28730
- columns: COLUMNS24
29544
+ columns: COLUMNS25
28731
29545
  }),
28732
29546
  {
28733
29547
  path: ["phone-numbers", "get"],
@@ -28777,7 +29591,7 @@ ${PHONE_NUMBER_FIELD_REFERENCE}`,
28777
29591
  );
28778
29592
  const record = asPhoneRecord(result3);
28779
29593
  const warnings = collectPhoneNumberWarnings(record);
28780
- outputData([record], ctx, COLUMNS24);
29594
+ outputData([record], ctx, COLUMNS25);
28781
29595
  if (warnings.length > 0) {
28782
29596
  process.stderr.write("\nWarnings after create:\n");
28783
29597
  for (const w of warnings) {
@@ -28809,7 +29623,7 @@ ${PHONE_NUMBER_FIELD_REFERENCE}`,
28809
29623
  id,
28810
29624
  data
28811
29625
  );
28812
- outputData([result3], ctx, COLUMNS24);
29626
+ outputData([result3], ctx, COLUMNS25);
28813
29627
  } catch (err) {
28814
29628
  return enrichPhoneNumberApiError(err);
28815
29629
  }
@@ -29097,7 +29911,7 @@ ${formatRoutingSimulation(sim, phone)}
29097
29911
  requiresWorkspace: true,
29098
29912
  handler: async ({ ctx, workspace }) => {
29099
29913
  const result3 = await requireAuth(ctx).apiClient.getAvailablePhoneNumbers(workspace);
29100
- outputData(result3, ctx, COLUMNS24);
29914
+ outputData(result3, ctx, COLUMNS25);
29101
29915
  }
29102
29916
  },
29103
29917
  {
@@ -29122,7 +29936,7 @@ ${formatRoutingSimulation(sim, phone)}
29122
29936
  const id = requireNumberFrom(args, "phone-number-id", "id");
29123
29937
  const providerPhoneUuid = requireString(args, "provider-phone-uuid");
29124
29938
  const result3 = await auth.apiClient.linkPhoneNumber(workspace, id, providerPhoneUuid);
29125
- outputData([result3], auth, COLUMNS24);
29939
+ outputData([result3], auth, COLUMNS25);
29126
29940
  }
29127
29941
  },
29128
29942
  {
@@ -29135,7 +29949,7 @@ ${formatRoutingSimulation(sim, phone)}
29135
29949
  workspace,
29136
29950
  data
29137
29951
  );
29138
- outputData([result3], ctx, COLUMNS24);
29952
+ outputData([result3], ctx, COLUMNS25);
29139
29953
  }
29140
29954
  },
29141
29955
  {
@@ -29287,7 +30101,7 @@ function normalizePronunciationUpdatePayload(data) {
29287
30101
  }
29288
30102
 
29289
30103
  // src/domains/pronunciations.ts
29290
- var COLUMNS25 = [
30104
+ var COLUMNS26 = [
29291
30105
  COL.id(),
29292
30106
  { header: "TERM", getValue: (item) => item.term ?? "" },
29293
30107
  { header: "RESPELLING", getValue: (item) => item.respelling ?? "" },
@@ -29309,7 +30123,7 @@ var pronunciationsDomain = {
29309
30123
  const auth = requireAuth(ctx);
29310
30124
  const orgUuid = await resolveOrgUuidFromWorkspace(auth.apiClient, workspace);
29311
30125
  const result3 = await auth.apiClient.getPronunciationEntries(orgUuid);
29312
- outputData(result3, ctx, COLUMNS25);
30126
+ outputData(result3, ctx, COLUMNS26);
29313
30127
  }
29314
30128
  },
29315
30129
  {
@@ -29323,7 +30137,7 @@ var pronunciationsDomain = {
29323
30137
  const orgUuid = await resolveOrgUuidFromWorkspace(auth.apiClient, workspace);
29324
30138
  const payload = normalizePronunciationCreatePayload(data);
29325
30139
  const result3 = await auth.apiClient.createPronunciationEntry(orgUuid, payload);
29326
- outputSingle(result3, ctx, COLUMNS25);
30140
+ outputSingle(result3, ctx, COLUMNS26);
29327
30141
  }
29328
30142
  },
29329
30143
  {
@@ -29341,7 +30155,7 @@ var pronunciationsDomain = {
29341
30155
  requireNumber(args, "id"),
29342
30156
  payload
29343
30157
  );
29344
- outputSingle(result3, ctx, COLUMNS25);
30158
+ outputSingle(result3, ctx, COLUMNS26);
29345
30159
  }
29346
30160
  },
29347
30161
  {
@@ -29365,7 +30179,7 @@ var pronunciationsDomain = {
29365
30179
  requiresWorkspace: true,
29366
30180
  handler: async ({ ctx }) => {
29367
30181
  const result3 = await requireAuth(ctx).apiClient.getMyPronunciations();
29368
- outputData(result3, ctx, COLUMNS25);
30182
+ outputData(result3, ctx, COLUMNS26);
29369
30183
  }
29370
30184
  },
29371
30185
  {
@@ -29376,7 +30190,7 @@ var pronunciationsDomain = {
29376
30190
  handler: async ({ ctx, data }) => {
29377
30191
  const payload = normalizePronunciationCreatePayload(data);
29378
30192
  const result3 = await requireAuth(ctx).apiClient.createMyPronunciation(payload);
29379
- outputSingle(result3, ctx, COLUMNS25);
30193
+ outputSingle(result3, ctx, COLUMNS26);
29380
30194
  }
29381
30195
  },
29382
30196
  {
@@ -29683,7 +30497,7 @@ ${ROUTINE_FIELD_REFERENCE}`,
29683
30497
  // src/domains/subscriptions.ts
29684
30498
  init_output();
29685
30499
  init_context();
29686
- var COLUMNS26 = [
30500
+ var COLUMNS27 = [
29687
30501
  COL.id(),
29688
30502
  COL.status(),
29689
30503
  { header: "PLAN", getValue: (item) => item.planName ?? item.plan ?? "" },
@@ -29699,7 +30513,7 @@ var subscriptionsDomain = {
29699
30513
  requiresWorkspace: false,
29700
30514
  handler: async ({ ctx }) => {
29701
30515
  const result3 = await requireAuth(ctx).apiClient.getSubscriptions();
29702
- outputData(result3, ctx, COLUMNS26);
30516
+ outputData(result3, ctx, COLUMNS27);
29703
30517
  }
29704
30518
  },
29705
30519
  {
@@ -29708,7 +30522,7 @@ var subscriptionsDomain = {
29708
30522
  requiresWorkspace: true,
29709
30523
  handler: async ({ ctx, workspace }) => {
29710
30524
  const result3 = await requireAuth(ctx).apiClient.getWorkspaceSubscriptions(workspace);
29711
- outputData(result3, ctx, COLUMNS26);
30525
+ outputData(result3, ctx, COLUMNS27);
29712
30526
  }
29713
30527
  },
29714
30528
  {
@@ -29721,7 +30535,7 @@ var subscriptionsDomain = {
29721
30535
  const result3 = await requireAuth(ctx).apiClient.cancelSubscription(
29722
30536
  requireNumber(args, "id")
29723
30537
  );
29724
- outputSingle(result3, ctx, COLUMNS26);
30538
+ outputSingle(result3, ctx, COLUMNS27);
29725
30539
  }
29726
30540
  },
29727
30541
  {
@@ -29733,7 +30547,7 @@ var subscriptionsDomain = {
29733
30547
  const result3 = await requireAuth(ctx).apiClient.reactivateSubscription(
29734
30548
  requireNumber(args, "id")
29735
30549
  );
29736
- outputSingle(result3, ctx, COLUMNS26);
30550
+ outputSingle(result3, ctx, COLUMNS27);
29737
30551
  }
29738
30552
  },
29739
30553
  {
@@ -29747,7 +30561,7 @@ var subscriptionsDomain = {
29747
30561
  requireNumber(args, "id"),
29748
30562
  data
29749
30563
  );
29750
- outputSingle(result3, ctx, COLUMNS26);
30564
+ outputSingle(result3, ctx, COLUMNS27);
29751
30565
  }
29752
30566
  }
29753
30567
  ]
@@ -30006,7 +30820,7 @@ var supportDomain = {
30006
30820
 
30007
30821
  // src/domains/supervisors.ts
30008
30822
  init_output();
30009
- var COLUMNS27 = [
30823
+ var COLUMNS28 = [
30010
30824
  COL.id(),
30011
30825
  COL.name(),
30012
30826
  { header: "TYPE", getValue: (item) => item.type ?? "" },
@@ -30024,7 +30838,7 @@ var supervisorsDomain = {
30024
30838
  createMethod: "createSupervisor",
30025
30839
  updateMethod: "updateSupervisor",
30026
30840
  deleteMethod: "deleteSupervisor",
30027
- columns: COLUMNS27
30841
+ columns: COLUMNS28
30028
30842
  })
30029
30843
  ]
30030
30844
  };
@@ -30420,7 +31234,7 @@ var widgetDomainsDomain = {
30420
31234
  // src/domains/integrations/app-connections.ts
30421
31235
  init_output();
30422
31236
  init_context();
30423
- var COLUMNS28 = [
31237
+ var COLUMNS29 = [
30424
31238
  COL.id(),
30425
31239
  COL.name(),
30426
31240
  { header: "TYPE", getValue: (item) => item.type ?? "" },
@@ -30461,7 +31275,7 @@ var appConnectionsDomain = {
30461
31275
  requiresWorkspace: true,
30462
31276
  handler: async ({ ctx, workspace }) => {
30463
31277
  const result3 = await requireAuth(ctx).apiClient.listAvailableAppConnections(workspace);
30464
- outputData(result3, ctx, COLUMNS28);
31278
+ outputData(result3, ctx, COLUMNS29);
30465
31279
  }
30466
31280
  },
30467
31281
  {
@@ -30470,7 +31284,7 @@ var appConnectionsDomain = {
30470
31284
  requiresWorkspace: true,
30471
31285
  handler: async ({ ctx, workspace }) => {
30472
31286
  const result3 = await requireAuth(ctx).apiClient.listAppConnections(workspace);
30473
- outputData(result3, ctx, COLUMNS28);
31287
+ outputData(result3, ctx, COLUMNS29);
30474
31288
  }
30475
31289
  },
30476
31290
  {
@@ -30494,7 +31308,7 @@ var appConnectionsDomain = {
30494
31308
  const result3 = await requireAuth(ctx).apiClient.enablePlatformApp(workspace, {
30495
31309
  slug: requireString(args, "slug")
30496
31310
  });
30497
- outputSingle(result3, ctx, COLUMNS28);
31311
+ outputSingle(result3, ctx, COLUMNS29);
30498
31312
  }
30499
31313
  },
30500
31314
  {
@@ -30507,7 +31321,7 @@ var appConnectionsDomain = {
30507
31321
  workspace,
30508
31322
  requireString(args, "id")
30509
31323
  );
30510
- outputSingle(result3, ctx, COLUMNS28);
31324
+ outputSingle(result3, ctx, COLUMNS29);
30511
31325
  }
30512
31326
  },
30513
31327
  {
@@ -30522,7 +31336,7 @@ var appConnectionsDomain = {
30522
31336
  requireString(args, "id"),
30523
31337
  data
30524
31338
  );
30525
- outputSingle(result3, ctx, COLUMNS28);
31339
+ outputSingle(result3, ctx, COLUMNS29);
30526
31340
  }
30527
31341
  },
30528
31342
  {
@@ -30869,7 +31683,7 @@ var confluenceDomain = {
30869
31683
  // src/domains/integrations/discord-bots.ts
30870
31684
  init_output();
30871
31685
  init_context();
30872
- var COLUMNS29 = [COL.id(), COL.name(), COL.status()];
31686
+ var COLUMNS30 = [COL.id(), COL.name(), COL.status()];
30873
31687
  var discordBotsDomain = {
30874
31688
  name: "discord-bots",
30875
31689
  description: "Manage Discord bot integrations",
@@ -30882,7 +31696,7 @@ var discordBotsDomain = {
30882
31696
  createMethod: "createDiscordBot",
30883
31697
  updateMethod: "updateDiscordBot",
30884
31698
  deleteMethod: "deleteDiscordBot",
30885
- columns: COLUMNS29,
31699
+ columns: COLUMNS30,
30886
31700
  paginationSupport: "full"
30887
31701
  }),
30888
31702
  {
@@ -30944,7 +31758,7 @@ var discordBotsDomain = {
30944
31758
  // src/domains/integrations/fhir-connections.ts
30945
31759
  init_output();
30946
31760
  init_context();
30947
- var COLUMNS30 = [
31761
+ var COLUMNS31 = [
30948
31762
  COL.id(),
30949
31763
  COL.name(),
30950
31764
  { header: "URL", getValue: (item) => item.baseUrl ?? "" },
@@ -30962,7 +31776,7 @@ var fhirConnectionsDomain = {
30962
31776
  createMethod: "createFhirConnection",
30963
31777
  updateMethod: "updateFhirConnection",
30964
31778
  deleteMethod: "deleteFhirConnection",
30965
- columns: COLUMNS30,
31779
+ columns: COLUMNS31,
30966
31780
  paginationSupport: "full"
30967
31781
  }),
30968
31782
  {
@@ -30985,7 +31799,7 @@ var fhirConnectionsDomain = {
30985
31799
  init_context();
30986
31800
  init_errors();
30987
31801
  init_output();
30988
- var COLUMNS31 = [
31802
+ var COLUMNS32 = [
30989
31803
  { header: "CONFIGURED", getValue: (i) => String(i.configured ?? false) },
30990
31804
  { header: "ENABLED", getValue: (i) => String(i.enabled ?? false) },
30991
31805
  { header: "HAS_KEY", getValue: (i) => String(i.hasApiKey ?? false) },
@@ -31014,7 +31828,7 @@ var patientSyncDomain = {
31014
31828
  workspace,
31015
31829
  data
31016
31830
  );
31017
- outputSingle(result3, ctx, COLUMNS31);
31831
+ outputSingle(result3, ctx, COLUMNS32);
31018
31832
  }
31019
31833
  },
31020
31834
  {
@@ -31023,7 +31837,7 @@ var patientSyncDomain = {
31023
31837
  requiresWorkspace: true,
31024
31838
  handler: async ({ ctx, workspace }) => {
31025
31839
  const result3 = await requireAuth(ctx).apiClient.getPatientSyncStatus(workspace);
31026
- outputSingle(result3, ctx, COLUMNS31);
31840
+ outputSingle(result3, ctx, COLUMNS32);
31027
31841
  }
31028
31842
  },
31029
31843
  {
@@ -32091,7 +32905,7 @@ var salesforceDomain = {
32091
32905
  init_errors();
32092
32906
  init_output();
32093
32907
  init_context();
32094
- var COLUMNS32 = [COL.id(), COL.name(), COL.status()];
32908
+ var COLUMNS33 = [COL.id(), COL.name(), COL.status()];
32095
32909
  function addSlackUrls(data, apiUrl, workspaceUuid) {
32096
32910
  const base = `${apiUrl}/api/v2/w/${workspaceUuid}/app-connections/slack`;
32097
32911
  return {
@@ -32114,7 +32928,7 @@ var slackAppsDomain = {
32114
32928
  entityName: "Slack app",
32115
32929
  listMethod: "getSlackApps",
32116
32930
  deleteMethod: "deleteSlackApp",
32117
- columns: COLUMNS32,
32931
+ columns: COLUMNS33,
32118
32932
  paginationSupport: "full"
32119
32933
  }),
32120
32934
  {
@@ -32203,7 +33017,7 @@ var slackAppsDomain = {
32203
33017
  init_errors();
32204
33018
  init_output();
32205
33019
  init_context();
32206
- var COLUMNS33 = [COL.id(), COL.name(), COL.status()];
33020
+ var COLUMNS34 = [COL.id(), COL.name(), COL.status()];
32207
33021
  function addTeamsUrls(data, apiUrl, workspaceUuid) {
32208
33022
  const base = `${apiUrl}/api/v2/w/${workspaceUuid}/app-connections/teams`;
32209
33023
  return {
@@ -32224,7 +33038,7 @@ var teamsAppsDomain = {
32224
33038
  entityName: "Teams app",
32225
33039
  listMethod: "getTeamsApps",
32226
33040
  deleteMethod: "deleteTeamsApp",
32227
- columns: COLUMNS33,
33041
+ columns: COLUMNS34,
32228
33042
  paginationSupport: "full"
32229
33043
  }),
32230
33044
  {
@@ -32330,6 +33144,7 @@ function registerPublicDomains(registry) {
32330
33144
  registry.register(qualificationsDomain);
32331
33145
  registry.register(queriesDomain);
32332
33146
  registry.register(personasDomain);
33147
+ registry.register(metricsDomain);
32333
33148
  registry.register(journeysDomain);
32334
33149
  registry.register(abilitiesDomain);
32335
33150
  registry.register(phoneNumbersDomain);
@@ -32337,10 +33152,10 @@ function registerPublicDomains(registry) {
32337
33152
  registry.register(inboxesDomain);
32338
33153
  registry.register(operatorGroupsDomain);
32339
33154
  registry.register(accessGrantsDomain);
33155
+ registry.register(interventionRequestsDomain);
32340
33156
  registry.register(notificationRulesDomain);
32341
33157
  registry.register(supervisorsDomain);
32342
33158
  registry.register(promptsDomain);
32343
- registry.register(milestonesDomain);
32344
33159
  registry.register(customToolkitsDomain);
32345
33160
  registry.register(mcpServersDomain);
32346
33161
  registry.register(apiKeysDomain);
@@ -32352,6 +33167,7 @@ function registerPublicDomains(registry) {
32352
33167
  registry.register(featuresDomain);
32353
33168
  registry.register(pronunciationsDomain);
32354
33169
  registry.register(orgDomain);
33170
+ registry.register(orgLegalEntitiesDomain);
32355
33171
  registry.register(orgPhoneNumbersDomain);
32356
33172
  registry.register(authManageDomain);
32357
33173
  registry.register(appsDomain);
@@ -35460,7 +36276,7 @@ async function authImportDevCommand(ctx, args) {
35460
36276
 
35461
36277
  // src/commands/organizations.ts
35462
36278
  init_output();
35463
- var COLUMNS34 = [
36279
+ var COLUMNS35 = [
35464
36280
  { header: "NAME", getValue: (o) => o.organizationName || "", maxWidth: 35 },
35465
36281
  { header: "SLUG", getValue: (o) => o.organizationSlug || "", maxWidth: 25 },
35466
36282
  { header: "UUID", getValue: (o) => o.organizationUuid },
@@ -35468,7 +36284,7 @@ var COLUMNS34 = [
35468
36284
  ];
35469
36285
  async function organizationsListCommand(ctx) {
35470
36286
  const organizations = await ctx.apiClient.getMyOrganizations();
35471
- outputData(organizations, ctx, COLUMNS34);
36287
+ outputData(organizations, ctx, COLUMNS35);
35472
36288
  }
35473
36289
 
35474
36290
  // src/commands/whoami.ts
@@ -35793,7 +36609,7 @@ init_concierge_api();
35793
36609
 
35794
36610
  // package.json
35795
36611
  var package_default = {
35796
- version: "0.16.0"};
36612
+ version: "0.17.0"};
35797
36613
 
35798
36614
  // src/gr.ts
35799
36615
  var VERSION = package_default.version;