@wayai/cli 0.3.350 → 0.3.351

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
@@ -17840,7 +17840,7 @@ var init_chunk_OMPT4ZHR = __esm({
17840
17840
  }
17841
17841
  });
17842
17842
 
17843
- // ../../packages/core/dist/chunk-Q5SZRRLP.js
17843
+ // ../../packages/core/dist/chunk-OG7KTWHD.js
17844
17844
  function refineScopedTarget(data, ctx) {
17845
17845
  if (data.scope === "org") {
17846
17846
  if (!data.org_id) {
@@ -17866,8 +17866,8 @@ function refineScopedTarget(data, ctx) {
17866
17866
  }
17867
17867
  }
17868
17868
  var adminOrgIdParam, adminOrgAdminIdParam, adminUserIdParam, PRICING_PLAN_ID_RE, adminPlanIdParam, adminOrganizationsQuery, adminUserSearchQuery, kanbanSlugMigrationQuery, adjustQuotaBody, updatePlanBody, addAdminUserBody, MAX_VOICE_CALL_MINUTE_OPS, voiceCallMinuteOps, AUTOMATION_GATE_EVALUATIONS_PER_OPERATION_BOUND, automationGateEvaluationsPerOperation, AUTOMATION_RUN_RETENTION_DAYS_MAX, automationRunRetentionDays, turnDeadlineSeconds, casesLimit, updatePlatformConfigBody, updateFreeOrgLimitBody, adminScopedTargetShape, adminScopedTargetBody, adminDryRunByDefaultTargetBody, WAYAI_HOST_TOKEN_TARGET_KINDS, WAYAI_HOST_TOKEN_MAX_TARGETS, adminClearWayaiHostTokensBody, BRANCHING_ORPHAN_ENTITY_TYPES, BRANCHING_ORPHAN_MAX_TARGETS, adminRepairBranchingOrphansBody, adminRepairLegacyOrgGrantsBody, adminRepairCredentialServicesBody, adminRepairCompedPlansBody, updatePricingPlanBody, dataExplorerSearchQuery, dataExplorerOrgIdParam, dataExplorerHubIdParam, dataExplorerConvIdParam, dataExplorerDoInstancesQuery, dataExplorerNsIdParam, dataExplorerKvKeysBody, dataExplorerKvKeyBody, uuidOrHexId, dataExplorerDeleteOrgParam, dataExplorerDeleteHubParam, dataExplorerDeleteConvParam, dataExplorerDeleteUserParam, dataExplorerDeleteQuery, dataExplorerKvDeleteBody, pitrDoNamespace, pitrBookmarkParam, pitrRestoreBody, healthSamplingTriggerBody, DEBUG_DO_HEX_PREFIX, debugDoEntityId, debugTableName, dataExplorerDebugTablesParam, dataExplorerDebugRowsParam, dataExplorerDebugRowsQuery, dataExplorerDebugAnalyticsTable, debugUuid, dataExplorerDebugAnalyticsRowsParam, dataExplorerDebugAnalyticsRowsQuery, dataExplorerDebugCountsDoType, dataExplorerDebugCountsParam, debugHubConvParam, debugMessageIdQuery;
17869
- var init_chunk_Q5SZRRLP = __esm({
17870
- "../../packages/core/dist/chunk-Q5SZRRLP.js"() {
17869
+ var init_chunk_OG7KTWHD = __esm({
17870
+ "../../packages/core/dist/chunk-OG7KTWHD.js"() {
17871
17871
  "use strict";
17872
17872
  init_chunk_FECLIZTY();
17873
17873
  init_chunk_BFG4ZWR4();
@@ -18045,6 +18045,13 @@ var init_chunk_Q5SZRRLP = __esm({
18045
18045
  * it as JSON. An id no connector has matches nothing, so it leaves that connector off.
18046
18046
  */
18047
18047
  vault_connector_ids: external_exports.array(uuidSchema).max(200).optional(),
18048
+ /**
18049
+ * The organizations that may store a base credential (wayai#6142, owner decisions 8 and 27): org ids, replacing the
18050
+ * whole list; empty, the default, admits none. Read only by a base credential's create and rotation, after base
18051
+ * credentials' vault gate (`apps/backend/src/durable-objects/platform-do/base-credential-orgs.ts`); a credential
18052
+ * already stored keeps working when its org leaves the list. The route stores it as JSON.
18053
+ */
18054
+ base_credential_org_ids: external_exports.array(uuidSchema).max(200).optional(),
18048
18055
  /**
18049
18056
  * The mobile app version policy (`MOBILE_VERSION_POLICY_COLUMNS`), per platform: an install
18050
18057
  * below the minimum is blocked until it updates from the store; one below the recommended
@@ -18514,7 +18521,7 @@ var init_contracts = __esm({
18514
18521
  init_chunk_4LXDRTO4();
18515
18522
  init_chunk_5PKKFSSF();
18516
18523
  init_chunk_NVKU5PPQ();
18517
- init_chunk_Q5SZRRLP();
18524
+ init_chunk_OG7KTWHD();
18518
18525
  init_chunk_FECLIZTY();
18519
18526
  init_chunk_BFG4ZWR4();
18520
18527
  init_chunk_UY32MQHG();
@@ -19996,6 +20003,9 @@ var init_utils = __esm({
19996
20003
  ["admin vault-gate status", { positionals: 0 }],
19997
20004
  ["admin vault-gate add", { positionals: 1 }],
19998
20005
  ["admin vault-gate remove", { positionals: 1 }],
20006
+ ["admin base-credential-orgs status", { positionals: 0 }],
20007
+ ["admin base-credential-orgs add", { positionals: 1 }],
20008
+ ["admin base-credential-orgs remove", { positionals: 1 }],
19999
20009
  ["admin voice-calls enable", { positionals: 0 }],
20000
20010
  ["admin voice-calls disable", { positionals: 0 }],
20001
20011
  ["admin voice-calls status", { positionals: 0 }],
@@ -27024,7 +27034,8 @@ async function assertStorageOn(client, path55, body) {
27024
27034
  await client.request("POST", path55, body);
27025
27035
  } catch (err) {
27026
27036
  if (refusalReason(err) === VALUE_MISSING) return;
27027
- if (refusalReason(err) === STORAGE_OFF) {
27037
+ const reason3 = refusalReason(err);
27038
+ if (reason3 === STORAGE_OFF || reason3 === ORG_NOT_ADMITTED) {
27028
27039
  throw expected(`${refusalMessage(err)} Nothing was read or stored.`);
27029
27040
  }
27030
27041
  throw err;
@@ -27206,7 +27217,7 @@ function buildBasesCredentialsCommand() {
27206
27217
  });
27207
27218
  return credentials;
27208
27219
  }
27209
- var STORAGE_OFF, VALUE_MISSING, RULE_NOT_COVERING, RULE_REFUSED, CREDENTIAL_REF;
27220
+ var STORAGE_OFF, ORG_NOT_ADMITTED, VALUE_MISSING, RULE_NOT_COVERING, RULE_REFUSED, CREDENTIAL_REF;
27210
27221
  var init_credentials = __esm({
27211
27222
  "src/data/commands/credentials.ts"() {
27212
27223
  "use strict";
@@ -27218,6 +27229,7 @@ var init_credentials = __esm({
27218
27229
  init_expected();
27219
27230
  init_terminal_output();
27220
27231
  STORAGE_OFF = "secret_storage_unavailable";
27232
+ ORG_NOT_ADMITTED = "org_not_admitted";
27221
27233
  VALUE_MISSING = "credential_value_not_storable";
27222
27234
  RULE_NOT_COVERING = "credential_rule_not_covering";
27223
27235
  RULE_REFUSED = "credential_rule_refused";
@@ -45959,6 +45971,26 @@ async function adminCommand(args2) {
45959
45971
  process.exit(1);
45960
45972
  }
45961
45973
  }
45974
+ if (group === "base-credential-orgs") {
45975
+ if (!sub) {
45976
+ printHelp2();
45977
+ process.exit(1);
45978
+ }
45979
+ switch (sub) {
45980
+ case "status":
45981
+ await runBaseCredentialOrgsStatus(positional, flagArgs);
45982
+ return;
45983
+ case "add":
45984
+ await runBaseCredentialOrgsChange("add", positional, flagArgs);
45985
+ return;
45986
+ case "remove":
45987
+ await runBaseCredentialOrgsChange("remove", positional, flagArgs);
45988
+ return;
45989
+ default:
45990
+ printHelp2();
45991
+ process.exit(1);
45992
+ }
45993
+ }
45962
45994
  if (group === "voice-calls") {
45963
45995
  if (!sub) {
45964
45996
  printHelp2();
@@ -47197,8 +47229,8 @@ function describeVaultGateEntry(connectorId) {
47197
47229
  function describeVaultGateList(ids) {
47198
47230
  return ids.length === 0 ? "(none listed)" : ids.map(describeVaultGateEntry).join(", ");
47199
47231
  }
47200
- function readVaultGateList(data) {
47201
- const raw = data.vault_connector_ids;
47232
+ function readUuidListColumn(data, column, noun) {
47233
+ const raw = data[column];
47202
47234
  if (raw === void 0 || raw === null) return [];
47203
47235
  let parsed;
47204
47236
  try {
@@ -47207,11 +47239,14 @@ function readVaultGateList(data) {
47207
47239
  parsed = void 0;
47208
47240
  }
47209
47241
  if (!Array.isArray(parsed) || !parsed.every((id) => uuidSchema.safeParse(id).success)) {
47210
- console.error(`vault_connector_ids cannot be read as a list of connector ids: ${JSON.stringify(raw)}`);
47242
+ console.error(`${column} cannot be read as a list of ${noun}: ${JSON.stringify(raw)}`);
47211
47243
  process.exit(1);
47212
47244
  }
47213
47245
  return parsed;
47214
47246
  }
47247
+ function readVaultGateList(data) {
47248
+ return readUuidListColumn(data, "vault_connector_ids", "connector ids");
47249
+ }
47215
47250
  function resolveVaultGateConnector(arg, usage4) {
47216
47251
  const wanted = (arg ?? "").trim().toLowerCase();
47217
47252
  const ids = VAULT_GATE_CONNECTORS.get(wanted) ?? (vaultGateConnectorName(wanted) ? [wanted] : null);
@@ -47298,6 +47333,92 @@ async function runVaultGateChange(change, positional, flagArgs) {
47298
47333
  console.log(`After: ${describeVaultGateList(after)}`);
47299
47334
  console.log(PLATFORM_CONFIG_PROPAGATION_NOTE);
47300
47335
  }
47336
+ function readBaseCredentialOrgList(data) {
47337
+ return readUuidListColumn(data, "base_credential_org_ids", "org ids");
47338
+ }
47339
+ function describeBaseCredentialOrgList(ids) {
47340
+ return ids.length === 0 ? "(none listed: no org may store a base credential)" : ids.join(", ");
47341
+ }
47342
+ async function readBaseCredentialOrgConfig(client) {
47343
+ try {
47344
+ return readBaseCredentialOrgList((await client.adminGetConfig()).data);
47345
+ } catch (err) {
47346
+ exitOnApiError(err);
47347
+ throw err;
47348
+ }
47349
+ }
47350
+ async function runBaseCredentialOrgsStatus(positional, flagArgs) {
47351
+ const usage4 = "wayai admin base-credential-orgs status [--json]";
47352
+ if (positional.length > 0) {
47353
+ console.error(usage4);
47354
+ process.exit(1);
47355
+ }
47356
+ const { jsonOutput } = parseBooleanFlags(flagArgs, usage4, ["--json"]);
47357
+ const { config, accessToken } = await requireAuth();
47358
+ const client = new ApiClient({ apiUrl: config.api_url, accessToken });
47359
+ const ids = await readBaseCredentialOrgConfig(client);
47360
+ if (jsonOutput) {
47361
+ console.log(JSON.stringify({ base_credential_org_ids: ids }, null, 2));
47362
+ return;
47363
+ }
47364
+ console.log(`base_credential_org_ids (platform): ${describeBaseCredentialOrgList(ids)}`);
47365
+ }
47366
+ async function runBaseCredentialOrgsChange(change, positional, flagArgs) {
47367
+ const usage4 = `wayai admin base-credential-orgs ${change} <org_id> [--yes] [--json]`;
47368
+ const { yes, jsonOutput } = parseBooleanFlags(flagArgs, usage4, ["--yes", "--json"]);
47369
+ if (positional.length !== 1) {
47370
+ console.error("Name one org id.");
47371
+ console.error(usage4);
47372
+ process.exit(1);
47373
+ }
47374
+ const orgId = positional[0].trim().toLowerCase();
47375
+ if (!uuidSchema.safeParse(orgId).success) {
47376
+ console.error(`Refused: "${positional[0]}" is not an org id (a UUID).`);
47377
+ console.error(usage4);
47378
+ process.exit(1);
47379
+ }
47380
+ const { config, accessToken } = await requireAuth();
47381
+ const client = new ApiClient({ apiUrl: config.api_url, accessToken });
47382
+ const before = await readBaseCredentialOrgConfig(client);
47383
+ const listed3 = before.some((id) => id.toLowerCase() === orgId);
47384
+ if (listed3 === (change === "add")) {
47385
+ if (jsonOutput) {
47386
+ console.log(JSON.stringify({ before, after: before, changed: false }, null, 2));
47387
+ return;
47388
+ }
47389
+ console.log(`Before: ${describeBaseCredentialOrgList(before)}`);
47390
+ console.log(`${orgId} is ${change === "add" ? "already" : "not"} listed; nothing was written.`);
47391
+ return;
47392
+ }
47393
+ const next = change === "add" ? [...before, orgId] : before.filter((id) => id.toLowerCase() !== orgId);
47394
+ if (!jsonOutput) console.log(`Before: ${describeBaseCredentialOrgList(before)}`);
47395
+ if (!yes && !jsonOutput) {
47396
+ console.log(change === "add" ? `About to add ${orgId}: its bases may store base credentials in the credentials vault while base credentials' vault gate is open.` : `About to remove ${orgId}: its bases can no longer store or rotate a base credential; the credentials they stored keep working and can be deleted.`);
47397
+ const ok = await confirm("Proceed?");
47398
+ if (!ok) {
47399
+ console.log("Aborted.");
47400
+ return;
47401
+ }
47402
+ }
47403
+ let after;
47404
+ try {
47405
+ after = readBaseCredentialOrgList((await client.adminUpdateConfig({ base_credential_org_ids: next })).data);
47406
+ } catch (err) {
47407
+ exitOnApiError(err);
47408
+ throw err;
47409
+ }
47410
+ const stored = after.some((id) => id.toLowerCase() === orgId) === (change === "add");
47411
+ if (jsonOutput) {
47412
+ console.log(JSON.stringify({ before, after, changed: stored }, null, 2));
47413
+ } else {
47414
+ console.log(`After: ${describeBaseCredentialOrgList(after)}`);
47415
+ }
47416
+ if (!stored) {
47417
+ console.error(`The platform config answered without the change: ${orgId} was not ${change === "add" ? "added" : "removed"}. A deploy may be in progress; run the command again in a few minutes.`);
47418
+ process.exit(1);
47419
+ }
47420
+ if (!jsonOutput) console.log(PLATFORM_CONFIG_PROPAGATION_NOTE);
47421
+ }
47301
47422
  function conflictReasonOf(err) {
47302
47423
  try {
47303
47424
  const reason3 = JSON.parse(err.body).details?.reason;
@@ -47957,6 +48078,12 @@ Usage:
47957
48078
  wayai admin vault-gate remove <connector> [--yes] [--json]
47958
48079
  Stop listing it: its new credentials no longer go to the vault (on production only Instagram's and base credentials' gates read the list)
47959
48080
 
48081
+ wayai admin base-credential-orgs status [--json] Print the orgs that may store a base credential (base_credential_org_ids)
48082
+ wayai admin base-credential-orgs add <org_id> [--yes] [--json]
48083
+ Admit an org: its bases may store base credentials while base credentials' vault gate is open; prints before and after, confirms unless --yes
48084
+ wayai admin base-credential-orgs remove <org_id> [--yes] [--json]
48085
+ Stop admitting it: no new value or rotation; what it stored keeps working and can be deleted
48086
+
47960
48087
  Sources:
47961
48088
  do Live DO SQLite (existing conversation, hub config, etc.).
47962
48089
  analytics ClickHouse projections (conversation, message, schedule_event).
@@ -48082,6 +48209,12 @@ Sources:
48082
48209
  whichever way the gate is set. Only connectors the vault holds anything of are
48083
48210
  taken: ${[...VAULT_GATE_CONNECTORS.keys()].join(", ")}, and GPT-Live (openai) by its
48084
48211
  catalog id only. Changes land within about 60 s.
48212
+ base-credential-orgs
48213
+ The orgs whose bases may store a base credential: the PLATFORM-wide
48214
+ base_credential_org_ids list, read after base credentials' vault gate
48215
+ (vault-gate add base_source) by every create and rotation, on every environment.
48216
+ Empty, the default, admits none. An org removed keeps the credentials it stored:
48217
+ they still send and can be deleted. Changes land within about 60 s.
48085
48218
 
48086
48219
  Types (do): ${VALID_TYPES.join(" | ")}
48087
48220
  Tables (analytics): ${VALID_ANALYTICS_TABLES.join(" | ")}