fix: 修复 ESM 模块导入路径,添加 .js 后缀兼容 Node.js ESM 加载
- 所有内部模块导入添加 .js 后缀 - types.ts 添加 __types 导出标记 - 确保运行时模块能被正确加载
This commit is contained in:
@ -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;
|
||||
|
||||
@ -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';
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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 };
|
||||
|
||||
|
||||
@ -7,6 +7,8 @@ export interface Entity {
|
||||
updatedAt: Date;
|
||||
}
|
||||
|
||||
export const __types = true;
|
||||
|
||||
export type RelationStatus = 'active' | 'deleted' | 'archived' | 'superseded';
|
||||
|
||||
export interface Relation {
|
||||
|
||||
Reference in New Issue
Block a user