@wayai/cli 0.3.347 → 0.3.349

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
@@ -26335,7 +26335,7 @@ var init_helpers = __esm({
26335
26335
  init_base_id();
26336
26336
  init_expected();
26337
26337
  init_utils();
26338
- BASE_SECRET_STORAGE_WHY = "a base's secrets are to be kept in the credentials vault, which does not hold them yet";
26338
+ BASE_SECRET_STORAGE_WHY = "the credentials vault does not hold this kind of secret yet";
26339
26339
  DURATION_RE = /^(\d+)([smhd])$/;
26340
26340
  DURATION_UNIT_MS = {
26341
26341
  s: 1e3,
@@ -26975,6 +26975,250 @@ var init_triggers = __esm({
26975
26975
  }
26976
26976
  });
26977
26977
 
26978
+ // src/data/commands/credentials.ts
26979
+ import { Command as Command2 } from "commander";
26980
+ import { readFileSync as readFileSync15 } from "fs";
26981
+ function withValueSourceOptions(cmd, what) {
26982
+ return cmd.option(
26983
+ "--file <path>",
26984
+ `Read ${what} from a file and base64-encode it (certificates, keystores, service-account JSON)`
26985
+ ).option("--value-stdin", `Read ${what} from stdin (recommended for CI)`).option("--value-prompt", `Prompt for ${what}, masked`);
26986
+ }
26987
+ async function resolveValue(opts, label3) {
26988
+ if (opts.file !== void 0) {
26989
+ if (opts.valueStdin || opts.valuePrompt) {
26990
+ throw expected("--file cannot be combined with --value-stdin or --value-prompt \u2014 pass one.");
26991
+ }
26992
+ try {
26993
+ return readFileSync15(opts.file).toString("base64");
26994
+ } catch (e) {
26995
+ throw expected(`--file ${opts.file}: ${e instanceof Error ? e.message : "could not be read"}`);
26996
+ }
26997
+ }
26998
+ return readSecret(
26999
+ {
27000
+ stdin: opts.valueStdin,
27001
+ prompt: opts.valuePrompt,
27002
+ stdinFlag: "--value-stdin",
27003
+ promptHint: "--value-prompt"
27004
+ },
27005
+ label3
27006
+ );
27007
+ }
27008
+ function credentialPath(base, id) {
27009
+ const root = `/v1/${pathSegment(base, "base id")}/credentials`;
27010
+ return id === void 0 ? root : `${root}/${pathSegment(id, "credential id")}`;
27011
+ }
27012
+ function refusalReason(err) {
27013
+ const reason3 = dataErrorDetails(err)?.reason;
27014
+ return typeof reason3 === "string" ? reason3 : null;
27015
+ }
27016
+ async function assertStorageOn(client, path55, body) {
27017
+ try {
27018
+ await client.request("POST", path55, body);
27019
+ } catch (err) {
27020
+ if (refusalReason(err) === VALUE_MISSING) return;
27021
+ if (refusalReason(err) === STORAGE_OFF) {
27022
+ throw expected(`${refusalMessage(err)} Nothing was read or stored.`);
27023
+ }
27024
+ throw err;
27025
+ }
27026
+ throw new Error("The credential service accepted a request that carried no value.");
27027
+ }
27028
+ function refusalMessage(err) {
27029
+ return dataErrorMessage(err) ?? (err instanceof Error ? err.message : String(err));
27030
+ }
27031
+ function parseRule(raw) {
27032
+ return raw === void 0 ? void 0 : parseData(raw, "--rule");
27033
+ }
27034
+ function parseProposedSources(raw) {
27035
+ if (raw === void 0) return void 0;
27036
+ const parsed = parseData(raw, "--proposed-sources");
27037
+ if (!Array.isArray(parsed)) throw expected("--proposed-sources must be a JSON list of sources, as a record type carries them.");
27038
+ return parsed;
27039
+ }
27040
+ function statedFromStored(policy) {
27041
+ const scopes = policy?.scopes;
27042
+ if (!Array.isArray(scopes) || scopes.length === 0) return null;
27043
+ return {
27044
+ scopes: scopes.map((scope) => ({
27045
+ origin: scope.origin,
27046
+ path: scope.path,
27047
+ match: scope.match,
27048
+ methods: scope.methods
27049
+ }))
27050
+ };
27051
+ }
27052
+ function overStoredLimit(err) {
27053
+ if (refusalReason(err) !== RULE_REFUSED) return false;
27054
+ const refusals = dataErrorDetails(err)?.refusals;
27055
+ return Array.isArray(refusals) && refusals.some((r) => r?.code === "too_many_scopes" || r?.code === "policy_too_large");
27056
+ }
27057
+ function sourceNamesCredential(source, name) {
27058
+ const ref = `${CREDENTIAL_REF}${name}`;
27059
+ const s = source;
27060
+ if (s?.auth?.secret_ref === ref) return true;
27061
+ return (s?.injections ?? []).some((i) => i?.target === "header" && i.secret_ref === ref);
27062
+ }
27063
+ function isUncoveredCredentialRefusal(err) {
27064
+ return refusalReason(err) === RULE_NOT_COVERING;
27065
+ }
27066
+ function rotatableInRefusal(message) {
27067
+ const found = /* @__PURE__ */ new Map();
27068
+ for (const m of message.matchAll(/credential '([^']+)' \(POST …\/credentials\/([^/\s)]+)\/rotate\)/g)) {
27069
+ found.set(m[2], { id: m[2], name: m[1] });
27070
+ }
27071
+ return [...found.values()];
27072
+ }
27073
+ async function reenterRefusedCredentials(client, base, message, pushedSources) {
27074
+ const named = rotatableInRefusal(message);
27075
+ if (named.length === 0) return false;
27076
+ const held = await client.request("GET", credentialPath(base));
27077
+ const refused = named.filter((c) => (Array.isArray(held) ? held : []).some((row) => row.id === c.id && row.name === c.name && row.policy) && pushedSources.some((source) => sourceNamesCredential(source, c.name)));
27078
+ if (refused.length === 0) return false;
27079
+ if (!isInteractive()) {
27080
+ for (const c of refused) {
27081
+ console.error(
27082
+ `To send credential '${sanitizeTerminalText(c.name)}' there, enter its value again: run \`wayai push\` in a terminal, or \`wayai bases credentials rotate ${sanitizeTerminalText(c.id)} --base ${sanitizeTerminalText(base)} --value-stdin --proposed-sources @<file>\` with a JSON list of the sources in your files that place it, then push again.`
27083
+ );
27084
+ }
27085
+ return false;
27086
+ }
27087
+ for (const c of refused) {
27088
+ const name = sanitizeTerminalText(c.name);
27089
+ if (!await confirm(`Enter the value of credential '${name}' again, so it may go where this change sends it?`)) return false;
27090
+ const path55 = `${credentialPath(base, c.id)}/rotate`;
27091
+ await assertStorageOn(client, path55, {});
27092
+ const value = await readSecret(
27093
+ { stdin: false, prompt: true, stdinFlag: "--value-stdin", promptHint: "--value-prompt" },
27094
+ `Value of credential '${name}'`
27095
+ );
27096
+ await client.request("POST", path55, {
27097
+ value,
27098
+ proposed_sources: pushedSources.filter((source) => sourceNamesCredential(source, c.name))
27099
+ });
27100
+ console.log(`Rotated credential '${name}': its rule now covers this change.`);
27101
+ }
27102
+ return true;
27103
+ }
27104
+ function buildBasesCredentialsCommand() {
27105
+ const credentials = withBaseOption(
27106
+ new Command2("credentials").description("Manage a base's integration credentials")
27107
+ );
27108
+ withValueSourceOptions(
27109
+ credentials.command("create").description(
27110
+ "Store a credential a source of this base names (value read from stdin, a masked prompt, or --file), with the rule derived from those sources"
27111
+ ).requiredOption("--name <name>", "Credential name \u2014 what a credential:<name> reference resolves").option("--content-type <mime>", "MIME type of the value (e.g. application/x-pkcs12)").option(
27112
+ "--expires-at <date>",
27113
+ "Expiry as ISO-8601 (e.g. 2027-01-01T00:00:00Z) \u2014 informational; nothing is auto-disabled"
27114
+ ).option(
27115
+ "--rule <json>",
27116
+ 'A wider rule than the derived one, inline or @file: {"scopes":[{"origin","path","match":"prefix"|"exact","methods"}]}'
27117
+ ),
27118
+ "the credential value"
27119
+ ).action(async function(opts) {
27120
+ const base = requireBase(this);
27121
+ const rule = parseRule(opts.rule);
27122
+ const client = await createDataClient();
27123
+ await assertStorageOn(client, credentialPath(base), { name: opts.name });
27124
+ const body = {
27125
+ name: opts.name,
27126
+ value: await resolveValue(opts, "Credential value")
27127
+ };
27128
+ if (opts.contentType) body.content_type = opts.contentType;
27129
+ if (opts.expiresAt) body.expires_at = opts.expiresAt;
27130
+ if (rule) body.rule = rule;
27131
+ printOutput(await client.request("POST", credentialPath(base), body), outputFormat(this));
27132
+ });
27133
+ credentials.command("list").description("List this base's credentials and the rule each was stored with (values are never returned)").action(async function() {
27134
+ const base = requireBase(this);
27135
+ const client = await createDataClient();
27136
+ printOutput(
27137
+ await client.request("GET", credentialPath(base)),
27138
+ outputFormat(this)
27139
+ );
27140
+ });
27141
+ credentials.command("get <id>").description("Get credential metadata and its stored rule (the value is never returned)").action(async function(id) {
27142
+ const base = requireBase(this);
27143
+ const client = await createDataClient();
27144
+ printOutput(
27145
+ await client.request("GET", credentialPath(base, id)),
27146
+ outputFormat(this)
27147
+ );
27148
+ });
27149
+ withValueSourceOptions(
27150
+ credentials.command("rotate <id>").description("Enter a new value, under the rule derived again from the sources (never auto-generates)").option("--expires-at <date>", "Set the rotated credential's new expiry (ISO-8601)").option("--rule <json>", "A wider rule than the derived one, inline or @file (as create takes it)").option("--keep-rule", "State the rule the credential is stored with again, as the wider rule").option(
27151
+ "--proposed-sources <json>",
27152
+ "Sources a refused save proposed, as a JSON list, inline or @file: the rule then covers them too (no source is saved)"
27153
+ ),
27154
+ "the new credential value"
27155
+ ).action(async function(id, opts) {
27156
+ const base = requireBase(this);
27157
+ if (opts.rule !== void 0 && opts.keepRule) throw expected("--rule cannot be combined with --keep-rule \u2014 pass one.");
27158
+ let rule = parseRule(opts.rule);
27159
+ const proposed = parseProposedSources(opts.proposedSources);
27160
+ const client = await createDataClient();
27161
+ const path55 = `${credentialPath(base, id)}/rotate`;
27162
+ await assertStorageOn(client, path55, {});
27163
+ const storedRule = async () => statedFromStored((await client.request("GET", credentialPath(base, id)))?.policy);
27164
+ if (opts.keepRule) {
27165
+ rule = await storedRule() ?? void 0;
27166
+ if (!rule) throw expected("This credential holds no stored rule to keep. Nothing was read or stored.");
27167
+ }
27168
+ const body = { value: await resolveValue(opts, "New credential value") };
27169
+ if (opts.expiresAt) body.expires_at = opts.expiresAt;
27170
+ if (rule) body.rule = rule;
27171
+ if (proposed) body.proposed_sources = proposed;
27172
+ try {
27173
+ printOutput(await client.request("POST", path55, body), outputFormat(this));
27174
+ } catch (err) {
27175
+ if (!rule && overStoredLimit(err) && await storedRule()) {
27176
+ throw expected(
27177
+ `${refusalMessage(err)} It is stored under a wider rule: if that rule still covers every use the sources make, run the rotation again with --keep-rule to state it again; otherwise pass --rule with one that does.`
27178
+ );
27179
+ }
27180
+ throw err;
27181
+ }
27182
+ });
27183
+ credentials.command("set-sync <id>").description("Set the promote-time publish flag \u2014 has no effect: promotion carries no credential").option("--no-sync-to-production", "Do not publish this credential on promote (has no effect)").action(() => {
27184
+ throw expected("Promotion carries no base credential, so the publish flag has no effect. Nothing was changed.");
27185
+ });
27186
+ credentials.command("delete <id>").description("Delete a direct credential").option("-y, --yes", "Skip confirmation prompt").action(async function(id, opts) {
27187
+ const base = requireBase(this);
27188
+ if (!opts.yes) {
27189
+ if (!isInteractive()) {
27190
+ throw expected("Refusing to delete without confirmation \u2014 pass --yes to delete non-interactively.");
27191
+ }
27192
+ if (!await confirm(`Delete credential ${id} on base ${base}? This cannot be undone.`)) {
27193
+ console.log("Aborted");
27194
+ return;
27195
+ }
27196
+ }
27197
+ const client = await createDataClient();
27198
+ await client.request("DELETE", credentialPath(base, id));
27199
+ printOutput({ id, deleted: true }, outputFormat(this));
27200
+ });
27201
+ return credentials;
27202
+ }
27203
+ var STORAGE_OFF, VALUE_MISSING, RULE_NOT_COVERING, RULE_REFUSED, CREDENTIAL_REF;
27204
+ var init_credentials = __esm({
27205
+ "src/data/commands/credentials.ts"() {
27206
+ "use strict";
27207
+ init_api_client();
27208
+ init_client();
27209
+ init_output();
27210
+ init_helpers();
27211
+ init_utils();
27212
+ init_expected();
27213
+ init_terminal_output();
27214
+ STORAGE_OFF = "secret_storage_unavailable";
27215
+ VALUE_MISSING = "credential_value_not_storable";
27216
+ RULE_NOT_COVERING = "credential_rule_not_covering";
27217
+ RULE_REFUSED = "credential_rule_refused";
27218
+ CREDENTIAL_REF = "credential:";
27219
+ }
27220
+ });
27221
+
26978
27222
  // src/data/config-as-code/sync.ts
26979
27223
  var sync_exports = {};
26980
27224
  __export(sync_exports, {
@@ -27016,6 +27260,19 @@ async function mirrorLinkedProduction(client, basesDir, originId) {
27016
27260
  );
27017
27261
  }
27018
27262
  }
27263
+ async function applyRefusedCredentialsAgain(client, baseId, config) {
27264
+ try {
27265
+ return await applyConfig(client, baseId, config);
27266
+ } catch (err) {
27267
+ if (!isUncoveredCredentialRefusal(err)) throw err;
27268
+ const message = refusalMessage(err);
27269
+ console.error(`
27270
+ ${RED}${sanitizeTerminalText(message)}${RESET}`);
27271
+ const sources = config.record_types.flatMap((rt) => rt.sources ?? []);
27272
+ if (!await reenterRefusedCredentials(client, baseId, message, sources)) throw err;
27273
+ return applyConfig(client, baseId, config);
27274
+ }
27275
+ }
27019
27276
  async function pullBase(gitRootOrNull, selector, args2) {
27020
27277
  const { autoConfirm } = parseArgs5(args2);
27021
27278
  const gitRoot = requireGitRoot(gitRootOrNull);
@@ -27158,7 +27415,7 @@ Apply these changes to preview "${sanitizeTerminalText(baseId)}"?`);
27158
27415
  return;
27159
27416
  }
27160
27417
  }
27161
- const result = await applyConfig(client, baseId, config);
27418
+ const result = await applyRefusedCredentialsAgain(client, baseId, config);
27162
27419
  warnUnsignedTriggers(result.unsigned_triggers);
27163
27420
  const removals = collectRemovals(diff);
27164
27421
  if (removals.length > 0) {
@@ -27202,6 +27459,7 @@ var init_sync = __esm({
27202
27459
  init_base_workspace();
27203
27460
  init_types2();
27204
27461
  init_triggers();
27462
+ init_credentials();
27205
27463
  }
27206
27464
  });
27207
27465
 
@@ -36787,7 +37045,7 @@ var init_eval_results = __esm({
36787
37045
 
36788
37046
  // src/lib/call-eval/caller-audio.ts
36789
37047
  import { createHash as createHash4 } from "crypto";
36790
- import { mkdirSync as mkdirSync16, readFileSync as readFileSync18, renameSync as renameSync8, writeFileSync as writeFileSync9 } from "fs";
37048
+ import { mkdirSync as mkdirSync16, readFileSync as readFileSync19, renameSync as renameSync8, writeFileSync as writeFileSync9 } from "fs";
36791
37049
  import { homedir as homedir6 } from "os";
36792
37050
  import { dirname as dirname18, isAbsolute as isAbsolute2, join as join40, resolve as resolve16 } from "path";
36793
37051
  function parseWav(buf, name = "clip") {
@@ -36881,7 +37139,7 @@ var init_caller_audio = __esm({
36881
37139
  if (!path55) throw new Error(`Line ${line.n} has no clip: give --clips <dir>, or a "clip" for it in the plan.`);
36882
37140
  let buf;
36883
37141
  try {
36884
- buf = readFileSync18(path55);
37142
+ buf = readFileSync19(path55);
36885
37143
  } catch {
36886
37144
  throw new Error(`Line ${line.n}'s clip ${path55} cannot be read.`);
36887
37145
  }
@@ -36925,7 +37183,7 @@ ${text5}`).digest("hex");
36925
37183
  }
36926
37184
  async readOrSynthesize(line, path55) {
36927
37185
  try {
36928
- return pcmClip(readFileSync18(path55));
37186
+ return pcmClip(readFileSync19(path55));
36929
37187
  } catch {
36930
37188
  }
36931
37189
  const res = await this.doFetch("https://api.openai.com/v1/audio/speech", {
@@ -38431,7 +38689,7 @@ __export(eval_call_exports, {
38431
38689
  printEvalCallHelp: () => printEvalCallHelp,
38432
38690
  suiteExitCode: () => suiteExitCode
38433
38691
  });
38434
- import { accessSync, constants as fsConstants, existsSync as existsSync17, readFileSync as readFileSync19, statSync as statSync10, writeFileSync as writeFileSync10 } from "fs";
38692
+ import { accessSync, constants as fsConstants, existsSync as existsSync17, readFileSync as readFileSync20, statSync as statSync10, writeFileSync as writeFileSync10 } from "fs";
38435
38693
  import { dirname as dirname19, resolve as resolve17 } from "path";
38436
38694
  function fail(message) {
38437
38695
  throw new Error(message);
@@ -38589,7 +38847,7 @@ async function evalCallCommand(argv) {
38589
38847
  let plan;
38590
38848
  try {
38591
38849
  options = parseEvalCallArgs(args2);
38592
- plan = options.planPath ? parseCallPlan(JSON.parse(readFileSync19(options.planPath, "utf8"))) : { lines: {} };
38850
+ plan = options.planPath ? parseCallPlan(JSON.parse(readFileSync20(options.planPath, "utf8"))) : { lines: {} };
38593
38851
  } catch (err) {
38594
38852
  console.error(extractApiMessage(err));
38595
38853
  process.exit(1);
@@ -43067,6 +43325,10 @@ async function caseReceivedAdd(session, file, opts) {
43067
43325
  console.log(`${one2(received.title)} registered in ${phase.folder}/received/ of ${session.connection.code}: ${received.received_id}`);
43068
43326
  if (received.text_origin === "agent") console.log("Its text is marked as converted by an agent, for whoever reviews it.");
43069
43327
  }
43328
+ function markedThroughout(work) {
43329
+ const rows = [...work.inputs, ...work.items, ...work.items.flatMap((i) => i.item_links.depends_on)];
43330
+ return rows.every((row) => typeof row.confidential === "boolean");
43331
+ }
43070
43332
  function documentHere(root, record, bound) {
43071
43333
  const folder = bound.endsWith("/");
43072
43334
  try {
@@ -43086,13 +43348,14 @@ async function caseSkeleton(session, clone, opts) {
43086
43348
  if (opts.confidential && !holdsRight) {
43087
43349
  throw expected(`This machine's authorization on case ${detail.code} does not hold the Confidential right, so --confidential reads nothing more. Run it without --confidential.`);
43088
43350
  }
