@pennyfarthing/cyclist 10.4.0 → 11.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (270) hide show
  1. package/dist/api/agent-load.d.ts +1 -2
  2. package/dist/api/agent-load.d.ts.map +1 -1
  3. package/dist/api/agent-load.js +2 -123
  4. package/dist/api/agent-load.js.map +1 -1
  5. package/dist/api/audit-log.d.ts +1 -17
  6. package/dist/api/audit-log.d.ts.map +1 -1
  7. package/dist/api/audit-log.js +2 -162
  8. package/dist/api/audit-log.js.map +1 -1
  9. package/dist/api/background-tasks.d.ts +1 -26
  10. package/dist/api/background-tasks.d.ts.map +1 -1
  11. package/dist/api/background-tasks.js +2 -55
  12. package/dist/api/background-tasks.js.map +1 -1
  13. package/dist/api/bell.d.ts +1 -18
  14. package/dist/api/bell.d.ts.map +1 -1
  15. package/dist/api/bell.js +2 -33
  16. package/dist/api/bell.js.map +1 -1
  17. package/dist/api/code-markers.d.ts +1 -8
  18. package/dist/api/code-markers.d.ts.map +1 -1
  19. package/dist/api/code-markers.js +2 -61
  20. package/dist/api/code-markers.js.map +1 -1
  21. package/dist/api/complexity.d.ts +1 -2
  22. package/dist/api/complexity.d.ts.map +1 -1
  23. package/dist/api/complexity.js +2 -46
  24. package/dist/api/complexity.js.map +1 -1
  25. package/dist/api/context.d.ts +1 -37
  26. package/dist/api/context.d.ts.map +1 -1
  27. package/dist/api/context.js +2 -143
  28. package/dist/api/context.js.map +1 -1
  29. package/dist/api/dead-code.d.ts +1 -2
  30. package/dist/api/dead-code.d.ts.map +1 -1
  31. package/dist/api/dead-code.js +2 -69
  32. package/dist/api/dead-code.js.map +1 -1
  33. package/dist/api/dependencies.d.ts +1 -2
  34. package/dist/api/dependencies.d.ts.map +1 -1
  35. package/dist/api/dependencies.js +2 -42
  36. package/dist/api/dependencies.js.map +1 -1
  37. package/dist/api/evaluation.d.ts +1 -19
  38. package/dist/api/evaluation.d.ts.map +1 -1
  39. package/dist/api/evaluation.js +2 -127
  40. package/dist/api/evaluation.js.map +1 -1
  41. package/dist/api/file-browser.d.ts +1 -8
  42. package/dist/api/file-browser.d.ts.map +1 -1
  43. package/dist/api/file-browser.js +2 -114
  44. package/dist/api/file-browser.js.map +1 -1
  45. package/dist/api/git.d.ts +1 -46
  46. package/dist/api/git.d.ts.map +1 -1
  47. package/dist/api/git.js +2 -354
  48. package/dist/api/git.js.map +1 -1
  49. package/dist/api/health-score.d.ts +1 -2
  50. package/dist/api/health-score.d.ts.map +1 -1
  51. package/dist/api/health-score.js +2 -46
  52. package/dist/api/health-score.js.map +1 -1
  53. package/dist/api/hook-request.d.ts +1 -40
  54. package/dist/api/hook-request.d.ts.map +1 -1
  55. package/dist/api/hook-request.js +2 -277
  56. package/dist/api/hook-request.js.map +1 -1
  57. package/dist/api/hotspots.d.ts +1 -2
  58. package/dist/api/hotspots.d.ts.map +1 -1
  59. package/dist/api/hotspots.js +2 -61
  60. package/dist/api/hotspots.js.map +1 -1
  61. package/dist/api/identity.d.ts +1 -16
  62. package/dist/api/identity.d.ts.map +1 -1
  63. package/dist/api/identity.js +2 -78
  64. package/dist/api/identity.js.map +1 -1
  65. package/dist/api/index.d.ts +1 -34
  66. package/dist/api/index.d.ts.map +1 -1
  67. package/dist/api/index.js +2 -44
  68. package/dist/api/index.js.map +1 -1
  69. package/dist/api/mode.d.ts +1 -22
  70. package/dist/api/mode.d.ts.map +1 -1
  71. package/dist/api/mode.js +2 -37
  72. package/dist/api/mode.js.map +1 -1
  73. package/dist/api/otlp.d.ts +1 -2
  74. package/dist/api/otlp.d.ts.map +1 -1
  75. package/dist/api/otlp.js +2 -46
  76. package/dist/api/otlp.js.map +1 -1
  77. package/dist/api/permissions.d.ts +1 -15
  78. package/dist/api/permissions.d.ts.map +1 -1
  79. package/dist/api/permissions.js +2 -66
  80. package/dist/api/permissions.js.map +1 -1
  81. package/dist/api/persona.d.ts +1 -8
  82. package/dist/api/persona.d.ts.map +1 -1
  83. package/dist/api/persona.js +2 -67
  84. package/dist/api/persona.js.map +1 -1
  85. package/dist/api/portrait.d.ts +1 -5
  86. package/dist/api/portrait.d.ts.map +1 -1
  87. package/dist/api/portrait.js +2 -27
  88. package/dist/api/portrait.js.map +1 -1
  89. package/dist/api/settings.d.ts +1 -53
  90. package/dist/api/settings.d.ts.map +1 -1
  91. package/dist/api/settings.js +2 -464
  92. package/dist/api/settings.js.map +1 -1
  93. package/dist/api/spans.d.ts +1 -16
  94. package/dist/api/spans.d.ts.map +1 -1
  95. package/dist/api/spans.js +2 -244
  96. package/dist/api/spans.js.map +1 -1
  97. package/dist/api/stats.d.ts +1 -12
  98. package/dist/api/stats.d.ts.map +1 -1
  99. package/dist/api/stats.js +2 -84
  100. package/dist/api/stats.js.map +1 -1
  101. package/dist/api/story.d.ts +1 -2
  102. package/dist/api/story.d.ts.map +1 -1
  103. package/dist/api/story.js +2 -14
  104. package/dist/api/story.js.map +1 -1
  105. package/dist/api/telemetry.d.ts +1 -18
  106. package/dist/api/telemetry.d.ts.map +1 -1
  107. package/dist/api/telemetry.js +2 -164
  108. package/dist/api/telemetry.js.map +1 -1
  109. package/dist/api/theme-agents.d.ts +1 -60
  110. package/dist/api/theme-agents.d.ts.map +1 -1
  111. package/dist/api/theme-agents.js +2 -213
  112. package/dist/api/theme-agents.js.map +1 -1
  113. package/dist/api/todos.d.ts +1 -32
  114. package/dist/api/todos.d.ts.map +1 -1
  115. package/dist/api/todos.js +2 -43
  116. package/dist/api/todos.js.map +1 -1
  117. package/dist/api/token-stats.d.ts +1 -7
  118. package/dist/api/token-stats.d.ts.map +1 -1
  119. package/dist/api/token-stats.js +2 -35
  120. package/dist/api/token-stats.js.map +1 -1
  121. package/dist/api/welcome.d.ts +1 -21
  122. package/dist/api/welcome.d.ts.map +1 -1
  123. package/dist/api/welcome.js +2 -34
  124. package/dist/api/welcome.js.map +1 -1
  125. package/dist/env.d.ts +6 -0
  126. package/dist/env.d.ts.map +1 -0
  127. package/dist/env.js +10 -0
  128. package/dist/env.js.map +1 -0
  129. package/dist/focus.d.ts +53 -0
  130. package/dist/focus.d.ts.map +1 -0
  131. package/dist/focus.js +122 -0
  132. package/dist/focus.js.map +1 -0
  133. package/dist/menu-builder.d.ts.map +1 -1
  134. package/dist/menu-builder.js +0 -1
  135. package/dist/menu-builder.js.map +1 -1
  136. package/dist/public/css/react.css +1 -1
  137. package/dist/public/js/react/react.js +51 -59
  138. package/dist/server.d.ts +16 -85
  139. package/dist/server.d.ts.map +1 -1
  140. package/dist/server.js +38 -409
  141. package/dist/server.js.map +1 -1
  142. package/dist/sprint-data.d.ts +1 -1
  143. package/dist/sprint-data.d.ts.map +1 -1
  144. package/dist/sprint-data.js +2 -2
  145. package/dist/sprint-data.js.map +1 -1
  146. package/dist/websocket.d.ts +2 -0
  147. package/dist/websocket.d.ts.map +1 -1
  148. package/dist/websocket.js +42 -75
  149. package/dist/websocket.js.map +1 -1
  150. package/package.json +3 -6
  151. package/portraits/hogans-heroes/large/burkhalter-35312.png +0 -0
  152. package/portraits/hogans-heroes/large/carter-34352.png +0 -0
  153. package/portraits/hogans-heroes/large/hochstetter-45314.png +0 -0
  154. package/portraits/hogans-heroes/large/hogan-44541.png +0 -0
  155. package/portraits/hogans-heroes/large/kinch-35241.png +0 -0
  156. package/portraits/hogans-heroes/large/klink-23434.png +0 -0
  157. package/portraits/hogans-heroes/large/lebeau-45443.png +0 -0
  158. package/portraits/hogans-heroes/large/marya-53543.png +0 -0
  159. package/portraits/hogans-heroes/large/newkirk-54432.png +0 -0
  160. package/portraits/hogans-heroes/large/schultz-42453.png +0 -0
  161. package/portraits/hogans-heroes/large/underground-55131.png +0 -0
  162. package/portraits/hogans-heroes/medium/burkhalter-35312.png +0 -0
  163. package/portraits/hogans-heroes/medium/carter-34352.png +0 -0
  164. package/portraits/hogans-heroes/medium/hochstetter-45314.png +0 -0
  165. package/portraits/hogans-heroes/medium/hogan-44541.png +0 -0
  166. package/portraits/hogans-heroes/medium/kinch-35241.png +0 -0
  167. package/portraits/hogans-heroes/medium/klink-23434.png +0 -0
  168. package/portraits/hogans-heroes/medium/lebeau-45443.png +0 -0
  169. package/portraits/hogans-heroes/medium/marya-53543.png +0 -0
  170. package/portraits/hogans-heroes/medium/newkirk-54432.png +0 -0
  171. package/portraits/hogans-heroes/medium/schultz-42453.png +0 -0
  172. package/portraits/hogans-heroes/medium/underground-55131.png +0 -0
  173. package/portraits/monty-python/large/announcer-44441.png +0 -0
  174. package/portraits/monty-python/large/arguer-35412.png +0 -0
  175. package/portraits/monty-python/large/bicycle-repair-man-35241.png +0 -0
  176. package/portraits/monty-python/large/colonel-35423.png +0 -0
  177. package/portraits/monty-python/large/counsellor-45341.png +0 -0
  178. package/portraits/monty-python/large/gumbys-23524.png +0 -0
  179. package/portraits/monty-python/large/nudge-43533.png +0 -0
  180. package/portraits/monty-python/large/praline-45413.png +0 -0
  181. package/portraits/monty-python/large/silly-walks-55322.png +0 -0
  182. package/portraits/monty-python/large/wensleydale-54451.png +0 -0
  183. package/portraits/monty-python/large/xim-nez-43534.png +0 -0
  184. package/portraits/monty-python/medium/announcer-44441.png +0 -0
  185. package/portraits/monty-python/medium/arguer-35412.png +0 -0
  186. package/portraits/monty-python/medium/bicycle-repair-man-35241.png +0 -0
  187. package/portraits/monty-python/medium/colonel-35423.png +0 -0
  188. package/portraits/monty-python/medium/counsellor-45341.png +0 -0
  189. package/portraits/monty-python/medium/gumbys-23524.png +0 -0
  190. package/portraits/monty-python/medium/nudge-43533.png +0 -0
  191. package/portraits/monty-python/medium/praline-45413.png +0 -0
  192. package/portraits/monty-python/medium/silly-walks-55322.png +0 -0
  193. package/portraits/monty-python/medium/wensleydale-54451.png +0 -0
  194. package/portraits/monty-python/medium/xim-nez-43534.png +0 -0
  195. package/portraits/stephen-king/large/andy-55231.png +0 -0
  196. package/portraits/stephen-king/large/christine-25112.png +0 -0
  197. package/portraits/stephen-king/large/danny-53243.png +0 -0
  198. package/portraits/stephen-king/large/flagg-55311.png +0 -0
  199. package/portraits/stephen-king/large/gaunt-54421.png +0 -0
  200. package/portraits/stephen-king/large/jack-44224.png +0 -0
  201. package/portraits/stephen-king/large/johnny-44353.png +0 -0
  202. package/portraits/stephen-king/large/margaret-15415.png +0 -0
  203. package/portraits/stephen-king/large/paul-45233.png +0 -0
  204. package/portraits/stephen-king/large/pennywise-54411.png +0 -0
  205. package/portraits/stephen-king/large/roland-35121.png +0 -0
  206. package/portraits/stephen-king/medium/andy-55231.png +0 -0
  207. package/portraits/stephen-king/medium/christine-25112.png +0 -0
  208. package/portraits/stephen-king/medium/danny-53243.png +0 -0
  209. package/portraits/stephen-king/medium/flagg-55311.png +0 -0
  210. package/portraits/stephen-king/medium/gaunt-54421.png +0 -0
  211. package/portraits/stephen-king/medium/jack-44224.png +0 -0
  212. package/portraits/stephen-king/medium/johnny-44353.png +0 -0
  213. package/portraits/stephen-king/medium/margaret-15415.png +0 -0
  214. package/portraits/stephen-king/medium/paul-45233.png +0 -0
  215. package/portraits/stephen-king/medium/pennywise-54411.png +0 -0
  216. package/portraits/stephen-king/medium/roland-35121.png +0 -0
  217. package/src/public/App.tsx +21 -5
  218. package/src/public/components/BikeRackIndex.tsx +0 -1
  219. package/src/public/components/BikeRackWorkspace.tsx +86 -11
  220. package/src/public/components/DockviewWorkspace.tsx +19 -8
  221. package/src/public/components/StandalonePanel.tsx +1 -3
  222. package/src/public/components/panel-registry.ts +3 -1
  223. package/src/public/components/panels/AuditLogPanel.tsx +28 -4
  224. package/src/public/components/panels/GitPanel.tsx +1 -20
  225. package/src/public/components/panels/SettingsPanel.tsx +0 -1
  226. package/src/public/components/panels/SprintPanel.tsx +32 -1
  227. package/src/public/components/panels/index.ts +0 -2
  228. package/src/public/hooks/useFocusPanel.ts +137 -0
  229. package/src/public/hooks/useLayoutPersistence.ts +8 -5
  230. package/src/public/styles/dockview-theme.css +1 -84
  231. package/src/public/styles/tailwind.css +27 -32
  232. package/src/public/utils/slash-commands.ts +122 -98
  233. package/dist/hooks/cyclist-pretooluse-hook.d.ts +0 -60
  234. package/dist/hooks/cyclist-pretooluse-hook.d.ts.map +0 -1
  235. package/dist/hooks/cyclist-pretooluse-hook.js +0 -57
  236. package/dist/hooks/cyclist-pretooluse-hook.js.map +0 -1
  237. package/dist/hooks/pretooluse-hook.d.ts +0 -89
  238. package/dist/hooks/pretooluse-hook.d.ts.map +0 -1
  239. package/dist/hooks/pretooluse-hook.js +0 -235
  240. package/dist/hooks/pretooluse-hook.js.map +0 -1
  241. package/dist/notification-sound.d.ts +0 -59
  242. package/dist/notification-sound.d.ts.map +0 -1
  243. package/dist/notification-sound.js +0 -219
  244. package/dist/notification-sound.js.map +0 -1
  245. package/dist/plugin-loader.test.d.ts +0 -17
  246. package/dist/plugin-loader.test.d.ts.map +0 -1
  247. package/dist/plugin-loader.test.js +0 -407
  248. package/dist/plugin-loader.test.js.map +0 -1
  249. package/portraits/star-trek-tng/large/beverly-44352.png +0 -0
  250. package/portraits/star-trek-tng/large/data-55241.png +0 -0
  251. package/portraits/star-trek-tng/large/deanna-43353.png +0 -0
  252. package/portraits/star-trek-tng/large/geordi-54342.png +0 -0
  253. package/portraits/star-trek-tng/large/jean-luc-45342.png +0 -0
  254. package/portraits/star-trek-tng/large/kathryn-45332.png +0 -0
  255. package/portraits/star-trek-tng/large/miles-35342.png +0 -0
  256. package/portraits/star-trek-tng/large/q-53521.png +0 -0
  257. package/portraits/star-trek-tng/large/spock-45231.png +0 -0
  258. package/portraits/star-trek-tng/large/troi-44352.png +0 -0
  259. package/portraits/star-trek-tng/medium/beverly-44352.png +0 -0
  260. package/portraits/star-trek-tng/medium/data-55241.png +0 -0
  261. package/portraits/star-trek-tng/medium/deanna-43353.png +0 -0
  262. package/portraits/star-trek-tng/medium/geordi-54342.png +0 -0
  263. package/portraits/star-trek-tng/medium/jean-luc-45342.png +0 -0
  264. package/portraits/star-trek-tng/medium/kathryn-45332.png +0 -0
  265. package/portraits/star-trek-tng/medium/miles-35342.png +0 -0
  266. package/portraits/star-trek-tng/medium/q-53521.png +0 -0
  267. package/portraits/star-trek-tng/medium/spock-45231.png +0 -0
  268. package/portraits/star-trek-tng/medium/troi-44352.png +0 -0
  269. package/src/public/components/panels/TTYPanel.tsx +0 -299
  270. package/src/public/types/electron.d.ts +0 -18
