@the-magic-tower/fixhive-opencode-plugin 0.1.11 → 0.1.13

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.
package/dist/index.d.ts CHANGED
@@ -477,6 +477,16 @@ declare function runMigrations(db: Database.Database): void;
477
477
  * Supabase client for cloud knowledge base operations
478
478
  */
479
479
 
480
+ /**
481
+ * Cloud Client Configuration
482
+ */
483
+ interface CloudClientConfig {
484
+ supabaseUrl: string;
485
+ supabaseAnonKey: string;
486
+ openaiApiKey?: string;
487
+ contributorId?: string;
488
+ similarityThreshold?: number;
489
+ }
480
490
  /**
481
491
  * Cloud Client Class
482
492
  * Manages communication with Supabase cloud database
@@ -486,13 +496,11 @@ declare class CloudClient {
486
496
  private embedding;
487
497
  private contributorId;
488
498
  private similarityThreshold;
489
- constructor(config: {
490
- supabaseUrl: string;
491
- supabaseAnonKey: string;
492
- openaiApiKey?: string;
493
- contributorId?: string;
494
- similarityThreshold?: number;
495
- });
499
+ private constructor();
500
+ /**
501
+ * Create a CloudClient instance (async factory for Bun compatibility)
502
+ */
503
+ static create(config: CloudClientConfig): Promise<CloudClient>;
496
504
  /**
497
505
  * Search for similar errors in cloud knowledge base
498
506
  */
@@ -548,15 +556,9 @@ declare class CloudClient {
548
556
  hasEmbeddingService(): boolean;
549
557
  }
550
558
  /**
551
- * Create cloud client with config
559
+ * Create cloud client with config (async for Bun compatibility)
552
560
  */
553
- declare function createCloudClient(config: {
554
- supabaseUrl: string;
555
- supabaseAnonKey: string;
556
- openaiApiKey?: string;
557
- contributorId?: string;
558
- similarityThreshold?: number;
559
- }): CloudClient;
561
+ declare function createCloudClient(config: CloudClientConfig): Promise<CloudClient>;
560
562
 
561
563
  /**
562
564
  * FixHive Embedding Service
package/dist/index.js CHANGED
@@ -998,9 +998,6 @@ var LocalStore = class _LocalStore {
998
998
  }
999
999
  };
1000
1000
 
1001
- // src/cloud/client.ts
1002
- import { createClient } from "@supabase/supabase-js";
1003
-
1004
1001
  // src/cloud/embedding.ts
1005
1002
  import OpenAI from "openai";
1006
1003
  var DEFAULT_MODEL = "text-embedding-3-small";
@@ -1110,25 +1107,42 @@ function createEmbeddingService(config) {
1110
1107
  }
1111
1108
 
1112
1109
  // src/cloud/client.ts
1113
- var CloudClient = class {
1110
+ var createClient;
1111
+ async function getCreateClient() {
1112
+ if (!createClient) {
1113
+ const supabase = await import("@supabase/supabase-js");
1114
+ createClient = supabase.createClient;
1115
+ }
1116
+ return createClient;
1117
+ }
1118
+ var CloudClient = class _CloudClient {
1114
1119
  supabase;
1115
1120
  embedding;
1116
1121
  contributorId;
1117
1122
  similarityThreshold;
1118
- constructor(config) {
1119
- this.supabase = createClient(config.supabaseUrl, config.supabaseAnonKey);
1123
+ constructor(supabase, embedding, contributorId, similarityThreshold) {
1124
+ this.supabase = supabase;
1125
+ this.embedding = embedding;
1126
+ this.contributorId = contributorId;
1127
+ this.similarityThreshold = similarityThreshold;
1128
+ }
1129
+ /**
1130
+ * Create a CloudClient instance (async factory for Bun compatibility)
1131
+ */
1132
+ static async create(config) {
1133
+ const createClientFn = await getCreateClient();
1134
+ const supabase = createClientFn(config.supabaseUrl, config.supabaseAnonKey);
1135
+ let embedding = null;
1120
1136
  if (config.openaiApiKey) {
1121
1137
  try {
1122
- this.embedding = new EmbeddingService(config.openaiApiKey);
1138
+ embedding = new EmbeddingService(config.openaiApiKey);
1123
1139
  } catch (err) {
1124
1140
  console.warn("[FixHive] Failed to initialize embedding service:", err);
1125
- this.embedding = null;
1126
1141
  }
1127
- } else {
1128
- this.embedding = null;
1129
1142
  }
1130
- this.contributorId = config.contributorId || generateContributorId();
1131
- this.similarityThreshold = config.similarityThreshold || 0.7;
1143
+ const contributorId = config.contributorId || generateContributorId();
1144
+ const similarityThreshold = config.similarityThreshold || 0.7;
1145
+ return new _CloudClient(supabase, embedding, contributorId, similarityThreshold);
1132
1146
  }
1133
1147
  /**
1134
1148
  * Search for similar errors in cloud knowledge base
@@ -1373,8 +1387,8 @@ ${errorRecord.errorStack || ""}`;
1373
1387
  return this.embedding !== null;
1374
1388
  }
1375
1389
  };
1376
- function createCloudClient(config) {
1377
- return new CloudClient(config);
1390
+ async function createCloudClient(config) {
1391
+ return CloudClient.create(config);
1378
1392
  }
1379
1393
 
1380
1394
  // src/plugin/tools.ts
@@ -1619,7 +1633,7 @@ var FixHivePlugin = async (ctx) => {
1619
1633
  let cloudClient = null;
1620
1634
  if (config.supabaseUrl && config.supabaseAnonKey) {
1621
1635
  try {
1622
- cloudClient = new CloudClient({
1636
+ cloudClient = await CloudClient.create({
1623
1637
  supabaseUrl: config.supabaseUrl,
1624
1638
  supabaseAnonKey: config.supabaseAnonKey,
1625
1639
  openaiApiKey: config.openaiApiKey,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@the-magic-tower/fixhive-opencode-plugin",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "description": "Community-based error knowledge sharing for OpenCode",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -44,7 +44,7 @@
44
44
  "@opencode-ai/plugin": "^1.1.1"
45
45
  },
46
46
  "dependencies": {
47
- "@supabase/supabase-js": "^2.45.0",
47
+ "@supabase/supabase-js": "2.43.2",
48
48
  "better-sqlite3": "^12.5.0",
49
49
  "openai": "^6.16.0",
50
50
  "uuid": "^13.0.0",