@pennyfarthing/cyclist 10.3.1 → 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 (271) 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 +29 -8
  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 +45 -78
  149. package/dist/websocket.js.map +1 -1
  150. package/package.json +33 -35
  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/LICENSE +0 -14
  234. package/dist/hooks/cyclist-pretooluse-hook.d.ts +0 -60
  235. package/dist/hooks/cyclist-pretooluse-hook.d.ts.map +0 -1
  236. package/dist/hooks/cyclist-pretooluse-hook.js +0 -57
  237. package/dist/hooks/cyclist-pretooluse-hook.js.map +0 -1
  238. package/dist/hooks/pretooluse-hook.d.ts +0 -89
  239. package/dist/hooks/pretooluse-hook.d.ts.map +0 -1
  240. package/dist/hooks/pretooluse-hook.js +0 -235
  241. package/dist/hooks/pretooluse-hook.js.map +0 -1
  242. package/dist/notification-sound.d.ts +0 -59
  243. package/dist/notification-sound.d.ts.map +0 -1
  244. package/dist/notification-sound.js +0 -219
  245. package/dist/notification-sound.js.map +0 -1
  246. package/dist/plugin-loader.test.d.ts +0 -17
  247. package/dist/plugin-loader.test.d.ts.map +0 -1
  248. package/dist/plugin-loader.test.js +0 -407
  249. package/dist/plugin-loader.test.js.map +0 -1
  250. package/portraits/star-trek-tng/large/beverly-44352.png +0 -0
  251. package/portraits/star-trek-tng/large/data-55241.png +0 -0
  252. package/portraits/star-trek-tng/large/deanna-43353.png +0 -0
  253. package/portraits/star-trek-tng/large/geordi-54342.png +0 -0
  254. package/portraits/star-trek-tng/large/jean-luc-45342.png +0 -0
  255. package/portraits/star-trek-tng/large/kathryn-45332.png +0 -0
  256. package/portraits/star-trek-tng/large/miles-35342.png +0 -0
  257. package/portraits/star-trek-tng/large/q-53521.png +0 -0
  258. package/portraits/star-trek-tng/large/spock-45231.png +0 -0
  259. package/portraits/star-trek-tng/large/troi-44352.png +0 -0
  260. package/portraits/star-trek-tng/medium/beverly-44352.png +0 -0
  261. package/portraits/star-trek-tng/medium/data-55241.png +0 -0
  262. package/portraits/star-trek-tng/medium/deanna-43353.png +0 -0
  263. package/portraits/star-trek-tng/medium/geordi-54342.png +0 -0
  264. package/portraits/star-trek-tng/medium/jean-luc-45342.png +0 -0
  265. package/portraits/star-trek-tng/medium/kathryn-45332.png +0 -0
  266. package/portraits/star-trek-tng/medium/miles-35342.png +0 -0
  267. package/portraits/star-trek-tng/medium/q-53521.png +0 -0
  268. package/portraits/star-trek-tng/medium/spock-45231.png +0 -0
  269. package/portraits/star-trek-tng/medium/troi-44352.png +0 -0
  270. package/src/public/components/panels/TTYPanel.tsx +0 -299
  271. package/src/public/types/electron.d.ts +0 -18
