@wayai/cli 0.3.279 → 0.3.280

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
@@ -6207,7 +6207,7 @@ var init_chunk_5XEJSR22 = __esm({
6207
6207
  }
6208
6208
  });
6209
6209
 
6210
- // ../../packages/core/dist/chunk-D7SSWNL3.js
6210
+ // ../../packages/core/dist/chunk-3VCB2RTC.js
6211
6211
  function matchPath(pattern, path45) {
6212
6212
  const pathSegments2 = path45.replace(/\/$/, "").split("/");
6213
6213
  const isPrefix = pattern.endsWith("/*");
@@ -6236,8 +6236,8 @@ function getEndpointConfig(path45) {
6236
6236
  return { tier: "STANDARD" };
6237
6237
  }
6238
6238
  var ENDPOINT_CONFIGS, EXCLUDED_PATHS;
6239
- var init_chunk_D7SSWNL3 = __esm({
6240
- "../../packages/core/dist/chunk-D7SSWNL3.js"() {
6239
+ var init_chunk_3VCB2RTC = __esm({
6240
+ "../../packages/core/dist/chunk-3VCB2RTC.js"() {
6241
6241
  "use strict";
6242
6242
  init_chunk_5XEJSR22();
6243
6243
  ENDPOINT_CONFIGS = {
@@ -6559,6 +6559,7 @@ var init_chunk_D7SSWNL3 = __esm({
6559
6559
  // Knowledge-blob repair (#5142 step 5 C1) — deletes R2 objects across every hub of a scope, so it
6560
6560
  // takes the same strict, fail-closed budget as the other hub repairs. Exact path, for the same reason.
6561
6561
  "/api/admin/hubs/repair-knowledge-blobs": { tier: "STRICT", userLimit: 10, userWindow: 3600, failClosed: true },
6562
+ "/api/admin/hubs/repair-credential-links": { tier: "STRICT", userLimit: 10, userWindow: 3600, failClosed: true },
6562
6563
  // CI/GitOps endpoints - standard with user limits. 500 because `wayai push` makes four requests
6563
6564
  // (pull, diff, push, pull) and a GitOps job may push every hub at once with one token; when
6564
6565
  // each path held its own 100, that ran to 100 hubs a minute.
@@ -6715,7 +6716,7 @@ var init_chunk_D7SSWNL3 = __esm({
6715
6716
  }
6716
6717
  });
6717
6718
 
6718
- // ../../packages/core/dist/chunk-7QJBCQR3.js
6719
+ // ../../packages/core/dist/chunk-S447DV3E.js
6719
6720
  function fileSnapshotChanged(run) {
6720
6721
  return run.written + run.removed > 0;
6721
6722
  }
@@ -6756,10 +6757,10 @@ async function sendWithRetry(opts, cursor) {
6756
6757
  }
6757
6758
  }
6758
6759
  var rekorFileSnapshotAnswerSchema, FILE_SNAPSHOT_MAX_PAGES, FILE_SNAPSHOT_CONFLICT_ATTEMPTS, FILE_SNAPSHOT_PAGE_SPACING_MS, FILE_SNAPSHOT_CONFLICT_STATUS;
6759
- var init_chunk_7QJBCQR3 = __esm({
6760
- "../../packages/core/dist/chunk-7QJBCQR3.js"() {
6760
+ var init_chunk_S447DV3E = __esm({
6761
+ "../../packages/core/dist/chunk-S447DV3E.js"() {
6761
6762
  "use strict";
6762
- init_chunk_D7SSWNL3();
6763
+ init_chunk_3VCB2RTC();
6763
6764
  init_chunk_5XEJSR22();
6764
6765
  init_zod();
6765
6766
  rekorFileSnapshotAnswerSchema = external_exports.object({
@@ -15273,7 +15274,7 @@ var init_chunk_OMPT4ZHR = __esm({
15273
15274
  }
15274
15275
  });
15275
15276
 
15276
- // ../../packages/core/dist/chunk-6AIZYKDD.js
15277
+ // ../../packages/core/dist/chunk-M44PP7YM.js
15277
15278
  function refineScopedTarget(data, ctx) {
15278
15279
  if (data.scope === "org") {
15279
15280
  if (!data.org_id) {
@@ -15298,9 +15299,9 @@ function refineScopedTarget(data, ctx) {
15298
15299
  }
15299
15300
  }
15300
15301
  }
15301
- 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, updatePlatformConfigBody, updateFreeOrgLimitBody, adminScopedTargetShape, adminScopedTargetBody, adminRepairKnowledgeBlobsBody, BRANCHING_ORPHAN_ENTITY_TYPES, BRANCHING_ORPHAN_MAX_TARGETS, adminRepairBranchingOrphansBody, adminRepairLegacyOrgGrantsBody, 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;
15302
- var init_chunk_6AIZYKDD = __esm({
15303
- "../../packages/core/dist/chunk-6AIZYKDD.js"() {
15302
+ 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, updatePlatformConfigBody, updateFreeOrgLimitBody, adminScopedTargetShape, adminScopedTargetBody, adminDryRunByDefaultTargetBody, BRANCHING_ORPHAN_ENTITY_TYPES, BRANCHING_ORPHAN_MAX_TARGETS, adminRepairBranchingOrphansBody, adminRepairLegacyOrgGrantsBody, 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;
15303
+ var init_chunk_M44PP7YM = __esm({
15304
+ "../../packages/core/dist/chunk-M44PP7YM.js"() {
15304
15305
  "use strict";
15305
15306
  init_chunk_FECLIZTY();
15306
15307
  init_chunk_BFG4ZWR4();
@@ -15467,7 +15468,7 @@ var init_chunk_6AIZYKDD = __esm({
15467
15468
  dry_run: external_exports.boolean().optional().default(false)
15468
15469
  });
15469
15470
  adminScopedTargetBody = adminScopedTargetShape.strict().superRefine(refineScopedTarget);
15470
- adminRepairKnowledgeBlobsBody = adminScopedTargetShape.extend({ dry_run: external_exports.boolean().optional().default(true) }).strict().superRefine(refineScopedTarget);
15471
+ adminDryRunByDefaultTargetBody = adminScopedTargetShape.extend({ dry_run: external_exports.boolean().optional().default(true) }).strict().superRefine(refineScopedTarget);
15471
15472
  BRANCHING_ORPHAN_ENTITY_TYPES = [
15472
15473
  "agent",
15473
15474
  "agent_parameter",
@@ -16350,7 +16351,7 @@ var init_contracts = __esm({
16350
16351
  init_chunk_ZC6YGHNX();
16351
16352
  init_chunk_HIGKBEPF();
16352
16353
  init_chunk_5DGHIY7L();
16353
- init_chunk_7QJBCQR3();
16354
+ init_chunk_S447DV3E();
16354
16355
  init_chunk_IPDOHAZ5();
16355
16356
  init_chunk_GPM7PE44();
16356
16357
  init_chunk_VEERWOZ6();
@@ -16394,7 +16395,7 @@ var init_contracts = __esm({
16394
16395
  init_chunk_4LXDRTO4();
16395
16396
  init_chunk_JDJ4EUOL();
16396
16397
  init_chunk_NVKU5PPQ();
16397
- init_chunk_6AIZYKDD();
16398
+ init_chunk_M44PP7YM();
16398
16399
  init_chunk_FECLIZTY();
16399
16400
  init_chunk_BFG4ZWR4();
16400
16401
  init_chunk_C3V6PEQ7();
@@ -16411,7 +16412,7 @@ var init_contracts = __esm({
16411
16412
  init_chunk_LYHV5FZW();
16412
16413
  init_chunk_IG6QBZMA();
16413
16414
  init_chunk_OMPT4ZHR();
16414
- init_chunk_D7SSWNL3();
16415
+ init_chunk_3VCB2RTC();
16415
16416
  init_chunk_SOJMWM63();
16416
16417
  init_chunk_WTOA3ANF();
16417
16418
  init_chunk_5XEJSR22();
@@ -16572,7 +16573,7 @@ var UUID_RE2, WAYAI_WORKSPACE_LAYOUT;
16572
16573
  var init_dist = __esm({
16573
16574
  "../../packages/core/dist/index.js"() {
16574
16575
  "use strict";
16575
- init_chunk_D7SSWNL3();
16576
+ init_chunk_3VCB2RTC();
16576
16577
  init_chunk_SOJMWM63();
16577
16578
  init_chunk_WTOA3ANF();
16578
16579
  init_chunk_5XEJSR22();
@@ -17813,6 +17814,7 @@ var init_utils = __esm({
17813
17814
  ["admin skill install", { positionals: 1 }],
17814
17815
  ["admin hubs repair-team-orphans", { positionals: 0, values: ["--org", "--hub"], dryRun: true }],
17815
17816
  ["admin hubs repair-branching-orphans", { positionals: 0, values: ["--org", "--hub", "--id"], dryRun: true }],
17817
+ ["admin hubs repair-credential-links", { positionals: 0, values: ["--org", "--hub"], dryRun: true }],
17816
17818
  ["admin hubs repair-knowledge-blobs", { positionals: 0, values: ["--org", "--hub"], dryRun: true }],
17817
17819
  ["admin orgs repair-legacy-grants", { positionals: 0, values: ["--org"], dryRun: true }],
17818
17820
  ["admin harness mass-destroy", { positionals: 0, values: ["--org", "--hub"], dryRun: true }],
@@ -18329,6 +18331,10 @@ var init_api_client = __esm({
18329
18331
  async adminRepairKnowledgeBlobs(body) {
18330
18332
  return this.request("POST", "/api/admin/hubs/repair-knowledge-blobs", body);
18331
18333
  }
18334
+ // Used by `wayai admin hubs repair-credential-links` (platform-admin gated).
18335
+ async adminRepairCredentialLinks(body) {
18336
+ return this.request("POST", "/api/admin/hubs/repair-credential-links", body);
18337
+ }
18332
18338
  // Report twin candidates, or delete named production rows no preview maps (#4577).
18333
18339
  // Used by `wayai admin hubs repair-branching-orphans` (platform-admin gated).
18334
18340
  async adminRepairBranchingOrphans(body) {
@@ -37639,6 +37645,9 @@ async function adminCommand(args2) {
37639
37645
  case "repair-branching-orphans":
37640
37646
  await runRepairBranchingOrphans(flagArgs);
37641
37647
  return;
37648
+ case "repair-credential-links":
37649
+ await runRepairCredentialLinks(flagArgs);
37650
+ return;
37642
37651
  case "repair-knowledge-blobs":
37643
37652
  await runRepairKnowledgeBlobs(flagArgs);
37644
37653
  return;
@@ -38151,18 +38160,19 @@ async function runRepairTeamOrphans(flagArgs) {
38151
38160
  console.log(`${d.hub_id} | ${d.dangling_team_ids.join(",")} | ${d.team_users_removed}`);
38152
38161
  }
38153
38162
  }
38154
- async function runRepairKnowledgeBlobs(flagArgs) {
38155
- const USAGE8 = "wayai admin hubs repair-knowledge-blobs --all | --org <org_id> | --hub <hub_id> [--apply] [--yes] [--json]";
38163
+ function parseApplyTargetFlags(flagArgs, usage3) {
38156
38164
  const apply = flagArgs.includes("--apply");
38157
- const { body, targetLabel, dryRun, yes, jsonOutput } = parseScopedTargetFlags(
38158
- flagArgs.filter((arg) => arg !== "--apply"),
38159
- USAGE8
38160
- );
38161
- if (apply && dryRun) {
38165
+ const target = parseScopedTargetFlags(flagArgs.filter((arg) => arg !== "--apply"), usage3);
38166
+ if (apply && target.dryRun) {
38162
38167
  console.error("--apply and --dry-run contradict each other: a run is a dry run unless --apply is given.");
38163
- console.error(USAGE8);
38168
+ console.error(usage3);
38164
38169
  process.exit(1);
38165
38170
  }
38171
+ return { ...target, apply };
38172
+ }
38173
+ async function runRepairKnowledgeBlobs(flagArgs) {
38174
+ const USAGE8 = "wayai admin hubs repair-knowledge-blobs --all | --org <org_id> | --hub <hub_id> [--apply] [--yes] [--json]";
38175
+ const { body, targetLabel, apply, yes, jsonOutput } = parseApplyTargetFlags(flagArgs, USAGE8);
38166
38176
  const input = { ...body, dry_run: !apply };
38167
38177
  if (apply && !yes && !jsonOutput) {
38168
38178
  console.log(`About to DELETE the R2 objects no file row holds in: ${targetLabel}.`);
@@ -38209,6 +38219,48 @@ async function runRepairKnowledgeBlobs(flagArgs) {
38209
38219
  for (const key of d.keys) console.log(` ${key}`);
38210
38220
  }
38211
38221
  }
38222
+ async function runRepairCredentialLinks(flagArgs) {
38223
+ const USAGE8 = "wayai admin hubs repair-credential-links --all | --org <org_id> | --hub <hub_id> [--apply] [--yes] [--json]";
38224
+ const { body, targetLabel, apply, yes, jsonOutput } = parseApplyTargetFlags(flagArgs, USAGE8);
38225
+ if (apply && !yes && !jsonOutput) {
38226
+ console.log(`About to WRITE org credential links and current secrets to production connections in: ${targetLabel}.`);
38227
+ console.log("Run without --apply first to see what would change.");
38228
+ const ok = await confirm("Proceed?");
38229
+ if (!ok) {
38230
+ console.log("Aborted.");
38231
+ return;
38232
+ }
38233
+ }
38234
+ const { config, accessToken } = await requireAuth();
38235
+ const client = new ApiClient({ apiUrl: config.api_url, accessToken });
38236
+ let response;
38237
+ try {
38238
+ response = await client.adminRepairCredentialLinks({ ...body, dry_run: !apply });
38239
+ } catch (err) {
38240
+ exitOnApiError(err);
38241
+ throw err;
38242
+ }
38243
+ const data = response.data;
38244
+ if (jsonOutput) {
38245
+ console.log(JSON.stringify(data, null, 2));
38246
+ return;
38247
+ }
38248
+ const mode = data.dry_run ? "DRY RUN \u2014 nothing written" : "written";
38249
+ console.log(
38250
+ `repair-credential-links (${data.scope}) \u2014 ${mode}: hubs_scanned=${data.hubs_scanned} links_added=${data.links_added} secrets_updated=${data.secrets_updated}`
38251
+ );
38252
+ if (data.hubs_errored > 0 || data.orgs_errored > 0) {
38253
+ console.log(
38254
+ `WARNING: ${data.orgs_errored} org(s) and ${data.hubs_errored} hub(s) errored and were SKIPPED \u2014 re-run to cover them.`
38255
+ );
38256
+ }
38257
+ for (const r of data.results) {
38258
+ const reason = r.reason ? ` (${r.reason})` : "";
38259
+ const stale = r.secret_stale ? " secret_stale" : "";
38260
+ const written = r.secret_written ? " secret_written" : "";
38261
+ console.log(` hub=${r.hub_id} connection=${r.connection_id} credential=${r.credential_id}: ${r.outcome}${reason}${stale}${written}`);
38262
+ }
38263
+ }
38212
38264
  async function runRepairBranchingOrphans(flagArgs) {
38213
38265
  const USAGE8 = "wayai admin hubs repair-branching-orphans --all | --org <org_id> | --hub <hub_id> [--id <type>:<id> ...] [--dry-run] [--yes] [--json]";
38214
38266
  const targets = [];
@@ -39333,6 +39385,9 @@ Usage:
39333
39385
  wayai admin hubs repair-branching-orphans --all | --org <org_id> | --hub <hub_id> [--id <type>:<id> ...] [--dry-run] [--yes] [--json]
39334
39386
  Without --id: report unmapped production rows that duplicate a mapped one (#4577). With --id: delete exactly those rows of one production hub, each only if no live preview maps it and nothing references it
39335
39387
 
39388
+ wayai admin hubs repair-credential-links --all | --org <org_id> | --hub <hub_id> [--apply] [--yes] [--json]
39389
+ Report, or with --apply give each production connection copied before publish carried org credential links its links and their current secrets, and write the current secret into a linked connection that does not hold it (#5423). Idempotent \u2014 run without --apply first
39390
+
39336
39391
  wayai admin hubs repair-knowledge-blobs --all | --org <org_id> | --hub <hub_id> [--apply] [--yes] [--json]
39337
39392
  Report, or with --apply delete, the R2 objects under each hub no file row holds (retired knowledge's, #5142), older than a day; never eval attachments or call openings. A dry run by default. Run it once the deploy that retired knowledge is fully live: a hub on older code stops on its first page, as errored
39338
39393
 
@@ -39418,6 +39473,12 @@ Sources:
39418
39473
  diff sees them. It never picks rows itself \u2014 a deleted preview leaves live
39419
39474
  rows unmapped too \u2014 so without --id it only reports candidates, and with
39420
39475
  --id it deletes the named rows that pass its checks.
39476
+ \`repair-credential-links\` backfills org credential links on production
39477
+ connections copied before publish carried them: a key update skips such a
39478
+ connection, which keeps the old key until its next publish. It links only
39479
+ what a preview's own link supports, also writes the current key into a linked
39480
+ connection that does not hold it, leaves a connection two credentials could
39481
+ supply with a reason, and writes only with --apply.
39421
39482
  \`repair-knowledge-blobs\` sweeps the R2 objects retired hub knowledge left
39422
39483
  behind once its rows were deleted: keys no file row holds, older than a
39423
39484
  day. It reports by default and deletes only with --apply.