fss-link 1.0.47 → 1.0.49

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,89 +1,89 @@
1
1
  {
2
- "name": "fss-link",
3
- "version": "1.0.47",
4
- "description": "FSS Link - AI-powered coding assistant",
5
- "repository": {
6
- "type": "git",
7
- "url": "git+https://github.com/FSSCoding/fss-link.git"
8
- },
9
- "type": "module",
10
- "main": "dist/index.js",
11
- "bin": {
12
- "fss-link": "dist/index.js"
13
- },
14
- "scripts": {
15
- "build": "node ../../scripts/build_package.js",
16
- "start": "node dist/index.js",
17
- "debug": "node --inspect-brk dist/index.js",
18
- "lint": "eslint . --ext .ts,.tsx",
19
- "format": "prettier --write .",
20
- "test": "vitest run",
21
- "test:ci": "vitest run --coverage",
22
- "typecheck": "tsc --noEmit"
23
- },
24
- "files": [
25
- "dist"
26
- ],
27
- "config": {
28
- "sandboxImageUri": "ghcr.io/fsscoding/fss-link:0.0.10"
29
- },
30
- "dependencies": {
31
- "fss-link-core": "1.0.45",
32
- "@google/genai": "1.9.0",
33
- "@iarna/toml": "^2.2.5",
34
- "@modelcontextprotocol/sdk": "^1.15.1",
35
- "@types/update-notifier": "^6.0.8",
36
- "command-exists": "^1.2.9",
37
- "diff": "^7.0.0",
38
- "dotenv": "^17.1.0",
39
- "glob": "^10.4.1",
40
- "highlight.js": "^11.11.1",
41
- "ink": "^6.1.1",
42
- "ink-big-text": "^2.0.0",
43
- "ink-gradient": "^3.0.0",
44
- "ink-link": "^4.1.0",
45
- "ink-select-input": "^6.2.0",
46
- "ink-spinner": "^5.0.0",
47
- "lowlight": "^3.3.0",
48
- "mime-types": "^3.0.1",
49
- "open": "^10.1.2",
50
- "qrcode-terminal": "^0.12.0",
51
- "react": "19.1.1",
52
- "react-dom": "19.1.1",
53
- "read-package-up": "^11.0.0",
54
- "shell-quote": "^1.8.3",
55
- "string-width": "^7.1.0",
56
- "strip-ansi": "^7.1.0",
57
- "strip-json-comments": "^3.1.1",
58
- "undici": "^7.10.0",
59
- "update-notifier": "^7.3.1",
60
- "yargs": "^17.7.2",
61
- "zod": "^3.23.8",
62
- "axios": "^1.11.0",
63
- "cheerio": "^1.1.2",
64
- "sql.js": "^1.11.0",
65
- "fs-extra": "^11.3.1"
66
- },
67
- "devDependencies": {
68
- "@babel/runtime": "^7.27.6",
69
- "fss-link-test-utils": "file:../test-utils",
70
- "@testing-library/react": "^16.3.0",
71
- "@types/command-exists": "^1.2.3",
72
- "@types/diff": "^7.0.2",
73
- "@types/dotenv": "^6.1.1",
74
- "@types/node": "^20.11.24",
75
- "@types/react": "^19.1.8",
76
- "@types/react-dom": "^19.1.6",
77
- "@types/semver": "^7.7.0",
78
- "@types/shell-quote": "^1.7.5",
79
- "@types/yargs": "^17.0.32",
80
- "ink-testing-library": "^4.0.0",
81
- "jsdom": "^26.1.0",
82
- "pretty-format": "^30.0.2",
83
- "typescript": "^5.3.3",
84
- "vitest": "^3.1.1"
85
- },
86
- "engines": {
87
- "node": ">=20"
88
- }
2
+ "name": "fss-link",
3
+ "version": "1.0.49",
4
+ "description": "FSS Link - AI-powered coding assistant",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/FSSCoding/fss-link.git"
8
+ },
9
+ "type": "module",
10
+ "main": "dist/index.js",
11
+ "bin": {
12
+ "fss-link": "dist/index.js"
13
+ },
14
+ "scripts": {
15
+ "build": "node ../../scripts/build_package.js",
16
+ "start": "node dist/index.js",
17
+ "debug": "node --inspect-brk dist/index.js",
18
+ "lint": "eslint . --ext .ts,.tsx",
19
+ "format": "prettier --write .",
20
+ "test": "vitest run",
21
+ "test:ci": "vitest run --coverage",
22
+ "typecheck": "tsc --noEmit"
23
+ },
24
+ "files": [
25
+ "dist"
26
+ ],
27
+ "config": {
28
+ "sandboxImageUri": "ghcr.io/fsscoding/fss-link:0.0.10"
29
+ },
30
+ "dependencies": {
31
+ "fss-link-core": "1.0.46",
32
+ "@google/genai": "1.9.0",
33
+ "@iarna/toml": "^2.2.5",
34
+ "@modelcontextprotocol/sdk": "^1.15.1",
35
+ "@types/update-notifier": "^6.0.8",
36
+ "command-exists": "^1.2.9",
37
+ "diff": "^7.0.0",
38
+ "dotenv": "^17.1.0",
39
+ "glob": "^10.4.1",
40
+ "highlight.js": "^11.11.1",
41
+ "ink": "^6.1.1",
42
+ "ink-big-text": "^2.0.0",
43
+ "ink-gradient": "^3.0.0",
44
+ "ink-link": "^4.1.0",
45
+ "ink-select-input": "^6.2.0",
46
+ "ink-spinner": "^5.0.0",
47
+ "lowlight": "^3.3.0",
48
+ "mime-types": "^3.0.1",
49
+ "open": "^10.1.2",
50
+ "qrcode-terminal": "^0.12.0",
51
+ "react": "19.1.1",
52
+ "react-dom": "19.1.1",
53
+ "read-package-up": "^11.0.0",
54
+ "shell-quote": "^1.8.3",
55
+ "string-width": "^7.1.0",
56
+ "strip-ansi": "^7.1.0",
57
+ "strip-json-comments": "^3.1.1",
58
+ "undici": "^7.10.0",
59
+ "update-notifier": "^7.3.1",
60
+ "yargs": "^17.7.2",
61
+ "zod": "^3.23.8",
62
+ "axios": "^1.11.0",
63
+ "cheerio": "^1.1.2",
64
+ "sql.js": "^1.11.0",
65
+ "fs-extra": "^11.3.1"
66
+ },
67
+ "devDependencies": {
68
+ "@babel/runtime": "^7.27.6",
69
+ "fss-link-test-utils": "file:../test-utils",
70
+ "@testing-library/react": "^16.3.0",
71
+ "@types/command-exists": "^1.2.3",
72
+ "@types/diff": "^7.0.2",
73
+ "@types/dotenv": "^6.1.1",
74
+ "@types/node": "^20.11.24",
75
+ "@types/react": "^19.1.8",
76
+ "@types/react-dom": "^19.1.6",
77
+ "@types/semver": "^7.7.0",
78
+ "@types/shell-quote": "^1.7.5",
79
+ "@types/yargs": "^17.0.32",
80
+ "ink-testing-library": "^4.0.0",
81
+ "jsdom": "^26.1.0",
82
+ "pretty-format": "^30.0.2",
83
+ "typescript": "^5.3.3",
84
+ "vitest": "^3.1.1"
85
+ },
86
+ "engines": {
87
+ "node": ">=20"
88
+ }
89
89
  }
