@wayai/cli 0.3.279 → 0.3.281
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 +167 -27
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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-
|
|
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
|
|
6240
|
-
"../../packages/core/dist/chunk-
|
|
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-
|
|
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
|
|
6760
|
-
"../../packages/core/dist/chunk-
|
|
6760
|
+
var init_chunk_S447DV3E = __esm({
|
|
6761
|
+
"../../packages/core/dist/chunk-S447DV3E.js"() {
|
|
6761
6762
|
"use strict";
|
|
6762
|
-
|
|
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-
|
|
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,
|
|
15302
|
-
var
|
|
15303
|
-
"../../packages/core/dist/chunk-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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) {
|
|
@@ -27455,6 +27461,7 @@ var push_exports = {};
|
|
|
27455
27461
|
__export(push_exports, {
|
|
27456
27462
|
autoRenameAgentFiles: () => autoRenameAgentFiles,
|
|
27457
27463
|
createAndPushNewHub: () => createAndPushNewHub,
|
|
27464
|
+
mergeSkippedToolEntries: () => mergeSkippedToolEntries,
|
|
27458
27465
|
printErrors: () => printErrors,
|
|
27459
27466
|
printLocalFileChanges: () => printLocalFileChanges,
|
|
27460
27467
|
printSyncResult: () => printSyncResult,
|
|
@@ -27703,11 +27710,63 @@ async function autoRenameAgentFiles(client, hubId, hubFolder, organizationId, re
|
|
|
27703
27710
|
}
|
|
27704
27711
|
}
|
|
27705
27712
|
}
|
|
27706
|
-
|
|
27713
|
+
function resolveHeld(id, name, held) {
|
|
27714
|
+
if (id && held?.some((h) => h.id === id)) return id;
|
|
27715
|
+
return held?.find((h) => name !== void 0 && h.name === name)?.id;
|
|
27716
|
+
}
|
|
27717
|
+
function entriesWithNoRow(entries, rows, identity2, pulled) {
|
|
27718
|
+
const keys = entries.map((entry) => identity2.key(entry, pulled));
|
|
27719
|
+
const rowKeys = new Set(rows.map((row) => identity2.rowKey(row)));
|
|
27720
|
+
const resolvedKeys = new Set(keys.filter((key) => key !== null));
|
|
27721
|
+
const unresolved = entries.filter((_, i) => keys[i] === null);
|
|
27722
|
+
const unresolvedTaken = /* @__PURE__ */ new Set();
|
|
27723
|
+
for (const tool of new Set(unresolved.map((entry) => identity2.tool(entry)))) {
|
|
27724
|
+
const named = new Set(unresolved.filter((entry) => identity2.tool(entry) === tool).map((entry) => identity2.label(entry)));
|
|
27725
|
+
const freeRows = rows.filter((row) => identity2.tool(row) === tool && !resolvedKeys.has(identity2.rowKey(row)));
|
|
27726
|
+
if (freeRows.length >= named.size) unresolvedTaken.add(tool);
|
|
27727
|
+
}
|
|
27728
|
+
return entries.filter((entry, i) => {
|
|
27729
|
+
const key = keys[i];
|
|
27730
|
+
return key === null ? !unresolvedTaken.has(identity2.tool(entry)) : !rowKeys.has(key);
|
|
27731
|
+
});
|
|
27732
|
+
}
|
|
27733
|
+
function mergeSkippedToolEntries(pulled, pushed) {
|
|
27734
|
+
const kept = [];
|
|
27735
|
+
for (const local of pushed.agents ?? []) {
|
|
27736
|
+
const remote = (pulled.agents ?? []).find((a) => local.id !== void 0 && a.id === local.id) ?? (pulled.agents ?? []).find((a) => a.name === local.name);
|
|
27737
|
+
const localTools = local.tools;
|
|
27738
|
+
if (!remote || !localTools) continue;
|
|
27739
|
+
const tools = remote.tools ?? {};
|
|
27740
|
+
const keep = (group) => {
|
|
27741
|
+
const identity2 = SKIPPABLE_ENTRY_IDENTITY[group];
|
|
27742
|
+
const rows = tools[group] ?? [];
|
|
27743
|
+
const missing = entriesWithNoRow(localTools[group] ?? [], rows, identity2, pulled);
|
|
27744
|
+
if (missing.length === 0) return;
|
|
27745
|
+
const replaced = new Set(missing.map(entryId).filter((id) => id !== void 0));
|
|
27746
|
+
const leftRows = rows.filter((row) => {
|
|
27747
|
+
const id = entryId(row);
|
|
27748
|
+
return id === void 0 || !replaced.has(id);
|
|
27749
|
+
});
|
|
27750
|
+
tools[group] = [...leftRows, ...missing];
|
|
27751
|
+
kept.push(...missing.map((entry) => `${local.name}: ${identity2.label(entry)}`));
|
|
27752
|
+
};
|
|
27753
|
+
keep("native");
|
|
27754
|
+
keep("delegation");
|
|
27755
|
+
keep("mcp");
|
|
27756
|
+
if (Object.keys(tools).length > 0) remote.tools = tools;
|
|
27757
|
+
}
|
|
27758
|
+
return kept;
|
|
27759
|
+
}
|
|
27760
|
+
async function syncAfterPush(client, hubId, hubFolder, pushed, organizationId) {
|
|
27707
27761
|
try {
|
|
27708
27762
|
const remoteConfig = await client.pull(hubId, organizationId);
|
|
27763
|
+
const kept = mergeSkippedToolEntries(remoteConfig, pushed);
|
|
27709
27764
|
const delta = await materializeHubFolder(hubFolder, remoteConfig);
|
|
27710
27765
|
printLocalFileChanges(delta);
|
|
27766
|
+
if (kept.length > 0) {
|
|
27767
|
+
console.log(`Kept ${kept.length} tool ${kept.length === 1 ? "entry" : "entries"} in this folder that this push did not write; push again once ${kept.length === 1 ? "it" : "they"} can be applied:`);
|
|
27768
|
+
for (const line of kept) console.log(` ${line}`);
|
|
27769
|
+
}
|
|
27711
27770
|
const finalFolder = autoRenameHubFolder(hubFolder, remoteConfig.hub.name, remoteConfig.hub_environment, hubId, remoteConfig.preview_label, remoteConfig.branch_name);
|
|
27712
27771
|
if (finalFolder !== hubFolder) {
|
|
27713
27772
|
console.log(`Hub folder is now ${finalFolder}`);
|
|
@@ -27761,7 +27820,7 @@ async function pushSingleHub(client, hubId, hubFolder, autoConfirm, organization
|
|
|
27761
27820
|
console.log("Pushing changes...");
|
|
27762
27821
|
const result = await client.push(hubId, wireConfig, organizationId);
|
|
27763
27822
|
printSyncResult(result);
|
|
27764
|
-
await syncAfterPush(client, hubId, hubFolder, organizationId);
|
|
27823
|
+
await syncAfterPush(client, hubId, hubFolder, localConfig, organizationId);
|
|
27765
27824
|
seedScopeIfEmpty("hubs", hubId);
|
|
27766
27825
|
return true;
|
|
27767
27826
|
}
|
|
@@ -27918,7 +27977,7 @@ async function pushCommand(args2) {
|
|
|
27918
27977
|
assertScopeAllowsCreation("hubs", resolution.target.hub.hubName);
|
|
27919
27978
|
await createAndPushNewHub(client, resolution.target.hub, { autoConfirm, label: label2, organizationId });
|
|
27920
27979
|
}
|
|
27921
|
-
var LOCAL_CHANGE_LIST_CAP;
|
|
27980
|
+
var LOCAL_CHANGE_LIST_CAP, nativeEntryName, entryId, SKIPPABLE_ENTRY_IDENTITY;
|
|
27922
27981
|
var init_push = __esm({
|
|
27923
27982
|
"src/commands/push.ts"() {
|
|
27924
27983
|
"use strict";
|
|
@@ -27940,6 +27999,32 @@ var init_push = __esm({
|
|
|
27940
27999
|
init_community_workspace();
|
|
27941
28000
|
init_fs_safety();
|
|
27942
28001
|
LOCAL_CHANGE_LIST_CAP = 20;
|
|
28002
|
+
nativeEntryName = (entry) => typeof entry === "string" ? entry : entry.name;
|
|
28003
|
+
entryId = (entry) => typeof entry === "string" ? void 0 : entry.id;
|
|
28004
|
+
SKIPPABLE_ENTRY_IDENTITY = {
|
|
28005
|
+
native: {
|
|
28006
|
+
key: (entry) => nativeEntryName(entry),
|
|
28007
|
+
rowKey: (row) => nativeEntryName(row),
|
|
28008
|
+
tool: (entry) => nativeEntryName(entry),
|
|
28009
|
+
label: (entry) => `native tool "${nativeEntryName(entry)}"`
|
|
28010
|
+
},
|
|
28011
|
+
delegation: {
|
|
28012
|
+
key: (entry, pulled) => {
|
|
28013
|
+
const target = entry.type === "agent" ? resolveHeld(entry.target_id, entry.target, pulled.agents) : entry.type === "team" ? resolveHeld(entry.target_id, entry.target, pulled.teams) : entry.target_id;
|
|
28014
|
+
if (target === void 0 && entry.type === "hub") return null;
|
|
28015
|
+
return `${entry.tool}:${entry.type}:${target ?? `name:${entry.target}`}`;
|
|
28016
|
+
},
|
|
28017
|
+
rowKey: (row) => `${row.tool}:${row.type}:${row.target_id ?? `name:${row.target}`}`,
|
|
28018
|
+
tool: (entry) => `${entry.tool}:${entry.type}`,
|
|
28019
|
+
label: (entry) => `${entry.tool} to ${entry.type} "${entry.target}"`
|
|
28020
|
+
},
|
|
28021
|
+
mcp: {
|
|
28022
|
+
key: (entry, pulled) => `${resolveHeld(entry.connection_id, entry.connection, pulled.connections) ?? `name:${entry.connection}`}:${entry.name}`,
|
|
28023
|
+
rowKey: (row) => `${row.connection_id ?? `name:${row.connection}`}:${row.name}`,
|
|
28024
|
+
tool: (entry) => entry.name,
|
|
28025
|
+
label: (entry) => `MCP tool "${entry.name}" on "${entry.connection ?? entry.connection_id}"`
|
|
28026
|
+
}
|
|
28027
|
+
};
|
|
27943
28028
|
}
|
|
27944
28029
|
});
|
|
27945
28030
|
|
|
@@ -37639,6 +37724,9 @@ async function adminCommand(args2) {
|
|
|
37639
37724
|
case "repair-branching-orphans":
|
|
37640
37725
|
await runRepairBranchingOrphans(flagArgs);
|
|
37641
37726
|
return;
|
|
37727
|
+
case "repair-credential-links":
|
|
37728
|
+
await runRepairCredentialLinks(flagArgs);
|
|
37729
|
+
return;
|
|
37642
37730
|
case "repair-knowledge-blobs":
|
|
37643
37731
|
await runRepairKnowledgeBlobs(flagArgs);
|
|
37644
37732
|
return;
|
|
@@ -38151,18 +38239,19 @@ async function runRepairTeamOrphans(flagArgs) {
|
|
|
38151
38239
|
console.log(`${d.hub_id} | ${d.dangling_team_ids.join(",")} | ${d.team_users_removed}`);
|
|
38152
38240
|
}
|
|
38153
38241
|
}
|
|
38154
|
-
|
|
38155
|
-
const USAGE8 = "wayai admin hubs repair-knowledge-blobs --all | --org <org_id> | --hub <hub_id> [--apply] [--yes] [--json]";
|
|
38242
|
+
function parseApplyTargetFlags(flagArgs, usage3) {
|
|
38156
38243
|
const apply = flagArgs.includes("--apply");
|
|
38157
|
-
const
|
|
38158
|
-
|
|
38159
|
-
USAGE8
|
|
38160
|
-
);
|
|
38161
|
-
if (apply && dryRun) {
|
|
38244
|
+
const target = parseScopedTargetFlags(flagArgs.filter((arg) => arg !== "--apply"), usage3);
|
|
38245
|
+
if (apply && target.dryRun) {
|
|
38162
38246
|
console.error("--apply and --dry-run contradict each other: a run is a dry run unless --apply is given.");
|
|
38163
|
-
console.error(
|
|
38247
|
+
console.error(usage3);
|
|
38164
38248
|
process.exit(1);
|
|
38165
38249
|
}
|
|
38250
|
+
return { ...target, apply };
|
|
38251
|
+
}
|
|
38252
|
+
async function runRepairKnowledgeBlobs(flagArgs) {
|
|
38253
|
+
const USAGE8 = "wayai admin hubs repair-knowledge-blobs --all | --org <org_id> | --hub <hub_id> [--apply] [--yes] [--json]";
|
|
38254
|
+
const { body, targetLabel, apply, yes, jsonOutput } = parseApplyTargetFlags(flagArgs, USAGE8);
|
|
38166
38255
|
const input = { ...body, dry_run: !apply };
|
|
38167
38256
|
if (apply && !yes && !jsonOutput) {
|
|
38168
38257
|
console.log(`About to DELETE the R2 objects no file row holds in: ${targetLabel}.`);
|
|
@@ -38209,6 +38298,48 @@ async function runRepairKnowledgeBlobs(flagArgs) {
|
|
|
38209
38298
|
for (const key of d.keys) console.log(` ${key}`);
|
|
38210
38299
|
}
|
|
38211
38300
|
}
|
|
38301
|
+
async function runRepairCredentialLinks(flagArgs) {
|
|
38302
|
+
const USAGE8 = "wayai admin hubs repair-credential-links --all | --org <org_id> | --hub <hub_id> [--apply] [--yes] [--json]";
|
|
38303
|
+
const { body, targetLabel, apply, yes, jsonOutput } = parseApplyTargetFlags(flagArgs, USAGE8);
|
|
38304
|
+
if (apply && !yes && !jsonOutput) {
|
|
38305
|
+
console.log(`About to WRITE org credential links and current secrets to production connections in: ${targetLabel}.`);
|
|
38306
|
+
console.log("Run without --apply first to see what would change.");
|
|
38307
|
+
const ok = await confirm("Proceed?");
|
|
38308
|
+
if (!ok) {
|
|
38309
|
+
console.log("Aborted.");
|
|
38310
|
+
return;
|
|
38311
|
+
}
|
|
38312
|
+
}
|
|
38313
|
+
const { config, accessToken } = await requireAuth();
|
|
38314
|
+
const client = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
38315
|
+
let response;
|
|
38316
|
+
try {
|
|
38317
|
+
response = await client.adminRepairCredentialLinks({ ...body, dry_run: !apply });
|
|
38318
|
+
} catch (err) {
|
|
38319
|
+
exitOnApiError(err);
|
|
38320
|
+
throw err;
|
|
38321
|
+
}
|
|
38322
|
+
const data = response.data;
|
|
38323
|
+
if (jsonOutput) {
|
|
38324
|
+
console.log(JSON.stringify(data, null, 2));
|
|
38325
|
+
return;
|
|
38326
|
+
}
|
|
38327
|
+
const mode = data.dry_run ? "DRY RUN \u2014 nothing written" : "written";
|
|
38328
|
+
console.log(
|
|
38329
|
+
`repair-credential-links (${data.scope}) \u2014 ${mode}: hubs_scanned=${data.hubs_scanned} links_added=${data.links_added} secrets_updated=${data.secrets_updated}`
|
|
38330
|
+
);
|
|
38331
|
+
if (data.hubs_errored > 0 || data.orgs_errored > 0) {
|
|
38332
|
+
console.log(
|
|
38333
|
+
`WARNING: ${data.orgs_errored} org(s) and ${data.hubs_errored} hub(s) errored and were SKIPPED \u2014 re-run to cover them.`
|
|
38334
|
+
);
|
|
38335
|
+
}
|
|
38336
|
+
for (const r of data.results) {
|
|
38337
|
+
const reason = r.reason ? ` (${r.reason})` : "";
|
|
38338
|
+
const stale = r.secret_stale ? " secret_stale" : "";
|
|
38339
|
+
const written = r.secret_written ? " secret_written" : "";
|
|
38340
|
+
console.log(` hub=${r.hub_id} connection=${r.connection_id} credential=${r.credential_id}: ${r.outcome}${reason}${stale}${written}`);
|
|
38341
|
+
}
|
|
38342
|
+
}
|
|
38212
38343
|
async function runRepairBranchingOrphans(flagArgs) {
|
|
38213
38344
|
const USAGE8 = "wayai admin hubs repair-branching-orphans --all | --org <org_id> | --hub <hub_id> [--id <type>:<id> ...] [--dry-run] [--yes] [--json]";
|
|
38214
38345
|
const targets = [];
|
|
@@ -39333,6 +39464,9 @@ Usage:
|
|
|
39333
39464
|
wayai admin hubs repair-branching-orphans --all | --org <org_id> | --hub <hub_id> [--id <type>:<id> ...] [--dry-run] [--yes] [--json]
|
|
39334
39465
|
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
39466
|
|
|
39467
|
+
wayai admin hubs repair-credential-links --all | --org <org_id> | --hub <hub_id> [--apply] [--yes] [--json]
|
|
39468
|
+
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
|
|
39469
|
+
|
|
39336
39470
|
wayai admin hubs repair-knowledge-blobs --all | --org <org_id> | --hub <hub_id> [--apply] [--yes] [--json]
|
|
39337
39471
|
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
39472
|
|
|
@@ -39418,6 +39552,12 @@ Sources:
|
|
|
39418
39552
|
diff sees them. It never picks rows itself \u2014 a deleted preview leaves live
|
|
39419
39553
|
rows unmapped too \u2014 so without --id it only reports candidates, and with
|
|
39420
39554
|
--id it deletes the named rows that pass its checks.
|
|
39555
|
+
\`repair-credential-links\` backfills org credential links on production
|
|
39556
|
+
connections copied before publish carried them: a key update skips such a
|
|
39557
|
+
connection, which keeps the old key until its next publish. It links only
|
|
39558
|
+
what a preview's own link supports, also writes the current key into a linked
|
|
39559
|
+
connection that does not hold it, leaves a connection two credentials could
|
|
39560
|
+
supply with a reason, and writes only with --apply.
|
|
39421
39561
|
\`repair-knowledge-blobs\` sweeps the R2 objects retired hub knowledge left
|
|
39422
39562
|
behind once its rows were deleted: keys no file row holds, older than a
|
|
39423
39563
|
day. It reports by default and deletes only with --apply.
|