@wayai/cli 0.3.296 → 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 +78 -21
- 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
|
|
@@ -40045,7 +40095,14 @@ var init_admin = __esm({
|
|
|
40045
40095
|
"0cd6a292-895b-4667-b89e-dd298628c272",
|
|
40046
40096
|
"c3d4e5f6-7a8b-4c9d-0e1f-2a3b4c5d6e7f",
|
|
40047
40097
|
"b2c3d4e5-f6a7-4b89-c012-3456789abcdf"
|
|
40048
|
-
]]
|
|
40098
|
+
]],
|
|
40099
|
+
["anthropic", ["b3c4d5e6-f7a8-9012-bcde-f12345678902"]],
|
|
40100
|
+
["gemini", [
|
|
40101
|
+
"c4d5e6f7-a8b9-0123-cdef-234567890123",
|
|
40102
|
+
"54448ab4-7457-436d-ae1a-4d7713130cb9"
|
|
40103
|
+
]],
|
|
40104
|
+
["openrouter", ["4d7e9f23-1a2b-4c3d-9e8f-5a6b7c8d9e0f"]],
|
|
40105
|
+
["xai", ["59b0864f-55ec-4284-9af3-62ebd82e33ce"]]
|
|
40049
40106
|
]);
|
|
40050
40107
|
VAULT_GATE_BY_ID_ONLY = /* @__PURE__ */ new Map([
|
|
40051
40108
|
["01e7b19c-bc94-43f4-a780-ad5a22fb7127", "openai"]
|
|
@@ -40589,7 +40646,7 @@ var init_actions = __esm({
|
|
|
40589
40646
|
|
|
40590
40647
|
// src/data/commands/attachments.ts
|
|
40591
40648
|
import { Command as Command2 } from "commander";
|
|
40592
|
-
import { readFileSync as
|
|
40649
|
+
import { readFileSync as readFileSync20 } from "fs";
|
|
40593
40650
|
function findAttachmentByFilename(attachments, filename) {
|
|
40594
40651
|
return attachments.find((a) => a.key.endsWith(`/${filename}`)) ?? null;
|
|
40595
40652
|
}
|
|
@@ -40630,7 +40687,7 @@ function buildAttachmentsCommand() {
|
|
|
40630
40687
|
printOutput(data, outputFormat(this));
|
|
40631
40688
|
return;
|
|
40632
40689
|
}
|
|
40633
|
-
const body =
|
|
40690
|
+
const body = readFileSync20(opts.file);
|
|
40634
40691
|
await client.upload(uploadPathFrom(data?.upload_url), body, opts.contentType);
|
|
40635
40692
|
printOutput({ ...data, uploaded: true }, outputFormat(this));
|
|
40636
40693
|
});
|
|
@@ -41127,7 +41184,7 @@ var init_providers = __esm({
|
|
|
41127
41184
|
|
|
41128
41185
|
// src/data/commands/credentials.ts
|
|
41129
41186
|
import { Command as Command6 } from "commander";
|
|
41130
|
-
import { readFileSync as
|
|
41187
|
+
import { readFileSync as readFileSync21 } from "fs";
|
|
41131
41188
|
function withValueSourceOptions(cmd, what) {
|
|
41132
41189
|
return cmd.option(
|
|
41133
41190
|
"--file <path>",
|
|
@@ -41140,7 +41197,7 @@ async function resolveValue(opts, label2) {
|
|
|
41140
41197
|
throw expected("--file cannot be combined with --value-stdin or --value-prompt \u2014 pass one.");
|
|
41141
41198
|
}
|
|
41142
41199
|
try {
|
|
41143
|
-
return
|
|
41200
|
+
return readFileSync21(opts.file).toString("base64");
|
|
41144
41201
|
} catch (e) {
|
|
41145
41202
|
throw expected(`--file ${opts.file}: ${e instanceof Error ? e.message : "could not be read"}`);
|
|
41146
41203
|
}
|
|
@@ -41289,7 +41346,7 @@ var init_credentials = __esm({
|
|
|
41289
41346
|
|
|
41290
41347
|
// src/data/commands/sql.ts
|
|
41291
41348
|
import { Command as Command7 } from "commander";
|
|
41292
|
-
import { readFileSync as
|
|
41349
|
+
import { readFileSync as readFileSync22 } from "fs";
|
|
41293
41350
|
function buildBasesSqlCommand() {
|
|
41294
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(
|
|
41295
41352
|
"--param <kv...>",
|
|
@@ -41299,7 +41356,7 @@ function buildBasesSqlCommand() {
|
|
|
41299
41356
|
let query;
|
|
41300
41357
|
if (opts.file) {
|
|
41301
41358
|
try {
|
|
41302
|
-
query =
|
|
41359
|
+
query = readFileSync22(opts.file, "utf-8").trim();
|
|
41303
41360
|
} catch (e) {
|
|
41304
41361
|
throw expected(`--file ${opts.file}: ${e instanceof Error ? e.message : "could not be read"}`);
|
|
41305
41362
|
}
|
|
@@ -41982,7 +42039,7 @@ var init_file_types = __esm({
|
|
|
41982
42039
|
|
|
41983
42040
|
// src/data/commands/files.ts
|
|
41984
42041
|
import { Command as Command11 } from "commander";
|
|
41985
|
-
import { readFileSync as
|
|
42042
|
+
import { readFileSync as readFileSync23, writeFileSync as writeFileSync11 } from "fs";
|
|
41986
42043
|
import { basename as basename29 } from "path";
|
|
41987
42044
|
function renderFileDiff(fileType, filePath2, from, to, d) {
|
|
41988
42045
|
console.log(sanitizeTerminalText(`${fileType}/${filePath2}: v${from} \u2192 v${to}`));
|
|
@@ -42039,7 +42096,7 @@ function buildFilesCommand() {
|
|
|
42039
42096
|
label: opts.label,
|
|
42040
42097
|
metadata: opts.metadata === void 0 ? void 0 : parseData(opts.metadata, "--metadata")
|
|
42041
42098
|
});
|
|
42042
|
-
const body =
|
|
42099
|
+
const body = readFileSync23(opts.file);
|
|
42043
42100
|
const client = await createDataClient();
|
|
42044
42101
|
printOutput(
|
|
42045
42102
|
await client.upload(
|
|
@@ -43128,7 +43185,7 @@ init_errors2();
|
|
|
43128
43185
|
init_mask_secrets();
|
|
43129
43186
|
init_utils();
|
|
43130
43187
|
init_registry();
|
|
43131
|
-
import { readFileSync as
|
|
43188
|
+
import { readFileSync as readFileSync24 } from "fs";
|
|
43132
43189
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
43133
43190
|
import { dirname as dirname16, join as join39 } from "path";
|
|
43134
43191
|
|
|
@@ -43286,7 +43343,7 @@ Run \`wayai admin skill install\` to update.`);
|
|
|
43286
43343
|
|
|
43287
43344
|
// src/index.ts
|
|
43288
43345
|
var __dirname = dirname16(fileURLToPath2(import.meta.url));
|
|
43289
|
-
var pkg = JSON.parse(
|
|
43346
|
+
var pkg = JSON.parse(readFileSync24(join39(__dirname, "..", "package.json"), "utf-8"));
|
|
43290
43347
|
var [, , command, ...args] = process.argv;
|
|
43291
43348
|
var isBackgroundRefresh = command === REFRESH_COMMAND;
|
|
43292
43349
|
if (!isBackgroundRefresh) initSentry(command, pkg.version);
|