@@ -8,6 +8,15 @@ export interface UserPreference {
8
8
  key: string;
9
9
  value: string;
10
10
  }
11
+ interface DatabaseCustomEndpointRecord {
12
+ id: number;
13
+ provider_id: number;
14
+ name: string;
15
+ url: string;
16
+ description: string | null;
17
+ is_default: number;
18
+ created_at: string;
19
+ }
11
20
  /**
12
21
  * FSS Link Database Manager
13
22
  * Handles all persistent state for model configurations and user preferences
@@ -38,6 +47,14 @@ export declare class FSSLinkDatabase {
38
47
  * Ensure default model configurations exist for new installations
39
48
  */
40
49
  private ensureDefaultConfigurations;
50
+ /**
51
+ * Get provider settings for a specific provider
52
+ */
53
+ getProviderSettings(providerId: number): Promise<Record<string, string>>;
54
+ /**
55
+ * Save a provider setting
56
+ */
57
+ saveProviderSetting(providerId: number, key: string, value: string | number): Promise<void>;
41
58
  /**
42
59
  * Get the currently active model configuration
43
60
  */
@@ -105,15 +122,14 @@ export declare class FSSLinkDatabase {
105
122
  /**
106
123
  * Get custom endpoints for a provider
107
124
  */
108
- getCustomEndpoints(providerId: number): Promise<Array<Record<string, unknown>>>;
109
- /**
110
- * Save provider-specific settings (like sampling params)
111
- */
112
- saveProviderSetting(providerId: number, key: string, value: string): Promise<void>;
125
+ getCustomEndpoints(providerId: number): Promise<DatabaseCustomEndpointRecord[]>;
113
126
  /**
114
- * Get provider-specific settings
127
+ * Get smart default provider with settings
115
128
  */
116
- getProviderSettings(providerId: number): Promise<Record<string, string>>;
129
+ getSmartDefaultProviderWithSettings(): Promise<{
130
+ model: ModelConfig;
131
+ settings: Record<string, string>;
132
+ } | null>;
117
133
  /**
118
134
  * Get smart default provider based on usage and preferences
119
135
  */
@@ -131,3 +147,4 @@ export declare function getFSSLinkDatabase(): Promise<FSSLinkDatabase>;
131
147
  * Close the global database instance (for cleanup)
132
148
  */
133
149
  export declare function closeFSSLinkDatabase(): void;
150
+ export {};