@gravity-rail/cli 0.34.0 → 0.36.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/README.md CHANGED
@@ -418,11 +418,33 @@ gr org domains verify-ownership --org-uuid $ORG_UUID --domain-uuid $DOMAIN_UUID
418
418
  gr org domains email enable --org-uuid $ORG_UUID --domain-uuid $DOMAIN_UUID --allow-write
419
419
  gr org domains email verify-mx --org-uuid $ORG_UUID --domain-uuid $DOMAIN_UUID --allow-write
420
420
 
421
- # Site DNS: enable custom site routing, then verify CNAME
421
+ # Site DNS: check the CNAME resolves, enable custom site routing, then verify
422
+ gr org domains site preflight --org-uuid $ORG_UUID --domain-uuid $DOMAIN_UUID
422
423
  gr org domains site enable --org-uuid $ORG_UUID --domain-uuid $DOMAIN_UUID --allow-write
423
424
  gr org domains site verify-cname --org-uuid $ORG_UUID --domain-uuid $DOMAIN_UUID --allow-write
424
425
  ```
425
426
 
427
+ ### Host many sites under one wildcard
428
+
429
+ ```sh
430
+ # Enable a verified domain as a parent: publish *.<domain> first, then enable
431
+ gr org domains site preflight --org-uuid $ORG_UUID --domain-uuid $PARENT_UUID --child-hosting
432
+ gr org domains site enable --org-uuid $ORG_UUID --domain-uuid $PARENT_UUID --child-hosting --allow-write
433
+
434
+ # Add hosts one at a time; each reports its own result, and the command exits
435
+ # non-zero if any failed. New hosts verify on their own within minutes.
436
+ gr org domains site children add --org-uuid $ORG_UUID --domain-uuid $PARENT_UUID \
437
+ --label clinic-a --label clinic-b --allow-write
438
+ gr org domains site children add --org-uuid $ORG_UUID --domain-uuid $PARENT_UUID \
439
+ --labels-file labels.txt --allow-write
440
+ gr org domains site children list --org-uuid $ORG_UUID --domain-uuid $PARENT_UUID
441
+
442
+ # Remove hosts: certificate, routing and registration. --confirm also removes
443
+ # hosts that still route sites.
444
+ gr org domains site children remove --org-uuid $ORG_UUID --domain-uuid $PARENT_UUID \
445
+ --label clinic-a --allow-write
446
+ ```
447
+
426
448
  ### Find members by label
427
449
 
428
450
  ```sh
package/dist/gr.js CHANGED
@@ -3230,7 +3230,7 @@ var init_libphonenumber_js = __esm({
3230
3230
  }
3231
3231
  });
3232
3232
 
