@mutagent/cli 0.1.386 → 0.1.388

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 (3) hide show
  1. package/dist/bin/cli.js +2512 -190
  2. package/dist/index.js +30 -2
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -256,6 +256,18 @@ var init_known_secrets = __esm(() => {
256
256
  });
257
257
 
258
258
  // src/lib/config.ts
259
+ var exports_config = {};
260
+ __export(exports_config, {
261
+ setWorkspaceSelection: () => setWorkspaceSelection,
262
+ saveFullCredentials: () => saveFullCredentials,
263
+ saveCredentials: () => saveCredentials,
264
+ recordKeyScope: () => recordKeyScope,
265
+ loadConfig: () => loadConfig,
266
+ hasCredentials: () => hasCredentials,
267
+ getApiKey: () => getApiKey,
268
+ envKeyReplacesFile: () => envKeyReplacesFile,
269
+ clearCredentials: () => clearCredentials
270
+ });
259
271
  import { cosmiconfigSync } from "cosmiconfig";
260
272
  import { z } from "zod";
261
273
  import { homedir } from "os";
@@ -611,6 +623,7 @@ __export(exports_organization_scope, {
611
623
  setWorkspaceFlag: () => setWorkspaceFlag,
612
624
  setOrgAssertion: () => setOrgAssertion,
613
625
  resolveKeyTenancy: () => resolveKeyTenancy,
626
+ resetKeyScopeCache: () => resetKeyScopeCache,
614
627
  otherOrganizationHint: () => otherOrganizationHint,
615
628
  orgMismatch: () => orgMismatch,
616
629
  noWorkspaceSelected: () => noWorkspaceSelected,
@@ -773,6 +786,20 @@ async function probeKeyScope(apiKey, endpoint, workspaceNamed) {
773
786
  const fromFile = !envKeyReplacesFile();
774
787
  if (!fromFile && workspaceNamed && orgAssertion === undefined)
775
788
  return;
789
+ const cacheKey = `${endpoint}
790
+ ${apiKey}`;
791
+ const cached = keySelfProbes.get(cacheKey);
792
+ if (cached)
793
+ return cached;
794
+ const probe = readKeyScope(apiKey, endpoint, fromFile);
795
+ keySelfProbes.set(cacheKey, probe);
796
+ probe.catch(() => keySelfProbes.delete(cacheKey));
797
+ return probe;
798
+ }
799
+ function resetKeyScopeCache() {
800
+ keySelfProbes.clear();
801
+ }
802
+ async function readKeyScope(apiKey, endpoint, fromFile) {
776
803
  try {
777
804
  const self = await fetchKeySelf(apiKey, endpoint);
778
805
  if (fromFile)
@@ -856,7 +883,7 @@ async function findWorkspace(wanted, t) {
856
883
  const orgs = await fetchOrganizations(t.apiKey, t.endpoint);
857
884
  throw otherOrganizationHint(wanted, t.organization, orgs);
858
885
  }
859
- var TENANCY_DENIED = "TENANCY_DENIED", UUID_PATTERN, TenancyError, ENV_KEY_WORKSPACE_FIX = "Pass --workspace <name|id> or set MUTAGENT_WORKSPACE_ID", orgAssertion, workspaceFlag;
886
+ var TENANCY_DENIED = "TENANCY_DENIED", UUID_PATTERN, TenancyError, ENV_KEY_WORKSPACE_FIX = "Pass --workspace <name|id> or set MUTAGENT_WORKSPACE_ID", orgAssertion, workspaceFlag, keySelfProbes;
860
887
  var init_organization_scope = __esm(() => {
861
888
  init_errors();
862
889
  init_config();
@@ -867,6 +894,7 @@ var init_organization_scope = __esm(() => {
867
894
  this.name = "TenancyError";
868
895
  }
869
896
  };
897
+ keySelfProbes = new Map;
870
898
  });
871
899
 
872
900
  // src/lib/provider-request.ts
@@ -1699,4 +1727,4 @@ export {
1699
1727
  ApiError
1700
1728
  };
1701
1729
 
1702
- //# debugId=BEB715BD5D61FB5564756E2164756E21
1730
+ //# debugId=775F42A23F18BBFB64756E2164756E21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mutagent/cli",
3
- "version": "0.1.386",
3
+ "version": "0.1.388",
4
4
  "description": "Bun-native CLI for the MutagenT AI platform - auth, provider config, and lifecycle-tool installer for AI-native workflows",
5
5
  "type": "module",
6
6
  "bin": {