chatlab-cli 0.27.1 → 0.27.2

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 (64) hide show
  1. package/dist/{chat-command-B7POB3C3.mjs → chat-command-QVCZVDSB.mjs} +5 -5
  2. package/dist/{chunk-I7BHOZPX.mjs → chunk-B2VLK3FB.mjs} +35 -2
  3. package/dist/{chunk-I7BHOZPX.mjs.map → chunk-B2VLK3FB.mjs.map} +1 -1
  4. package/dist/{chunk-N3G43SCQ.mjs → chunk-DHRSLYUM.mjs} +105 -9
  5. package/dist/chunk-DHRSLYUM.mjs.map +1 -0
  6. package/dist/{chunk-3JNVGW62.mjs → chunk-H22VDCPB.mjs} +2 -2
  7. package/dist/{chunk-SIVERPF5.mjs → chunk-JOXF6ROV.mjs} +44 -9
  8. package/dist/chunk-JOXF6ROV.mjs.map +1 -0
  9. package/dist/{chunk-3FUF3PEY.mjs → chunk-K7UUN3HT.mjs} +11 -11
  10. package/dist/{chunk-SAE2H2LN.mjs → chunk-MDDWX2MG.mjs} +3 -3
  11. package/dist/{chunk-WQMKKUSD.mjs → chunk-OD3YH23N.mjs} +2 -2
  12. package/dist/{chunk-RJ4D4QWK.mjs → chunk-PXWAYFII.mjs} +3 -3
  13. package/dist/{chunk-YUFYTDRH.mjs → chunk-ST5APJB2.mjs} +3 -3
  14. package/dist/cli.mjs +4 -4
  15. package/dist/{http-A54ZBBAY.mjs → http-LSCVGWCI.mjs} +9 -9
  16. package/dist/{import-EA3TB3S2.mjs → import-E6HBJMMT.mjs} +5 -5
  17. package/dist/index.mjs +9 -9
  18. package/dist/{mcp-DJDOWHH3.mjs → mcp-I7JUC5JV.mjs} +5 -5
  19. package/dist/semantic-index-worker.mjs +1 -1
  20. package/dist/{src-EKPMJRG6.mjs → src-HZILDI7C.mjs} +5 -3
  21. package/dist/{stream-import-FQFNRQ2B.mjs → stream-import-IMRULRS2.mjs} +4 -4
  22. package/dist/{worker-runtime-UH2OBO3T.mjs → worker-runtime-WWQ7W74Q.mjs} +2 -2
  23. package/dist-web/assets/{DebugToolsPanel.vue_vue_type_script_setup_true_lang-NL1sTF6i.js → DebugToolsPanel.vue_vue_type_script_setup_true_lang-Du1FDD8L.js} +4 -4
  24. package/dist-web/assets/{MessageExportModal-B60rvfCh.js → MessageExportModal-4ehLHG4x.js} +1 -1
  25. package/dist-web/assets/{electron-BRUg9LnY.js → electron-B3AteJC8.js} +1 -1
  26. package/dist-web/assets/electron-DGxVMsvC.js +1 -0
  27. package/dist-web/assets/{fetch-BIpjJHxj.js → fetch-BQxv_UGQ.js} +1 -1
  28. package/dist-web/assets/{fetch-DSN-QYZE.js → fetch-BUcl-Frr.js} +1 -1
  29. package/dist-web/assets/{fetch-DE8gj5Ke.js → fetch-BwQh9WUD.js} +1 -1
  30. package/dist-web/assets/{fetch-woAa3H2L.js → fetch-C2mSdG3h.js} +1 -1
  31. package/dist-web/assets/{fetch-Cma-mZjd.js → fetch-CZDFhvxY.js} +1 -1
  32. package/dist-web/assets/{fetch-DNSaxRnL.js → fetch-ChZEF_n3.js} +1 -1
  33. package/dist-web/assets/{fetch-BRsMdFcn.js → fetch-DCQN6wfR.js} +1 -1
  34. package/dist-web/assets/{fetch-DLAp7h55.js → fetch-DZFx8FA4.js} +1 -1
  35. package/dist-web/assets/{fetch-C-m3IysH.js → fetch-DlJFgbum.js} +1 -1
  36. package/dist-web/assets/{fetch-DOEbyLSD.js → fetch-O8M5ZWsc.js} +1 -1
  37. package/dist-web/assets/index-B_uZZGqi.js +173 -0
  38. package/dist-web/assets/{index-YmzTgkb2.css → index-CoX0L-A8.css} +1 -1
  39. package/dist-web/assets/{index-B3mDjury.js → index-DR78oafF.js} +7 -7
  40. package/dist-web/assets/{index-iwqJDVMJ.js → index-DTlfOd_u.js} +2 -2
  41. package/dist-web/assets/{index-r_zHR2t9.js → index-DlkH2E7N.js} +1 -1
  42. package/dist-web/assets/{index-B9I-Y3fR.js → index-KAFPL6dl.js} +1 -1
  43. package/dist-web/assets/{index-o6veAyTB.js → index-qVTX1tLg.js} +3 -3
  44. package/dist-web/assets/web-CoKgy4Oo.js +1 -0
  45. package/dist-web/index.html +2 -2
  46. package/package.json +1 -1
  47. package/dist/chunk-N3G43SCQ.mjs.map +0 -1
  48. package/dist/chunk-SIVERPF5.mjs.map +0 -1
  49. package/dist-web/assets/electron-CRSL7qPM.js +0 -1
  50. package/dist-web/assets/index-GAU7LI1r.js +0 -173
  51. package/dist-web/assets/web-C2UtGskd.js +0 -1
  52. /package/dist/{chat-command-B7POB3C3.mjs.map → chat-command-QVCZVDSB.mjs.map} +0 -0
  53. /package/dist/{chunk-3JNVGW62.mjs.map → chunk-H22VDCPB.mjs.map} +0 -0
  54. /package/dist/{chunk-3FUF3PEY.mjs.map → chunk-K7UUN3HT.mjs.map} +0 -0
  55. /package/dist/{chunk-SAE2H2LN.mjs.map → chunk-MDDWX2MG.mjs.map} +0 -0
  56. /package/dist/{chunk-WQMKKUSD.mjs.map → chunk-OD3YH23N.mjs.map} +0 -0
  57. /package/dist/{chunk-RJ4D4QWK.mjs.map → chunk-PXWAYFII.mjs.map} +0 -0
  58. /package/dist/{chunk-YUFYTDRH.mjs.map → chunk-ST5APJB2.mjs.map} +0 -0
  59. /package/dist/{http-A54ZBBAY.mjs.map → http-LSCVGWCI.mjs.map} +0 -0
  60. /package/dist/{import-EA3TB3S2.mjs.map → import-E6HBJMMT.mjs.map} +0 -0
  61. /package/dist/{mcp-DJDOWHH3.mjs.map → mcp-I7JUC5JV.mjs.map} +0 -0
  62. /package/dist/{src-EKPMJRG6.mjs.map → src-HZILDI7C.mjs.map} +0 -0
  63. /package/dist/{stream-import-FQFNRQ2B.mjs.map → stream-import-IMRULRS2.mjs.map} +0 -0
  64. /package/dist/{worker-runtime-UH2OBO3T.mjs.map → worker-runtime-WWQ7W74Q.mjs.map} +0 -0
