@vendian/cli 0.0.42 → 0.0.43

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/cli-wrapper.mjs +22 -2
  2. package/package.json +1 -1
package/cli-wrapper.mjs CHANGED
@@ -2500,7 +2500,7 @@ function buildLocalServeEventStreamArgs({ agentsDir: agentsDir2 = "./agents", co
2500
2500
  }
2501
2501
 
2502
2502
  // src/version.js
2503
- var CLI_VERSION = true ? "0.0.42" : process.env.npm_package_version || "0.0.0-dev";
2503
+ var CLI_VERSION = true ? "0.0.43" : process.env.npm_package_version || "0.0.0-dev";
2504
2504
 
2505
2505
  // src/dev-server.js
2506
2506
  var __dirname = path8.dirname(fileURLToPath(import.meta.url));
@@ -2513,6 +2513,7 @@ var logStore = null;
2513
2513
  var agentsDir = "";
2514
2514
  var activeServeAgentsDir = "";
2515
2515
  var collectionId = "";
2516
+ var activeAuthLogin = null;
2516
2517
  async function startDevServer({
2517
2518
  port = 3859,
2518
2519
  agents = "",
@@ -2828,13 +2829,32 @@ async function loginOrActivateBackend({ backend, env, setupFn, statusFn, activat
2828
2829
  }
2829
2830
  async function apiAuthLogin(req, res, body) {
2830
2831
  try {
2831
- const result = await loginOrActivateBackend({ backend: body.backend });
2832
+ const result = await runSingleAuthLogin({ backend: body.backend });
2832
2833
  const status = result.ok ? 200 : 400;
2833
2834
  jsonResponse(res, result, status);
2834
2835
  } catch (err) {
2835
2836
  jsonResponse(res, { ok: false, error: err.message || "Login failed" }, 500);
2836
2837
  }
2837
2838
  }
2839
+ async function runSingleAuthLogin({ backend, loginFn } = {}) {
2840
+ if (activeAuthLogin?.promise) {
2841
+ if (activeAuthLogin.backend !== backend) {
2842
+ return {
2843
+ ok: false,
2844
+ error: `A Vendian sign-in is already in progress for ${activeAuthLogin.backend}. Finish that browser flow or wait for it to close, then try ${backend} again.`
2845
+ };
2846
+ }
2847
+ return activeAuthLogin.promise;
2848
+ }
2849
+ const executeLogin = loginFn || loginOrActivateBackend;
2850
+ const promise = Promise.resolve().then(() => executeLogin({ backend })).finally(() => {
2851
+ if (activeAuthLogin?.promise === promise) {
2852
+ activeAuthLogin = null;
2853
+ }
2854
+ });
2855
+ activeAuthLogin = { backend, promise };
2856
+ return promise;
2857
+ }
2838
2858
  async function apiValidate(req, res, body) {
2839
2859
  const targetPath = body.path || agentsDir;
2840
2860
  const invocation = await preparePythonVendianInvocation(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vendian/cli",
3
- "version": "0.0.42",
3
+ "version": "0.0.43",
4
4
  "description": "Public Vendian CLI bootstrapper and launcher",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,