@@ -1,47 +1,3 @@
1
- import { Router } from 'express';
2
- import { execFile } from 'child_process';
3
- import { join } from 'path';
4
- export function createComplexityRouter(getProjectDir) {
5
- const router = Router();
6
- router.get('/', (req, res) => {
7
- const projectDir = getProjectDir();
8
- const top = req.query.top;
9
- const args = [
10
- '-m', 'pennyfarthing_scripts.complexity',
11
- 'analyze',
12
- '--format', 'json',
13
- '--path', projectDir,
14
- ];
15
- if (top) {
16
- args.push('--top', top);
17
- }
18
- const pythonPath = join(projectDir, 'pennyfarthing');
19
- execFile('python3', args, {
20
- cwd: pythonPath,
21
- env: { ...process.env, PYTHONPATH: pythonPath },
22
- timeout: 30000,
23
- }, (err, stdout, stderr) => {
24
- if (err) {
25
- console.error('[Complexity] Analysis failed:', stderr || err.message);
26
- res.status(500).json({
27
- success: false,
28
- error: stderr || err.message,
29
- });
30
- return;
31
- }
32
- try {
33
- const data = JSON.parse(stdout);
34
- res.json(data);
35
- }
36
- catch (parseErr) {
37
- console.error('[Complexity] JSON parse failed:', parseErr);
38
- res.status(500).json({
39
- success: false,
40
- error: 'Failed to parse complexity analysis output',
41
- });
42
- }
43
- });
44
- });
45
- return router;
46
- }
1
+ // Re-export from @pennyfarthing/core (Story 98-17)
2
+ export * from '@pennyfarthing/core/dist/server/api/complexity.js';
47
3
  //# sourceMappingURL=complexity.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"complexity.js","sourceRoot":"","sources":["../../src/api/complexity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAA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OAAO,QAAQ,EAAE,CAAC;gBAClB,OAAO,CAAC,KAAK,CAAC,iCAAiC,EAAE,QAAQ,CAAC,CAAC;gBAC3D,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;oBACnB,OAAO,EAAE,KAAK;oBACd,KAAK,EAAE,4CAA4C;iBACpD,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC"}
