apiblaze 0.17.10 → 0.17.12

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 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -699,7 +699,7 @@ var import_commander = require("commander");
699
699
  var import_chalk37 = __toESM(require("chalk"));
700
700
 
701
701
  // package.json
702
- var version = "0.17.10";
702
+ var version = "0.17.12";
703
703
 
704
704
  // src/index.ts
705
705
  init_types();
@@ -5026,7 +5026,7 @@ async function provision(spec2, target, opts) {
5026
5026
  }
5027
5027
  if (!base && spec2.info && typeof spec2.info.title === "string") base = normalizeName2(spec2.info.title);
5028
5028
  if (!base || base.length < 3) base = "apichat";
5029
- let name = opts.name ? base : `${base}-${salt()}`;
5029
+ let name = opts.name ? base : `${base}${salt()}`;
5030
5030
  const spinner = (0, import_ora16.default)("Provisioning an api_key proxy...").start();
5031
5031
  let result;
5032
5032
  for (let attempt = 0; attempt < 4; attempt++) {
@@ -5063,7 +5063,7 @@ async function provision(spec2, target, opts) {
5063
5063
  const status = err instanceof ApiError ? err.status : void 0;
5064
5064
  const collision = err instanceof ApiError && (err.status === 409 || /exist|taken|available/i.test(err.message));
5065
5065
  if (collision && attempt < 3) {
5066
- name = `${base}-${salt()}`;
5066
+ name = `${base}${salt()}`;
5067
5067
  continue;
5068
5068
  }
5069
5069
  if (status === 401) {
@@ -5338,6 +5338,16 @@ function saveTranscript(p, messages) {
5338
5338
  list[i].updatedAt = (/* @__PURE__ */ new Date()).toISOString();
5339
5339
  writeApichats(list);
5340
5340
  }
5341
+ function claimApichat(p, ownerUserId) {
5342
+ const list = loadApichats();
5343
+ const i = list.findIndex((a) => apichatKey(a) === apichatKey(p));
5344
+ if (i < 0) return;
5345
+ list[i].ownerUserId = ownerUserId;
5346
+ list[i].anon = false;
5347
+ list[i].mcpHost = p.mcpHost;
5348
+ list[i].updatedAt = (/* @__PURE__ */ new Date()).toISOString();
5349
+ writeApichats(list);
5350
+ }
5341
5351
  function discoverLocalSpecs() {
5342
5352
  const cwd = process.cwd();
5343
5353
  const known = ["openapi.yaml", "openapi.yml", "openapi.json", "swagger.yaml", "swagger.yml", "swagger.json", "api.yaml", "api.yml", "api.json"];
@@ -5365,7 +5375,8 @@ function discoverLocalSpecs() {
5365
5375
  }
5366
5376
  async function noArgsMenu(opts) {
5367
5377
  const { default: inquirer3 } = await import("inquirer");
5368
- const saved = loadApichats();
5378
+ const me = loadCredentials()?.apiblazeUserId;
5379
+ const saved = loadApichats().filter((a) => a.anon ? true : a.ownerUserId !== void 0 && a.ownerUserId === me);
5369
5380
  const choices = saved.map((a) => ({
5370
5381
  name: `Chat with ${import_chalk32.default.bold(a.name)} ${import_chalk32.default.dim(`(${a.target})${a.messages && a.messages.length ? ` \xB7 ${a.messages.length} msgs` : ""}`)}`,
5371
5382
  value: { type: "existing", a }
@@ -5471,6 +5482,7 @@ async function runRepl(p, initialMessages) {
5471
5482
  if (p.mcpHost.endsWith(".mcp.tryabz.run")) {
5472
5483
  p.mcpHost = p.mcpHost.replace(".mcp.tryabz.run", ".mcp.abz.run");
5473
5484
  p.anon = false;
5485
+ claimApichat(p, loadCredentials()?.apiblazeUserId);
5474
5486
  console.log(import_chalk32.default.dim(` Workspace claimed \u2014 chat now routes on ${p.mcpHost}. History preserved.`));
5475
5487
  }
5476
5488
  } catch (err) {
@@ -5520,6 +5532,8 @@ async function runApichat(opts) {
5520
5532
  mcpHost: p.mcpHost,
5521
5533
  dpKey: p.dpKey,
5522
5534
  anon: p.anon,
5535
+ ownerUserId: loadCredentials()?.apiblazeUserId,
5536
+ // undefined while anon
5523
5537
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
5524
5538
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
5525
5539
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apiblaze",
3
- "version": "0.17.10",
3
+ "version": "0.17.12",
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",