@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/lib.js CHANGED
@@ -59,6 +59,19 @@ var COMMON_ARGS = [
59
59
  { name: "id", description: "Entity ID" },
60
60
  { name: "uuid", description: "Entity UUID" }
61
61
  ];
62
+ var ORG_UUID_ARG = {
63
+ name: "org-uuid",
64
+ aliases: ["org"],
65
+ description: "Organization UUID or ID",
66
+ required: true
67
+ };
68
+ function requireOrgRef(args) {
69
+ const val = args["org-uuid"] ?? args.org;
70
+ if (typeof val !== "string" || !val) {
71
+ throw new CLIError("Missing required argument: --org-uuid");
72
+ }
73
+ return val;
74
+ }
62
75
  function parseArgs(defs, argv) {
63
76
  const allDefs = [...defs, ...COMMON_ARGS];
64
77
  const result2 = {};
@@ -838,8 +851,8 @@ var CommandRegistry = class {
838
851
  const key = cmd.path.join(" ");
839
852
  this.commands.set(key, cmd);
840
853
  }
841
- registerCommands(commands3) {
842
- for (const cmd of commands3) {
854
+ registerCommands(commands4) {
855
+ for (const cmd of commands4) {
843
856
  this.registerCommand(cmd);
844
857
  }
845
858
  }
@@ -1351,6 +1364,42 @@ var FEEDBACK_COLUMNS = [
1351
1364
  },
1352
1365
  COL.created()
1353
1366
  ];
1367
+ async function respondWithValue(ctx, workspace, args) {
1368
+ const chatId = requireIdOrUuidFrom(args, "chat-id", "id");
1369
+ const chat = await requireAuth(ctx).apiClient.getChat(workspace, chatId);
1370
+ const interrupt = chat?.interrupt;
1371
+ if (!interrupt || !interrupt.interruptId) {
1372
+ throw new Error("No pending interrupt on this chat.");
1373
+ }
1374
+ const raw = args.value;
1375
+ if (typeof raw !== "string" || !raw.length) {
1376
+ throw new Error(
1377
+ `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.`
1378
+ );
1379
+ }
1380
+ const url = `${ctx.envConfig.apiUrl}/api/v2/w/${workspace}/chats/${chat.id}/inference/hitl`;
1381
+ const response = await fetch(url, {
1382
+ method: "POST",
1383
+ headers: {
1384
+ Authorization: `Bearer ${requireAuth(ctx).accessToken}`,
1385
+ "Content-Type": "application/json"
1386
+ },
1387
+ body: JSON.stringify({ chosenValue: raw, interruptId: interrupt.interruptId })
1388
+ });
1389
+ if (!response.ok) {
1390
+ throw new Error(
1391
+ `Resume failed (${response.status}): ${(await response.text()).slice(0, 400)}`
1392
+ );
1393
+ }
1394
+ outputSingle(
1395
+ {
1396
+ status: "resumed",
1397
+ chatId: chat.id,
1398
+ next: `gr chats inspect --id ${chat.id} -w ${workspace}`
1399
+ },
1400
+ ctx
1401
+ );
1402
+ }
1354
1403
  async function respondToInterrupt(ctx, workspace, args, decisionType) {
1355
1404
  const chatId = requireIdOrUuidFrom(args, "chat-id", "id");
1356
1405
  const chat = await requireAuth(ctx).apiClient.getChat(workspace, chatId);
@@ -1383,6 +1432,27 @@ async function respondToInterrupt(ctx, workspace, args, decisionType) {
1383
1432
  if (streamError) throw new Error(`Inference error: ${streamError}`);
1384
1433
  outputSingle({ role: "assistant", content: buffered }, ctx, MESSAGE_COLUMNS2);
1385
1434
  }
1435
+ function isDevProfile(env) {
1436
+ return env === "dev" || env === "development" || env === "local";
1437
+ }
1438
+ function isLocalApiOrigin(apiUrl) {
1439
+ if (!apiUrl) return false;
1440
+ try {
1441
+ const host = new URL(apiUrl).hostname.replace(/^\[|\]$/g, "");
1442
+ return host === "localhost" || host === "127.0.0.1" || host === "::1" || host.endsWith(".gravityrail.test");
1443
+ } catch {
1444
+ return false;
1445
+ }
1446
+ }
1447
+ async function shouldRedactChatContent(ctx, apiClient, workspace) {
1448
+ if (isDevProfile(ctx.env) && isLocalApiOrigin(ctx.envConfig?.apiUrl)) return false;
1449
+ try {
1450
+ const ws = await apiClient.getWorkspace(workspace);
1451
+ return ws.phiPostureDecision !== "allow_non_phi";
1452
+ } catch {
1453
+ return true;
1454
+ }
1455
+ }
1386
1456
  var chatsDomain = {
1387
1457
  name: "chats",
1388
1458
  description: "Manage chats",
@@ -1579,6 +1649,28 @@ var chatsDomain = {
1579
1649
  await respondToInterrupt(ctx, workspace, args, decisionType);
1580
1650
  }
1581
1651
  },
1652
+ {
1653
+ path: ["chats", "interrupt", "respond"],
1654
+ description: "Answer a chat's pending UI interrupt (form or choice list) with a value, and stream the continued reply.",
1655
+ mutates: true,
1656
+ requiresWorkspace: true,
1657
+ args: [
1658
+ {
1659
+ name: "chat-id",
1660
+ aliases: ["id"],
1661
+ description: "Chat ID (numeric id preferred; uuid accepted)",
1662
+ required: true
1663
+ },
1664
+ {
1665
+ name: "value",
1666
+ 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.`,
1667
+ required: true
1668
+ }
1669
+ ],
1670
+ handler: async ({ ctx, workspace, args }) => {
1671
+ await respondWithValue(ctx, workspace, args);
1672
+ }
1673
+ },
1582
1674
  {
1583
1675
  path: ["chats", "interrupt", "deny"],
1584
1676
  description: "Reject a chat's pending approval request with a reason.",
@@ -1609,7 +1701,17 @@ var chatsDomain = {
1609
1701
  description: "Chat ID (numeric id preferred; uuid accepted)",
1610
1702
  required: true
1611
1703
  },
1612
- { name: "stream", description: "Stream the AI response via AG-UI", isFlag: true }
1704
+ { name: "stream", description: "Stream the AI response via AG-UI", isFlag: true },
1705
+ {
1706
+ // Read by the handler below since this command was written, but
1707
+ // never declared — so `--auto-approve` parsed as nothing and the
1708
+ // turn stopped on every tool call anyway. Driving a manager turn
1709
+ // from the CLI meant approving each exec by hand, which is why
1710
+ // multi-turn QA was impractical.
1711
+ name: "auto-approve",
1712
+ description: "Approve tool calls automatically for this turn (development QA). Capability round-trips (screenshots, browser, forms) still prompt.",
1713
+ isFlag: true
1714
+ }
1613
1715
  ],
1614
1716
  handler: async ({ ctx, workspace, args, data }) => {
1615
1717
  const content = typeof data === "string" ? data : data?.content;
@@ -1644,7 +1746,11 @@ var chatsDomain = {
1644
1746
  );
1645
1747
  process.stdout.write("\n");
1646
1748
  if (!streamed.trim()) {
1647
- await printPendingApproval(ctx, workspace, chatId);
1749
+ if (!await printPendingApproval(ctx, workspace, chatId)) {
1750
+ throw new Error(
1751
+ `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.`
1752
+ );
1753
+ }
1648
1754
  }
1649
1755
  } else {
1650
1756
  const aguiClient = new AGUIClient({
@@ -1674,6 +1780,9 @@ var chatsDomain = {
1674
1780
  chatId
1675
1781
  );
1676
1782
  if (await printPendingApproval(ctx, workspace, chatId, chat)) return;
1783
+ throw new Error(
1784
+ `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.`
1785
+ );
1677
1786
  }
1678
1787
  outputSingle(
1679
1788
  {
@@ -1816,6 +1925,8 @@ var chatsDomain = {
1816
1925
  authed.apiClient.getChat(workspace, chatId),
1817
1926
  authed.apiClient.getChatMessages(workspace, chatId)
1818
1927
  ]);
1928
+ const redact = await shouldRedactChatContent(ctx, authed.apiClient, workspace);
1929
+ const hide = (value) => redact ? "[REDACTED]" : value;
1819
1930
  const result2 = {
1820
1931
  chat: {
1821
1932
  id: chat.id,
@@ -1831,7 +1942,7 @@ var chatsDomain = {
1831
1942
  // field projections (#20262). Always an array so the key
1832
1943
  // survives JSON serialization even when the API omits it.
1833
1944
  participants: (chat.participants ?? []).map((p) => ({
1834
- name: "[REDACTED]",
1945
+ name: hide(p.name),
1835
1946
  role: p.role,
1836
1947
  memberId: p.memberId ?? null,
1837
1948
  memberType: p.memberType ?? null
@@ -1839,11 +1950,13 @@ var chatsDomain = {
1839
1950
  },
1840
1951
  // Deliberate allow-list — never spread the API message. PHI
1841
1952
  // lives in content and (if ever added) sttMetadata.words
1842
- // (#21973); both must stay out of inspect output.
1953
+ // (#21973), so nothing beyond these three keys is emitted; the
1954
+ // content itself is gated on posture (see
1955
+ // shouldRedactChatContent), not blanket-hidden.
1843
1956
  messages: messages.map((m) => ({
1844
1957
  id: m.id,
1845
1958
  role: m.role,
1846
- content: "[REDACTED]"
1959
+ content: hide(m.content)
1847
1960
  }))
1848
1961
  };
1849
1962
  const assignmentId = chat.assignmentId;
@@ -1861,7 +1974,7 @@ var chatsDomain = {
1861
1974
  dataRecords: assignment.dataRecords?.map((dr) => ({
1862
1975
  id: dr.id,
1863
1976
  dataTypeId: dr.dataTypeId,
1864
- fieldValues: "[REDACTED]"
1977
+ fieldValues: hide(dr.fieldValues)
1865
1978
  }))
1866
1979
  };
1867
1980
  }
@@ -3207,8 +3320,6 @@ Provisioning started. Watch it come up with:
3207
3320
  "inboxes",
3208
3321
  "routines",
3209
3322
  "memberFilters",
3210
- "milestones",
3211
- "milestoneGoals",
3212
3323
  "customToolkits",
3213
3324
  "customTools",
3214
3325
  "pages",
@@ -3289,8 +3400,6 @@ Provisioning started. Watch it come up with:
3289
3400
  "inboxes",
3290
3401
  "routines",
3291
3402
  "memberFilters",
3292
- "milestones",
3293
- "milestoneGoals",
3294
3403
  "customToolkits",
3295
3404
  "customTools",
3296
3405
  "pages",
@@ -5682,8 +5791,156 @@ var journeysDomain = {
5682
5791
  ]
5683
5792
  };
5684
5793
 
5685
- // src/domains/personas.ts
5794
+ // src/domains/metrics.ts
5686
5795
  var COLUMNS11 = [
5796
+ COL.id(),
5797
+ COL.name(),
5798
+ { header: "SLUG", getValue: (item) => item.slug ?? "" },
5799
+ { header: "TYPE", getValue: (item) => item.metricType ?? "" },
5800
+ { header: "SOURCE", getValue: (item) => item.source ?? "" },
5801
+ { header: "UNIT", getValue: (item) => item.unit ?? "" },
5802
+ {
5803
+ header: "ENABLED",
5804
+ getValue: (item) => item.enabled ? "yes" : "no"
5805
+ },
5806
+ COL.created()
5807
+ ];
5808
+ var OBS_COLUMNS = [
5809
+ COL.id(),
5810
+ { header: "VALUE", getValue: (item) => String(item.value ?? "") },
5811
+ { header: "OBSERVED_AT", getValue: (item) => item.observedAt ?? "" },
5812
+ {
5813
+ header: "CHAT_ID",
5814
+ getValue: (item) => item.chatId != null ? String(item.chatId) : ""
5815
+ },
5816
+ {
5817
+ header: "MEMBER_ID",
5818
+ getValue: (item) => item.memberId != null ? String(item.memberId) : ""
5819
+ }
5820
+ ];
5821
+ var metricsDomain = {
5822
+ name: "metrics",
5823
+ description: "Customer-defined outcome metrics (CEL expression or LLM rubric) with time-series readout",
5824
+ commands: [
5825
+ ...crudCommands({
5826
+ prefix: ["metrics"],
5827
+ entityName: "metric",
5828
+ listMethod: "listMetrics",
5829
+ getMethod: "getMetric",
5830
+ createMethod: "createMetric",
5831
+ updateMethod: "updateMetric",
5832
+ deleteMethod: "deleteMetric",
5833
+ columns: COLUMNS11,
5834
+ paginationSupport: "full",
5835
+ createExamples: [
5836
+ `yarn gr metrics create -w $WID --allow-write --data '{"name":"SMS Channel Rate","metricType":"expression","celExpression":"chat.channel == \\"phone-sms\\"","unit":"rate"}'`,
5837
+ `yarn gr metrics create -w $WID --allow-write --data '{"name":"Qualified Engagement","metricType":"rubric","evaluationPrompt":"Did the user show buying intent?","unit":"rate"}'`
5838
+ ],
5839
+ createHelp: "Create a metric definition. metricType is expression (CEL) or rubric (LLM). MVP source is chat only."
5840
+ }),
5841
+ {
5842
+ path: ["metrics", "observations"],
5843
+ description: "List raw observations for a metric in a date range (may include PHI reason)",
5844
+ args: [
5845
+ { name: "id", required: true, description: "Metric ID" },
5846
+ {
5847
+ name: "start",
5848
+ required: true,
5849
+ description: "ISO-8601 inclusive lower bound on observed_at"
5850
+ },
5851
+ {
5852
+ name: "end",
5853
+ required: true,
5854
+ description: "ISO-8601 exclusive upper bound on observed_at"
5855
+ },
5856
+ { name: "page", description: "Page number (default 1)" },
5857
+ { name: "page-size", description: "Page size (default 100)" }
5858
+ ],
5859
+ requiresWorkspace: true,
5860
+ examples: [
5861
+ "yarn gr metrics observations --id 1 --start 2026-07-01T00:00:00Z --end 2026-08-01T00:00:00Z"
5862
+ ],
5863
+ handler: async (hctx) => {
5864
+ const client = requireAuth(hctx.ctx).apiClient;
5865
+ const id = requireNumber(hctx.args, "id");
5866
+ const start = requireString(hctx.args, "start");
5867
+ const end = requireString(hctx.args, "end");
5868
+ const page = hctx.args["page"] != null ? Number(hctx.args["page"]) : void 0;
5869
+ const pageSize = hctx.args["page-size"] != null ? Number(hctx.args["page-size"]) : void 0;
5870
+ const result2 = await client.listMetricObservations(hctx.workspace, id, {
5871
+ start,
5872
+ end,
5873
+ page,
5874
+ pageSize
5875
+ });
5876
+ outputData(result2.items ?? result2, hctx.ctx, OBS_COLUMNS);
5877
+ }
5878
+ },
5879
+ {
5880
+ path: ["metrics", "series"],
5881
+ description: "Time-bucketed aggregation for a metric (numeric only)",
5882
+ args: [
5883
+ { name: "id", required: true, description: "Metric ID" },
5884
+ {
5885
+ name: "start",
5886
+ required: true,
5887
+ description: "ISO-8601 inclusive lower bound on observed_at"
5888
+ },
5889
+ {
5890
+ name: "end",
5891
+ required: true,
5892
+ description: "ISO-8601 exclusive upper bound on observed_at"
5893
+ },
5894
+ { name: "bucket", description: "day | week (default day)" },
5895
+ {
5896
+ name: "aggregation",
5897
+ description: "avg | sum | count | rate (default avg)"
5898
+ }
5899
+ ],
5900
+ requiresWorkspace: true,
5901
+ examples: [
5902
+ "yarn gr metrics series --id 1 --start 2026-07-01T00:00:00Z --end 2026-08-01T00:00:00Z --bucket day"
5903
+ ],
5904
+ handler: async (hctx) => {
5905
+ const client = requireAuth(hctx.ctx).apiClient;
5906
+ const id = requireNumber(hctx.args, "id");
5907
+ const result2 = await client.getMetricSeries(hctx.workspace, id, {
5908
+ start: requireString(hctx.args, "start"),
5909
+ end: requireString(hctx.args, "end"),
5910
+ bucket: hctx.args["bucket"] ?? "day",
5911
+ aggregation: hctx.args["aggregation"] ?? "avg"
5912
+ });
5913
+ outputSingle(result2, hctx.ctx);
5914
+ }
5915
+ },
5916
+ {
5917
+ path: ["metrics", "compute-for-chat"],
5918
+ description: "On-demand evaluate enabled chat-source metrics for one chat (writes observations + dual-write feedback)",
5919
+ args: [
5920
+ {
5921
+ name: "chat-id",
5922
+ required: true,
5923
+ description: "Chat ID to evaluate"
5924
+ }
5925
+ ],
5926
+ requiresWorkspace: true,
5927
+ mutates: true,
5928
+ examples: ["yarn gr metrics compute-for-chat --chat-id 42 --allow-write"],
5929
+ handler: async (hctx) => {
5930
+ const client = requireAuth(hctx.ctx).apiClient;
5931
+ const chatId = requireNumber(hctx.args, "chat-id");
5932
+ if (chatId < 1) {
5933
+ throw new CLIError("--chat-id must be a positive number");
5934
+ }
5935
+ const result2 = await client.computeChatMetrics(hctx.workspace, { chatId });
5936
+ outputSingle(result2, hctx.ctx);
5937
+ }
5938
+ }
5939
+ ]
5940
+ };
5941
+
5942
+ // src/domains/personas.ts
5943
+ var COLUMNS12 = [
5687
5944
  COL.id(),
5688
5945
  COL.name(),
5689
5946
  { header: "AGE", getValue: (item) => item.age != null ? String(item.age) : "" },
@@ -5713,7 +5970,7 @@ var personasDomain = {
5713
5970
  createMethod: "createPersona",
5714
5971
  updateMethod: "updatePersona",
5715
5972
  deleteMethod: "deletePersona",
5716
- columns: COLUMNS11,
5973
+ columns: COLUMNS12,
5717
5974
  paginationSupport: "full"
5718
5975
  })
5719
5976
  ]
@@ -5773,11 +6030,11 @@ function shuffleInPlace(items) {
5773
6030
  }
5774
6031
  return items;
5775
6032
  }
5776
- function buildModelEvalBatchJobs(scenarios, models, rounds, warmup) {
6033
+ function buildModelEvalBatchJobs(scenarios, models, rounds, warmup, realtimeModels = []) {
5777
6034
  if (scenarios.length === 0) {
5778
6035
  throw new CLIError("At least one scenario is required");
5779
6036
  }
5780
- if (models.length === 0) {
6037
+ if (models.length === 0 && realtimeModels.length === 0) {
5781
6038
  throw new CLIError("At least one model is required");
5782
6039
  }
5783
6040
  if (rounds < 1) {
@@ -5798,12 +6055,60 @@ function buildModelEvalBatchJobs(scenarios, models, rounds, warmup) {
5798
6055
  modelId
5799
6056
  });
5800
6057
  }
6058
+ for (const modelId of realtimeModels) {
6059
+ roundJobs.push({
6060
+ round,
6061
+ warmup: warm,
6062
+ scenarioId: scenario.id,
6063
+ scenarioSlug: scenario.slug,
6064
+ scenarioName: scenario.name,
6065
+ modelId,
6066
+ realtime: true
6067
+ });
6068
+ }
5801
6069
  }
5802
6070
  shuffleInPlace(roundJobs);
5803
6071
  jobs.push(...roundJobs);
5804
6072
  }
5805
6073
  return jobs;
5806
6074
  }
6075
+ var REALTIME_AUDIO_USD_PER_MIN = {
6076
+ "xai:realtime:voice-agent": 0.05,
6077
+ // Grok Voice Think Fast 1
6078
+ "xai:realtime:voice-agent-2": 0.08
6079
+ // Grok Voice Think Fast 2
6080
+ };
6081
+ var DEFAULT_REALTIME_AUDIO_USD_PER_MIN = 0.08;
6082
+ var EST_AUDIO_MIN_PER_RUN = 3;
6083
+ var EST_TEXT_USD_PER_RUN = 0.012;
6084
+ function realtimeAudioUsdPerMin(modelId) {
6085
+ return REALTIME_AUDIO_USD_PER_MIN[modelId] ?? DEFAULT_REALTIME_AUDIO_USD_PER_MIN;
6086
+ }
6087
+ function estimateRealtimeRunCostUsd(modelId) {
6088
+ return EST_AUDIO_MIN_PER_RUN * realtimeAudioUsdPerMin(modelId) + EST_TEXT_USD_PER_RUN;
6089
+ }
6090
+ function projectRealtimeBatchCostUsd(jobs) {
6091
+ return jobs.filter((j) => j.realtime).reduce((sum, j) => sum + estimateRealtimeRunCostUsd(j.modelId), 0);
6092
+ }
6093
+ function actualRealtimeRowCostUsd(row, modelId) {
6094
+ const summary = row.timing_summary;
6095
+ const audioMs = summary ? summary["audio_output_ms_total"] : void 0;
6096
+ if (typeof audioMs === "number" && Number.isFinite(audioMs) && audioMs >= 0) {
6097
+ return audioMs / 6e4 * realtimeAudioUsdPerMin(modelId) + EST_TEXT_USD_PER_RUN;
6098
+ }
6099
+ return estimateRealtimeRunCostUsd(modelId);
6100
+ }
6101
+ function parseMaxBudgetUsd(raw, flagName) {
6102
+ if (raw === void 0 || raw === null || raw === "") {
6103
+ return void 0;
6104
+ }
6105
+ const value = Number(raw);
6106
+ if (!Number.isFinite(value) || value <= 0) {
6107
+ throw new CLIError(`${flagName} must be a positive number of USD`);
6108
+ }
6109
+ return value;
6110
+ }
6111
+ var REALTIME_MAX_CONCURRENCY = 4;
5807
6112
  function summarizeCriterionResults(run) {
5808
6113
  if (!run.criterionResults?.length) return void 0;
5809
6114
  return run.criterionResults.map((c) => ({
@@ -5812,7 +6117,7 @@ function summarizeCriterionResults(run) {
5812
6117
  score: c.score ?? null
5813
6118
  }));
5814
6119
  }
5815
- function runToBatchRow(job, workflowId, run, error) {
6120
+ function runToBatchRow(job, workflowId, run, error, batchLabel) {
5816
6121
  return {
5817
6122
  ts: (/* @__PURE__ */ new Date()).toISOString(),
5818
6123
  round: job.round,
@@ -5822,6 +6127,8 @@ function runToBatchRow(job, workflowId, run, error) {
5822
6127
  scenario_slug: job.scenarioSlug,
5823
6128
  scenario_name: job.scenarioName,
5824
6129
  model_id: job.modelId,
6130
+ ...job.realtime ? { realtime_model_id: job.modelId } : {},
6131
+ ...batchLabel ? { batch_label: batchLabel } : {},
5825
6132
  run_id: run?.id,
5826
6133
  error,
5827
6134
  failure_reason: run?.failureReason ?? null,
@@ -5876,7 +6183,10 @@ async function executeModelEvalJob(api, options, job, waitTimeoutMs, pollMs, sle
5876
6183
  const started = await api.startTestChatRun(options.workspace, options.workflowId, {
5877
6184
  scenarioId: job.scenarioId,
5878
6185
  driver: DriverMode.AUTO,
5879
- assistantChatModelId: job.modelId
6186
+ ...job.realtime ? {
6187
+ assistantRealtimeModelId: job.modelId,
6188
+ ...options.realtimeConfig ? { assistantRealtimeModelConfig: options.realtimeConfig } : {}
6189
+ } : { assistantChatModelId: job.modelId }
5880
6190
  });
5881
6191
  let run = await waitForRunTerminal(
5882
6192
  api,
@@ -5897,10 +6207,10 @@ async function executeModelEvalJob(api, options, job, waitTimeoutMs, pollMs, sle
5897
6207
  sleep2
5898
6208
  );
5899
6209
  }
5900
- return runToBatchRow(job, options.workflowId, run);
6210
+ return runToBatchRow(job, options.workflowId, run, void 0, options.batchLabel);
5901
6211
  } catch (e) {
5902
6212
  const message = e instanceof Error ? e.message : String(e);
5903
- return runToBatchRow(job, options.workflowId, null, message);
6213
+ return runToBatchRow(job, options.workflowId, null, message, options.batchLabel);
5904
6214
  }
5905
6215
  }
5906
6216
  function createSpacingGate(spacingSec, sleep2) {
@@ -5918,56 +6228,99 @@ function createSpacingGate(spacingSec, sleep2) {
5918
6228
  }
5919
6229
  async function executeModelEvalBatch(api, options) {
5920
6230
  const sleep2 = options.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
5921
- const concurrency = options.concurrency ?? 1;
5922
6231
  const jobs = buildModelEvalBatchJobs(
5923
6232
  options.scenarios,
5924
6233
  options.models,
5925
6234
  options.rounds,
5926
- options.warmup
6235
+ options.warmup,
6236
+ options.realtimeModels ?? []
5927
6237
  );
5928
6238
  const waitTimeoutMs = options.waitTimeoutSec * 1e3;
5929
6239
  const pollMs = options.pollIntervalSec * 1e3;
5930
6240
  const rows = [];
5931
6241
  let stopBatch = false;
6242
+ let budgetStopped = false;
6243
+ let actualSpendUsd = 0;
5932
6244
  const awaitSpacing = createSpacingGate(options.spacingSec, sleep2);
6245
+ const emitProgress = (line) => {
6246
+ if (options.onProgress) {
6247
+ options.onProgress(line);
6248
+ } else {
6249
+ process.stdout.write(`${line}
6250
+ `);
6251
+ }
6252
+ };
6253
+ const realtimeJobCount = jobs.filter((j) => j.realtime).length;
6254
+ let concurrency = options.concurrency ?? 1;
6255
+ if (realtimeJobCount > 0 && concurrency > REALTIME_MAX_CONCURRENCY) {
6256
+ emitProgress(
6257
+ `concurrency clamped ${concurrency} -> ${REALTIME_MAX_CONCURRENCY} (realtime models share the provider session pool)`
6258
+ );
6259
+ concurrency = REALTIME_MAX_CONCURRENCY;
6260
+ }
6261
+ if (realtimeJobCount > 0) {
6262
+ const projectedUsd = projectRealtimeBatchCostUsd(jobs);
6263
+ const cap = options.maxBudgetUsd;
6264
+ emitProgress(
6265
+ `realtime budget: projected ~$${projectedUsd.toFixed(2)} for ${realtimeJobCount} realtime run(s)${cap != null ? ` (cap $${cap.toFixed(2)})` : ""}`
6266
+ );
6267
+ if (cap != null && projectedUsd > cap) {
6268
+ throw new CLIError(
6269
+ `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.`
6270
+ );
6271
+ }
6272
+ }
5933
6273
  const recordRow = (job, row) => {
5934
6274
  rows.push(row);
5935
6275
  if (options.outPath) {
5936
6276
  appendFileSync(options.outPath, `${JSON.stringify(row)}
5937
6277
  `);
5938
6278
  }
5939
- const progress = formatBatchProgressLine(job, row);
5940
- if (options.onProgress) {
5941
- options.onProgress(progress);
5942
- } else {
5943
- process.stdout.write(`${progress}
5944
- `);
5945
- }
6279
+ emitProgress(formatBatchProgressLine(job, row));
5946
6280
  };
6281
+ const makeSkippedRow = (job) => ({
6282
+ ...runToBatchRow(
6283
+ job,
6284
+ options.workflowId,
6285
+ null,
6286
+ budgetStopped ? "batch stopped: realtime budget cap reached" : "batch aborted before start",
6287
+ options.batchLabel
6288
+ ),
6289
+ batch_skipped: true
6290
+ });
5947
6291
  const runOne = async (job) => {
5948
6292
  await awaitSpacing();
5949
6293
  if (stopBatch) {
5950
- return {
5951
- ...runToBatchRow(job, options.workflowId, null, "batch aborted before start"),
5952
- batch_skipped: true
5953
- };
6294
+ return makeSkippedRow(job);
5954
6295
  }
5955
6296
  const row = await executeModelEvalJob(api, options, job, waitTimeoutMs, pollMs, sleep2);
5956
6297
  if (isConfigurationBlockerFailure(row.failure_reason)) {
5957
6298
  stopBatch = true;
5958
6299
  }
6300
+ if (job.realtime && !row.batch_skipped) {
6301
+ actualSpendUsd += actualRealtimeRowCostUsd(row, job.modelId);
6302
+ if (options.maxBudgetUsd != null && actualSpendUsd >= options.maxBudgetUsd && !stopBatch) {
6303
+ stopBatch = true;
6304
+ budgetStopped = true;
6305
+ emitProgress(
6306
+ `realtime budget: actual spend ~$${actualSpendUsd.toFixed(2)} reached cap $${options.maxBudgetUsd.toFixed(2)} \u2014 stopping dispatch`
6307
+ );
6308
+ }
6309
+ }
5959
6310
  return row;
5960
6311
  };
5961
6312
  if (concurrency <= 1) {
5962
- for (const job of jobs) {
6313
+ let stoppedAt = jobs.length;
6314
+ for (const [index, job] of jobs.entries()) {
5963
6315
  if (stopBatch) {
6316
+ stoppedAt = index;
5964
6317
  break;
5965
6318
  }
5966
6319
  const row = await runOne(job);
5967
6320
  recordRow(job, row);
5968
- if (stopBatch) {
5969
- break;
5970
- }
6321
+ }
6322
+ for (const job of jobs.slice(stoppedAt)) {
6323
+ recordRow(job, makeSkippedRow(job));
5971
6324
  }
5972
6325
  } else {
5973
6326
  const results = new Array(jobs.length);
@@ -5983,6 +6336,9 @@ async function executeModelEvalBatch(api, options) {
5983
6336
  return;
5984
6337
  }
5985
6338
  const job = jobs[index];
6339
+ if (job === void 0) {
6340
+ return;
6341
+ }
5986
6342
  const row = await runOne(job);
5987
6343
  results[index] = row;
5988
6344
  recordRow(job, row);
@@ -5991,20 +6347,19 @@ async function executeModelEvalBatch(api, options) {
5991
6347
  const workers = Array.from({ length: Math.min(concurrency, jobs.length) }, () => worker());
5992
6348
  await Promise.all(workers);
5993
6349
  if (stopBatch) {
5994
- for (let index = 0; index < jobs.length; index++) {
6350
+ jobs.forEach((job, index) => {
5995
6351
  if (results[index] !== void 0) {
5996
- continue;
6352
+ return;
5997
6353
  }
5998
- const job = jobs[index];
5999
- const skipped = {
6000
- ...runToBatchRow(job, options.workflowId, null, "batch aborted before start"),
6001
- batch_skipped: true
6002
- };
6354
+ const skipped = makeSkippedRow(job);
6003
6355
  results[index] = skipped;
6004
6356
  recordRow(job, skipped);
6005
- }
6357
+ });
6006
6358
  }
6007
6359
  }
6360
+ if (realtimeJobCount > 0) {
6361
+ emitProgress(`realtime budget: total actual spend ~$${actualSpendUsd.toFixed(2)}`);
6362
+ }
6008
6363
  const blockerRow = rows.find((r) => isConfigurationBlockerFailure(r.failure_reason));
6009
6364
  if (blockerRow) {
6010
6365
  throw new CLIError(
@@ -6306,9 +6661,29 @@ var qualificationsDomain = {
6306
6661
  { name: "workflow-id", description: "Workflow ID", required: true },
6307
6662
  {
6308
6663
  name: "models",
6309
- description: "Comma-separated assistant chat model IDs",
6664
+ description: "Comma-separated assistant chat model IDs (optional with --realtime-models)",
6310
6665
  alias: "m",
6311
- required: true
6666
+ required: false
6667
+ },
6668
+ {
6669
+ name: "realtime-models",
6670
+ description: "Comma-separated native realtime model IDs (each forwarded as assistantRealtimeModelId)",
6671
+ required: false
6672
+ },
6673
+ {
6674
+ name: "realtime-config",
6675
+ description: "JSON object forwarded as assistantRealtimeModelConfig on realtime jobs",
6676
+ required: false
6677
+ },
6678
+ {
6679
+ name: "batch-label",
6680
+ description: "Label recorded on every JSONL row for cross-batch comparison",
6681
+ required: false
6682
+ },
6683
+ {
6684
+ name: "max-budget-usd",
6685
+ 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)",
6686
+ required: false
6312
6687
  },
6313
6688
  {
6314
6689
  name: "scenario-ids",
@@ -6348,7 +6723,31 @@ var qualificationsDomain = {
6348
6723
  { name: "out", description: "Append JSONL rows to this file" }
6349
6724
  ],
6350
6725
  handler: async ({ ctx, workspace, args }) => {
6351
- const models = parseCommaSeparatedList(requireString(args, "models"), "--models");
6726
+ const models = args.models ? parseCommaSeparatedList(String(args.models), "--models") : [];
6727
+ const realtimeModels = args["realtime-models"] ? parseCommaSeparatedList(String(args["realtime-models"]), "--realtime-models") : [];
6728
+ if (models.length === 0 && realtimeModels.length === 0) {
6729
+ throw new CLIError("Specify --models and/or --realtime-models");
6730
+ }
6731
+ let realtimeConfig;
6732
+ if (args["realtime-config"]) {
6733
+ if (realtimeModels.length === 0) {
6734
+ throw new CLIError("--realtime-config requires --realtime-models");
6735
+ }
6736
+ let parsed;
6737
+ try {
6738
+ parsed = JSON.parse(String(args["realtime-config"]));
6739
+ } catch {
6740
+ throw new CLIError("--realtime-config is not valid JSON");
6741
+ }
6742
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
6743
+ throw new CLIError(
6744
+ "--realtime-config must be a JSON object (not an array or null)"
6745
+ );
6746
+ }
6747
+ realtimeConfig = parsed;
6748
+ }
6749
+ const batchLabel = args["batch-label"] ? String(args["batch-label"]) : void 0;
6750
+ const maxBudgetUsd = parseMaxBudgetUsd(args["max-budget-usd"], "--max-budget-usd");
6352
6751
  const allScenarios = Boolean(args["all-scenarios"]);
6353
6752
  const scenarioIdsRaw = args["scenario-ids"];
6354
6753
  if (allScenarios && scenarioIdsRaw) {
@@ -6389,6 +6788,10 @@ var qualificationsDomain = {
6389
6788
  workspace,
6390
6789
  workflowId,
6391
6790
  models,
6791
+ realtimeModels,
6792
+ realtimeConfig,
6793
+ batchLabel,
6794
+ maxBudgetUsd,
6392
6795
  scenarios,
6393
6796
  rounds,
6394
6797
  warmup,
@@ -6703,7 +7106,7 @@ Relations (relationMatch): ${relations.join(", ")}`);
6703
7106
 
6704
7107
  // src/domains/sites.ts
6705
7108
  import { readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
6706
- var COLUMNS12 = [
7109
+ var COLUMNS13 = [
6707
7110
  COL.id(),
6708
7111
  COL.name(),
6709
7112
  { header: "SLUG", getValue: (item) => item.slug ?? "" },
@@ -6757,7 +7160,7 @@ var sitesDomain = {
6757
7160
  createMethod: "createSite",
6758
7161
  updateMethod: "updateSite",
6759
7162
  deleteMethod: "deleteSite",
6760
- columns: COLUMNS12
7163
+ columns: COLUMNS13
6761
7164
  }),
6762
7165
  // Pages sub-resource
6763
7166
  {
@@ -7428,7 +7831,7 @@ var abilitiesDomain = {
7428
7831
  };
7429
7832
 
7430
7833
  // src/domains/access-grants.ts
7431
- var COLUMNS13 = [
7834
+ var COLUMNS14 = [
7432
7835
  COL.id(),
7433
7836
  COL.status(),
7434
7837
  { header: "GRANTOR", getValue: (item) => String(item.grantorMemberId ?? "") },
@@ -7445,7 +7848,7 @@ var accessGrantsDomain = {
7445
7848
  requiresWorkspace: true,
7446
7849
  handler: async ({ ctx, workspace }) => {
7447
7850
  const result2 = await requireAuth(ctx).apiClient.getAccessGrants(workspace);
7448
- outputData(listResult(result2, false), ctx, COLUMNS13);
7851
+ outputData(listResult(result2, false), ctx, COLUMNS14);
7449
7852
  }
7450
7853
  },
7451
7854
  {
@@ -7458,7 +7861,7 @@ var accessGrantsDomain = {
7458
7861
  workspace,
7459
7862
  requireString(args, "id")
7460
7863
  );
7461
- outputSingle(result2, ctx, COLUMNS13);
7864
+ outputSingle(result2, ctx, COLUMNS14);
7462
7865
  }
7463
7866
  },
7464
7867
  {
@@ -7471,7 +7874,7 @@ var accessGrantsDomain = {
7471
7874
  workspace,
7472
7875
  data
7473
7876
  );
7474
- outputSingle(result2, ctx, COLUMNS13);
7877
+ outputSingle(result2, ctx, COLUMNS14);
7475
7878
  }
7476
7879
  },
7477
7880
  {
@@ -7482,7 +7885,7 @@ var accessGrantsDomain = {
7482
7885
  const result2 = await requireAuth(ctx).apiClient.getMyReceivedGrants(workspace, {
7483
7886
  pageSize: 200
7484
7887
  });
7485
- outputData(listResult(result2, false), ctx, COLUMNS13);
7888
+ outputData(listResult(result2, false), ctx, COLUMNS14);
7486
7889
  }
7487
7890
  },
7488
7891
  {
@@ -7493,7 +7896,7 @@ var accessGrantsDomain = {
7493
7896
  const result2 = await requireAuth(ctx).apiClient.getMyGivenGrants(workspace, {
7494
7897
  pageSize: 200
7495
7898
  });
7496
- outputData(listResult(result2, false), ctx, COLUMNS13);
7899
+ outputData(listResult(result2, false), ctx, COLUMNS14);
7497
7900
  }
7498
7901
  },
7499
7902
  {
@@ -7508,7 +7911,7 @@ var accessGrantsDomain = {
7508
7911
  requireString(args, "id"),
7509
7912
  data ?? {}
7510
7913
  );
7511
- outputSingle(result2, ctx, COLUMNS13);
7914
+ outputSingle(result2, ctx, COLUMNS14);
7512
7915
  }
7513
7916
  },
7514
7917
  {
@@ -7523,7 +7926,7 @@ var accessGrantsDomain = {
7523
7926
  requireString(args, "id"),
7524
7927
  data ?? {}
7525
7928
  );
7526
- outputSingle(result2, ctx, COLUMNS13);
7929
+ outputSingle(result2, ctx, COLUMNS14);
7527
7930
  }
7528
7931
  },
7529
7932
  {
@@ -7536,7 +7939,7 @@ var accessGrantsDomain = {
7536
7939
  workspace,
7537
7940
  requireNumber(args, "member-id")
7538
7941
  );
7539
- outputData(listResult(result2, false), ctx, COLUMNS13);
7942
+ outputData(listResult(result2, false), ctx, COLUMNS14);
7540
7943
  }
7541
7944
  },
7542
7945
  {
@@ -7561,14 +7964,14 @@ var accessGrantsDomain = {
7561
7964
  pageSize: 200
7562
7965
  }
7563
7966
  );
7564
- outputData(listResult(result2, false), ctx, COLUMNS13);
7967
+ outputData(listResult(result2, false), ctx, COLUMNS14);
7565
7968
  }
7566
7969
  }
7567
7970
  ]
7568
7971
  };
7569
7972
 
7570
7973
  // src/domains/ai-models.ts
7571
- var COLUMNS14 = [
7974
+ var COLUMNS15 = [
7572
7975
  { header: "ID", getValue: (item) => String(item.id ?? item.modelId ?? "") },
7573
7976
  { header: "NAME", getValue: (item) => item.name ?? item.displayName ?? "" },
7574
7977
  { header: "PROVIDER", getValue: (item) => item.provider ?? "" },
@@ -7584,7 +7987,7 @@ var aiModelsDomain = {
7584
7987
  requiresWorkspace: false,
7585
7988
  handler: async ({ ctx }) => {
7586
7989
  const result2 = await requireAuth(ctx).apiClient.getAllModels();
7587
- outputData(result2, ctx, COLUMNS14);
7990
+ outputData(result2, ctx, COLUMNS15);
7588
7991
  }
7589
7992
  },
7590
7993
  {
@@ -7593,7 +7996,7 @@ var aiModelsDomain = {
7593
7996
  requiresWorkspace: false,
7594
7997
  handler: async ({ ctx }) => {
7595
7998
  const result2 = await requireAuth(ctx).apiClient.getChatModels();
7596
- outputData(result2, ctx, COLUMNS14);
7999
+ outputData(result2, ctx, COLUMNS15);
7597
8000
  }
7598
8001
  },
7599
8002
  {
@@ -7602,7 +8005,7 @@ var aiModelsDomain = {
7602
8005
  requiresWorkspace: false,
7603
8006
  handler: async ({ ctx }) => {
7604
8007
  const result2 = await requireAuth(ctx).apiClient.getRealtimeModels();
7605
- outputData(result2, ctx, COLUMNS14);
8008
+ outputData(result2, ctx, COLUMNS15);
7606
8009
  }
7607
8010
  },
7608
8011
  {
@@ -7611,14 +8014,14 @@ var aiModelsDomain = {
7611
8014
  requiresWorkspace: false,
7612
8015
  handler: async ({ ctx }) => {
7613
8016
  const result2 = await requireAuth(ctx).apiClient.getVoiceModels();
7614
- outputData(result2, ctx, COLUMNS14);
8017
+ outputData(result2, ctx, COLUMNS15);
7615
8018
  }
7616
8019
  }
7617
8020
  ]
7618
8021
  };
7619
8022
 
7620
8023
  // src/domains/api-keys.ts
7621
- var COLUMNS15 = [
8024
+ var COLUMNS16 = [
7622
8025
  COL.id(),
7623
8026
  COL.name(),
7624
8027
  { header: "PREFIX", getValue: (item) => item.prefix ?? "" },
@@ -7641,7 +8044,7 @@ var apiKeysDomain = {
7641
8044
  requiresWorkspace: true,
7642
8045
  handler: async ({ ctx, workspace }) => {
7643
8046
  const result2 = await requireAuth(ctx).apiClient.getApiKeys(workspace);
7644
- outputData(result2, ctx, COLUMNS15);
8047
+ outputData(result2, ctx, COLUMNS16);
7645
8048
  }
7646
8049
  },
7647
8050
  {
@@ -7676,7 +8079,7 @@ var apiKeysDomain = {
7676
8079
  requiresWorkspace: false,
7677
8080
  handler: async ({ ctx }) => {
7678
8081
  const result2 = await requireAuth(ctx).apiClient.getGlobalApiKeys();
7679
- outputData(result2, ctx, COLUMNS15);
8082
+ outputData(result2, ctx, COLUMNS16);
7680
8083
  }
7681
8084
  },
7682
8085
  {
@@ -8326,7 +8729,7 @@ var conciergeDomain = {
8326
8729
  };
8327
8730
 
8328
8731
  // src/domains/custom-toolkits.ts
8329
- var COLUMNS16 = [COL.id(), COL.name(), COL.description(), COL.enabled()];
8732
+ var COLUMNS17 = [COL.id(), COL.name(), COL.description(), COL.enabled()];
8330
8733
  var TOOL_COLUMNS2 = [COL.id(), COL.name(), COL.description()];
8331
8734
  var customToolkitsDomain = {
8332
8735
  name: "custom-toolkits",
@@ -8340,7 +8743,7 @@ var customToolkitsDomain = {
8340
8743
  createMethod: "createCustomToolkit",
8341
8744
  updateMethod: "updateCustomToolkit",
8342
8745
  deleteMethod: "deleteCustomToolkit",
8343
- columns: COLUMNS16
8746
+ columns: COLUMNS17
8344
8747
  }),
8345
8748
  {
8346
8749
  path: ["custom-toolkits", "enable"],
@@ -8353,7 +8756,7 @@ var customToolkitsDomain = {
8353
8756
  workspace,
8354
8757
  requireNumber(args, "id")
8355
8758
  );
8356
- outputSingle(result2, ctx, COLUMNS16);
8759
+ outputSingle(result2, ctx, COLUMNS17);
8357
8760
  }
8358
8761
  },
8359
8762
  {
@@ -8367,7 +8770,7 @@ var customToolkitsDomain = {
8367
8770
  workspace,
8368
8771
  requireNumber(args, "id")
8369
8772
  );
8370
- outputSingle(result2, ctx, COLUMNS16);
8773
+ outputSingle(result2, ctx, COLUMNS17);
8371
8774
  }
8372
8775
  },
8373
8776
  // Tools — nested resource requiring toolkitId
@@ -8479,7 +8882,7 @@ var docsDomain = {
8479
8882
  };
8480
8883
 
8481
8884
  // src/domains/features.ts
8482
- var COLUMNS17 = [
8885
+ var COLUMNS18 = [
8483
8886
  { header: "SLUG", getValue: (item) => item.slug ?? "" },
8484
8887
  COL.name(),
8485
8888
  COL.description()
@@ -8494,7 +8897,7 @@ var featuresDomain = {
8494
8897
  requiresWorkspace: false,
8495
8898
  handler: async ({ ctx }) => {
8496
8899
  const result2 = await requireAuth(ctx).apiClient.getFeatureRegistry();
8497
- outputData(result2, ctx, COLUMNS17);
8900
+ outputData(result2, ctx, COLUMNS18);
8498
8901
  }
8499
8902
  },
8500
8903
  {
@@ -8506,7 +8909,7 @@ var featuresDomain = {
8506
8909
  const result2 = await requireAuth(ctx).apiClient.getFeatureBySlug(
8507
8910
  requireString(args, "slug")
8508
8911
  );
8509
- outputSingle(result2, ctx, COLUMNS17);
8912
+ outputSingle(result2, ctx, COLUMNS18);
8510
8913
  }
8511
8914
  },
8512
8915
  {
@@ -8515,14 +8918,14 @@ var featuresDomain = {
8515
8918
  requiresWorkspace: true,
8516
8919
  handler: async ({ ctx }) => {
8517
8920
  const result2 = await requireAuth(ctx).apiClient.getAvailableWorkspaceFeatures();
8518
- outputData(result2, ctx, COLUMNS17);
8921
+ outputData(result2, ctx, COLUMNS18);
8519
8922
  }
8520
8923
  }
8521
8924
  ]
8522
8925
  };
8523
8926
 
8524
8927
  // src/domains/inboxes.ts
8525
- var COLUMNS18 = [
8928
+ var COLUMNS19 = [
8526
8929
  COL.id(),
8527
8930
  COL.name(),
8528
8931
  { header: "EMAIL", getValue: (item) => item.emailAddress ?? "" },
@@ -8547,7 +8950,7 @@ var inboxesDomain = {
8547
8950
  createMethod: "createInbox",
8548
8951
  updateMethod: "updateInbox",
8549
8952
  deleteMethod: "deleteInbox",
8550
- columns: COLUMNS18
8953
+ columns: COLUMNS19
8551
8954
  }),
8552
8955
  {
8553
8956
  path: ["inboxes", "emails", "list"],
@@ -8632,7 +9035,7 @@ var inboxesDomain = {
8632
9035
  };
8633
9036
 
8634
9037
  // src/domains/mcp-servers.ts
8635
- var COLUMNS19 = [
9038
+ var COLUMNS20 = [
8636
9039
  COL.id(),
8637
9040
  COL.name(),
8638
9041
  { header: "URL", getValue: (item) => item.url ?? "" },
@@ -8650,7 +9053,7 @@ var mcpServersDomain = {
8650
9053
  createMethod: "createMcpServer",
8651
9054
  updateMethod: "updateMcpServer",
8652
9055
  deleteMethod: "deleteMcpServer",
8653
- columns: COLUMNS19
9056
+ columns: COLUMNS20
8654
9057
  }),
8655
9058
  {
8656
9059
  path: ["mcp-servers", "enable"],
@@ -8663,7 +9066,7 @@ var mcpServersDomain = {
8663
9066
  workspace,
8664
9067
  requireNumber(args, "id")
8665
9068
  );
8666
- outputSingle(result2, ctx, COLUMNS19);
9069
+ outputSingle(result2, ctx, COLUMNS20);
8667
9070
  }
8668
9071
  },
8669
9072
  {
@@ -8677,7 +9080,7 @@ var mcpServersDomain = {
8677
9080
  workspace,
8678
9081
  requireNumber(args, "id")
8679
9082
  );
8680
- outputSingle(result2, ctx, COLUMNS19);
9083
+ outputSingle(result2, ctx, COLUMNS20);
8681
9084
  }
8682
9085
  },
8683
9086
  {
@@ -8697,7 +9100,7 @@ var mcpServersDomain = {
8697
9100
  };
8698
9101
 
8699
9102
  // src/domains/member-memories.ts
8700
- var COLUMNS20 = [
9103
+ var COLUMNS21 = [
8701
9104
  { header: "KEY", getValue: (item) => item.key ?? "" },
8702
9105
  { header: "TYPE", getValue: (item) => item.type ?? "basic" },
8703
9106
  { header: "DESCRIPTION", getValue: (item) => truncate(item.description ?? "", 60) },
@@ -8731,7 +9134,7 @@ var memberMemoriesDomain = {
8731
9134
  type,
8732
9135
  query
8733
9136
  });
8734
- outputData(listResult(result2, false), ctx, COLUMNS20);
9137
+ outputData(listResult(result2, false), ctx, COLUMNS21);
8735
9138
  }
8736
9139
  },
8737
9140
  {
@@ -8750,7 +9153,7 @@ var memberMemoriesDomain = {
8750
9153
  memberId,
8751
9154
  key
8752
9155
  );
8753
- outputData(result2, ctx, COLUMNS20);
9156
+ outputData(result2, ctx, COLUMNS21);
8754
9157
  }
8755
9158
  },
8756
9159
  {
@@ -8781,7 +9184,7 @@ var memberMemoriesDomain = {
8781
9184
  ...priority !== void 0 && { priority }
8782
9185
  }
8783
9186
  );
8784
- outputData(result2, ctx, COLUMNS20);
9187
+ outputData(result2, ctx, COLUMNS21);
8785
9188
  }
8786
9189
  },
8787
9190
  {
@@ -8814,33 +9217,56 @@ var memberMemoriesDomain = {
8814
9217
  ]
8815
9218
  };
8816
9219
 
8817
- // src/domains/milestones.ts
8818
- var COLUMNS21 = [
9220
+ // src/domains/intervention-requests.ts
9221
+ var COLUMNS22 = [
8819
9222
  COL.id(),
8820
- COL.name(),
8821
- COL.status(),
8822
- { header: "DUE DATE", getValue: (item) => item.dueDate ?? "" }
9223
+ { header: "KIND", getValue: (item) => item.kind ?? "" },
9224
+ { header: "CHAT", getValue: (item) => item.chatId ?? "" },
9225
+ {
9226
+ header: "STATUS",
9227
+ getValue: (item) => item.resolvedAt ? item.resolution ?? "resolved" : "open"
9228
+ },
9229
+ // Zero is the interesting value: the intervention was requested and nobody
9230
+ // was told, which is what `--unrouted` filters for.
9231
+ { header: "NOTIFIED", getValue: (item) => item.notifiedCount ?? 0 },
9232
+ { header: "REASON", getValue: (item) => item.reasonCode ?? "" },
9233
+ { header: "CREATED", getValue: (item) => item.createdAt ?? "" }
8823
9234
  ];
8824
- var milestonesDomain = {
8825
- name: "milestones",
8826
- description: "Manage milestones",
9235
+ var interventionRequestsDomain = {
9236
+ name: "interventions",
9237
+ description: "Inspect intervention requests \u2014 escalations and other asks for a person",
8827
9238
  commands: [
8828
- ...crudCommands({
8829
- prefix: ["milestones"],
8830
- entityName: "milestone",
8831
- listMethod: "getMilestones",
8832
- getMethod: "getMilestone",
8833
- createMethod: "createMilestone",
8834
- updateMethod: "updateMilestone",
8835
- deleteMethod: "deleteMilestone",
8836
- columns: COLUMNS21,
8837
- paginationSupport: "full"
8838
- })
9239
+ {
9240
+ path: ["interventions", "list"],
9241
+ description: "List intervention requests (escalations etc). Newest first. Read-only.",
9242
+ requiresWorkspace: true,
9243
+ args: [
9244
+ { name: "kind", description: "escalation | contributor_input | approval" },
9245
+ { name: "open", description: "Only unresolved requests", isFlag: true },
9246
+ { name: "chat-id", description: "Only requests for this chat" },
9247
+ {
9248
+ name: "unrouted",
9249
+ description: "Only requests that notified NOBODY \u2014 escalations that reached no one",
9250
+ isFlag: true
9251
+ },
9252
+ { name: "limit", description: "Max rows (default 50, max 200)" }
9253
+ ],
9254
+ handler: async ({ ctx, workspace, args, requireAuth: requireAuth2, outputData: outputData2 }) => {
9255
+ const result2 = await requireAuth2(ctx).apiClient.getInterventionRequests(workspace, {
9256
+ kind: args["kind"],
9257
+ openOnly: Boolean(args["open"]),
9258
+ chatId: args["chat-id"] ? Number(args["chat-id"]) : void 0,
9259
+ unroutedOnly: Boolean(args["unrouted"]),
9260
+ limit: args["limit"] ? Number(args["limit"]) : void 0
9261
+ });
9262
+ outputData2(result2, ctx, COLUMNS22);
9263
+ }
9264
+ }
8839
9265
  ]
8840
9266
  };
8841
9267
 
8842
9268
  // src/domains/notification-rules.ts
8843
- var COLUMNS22 = [
9269
+ var COLUMNS23 = [
8844
9270
  COL.id(),
8845
9271
  COL.name(),
8846
9272
  { header: "TYPE", getValue: (item) => item.noticeType ?? "" },
@@ -8857,7 +9283,7 @@ var notificationRulesDomain = {
8857
9283
  createMethod: "createNotificationRule",
8858
9284
  updateMethod: "updateNotificationRule",
8859
9285
  deleteMethod: "deleteNotificationRule",
8860
- columns: COLUMNS22
9286
+ columns: COLUMNS23
8861
9287
  })
8862
9288
  ]
8863
9289
  };
@@ -8917,7 +9343,7 @@ var oauthDomain = {
8917
9343
  };
8918
9344
 
8919
9345
  // src/domains/operator-groups.ts
8920
- var COLUMNS23 = [COL.id(), COL.name(), COL.description()];
9346
+ var COLUMNS24 = [COL.id(), COL.name(), COL.description()];
8921
9347
  var operatorGroupsDomain = {
8922
9348
  name: "operator-groups",
8923
9349
  description: "Manage operator groups",
@@ -8930,7 +9356,7 @@ var operatorGroupsDomain = {
8930
9356
  createMethod: "createOperatorGroup",
8931
9357
  updateMethod: "updateOperatorGroup",
8932
9358
  deleteMethod: "deleteOperatorGroup",
8933
- columns: COLUMNS23
9359
+ columns: COLUMNS24
8934
9360
  }),
8935
9361
  {
8936
9362
  path: ["operator-groups", "add-member"],
@@ -9008,13 +9434,6 @@ var ORG_DOMAIN_COLUMNS = [
9008
9434
  maxWidth: 80
9009
9435
  }
9010
9436
  ];
9011
- function requireOrgId(args) {
9012
- const val = args["org-uuid"] ?? args.org;
9013
- if (typeof val !== "string" || !val) {
9014
- throw new CLIError("Missing required argument: --org-uuid");
9015
- }
9016
- return val;
9017
- }
9018
9437
  function requireDomainUuid(args) {
9019
9438
  const val = args["domain-uuid"] ?? args.uuid;
9020
9439
  if (typeof val !== "string" || !val) {
@@ -9029,7 +9448,7 @@ function requireDomain(args) {
9029
9448
  }
9030
9449
  return val;
9031
9450
  }
9032
- var ORG_UUID_ARG = {
9451
+ var ORG_UUID_ARG2 = {
9033
9452
  name: "org-uuid",
9034
9453
  aliases: ["org"],
9035
9454
  description: "Organization UUID or ID",
@@ -9050,13 +9469,13 @@ function emailVerifyCommand(path4, description) {
9050
9469
  description,
9051
9470
  mutates: true,
9052
9471
  requiresWorkspace: false,
9053
- args: [ORG_UUID_ARG, DOMAIN_UUID_ARG],
9472
+ args: [ORG_UUID_ARG2, DOMAIN_UUID_ARG],
9054
9473
  examples: [
9055
9474
  `yarn gr ${path4.join(" ")} --org-uuid $ORG_UUID --domain-uuid $DOMAIN_UUID --allow-write`
9056
9475
  ],
9057
9476
  handler: async (hctx) => {
9058
9477
  const result2 = await requireAuth(hctx.ctx).apiClient.verifyOrgDomainEmail(
9059
- requireOrgId(hctx.args),
9478
+ requireOrgRef(hctx.args),
9060
9479
  requireDomainUuid(hctx.args)
9061
9480
  );
9062
9481
  outputSingle(result2, hctx.ctx);
@@ -9069,13 +9488,13 @@ function siteVerifyCommand(path4, description) {
9069
9488
  description,
9070
9489
  mutates: true,
9071
9490
  requiresWorkspace: false,
9072
- args: [ORG_UUID_ARG, DOMAIN_UUID_ARG],
9491
+ args: [ORG_UUID_ARG2, DOMAIN_UUID_ARG],
9073
9492
  examples: [
9074
9493
  `yarn gr ${path4.join(" ")} --org-uuid $ORG_UUID --domain-uuid $DOMAIN_UUID --allow-write`
9075
9494
  ],
9076
9495
  handler: async (hctx) => {
9077
9496
  const result2 = await requireAuth(hctx.ctx).apiClient.verifyOrgDomainSite(
9078
- requireOrgId(hctx.args),
9497
+ requireOrgRef(hctx.args),
9079
9498
  requireDomainUuid(hctx.args)
9080
9499
  );
9081
9500
  outputSingle(result2, hctx.ctx);
@@ -9089,7 +9508,7 @@ function registerDomainCommand(path4) {
9089
9508
  mutates: true,
9090
9509
  requiresWorkspace: false,
9091
9510
  args: [
9092
- ORG_UUID_ARG,
9511
+ ORG_UUID_ARG2,
9093
9512
  { name: "domain", description: "Domain to register, e.g. example.com", required: true }
9094
9513
  ],
9095
9514
  examples: [
@@ -9097,7 +9516,7 @@ function registerDomainCommand(path4) {
9097
9516
  ],
9098
9517
  handler: async (hctx) => {
9099
9518
  const result2 = await requireAuth(hctx.ctx).apiClient.registerOrgDomain(
9100
- requireOrgId(hctx.args),
9519
+ requireOrgRef(hctx.args),
9101
9520
  requireDomain(hctx.args)
9102
9521
  );
9103
9522
  outputSingle(result2, hctx.ctx, ORG_DOMAIN_COLUMNS);
@@ -9109,11 +9528,11 @@ var domainCommands = [
9109
9528
  path: ["org", "domains", "list"],
9110
9529
  description: "List domains registered to an organization",
9111
9530
  requiresWorkspace: false,
9112
- args: [ORG_UUID_ARG],
9531
+ args: [ORG_UUID_ARG2],
9113
9532
  examples: ["yarn gr org domains list --org-uuid $ORG_UUID"],
9114
9533
  handler: async (hctx) => {
9115
9534
  const result2 = await requireAuth(hctx.ctx).apiClient.listOrgDomains(
9116
- requireOrgId(hctx.args)
9535
+ requireOrgRef(hctx.args)
9117
9536
  );
9118
9537
  outputData(result2, hctx.ctx, ORG_DOMAIN_COLUMNS);
9119
9538
  }
@@ -9122,11 +9541,11 @@ var domainCommands = [
9122
9541
  path: ["org", "domains", "get"],
9123
9542
  description: "Get a registered organization domain",
9124
9543
  requiresWorkspace: false,
9125
- args: [ORG_UUID_ARG, DOMAIN_UUID_ARG],
9544
+ args: [ORG_UUID_ARG2, DOMAIN_UUID_ARG],
9126
9545
  examples: ["yarn gr org domains get --org-uuid $ORG_UUID --domain-uuid $DOMAIN_UUID"],
9127
9546
  handler: async (hctx) => {
9128
9547
  const result2 = await requireAuth(hctx.ctx).apiClient.getOrgDomain(
9129
- requireOrgId(hctx.args),
9548
+ requireOrgRef(hctx.args),
9130
9549
  requireDomainUuid(hctx.args)
9131
9550
  );
9132
9551
  outputSingle(result2, hctx.ctx, ORG_DOMAIN_COLUMNS);
@@ -9139,13 +9558,13 @@ var domainCommands = [
9139
9558
  description: "Verify domain ownership by checking the _gravity-verify TXT record",
9140
9559
  mutates: true,
9141
9560
  requiresWorkspace: false,
9142
- args: [ORG_UUID_ARG, DOMAIN_UUID_ARG],
9561
+ args: [ORG_UUID_ARG2, DOMAIN_UUID_ARG],
9143
9562
  examples: [
9144
9563
  "yarn gr org domains verify-ownership --org-uuid $ORG_UUID --domain-uuid $DOMAIN_UUID --allow-write"
9145
9564
  ],
9146
9565
  handler: async (hctx) => {
9147
9566
  const result2 = await requireAuth(hctx.ctx).apiClient.verifyOrgDomainOwnership(
9148
- requireOrgId(hctx.args),
9567
+ requireOrgRef(hctx.args),
9149
9568
  requireDomainUuid(hctx.args)
9150
9569
  );
9151
9570
  outputSingle(result2, hctx.ctx);
@@ -9156,13 +9575,16 @@ var domainCommands = [
9156
9575
  description: "Delete a registered organization domain",
9157
9576
  mutates: true,
9158
9577
  requiresWorkspace: false,
9159
- args: [ORG_UUID_ARG, DOMAIN_UUID_ARG],
9578
+ args: [ORG_UUID_ARG2, DOMAIN_UUID_ARG],
9160
9579
  examples: [
9161
9580
  "yarn gr org domains delete --org-uuid $ORG_UUID --domain-uuid $DOMAIN_UUID --allow-write"
9162
9581
  ],
9163
9582
  handler: async (hctx) => {
9164
9583
  const domainUuid = requireDomainUuid(hctx.args);
9165
- await requireAuth(hctx.ctx).apiClient.deleteOrgDomain(requireOrgId(hctx.args), domainUuid);
9584
+ await requireAuth(hctx.ctx).apiClient.deleteOrgDomain(
9585
+ requireOrgRef(hctx.args),
9586
+ domainUuid
9587
+ );
9166
9588
  process.stdout.write(`Deleted org domain ${domainUuid}
9167
9589
  `);
9168
9590
  }
@@ -9172,13 +9594,13 @@ var domainCommands = [
9172
9594
  description: "Enable email DNS records on a verified organization domain",
9173
9595
  mutates: true,
9174
9596
  requiresWorkspace: false,
9175
- args: [ORG_UUID_ARG, DOMAIN_UUID_ARG],
9597
+ args: [ORG_UUID_ARG2, DOMAIN_UUID_ARG],
9176
9598
  examples: [
9177
9599
  "yarn gr org domains email enable --org-uuid $ORG_UUID --domain-uuid $DOMAIN_UUID --allow-write"
9178
9600
  ],
9179
9601
  handler: async (hctx) => {
9180
9602
  const result2 = await requireAuth(hctx.ctx).apiClient.enableOrgDomainEmail(
9181
- requireOrgId(hctx.args),
9603
+ requireOrgRef(hctx.args),
9182
9604
  requireDomainUuid(hctx.args)
9183
9605
  );
9184
9606
  outputSingle(result2, hctx.ctx);
@@ -9188,11 +9610,11 @@ var domainCommands = [
9188
9610
  path: ["org", "domains", "email", "get"],
9189
9611
  description: "Get email DNS setup and status for an organization domain",
9190
9612
  requiresWorkspace: false,
9191
- args: [ORG_UUID_ARG, DOMAIN_UUID_ARG],
9613
+ args: [ORG_UUID_ARG2, DOMAIN_UUID_ARG],
9192
9614
  examples: ["yarn gr org domains email get --org-uuid $ORG_UUID --domain-uuid $DOMAIN_UUID"],
9193
9615
  handler: async (hctx) => {
9194
9616
  const result2 = await requireAuth(hctx.ctx).apiClient.getOrgDomainEmail(
9195
- requireOrgId(hctx.args),
9617
+ requireOrgRef(hctx.args),
9196
9618
  requireDomainUuid(hctx.args)
9197
9619
  );
9198
9620
  outputSingle(result2, hctx.ctx);
@@ -9212,7 +9634,7 @@ var domainCommands = [
9212
9634
  mutates: true,
9213
9635
  requiresWorkspace: false,
9214
9636
  args: [
9215
- ORG_UUID_ARG,
9637
+ ORG_UUID_ARG2,
9216
9638
  DOMAIN_UUID_ARG,
9217
9639
  {
9218
9640
  name: "confirm",
@@ -9226,7 +9648,7 @@ var domainCommands = [
9226
9648
  handler: async (hctx) => {
9227
9649
  const domainUuid = requireDomainUuid(hctx.args);
9228
9650
  const result2 = await requireAuth(hctx.ctx).apiClient.disableOrgDomainEmail(
9229
- requireOrgId(hctx.args),
9651
+ requireOrgRef(hctx.args),
9230
9652
  domainUuid,
9231
9653
  hctx.args.confirm === true
9232
9654
  );
@@ -9249,13 +9671,13 @@ var domainCommands = [
9249
9671
  description: "Enable custom site CNAME verification on a verified organization domain",
9250
9672
  mutates: true,
9251
9673
  requiresWorkspace: false,
9252
- args: [ORG_UUID_ARG, DOMAIN_UUID_ARG],
9674
+ args: [ORG_UUID_ARG2, DOMAIN_UUID_ARG],
9253
9675
  examples: [
9254
9676
  "yarn gr org domains site enable --org-uuid $ORG_UUID --domain-uuid $DOMAIN_UUID --allow-write"
9255
9677
  ],
9256
9678
  handler: async (hctx) => {
9257
9679
  const result2 = await requireAuth(hctx.ctx).apiClient.enableOrgDomainSite(
9258
- requireOrgId(hctx.args),
9680
+ requireOrgRef(hctx.args),
9259
9681
  requireDomainUuid(hctx.args)
9260
9682
  );
9261
9683
  outputSingle(result2, hctx.ctx);
@@ -9265,11 +9687,11 @@ var domainCommands = [
9265
9687
  path: ["org", "domains", "site", "get"],
9266
9688
  description: "Get custom site CNAME setup and status for an organization domain",
9267
9689
  requiresWorkspace: false,
9268
- args: [ORG_UUID_ARG, DOMAIN_UUID_ARG],
9690
+ args: [ORG_UUID_ARG2, DOMAIN_UUID_ARG],
9269
9691
  examples: ["yarn gr org domains site get --org-uuid $ORG_UUID --domain-uuid $DOMAIN_UUID"],
9270
9692
  handler: async (hctx) => {
9271
9693
  const result2 = await requireAuth(hctx.ctx).apiClient.getOrgDomainSite(
9272
- requireOrgId(hctx.args),
9694
+ requireOrgRef(hctx.args),
9273
9695
  requireDomainUuid(hctx.args)
9274
9696
  );
9275
9697
  outputSingle(result2, hctx.ctx);
@@ -9289,7 +9711,7 @@ var domainCommands = [
9289
9711
  mutates: true,
9290
9712
  requiresWorkspace: false,
9291
9713
  args: [
9292
- ORG_UUID_ARG,
9714
+ ORG_UUID_ARG2,
9293
9715
  DOMAIN_UUID_ARG,
9294
9716
  {
9295
9717
  name: "confirm",
@@ -9303,7 +9725,7 @@ var domainCommands = [
9303
9725
  handler: async (hctx) => {
9304
9726
  const domainUuid = requireDomainUuid(hctx.args);
9305
9727
  const result2 = await requireAuth(hctx.ctx).apiClient.disableOrgDomainSite(
9306
- requireOrgId(hctx.args),
9728
+ requireOrgRef(hctx.args),
9307
9729
  domainUuid,
9308
9730
  hctx.args.confirm === true
9309
9731
  );
@@ -9338,6 +9760,226 @@ var orgDomain = {
9338
9760
  ]
9339
9761
  };
9340
9762
 
9763
+ // src/domains/org-legal-entities.ts
9764
+ var LEGAL_ENTITY_COLUMNS = [
9765
+ { header: "UUID", getValue: (e) => e.uuid ?? "" },
9766
+ { header: "LEGAL NAME", getValue: (e) => e.legalName ?? "" },
9767
+ { header: "PRIMARY", getValue: (e) => e.isPrimary ? "yes" : "" },
9768
+ { header: "ID TYPE", getValue: (e) => e.registrationIdentifierType ?? "" },
9769
+ { header: "PROFILE SID", getValue: (e) => e.customerProfileSid ?? "" },
9770
+ // The CACHED status hint. `org business-profile get` reads Twilio live.
9771
+ { header: "PROFILE STATUS (cached)", getValue: (e) => e.customerProfileStatus ?? "" }
9772
+ ];
9773
+ var LEGAL_ENTITY_UUID_ARG = {
9774
+ name: "legal-entity-uuid",
9775
+ aliases: ["legal-entity", "entity-uuid"],
9776
+ description: "Legal entity UUID (omit to use the org primary entity)",
9777
+ required: false
9778
+ };
9779
+ var TRUST_PRODUCT_ENTITY_UUID_ARG = { ...LEGAL_ENTITY_UUID_ARG, required: true };
9780
+ var TRUST_PRODUCT_COLUMNS = [
9781
+ { header: "PRODUCT", getValue: (p) => p.product ?? "" },
9782
+ { header: "STATUS", getValue: (p) => p.status ?? "(none)" },
9783
+ { header: "TRUST PRODUCT SID", getValue: (p) => p.trustProductSid ?? "(none)" },
9784
+ // CNAM only; blank for the other two rather than absent, so the column lines up.
9785
+ { header: "DISPLAY NAME", getValue: (p) => p.displayName ?? "" }
9786
+ ];
9787
+ function optionalEntityUuid(args) {
9788
+ const val = args["legal-entity-uuid"] ?? args["legal-entity"] ?? args["entity-uuid"];
9789
+ return typeof val === "string" && val ? val : void 0;
9790
+ }
9791
+ function requireEntityUuid(args) {
9792
+ const val = optionalEntityUuid(args);
9793
+ if (!val) {
9794
+ throw new CLIError("Missing required argument: --legal-entity-uuid");
9795
+ }
9796
+ return val;
9797
+ }
9798
+ function requireBody(data) {
9799
+ if (data && typeof data === "object" && !Array.isArray(data)) return data;
9800
+ throw new CLIError(
9801
+ `Missing or invalid --data. Pass a JSON object, e.g. --data '{"key":"value"}' (or --file body.json). Arrays are not accepted.`
9802
+ );
9803
+ }
9804
+ function submittability(profile) {
9805
+ if (profile.evaluationStatus === "compliant") return "yes";
9806
+ if (profile.evaluationStatus === "noncompliant") return "no (noncompliant)";
9807
+ if (profile.status && profile.status !== "draft") return `n/a (${profile.status})`;
9808
+ return "no (never evaluated)";
9809
+ }
9810
+ var commands2 = [
9811
+ {
9812
+ path: ["org", "legal-entities", "list"],
9813
+ 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`.",
9814
+ requiresWorkspace: false,
9815
+ args: [ORG_UUID_ARG],
9816
+ examples: ["yarn gr org legal-entities list --org-uuid $ORG_UUID"],
9817
+ handler: async (hctx) => {
9818
+ const result2 = await requireAuth(hctx.ctx).apiClient.listLegalEntities(
9819
+ requireOrgRef(hctx.args)
9820
+ );
9821
+ outputData(result2.legalEntities ?? [], hctx.ctx, LEGAL_ENTITY_COLUMNS);
9822
+ }
9823
+ },
9824
+ {
9825
+ path: ["org", "legal-entities", "get"],
9826
+ description: "Get one legal entity",
9827
+ requiresWorkspace: false,
9828
+ args: [ORG_UUID_ARG, { ...LEGAL_ENTITY_UUID_ARG, required: true }],
9829
+ examples: [
9830
+ "yarn gr org legal-entities get --org-uuid $ORG_UUID --legal-entity-uuid $ENTITY_UUID"
9831
+ ],
9832
+ handler: async (hctx) => {
9833
+ const result2 = await requireAuth(hctx.ctx).apiClient.getLegalEntity(
9834
+ requireOrgRef(hctx.args),
9835
+ requireEntityUuid(hctx.args)
9836
+ );
9837
+ outputSingle(result2, hctx.ctx);
9838
+ }
9839
+ },
9840
+ {
9841
+ path: ["org", "legal-entities", "create"],
9842
+ description: "Create a legal entity (its business profile is filled in separately)",
9843
+ mutates: true,
9844
+ requiresWorkspace: false,
9845
+ args: [ORG_UUID_ARG],
9846
+ examples: [
9847
+ `yarn gr org legal-entities create --org-uuid $ORG_UUID --data '{"legalName":"Acme Health"}' --allow-write`
9848
+ ],
9849
+ handler: async (hctx) => {
9850
+ const result2 = await requireAuth(hctx.ctx).apiClient.createLegalEntity(
9851
+ requireOrgRef(hctx.args),
9852
+ requireBody(hctx.data)
9853
+ );
9854
+ outputSingle(result2, hctx.ctx);
9855
+ }
9856
+ },
9857
+ {
9858
+ path: ["org", "business-profile", "get"],
9859
+ description: "Read a legal entity's business profile LIVE from Twilio. SUBMITTABLE is derived from evaluationStatus, not status.",
9860
+ requiresWorkspace: false,
9861
+ args: [ORG_UUID_ARG, LEGAL_ENTITY_UUID_ARG],
9862
+ examples: ["yarn gr org business-profile get --org-uuid $ORG_UUID"],
9863
+ handler: async (hctx) => {
9864
+ const profile = await requireAuth(hctx.ctx).apiClient.getBusinessProfile(
9865
+ requireOrgRef(hctx.args),
9866
+ optionalEntityUuid(hctx.args)
9867
+ );
9868
+ outputSingle(
9869
+ hctx.ctx.outputFormat === "json" ? profile : {
9870
+ status: profile.status ?? "(none)",
9871
+ evaluationStatus: profile.evaluationStatus ?? "(not evaluated)",
9872
+ SUBMITTABLE: submittability(profile),
9873
+ customerProfileSid: profile.customerProfileSid ?? "(none)",
9874
+ legalName: profile.businessInfo?.legalName ?? "(missing)",
9875
+ authorizedReps: (profile.authorizedReps ?? []).length,
9876
+ hasAddress: profile.address ? "yes" : "no",
9877
+ failureReasons: (profile.failureReasons ?? []).join("; ") || "(none)",
9878
+ profileRecoveryFailed: profile.profileRecoveryFailed ? "YES" : "no"
9879
+ },
9880
+ hctx.ctx
9881
+ );
9882
+ }
9883
+ },
9884
+ {
9885
+ path: ["org", "business-profile", "update"],
9886
+ description: "Upsert the business profile (idempotent via cached SIDs). Returns the fresh compliance evaluation.",
9887
+ mutates: true,
9888
+ requiresWorkspace: false,
9889
+ args: [ORG_UUID_ARG, LEGAL_ENTITY_UUID_ARG],
9890
+ examples: [
9891
+ "yarn gr org business-profile update --org-uuid $ORG_UUID --file profile.json --allow-write"
9892
+ ],
9893
+ handler: async (hctx) => {
9894
+ const result2 = await requireAuth(hctx.ctx).apiClient.updateBusinessProfile(
9895
+ requireOrgRef(hctx.args),
9896
+ requireBody(hctx.data),
9897
+ optionalEntityUuid(hctx.args)
9898
+ );
9899
+ outputSingle(result2, hctx.ctx);
9900
+ }
9901
+ },
9902
+ {
9903
+ path: ["org", "business-profile", "submit"],
9904
+ 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.",
9905
+ mutates: true,
9906
+ requiresWorkspace: false,
9907
+ args: [ORG_UUID_ARG, LEGAL_ENTITY_UUID_ARG],
9908
+ examples: ["yarn gr org business-profile submit --org-uuid $ORG_UUID --allow-write"],
9909
+ handler: async (hctx) => {
9910
+ const result2 = await requireAuth(hctx.ctx).apiClient.submitBusinessProfile(
9911
+ requireOrgRef(hctx.args),
9912
+ optionalEntityUuid(hctx.args)
9913
+ );
9914
+ outputSingle(result2, hctx.ctx);
9915
+ }
9916
+ },
9917
+ {
9918
+ path: ["org", "business-profile", "cancel"],
9919
+ description: "Cancel an in-flight Twilio review, resetting the profile to draft so it can be edited and resubmitted",
9920
+ mutates: true,
9921
+ requiresWorkspace: false,
9922
+ args: [ORG_UUID_ARG, LEGAL_ENTITY_UUID_ARG],
9923
+ examples: ["yarn gr org business-profile cancel --org-uuid $ORG_UUID --allow-write"],
9924
+ handler: async (hctx) => {
9925
+ const result2 = await requireAuth(hctx.ctx).apiClient.cancelBusinessProfile(
9926
+ requireOrgRef(hctx.args),
9927
+ optionalEntityUuid(hctx.args)
9928
+ );
9929
+ outputSingle(result2, hctx.ctx);
9930
+ }
9931
+ },
9932
+ {
9933
+ path: ["org", "trust-products", "list"],
9934
+ 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.",
9935
+ requiresWorkspace: false,
9936
+ args: [ORG_UUID_ARG, TRUST_PRODUCT_ENTITY_UUID_ARG],
9937
+ examples: [
9938
+ "yarn gr org trust-products list --org-uuid $ORG_UUID --legal-entity-uuid $ENTITY_UUID --env prod"
9939
+ ],
9940
+ handler: async (hctx) => {
9941
+ const result2 = await requireAuth(hctx.ctx).apiClient.getVoiceTrustProducts(
9942
+ requireOrgRef(hctx.args),
9943
+ requireEntityUuid(hctx.args)
9944
+ );
9945
+ outputData(result2.products, hctx.ctx, TRUST_PRODUCT_COLUMNS);
9946
+ }
9947
+ },
9948
+ {
9949
+ path: ["org", "trust-products", "sync"],
9950
+ 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.",
9951
+ // Writes trust_hub_state and calls Twilio. Read-only in business terms
9952
+ // (it discovers, it does not create or submit), but it mutates our cache,
9953
+ // so it takes --allow-write like every other state-changing verb.
9954
+ mutates: true,
9955
+ requiresWorkspace: false,
9956
+ args: [ORG_UUID_ARG, TRUST_PRODUCT_ENTITY_UUID_ARG],
9957
+ examples: [
9958
+ "yarn gr org trust-products sync --org-uuid $ORG_UUID --legal-entity-uuid $ENTITY_UUID --env prod --allow-write"
9959
+ ],
9960
+ handler: async (hctx) => {
9961
+ const result2 = await requireAuth(hctx.ctx).apiClient.syncVoiceTrustProducts(
9962
+ requireOrgRef(hctx.args),
9963
+ requireEntityUuid(hctx.args)
9964
+ );
9965
+ if (hctx.ctx.outputFormat !== "table") {
9966
+ outputSingle(result2, hctx.ctx);
9967
+ return;
9968
+ }
9969
+ const discovered = result2.discovered ?? [];
9970
+ console.log(
9971
+ discovered.length > 0 ? `Discovered ${discovered.length} product(s): ${discovered.join(", ")}` : "No new products discovered \u2014 already up to date."
9972
+ );
9973
+ outputData(result2.products, hctx.ctx, TRUST_PRODUCT_COLUMNS);
9974
+ }
9975
+ }
9976
+ ];
9977
+ var orgLegalEntitiesDomain = {
9978
+ name: "org",
9979
+ description: "Legal entities and business profiles (Twilio Customer Profiles)",
9980
+ commands: commands2
9981
+ };
9982
+
9341
9983
  // src/domains/org-phone-numbers.ts
9342
9984
  import { OrgApi } from "@gravity-rail/sdk";
9343
9985
  function getOrgApi(hctx) {
@@ -9359,14 +10001,7 @@ var AVAILABLE_PHONE_COLUMNS = [
9359
10001
  { header: "Region", getValue: (p) => p.region ?? "" },
9360
10002
  { header: "Type", getValue: (p) => p.phoneNumberType ?? "" }
9361
10003
  ];
9362
- function requireOrgUuid(args) {
9363
- const val = args["org-uuid"] ?? args["org"];
9364
- if (typeof val !== "string" || !val) {
9365
- throw new CLIError("Missing required argument: --org-uuid");
9366
- }
9367
- return val;
9368
- }
9369
- var commands2 = [
10004
+ var commands3 = [
9370
10005
  {
9371
10006
  path: ["org", "phone-numbers", "list"],
9372
10007
  description: "List all phone numbers owned by an organization",
@@ -9376,7 +10011,7 @@ var commands2 = [
9376
10011
  requiresWorkspace: false,
9377
10012
  columns: PROVIDER_PHONE_COLUMNS,
9378
10013
  handler: async (hctx) => {
9379
- const orgUuid = requireOrgUuid(hctx.args);
10014
+ const orgUuid = requireOrgRef(hctx.args);
9380
10015
  const result2 = await getOrgApi(hctx).listPhoneNumbers(orgUuid);
9381
10016
  outputData(result2, hctx.ctx, PROVIDER_PHONE_COLUMNS);
9382
10017
  }
@@ -9399,7 +10034,7 @@ var commands2 = [
9399
10034
  requiresWorkspace: false,
9400
10035
  columns: AVAILABLE_PHONE_COLUMNS,
9401
10036
  handler: async (hctx) => {
9402
- const orgUuid = requireOrgUuid(hctx.args);
10037
+ const orgUuid = requireOrgRef(hctx.args);
9403
10038
  const result2 = await getOrgApi(hctx).searchPhoneNumbers(orgUuid, {
9404
10039
  country: hctx.args.country ?? "US",
9405
10040
  numberType: hctx.args["number-type"] ?? "local",
@@ -9435,7 +10070,7 @@ var commands2 = [
9435
10070
  requiresWorkspace: false,
9436
10071
  columns: PROVIDER_PHONE_COLUMNS,
9437
10072
  handler: async (hctx) => {
9438
- const orgUuid = requireOrgUuid(hctx.args);
10073
+ const orgUuid = requireOrgRef(hctx.args);
9439
10074
  const phoneNumber = hctx.args["phone-number"];
9440
10075
  if (!phoneNumber) throw new CLIError("Missing required argument: --phone-number");
9441
10076
  const numberType = hctx.args["number-type"] ?? "local";
@@ -9464,7 +10099,7 @@ var commands2 = [
9464
10099
  requiresWorkspace: false,
9465
10100
  columns: PROVIDER_PHONE_COLUMNS,
9466
10101
  handler: async (hctx) => {
9467
- const orgUuid = requireOrgUuid(hctx.args);
10102
+ const orgUuid = requireOrgRef(hctx.args);
9468
10103
  const providerPhoneUuid = hctx.args["provider-phone-uuid"];
9469
10104
  const workspaceUuid = hctx.args["workspace-uuid"];
9470
10105
  if (!providerPhoneUuid)
@@ -9496,7 +10131,7 @@ Create a workspace phone linked to this provider number (sets Twilio webhooks):
9496
10131
  requiresWorkspace: false,
9497
10132
  columns: PROVIDER_PHONE_COLUMNS,
9498
10133
  handler: async (hctx) => {
9499
- const orgUuid = requireOrgUuid(hctx.args);
10134
+ const orgUuid = requireOrgRef(hctx.args);
9500
10135
  const providerPhoneUuid = hctx.args["provider-phone-uuid"];
9501
10136
  const newWorkspaceUuid = hctx.args["new-workspace-uuid"];
9502
10137
  if (!providerPhoneUuid)
@@ -9522,7 +10157,7 @@ Create a workspace phone linked to this provider number (sets Twilio webhooks):
9522
10157
  requiresWorkspace: false,
9523
10158
  columns: PROVIDER_PHONE_COLUMNS,
9524
10159
  handler: async (hctx) => {
9525
- const orgUuid = requireOrgUuid(hctx.args);
10160
+ const orgUuid = requireOrgRef(hctx.args);
9526
10161
  const providerPhoneUuid = hctx.args["provider-phone-uuid"];
9527
10162
  if (!providerPhoneUuid)
9528
10163
  throw new CLIError("Missing required argument: --provider-phone-uuid");
@@ -9540,7 +10175,7 @@ Create a workspace phone linked to this provider number (sets Twilio webhooks):
9540
10175
  ],
9541
10176
  requiresWorkspace: false,
9542
10177
  handler: async (hctx) => {
9543
- const orgUuid = requireOrgUuid(hctx.args);
10178
+ const orgUuid = requireOrgRef(hctx.args);
9544
10179
  const providerPhoneUuid = hctx.args["provider-phone-uuid"];
9545
10180
  if (!providerPhoneUuid)
9546
10181
  throw new CLIError("Missing required argument: --provider-phone-uuid");
@@ -9552,7 +10187,7 @@ Create a workspace phone linked to this provider number (sets Twilio webhooks):
9552
10187
  var orgPhoneNumbersDomain = {
9553
10188
  name: "org",
9554
10189
  description: "Organization management",
9555
- commands: commands2
10190
+ commands: commands3
9556
10191
  };
9557
10192
 
9558
10193
  // src/lib/phone-numbers/defaults.ts
@@ -12563,7 +13198,7 @@ function requireCallerRole(args, flag) {
12563
13198
  }
12564
13199
  return role;
12565
13200
  }
12566
- var COLUMNS24 = [
13201
+ var COLUMNS25 = [
12567
13202
  COL.id(),
12568
13203
  { header: "NUMBER", getValue: (item) => item.phoneNumber ?? item.number ?? "" },
12569
13204
  { header: "LABEL", getValue: (item) => item.label ?? item.name ?? "" },
@@ -12590,7 +13225,7 @@ var phoneNumbersDomain = {
12590
13225
  entityName: "phone number",
12591
13226
  listMethod: "getPhoneNumbers",
12592
13227
  archiveMethod: "archivePhoneNumber",
12593
- columns: COLUMNS24
13228
+ columns: COLUMNS25
12594
13229
  }),
12595
13230
  {
12596
13231
  path: ["phone-numbers", "get"],
@@ -12640,7 +13275,7 @@ ${PHONE_NUMBER_FIELD_REFERENCE}`,
12640
13275
  );
12641
13276
  const record = asPhoneRecord(result2);
12642
13277
  const warnings = collectPhoneNumberWarnings(record);
12643
- outputData([record], ctx, COLUMNS24);
13278
+ outputData([record], ctx, COLUMNS25);
12644
13279
  if (warnings.length > 0) {
12645
13280
  process.stderr.write("\nWarnings after create:\n");
12646
13281
  for (const w of warnings) {
@@ -12672,7 +13307,7 @@ ${PHONE_NUMBER_FIELD_REFERENCE}`,
12672
13307
  id,
12673
13308
  data
12674
13309
  );
12675
- outputData([result2], ctx, COLUMNS24);
13310
+ outputData([result2], ctx, COLUMNS25);
12676
13311
  } catch (err) {
12677
13312
  return enrichPhoneNumberApiError(err);
12678
13313
  }
@@ -12960,7 +13595,7 @@ ${formatRoutingSimulation(sim, phone)}
12960
13595
  requiresWorkspace: true,
12961
13596
  handler: async ({ ctx, workspace }) => {
12962
13597
  const result2 = await requireAuth(ctx).apiClient.getAvailablePhoneNumbers(workspace);
12963
- outputData(result2, ctx, COLUMNS24);
13598
+ outputData(result2, ctx, COLUMNS25);
12964
13599
  }
12965
13600
  },
12966
13601
  {
@@ -12985,7 +13620,7 @@ ${formatRoutingSimulation(sim, phone)}
12985
13620
  const id = requireNumberFrom(args, "phone-number-id", "id");
12986
13621
  const providerPhoneUuid = requireString(args, "provider-phone-uuid");
12987
13622
  const result2 = await auth.apiClient.linkPhoneNumber(workspace, id, providerPhoneUuid);
12988
- outputData([result2], auth, COLUMNS24);
13623
+ outputData([result2], auth, COLUMNS25);
12989
13624
  }
12990
13625
  },
12991
13626
  {
@@ -12998,7 +13633,7 @@ ${formatRoutingSimulation(sim, phone)}
12998
13633
  workspace,
12999
13634
  data
13000
13635
  );
13001
- outputData([result2], ctx, COLUMNS24);
13636
+ outputData([result2], ctx, COLUMNS25);
13002
13637
  }
13003
13638
  },
13004
13639
  {
@@ -13145,7 +13780,7 @@ function normalizePronunciationUpdatePayload(data) {
13145
13780
  }
13146
13781
 
13147
13782
  // src/domains/pronunciations.ts
13148
- var COLUMNS25 = [
13783
+ var COLUMNS26 = [
13149
13784
  COL.id(),
13150
13785
  { header: "TERM", getValue: (item) => item.term ?? "" },
13151
13786
  { header: "RESPELLING", getValue: (item) => item.respelling ?? "" },
@@ -13167,7 +13802,7 @@ var pronunciationsDomain = {
13167
13802
  const auth = requireAuth(ctx);
13168
13803
  const orgUuid = await resolveOrgUuidFromWorkspace(auth.apiClient, workspace);
13169
13804
  const result2 = await auth.apiClient.getPronunciationEntries(orgUuid);
13170
- outputData(result2, ctx, COLUMNS25);
13805
+ outputData(result2, ctx, COLUMNS26);
13171
13806
  }
13172
13807
  },
13173
13808
  {
@@ -13181,7 +13816,7 @@ var pronunciationsDomain = {
13181
13816
  const orgUuid = await resolveOrgUuidFromWorkspace(auth.apiClient, workspace);
13182
13817
  const payload = normalizePronunciationCreatePayload(data);
13183
13818
  const result2 = await auth.apiClient.createPronunciationEntry(orgUuid, payload);
13184
- outputSingle(result2, ctx, COLUMNS25);
13819
+ outputSingle(result2, ctx, COLUMNS26);
13185
13820
  }
13186
13821
  },
13187
13822
  {
@@ -13199,7 +13834,7 @@ var pronunciationsDomain = {
13199
13834
  requireNumber(args, "id"),
13200
13835
  payload
13201
13836
  );
13202
- outputSingle(result2, ctx, COLUMNS25);
13837
+ outputSingle(result2, ctx, COLUMNS26);
13203
13838
  }
13204
13839
  },
13205
13840
  {
@@ -13223,7 +13858,7 @@ var pronunciationsDomain = {
13223
13858
  requiresWorkspace: true,
13224
13859
  handler: async ({ ctx }) => {
13225
13860
  const result2 = await requireAuth(ctx).apiClient.getMyPronunciations();
13226
- outputData(result2, ctx, COLUMNS25);
13861
+ outputData(result2, ctx, COLUMNS26);
13227
13862
  }
13228
13863
  },
13229
13864
  {
@@ -13234,7 +13869,7 @@ var pronunciationsDomain = {
13234
13869
  handler: async ({ ctx, data }) => {
13235
13870
  const payload = normalizePronunciationCreatePayload(data);
13236
13871
  const result2 = await requireAuth(ctx).apiClient.createMyPronunciation(payload);
13237
- outputSingle(result2, ctx, COLUMNS25);
13872
+ outputSingle(result2, ctx, COLUMNS26);
13238
13873
  }
13239
13874
  },
13240
13875
  {
@@ -13532,7 +14167,7 @@ ${ROUTINE_FIELD_REFERENCE}`,
13532
14167
  };
13533
14168
 
13534
14169
  // src/domains/subscriptions.ts
13535
- var COLUMNS26 = [
14170
+ var COLUMNS27 = [
13536
14171
  COL.id(),
13537
14172
  COL.status(),
13538
14173
  { header: "PLAN", getValue: (item) => item.planName ?? item.plan ?? "" },
@@ -13548,7 +14183,7 @@ var subscriptionsDomain = {
13548
14183
  requiresWorkspace: false,
13549
14184
  handler: async ({ ctx }) => {
13550
14185
  const result2 = await requireAuth(ctx).apiClient.getSubscriptions();
13551
- outputData(result2, ctx, COLUMNS26);
14186
+ outputData(result2, ctx, COLUMNS27);
13552
14187
  }
13553
14188
  },
13554
14189
  {
@@ -13557,7 +14192,7 @@ var subscriptionsDomain = {
13557
14192
  requiresWorkspace: true,
13558
14193
  handler: async ({ ctx, workspace }) => {
13559
14194
  const result2 = await requireAuth(ctx).apiClient.getWorkspaceSubscriptions(workspace);
13560
- outputData(result2, ctx, COLUMNS26);
14195
+ outputData(result2, ctx, COLUMNS27);
13561
14196
  }
13562
14197
  },
13563
14198
  {
@@ -13570,7 +14205,7 @@ var subscriptionsDomain = {
13570
14205
  const result2 = await requireAuth(ctx).apiClient.cancelSubscription(
13571
14206
  requireNumber(args, "id")
13572
14207
  );
13573
- outputSingle(result2, ctx, COLUMNS26);
14208
+ outputSingle(result2, ctx, COLUMNS27);
13574
14209
  }
13575
14210
  },
13576
14211
  {
@@ -13582,7 +14217,7 @@ var subscriptionsDomain = {
13582
14217
  const result2 = await requireAuth(ctx).apiClient.reactivateSubscription(
13583
14218
  requireNumber(args, "id")
13584
14219
  );
13585
- outputSingle(result2, ctx, COLUMNS26);
14220
+ outputSingle(result2, ctx, COLUMNS27);
13586
14221
  }
13587
14222
  },
13588
14223
  {
@@ -13596,7 +14231,7 @@ var subscriptionsDomain = {
13596
14231
  requireNumber(args, "id"),
13597
14232
  data
13598
14233
  );
13599
- outputSingle(result2, ctx, COLUMNS26);
14234
+ outputSingle(result2, ctx, COLUMNS27);
13600
14235
  }
13601
14236
  }
13602
14237
  ]
@@ -13850,7 +14485,7 @@ var supportDomain = {
13850
14485
  };
13851
14486
 
13852
14487
  // src/domains/supervisors.ts
13853
- var COLUMNS27 = [
14488
+ var COLUMNS28 = [
13854
14489
  COL.id(),
13855
14490
  COL.name(),
13856
14491
  { header: "TYPE", getValue: (item) => item.type ?? "" },
@@ -13868,7 +14503,7 @@ var supervisorsDomain = {
13868
14503
  createMethod: "createSupervisor",
13869
14504
  updateMethod: "updateSupervisor",
13870
14505
  deleteMethod: "deleteSupervisor",
13871
- columns: COLUMNS27
14506
+ columns: COLUMNS28
13872
14507
  })
13873
14508
  ]
13874
14509
  };
@@ -14256,7 +14891,7 @@ var widgetDomainsDomain = {
14256
14891
  };
14257
14892
 
14258
14893
  // src/domains/integrations/app-connections.ts
14259
- var COLUMNS28 = [
14894
+ var COLUMNS29 = [
14260
14895
  COL.id(),
14261
14896
  COL.name(),
14262
14897
  { header: "TYPE", getValue: (item) => item.type ?? "" },
@@ -14297,7 +14932,7 @@ var appConnectionsDomain = {
14297
14932
  requiresWorkspace: true,
14298
14933
  handler: async ({ ctx, workspace }) => {
14299
14934
  const result2 = await requireAuth(ctx).apiClient.listAvailableAppConnections(workspace);
14300
- outputData(result2, ctx, COLUMNS28);
14935
+ outputData(result2, ctx, COLUMNS29);
14301
14936
  }
14302
14937
  },
14303
14938
  {
@@ -14306,7 +14941,7 @@ var appConnectionsDomain = {
14306
14941
  requiresWorkspace: true,
14307
14942
  handler: async ({ ctx, workspace }) => {
14308
14943
  const result2 = await requireAuth(ctx).apiClient.listAppConnections(workspace);
14309
- outputData(result2, ctx, COLUMNS28);
14944
+ outputData(result2, ctx, COLUMNS29);
14310
14945
  }
14311
14946
  },
14312
14947
  {
@@ -14330,7 +14965,7 @@ var appConnectionsDomain = {
14330
14965
  const result2 = await requireAuth(ctx).apiClient.enablePlatformApp(workspace, {
14331
14966
  slug: requireString(args, "slug")
14332
14967
  });
14333
- outputSingle(result2, ctx, COLUMNS28);
14968
+ outputSingle(result2, ctx, COLUMNS29);
14334
14969
  }
14335
14970
  },
14336
14971
  {
@@ -14343,7 +14978,7 @@ var appConnectionsDomain = {
14343
14978
  workspace,
14344
14979
  requireString(args, "id")
14345
14980
  );
14346
- outputSingle(result2, ctx, COLUMNS28);
14981
+ outputSingle(result2, ctx, COLUMNS29);
14347
14982
  }
14348
14983
  },
14349
14984
  {
@@ -14358,7 +14993,7 @@ var appConnectionsDomain = {
14358
14993
  requireString(args, "id"),
14359
14994
  data
14360
14995
  );
14361
- outputSingle(result2, ctx, COLUMNS28);
14996
+ outputSingle(result2, ctx, COLUMNS29);
14362
14997
  }
14363
14998
  },
14364
14999
  {
@@ -14700,7 +15335,7 @@ var confluenceDomain = {
14700
15335
  };
14701
15336
 
14702
15337
  // src/domains/integrations/discord-bots.ts
14703
- var COLUMNS29 = [COL.id(), COL.name(), COL.status()];
15338
+ var COLUMNS30 = [COL.id(), COL.name(), COL.status()];
14704
15339
  var discordBotsDomain = {
14705
15340
  name: "discord-bots",
14706
15341
  description: "Manage Discord bot integrations",
@@ -14713,7 +15348,7 @@ var discordBotsDomain = {
14713
15348
  createMethod: "createDiscordBot",
14714
15349
  updateMethod: "updateDiscordBot",
14715
15350
  deleteMethod: "deleteDiscordBot",
14716
- columns: COLUMNS29,
15351
+ columns: COLUMNS30,
14717
15352
  paginationSupport: "full"
14718
15353
  }),
14719
15354
  {
@@ -14773,7 +15408,7 @@ var discordBotsDomain = {
14773
15408
  };
14774
15409
 
14775
15410
  // src/domains/integrations/fhir-connections.ts
14776
- var COLUMNS30 = [
15411
+ var COLUMNS31 = [
14777
15412
  COL.id(),
14778
15413
  COL.name(),
14779
15414
  { header: "URL", getValue: (item) => item.baseUrl ?? "" },
@@ -14791,7 +15426,7 @@ var fhirConnectionsDomain = {
14791
15426
  createMethod: "createFhirConnection",
14792
15427
  updateMethod: "updateFhirConnection",
14793
15428
  deleteMethod: "deleteFhirConnection",
14794
- columns: COLUMNS30,
15429
+ columns: COLUMNS31,
14795
15430
  paginationSupport: "full"
14796
15431
  }),
14797
15432
  {
@@ -14811,7 +15446,7 @@ var fhirConnectionsDomain = {
14811
15446
  };
14812
15447
 
14813
15448
  // src/domains/integrations/patientsync.ts
14814
- var COLUMNS31 = [
15449
+ var COLUMNS32 = [
14815
15450
  { header: "CONFIGURED", getValue: (i) => String(i.configured ?? false) },
14816
15451
  { header: "ENABLED", getValue: (i) => String(i.enabled ?? false) },
14817
15452
  { header: "HAS_KEY", getValue: (i) => String(i.hasApiKey ?? false) },
@@ -14840,7 +15475,7 @@ var patientSyncDomain = {
14840
15475
  workspace,
14841
15476
  data
14842
15477
  );
14843
- outputSingle(result2, ctx, COLUMNS31);
15478
+ outputSingle(result2, ctx, COLUMNS32);
14844
15479
  }
14845
15480
  },
14846
15481
  {
@@ -14849,7 +15484,7 @@ var patientSyncDomain = {
14849
15484
  requiresWorkspace: true,
14850
15485
  handler: async ({ ctx, workspace }) => {
14851
15486
  const result2 = await requireAuth(ctx).apiClient.getPatientSyncStatus(workspace);
14852
- outputSingle(result2, ctx, COLUMNS31);
15487
+ outputSingle(result2, ctx, COLUMNS32);
14853
15488
  }
14854
15489
  },
14855
15490
  {
@@ -15898,7 +16533,7 @@ var salesforceDomain = {
15898
16533
  };
15899
16534
 
15900
16535
  // src/domains/integrations/slack-apps.ts
15901
- var COLUMNS32 = [COL.id(), COL.name(), COL.status()];
16536
+ var COLUMNS33 = [COL.id(), COL.name(), COL.status()];
15902
16537
  function addSlackUrls(data, apiUrl, workspaceUuid) {
15903
16538
  const base = `${apiUrl}/api/v2/w/${workspaceUuid}/app-connections/slack`;
15904
16539
  return {
@@ -15921,7 +16556,7 @@ var slackAppsDomain = {
15921
16556
  entityName: "Slack app",
15922
16557
  listMethod: "getSlackApps",
15923
16558
  deleteMethod: "deleteSlackApp",
15924
- columns: COLUMNS32,
16559
+ columns: COLUMNS33,
15925
16560
  paginationSupport: "full"
15926
16561
  }),
15927
16562
  {
@@ -16007,7 +16642,7 @@ var slackAppsDomain = {
16007
16642
  };
16008
16643
 
16009
16644
  // src/domains/integrations/teams-apps.ts
16010
- var COLUMNS33 = [COL.id(), COL.name(), COL.status()];
16645
+ var COLUMNS34 = [COL.id(), COL.name(), COL.status()];
16011
16646
  function addTeamsUrls(data, apiUrl, workspaceUuid) {
16012
16647
  const base = `${apiUrl}/api/v2/w/${workspaceUuid}/app-connections/teams`;
16013
16648
  return {
@@ -16028,7 +16663,7 @@ var teamsAppsDomain = {
16028
16663
  entityName: "Teams app",
16029
16664
  listMethod: "getTeamsApps",
16030
16665
  deleteMethod: "deleteTeamsApp",
16031
- columns: COLUMNS33,
16666
+ columns: COLUMNS34,
16032
16667
  paginationSupport: "full"
16033
16668
  }),
16034
16669
  {
@@ -16134,6 +16769,7 @@ function registerPublicDomains(registry) {
16134
16769
  registry.register(qualificationsDomain);
16135
16770
  registry.register(queriesDomain);
16136
16771
  registry.register(personasDomain);
16772
+ registry.register(metricsDomain);
16137
16773
  registry.register(journeysDomain);
16138
16774
  registry.register(abilitiesDomain);
16139
16775
  registry.register(phoneNumbersDomain);
@@ -16141,10 +16777,10 @@ function registerPublicDomains(registry) {
16141
16777
  registry.register(inboxesDomain);
16142
16778
  registry.register(operatorGroupsDomain);
16143
16779
  registry.register(accessGrantsDomain);
16780
+ registry.register(interventionRequestsDomain);
16144
16781
  registry.register(notificationRulesDomain);
16145
16782
  registry.register(supervisorsDomain);
16146
16783
  registry.register(promptsDomain);
16147
- registry.register(milestonesDomain);
16148
16784
  registry.register(customToolkitsDomain);
16149
16785
  registry.register(mcpServersDomain);
16150
16786
  registry.register(apiKeysDomain);
@@ -16156,6 +16792,7 @@ function registerPublicDomains(registry) {
16156
16792
  registry.register(featuresDomain);
16157
16793
  registry.register(pronunciationsDomain);
16158
16794
  registry.register(orgDomain);
16795
+ registry.register(orgLegalEntitiesDomain);
16159
16796
  registry.register(orgPhoneNumbersDomain);
16160
16797
  registry.register(authManageDomain);
16161
16798
  registry.register(appsDomain);
@@ -19293,7 +19930,7 @@ async function authImportDevCommand(ctx, args) {
19293
19930
  }
19294
19931
 
19295
19932
  // src/commands/organizations.ts
19296
- var COLUMNS34 = [
19933
+ var COLUMNS35 = [
19297
19934
  { header: "NAME", getValue: (o) => o.organizationName || "", maxWidth: 35 },
19298
19935
  { header: "SLUG", getValue: (o) => o.organizationSlug || "", maxWidth: 25 },
19299
19936
  { header: "UUID", getValue: (o) => o.organizationUuid },
@@ -19301,7 +19938,7 @@ var COLUMNS34 = [
19301
19938
  ];
19302
19939
  async function organizationsListCommand(ctx) {
19303
19940
  const organizations = await ctx.apiClient.getMyOrganizations();
19304
- outputData(organizations, ctx, COLUMNS34);
19941
+ outputData(organizations, ctx, COLUMNS35);
19305
19942
  }
19306
19943
 
19307
19944
  // src/commands/whoami.ts