fss-link 1.1.1 → 1.1.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 (2) hide show
  1. package/bundle/fss-link.js +58 -6
  2. package/package.json +1 -1
@@ -22084,7 +22084,7 @@ async function createContentGeneratorConfig(config, authType) {
22084
22084
  async function createContentGenerator(config, gcConfig, sessionId2) {
22085
22085
  if (DEBUG_CONTENT)
22086
22086
  console.log(`\u{1F41B} DEBUG createContentGenerator: authType=${config.authType}, apiKey=${config.apiKey}, baseUrl=${config.baseUrl}`);
22087
- const version = "1.1.1";
22087
+ const version = "1.1.2";
22088
22088
  const userAgent = `FSS-Link/${version} (${process.platform}; ${process.arch})`;
22089
22089
  const baseHeaders = {
22090
22090
  "User-Agent": userAgent
@@ -71176,7 +71176,18 @@ var init_config = __esm({
71176
71176
  console.warn("Database configuration invalid - may need manual setup");
71177
71177
  }
71178
71178
  } else {
71179
- console.log("Using existing database configuration");
71179
+ const currentAuthType = await this.modelStateProvider.getCurrentAuthType();
71180
+ if (currentAuthType && currentAuthType !== authMethod) {
71181
+ console.log(`Auth type changed: ${currentAuthType} \u2192 ${authMethod}`);
71182
+ const switched = await this.modelStateProvider.switchToAuthType(authMethod);
71183
+ if (switched) {
71184
+ console.log(`\u2705 Switched to ${authMethod} model from database`);
71185
+ } else {
71186
+ console.warn(`\u26A0\uFE0F No ${authMethod} model in database, using defaults`);
71187
+ }
71188
+ } else {
71189
+ console.log("Using existing database configuration");
71190
+ }
71180
71191
  }
71181
71192
  } else {
71182
71193
  console.warn("No model state provider available - database-first authentication unavailable");
@@ -84722,6 +84733,48 @@ var init_modelManager = __esm({
84722
84733
  return false;
84723
84734
  }
84724
84735
  }
84736
+ /**
84737
+ * Switch to a model with the specified auth type
84738
+ * Finds the most recently used model with matching auth_type and activates it
84739
+ *
84740
+ * @param authType - The auth type to switch to
84741
+ * @returns true if a matching model was found and activated, false otherwise
84742
+ *
84743
+ * 🔒 MIGRATED: Uses UnifiedDatabase for thread-safe operations
84744
+ */
84745
+ async switchToAuthType(authType) {
84746
+ try {
84747
+ if (DEBUG_MODEL) console.log(`\u{1F512} [MODEL-MANAGER] Switching to auth type: ${authType}`);
84748
+ const db = await this.getDb();
84749
+ const models = await db.getModelsByAuthType(authType);
84750
+ if (models.length === 0) {
84751
+ if (DEBUG_MODEL) console.log(`\u274C [MODEL-MANAGER] No models found with auth_type: ${authType}`);
84752
+ return false;
84753
+ }
84754
+ models.sort((a, b) => {
84755
+ const aTime = a.lastUsed?.getTime() || 0;
84756
+ const bTime = b.lastUsed?.getTime() || 0;
84757
+ return bTime - aTime;
84758
+ });
84759
+ const modelToActivate = models[0];
84760
+ if (!modelToActivate.id) {
84761
+ console.error(`\u274C [MODEL-MANAGER] Model missing ID, cannot activate`);
84762
+ return false;
84763
+ }
84764
+ if (DEBUG_MODEL) {
84765
+ console.log(`\u2705 [MODEL-MANAGER] Found model: ${modelToActivate.displayName} (id=${modelToActivate.id})`);
84766
+ }
84767
+ await db.setActiveModel(modelToActivate.id);
84768
+ await this.updateEnvironmentFromModel(modelToActivate);
84769
+ if (DEBUG_MODEL) {
84770
+ console.log(`\u2705 [MODEL-MANAGER] Successfully switched to ${authType}/${modelToActivate.modelName}`);
84771
+ }
84772
+ return true;
84773
+ } catch (error) {
84774
+ console.error(`\u274C [MODEL-MANAGER] Failed to switch to auth type ${authType}:`, error);
84775
+ return false;
84776
+ }
84777
+ }
84725
84778
  /**
84726
84779
  * Get the currently active model
84727
84780
  *
@@ -84883,9 +84936,8 @@ var init_modelManager = __esm({
84883
84936
  let settings = {};
84884
84937
  try {
84885
84938
  const db = await this.getDb();
84886
- const providerModel = await db.getModelsByAuthType(model.authType);
84887
- if (providerModel && providerModel["id"]) {
84888
- settings = await db.getProviderSettings(providerModel["id"]);
84939
+ if (model.id) {
84940
+ settings = await db.getProviderSettings(model.id);
84889
84941
  }
84890
84942
  } catch (error) {
84891
84943
  console.warn("Failed to load provider settings:", error);
@@ -93876,7 +93928,7 @@ async function getPackageJson() {
93876
93928
  // packages/cli/src/utils/version.ts
93877
93929
  async function getCliVersion() {
93878
93930
  const pkgJson = await getPackageJson();
93879
- return "1.1.1";
93931
+ return "1.1.2";
93880
93932
  }
93881
93933
 
93882
93934
  // packages/cli/src/ui/commands/aboutCommand.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fss-link",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "engines": {
5
5
  "node": ">=20.0.0"
6
6
  },