@wayai/cli 0.3.297 → 0.3.298
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 +70 -20
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -38438,16 +38438,40 @@ async function runRepairCredentialLinks(flagArgs) {
|
|
|
38438
38438
|
console.log(` hub=${r.hub_id} connection=${r.connection_id} credential=${r.credential_id}: ${r.outcome}${reason}${stale}${written}`);
|
|
38439
38439
|
}
|
|
38440
38440
|
}
|
|
38441
|
+
function printCustomerReport(customer, dryRun) {
|
|
38442
|
+
const c = customer.census;
|
|
38443
|
+
const auth = Object.entries(c.by_auth).map(([k, n]) => `${k}=${n}`).join(" ") || "-";
|
|
38444
|
+
console.log(`connections: ${c.connections} (${auth}) http=${c.http} non_default_port=${c.non_default_port} wayai_host=${c.wayai_host} body_placement=${c.body_placement} literal_header_secret=${c.literal_header_secret} secret_url=${c.secret_url}`);
|
|
38445
|
+
console.log(`policies (${customer.policies.length}; old ciphertext kept ${customer.undo_days} days for revert):`);
|
|
38446
|
+
for (const p of customer.policies) {
|
|
38447
|
+
const subject = p.credential_id ? `credential ${p.credential_id}` : "value";
|
|
38448
|
+
console.log(` ${subject} ${p.field}${p.spans_hubs ? " (SPANS HUBS)" : ""}: ${p.reasons.length > 0 ? `stays (${p.reasons.join(", ")})` : dryRun ? "would move" : "approved"}`);
|
|
38449
|
+
if (p.policy) {
|
|
38450
|
+
if (p.policy.legacy_origin) console.log(" LEGACY ORIGIN (http or another port, moved as it is)");
|
|
38451
|
+
for (const scope of p.policy.scopes) {
|
|
38452
|
+
const placements = scope.placements.map((pl) => pl.kind === "header" ? `header:${pl.name}` : pl.kind === "query" ? `query:${pl.name}` : pl.kind === "path" ? `path:${pl.after}` : "basic");
|
|
38453
|
+
console.log(` ${scope.origin}${scope.path} (${scope.match}) ${scope.methods.join(",")} [${placements.join(", ")}] headers=${scope.headers.join(",") || "-"}`);
|
|
38454
|
+
}
|
|
38455
|
+
console.log(` policy_hash=${p.policy_hash}`);
|
|
38456
|
+
}
|
|
38457
|
+
for (const r of p.rows) console.log(` hub=${r.hub_id} connection=${r.connection_id}`);
|
|
38458
|
+
}
|
|
38459
|
+
for (const r of customer.stays) console.log(` stays (${r.reason}): ${r.entries}`);
|
|
38460
|
+
if (dryRun && customer.policies.some((p) => p.reasons.length === 0)) {
|
|
38461
|
+
console.log("To move them: save this dry run with --json, review it, then --apply --approved <that file>.");
|
|
38462
|
+
}
|
|
38463
|
+
}
|
|
38441
38464
|
function printVaultReport(data) {
|
|
38442
38465
|
if (data.hubs_errored.length > 0) console.log(`WARNING: ${data.hubs_errored.length} hub(s) could not be read and were SKIPPED \u2014 re-run to cover them: ${data.hubs_errored.join(", ")}`);
|
|
38443
38466
|
if (data.reenable.length === 0) return;
|
|
38444
38467
|
console.log(`${data.dry_run ? "Would need" : "Need"} their channel enabled again, on the preview hub (${data.reenable.length}):`);
|
|
38445
38468
|
for (const r of data.reenable) console.log(` hub=${r.hub_id}${r.preview ? " (preview)" : ""} connection=${r.connection_id} bot=${r.bot_username ?? "-"}${r.enabled ? "" : " (disabled)"}`);
|
|
38446
38469
|
}
|
|
38447
|
-
function parseVaultFlags(flagArgs, usage3,
|
|
38470
|
+
function parseVaultFlags(flagArgs, usage3, importFlags) {
|
|
38448
38471
|
let orgId;
|
|
38449
38472
|
let connectorId;
|
|
38450
38473
|
let maxPuts;
|
|
38474
|
+
let approvedFile;
|
|
38451
38475
|
let apply = false;
|
|
38452
38476
|
let yes = false;
|
|
38453
38477
|
let jsonOutput = false;
|
|
@@ -38457,8 +38481,10 @@ function parseVaultFlags(flagArgs, usage3, allowMaxPuts) {
|
|
|
38457
38481
|
orgId = requireFlagValue(flagArgs, ++i, "--org");
|
|
38458
38482
|
} else if (flag === "--connector") {
|
|
38459
38483
|
connectorId = requireFlagValue(flagArgs, ++i, "--connector");
|
|
38460
|
-
} else if (flag === "--max-puts" &&
|
|
38484
|
+
} else if (flag === "--max-puts" && importFlags) {
|
|
38461
38485
|
maxPuts = parsePositiveIntFlag("--max-puts", flagArgs[++i]);
|
|
38486
|
+
} else if (flag === "--approved" && importFlags) {
|
|
38487
|
+
approvedFile = requireFlagValue(flagArgs, ++i, "--approved");
|
|
38462
38488
|
} else if (flag === "--apply") {
|
|
38463
38489
|
apply = true;
|
|
38464
38490
|
} else if (flag === "--yes" || flag === "-y") {
|
|
@@ -38476,11 +38502,28 @@ function parseVaultFlags(flagArgs, usage3, allowMaxPuts) {
|
|
|
38476
38502
|
console.error(usage3);
|
|
38477
38503
|
process.exit(1);
|
|
38478
38504
|
}
|
|
38479
|
-
return { orgId, connectorId, maxPuts, apply, yes, jsonOutput };
|
|
38505
|
+
return { orgId, connectorId, maxPuts, approvedFile, apply, yes, jsonOutput };
|
|
38506
|
+
}
|
|
38507
|
+
function readApprovedPolicies(file) {
|
|
38508
|
+
let parsed;
|
|
38509
|
+
try {
|
|
38510
|
+
parsed = JSON.parse(fs32.readFileSync(file, "utf8"));
|
|
38511
|
+
} catch (err) {
|
|
38512
|
+
console.error(`--approved: cannot read ${file} as a dry run's --json output: ${err instanceof Error ? err.message : String(err)}`);
|
|
38513
|
+
process.exit(1);
|
|
38514
|
+
}
|
|
38515
|
+
const report2 = parsed;
|
|
38516
|
+
const customer = report2.data?.customer ?? report2.customer;
|
|
38517
|
+
if (!customer || !Array.isArray(customer.policies)) {
|
|
38518
|
+
console.error(`--approved: ${file} holds no customer.policies (a REST API, External Resources or MCP Server dry run's --json output)`);
|
|
38519
|
+
process.exit(1);
|
|
38520
|
+
}
|
|
38521
|
+
return customer.policies.flatMap((p) => typeof p.policy_hash === "string" && Array.isArray(p.reasons) && p.reasons.length === 0 ? [p.policy_hash] : []);
|
|
38480
38522
|
}
|
|
38481
38523
|
async function runVaultImport(flagArgs) {
|
|
38482
|
-
const USAGE8 = "wayai admin vault import --org <org_id> --connector <connector_id> [--max-puts <n>] [--apply] [--yes] [--json]";
|
|
38483
|
-
const { orgId, connectorId, maxPuts, apply, yes, jsonOutput } = parseVaultFlags(flagArgs, USAGE8, true);
|
|
38524
|
+
const USAGE8 = "wayai admin vault import --org <org_id> --connector <connector_id> [--max-puts <n>] [--approved <dry-run.json>] [--apply] [--yes] [--json]";
|
|
38525
|
+
const { orgId, connectorId, maxPuts, approvedFile, apply, yes, jsonOutput } = parseVaultFlags(flagArgs, USAGE8, true);
|
|
38526
|
+
const approved = approvedFile ? readApprovedPolicies(approvedFile) : void 0;
|
|
38484
38527
|
if (apply && !yes && !jsonOutput) {
|
|
38485
38528
|
console.log(`About to MOVE organization ${orgId}'s credentials of connector ${connectorId} into the credentials vault.`);
|
|
38486
38529
|
console.log("Run without --apply first to see what would move.");
|
|
@@ -38493,7 +38536,13 @@ async function runVaultImport(flagArgs) {
|
|
|
38493
38536
|
const client = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
38494
38537
|
let data;
|
|
38495
38538
|
try {
|
|
38496
|
-
data = (await client.adminVaultImportRun({
|
|
38539
|
+
data = (await client.adminVaultImportRun({
|
|
38540
|
+
org_id: orgId,
|
|
38541
|
+
connector_id: connectorId,
|
|
38542
|
+
dry_run: !apply,
|
|
38543
|
+
...maxPuts ? { max_puts: maxPuts } : {},
|
|
38544
|
+
...apply && approved ? { approved_policies: approved } : {}
|
|
38545
|
+
})).data;
|
|
38497
38546
|
} catch (err) {
|
|
38498
38547
|
exitOnApiError(err);
|
|
38499
38548
|
throw err;
|
|
@@ -38526,6 +38575,7 @@ async function runVaultImport(flagArgs) {
|
|
|
38526
38575
|
console.log("A credential with a stale row moves once `wayai admin hubs repair-credential-links --org <org_id> --apply` writes its current value.");
|
|
38527
38576
|
}
|
|
38528
38577
|
}
|
|
38578
|
+
if (data.customer) printCustomerReport(data.customer, data.dry_run);
|
|
38529
38579
|
const voiceRows = data.voice_rows ?? [];
|
|
38530
38580
|
if (voiceRows.length > 0) {
|
|
38531
38581
|
console.log(`GPT-Live connections this run ${data.dry_run ? "would move" : "moved"} (${voiceRows.length}): a call live on one keeps its key; one started after, or a restarted call control, goes through the vault. Live calls are not counted.`);
|
|
@@ -38557,7 +38607,7 @@ async function runVaultRevert(flagArgs) {
|
|
|
38557
38607
|
console.log(JSON.stringify(data, null, 2));
|
|
38558
38608
|
return;
|
|
38559
38609
|
}
|
|
38560
|
-
console.log(`vault revert (${data.connector}) \u2014 ${data.dry_run ? "DRY RUN \u2014 nothing written" : "written"}: hubs_scanned=${data.hubs_scanned} undo_rows=${data.undo_rows}`);
|
|
38610
|
+
console.log(`vault revert (${data.connector}) \u2014 ${data.dry_run ? "DRY RUN \u2014 nothing written" : "written"}: hubs_scanned=${data.hubs_scanned} undo_rows=${data.undo_rows}${data.undo_days === void 0 ? "" : ` (within ${data.undo_days} days of the move)`}`);
|
|
38561
38611
|
for (const v of data.values) {
|
|
38562
38612
|
console.log(` value ${v.field} \u2190 ${v.secret_id}${v.code ? `: ${v.code}` : ""}`);
|
|
38563
38613
|
for (const r of v.rows) console.log(` hub=${r.hub_id} connection=${r.connection_id}: ${r.outcome}`);
|
|
@@ -39813,11 +39863,11 @@ Usage:
|
|
|
39813
39863
|
wayai admin orgs repair-legacy-grants --all | --org <org_id> [--dry-run] [--yes] [--json]
|
|
39814
39864
|
Repair org-admin roster rows keyed by email with a NULL user_email (pre-#3922 platform-admin adds): grant the real access they never conferred, or drop the phantom seat. Idempotent \u2014 run --dry-run first
|
|
39815
39865
|
|
|
39816
|
-
wayai admin vault import --org <org_id> --connector <connector_id> [--max-puts <n>] [--apply] [--yes] [--json]
|
|
39817
|
-
Move one org's stored credentials of one connector into the credentials vault, no re-entry (#5644). A dry run by default (counts by field, link kind and form); --apply needs the connector's gate open, puts each distinct value once for the direct rows holding it, moves each org credential with the rows it supplies when all of them may move (else names why it stays), and keeps the old ciphertext 30 days for revert. Re-run until values_remaining and credentials_remaining are 0. Lists Telegram bots to enable again. WhatsApp and Instagram: trims each token as a send does (rows counted), puts it with its expiry, and counts the legacy api_key rows that stay
|
|
39866
|
+
wayai admin vault import --org <org_id> --connector <connector_id> [--max-puts <n>] [--approved <dry-run.json>] [--apply] [--yes] [--json]
|
|
39867
|
+
Move one org's stored credentials of one connector into the credentials vault, no re-entry (#5644). A dry run by default (counts by field, link kind and form); --apply needs the connector's gate open, puts each distinct value once for the direct rows holding it, moves each org credential with the rows it supplies when all of them may move (else names why it stays), and keeps the old ciphertext 30 days for revert. Re-run until values_remaining and credentials_remaining are 0. Lists Telegram bots to enable again. WhatsApp and Instagram: trims each token as a send does (rows counted), puts it with its expiry, and counts the legacy api_key rows that stay. REST API, External Resources, MCP Server: prints each value's derived policy or why it stays and counts the connections; --apply moves only what --approved (the reviewed dry run's --json) lists, keeping the old ciphertext 7 days
|
|
39818
39868
|
|
|
39819
39869
|
wayai admin vault revert --org <org_id> --connector <connector_id> [--apply] [--yes] [--json]
|
|
39820
|
-
Put back what vault import moved, within 30 days, and erase the vault entries no row names; a WhatsApp or Instagram token the vault renewed since stays (renewed). A dry run by default
|
|
39870
|
+
Put back what vault import moved, within 30 days (7 for REST API, External Resources, MCP Server), and erase the vault entries no row names; a WhatsApp or Instagram token the vault renewed since stays (renewed). A dry run by default
|
|
39821
39871
|
|
|
39822
39872
|
wayai admin harness disable Flip the platform harness_enabled flag OFF (break-glass: blocks harness-agent writes and the per-turn kill switch aborts each harness turn on its next invocation)
|
|
39823
39873
|
wayai admin harness enable Flip the platform harness_enabled flag ON
|
|
@@ -40596,7 +40646,7 @@ var init_actions = __esm({
|
|
|
40596
40646
|
|
|
40597
40647
|
// src/data/commands/attachments.ts
|
|
40598
40648
|
import { Command as Command2 } from "commander";
|
|
40599
|
-
import { readFileSync as
|
|
40649
|
+
import { readFileSync as readFileSync20 } from "fs";
|
|
40600
40650
|
function findAttachmentByFilename(attachments, filename) {
|
|
40601
40651
|
return attachments.find((a) => a.key.endsWith(`/${filename}`)) ?? null;
|
|
40602
40652
|
}
|
|
@@ -40637,7 +40687,7 @@ function buildAttachmentsCommand() {
|
|
|
40637
40687
|
printOutput(data, outputFormat(this));
|
|
40638
40688
|
return;
|
|
40639
40689
|
}
|
|
40640
|
-
const body =
|
|
40690
|
+
const body = readFileSync20(opts.file);
|
|
40641
40691
|
await client.upload(uploadPathFrom(data?.upload_url), body, opts.contentType);
|
|
40642
40692
|
printOutput({ ...data, uploaded: true }, outputFormat(this));
|
|
40643
40693
|
});
|
|
@@ -41134,7 +41184,7 @@ var init_providers = __esm({
|
|
|
41134
41184
|
|
|
41135
41185
|
// src/data/commands/credentials.ts
|
|
41136
41186
|
import { Command as Command6 } from "commander";
|
|
41137
|
-
import { readFileSync as
|
|
41187
|
+
import { readFileSync as readFileSync21 } from "fs";
|
|
41138
41188
|
function withValueSourceOptions(cmd, what) {
|
|
41139
41189
|
return cmd.option(
|
|
41140
41190
|
"--file <path>",
|
|
@@ -41147,7 +41197,7 @@ async function resolveValue(opts, label2) {
|
|
|
41147
41197
|
throw expected("--file cannot be combined with --value-stdin or --value-prompt \u2014 pass one.");
|
|
41148
41198
|
}
|
|
41149
41199
|
try {
|
|
41150
|
-
return
|
|
41200
|
+
return readFileSync21(opts.file).toString("base64");
|
|
41151
41201
|
} catch (e) {
|
|
41152
41202
|
throw expected(`--file ${opts.file}: ${e instanceof Error ? e.message : "could not be read"}`);
|
|
41153
41203
|
}
|
|
@@ -41296,7 +41346,7 @@ var init_credentials = __esm({
|
|
|
41296
41346
|
|
|
41297
41347
|
// src/data/commands/sql.ts
|
|
41298
41348
|
import { Command as Command7 } from "commander";
|
|
41299
|
-
import { readFileSync as
|
|
41349
|
+
import { readFileSync as readFileSync22 } from "fs";
|
|
41300
41350
|
function buildBasesSqlCommand() {
|
|
41301
41351
|
return withBaseOption(new Command7("sql")).description("Execute a read-only SQL query against base data").argument("[query]", "SQL query (SELECT only)").option("--file <path>", "Read SQL from a file instead of the argument").option(
|
|
41302
41352
|
"--param <kv...>",
|
|
@@ -41306,7 +41356,7 @@ function buildBasesSqlCommand() {
|
|
|
41306
41356
|
let query;
|
|
41307
41357
|
if (opts.file) {
|
|
41308
41358
|
try {
|
|
41309
|
-
query =
|
|
41359
|
+
query = readFileSync22(opts.file, "utf-8").trim();
|
|
41310
41360
|
} catch (e) {
|
|
41311
41361
|
throw expected(`--file ${opts.file}: ${e instanceof Error ? e.message : "could not be read"}`);
|
|
41312
41362
|
}
|
|
@@ -41989,7 +42039,7 @@ var init_file_types = __esm({
|
|
|
41989
42039
|
|
|
41990
42040
|
// src/data/commands/files.ts
|
|
41991
42041
|
import { Command as Command11 } from "commander";
|
|
41992
|
-
import { readFileSync as
|
|
42042
|
+
import { readFileSync as readFileSync23, writeFileSync as writeFileSync11 } from "fs";
|
|
41993
42043
|
import { basename as basename29 } from "path";
|
|
41994
42044
|
function renderFileDiff(fileType, filePath2, from, to, d) {
|
|
41995
42045
|
console.log(sanitizeTerminalText(`${fileType}/${filePath2}: v${from} \u2192 v${to}`));
|
|
@@ -42046,7 +42096,7 @@ function buildFilesCommand() {
|
|
|
42046
42096
|
label: opts.label,
|
|
42047
42097
|
metadata: opts.metadata === void 0 ? void 0 : parseData(opts.metadata, "--metadata")
|
|
42048
42098
|
});
|
|
42049
|
-
const body =
|
|
42099
|
+
const body = readFileSync23(opts.file);
|
|
42050
42100
|
const client = await createDataClient();
|
|
42051
42101
|
printOutput(
|
|
42052
42102
|
await client.upload(
|
|
@@ -43135,7 +43185,7 @@ init_errors2();
|
|
|
43135
43185
|
init_mask_secrets();
|
|
43136
43186
|
init_utils();
|
|
43137
43187
|
init_registry();
|
|
43138
|
-
import { readFileSync as
|
|
43188
|
+
import { readFileSync as readFileSync24 } from "fs";
|
|
43139
43189
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
43140
43190
|
import { dirname as dirname16, join as join39 } from "path";
|
|
43141
43191
|
|
|
@@ -43293,7 +43343,7 @@ Run \`wayai admin skill install\` to update.`);
|
|
|
43293
43343
|
|
|
43294
43344
|
// src/index.ts
|
|
43295
43345
|
var __dirname = dirname16(fileURLToPath2(import.meta.url));
|
|
43296
|
-
var pkg = JSON.parse(
|
|
43346
|
+
var pkg = JSON.parse(readFileSync24(join39(__dirname, "..", "package.json"), "utf-8"));
|
|
43297
43347
|
var [, , command, ...args] = process.argv;
|
|
43298
43348
|
var isBackgroundRefresh = command === REFRESH_COMMAND;
|
|
43299
43349
|
if (!isBackgroundRefresh) initSentry(command, pkg.version);
|