Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions scripts/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@ function main() {
}

main();

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions scripts/migrate-tests.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,5 @@ function migrateDirectory(dir) {
}

migrateDirectory("tests");

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions scripts/migrate-v1-to-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -374,3 +374,5 @@ migrate(storagePath)
console.error("Migration failed:", error);
process.exit(1);
});

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -748,3 +748,5 @@ export function isConfigured(): boolean {
// The system should check specific sub-configurations when features are invoked.
return true;
}

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -632,3 +632,5 @@ function formatMemoriesForCompaction(memories: any[]): string {

return output;
}

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ export const id =
typeof pkg.name === "string" && pkg.name.trim() ? pkg.name.trim() : "opencode-mem0";
export { OpenCodeMemPlugin };
export default { id, server: OpenCodeMemPlugin } satisfies PluginModule;

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/ai/ai-provider-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,5 @@ export class AIProviderFactory {
return aiSessionManager.cleanupExpiredSessions();
}
}

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/ai/opencode-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,3 +286,5 @@ export async function generateStructuredOutput<T>(options: {
});
return result.output as T;
}

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/ai/provider-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ export function buildMemoryProviderConfig(
iterationTimeout: overrides.iterationTimeout ?? config.autoCaptureIterationTimeout,
};
}

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/ai/providers/anthropic-messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,3 +243,5 @@ export class AnthropicMessagesProvider extends BaseAIProvider {
return null;
}
}

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/ai/providers/base-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,5 @@ export abstract class BaseAIProvider {

abstract supportsSession(): boolean;
}

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/ai/providers/google-gemini.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,3 +277,5 @@ export class GoogleGeminiProvider extends BaseAIProvider {
return { success: false, error: `Max iterations (${maxIterations}) reached`, iterations };
}
}

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/ai/providers/openai-chat-completion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -444,3 +444,5 @@ export class OpenAIChatCompletionProvider extends BaseAIProvider {
};
}
}

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/ai/providers/openai-responses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,3 +235,5 @@ export class OpenAIResponsesProvider extends BaseAIProvider {
return data;
}
}

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/ai/session/ai-session-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
private readonly sessionRetentionMs: number;

constructor() {
this.dbPath = join(CONFIG.storagePath, AI_SESSIONS_DB_NAME);

Check failure on line 24 in src/services/ai/session/ai-session-manager.ts

View workflow job for this annotation

GitHub Actions / check

TypeError: undefined is not an object (evaluating 'CONFIG.storagePath')

at new AISessionManager (/home/runner/work/opencode-mem0/opencode-mem0/src/services/ai/session/ai-session-manager.ts:24:24) at /home/runner/work/opencode-mem0/opencode-mem0/src/services/ai/session/ai-session-manager.ts:225:33 at requestImportModule (2:1)
const dir = dirname(this.dbPath);
if (!existsSync(dir)) {
mkdirSync(dir, { recursive: true });
Expand Down Expand Up @@ -223,3 +223,5 @@
}

export const aiSessionManager = new AISessionManager();

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/ai/session/session-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@ export interface SessionUpdateParams {
conversationId?: string;
metadata?: Record<string, any>;
}

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/ai/tools/tool-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,5 @@ export class ToolSchemaConverter {
};
}
}

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/ai/validators/user-profile-validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,5 @@ export class UserProfileValidator {
return errors;
}
}

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/api-handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1171,3 +1171,5 @@ export async function handleConflictStats(): Promise<
return { success: false, error: "Internal error" };
}
}

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/auto-capture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -387,3 +387,5 @@ Analyze this conversation. If it contains technical work (code, bugs, features,
tags: (result.data.tags || []).map((t: string) => t.toLowerCase().trim()),
};
}

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/cleanup-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,5 @@ export class CleanupService {
}

export const cleanupService = new CleanupService();

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -444,3 +444,5 @@ export class LocalMemoryClient {
}

export const memoryClient = new LocalMemoryClient();

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,5 @@ export function formatContextForPrompt(

return parts.join("\n");
}

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/deduplication-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,5 @@ export class DeduplicationService {
}

export const deduplicationService = new DeduplicationService();

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/embedding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,5 @@ export class EmbeddingService {
}

export const embeddingService = EmbeddingService.getInstance();

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/jsonc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,5 @@ export function stripJsoncComments(content: string): string {
// Remove trailing commas before } or ]
return result.replace(/,\s*([}\]])/g, "$1");
}

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/language-detector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ export function getLanguageName(code: string): string {
}
return lang?.name || "English";
}

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,5 @@ export function log(message: string, data?: unknown) {
: `[${timestamp}] ${message}\n`;
appendFileSync(logFile, line);
}

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/memory-conflicts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -647,3 +647,5 @@ export function getAllUnresolvedConflicts(

return allConflicts.sort((a, b) => b.detectedAt - a.detectedAt).slice(0, limit);
}

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/memory-lifecycle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -404,3 +404,5 @@ export async function runLifecycleMaintenance(): Promise<void> {
log("Lifecycle maintenance error", { error: String(error) });
}
}

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/memory-scoring-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,3 +230,5 @@ export async function runOneTimeScoringRecalculation(): Promise<{
}> {
return recalculateAllScores(true);
}

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/memory-scoring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -619,3 +619,5 @@ export function recordAccess(currentAccessCount: number): {
lastAccessed: Date.now(),
};
}

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/migration-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,3 +341,5 @@ export class MigrationService {
}

