fix: 修复 ESM 模块导入路径,添加 .js 后缀兼容 Node.js ESM 加载

- 所有内部模块导入添加 .js 后缀
- types.ts 添加 __types 导出标记
- 确保运行时模块能被正确加载
This commit is contained in:
root
2026-04-24 16:02:24 +08:00
parent c930b20e84
commit 33a2b8c749
5 changed files with 10 additions and 8 deletions

View File

@ -2,7 +2,7 @@ import Database from 'better-sqlite3';
import type {
Entity, Relation, RecallParams, CommitParams, PurgeParams,
RecallResult, CommitResult, PurgeResult, MemoryStats
} from './types';
} from './types.js';
export class GraphDatabase {
private db: Database.Database;

View File

@ -1,3 +1,3 @@
export * from './types';
export * from './graph_database';
export { MemoryService } from './memory_service';
export * from './types.js';
export * from './graph_database.js';
export { MemoryService } from './memory_service.js';

View File

@ -1,5 +1,5 @@
import { GraphDatabase } from './graph_database';
import { TaskNodeStore } from './task_node_store';
import { GraphDatabase } from './graph_database.js';
import { TaskNodeStore } from './task_node_store.js';
import * as fs from 'fs';
import * as path from 'path';
import type {
@ -8,7 +8,7 @@ import type {
ContextRewriteParams, ContextRewriteResult,
WorkingMemoryChainParams, WorkingMemoryChainResult,
TaskNodeCreateParams, TaskNodeChainResult
} from './types';
} from './types.js';
export class MemoryService {
private db: GraphDatabase;

View File

@ -1,7 +1,7 @@
import Database from 'better-sqlite3';
import * as fs from 'fs';
import * as path from 'path';
import type { TaskNodeData } from './types';
import type { TaskNodeData } from './types.js';
export { TaskNodeData as TaskNode };

View File

@ -7,6 +7,8 @@ export interface Entity {
updatedAt: Date;
}
export const __types = true;
export type RelationStatus = 'active' | 'deleted' | 'archived' | 'superseded';
export interface Relation {