agent-recorder 0.0.1 → 0.0.8
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/package.json +2 -2
- package/vendor/node_modules/@agent-recorder/core/db/migrations.d.ts +2 -2
- package/vendor/node_modules/@agent-recorder/core/db/migrations.d.ts.map +1 -1
- package/vendor/node_modules/@agent-recorder/core/db/migrations.js +14 -6
- package/vendor/node_modules/@agent-recorder/core/db/migrations.js.map +1 -1
- package/vendor/node_modules/@agent-recorder/cli/analytics/session-analytics 2.js +0 -205
- package/vendor/node_modules/@agent-recorder/cli/analytics/session-analytics.d 2.ts +0 -50
- package/vendor/node_modules/@agent-recorder/cli/analytics/session-analytics.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/analytics/session-analytics.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/analytics/session-analytics.test 2.js +0 -253
- package/vendor/node_modules/@agent-recorder/cli/analytics/session-analytics.test.d 2.ts +0 -5
- package/vendor/node_modules/@agent-recorder/cli/analytics/session-analytics.test.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/analytics/session-analytics.test.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/commands/configure 2.js +0 -144
- package/vendor/node_modules/@agent-recorder/cli/commands/configure.d 2.ts +0 -17
- package/vendor/node_modules/@agent-recorder/cli/commands/configure.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/commands/configure.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/commands/diagnose 2.js +0 -141
- package/vendor/node_modules/@agent-recorder/cli/commands/diagnose.d 2.ts +0 -5
- package/vendor/node_modules/@agent-recorder/cli/commands/diagnose.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/commands/diagnose.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/commands/doctor 2.js +0 -253
- package/vendor/node_modules/@agent-recorder/cli/commands/doctor.d 2.ts +0 -5
- package/vendor/node_modules/@agent-recorder/cli/commands/doctor.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/commands/doctor.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/commands/export 2.js +0 -56
- package/vendor/node_modules/@agent-recorder/cli/commands/export.d 2.ts +0 -12
- package/vendor/node_modules/@agent-recorder/cli/commands/export.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/commands/export.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/commands/install 2.js +0 -77
- package/vendor/node_modules/@agent-recorder/cli/commands/install.d 2.ts +0 -13
- package/vendor/node_modules/@agent-recorder/cli/commands/install.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/commands/install.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/commands/logs 2.js +0 -40
- package/vendor/node_modules/@agent-recorder/cli/commands/logs.d 2.ts +0 -8
- package/vendor/node_modules/@agent-recorder/cli/commands/logs.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/commands/logs.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/commands/mock-mcp 2.js +0 -188
- package/vendor/node_modules/@agent-recorder/cli/commands/mock-mcp.d 2.ts +0 -10
- package/vendor/node_modules/@agent-recorder/cli/commands/mock-mcp.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/commands/mock-mcp.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/commands/restart 2.js +0 -67
- package/vendor/node_modules/@agent-recorder/cli/commands/restart.d 2.ts +0 -9
- package/vendor/node_modules/@agent-recorder/cli/commands/restart.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/commands/restart.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/commands/sessions 2.js +0 -333
- package/vendor/node_modules/@agent-recorder/cli/commands/sessions.d 2.ts +0 -52
- package/vendor/node_modules/@agent-recorder/cli/commands/sessions.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/commands/sessions.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/commands/start 2.js +0 -174
- package/vendor/node_modules/@agent-recorder/cli/commands/start.d 2.ts +0 -10
- package/vendor/node_modules/@agent-recorder/cli/commands/start.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/commands/start.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/commands/status 2.js +0 -104
- package/vendor/node_modules/@agent-recorder/cli/commands/status.d 2.ts +0 -5
- package/vendor/node_modules/@agent-recorder/cli/commands/status.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/commands/status.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/commands/stop 2.js +0 -89
- package/vendor/node_modules/@agent-recorder/cli/commands/stop.d 2.ts +0 -8
- package/vendor/node_modules/@agent-recorder/cli/commands/stop.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/commands/stop.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/commands/tui 2.js +0 -14
- package/vendor/node_modules/@agent-recorder/cli/commands/tui.d 2.ts +0 -5
- package/vendor/node_modules/@agent-recorder/cli/commands/tui.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/commands/tui.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/config/claude-paths 2.js +0 -117
- package/vendor/node_modules/@agent-recorder/cli/config/claude-paths.d 2.ts +0 -55
- package/vendor/node_modules/@agent-recorder/cli/config/claude-paths.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/config/claude-paths.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/config/claude-paths.test 2.js +0 -152
- package/vendor/node_modules/@agent-recorder/cli/config/claude-paths.test.d 2.ts +0 -5
- package/vendor/node_modules/@agent-recorder/cli/config/claude-paths.test.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/config/claude-paths.test.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/index 2.js +0 -194
- package/vendor/node_modules/@agent-recorder/cli/index.d 2.ts +0 -10
- package/vendor/node_modules/@agent-recorder/cli/index.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/index.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/package 2.json +0 -17
- package/vendor/node_modules/@agent-recorder/cli/tui/App 2.js +0 -84
- package/vendor/node_modules/@agent-recorder/cli/tui/App.d 2.ts +0 -6
- package/vendor/node_modules/@agent-recorder/cli/tui/App.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/tui/App.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/tui/api 2.js +0 -105
- package/vendor/node_modules/@agent-recorder/cli/tui/api.d 2.ts +0 -31
- package/vendor/node_modules/@agent-recorder/cli/tui/api.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/tui/api.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/tui/components/EventInspectPanel 2.js +0 -45
- package/vendor/node_modules/@agent-recorder/cli/tui/components/EventInspectPanel.d 2.ts +0 -11
- package/vendor/node_modules/@agent-recorder/cli/tui/components/EventInspectPanel.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/tui/components/EventInspectPanel.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/tui/components/Header 2.js +0 -13
- package/vendor/node_modules/@agent-recorder/cli/tui/components/Header.d 2.ts +0 -17
- package/vendor/node_modules/@agent-recorder/cli/tui/components/Header.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/tui/components/Header.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/tui/components/Spinner 2.js +0 -21
- package/vendor/node_modules/@agent-recorder/cli/tui/components/Spinner.d 2.ts +0 -12
- package/vendor/node_modules/@agent-recorder/cli/tui/components/Spinner.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/tui/components/Spinner.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/tui/components/StatusBadge 2.js +0 -50
- package/vendor/node_modules/@agent-recorder/cli/tui/components/StatusBadge.d 2.ts +0 -16
- package/vendor/node_modules/@agent-recorder/cli/tui/components/StatusBadge.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/tui/components/StatusBadge.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/tui/components/Table 2.js +0 -20
- package/vendor/node_modules/@agent-recorder/cli/tui/components/Table.d 2.ts +0 -21
- package/vendor/node_modules/@agent-recorder/cli/tui/components/Table.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/tui/components/Table.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/tui/components/index 2.js +0 -8
- package/vendor/node_modules/@agent-recorder/cli/tui/components/index.d 2.ts +0 -8
- package/vendor/node_modules/@agent-recorder/cli/tui/components/index.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/tui/components/index.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/tui/hooks/useEventStream 2.js +0 -75
- package/vendor/node_modules/@agent-recorder/cli/tui/hooks/useEventStream.d 2.ts +0 -22
- package/vendor/node_modules/@agent-recorder/cli/tui/hooks/useEventStream.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/tui/hooks/useEventStream.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/tui/screens/SessionDetailScreen 2.js +0 -190
- package/vendor/node_modules/@agent-recorder/cli/tui/screens/SessionDetailScreen.d 2.ts +0 -13
- package/vendor/node_modules/@agent-recorder/cli/tui/screens/SessionDetailScreen.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/tui/screens/SessionDetailScreen.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/tui/screens/SessionsScreen 2.js +0 -166
- package/vendor/node_modules/@agent-recorder/cli/tui/screens/SessionsScreen.d 2.ts +0 -10
- package/vendor/node_modules/@agent-recorder/cli/tui/screens/SessionsScreen.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/tui/screens/SessionsScreen.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/tui/screens/index 2.js +0 -6
- package/vendor/node_modules/@agent-recorder/cli/tui/screens/index.d 2.ts +0 -6
- package/vendor/node_modules/@agent-recorder/cli/tui/screens/index.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/cli/tui/screens/index.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/core/config 2.js +0 -44
- package/vendor/node_modules/@agent-recorder/core/config.d 2.ts +0 -25
- package/vendor/node_modules/@agent-recorder/core/config.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/core/db/connection.d 2.ts +0 -15
- package/vendor/node_modules/@agent-recorder/core/migrations/001_initial 2.sql +0 -40
- package/vendor/node_modules/@agent-recorder/core/migrations/002_session_sequences 2.sql +0 -8
- package/vendor/node_modules/@agent-recorder/core/migrations/003_add_tool_columns 2.sql +0 -9
- package/vendor/node_modules/@agent-recorder/core/migrations/004_add_cancelled_status 2.sql +0 -23
- package/vendor/node_modules/@agent-recorder/core/migrations/005_add_error_category 2.sql +0 -6
- package/vendor/node_modules/@agent-recorder/core/package 2.json +0 -18
- package/vendor/node_modules/@agent-recorder/core/types/events.d 2.ts +0 -69
- package/vendor/node_modules/@agent-recorder/core/types/index 2.js +0 -2
- package/vendor/node_modules/@agent-recorder/core/types/index.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/core/types/session 2.js +0 -6
- package/vendor/node_modules/@agent-recorder/core/types/session.d 2.ts +0 -22
- package/vendor/node_modules/@agent-recorder/core/types/session.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/core/types/session.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/core/utils/error-category 2.js +0 -58
- package/vendor/node_modules/@agent-recorder/core/utils/error-category.d 2.ts +0 -22
- package/vendor/node_modules/@agent-recorder/core/utils/error-category.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/core/utils/error-category.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/core/utils/error-category.test.d 2.ts +0 -5
- package/vendor/node_modules/@agent-recorder/core/utils/error-category.test.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/core/utils/error-category.test.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/core/utils/index 2.js +0 -6
- package/vendor/node_modules/@agent-recorder/core/utils/index.d 2.ts +0 -6
- package/vendor/node_modules/@agent-recorder/core/utils/index.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/core/utils/index.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/core/utils/redact.d 2.ts +0 -19
- package/vendor/node_modules/@agent-recorder/core/utils/redact.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/core/utils/redact.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/service/index 2.js +0 -128
- package/vendor/node_modules/@agent-recorder/service/index.d 2.ts +0 -36
- package/vendor/node_modules/@agent-recorder/service/index.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/service/index.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/service/mcp/index 2.js +0 -7
- package/vendor/node_modules/@agent-recorder/service/mcp/index.d 2.ts +0 -7
- package/vendor/node_modules/@agent-recorder/service/mcp/index.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/service/mcp/index.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/service/mcp/proxy 2.js +0 -223
- package/vendor/node_modules/@agent-recorder/service/mcp/proxy.d 2.ts +0 -26
- package/vendor/node_modules/@agent-recorder/service/mcp/proxy.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/service/mcp/proxy.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/service/mcp/proxy.test.d 2.ts +0 -5
- package/vendor/node_modules/@agent-recorder/service/mcp/proxy.test.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/service/mcp/proxy.test.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/service/mcp/recorder 2.js +0 -62
- package/vendor/node_modules/@agent-recorder/service/mcp/recorder.d 2.ts +0 -31
- package/vendor/node_modules/@agent-recorder/service/mcp/recorder.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/service/mcp/recorder.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/service/mcp/types 2.js +0 -15
- package/vendor/node_modules/@agent-recorder/service/mcp/types.d 2.ts +0 -40
- package/vendor/node_modules/@agent-recorder/service/mcp/types.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/service/mcp/types.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/service/package 2.json +0 -15
- package/vendor/node_modules/@agent-recorder/service/routes/events 2.js +0 -71
- package/vendor/node_modules/@agent-recorder/service/routes/events.d 2.ts +0 -11
- package/vendor/node_modules/@agent-recorder/service/routes/events.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/service/routes/events.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/service/routes/health 2.js +0 -18
- package/vendor/node_modules/@agent-recorder/service/routes/health.d 2.ts +0 -6
- package/vendor/node_modules/@agent-recorder/service/routes/health.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/service/routes/health.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/service/routes/sessions 2.js +0 -80
- package/vendor/node_modules/@agent-recorder/service/routes/sessions.d 2.ts +0 -12
- package/vendor/node_modules/@agent-recorder/service/routes/sessions.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/service/routes/sessions.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/service/server 2.js +0 -36
- package/vendor/node_modules/@agent-recorder/service/server.d 2.ts +0 -19
- package/vendor/node_modules/@agent-recorder/service/server.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/service/server.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/service/server.test 2.js +0 -296
- package/vendor/node_modules/@agent-recorder/service/server.test.d 2.ts +0 -5
- package/vendor/node_modules/@agent-recorder/service/server.test.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/service/session-manager 2.js +0 -22
- package/vendor/node_modules/@agent-recorder/service/session-manager.d 2.ts +0 -16
- package/vendor/node_modules/@agent-recorder/service/session-manager.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/service/session-manager.js 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/service/session-manager.test 2.js +0 -61
- package/vendor/node_modules/@agent-recorder/service/session-manager.test.d 2.ts +0 -5
- package/vendor/node_modules/@agent-recorder/service/session-manager.test.d.ts 2.map +0 -1
- package/vendor/node_modules/@agent-recorder/service/session-manager.test.js 2.map +0 -1
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tool call recorder.
|
|
3
|
-
* Records tool_call events to the database with atomic sequence allocation.
|
|
4
|
-
* Implements fail-open pattern: errors are logged but don't block proxy forwarding.
|
|
5
|
-
*/
|
|
6
|
-
import type Database from "better-sqlite3";
|
|
7
|
-
import { type EventStatus } from "@agent-recorder/core";
|
|
8
|
-
export interface RecordToolCallOptions {
|
|
9
|
-
db: Database.Database;
|
|
10
|
-
sessionId: string;
|
|
11
|
-
parentEventId?: string | null;
|
|
12
|
-
toolName: string;
|
|
13
|
-
mcpMethod?: string;
|
|
14
|
-
input: unknown;
|
|
15
|
-
output: unknown;
|
|
16
|
-
status: EventStatus;
|
|
17
|
-
startedAt: string;
|
|
18
|
-
endedAt: string;
|
|
19
|
-
redactKeys: string[];
|
|
20
|
-
/** Enable debug logging (metadata only, no payloads) */
|
|
21
|
-
debugProxy?: boolean;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Record a tool call event to the database.
|
|
25
|
-
* Uses atomic sequence allocation from session_sequences table.
|
|
26
|
-
* Fails open: catches errors, logs them, and continues.
|
|
27
|
-
*
|
|
28
|
-
* @returns The event ID if successful, null if recording failed
|
|
29
|
-
*/
|
|
30
|
-
export declare function recordToolCall(options: RecordToolCallOptions): string | null;
|
|
31
|
-
//# sourceMappingURL=recorder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"recorder.d.ts","sourceRoot":"","sources":["../../src/mcp/recorder.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAKL,KAAK,WAAW,EACjB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,QAAQ,CAAC,QAAQ,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,WAAW,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,wDAAwD;IACxD,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,MAAM,GAAG,IAAI,CAoE5E"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"recorder.js","sourceRoot":"","sources":["../../src/mcp/recorder.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,WAAW,EACX,iBAAiB,GAElB,MAAM,sBAAsB,CAAC;AAkB9B;;;;;;GAMG;AACH,MAAM,UAAU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,WAAW,MAAM,aAAa,UAAU,IAAI,CACrH,CAAC;QACJ,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,uCAAuC;QACvC,OAAO,CAAC,KAAK,CAAC,6BAA6B,EAAE,KAAK,CAAC,CAAC;QACpD,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* JSON-RPC 2.0 types for MCP protocol.
|
|
3
|
-
*/
|
|
4
|
-
/** Check if a JSON-RPC request is a tools/call request */
|
|
5
|
-
export function isToolsCallRequest(request) {
|
|
6
|
-
return (request.method === "tools/call" &&
|
|
7
|
-
typeof request.params === "object" &&
|
|
8
|
-
request.params !== null &&
|
|
9
|
-
"name" in request.params);
|
|
10
|
-
}
|
|
11
|
-
/** Check if a JSON-RPC response is an error response */
|
|
12
|
-
export function isErrorResponse(response) {
|
|
13
|
-
return "error" in response;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=types.js.map
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* JSON-RPC 2.0 types for MCP protocol.
|
|
3
|
-
*/
|
|
4
|
-
/** Base JSON-RPC request structure */
|
|
5
|
-
export interface JsonRpcRequest {
|
|
6
|
-
jsonrpc: "2.0";
|
|
7
|
-
method: string;
|
|
8
|
-
params?: unknown;
|
|
9
|
-
id?: string | number | null;
|
|
10
|
-
}
|
|
11
|
-
/** JSON-RPC success response */
|
|
12
|
-
export interface JsonRpcSuccessResponse {
|
|
13
|
-
jsonrpc: "2.0";
|
|
14
|
-
result: unknown;
|
|
15
|
-
id: string | number | null;
|
|
16
|
-
}
|
|
17
|
-
/** JSON-RPC error response */
|
|
18
|
-
export interface JsonRpcErrorResponse {
|
|
19
|
-
jsonrpc: "2.0";
|
|
20
|
-
error: {
|
|
21
|
-
code: number;
|
|
22
|
-
message: string;
|
|
23
|
-
data?: unknown;
|
|
24
|
-
};
|
|
25
|
-
id: string | number | null;
|
|
26
|
-
}
|
|
27
|
-
/** Union of JSON-RPC response types */
|
|
28
|
-
export type JsonRpcResponse = JsonRpcSuccessResponse | JsonRpcErrorResponse;
|
|
29
|
-
/** MCP tools/call request params */
|
|
30
|
-
export interface ToolsCallParams {
|
|
31
|
-
name: string;
|
|
32
|
-
arguments?: Record<string, unknown>;
|
|
33
|
-
}
|
|
34
|
-
/** Check if a JSON-RPC request is a tools/call request */
|
|
35
|
-
export declare function isToolsCallRequest(request: JsonRpcRequest): request is JsonRpcRequest & {
|
|
36
|
-
params: ToolsCallParams;
|
|
37
|
-
};
|
|
38
|
-
/** Check if a JSON-RPC response is an error response */
|
|
39
|
-
export declare function isErrorResponse(response: JsonRpcResponse): response is JsonRpcErrorResponse;
|
|
40
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/mcp/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,sCAAsC;AACtC,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,KAAK,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,gCAAgC;AAChC,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,KAAK,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,8BAA8B;AAC9B,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,KAAK,CAAC;IACf,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,OAAO,CAAC;KAChB,CAAC;IACF,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,uCAAuC;AACvC,MAAM,MAAM,eAAe,GAAG,sBAAsB,GAAG,oBAAoB,CAAC;AAE5E,oCAAoC;AACpC,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC;AAED,0DAA0D;AAC1D,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,cAAc,GACtB,OAAO,IAAI,cAAc,GAAG;IAAE,MAAM,EAAE,eAAe,CAAA;CAAE,CAOzD;AAED,wDAAwD;AACxD,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,eAAe,GACxB,QAAQ,IAAI,oBAAoB,CAElC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/mcp/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAqCH,0DAA0D;AAC1D,MAAM,UAAU,kBAAkB,CAChC,OAAuB;IAEvB,OAAO,CACL,OAAO,CAAC,MAAM,KAAK,YAAY;QAC/B,OAAO,OAAO,CAAC,MAAM,KAAK,QAAQ;QAClC,OAAO,CAAC,MAAM,KAAK,IAAI;QACvB,MAAM,IAAI,OAAO,CAAC,MAAM,CACzB,CAAC;AACJ,CAAC;AAED,wDAAwD;AACxD,MAAM,UAAU,eAAe,CAC7B,QAAyB;IAEzB,OAAO,OAAO,IAAI,QAAQ,CAAC;AAC7B,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@agent-recorder/service",
|
|
3
|
-
"version": "0.0.1",
|
|
4
|
-
"type": "module",
|
|
5
|
-
"exports": {
|
|
6
|
-
".": {
|
|
7
|
-
"types": "./index.d.ts",
|
|
8
|
-
"import": "./index.js"
|
|
9
|
-
}
|
|
10
|
-
},
|
|
11
|
-
"dependencies": {
|
|
12
|
-
"better-sqlite3": "^11.7.0",
|
|
13
|
-
"fastify": "^5.0.0"
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Event management endpoints.
|
|
3
|
-
*/
|
|
4
|
-
import { insertEvent, getEventsBySession, getEventsBySessionPaginated, countEventsBySession, getLatestToolCallEvent, } from "@agent-recorder/core";
|
|
5
|
-
export async function registerEventsRoutes(app, options) {
|
|
6
|
-
const { db } = options;
|
|
7
|
-
// Insert a new event
|
|
8
|
-
app.post("/api/events", async (request, reply) => {
|
|
9
|
-
try {
|
|
10
|
-
const event = insertEvent(db, request.body);
|
|
11
|
-
return reply.code(201).send(event);
|
|
12
|
-
}
|
|
13
|
-
catch (error) {
|
|
14
|
-
console.error("Failed to insert event:", error);
|
|
15
|
-
// Fail-open: log error but return 500, don't crash
|
|
16
|
-
return reply.code(500).send({ error: "Failed to insert event" });
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
// Get events for a session with optional after/limit for tailing
|
|
20
|
-
app.get("/api/sessions/:id/events", async (request) => {
|
|
21
|
-
try {
|
|
22
|
-
const { id } = request.params;
|
|
23
|
-
const { after, limit } = request.query;
|
|
24
|
-
// If no query params, return all events (legacy behavior)
|
|
25
|
-
if (after === undefined && limit === undefined) {
|
|
26
|
-
return getEventsBySession(db, id);
|
|
27
|
-
}
|
|
28
|
-
// Use paginated query
|
|
29
|
-
return getEventsBySessionPaginated(db, id, {
|
|
30
|
-
after: after ? parseInt(after, 10) : 0,
|
|
31
|
-
limit: limit ? parseInt(limit, 10) : 200,
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
catch (error) {
|
|
35
|
-
console.error("Failed to get session events:", error);
|
|
36
|
-
return [];
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
// Get event count for a session (efficient SQL count)
|
|
40
|
-
app.get("/api/sessions/:id/events/count", async (request) => {
|
|
41
|
-
try {
|
|
42
|
-
const { id } = request.params;
|
|
43
|
-
return { count: countEventsBySession(db, id) };
|
|
44
|
-
}
|
|
45
|
-
catch (error) {
|
|
46
|
-
console.error("Failed to count session events:", error);
|
|
47
|
-
return { count: 0 };
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
// Get latest tool_call event for a session (used by doctor command)
|
|
51
|
-
app.get("/api/sessions/:id/events/latest-tool-call", async (request, reply) => {
|
|
52
|
-
try {
|
|
53
|
-
const { id } = request.params;
|
|
54
|
-
const event = getLatestToolCallEvent(db, id);
|
|
55
|
-
if (event) {
|
|
56
|
-
// Return minimal info needed by doctor
|
|
57
|
-
return {
|
|
58
|
-
toolName: event.toolName,
|
|
59
|
-
mcpMethod: event.mcpMethod,
|
|
60
|
-
startedAt: event.startedAt,
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
return reply.code(404).send({ error: "No tool_call events found" });
|
|
64
|
-
}
|
|
65
|
-
catch (error) {
|
|
66
|
-
console.error("Failed to get latest tool_call event:", error);
|
|
67
|
-
return reply.code(500).send({ error: "Failed to get event" });
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
//# sourceMappingURL=events.js.map
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Event management endpoints.
|
|
3
|
-
*/
|
|
4
|
-
import type { FastifyInstance } from "fastify";
|
|
5
|
-
import type Database from "better-sqlite3";
|
|
6
|
-
interface EventsRoutesOptions {
|
|
7
|
-
db: Database.Database;
|
|
8
|
-
}
|
|
9
|
-
export declare function registerEventsRoutes(app: FastifyInstance, options: EventsRoutesOptions): Promise<void>;
|
|
10
|
-
export {};
|
|
11
|
-
//# sourceMappingURL=events.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/routes/events.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,KAAK,QAA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AE;QACvB,IAAI,CAAC;YACH,MAAM,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;YAC9B,MAAM,KAAK,GAAG,sBAAsB,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;YAC7C,IAAI,KAAK,EAAE,CAAC;gBACV,uCAAuC;gBACvC,OAAO;oBACL,QAAQ,EAAE,KAAK,CAAC,QAAQ;oBACxB,SAAS,EAAE,KAAK,CAAC,SAAS;oBAC1B,SAAS,EAAE,KAAK,CAAC,SAAS;iBAC3B,CAAC;YACJ,CAAC;YACD,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,2BAA2B,EAAE,CAAC,CAAC;QACtE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,uCAAuC,EAAE,KAAK,CAAC,CAAC;YAC9D,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,qBAAqB,EAAE,CAAC,CAAC;QAChE,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Health check endpoint with daemon diagnostics.
|
|
3
|
-
*/
|
|
4
|
-
import { getDaemonInfo } from "../index.js";
|
|
5
|
-
export async function registerHealthRoutes(app) {
|
|
6
|
-
app.get("/api/health", async () => {
|
|
7
|
-
const daemonInfo = getDaemonInfo();
|
|
8
|
-
return {
|
|
9
|
-
status: "ok",
|
|
10
|
-
pid: process.pid,
|
|
11
|
-
uptime: process.uptime(),
|
|
12
|
-
mode: daemonInfo.mode,
|
|
13
|
-
sessionId: daemonInfo.sessionId,
|
|
14
|
-
startedAt: daemonInfo.startedAt,
|
|
15
|
-
};
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=health.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../src/routes/health.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG/C,wBAAsB,oBAAoB,CACxC,GAAG,EAAE,eAAe,GACnB,OAAO,CAAC,IAAI,CAAC,CAaf"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"health.js","sourceRoot":"","sources":["../../src/routes/health.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,GAAoB;IAEpB,GAAG,CAAC,GAAG,CAAC,aAAa,EAAE,KAAK,IAAI,EAAE;QAChC,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC;QAEnC,OAAO;YACL,MAAM,EAAE,IAAI;YACZ,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE;YACxB,IAAI,EAAE,UAAU,CAAC,IAAI;YACrB,SAAS,EAAE,UAAU,CAAC,SAAS;YAC/B,SAAS,EAAE,UAAU,CAAC,SAAS;SAChC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Session management endpoints.
|
|
3
|
-
*/
|
|
4
|
-
import { createSession, endSession, getSessionById, listSessions, } from "@agent-recorder/core";
|
|
5
|
-
import { randomUUID } from "node:crypto";
|
|
6
|
-
export async function registerSessionsRoutes(app, options) {
|
|
7
|
-
const { db, currentSessionId } = options;
|
|
8
|
-
// Get current active session (daemon's session)
|
|
9
|
-
app.get("/api/sessions/current", async (request, reply) => {
|
|
10
|
-
if (!currentSessionId) {
|
|
11
|
-
return reply.code(404).send({ error: "No active session" });
|
|
12
|
-
}
|
|
13
|
-
const session = getSessionById(db, currentSessionId);
|
|
14
|
-
if (!session) {
|
|
15
|
-
return reply.code(404).send({ error: "Session not found" });
|
|
16
|
-
}
|
|
17
|
-
return {
|
|
18
|
-
id: session.id,
|
|
19
|
-
status: session.status,
|
|
20
|
-
startedAt: session.startedAt,
|
|
21
|
-
};
|
|
22
|
-
});
|
|
23
|
-
// Create a new session
|
|
24
|
-
app.post("/api/sessions", async (request, reply) => {
|
|
25
|
-
try {
|
|
26
|
-
const id = randomUUID();
|
|
27
|
-
const startedAt = new Date().toISOString();
|
|
28
|
-
const session = createSession(db, id, startedAt);
|
|
29
|
-
return reply.code(201).send(session);
|
|
30
|
-
}
|
|
31
|
-
catch (error) {
|
|
32
|
-
console.error("Failed to create session:", error);
|
|
33
|
-
return reply.code(500).send({ error: "Failed to create session" });
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
// End a session
|
|
37
|
-
app.post("/api/sessions/:id/end", async (request, reply) => {
|
|
38
|
-
try {
|
|
39
|
-
const { id } = request.params;
|
|
40
|
-
const { status } = request.body ?? {};
|
|
41
|
-
const endedAt = new Date().toISOString();
|
|
42
|
-
const session = endSession(db, id, endedAt, status ?? "completed");
|
|
43
|
-
if (!session) {
|
|
44
|
-
return reply.code(404).send({ error: "Session not found" });
|
|
45
|
-
}
|
|
46
|
-
return session;
|
|
47
|
-
}
|
|
48
|
-
catch (error) {
|
|
49
|
-
console.error("Failed to end session:", error);
|
|
50
|
-
return reply.code(500).send({ error: "Failed to end session" });
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
// List sessions
|
|
54
|
-
app.get("/api/sessions", async (request) => {
|
|
55
|
-
try {
|
|
56
|
-
const { status } = request.query;
|
|
57
|
-
return listSessions(db, status);
|
|
58
|
-
}
|
|
59
|
-
catch (error) {
|
|
60
|
-
console.error("Failed to list sessions:", error);
|
|
61
|
-
return [];
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
// Get session by ID
|
|
65
|
-
app.get("/api/sessions/:id", async (request, reply) => {
|
|
66
|
-
try {
|
|
67
|
-
const { id } = request.params;
|
|
68
|
-
const session = getSessionById(db, id);
|
|
69
|
-
if (!session) {
|
|
70
|
-
return reply.code(404).send({ error: "Session not found" });
|
|
71
|
-
}
|
|
72
|
-
return session;
|
|
73
|
-
}
|
|
74
|
-
catch (error) {
|
|
75
|
-
console.error("Failed to get session:", error);
|
|
76
|
-
return reply.code(500).send({ error: "Failed to get session" });
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
//# sourceMappingURL=sessions.js.map
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Session management endpoints.
|
|
3
|
-
*/
|
|
4
|
-
import type { FastifyInstance } from "fastify";
|
|
5
|
-
import type Database from "better-sqlite3";
|
|
6
|
-
interface SessionsRoutesOptions {
|
|
7
|
-
db: Database.Database;
|
|
8
|
-
currentSessionId: string | null;
|
|
9
|
-
}
|
|
10
|
-
export declare function registerSessionsRoutes(app: FastifyInstance, options: SessionsRoutesOptions): Promise<void>;
|
|
11
|
-
export {};
|
|
12
|
-
//# sourceMappingURL=sessions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sessions.d.ts","sourceRoot":"","sources":["../../src/routes/sessions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAU3C,UAAU,qBAAqB;IAC7B,EAAE,EAAE,QAAQ,CAAC,QAAQ,CAAC;IACtB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AAED,wBAAsB,sBAAsB,CAC1C,GAAG,EAAE,eAAe,EACpB,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,IAAI,CAAC,CAyFf"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sessions.js","sourceRoot":"","sources":["../../src/routes/sessions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G,CACL,eAAe,EACf,KAAK,EAAE,OAAO,EAAE,EAAE;QAChB,IAAI,CAAC;YACH,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC;YACjC,OAAO,YAAY,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;QAClC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,0BAA0B,EAAE,KAAK,CAAC,CAAC;YACjD,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC,CACF,CAAC;IAEF,oBAAoB;IACpB,GAAG,CAAC,GAAG,CACL,mBAAmB,EACnB,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE;QACvB,IAAI,CAAC;YACH,MAAM,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;YAC9B,MAAM,OAAO,GAAG,cAAc,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;YAEvC,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,mBAAmB,EAAE,CAAC,CAAC;YAC9D,CAAC;YAED,OAAO,OAAO,CAAC;QACjB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;YAC/C,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,uBAAuB,EAAE,CAAC,CAAC;QAClE,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fastify server factory.
|
|
3
|
-
* Creates and configures the daemon server.
|
|
4
|
-
*/
|
|
5
|
-
import Fastify, {} from "fastify";
|
|
6
|
-
import { registerHealthRoutes } from "./routes/health.js";
|
|
7
|
-
import { registerSessionsRoutes } from "./routes/sessions.js";
|
|
8
|
-
import { registerEventsRoutes } from "./routes/events.js";
|
|
9
|
-
/**
|
|
10
|
-
* Create a configured Fastify server instance.
|
|
11
|
-
*/
|
|
12
|
-
export async function createServer(options) {
|
|
13
|
-
const { db, currentSessionId } = options;
|
|
14
|
-
const app = Fastify({
|
|
15
|
-
logger: true,
|
|
16
|
-
});
|
|
17
|
-
// Register routes
|
|
18
|
-
await registerHealthRoutes(app);
|
|
19
|
-
await registerSessionsRoutes(app, {
|
|
20
|
-
db,
|
|
21
|
-
currentSessionId: currentSessionId ?? null,
|
|
22
|
-
});
|
|
23
|
-
await registerEventsRoutes(app, { db });
|
|
24
|
-
return app;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Start the server on localhost only.
|
|
28
|
-
*/
|
|
29
|
-
export async function startServer(app, port) {
|
|
30
|
-
await app.listen({
|
|
31
|
-
port,
|
|
32
|
-
host: "127.0.0.1", // localhost only
|
|
33
|
-
});
|
|
34
|
-
console.log(`Agent Recorder daemon listening on http://127.0.0.1:${port}`);
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=server.js.map
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fastify server factory.
|
|
3
|
-
* Creates and configures the daemon server.
|
|
4
|
-
*/
|
|
5
|
-
import { type FastifyInstance } from "fastify";
|
|
6
|
-
import type Database from "better-sqlite3";
|
|
7
|
-
export interface CreateServerOptions {
|
|
8
|
-
db: Database.Database;
|
|
9
|
-
currentSessionId?: string | null;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Create a configured Fastify server instance.
|
|
13
|
-
*/
|
|
14
|
-
export declare function createServer(options: CreateServerOptions): Promise<FastifyInstance>;
|
|
15
|
-
/**
|
|
16
|
-
* Start the server on localhost only.
|
|
17
|
-
*/
|
|
18
|
-
export declare function startServer(app: FastifyInstance, port: number): Promise<void>;
|
|
19
|
-
//# sourceMappingURL=server.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAgB,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAK3C,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,QAAQ,CAAC,QAAQ,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC;AAED;;GAEG;AACH,wBAAsB,YAAY,CAChC,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,eAAe,CAAC,CAgB1B;AAED;;GAEG;AACH,wBAAsB,WAAW,CAC/B,GAAG,EAAE,eAAe,EACpB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,IAAI,CAAC,CAMf"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,OAAO,EAAE,EAAwB,MAAM,SAAS,CAAC;AAExD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAO1D;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,OAA4B;IAE5B,MAAM,EAAE,EAAE,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC;IAEzC,MAAM,GAAG,GAAG,OAAO,CAAC;QAClB,MAAM,EAAE,IAAI;KACb,CAAC,CAAC;IAEH,kBAAkB;IAClB,MAAM,oBAAoB,CAAC,GAAG,CAAC,CAAC;IAChC,MAAM,sBAAsB,CAAC,GAAG,EAAE;QAChC,EAAE;QACF,gBAAgB,EAAE,gBAAgB,IAAI,IAAI;K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