3233
- // ../sdk/dist/chunk-ON7HBHJA.js
3233
+ // ../sdk/dist/chunk-R3C63RZJ.js
3234
3234
  function sanitizePhoneForBackend(phoneNumber) {
3235
3235
  try {
3236
3236
  let parsed = parsePhoneNumber4(phoneNumber);
@@ -4442,6 +4442,8 @@ function bindOrgMethods(target, org) {
4442
4442
  target.enableOrgDomainSite = org.enableOrgDomainSite.bind(org);
4443
4443
  target.getOrgDomainSite = org.getOrgDomainSite.bind(org);
4444
4444
  target.preflightOrgDomainSite = org.preflightOrgDomainSite.bind(org);
4445
+ target.createOrgDomainSiteChildHost = org.createOrgDomainSiteChildHost.bind(org);
4446
+ target.listOrgDomainSiteChildHosts = org.listOrgDomainSiteChildHosts.bind(org);
4445
4447
  target.verifyOrgDomainSite = org.verifyOrgDomainSite.bind(org);
4446
4448
  target.disableOrgDomainSite = org.disableOrgDomainSite.bind(org);
4447
4449
  target.getBusinessProfile = org.getBusinessProfile.bind(org);
@@ -4480,10 +4482,12 @@ function bindJourneysMethods(target, journeys) {
4480
4482
  target.getJourneys = journeys.getJourneys.bind(journeys);
4481
4483
  target.getJourney = journeys.getJourney.bind(journeys);
4482
4484
  target.getJourneyAuthoring = journeys.getJourneyAuthoring.bind(journeys);
4485
+ target.putJourneyDraft = journeys.putJourneyDraft.bind(journeys);
4483
4486
  target.putJourneyV2Definition = journeys.putJourneyV2Definition.bind(journeys);
4484
4487
  target.getJourneyV2Validation = journeys.getJourneyV2Validation.bind(journeys);
4485
4488
  target.getJourneyFilterOptions = journeys.getJourneyFilterOptions.bind(journeys);
4486
4489
  target.getJourneyHealth = journeys.getJourneyHealth.bind(journeys);
4490
+ target.cloneJourneyAsV2 = journeys.cloneJourneyAsV2.bind(journeys);
4487
4491
  target.createJourney = journeys.createJourney.bind(journeys);
4488
4492
  target.updateJourney = journeys.updateJourney.bind(journeys);
4489
4493
  target.archiveJourney = journeys.archiveJourney.bind(journeys);
@@ -4609,8 +4613,8 @@ function getRevisionState(workflow, revision) {
4609
4613
  };
4610
4614
  }
4611
4615
  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, EventRuleObjectType, EventRuleEventType, EventRuleActionType, DriverMode, WorkspaceInvitationsApi, WorkspacesApi, DashboardsApi, DevicesApi, TeamsAppsApi, ExperimentsApi, PatientSyncConnectionsApi, ActivityApi, MotdApi, InterventionRequestsApi, MetricsApi, ProjectsApi, TrackedLinksApi, WORKSPACE_METHOD_NAMES, WORKSPACE_METHOD_NAME_SET, GravityRailClient, WIDGET_SLUGS, CHAT_TYPES, BUILTIN_ASSISTANT_CHAT_TYPES, MEMBER_AGENT_CHAT_TYPES, ActivityGrain, ActivityGroupBy, ActivityOpenItemOrder, ActivityWindowBasis;
4612
- var init_chunk_ON7HBHJA = __esm({
4613
- "../sdk/dist/chunk-ON7HBHJA.js"() {
4616
+ var init_chunk_R3C63RZJ = __esm({
4617
+ "../sdk/dist/chunk-R3C63RZJ.js"() {
4614
4618
  init_chunk_P2E6LU7I();
4615
4619
  init_libphonenumber_js();
4616
4620
  AbilitiesApi = class extends BaseApiClient {
@@ -5712,8 +5716,14 @@ var init_chunk_ON7HBHJA = __esm({
5712
5716
  });
5713
5717
  }
5714
5718
  /** List all calendar event types in the workspace. */
5715
- async getEventTypes(wid) {
5716
- return this.fetch(`w/${wid}/calendar-event-types`);
5719
+ async getEventTypes(wid, options) {
5720
+ const params = new URLSearchParams();
5721
+ if (options?.page !== void 0) params.set("page", String(options.page));
5722
+ if (options?.pageSize !== void 0) params.set("pageSize", String(options.pageSize));
5723
+ const query = params.size ? `?${params}` : "";
5724
+ return this.fetch(
5725
+ `w/${wid}/calendar-event-types${query}`
5726
+ );
5717
5727
  }
5718
5728
  /** Get a single calendar event type by ID. */
5719
5729
  async getEventType(wid, id) {
@@ -6647,17 +6657,17 @@ var init_chunk_ON7HBHJA = __esm({
6647
6657
  return this.fetch(`w/${wid}/data-types/records/${recordId}`);
6648
6658
  }
6649
6659
  /** Create a new data record under the specified data type. */
6650
- async createDataRecord(wid, dataTypeId, record) {
6660
+ async createDataRecord(wid, dataTypeId, record2) {
6651
6661
  return this.fetch(`w/${wid}/data-types/${dataTypeId}/records`, {
6652
6662
  method: "POST",
6653
- body: JSON.stringify(record)
6663
+ body: JSON.stringify(record2)
6654
6664
  });
6655
6665
  }
6656
6666
  /** Update an existing data record's field values. */
6657
- async updateDataRecord(wid, dataTypeId, recordId, record) {
6667
+ async updateDataRecord(wid, dataTypeId, recordId, record2) {
6658
6668
  return this.fetch(`w/${wid}/data-types/${dataTypeId}/records/${recordId}`, {
6659
6669
  method: "PUT",
6660
- body: JSON.stringify(record)
6670
+ body: JSON.stringify(record2)
6661
6671
  });
6662
6672
  }
6663
6673
  /** Delete a data record by ID. */
@@ -11862,6 +11872,12 @@ var init_chunk_ON7HBHJA = __esm({
11862
11872
  }
11863
11873
  };
11864
11874
  JourneysApi = class extends BaseApiClient {
11875
+ async putJourneyDraft(wid, journeyId, data) {
11876
+ return this.fetch(`w/${wid}/journeys/${journeyId}/draft`, {
11877
+ method: "PUT",
11878
+ body: JSON.stringify(data)
11879
+ });
11880
+ }
11865
11881
  /**
11866
11882
  * List journeys, optionally including archived, paginated.
11867
11883
  *
@@ -11951,6 +11967,13 @@ var init_chunk_ON7HBHJA = __esm({
11951
11967
  async getJourneyFilterOptions(wid) {
11952
11968
  return this.fetch(`w/${wid}/journeys/filter-options`);
11953
11969
  }
11970
+ /** Copy a supported legacy definition into a separate draft V2 Journey. */
11971
+ async cloneJourneyAsV2(wid, id) {
11972
+ return this.fetch(`w/${wid}/journeys/${id}/clone-v2`, {
11973
+ method: "POST",
11974
+ body: JSON.stringify({})
11975
+ });
11976
+ }
11954
11977
  /** Create a new journey. Returns the READ projection (`JourneyRead`). */
11955
11978
  async createJourney(wid, data) {
11956
11979
  return this.fetch(`w/${wid}/journeys`, {
@@ -14180,6 +14203,7 @@ var init_chunk_ON7HBHJA = __esm({
14180
14203
  "createFolder",
14181
14204
  "createGoal",
14182
14205
  "createInbox",
14206
+ "cloneJourneyAsV2",
14183
14207
  "createJourney",
14184
14208
  "createJourneyNote",
14185
14209
  "createMcpServer",
@@ -14773,6 +14797,7 @@ var init_chunk_ON7HBHJA = __esm({
14773
14797
  "previewWorkspaceImportZip",
14774
14798
  "provisionClientWorkspace",
14775
14799
  "publishWorkflowRevision",
14800
+ "putJourneyDraft",
14776
14801
  "putJourneyV2Definition",
14777
14802
  "rateMessage",
14778
14803
  "getChatFeedback",
@@ -15232,10 +15257,12 @@ var init_chunk_ON7HBHJA = __esm({
15232
15257
  getJourneys;
15233
15258
  getJourney;
15234
15259
  getJourneyAuthoring;
15260
+ putJourneyDraft;
15235
15261
  putJourneyV2Definition;
15236
15262
  getJourneyV2Validation;
15237
15263
  getJourneyFilterOptions;
15238
15264
  getJourneyHealth;
15265
+ cloneJourneyAsV2;
15239
15266
  createJourney;
15240
15267
  updateJourney;
15241
15268
  archiveJourney;
@@ -15380,6 +15407,8 @@ var init_chunk_ON7HBHJA = __esm({
15380
15407
  enableOrgDomainSite;
15381
15408
  getOrgDomainSite;
15382
15409
  preflightOrgDomainSite;
15410
+ createOrgDomainSiteChildHost;
15411
+ listOrgDomainSiteChildHosts;
15383
15412
  verifyOrgDomainSite;
15384
15413
  disableOrgDomainSite;
15385
15414
  getBusinessProfile;
@@ -16277,7 +16306,7 @@ var init_chunk_HRUMZ46V = __esm({
16277
16306
  var SEARCHABLE_EVENT_RULE_SOURCE_FIELDS, ActivityEventType, EntityKind;
16278
16307
  var init_dist = __esm({
16279
16308
  "../sdk/dist/index.js"() {
16280
- init_chunk_ON7HBHJA();
16309
+ init_chunk_R3C63RZJ();
16281
16310
  init_chunk_HRUMZ46V();
16282
16311
  init_chunk_P2E6LU7I();
16283
16312
  SEARCHABLE_EVENT_RULE_SOURCE_FIELDS = [
@@ -21014,7 +21043,6 @@ function findDef(defs, arg) {
21014
21043
 
21015
21044
  // src/lib/global-options.ts
21016
21045
  init_errors();
21017
- var MAX_COMMAND_WORDS = 4;
21018
21046
  function parseGlobalOptions(argv, spec) {
21019
21047
  let env = spec.defaultEnv;
21020
21048
  let profile;
@@ -21081,9 +21109,6 @@ function parseGlobalOptions(argv, spec) {
21081
21109
  rest.push(arg);
21082
21110
  }
21083
21111
  }
21084
- while (commandWords.length > MAX_COMMAND_WORDS) {
21085
- rest.unshift(commandWords.pop());
21086
- }
21087
21112
  return {
21088
21113
  opts: { env, profile, apiUrl, outputFormat, jq, verbose, allowWrite },
21089
21114
  commandWords,
@@ -21551,7 +21576,7 @@ var CommandRegistry = class {
21551
21576
  /** Resolve command words to a CommandDef using longest-match.
21552
21577
  * Supports {param} path segments that match any word and extract as pathParams. */
21553
21578
  resolve(words) {
21554
- for (let len = Math.min(words.length, 4); len >= 1; len--) {
21579
+ for (let len = words.length; len >= 1; len--) {
21555
21580
  const key = words.slice(0, len).join(" ");
21556
21581
  const cmd = this.commands.get(key);
21557
21582
  if (cmd) {
@@ -24587,8 +24612,8 @@ function parseBindingsFile(payload) {
24587
24612
  if (typeof entry !== "object" || entry === null || Array.isArray(entry)) {
24588
24613
  throw new CLIError(`${where}: each binding must be a JSON object.`);
24589
24614
  }
24590
- const record = entry;
24591
- const value = record.value;
24615
+ const record2 = entry;
24616
+ const value = record2.value;
24592
24617
  if (typeof value !== "string" && typeof value !== "boolean") {
24593
24618
  throw new CLIError(`${where}: "value" must be a string or a boolean.`);
24594
24619
  }
@@ -24596,14 +24621,14 @@ function parseBindingsFile(payload) {
24596
24621
  throw new CLIError(`${where}: "value" must not be empty.`);
24597
24622
  }
24598
24623
  const binding = {
24599
- entityType: requireString2(record.entityType, "entityType", where),
24600
- sourceUuid: requireString2(record.sourceUuid, "sourceUuid", where),
24601
- fieldPath: requireString2(record.fieldPath, "fieldPath", where),
24624
+ entityType: requireString2(record2.entityType, "entityType", where),
24625
+ sourceUuid: requireString2(record2.sourceUuid, "sourceUuid", where),
24626
+ fieldPath: requireString2(record2.fieldPath, "fieldPath", where),
24602
24627
  value
24603
24628
  };
24604
- const parentKind = optionalString2(record.parentKind, "parentKind", where);
24629
+ const parentKind = optionalString2(record2.parentKind, "parentKind", where);
24605
24630
  if (parentKind !== void 0) binding.parentKind = parentKind;
24606
- const parentUuid = optionalString2(record.parentUuid, "parentUuid", where);
24631
+ const parentUuid = optionalString2(record2.parentUuid, "parentUuid", where);
24607
24632
  if (parentUuid !== void 0) binding.parentUuid = parentUuid;
24608
24633
  return binding;
24609
24634
  });
@@ -33388,6 +33413,7 @@ var operatorGroupsDomain = {
33388
33413
  };
33389
33414
 
33390
33415
  // src/domains/org.ts
33416
+ init_dist();
33391
33417
  init_context();
33392
33418
  init_errors();
33393
33419
  init_output();
@@ -33438,6 +33464,95 @@ var DOMAIN_UUID_ARG = {
33438
33464
  function pluralize(count, singular, plural = `${singular}s`) {
33439
33465
  return count === 1 ? singular : plural;
33440
33466
  }
33467
+ var CHILD_HOST_COLUMNS = [
33468
+ { header: "HOST", getValue: (item) => item.domain },
33469
+ { header: "STATUS", getValue: (item) => item.status },
33470
+ { header: "UUID", getValue: (item) => item.orgDomainUuid },
33471
+ { header: "CREATED", getValue: (item) => String(item.createdAt) }
33472
+ ];
33473
+ var CHILD_HOST_ROW_COLUMNS = [
33474
+ { header: "HOST", getValue: (row) => row.host },
33475
+ { header: "STATUS", getValue: (row) => row.status },
33476
+ { header: "DETAIL", getValue: (row) => row.detail ?? "", maxWidth: 80 }
33477
+ ];
33478
+ var CHILD_HOSTING_ARG = {
33479
+ name: "child-hosting",
33480
+ description: "Child-hosting mode: the domain hosts children under its *.<domain> wildcard (see `site children`)",
33481
+ isFlag: true
33482
+ };
33483
+ var PARENT_DOMAIN_UUID_ARG = {
33484
+ ...DOMAIN_UUID_ARG,
33485
+ description: "OrgDomain UUID of the child-hosting parent"
33486
+ };
33487
+ var LABEL_ARGS = [
33488
+ { name: "label", description: "Host label, e.g. clinic-a (repeatable)", repeatable: true },
33489
+ {
33490
+ name: "labels-file",
33491
+ description: "File with one label per line; blank lines and # comments are skipped"
33492
+ }
33493
+ ];
33494
+ async function readLabelsFile(filePath) {
33495
+ const { readFile } = await import('fs/promises');
33496
+ let raw;
33497
+ try {
33498
+ raw = await readFile(filePath, "utf8");
33499
+ } catch (err) {
33500
+ throw new CLIError(
33501
+ `Could not read --labels-file ${filePath}: ${err?.code ?? "unknown error"}`
33502
+ );
33503
+ }
33504
+ return raw.split("\n").map((line) => line.trim()).filter((line) => line && !line.startsWith("#"));
33505
+ }
33506
+ async function collectLabels(args) {
33507
+ const raw = [...repeatedValues(args, "label")];
33508
+ const labelsFile = args["labels-file"];
33509
+ if (typeof labelsFile === "string" && labelsFile) {
33510
+ raw.push(...await readLabelsFile(labelsFile));
33511
+ }
33512
+ const labels = [...new Set(raw.map((label) => label.trim().toLowerCase()).filter(Boolean))];
33513
+ if (labels.length === 0) {
33514
+ throw new CLIError("Give at least one --label, or a --labels-file with one label per line.");
33515
+ }
33516
+ return labels;
33517
+ }
33518
+ var detailOf = (err) => err instanceof Error ? err.message : String(err);
33519
+ function record(rows, row) {
33520
+ rows.push(row);
33521
+ stderr2(`${row.host}: ${row.status}${row.detail ? ` (${row.detail})` : ""}`);
33522
+ }
33523
+ function reportRows(rows, opts, verb) {
33524
+ outputData(rows, opts, CHILD_HOST_ROW_COLUMNS);
33525
+ if (rows.some((row) => row.status === "pending")) {
33526
+ hint(opts, [
33527
+ "New hosts verify on their own once their certificates issue, usually within minutes.",
33528
+ "Check with `gr org domains site children list`."
33529
+ ]);
33530
+ }
33531
+ const failed = rows.filter((row) => row.status === "error").length;
33532
+ if (failed > 0) {
33533
+ throw new CLIError(
33534
+ `${failed} of ${rows.length} ${pluralize(rows.length, "host")} could not be ${verb}.`
33535
+ );
33536
+ }
33537
+ }
33538
+ async function removeChildHost(client, orgRef, host, confirm) {
33539
+ try {
33540
+ const result2 = await client.disableOrgDomainSite(orgRef, host.orgDomainUuid, confirm);
33541
+ if (!result2.ok) {
33542
+ const { siteCount } = result2.impact;
33543
+ const sites = `${siteCount} ${pluralize(siteCount, "site")}`;
33544
+ return {
33545
+ host: host.domain,
33546
+ status: "error",
33547
+ detail: confirm ? `Still routes ${sites} after a confirmed disable; it was not removed.` : `Still routes ${sites}; re-run with --confirm to remove it anyway.`
33548
+ };
33549
+ }
33550
+ } catch (err) {
33551
+ if (!(err instanceof ApiError && err.statusCode === 404)) throw err;
33552
+ }
33553
+ await client.deleteOrgDomain(orgRef, host.orgDomainUuid);
33554
+ return { host: host.domain, status: "removed" };
33555
+ }
33441
33556
  function emailVerifyCommand(path4, description) {
33442
33557
  return {
33443
33558
  path: path4,
@@ -33641,19 +33756,42 @@ var domainCommands = [
33641
33756
  `);
33642
33757
  }
33643
33758
  },
33759
+ {
33760
+ path: ["org", "domains", "site", "preflight"],
33761
+ description: "Check the DNS that enabling sites needs, without enabling; exits non-zero until it resolves",
33762
+ requiresWorkspace: false,
33763
+ args: [ORG_UUID_ARG2, DOMAIN_UUID_ARG, CHILD_HOSTING_ARG],
33764
+ examples: [
33765
+ "yarn gr org domains site preflight --org-uuid $ORG_UUID --domain-uuid $DOMAIN_UUID",
33766
+ "yarn gr org domains site preflight --org-uuid $ORG_UUID --domain-uuid $DOMAIN_UUID --child-hosting"
33767
+ ],
33768
+ handler: async (hctx) => {
33769
+ const result2 = await requireAuth(hctx.ctx).apiClient.preflightOrgDomainSite(
33770
+ requireOrgRef(hctx.args),
33771
+ requireDomainUuid(hctx.args),
33772
+ { childHosting: hctx.args["child-hosting"] === true }
33773
+ );
33774
+ outputSingle(result2, hctx.ctx);
33775
+ if (!result2.dnsReady) {
33776
+ throw new CLIError("DNS is not ready yet. Publish the records above, then re-run.");
33777
+ }
33778
+ }
33779
+ },
33644
33780
  {
33645
33781
  path: ["org", "domains", "site", "enable"],
33646
- description: "Enable custom site CNAME verification on a verified organization domain",
33782
+ description: "Enable custom site routing on a verified organization domain, or with --child-hosting as a parent for hosts under its wildcard",
33647
33783
  mutates: true,
33648
33784
  requiresWorkspace: false,
33649
- args: [ORG_UUID_ARG2, DOMAIN_UUID_ARG],
33785
+ args: [ORG_UUID_ARG2, DOMAIN_UUID_ARG, CHILD_HOSTING_ARG],
33650
33786
  examples: [
33651
- "yarn gr org domains site enable --org-uuid $ORG_UUID --domain-uuid $DOMAIN_UUID --allow-write"
33787
+ "yarn gr org domains site enable --org-uuid $ORG_UUID --domain-uuid $DOMAIN_UUID --allow-write",
33788
+ "yarn gr org domains site enable --org-uuid $ORG_UUID --domain-uuid $DOMAIN_UUID --child-hosting --allow-write"
33652
33789
  ],
33653
33790
  handler: async (hctx) => {
33654
33791
  const result2 = await requireAuth(hctx.ctx).apiClient.enableOrgDomainSite(
33655
33792
  requireOrgRef(hctx.args),
33656
- requireDomainUuid(hctx.args)
33793
+ requireDomainUuid(hctx.args),
33794
+ { childHosting: hctx.args["child-hosting"] === true }
33657
33795
  );
33658
33796
  outputSingle(result2, hctx.ctx);
33659
33797
  }
@@ -33716,6 +33854,103 @@ var domainCommands = [
33716
33854
  process.stdout.write(`Disabled site routing for org domain ${domainUuid}
33717
33855
  `);
33718
33856
  }
33857
+ },
33858
+ {
33859
+ path: ["org", "domains", "site", "children", "list"],
33860
+ description: "List the hosts beneath a child-hosting parent domain, with their status",
33861
+ requiresWorkspace: false,
33862
+ args: [ORG_UUID_ARG2, PARENT_DOMAIN_UUID_ARG],
33863
+ examples: [
33864
+ "yarn gr org domains site children list --org-uuid $ORG_UUID --domain-uuid $PARENT_UUID"
33865
+ ],
33866
+ handler: async (hctx) => {
33867
+ const result2 = await requireAuth(hctx.ctx).apiClient.listOrgDomainSiteChildHosts(
33868
+ requireOrgRef(hctx.args),
33869
+ requireDomainUuid(hctx.args)
33870
+ );
33871
+ outputData(result2.items, hctx.ctx, CHILD_HOST_COLUMNS);
33872
+ }
33873
+ },
33874
+ {
33875
+ path: ["org", "domains", "site", "children", "add"],
33876
+ description: "Add hosts beneath a child-hosting parent domain, one at a time; exits non-zero if any fail",
33877
+ mutates: true,
33878
+ requiresWorkspace: false,
33879
+ args: [ORG_UUID_ARG2, PARENT_DOMAIN_UUID_ARG, ...LABEL_ARGS],
33880
+ examples: [
33881
+ "yarn gr org domains site children add --org-uuid $ORG_UUID --domain-uuid $PARENT_UUID --label clinic-a --label clinic-b --allow-write",
33882
+ "yarn gr org domains site children add --org-uuid $ORG_UUID --domain-uuid $PARENT_UUID --labels-file labels.txt --allow-write"
33883
+ ],
33884
+ handler: async (hctx) => {
33885
+ const client = requireAuth(hctx.ctx).apiClient;
33886
+ const orgRef = requireOrgRef(hctx.args);
33887
+ const parentUuid = requireDomainUuid(hctx.args);
33888
+ const labels = await collectLabels(hctx.args);
33889
+ const parent = await client.getOrgDomain(orgRef, parentUuid);
33890
+ const rows = [];
33891
+ for (const label of labels) {
33892
+ try {
33893
+ const created = await client.createOrgDomainSiteChildHost(orgRef, parentUuid, {
33894
+ label
33895
+ });
33896
+ record(rows, { host: created.domain, status: created.status });
33897
+ } catch (err) {
33898
+ record(rows, {
33899
+ host: `${label}.${parent.domain}`,
33900
+ status: "error",
33901
+ detail: detailOf(err)
33902
+ });
33903
+ }
33904
+ }
33905
+ reportRows(rows, hctx.ctx, "added");
33906
+ }
33907
+ },
33908
+ {
33909
+ path: ["org", "domains", "site", "children", "remove"],
33910
+ description: "Remove hosts from a child-hosting parent domain (certificate, routing and registration); exits non-zero if any fail",
33911
+ mutates: true,
33912
+ requiresWorkspace: false,
33913
+ args: [
33914
+ ORG_UUID_ARG2,
33915
+ PARENT_DOMAIN_UUID_ARG,
33916
+ ...LABEL_ARGS,
33917
+ {
33918
+ name: "confirm",
33919
+ description: "Also remove hosts that still route sites",
33920
+ isFlag: true
33921
+ }
33922
+ ],
33923
+ examples: [
33924
+ "yarn gr org domains site children remove --org-uuid $ORG_UUID --domain-uuid $PARENT_UUID --label clinic-a --allow-write",
33925
+ "yarn gr org domains site children remove --org-uuid $ORG_UUID --domain-uuid $PARENT_UUID --labels-file labels.txt --confirm --allow-write"
33926
+ ],
33927
+ handler: async (hctx) => {
33928
+ const client = requireAuth(hctx.ctx).apiClient;
33929
+ const orgRef = requireOrgRef(hctx.args);
33930
+ const parentUuid = requireDomainUuid(hctx.args);
33931
+ const labels = await collectLabels(hctx.args);
33932
+ const confirm = hctx.args.confirm === true;
33933
+ const { items } = await client.listOrgDomainSiteChildHosts(orgRef, parentUuid);
33934
+ const hostsByLabel = new Map(items.map((host) => [host.label, host]));
33935
+ const rows = [];
33936
+ for (const label of labels) {
33937
+ const host = hostsByLabel.get(label);
33938
+ if (!host) {
33939
+ record(rows, {
33940
+ host: label,
33941
+ status: "error",
33942
+ detail: "No host with this label under this domain."
33943
+ });
33944
+ continue;
33945
+ }
33946
+ try {
33947
+ record(rows, await removeChildHost(client, orgRef, host, confirm));
33948
+ } catch (err) {
33949
+ record(rows, { host: host.domain, status: "error", detail: detailOf(err) });
33950
+ }
33951
+ }
33952
+ reportRows(rows, hctx.ctx, "removed");
33953
+ }
33719
33954
  }
33720
33955
  ];
33721
33956
  var orgDomain = {
@@ -34958,9 +35193,9 @@ ${PHONE_NUMBER_FIELD_REFERENCE}`,
34958
35193
  workspace,
34959
35194
  payload
34960
35195
  );
34961
- const record = asPhoneRecord(result2);
34962
- const warnings = collectPhoneNumberWarnings(record);
34963
- outputData([record], ctx, COLUMNS26);
35196
+ const record2 = asPhoneRecord(result2);
35197
+ const warnings = collectPhoneNumberWarnings(record2);
35198
+ outputData([record2], ctx, COLUMNS26);
34964
35199
  if (warnings.length > 0) {
34965
35200
  process.stderr.write("\nWarnings after create:\n");
34966
35201
  for (const w of warnings) {
@@ -38866,17 +39101,17 @@ function parseUiPromptResponse(content) {
38866
39101
  return null;
38867
39102
  }
38868
39103
  if (!parsed || typeof parsed !== "object") return null;
38869
- const record = parsed;
38870
- const hasChoice = record.chosenValue !== void 0;
38871
- const hasValues = record.values !== void 0;
38872
- if (record.status === "declined") {
39104
+ const record2 = parsed;
39105
+ const hasChoice = record2.chosenValue !== void 0;
39106
+ const hasValues = record2.values !== void 0;
39107
+ if (record2.status === "declined") {
38873
39108
  return hasChoice || hasValues ? null : { promptId, kind, body: { status: "declined" } };
38874
39109
  }
38875
- if (record.status !== "submitted" || hasChoice === hasValues) return null;
39110
+ if (record2.status !== "submitted" || hasChoice === hasValues) return null;
38876
39111
  if (hasChoice) {
38877
- return typeof record.chosenValue === "string" ? { promptId, kind, body: { status: "submitted", chosenValue: record.chosenValue } } : null;
39112
+ return typeof record2.chosenValue === "string" ? { promptId, kind, body: { status: "submitted", chosenValue: record2.chosenValue } } : null;
38878
39113
  }
38879
- const values = parseFormValues(record.values);
39114
+ const values = parseFormValues(record2.values);
38880
39115
  return values ? { promptId, kind, body: { status: "submitted", values } } : null;
38881
39116
  }
38882
39117
  function parseFormValues(raw) {
@@ -39874,8 +40109,8 @@ async function handleUIChoiceTerminal(payload) {
39874
40109
  }
39875
40110
 
39876
40111
  // src/lib/ui-prompt-presented.ts
39877
- function optionalString3(record, key) {
39878
- const value = record[key];
40112
+ function optionalString3(record2, key) {
40113
+ const value = record2[key];
39879
40114
  return typeof value === "string" && value.length > 0 ? value : void 0;
39880
40115
  }
39881
40116
  var CONNECT_TOOL_NAME = /^connect_[a-z0-9_]+_account$/;
@@ -39885,14 +40120,14 @@ function isUiPromptToolName(name) {
39885
40120
  }
39886
40121
  function parseConnect(value) {
39887
40122
  if (!value || typeof value !== "object") return void 0;
39888
- const record = value;
39889
- const appSlug = optionalString3(record, "appSlug");
40123
+ const record2 = value;
40124
+ const appSlug = optionalString3(record2, "appSlug");
39890
40125
  if (!appSlug) return void 0;
39891
40126
  return {
39892
40127
  appSlug,
39893
- connectionUuid: optionalString3(record, "connectionUuid") ?? "",
39894
- label: optionalString3(record, "label") ?? appSlug,
39895
- expiresInMinutes: typeof record.expiresInMinutes === "number" ? record.expiresInMinutes : 0
40128
+ connectionUuid: optionalString3(record2, "connectionUuid") ?? "",
40129
+ label: optionalString3(record2, "label") ?? appSlug,
40130
+ expiresInMinutes: typeof record2.expiresInMinutes === "number" ? record2.expiresInMinutes : 0
39896
40131
  };
39897
40132
  }
39898
40133
  function parseUiPromptPresented(content) {
@@ -39907,24 +40142,24 @@ function parseUiPromptPresented(content) {
39907
40142
  }
39908
40143
  }
39909
40144
  if (!value || typeof value !== "object") return null;
39910
- const record = value;
39911
- if (record.status !== "presented") return null;
39912
- const promptId = optionalString3(record, "promptId");
39913
- const kind = record.kind;
40145
+ const record2 = value;
40146
+ if (record2.status !== "presented") return null;
40147
+ const promptId = optionalString3(record2, "promptId");
40148
+ const kind = record2.kind;
39914
40149
  if (!promptId || !isUiPromptKind(kind)) return null;
39915
- const connect = parseConnect(record.connect);
40150
+ const connect = parseConnect(record2.connect);
39916
40151
  if (kind === "inline_connect" && !connect) return null;
39917
40152
  return {
39918
40153
  status: "presented",
39919
40154
  promptId,
39920
40155
  kind,
39921
- userPrompt: optionalString3(record, "userPrompt"),
39922
- openuiMarkup: optionalString3(record, "openuiMarkup"),
39923
- description: optionalString3(record, "description"),
39924
- multi: record.multi === true,
40156
+ userPrompt: optionalString3(record2, "userPrompt"),
40157
+ openuiMarkup: optionalString3(record2, "openuiMarkup"),
40158
+ description: optionalString3(record2, "description"),
40159
+ multi: record2.multi === true,
39925
40160
  // LLM-facing guidance. The CLI never renders it, but it is part of the
39926
40161
  // result, so it travels rather than being dropped on the floor.
39927
- instructions: typeof record.instructions === "string" ? record.instructions : "",
40162
+ instructions: typeof record2.instructions === "string" ? record2.instructions : "",
39928
40163
  ...connect ? { connect } : {}
39929
40164
  };
39930
40165
  }
@@ -40015,9 +40250,9 @@ async function runConciergeAguiLoop(client, initialMessages, onEvent, opts) {
40015
40250
  const type = event.type?.toLowerCase() ?? "";
40016
40251
  if (type === "tool_call_start") {
40017
40252
  hasToolCalls = true;
40018
- const record = event;
40019
- const callId = record.toolCallId ?? record.tool_call_id;
40020
- const name = record.toolCallName ?? record.tool_call_name ?? record.toolName;
40253
+ const record2 = event;
40254
+ const callId = record2.toolCallId ?? record2.tool_call_id;
40255
+ const name = record2.toolCallName ?? record2.tool_call_name ?? record2.toolName;
40021
40256
  if (typeof callId === "string" && typeof name === "string") {
40022
40257
  toolCallNames.set(callId, name);
40023
40258
  }
@@ -43141,7 +43376,7 @@ init_concierge_api();
43141
43376
 
43142
43377
  // package.json
43143
43378
  var package_default = {
43144
- version: "0.34.0"};
43379
+ version: "0.36.0"};
43145
43380
 
43146
43381
  // src/gr.ts
43147
43382
  var VERSION = package_default.version;