@@ -6,10 +6,10 @@ const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __pathDirname(__filename);
7
7
  import {
8
8
  createCliRunAgentStream
9
- } from "./chunk-RJ4D4QWK.mjs";
10
- import "./chunk-WQMKKUSD.mjs";
11
- import "./chunk-N3G43SCQ.mjs";
12
- import "./chunk-I7BHOZPX.mjs";
9
+ } from "./chunk-PXWAYFII.mjs";
10
+ import "./chunk-OD3YH23N.mjs";
11
+ import "./chunk-DHRSLYUM.mjs";
12
+ import "./chunk-B2VLK3FB.mjs";
13
13
  import "./chunk-GFHSSCCR.mjs";
14
14
 
15
15
  // src/ai/chat-command.ts
@@ -302,4 +302,4 @@ export {
302
302
  runChatCommand,
303
303
  runChatTurn
304
304
  };
305
- //# sourceMappingURL=chat-command-B7POB3C3.mjs.map
305
+ //# sourceMappingURL=chat-command-QVCZVDSB.mjs.map
@@ -200,6 +200,14 @@ function writeAuthProfile(name, profile) {
200
200
  const filePath = getAuthProfilesPath();
201
201
  fs2.writeFileSync(filePath, JSON.stringify(data, null, 2), { encoding: "utf-8", mode: 384 });
202
202
  }
203
+ function deleteAuthProfile(name) {
204
+ const data = loadAuthProfiles();
205
+ if (!(name in data.profiles)) return false;
206
+ delete data.profiles[name];
207
+ const filePath = getAuthProfilesPath();
208
+ fs2.writeFileSync(filePath, JSON.stringify(data, null, 2), { encoding: "utf-8", mode: 384 });
209
+ return true;
210
+ }
203
211
 
204
212
  // ../../packages/config/src/migrations/runner.ts
205
213
  import * as fs3 from "fs";
@@ -12678,11 +12686,22 @@ function resolveSlot(slot, configs) {
12678
12686
  const fallback = configs[0];
12679
12687
  return fallback ? { configId: fallback.id, modelId: fallback.model || "" } : null;
12680
12688
  }
