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.
Files changed (208) hide show
  1. package/package.json +2 -2
  2. package/vendor/node_modules/@agent-recorder/core/db/migrations.d.ts +2 -2
  3. package/vendor/node_modules/@agent-recorder/core/db/migrations.d.ts.map +1 -1
  4. package/vendor/node_modules/@agent-recorder/core/db/migrations.js +14 -6
  5. package/vendor/node_modules/@agent-recorder/core/db/migrations.js.map +1 -1
  6. package/vendor/node_modules/@agent-recorder/cli/analytics/session-analytics 2.js +0 -205
  7. package/vendor/node_modules/@agent-recorder/cli/analytics/session-analytics.d 2.ts +0 -50
  8. package/vendor/node_modules/@agent-recorder/cli/analytics/session-analytics.d.ts 2.map +0 -1
  9. package/vendor/node_modules/@agent-recorder/cli/analytics/session-analytics.js 2.map +0 -1
  10. package/vendor/node_modules/@agent-recorder/cli/analytics/session-analytics.test 2.js +0 -253
  11. package/vendor/node_modules/@agent-recorder/cli/analytics/session-analytics.test.d 2.ts +0 -5
  12. package/vendor/node_modules/@agent-recorder/cli/analytics/session-analytics.test.d.ts 2.map +0 -1
  13. package/vendor/node_modules/@agent-recorder/cli/analytics/session-analytics.test.js 2.map +0 -1
  14. package/vendor/node_modules/@agent-recorder/cli/commands/configure 2.js +0 -144
  15. package/vendor/node_modules/@agent-recorder/cli/commands/configure.d 2.ts +0 -17
  16. package/vendor/node_modules/@agent-recorder/cli/commands/configure.d.ts 2.map +0 -1
  17. package/vendor/node_modules/@agent-recorder/cli/commands/configure.js 2.map +0 -1
  18. package/vendor/node_modules/@agent-recorder/cli/commands/diagnose 2.js +0 -141
  19. package/vendor/node_modules/@agent-recorder/cli/commands/diagnose.d 2.ts +0 -5
  20. package/vendor/node_modules/@agent-recorder/cli/commands/diagnose.d.ts 2.map +0 -1
  21. package/vendor/node_modules/@agent-recorder/cli/commands/diagnose.js 2.map +0 -1
  22. package/vendor/node_modules/@agent-recorder/cli/commands/doctor 2.js +0 -253
  23. package/vendor/node_modules/@agent-recorder/cli/commands/doctor.d 2.ts +0 -5
  24. package/vendor/node_modules/@agent-recorder/cli/commands/doctor.d.ts 2.map +0 -1
  25. package/vendor/node_modules/@agent-recorder/cli/commands/doctor.js 2.map +0 -1
  26. package/vendor/node_modules/@agent-recorder/cli/commands/export 2.js +0 -56
  27. package/vendor/node_modules/@agent-recorder/cli/commands/export.d 2.ts +0 -12
  28. package/vendor/node_modules/@agent-recorder/cli/commands/export.d.ts 2.map +0 -1
  29. package/vendor/node_modules/@agent-recorder/cli/commands/export.js 2.map +0 -1
  30. package/vendor/node_modules/@agent-recorder/cli/commands/install 2.js +0 -77
  31. package/vendor/node_modules/@agent-recorder/cli/commands/install.d 2.ts +0 -13
  32. package/vendor/node_modules/@agent-recorder/cli/commands/install.d.ts 2.map +0 -1
  33. package/vendor/node_modules/@agent-recorder/cli/commands/install.js 2.map +0 -1
  34. package/vendor/node_modules/@agent-recorder/cli/commands/logs 2.js +0 -40
  35. package/vendor/node_modules/@agent-recorder/cli/commands/logs.d 2.ts +0 -8
  36. package/vendor/node_modules/@agent-recorder/cli/commands/logs.d.ts 2.map +0 -1
  37. package/vendor/node_modules/@agent-recorder/cli/commands/logs.js 2.map +0 -1
  38. package/vendor/node_modules/@agent-recorder/cli/commands/mock-mcp 2.js +0 -188
  39. package/vendor/node_modules/@agent-recorder/cli/commands/mock-mcp.d 2.ts +0 -10
  40. package/vendor/node_modules/@agent-recorder/cli/commands/mock-mcp.d.ts 2.map +0 -1
  41. package/vendor/node_modules/@agent-recorder/cli/commands/mock-mcp.js 2.map +0 -1
  42. package/vendor/node_modules/@agent-recorder/cli/commands/restart 2.js +0 -67
  43. package/vendor/node_modules/@agent-recorder/cli/commands/restart.d 2.ts +0 -9
  44. package/vendor/node_modules/@agent-recorder/cli/commands/restart.d.ts 2.map +0 -1
  45. package/vendor/node_modules/@agent-recorder/cli/commands/restart.js 2.map +0 -1
  46. package/vendor/node_modules/@agent-recorder/cli/commands/sessions 2.js +0 -333
  47. package/vendor/node_modules/@agent-recorder/cli/commands/sessions.d 2.ts +0 -52
  48. package/vendor/node_modules/@agent-recorder/cli/commands/sessions.d.ts 2.map +0 -1
  49. package/vendor/node_modules/@agent-recorder/cli/commands/sessions.js 2.map +0 -1
  50. package/vendor/node_modules/@agent-recorder/cli/commands/start 2.js +0 -174
  51. package/vendor/node_modules/@agent-recorder/cli/commands/start.d 2.ts +0 -10
  52. package/vendor/node_modules/@agent-recorder/cli/commands/start.d.ts 2.map +0 -1
  53. package/vendor/node_modules/@agent-recorder/cli/commands/start.js 2.map +0 -1
  54. package/vendor/node_modules/@agent-recorder/cli/commands/status 2.js +0 -104
  55. package/vendor/node_modules/@agent-recorder/cli/commands/status.d 2.ts +0 -5
  56. package/vendor/node_modules/@agent-recorder/cli/commands/status.d.ts 2.map +0 -1
  57. package/vendor/node_modules/@agent-recorder/cli/commands/status.js 2.map +0 -1
  58. package/vendor/node_modules/@agent-recorder/cli/commands/stop 2.js +0 -89
  59. package/vendor/node_modules/@agent-recorder/cli/commands/stop.d 2.ts +0 -8
  60. package/vendor/node_modules/@agent-recorder/cli/commands/stop.d.ts 2.map +0 -1
  61. package/vendor/node_modules/@agent-recorder/cli/commands/stop.js 2.map +0 -1
  62. package/vendor/node_modules/@agent-recorder/cli/commands/tui 2.js +0 -14
  63. package/vendor/node_modules/@agent-recorder/cli/commands/tui.d 2.ts +0 -5
  64. package/vendor/node_modules/@agent-recorder/cli/commands/tui.d.ts 2.map +0 -1
  65. package/vendor/node_modules/@agent-recorder/cli/commands/tui.js 2.map +0 -1
  66. package/vendor/node_modules/@agent-recorder/cli/config/claude-paths 2.js +0 -117
  67. package/vendor/node_modules/@agent-recorder/cli/config/claude-paths.d 2.ts +0 -55
  68. package/vendor/node_modules/@agent-recorder/cli/config/claude-paths.d.ts 2.map +0 -1
  69. package/vendor/node_modules/@agent-recorder/cli/config/claude-paths.js 2.map +0 -1
  70. package/vendor/node_modules/@agent-recorder/cli/config/claude-paths.test 2.js +0 -152
  71. package/vendor/node_modules/@agent-recorder/cli/config/claude-paths.test.d 2.ts +0 -5
  72. package/vendor/node_modules/@agent-recorder/cli/config/claude-paths.test.d.ts 2.map +0 -1
  73. package/vendor/node_modules/@agent-recorder/cli/config/claude-paths.test.js 2.map +0 -1
  74. package/vendor/node_modules/@agent-recorder/cli/index 2.js +0 -194
  75. package/vendor/node_modules/@agent-recorder/cli/index.d 2.ts +0 -10
  76. package/vendor/node_modules/@agent-recorder/cli/index.d.ts 2.map +0 -1
  77. package/vendor/node_modules/@agent-recorder/cli/index.js 2.map +0 -1
  78. package/vendor/node_modules/@agent-recorder/cli/package 2.json +0 -17
  79. package/vendor/node_modules/@agent-recorder/cli/tui/App 2.js +0 -84
  80. package/vendor/node_modules/@agent-recorder/cli/tui/App.d 2.ts +0 -6
  81. package/vendor/node_modules/@agent-recorder/cli/tui/App.d.ts 2.map +0 -1
  82. package/vendor/node_modules/@agent-recorder/cli/tui/App.js 2.map +0 -1
  83. package/vendor/node_modules/@agent-recorder/cli/tui/api 2.js +0 -105
  84. package/vendor/node_modules/@agent-recorder/cli/tui/api.d 2.ts +0 -31
  85. package/vendor/node_modules/@agent-recorder/cli/tui/api.d.ts 2.map +0 -1
  86. package/vendor/node_modules/@agent-recorder/cli/tui/api.js 2.map +0 -1
  87. package/vendor/node_modules/@agent-recorder/cli/tui/components/EventInspectPanel 2.js +0 -45
  88. package/vendor/node_modules/@agent-recorder/cli/tui/components/EventInspectPanel.d 2.ts +0 -11
  89. package/vendor/node_modules/@agent-recorder/cli/tui/components/EventInspectPanel.d.ts 2.map +0 -1
  90. package/vendor/node_modules/@agent-recorder/cli/tui/components/EventInspectPanel.js 2.map +0 -1
  91. package/vendor/node_modules/@agent-recorder/cli/tui/components/Header 2.js +0 -13
  92. package/vendor/node_modules/@agent-recorder/cli/tui/components/Header.d 2.ts +0 -17
  93. package/vendor/node_modules/@agent-recorder/cli/tui/components/Header.d.ts 2.map +0 -1
  94. package/vendor/node_modules/@agent-recorder/cli/tui/components/Header.js 2.map +0 -1
  95. package/vendor/node_modules/@agent-recorder/cli/tui/components/Spinner 2.js +0 -21
  96. package/vendor/node_modules/@agent-recorder/cli/tui/components/Spinner.d 2.ts +0 -12
  97. package/vendor/node_modules/@agent-recorder/cli/tui/components/Spinner.d.ts 2.map +0 -1
  98. package/vendor/node_modules/@agent-recorder/cli/tui/components/Spinner.js 2.map +0 -1
  99. package/vendor/node_modules/@agent-recorder/cli/tui/components/StatusBadge 2.js +0 -50
  100. package/vendor/node_modules/@agent-recorder/cli/tui/components/StatusBadge.d 2.ts +0 -16
  101. package/vendor/node_modules/@agent-recorder/cli/tui/components/StatusBadge.d.ts 2.map +0 -1
  102. package/vendor/node_modules/@agent-recorder/cli/tui/components/StatusBadge.js 2.map +0 -1
  103. package/vendor/node_modules/@agent-recorder/cli/tui/components/Table 2.js +0 -20
  104. package/vendor/node_modules/@agent-recorder/cli/tui/components/Table.d 2.ts +0 -21
  105. package/vendor/node_modules/@agent-recorder/cli/tui/components/Table.d.ts 2.map +0 -1
  106. package/vendor/node_modules/@agent-recorder/cli/tui/components/Table.js 2.map +0 -1
  107. package/vendor/node_modules/@agent-recorder/cli/tui/components/index 2.js +0 -8
  108. package/vendor/node_modules/@agent-recorder/cli/tui/components/index.d 2.ts +0 -8
  109. package/vendor/node_modules/@agent-recorder/cli/tui/components/index.d.ts 2.map +0 -1
  110. package/vendor/node_modules/@agent-recorder/cli/tui/components/index.js 2.map +0 -1
  111. package/vendor/node_modules/@agent-recorder/cli/tui/hooks/useEventStream 2.js +0 -75
  112. package/vendor/node_modules/@agent-recorder/cli/tui/hooks/useEventStream.d 2.ts +0 -22
  113. package/vendor/node_modules/@agent-recorder/cli/tui/hooks/useEventStream.d.ts 2.map +0 -1
  114. package/vendor/node_modules/@agent-recorder/cli/tui/hooks/useEventStream.js 2.map +0 -1
  115. package/vendor/node_modules/@agent-recorder/cli/tui/screens/SessionDetailScreen 2.js +0 -190
  116. package/vendor/node_modules/@agent-recorder/cli/tui/screens/SessionDetailScreen.d 2.ts +0 -13
  117. package/vendor/node_modules/@agent-recorder/cli/tui/screens/SessionDetailScreen.d.ts 2.map +0 -1
  118. package/vendor/node_modules/@agent-recorder/cli/tui/screens/SessionDetailScreen.js 2.map +0 -1
  119. package/vendor/node_modules/@agent-recorder/cli/tui/screens/SessionsScreen 2.js +0 -166
  120. package/vendor/node_modules/@agent-recorder/cli/tui/screens/SessionsScreen.d 2.ts +0 -10
  121. package/vendor/node_modules/@agent-recorder/cli/tui/screens/SessionsScreen.d.ts 2.map +0 -1
  122. package/vendor/node_modules/@agent-recorder/cli/tui/screens/SessionsScreen.js 2.map +0 -1
  123. package/vendor/node_modules/@agent-recorder/cli/tui/screens/index 2.js +0 -6
  124. package/vendor/node_modules/@agent-recorder/cli/tui/screens/index.d 2.ts +0 -6
  125. package/vendor/node_modules/@agent-recorder/cli/tui/screens/index.d.ts 2.map +0 -1
  126. package/vendor/node_modules/@agent-recorder/cli/tui/screens/index.js 2.map +0 -1
  127. package/vendor/node_modules/@agent-recorder/core/config 2.js +0 -44
  128. package/vendor/node_modules/@agent-recorder/core/config.d 2.ts +0 -25
  129. package/vendor/node_modules/@agent-recorder/core/config.d.ts 2.map +0 -1
  130. package/vendor/node_modules/@agent-recorder/core/db/connection.d 2.ts +0 -15
  131. package/vendor/node_modules/@agent-recorder/core/migrations/001_initial 2.sql +0 -40
  132. package/vendor/node_modules/@agent-recorder/core/migrations/002_session_sequences 2.sql +0 -8
  133. package/vendor/node_modules/@agent-recorder/core/migrations/003_add_tool_columns 2.sql +0 -9
  134. package/vendor/node_modules/@agent-recorder/core/migrations/004_add_cancelled_status 2.sql +0 -23
  135. package/vendor/node_modules/@agent-recorder/core/migrations/005_add_error_category 2.sql +0 -6
  136. package/vendor/node_modules/@agent-recorder/core/package 2.json +0 -18
  137. package/vendor/node_modules/@agent-recorder/core/types/events.d 2.ts +0 -69
  138. package/vendor/node_modules/@agent-recorder/core/types/index 2.js +0 -2
  139. package/vendor/node_modules/@agent-recorder/core/types/index.js 2.map +0 -1
  140. package/vendor/node_modules/@agent-recorder/core/types/session 2.js +0 -6
  141. package/vendor/node_modules/@agent-recorder/core/types/session.d 2.ts +0 -22
  142. package/vendor/node_modules/@agent-recorder/core/types/session.d.ts 2.map +0 -1
  143. package/vendor/node_modules/@agent-recorder/core/types/session.js 2.map +0 -1
  144. package/vendor/node_modules/@agent-recorder/core/utils/error-category 2.js +0 -58
  145. package/vendor/node_modules/@agent-recorder/core/utils/error-category.d 2.ts +0 -22
  146. package/vendor/node_modules/@agent-recorder/core/utils/error-category.d.ts 2.map +0 -1
  147. package/vendor/node_modules/@agent-recorder/core/utils/error-category.js 2.map +0 -1
  148. package/vendor/node_modules/@agent-recorder/core/utils/error-category.test.d 2.ts +0 -5
  149. package/vendor/node_modules/@agent-recorder/core/utils/error-category.test.d.ts 2.map +0 -1
  150. package/vendor/node_modules/@agent-recorder/core/utils/error-category.test.js 2.map +0 -1
  151. package/vendor/node_modules/@agent-recorder/core/utils/index 2.js +0 -6
  152. package/vendor/node_modules/@agent-recorder/core/utils/index.d 2.ts +0 -6
  153. package/vendor/node_modules/@agent-recorder/core/utils/index.d.ts 2.map +0 -1
  154. package/vendor/node_modules/@agent-recorder/core/utils/index.js 2.map +0 -1
  155. package/vendor/node_modules/@agent-recorder/core/utils/redact.d 2.ts +0 -19
  156. package/vendor/node_modules/@agent-recorder/core/utils/redact.d.ts 2.map +0 -1
  157. package/vendor/node_modules/@agent-recorder/core/utils/redact.js 2.map +0 -1
  158. package/vendor/node_modules/@agent-recorder/service/index 2.js +0 -128
  159. package/vendor/node_modules/@agent-recorder/service/index.d 2.ts +0 -36
  160. package/vendor/node_modules/@agent-recorder/service/index.d.ts 2.map +0 -1
  161. package/vendor/node_modules/@agent-recorder/service/index.js 2.map +0 -1
  162. package/vendor/node_modules/@agent-recorder/service/mcp/index 2.js +0 -7
  163. package/vendor/node_modules/@agent-recorder/service/mcp/index.d 2.ts +0 -7
  164. package/vendor/node_modules/@agent-recorder/service/mcp/index.d.ts 2.map +0 -1
  165. package/vendor/node_modules/@agent-recorder/service/mcp/index.js 2.map +0 -1
  166. package/vendor/node_modules/@agent-recorder/service/mcp/proxy 2.js +0 -223
  167. package/vendor/node_modules/@agent-recorder/service/mcp/proxy.d 2.ts +0 -26
  168. package/vendor/node_modules/@agent-recorder/service/mcp/proxy.d.ts 2.map +0 -1
  169. package/vendor/node_modules/@agent-recorder/service/mcp/proxy.js 2.map +0 -1
  170. package/vendor/node_modules/@agent-recorder/service/mcp/proxy.test.d 2.ts +0 -5
  171. package/vendor/node_modules/@agent-recorder/service/mcp/proxy.test.d.ts 2.map +0 -1
  172. package/vendor/node_modules/@agent-recorder/service/mcp/proxy.test.js 2.map +0 -1
  173. package/vendor/node_modules/@agent-recorder/service/mcp/recorder 2.js +0 -62
  174. package/vendor/node_modules/@agent-recorder/service/mcp/recorder.d 2.ts +0 -31
  175. package/vendor/node_modules/@agent-recorder/service/mcp/recorder.d.ts 2.map +0 -1
  176. package/vendor/node_modules/@agent-recorder/service/mcp/recorder.js 2.map +0 -1
  177. package/vendor/node_modules/@agent-recorder/service/mcp/types 2.js +0 -15
  178. package/vendor/node_modules/@agent-recorder/service/mcp/types.d 2.ts +0 -40
  179. package/vendor/node_modules/@agent-recorder/service/mcp/types.d.ts 2.map +0 -1
  180. package/vendor/node_modules/@agent-recorder/service/mcp/types.js 2.map +0 -1
  181. package/vendor/node_modules/@agent-recorder/service/package 2.json +0 -15
  182. package/vendor/node_modules/@agent-recorder/service/routes/events 2.js +0 -71
  183. package/vendor/node_modules/@agent-recorder/service/routes/events.d 2.ts +0 -11
  184. package/vendor/node_modules/@agent-recorder/service/routes/events.d.ts 2.map +0 -1
  185. package/vendor/node_modules/@agent-recorder/service/routes/events.js 2.map +0 -1
  186. package/vendor/node_modules/@agent-recorder/service/routes/health 2.js +0 -18
  187. package/vendor/node_modules/@agent-recorder/service/routes/health.d 2.ts +0 -6
  188. package/vendor/node_modules/@agent-recorder/service/routes/health.d.ts 2.map +0 -1
  189. package/vendor/node_modules/@agent-recorder/service/routes/health.js 2.map +0 -1
  190. package/vendor/node_modules/@agent-recorder/service/routes/sessions 2.js +0 -80
  191. package/vendor/node_modules/@agent-recorder/service/routes/sessions.d 2.ts +0 -12
  192. package/vendor/node_modules/@agent-recorder/service/routes/sessions.d.ts 2.map +0 -1
  193. package/vendor/node_modules/@agent-recorder/service/routes/sessions.js 2.map +0 -1
  194. package/vendor/node_modules/@agent-recorder/service/server 2.js +0 -36
  195. package/vendor/node_modules/@agent-recorder/service/server.d 2.ts +0 -19
  196. package/vendor/node_modules/@agent-recorder/service/server.d.ts 2.map +0 -1
  197. package/vendor/node_modules/@agent-recorder/service/server.js 2.map +0 -1
  198. package/vendor/node_modules/@agent-recorder/service/server.test 2.js +0 -296
  199. package/vendor/node_modules/@agent-recorder/service/server.test.d 2.ts +0 -5
  200. package/vendor/node_modules/@agent-recorder/service/server.test.d.ts 2.map +0 -1
  201. package/vendor/node_modules/@agent-recorder/service/session-manager 2.js +0 -22
  202. package/vendor/node_modules/@agent-recorder/service/session-manager.d 2.ts +0 -16
  203. package/vendor/node_modules/@agent-recorder/service/session-manager.d.ts 2.map +0 -1
  204. package/vendor/node_modules/@agent-recorder/service/session-manager.js 2.map +0 -1
  205. package/vendor/node_modules/@agent-recorder/service/session-manager.test 2.js +0 -61
  206. package/vendor/node_modules/@agent-recorder/service/session-manager.test.d 2.ts +0 -5
  207. package/vendor/node_modules/@agent-recorder/service/session-manager.test.d.ts 2.map +0 -1
  208. package/vendor/node_modules/@agent-recorder/service/session-manager.test.js 2.map +0 -1
