apiblaze 0.17.16 → 0.17.18

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.
Files changed (2) hide show
  1. package/dist/index.js +18 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -699,7 +699,7 @@ var import_commander = require("commander");
699
699
  var import_chalk38 = __toESM(require("chalk"));
700
700
 
701
701
  // package.json
702
- var version = "0.17.16";
702
+ var version = "0.17.18";
703
703
 
704
704
  // src/index.ts
705
705
  init_types();
@@ -5226,15 +5226,22 @@ var CLIENT_ROUND_CAP = 12;
5226
5226
  function chatUrl(p) {
5227
5227
  return `https://${p.mcpHost}/${p.version}/${p.environment}/runtime-chat`;
5228
5228
  }
5229
+ function maskKey(k) {
5230
+ return k.length <= 8 ? "****" : `${k.slice(0, 4)}\u2026${k.slice(-4)}`;
5231
+ }
5232
+ var revealAuth = false;
5229
5233
  function renderToolEvents(events, dpKey) {
5230
5234
  for (const e of events ?? []) {
5231
5235
  const ok = typeof e.status === "number" ? e.status < 400 : String(e.status).toLowerCase() === "ok";
5232
5236
  const mark = ok ? import_chalk33.default.green("\u2713") : import_chalk33.default.red("\u2717");
5233
5237
  console.log(` ${mark} ${import_chalk33.default.cyan(e.name)} ${import_chalk33.default.dim(`(${e.status}, ${e.ms}ms)`)}`);
5234
5238
  if (isVerbose() && e.method && e.url) {
5235
- const auth = dpKey ? ` \\
5236
- -H 'X-API-Key: ${maskSecret(dpKey)}'` : "";
5237
- console.log(import_chalk33.default.dim(` curl -sS -X ${e.method} '${e.url}'${auth}`));
5239
+ console.log(import_chalk33.default.dim(` curl -sS -X ${e.method} '${e.url}'${dpKey ? " \\" : ""}`));
5240
+ if (dpKey) {
5241
+ const keyLine = ` -H 'X-API-Key: ${revealAuth ? dpKey : maskKey(dpKey)}'`;
5242
+ const hint = revealAuth ? "" : import_chalk33.default.yellow(" \u2190 /showauth will reveal this");
5243
+ console.log(import_chalk33.default.dim(keyLine) + hint);
5244
+ }
5238
5245
  }
5239
5246
  }
5240
5247
  }
@@ -5405,7 +5412,7 @@ async function openServerProxy(project) {
5405
5412
  if (!dpKey) {
5406
5413
  console.log(import_chalk33.default.dim(` Minting an API key for tenant ${import_chalk33.default.bold(tenant2)} to query project ${import_chalk33.default.bold(project.projectName)}\u2026`));
5407
5414
  dpKey = await mintDurableProxyKey(project.teamId, tenant2);
5408
- console.log(` ${import_chalk33.default.green("\u2714")} API key: ${import_chalk33.default.dim(maskSecret(dpKey))}`);
5415
+ console.log(` ${import_chalk33.default.green("\u2714")} API key: ${import_chalk33.default.dim(maskKey(dpKey))}`);
5409
5416
  }
5410
5417
  const p = {
5411
5418
  projectId: project.projectId,
@@ -5610,8 +5617,13 @@ async function runRepl(p, initialMessages) {
5610
5617
  }
5611
5618
  continue;
5612
5619
  }
5620
+ if (text === "/showauth") {
5621
+ revealAuth = !revealAuth;
5622
+ console.log(import_chalk33.default.dim(revealAuth ? " The real API key will be shown in the next call's curl. /showauth again to re-mask." : " API key re-masked."));
5623
+ continue;
5624
+ }
5613
5625
  if (text.startsWith("/")) {
5614
- console.log(import_chalk33.default.dim(" Commands: /login /claim /exit"));
5626
+ console.log(import_chalk33.default.dim(" Commands: /login /claim /showauth /exit"));
5615
5627
  continue;
5616
5628
  }
5617
5629
  await replTurn(p, messages, text);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apiblaze",
3
- "version": "0.17.16",
3
+ "version": "0.17.18",
4
4
  "description": "APIblaze CLI — Chat with your APIs, Manage your API keys, users and groups with the APIblaze serverless proxy",
5
5
  "keywords": [
6
6
  "apiblaze",