@wayai/cli 0.3.261 → 0.3.262

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/index.js CHANGED
@@ -6636,7 +6636,7 @@ var init_chunk_Y7CFCYX4 = __esm({
6636
6636
  }
6637
6637
  });
6638
6638
 
6639
- // ../../packages/core/dist/chunk-IPEFFLCO.js
6639
+ // ../../packages/core/dist/chunk-S5SVBLGT.js
6640
6640
  function normalizeContactPhone(raw) {
6641
6641
  const compact = raw.trim().replace(/[\s\-.()]/g, "");
6642
6642
  const withPlus = compact.startsWith("00") ? `+${compact.slice(2)}` : compact;
@@ -6648,9 +6648,9 @@ function normalizeContactLabel(raw) {
6648
6648
  function importRowLabels(row, batchLabels) {
6649
6649
  return [.../* @__PURE__ */ new Set([...row.labels ?? [], ...batchLabels ?? []])];
6650
6650
  }
6651
- var CONTACT_ENVIRONMENTS, CONTACT_NAME_MAX, CONTACT_EMAIL_MAX, CONTACT_PHONE_INPUT_MAX, CONTACT_INSTAGRAM_SID_MAX, CONTACT_METADATA_MAX_BYTES, CONTACT_LABEL_MAX, CONTACT_LABELS_MAX, CONTACT_SCOPE_TAGS_MAX, CONTACT_PAGE_MAX, CONTACT_IMPORT_BATCH_MAX, CONTACT_SEARCH_MAX, CONTACT_LIST_NAME_MAX, CONTACT_LIST_NAME_REGEX, CONTACT_LIST_DESCRIPTION_MAX, CONTACT_LIST_FILTER_MAX, CONTACT_LIST_PINS_PER_REQUEST_MAX, SUPPRESSION_SCOPES, SUPPRESSION_ID_REGEX, contactName, contactPhone, contactEmail, contactInstagramSid, contactLabel, contactLabels, contactMetadata, scopeTagIds, contactVisibilitySchema, hasIdentity, IDENTITY_REQUIRED, contactBookOrgQuery, contactBookContactParam, contactBookListParam, contactBookHubParam, contactBookPageQuery, listContactBookContactsQuery, listHubContactBookContactsQuery, contactBookLinkCandidatesQuery, listContactBookListMembersQuery, contactRowFields, createContactBookContactBody, updateContactBookContactBody, contactImportRowSchema, importContactBookContactsBody, linkContactBookContactBody, CONTACT_CUSTOMER_BASE_ID_PATTERN, baseId, recordId, linkContactCustomerBody, unlinkContactCustomerQuery, listName, contactListFilterSchema, createContactBookListBody, updateContactBookListBody, updateContactBookListPinsBody, suppressionIdentitySchema, createContactBookSuppressionBody, contactBookSuppressionParam, listContactBookSuppressionsQuery, contactBookEmailUnsubscribeTokenSchema, contactBookEmailUnsubscribeQuery, orgListReferenceSchema;
6652
- var init_chunk_IPEFFLCO = __esm({
6653
- "../../packages/core/dist/chunk-IPEFFLCO.js"() {
6651
+ var CONTACT_ENVIRONMENTS, CONTACT_NAME_MAX, CONTACT_EMAIL_MAX, CONTACT_PHONE_INPUT_MAX, CONTACT_INSTAGRAM_SID_MAX, CONTACT_METADATA_MAX_BYTES, CONTACT_LABEL_MAX, CONTACT_LABELS_MAX, CONTACT_SCOPE_TAGS_MAX, CONTACT_PAGE_MAX, CONTACT_IMPORT_BATCH_MAX, CONTACT_SEARCH_MAX, CONTACT_LIST_NAME_MAX, CONTACT_LIST_NAME_REGEX, CONTACT_LIST_DESCRIPTION_MAX, CONTACT_LIST_FILTER_MAX, CONTACT_LIST_PINS_PER_REQUEST_MAX, SUPPRESSION_SCOPES, SUPPRESSION_ID_REGEX, contactName, contactPhone, contactEmail, contactInstagramSid, contactLabel, contactLabels, contactMetadata, scopeTagIds, contactVisibilitySchema, hasIdentity, IDENTITY_REQUIRED, contactBookOrgQuery, contactBookContactParam, contactBookListParam, contactBookHubParam, contactBookPageQuery, listContactBookContactsQuery, listHubContactBookContactsQuery, contactBookLinkCandidatesQuery, listContactBookListMembersQuery, contactRowFields, createContactBookContactBody, updateContactBookContactBody, contactImportRowSchema, importContactBookContactsBody, linkContactBookContactBody, listName, contactListFilterSchema, createContactBookListBody, updateContactBookListBody, updateContactBookListPinsBody, suppressionIdentitySchema, createContactBookSuppressionBody, contactBookSuppressionParam, listContactBookSuppressionsQuery, contactBookEmailUnsubscribeTokenSchema, contactBookEmailUnsubscribeQuery, orgListReferenceSchema;
6652
+ var init_chunk_S5SVBLGT = __esm({
6653
+ "../../packages/core/dist/chunk-S5SVBLGT.js"() {
6654
6654
  "use strict";
6655
6655
  init_zod();
6656
6656
  CONTACT_ENVIRONMENTS = ["production", "preview", "all"];
@@ -6769,16 +6769,6 @@ var init_chunk_IPEFFLCO = __esm({
6769
6769
  linkContactBookContactBody = external_exports.object({
6770
6770
  user_id: external_exports.string().min(1).max(128)
6771
6771
  }).strict();
6772
- CONTACT_CUSTOMER_BASE_ID_PATTERN = /^[A-Za-z0-9_-]{1,128}$/;
6773
- baseId = external_exports.string().regex(CONTACT_CUSTOMER_BASE_ID_PATTERN, { message: "Must be a base id" });
6774
- recordId = external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_\-.:]{0,254}$/, { message: "Must be a record id" });
6775
- linkContactCustomerBody = external_exports.object({
6776
- base_id: baseId,
6777
- record_id: recordId
6778
- }).strict();
6779
- unlinkContactCustomerQuery = contactBookOrgQuery.extend({
6780
- base_id: baseId
6781
- });
6782
6772
  listName = external_exports.string().trim().min(1).max(CONTACT_LIST_NAME_MAX).regex(CONTACT_LIST_NAME_REGEX, {
6783
6773
  message: 'Must be lowercase alphanumeric with hyphens (e.g. "vip-customers")'
6784
6774
  });
@@ -6821,12 +6811,12 @@ var init_chunk_IPEFFLCO = __esm({
6821
6811
  }
6822
6812
  });
6823
6813
 
6824
- // ../../packages/core/dist/chunk-YHH6V2TT.js
6814
+ // ../../packages/core/dist/chunk-F5Z4VOPU.js
6825
6815
  var PERSON_ID_PATTERN, CONTACT_PERSON_ID_PATTERN, PERSON_DENY_PAGE_MAX, PERSON_ID_FORM_MESSAGE, userPersonIdSchema, personIdSchema, personParam, personLinkParam, deniedPersonParam, listDeniedPersonsQuery;
6826
- var init_chunk_YHH6V2TT = __esm({
6827
- "../../packages/core/dist/chunk-YHH6V2TT.js"() {
6816
+ var init_chunk_F5Z4VOPU = __esm({
6817
+ "../../packages/core/dist/chunk-F5Z4VOPU.js"() {
6828
6818
  "use strict";
6829
- init_chunk_IPEFFLCO();
6819
+ init_chunk_S5SVBLGT();
6830
6820
  init_zod();
6831
6821
  PERSON_ID_PATTERN = /^prs_[a-z2-7]{52}$/;
6832
6822
  CONTACT_PERSON_ID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
@@ -12034,12 +12024,12 @@ var init_chunk_6J742GLA = __esm({
12034
12024
  }
12035
12025
  });
12036
12026
 
12037
- // ../../packages/core/dist/chunk-ZM3DFTSY.js
12027
+ // ../../packages/core/dist/chunk-6YIKY5UC.js
12038
12028
  var COMMUNITIES_PER_ORG_MAX, COMMUNITY_NAME_MAX_LENGTH, COMMUNITY_REGISTRY_CLOSED_REASON, COMMUNITY_MEMBERS_MAX, COMMUNITY_ADMISSIONS, COMMUNITY_ACCESS_MAX, COMMUNITY_ACCESS_ADD_MAX, COMMUNITY_ACCESS_FULL_REASON, COMMUNITY_JOIN_SOURCE_MAX_LENGTH, COMMUNITY_JOIN_FLOW_TOKEN_MAX_LENGTH, COMMUNITY_ROOMS_MAX, COMMUNITY_ROOM_NAME_MAX_LENGTH, COMMUNITY_MESSAGE_MAX_LENGTH, COMMUNITY_MESSAGES_PAGE_SIZE, COMMUNITY_ATTACHMENT_URLS_MAX, COMMUNITY_POST_TITLE_MAX_LENGTH, COMMUNITY_POST_SEARCH_MAX_LENGTH, COMMUNITY_MEMBER_STATUSES, COMMUNITY_RULES_MAX_LENGTH, COMMUNITY_SLOW_MODE_MAX_SECONDS, COMMUNITY_COURSES_LABEL_MAX_LENGTH, COMMUNITY_LIVE_TICKET_PREFIX, COMMUNITY_STATS_DAYS, communityNameSchema, adminCreateCommunityBody, communityIdParam, communityJoinTokenSchema, communityJoinSourceSchema, communityJoinPreviewQuery, communityJoinBody, communityRoomKindSchema, communityRoomNameSchema, communityRoomIdParam, communityMessageIdParam, communityRoomCreateBody, communityRoomUpdateBody, communityMessagesQuery, communityMessageBodySchema, communityPostTitleSchema, communityAttachmentUploadSchema, communitySendBody, communityEditBody, communityPostIdParam, communityPostsQuery, communityAnswerBody, communityReadBody, communityAttachmentUrlsBody, communityPersonParam, communityOrgParam, communityPeopleQuery, communityCoursesLabelSchema, communityAdmissionSchema, communitySettingsBody, communityAccessEmailSchema, communityAccessAddBody, communityAccessQuery, communityAccessIdParam, communityBanBody, communityLockBody, communityPinBody, communityModLogQuery, communityReportsQuery, communityReportIdParam, communityLiveTicketSchema, communityLiveQuery, communityMuteBody, communityEmailUnsubscribeTokenSchema, communityEmailUnsubscribeQuery;
12039
- var init_chunk_ZM3DFTSY = __esm({
12040
- "../../packages/core/dist/chunk-ZM3DFTSY.js"() {
12029
+ var init_chunk_6YIKY5UC = __esm({
12030
+ "../../packages/core/dist/chunk-6YIKY5UC.js"() {
12041
12031
  "use strict";
12042
- init_chunk_IPEFFLCO();
12032
+ init_chunk_S5SVBLGT();
12043
12033
  init_chunk_6J742GLA();
12044
12034
  init_chunk_ZVXO3XL6();
12045
12035
  init_chunk_HZ6CADSY();
@@ -12143,7 +12133,7 @@ var init_chunk_ZM3DFTSY = __esm({
12143
12133
  }
12144
12134
  });
12145
12135
 
12146
- // ../../packages/core/dist/chunk-5WTHC665.js
12136
+ // ../../packages/core/dist/chunk-ZA6REWD4.js
12147
12137
  function parseCommunityLessonVideoUrl(url) {
12148
12138
  const parts = /^https?:\/\/([^/?#]+)([^?#]*)(?:\?([^#]*))?(?:#.*)?$/i.exec(url.trim());
12149
12139
  if (!parts) return null;
@@ -12169,10 +12159,10 @@ function communityLessonVideoWatchUrl(video) {
12169
12159
  }
12170
12160
  }
12171
12161
  var COMMUNITY_COURSES_MAX, COMMUNITY_COURSE_MODULES_MAX, COMMUNITY_COURSE_LESSONS_MAX, COMMUNITY_LESSONS_MAX, COMMUNITY_COURSE_TITLE_MAX_LENGTH, COMMUNITY_COURSE_DESCRIPTION_MAX_LENGTH, COMMUNITY_LESSON_BODY_MAX_LENGTH, COMMUNITY_LESSON_LINKS_MAX, COMMUNITY_LESSON_URL_MAX_LENGTH, YOUTUBE_ID, YOUTUBE_HOSTS, YOUTU_BE, YOUTUBE_ID_PATH, communityCourseIdParam, communityCourseModuleIdParam, communityLessonIdParam, communityCourseTitleSchema, communityCourseDescriptionSchema, communityCoursePositionSchema, communityLessonVideoUrlSchema, communityLessonLinkSchema, communityLessonLinksSchema, communityLessonBodySchema, communityCourseCreateBody, communityCourseUpdateBody, communityModuleCreateBody, communityModuleUpdateBody, communityLessonCreateBody, communityLessonUpdateBody;
12172
- var init_chunk_5WTHC665 = __esm({
12173
- "../../packages/core/dist/chunk-5WTHC665.js"() {
12162
+ var init_chunk_ZA6REWD4 = __esm({
12163
+ "../../packages/core/dist/chunk-ZA6REWD4.js"() {
12174
12164
  "use strict";
12175
- init_chunk_ZM3DFTSY();
12165
+ init_chunk_6YIKY5UC();
12176
12166
  init_chunk_HZ6CADSY();
12177
12167
  init_zod();
12178
12168
  COMMUNITY_COURSES_MAX = 20;
@@ -15671,15 +15661,15 @@ var init_chunk_JO53JB35 = __esm({
15671
15661
  }
15672
15662
  });
15673
15663
 
15674
- // ../../packages/core/dist/chunk-63ZD7TGN.js
15664
+ // ../../packages/core/dist/chunk-ZU2FJGU3.js
15675
15665
  function filterNamesAnything(filter) {
15676
15666
  return filter.labels.length + filter.scope_tag_ids.length > 0;
15677
15667
  }
15678
15668
  var hubListNameSchema, HUB_LIST_FILTER_REQUIRED, hubContactListFilterSchema, hubContactListIdParam, hubContactListHubQuery, description, createHubContactListBody, updateHubContactListBody;
15679
- var init_chunk_63ZD7TGN = __esm({
15680
- "../../packages/core/dist/chunk-63ZD7TGN.js"() {
15669
+ var init_chunk_ZU2FJGU3 = __esm({
15670
+ "../../packages/core/dist/chunk-ZU2FJGU3.js"() {
15681
15671
  "use strict";
15682
- init_chunk_IPEFFLCO();
15672
+ init_chunk_S5SVBLGT();
15683
15673
  init_zod();
15684
15674
  hubListNameSchema = orgListReferenceSchema;
15685
15675
  HUB_LIST_FILTER_REQUIRED = "A hub list names at least one label or scope tag";
@@ -15705,13 +15695,13 @@ var init_chunk_63ZD7TGN = __esm({
15705
15695
  }
15706
15696
  });
15707
15697
 
15708
- // ../../packages/core/dist/chunk-EXAQDPNR.js
15698
+ // ../../packages/core/dist/chunk-CL2SULM6.js
15709
15699
  var AUTOMATION_TRIGGER_TYPES, AUTOMATION_EVENT_TYPES, AUTOMATION_TARGET_TYPES, AUTOMATION_ACTION_TYPES, AUTOMATION_CHANNEL_TYPES, AUTOMATION_PURPOSES, AUTOMATION_NAME_MAX, AUTOMATION_DESCRIPTION_MAX, AUTOMATION_INSTRUCTIONS_MAX, AUTOMATION_TEXT_MAX, AUTOMATION_CRON_MAX, AUTOMATION_WEBHOOK_AUTHS, AUTOMATION_WEBHOOK_HEADERS, AUTOMATION_WEBHOOK_BODY_MAX_BYTES, AUTOMATION_WEBHOOK_HEADER_NAME_MAX, WEBHOOK_RESERVED_HEADERS, automationTriggerSchema, automationTargetSchema, automationActionSchema, automationGateSchema, automationName, automationDescription, automationIdParam, automationHubQuery, automationWebhookParams, AUTOMATION_RUNS_PAGE_MAX, listAutomationRunsQuery, createAutomationBody, updateAutomationBody, AUTOMATION_ALERT_CATEGORIES, AUTOMATION_BLOCKED_ALERT_CATEGORY, automationEventSubscriberParam;
15710
- var init_chunk_EXAQDPNR = __esm({
15711
- "../../packages/core/dist/chunk-EXAQDPNR.js"() {
15700
+ var init_chunk_CL2SULM6 = __esm({
15701
+ "../../packages/core/dist/chunk-CL2SULM6.js"() {
15712
15702
  "use strict";
15713
- init_chunk_63ZD7TGN();
15714
- init_chunk_IPEFFLCO();
15703
+ init_chunk_ZU2FJGU3();
15704
+ init_chunk_S5SVBLGT();
15715
15705
  init_chunk_5FTGVRDF();
15716
15706
  init_chunk_5XEJSR22();
15717
15707
  init_chunk_Q3WAAJBA();
@@ -16168,7 +16158,7 @@ var init_contracts = __esm({
16168
16158
  init_chunk_VEERWOZ6();
16169
16159
  init_chunk_ZXK6N2HN();
16170
16160
  init_chunk_Y7CFCYX4();
16171
- init_chunk_YHH6V2TT();
16161
+ init_chunk_F5Z4VOPU();
16172
16162
  init_chunk_5DGHIY7L();
16173
16163
  init_chunk_YUZFHVB2();
16174
16164
  init_chunk_I3O2RACG();
@@ -16185,8 +16175,8 @@ var init_contracts = __esm({
16185
16175
  init_chunk_UI6YFSZL();
16186
16176
  init_chunk_C4HEZ7ZI();
16187
16177
  init_chunk_IR2NOSI3();
16188
- init_chunk_5WTHC665();
16189
- init_chunk_ZM3DFTSY();
16178
+ init_chunk_ZA6REWD4();
16179
+ init_chunk_6YIKY5UC();
16190
16180
  init_chunk_YULHXJ5M();
16191
16181
  init_chunk_V4FRPRH5();
16192
16182
  init_chunk_LWMLR2WI();
@@ -16217,9 +16207,9 @@ var init_contracts = __esm({
16217
16207
  init_chunk_2PZIF56U();
16218
16208
  init_chunk_UEJOG2Q7();
16219
16209
  init_chunk_JO53JB35();
16220
- init_chunk_EXAQDPNR();
16221
- init_chunk_63ZD7TGN();
16222
- init_chunk_IPEFFLCO();
16210
+ init_chunk_CL2SULM6();
16211
+ init_chunk_ZU2FJGU3();
16212
+ init_chunk_S5SVBLGT();
16223
16213
  init_chunk_5FTGVRDF();
16224
16214
  init_chunk_IG6QBZMA();
16225
16215
  init_chunk_OMPT4ZHR();
@@ -18172,19 +18162,6 @@ var init_api_client = __esm({
18172
18162
  }
18173
18163
  // The org-admin community routes (gh #5003, `wayai communities`): an owner or admin of the
18174
18164
  // community's org, on an interactive session only — a scoped token is refused with 403.
18175
- /**
18176
- * Link a contact to its customer record, a root record of one of the org's bases (#5083 RK2 A3).
18177
- * A browser sign-in only: the route refuses an API token.
18178
- */
18179
- async linkContactCustomer(orgId, contactId, body) {
18180
- const qs = new URLSearchParams({ organization_id: orgId });
18181
- return this.request("PUT", `/api/contact-book/contacts/${encodeURIComponent(contactId)}/customer?${qs}`, body);
18182
- }
18183
- /** Unlink a contact from its customer record in one base (owner decision 142). A browser sign-in only. */
18184
- async unlinkContactCustomer(orgId, contactId, baseId2) {
18185
- const qs = new URLSearchParams({ organization_id: orgId, base_id: baseId2 });
18186
- return this.request("DELETE", `/api/contact-book/contacts/${encodeURIComponent(contactId)}/customer?${qs}`);
18187
- }
18188
18165
  // Person links and the deny list (wayai-pro/wayai#5473 §1): a browser sign-in only — each route refuses
18189
18166
  // an API token. A link takes org:write over the organization; the rest an organization admin.
18190
18167
  /** Whom a person id names in the organization: the hub where a conversation carries it, and that hub's name and email for them. */
@@ -23658,12 +23635,12 @@ function writeBaseFolder(folder, meta, config) {
23658
23635
  }
23659
23636
  return delta;
23660
23637
  }
23661
- function markProductionMirror(folder, baseId2) {
23638
+ function markProductionMirror(folder, baseId) {
23662
23639
  const file = path23.join(folder, BASE_META_FILE);
23663
23640
  try {
23664
23641
  const body = readFileNoFollow(folder, file)?.toString("utf-8");
23665
23642
  if (body === void 0 || body.startsWith(MIRROR_MARKER_PREFIX)) return;
23666
- const banner = `${MIRROR_MARKER_PREFIX} "${baseId2}". Edits are ignored; \`wayai push\` refuses it. Edit the linked preview instead.
23643
+ const banner = `${MIRROR_MARKER_PREFIX} "${baseId}". Edits are ignored; \`wayai push\` refuses it. Edit the linked preview instead.
23667
23644
  `;
23668
23645
  writeFileNoFollow(folder, file, Buffer.from(banner + body, "utf-8"));
23669
23646
  } catch {
@@ -23795,10 +23772,10 @@ function createPreview(client, originId, opts) {
23795
23772
  ...opts.analytics ? { analytics: opts.analytics } : {}
23796
23773
  });
23797
23774
  }
23798
- function deleteEntity(client, baseId2, kind, id) {
23775
+ function deleteEntity(client, baseId, kind, id) {
23799
23776
  return client.request(
23800
23777
  "DELETE",
23801
- `/v1/${pathSegment(baseId2, "base id")}/${ENTITY_DIRS[kind]}/${pathSegment(id, `${kind} id`)}`
23778
+ `/v1/${pathSegment(baseId, "base id")}/${ENTITY_DIRS[kind]}/${pathSegment(id, `${kind} id`)}`
23802
23779
  );
23803
23780
  }
23804
23781
  var init_api = __esm({
@@ -24011,40 +23988,40 @@ async function pullBase(gitRootOrNull, selector, args2) {
24011
23988
  const gitRoot = requireGitRoot(gitRootOrNull);
24012
23989
  const target = resolveBaseTarget(gitRoot, selector);
24013
23990
  const basesDir = resolveBasesDir(gitRoot);
24014
- const baseId2 = targetBaseId(target, selector);
24015
- if (!baseId2) {
23991
+ const baseId = targetBaseId(target, selector);
23992
+ if (!baseId) {
24016
23993
  throw expected(
24017
23994
  `Could not determine the base id for ${target.folder}. Pass the base id explicitly.`
24018
23995
  );
24019
23996
  }
24020
23997
  const client = await createDataClient();
24021
23998
  console.log("Fetching base configuration...");
24022
- const record = await getBaseRecord(client, baseId2);
23999
+ const record = await getBaseRecord(client, baseId);
24023
24000
  if (record.environment === "production") {
24024
- const folder = await writeProductionMirror(client, basesDir, record.id ?? baseId2, record);
24001
+ const folder = await writeProductionMirror(client, basesDir, record.id ?? baseId, record);
24025
24002
  console.log(`Production base mirrored (read-only) \u2192 ${folder}`);
24026
24003
  return;
24027
24004
  }
24028
- assertInScope("bases", baseId2);
24005
+ assertInScope("bases", baseId);
24029
24006
  if (target.exists && !autoConfirm) {
24030
24007
  const ok = await confirm(
24031
- `Overwrite local files in ${path25.relative(gitRoot, target.folder)} with the server config for "${sanitizeTerminalText(baseId2)}"?`
24008
+ `Overwrite local files in ${path25.relative(gitRoot, target.folder)} with the server config for "${sanitizeTerminalText(baseId)}"?`
24032
24009
  );
24033
24010
  if (!ok) {
24034
24011
  console.log("Cancelled.");
24035
24012
  return;
24036
24013
  }
24037
24014
  }
24038
- const config = await getConfig(client, baseId2);
24015
+ const config = await getConfig(client, baseId);
24039
24016
  const isFirstPull = !target.exists;
24040
- const delta = writeBaseFolder(target.folder, metaFromRecord(record, baseId2), config);
24017
+ const delta = writeBaseFolder(target.folder, metaFromRecord(record, baseId), config);
24041
24018
  console.log(`Base configuration written to ${target.folder}`);
24042
24019
  console.log(
24043
24020
  ` ${ENTITY_KINDS.map((kind) => `${(config[kind] ?? []).length} ${kind}`).join(", ")}`
24044
24021
  );
24045
24022
  if (!isFirstPull) printLocalFileChanges(delta);
24046
24023
  console.log(" Credential values are not written. Manage them with `wayai bases credentials`.");
24047
- seedScopeIfEmpty("bases", baseId2);
24024
+ seedScopeIfEmpty("bases", baseId);
24048
24025
  if (record.origin_base_id) {
24049
24026
  await mirrorLinkedProduction(client, basesDir, record.origin_base_id);
24050
24027
  }
@@ -24114,25 +24091,25 @@ async function pushBase(gitRootOrNull, selector, args2) {
24114
24091
  return;
24115
24092
  }
24116
24093
  const client = await createDataClient();
24117
- let baseId2 = meta.base_id;
24118
- if (!baseId2) {
24094
+ let baseId = meta.base_id;
24095
+ if (!baseId) {
24119
24096
  const created = await createDeclaredPreview(client, target, parsed, autoConfirm);
24120
24097
  if (!created) return;
24121
- baseId2 = created;
24098
+ baseId = created;
24122
24099
  } else {
24123
- const record = await getBaseRecord(client, baseId2);
24100
+ const record = await getBaseRecord(client, baseId);
24124
24101
  if (record.environment && record.environment !== "preview") {
24125
24102
  throw expected(
24126
- `"${sanitizeTerminalText(baseId2)}" is a ${sanitizeTerminalText(record.environment)} base. Push operates on previews \u2014 promote with \`wayai bases promote\`.`
24103
+ `"${sanitizeTerminalText(baseId)}" is a ${sanitizeTerminalText(record.environment)} base. Push operates on previews \u2014 promote with \`wayai bases promote\`.`
24127
24104
  );
24128
24105
  }
24129
- assertInScope("bases", baseId2);
24106
+ assertInScope("bases", baseId);
24130
24107
  }
24131
- const diff = await diffConfig(client, baseId2, config);
24108
+ const diff = await diffConfig(client, baseId, config);
24132
24109
  printLintWarnings(diff.warnings);
24133
24110
  if (isDiffEmpty(diff)) {
24134
- console.log(`No changes \u2014 preview "${sanitizeTerminalText(baseId2)}" already matches your files.`);
24135
- if (!dryRun) seedScopeIfEmpty("bases", baseId2);
24111
+ console.log(`No changes \u2014 preview "${sanitizeTerminalText(baseId)}" already matches your files.`);
24112
+ if (!dryRun) seedScopeIfEmpty("bases", baseId);
24136
24113
  return;
24137
24114
  }
24138
24115
  console.log(renderDiff(diff));
@@ -24142,13 +24119,13 @@ async function pushBase(gitRootOrNull, selector, args2) {
24142
24119
  }
24143
24120
  if (!autoConfirm) {
24144
24121
  const ok = await confirm(`
24145
- Apply these changes to preview "${sanitizeTerminalText(baseId2)}"?`);
24122
+ Apply these changes to preview "${sanitizeTerminalText(baseId)}"?`);
24146
24123
  if (!ok) {
24147
24124
  console.log("Cancelled.");
24148
24125
  return;
24149
24126
  }
24150
24127
  }
24151
- const result = await applyConfig(client, baseId2, config);
24128
+ const result = await applyConfig(client, baseId, config);
24152
24129
  const secretGroups = [
24153
24130
  ["trigger", result.new_trigger_secrets],
24154
24131
  ["inbound webhook", result.new_inbound_webhook_secrets]
@@ -24175,7 +24152,7 @@ ${RED}${removals.length} ${word} not in your files were left on the base. Re-run
24175
24152
  Delete ${removals.length} server ${word} not in your files? Record types cascade to their records, file types to their files.`
24176
24153
  )) {
24177
24154
  for (const removal of removals) {
24178
- await deleteEntity(client, baseId2, removal.kind, removal.id);
24155
+ await deleteEntity(client, baseId, removal.kind, removal.id);
24179
24156
  console.log(` - deleted ${removal.kind} ${sanitizeTerminalText(removal.id)}`);
24180
24157
  }
24181
24158
  } else {
@@ -24183,8 +24160,8 @@ Delete ${removals.length} server ${word} not in your files? Record types cascade
24183
24160
  }
24184
24161
  }
24185
24162
  console.log(`
24186
- Pushed to preview "${sanitizeTerminalText(baseId2)}".`);
24187
- seedScopeIfEmpty("bases", baseId2);
24163
+ Pushed to preview "${sanitizeTerminalText(baseId)}".`);
24164
+ seedScopeIfEmpty("bases", baseId);
24188
24165
  }
24189
24166
  var init_sync = __esm({
24190
24167
  "src/data/config-as-code/sync.ts"() {
@@ -35576,8 +35553,6 @@ function parse2(args2) {
35576
35553
  args: args2,
35577
35554
  options: {
35578
35555
  org: { type: "string" },
35579
- base: { type: "string" },
35580
- record: { type: "string" },
35581
35556
  to: { type: "string" },
35582
35557
  cursor: { type: "string" },
35583
35558
  limit: { type: "string" },
@@ -35633,24 +35608,7 @@ function entryLine(entry) {
35633
35608
  function print(values, data, lines) {
35634
35609
  console.log(values.json ? JSON.stringify(data, null, 2) : lines.join("\n"));
35635
35610
  }
35636
- async function customerRecord(sub, positionals, values) {
35637
- const [contactId, ...extra] = positionals;
35638
- if (contactId === void 0 || extra.length > 0) throw usageError3(`${sub} takes one <contact_id>.`);
35639
- if (!UUID_RE3.test(contactId)) throw usageError3(`Invalid <contact_id> ${JSON.stringify(contactId)}: expected a contact id (a UUID).`);
35640
- refuseFlags(sub, values, ["to", "cursor", "limit"]);
35641
- if (!values.base) throw usageError3(`${sub} needs --base <base_id>.`);
35642
- if (!isValidBaseId(values.base)) throw usageError3(`Invalid --base ${JSON.stringify(values.base)}: a base id is ${BASE_ID_RULE}.`);
35643
- if (sub === "link-customer" && !values.record) throw usageError3("link-customer needs --record <record_id>.");
35644
- if (sub === "unlink-customer" && values.record !== void 0) throw usageError3("--record applies only to link-customer.");
35645
- const orgId = resolveOrgId2(values.org);
35646
- await withApi(async (api) => {
35647
- const { customer } = sub === "link-customer" ? await api.linkContactCustomer(orgId, contactId, { base_id: values.base, record_id: values.record }) : await api.unlinkContactCustomer(orgId, contactId, values.base);
35648
- const where = `base ${text2(customer.base_id)} (${text2(customer.record_type)})`;
35649
- print(values, customer, [sub === "link-customer" ? `Contact ${customer.contact_id} is linked to customer record ${text2(customer.record_id)} in ${where}.` : `Contact ${customer.contact_id} is unlinked from customer record ${text2(customer.record_id)} in ${where}; the record keeps the contact id under ${customer.external_source}.`]);
35650
- });
35651
- }
35652
35611
  async function persons(sub, positionals, values) {
35653
- refuseFlags(sub, values, ["base", "record"]);
35654
35612
  const takesTo = sub === "link-person" || sub === "unlink-person";
35655
35613
  if (!takesTo) refuseFlags(sub, values, ["to"]);
35656
35614
  if (sub !== "denied-persons") refuseFlags(sub, values, ["cursor", "limit"]);
@@ -35728,9 +35686,7 @@ async function contactsCommand(args2) {
35728
35686
  const { values, positionals } = parse2(args2);
35729
35687
  const [sub, ...rest] = positionals;
35730
35688
  if (!SUBCOMMANDS2.includes(sub)) throw usageError3(`Unknown subcommand ${JSON.stringify(sub)}.`);
35731
- const command2 = sub;
35732
- if (command2 === "link-customer" || command2 === "unlink-customer") return customerRecord(command2, rest, values);
35733
- return persons(command2, rest, values);
35689
+ return persons(sub, rest, values);
35734
35690
  }
35735
35691
  var USAGE4, SUBCOMMANDS2, text2;
35736
35692
  var init_contacts = __esm({
@@ -35743,15 +35699,12 @@ var init_contacts = __esm({
35743
35699
  init_repo_config();
35744
35700
  init_terminal_output();
35745
35701
  init_token_store();
35746
- init_base_id();
35747
35702
  init_utils();
35748
35703
  init_contracts();
35749
35704
  USAGE4 = `
35750
- wayai contacts \u2014 a contact's customer record in a base, and the organization's person links and deny list
35705
+ wayai contacts \u2014 the organization's person links and deny list
35751
35706
 
35752
35707
  Usage:
35753
- wayai contacts link-customer <contact_id> --base <base_id> --record <record_id> [--org <org_id>] [--json]
35754
- wayai contacts unlink-customer <contact_id> --base <base_id> [--org <org_id>] [--json]
35755
35708
  wayai contacts lookup-person <person_id> [--org <org_id>] [--json]
35756
35709
  wayai contacts person-links <person_id> [--org <org_id>] [--json]
35757
35710
  wayai contacts link-person <person_id> --to <person_id|contact_id> [--org <org_id>] [--json]
@@ -35760,16 +35713,6 @@ Usage:
35760
35713
  wayai contacts deny-person <person_id|contact_id> [--org <org_id>] [--json]
35761
35714
  wayai contacts undeny-person <person_id|contact_id> [--org <org_id>] [--json]
35762
35715
 
35763
- link-customer Make the record the contact's customer record: an eval declaring the contact
35764
- then reaches that customer through a customer-scoped toolset (an agent's and
35765
- a customer page's calls name no customer). The record is one of the base's
35766
- customer record type (x-customer-scope role root), holding no external key
35767
- or the contact id under another source. A record keyed under another
35768
- external_id is refused: re-keying it would orphan its owned records.
35769
- unlink-customer Unlink the contact's customer record in the base. The record keeps the
35770
- contact id under the source wayai_contact_unlinked, so its owned records stay
35771
- its own, and link-customer on the same record links it again.
35772
-
35773
35716
  lookup-person Whom a person id (prs_\u2026) names: a hub of the organization where a
35774
35717
  conversation carries it, and that hub's name and email for the person. A
35775
35718
  person id no conversation carries is unknown.
@@ -35790,8 +35733,6 @@ admin. These commands need a browser sign-in (\`wayai login\`): an API token
35790
35733
  (\`wayai login --token\`, or WAYAI_TOKEN) is refused.
35791
35734
  `.trim();
35792
35735
  SUBCOMMANDS2 = [
35793
- "link-customer",
35794
- "unlink-customer",
35795
35736
  "lookup-person",
35796
35737
  "person-links",
35797
35738
  "link-person",
@@ -37074,14 +37015,14 @@ var init_remote = __esm({
37074
37015
  function refreshPreviewCommand(orgId, base) {
37075
37016
  return `wayai knowledge refresh-preview --org ${orgId} --base ${sanitizeTerminalText(base)}`;
37076
37017
  }
37077
- async function resolveBases(kb, baseId2, orgId) {
37078
- const base = await kb.getBase(baseId2);
37079
- if (!base || base.deleted) throw expected(`Base "${sanitizeTerminalText(baseId2)}" not found in this organization.`);
37018
+ async function resolveBases(kb, baseId, orgId) {
37019
+ const base = await kb.getBase(baseId);
37020
+ if (!base || base.deleted) throw expected(`Base "${sanitizeTerminalText(baseId)}" not found in this organization.`);
37080
37021
  if (base.environment === "preview") {
37081
37022
  const origin = base.origin_base_id ? await kb.getBase(base.origin_base_id) : null;
37082
37023
  if (!origin || origin.deleted || origin.environment !== "production") {
37083
37024
  throw expected(
37084
- `Base "${sanitizeTerminalText(baseId2)}" is a preview with no production origin, so it has no production files to copy. Name the production knowledge base, or a preview created from it.`
37025
+ `Base "${sanitizeTerminalText(baseId)}" is a preview with no production origin, so it has no production files to copy. Name the production knowledge base, or a preview created from it.`
37085
37026
  );
37086
37027
  }
37087
37028
  return { production: origin.id, preview: base.id };
@@ -37094,7 +37035,7 @@ async function resolveBases(kb, baseId2, orgId) {
37094
37035
  }
37095
37036
  if (previews.length !== 1) {
37096
37037
  throw expected(
37097
- previews.length === 0 ? `Base "${sanitizeTerminalText(baseId2)}" has no preview. Create one with \`wayai bases create-preview ${sanitizeTerminalText(baseId2)} --name <name>\`, then copy production's files into it with \`${refreshPreviewCommand(orgId, baseId2)}\`.` : `Base "${sanitizeTerminalText(baseId2)}" has ${previews.length} previews (${previews.map(sanitizeTerminalText).join(", ")}). Pass the one to use as --base.`
37038
+ previews.length === 0 ? `Base "${sanitizeTerminalText(baseId)}" has no preview. Create one with \`wayai bases create-preview ${sanitizeTerminalText(baseId)} --name <name>\`, then copy production's files into it with \`${refreshPreviewCommand(orgId, baseId)}\`.` : `Base "${sanitizeTerminalText(baseId)}" has ${previews.length} previews (${previews.map(sanitizeTerminalText).join(", ")}). Pass the one to use as --base.`
37098
37039
  );
37099
37040
  }
37100
37041
  return { production: base.id, preview: previews[0] };
@@ -41119,28 +41060,28 @@ function buildBasesCommand() {
41119
41060
  bases.command("use <base>").description(
41120
41061
  "Deprecated alias of `wayai use bases/<id>` \u2014 scope this worktree to a base"
41121
41062
  ).action(async function(selector) {
41122
- const baseId2 = resolveBaseSelectorToId(findGitRoot(), selector);
41063
+ const baseId = resolveBaseSelectorToId(findGitRoot(), selector);
41123
41064
  const previous = readScope().bases;
41124
- const changed = previous.length !== 1 || previous[0] !== baseId2;
41065
+ const changed = previous.length !== 1 || previous[0] !== baseId;
41125
41066
  if (changed) {
41126
41067
  try {
41127
- setScopeAxis("bases", [baseId2]);
41068
+ setScopeAxis("bases", [baseId]);
41128
41069
  } catch (err) {
41129
41070
  throw expected(err instanceof Error ? err.message : String(err));
41130
41071
  }
41131
41072
  }
41132
41073
  if (outputFormat(this) === "json") {
41133
41074
  printOutput(
41134
- { base_id: baseId2, previous_base_id: previous[0] ?? null, changed },
41075
+ { base_id: baseId, previous_base_id: previous[0] ?? null, changed },
41135
41076
  "json"
41136
41077
  );
41137
41078
  return;
41138
41079
  }
41139
41080
  if (!changed) {
41140
- console.log(`Worktree already bound to base ${baseId2}.`);
41081
+ console.log(`Worktree already bound to base ${baseId}.`);
41141
41082
  } else {
41142
41083
  console.log(
41143
- previous.length > 0 ? `Worktree rebound: ${previous.join(", ")} -> ${baseId2}.` : `Worktree bound to base ${baseId2}.`
41084
+ previous.length > 0 ? `Worktree rebound: ${previous.join(", ")} -> ${baseId}.` : `Worktree bound to base ${baseId}.`
41144
41085
  );
41145
41086
  }
41146
41087
  });
@@ -42860,7 +42801,7 @@ Commands:
42860
42801
  sync-mcp Re-discover an MCP connection's tools (refresh stale schemas)
42861
42802
  list List organizations and hubs
42862
42803
  communities An organization's communities: list, join link (get/rotate/off), stats, access list (list/add/remove) \u2014 \`wayai communities --help\`
42863
- contacts A contact's customer record in a base; person links, the deny list, person lookup (browser sign-in only) \u2014 \`wayai contacts --help\`
42804
+ contacts Person links, the deny list, person lookup (browser sign-in only) \u2014 \`wayai contacts --help\`
42864
42805
  dimensions An organization's access dimensions and their values: list, create, relabel, add/retire values \u2014 \`wayai dimensions --help\`
42865
42806
  access explain The access set a hub agent's toolset calls send for a person, and which layer removed each value \u2014 \`wayai access --help\`
42866
42807
  knowledge refresh-preview Make the knowledge base's preview hold its production base's files \u2014 \`wayai knowledge --help\`