12689
+ function getAuthProfile(config) {
12690
+ return config.authProfile;
12691
+ }
12692
+ function isAuthProfileUsed(configs, authProfile, profileProvider) {
12693
+ return configs.some((config) => {
12694
+ const configAuthProfile = getAuthProfile(config);
12695
+ if (configAuthProfile === authProfile) return true;
12696
+ return !configAuthProfile && profileProvider !== void 0 && config.provider === profileProvider;
12697
+ });
12698
+ }
12681
12699
  var LLMConfigStore = class {
12682
12700
  storage;
12683
12701
  t;
12684
12702
  generateId;
12685
12703
  onApiKeyCreated;
12704
+ onApiKeyDeleted;
12686
12705
  resolveApiKey;
12687
12706
  onStoreLoaded;
12688
12707
  constructor(storage, deps = {}) {
@@ -12690,6 +12709,7 @@ var LLMConfigStore = class {
12690
12709
  this.t = deps.t || defaultT;
12691
12710
  this.generateId = deps.generateId || defaultGenerateId;
12692
12711
  this.onApiKeyCreated = deps.onApiKeyCreated;
12712
+ this.onApiKeyDeleted = deps.onApiKeyDeleted;
12693
12713
  this.resolveApiKey = deps.resolveApiKey;
12694
12714
  this.onStoreLoaded = deps.onStoreLoaded;
12695
12715
  }
@@ -12788,20 +12808,27 @@ var LLMConfigStore = class {
12788
12808
  if (index === -1) {
12789
12809
  return { success: false, error: this.t("llm.configNotFound") };
12790
12810
  }
12811
+ const oldConfig = store.configs[index];
12812
+ const oldProfileName = oldConfig.authProfile;
12791
12813
  const updated = {
12792
- ...store.configs[index],
12814
+ ...oldConfig,
12793
12815
  ...updates,
12794
12816
  updatedAt: Date.now()
12795
12817
  };
12796
12818
  store.configs[index] = updated;
12819
+ let oldProfileToDelete = null;
12797
12820
  if (updates.apiKey && this.onApiKeyCreated) {
12798
12821
  const profileName = this.onApiKeyCreated(updated, updates.apiKey);
12799
12822
  if (profileName) {
12800
12823
  ;
12801
12824
  store.configs[index].authProfile = profileName;
12825
+ if (oldProfileName && oldProfileName !== profileName && !isAuthProfileUsed(store.configs, oldProfileName, oldConfig.provider)) {
12826
+ oldProfileToDelete = oldConfig;
12827
+ }
12802
12828
  }
12803
12829
  }
12804
12830
  this.saveStore(store);
12831
+ if (oldProfileToDelete) this.onApiKeyDeleted?.(oldProfileToDelete);
12805
12832
  return { success: true };
12806
12833
  }
12807
12834
  deleteConfig(id) {
@@ -12810,6 +12837,7 @@ var LLMConfigStore = class {
12810
12837
  if (index === -1) {
12811
12838
  return { success: false, error: this.t("llm.configNotFound") };
12812
12839
  }
12840
+ const deleted = store.configs[index];
12813
12841
  store.configs.splice(index, 1);
12814
12842
  const fallback = store.configs[0];
12815
12843
  if (store.defaultAssistant?.configId === id) {
@@ -12819,6 +12847,10 @@ var LLMConfigStore = class {
12819
12847
  store.fastModel = fallback ? { configId: fallback.id, modelId: fallback.model || "" } : null;
12820
12848
  }
12821
12849
  this.saveStore(store);
12850
+ const deletedProfileName = getAuthProfile(deleted);
12851
+ if (!deletedProfileName || !isAuthProfileUsed(store.configs, deletedProfileName, deleted.provider)) {
12852
+ this.onApiKeyDeleted?.(deleted);
12853
+ }
12822
12854
  return { success: true };
12823
12855
  }
12824
12856
  setDefaultAssistantModel(configId, modelId) {
@@ -17408,6 +17440,7 @@ export {
17408
17440
  writeConfigField,
17409
17441
  resolveApiKey,
17410
17442
  writeAuthProfile,
17443
+ deleteAuthProfile,
17411
17444
  MigrationRunner,
17412
17445
  ALL_MIGRATIONS,
17413
17446
  BetterSqliteAdapter,
@@ -17685,4 +17718,4 @@ export {
17685
17718
  createDatabaseManagerAdapter,
17686
17719
  MergeSessionCache
17687
17720
  };
17688
- //# sourceMappingURL=chunk-I7BHOZPX.mjs.map
17721
+ //# sourceMappingURL=chunk-B2VLK3FB.mjs.map