@@ -1,235 +0,0 @@
1
- /**
2
- * Cyclist PreToolUse Hook - Core Logic
3
- *
4
- * Testable module containing all hook logic. The companion runner script
5
- * (cyclist-pretooluse-hook.js) imports from the compiled output and invokes main().
6
- *
7
- * Flow:
8
- * 1. Claude Code calls the runner script with tool info via stdin (JSON)
9
- * 2. Script reads port from .cyclist-port in project directory
10
- * 3. Script sends request to WheelHub's /api/hook-request endpoint
11
- * 4. WheelHub checks grants / shows approval modal, user decides
12
- * 5. Script receives response, outputs JSON decision to stdout
13
- * 6. Claude Code proceeds or blocks based on decision
14
- *
15
- * Per ADR-0004: All communication converges through WheelHub.
16
- *
17
- * Story: MSSCI-14320 - Update and register PreToolUse hook
18
- */
19
- import http from 'node:http';
20
- import fs from 'node:fs';
21
- import path from 'node:path';
22
- // =============================================================================
23
- // Constants
24
- // =============================================================================
25
- export const DEFAULT_PORT = 7432;
26
- export const HOST = '127.0.0.1';
27
- export const TIMEOUT_MS = 120_000; // 2 minutes for user to decide
28
- export const PORT_FILE = '.cyclist-port';
29
- export const LEGACY_PORT_FILE = '.cyclist-approval-port';
30
- export const ENDPOINT = '/api/hook-request';
31
- // =============================================================================
32
- // Project Root Detection
33
- // =============================================================================
34
- /**
35
- * Find the project root by looking for port files or .claude directory.
36
- * Walks up from startDir (defaults to cwd) until found or reaches filesystem root.
37
- */
38
- export function findProjectRoot(startDir) {
39
- let dir = startDir ?? process.cwd();
40
- const root = path.parse(dir).root;
41
- while (dir !== root) {
42
- if (fs.existsSync(path.join(dir, PORT_FILE))) {
43
- return dir;
44
- }
45
- if (fs.existsSync(path.join(dir, LEGACY_PORT_FILE))) {
46
- return dir;
47
- }
48
- if (fs.existsSync(path.join(dir, '.claude'))) {
49
- return dir;
50
- }
51
- dir = path.dirname(dir);
52
- }
53
- return null;
54
- }
55
- // =============================================================================
56
- // Port Discovery
57
- // =============================================================================
58
- /**
59
- * Read the WheelHub server port. Prefers .cyclist-port, falls back to
60
- * .cyclist-approval-port for migration compatibility, then default port.
61
- *
62
- * Mirrors hooks.py:get_cyclist_port() behavior.
63
- */
64
- export function getPort(projectRoot) {
65
- const root = projectRoot ?? findProjectRoot();
66
- if (!root) {
67
- return DEFAULT_PORT;
68
- }
69
- // Try canonical port file first
70
- const port = readPortFile(path.join(root, PORT_FILE));
71
- if (port !== null) {
72
- return port;
73
- }
74
- // Fall back to legacy port file
75
- const legacyPort = readPortFile(path.join(root, LEGACY_PORT_FILE));
76
- if (legacyPort !== null) {
77
- return legacyPort;
78
- }
79
- return DEFAULT_PORT;
80
- }
81
- /**
82
- * Read a port number from a file. Returns null if file doesn't exist or is invalid.
83
- */
84
- export function readPortFile(filePath) {
85
- if (!fs.existsSync(filePath)) {
86
- return null;
87
- }
88
- try {
89
- const content = fs.readFileSync(filePath, 'utf-8').trim();
90
- const port = parseInt(content, 10);
91
- if (!isNaN(port) && port > 0 && port < 65536) {
92
- return port;
93
- }
94
- }
95
- catch {
96
- // Fall through
97
- }
98
- return null;
99
- }
100
- // =============================================================================
101
- // Stdin Reading
102
- // =============================================================================
103
- /**
104
- * Read all stdin as JSON.
105
- */
106
- export async function readStdin() {
107
- return new Promise((resolve, reject) => {
108
- let data = '';
109
- process.stdin.setEncoding('utf8');
110
- process.stdin.on('data', (chunk) => { data += chunk; });
111
- process.stdin.on('end', () => {
112
- try {
113
- resolve(JSON.parse(data));
114
- }
115
- catch (e) {
116
- reject(new Error(`Invalid JSON input: ${e.message}`));
117
- }
118
- });
119
- process.stdin.on('error', reject);
120
- });
121
- }
122
- // =============================================================================
123
- // HTTP Request
124
- // =============================================================================
125
- /**
126
- * Send approval request to WheelHub and wait for response.
127
- * Returns { decision: "ask" } when WheelHub is unreachable (ECONNREFUSED).
128
- */
129
- export async function requestApproval(toolData, port) {
130
- const resolvedPort = port ?? getPort();
131
- const postData = JSON.stringify(toolData);
132
- return new Promise((resolve, reject) => {
133
- const options = {
134
- hostname: HOST,
135
- port: resolvedPort,
136
- path: ENDPOINT,
137
- method: 'POST',
138
- headers: {
139
- 'Content-Type': 'application/json',
140
- 'Content-Length': Buffer.byteLength(postData),
141
- },
142
- timeout: TIMEOUT_MS,
143
- };
144
- const req = http.request(options, (res) => {
145
- let data = '';
146
- res.on('data', (chunk) => { data += chunk; });
147
- res.on('end', () => {
148
- try {
149
- resolve(JSON.parse(data));
150
- }
151
- catch (e) {
152
- reject(new Error(`Invalid response from WheelHub: ${e.message}`));
153
- }
154
- });
155
- });
156
- req.on('error', (e) => {
157
- if (e.code === 'ECONNREFUSED') {
158
- resolve({ decision: 'ask', reason: 'WheelHub not running, deferring to Claude Code' });
159
- }
160
- else {
161
- reject(e);
162
- }
163
- });
164
- req.on('timeout', () => {
165
- req.destroy();
166
- reject(new Error('Approval request timed out'));
167
- });
168
- req.write(postData);
169
- req.end();
170
- });
171
- }
172
- // =============================================================================
173
- // Output Formatting
174
- // =============================================================================
175
- /**
176
- * Build the Claude Code hook output object.
177
- * MSSCI-11947: Supports updatedInput passthrough for interactive tools.
178
- */
179
- export function buildOutput(decision, reason, updatedInput) {
180
- const output = {
181
- hookSpecificOutput: {
182
- hookEventName: 'PreToolUse',
183
- permissionDecision: decision,
184
- permissionDecisionReason: reason,
185
- },
186
- };
187
- if (updatedInput) {
188
- output.hookSpecificOutput.updatedInput = updatedInput;
189
- }
190
- return output;
191
- }
192
- /**
193
- * Output decision to stdout in Claude Code hook format.
194
- */
195
- export function outputDecision(decision, reason, updatedInput) {
196
- console.log(JSON.stringify(buildOutput(decision, reason, updatedInput)));
197
- }
198
- // =============================================================================
199
- // Main Entry Point
200
- // =============================================================================
201
- /**
202
- * Main hook logic. Reads stdin, sends to WheelHub, outputs decision.
203
- * MSSCI-11947: Handles data field passthrough for interactive tools.
204
- */
205
- export async function main() {
206
- try {
207
- const toolData = await readStdin();
208
- const { tool_name, tool_input, tool_use_id, session_id } = toolData;
209
- const response = await requestApproval({
210
- toolName: tool_name,
211
- toolId: tool_use_id,
212
- input: tool_input,
213
- sessionId: session_id,
214
- });
215
- if (response.decision === 'allow') {
216
- outputDecision('allow', response.reason || 'Approved by user', response.data || null);
217
- }
218
- else if (response.decision === 'deny') {
219
- outputDecision('deny', response.reason || 'Rejected by user', response.data || null);
220
- }
221
- else if (response.decision === 'ask') {
222
- outputDecision('ask', response.reason || 'Deferred to Claude Code');
223
- }
224
- else {
225
- // Unknown decision - defer to Claude Code rather than silently allowing
226
- outputDecision('ask', 'Unknown response from WheelHub');
227
- }
228
- }
229
- catch (error) {
230
- console.error(`[cyclist-hook] Error: ${error.message}`);
231
- // Output ask so Claude Code shows its built-in dialog, don't silently allow
232
- outputDecision('ask', 'Hook error, deferring to Claude Code');
233
- }
234
- }
235
- //# sourceMappingURL=pretooluse-hook.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pretooluse-hook.js","sourceRoot":"","sources":["../../src/hooks/pretooluse-hook.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,gFAAgF;AAChF,YAAY;AACZ,gFAAgF;AAEhF,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC;AACjC,MAAM,CAAC,MAAM,IAAI,GAAG,WAAW,CAAC;AAChC,MAAM,CAAC,MAAM,UAAU,GAAG,OAAO,CAAC,CAAC,+BAA+B;AAClE,MAAM,CAAC,MAAM,SAAS,GAAG,eAAe,CAAC;AACzC,MAAM,CAAC,MAAM,gBAAgB,GAAG,wBAAwB,CAAC;AACzD,MAAM,CAAC,MAAM,QAAQ,GAAG,mBAAmB,CAAC;AA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CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,yBAA0B,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;QACnE,4EAA4E;QAC5E,cAAc,CAAC,KAAK,EAAE,sCAAsC,CAAC,CAAC;IAChE,CAAC;AACH,CAAC"}
@@ -1,59 +0,0 @@
1
- /**
2
- * Notification Sound Service (Story MSSCI-14191)
3
- *
4
- * Provides audio notifications for workflow events using Web Audio API.
5
- * Different tones for different event types:
6
- * - HANDOFF: Low tone (agent transition)
7
- * - QUESTION: Higher tone (user input needed)
8
- * - COMPLETION: Chord (workflow complete)
9
- *
10
- * State is managed in-memory but can sync with settings via loadNotificationSoundSetting().
11
- */
12
- /**
13
- * Notification event types that trigger sounds
14
- */
15
- export declare const NotificationEvent: {
16
- readonly HANDOFF: "handoff";
17
- readonly QUESTION: "question";
18
- readonly COMPLETION: "completion";
19
- };
20
- export type NotificationEventType = (typeof NotificationEvent)[keyof typeof NotificationEvent];
21
- /**
22
- * Service class for notification sounds (exported for type checking)
23
- */
24
- export declare class NotificationSound {
25
- static isEnabled(): boolean;
26
- static setEnabled(enabled: boolean): void;
27
- static play(event: NotificationEventType): Promise<void>;
28
- }
29
- /**
30
- * Check if notification sounds are enabled
31
- */
32
- export declare function isNotificationSoundEnabled(): boolean;
33
- /**
34
- * Enable or disable notification sounds
35
- */
36
- export declare function setNotificationSoundEnabled(enabled: boolean): void;
37
- /**
38
- * Load notification sound setting from REST API
39
- */
40
- export declare function loadNotificationSoundSetting(): Promise<void>;
41
- /**
42
- * Check if audio playback is permitted (handles autoplay restrictions)
43
- * Returns true if audio can play, false if user gesture is required
44
- */
45
- export declare function checkAudioPermission(): Promise<boolean>;
46
- /**
47
- * Play a notification sound for the given event type
48
- */
49
- export declare function playNotificationSound(event: NotificationEventType): Promise<void>;
50
- /**
51
- * Reset state (for testing)
52
- */
53
- export declare function resetNotificationSoundState(): void;
54
- /**
55
- * Inject a custom AudioContext class (for testing)
56
- * Pass null to use the default detection
57
- */
58
- export declare function setAudioContextClass(cls: (new () => AudioContext) | null): void;
59
- //# sourceMappingURL=notification-sound.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"notification-sound.d.ts","sourceRoot":"","sources":["../src/notification-sound.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;CAIpB,CAAC;AAEX,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC;AA0B/F;;GAEG;AACH,qBAAa,iBAAiB;IAC5B,MAAM,CAAC,SAAS,IAAI,OAAO;IAI3B,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;WAI5B,IAAI,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;CAG/D;AAED;;GAEG;AACH,wBAAgB,0BAA0B,IAAI,OAAO,CAEpD;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAElE;AAED;;GAEG;AACH,wBAAsB,4BAA4B,IAAI,OAAO,CAAC,IAAI,CAAC,CAUlE;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,OAAO,CAAC,CAa7D;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CA4BvF;AA6ED;;GAEG;AACH,wBAAgB,2BAA2B,IAAI,IAAI,CAUlD;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,CAAC,UAAU,YAAY,CAAC,GAAG,IAAI,GAAG,IAAI,CAI/E"}
@@ -1,219 +0,0 @@
1
- /**
2
- * Notification Sound Service (Story MSSCI-14191)
3
- *
4
- * Provides audio notifications for workflow events using Web Audio API.
5
- * Different tones for different event types:
6
- * - HANDOFF: Low tone (agent transition)
7
- * - QUESTION: Higher tone (user input needed)
8
- * - COMPLETION: Chord (workflow complete)
9
- *
10
- * State is managed in-memory but can sync with settings via loadNotificationSoundSetting().
11
- */
12
- // =============================================================================
13
- // Types
14
- // =============================================================================
15
- /**
16
- * Notification event types that trigger sounds
17
- */
18
- export const NotificationEvent = {
19
- HANDOFF: 'handoff', // Agent handoff / phase transition
20
- QUESTION: 'question', // User input required
21
- COMPLETION: 'completion', // Workflow completion
22
- };
23
- /**
24
- * Frequency configurations for each event type (in Hz)
25
- */
26
- const EVENT_FREQUENCIES = {
27
- [NotificationEvent.HANDOFF]: [330], // E4 - single low tone
28
- [NotificationEvent.QUESTION]: [523], // C5 - higher, attention-grabbing
29
- [NotificationEvent.COMPLETION]: [523, 659, 784], // C5-E5-G5 major chord
30
- };
31
- // =============================================================================
32
- // State
33
- // =============================================================================
34
- let soundEnabled = false;
35
- let audioContext = null;
36
- // For testing: injectable AudioContext constructor
37
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
38
- let _audioContextClass = null;
39
- // =============================================================================
40
- // Public API
41
- // =============================================================================
42
- /**
43
- * Service class for notification sounds (exported for type checking)
44
- */
45
- export class NotificationSound {
46
- static isEnabled() {
47
- return isNotificationSoundEnabled();
48
- }
49
- static setEnabled(enabled) {
50
- setNotificationSoundEnabled(enabled);
51
- }
52
- static async play(event) {
53
- return playNotificationSound(event);
54
- }
55
- }
56
- /**
57
- * Check if notification sounds are enabled
58
- */
59
- export function isNotificationSoundEnabled() {
60
- return soundEnabled;
61
- }
62
- /**
63
- * Enable or disable notification sounds
64
- */
65
- export function setNotificationSoundEnabled(enabled) {
66
- soundEnabled = enabled;
67
- }
68
- /**
69
- * Load notification sound setting from REST API
70
- */
71
- export async function loadNotificationSoundSetting() {
72
- try {
73
- const response = await fetch('/api/settings');
74
- if (response.ok) {
75
- const settings = await response.json();
76
- soundEnabled = settings?.notifications?.sound ?? false;
77
- }
78
- }
79
- catch {
80
- // Silently fail - keep current state
81
- }
82
- }
83
- /**
84
- * Check if audio playback is permitted (handles autoplay restrictions)
85
- * Returns true if audio can play, false if user gesture is required
86
- */
87
- export async function checkAudioPermission() {
88
- try {
89
- const ctx = getOrCreateAudioContext();
90
- if (!ctx)
91
- return false;
92
- if (ctx.state === 'suspended') {
93
- await ctx.resume();
94
- }
95
- return ctx.state === 'running';
96
- }
97
- catch {
98
- return false;
99
- }
100
- }
101
- /**
102
- * Play a notification sound for the given event type
103
- */
104
- export async function playNotificationSound(event) {
105
- // Exit early if disabled
106
- if (!soundEnabled) {
107
- return;
108
- }
109
- try {
110
- const ctx = getOrCreateAudioContext();
111
- if (!ctx) {
112
- return;
113
- }
114
- // Handle suspended state (autoplay restrictions)
115
- if (ctx.state === 'suspended') {
116
- await ctx.resume();
117
- }
118
- const frequencies = EVENT_FREQUENCIES[event] || EVENT_FREQUENCIES[NotificationEvent.HANDOFF];
119
- // Play each frequency in the pattern
120
- for (let i = 0; i < frequencies.length; i++) {
121
- const freq = frequencies[i];
122
- const startTime = ctx.currentTime + i * 0.1; // Slight offset for chord/arpeggio effect
123
- playTone(ctx, freq, startTime, 0.2);
124
- }
125
- }
126
- catch {
127
- // Silently fail - audio is optional
128
- }
129
- }
130
- // =============================================================================
131
- // Internal Helpers
132
- // =============================================================================
133
- /**
134
- * Get the AudioContext constructor (allows for mocking in tests)
135
- * Checks multiple locations to support different environments and test mocking
136
- */
137
- function getAudioContextClass() {
138
- // Check if a test-injected class is set
139
- if (_audioContextClass !== null) {
140
- return _audioContextClass;
141
- }
142
- // Check various locations where AudioContext might be defined
143
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
144
- const g = globalThis;
145
- if (g.AudioContext) {
146
- return g.AudioContext;
147
- }
148
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
149
- if (typeof window !== 'undefined' && window.AudioContext) {
150
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
151
- return window.AudioContext;
152
- }
153
- // webkitAudioContext for Safari
154
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
155
- if (typeof window !== 'undefined' && window.webkitAudioContext) {
156
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
157
- return window.webkitAudioContext;
158
- }
159
- return null;
160
- }
161
- /**
162
- * Get or create the shared AudioContext
163
- */
164
- function getOrCreateAudioContext() {
165
- const AudioContextClass = getAudioContextClass();
166
- if (!AudioContextClass) {
167
- return null;
168
- }
169
- if (!audioContext) {
170
- try {
171
- audioContext = new AudioContextClass();
172
- }
173
- catch {
174
- return null;
175
- }
176
- }
177
- return audioContext;
178
- }
179
- /**
180
- * Play a single tone using Web Audio API
181
- */
182
- function playTone(ctx, frequency, startTime, duration) {
183
- const oscillator = ctx.createOscillator();
184
- const gainNode = ctx.createGain();
185
- oscillator.connect(gainNode);
186
- gainNode.connect(ctx.destination);
187
- oscillator.type = 'sine';
188
- oscillator.frequency.setValueAtTime(frequency, startTime);
189
- // Envelope: quick attack, gradual decay
190
- gainNode.gain.setValueAtTime(0.3, startTime);
191
- gainNode.gain.exponentialRampToValueAtTime(0.01, startTime + duration);
192
- oscillator.start(startTime);
193
- oscillator.stop(startTime + duration);
194
- }
195
- /**
196
- * Reset state (for testing)
197
- */
198
- export function resetNotificationSoundState() {
199
- soundEnabled = false;
200
- if (audioContext) {
201
- try {
202
- audioContext.close().catch(() => { });
203
- }
204
- catch {
205
- // Ignore errors closing mock audio context
206
- }
207
- audioContext = null;
208
- }
209
- }
210
- /**
211
- * Inject a custom AudioContext class (for testing)
212
- * Pass null to use the default detection
213
- */
214
- export function setAudioContextClass(cls) {
215
- _audioContextClass = cls;
216
- // Reset the existing context so the new class is used
217
- audioContext = null;
218
- }
219
- //# sourceMappingURL=notification-sound.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"notification-sound.js","sourceRoot":"","sources":["../src/notification-sound.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,gFAAgF;AAChF,QAAQ;AACR,gFAAgF;AAEhF;;GAEG;AACH,MAAM,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H,MAAM,UAAU,oBAAoB,CAAC,GAAoC;IACvE,kBAAkB,GAAG,GAAG,CAAC;IACzB,sDAAsD;IACtD,YAAY,GAAG,IAAI,CAAC;AACtB,CAAC"}
@@ -1,17 +0,0 @@
1
- /**
2
- * Tests for Story 93-6: Plugin Router Loader for Cyclist
3
- *
4
- * Tests the dynamic discovery and mounting of API routers from installed
5
- * @pennyfarthing/* plugin packages. The loader uses the plugin discovery
6
- * system (93-3) to find plugins and mount their Express routers.
7
- *
8
- * Test categories:
9
- * 1. initPluginRouters() - Core loading behavior
10
- * 2. Plugin with API router - Benchmark plugin integration
11
- * 3. Graceful degradation - Missing packages, failed imports
12
- * 4. Cyclist starts without plugins - Empty state
13
- *
14
- * Run with: cd packages/cyclist && pnpm test
15
- */
16
- export {};
17
- //# sourceMappingURL=plugin-loader.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin-loader.test.d.ts","sourceRoot":"","sources":["../src/plugin-loader.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG"}