1
+ {"version":3,"file":"complexity.js","sourceRoot":"","sources":["../../src/api/complexity.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,cAAc,mDAAmD,CAAC"}
@@ -1,38 +1,2 @@
1
- import { Router } from 'express';
2
- import type { ContextTier } from '../prime.js';
3
- /**
4
- * Context usage information from check-context.sh
5
- */
6
- export interface ContextInfo {
7
- percent: number | null;
8
- tokens: number | null;
9
- status: string | null;
10
- error: string | null;
11
- sessionId?: string;
12
- /** System prompt overhead (first turn tokens) */
13
- baseline: number | null;
14
- /** Tokens used by conversation (total - baseline) */
15
- usableTokens: number | null;
16
- /** Conversation usage as % of available capacity */
17
- usablePercent: number | null;
18
- /** Available capacity (max - baseline) */
19
- available: number | null;
20
- /** Current context tier (FULL, REFRESH, HANDOFF, MINIMAL) */
21
- tier?: ContextTier;
22
- /** Per-component token counts (MSSCI-12800) */
23
- tokenCounts?: Record<string, number>;
24
- /** Total tokens across all injected components (MSSCI-12800) */
25
- totalTokens?: number;
26
- }
27
- /**
28
- * Get context usage by running check-context.sh
29
- * @param projectDir - The project directory
30
- * @param sessionId - Optional session ID to check specific transcript
31
- * @returns Context usage info
32
- */
33
- export declare function getContextUsage(projectDir: string, sessionId?: string): ContextInfo;
34
- /**
35
- * Create context API router
36
- */
37
- export declare function createContextRouter(getProjectDir: () => string): Router;
1
+ export * from '@pennyfarthing/core/dist/server/api/context.js';
38
2
  //# sourceMappingURL=context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/api/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAIjC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iDAAiD;IACjD,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,qDAAqD;IACrD,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,oDAAoD;IACpD,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,0CAA0C;IAC1C,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,6DAA6D;IAC7D,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,+CAA+C;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,gEAAgE;IAChE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,WAAW,CAwHnF;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,MAAM,MAAM,GAAG,MAAM,CAWvE"}
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/api/context.ts"],"names":[],"mappings":"AACA,cAAc,gDAAgD,CAAC"}
@@ -1,144 +1,3 @@
1
- import { Router } from 'express';
2
- import { execSync } from 'child_process';
3
- import { existsSync } from 'fs';
4
- import { join } from 'path';
5
- /**
6
- * Get context usage by running check-context.sh
7
- * @param projectDir - The project directory
8
- * @param sessionId - Optional session ID to check specific transcript
9
- * @returns Context usage info
10
- */
11
- export function getContextUsage(projectDir, sessionId) {
12
- // Find the check-context.sh script
13
- const possiblePaths = [
14
- join(projectDir, 'pennyfarthing-dist', 'scripts', 'core', 'check-context.sh'),
15
- join(projectDir, '.pennyfarthing', 'scripts', 'core', 'check-context.sh'),
16
- ];
17
- let scriptPath = null;
18
- for (const path of possiblePaths) {
19
- if (existsSync(path)) {
20
- scriptPath = path;
21
- break;
22
- }
23
- }
24
- if (!scriptPath) {
25
- return { percent: null, tokens: null, status: null, error: 'check-context.sh not found', baseline: null, usableTokens: null, usablePercent: null, available: null };
26
- }
27
- try {
28
- // Build environment with optional SESSION_ID
29
- const env = {
30
- ...process.env,
31
- PROJECT_ROOT: projectDir,
32
- };
33
- if (sessionId) {
34
- env.SESSION_ID = sessionId;
35
- }
36
- const output = execSync(`"${scriptPath}"`, {
37
- encoding: 'utf-8',
38
- timeout: 5000,
39
- cwd: projectDir,
40
- env,
41
- });
42
- // Parse the output which looks like:
43
- // CONTEXT_TOKENS=12345
44
- // CONTEXT_PERCENT=45
45
- // CONTEXT_STATUS=OK
46
- // HANDOFF_MODE=ask
47
- const result = {
48
- percent: null,
49
- tokens: null,
50
- status: null,
51
- error: null,
52
- sessionId,
53
- baseline: null,
54
- usableTokens: null,
55
- usablePercent: null,
56
- available: null,
57
- };
58
- for (const line of output.split('\n')) {
59
- const [key, value] = line.split('=');
60
- if (key === 'CONTEXT_PERCENT') {
61
- result.percent = parseInt(value, 10);
62
- }
63
- else if (key === 'CONTEXT_TOKENS') {
64
- result.tokens = parseInt(value, 10);
65
- }
66
- else if (key === 'CONTEXT_STATUS') {
67
- result.status = value;
68
- }
69
- else if (key === 'CONTEXT_ERROR') {
70
- // Translate session_not_found to user-friendly message
71
- if (value === 'session_not_found') {
72
- result.error = `session transcript not found: ${sessionId}`;
73
- }
74
- else {
75
- result.error = value;
76
- }
77
- }
78
- else if (key === 'CONTEXT_BASELINE') {
79
- result.baseline = parseInt(value, 10);
80
- }
81
- else if (key === 'CONTEXT_USABLE_TOKENS') {
82
- result.usableTokens = parseInt(value, 10);
83
- }
84
- else if (key === 'CONTEXT_USABLE_PERCENT') {
85
- result.usablePercent = parseInt(value, 10);
86
- }
87
- else if (key === 'CONTEXT_AVAILABLE') {
88
- result.available = parseInt(value, 10);
89
- }
90
- }
91
- return result;
92
- }
93
- catch (err) {
94
- // execSync throws when script exits with non-zero code
95
- // The error may contain stdout/stderr with our structured output
96
- let errMsg = 'Failed to get context';
97
- if (err && typeof err === 'object') {
98
- const execErr = err;
99
- // Try to get output from the error object
100
- const stdout = execErr.stdout?.toString() || '';
101
- const stderr = execErr.stderr?.toString() || '';
102
- const combined = stdout + stderr + (execErr.message || '');
103
- // Check for session-specific errors
104
- if (sessionId && (combined.includes('session_not_found') || combined.includes('session transcript not found'))) {
105
- errMsg = `session transcript not found: ${sessionId}`;
106
- }
107
- else if (combined.includes('CONTEXT_ERROR=')) {
108
- // Parse the error from script output
109
- const match = combined.match(/CONTEXT_ERROR=(\w+)/);
110
- if (match) {
111
- errMsg = match[1] === 'session_not_found' ? `session transcript not found: ${sessionId}` : match[1];
112
- }
113
- }
114
- else {
115
- errMsg = execErr.message || 'Failed to get context';
116
- }
117
- }
118
- return {
119
- percent: null,
120
- tokens: null,
121
- status: null,
122
- error: errMsg,
123
- sessionId,
124
- baseline: null,
125
- usableTokens: null,
126
- usablePercent: null,
127
- available: null,
128
- };
129
- }
130
- }
131
- /**
132
- * Create context API router
133
- */
134
- export function createContextRouter(getProjectDir) {
135
- const router = Router();
136
- // Context API - GET current context usage
137
- router.get('/', (_req, res) => {
138
- const projectDir = getProjectDir();
139
- const context = getContextUsage(projectDir);
140
- res.json(context);
141
- });
142
- return router;
143
- }
1
+ // Re-export from @pennyfarthing/core (Story 98-17)
2
+ export * from '@pennyfarthing/core/dist/server/api/context.js';
144
3
  //# sourceMappingURL=context.js.map
@@ -1 +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DAAgD,CAAC"}
@@ -1,3 +1,2 @@
1
- import { Router } from 'express';
2
- export declare function createDeadCodeRouter(getProjectDir: () => string): Router;
1
+ export * from '@pennyfarthing/core/dist/server/api/dead-code.js';
3
2
  //# sourceMappingURL=dead-code.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dead-code.d.ts","sourceRoot":"","sources":["../../src/api/dead-code.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AA2CjC,wBAAgB,oBAAoB,CAAC,aAAa,EAAE,MAAM,MAAM,GAAG,MAAM,CAmCxE"}
1
+ {"version":3,"file":"dead-code.d.ts","sourceRoot":"","sources":["../../src/api/dead-code.ts"],"names":[],"mappings":"AACA,cAAc,kDAAkD,CAAC"}
@@ -1,70 +1,3 @@
1
- import { Router } from 'express';
2
- import { execFile } from 'child_process';
3
- import { join } from 'path';
4
- function runDeadCodeCommand(command, projectDir, days, repo) {
5
- return new Promise((resolve, reject) => {
6
- const args = ['-m', 'pennyfarthing_scripts.deadcode', command, '--format', 'json'];
7
- if (command === 'stale') {
8
- args.push('--days', days);
9
- }
10
- if (repo) {
11
- args.push('--repo', repo);
12
- }
13
- else {
14
- args.push('--path', projectDir);
15
- }
16
- const pythonPath = join(projectDir, 'pennyfarthing');
17
- execFile('python3', args, {
18
- cwd: pythonPath,
19
- env: { ...process.env, PYTHONPATH: pythonPath },
20
- timeout: 30000,
21
- }, (err, stdout, stderr) => {
22
- if (err) {
23
- reject(new Error(stderr || err.message));
24
- return;
25
- }
26
- try {
27
- resolve(JSON.parse(stdout));
28
- }
29
- catch {
30
- reject(new Error('Failed to parse dead code analysis output'));
31
- }
32
- });
33
- });
34
- }
35
- export function createDeadCodeRouter(getProjectDir) {
36
- const router = Router();
37
- // GET /api/dead-code?days=180&repo=pennyfarthing&layer=all|stale|exports
38
- router.get('/', async (req, res) => {
39
- const projectDir = getProjectDir();
40
- const days = String(req.query.days || '180');
41
- const repo = req.query.repo;
42
- const layer = String(req.query.layer || 'all');
43
- try {
44
- if (layer === 'stale' || layer === 'exports') {
45
- const data = await runDeadCodeCommand(layer, projectDir, days, repo);
46
- res.json(data);
47
- }
48
- else {
49
- // layer=all: run both and merge
50
- const [staleData, exportsData] = await Promise.all([
51
- runDeadCodeCommand('stale', projectDir, days, repo),
52
- runDeadCodeCommand('exports', projectDir, days, repo).catch(() => ({})),
53
- ]);
54
- res.json({
55
- success: true,
56
- ...staleData,
57
- unused_exports: exportsData.unused_exports ?? [],
58
- unused_export_count: exportsData.unused_export_count ?? 0,
59
- });
60
- }
61
- }
62
- catch (err) {
63
- const message = err instanceof Error ? err.message : String(err);
64
- console.error('[DeadCode] Analysis failed:', message);
65
- res.status(500).json({ success: false, error: message });
66
- }
67
- });
68
- return router;
69
- }
1
+ // Re-export from @pennyfarthing/core (Story 98-17)
2
+ export * from '@pennyfarthing/core/dist/server/api/dead-code.js';
70
3
  //# sourceMappingURL=dead-code.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dead-code.js","sourceRoot":"","sources":["../../src/api/dead-code.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,SAAS,kBAAkB,CACzB,OAA4B,EAC5B,UAAkB,EAClB,IAAY,EACZ,IAAwB;IAExB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,IAAI,GAAG,CAAC,IAAI,EAAE,gCAAgC,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;QAEnF,IAAI,OAAO,KAAK,OAAO,EAAE,CAAC;YACxB,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAC5B,CAAC;QAED,IAAI,IAAI,EAAE,CAAC;YACT,IAAI,CAAC,I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AO,MAAM,CAAC;AAChB,CAAC"}
1
+ {"version":3,"file":"dead-code.js","sourceRoot":"","sources":["../../src/api/dead-code.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,cAAc,kDAAkD,CAAC"}
@@ -1,3 +1,2 @@
1
- import { Router } from 'express';
2
- export declare function createDependenciesRouter(getProjectDir: () => string): Router;
1
+ export * from '@pennyfarthing/core/dist/server/api/dependencies.js';
3
2
  //# sourceMappingURL=dependencies.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dependencies.d.ts","sourceRoot":"","sources":["../../src/api/dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAIjC,wBAAgB,wBAAwB,CAAC,aAAa,EAAE,MAAM,MAAM,GAAG,MAAM,CA2C5E"}
1
+ {"version":3,"file":"dependencies.d.ts","sourceRoot":"","sources":["../../src/api/dependencies.ts"],"names":[],"mappings":"AACA,cAAc,qDAAqD,CAAC"}
@@ -1,43 +1,3 @@
1
- import { Router } from 'express';
2
- import { execFile } from 'child_process';
3
- import { join } from 'path';
4
- export function createDependenciesRouter(getProjectDir) {
5
- const router = Router();
6
- router.get('/', (req, res) => {
7
- const projectDir = getProjectDir();
8
- const args = [
9
- '-m', 'pennyfarthing_scripts.dependencies',
10
- 'analyze',
11
- '--format', 'json',
12
- '--path', projectDir,
13
- ];
14
- const pythonPath = join(projectDir, 'pennyfarthing');
15
- execFile('python3', args, {
16
- cwd: pythonPath,
17
- env: { ...process.env, PYTHONPATH: pythonPath },
18
- timeout: 30000,
19
- }, (err, stdout, stderr) => {
20
- if (err) {
21
- console.error('[Dependencies] Analysis failed:', stderr || err.message);
22
- res.status(500).json({
23
- success: false,
24
- error: stderr || err.message,
25
- });
26
- return;
27
- }
28
- try {
29
- const data = JSON.parse(stdout);
30
- res.json(data);
31
- }
32
- catch (parseErr) {
33
- console.error('[Dependencies] JSON parse failed:', parseErr);
34
- res.status(500).json({
35
- success: false,
36
- error: 'Failed to parse dependencies analysis output',
37
- });
38
- }
39
- });
40
- });
41
- return router;
42
- }
1
+ // Re-export from @pennyfarthing/core (Story 98-17)
2
+ export * from '@pennyfarthing/core/dist/server/api/dependencies.js';
43
3
  //# sourceMappingURL=dependencies.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../../src/api/dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,MAAM,UAAU,wBAAwB,CAAC,aAA2B;IAClE,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC;IAExB,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QAC3B,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC;QAEnC,MAAM,IAAI,GAAG;YACX,IAAI,EAAE,oCAAoC;YAC1C,SAAS;YACT,UAAU,EAAE,MAAM;YAClB,QAAQ,EAAE,UAAU;SACrB,CAAC;QAEF,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;QAErD,QAAQ,CAAC,SAAS,EAAE,IAAI,EAAE;YACxB,GAAG,EAAE,UAAU;YACf,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,UAAU,EAAE,UAAU,EAAE;YAC/C,OAAO,EAAE,KAAK;SACf,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;YACzB,IAAI,GAAG,EAAE,CAAC;gBACR,OAAO,CAAC,KAAK,CAAC,iCAAiC,EAAE,MAAM,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;gBACxE,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;oBACnB,OAAO,EAAE,KAAK;oBACd,KAAK,EAAE,MAAM,IAAI,GAAG,CAAC,OAAO;iBAC7B,CAAC,CAAC;gBACH,OAAO;YACT,CAAC;YAED,IAAI,CAAC;gBACH,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;gBAChC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACjB,CAAC;YAAC,OAAO,QAAQ,EAAE,CAAC;gBAClB,OAAO,CAAC,KAAK,CAAC,mCAAmC,EAAE,QAAQ,CAAC,CAAC;gBAC7D,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;oBACnB,OAAO,EAAE,KAAK;oBACd,KAAK,EAAE,8CAA8C;iBACtD,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC"}
1
+ {"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../../src/api/dependencies.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,cAAc,qDAAqD,CAAC"}
@@ -1,20 +1,2 @@
1
- /**
2
- * Evaluation API Router - Story 19-9
3
- *
4
- * REST API for agent evaluation data. Exposes metrics aggregated by
5
- * agent role, persona/theme, and task type with regression detection.
6
- */
7
- import { Router } from 'express';
8
- /**
9
- * Create evaluation API router
10
- *
11
- * Endpoints:
12
- * - GET /agents - All agent metrics
13
- * - GET /agents/:role - Specific agent metrics
14
- * - GET /personas - All persona metrics
15
- * - GET /tasks - Task type breakdown
16
- * - GET /regression - Regression alerts and trends
17
- * - GET /recommendations - Generated recommendations
18
- */
19
- export declare function createEvaluationRouter(): Router;
1
+ export * from '@pennyfarthing/core/dist/server/api/evaluation.js';
20
2
  //# sourceMappingURL=evaluation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"evaluation.d.ts","sourceRoot":"","sources":["../../src/api/evaluation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAOjC;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CAiI/C"}
1
+ {"version":3,"file":"evaluation.d.ts","sourceRoot":"","sources":["../../src/api/evaluation.ts"],"names":[],"mappings":"AACA,cAAc,mDAAmD,CAAC"}
@@ -1,128 +1,3 @@
1
- /**
2
- * Evaluation API Router - Story 19-9
3
- *
4
- * REST API for agent evaluation data. Exposes metrics aggregated by
5
- * agent role, persona/theme, and task type with regression detection.
6
- */
7
- import { Router } from 'express';
8
- import { getEvaluation, detectTrend, generateRecommendations, } from '../agent-evaluation.js';
9
- /**
10
- * Create evaluation API router
11
- *
12
- * Endpoints:
13
- * - GET /agents - All agent metrics
14
- * - GET /agents/:role - Specific agent metrics
15
- * - GET /personas - All persona metrics
16
- * - GET /tasks - Task type breakdown
17
- * - GET /regression - Regression alerts and trends
18
- * - GET /recommendations - Generated recommendations
19
- */
20
- export function createEvaluationRouter() {
21
- const router = Router();
22
- /**
23
- * GET /api/evaluation/agents
24
- *
25
- * Returns metrics for all agents.
26
- *
27
- * Response 200: Record<string, AgentMetrics>
28
- * Response 404: { error: 'No evaluation data available' }
29
- */
30
- router.get('/agents', (_req, res) => {
31
- const evaluation = getEvaluation();
32
- if (!evaluation) {
33
- return res.status(404).json({ error: 'No evaluation data available' });
34
- }
35
- res.json(evaluation.agentMetrics);
36
- });
37
- /**
38
- * GET /api/evaluation/agents/:role
39
- *
40
- * Returns metrics for a specific agent role.
41
- *
42
- * Response 200: AgentMetrics
43
- * Response 404: { error: 'No evaluation data available' } or { error: 'Agent not found: X' }
44
- */
45
- router.get('/agents/:role', (req, res) => {
46
- const evaluation = getEvaluation();
47
- if (!evaluation) {
48
- return res.status(404).json({ error: 'No evaluation data available' });
49
- }
50
- const role = req.params.role.toLowerCase();
51
- const metrics = evaluation.agentMetrics[role];
52
- if (!metrics) {
53
- return res.status(404).json({ error: `Agent not found: ${req.params.role}` });
54
- }
55
- res.json(metrics);
56
- });
57
- /**
58
- * GET /api/evaluation/personas
59
- *
60
- * Returns metrics for all personas/themes.
61
- *
62
- * Response 200: Record<string, PersonaMetrics>
63
- * Response 404: { error: 'No evaluation data available' }
64
- */
65
- router.get('/personas', (_req, res) => {
66
- const evaluation = getEvaluation();
67
- if (!evaluation) {
68
- return res.status(404).json({ error: 'No evaluation data available' });
69
- }
70
- res.json(evaluation.personaMetrics);
71
- });
72
- /**
73
- * GET /api/evaluation/tasks
74
- *
75
- * Returns metrics broken down by task type.
76
- *
77
- * Response 200: Record<string, TaskMetrics>
78
- * Response 404: { error: 'No evaluation data available' }
79
- */
80
- router.get('/tasks', (_req, res) => {
81
- const evaluation = getEvaluation();
82
- if (!evaluation) {
83
- return res.status(404).json({ error: 'No evaluation data available' });
84
- }
85
- res.json(evaluation.taskTypeMetrics);
86
- });
87
- /**
88
- * GET /api/evaluation/regression
89
- *
90
- * Returns regression alerts and trend information.
91
- *
92
- * Response 200: { alerts: RegressionAlert[], trends: Record<string, TrendDirection> }
93
- * Response 404: { error: 'No evaluation data available' }
94
- */
95
- router.get('/regression', (_req, res) => {
96
- const evaluation = getEvaluation();
97
- if (!evaluation) {
98
- return res.status(404).json({ error: 'No evaluation data available' });
99
- }
100
- // Calculate trends for each agent
101
- const trends = {};
102
- for (const role of Object.keys(evaluation.agentMetrics)) {
103
- trends[role] = detectTrend(role);
104
- }
105
- res.json({
106
- alerts: evaluation.regressionAlerts,
107
- trends,
108
- });
109
- });
110
- /**
111
- * GET /api/evaluation/recommendations
112
- *
113
- * Returns generated recommendations based on current evaluation.
114
- *
115
- * Response 200: string[]
116
- * Response 404: { error: 'No evaluation data available' }
117
- */
118
- router.get('/recommendations', (_req, res) => {
119
- const evaluation = getEvaluation();
120
- if (!evaluation) {
121
- return res.status(404).json({ error: 'No evaluation data available' });
122
- }
123
- const recommendations = generateRecommendations(evaluation);
124
- res.json(recommendations);
125
- });
126
- return router;
127
- }
1
+ // Re-export from @pennyfarthing/core (Story 98-17)
2
+ export * from '@pennyfarthing/core/dist/server/api/evaluation.js';
128
3
  //# sourceMappingURL=evaluation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"evaluation.js","sourceRoot":"","sources":["../../src/api/evaluation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EACL,aAAa,EACb,WAAW,EACX,uBAAuB,GACxB,MAAM,wBAAwB,CAAC;AAEhC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,sBAAsB;IACpC,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC;IAExB;;;;;;;OAOG;IACH,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;QAClC,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC;QAEnC,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,8BAA8B,EAAE,CAAC,CAAC;QACzE,CAAC;QAED,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;IAEH;;;;;;;OAOG;IACH,MAAM,CAAC,GAAG,CAAC,eAAe,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QACvC,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC;QAEnC,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,8BAA8B,EAAE,CAAC,CAAC;QACzE,CAAC;QAED,MAAM,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;QAC3C,MAAM,OAAO,GAAG,UAAU,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QAE9C,IAAI,CAAC,O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,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,8BAA8B,EAAE,CAAC,CAAC;QACzE,CAAC;QAED,kCAAkC;QAClC,MAAM,MAAM,GAA2B,EAAE,CAAC;QAC1C,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;YACxD,MAAM,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;QACnC,CAAC;QAED,GAAG,CAAC,IAAI,CAAC;YACP,MAAM,EAAE,UAAU,CAAC,gBAAgB;YACnC,MAAM;SACP,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH;;;;;;;OAOG;IACH,MAAM,CAAC,GAAG,CAAC,kBAAkB,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;QAC3C,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC;QAEnC,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,8BAA8B,EAAE,CAAC,CAAC;QACzE,CAAC;QAED,MAAM,eAAe,GAAG,uBAAuB,CAAC,UAAU,CAAC,CAAC;QAC5D,GAAG,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC"}
1
+ {"version":3,"file":"evaluation.js","sourceRoot":"","sources":["../../src/api/evaluation.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,cAAc,mDAAmD,CAAC"}
@@ -1,9 +1,2 @@
1
- /**
2
- * File Browser API Router
3
- *
4
- * REST endpoints for file browser functionality in web mode.
5
- * Mirrors the IPC handlers from main.ts for browser compatibility.
6
- */
7
- import { Router } from 'express';
8
- export declare function createFileBrowserRouter(getProjectDir: () => string): Router;
1
+ export * from '@pennyfarthing/core/dist/server/api/file-browser.js';
9
2
  //# sourceMappingURL=file-browser.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"file-browser.d.ts","sourceRoot":"","sources":["../../src/api/file-browser.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAMjC,wBAAgB,uBAAuB,CAAC,aAAa,EAAE,MAAM,MAAM,GAAG,MAAM,CAiH3E"}
1
+ {"version":3,"file":"file-browser.d.ts","sourceRoot":"","sources":["../../src/api/file-browser.ts"],"names":[],"mappings":"AACA,cAAc,qDAAqD,CAAC"}