fss-link 1.0.85 → 1.1.1

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 +82 -84
  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.0.85";
22087
+ const version = "1.1.1";
22088
22088
  const userAgent = `FSS-Link/${version} (${process.platform}; ${process.arch})`;
22089
22089
  const baseHeaders = {
22090
22090
  "User-Agent": userAgent
@@ -81567,7 +81567,7 @@ var init_databaseMigrations = __esm({
81567
81567
  registerMigrations() {
81568
81568
  this.migrations.push({
81569
81569
  version: 1,
81570
- name: "initial_schema",
81570
+ name: "complete_schema",
81571
81571
  up: (db) => {
81572
81572
  db.exec(`
81573
81573
  CREATE TABLE IF NOT EXISTS model_configs (
@@ -81624,33 +81624,13 @@ var init_databaseMigrations = __esm({
81624
81624
  )
81625
81625
  `);
81626
81626
  console.log("provider_usage_stats table created successfully");
81627
- },
81628
- down: (db) => {
81629
- db.exec("DROP TABLE IF EXISTS provider_usage_stats");
81630
- db.exec("DROP TABLE IF EXISTS provider_settings");
81631
- db.exec("DROP TABLE IF EXISTS custom_endpoints");
81632
- db.exec("DROP TABLE IF EXISTS user_preferences");
81633
- db.exec("DROP TABLE IF EXISTS model_configs");
81634
- }
81635
- });
81636
- this.migrations.push({
81637
- version: 2,
81638
- name: "unique_active_constraint",
81639
- up: (db) => {
81640
81627
  db.exec(`
81641
- CREATE UNIQUE INDEX IF NOT EXISTS idx_model_configs_active_unique
81642
- ON model_configs(auth_type)
81643
- WHERE is_active = 1
81628
+ CREATE TABLE IF NOT EXISTS schema_info (
81629
+ key TEXT PRIMARY KEY,
81630
+ value TEXT NOT NULL,
81631
+ updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
81632
+ )
81644
81633
  `);
81645
- },
81646
- down: (db) => {
81647
- db.exec("DROP INDEX IF EXISTS idx_model_configs_active_unique");
81648
- }
81649
- });
81650
- this.migrations.push({
81651
- version: 3,
81652
- name: "performance_indexes",
81653
- up: (db) => {
81654
81634
  db.exec(`
81655
81635
  CREATE INDEX IF NOT EXISTS idx_model_configs_favorite
81656
81636
  ON model_configs(is_favorite, last_used DESC)
@@ -81668,60 +81648,28 @@ var init_databaseMigrations = __esm({
81668
81648
  db.exec(`
81669
81649
  CREATE INDEX IF NOT EXISTS idx_provider_usage_stats_aggregation
81670
81650
  ON provider_usage_stats(provider_id, created_at DESC)
81671
- `);
81672
- },
81673
- down: (db) => {
81674
- db.exec("DROP INDEX IF EXISTS idx_provider_usage_stats_aggregation");
81675
- db.exec("DROP INDEX IF EXISTS idx_provider_settings_lookup");
81676
- db.exec("DROP INDEX IF EXISTS idx_model_configs_recent");
81677
- db.exec("DROP INDEX IF EXISTS idx_model_configs_favorite");
81678
- }
81679
- });
81680
- this.migrations.push({
81681
- version: 4,
81682
- name: "health_monitoring",
81683
- up: (db) => {
81684
- db.exec(`
81685
- CREATE TABLE IF NOT EXISTS schema_info (
81686
- key TEXT PRIMARY KEY,
81687
- value TEXT NOT NULL,
81688
- updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
81689
- )
81690
81651
  `);
81691
81652
  const now = (/* @__PURE__ */ new Date()).toISOString();
81692
81653
  db.exec(`
81693
81654
  INSERT OR REPLACE INTO schema_info (key, value, updated_at)
81694
81655
  VALUES
81695
- ('schema_version', '4', '${now}'),
81696
- ('last_migration', 'health_monitoring', '${now}'),
81697
- ('total_migrations', '4', '${now}')
81656
+ ('schema_version', '1', '${now}'),
81657
+ ('last_migration', 'complete_schema', '${now}'),
81658
+ ('total_migrations', '1', '${now}')
81698
81659
  `);
81660
+ console.log("Complete database schema created successfully");
81699
81661
  },
81700
81662
  down: (db) => {
81663
+ db.exec("DROP INDEX IF EXISTS idx_provider_usage_stats_aggregation");
81664
+ db.exec("DROP INDEX IF EXISTS idx_provider_settings_lookup");
81665
+ db.exec("DROP INDEX IF EXISTS idx_model_configs_recent");
81666
+ db.exec("DROP INDEX IF EXISTS idx_model_configs_favorite");
81701
81667
  db.exec("DROP TABLE IF EXISTS schema_info");
81702
- }
81703
- });
81704
- this.migrations.push({
81705
- version: 5,
81706
- name: "add_source_column",
81707
- up: (db) => {
81708
- const tableInfo = db.exec(`PRAGMA table_info(model_configs)`);
81709
- const hasSourceColumn = tableInfo.some(
81710
- (result) => result.values && result.values.some((row) => row[1] === "source")
81711
- );
81712
- if (!hasSourceColumn) {
81713
- console.log("Adding missing source column to model_configs table...");
81714
- db.exec(`
81715
- ALTER TABLE model_configs
81716
- ADD COLUMN source TEXT DEFAULT 'db'
81717
- `);
81718
- console.log("Source column added successfully");
81719
- } else {
81720
- console.log("Source column already exists, skipping");
81721
- }
81722
- },
81723
- down: (db) => {
81724
- console.log("Rollback: Source column left in place (SQLite limitation)");
81668
+ db.exec("DROP TABLE IF EXISTS provider_usage_stats");
81669
+ db.exec("DROP TABLE IF EXISTS provider_settings");
81670
+ db.exec("DROP TABLE IF EXISTS custom_endpoints");
81671
+ db.exec("DROP TABLE IF EXISTS user_preferences");
81672
+ db.exec("DROP TABLE IF EXISTS model_configs");
81725
81673
  }
81726
81674
  });
81727
81675
  }
@@ -82439,13 +82387,14 @@ var init_core_database = __esm({
82439
82387
  modelName: "qwen3-coder:latest",
82440
82388
  endpointUrl: "http://localhost:11434",
82441
82389
  displayName: "Qwen3 Coder (Ollama)",
82442
- isActive: true
82390
+ isActive: false
82443
82391
  },
82444
82392
  {
82445
82393
  authType: "lm-studio",
82446
82394
  modelName: "qwen/qwen3-coder-30b",
82447
82395
  endpointUrl: "http://localhost:1234/v1",
82448
- displayName: "Qwen3 Coder 30B (LM Studio)"
82396
+ displayName: "Qwen3 Coder 30B (LM Studio)",
82397
+ isActive: false
82449
82398
  },
82450
82399
  {
82451
82400
  authType: "openai",
@@ -82456,13 +82405,13 @@ var init_core_database = __esm({
82456
82405
  {
82457
82406
  authType: "gemini-api-key",
82458
82407
  modelName: "gemini-2.0-flash-thinking",
82459
- endpointUrl: "",
82408
+ endpointUrl: "https://generativelanguage.googleapis.com/v1beta",
82460
82409
  displayName: "Gemini 2.0 Flash Thinking"
82461
82410
  },
82462
82411
  {
82463
82412
  authType: "qwen-oauth",
82464
82413
  modelName: "qwen/qwen3-30b-a3b-2507",
82465
- endpointUrl: "",
82414
+ endpointUrl: "https://dashscope.aliyuncs.com/compatible-mode/v1",
82466
82415
  displayName: "Qwen3 30B (OAuth)"
82467
82416
  }
82468
82417
  ];
@@ -82994,6 +82943,7 @@ var ModelDatabase;
82994
82943
  var init_model_database = __esm({
82995
82944
  "packages/cli/src/config/model-database.ts"() {
82996
82945
  init_database_utils();
82946
+ init_database();
82997
82947
  ModelDatabase = class {
82998
82948
  constructor(db) {
82999
82949
  this.db = db;
@@ -83055,7 +83005,7 @@ var init_model_database = __esm({
83055
83005
  if (!this.db) {
83056
83006
  throw new Error("Database not initialized");
83057
83007
  }
83058
- const encryptedApiKey = config.apiKey || null;
83008
+ const encryptedApiKey = config.apiKey ? FSSLinkDatabase.encryptApiKey(config.apiKey) : null;
83059
83009
  const normalizedEndpointUrl = config.endpointUrl || "";
83060
83010
  const existingRecord = await safeQueryFirstWithLocking(
83061
83011
  this.db,
@@ -83295,7 +83245,7 @@ var init_model_database = __esm({
83295
83245
  authType: record.auth_type,
83296
83246
  modelName: record.model_name,
83297
83247
  endpointUrl: record.endpoint_url || void 0,
83298
- apiKey: record.api_key || void 0,
83248
+ apiKey: record.api_key ? FSSLinkDatabase.decryptApiKey(record.api_key) : void 0,
83299
83249
  displayName: record.display_name || void 0,
83300
83250
  isFavorite: record.is_favorite === 1,
83301
83251
  isActive: record.is_active === 1,
@@ -84596,15 +84546,63 @@ var init_database = __esm({
84596
84546
  * Legacy encryption methods (maintained for compatibility)
84597
84547
  */
84598
84548
  encrypt(value) {
84599
- const cipher = crypto13.createCipher("aes-256-cbc", this.encryptionKey);
84600
- let encrypted = cipher.update(value, "utf8", "hex");
84549
+ if (!value) return value;
84550
+ const iv = crypto13.randomBytes(16);
84551
+ const cipher = crypto13.createCipheriv("aes-256-cbc", this.encryptionKey, iv);
84552
+ let encrypted = iv.toString("hex") + ":";
84553
+ encrypted += cipher.update(value, "utf8", "hex");
84601
84554
  encrypted += cipher.final("hex");
84602
84555
  return encrypted;
84603
84556
  }
84604
84557
  decrypt(value) {
84558
+ if (!value) return value;
84559
+ try {
84560
+ const parts = value.split(":");
84561
+ const iv = Buffer.from(parts[0], "hex");
84562
+ const encrypted = parts[1];
84563
+ const decipher = crypto13.createDecipheriv("aes-256-cbc", this.encryptionKey, iv);
84564
+ let decrypted = decipher.update(encrypted, "hex", "utf8");
84565
+ decrypted += decipher.final("utf8");
84566
+ return decrypted;
84567
+ } catch (error) {
84568
+ return value;
84569
+ }
84570
+ }
84571
+ /**
84572
+ * Static encryption methods for use across database classes
84573
+ */
84574
+ static getEncryptionKey() {
84575
+ const keyPath = path57.join(USER_SETTINGS_DIR, "db.key");
84576
+ if (fs51.existsSync(keyPath)) {
84577
+ return fs51.readFileSync(keyPath);
84578
+ } else {
84579
+ const key = crypto13.randomBytes(32);
84580
+ if (!fs51.existsSync(USER_SETTINGS_DIR)) {
84581
+ fs51.mkdirSync(USER_SETTINGS_DIR, { recursive: true });
84582
+ }
84583
+ fs51.writeFileSync(keyPath, key);
84584
+ return key;
84585
+ }
84586
+ }
84587
+ static encryptApiKey(value) {
84588
+ if (!value) return value;
84589
+ const key = this.getEncryptionKey();
84590
+ const iv = crypto13.randomBytes(16);
84591
+ const cipher = crypto13.createCipheriv("aes-256-cbc", key, iv);
84592
+ let encrypted = iv.toString("hex") + ":";
84593
+ encrypted += cipher.update(value, "utf8", "hex");
84594
+ encrypted += cipher.final("hex");
84595
+ return encrypted;
84596
+ }
84597
+ static decryptApiKey(value) {
84598
+ if (!value) return value;
84605
84599
  try {
84606
- const decipher = crypto13.createDecipher("aes-256-cbc", this.encryptionKey);
84607
- let decrypted = decipher.update(value, "hex", "utf8");
84600
+ const key = this.getEncryptionKey();
84601
+ const parts = value.split(":");
84602
+ const iv = Buffer.from(parts[0], "hex");
84603
+ const encrypted = parts[1];
84604
+ const decipher = crypto13.createDecipheriv("aes-256-cbc", key, iv);
84605
+ let decrypted = decipher.update(encrypted, "hex", "utf8");
84608
84606
  decrypted += decipher.final("utf8");
84609
84607
  return decrypted;
84610
84608
  } catch (error) {
@@ -93878,7 +93876,7 @@ async function getPackageJson() {
93878
93876
  // packages/cli/src/utils/version.ts
93879
93877
  async function getCliVersion() {
93880
93878
  const pkgJson = await getPackageJson();
93881
- return "1.0.85";
93879
+ return "1.1.1";
93882
93880
  }
93883
93881
 
93884
93882
  // packages/cli/src/ui/commands/aboutCommand.ts
@@ -93930,7 +93928,7 @@ import open4 from "open";
93930
93928
  import process11 from "node:process";
93931
93929
 
93932
93930
  // packages/cli/src/generated/git-commit.ts
93933
- var GIT_COMMIT_INFO = "a5d03a59";
93931
+ var GIT_COMMIT_INFO = "5495c6a2";
93934
93932
 
93935
93933
  // packages/cli/src/ui/commands/bugCommand.ts
93936
93934
  init_dist2();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fss-link",
3
- "version": "1.0.85",
3
+ "version": "1.1.1",
4
4
  "engines": {
5
5
  "node": ">=20.0.0"
6
6
  },