fss-link 1.0.47 → 1.0.48

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.
@@ -208,6 +208,9 @@ export class FSSLinkDatabase {
208
208
  defaultOllamaConfig.created_at
209
209
  );
210
210
 
211
+ // Get the inserted Ollama config ID to add provider settings
212
+ const ollamaId = this.db.lastInsertRowid;
213
+
211
214
  // Also insert a default Gemini configuration (inactive) for when users want to configure API keys later
212
215
  const defaultGeminiConfig = {
213
216
  auth_type: 'use_gemini',
@@ -282,9 +285,66 @@ export class FSSLinkDatabase {
282
285
  defaultOpenAIConfig.last_used,
283
286
  defaultOpenAIConfig.created_at
284
287
  );
288
+
289
+ // Get all the provider IDs we just created for setting default provider settings
290
+ const lmStudioId = this.db.lastInsertRowid;
291
+
292
+ // Insert default provider settings for optimal context windows
293
+ const settingsStmt = this.db.prepare(`
294
+ INSERT INTO provider_settings (provider_id, setting_key, setting_value, updated_at)
295
+ VALUES (?, ?, ?, ?)
296
+ `);
297
+
298
+ const now = new Date().toISOString();
299
+
300
+ // Ollama default settings - 32K context window
301
+ settingsStmt.run(ollamaId, 'num_ctx', '32768', now);
302
+ settingsStmt.run(ollamaId, 'temperature', '0.0', now);
303
+
304
+ // LM Studio default settings - 32K context window
305
+ settingsStmt.run(lmStudioId, 'num_ctx', '32768', now);
306
+ settingsStmt.run(lmStudioId, 'temperature', '0.0', now);
285
307
  }
286
308
  }
287
309
 
310
+ /**
311
+ * Get provider settings for a specific provider
312
+ */
313
+ async getProviderSettings(providerId: number): Promise<Record<string, string>> {
314
+ await this.ensureInitialized();
315
+ if (!this.db) return {};
316
+
317
+ const stmt = this.db.prepare(`
318
+ SELECT setting_key, setting_value
319
+ FROM provider_settings
320
+ WHERE provider_id = ?
321
+ `);
322
+
323
+ const rows = stmt.all(providerId) as Array<{ setting_key: string; setting_value: string }>;
324
+ const settings: Record<string, string> = {};
325
+
326
+ for (const row of rows) {
327
+ settings[row.setting_key] = row.setting_value;
328
+ }
329
+
330
+ return settings;
331
+ }
332
+
333
+ /**
334
+ * Save a provider setting
335
+ */
336
+ async saveProviderSetting(providerId: number, key: string, value: string | number): Promise<void> {
337
+ await this.ensureInitialized();
338
+ if (!this.db) return;
339
+
340
+ const stmt = this.db.prepare(`
341
+ INSERT OR REPLACE INTO provider_settings (provider_id, setting_key, setting_value, updated_at)
342
+ VALUES (?, ?, ?, ?)
343
+ `);
344
+
345
+ stmt.run(providerId, key, String(value), new Date().toISOString());
346
+ }
347
+
288
348
  /**
289
349
  * Get the currently active model configuration
290
350
  */
@@ -653,6 +713,17 @@ export class FSSLinkDatabase {
653
713
  return settings;
654
714
  }
655
715
 
716
+ /**
717
+ * Get smart default provider with settings
718
+ */
719
+ async getSmartDefaultProviderWithSettings(): Promise<{model: ModelConfig, settings: Record<string, string>} | null> {
720
+ const model = await this.getSmartDefaultProvider();
721
+ if (!model || !model.id) return null;
722
+
723
+ const settings = await this.getProviderSettings(model.id);
724
+ return { model, settings };
725
+ }
726
+
656
727
  /**
657
728
  * Get smart default provider based on usage and preferences
658
729
  */
