@tonycasey/lisa 1.2.0 → 2.0.0
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.
- package/README.md +22 -15
- package/dist/hooks/session-start.js +43114 -0
- package/dist/hooks/session-stop.js +42699 -0
- package/dist/hooks/user-prompt-submit.js +42757 -0
- package/dist/lib/application/handlers/PromptSubmitHandler.d.ts +27 -0
- package/dist/lib/application/handlers/PromptSubmitHandler.d.ts.map +1 -0
- package/dist/lib/application/handlers/PromptSubmitHandler.js +53 -0
- package/dist/lib/application/handlers/PromptSubmitHandler.js.map +1 -0
- package/dist/lib/application/handlers/SessionStartHandler.d.ts +50 -0
- package/dist/lib/application/handlers/SessionStartHandler.d.ts.map +1 -0
- package/dist/lib/application/handlers/SessionStartHandler.js +448 -0
- package/dist/lib/application/handlers/SessionStartHandler.js.map +1 -0
- package/dist/lib/application/handlers/SessionStopHandler.d.ts +15 -0
- package/dist/lib/application/handlers/SessionStopHandler.d.ts.map +1 -0
- package/dist/lib/application/handlers/SessionStopHandler.js +35 -0
- package/dist/lib/application/handlers/SessionStopHandler.js.map +1 -0
- package/dist/lib/application/handlers/index.d.ts +8 -0
- package/dist/lib/application/handlers/index.d.ts.map +1 -0
- package/dist/lib/application/handlers/index.js +14 -0
- package/dist/lib/application/handlers/index.js.map +1 -0
- package/dist/lib/application/index.d.ts +13 -0
- package/dist/lib/application/index.d.ts.map +1 -0
- package/dist/lib/application/index.js +31 -0
- package/dist/lib/application/index.js.map +1 -0
- package/dist/lib/application/interfaces/ISessionStartResult.d.ts +22 -0
- package/dist/lib/application/interfaces/ISessionStartResult.d.ts.map +1 -0
- package/dist/lib/application/interfaces/ISessionStartResult.js +3 -0
- package/dist/lib/application/interfaces/ISessionStartResult.js.map +1 -0
- package/dist/lib/application/interfaces/index.d.ts +5 -0
- package/dist/lib/application/interfaces/index.d.ts.map +1 -0
- package/dist/lib/application/interfaces/index.js +6 -0
- package/dist/lib/application/interfaces/index.js.map +1 -0
- package/dist/lib/cli.d.ts +34 -0
- package/dist/lib/cli.d.ts.map +1 -0
- package/dist/lib/cli.js +664 -0
- package/dist/lib/cli.js.map +1 -0
- package/dist/lib/domain/errors/LisaError.d.ts +41 -0
- package/dist/lib/domain/errors/LisaError.d.ts.map +1 -0
- package/dist/lib/domain/errors/LisaError.js +69 -0
- package/dist/lib/domain/errors/LisaError.js.map +1 -0
- package/dist/lib/domain/errors/index.d.ts +5 -0
- package/dist/lib/domain/errors/index.d.ts.map +1 -0
- package/dist/lib/domain/errors/index.js +14 -0
- package/dist/lib/domain/errors/index.js.map +1 -0
- package/dist/lib/domain/index.d.ts +14 -0
- package/dist/lib/domain/index.d.ts.map +1 -0
- package/dist/lib/domain/index.js +33 -0
- package/dist/lib/domain/index.js.map +1 -0
- package/dist/lib/domain/interfaces/IEventEmitter.d.ts +32 -0
- package/dist/lib/domain/interfaces/IEventEmitter.d.ts.map +1 -0
- package/dist/lib/domain/interfaces/IEventEmitter.js +3 -0
- package/dist/lib/domain/interfaces/IEventEmitter.js.map +1 -0
- package/dist/lib/domain/interfaces/ILisaContext.d.ts +25 -0
- package/dist/lib/domain/interfaces/ILisaContext.d.ts.map +1 -0
- package/dist/lib/domain/interfaces/ILisaContext.js +3 -0
- package/dist/lib/domain/interfaces/ILisaContext.js.map +1 -0
- package/dist/lib/domain/interfaces/ILisaServices.d.ts +34 -0
- package/dist/lib/domain/interfaces/ILisaServices.d.ts.map +1 -0
- package/dist/lib/domain/interfaces/ILisaServices.js +3 -0
- package/dist/lib/domain/interfaces/ILisaServices.js.map +1 -0
- package/dist/lib/domain/interfaces/ILogger.d.ts +94 -0
- package/dist/lib/domain/interfaces/ILogger.d.ts.map +1 -0
- package/dist/lib/domain/interfaces/ILogger.js +3 -0
- package/dist/lib/domain/interfaces/ILogger.js.map +1 -0
- package/dist/lib/domain/interfaces/IMcpClient.d.ts +31 -0
- package/dist/lib/domain/interfaces/IMcpClient.d.ts.map +1 -0
- package/dist/lib/domain/interfaces/IMcpClient.js +3 -0
- package/dist/lib/domain/interfaces/IMcpClient.js.map +1 -0
- package/dist/lib/domain/interfaces/IMemoryService.d.ts +56 -0
- package/dist/lib/domain/interfaces/IMemoryService.d.ts.map +1 -0
- package/dist/lib/domain/interfaces/IMemoryService.js +3 -0
- package/dist/lib/domain/interfaces/IMemoryService.js.map +1 -0
- package/dist/lib/domain/interfaces/IRecursionService.d.ts +52 -0
- package/dist/lib/domain/interfaces/IRecursionService.d.ts.map +1 -0
- package/dist/lib/domain/interfaces/IRecursionService.js +3 -0
- package/dist/lib/domain/interfaces/IRecursionService.js.map +1 -0
- package/dist/lib/domain/interfaces/ISessionCaptureService.d.ts +16 -0
- package/dist/lib/domain/interfaces/ISessionCaptureService.d.ts.map +1 -0
- package/dist/lib/domain/interfaces/ISessionCaptureService.js +3 -0
- package/dist/lib/domain/interfaces/ISessionCaptureService.js.map +1 -0
- package/dist/lib/domain/interfaces/ITaskService.d.ts +52 -0
- package/dist/lib/domain/interfaces/ITaskService.d.ts.map +1 -0
- package/dist/lib/domain/interfaces/ITaskService.js +3 -0
- package/dist/lib/domain/interfaces/ITaskService.js.map +1 -0
- package/dist/lib/domain/interfaces/dal/IConnectionManager.d.ts +110 -0
- package/dist/lib/domain/interfaces/dal/IConnectionManager.d.ts.map +1 -0
- package/dist/lib/domain/interfaces/dal/IConnectionManager.js +8 -0
- package/dist/lib/domain/interfaces/dal/IConnectionManager.js.map +1 -0
- package/dist/lib/domain/interfaces/dal/IMemoryRepository.d.ts +93 -0
- package/dist/lib/domain/interfaces/dal/IMemoryRepository.d.ts.map +1 -0
- package/dist/lib/domain/interfaces/dal/IMemoryRepository.js +9 -0
- package/dist/lib/domain/interfaces/dal/IMemoryRepository.js.map +1 -0
- package/dist/lib/domain/interfaces/dal/IRepositoryRouter.d.ts +88 -0
- package/dist/lib/domain/interfaces/dal/IRepositoryRouter.d.ts.map +1 -0
- package/dist/lib/domain/interfaces/dal/IRepositoryRouter.js +23 -0
- package/dist/lib/domain/interfaces/dal/IRepositoryRouter.js.map +1 -0
- package/dist/lib/domain/interfaces/dal/ITaskRepository.d.ts +87 -0
- package/dist/lib/domain/interfaces/dal/ITaskRepository.d.ts.map +1 -0
- package/dist/lib/domain/interfaces/dal/ITaskRepository.js +9 -0
- package/dist/lib/domain/interfaces/dal/ITaskRepository.js.map +1 -0
- package/dist/lib/domain/interfaces/dal/index.d.ts +14 -0
- package/dist/lib/domain/interfaces/dal/index.d.ts.map +1 -0
- package/dist/lib/domain/interfaces/dal/index.js +15 -0
- package/dist/lib/domain/interfaces/dal/index.js.map +1 -0
- package/dist/lib/domain/interfaces/dal/types.d.ts +81 -0
- package/dist/lib/domain/interfaces/dal/types.d.ts.map +1 -0
- package/dist/lib/domain/interfaces/dal/types.js +28 -0
- package/dist/lib/domain/interfaces/dal/types.js.map +1 -0
- package/dist/lib/domain/interfaces/events/IMemoryEvent.d.ts +27 -0
- package/dist/lib/domain/interfaces/events/IMemoryEvent.d.ts.map +1 -0
- package/dist/lib/domain/interfaces/events/IMemoryEvent.js +26 -0
- package/dist/lib/domain/interfaces/events/IMemoryEvent.js.map +1 -0
- package/dist/lib/domain/interfaces/events/IPromptSubmitEvent.d.ts +20 -0
- package/dist/lib/domain/interfaces/events/IPromptSubmitEvent.d.ts.map +1 -0
- package/dist/lib/domain/interfaces/events/IPromptSubmitEvent.js +16 -0
- package/dist/lib/domain/interfaces/events/IPromptSubmitEvent.js.map +1 -0
- package/dist/lib/domain/interfaces/events/ISessionStartEvent.d.ts +19 -0
- package/dist/lib/domain/interfaces/events/ISessionStartEvent.d.ts.map +1 -0
- package/dist/lib/domain/interfaces/events/ISessionStartEvent.js +15 -0
- package/dist/lib/domain/interfaces/events/ISessionStartEvent.js.map +1 -0
- package/dist/lib/domain/interfaces/events/ISessionStopEvent.d.ts +22 -0
- package/dist/lib/domain/interfaces/events/ISessionStopEvent.d.ts.map +1 -0
- package/dist/lib/domain/interfaces/events/ISessionStopEvent.js +15 -0
- package/dist/lib/domain/interfaces/events/ISessionStopEvent.js.map +1 -0
- package/dist/lib/domain/interfaces/events/LisaEvent.d.ts +13 -0
- package/dist/lib/domain/interfaces/events/LisaEvent.d.ts.map +1 -0
- package/dist/lib/domain/interfaces/events/LisaEvent.js +3 -0
- package/dist/lib/domain/interfaces/events/LisaEvent.js.map +1 -0
- package/dist/lib/domain/interfaces/events/index.d.ts +9 -0
- package/dist/lib/domain/interfaces/events/index.d.ts.map +1 -0
- package/dist/lib/domain/interfaces/events/index.js +16 -0
- package/dist/lib/domain/interfaces/events/index.js.map +1 -0
- package/dist/lib/domain/interfaces/index.d.ts +16 -0
- package/dist/lib/domain/interfaces/index.d.ts.map +1 -0
- package/dist/lib/domain/interfaces/index.js +25 -0
- package/dist/lib/domain/interfaces/index.js.map +1 -0
- package/dist/lib/domain/interfaces/types/ICapturedWork.d.ts +14 -0
- package/dist/lib/domain/interfaces/types/ICapturedWork.d.ts.map +1 -0
- package/dist/lib/domain/interfaces/types/ICapturedWork.js +14 -0
- package/dist/lib/domain/interfaces/types/ICapturedWork.js.map +1 -0
- package/dist/lib/domain/interfaces/types/IMemoryResult.d.ts +39 -0
- package/dist/lib/domain/interfaces/types/IMemoryResult.d.ts.map +1 -0
- package/dist/lib/domain/interfaces/types/IMemoryResult.js +29 -0
- package/dist/lib/domain/interfaces/types/IMemoryResult.js.map +1 -0
- package/dist/lib/domain/interfaces/types/ITask.d.ts +46 -0
- package/dist/lib/domain/interfaces/types/ITask.d.ts.map +1 -0
- package/dist/lib/domain/interfaces/types/ITask.js +17 -0
- package/dist/lib/domain/interfaces/types/ITask.js.map +1 -0
- package/dist/lib/domain/interfaces/types/index.d.ts +7 -0
- package/dist/lib/domain/interfaces/types/index.d.ts.map +1 -0
- package/dist/lib/domain/interfaces/types/index.js +14 -0
- package/dist/lib/domain/interfaces/types/index.js.map +1 -0
- package/dist/lib/domain/types/ISOTimestamp.d.ts +19 -0
- package/dist/lib/domain/types/ISOTimestamp.d.ts.map +1 -0
- package/dist/lib/domain/types/ISOTimestamp.js +18 -0
- package/dist/lib/domain/types/ISOTimestamp.js.map +1 -0
- package/dist/lib/domain/types/index.d.ts +7 -0
- package/dist/lib/domain/types/index.d.ts.map +1 -0
- package/dist/lib/domain/types/index.js +12 -0
- package/dist/lib/domain/types/index.js.map +1 -0
- package/dist/lib/infrastructure/adapters/claude/index.d.ts +8 -0
- package/dist/lib/infrastructure/adapters/claude/index.d.ts.map +1 -0
- package/dist/lib/infrastructure/adapters/claude/index.js +18 -0
- package/dist/lib/infrastructure/adapters/claude/index.js.map +1 -0
- package/dist/lib/infrastructure/adapters/claude/session-start.d.ts +9 -0
- package/dist/lib/infrastructure/adapters/claude/session-start.d.ts.map +1 -0
- package/dist/lib/infrastructure/adapters/claude/session-start.js +54 -0
- package/dist/lib/infrastructure/adapters/claude/session-start.js.map +1 -0
- package/dist/lib/infrastructure/adapters/claude/session-stop.d.ts +13 -0
- package/dist/lib/infrastructure/adapters/claude/session-stop.d.ts.map +1 -0
- package/dist/lib/infrastructure/adapters/claude/session-stop.js +43 -0
- package/dist/lib/infrastructure/adapters/claude/session-stop.js.map +1 -0
- package/dist/lib/infrastructure/adapters/claude/stdin.d.ts +13 -0
- package/dist/lib/infrastructure/adapters/claude/stdin.d.ts.map +1 -0
- package/dist/lib/infrastructure/adapters/claude/stdin.js +36 -0
- package/dist/lib/infrastructure/adapters/claude/stdin.js.map +1 -0
- package/dist/lib/infrastructure/adapters/claude/user-prompt-submit.d.ts +13 -0
- package/dist/lib/infrastructure/adapters/claude/user-prompt-submit.d.ts.map +1 -0
- package/dist/lib/infrastructure/adapters/claude/user-prompt-submit.js +58 -0
- package/dist/lib/infrastructure/adapters/claude/user-prompt-submit.js.map +1 -0
- package/dist/lib/infrastructure/adapters/opencode/index.d.ts +7 -0
- package/dist/lib/infrastructure/adapters/opencode/index.d.ts.map +1 -0
- package/dist/lib/infrastructure/adapters/opencode/index.js +18 -0
- package/dist/lib/infrastructure/adapters/opencode/index.js.map +1 -0
- package/dist/lib/infrastructure/adapters/opencode/opencode-events.d.ts +73 -0
- package/dist/lib/infrastructure/adapters/opencode/opencode-events.d.ts.map +1 -0
- package/dist/lib/infrastructure/adapters/opencode/opencode-events.js +131 -0
- package/dist/lib/infrastructure/adapters/opencode/opencode-events.js.map +1 -0
- package/dist/lib/infrastructure/adapters/opencode/plugin.d.ts +60 -0
- package/dist/lib/infrastructure/adapters/opencode/plugin.d.ts.map +1 -0
- package/dist/lib/infrastructure/adapters/opencode/plugin.js +147 -0
- package/dist/lib/infrastructure/adapters/opencode/plugin.js.map +1 -0
- package/dist/lib/infrastructure/context/ContextDetector.d.ts +92 -0
- package/dist/lib/infrastructure/context/ContextDetector.d.ts.map +1 -0
- package/dist/lib/infrastructure/context/ContextDetector.js +415 -0
- package/dist/lib/infrastructure/context/ContextDetector.js.map +1 -0
- package/dist/lib/infrastructure/context/index.d.ts +5 -0
- package/dist/lib/infrastructure/context/index.d.ts.map +1 -0
- package/dist/lib/infrastructure/context/index.js +9 -0
- package/dist/lib/infrastructure/context/index.js.map +1 -0
- package/dist/lib/infrastructure/dal/RepositoryFactory.d.ts +71 -0
- package/dist/lib/infrastructure/dal/RepositoryFactory.d.ts.map +1 -0
- package/dist/lib/infrastructure/dal/RepositoryFactory.js +134 -0
- package/dist/lib/infrastructure/dal/RepositoryFactory.js.map +1 -0
- package/dist/lib/infrastructure/dal/connections/McpConnectionManager.d.ts +56 -0
- package/dist/lib/infrastructure/dal/connections/McpConnectionManager.d.ts.map +1 -0
- package/dist/lib/infrastructure/dal/connections/McpConnectionManager.js +98 -0
- package/dist/lib/infrastructure/dal/connections/McpConnectionManager.js.map +1 -0
- package/dist/lib/infrastructure/dal/connections/Neo4jConnectionManager.d.ts +60 -0
- package/dist/lib/infrastructure/dal/connections/Neo4jConnectionManager.d.ts.map +1 -0
- package/dist/lib/infrastructure/dal/connections/Neo4jConnectionManager.js +181 -0
- package/dist/lib/infrastructure/dal/connections/Neo4jConnectionManager.js.map +1 -0
- package/dist/lib/infrastructure/dal/connections/ZepConnectionManager.d.ts +53 -0
- package/dist/lib/infrastructure/dal/connections/ZepConnectionManager.d.ts.map +1 -0
- package/dist/lib/infrastructure/dal/connections/ZepConnectionManager.js +168 -0
- package/dist/lib/infrastructure/dal/connections/ZepConnectionManager.js.map +1 -0
- package/dist/lib/infrastructure/dal/connections/index.d.ts +9 -0
- package/dist/lib/infrastructure/dal/connections/index.d.ts.map +1 -0
- package/dist/lib/infrastructure/dal/connections/index.js +18 -0
- package/dist/lib/infrastructure/dal/connections/index.js.map +1 -0
- package/dist/lib/infrastructure/dal/index.d.ts +27 -0
- package/dist/lib/infrastructure/dal/index.d.ts.map +1 -0
- package/dist/lib/infrastructure/dal/index.js +50 -0
- package/dist/lib/infrastructure/dal/index.js.map +1 -0
- package/dist/lib/infrastructure/dal/repositories/index.d.ts +7 -0
- package/dist/lib/infrastructure/dal/repositories/index.d.ts.map +1 -0
- package/dist/lib/infrastructure/dal/repositories/index.js +19 -0
- package/dist/lib/infrastructure/dal/repositories/index.js.map +1 -0
- package/dist/lib/infrastructure/dal/repositories/mcp/McpMemoryRepository.d.ts +54 -0
- package/dist/lib/infrastructure/dal/repositories/mcp/McpMemoryRepository.d.ts.map +1 -0
- package/dist/lib/infrastructure/dal/repositories/mcp/McpMemoryRepository.js +131 -0
- package/dist/lib/infrastructure/dal/repositories/mcp/McpMemoryRepository.js.map +1 -0
- package/dist/lib/infrastructure/dal/repositories/mcp/McpTaskRepository.d.ts +60 -0
- package/dist/lib/infrastructure/dal/repositories/mcp/McpTaskRepository.d.ts.map +1 -0
- package/dist/lib/infrastructure/dal/repositories/mcp/McpTaskRepository.js +182 -0
- package/dist/lib/infrastructure/dal/repositories/mcp/McpTaskRepository.js.map +1 -0
- package/dist/lib/infrastructure/dal/repositories/mcp/index.d.ts +6 -0
- package/dist/lib/infrastructure/dal/repositories/mcp/index.d.ts.map +1 -0
- package/dist/lib/infrastructure/dal/repositories/mcp/index.js +11 -0
- package/dist/lib/infrastructure/dal/repositories/mcp/index.js.map +1 -0
- package/dist/lib/infrastructure/dal/repositories/neo4j/Neo4jMemoryRepository.d.ts +47 -0
- package/dist/lib/infrastructure/dal/repositories/neo4j/Neo4jMemoryRepository.d.ts.map +1 -0
- package/dist/lib/infrastructure/dal/repositories/neo4j/Neo4jMemoryRepository.js +144 -0
- package/dist/lib/infrastructure/dal/repositories/neo4j/Neo4jMemoryRepository.js.map +1 -0
- package/dist/lib/infrastructure/dal/repositories/neo4j/Neo4jTaskRepository.d.ts +46 -0
- package/dist/lib/infrastructure/dal/repositories/neo4j/Neo4jTaskRepository.d.ts.map +1 -0
- package/dist/lib/infrastructure/dal/repositories/neo4j/Neo4jTaskRepository.js +160 -0
- package/dist/lib/infrastructure/dal/repositories/neo4j/Neo4jTaskRepository.js.map +1 -0
- package/dist/lib/infrastructure/dal/repositories/neo4j/index.d.ts +6 -0
- package/dist/lib/infrastructure/dal/repositories/neo4j/index.d.ts.map +1 -0
- package/dist/lib/infrastructure/dal/repositories/neo4j/index.js +11 -0
- package/dist/lib/infrastructure/dal/repositories/neo4j/index.js.map +1 -0
- package/dist/lib/infrastructure/dal/repositories/zep/ZepMemoryRepository.d.ts +55 -0
- package/dist/lib/infrastructure/dal/repositories/zep/ZepMemoryRepository.d.ts.map +1 -0
- package/dist/lib/infrastructure/dal/repositories/zep/ZepMemoryRepository.js +165 -0
- package/dist/lib/infrastructure/dal/repositories/zep/ZepMemoryRepository.js.map +1 -0
- package/dist/lib/infrastructure/dal/repositories/zep/ZepTaskRepository.d.ts +58 -0
- package/dist/lib/infrastructure/dal/repositories/zep/ZepTaskRepository.d.ts.map +1 -0
- package/dist/lib/infrastructure/dal/repositories/zep/ZepTaskRepository.js +206 -0
- package/dist/lib/infrastructure/dal/repositories/zep/ZepTaskRepository.js.map +1 -0
- package/dist/lib/infrastructure/dal/repositories/zep/index.d.ts +6 -0
- package/dist/lib/infrastructure/dal/repositories/zep/index.d.ts.map +1 -0
- package/dist/lib/infrastructure/dal/repositories/zep/index.js +11 -0
- package/dist/lib/infrastructure/dal/repositories/zep/index.js.map +1 -0
- package/dist/lib/infrastructure/dal/routing/RepositoryRouter.d.ts +73 -0
- package/dist/lib/infrastructure/dal/routing/RepositoryRouter.d.ts.map +1 -0
- package/dist/lib/infrastructure/dal/routing/RepositoryRouter.js +170 -0
- package/dist/lib/infrastructure/dal/routing/RepositoryRouter.js.map +1 -0
- package/dist/lib/infrastructure/dal/routing/index.d.ts +5 -0
- package/dist/lib/infrastructure/dal/routing/index.d.ts.map +1 -0
- package/dist/lib/infrastructure/dal/routing/index.js +10 -0
- package/dist/lib/infrastructure/dal/routing/index.js.map +1 -0
- package/dist/lib/infrastructure/di/ServiceFactory.d.ts +44 -0
- package/dist/lib/infrastructure/di/ServiceFactory.d.ts.map +1 -0
- package/dist/lib/infrastructure/di/ServiceFactory.js +141 -0
- package/dist/lib/infrastructure/di/ServiceFactory.js.map +1 -0
- package/dist/lib/infrastructure/di/index.d.ts +5 -0
- package/dist/lib/infrastructure/di/index.d.ts.map +1 -0
- package/dist/lib/infrastructure/di/index.js +10 -0
- package/dist/lib/infrastructure/di/index.js.map +1 -0
- package/dist/lib/infrastructure/index.d.ts +17 -0
- package/dist/lib/infrastructure/index.d.ts.map +1 -0
- package/dist/lib/infrastructure/index.js +41 -0
- package/dist/lib/infrastructure/index.js.map +1 -0
- package/dist/lib/infrastructure/logging/Logger.d.ts +50 -0
- package/dist/lib/infrastructure/logging/Logger.d.ts.map +1 -0
- package/dist/lib/infrastructure/logging/Logger.js +167 -0
- package/dist/lib/infrastructure/logging/Logger.js.map +1 -0
- package/dist/lib/infrastructure/logging/context.d.ts +51 -0
- package/dist/lib/infrastructure/logging/context.d.ts.map +1 -0
- package/dist/lib/infrastructure/logging/context.js +77 -0
- package/dist/lib/infrastructure/logging/context.js.map +1 -0
- package/dist/lib/infrastructure/logging/factory.d.ts +36 -0
- package/dist/lib/infrastructure/logging/factory.d.ts.map +1 -0
- package/dist/lib/infrastructure/logging/factory.js +122 -0
- package/dist/lib/infrastructure/logging/factory.js.map +1 -0
- package/dist/lib/infrastructure/logging/index.d.ts +26 -0
- package/dist/lib/infrastructure/logging/index.d.ts.map +1 -0
- package/dist/lib/infrastructure/logging/index.js +45 -0
- package/dist/lib/infrastructure/logging/index.js.map +1 -0
- package/dist/lib/infrastructure/mcp/McpClient.d.ts +36 -0
- package/dist/lib/infrastructure/mcp/McpClient.d.ts.map +1 -0
- package/dist/lib/infrastructure/mcp/McpClient.js +155 -0
- package/dist/lib/infrastructure/mcp/McpClient.js.map +1 -0
- package/dist/lib/infrastructure/mcp/index.d.ts +5 -0
- package/dist/lib/infrastructure/mcp/index.d.ts.map +1 -0
- package/dist/lib/infrastructure/mcp/index.js +9 -0
- package/dist/lib/infrastructure/mcp/index.js.map +1 -0
- package/dist/lib/infrastructure/services/EventEmitter.d.ts +24 -0
- package/dist/lib/infrastructure/services/EventEmitter.d.ts.map +1 -0
- package/dist/lib/infrastructure/services/EventEmitter.js +41 -0
- package/dist/lib/infrastructure/services/EventEmitter.js.map +1 -0
- package/dist/lib/infrastructure/services/MemoryService.d.ts +48 -0
- package/dist/lib/infrastructure/services/MemoryService.d.ts.map +1 -0
- package/dist/lib/infrastructure/services/MemoryService.js +298 -0
- package/dist/lib/infrastructure/services/MemoryService.js.map +1 -0
- package/dist/lib/infrastructure/services/RecursionService.d.ts +50 -0
- package/dist/lib/infrastructure/services/RecursionService.d.ts.map +1 -0
- package/dist/lib/infrastructure/services/RecursionService.js +233 -0
- package/dist/lib/infrastructure/services/RecursionService.js.map +1 -0
- package/dist/lib/infrastructure/services/SessionCaptureService.d.ts +31 -0
- package/dist/lib/infrastructure/services/SessionCaptureService.d.ts.map +1 -0
- package/dist/lib/infrastructure/services/SessionCaptureService.js +38 -0
- package/dist/lib/infrastructure/services/SessionCaptureService.js.map +1 -0
- package/dist/lib/infrastructure/services/TaskService.d.ts +38 -0
- package/dist/lib/infrastructure/services/TaskService.d.ts.map +1 -0
- package/dist/lib/infrastructure/services/TaskService.js +227 -0
- package/dist/lib/infrastructure/services/TaskService.js.map +1 -0
- package/dist/lib/infrastructure/services/index.d.ts +9 -0
- package/dist/lib/infrastructure/services/index.d.ts.map +1 -0
- package/dist/lib/infrastructure/services/index.js +17 -0
- package/dist/lib/infrastructure/services/index.js.map +1 -0
- package/dist/lib/interfaces/IDockerClient.d.ts +6 -0
- package/dist/lib/interfaces/IDockerClient.d.ts.map +1 -0
- package/dist/lib/interfaces/IDockerClient.js +1 -0
- package/dist/lib/interfaces/IDockerClient.js.map +1 -0
- package/dist/lib/interfaces/IMcpClient.d.ts +7 -0
- package/dist/lib/interfaces/IMcpClient.d.ts.map +1 -0
- package/dist/lib/interfaces/IMcpClient.js +1 -0
- package/dist/lib/interfaces/IMcpClient.js.map +1 -0
- package/dist/lib/interfaces/IServices.d.ts +9 -0
- package/dist/lib/interfaces/IServices.d.ts.map +1 -0
- package/dist/lib/interfaces/IServices.js +1 -0
- package/dist/lib/interfaces/IServices.js.map +1 -0
- package/dist/lib/interfaces/ITemplateCopier.d.ts +6 -0
- package/dist/lib/interfaces/ITemplateCopier.d.ts.map +1 -0
- package/dist/lib/interfaces/ITemplateCopier.js +1 -0
- package/dist/lib/interfaces/ITemplateCopier.js.map +1 -0
- package/dist/lib/mcp.d.ts +5 -0
- package/dist/lib/mcp.d.ts.map +1 -0
- package/dist/lib/mcp.js +12 -1
- package/dist/lib/mcp.js.map +1 -0
- package/dist/lib/scanner/analyzer.d.ts +51 -0
- package/dist/lib/scanner/analyzer.d.ts.map +1 -0
- package/dist/lib/scanner/analyzer.js +6 -1
- package/dist/lib/scanner/analyzer.js.map +1 -0
- package/dist/lib/scanner/discovery.d.ts +25 -0
- package/dist/lib/scanner/discovery.d.ts.map +1 -0
- package/dist/lib/scanner/discovery.js +4 -3
- package/dist/lib/scanner/discovery.js.map +1 -0
- package/dist/lib/scanner/facts.d.ts +33 -0
- package/dist/lib/scanner/facts.d.ts.map +1 -0
- package/dist/lib/scanner/facts.js +23 -5
- package/dist/lib/scanner/facts.js.map +1 -0
- package/dist/lib/scanner/index.d.ts +31 -0
- package/dist/lib/scanner/index.d.ts.map +1 -0
- package/dist/lib/scanner/index.js +1 -6
- package/dist/lib/scanner/index.js.map +1 -0
- package/dist/lib/scanner/reviewer.d.ts +62 -0
- package/dist/lib/scanner/reviewer.d.ts.map +1 -0
- package/dist/lib/scanner/reviewer.js +26 -8
- package/dist/lib/scanner/reviewer.js.map +1 -0
- package/dist/lib/services.d.ts +7 -0
- package/dist/lib/services.d.ts.map +1 -0
- package/dist/lib/services.js +1 -0
- package/dist/lib/services.js.map +1 -0
- package/dist/opencode/lisa.js +43344 -0
- package/dist/package.json +15 -3
- package/dist/project/.lisa/.env.template +18 -0
- package/dist/{templates → project/.lisa}/rules/shared/git-rules.md +6 -6
- package/dist/project/.lisa/skills/common/group-id.d.ts.map +1 -0
- package/dist/{templates/agents → project/.lisa}/skills/common/group-id.js +1 -0
- package/dist/project/.lisa/skills/common/group-id.js.map +1 -0
- package/dist/project/.lisa/skills/common/type-mappings.d.ts.map +1 -0
- package/dist/project/.lisa/skills/common/type-mappings.js +93 -0
- package/dist/project/.lisa/skills/common/type-mappings.js.map +1 -0
- package/dist/{templates/agents → project/.lisa}/skills/git/SKILL.md +7 -7
- package/dist/project/.lisa/skills/git/scripts/bump-version.d.ts.map +1 -0
- package/dist/project/.lisa/skills/git/scripts/bump-version.js +58 -0
- package/dist/project/.lisa/skills/git/scripts/bump-version.js.map +1 -0
- package/dist/{templates/agents → project/.lisa}/skills/init-review/SKILL.md +2 -2
- package/dist/project/.lisa/skills/init-review/scripts/ai-enrich.d.ts.map +1 -0
- package/dist/project/.lisa/skills/init-review/scripts/ai-enrich.js +177 -0
- package/dist/project/.lisa/skills/init-review/scripts/ai-enrich.js.map +1 -0
- package/dist/project/.lisa/skills/init-review/scripts/init-review.d.ts.map +1 -0
- package/dist/project/.lisa/skills/init-review/scripts/init-review.js +143 -0
- package/dist/project/.lisa/skills/init-review/scripts/init-review.js.map +1 -0
- package/dist/project/.lisa/skills/jira/scripts/jira.d.ts.map +1 -0
- package/dist/project/.lisa/skills/jira/scripts/jira.js +159 -0
- package/dist/project/.lisa/skills/jira/scripts/jira.js.map +1 -0
- package/dist/{templates/agents → project/.lisa}/skills/lisa/SKILL.md +17 -15
- package/dist/project/.lisa/skills/lisa/scripts/compile-skills.d.ts.map +1 -0
- package/dist/project/.lisa/skills/lisa/scripts/compile-skills.js +75 -0
- package/dist/project/.lisa/skills/lisa/scripts/compile-skills.js.map +1 -0
- package/dist/project/.lisa/skills/lisa/scripts/storage.d.ts.map +1 -0
- package/dist/project/.lisa/skills/lisa/scripts/storage.js +114 -0
- package/dist/project/.lisa/skills/lisa/scripts/storage.js.map +1 -0
- package/dist/{templates/agents → project/.lisa}/skills/memory/SKILL.md +3 -3
- package/dist/project/.lisa/skills/memory/scripts/memory.d.ts.map +1 -0
- package/dist/project/.lisa/skills/memory/scripts/memory.js +95 -0
- package/dist/project/.lisa/skills/memory/scripts/memory.js.map +1 -0
- package/dist/{templates/agents → project/.lisa}/skills/prompt/SKILL.md +1 -1
- package/dist/project/.lisa/skills/prompt/scripts/prompt.d.ts.map +1 -0
- package/dist/project/.lisa/skills/prompt/scripts/prompt.js +80 -0
- package/dist/project/.lisa/skills/prompt/scripts/prompt.js.map +1 -0
- package/dist/project/.lisa/skills/shared/clients/McpClient.d.ts.map +1 -0
- package/dist/project/.lisa/skills/shared/clients/McpClient.js +117 -0
- package/dist/project/.lisa/skills/shared/clients/McpClient.js.map +1 -0
- package/dist/project/.lisa/skills/shared/clients/Neo4jClient.d.ts.map +1 -0
- package/dist/project/.lisa/skills/shared/clients/Neo4jClient.js +81 -0
- package/dist/project/.lisa/skills/shared/clients/Neo4jClient.js.map +1 -0
- package/dist/project/.lisa/skills/shared/clients/ZepClient.d.ts.map +1 -0
- package/dist/project/.lisa/skills/shared/clients/ZepClient.js +238 -0
- package/dist/project/.lisa/skills/shared/clients/ZepClient.js.map +1 -0
- package/dist/project/.lisa/skills/shared/clients/index.d.ts.map +1 -0
- package/dist/project/.lisa/skills/shared/clients/index.js +33 -0
- package/dist/project/.lisa/skills/shared/clients/index.js.map +1 -0
- package/dist/project/.lisa/skills/shared/clients/interfaces/IMcpClient.d.ts.map +1 -0
- package/dist/project/.lisa/skills/shared/clients/interfaces/IMcpClient.js +3 -0
- package/dist/project/.lisa/skills/shared/clients/interfaces/IMcpClient.js.map +1 -0
- package/dist/project/.lisa/skills/shared/clients/interfaces/INeo4jClient.d.ts.map +1 -0
- package/dist/project/.lisa/skills/shared/clients/interfaces/INeo4jClient.js +3 -0
- package/dist/project/.lisa/skills/shared/clients/interfaces/INeo4jClient.js.map +1 -0
- package/dist/project/.lisa/skills/shared/clients/interfaces/IZepClient.d.ts.map +1 -0
- package/dist/project/.lisa/skills/shared/clients/interfaces/IZepClient.js +3 -0
- package/dist/project/.lisa/skills/shared/clients/interfaces/IZepClient.js.map +1 -0
- package/dist/project/.lisa/skills/shared/clients/interfaces/index.d.ts.map +1 -0
- package/dist/project/.lisa/skills/shared/clients/interfaces/index.js +23 -0
- package/dist/project/.lisa/skills/shared/clients/interfaces/index.js.map +1 -0
- package/dist/project/.lisa/skills/shared/group-id.d.ts.map +1 -0
- package/dist/project/.lisa/skills/shared/group-id.js +18 -0
- package/dist/project/.lisa/skills/shared/group-id.js.map +1 -0
- package/dist/project/.lisa/skills/shared/index.d.ts.map +1 -0
- package/dist/project/.lisa/skills/shared/index.js +31 -0
- package/dist/project/.lisa/skills/shared/index.js.map +1 -0
- package/dist/project/.lisa/skills/shared/logger.d.ts.map +1 -0
- package/dist/project/.lisa/skills/shared/logger.js +18 -0
- package/dist/project/.lisa/skills/shared/logger.js.map +1 -0
- package/dist/project/.lisa/skills/shared/services/InitReviewService.d.ts.map +1 -0
- package/dist/project/.lisa/skills/shared/services/InitReviewService.js +287 -0
- package/dist/project/.lisa/skills/shared/services/InitReviewService.js.map +1 -0
- package/dist/project/.lisa/skills/shared/services/JiraService.d.ts.map +1 -0
- package/dist/project/.lisa/skills/shared/services/JiraService.js +257 -0
- package/dist/project/.lisa/skills/shared/services/JiraService.js.map +1 -0
- package/dist/project/.lisa/skills/shared/services/MemoryCliService.d.ts.map +1 -0
- package/dist/project/.lisa/skills/shared/services/MemoryCliService.js +36 -0
- package/dist/project/.lisa/skills/shared/services/MemoryCliService.js.map +1 -0
- package/dist/project/.lisa/skills/shared/services/MemoryService.d.ts.map +1 -0
- package/dist/project/.lisa/skills/shared/services/MemoryService.js +146 -0
- package/dist/project/.lisa/skills/shared/services/MemoryService.js.map +1 -0
- package/dist/project/.lisa/skills/shared/services/PromptService.d.ts.map +1 -0
- package/dist/project/.lisa/skills/shared/services/PromptService.js +53 -0
- package/dist/project/.lisa/skills/shared/services/PromptService.js.map +1 -0
- package/dist/project/.lisa/skills/shared/services/SkillCompilerService.d.ts.map +1 -0
- package/dist/project/.lisa/skills/shared/services/SkillCompilerService.js +115 -0
- package/dist/project/.lisa/skills/shared/services/SkillCompilerService.js.map +1 -0
- package/dist/project/.lisa/skills/shared/services/StorageService.d.ts.map +1 -0
- package/dist/project/.lisa/skills/shared/services/StorageService.js +257 -0
- package/dist/project/.lisa/skills/shared/services/StorageService.js.map +1 -0
- package/dist/project/.lisa/skills/shared/services/TaskCliService.d.ts.map +1 -0
- package/dist/project/.lisa/skills/shared/services/TaskCliService.js +40 -0
- package/dist/project/.lisa/skills/shared/services/TaskCliService.js.map +1 -0
- package/dist/project/.lisa/skills/shared/services/TaskService.d.ts.map +1 -0
- package/dist/project/.lisa/skills/shared/services/TaskService.js +158 -0
- package/dist/project/.lisa/skills/shared/services/TaskService.js.map +1 -0
- package/dist/project/.lisa/skills/shared/services/VersionService.d.ts.map +1 -0
- package/dist/project/.lisa/skills/shared/services/VersionService.js +88 -0
- package/dist/project/.lisa/skills/shared/services/VersionService.js.map +1 -0
- package/dist/project/.lisa/skills/shared/services/index.d.ts.map +1 -0
- package/dist/project/.lisa/skills/shared/services/index.js +47 -0
- package/dist/project/.lisa/skills/shared/services/index.js.map +1 -0
- package/dist/project/.lisa/skills/shared/services/interfaces/IMemoryService.d.ts.map +1 -0
- package/dist/project/.lisa/skills/shared/services/interfaces/IMemoryService.js +7 -0
- package/dist/project/.lisa/skills/shared/services/interfaces/IMemoryService.js.map +1 -0
- package/dist/project/.lisa/skills/shared/services/interfaces/ITaskService.d.ts.map +1 -0
- package/dist/project/.lisa/skills/shared/services/interfaces/ITaskService.js +7 -0
- package/dist/project/.lisa/skills/shared/services/interfaces/ITaskService.js.map +1 -0
- package/dist/project/.lisa/skills/shared/services/interfaces/index.d.ts.map +1 -0
- package/dist/project/.lisa/skills/shared/services/interfaces/index.js +22 -0
- package/dist/project/.lisa/skills/shared/services/interfaces/index.js.map +1 -0
- package/dist/project/.lisa/skills/shared/utils/FileCache.d.ts.map +1 -0
- package/dist/project/.lisa/skills/shared/utils/FileCache.js +119 -0
- package/dist/project/.lisa/skills/shared/utils/FileCache.js.map +1 -0
- package/dist/project/.lisa/skills/shared/utils/Logger.d.ts.map +1 -0
- package/dist/project/.lisa/skills/shared/utils/Logger.js +197 -0
- package/dist/project/.lisa/skills/shared/utils/Logger.js.map +1 -0
- package/dist/project/.lisa/skills/shared/utils/cache.d.ts.map +1 -0
- package/dist/project/.lisa/skills/shared/utils/cache.js +76 -0
- package/dist/project/.lisa/skills/shared/utils/cache.js.map +1 -0
- package/dist/project/.lisa/skills/shared/utils/cli.d.ts.map +1 -0
- package/dist/project/.lisa/skills/shared/utils/cli.js +87 -0
- package/dist/project/.lisa/skills/shared/utils/cli.js.map +1 -0
- package/dist/project/.lisa/skills/shared/utils/env.d.ts.map +1 -0
- package/dist/project/.lisa/skills/shared/utils/env.js +103 -0
- package/dist/project/.lisa/skills/shared/utils/env.js.map +1 -0
- package/dist/project/.lisa/skills/shared/utils/group-id.d.ts.map +1 -0
- package/dist/project/.lisa/skills/shared/utils/group-id.js +91 -0
- package/dist/project/.lisa/skills/shared/utils/group-id.js.map +1 -0
- package/dist/project/.lisa/skills/shared/utils/index.d.ts.map +1 -0
- package/dist/project/.lisa/skills/shared/utils/index.js +55 -0
- package/dist/project/.lisa/skills/shared/utils/index.js.map +1 -0
- package/dist/project/.lisa/skills/shared/utils/interfaces/ICache.d.ts.map +1 -0
- package/dist/project/.lisa/skills/shared/utils/interfaces/ICache.js +3 -0
- package/dist/project/.lisa/skills/shared/utils/interfaces/ICache.js.map +1 -0
- package/dist/project/.lisa/skills/shared/utils/interfaces/ILogger.d.ts.map +1 -0
- package/dist/project/.lisa/skills/shared/utils/interfaces/ILogger.js +3 -0
- package/dist/project/.lisa/skills/shared/utils/interfaces/ILogger.js.map +1 -0
- package/dist/project/.lisa/skills/shared/utils/interfaces/index.d.ts.map +1 -0
- package/dist/project/.lisa/skills/shared/utils/interfaces/index.js +22 -0
- package/dist/project/.lisa/skills/shared/utils/interfaces/index.js.map +1 -0
- package/dist/{templates/agents → project/.lisa}/skills/tasks/SKILL.md +2 -2
- package/dist/project/.lisa/skills/tasks/scripts/tasks.d.ts.map +1 -0
- package/dist/project/.lisa/skills/tasks/scripts/tasks.js +98 -0
- package/dist/project/.lisa/skills/tasks/scripts/tasks.js.map +1 -0
- package/package.json +31 -10
- package/scripts/postinstall.js +93 -60
- package/dist/cli.js +0 -414
- package/dist/templates/agents/.sample.env +0 -12
- package/dist/templates/agents/docs/EXTENDING-SKILLS.md +0 -291
- package/dist/templates/agents/docs/EXTENDING-rules.md +0 -57
- package/dist/templates/agents/docs/STORAGE_SETUP.md +0 -161
- package/dist/templates/agents/skills/git/scripts/bump-version.js +0 -112
- package/dist/templates/agents/skills/init-review/scripts/ai-enrich.js +0 -258
- package/dist/templates/agents/skills/init-review/scripts/init-review.js +0 -769
- package/dist/templates/agents/skills/jira/scripts/jira.js +0 -406
- package/dist/templates/agents/skills/lisa/scripts/compile-skills.js +0 -177
- package/dist/templates/agents/skills/lisa/scripts/storage.js +0 -374
- package/dist/templates/agents/skills/memory/scripts/memory.js +0 -533
- package/dist/templates/agents/skills/prompt/scripts/prompt.js +0 -184
- package/dist/templates/agents/skills/tasks/scripts/tasks.js +0 -489
- package/dist/templates/claude/config.js +0 -40
- package/dist/templates/claude/hooks/README.md +0 -158
- package/dist/templates/claude/hooks/common/complexity-rater.js +0 -290
- package/dist/templates/claude/hooks/common/context.js +0 -263
- package/dist/templates/claude/hooks/common/group-id.js +0 -188
- package/dist/templates/claude/hooks/common/mcp-client.js +0 -131
- package/dist/templates/claude/hooks/common/transcript-parser.js +0 -256
- package/dist/templates/claude/hooks/common/zep-client.js +0 -175
- package/dist/templates/claude/hooks/session-start.js +0 -511
- package/dist/templates/claude/hooks/session-stop-worker.js +0 -484
- package/dist/templates/claude/hooks/session-stop.js +0 -122
- package/dist/templates/claude/hooks/user-prompt-submit.js +0 -479
- package/dist/templates/claude/settings.json +0 -46
- package/dist/templates/docker/.env.lisa.example +0 -17
- /package/dist/{templates → project/.lisa}/docker/docker-compose.graphiti.yml +0 -0
- /package/dist/{templates → project/.lisa}/rules/shared/clean-architecture.md +0 -0
- /package/dist/{templates → project/.lisa}/rules/shared/code-quality-rules.md +0 -0
- /package/dist/{templates → project/.lisa}/rules/shared/git-rules.local.md +0 -0
- /package/dist/{templates → project/.lisa}/rules/shared/testing-principles.md +0 -0
- /package/dist/{templates → project/.lisa}/rules/typescript/coding-standards.md +0 -0
- /package/dist/{templates → project/.lisa}/rules/typescript/testing.md +0 -0
- /package/dist/{templates → project/.lisa}/rules/typescript/typescript-config-guide.md +0 -0
- /package/dist/{templates/agents → project/.lisa}/skills/git/scripts/poll-ci.sh +0 -0
- /package/dist/{templates/agents → project/.lisa}/skills/jira/SKILL.md +0 -0
- /package/dist/{templates/agents → project/.lisa}/skills/lisa/cache/.gitkeep +0 -0
|
@@ -1,533 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
// Lightweight Graphiti memory helper usable by any model.
|
|
4
|
-
// Commands:
|
|
5
|
-
// node memory.js add "text to remember" [--group <id>] [--tag foo] [--type <type>] [--source <src>] [--cache]
|
|
6
|
-
// node memory.js load [--group <id>] [--query <q>] [--limit N] [--cache]
|
|
7
|
-
// Options:
|
|
8
|
-
// --endpoint <url> : MCP endpoint (default env GRAPHITI_ENDPOINT or http://localhost:8010/mcp/)
|
|
9
|
-
// --type <type> : Entity type (decision, pattern, bug, etc.) - maps to tag
|
|
10
|
-
// --cache : write successful responses to cache/memory.log and use it as fallback on errors.
|
|
11
|
-
// Modes:
|
|
12
|
-
// local : Local Docker MCP server (default)
|
|
13
|
-
// zep-cloud : Zep Cloud native REST API (no Docker required)
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const fs = require('fs');
|
|
16
|
-
const path = require('path');
|
|
17
|
-
const os = require('os');
|
|
18
|
-
// ============================================================================
|
|
19
|
-
// Group ID Utilities (inline to avoid import complexity in deployed skills)
|
|
20
|
-
// ============================================================================
|
|
21
|
-
const MAX_GROUP_ID_LENGTH = 128;
|
|
22
|
-
/**
|
|
23
|
-
* Normalize a path to a valid group ID string.
|
|
24
|
-
* Works cross-platform (Windows and Unix).
|
|
25
|
-
* /Users/tony.casey/Repos/api -> users-tony_casey-repos-api
|
|
26
|
-
* C:\dev\lisa -> c-dev-lisa
|
|
27
|
-
*/
|
|
28
|
-
function normalizePathToGroupId(absolutePath) {
|
|
29
|
-
let normalized = absolutePath
|
|
30
|
-
.toLowerCase()
|
|
31
|
-
.replace(/^[a-z]:/i, (match) => match.charAt(0)) // C: -> c
|
|
32
|
-
.replace(/^\//, '') // Remove leading slash (Unix)
|
|
33
|
-
.replace(/\\/g, '-') // Backslash to dash (Windows)
|
|
34
|
-
.replace(/\//g, '-') // Forward slash to dash (Unix)
|
|
35
|
-
.replace(/\./g, '_') // Dots to underscores
|
|
36
|
-
.replace(/^-+/, '') // Remove leading dashes
|
|
37
|
-
.replace(/-+/g, '-'); // Collapse multiple dashes
|
|
38
|
-
if (normalized.length > MAX_GROUP_ID_LENGTH) {
|
|
39
|
-
normalized = normalized.slice(-MAX_GROUP_ID_LENGTH);
|
|
40
|
-
}
|
|
41
|
-
return normalized;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Get the current folder's group ID.
|
|
45
|
-
*/
|
|
46
|
-
function getCurrentGroupId(cwd = process.cwd()) {
|
|
47
|
-
return normalizePathToGroupId(cwd);
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Check if we're on Windows
|
|
51
|
-
*/
|
|
52
|
-
function isWindows() {
|
|
53
|
-
return os.platform() === 'win32';
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Get the root boundary for hierarchical traversal.
|
|
57
|
-
* - Windows: drive root (e.g., C:\) or home directory, whichever is deeper
|
|
58
|
-
* - Unix: home directory or /
|
|
59
|
-
*/
|
|
60
|
-
function getRootBoundary(cwd = process.cwd()) {
|
|
61
|
-
const homeDir = os.homedir();
|
|
62
|
-
if (isWindows()) {
|
|
63
|
-
// On Windows, check if cwd is under home directory
|
|
64
|
-
const cwdLower = cwd.toLowerCase();
|
|
65
|
-
const homeLower = homeDir.toLowerCase();
|
|
66
|
-
if (cwdLower.startsWith(homeLower)) {
|
|
67
|
-
return homeDir; // Under home, use home as boundary
|
|
68
|
-
}
|
|
69
|
-
// Not under home (e.g., C:\dev\), use drive root as boundary
|
|
70
|
-
const driveRoot = path.parse(cwd).root; // e.g., "C:\"
|
|
71
|
-
return driveRoot;
|
|
72
|
-
}
|
|
73
|
-
// Unix: use home directory if under it, otherwise use /
|
|
74
|
-
if (cwd.startsWith(homeDir)) {
|
|
75
|
-
return homeDir;
|
|
76
|
-
}
|
|
77
|
-
return '/';
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Get hierarchical group IDs from current folder up to root boundary.
|
|
81
|
-
* Returns array ordered from most specific (current) to least specific (root).
|
|
82
|
-
* Works cross-platform (Windows and Unix).
|
|
83
|
-
*/
|
|
84
|
-
function getHierarchicalGroupIds(cwd = process.cwd()) {
|
|
85
|
-
const rootBoundary = getRootBoundary(cwd);
|
|
86
|
-
const groups = [];
|
|
87
|
-
let currentPath = path.resolve(cwd);
|
|
88
|
-
const maxDepth = 10; // Safety limit
|
|
89
|
-
let depth = 0;
|
|
90
|
-
while (depth < maxDepth) {
|
|
91
|
-
groups.push(normalizePathToGroupId(currentPath));
|
|
92
|
-
// Stop if we've reached the root boundary
|
|
93
|
-
if (currentPath.toLowerCase() === rootBoundary.toLowerCase()) {
|
|
94
|
-
break;
|
|
95
|
-
}
|
|
96
|
-
const parentPath = path.dirname(currentPath);
|
|
97
|
-
// Stop if we can't go up anymore (reached filesystem root)
|
|
98
|
-
if (parentPath === currentPath) {
|
|
99
|
-
break;
|
|
100
|
-
}
|
|
101
|
-
currentPath = parentPath;
|
|
102
|
-
depth++;
|
|
103
|
-
}
|
|
104
|
-
return groups;
|
|
105
|
-
}
|
|
106
|
-
// ============================================================================
|
|
107
|
-
// Zep Cloud Native API Client (for zep-cloud mode)
|
|
108
|
-
// ============================================================================
|
|
109
|
-
const ZEP_BASE_URL = 'https://api.getzep.com/api/v2';
|
|
110
|
-
async function zepFetch(apiKey, urlPath, options = {}, timeoutMs = 15000) {
|
|
111
|
-
const url = `${ZEP_BASE_URL}${urlPath}`;
|
|
112
|
-
const resp = await fetch(url, {
|
|
113
|
-
...options,
|
|
114
|
-
headers: {
|
|
115
|
-
'Content-Type': 'application/json',
|
|
116
|
-
Authorization: `Api-Key ${apiKey}`,
|
|
117
|
-
...(options.headers || {}),
|
|
118
|
-
},
|
|
119
|
-
signal: AbortSignal.timeout(timeoutMs),
|
|
120
|
-
});
|
|
121
|
-
const text = await resp.text();
|
|
122
|
-
let data;
|
|
123
|
-
try {
|
|
124
|
-
data = text ? JSON.parse(text) : {};
|
|
125
|
-
}
|
|
126
|
-
catch (_err) {
|
|
127
|
-
throw new Error(`Invalid JSON from Zep (${resp.status}): ${text.slice(0, 200)}`);
|
|
128
|
-
}
|
|
129
|
-
if (!resp.ok) {
|
|
130
|
-
// Zep returns errors in 'message' field, not 'error.message'
|
|
131
|
-
const errorMsg = data.message ||
|
|
132
|
-
data.error?.message ||
|
|
133
|
-
data.error?.detail ||
|
|
134
|
-
`HTTP ${resp.status}`;
|
|
135
|
-
throw new Error(errorMsg);
|
|
136
|
-
}
|
|
137
|
-
return data;
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Zep v3 uses a thread-based approach:
|
|
141
|
-
* 1. Ensure user exists
|
|
142
|
-
* 2. Get or create a thread for the project
|
|
143
|
-
* 3. Add messages to the thread
|
|
144
|
-
* Zep extracts facts automatically from messages
|
|
145
|
-
*/
|
|
146
|
-
async function zepEnsureUser(apiKey, userId) {
|
|
147
|
-
try {
|
|
148
|
-
// Try to create user - will fail if exists, which is fine
|
|
149
|
-
await zepFetch(apiKey, '/users', {
|
|
150
|
-
method: 'POST',
|
|
151
|
-
body: JSON.stringify({
|
|
152
|
-
user_id: userId,
|
|
153
|
-
first_name: 'Lisa',
|
|
154
|
-
last_name: 'Memory',
|
|
155
|
-
}),
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
catch (err) {
|
|
159
|
-
// User already exists is ok (400 with "user already exists")
|
|
160
|
-
if (!(err instanceof Error && err.message.includes('already exists'))) {
|
|
161
|
-
throw err;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
return { user_id: userId };
|
|
165
|
-
}
|
|
166
|
-
async function zepGetOrCreateThread(apiKey, threadId, userId) {
|
|
167
|
-
try {
|
|
168
|
-
// Try to create thread - will fail if exists
|
|
169
|
-
await zepFetch(apiKey, '/threads', {
|
|
170
|
-
method: 'POST',
|
|
171
|
-
body: JSON.stringify({
|
|
172
|
-
thread_id: threadId,
|
|
173
|
-
user_id: userId,
|
|
174
|
-
metadata: { project: threadId, created_by: 'lisa' },
|
|
175
|
-
}),
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
catch (err) {
|
|
179
|
-
// Thread already exists is ok
|
|
180
|
-
if (!(err instanceof Error && err.message.includes('already exists'))) {
|
|
181
|
-
throw err;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
return { thread_id: threadId };
|
|
185
|
-
}
|
|
186
|
-
async function zepAddMemory(apiKey, text, groupId, source) {
|
|
187
|
-
// Use groupId as both user_id and thread_id base for consistent storage
|
|
188
|
-
const userId = `lisa-${groupId}`;
|
|
189
|
-
const threadId = `lisa-memory-${groupId}`;
|
|
190
|
-
// Ensure user and thread exist
|
|
191
|
-
await zepEnsureUser(apiKey, userId);
|
|
192
|
-
await zepGetOrCreateThread(apiKey, threadId, userId);
|
|
193
|
-
// Add message to thread (Zep extracts facts automatically)
|
|
194
|
-
const result = await zepFetch(apiKey, `/threads/${encodeURIComponent(threadId)}/messages`, {
|
|
195
|
-
method: 'POST',
|
|
196
|
-
body: JSON.stringify({
|
|
197
|
-
messages: [
|
|
198
|
-
{
|
|
199
|
-
role: 'user',
|
|
200
|
-
role_type: 'user',
|
|
201
|
-
content: `[${source}] ${text}`,
|
|
202
|
-
},
|
|
203
|
-
],
|
|
204
|
-
}),
|
|
205
|
-
});
|
|
206
|
-
return { message_uuid: result.message_uuids?.[0] };
|
|
207
|
-
}
|
|
208
|
-
async function zepSearchFacts(apiKey, query, groupIds, limit) {
|
|
209
|
-
const allFacts = [];
|
|
210
|
-
// Search across all group IDs (hierarchical)
|
|
211
|
-
for (const groupId of groupIds) {
|
|
212
|
-
const userId = `lisa-${groupId}`;
|
|
213
|
-
try {
|
|
214
|
-
const result = await zepFetch(apiKey, '/graph/search', {
|
|
215
|
-
method: 'POST',
|
|
216
|
-
body: JSON.stringify({
|
|
217
|
-
user_id: userId,
|
|
218
|
-
query,
|
|
219
|
-
limit: Math.ceil(limit / groupIds.length), // Distribute limit across groups
|
|
220
|
-
search_scope: 'facts',
|
|
221
|
-
}),
|
|
222
|
-
});
|
|
223
|
-
// Transform edges to facts format
|
|
224
|
-
const facts = (result.edges || []).map((edge) => ({
|
|
225
|
-
uuid: edge.uuid,
|
|
226
|
-
name: edge.name,
|
|
227
|
-
fact: edge.fact,
|
|
228
|
-
created_at: edge.created_at,
|
|
229
|
-
}));
|
|
230
|
-
allFacts.push(...facts);
|
|
231
|
-
}
|
|
232
|
-
catch (_err) {
|
|
233
|
-
// Group might not exist yet, continue to next
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
// Sort by created_at descending and limit
|
|
237
|
-
allFacts.sort((a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime());
|
|
238
|
-
return { facts: allFacts.slice(0, limit) };
|
|
239
|
-
}
|
|
240
|
-
// ============================================================================
|
|
241
|
-
// End Zep Cloud Client
|
|
242
|
-
// ============================================================================
|
|
243
|
-
// Entity type to tag mapping
|
|
244
|
-
const TYPE_MAP = {
|
|
245
|
-
// Code & Architecture
|
|
246
|
-
'decision': 'code:decision',
|
|
247
|
-
'pattern': 'code:pattern',
|
|
248
|
-
'dependency': 'code:dependency',
|
|
249
|
-
'tech-debt': 'code:tech-debt',
|
|
250
|
-
// Context & History
|
|
251
|
-
'bug': 'context:bug',
|
|
252
|
-
'rationale': 'context:rationale',
|
|
253
|
-
'failed': 'context:failed',
|
|
254
|
-
'quirk': 'context:quirk',
|
|
255
|
-
// External
|
|
256
|
-
'feedback': 'external:feedback',
|
|
257
|
-
'incident': 'external:incident',
|
|
258
|
-
'contract': 'external:contract',
|
|
259
|
-
// People & Process
|
|
260
|
-
'contributor': 'people:contributor',
|
|
261
|
-
'review': 'people:review',
|
|
262
|
-
'blocker': 'people:blocker',
|
|
263
|
-
'estimate': 'people:estimate',
|
|
264
|
-
// Project
|
|
265
|
-
'scope-in': 'project:scope-in',
|
|
266
|
-
'scope-out': 'project:scope-out',
|
|
267
|
-
'milestone': 'project:milestone',
|
|
268
|
-
'init-review': 'type:init-review',
|
|
269
|
-
};
|
|
270
|
-
// Auto-detect prefixes in text
|
|
271
|
-
const PREFIX_MAP = {
|
|
272
|
-
'DECISION:': 'code:decision',
|
|
273
|
-
'PATTERN:': 'code:pattern',
|
|
274
|
-
'TECH-DEBT:': 'code:tech-debt',
|
|
275
|
-
'BUG:': 'context:bug',
|
|
276
|
-
'RATIONALE:': 'context:rationale',
|
|
277
|
-
'FAILED:': 'context:failed',
|
|
278
|
-
'INCIDENT:': 'external:incident',
|
|
279
|
-
'BLOCKER:': 'people:blocker',
|
|
280
|
-
'SCOPE-IN:': 'project:scope-in',
|
|
281
|
-
'SCOPE-OUT:': 'project:scope-out',
|
|
282
|
-
'INIT-REVIEW:': 'type:init-review',
|
|
283
|
-
};
|
|
284
|
-
function detectPrefixTag(text) {
|
|
285
|
-
for (const [prefix, tag] of Object.entries(PREFIX_MAP)) {
|
|
286
|
-
if (text.toUpperCase().startsWith(prefix)) {
|
|
287
|
-
return tag;
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
return null;
|
|
291
|
-
}
|
|
292
|
-
const args = process.argv.slice(2);
|
|
293
|
-
const env = (() => {
|
|
294
|
-
// Read from .agents/skills/.env (2 levels up from memory/scripts/)
|
|
295
|
-
const envPath = path.join(__dirname, '..', '..', '.env');
|
|
296
|
-
const out = {};
|
|
297
|
-
try {
|
|
298
|
-
const raw = fs.readFileSync(envPath, 'utf8');
|
|
299
|
-
raw.split(/\r?\n/).forEach((line) => {
|
|
300
|
-
if (!line || line.startsWith('#'))
|
|
301
|
-
return;
|
|
302
|
-
const idx = line.indexOf('=');
|
|
303
|
-
if (idx === -1)
|
|
304
|
-
return;
|
|
305
|
-
const key = line.slice(0, idx).trim();
|
|
306
|
-
const val = line.slice(idx + 1).trim();
|
|
307
|
-
out[key] = val;
|
|
308
|
-
});
|
|
309
|
-
}
|
|
310
|
-
catch (_) {
|
|
311
|
-
// optional .env; ignore if missing
|
|
312
|
-
}
|
|
313
|
-
return out;
|
|
314
|
-
})();
|
|
315
|
-
function popFlag(name, fallback) {
|
|
316
|
-
const idx = args.indexOf(name);
|
|
317
|
-
if (idx === -1)
|
|
318
|
-
return fallback;
|
|
319
|
-
const val = args[idx + 1];
|
|
320
|
-
args.splice(idx, 2);
|
|
321
|
-
return val ?? fallback;
|
|
322
|
-
}
|
|
323
|
-
function hasFlag(name) {
|
|
324
|
-
const idx = args.indexOf(name);
|
|
325
|
-
if (idx === -1)
|
|
326
|
-
return false;
|
|
327
|
-
args.splice(idx, 1);
|
|
328
|
-
return true;
|
|
329
|
-
}
|
|
330
|
-
const command = args.shift() ?? '';
|
|
331
|
-
const endpoint = popFlag('--endpoint', env.GRAPHITI_ENDPOINT || process.env.GRAPHITI_ENDPOINT || 'http://localhost:8010/mcp/');
|
|
332
|
-
// Group ID: explicit --group > env > folder-based (current directory)
|
|
333
|
-
const explicitGroup = popFlag('--group', null);
|
|
334
|
-
const envGroup = env.GRAPHITI_GROUP_ID || process.env.GRAPHITI_GROUP_ID;
|
|
335
|
-
const groupId = explicitGroup || envGroup || getCurrentGroupId();
|
|
336
|
-
// Track if group was explicitly configured (CLI or env) vs auto-detected
|
|
337
|
-
const hasConfiguredGroup = !!(explicitGroup || envGroup);
|
|
338
|
-
const query = popFlag('--query', '');
|
|
339
|
-
const limit = Number(popFlag('--limit', '10')) || 10;
|
|
340
|
-
const explicitTag = popFlag('--tag', null);
|
|
341
|
-
const entityType = popFlag('--type', null);
|
|
342
|
-
const source = popFlag('--source', 'skill:load-memory');
|
|
343
|
-
const useCache = hasFlag('--cache');
|
|
344
|
-
const payload = args.join(' ').trim();
|
|
345
|
-
const cacheFile = path.join(__dirname, '..', 'cache', 'memory.log');
|
|
346
|
-
// Mode detection
|
|
347
|
-
const graphitiMode = env.STORAGE_MODE || process.env.STORAGE_MODE || 'local';
|
|
348
|
-
const zepApiKey = env.ZEP_API_KEY || process.env.ZEP_API_KEY || '';
|
|
349
|
-
const isZepCloud = graphitiMode === 'zep-cloud';
|
|
350
|
-
// Resolve tag: explicit --tag > --type mapping > prefix detection > undefined
|
|
351
|
-
function resolveTag(text) {
|
|
352
|
-
if (explicitTag)
|
|
353
|
-
return explicitTag;
|
|
354
|
-
if (entityType && TYPE_MAP[entityType])
|
|
355
|
-
return TYPE_MAP[entityType];
|
|
356
|
-
const prefixTag = detectPrefixTag(text);
|
|
357
|
-
if (prefixTag)
|
|
358
|
-
return prefixTag;
|
|
359
|
-
return undefined;
|
|
360
|
-
}
|
|
361
|
-
async function initialize() {
|
|
362
|
-
const body = {
|
|
363
|
-
jsonrpc: '2.0',
|
|
364
|
-
id: 'init',
|
|
365
|
-
method: 'initialize',
|
|
366
|
-
params: {
|
|
367
|
-
protocolVersion: '2024-11-05',
|
|
368
|
-
capabilities: {
|
|
369
|
-
experimental: {},
|
|
370
|
-
prompts: { listChanged: false },
|
|
371
|
-
resources: { subscribe: false, listChanged: false },
|
|
372
|
-
tools: { listChanged: false },
|
|
373
|
-
},
|
|
374
|
-
clientInfo: { name: 'memory-skill', version: '0.1.0' },
|
|
375
|
-
},
|
|
376
|
-
};
|
|
377
|
-
const resp = await fetch(endpoint, {
|
|
378
|
-
method: 'POST',
|
|
379
|
-
headers: {
|
|
380
|
-
'Content-Type': 'application/json',
|
|
381
|
-
// Graphiti requires clients to accept both JSON responses and event streams.
|
|
382
|
-
Accept: 'application/json, text/event-stream',
|
|
383
|
-
},
|
|
384
|
-
body: JSON.stringify(body),
|
|
385
|
-
});
|
|
386
|
-
if (!resp.ok)
|
|
387
|
-
throw new Error(`initialize failed: ${resp.status}`);
|
|
388
|
-
const sid = resp.headers.get('mcp-session-id');
|
|
389
|
-
if (!sid)
|
|
390
|
-
throw new Error('missing mcp-session-id');
|
|
391
|
-
return sid;
|
|
392
|
-
}
|
|
393
|
-
async function rpcCall(method, params, sessionId) {
|
|
394
|
-
const payload = method === 'initialize' || method === 'ping' || method.startsWith('tools/')
|
|
395
|
-
? { jsonrpc: '2.0', id: '1', method, params }
|
|
396
|
-
: { jsonrpc: '2.0', id: '1', method: 'tools/call', params: { name: method, arguments: params } };
|
|
397
|
-
const resp = await fetch(endpoint, {
|
|
398
|
-
method: 'POST',
|
|
399
|
-
headers: {
|
|
400
|
-
'Content-Type': 'application/json',
|
|
401
|
-
'MCP-SESSION-ID': sessionId,
|
|
402
|
-
Accept: 'application/json, text/event-stream',
|
|
403
|
-
},
|
|
404
|
-
body: JSON.stringify(payload),
|
|
405
|
-
});
|
|
406
|
-
let text = await resp.text();
|
|
407
|
-
// MCP servers may wrap JSON in Server-Sent Events; unwrap the data line if present.
|
|
408
|
-
if (text.startsWith('event:')) {
|
|
409
|
-
const dataLine = text.split('\n').find((l) => l.startsWith('data:'));
|
|
410
|
-
if (dataLine)
|
|
411
|
-
text = dataLine.slice(5).trim();
|
|
412
|
-
}
|
|
413
|
-
let data;
|
|
414
|
-
try {
|
|
415
|
-
data = JSON.parse(text);
|
|
416
|
-
}
|
|
417
|
-
catch (err) {
|
|
418
|
-
throw new Error(`bad JSON: ${text.slice(0, 160)}`);
|
|
419
|
-
}
|
|
420
|
-
if (!resp.ok || data.error)
|
|
421
|
-
throw new Error(data?.error?.message || `HTTP ${resp.status}`);
|
|
422
|
-
return data.result?.structuredContent?.result || data.result || data;
|
|
423
|
-
}
|
|
424
|
-
async function addMemory(sessionId) {
|
|
425
|
-
if (!payload)
|
|
426
|
-
throw new Error('add requires text payload');
|
|
427
|
-
const resolvedTag = resolveTag(payload);
|
|
428
|
-
const params = {
|
|
429
|
-
name: payload.slice(0, 80),
|
|
430
|
-
episode_body: payload,
|
|
431
|
-
source,
|
|
432
|
-
group_id: groupId,
|
|
433
|
-
tags: resolvedTag ? [resolvedTag] : undefined,
|
|
434
|
-
};
|
|
435
|
-
await rpcCall('add_memory', params, sessionId);
|
|
436
|
-
return { status: 'ok', action: 'add', group: groupId, text: payload, tag: resolvedTag };
|
|
437
|
-
}
|
|
438
|
-
async function loadMemory(sessionId) {
|
|
439
|
-
// Use configured group (CLI or env) if available, otherwise use hierarchical groups
|
|
440
|
-
const groupIds = hasConfiguredGroup ? [groupId] : getHierarchicalGroupIds();
|
|
441
|
-
const params = { query: query || '*', max_facts: limit, group_ids: groupIds };
|
|
442
|
-
const result = await rpcCall('search_memory_facts', params, sessionId);
|
|
443
|
-
const facts = result?.facts || result?.result?.facts || [];
|
|
444
|
-
return { status: 'ok', action: 'load', group: groupId, groups: groupIds, query, facts };
|
|
445
|
-
}
|
|
446
|
-
// ============================================================================
|
|
447
|
-
// Zep Cloud Mode Functions (no MCP/Docker required)
|
|
448
|
-
// ============================================================================
|
|
449
|
-
async function addMemoryZep() {
|
|
450
|
-
if (!payload)
|
|
451
|
-
throw new Error('add requires text payload');
|
|
452
|
-
if (!zepApiKey)
|
|
453
|
-
throw new Error('ZEP_API_KEY required for zep-cloud mode');
|
|
454
|
-
const resolvedTag = resolveTag(payload);
|
|
455
|
-
// Include tag in the text for Zep (Zep extracts facts from message content)
|
|
456
|
-
const textWithTag = resolvedTag ? `[${resolvedTag}] ${payload}` : payload;
|
|
457
|
-
const result = await zepAddMemory(zepApiKey, textWithTag, groupId, source);
|
|
458
|
-
return {
|
|
459
|
-
status: 'ok',
|
|
460
|
-
action: 'add',
|
|
461
|
-
group: groupId,
|
|
462
|
-
text: payload,
|
|
463
|
-
tag: resolvedTag,
|
|
464
|
-
message_uuid: result.message_uuid,
|
|
465
|
-
mode: 'zep-cloud',
|
|
466
|
-
};
|
|
467
|
-
}
|
|
468
|
-
async function loadMemoryZep() {
|
|
469
|
-
if (!zepApiKey)
|
|
470
|
-
throw new Error('ZEP_API_KEY required for zep-cloud mode');
|
|
471
|
-
// Use configured group (CLI or env) if available, otherwise use hierarchical groups
|
|
472
|
-
const groupIds = hasConfiguredGroup ? [groupId] : getHierarchicalGroupIds();
|
|
473
|
-
const result = await zepSearchFacts(zepApiKey, query || '*', groupIds, limit);
|
|
474
|
-
return {
|
|
475
|
-
status: 'ok',
|
|
476
|
-
action: 'load',
|
|
477
|
-
group: groupId,
|
|
478
|
-
groups: groupIds,
|
|
479
|
-
query,
|
|
480
|
-
facts: result.facts,
|
|
481
|
-
mode: 'zep-cloud',
|
|
482
|
-
};
|
|
483
|
-
}
|
|
484
|
-
function writeCache(obj) {
|
|
485
|
-
try {
|
|
486
|
-
const line = JSON.stringify({ ts: new Date().toISOString(), ...obj });
|
|
487
|
-
fs.appendFileSync(cacheFile, `${line}\n`, 'utf8');
|
|
488
|
-
}
|
|
489
|
-
catch (err) {
|
|
490
|
-
// cache failures should not crash command
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
function readCacheFallback() {
|
|
494
|
-
try {
|
|
495
|
-
const data = fs.readFileSync(cacheFile, 'utf8').trim().split('\n').filter(Boolean);
|
|
496
|
-
if (!data.length)
|
|
497
|
-
return null;
|
|
498
|
-
return data.slice(-1).map((l) => JSON.parse(l))[0];
|
|
499
|
-
}
|
|
500
|
-
catch (err) {
|
|
501
|
-
return null;
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
async function main() {
|
|
505
|
-
try {
|
|
506
|
-
if (!['add', 'load'].includes(command))
|
|
507
|
-
throw new Error('command must be add|load');
|
|
508
|
-
let out;
|
|
509
|
-
if (isZepCloud) {
|
|
510
|
-
// Zep Cloud mode: use native REST API (no Docker/MCP required)
|
|
511
|
-
out = command === 'add' ? await addMemoryZep() : await loadMemoryZep();
|
|
512
|
-
}
|
|
513
|
-
else {
|
|
514
|
-
// MCP mode: local (requires Docker MCP server)
|
|
515
|
-
const sid = await initialize();
|
|
516
|
-
out = command === 'add' ? await addMemory(sid) : await loadMemory(sid);
|
|
517
|
-
}
|
|
518
|
-
if (useCache)
|
|
519
|
-
writeCache(out);
|
|
520
|
-
console.log(JSON.stringify(out, null, 2));
|
|
521
|
-
}
|
|
522
|
-
catch (err) {
|
|
523
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
524
|
-
const fallback = useCache ? readCacheFallback() : null;
|
|
525
|
-
if (fallback) {
|
|
526
|
-
console.log(JSON.stringify({ status: 'fallback', error: message, fallback }, null, 2));
|
|
527
|
-
return;
|
|
528
|
-
}
|
|
529
|
-
console.error(message);
|
|
530
|
-
process.exit(1);
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
main();
|