export const migrationService = new MigrationService();

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/platform-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,5 @@ export function serve(options: ServeOptions): Promise<PlatformServer> {

return createNodeServer(options);
}

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/privacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ export function isFullyPrivate(content: string): boolean {
const stripped = stripPrivateContent(content).trim();
return stripped === "[REDACTED]" || stripped === "";
}

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/retrieval-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,5 @@ export function calculateDiversityPenalty(

return 0;
}

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/secret-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,5 @@ export function resolveSecretValue(value: string | undefined): string | undefine

return value;
}

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/sqlite/connection-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,5 @@ export class ConnectionManager {
}

export const connectionManager = new ConnectionManager();

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/sqlite/shard-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,3 +403,5 @@ export class ShardManager {
}

export const shardManager = new ShardManager();

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/sqlite/sqlite-bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,5 @@ export function getDatabase(): new (path: string) => Database {
}
return DatabaseImpl;
}

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/sqlite/transcript-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,3 +275,5 @@ export class TranscriptManager {
}

export const transcriptManager = new TranscriptManager();

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/sqlite/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,5 @@ export interface SearchResult {
contextBoost?: number;
finalScore?: number;
}

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/sqlite/vector-search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -664,3 +664,5 @@ export class VectorSearch {
}

export const vectorSearch = new VectorSearch();

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/tags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,5 @@ export function getTags(directory: string): {
project: getProjectTagInfo(directory),
};
}

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/transcript-capture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,5 @@ export async function cleanupOldTranscripts(): Promise<number> {

return transcriptManager.deleteOldTranscripts(cutoffTime);
}

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/user-memory-learning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,3 +305,5 @@ Use the update_user_profile tool to save the ${existingProfile ? "updated" : "ne

return rawData as UserProfileData;
}

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/user-profile/profile-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,5 @@ export function getUserProfileContext(userId: string): string | null {

return parts.join("\n");
}

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/user-profile/profile-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,5 @@ export const safeObject = <T extends object>(obj: any, fallback: T): T => {
}
return result && typeof result === "object" && !Array.isArray(result) ? (result as T) : fallback;
};

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/user-profile/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,5 @@ export interface UserProfileChangelog {
profileDataSnapshot: string;
createdAt: number;
}

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/user-profile/user-profile-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,3 +395,5 @@ export class UserProfileManager {
}

export const userProfileManager = new UserProfileManager();

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/user-prompt/user-prompt-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,3 +256,5 @@ export class UserPromptManager {
}

export const userPromptManager = new UserPromptManager();

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/vector-backends/backend-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,5 @@ export async function createVectorBackend(
return exactScanBackend;
}
}

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/vector-backends/exact-scan-backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,5 @@ export class ExactScanBackend implements VectorBackend {
return dot / (Math.sqrt(magA) * Math.sqrt(magB));
}
}

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/vector-backends/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,5 @@ export interface VectorBackendFactoryOptions {
probeUSearch?: () => Promise<boolean>;
createUSearchBackend?: () => VectorBackend;
}

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/vector-backends/usearch-backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,3 +239,5 @@ export class USearchBackend implements VectorBackend {
}
}
}

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/web-server-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,3 +367,5 @@ self.onmessage = async (event: MessageEvent<WorkerMessage>) => {
} as WorkerResponse);
}
};

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/services/web-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -523,3 +523,5 @@ export async function startWebServer(config: WebServerConfig): Promise<WebServer
await server.start();
return server;
}

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ export interface MemoryMetadata {
}

export type AIProviderType = "openai-chat" | "openai-responses" | "anthropic";

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/types/usearch.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
declare module "usearch";

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/web/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -1388,3 +1388,5 @@ document.addEventListener("DOMContentLoaded", async () => {

lucide.createIcons();
});

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions src/web/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,3 +265,5 @@ window.t = t;
window.getLanguage = getLanguage;
window.setLanguage = setLanguage;
window.applyLanguage = applyLanguage;

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions tests/ai-provider-config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,3 +235,5 @@ describe("AI provider config", () => {
expect(capturedBody?.temperature).toBeUndefined();
});
});

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions tests/anthropic-provider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,5 @@ describe("AnthropicMessagesProvider", () => {
expect(capturedBody?.max_tokens).toBe(2048);
});
});

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions tests/config-resolution.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,5 @@ describe("project-scoped config resolution", () => {
expect(CONFIG.opencodeProvider).toBeUndefined();
});
});

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions tests/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,5 @@ describe("config", () => {
});
});
});

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions tests/language-detector.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,5 @@ describe("getLanguageName", () => {
expect(getLanguageName("xyz")).toBe("English");
});
});

// AUDIT_TRIGGER — Round 3 full repo audit
2 changes: 2 additions & 0 deletions tests/memory-engine.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -721,3 +721,5 @@ describe("Memory Engine Integration", () => {
});
});
});

// AUDIT_TRIGGER — Round 3 full repo audit
Loading
Loading