Skip to content

Commit d7fb859

Browse files
fix: remove unnecessary re-exports that break opencode plugin loading
- Remove non-Plugin re-exports (CONFIG, graphitiClient, etc.) from index.ts that caused opencode to crash with 'fn3 is not a function' when it tried to call non-function exports as Plugin initializers - Fix MCP client similarity scores to return null instead of fake values - Fix o1/o3 model regex pattern to avoid false matches with gpt-4o - Fix dedup substring check: require min 50 chars to avoid false matches
1 parent 7fef51f commit d7fb859

File tree

3 files changed

+5
-13
lines changed

3 files changed

+5
-13
lines changed

src/index.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,11 @@ export const GraphitiPlugin: Plugin = async (ctx: PluginInput) => {
290290
// For scored results, use similarity threshold
291291
if (r.similarity != null && r.similarity > 0.9) return true;
292292
// For unscored results, check content similarity via string matching
293+
// Only apply for content with reasonable length (>50 chars) to avoid false matches
293294
if (r.similarity == null && r.memory) {
294295
const existingNorm = r.memory.toLowerCase().trim();
295296
const newNorm = sanitizedContent.toLowerCase().trim();
297+
if (newNorm.length < 50) return existingNorm === newNorm;
296298
return existingNorm === newNorm || existingNorm.includes(newNorm) || newNorm.includes(existingNorm);
297299
}
298300
return false;
@@ -579,16 +581,6 @@ export const GraphitiPlugin: Plugin = async (ctx: PluginInput) => {
579581

580582
export const SupermemoryPlugin = GraphitiPlugin;
581583

582-
export { graphitiClient as graphitiMcpClient, GraphitiClient } from "./services/graphiti-client.js";
583-
export { graphitiRestClient, GraphitiRestClient } from "./services/graphiti-rest-client.js";
584-
585-
const activeClient = USE_REST_API ? restClient : mcpClient;
586-
export { activeClient as graphitiClient };
587-
588-
export type { MemoryScope, MemoryType, GraphitiNodeResult, GraphitiFactResult, GraphitiEpisodeResult, MemoryResult, UserProfile } from "./types/index.js";
589-
590-
export { isConfigured, CONFIG, GRAPHITI_MCP_URL, GRAPHITI_REST_URL, USE_REST_API } from "./config.js";
591-
592584
function formatSearchResults(
593585
query: string,
594586
scope: string | undefined,

src/services/compaction.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const SUPPORTED_MODEL_PATTERNS = [
3434
/gemini/i,
3535
/gpt-4o?/i,
3636
/gpt-5/i,
37-
/\bo[13]\b/i,
37+
/(?:^|[-/])o[13](?:$|[-/])/i,
3838
/deepseek/i,
3939
/qwen/i,
4040
];

src/services/graphiti-client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,15 +431,15 @@ export class GraphitiClient {
431431
...(nodesResult.nodes || []).map((node) => ({
432432
id: node.uuid,
433433
memory: node.summary || node.name,
434-
similarity: 0.9 as number | null,
434+
similarity: null as number | null,
435435
type: "node" as const,
436436
labels: node.labels,
437437
createdAt: node.created_at,
438438
})),
439439
...validFacts.map((fact) => ({
440440
id: fact.uuid || `fact-${Date.now()}`,
441441
memory: this.formatFactWithRelationship(fact),
442-
similarity: 0.85 as number | null,
442+
similarity: null as number | null,
443443
type: "fact" as const,
444444
createdAt: fact.created_at,
445445
validAt: fact.valid_at,

0 commit comments

Comments
 (0)