@@ -1,166 +0,0 @@
1
- import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
- /**
3
- * Sessions list screen with table and navigation.
4
- */
5
- import React, { useState, useEffect, useCallback } from "react";
6
- import { Box, Text, useInput, useApp } from "ink";
7
- import TextInput from "ink-text-input";
8
- import { Header, Table, StatusBadge, Spinner, } from "../components/index.js";
9
- import { fetchSessions, fetchEventCount } from "../api.js";
10
- /**
11
- * Format time ago.
12
- */
13
- function formatTimeAgo(isoDate) {
14
- const then = new Date(isoDate).getTime();
15
- const now = Date.now();
16
- const seconds = Math.floor((now - then) / 1000);
17
- if (seconds < 60)
18
- return `${seconds}s ago`;
19
- if (seconds < 3600)
20
- return `${Math.floor(seconds / 60)}m ago`;
21
- if (seconds < 86400)
22
- return `${Math.floor(seconds / 3600)}h ago`;
23
- return `${Math.floor(seconds / 86400)}d ago`;
24
- }
25
- /**
26
- * Format duration.
27
- */
28
- function formatDuration(startedAt, endedAt) {
29
- const start = new Date(startedAt).getTime();
30
- const end = endedAt ? new Date(endedAt).getTime() : Date.now();
31
- const seconds = Math.floor((end - start) / 1000);
32
- if (seconds < 60)
33
- return `${seconds}s`;
34
- if (seconds < 3600) {
35
- const m = Math.floor(seconds / 60);
36
- const s = seconds % 60;
37
- return `${m}m ${s}s`;
38
- }
39
- const h = Math.floor(seconds / 3600);
40
- const m = Math.floor((seconds % 3600) / 60);
41
- return `${h}h ${m}m`;
42
- }
43
- export function SessionsScreen({ baseUrl, onSelectSession, }) {
44
- const { exit } = useApp();
45
- const [sessions, setSessions] = useState([]);
46
- const [loading, setLoading] = useState(true);
47
- const [error, setError] = useState(null);
48
- const [selectedIndex, setSelectedIndex] = useState(0);
49
- const [searchMode, setSearchMode] = useState(false);
50
- const [searchQuery, setSearchQuery] = useState("");
51
- const loadSessions = useCallback(async () => {
52
- setLoading(true);
53
- setError(null);
54
- try {
55
- const sessionsData = await fetchSessions(baseUrl);
56
- // Fetch event counts for each session
57
- const sessionsWithCounts = await Promise.all(sessionsData.map(async (session) => {
58
- const eventCount = await fetchEventCount(baseUrl, session.id);
59
- return { ...session, eventCount };
60
- }));
61
- setSessions(sessionsWithCounts);
62
- }
63
- catch (err) {
64
- setError(err instanceof Error ? err.message : "Failed to load sessions");
65
- }
66
- finally {
67
- setLoading(false);
68
- }
69
- }, [baseUrl]);
70
- // Initial load
71
- useEffect(() => {
72
- loadSessions();
73
- }, [loadSessions]);
74
- // Auto-refresh every 2 seconds
75
- useEffect(() => {
76
- const timer = setInterval(loadSessions, 2000);
77
- return () => clearInterval(timer);
78
- }, [loadSessions]);
79
- // Filter sessions by search query
80
- const filteredSessions = searchQuery
81
- ? sessions.filter((s) => s.id.toLowerCase().includes(searchQuery.toLowerCase()))
82
- : sessions;
83
- // Handle keyboard input
84
- useInput((input, key) => {
85
- if (searchMode) {
86
- if (key.escape) {
87
- setSearchMode(false);
88
- setSearchQuery("");
89
- }
90
- return;
91
- }
92
- if (input === "q") {
93
- exit();
94
- return;
95
- }
96
- if (input === "/" || input === "s") {
97
- setSearchMode(true);
98
- return;
99
- }
100
- if (input === "r") {
101
- loadSessions();
102
- return;
103
- }
104
- if (key.upArrow) {
105
- setSelectedIndex((prev) => Math.max(0, prev - 1));
106
- }
107
- else if (key.downArrow) {
108
- setSelectedIndex((prev) => Math.min(filteredSessions.length - 1, prev + 1));
109
- }
110
- else if (key.return) {
111
- const selectedSession = filteredSessions[selectedIndex];
112
- if (filteredSessions.length > 0 && selectedSession) {
113
- onSelectSession(selectedSession.id);
114
- }
115
- }
116
- });
117
- // Reset selection when filtered list changes
118
- useEffect(() => {
119
- if (selectedIndex >= filteredSessions.length) {
120
- setSelectedIndex(Math.max(0, filteredSessions.length - 1));
121
- }
122
- }, [filteredSessions.length, selectedIndex]);
123
- const columns = [
124
- {
125
- key: "id",
126
- header: "ID",
127
- width: 14,
128
- render: (row) => _jsxs(Text, { children: [row.id.slice(0, 12), "..."] }),
129
- },
130
- {
131
- key: "status",
132
- header: "Status",
133
- width: 10,
134
- render: (row) => (_jsxs(Text, { children: [_jsx(StatusBadge, { status: row.status }), " ", row.status] })),
135
- },
136
- {
137
- key: "events",
138
- header: "Events",
139
- width: 8,
140
- render: (row) => _jsx(Text, { children: row.eventCount }),
141
- },
142
- {
143
- key: "started",
144
- header: "Started",
145
- width: 12,
146
- render: (row) => _jsx(Text, { dimColor: true, children: formatTimeAgo(row.startedAt) }),
147
- },
148
- {
149
- key: "duration",
150
- header: "Duration",
151
- width: 10,
152
- render: (row) => (_jsx(Text, { dimColor: true, children: formatDuration(row.startedAt, row.endedAt) })),
153
- },
154
- ];
155
- if (error) {
156
- return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Header, { title: "Sessions", hints: [
157
- { key: "q", label: "quit" },
158
- { key: "r", label: "retry" },
159
- ] }), _jsx(Box, { marginTop: 1, children: _jsxs(Text, { color: "red", children: ["Error: ", error] }) }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "Press r to retry or q to quit." }) })] }));
160
- }
161
- return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Header, { title: "Sessions", hints: [
162
- { key: "q", label: "quit" },
163
- { key: "/", label: "search" },
164
- ] }), searchMode && (_jsxs(Box, { marginTop: 1, children: [_jsx(Text, { children: "Search: " }), _jsx(TextInput, { value: searchQuery, onChange: setSearchQuery, placeholder: "session id..." }), _jsx(Text, { dimColor: true, children: " (Esc to cancel)" })] })), _jsx(Box, { marginTop: 1, children: loading && sessions.length === 0 ? (_jsx(Spinner, { label: "Loading sessions..." })) : filteredSessions.length === 0 ? (_jsx(Text, { dimColor: true, children: searchQuery ? "No matching sessions" : "No sessions recorded" })) : (_jsx(Table, { columns: columns, data: filteredSessions, selectedIndex: selectedIndex, maxRows: 15 })) }), _jsx(Box, { marginTop: 1, children: _jsxs(Text, { dimColor: true, children: ["[\u2191/\u2193] navigate [Enter] view [r] refresh", loading && sessions.length > 0 && " (refreshing...)"] }) })] }));
165
- }
166
- //# sourceMappingURL=SessionsScreen.js.map
@@ -1,10 +0,0 @@
1
- /**
2
- * Sessions list screen with table and navigation.
3
- */
4
- import React from "react";
5
- export interface SessionsScreenProps {
6
- baseUrl: string;
7
- onSelectSession: (sessionId: string) => void;
8
- }
9
- export declare function SessionsScreen({ baseUrl, onSelectSession, }: SessionsScreenProps): React.ReactElement;
10
- //# sourceMappingURL=SessionsScreen.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SessionsScreen.d.ts","sourceRoot":"","sources":["../../../src/tui/screens/SessionsScreen.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAA2C,MAAM,OAAO,CAAC;AAahE,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9C;AAuCD,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,eAAe,GAChB,EAAE,mBAAmB,GAAG,KAAK,CAAC,YAAY,CA2M1C"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SessionsScreen.js","sourceRoot":"","sources":["../../../src/tui/screens/SessionsScreen.tsx"],"names":[],"mappings":";AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAClD,OAAO,SAAS,MAAM,gBAAgB,CAAC;AAEvC,OAAO,EACL,MAAM,EACN,KAAK,EACL,WAAW,EACX,OAAO,GAER,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAW3D;;GAEG;AACH,SAAS,aAAa,CAAC,OAAe;IACpC,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,CAAC;IACzC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACvB,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;IAEhD,IAAI,OAAO,GAAG,EAAE;QAAE,OAAO,GAAG,OAAO,OAAO,C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GAAG,CAAC,IAAI,kBAAkB,IAChD,GACH,IACF,CACP,CAAC;AACJ,CAAC"}
@@ -1,6 +0,0 @@
1
- /**
2
- * TUI screens barrel export.
3
- */
4
- export { SessionsScreen } from "./SessionsScreen.js";
5
- export { SessionDetailScreen, } from "./SessionDetailScreen.js";
6
- //# sourceMappingURL=index.js.map
@@ -1,6 +0,0 @@
1
- /**
2
- * TUI screens barrel export.
3
- */
4
- export { SessionsScreen, type SessionsScreenProps } from "./SessionsScreen.js";
5
- export { SessionDetailScreen, type SessionDetailScreenProps, } from "./SessionDetailScreen.js";
6
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tui/screens/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE/E,OAAO,EACL,mBAAmB,EACnB,KAAK,wBAAwB,GAC9B,MAAM,0BAA0B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tui/screens/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAA4B,MAAM,qBAAqB,CAAC;AAE/E,OAAO,EACL,mBAAmB,GAEpB,MAAM,0BAA0B,CAAC"}
@@ -1,44 +0,0 @@
1
- /**
2
- * Configuration management.
3
- * Reads from environment variables with sensible defaults.
4
- */
5
- import { homedir } from "node:os";
6
- import { join } from "node:path";
7
- /** Get the default database path in user's home directory */
8
- export function getDefaultDbPath() {
9
- return join(homedir(), ".agent-recorder", "agent-recorder.sqlite");
10
- }
11
- const DEFAULT_REDACT_KEYS = [
12
- "authorization",
13
- "Authorization",
14
- "api_key",
15
- "apikey",
16
- "token",
17
- "access_token",
18
- "refresh_token",
19
- "secret",
20
- "password",
21
- ];
22
- /**
23
- * Load configuration from environment variables.
24
- */
25
- export function loadConfig() {
26
- const listenPort = parseInt(process.env["AR_LISTEN_PORT"] ?? "8787", 10);
27
- const dbPath = process.env["AR_DB_PATH"] ?? getDefaultDbPath();
28
- const redactKeysRaw = process.env["AR_REDACT_KEYS"];
29
- const redactKeys = redactKeysRaw
30
- ? redactKeysRaw.split(",").map((k) => k.trim())
31
- : DEFAULT_REDACT_KEYS;
32
- const mcpProxyPort = parseInt(process.env["AR_MCP_PROXY_PORT"] ?? "8788", 10);
33
- const downstreamMcpUrl = process.env["AR_DOWNSTREAM_MCP_URL"] ?? null;
34
- const debugProxy = process.env["AR_DEBUG_PROXY"] === "1";
35
- return {
36
- listenPort,
37
- dbPath,
38
- redactKeys,
39
- mcpProxyPort,
40
- downstreamMcpUrl,
41
- debugProxy,
42
- };
43
- }
44
- //# sourceMappingURL=config.js.map
@@ -1,25 +0,0 @@
1
- /**
2
- * Configuration management.
3
- * Reads from environment variables with sensible defaults.
4
- */
5
- /** Get the default database path in user's home directory */
6
- export declare function getDefaultDbPath(): string;
7
- export interface Config {
8
- /** Port for the daemon to listen on (default: 8787) */
9
- listenPort: number;
10
- /** Path to SQLite database file (default: ~/.agent-recorder/agent-recorder.sqlite) */
11
- dbPath: string;
12
- /** Keys to redact from JSON payloads */
13
- redactKeys: string[];
14
- /** Port for MCP proxy to listen on (default: 8788) */
15
- mcpProxyPort: number;
16
- /** URL of downstream MCP server to forward requests to (optional) */
17
- downstreamMcpUrl: string | null;
18
- /** Enable debug logging for MCP proxy (tools/call only) */
19
- debugProxy: boolean;
20
- }
21
- /**
22
- * Load configuration from environment variables.
23
- */
24
- export declare function loadConfig(): Config;
25
- //# sourceMappingURL=config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,6DAA6D;AAC7D,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED,MAAM,WAAW,MAAM;IACrB,uDAAuD;IACvD,UAAU,EAAE,MAAM,CAAC;IAEnB,sFAAsF;IACtF,MAAM,EAAE,MAAM,CAAC;IAEf,wCAAwC;IACxC,UAAU,EAAE,MAAM,EAAE,CAAC;IAErB,sDAAsD;IACtD,YAAY,EAAE,MAAM,CAAC;IAErB,qEAAqE;IACrE,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAEhC,2DAA2D;IAC3D,UAAU,EAAE,OAAO,CAAC;CACrB;AAcD;;GAEG;AACH,wBAAgB,UAAU,IAAI,MAAM,CAmBnC"}
@@ -1,15 +0,0 @@
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
@@ -1,40 +0,0 @@
1
- -- Agent Recorder: Initial Schema
2
- -- Migration: 001_initial
3
- --
4
- -- Creates sessions and events tables with denormalized fields
5
- -- for efficient querying and hierarchical timeline rendering.
6
-
7
- -- Sessions table
8
- CREATE TABLE IF NOT EXISTS sessions (
9
- id TEXT PRIMARY KEY,
10
- started_at TEXT NOT NULL,
11
- ended_at TEXT,
12
- status TEXT NOT NULL CHECK (status IN ('active', 'completed', 'error')),
13
- created_at TEXT NOT NULL DEFAULT (datetime('now'))
14
- );
15
-
16
- -- Events table with denormalized fields
17
- CREATE TABLE IF NOT EXISTS events (
18
- id TEXT PRIMARY KEY,
19
- session_id TEXT NOT NULL,
20
- parent_event_id TEXT,
21
- sequence INTEGER NOT NULL,
22
- event_type TEXT NOT NULL CHECK (event_type IN ('agent_call', 'subagent_call', 'skill_call', 'tool_call')),
23
- agent_role TEXT NOT NULL,
24
- agent_name TEXT NOT NULL,
25
- skill_name TEXT,
26
- started_at TEXT NOT NULL,
27
- ended_at TEXT,
28
- status TEXT NOT NULL CHECK (status IN ('running', 'success', 'error', 'timeout', 'cancelled')),
29
- input_json TEXT,
30
- output_json TEXT,
31
- created_at TEXT NOT NULL DEFAULT (datetime('now')),
32
- FOREIGN KEY (session_id) REFERENCES sessions(id) ON DELETE CASCADE,
33
- FOREIGN KEY (parent_event_id) REFERENCES events(id) ON DELETE SET NULL
34
- );
35
-
36
- -- Indexes for common query patterns
37
- CREATE INDEX IF NOT EXISTS idx_events_session_id ON events(session_id);
38
- CREATE INDEX IF NOT EXISTS idx_events_parent_event_id ON events(parent_event_id);
39
- CREATE INDEX IF NOT EXISTS idx_events_event_type ON events(event_type);
40
- CREATE UNIQUE INDEX IF NOT EXISTS idx_events_session_sequence ON events(session_id, sequence);
@@ -1,8 +0,0 @@
1
- -- Session sequences table for atomic sequence number generation
2
- -- Each session has its own sequence counter
3
-
4
- CREATE TABLE IF NOT EXISTS session_sequences (
5
- session_id TEXT PRIMARY KEY,
6
- next_sequence INTEGER NOT NULL DEFAULT 1,
7
- FOREIGN KEY (session_id) REFERENCES sessions(id) ON DELETE CASCADE
8
- );
@@ -1,9 +0,0 @@
1
- -- Add tool_name and mcp_method columns for proper tool call metadata
2
- -- SQLite allows ADD COLUMN without rebuilding table
3
-
4
- ALTER TABLE events ADD COLUMN tool_name TEXT;
5
- ALTER TABLE events ADD COLUMN mcp_method TEXT;
6
-
7
- -- Indexes for efficient filtering by tool name and MCP method
8
- CREATE INDEX IF NOT EXISTS idx_events_tool_name ON events(tool_name);
9
- CREATE INDEX IF NOT EXISTS idx_events_mcp_method ON events(mcp_method);
@@ -1,23 +0,0 @@
1
- -- Agent Recorder: Add 'cancelled' status to sessions
2
- -- Migration: 004_add_cancelled_status
3
- --
4
- -- Adds 'cancelled' to the sessions status CHECK constraint.
5
- -- SQLite doesn't support ALTER CHECK, so we recreate the table.
6
-
7
- -- Create new sessions table with updated constraint
8
- CREATE TABLE sessions_new (
9
- id TEXT PRIMARY KEY,
10
- started_at TEXT NOT NULL,
11
- ended_at TEXT,
12
- status TEXT NOT NULL CHECK (status IN ('active', 'completed', 'error', 'cancelled')),
13
- created_at TEXT NOT NULL DEFAULT (datetime('now'))
14
- );
15
-
16
- -- Copy existing data
17
- INSERT INTO sessions_new SELECT * FROM sessions;
18
-
19
- -- Drop old table
20
- DROP TABLE sessions;
21
-
22
- -- Rename new table
23
- ALTER TABLE sessions_new RENAME TO sessions;
@@ -1,6 +0,0 @@
1
- -- Add error_category column for stable error classification
2
- -- Categories: downstream_timeout, downstream_unreachable, jsonrpc_invalid, jsonrpc_error, unknown
3
- ALTER TABLE events ADD COLUMN error_category TEXT;
4
-
5
- -- Index for filtering by error category
6
- CREATE INDEX IF NOT EXISTS idx_events_error_category ON events(error_category);
@@ -1,18 +0,0 @@
1
- {
2
- "name": "@agent-recorder/core",
3
- "version": "0.0.1",
4
- "type": "module",
5
- "exports": {
6
- ".": {
7
- "types": "./index.d.ts",
8
- "import": "./index.js"
9
- },
10
- "./types": {
11
- "types": "./types/index.d.ts",
12
- "import": "./types/index.js"
13
- }
14
- },
15
- "dependencies": {
16
- "better-sqlite3": "^11.7.0"
17
- }
18
- }
@@ -1,69 +0,0 @@
1
- /**
2
- * Event types for Agent Recorder.
3
- * Records observable execution boundaries only — no prompts, no reasoning.
4
- */
5
- /** Supported event types in the execution hierarchy */
6
- export type EventType = "agent_call" | "subagent_call" | "skill_call" | "tool_call";
7
- /** Status of an event */
8
- export type EventStatus = "running" | "success" | "error" | "timeout" | "cancelled";
9
- /** Error category for failed events (stable enum-like values) */
10
- export type ErrorCategory = "downstream_timeout" | "downstream_unreachable" | "jsonrpc_invalid" | "jsonrpc_error" | "unknown";
11
- /**
12
- * Base event shared by all event types.
13
- * Matches the SQLite schema with denormalized fields for efficient querying.
14
- */
15
- export interface BaseEvent {
16
- /** Unique event ID (UUID) */
17
- id: string;
18
- /** Session this event belongs to */
19
- sessionId: string;
20
- /** Parent event ID (null for root agent_call) */
21
- parentEventId: string | null;
22
- /** Per-session ordering sequence number */
23
- sequence: number;
24
- /** Type of this event */
25
- eventType: EventType;
26
- /** Role of the agent (e.g., "assistant", "user") */
27
- agentRole: string;
28
- /** Name of the agent or subagent */
29
- agentName: string;
30
- /** Name of the skill (null if not a skill_call or tool within a skill) */
31
- skillName: string | null;
32
- /** Name of the tool (for tool_call events) */
33
- toolName: string | null;
34
- /** MCP method name (e.g., "tools/call") */
35
- mcpMethod: string | null;
36
- /** When this event started (ISO 8601) */
37
- startedAt: string;
38
- /** When this event ended (ISO 8601, null if still running) */
39
- endedAt: string | null;
40
- /** Current status of this event */
41
- status: EventStatus;
42
- /** Redacted+truncated input JSON blob */
43
- inputJson: string | null;
44
- /** Redacted+truncated output JSON blob */
45
- outputJson: string | null;
46
- /** Error category for failed events (null if success/running) */
47
- errorCategory: ErrorCategory | null;
48
- /** When this record was created (ISO 8601) */
49
- createdAt: string;
50
- }
51
- /** Agent call event (root of an execution tree) */
52
- export interface AgentCallEvent extends BaseEvent {
53
- eventType: "agent_call";
54
- }
55
- /** Subagent call event (child of agent_call or another subagent_call) */
56
- export interface SubagentCallEvent extends BaseEvent {
57
- eventType: "subagent_call";
58
- }
59
- /** Skill call event (groups related tool calls) */
60
- export interface SkillCallEvent extends BaseEvent {
61
- eventType: "skill_call";
62
- }
63
- /** Tool call event (leaf node in the hierarchy) */
64
- export interface ToolCallEvent extends BaseEvent {
65
- eventType: "tool_call";
66
- }
67
- /** Union type for all event types */
68
- export type RecordedEvent = AgentCallEvent | SubagentCallEvent | SkillCallEvent | ToolCallEvent;
69
- //# sourceMappingURL=events.d.ts.map
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":""}
@@ -1,6 +0,0 @@
1
- /**
2
- * Session types for Agent Recorder.
3
- * A session represents a single Claude Code execution run.
4
- */
5
- export {};
6
- //# sourceMappingURL=session.js.map
@@ -1,22 +0,0 @@
1
- /**
2
- * Session types for Agent Recorder.
3
- * A session represents a single Claude Code execution run.
4
- */
5
- /** Status of a recording session */
6
- export type SessionStatus = "active" | "completed" | "error" | "cancelled";
7
- /**
8
- * A recording session containing a tree of events.
9
- */
10
- export interface Session {
11
- /** Unique session ID (UUID) */
12
- id: string;
13
- /** When the session started (ISO 8601) */
14
- startedAt: string;
15
- /** When the session ended (ISO 8601, null if still active) */
16
- endedAt: string | null;
17
- /** Current status of this session */
18
- status: SessionStatus;
19
- /** When this record was created (ISO 8601) */
20
- createdAt: string;
21
- }
22
- //# sourceMappingURL=session.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/types/session.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,oCAAoC;AACpC,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,WAAW,GAAG,OAAO,GAAG,WAAW,CAAC;AAE3E;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,+BAA+B;IAC/B,EAAE,EAAE,MAAM,CAAC;IAEX,0CAA0C;IAC1C,SAAS,EAAE,MAAM,CAAC;IAElB,8DAA8D;IAC9D,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAEvB,qCAAqC;IACrC,MAAM,EAAE,aAAa,CAAC;IAEtB,8CAA8C;IAC9C,SAAS,EAAE,MAAM,CAAC;CACnB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/types/session.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -1,58 +0,0 @@
1
- /**
2
- * Error category derivation.
3
- * Determines error_category from status and outputJson WITHOUT logging content.
4
- * Categories are stable enum-like strings - no raw error messages.
5
- */
6
- /**
7
- * Derive error category from event status and output.
8
- * CRITICAL: This function must NOT log or expose output content.
9
- *
10
- * Decision tree (EXACT):
11
- * 1. If status === "success" | "running" | "cancelled" → null
12
- * 2. If status === "timeout" → "downstream_timeout"
13
- * 3. If JSON-RPC error AND code === -32000 AND message contains "connect"
14
- * → "downstream_unreachable"
15
- * 4. If JSON-RPC error AND (code === -32700 OR code === -32600)
16
- * → "jsonrpc_invalid"
17
- * 5. If downstream returned JSON-RPC error object → "jsonrpc_error"
18
- * 6. Otherwise → "unknown"
19
- */
20
- export function deriveErrorCategory(status, outputJson) {
21
- // Not an error status - no category needed
22
- if (status === "success" || status === "running" || status === "cancelled") {
23
- return null;
24
- }
25
- // Timeout status always maps to downstream_timeout
26
- if (status === "timeout") {
27
- return "downstream_timeout";
28
- }
29
- // status === "error" - parse outputJson to determine category
30
- if (!outputJson) {
31
- return "unknown";
32
- }
33
- try {
34
- const output = JSON.parse(outputJson);
35
- // Check for JSON-RPC error structure: { code: number, message?: string }
36
- if (output && typeof output === "object" && "code" in output) {
37
- const code = output.code;
38
- const message = typeof output.message === "string" ? output.message.toLowerCase() : "";
39
- // -32000 with "connect" -> downstream_unreachable
40
- if (code === -32000 && message.includes("connect")) {
41
- return "downstream_unreachable";
42
- }
43
- // -32700 (Parse error) or -32600 (Invalid Request) -> jsonrpc_invalid
44
- if (code === -32700 || code === -32600) {
45
- return "jsonrpc_invalid";
46
- }
47
- // Any other JSON-RPC error object -> jsonrpc_error
48
- return "jsonrpc_error";
49
- }
50
- // Has some structure but not a JSON-RPC error
51
- return "unknown";
52
- }
53
- catch {
54
- // JSON parse failed
55
- return "unknown";
56
- }
57
- }
58
- //# sourceMappingURL=error-category.js.map
@@ -1,22 +0,0 @@
1
- /**
2
- * Error category derivation.
3
- * Determines error_category from status and outputJson WITHOUT logging content.
4
- * Categories are stable enum-like strings - no raw error messages.
5
- */
6
- import type { ErrorCategory, EventStatus } from "../types/index.js";
7
- /**
8
- * Derive error category from event status and output.
9
- * CRITICAL: This function must NOT log or expose output content.
10
- *
11
- * Decision tree (EXACT):
12
- * 1. If status === "success" | "running" | "cancelled" → null
13
- * 2. If status === "timeout" → "downstream_timeout"
14
- * 3. If JSON-RPC error AND code === -32000 AND message contains "connect"
15
- * → "downstream_unreachable"
16
- * 4. If JSON-RPC error AND (code === -32700 OR code === -32600)
17
- * → "jsonrpc_invalid"
18
- * 5. If downstream returned JSON-RPC error object → "jsonrpc_error"
19
- * 6. Otherwise → "unknown"
20
- */
21
- export declare function deriveErrorCategory(status: EventStatus, outputJson: string | null): ErrorCategory | null;
22
- //# sourceMappingURL=error-category.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"error-category.d.ts","sourceRoot":"","sources":["../../src/utils/error-category.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEpE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,WAAW,EACnB,UAAU,EAAE,MAAM,GAAG,IAAI,GACxB,aAAa,GAAG,IAAI,CA6CtB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"error-category.js","sourceRoot":"","sources":["../../src/utils/error-category.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,mBAAmB,CACjC,MAAmB,EACnB,UAAyB;IAEzB,2CAA2C;IAC3C,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,WAAW,EAAE,CAAC;QAC3E,OAAO,IAAI,CAAC;IACd,CAAC;IAED,mDAAmD;IACnD,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,oBAAoB,CAAC;IAC9B,CAAC;IAED,8DAA8D;IAC9D,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAEtC,yEAAyE;QACzE,IAAI,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,IAAI,MAAM,EAAE,CAAC;YAC7D,MAAM,IAAI,GAAG,MAAM,CAAC,IAAc,CAAC;YACnC,MAAM,OAAO,GACX,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAEzE,kDAAkD;YAClD,IAAI,IAAI,KAAK,CAAC,KAAK,IAAI,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;gBACnD,OAAO,wBAAwB,CAAC;YAClC,CAAC;YAED,sEAAsE;YACtE,IAAI,IAAI,KAAK,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;gBACvC,OAAO,iBAAiB,CAAC;YAC3B,CAAC;YAED,mDAAmD;YACnD,OAAO,eAAe,CAAC;QACzB,CAAC;QAED,8CAA8C;QAC9C,OAAO,SAAS,CAAC;IACnB,CAAC;IAAC,MAAM,CAAC;QACP,oBAAoB;QACpB,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
@@ -1,5 +0,0 @@
1
- /**
2
- * Tests for error category derivation.
3
- */
4
- export {};
5
- //# sourceMappingURL=error-category.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"error-category.test.d.ts","sourceRoot":"","sources":["../../src/utils/error-category.test.ts"],"names":[],"mappings":"AAAA;;GAEG"}