@@ -690,6 +761,7 @@ export class FSSLinkDatabase {
690
761
  if (!result) return null;
691
762
 
692
763
  return {
764
+ id: result.id,
693
765
  authType: result.auth_type,
694
766
  modelName: result.model_name,
695
767
  endpointUrl: result.endpoint_url,
@@ -30,7 +30,7 @@ export class ModelManager {
30
30
  await db.setActiveModel(modelId);
31
31
 
32
32
  // Update environment variables for immediate use
33
- this.updateEnvironmentFromModel(config);
33
+ await this.updateEnvironmentFromModel(config);
34
34
 
35
35
  return modelId;
36
36
  }
@@ -63,7 +63,7 @@ export class ModelManager {
63
63
  await db.setActiveModel(modelId);
64
64
 
65
65
  // Update environment variables for immediate use
66
- this.updateEnvironmentFromModel(config);
66
+ await this.updateEnvironmentFromModel(config);
67
67
 
68
68
  return modelId;
69
69
  }
@@ -78,7 +78,7 @@ export class ModelManager {
78
78
 
79
79
  const activeModel = await db.getActiveModel();
80
80
  if (activeModel) {
81
- this.updateEnvironmentFromModel(activeModel);
81
+ await this.updateEnvironmentFromModel(activeModel);
82
82
  return true;
83
83
  }
84
84
 
@@ -146,7 +146,7 @@ export class ModelManager {
146
146
  const activeModel = await db.getActiveModel();
147
147
 
148
148
  if (activeModel) {
149
- this.updateEnvironmentFromModel(activeModel);
149
+ await this.updateEnvironmentFromModel(activeModel);
150
150
  return true;
151
151
  }
152
152
 
@@ -188,8 +188,19 @@ export class ModelManager {
188
188
 
189
189
  /**
190
190
  * Update process environment variables from model configuration
191
+ * Now includes provider settings like context window
191
192
  */
192
- private updateEnvironmentFromModel(model: ModelConfig): void {
193
+ private async updateEnvironmentFromModel(model: ModelConfig): Promise<void> {
194
+ // Load provider settings if we have a model ID
195
+ let settings: Record<string, string> = {};
196
+ if (model.id) {
197
+ try {
198
+ const db = await this.getDb();
199
+ settings = await db.getProviderSettings(model.id);
200
+ } catch (error) {
201
+ console.warn('Failed to load provider settings:', error);
202
+ }
203
+ }
193
204
  switch (model.authType) {
194
205
  case 'openai':
195
206
  process.env['OPENAI_API_KEY'] = model.apiKey || '';
@@ -218,6 +229,46 @@ export class ModelManager {
218
229
  console.warn(`Unknown auth type: ${model.authType}`);
219
230
  break;
220
231
  }
232
+
233
+ // Apply provider settings to the global configuration if available
234
+ if (Object.keys(settings).length > 0) {
235
+ await this.applyProviderSettings(settings);
236
+ }
237
+ }
238
+
239
+ /**
240
+ * Apply provider settings to the global configuration
241
+ */
242
+ private async applyProviderSettings(settings: Record<string, string>): Promise<void> {
243
+ try {
244
+ const { getConfig } = await import('./settings.js');
245
+ const config = getConfig();
246
+
247
+ // Convert string settings to appropriate types and update config
248
+ const samplingParams: Record<string, unknown> = {};
249
+
250
+ if (settings.num_ctx) {
251
+ samplingParams.num_ctx = parseInt(settings.num_ctx, 10);
252
+ }
253
+
254
+ if (settings.temperature) {
255
+ samplingParams.temperature = parseFloat(settings.temperature);
256
+ }
257
+
258
+ if (settings.top_p) {
259
+ samplingParams.top_p = parseFloat(settings.top_p);
260
+ }
261
+
262
+ if (settings.top_k) {
263
+ samplingParams.top_k = parseInt(settings.top_k, 10);
264
+ }
265
+
266
+ if (Object.keys(samplingParams).length > 0) {
267
+ config.setContentGeneratorSamplingParams(samplingParams);
268
+ }
269
+ } catch (error) {
270
+ console.warn('Failed to apply provider settings:', error);
271
+ }
221
272
  }
222
273
 
223
274
  /**
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fss-link",
3
- "version": "1.0.47",
3
+ "version": "1.0.48",
4
4
  "description": "FSS Link - AI-powered coding assistant",
5
5
  "repository": {
6
6
  "type": "git",
@@ -94,7 +94,7 @@ export function getInstallationInfo(
94
94
 
95
95
  // Check for pnpm
96
96
  if (realPath.includes('/.pnpm/global')) {
97
- const updateCommand = 'pnpm add -g fss-link-core@latest';
97
+ const updateCommand = 'pnpm add -g fss-link@latest';
98
98
  return {
99
99
  packageManager: PackageManager.PNPM,
100
100
  isGlobal: true,
@@ -107,7 +107,7 @@ export function getInstallationInfo(
107
107
 
108
108
  // Check for yarn
109
109
  if (realPath.includes('/.yarn/global')) {
110
- const updateCommand = 'yarn global add fss-link-core@latest';
110
+ const updateCommand = 'yarn global add fss-link@latest';
111
111
  return {
112
112
  packageManager: PackageManager.YARN,
113
113
  isGlobal: true,
@@ -127,7 +127,7 @@ export function getInstallationInfo(
127
127
  };
128
128
  }
129
129
  if (realPath.includes('/.bun/bin')) {
130
- const updateCommand = 'bun add -g fss-link-core@latest';
130
+ const updateCommand = 'bun add -g fss-link@latest';
131
131
  return {
132
132
  packageManager: PackageManager.BUN,
133
133
  isGlobal: true,
@@ -160,7 +160,7 @@ export function getInstallationInfo(
160
160
  }
161
161
 
162
162
  // Assume global npm
163
- const updateCommand = 'npm install -g fss-link-core@latest';
163
+ const updateCommand = 'npm install -g fss-link@latest';
164
164
  return {
165
165
  packageManager: PackageManager.NPM,
166
166
  isGlobal: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fss-link",
3
- "version": "1.0.47",
3
+ "version": "1.0.48",
4
4
  "description": "FSS Link - AI-powered coding assistant",
5
5
  "repository": {
6
6
  "type": "git",