43089
- if (!opts.confidential && holdsRight) throw expected(SKELETON_CONFIDENTIAL_REQUIRED);
43090
43351
  const mirror = mirrorFolder(clone.root);
43091
43352
  if (!mirror) throw undelivered();
43092
43353
  const phaseFolders = detail.phases.map((p) => p.folder);
43093
43354
  assertClonePaths(clone.root, clone.record, phaseFolders);
43094
43355
  const phase = findPhase(detail, opts.phase);
43095
43356
  const work = (await call2(session, () => session.api.getCasePhaseWork(session.connection, phase.phase_id))).data;
43357
+ if (!opts.confidential && holdsRight && !markedThroughout(work)) throw expected(SKELETON_CONFIDENTIAL_REQUIRED);
43358
+ const workItems = opts.confidential ? work.items : work.items.filter((i) => i.confidential !== true);
43096
43359
  const outputs = opts.output === void 0 ? work.outputs : work.outputs.filter((o) => o.code === opts.output);
43097
43360
  if (opts.output !== void 0 && outputs.length === 0) {
43098
43361
  throw expected(`Phase ${phase.folder} has no output ${JSON.stringify(sanitizeTerminalText(opts.output))}. Its outputs: ${work.outputs.map((o) => one2(o.code)).join(", ") || "none"}.`);
@@ -43116,7 +43379,7 @@ async function caseSkeleton(session, clone, opts) {
43116
43379
  if (bad.length) return null;
43117
43380
  if (output.format === "file") return { code: code2, skipped: "a file piece, sent as it comes: it has no items to start from" };
43118
43381
  if (output.dispensation) return { code: code2, skipped: "dispensed" };
43119
- const items = work.items.filter((i) => i.output_id === output.id && !i.dispensation);
43382
+ const items = workItems.filter((i) => i.output_id === output.id && !i.dispensation);
43120
43383
  const malformed = items.filter((i) => !CASE_CODE_PATTERN.test(i.code));
43121
43384
  for (const i of malformed) problems2.push(`output ${code2}: ${JSON.stringify(sanitizeTerminalText(i.code))} is no item code`);
43122
43385
  if (malformed.length) return null;
@@ -43176,8 +43439,10 @@ async function caseSkeleton(session, clone, opts) {
43176
43439
  if (plan.missing.length) console.log(` Attributes the case holds no value for, left as {{fill: \u2026}}: ${plan.missing.map(one2).join(", ")}.`);
43177
43440
  }
43178
43441
  if (wrote) console.log("Replace each {{fill: \u2026}} with its text, then push.");
43442
+ if (!opts.confidential) console.log(`
43443
+ ${SKELETON_CONFIDENTIAL_NOTICE}`);
43179
43444
  }
43180
- var NOTE_PAGES_READ, NOTES_PAGE, AGENDA_PAGES_READ2, one2, loadCase, loadState, phaseLabel, statusWords, CaseNames, AWAITING, readsWork, PHASES_VIEW_NOTE, noteLine, blockerKey, SKELETON_CONFIDENTIAL_REQUIRED;
43445
+ var NOTE_PAGES_READ, NOTES_PAGE, AGENDA_PAGES_READ2, one2, loadCase, loadState, phaseLabel, statusWords, CaseNames, AWAITING, readsWork, PHASES_VIEW_NOTE, noteLine, blockerKey, SKELETON_CONFIDENTIAL_REQUIRED, SKELETON_CONFIDENTIAL_NOTICE;
43181
43446
  var init_case_work = __esm({
43182
43447
  "src/cases/case-work.ts"() {
43183
43448
  "use strict";
@@ -43276,7 +43541,8 @@ var init_case_work = __esm({
43276
43541
  return "";
43277
43542
  }
43278
43543
  };
43279
- SKELETON_CONFIDENTIAL_REQUIRED = "This machine's authorization holds the Confidential right, so the phase's items WayAI answers it may include confidential ones, which this version of the CLI cannot yet leave out: a document at an open path could carry them. Run skeleton with --confidential, which writes the documents under conf/.";
43544
+ SKELETON_CONFIDENTIAL_REQUIRED = "This machine's authorization holds the Confidential right, so the phase's items WayAI answers it may include confidential ones, and its answer does not mark which they are (a server before the marking sends none): a document at an open path could carry them. Run skeleton with --confidential, which writes the documents under conf/.";
43545
+ SKELETON_CONFIDENTIAL_NOTICE = "Confidential items are left out of these documents unless you pass --confidential.";
43280
43546
  }
43281
43547
  });
43282
43548
 
@@ -44575,8 +44841,8 @@ skeleton Write the starting document of each of a phase's outputs into the
44575
44841
  {{fill: \u2026}}. It never overwrites: an output whose document is
44576
44842
  already here is skipped. A template that differs from the
44577
44843
  published manifest refuses the run. --output names one output.
44578
- An authorization holding the Confidential right needs
44579
- --confidential, which writes the documents under conf/ with the
44844
+ Without --confidential, confidential items are left out of the
44845
+ documents. --confidential writes them whole under conf/, with the
44580
44846
  confidential templates a \`pull --mirror-only --confidential\`
44581
44847
  delivered.
44582
44848
  note Add a note (an observation unless --kind says otherwise). A
@@ -45248,7 +45514,7 @@ var init_file_map = __esm({
45248
45514
  });
45249
45515
 
45250
45516
  // ../../packages/core/dist/contracts/vault.js
45251
- var vaultIdSchema, vaultFailureOutcomeSchema, vaultRefreshCategorySchema, vaultFailureBodySchema, VAULT_BASE_SOURCE_MAX_REFS, VAULT_VALUE_MAX_BYTES, vaultSendEnvelopeSchema, vaultVerifyEnvelopeSchema, vaultAutomationHmacEnvelopeSchema, vaultAutomationStaticEnvelopeSchema, AUTOMATION_WEBHOOK_VAULT_GATE_ID, GITHUB_APP_VAULT_GATE_ID, vaultVerifyResponseSchema, vaultVersionSchema, vaultPutResponseSchema, vaultDeleteResponseSchema, vaultInstantSchema, vaultMetaResponseSchema, vaultRefreshResponseSchema, vaultMintResponseSchema, vaultSignEnvelopeSchema, VAULT_SIGN_MAX_BODY_BYTES, vaultSignResponseSchema;
45517
+ var vaultIdSchema, vaultFailureOutcomeSchema, vaultRefreshCategorySchema, vaultFailureBodySchema, VAULT_BASE_SOURCE_MAX_REFS, VAULT_VALUE_MAX_BYTES, vaultSendEnvelopeSchema, vaultVerifyEnvelopeSchema, vaultAutomationHmacEnvelopeSchema, vaultAutomationStaticEnvelopeSchema, AUTOMATION_WEBHOOK_VAULT_GATE_ID, GITHUB_APP_VAULT_GATE_ID, BASE_SOURCE_VAULT_GATE_ID, vaultVerifyResponseSchema, vaultVersionSchema, vaultPutResponseSchema, vaultDeleteResponseSchema, vaultInstantSchema, vaultMetaResponseSchema, vaultRefreshResponseSchema, vaultMintResponseSchema, vaultSignEnvelopeSchema, VAULT_SIGN_MAX_BODY_BYTES, vaultSignResponseSchema;
45252
45518
  var init_vault = __esm({
45253
45519
  "../../packages/core/dist/contracts/vault.js"() {
45254
45520
  "use strict";
@@ -45319,6 +45585,7 @@ var init_vault = __esm({
45319
45585
  vaultAutomationStaticEnvelopeSchema = external_exports.object({}).strict();
45320
45586
  AUTOMATION_WEBHOOK_VAULT_GATE_ID = "c2d6f1a4-7e3b-4f1a-9b8d-6a1f4e7c3b20";
45321
45587
  GITHUB_APP_VAULT_GATE_ID = "fff3a999-e46a-483d-a50b-ab9d01bcb707";
45588
+ BASE_SOURCE_VAULT_GATE_ID = "bdf54b42-0f2c-4627-8474-a442f725d0ce";
45322
45589
  vaultVerifyResponseSchema = external_exports.object({});
45323
45590
  vaultVersionSchema = external_exports.number().int().positive();
45324
45591
  vaultPutResponseSchema = external_exports.object({ version: vaultVersionSchema });
@@ -47680,7 +47947,7 @@ Usage:
47680
47947
 
47681
47948
  wayai admin vault-gate status [--json] Print the vault_connector_ids list (on production it decides only Instagram's and base credentials' gates: the backend's vault-gate.ts)
47682
47949
  wayai admin vault-gate add <connector> [--yes] [--json]
47683
- List a connector: a vault connector's name (e.g. telegram, whatsapp, instagram, or openai for its LLM, STT and TTS ids, never GPT-Live's) or one catalog id (GPT-Live's only so); prints before and after, confirms unless --yes
47950
+ List a connector: a vault connector's name (e.g. telegram, whatsapp, instagram, base_source for new base credentials, or openai for its LLM, STT and TTS ids, never GPT-Live's) or one catalog id (GPT-Live's only so); prints before and after, confirms unless --yes
47684
47951
  wayai admin vault-gate remove <connector> [--yes] [--json]
47685
47952
  Stop listing it: its new credentials no longer go to the vault (on production only Instagram's and base credentials' gates read the list)
47686
47953
 
@@ -47930,7 +48197,8 @@ var init_admin = __esm({
47930
48197
  ["resend", ["a1b2c3d4-e5f6-4a89-b012-3e5e0d000001"]],
47931
48198
  ["claude_managed_agents", ["4b8eeecf-a835-444a-abed-516d0a29cee2"]],
47932
48199
  ["github_app", [GITHUB_APP_VAULT_GATE_ID]],
47933
- ["api_channel", ["a1b2c3d4-e5f6-4a89-b012-3e5e0d000003"]]
48200
+ ["api_channel", ["a1b2c3d4-e5f6-4a89-b012-3e5e0d000003"]],
48201
+ ["base_source", [BASE_SOURCE_VAULT_GATE_ID]]
47934
48202
  ]);
47935
48203
  VAULT_GATE_BY_ID_ONLY = /* @__PURE__ */ new Map([
47936
48204
  ["01e7b19c-bc94-43f4-a780-ad5a22fb7127", "openai"]
@@ -48402,9 +48670,9 @@ var init_update = __esm({
48402
48670
  });
48403
48671
 
48404
48672
  // src/data/commands/actions.ts
48405
- import { Command as Command2 } from "commander";
48673
+ import { Command as Command3 } from "commander";
48406
48674
  function buildActionsCommand() {
48407
- const actions = new Command2("actions").description(
48675
+ const actions = new Command3("actions").description(
48408
48676
  "Manage Actions \u2014 reusable, named definitions: one record_type + one operation, or a composite of atomic write steps (--config with `steps`)"
48409
48677
  );
48410
48678
  actions.command("upsert <id>").description(
@@ -48473,8 +48741,8 @@ var init_actions = __esm({
48473
48741
  });
48474
48742
 
48475
48743
  // src/data/commands/attachments.ts
48476
- import { Command as Command3 } from "commander";
48477
- import { readFileSync as readFileSync22 } from "fs";
48744
+ import { Command as Command4 } from "commander";
48745
+ import { readFileSync as readFileSync23 } from "fs";
48478
48746
  function findAttachmentByFilename(attachments, filename) {
48479
48747
  return attachments.find((a) => a.key.endsWith(`/${filename}`)) ?? null;
48480
48748
  }
@@ -48500,7 +48768,7 @@ function uploadPathFrom(uploadUrl) {
48500
48768
  return uploadUrl;
48501
48769
  }
48502
48770
  function buildAttachmentsCommand() {
48503
- const attachments = new Command3("attachments").description("Manage record attachments");
48771
+ const attachments = new Command4("attachments").description("Manage record attachments");
48504
48772
  attachments.command("upload <record_type> <id>").description(
48505
48773
  "Get a presigned upload URL for a record attachment. With --file, uploads the file content in one step."
48506
48774
  ).requiredOption("--filename <name>", "File name or path (e.g. docs/guide.md)").option("--content-type <type>", "MIME type", "application/octet-stream").option("--file <path>", "Local file to upload (skips presigned URL output, uploads directly)").action(async function(recordType2, id, opts) {
@@ -48515,7 +48783,7 @@ function buildAttachmentsCommand() {
48515
48783
  printOutput(data, outputFormat(this));
48516
48784
  return;
48517
48785
  }
48518
- const body = readFileSync22(opts.file);
48786
+ const body = readFileSync23(opts.file);
48519
48787
  await client.upload(uploadPathFrom(data?.upload_url), body, opts.contentType);
48520
48788
  printOutput({ ...data, uploaded: true }, outputFormat(this));
48521
48789
  });
@@ -48580,9 +48848,9 @@ var init_attachments = __esm({
48580
48848
  });
48581
48849
 
48582
48850
  // src/data/commands/batch.ts
48583
- import { Command as Command4 } from "commander";
48851
+ import { Command as Command5 } from "commander";
48584
48852
  function buildBasesBatchCommand() {
48585
- return withBaseOption(new Command4("batch")).description("Execute atomic batch operations (up to 1,000 operations)").requiredOption("--operations <json>", "Operations array (inline JSON or @filename)").action(async function(opts) {
48853
+ return withBaseOption(new Command5("batch")).description("Execute atomic batch operations (up to 1,000 operations)").requiredOption("--operations <json>", "Operations array (inline JSON or @filename)").action(async function(opts) {
48586
48854
  const base = pathSegment(requireBase(this), "--base");
48587
48855
  const operations = parseData(opts.operations, "--operations");
48588
48856
  const client = await createDataClient();
@@ -48611,7 +48879,7 @@ import { createReadStream } from "fs";
48611
48879
  import { access, constants as constants2, stat } from "fs/promises";
48612
48880
  import { createInterface as createInterface3 } from "readline";
48613
48881
  import { randomUUID as randomUUID2 } from "crypto";
48614
- import { Command as Command5 } from "commander";
48882
+ import { Command as Command6 } from "commander";
48615
48883
  function isRetryable(err) {
48616
48884
  if (isNetworkError(err)) return true;
48617
48885
  if (!(err instanceof ApiError)) return false;
@@ -48687,7 +48955,7 @@ async function beginSession(state, client, base, recordType2, requestKey) {
48687
48955
  return res.session;
48688
48956
  }
48689
48957
  function buildBasesImportCommand() {
48690
- const importCmd = withBaseOption(new Command5("import")).description(
48958
+ const importCmd = withBaseOption(new Command6("import")).description(
48691
48959
  "Bulk historical import: load an NDJSON backfill, list sessions, or undo one"
48692
48960
  );
48693
48961
  importCmd.command("run <record_type>").description(
@@ -48931,7 +49199,7 @@ var init_import = __esm({
48931
49199
  });
48932
49200
 
48933
49201
  // src/data/commands/providers.ts
48934
- import { Command as Command6 } from "commander";
49202
+ import { Command as Command7 } from "commander";
48935
49203
  import { writeFileSync as writeFileSync13 } from "fs";
48936
49204
  function providerSegment(provider) {
48937
49205
  if (!VALID_PROVIDERS.includes(provider)) {
@@ -48940,7 +49208,7 @@ function providerSegment(provider) {
48940
49208
  return pathSegment(provider, "provider");
48941
49209
  }
48942
49210
  function buildBasesProvidersCommand() {
48943
- const providers = withBaseOption(new Command6("providers")).description(
49211
+ const providers = withBaseOption(new Command7("providers")).description(
48944
49212
  "Import/export tool definitions between LLM providers and record types"
48945
49213
  );
48946
49214
  providers.command("import <provider>").description(`Import tool definitions as record types. Providers: ${VALID_PROVIDERS_HELP}`).requiredOption("--tools <json>", "Tool definitions (inline JSON or @filename)").action(async function(provider, opts) {
@@ -49010,83 +49278,9 @@ var init_providers = __esm({
49010
49278
  }
49011
49279
  });
49012
49280
 
49013
- // src/data/commands/credentials.ts
49014
- import { Command as Command7 } from "commander";
49015
- function withValueSourceOptions(cmd, what) {
49016
- return cmd.option("--file <path>", `Read ${what} from a file (unavailable for now)`).option("--value-stdin", `Read ${what} from stdin (unavailable for now)`).option("--value-prompt", `Prompt for ${what}, masked (unavailable for now)`);
49017
- }
49018
- function credentialPath(base, id) {
49019
- const root = `/v1/${pathSegment(base, "base id")}/credentials`;
49020
- return id === void 0 ? root : `${root}/${pathSegment(id, "credential id")}`;
49021
- }
49022
- function buildBasesCredentialsCommand() {
49023
- const credentials = withBaseOption(
49024
- new Command7("credentials").description("Manage a base's integration credentials")
49025
- );
49026
- withValueSourceOptions(
49027
- credentials.command("create").description("Store a credential on this base \u2014 unavailable for now").option("--name <name>", "Credential name").option("--content-type <mime>", "MIME type of the value").option("--expires-at <date>", "Expiry as ISO-8601").option("--no-sync-to-production", "Do not publish this credential on promote (unavailable for now)"),
49028
- "the credential value"
49029
- ).action(() => {
49030
- throw expected(STORAGE_UNAVAILABLE);
49031
- });
49032
- credentials.command("list").description("List this base's credentials (values are never returned)").action(async function() {
49033
- const base = requireBase(this);
49034
- const client = await createDataClient();
49035
- printOutput(
49036
- await client.request("GET", credentialPath(base)),
49037
- outputFormat(this)
49038
- );
49039
- });
49040
- credentials.command("get <id>").description("Get credential metadata (the value is never returned)").action(async function(id) {
49041
- const base = requireBase(this);
49042
- const client = await createDataClient();
49043
- printOutput(
49044
- await client.request("GET", credentialPath(base, id)),
49045
- outputFormat(this)
49046
- );
49047
- });
49048
- withValueSourceOptions(
49049
- credentials.command("rotate <id>").description("Install a new value \u2014 unavailable for now").option("--expires-at <date>", "Set the rotated credential's new expiry (ISO-8601)"),
49050
- "the new credential value"
49051
- ).action(() => {
49052
- throw expected(STORAGE_UNAVAILABLE);
49053
- });
49054
- credentials.command("set-sync <id>").description("Set the promote-time publish flag \u2014 unavailable for now: promotion carries no credential").option("--no-sync-to-production", "Do not publish this credential on promote (unavailable for now)").action(() => {
49055
- throw expected("Promotion carries no base credential for now, so the publish flag has no effect. Nothing was changed.");
49056
- });
49057
- credentials.command("delete <id>").description("Delete a direct credential").option("-y, --yes", "Skip confirmation prompt").action(async function(id, opts) {
49058
- const base = requireBase(this);
49059
- if (!opts.yes) {
49060
- if (!isInteractive()) {
49061
- throw expected("Refusing to delete without confirmation \u2014 pass --yes to delete non-interactively.");
49062
- }
49063
- if (!await confirm(`Delete credential ${id} on base ${base}? This cannot be undone.`)) {
49064
- console.log("Aborted");
49065
- return;
49066
- }
49067
- }
49068
- const client = await createDataClient();
49069
- await client.request("DELETE", credentialPath(base, id));
49070
- printOutput({ id, deleted: true }, outputFormat(this));
49071
- });
49072
- return credentials;
49073
- }
49074
- var STORAGE_UNAVAILABLE;
49075
- var init_credentials = __esm({
49076
- "src/data/commands/credentials.ts"() {
49077
- "use strict";
49078
- init_client();
49079
- init_output();
49080
- init_helpers();
49081
- init_utils();
49082
- init_expected();
49083
- STORAGE_UNAVAILABLE = `Storing a base credential is unavailable for now: ${BASE_SECRET_STORAGE_WHY}. Nothing was read or stored.`;
49084
- }
49085
- });
49086
-
49087
49281
  // src/data/commands/sql.ts
49088
49282
  import { Command as Command8 } from "commander";
49089
- import { readFileSync as readFileSync23 } from "fs";
49283
+ import { readFileSync as readFileSync24 } from "fs";
49090
49284
  function buildBasesSqlCommand() {
49091
49285
  return withBaseOption(new Command8("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(
49092
49286
  "--param <kv...>",
@@ -49096,7 +49290,7 @@ function buildBasesSqlCommand() {
49096
49290
  let query;
49097
49291
  if (opts.file) {
49098
49292
  try {
49099
- query = readFileSync23(opts.file, "utf-8").trim();
49293
+ query = readFileSync24(opts.file, "utf-8").trim();
49100
49294
  } catch (e) {
49101
49295
  throw expected(`--file ${opts.file}: ${e instanceof Error ? e.message : "could not be read"}`);
49102
49296
  }
@@ -49775,7 +49969,7 @@ var init_file_types = __esm({
49775
49969
 
49776
49970
  // src/data/commands/files.ts
49777
49971
  import { Command as Command12 } from "commander";
49778
- import { readFileSync as readFileSync24, writeFileSync as writeFileSync14 } from "fs";
49972
+ import { readFileSync as readFileSync25, writeFileSync as writeFileSync14 } from "fs";
49779
49973
  import { basename as basename31 } from "path";
49780
49974
  function renderFileDiff(fileType, filePath3, from, to, d) {
49781
49975
  console.log(sanitizeTerminalText(`${fileType}/${filePath3}: v${from} \u2192 v${to}`));
@@ -49832,7 +50026,7 @@ function buildFilesCommand() {
49832
50026
  label: opts.label,
49833
50027
  metadata: opts.metadata === void 0 ? void 0 : parseData(opts.metadata, "--metadata")
49834
50028
  });
49835
- const body = readFileSync24(opts.file);
50029
+ const body = readFileSync25(opts.file);
49836
50030
  const client = await createDataClient();
49837
50031
  printOutput(
49838
50032
  await client.upload(
@@ -50795,7 +50989,7 @@ init_errors3();
50795
50989
  init_mask_secrets();
50796
50990
  init_utils();
50797
50991
  init_registry();
50798
- import { readFileSync as readFileSync25 } from "fs";
50992
+ import { readFileSync as readFileSync26 } from "fs";
50799
50993
  import { fileURLToPath as fileURLToPath2 } from "url";
50800
50994
  import { dirname as dirname22, join as join49 } from "path";
50801
50995
 
@@ -50953,7 +51147,7 @@ Run \`wayai admin skill install\` to update.`);
50953
51147
 
50954
51148
  // src/index.ts
50955
51149
  var __dirname = dirname22(fileURLToPath2(import.meta.url));
50956
- var pkg = JSON.parse(readFileSync25(join49(__dirname, "..", "package.json"), "utf-8"));
51150
+ var pkg = JSON.parse(readFileSync26(join49(__dirname, "..", "package.json"), "utf-8"));
50957
51151
  var [, , command, ...args] = process.argv;
50958
51152
  var isBackgroundRefresh = command === REFRESH_COMMAND;
50959
51153
  if (!isBackgroundRefresh) initSentry(command, pkg.version);