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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-recorder",
3
- "version": "0.0.1",
3
+ "version": "0.0.8",
4
4
  "description": "Local-first flight recorder for Claude Code",
5
5
  "type": "module",
6
6
  "bin": {
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "repository": {
37
37
  "type": "git",
38
- "url": "https://github.com/yourusername/agent-recorder"
38
+ "url": "git+https://github.com/EdytaKucharska/agent_recorder.git"
39
39
  },
40
40
  "keywords": [
41
41
  "claude",
@@ -10,8 +10,8 @@ import type Database from "better-sqlite3";
10
10
  export declare function runMigrations(db: Database.Database, migrationsDir: string): void;
11
11
  /**
12
12
  * Gets the default migrations directory path.
13
- * Assumes this file is at packages/core/src/db/migrations.ts (or dist/db/migrations.js)
14
- * and migrations are at packages/core/migrations/
13
+ * In vendored build: db/migrations.js ../migrations
14
+ * In dev build: dist/db/migrations.js → ../../migrations
15
15
  */
16
16
  export declare function getDefaultMigrationsDir(): string;
17
17
  //# sourceMappingURL=migrations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"migrations.d.ts","sourceRoot":"","sources":["../../src/db/migrations.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAK3C;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,aAAa,EAAE,MAAM,GACpB,IAAI,CAsCN;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,CAOhD"}
1
+ {"version":3,"file":"migrations.d.ts","sourceRoot":"","sources":["../../src/db/migrations.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAK3C;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,aAAa,EAAE,MAAM,GACpB,IAAI,CAsCN;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,CAgBhD"}
@@ -42,15 +42,23 @@ export function runMigrations(db, migrationsDir) {
42
42
  }
43
43
  /**
44
44
  * Gets the default migrations directory path.
45
- * Assumes this file is at packages/core/src/db/migrations.ts (or dist/db/migrations.js)
46
- * and migrations are at packages/core/migrations/
45
+ * In vendored build: db/migrations.js ../migrations
46
+ * In dev build: dist/db/migrations.js → ../../migrations
47
47
  */
48
48
  export function getDefaultMigrationsDir() {
49
- // ESM-compatible __dirname equivalent
50
49
  const __filename = fileURLToPath(import.meta.url);
51
50
  const __dirname = dirname(__filename);
52
- // When running from dist, we need to go up to packages/core
53
- // This works for both src and dist locations
54
- return join(__dirname, "..", "..", "migrations");
51
+ // Try vendored path first (one level up from db/)
52
+ const vendorPath = join(__dirname, "..", "migrations");
53
+ // Fall back to dev path (two levels up from dist/db/)
54
+ const devPath = join(__dirname, "..", "..", "migrations");
55
+ // Check which path exists
56
+ try {
57
+ readdirSync(vendorPath);
58
+ return vendorPath;
59
+ }
60
+ catch {
61
+ return devPath;
62
+ }
55
63
  }
56
64
  //# sourceMappingURL=migrations.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"migrations.js","sourceRoot":"","sources":["../../src/db/migrations.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC;;;GAGG;AACH,MAAM,UAAU,aAAa,CAC3B,EAAqB,EACrB,aAAqB;IAErB,oDAAoD;IACpD,EAAE,CAAC,IAAI,CAAC;;;;;GAKP,CAAC,CAAC;IAEH,iCAAiC;IACjC,MAAM,OAAO,GAAG,IAAI,GAAG,CACrB,EAAE;SACC,OAAO,CAAC,kCAAkC,CAAC;SAC3C,GAAG,EAAE;SACL,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAE,GAA4B,CAAC,QAAQ,CAAC,CACxD,CAAC;IAEF,sCAAsC;IACtC,MAAM,KAAK,GAAG,WAAW,CAAC,aAAa,CAAC;SACrC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,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AAI,EAAE,YAAY,CAAC,CAAC;IACvD,sDAAsD;IACtD,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;IAE1D,0BAA0B;IAC1B,IAAI,CAAC;QACH,WAAW,CAAC,UAAU,CAAC,CAAC;QACxB,OAAO,UAAU,CAAC;IACpB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,OAAO,CAAC;IACjB,CAAC;AACH,CAAC"}
@@ -1,205 +0,0 @@
1
- /**
2
- * Session analytics - pure functions for computing session metrics.
3
- * These functions work on BaseEvent[] arrays fetched from the API.
4
- * No side effects, no I/O - just computation.
5
- */
6
- /**
7
- * Compute session summary from events.
8
- */
9
- export function computeSessionSummary(events, slowestCount = 10) {
10
- const byStatus = {};
11
- const byEventType = {};
12
- const byToolName = {};
13
- const byErrorCategory = {};
14
- let successCount = 0;
15
- let errorCount = 0;
16
- let timeoutCount = 0;
17
- let totalDurationMs = 0;
18
- let durationCount = 0;
19
- // Collect durations for slowest calls
20
- const durations = [];
21
- for (const event of events) {
22
- // Count by status
23
- byStatus[event.status] = (byStatus[event.status] ?? 0) + 1;
24
- // Count by event type
25
- byEventType[event.eventType] = (byEventType[event.eventType] ?? 0) + 1;
26
- // Count by tool name
27
- if (event.toolName) {
28
- byToolName[event.toolName] = (byToolName[event.toolName] ?? 0) + 1;
29
- }
30
- // Count by error category
31
- if (event.errorCategory) {
32
- byErrorCategory[event.errorCategory] =
33
- (byErrorCategory[event.errorCategory] ?? 0) + 1;
34
- }
35
- // Count success/error/timeout
36
- if (event.status === "success") {
37
- successCount++;
38
- }
39
- else if (event.status === "error") {
40
- errorCount++;
41
- }
42
- else if (event.status === "timeout") {
43
- timeoutCount++;
44
- }
45
- // Compute duration if both timestamps present
46
- if (event.startedAt && event.endedAt) {
47
- const duration = new Date(event.endedAt).getTime() - new Date(event.startedAt).getTime();
48
- totalDurationMs += duration;
49
- durationCount++;
50
- durations.push({
51
- sequence: event.sequence,
52
- toolName: event.toolName,
53
- durationMs: duration,
54
- });
55
- }
56
- }
57
- // Top tools by count
58
- const topTools = Object.entries(byToolName)
59
- .sort(([, a], [, b]) => b - a)
60
- .slice(0, 5)
61
- .map(([name, count]) => ({ name, count }));
62
- // Top errors by count
63
- const topErrors = Object.entries(byErrorCategory)
64
- .sort(([, a], [, b]) => b - a)
65
- .slice(0, 5)
66
- .map(([category, count]) => ({
67
- category: category,
68
- count,
69
- }));
70
- // Slowest calls
71
- const slowestCalls = durations
72
- .sort((a, b) => b.durationMs - a.durationMs)
73
- .slice(0, slowestCount);
74
- return {
75
- totalEvents: events.length,
76
- byStatus,
77
- byEventType,
78
- byToolName,
79
- byErrorCategory,
80
- successCount,
81
- errorCount,
82
- timeoutCount,
83
- errorRate: events.length > 0 ? (errorCount + timeoutCount) / events.length : 0,
84
- avgDurationMs: durationCount > 0 ? Math.round(totalDurationMs / durationCount) : null,
85
- totalDurationMs,
86
- topTools,
87
- topErrors,
88
- slowestCalls,
89
- };
90
- }
91
- /**
92
- * Format summary as human-readable text.
93
- */
94
- export function formatSummaryText(summary) {
95
- const lines = [];
96
- lines.push("Session Summary");
97
- lines.push("=".repeat(50));
98
- lines.push(`Total Events: ${summary.totalEvents}`);
99
- lines.push(`Error Rate: ${(summary.errorRate * 100).toFixed(1)}% (${summary.errorCount} errors, ${summary.timeoutCount} timeouts)`);
100
- lines.push(`Avg Duration: ${summary.avgDurationMs !== null ? `${summary.avgDurationMs}ms` : "N/A"}`);
101
- lines.push(`Total Duration: ${summary.totalDurationMs}ms`);
102
- lines.push("");
103
- // By status
104
- lines.push("By Status:");
105
- for (const [status, count] of Object.entries(summary.byStatus)) {
106
- lines.push(` ${status}: ${count}`);
107
- }
108
- lines.push("");
109
- // Top tools
110
- if (summary.topTools.length > 0) {
111
- lines.push("Top Tools:");
112
- for (const { name, count } of summary.topTools) {
113
- lines.push(` ${name}: ${count}`);
114
- }
115
- lines.push("");
116
- }
117
- // Error categories
118
- if (summary.topErrors.length > 0) {
119
- lines.push("Error Categories:");
120
- for (const { category, count } of summary.topErrors) {
121
- lines.push(` ${category}: ${count}`);
122
- }
123
- lines.push("");
124
- }
125
- // Slowest calls
126
- if (summary.slowestCalls.length > 0) {
127
- lines.push("Slowest Calls:");
128
- for (const { sequence, toolName, durationMs } of summary.slowestCalls.slice(0, 5)) {
129
- lines.push(` [${sequence}] ${toolName ?? "-"}: ${durationMs}ms`);
130
- }
131
- }
132
- return lines.join("\n");
133
- }
134
- /**
135
- * Format a concise one-line safe summary (no content).
136
- */
137
- export function formatConciseSummary(events, summary) {
138
- const parts = [];
139
- // Total events with top tools
140
- const toolBreakdown = summary.topTools
141
- .slice(0, 3)
142
- .map((t) => `${t.name}(${t.count})`)
143
- .join(", ");
144
- parts.push(`${summary.totalEvents} tool calls across ${toolBreakdown}${summary.topTools.length > 3 ? "..." : ""}`);
145
- // Errors
146
- if (summary.errorCount > 0 || summary.timeoutCount > 0) {
147
- const errorDetails = summary.topErrors
148
- .map((e) => `${e.category}`)
149
- .join(", ");
150
- parts.push(`${summary.errorCount + summary.timeoutCount} error(s): ${errorDetails || "unknown"}`);
151
- }
152
- // Slowest call
153
- if (summary.slowestCalls.length > 0) {
154
- const slowest = summary.slowestCalls[0];
155
- parts.push(`Slowest: ${slowest.toolName ?? "unknown"} (${slowest.durationMs}ms)`);
156
- }
157
- // Total wall time
158
- if (summary.totalDurationMs > 0) {
159
- const wallTime = (summary.totalDurationMs / 1000).toFixed(1);
160
- parts.push(`Total time: ${wallTime}s`);
161
- }
162
- return parts.join("\n");
163
- }
164
- /**
165
- * Format stats output for CLI.
166
- */
167
- export function formatStatsText(summary) {
168
- const lines = [];
169
- lines.push("Session Statistics");
170
- lines.push("=".repeat(50));
171
- lines.push("");
172
- // Counts by tool
173
- lines.push("Tool Call Counts (sorted by frequency):");
174
- const sortedTools = Object.entries(summary.byToolName).sort(([, a], [, b]) => b - a);
175
- for (const [name, count] of sortedTools) {
176
- lines.push(` ${name.padEnd(30)} ${count}`);
177
- }
178
- lines.push("");
179
- // Slowest calls
180
- if (summary.slowestCalls.length > 0) {
181
- lines.push("Slowest Calls (top 10):");
182
- for (const { sequence, toolName, durationMs } of summary.slowestCalls) {
183
- lines.push(` [${String(sequence).padStart(4)}] ${(toolName ?? "-").padEnd(30)} ${durationMs}ms`);
184
- }
185
- lines.push("");
186
- }
187
- // Error counts by tool
188
- if (summary.topErrors.length > 0) {
189
- lines.push("Error Categories:");
190
- for (const { category, count } of summary.topErrors) {
191
- lines.push(` ${category.padEnd(30)} ${count}`);
192
- }
193
- lines.push("");
194
- }
195
- // Summary stats
196
- lines.push("Summary:");
197
- lines.push(` Total Events: ${summary.totalEvents}`);
198
- lines.push(` Success: ${summary.successCount}`);
199
- lines.push(` Errors: ${summary.errorCount}`);
200
- lines.push(` Timeouts: ${summary.timeoutCount}`);
201
- lines.push(` Avg Duration: ${summary.avgDurationMs !== null ? `${summary.avgDurationMs}ms` : "N/A"}`);
202
- lines.push(` Total Duration: ${summary.totalDurationMs}ms`);
203
- return lines.join("\n");
204
- }
205
- //# sourceMappingURL=session-analytics.js.map
@@ -1,50 +0,0 @@
1
- /**
2
- * Session analytics - pure functions for computing session metrics.
3
- * These functions work on BaseEvent[] arrays fetched from the API.
4
- * No side effects, no I/O - just computation.
5
- */
6
- import type { BaseEvent, ErrorCategory } from "@agent-recorder/core";
7
- /** Session summary computed from events */
8
- export interface SessionSummary {
9
- totalEvents: number;
10
- byStatus: Record<string, number>;
11
- byEventType: Record<string, number>;
12
- byToolName: Record<string, number>;
13
- byErrorCategory: Record<string, number>;
14
- successCount: number;
15
- errorCount: number;
16
- timeoutCount: number;
17
- errorRate: number;
18
- avgDurationMs: number | null;
19
- totalDurationMs: number;
20
- topTools: Array<{
21
- name: string;
22
- count: number;
23
- }>;
24
- topErrors: Array<{
25
- category: ErrorCategory;
26
- count: number;
27
- }>;
28
- slowestCalls: Array<{
29
- sequence: number;
30
- toolName: string | null;
31
- durationMs: number;
32
- }>;
33
- }
34
- /**
35
- * Compute session summary from events.
36
- */
37
- export declare function computeSessionSummary(events: BaseEvent[], slowestCount?: number): SessionSummary;
38
- /**
39
- * Format summary as human-readable text.
40
- */
41
- export declare function formatSummaryText(summary: SessionSummary): string;
42
- /**
43
- * Format a concise one-line safe summary (no content).
44
- */
45
- export declare function formatConciseSummary(events: BaseEvent[], summary: SessionSummary): string;
46
- /**
47
- * Format stats output for CLI.
48
- */
49
- export declare function formatStatsText(summary: SessionSummary): string;
50
- //# sourceMappingURL=session-analytics.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"session-analytics.d.ts","sourceRoot":"","sources":["../../src/analytics/session-analytics.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErE,2CAA2C;AAC3C,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACjD,SAAS,EAAE,KAAK,CAAC;QAAE,QAAQ,EAAE,aAAa,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAA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C,CAAC,CAAC,KAAK,EAAE,CAC9F,CAAC;IACF,KAAK,CAAC,IAAI,CAAC,sBAAsB,OAAO,CAAC,eAAe,IAAI,CAAC,CAAC;IAE9D,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -1,253 +0,0 @@
1
- /**
2
- * Tests for session analytics pure functions.
3
- */
4
- import { describe, it, expect } from "vitest";
5
- import { computeSessionSummary, formatSummaryText, formatStatsText, formatConciseSummary, } from "./session-analytics.js";
6
- /** Create a mock event for testing */
7
- function mockEvent(overrides = {}) {
8
- return {
9
- id: "test-id",
10
- sessionId: "session-1",
11
- parentEventId: null,
12
- sequence: 1,
13
- eventType: "tool_call",
14
- agentRole: "assistant",
15
- agentName: "claude-code",
16
- skillName: null,
17
- toolName: "read_file",
18
- mcpMethod: "tools/call",
19
- startedAt: "2024-01-01T00:00:00.000Z",
20
- endedAt: "2024-01-01T00:00:01.000Z",
21
- status: "success",
22
- inputJson: "{}",
23
- outputJson: "{}",
24
- errorCategory: null,
25
- createdAt: "2024-01-01T00:00:00.000Z",
26
- ...overrides,
27
- };
28
- }
29
- describe("computeSessionSummary", () => {
30
- it("computes correct total events", () => {
31
- const events = [
32
- mockEvent({ sequence: 1 }),
33
- mockEvent({ sequence: 2 }),
34
- mockEvent({ sequence: 3 }),
35
- ];
36
- const summary = computeSessionSummary(events);
37
- expect(summary.totalEvents).toBe(3);
38
- });
39
- it("counts events by status", () => {
40
- const events = [
41
- mockEvent({ sequence: 1, status: "success" }),
42
- mockEvent({ sequence: 2, status: "success" }),
43
- mockEvent({
44
- sequence: 3,
45
- status: "error",
46
- errorCategory: "jsonrpc_error",
47
- }),
48
- mockEvent({
49
- sequence: 4,
50
- status: "timeout",
51
- errorCategory: "downstream_timeout",
52
- }),
53
- ];
54
- const summary = computeSessionSummary(events);
55
- expect(summary.byStatus["success"]).toBe(2);
56
- expect(summary.byStatus["error"]).toBe(1);
57
- expect(summary.byStatus["timeout"]).toBe(1);
58
- expect(summary.successCount).toBe(2);
59
- expect(summary.errorCount).toBe(1);
60
- expect(summary.timeoutCount).toBe(1);
61
- });
62
- it("counts events by tool name", () => {
63
- const events = [
64
- mockEvent({ sequence: 1, toolName: "read_file" }),
65
- mockEvent({ sequence: 2, toolName: "write_file" }),
66
- mockEvent({ sequence: 3, toolName: "read_file" }),
67
- ];
68
- const summary = computeSessionSummary(events);
69
- expect(summary.byToolName["read_file"]).toBe(2);
70
- expect(summary.byToolName["write_file"]).toBe(1);
71
- });
72
- it("computes error rate correctly", () => {
73
- const events = [
74
- mockEvent({ sequence: 1, status: "success" }),
75
- mockEvent({
76
- sequence: 2,
77
- status: "error",
78
- errorCategory: "jsonrpc_error",
79
- }),
80
- mockEvent({
81
- sequence: 3,
82
- status: "timeout",
83
- errorCategory: "downstream_timeout",
84
- }),
85
- mockEvent({ sequence: 4, status: "success" }),
86
- ];
87
- const summary = computeSessionSummary(events);
88
- expect(summary.errorRate).toBe(0.5); // 2 errors out of 4
89
- });
90
- it("computes average duration", () => {
91
- const events = [
92
- mockEvent({
93
- sequence: 1,
94
- startedAt: "2024-01-01T00:00:00.000Z",
95
- endedAt: "2024-01-01T00:00:01.000Z", // 1000ms
96
- }),
97
- mockEvent({
98
- sequence: 2,
99
- startedAt: "2024-01-01T00:00:02.000Z",
100
- endedAt: "2024-01-01T00:00:05.000Z", // 3000ms
101
- }),
102
- ];
103
- const summary = computeSessionSummary(events);
104
- expect(summary.avgDurationMs).toBe(2000);
105
- expect(summary.totalDurationMs).toBe(4000);
106
- });
107
- it("handles events with no end time", () => {
108
- const events = [
109
- mockEvent({
110
- sequence: 1,
111
- status: "running",
112
- startedAt: "2024-01-01T00:00:00.000Z",
113
- endedAt: null,
114
- }),
115
- ];
116
- const summary = computeSessionSummary(events);
117
- expect(summary.avgDurationMs).toBeNull();
118
- expect(summary.totalDurationMs).toBe(0);
119
- });
120
- it("counts error categories", () => {
121
- const events = [
122
- mockEvent({
123
- sequence: 1,
124
- status: "error",
125
- errorCategory: "jsonrpc_error",
126
- }),
127
- mockEvent({
128
- sequence: 2,
129
- status: "timeout",
130
- errorCategory: "downstream_timeout",
131
- }),
132
- mockEvent({
133
- sequence: 3,
134
- status: "error",
135
- errorCategory: "jsonrpc_error",
136
- }),
137
- ];
138
- const summary = computeSessionSummary(events);
139
- expect(summary.byErrorCategory["jsonrpc_error"]).toBe(2);
140
- expect(summary.byErrorCategory["downstream_timeout"]).toBe(1);
141
- });
142
- it("computes top tools sorted by count", () => {
143
- const events = [
144
- mockEvent({ sequence: 1, toolName: "read_file" }),
145
- mockEvent({ sequence: 2, toolName: "read_file" }),
146
- mockEvent({ sequence: 3, toolName: "read_file" }),
147
- mockEvent({ sequence: 4, toolName: "write_file" }),
148
- mockEvent({ sequence: 5, toolName: "write_file" }),
149
- mockEvent({ sequence: 6, toolName: "bash" }),
150
- ];
151
- const summary = computeSessionSummary(events);
152
- expect(summary.topTools).toHaveLength(3);
153
- expect(summary.topTools[0]).toEqual({ name: "read_file", count: 3 });
154
- expect(summary.topTools[1]).toEqual({ name: "write_file", count: 2 });
155
- expect(summary.topTools[2]).toEqual({ name: "bash", count: 1 });
156
- });
157
- it("computes slowest calls", () => {
158
- const events = [
159
- mockEvent({
160
- sequence: 1,
161
- toolName: "fast_tool",
162
- startedAt: "2024-01-01T00:00:00.000Z",
163
- endedAt: "2024-01-01T00:00:00.100Z", // 100ms
164
- }),
165
- mockEvent({
166
- sequence: 2,
167
- toolName: "slow_tool",
168
- startedAt: "2024-01-01T00:00:01.000Z",
169
- endedAt: "2024-01-01T00:00:06.000Z", // 5000ms
170
- }),
171
- mockEvent({
172
- sequence: 3,
173
- toolName: "medium_tool",
174
- startedAt: "2024-01-01T00:00:07.000Z",
175
- endedAt: "2024-01-01T00:00:08.000Z", // 1000ms
176
- }),
177
- ];
178
- const summary = computeSessionSummary(events);
179
- expect(summary.slowestCalls).toHaveLength(3);
180
- expect(summary.slowestCalls[0]).toEqual({
181
- sequence: 2,
182
- toolName: "slow_tool",
183
- durationMs: 5000,
184
- });
185
- expect(summary.slowestCalls[1]).toEqual({
186
- sequence: 3,
187
- toolName: "medium_tool",
188
- durationMs: 1000,
189
- });
190
- });
191
- it("handles empty events array", () => {
192
- const summary = computeSessionSummary([]);
193
- expect(summary.totalEvents).toBe(0);
194
- expect(summary.errorRate).toBe(0);
195
- expect(summary.avgDurationMs).toBeNull();
196
- expect(summary.topTools).toHaveLength(0);
197
- expect(summary.slowestCalls).toHaveLength(0);
198
- });
199
- });
200
- describe("formatSummaryText", () => {
201
- it("formats summary as text", () => {
202
- const events = [
203
- mockEvent({ sequence: 1, toolName: "read_file", status: "success" }),
204
- ];
205
- const summary = computeSessionSummary(events);
206
- const text = formatSummaryText(summary);
207
- expect(text).toContain("Session Summary");
208
- expect(text).toContain("Total Events: 1");
209
- expect(text).toContain("read_file: 1");
210
- expect(text).toContain("success: 1");
211
- });
212
- it("includes error categories when present", () => {
213
- const events = [
214
- mockEvent({
215
- sequence: 1,
216
- status: "error",
217
- errorCategory: "jsonrpc_error",
218
- }),
219
- ];
220
- const summary = computeSessionSummary(events);
221
- const text = formatSummaryText(summary);
222
- expect(text).toContain("Error Categories:");
223
- expect(text).toContain("jsonrpc_error: 1");
224
- });
225
- });
226
- describe("formatStatsText", () => {
227
- it("formats stats output", () => {
228
- const events = [
229
- mockEvent({ sequence: 1, toolName: "read_file" }),
230
- mockEvent({ sequence: 2, toolName: "read_file" }),
231
- ];
232
- const summary = computeSessionSummary(events);
233
- const text = formatStatsText(summary);
234
- expect(text).toContain("Session Statistics");
235
- expect(text).toContain("Tool Call Counts");
236
- expect(text).toContain("read_file");
237
- expect(text).toContain("Summary:");
238
- expect(text).toContain("Total Events:");
239
- });
240
- });
241
- describe("formatConciseSummary", () => {
242
- it("formats concise one-liner summary", () => {
243
- const events = [
244
- mockEvent({ sequence: 1, toolName: "read_file" }),
245
- mockEvent({ sequence: 2, toolName: "write_file" }),
246
- ];
247
- const summary = computeSessionSummary(events);
248
- const text = formatConciseSummary(events, summary);
249
- expect(text).toContain("2 tool calls");
250
- expect(text).toContain("read_file");
251
- });
252
- });
253
- //# sourceMappingURL=session-analytics.test.js.map
@@ -1,5 +0,0 @@
1
- /**
2
- * Tests for session analytics pure functions.
3
- */
4
- export {};
5
- //# sourceMappingURL=session-analytics.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"session-analytics.test.d.ts","sourceRoot":"","sources":["../../src/analytics/session-analytics.test.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"session-analytics.test.js","sourceRoot":"","sources":["../../src/analytics/session-analytics.test.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,eAAe,EACf,oBAAoB,GACrB,MAAM,wBAAwB,CAAC;AAGhC,sCAAsC;AACtC,SAAS,SAAS,CAAC,YAAgC,EAAE;IACnD,OAAO;QACL,EAAE,EAAE,SAAS;QACb,SAAS,EAAE,WAAW;QACtB,aAAa,EAAE,IAAI;QACnB,QAAQ,EAAE,CAAC;QACX,SAAS,EAAE,WAAW;QACtB,SAAS,EAAE,WAAW;QACtB,SAAS,EAAE,aAAa;QACxB,SAAS,EAAE,IAAI;QACf,QAAQ,EAAE,WAAW;QACrB,SAAS,EAAE,YAAY;QACvB,SAAS,EAAE,0BAA0B;QACrC,OAAO,EAAE,0BAA0B;QACnC,MAAM,EAAE,SAAS;QACjB,SAAS,EAAE,IAAI;QACf,UAAU,EAAE,IAAI;QAChB,aAAa,EAAE,IAAI;QACnB,SAAS,EAAE,0BAA0B;QACrC,GAAG,SAAS;KACb,CAAC;AACJ,CAAC;AAED,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACrC,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE;QACvC,MAAM,MAAM,G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