agent-recorder 0.0.1
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 +133 -0
- package/dist/bundle.d.ts +8 -0
- package/dist/bundle.d.ts.map +1 -0
- package/dist/bundle.js +131 -0
- package/dist/bundle.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -0
- package/package.json +53 -0
- package/vendor/node_modules/@agent-recorder/cli/analytics/session-analytics 2.js +205 -0
- package/vendor/node_modules/@agent-recorder/cli/analytics/session-analytics.d 2.ts +50 -0
- package/vendor/node_modules/@agent-recorder/cli/analytics/session-analytics.d.ts +50 -0
- package/vendor/node_modules/@agent-recorder/cli/analytics/session-analytics.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/analytics/session-analytics.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/analytics/session-analytics.js +205 -0
- package/vendor/node_modules/@agent-recorder/cli/analytics/session-analytics.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/analytics/session-analytics.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/analytics/session-analytics.test 2.js +253 -0
- package/vendor/node_modules/@agent-recorder/cli/analytics/session-analytics.test.d 2.ts +5 -0
- package/vendor/node_modules/@agent-recorder/cli/analytics/session-analytics.test.d.ts +5 -0
- package/vendor/node_modules/@agent-recorder/cli/analytics/session-analytics.test.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/analytics/session-analytics.test.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/analytics/session-analytics.test.js +253 -0
- package/vendor/node_modules/@agent-recorder/cli/analytics/session-analytics.test.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/analytics/session-analytics.test.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/configure 2.js +144 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/configure.d 2.ts +17 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/configure.d.ts +17 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/configure.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/configure.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/configure.js +144 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/configure.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/configure.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/diagnose 2.js +141 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/diagnose.d 2.ts +5 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/diagnose.d.ts +5 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/diagnose.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/diagnose.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/diagnose.js +141 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/diagnose.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/diagnose.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/doctor 2.js +253 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/doctor.d 2.ts +5 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/doctor.d.ts +5 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/doctor.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/doctor.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/doctor.js +253 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/doctor.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/doctor.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/export 2.js +56 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/export.d 2.ts +12 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/export.d.ts +12 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/export.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/export.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/export.js +56 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/export.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/export.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/install 2.js +77 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/install.d 2.ts +13 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/install.d.ts +13 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/install.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/install.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/install.js +77 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/install.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/install.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/logs 2.js +40 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/logs.d 2.ts +8 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/logs.d.ts +8 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/logs.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/logs.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/logs.js +40 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/logs.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/logs.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/mock-mcp 2.js +188 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/mock-mcp.d 2.ts +10 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/mock-mcp.d.ts +10 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/mock-mcp.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/mock-mcp.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/mock-mcp.js +188 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/mock-mcp.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/mock-mcp.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/restart 2.js +67 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/restart.d 2.ts +9 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/restart.d.ts +9 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/restart.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/restart.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/restart.js +67 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/restart.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/restart.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/sessions 2.js +333 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/sessions.d 2.ts +52 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/sessions.d.ts +52 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/sessions.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/sessions.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/sessions.js +333 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/sessions.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/sessions.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/start 2.js +174 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/start.d 2.ts +10 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/start.d.ts +10 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/start.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/start.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/start.js +174 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/start.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/start.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/status 2.js +104 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/status.d 2.ts +5 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/status.d.ts +5 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/status.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/status.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/status.js +104 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/status.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/status.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/stop 2.js +89 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/stop.d 2.ts +8 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/stop.d.ts +8 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/stop.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/stop.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/stop.js +89 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/stop.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/stop.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/tui 2.js +14 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/tui.d 2.ts +5 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/tui.d.ts +5 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/tui.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/tui.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/tui.js +14 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/tui.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/commands/tui.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/config/claude-paths 2.js +117 -0
- package/vendor/node_modules/@agent-recorder/cli/config/claude-paths.d 2.ts +55 -0
- package/vendor/node_modules/@agent-recorder/cli/config/claude-paths.d.ts +55 -0
- package/vendor/node_modules/@agent-recorder/cli/config/claude-paths.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/config/claude-paths.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/config/claude-paths.js +117 -0
- package/vendor/node_modules/@agent-recorder/cli/config/claude-paths.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/config/claude-paths.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/config/claude-paths.test 2.js +152 -0
- package/vendor/node_modules/@agent-recorder/cli/config/claude-paths.test.d 2.ts +5 -0
- package/vendor/node_modules/@agent-recorder/cli/config/claude-paths.test.d.ts +5 -0
- package/vendor/node_modules/@agent-recorder/cli/config/claude-paths.test.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/config/claude-paths.test.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/config/claude-paths.test.js +152 -0
- package/vendor/node_modules/@agent-recorder/cli/config/claude-paths.test.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/config/claude-paths.test.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/index 2.js +194 -0
- package/vendor/node_modules/@agent-recorder/cli/index.d 2.ts +10 -0
- package/vendor/node_modules/@agent-recorder/cli/index.d.ts +10 -0
- package/vendor/node_modules/@agent-recorder/cli/index.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/index.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/index.js +194 -0
- package/vendor/node_modules/@agent-recorder/cli/index.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/index.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/package 2.json +17 -0
- package/vendor/node_modules/@agent-recorder/cli/package.json +17 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/App 2.js +84 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/App.d 2.ts +6 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/App.d.ts +6 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/App.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/App.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/App.js +84 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/App.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/App.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/api 2.js +105 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/api.d 2.ts +31 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/api.d.ts +31 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/api.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/api.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/api.js +105 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/api.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/api.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/EventInspectPanel 2.js +45 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/EventInspectPanel.d 2.ts +11 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/EventInspectPanel.d.ts +11 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/EventInspectPanel.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/EventInspectPanel.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/EventInspectPanel.js +45 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/EventInspectPanel.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/EventInspectPanel.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/Header 2.js +13 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/Header.d 2.ts +17 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/Header.d.ts +17 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/Header.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/Header.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/Header.js +13 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/Header.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/Header.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/Spinner 2.js +21 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/Spinner.d 2.ts +12 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/Spinner.d.ts +12 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/Spinner.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/Spinner.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/Spinner.js +21 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/Spinner.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/Spinner.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/StatusBadge 2.js +50 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/StatusBadge.d 2.ts +16 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/StatusBadge.d.ts +16 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/StatusBadge.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/StatusBadge.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/StatusBadge.js +50 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/StatusBadge.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/StatusBadge.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/Table 2.js +20 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/Table.d 2.ts +21 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/Table.d.ts +21 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/Table.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/Table.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/Table.js +20 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/Table.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/Table.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/index 2.js +8 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/index.d 2.ts +8 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/index.d.ts +8 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/index.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/index.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/index.js +8 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/index.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/components/index.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/hooks/useEventStream 2.js +75 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/hooks/useEventStream.d 2.ts +22 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/hooks/useEventStream.d.ts +22 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/hooks/useEventStream.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/hooks/useEventStream.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/hooks/useEventStream.js +75 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/hooks/useEventStream.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/hooks/useEventStream.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/screens/SessionDetailScreen 2.js +190 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/screens/SessionDetailScreen.d 2.ts +13 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/screens/SessionDetailScreen.d.ts +13 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/screens/SessionDetailScreen.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/screens/SessionDetailScreen.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/screens/SessionDetailScreen.js +190 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/screens/SessionDetailScreen.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/screens/SessionDetailScreen.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/screens/SessionsScreen 2.js +166 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/screens/SessionsScreen.d 2.ts +10 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/screens/SessionsScreen.d.ts +10 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/screens/SessionsScreen.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/screens/SessionsScreen.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/screens/SessionsScreen.js +166 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/screens/SessionsScreen.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/screens/SessionsScreen.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/screens/index 2.js +6 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/screens/index.d 2.ts +6 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/screens/index.d.ts +6 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/screens/index.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/screens/index.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/screens/index.js +6 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/screens/index.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/cli/tui/screens/index.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/config 2.js +44 -0
- package/vendor/node_modules/@agent-recorder/core/config.d 2.ts +25 -0
- package/vendor/node_modules/@agent-recorder/core/config.d.ts +25 -0
- package/vendor/node_modules/@agent-recorder/core/config.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/config.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/config.js +44 -0
- package/vendor/node_modules/@agent-recorder/core/config.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/config.test.d.ts +5 -0
- package/vendor/node_modules/@agent-recorder/core/config.test.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/config.test.js +78 -0
- package/vendor/node_modules/@agent-recorder/core/config.test.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/daemon-paths.d.ts +50 -0
- package/vendor/node_modules/@agent-recorder/core/daemon-paths.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/daemon-paths.js +113 -0
- package/vendor/node_modules/@agent-recorder/core/daemon-paths.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/daemon-paths.test.d.ts +5 -0
- package/vendor/node_modules/@agent-recorder/core/daemon-paths.test.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/daemon-paths.test.js +143 -0
- package/vendor/node_modules/@agent-recorder/core/daemon-paths.test.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/db/connection.d 2.ts +15 -0
- package/vendor/node_modules/@agent-recorder/core/db/connection.d.ts +15 -0
- package/vendor/node_modules/@agent-recorder/core/db/connection.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/db/connection.js +30 -0
- package/vendor/node_modules/@agent-recorder/core/db/connection.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/db/events.d.ts +65 -0
- package/vendor/node_modules/@agent-recorder/core/db/events.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/db/events.js +117 -0
- package/vendor/node_modules/@agent-recorder/core/db/events.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/db/events.test.d.ts +5 -0
- package/vendor/node_modules/@agent-recorder/core/db/events.test.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/db/events.test.js +72 -0
- package/vendor/node_modules/@agent-recorder/core/db/events.test.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/db/index.d.ts +9 -0
- package/vendor/node_modules/@agent-recorder/core/db/index.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/db/index.js +9 -0
- package/vendor/node_modules/@agent-recorder/core/db/index.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/db/migrations.d.ts +17 -0
- package/vendor/node_modules/@agent-recorder/core/db/migrations.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/db/migrations.js +56 -0
- package/vendor/node_modules/@agent-recorder/core/db/migrations.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/db/sequences.d.ts +17 -0
- package/vendor/node_modules/@agent-recorder/core/db/sequences.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/db/sequences.js +41 -0
- package/vendor/node_modules/@agent-recorder/core/db/sequences.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/db/sessions.d.ts +17 -0
- package/vendor/node_modules/@agent-recorder/core/db/sessions.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/db/sessions.js +61 -0
- package/vendor/node_modules/@agent-recorder/core/db/sessions.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/index.d.ts +13 -0
- package/vendor/node_modules/@agent-recorder/core/index.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/index.js +13 -0
- package/vendor/node_modules/@agent-recorder/core/index.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/lockfile.d.ts +42 -0
- package/vendor/node_modules/@agent-recorder/core/lockfile.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/lockfile.js +122 -0
- package/vendor/node_modules/@agent-recorder/core/lockfile.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/lockfile.test.d.ts +5 -0
- package/vendor/node_modules/@agent-recorder/core/lockfile.test.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/lockfile.test.js +136 -0
- package/vendor/node_modules/@agent-recorder/core/lockfile.test.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/migrations/001_initial 2.sql +40 -0
- package/vendor/node_modules/@agent-recorder/core/migrations/001_initial.sql +40 -0
- package/vendor/node_modules/@agent-recorder/core/migrations/002_session_sequences 2.sql +8 -0
- package/vendor/node_modules/@agent-recorder/core/migrations/002_session_sequences.sql +8 -0
- package/vendor/node_modules/@agent-recorder/core/migrations/003_add_tool_columns 2.sql +9 -0
- package/vendor/node_modules/@agent-recorder/core/migrations/003_add_tool_columns.sql +9 -0
- package/vendor/node_modules/@agent-recorder/core/migrations/004_add_cancelled_status 2.sql +23 -0
- package/vendor/node_modules/@agent-recorder/core/migrations/004_add_cancelled_status.sql +23 -0
- package/vendor/node_modules/@agent-recorder/core/migrations/005_add_error_category 2.sql +6 -0
- package/vendor/node_modules/@agent-recorder/core/migrations/005_add_error_category.sql +6 -0
- package/vendor/node_modules/@agent-recorder/core/package 2.json +18 -0
- package/vendor/node_modules/@agent-recorder/core/package.json +18 -0
- package/vendor/node_modules/@agent-recorder/core/types/events.d 2.ts +69 -0
- package/vendor/node_modules/@agent-recorder/core/types/events.d.ts +69 -0
- package/vendor/node_modules/@agent-recorder/core/types/events.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/types/events.js +6 -0
- package/vendor/node_modules/@agent-recorder/core/types/events.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/types/index 2.js +2 -0
- package/vendor/node_modules/@agent-recorder/core/types/index.d.ts +3 -0
- package/vendor/node_modules/@agent-recorder/core/types/index.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/types/index.js +2 -0
- package/vendor/node_modules/@agent-recorder/core/types/index.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/types/index.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/types/session 2.js +6 -0
- package/vendor/node_modules/@agent-recorder/core/types/session.d 2.ts +22 -0
- package/vendor/node_modules/@agent-recorder/core/types/session.d.ts +22 -0
- package/vendor/node_modules/@agent-recorder/core/types/session.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/types/session.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/types/session.js +6 -0
- package/vendor/node_modules/@agent-recorder/core/types/session.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/types/session.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/utils/error-category 2.js +58 -0
- package/vendor/node_modules/@agent-recorder/core/utils/error-category.d 2.ts +22 -0
- package/vendor/node_modules/@agent-recorder/core/utils/error-category.d.ts +22 -0
- package/vendor/node_modules/@agent-recorder/core/utils/error-category.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/utils/error-category.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/utils/error-category.js +58 -0
- package/vendor/node_modules/@agent-recorder/core/utils/error-category.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/utils/error-category.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/utils/error-category.test.d 2.ts +5 -0
- package/vendor/node_modules/@agent-recorder/core/utils/error-category.test.d.ts +5 -0
- package/vendor/node_modules/@agent-recorder/core/utils/error-category.test.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/utils/error-category.test.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/utils/error-category.test.js +89 -0
- package/vendor/node_modules/@agent-recorder/core/utils/error-category.test.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/utils/error-category.test.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/utils/index 2.js +6 -0
- package/vendor/node_modules/@agent-recorder/core/utils/index.d 2.ts +6 -0
- package/vendor/node_modules/@agent-recorder/core/utils/index.d.ts +6 -0
- package/vendor/node_modules/@agent-recorder/core/utils/index.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/utils/index.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/utils/index.js +6 -0
- package/vendor/node_modules/@agent-recorder/core/utils/index.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/utils/index.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/utils/redact.d 2.ts +19 -0
- package/vendor/node_modules/@agent-recorder/core/utils/redact.d.ts +19 -0
- package/vendor/node_modules/@agent-recorder/core/utils/redact.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/utils/redact.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/utils/redact.js +52 -0
- package/vendor/node_modules/@agent-recorder/core/utils/redact.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/core/utils/redact.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/index 2.js +128 -0
- package/vendor/node_modules/@agent-recorder/service/index.d 2.ts +36 -0
- package/vendor/node_modules/@agent-recorder/service/index.d.ts +36 -0
- package/vendor/node_modules/@agent-recorder/service/index.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/index.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/index.js +128 -0
- package/vendor/node_modules/@agent-recorder/service/index.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/index.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/mcp/index 2.js +7 -0
- package/vendor/node_modules/@agent-recorder/service/mcp/index.d 2.ts +7 -0
- package/vendor/node_modules/@agent-recorder/service/mcp/index.d.ts +7 -0
- package/vendor/node_modules/@agent-recorder/service/mcp/index.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/mcp/index.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/mcp/index.js +7 -0
- package/vendor/node_modules/@agent-recorder/service/mcp/index.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/mcp/index.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/mcp/proxy 2.js +223 -0
- package/vendor/node_modules/@agent-recorder/service/mcp/proxy.d 2.ts +26 -0
- package/vendor/node_modules/@agent-recorder/service/mcp/proxy.d.ts +26 -0
- package/vendor/node_modules/@agent-recorder/service/mcp/proxy.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/mcp/proxy.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/mcp/proxy.js +223 -0
- package/vendor/node_modules/@agent-recorder/service/mcp/proxy.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/mcp/proxy.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/mcp/proxy.test.d 2.ts +5 -0
- package/vendor/node_modules/@agent-recorder/service/mcp/proxy.test.d.ts +5 -0
- package/vendor/node_modules/@agent-recorder/service/mcp/proxy.test.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/mcp/proxy.test.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/mcp/proxy.test.js +367 -0
- package/vendor/node_modules/@agent-recorder/service/mcp/proxy.test.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/mcp/proxy.test.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/mcp/recorder 2.js +62 -0
- package/vendor/node_modules/@agent-recorder/service/mcp/recorder.d 2.ts +31 -0
- package/vendor/node_modules/@agent-recorder/service/mcp/recorder.d.ts +31 -0
- package/vendor/node_modules/@agent-recorder/service/mcp/recorder.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/mcp/recorder.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/mcp/recorder.js +62 -0
- package/vendor/node_modules/@agent-recorder/service/mcp/recorder.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/mcp/recorder.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/mcp/types 2.js +15 -0
- package/vendor/node_modules/@agent-recorder/service/mcp/types.d 2.ts +40 -0
- package/vendor/node_modules/@agent-recorder/service/mcp/types.d.ts +40 -0
- package/vendor/node_modules/@agent-recorder/service/mcp/types.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/mcp/types.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/mcp/types.js +15 -0
- package/vendor/node_modules/@agent-recorder/service/mcp/types.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/mcp/types.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/package 2.json +15 -0
- package/vendor/node_modules/@agent-recorder/service/package.json +15 -0
- package/vendor/node_modules/@agent-recorder/service/routes/events 2.js +71 -0
- package/vendor/node_modules/@agent-recorder/service/routes/events.d 2.ts +11 -0
- package/vendor/node_modules/@agent-recorder/service/routes/events.d.ts +11 -0
- package/vendor/node_modules/@agent-recorder/service/routes/events.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/routes/events.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/routes/events.js +71 -0
- package/vendor/node_modules/@agent-recorder/service/routes/events.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/routes/events.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/routes/health 2.js +18 -0
- package/vendor/node_modules/@agent-recorder/service/routes/health.d 2.ts +6 -0
- package/vendor/node_modules/@agent-recorder/service/routes/health.d.ts +6 -0
- package/vendor/node_modules/@agent-recorder/service/routes/health.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/routes/health.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/routes/health.js +18 -0
- package/vendor/node_modules/@agent-recorder/service/routes/health.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/routes/health.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/routes/sessions 2.js +80 -0
- package/vendor/node_modules/@agent-recorder/service/routes/sessions.d 2.ts +12 -0
- package/vendor/node_modules/@agent-recorder/service/routes/sessions.d.ts +12 -0
- package/vendor/node_modules/@agent-recorder/service/routes/sessions.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/routes/sessions.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/routes/sessions.js +80 -0
- package/vendor/node_modules/@agent-recorder/service/routes/sessions.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/routes/sessions.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/server 2.js +36 -0
- package/vendor/node_modules/@agent-recorder/service/server.d 2.ts +19 -0
- package/vendor/node_modules/@agent-recorder/service/server.d.ts +19 -0
- package/vendor/node_modules/@agent-recorder/service/server.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/server.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/server.js +36 -0
- package/vendor/node_modules/@agent-recorder/service/server.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/server.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/server.test 2.js +296 -0
- package/vendor/node_modules/@agent-recorder/service/server.test.d 2.ts +5 -0
- package/vendor/node_modules/@agent-recorder/service/server.test.d.ts +5 -0
- package/vendor/node_modules/@agent-recorder/service/server.test.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/server.test.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/server.test.js +296 -0
- package/vendor/node_modules/@agent-recorder/service/server.test.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/session-manager 2.js +22 -0
- package/vendor/node_modules/@agent-recorder/service/session-manager.d 2.ts +16 -0
- package/vendor/node_modules/@agent-recorder/service/session-manager.d.ts +16 -0
- package/vendor/node_modules/@agent-recorder/service/session-manager.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/session-manager.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/session-manager.js +22 -0
- package/vendor/node_modules/@agent-recorder/service/session-manager.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/session-manager.js.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/session-manager.test 2.js +61 -0
- package/vendor/node_modules/@agent-recorder/service/session-manager.test.d 2.ts +5 -0
- package/vendor/node_modules/@agent-recorder/service/session-manager.test.d.ts +5 -0
- package/vendor/node_modules/@agent-recorder/service/session-manager.test.d.ts 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/session-manager.test.d.ts.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/session-manager.test.js +61 -0
- package/vendor/node_modules/@agent-recorder/service/session-manager.test.js 2.map +1 -0
- package/vendor/node_modules/@agent-recorder/service/session-manager.test.js.map +1 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for configuration management.
|
|
3
|
+
*/
|
|
4
|
+
import { describe, it, expect, beforeEach, afterEach } from "vitest";
|
|
5
|
+
import { homedir } from "node:os";
|
|
6
|
+
import { join } from "node:path";
|
|
7
|
+
import { loadConfig, getDefaultDbPath } from "./config.js";
|
|
8
|
+
describe("Config", () => {
|
|
9
|
+
const originalEnv = process.env;
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
// Reset environment before each test
|
|
12
|
+
process.env = { ...originalEnv };
|
|
13
|
+
delete process.env["AR_DB_PATH"];
|
|
14
|
+
delete process.env["AR_DEBUG_PROXY"];
|
|
15
|
+
delete process.env["AR_LISTEN_PORT"];
|
|
16
|
+
delete process.env["AR_MCP_PROXY_PORT"];
|
|
17
|
+
delete process.env["AR_DOWNSTREAM_MCP_URL"];
|
|
18
|
+
delete process.env["AR_REDACT_KEYS"];
|
|
19
|
+
});
|
|
20
|
+
afterEach(() => {
|
|
21
|
+
process.env = originalEnv;
|
|
22
|
+
});
|
|
23
|
+
describe("getDefaultDbPath", () => {
|
|
24
|
+
it("returns path in user home directory", () => {
|
|
25
|
+
const dbPath = getDefaultDbPath();
|
|
26
|
+
const expected = join(homedir(), ".agent-recorder", "agent-recorder.sqlite");
|
|
27
|
+
expect(dbPath).toBe(expected);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
describe("loadConfig", () => {
|
|
31
|
+
it("uses default DB path in home directory when AR_DB_PATH not set", () => {
|
|
32
|
+
const config = loadConfig();
|
|
33
|
+
const expected = join(homedir(), ".agent-recorder", "agent-recorder.sqlite");
|
|
34
|
+
expect(config.dbPath).toBe(expected);
|
|
35
|
+
});
|
|
36
|
+
it("uses AR_DB_PATH when set", () => {
|
|
37
|
+
process.env["AR_DB_PATH"] = "/custom/path/db.sqlite";
|
|
38
|
+
const config = loadConfig();
|
|
39
|
+
expect(config.dbPath).toBe("/custom/path/db.sqlite");
|
|
40
|
+
});
|
|
41
|
+
it("sets debugProxy to false by default", () => {
|
|
42
|
+
const config = loadConfig();
|
|
43
|
+
expect(config.debugProxy).toBe(false);
|
|
44
|
+
});
|
|
45
|
+
it("sets debugProxy to true when AR_DEBUG_PROXY=1", () => {
|
|
46
|
+
process.env["AR_DEBUG_PROXY"] = "1";
|
|
47
|
+
const config = loadConfig();
|
|
48
|
+
expect(config.debugProxy).toBe(true);
|
|
49
|
+
});
|
|
50
|
+
it("sets debugProxy to false for other AR_DEBUG_PROXY values", () => {
|
|
51
|
+
process.env["AR_DEBUG_PROXY"] = "true";
|
|
52
|
+
const config = loadConfig();
|
|
53
|
+
expect(config.debugProxy).toBe(false);
|
|
54
|
+
});
|
|
55
|
+
it("uses default ports when not set", () => {
|
|
56
|
+
const config = loadConfig();
|
|
57
|
+
expect(config.listenPort).toBe(8787);
|
|
58
|
+
expect(config.mcpProxyPort).toBe(8788);
|
|
59
|
+
});
|
|
60
|
+
it("uses custom ports when set", () => {
|
|
61
|
+
process.env["AR_LISTEN_PORT"] = "9000";
|
|
62
|
+
process.env["AR_MCP_PROXY_PORT"] = "9001";
|
|
63
|
+
const config = loadConfig();
|
|
64
|
+
expect(config.listenPort).toBe(9000);
|
|
65
|
+
expect(config.mcpProxyPort).toBe(9001);
|
|
66
|
+
});
|
|
67
|
+
it("sets downstreamMcpUrl to null when not set", () => {
|
|
68
|
+
const config = loadConfig();
|
|
69
|
+
expect(config.downstreamMcpUrl).toBeNull();
|
|
70
|
+
});
|
|
71
|
+
it("uses AR_DOWNSTREAM_MCP_URL when set", () => {
|
|
72
|
+
process.env["AR_DOWNSTREAM_MCP_URL"] = "http://localhost:9999";
|
|
73
|
+
const config = loadConfig();
|
|
74
|
+
expect(config.downstreamMcpUrl).toBe("http://localhost:9999");
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
//# sourceMappingURL=config.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.test.js","sourceRoot":"","sources":["../src/config.test.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE3D,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;IACtB,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC;IAEhC,UAAU,CAAC,GAAG,EAAE;QACd,qCAAqC;QACrC,OAAO,CAAC,GAAG,GAAG,EAAE,GAAG,WAAW,EAAE,CAAC;QACjC,OAAO,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QACjC,OAAO,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;QACrC,OAAO,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;QACrC,OAAO,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC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CAAC,IAAI,CAAC,CAAC;QACzC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE;YACpD,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;YAC5B,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,QAAQ,EAAE,CAAC;QAC7C,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,qCAAqC,EAAE,GAAG,EAAE;YAC7C,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,GAAG,uBAAuB,CAAC;YAC/D,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;YAC5B,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;QAChE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Daemon state file paths and PID management utilities.
|
|
3
|
+
* Provides standard paths for PID file, lock file, and log file.
|
|
4
|
+
*/
|
|
5
|
+
export interface DaemonPaths {
|
|
6
|
+
baseDir: string;
|
|
7
|
+
pidFile: string;
|
|
8
|
+
lockFile: string;
|
|
9
|
+
logFile: string;
|
|
10
|
+
dbFile: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Get standard paths for daemon state files.
|
|
14
|
+
* Base directory: ~/.agent-recorder/
|
|
15
|
+
*/
|
|
16
|
+
export declare function getDaemonPaths(): DaemonPaths;
|
|
17
|
+
/**
|
|
18
|
+
* Read PID from PID file.
|
|
19
|
+
* Returns null if file doesn't exist or is invalid.
|
|
20
|
+
*/
|
|
21
|
+
export declare function readPidFile(pidPath?: string): number | null;
|
|
22
|
+
/**
|
|
23
|
+
* Write PID to PID file.
|
|
24
|
+
* Creates parent directory if needed.
|
|
25
|
+
*/
|
|
26
|
+
export declare function writePidFile(pid: number, pidPath?: string): void;
|
|
27
|
+
/**
|
|
28
|
+
* Remove PID file if it exists.
|
|
29
|
+
*/
|
|
30
|
+
export declare function removePidFile(pidPath?: string): void;
|
|
31
|
+
/**
|
|
32
|
+
* Check if a process with the given PID is currently running.
|
|
33
|
+
* Uses kill(pid, 0) which checks process existence without sending a signal.
|
|
34
|
+
*/
|
|
35
|
+
export declare function isProcessRunning(pid: number): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Read PID from file and check if process is still running.
|
|
38
|
+
* Returns { running: true, pid } if process is alive.
|
|
39
|
+
* Returns { running: false, pid: null } if not running or no PID file.
|
|
40
|
+
*/
|
|
41
|
+
export declare function checkDaemonStatus(pidPath?: string): {
|
|
42
|
+
running: boolean;
|
|
43
|
+
pid: number | null;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Clean up stale PID file if the process is no longer running.
|
|
47
|
+
* Returns true if cleanup was performed.
|
|
48
|
+
*/
|
|
49
|
+
export declare function cleanStalePidFile(pidPath?: string): boolean;
|
|
50
|
+
//# sourceMappingURL=daemon-paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"daemon-paths.d.ts","sourceRoot":"","sources":["../src/daemon-paths.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,WAAW,CAS5C;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAc3D;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAWhE;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CASpD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAWrD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG;IACnD,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CACpB,CAQA;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAY3D"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Daemon state file paths and PID management utilities.
|
|
3
|
+
* Provides standard paths for PID file, lock file, and log file.
|
|
4
|
+
*/
|
|
5
|
+
import * as fs from "node:fs";
|
|
6
|
+
import * as path from "node:path";
|
|
7
|
+
import * as os from "node:os";
|
|
8
|
+
/**
|
|
9
|
+
* Get standard paths for daemon state files.
|
|
10
|
+
* Base directory: ~/.agent-recorder/
|
|
11
|
+
*/
|
|
12
|
+
export function getDaemonPaths() {
|
|
13
|
+
const baseDir = path.join(os.homedir(), ".agent-recorder");
|
|
14
|
+
return {
|
|
15
|
+
baseDir,
|
|
16
|
+
pidFile: path.join(baseDir, "agent-recorder.pid"),
|
|
17
|
+
lockFile: path.join(baseDir, "agent-recorder.lock"),
|
|
18
|
+
logFile: path.join(baseDir, "agent-recorder.log"),
|
|
19
|
+
dbFile: path.join(baseDir, "agent-recorder.sqlite"),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Read PID from PID file.
|
|
24
|
+
* Returns null if file doesn't exist or is invalid.
|
|
25
|
+
*/
|
|
26
|
+
export function readPidFile(pidPath) {
|
|
27
|
+
const { pidFile } = getDaemonPaths();
|
|
28
|
+
const filePath = pidPath ?? pidFile;
|
|
29
|
+
try {
|
|
30
|
+
const content = fs.readFileSync(filePath, "utf-8").trim();
|
|
31
|
+
const pid = parseInt(content, 10);
|
|
32
|
+
if (isNaN(pid) || pid <= 0) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
return pid;
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Write PID to PID file.
|
|
43
|
+
* Creates parent directory if needed.
|
|
44
|
+
*/
|
|
45
|
+
export function writePidFile(pid, pidPath) {
|
|
46
|
+
const { pidFile } = getDaemonPaths();
|
|
47
|
+
const filePath = pidPath ?? pidFile;
|
|
48
|
+
const dir = path.dirname(filePath);
|
|
49
|
+
// Ensure directory exists
|
|
50
|
+
if (!fs.existsSync(dir)) {
|
|
51
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
52
|
+
}
|
|
53
|
+
fs.writeFileSync(filePath, String(pid), "utf-8");
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Remove PID file if it exists.
|
|
57
|
+
*/
|
|
58
|
+
export function removePidFile(pidPath) {
|
|
59
|
+
const { pidFile } = getDaemonPaths();
|
|
60
|
+
const filePath = pidPath ?? pidFile;
|
|
61
|
+
try {
|
|
62
|
+
fs.unlinkSync(filePath);
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
// Ignore if file doesn't exist
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Check if a process with the given PID is currently running.
|
|
70
|
+
* Uses kill(pid, 0) which checks process existence without sending a signal.
|
|
71
|
+
*/
|
|
72
|
+
export function isProcessRunning(pid) {
|
|
73
|
+
try {
|
|
74
|
+
// Signal 0 doesn't send a signal but checks if process exists
|
|
75
|
+
process.kill(pid, 0);
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
// ESRCH means process doesn't exist
|
|
80
|
+
// EPERM means process exists but we don't have permission (still running)
|
|
81
|
+
const err = error;
|
|
82
|
+
return err.code === "EPERM";
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Read PID from file and check if process is still running.
|
|
87
|
+
* Returns { running: true, pid } if process is alive.
|
|
88
|
+
* Returns { running: false, pid: null } if not running or no PID file.
|
|
89
|
+
*/
|
|
90
|
+
export function checkDaemonStatus(pidPath) {
|
|
91
|
+
const pid = readPidFile(pidPath);
|
|
92
|
+
if (pid === null) {
|
|
93
|
+
return { running: false, pid: null };
|
|
94
|
+
}
|
|
95
|
+
const running = isProcessRunning(pid);
|
|
96
|
+
return { running, pid: running ? pid : null };
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Clean up stale PID file if the process is no longer running.
|
|
100
|
+
* Returns true if cleanup was performed.
|
|
101
|
+
*/
|
|
102
|
+
export function cleanStalePidFile(pidPath) {
|
|
103
|
+
const pid = readPidFile(pidPath);
|
|
104
|
+
if (pid === null) {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
if (!isProcessRunning(pid)) {
|
|
108
|
+
removePidFile(pidPath);
|
|
109
|
+
return true;
|
|
110
|
+
}
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=daemon-paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"daemon-paths.js","sourceRoot":"","sources":["../src/daemon-paths.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAU9B;;;GAGG;AACH,MAAM,UAAU,cAAc;IAC5B,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,iBAAiB,CAAC,CAAC;IAC3D,OAAO;QACL,OAAO;QACP,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EA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AAI,GAAG,KAAK,IAAI,EAAE,CAAC;QACjB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,CAAC;QAC3B,aAAa,CAAC,OAAO,CAAC,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"daemon-paths.test.d.ts","sourceRoot":"","sources":["../src/daemon-paths.test.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for daemon paths and PID file utilities.
|
|
3
|
+
*/
|
|
4
|
+
import { describe, it, expect, beforeEach, afterEach } from "vitest";
|
|
5
|
+
import * as fs from "node:fs";
|
|
6
|
+
import * as path from "node:path";
|
|
7
|
+
import * as os from "node:os";
|
|
8
|
+
import { getDaemonPaths, readPidFile, writePidFile, removePidFile, isProcessRunning, checkDaemonStatus, cleanStalePidFile, } from "./daemon-paths.js";
|
|
9
|
+
describe("getDaemonPaths", () => {
|
|
10
|
+
it("returns paths in home directory", () => {
|
|
11
|
+
const paths = getDaemonPaths();
|
|
12
|
+
const home = os.homedir();
|
|
13
|
+
expect(paths.baseDir).toBe(path.join(home, ".agent-recorder"));
|
|
14
|
+
expect(paths.pidFile).toBe(path.join(home, ".agent-recorder", "agent-recorder.pid"));
|
|
15
|
+
expect(paths.lockFile).toBe(path.join(home, ".agent-recorder", "agent-recorder.lock"));
|
|
16
|
+
expect(paths.logFile).toBe(path.join(home, ".agent-recorder", "agent-recorder.log"));
|
|
17
|
+
expect(paths.dbFile).toBe(path.join(home, ".agent-recorder", "agent-recorder.sqlite"));
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
describe("PID file operations", () => {
|
|
21
|
+
let tempDir;
|
|
22
|
+
let pidFilePath;
|
|
23
|
+
beforeEach(() => {
|
|
24
|
+
tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "ar-test-"));
|
|
25
|
+
pidFilePath = path.join(tempDir, "test.pid");
|
|
26
|
+
});
|
|
27
|
+
afterEach(() => {
|
|
28
|
+
fs.rmSync(tempDir, { recursive: true, force: true });
|
|
29
|
+
});
|
|
30
|
+
describe("readPidFile", () => {
|
|
31
|
+
it("returns null when file does not exist", () => {
|
|
32
|
+
expect(readPidFile(pidFilePath)).toBeNull();
|
|
33
|
+
});
|
|
34
|
+
it("returns null for empty file", () => {
|
|
35
|
+
fs.writeFileSync(pidFilePath, "");
|
|
36
|
+
expect(readPidFile(pidFilePath)).toBeNull();
|
|
37
|
+
});
|
|
38
|
+
it("returns null for non-numeric content", () => {
|
|
39
|
+
fs.writeFileSync(pidFilePath, "not-a-number");
|
|
40
|
+
expect(readPidFile(pidFilePath)).toBeNull();
|
|
41
|
+
});
|
|
42
|
+
it("returns null for negative numbers", () => {
|
|
43
|
+
fs.writeFileSync(pidFilePath, "-123");
|
|
44
|
+
expect(readPidFile(pidFilePath)).toBeNull();
|
|
45
|
+
});
|
|
46
|
+
it("returns PID for valid content", () => {
|
|
47
|
+
fs.writeFileSync(pidFilePath, "12345");
|
|
48
|
+
expect(readPidFile(pidFilePath)).toBe(12345);
|
|
49
|
+
});
|
|
50
|
+
it("trims whitespace", () => {
|
|
51
|
+
fs.writeFileSync(pidFilePath, " 12345 \n");
|
|
52
|
+
expect(readPidFile(pidFilePath)).toBe(12345);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
describe("writePidFile", () => {
|
|
56
|
+
it("writes PID to file", () => {
|
|
57
|
+
writePidFile(12345, pidFilePath);
|
|
58
|
+
expect(fs.readFileSync(pidFilePath, "utf-8")).toBe("12345");
|
|
59
|
+
});
|
|
60
|
+
it("creates parent directory if needed", () => {
|
|
61
|
+
const nestedPath = path.join(tempDir, "nested", "dir", "test.pid");
|
|
62
|
+
writePidFile(12345, nestedPath);
|
|
63
|
+
expect(fs.readFileSync(nestedPath, "utf-8")).toBe("12345");
|
|
64
|
+
});
|
|
65
|
+
it("overwrites existing file", () => {
|
|
66
|
+
writePidFile(11111, pidFilePath);
|
|
67
|
+
writePidFile(22222, pidFilePath);
|
|
68
|
+
expect(fs.readFileSync(pidFilePath, "utf-8")).toBe("22222");
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
describe("removePidFile", () => {
|
|
72
|
+
it("removes existing file", () => {
|
|
73
|
+
fs.writeFileSync(pidFilePath, "12345");
|
|
74
|
+
removePidFile(pidFilePath);
|
|
75
|
+
expect(fs.existsSync(pidFilePath)).toBe(false);
|
|
76
|
+
});
|
|
77
|
+
it("does not throw when file does not exist", () => {
|
|
78
|
+
expect(() => removePidFile(pidFilePath)).not.toThrow();
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
describe("isProcessRunning", () => {
|
|
83
|
+
it("returns true for current process", () => {
|
|
84
|
+
expect(isProcessRunning(process.pid)).toBe(true);
|
|
85
|
+
});
|
|
86
|
+
it("returns false for non-existent PID", () => {
|
|
87
|
+
// Use a very high PID that's unlikely to exist
|
|
88
|
+
expect(isProcessRunning(999999999)).toBe(false);
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
describe("checkDaemonStatus", () => {
|
|
92
|
+
let tempDir;
|
|
93
|
+
let pidFilePath;
|
|
94
|
+
beforeEach(() => {
|
|
95
|
+
tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "ar-test-"));
|
|
96
|
+
pidFilePath = path.join(tempDir, "test.pid");
|
|
97
|
+
});
|
|
98
|
+
afterEach(() => {
|
|
99
|
+
fs.rmSync(tempDir, { recursive: true, force: true });
|
|
100
|
+
});
|
|
101
|
+
it("returns not running when no PID file", () => {
|
|
102
|
+
const status = checkDaemonStatus(pidFilePath);
|
|
103
|
+
expect(status.running).toBe(false);
|
|
104
|
+
expect(status.pid).toBeNull();
|
|
105
|
+
});
|
|
106
|
+
it("returns running for current process PID", () => {
|
|
107
|
+
fs.writeFileSync(pidFilePath, String(process.pid));
|
|
108
|
+
const status = checkDaemonStatus(pidFilePath);
|
|
109
|
+
expect(status.running).toBe(true);
|
|
110
|
+
expect(status.pid).toBe(process.pid);
|
|
111
|
+
});
|
|
112
|
+
it("returns not running for stale PID", () => {
|
|
113
|
+
fs.writeFileSync(pidFilePath, "999999999");
|
|
114
|
+
const status = checkDaemonStatus(pidFilePath);
|
|
115
|
+
expect(status.running).toBe(false);
|
|
116
|
+
expect(status.pid).toBeNull();
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
describe("cleanStalePidFile", () => {
|
|
120
|
+
let tempDir;
|
|
121
|
+
let pidFilePath;
|
|
122
|
+
beforeEach(() => {
|
|
123
|
+
tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "ar-test-"));
|
|
124
|
+
pidFilePath = path.join(tempDir, "test.pid");
|
|
125
|
+
});
|
|
126
|
+
afterEach(() => {
|
|
127
|
+
fs.rmSync(tempDir, { recursive: true, force: true });
|
|
128
|
+
});
|
|
129
|
+
it("returns false when no PID file", () => {
|
|
130
|
+
expect(cleanStalePidFile(pidFilePath)).toBe(false);
|
|
131
|
+
});
|
|
132
|
+
it("returns false and does not remove for running process", () => {
|
|
133
|
+
fs.writeFileSync(pidFilePath, String(process.pid));
|
|
134
|
+
expect(cleanStalePidFile(pidFilePath)).toBe(false);
|
|
135
|
+
expect(fs.existsSync(pidFilePath)).toBe(true);
|
|
136
|
+
});
|
|
137
|
+
it("returns true and removes stale PID file", () => {
|
|
138
|
+
fs.writeFileSync(pidFilePath, "999999999");
|
|
139
|
+
expect(cleanStalePidFile(pidFilePath)).toBe(true);
|
|
140
|
+
expect(fs.existsSync(pidFilePath)).toBe(false);
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
//# sourceMappingURL=daemon-paths.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"daemon-paths.test.js","sourceRoot":"","sources":["../src/daemon-paths.test.ts"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C,CAAC,CAAC;IAEH,EAAE,CAAC,yCAAyC,EAAE,GAAG,EAAE;QACjD,EAAE,CAAC,aAAa,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;QAC3C,MAAM,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClD,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SQLite database connection management.
|
|
3
|
+
* Uses better-sqlite3 sync API.
|
|
4
|
+
*/
|
|
5
|
+
import Database from "better-sqlite3";
|
|
6
|
+
/**
|
|
7
|
+
* Opens or creates a SQLite database at the given path.
|
|
8
|
+
* Ensures the parent directory exists.
|
|
9
|
+
*/
|
|
10
|
+
export declare function openDatabase(dbPath: string): Database.Database;
|
|
11
|
+
/**
|
|
12
|
+
* Creates an in-memory database for testing.
|
|
13
|
+
*/
|
|
14
|
+
export declare function openMemoryDatabase(): Database.Database;
|
|
15
|
+
//# sourceMappingURL=connection.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SQLite database connection management.
|
|
3
|
+
* Uses better-sqlite3 sync API.
|
|
4
|
+
*/
|
|
5
|
+
import Database from "better-sqlite3";
|
|
6
|
+
/**
|
|
7
|
+
* Opens or creates a SQLite database at the given path.
|
|
8
|
+
* Ensures the parent directory exists.
|
|
9
|
+
*/
|
|
10
|
+
export declare function openDatabase(dbPath: string): Database.Database;
|
|
11
|
+
/**
|
|
12
|
+
* Creates an in-memory database for testing.
|
|
13
|
+
*/
|
|
14
|
+
export declare function openMemoryDatabase(): Database.Database;
|
|
15
|
+
//# sourceMappingURL=connection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../src/db/connection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAItC;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAY9D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,QAAQ,CAAC,QAAQ,CAItD"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SQLite database connection management.
|
|
3
|
+
* Uses better-sqlite3 sync API.
|
|
4
|
+
*/
|
|
5
|
+
import Database from "better-sqlite3";
|
|
6
|
+
import { mkdirSync, existsSync } from "node:fs";
|
|
7
|
+
import { dirname } from "node:path";
|
|
8
|
+
/**
|
|
9
|
+
* Opens or creates a SQLite database at the given path.
|
|
10
|
+
* Ensures the parent directory exists.
|
|
11
|
+
*/
|
|
12
|
+
export function openDatabase(dbPath) {
|
|
13
|
+
const dir = dirname(dbPath);
|
|
14
|
+
if (!existsSync(dir)) {
|
|
15
|
+
mkdirSync(dir, { recursive: true });
|
|
16
|
+
}
|
|
17
|
+
const db = new Database(dbPath);
|
|
18
|
+
// Enable foreign keys
|
|
19
|
+
db.pragma("foreign_keys = ON");
|
|
20
|
+
return db;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Creates an in-memory database for testing.
|
|
24
|
+
*/
|
|
25
|
+
export function openMemoryDatabase() {
|
|
26
|
+
const db = new Database(":memory:");
|
|
27
|
+
db.pragma("foreign_keys = ON");
|
|
28
|
+
return db;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=connection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection.js","sourceRoot":"","sources":["../../src/db/connection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,MAAc;IACzC,MAAM,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5B,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACrB,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACtC,CAAC;IAED,MAAM,EAAE,GAAG,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC;IAEhC,sBAAsB;IACtB,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;IAE/B,OAAO,EAAE,CAAC;AACZ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB;IAChC,MAAM,EAAE,GAAG,IAAI,QAAQ,CAAC,UAAU,CAAC,CAAC;IACpC,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;IAC/B,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event CRUD operations.
|
|
3
|
+
* Uses better-sqlite3 sync API.
|
|
4
|
+
*/
|
|
5
|
+
import type Database from "better-sqlite3";
|
|
6
|
+
import type { BaseEvent, ErrorCategory, EventStatus, EventType } from "../types/index.js";
|
|
7
|
+
/** Input for inserting a new event */
|
|
8
|
+
export interface InsertEventInput {
|
|
9
|
+
id: string;
|
|
10
|
+
sessionId: string;
|
|
11
|
+
parentEventId?: string | null;
|
|
12
|
+
sequence: number;
|
|
13
|
+
eventType: EventType;
|
|
14
|
+
agentRole: string;
|
|
15
|
+
agentName: string;
|
|
16
|
+
skillName?: string | null;
|
|
17
|
+
toolName?: string | null;
|
|
18
|
+
mcpMethod?: string | null;
|
|
19
|
+
startedAt: string;
|
|
20
|
+
endedAt?: string | null;
|
|
21
|
+
status: EventStatus;
|
|
22
|
+
inputJson?: string | null;
|
|
23
|
+
outputJson?: string | null;
|
|
24
|
+
errorCategory?: ErrorCategory | null;
|
|
25
|
+
}
|
|
26
|
+
/** Insert a new event */
|
|
27
|
+
export declare function insertEvent(db: Database.Database, event: InsertEventInput): BaseEvent;
|
|
28
|
+
/** Get event by ID */
|
|
29
|
+
export declare function getEventById(db: Database.Database, id: string): BaseEvent | null;
|
|
30
|
+
/** Get all events for a session, ordered by sequence */
|
|
31
|
+
export declare function getEventsBySession(db: Database.Database, sessionId: string): BaseEvent[];
|
|
32
|
+
/** Query options for getEventsBySessionPaginated */
|
|
33
|
+
export interface EventQueryOptions {
|
|
34
|
+
/** Only return events with sequence > after (default: 0) */
|
|
35
|
+
after?: number;
|
|
36
|
+
/** Maximum number of events to return (default: 200) */
|
|
37
|
+
limit?: number;
|
|
38
|
+
}
|
|
39
|
+
/** Get events for a session with pagination, ordered by sequence ASC */
|
|
40
|
+
export declare function getEventsBySessionPaginated(db: Database.Database, sessionId: string, options?: EventQueryOptions): BaseEvent[];
|
|
41
|
+
/** Count events for a session (efficient SQL count) */
|
|
42
|
+
export declare function countEventsBySession(db: Database.Database, sessionId: string): number;
|
|
43
|
+
/** Update an event's status and endedAt */
|
|
44
|
+
export declare function updateEventStatus(db: Database.Database, id: string, status: EventStatus, endedAt?: string): BaseEvent | null;
|
|
45
|
+
/** Filter options for event queries */
|
|
46
|
+
export interface EventFilterOptions {
|
|
47
|
+
/** Filter by tool name */
|
|
48
|
+
toolName?: string;
|
|
49
|
+
/** Filter by status */
|
|
50
|
+
status?: EventStatus;
|
|
51
|
+
/** Filter by error category */
|
|
52
|
+
errorCategory?: ErrorCategory;
|
|
53
|
+
/** Only events with sequence > sinceSeq */
|
|
54
|
+
sinceSeq?: number;
|
|
55
|
+
/** Maximum number of events to return */
|
|
56
|
+
limit?: number;
|
|
57
|
+
}
|
|
58
|
+
/** Get events for a session with filters (for CLI grep/search) */
|
|
59
|
+
export declare function getEventsBySessionFiltered(db: Database.Database, sessionId: string, options?: EventFilterOptions): BaseEvent[];
|
|
60
|
+
/**
|
|
61
|
+
* Get the most recent tool_call event for a session.
|
|
62
|
+
* Used by doctor command to show recording health.
|
|
63
|
+
*/
|
|
64
|
+
export declare function getLatestToolCallEvent(db: Database.Database, sessionId: string): BaseEvent | null;
|
|
65
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/db/events.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EACb,WAAW,EACX,SAAS,EACV,MAAM,mBAAmB,CAAC;AA8C3B,sCAAsC;AACtC,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,SAAS,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,WAAW,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,aAAa,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;CACtC;AAED,yBAAyB;AACzB,wBAAgB,WAAW,CACzB,EAAE,EAAE,QAAQ,CAAC,QAAQ,EAC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