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

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.
@@ -0,0 +1,88 @@
1
+ /**
2
+ * FixHive Cloud Client
3
+ * Supabase client for cloud knowledge base operations
4
+ */
5
+ import type { CloudKnowledgeEntry, SearchRequest, SearchResponse, UploadRequest, UploadResponse, DuplicateCheckResult, ContributorStats } from '../types/index.js';
6
+ /**
7
+ * Cloud Client Configuration
8
+ */
9
+ export interface CloudClientConfig {
10
+ supabaseUrl: string;
11
+ supabaseAnonKey: string;
12
+ openaiApiKey?: string;
13
+ contributorId?: string;
14
+ similarityThreshold?: number;
15
+ }
16
+ /**
17
+ * Cloud Client Class
18
+ * Manages communication with Supabase cloud database
19
+ */
20
+ export declare class CloudClient {
21
+ private supabase;
22
+ private embedding;
23
+ private contributorId;
24
+ private similarityThreshold;
25
+ private constructor();
26
+ /**
27
+ * Create a CloudClient instance (async factory for Bun compatibility)
28
+ */
29
+ static create(config: CloudClientConfig): Promise<CloudClient>;
30
+ /**
31
+ * Search for similar errors in cloud knowledge base
32
+ */
33
+ searchSimilar(request: SearchRequest): Promise<SearchResponse>;
34
+ /**
35
+ * Fallback text-based search
36
+ */
37
+ private searchByText;
38
+ /**
39
+ * Upload a resolution to cloud knowledge base
40
+ */
41
+ uploadResolution(request: UploadRequest): Promise<UploadResponse>;
42
+ /**
43
+ * Check for duplicate entries
44
+ */
45
+ checkDuplicate(errorHash: string, embedding: number[]): Promise<DuplicateCheckResult>;
46
+ /**
47
+ * Vote on a knowledge entry (with duplicate vote prevention)
48
+ */
49
+ vote(knowledgeId: string, helpful: boolean): Promise<{
50
+ success: boolean;
51
+ error?: string;
52
+ }>;
53
+ /**
54
+ * Report an entry for review
55
+ */
56
+ reportEntry(knowledgeId: string, reason?: string): Promise<{
57
+ success: boolean;
58
+ }>;
59
+ /**
60
+ * Report helpful usage
61
+ */
62
+ reportHelpful(knowledgeId: string): Promise<void>;
63
+ /**
64
+ * Get contributor statistics
65
+ */
66
+ getContributorStats(): Promise<ContributorStats>;
67
+ /**
68
+ * Get entry by ID
69
+ */
70
+ getEntry(id: string): Promise<CloudKnowledgeEntry | null>;
71
+ /**
72
+ * Map database row to CloudKnowledgeEntry
73
+ */
74
+ private mapToKnowledgeEntry;
75
+ /**
76
+ * Get contributor ID
77
+ */
78
+ getContributorId(): string;
79
+ /**
80
+ * Check if embedding service is available
81
+ */
82
+ hasEmbeddingService(): boolean;
83
+ }
84
+ /**
85
+ * Create cloud client with config (async for Bun compatibility)
86
+ */
87
+ export declare function createCloudClient(config: CloudClientConfig): Promise<CloudClient>;
88
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/cloud/client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EACV,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,aAAa,EACb,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;AAe3B;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;;GAGG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAiB;IACjC,OAAO,CAAC,SAAS,CAA0B;IAC3C,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,mBAAmB,CAAS;IAEpC,OAAO;IAYP;;OAEG;WACU,MAAM,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAAC;IAqBpE;;OAEG;IACG,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC;IAiCpE;;OAEG;YACW,YAAY;IAgC1B;;OAEG;IACG,gBAAgB,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC;IAgEvE;;OAEG;IACG,cAAc,CAClB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EAAE,GAClB,OAAO,CAAC,oBAAoB,CAAC;IAoChC;;OAEG;IACG,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IA2BhG;;OAEG;IACG,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IActF;;OAEG;IACG,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAYvD;;OAEG;IACG,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAiBtD;;OAEG;IACG,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAc/D;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAwB3B;;OAEG;IACH,gBAAgB,IAAI,MAAM;IAI1B;;OAEG;IACH,mBAAmB,IAAI,OAAO;CAG/B;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,iBAAiB,GACxB,OAAO,CAAC,WAAW,CAAC,CAEtB"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * FixHive Embedding Service
3
+ * Generates text embeddings for semantic search using OpenAI
4
+ */
5
+ /**
6
+ * Embedding Service Class
7
+ * Generates embeddings for error messages and solutions
8
+ */
9
+ export declare class EmbeddingService {
10
+ private client;
11
+ private model;
12
+ private dimensions;
13
+ constructor(apiKey: string, model?: string, dimensions?: number);
14
+ /**
15
+ * Generate embedding for a single text
16
+ */
17
+ generate(text: string): Promise<number[]>;
18
+ /**
19
+ * Generate embeddings for multiple texts
20
+ */
21
+ generateBatch(texts: string[]): Promise<number[][]>;
22
+ /**
23
+ * Generate embedding for error context
24
+ * Combines error message, stack trace, and context
25
+ */
26
+ generateErrorEmbedding(errorMessage: string, errorStack?: string, context?: {
27
+ language?: string;
28
+ framework?: string;
29
+ }): Promise<number[]>;
30
+ /**
31
+ * Truncate text to fit within model limits
32
+ */
33
+ private truncateText;
34
+ /**
35
+ * Calculate cosine similarity between two embeddings
36
+ */
37
+ static cosineSimilarity(a: number[], b: number[]): number;
38
+ /**
39
+ * Get embedding dimensions
40
+ */
41
+ getDimensions(): number;
42
+ /**
43
+ * Get model name
44
+ */
45
+ getModel(): string;
46
+ }
47
+ /**
48
+ * Create embedding service with config
49
+ */
50
+ export declare function createEmbeddingService(config: {
51
+ apiKey: string;
52
+ model?: string;
53
+ dimensions?: number;
54
+ }): EmbeddingService;
55
+ //# sourceMappingURL=embedding.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"embedding.d.ts","sourceRoot":"","sources":["../../src/cloud/embedding.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH;;;GAGG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,UAAU,CAAS;gBAEf,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM;IAM/D;;OAEG;IACG,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAY/C;;OAEG;IACG,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;IAYzD;;;OAGG;IACG,sBAAsB,CAC1B,YAAY,EAAE,MAAM,EACpB,UAAU,CAAC,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAClD,OAAO,CAAC,MAAM,EAAE,CAAC;IAqBpB;;OAEG;IACH,OAAO,CAAC,YAAY;IAgBpB;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM;IAqBzD;;OAEG;IACH,aAAa,IAAI,MAAM;IAIvB;;OAEG;IACH,QAAQ,IAAI,MAAM;CAGnB;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE;IAC7C,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,gBAAgB,CAEnB"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * FixHive Error Detector
3
+ * Detects errors from tool outputs using multi-signal analysis
4
+ */
5
+ import type { ErrorDetectionResult, ToolOutput } from '../types/index.js';
6
+ import { PrivacyFilter } from './privacy-filter.js';
7
+ /**
8
+ * Error Detector Class
9
+ * Analyzes tool outputs to detect errors
10
+ */
11
+ export declare class ErrorDetector {
12
+ private privacyFilter;
13
+ constructor(privacyFilter?: PrivacyFilter);
14
+ /**
15
+ * Detect if output contains an error
16
+ */
17
+ detect(toolOutput: ToolOutput): ErrorDetectionResult;
18
+ /**
19
+ * Check if content contains error keywords
20
+ */
21
+ private containsErrorKeywords;
22
+ /**
23
+ * Detect error patterns in content
24
+ */
25
+ private detectErrorPatterns;
26
+ /**
27
+ * Detect stack traces in content
28
+ */
29
+ private detectStackTrace;
30
+ /**
31
+ * Calculate confidence score from signals
32
+ */
33
+ private calculateConfidence;
34
+ /**
35
+ * Classify error type based on signals and content
36
+ */
37
+ private classifyErrorType;
38
+ /**
39
+ * Determine severity from signals and exit code
40
+ */
41
+ private determineSeverity;
42
+ /**
43
+ * Extract error message and stack from output
44
+ */
45
+ private extractErrorDetails;
46
+ /**
47
+ * Check if a line looks like an error message
48
+ */
49
+ private isErrorLine;
50
+ }
51
+ export declare const defaultErrorDetector: ErrorDetector;
52
+ //# sourceMappingURL=error-detector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-detector.d.ts","sourceRoot":"","sources":["../../src/core/error-detector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAIV,oBAAoB,EAEpB,UAAU,EACX,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAsGpD;;;GAGG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,aAAa,CAAgB;gBAEzB,aAAa,CAAC,EAAE,aAAa;IAIzC;;OAEG;IACH,MAAM,CAAC,UAAU,EAAE,UAAU,GAAG,oBAAoB;IAsEpD;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAI7B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IA+B3B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAoBxB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAa3B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAwBzB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAczB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAqC3B;;OAEG;IACH,OAAO,CAAC,WAAW;CASpB;AAGD,eAAO,MAAM,oBAAoB,eAAsB,CAAC"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * FixHive Hash Utilities
3
+ * Generates fingerprints and hashes for error deduplication
4
+ */
5
+ /**
6
+ * Generate SHA-256 hash of content
7
+ */
8
+ export declare function sha256(content: string): string;
9
+ /**
10
+ * Generate a shortened hash (first 16 characters)
11
+ */
12
+ export declare function shortHash(content: string): string;
13
+ /**
14
+ * Generate error fingerprint for matching similar errors
15
+ * Normalizes variable parts (paths, numbers, hashes) before hashing
16
+ */
17
+ export declare function generateErrorFingerprint(errorMessage: string, errorStack?: string): string;
18
+ /**
19
+ * Normalize error content by replacing variable parts
20
+ */
21
+ export declare function normalizeErrorContent(content: string): string;
22
+ /**
23
+ * Generate contributor ID (anonymous hash)
24
+ * Uses machine-specific information to create a stable anonymous ID
25
+ */
26
+ export declare function generateContributorId(): string;
27
+ /**
28
+ * Generate session-specific hash
29
+ */
30
+ export declare function generateSessionHash(sessionId: string): string;
31
+ /**
32
+ * Compare two fingerprints for similarity
33
+ * Returns true if they're identical (exact match)
34
+ */
35
+ export declare function fingerprintsMatch(fp1: string, fp2: string): boolean;
36
+ /**
37
+ * Calculate simple string similarity (Jaccard index)
38
+ * Used as a fallback when embeddings aren't available
39
+ */
40
+ export declare function calculateStringSimilarity(str1: string, str2: string): number;
41
+ //# sourceMappingURL=hash.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../src/core/hash.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;GAEG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE9C;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,YAAY,EAAE,MAAM,EACpB,UAAU,CAAC,EAAE,MAAM,GAClB,MAAM,CASR;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CA2B7D;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAS9C;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAEnE;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAU5E"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * FixHive Privacy Filter
3
+ * Sanitizes sensitive information from error messages before sharing
4
+ */
5
+ import type { PrivacyFilterRule, SanitizedContent, FilterContext } from '../types/index.js';
6
+ /**
7
+ * Privacy Filter Pipeline
8
+ * Applies multiple filtering rules to sanitize sensitive content
9
+ */
10
+ export declare class PrivacyFilter {
11
+ private rules;
12
+ constructor(customRules?: PrivacyFilterRule[]);
13
+ /**
14
+ * Sanitize content by applying all filter rules
15
+ */
16
+ sanitize(content: string, context?: FilterContext): SanitizedContent;
17
+ /**
18
+ * Generalize file paths while keeping meaningful structure
19
+ */
20
+ private generalizePaths;
21
+ /**
22
+ * Add a custom filter rule
23
+ */
24
+ addRule(rule: PrivacyFilterRule): void;
25
+ /**
26
+ * Remove a filter rule by name
27
+ */
28
+ removeRule(name: string): boolean;
29
+ /**
30
+ * Get all current rules
31
+ */
32
+ getRules(): ReadonlyArray<PrivacyFilterRule>;
33
+ /**
34
+ * Check if content contains sensitive data
35
+ * Note: Always reset regex lastIndex BEFORE testing to prevent state pollution
36
+ */
37
+ containsSensitiveData(content: string): boolean;
38
+ }
39
+ /**
40
+ * Create default filter context from project directory
41
+ */
42
+ export declare function createFilterContext(projectDirectory: string): FilterContext;
43
+ export declare const defaultPrivacyFilter: PrivacyFilter;
44
+ //# sourceMappingURL=privacy-filter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"privacy-filter.d.ts","sourceRoot":"","sources":["../../src/core/privacy-filter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAwN5F;;;GAGG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,KAAK,CAAsB;gBAEvB,WAAW,CAAC,EAAE,iBAAiB,EAAE;IAO7C;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,gBAAgB;IAqCpE;;OAEG;IACH,OAAO,CAAC,eAAe;IAwBvB;;OAEG;IACH,OAAO,CAAC,IAAI,EAAE,iBAAiB,GAAG,IAAI;IAKtC;;OAEG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IASjC;;OAEG;IACH,QAAQ,IAAI,aAAa,CAAC,iBAAiB,CAAC;IAI5C;;;OAGG;IACH,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;CAehD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,gBAAgB,EAAE,MAAM,GAAG,aAAa,CAc3E;AAGD,eAAO,MAAM,oBAAoB,eAAsB,CAAC"}