harnery 0.0.1 → 0.2.1

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 (445) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +84 -2
  3. package/bin/agent-coord +42 -0
  4. package/bin/agent-hook +44 -0
  5. package/bin/harn +40 -0
  6. package/dist/cli.d.ts +9 -0
  7. package/dist/cli.d.ts.map +1 -0
  8. package/dist/cli.js +18 -0
  9. package/dist/commander.d.ts +128 -0
  10. package/dist/commander.d.ts.map +1 -0
  11. package/dist/commander.js +126 -0
  12. package/dist/commands/agents.d.ts +18 -0
  13. package/dist/commands/agents.d.ts.map +1 -0
  14. package/dist/commands/agents.js +3946 -0
  15. package/dist/commands/backup.d.ts +22 -0
  16. package/dist/commands/backup.d.ts.map +1 -0
  17. package/dist/commands/backup.js +262 -0
  18. package/dist/commands/browse-ai.d.ts +4 -0
  19. package/dist/commands/browse-ai.d.ts.map +1 -0
  20. package/dist/commands/browse-ai.js +156 -0
  21. package/dist/commands/browse.d.ts +4 -0
  22. package/dist/commands/browse.d.ts.map +1 -0
  23. package/dist/commands/browse.js +590 -0
  24. package/dist/commands/callers.d.ts +4 -0
  25. package/dist/commands/callers.d.ts.map +1 -0
  26. package/dist/commands/callers.js +276 -0
  27. package/dist/commands/completion.d.ts +17 -0
  28. package/dist/commands/completion.d.ts.map +1 -0
  29. package/dist/commands/completion.js +158 -0
  30. package/dist/commands/config-get.d.ts +4 -0
  31. package/dist/commands/config-get.d.ts.map +1 -0
  32. package/dist/commands/config-get.js +131 -0
  33. package/dist/commands/context.d.ts +11 -0
  34. package/dist/commands/context.d.ts.map +1 -0
  35. package/dist/commands/context.js +185 -0
  36. package/dist/commands/cookies.d.ts +4 -0
  37. package/dist/commands/cookies.d.ts.map +1 -0
  38. package/dist/commands/cookies.js +140 -0
  39. package/dist/commands/docs.d.ts +4 -0
  40. package/dist/commands/docs.d.ts.map +1 -0
  41. package/dist/commands/docs.js +137 -0
  42. package/dist/commands/doctor.d.ts +25 -0
  43. package/dist/commands/doctor.d.ts.map +1 -0
  44. package/dist/commands/doctor.js +200 -0
  45. package/dist/commands/edit-batch.d.ts +18 -0
  46. package/dist/commands/edit-batch.d.ts.map +1 -0
  47. package/dist/commands/edit-batch.js +172 -0
  48. package/dist/commands/eml.d.ts +4 -0
  49. package/dist/commands/eml.d.ts.map +1 -0
  50. package/dist/commands/eml.js +428 -0
  51. package/dist/commands/env.d.ts +4 -0
  52. package/dist/commands/env.d.ts.map +1 -0
  53. package/dist/commands/env.js +201 -0
  54. package/dist/commands/fetch.d.ts +4 -0
  55. package/dist/commands/fetch.d.ts.map +1 -0
  56. package/dist/commands/fetch.js +99 -0
  57. package/dist/commands/file-history.d.ts +4 -0
  58. package/dist/commands/file-history.d.ts.map +1 -0
  59. package/dist/commands/file-history.js +152 -0
  60. package/dist/commands/grep.d.ts +4 -0
  61. package/dist/commands/grep.d.ts.map +1 -0
  62. package/dist/commands/grep.js +317 -0
  63. package/dist/commands/init.d.ts +82 -0
  64. package/dist/commands/init.d.ts.map +1 -0
  65. package/dist/commands/init.js +288 -0
  66. package/dist/commands/outline.d.ts +4 -0
  67. package/dist/commands/outline.d.ts.map +1 -0
  68. package/dist/commands/outline.js +509 -0
  69. package/dist/commands/presence.d.ts +12 -0
  70. package/dist/commands/presence.d.ts.map +1 -0
  71. package/dist/commands/presence.js +123 -0
  72. package/dist/commands/read.d.ts +7 -0
  73. package/dist/commands/read.d.ts.map +1 -0
  74. package/dist/commands/read.js +46 -0
  75. package/dist/commands/scratch.d.ts +4 -0
  76. package/dist/commands/scratch.d.ts.map +1 -0
  77. package/dist/commands/scratch.js +426 -0
  78. package/dist/commands/session.d.ts +4 -0
  79. package/dist/commands/session.d.ts.map +1 -0
  80. package/dist/commands/session.js +162 -0
  81. package/dist/commands/sync.d.ts +24 -0
  82. package/dist/commands/sync.d.ts.map +1 -0
  83. package/dist/commands/sync.js +275 -0
  84. package/dist/commands/toc.d.ts +5 -0
  85. package/dist/commands/toc.d.ts.map +1 -0
  86. package/dist/commands/toc.js +153 -0
  87. package/dist/commands/tokens.d.ts +4 -0
  88. package/dist/commands/tokens.d.ts.map +1 -0
  89. package/dist/commands/tokens.js +48 -0
  90. package/dist/commands/tunnel.d.ts +4 -0
  91. package/dist/commands/tunnel.d.ts.map +1 -0
  92. package/dist/commands/tunnel.js +513 -0
  93. package/dist/commands/uninstall.d.ts +22 -0
  94. package/dist/commands/uninstall.d.ts.map +1 -0
  95. package/dist/commands/uninstall.js +126 -0
  96. package/dist/commands/web.d.ts +4 -0
  97. package/dist/commands/web.d.ts.map +1 -0
  98. package/dist/commands/web.js +165 -0
  99. package/dist/core/agents/canonical-emit.d.ts +27 -0
  100. package/dist/core/agents/canonical-emit.d.ts.map +1 -0
  101. package/dist/core/agents/canonical-emit.js +72 -0
  102. package/dist/core/agents/cli-emit.d.ts +27 -0
  103. package/dist/core/agents/cli-emit.d.ts.map +1 -0
  104. package/dist/core/agents/cli-emit.js +57 -0
  105. package/dist/core/agents/cli.d.ts +10 -0
  106. package/dist/core/agents/cli.d.ts.map +1 -0
  107. package/dist/core/agents/cli.js +757 -0
  108. package/dist/core/agents/codex-replay.d.ts +29 -0
  109. package/dist/core/agents/codex-replay.d.ts.map +1 -0
  110. package/dist/core/agents/codex-replay.js +138 -0
  111. package/dist/core/agents/coord-client.d.ts +98 -0
  112. package/dist/core/agents/coord-client.d.ts.map +1 -0
  113. package/dist/core/agents/coord-client.js +212 -0
  114. package/dist/core/agents/events/consume.d.ts +59 -0
  115. package/dist/core/agents/events/consume.d.ts.map +1 -0
  116. package/dist/core/agents/events/consume.js +147 -0
  117. package/dist/core/agents/events/emit.d.ts +42 -0
  118. package/dist/core/agents/events/emit.d.ts.map +1 -0
  119. package/dist/core/agents/events/emit.js +70 -0
  120. package/dist/core/agents/events/ulid.d.ts +11 -0
  121. package/dist/core/agents/events/ulid.d.ts.map +1 -0
  122. package/dist/core/agents/events/ulid.js +47 -0
  123. package/dist/core/agents/index.d.ts +14 -0
  124. package/dist/core/agents/index.d.ts.map +1 -0
  125. package/dist/core/agents/index.js +13 -0
  126. package/dist/core/agents/paths.d.ts +6 -0
  127. package/dist/core/agents/paths.d.ts.map +1 -0
  128. package/dist/core/agents/paths.js +17 -0
  129. package/dist/core/agents/render/prompt-context.d.ts +43 -0
  130. package/dist/core/agents/render/prompt-context.d.ts.map +1 -0
  131. package/dist/core/agents/render/prompt-context.js +335 -0
  132. package/dist/core/agents/render/session-context.d.ts +39 -0
  133. package/dist/core/agents/render/session-context.d.ts.map +1 -0
  134. package/dist/core/agents/render/session-context.js +283 -0
  135. package/dist/core/agents/rules/claim-conflict.d.ts +35 -0
  136. package/dist/core/agents/rules/claim-conflict.d.ts.map +1 -0
  137. package/dist/core/agents/rules/claim-conflict.js +244 -0
  138. package/dist/core/agents/rules/commit-conflict.d.ts +59 -0
  139. package/dist/core/agents/rules/commit-conflict.d.ts.map +1 -0
  140. package/dist/core/agents/rules/commit-conflict.js +244 -0
  141. package/dist/core/agents/rules/stop-hook.d.ts +44 -0
  142. package/dist/core/agents/rules/stop-hook.d.ts.map +1 -0
  143. package/dist/core/agents/rules/stop-hook.js +161 -0
  144. package/dist/core/agents/session-events.d.ts +41 -0
  145. package/dist/core/agents/session-events.d.ts.map +1 -0
  146. package/dist/core/agents/session-events.js +205 -0
  147. package/dist/core/agents/state/activity-log.d.ts +18 -0
  148. package/dist/core/agents/state/activity-log.d.ts.map +1 -0
  149. package/dist/core/agents/state/activity-log.js +34 -0
  150. package/dist/core/agents/state/council.d.ts +39 -0
  151. package/dist/core/agents/state/council.d.ts.map +1 -0
  152. package/dist/core/agents/state/council.js +216 -0
  153. package/dist/core/agents/state/heartbeat-projector.d.ts +59 -0
  154. package/dist/core/agents/state/heartbeat-projector.d.ts.map +1 -0
  155. package/dist/core/agents/state/heartbeat-projector.js +436 -0
  156. package/dist/core/agents/state/heartbeat-writer.d.ts +64 -0
  157. package/dist/core/agents/state/heartbeat-writer.d.ts.map +1 -0
  158. package/dist/core/agents/state/heartbeat-writer.js +271 -0
  159. package/dist/core/agents/state/names.d.ts +35 -0
  160. package/dist/core/agents/state/names.d.ts.map +1 -0
  161. package/dist/core/agents/state/names.js +376 -0
  162. package/dist/core/agents/state/pidmap.d.ts +11 -0
  163. package/dist/core/agents/state/pidmap.d.ts.map +1 -0
  164. package/dist/core/agents/state/pidmap.js +32 -0
  165. package/dist/core/agents/state/scratch.d.ts +27 -0
  166. package/dist/core/agents/state/scratch.d.ts.map +1 -0
  167. package/dist/core/agents/state/scratch.js +90 -0
  168. package/dist/core/agents/state/shell-mutation.d.ts +17 -0
  169. package/dist/core/agents/state/shell-mutation.d.ts.map +1 -0
  170. package/dist/core/agents/state/shell-mutation.js +41 -0
  171. package/dist/core/agents/state/stale-sweep.d.ts +16 -0
  172. package/dist/core/agents/state/stale-sweep.d.ts.map +1 -0
  173. package/dist/core/agents/state/stale-sweep.js +166 -0
  174. package/dist/core/config.d.ts +29 -0
  175. package/dist/core/config.d.ts.map +1 -0
  176. package/dist/core/config.js +108 -0
  177. package/dist/core/hooks/cli.d.ts +21 -0
  178. package/dist/core/hooks/cli.d.ts.map +1 -0
  179. package/dist/core/hooks/cli.js +1123 -0
  180. package/dist/core/hooks/effects/image-capture.d.ts +43 -0
  181. package/dist/core/hooks/effects/image-capture.d.ts.map +1 -0
  182. package/dist/core/hooks/effects/image-capture.js +288 -0
  183. package/dist/core/hooks/effects/index.d.ts +64 -0
  184. package/dist/core/hooks/effects/index.d.ts.map +1 -0
  185. package/dist/core/hooks/effects/index.js +197 -0
  186. package/dist/core/hooks/events/emit.d.ts +31 -0
  187. package/dist/core/hooks/events/emit.d.ts.map +1 -0
  188. package/dist/core/hooks/events/emit.js +89 -0
  189. package/dist/core/hooks/events/schema.d.ts +235 -0
  190. package/dist/core/hooks/events/schema.d.ts.map +1 -0
  191. package/dist/core/hooks/events/schema.js +12 -0
  192. package/dist/core/hooks/events/ulid.d.ts +10 -0
  193. package/dist/core/hooks/events/ulid.d.ts.map +1 -0
  194. package/dist/core/hooks/events/ulid.js +47 -0
  195. package/dist/core/hooks/harness/detect.d.ts +9 -0
  196. package/dist/core/hooks/harness/detect.d.ts.map +1 -0
  197. package/dist/core/hooks/harness/detect.js +29 -0
  198. package/dist/core/hooks/harness/events.d.ts +45 -0
  199. package/dist/core/hooks/harness/events.d.ts.map +1 -0
  200. package/dist/core/hooks/harness/events.js +71 -0
  201. package/dist/core/hooks/harness/output.d.ts +46 -0
  202. package/dist/core/hooks/harness/output.d.ts.map +1 -0
  203. package/dist/core/hooks/harness/output.js +87 -0
  204. package/dist/core/hooks/harness/parse.d.ts +67 -0
  205. package/dist/core/hooks/harness/parse.d.ts.map +1 -0
  206. package/dist/core/hooks/harness/parse.js +132 -0
  207. package/dist/core/hooks/index.d.ts +8 -0
  208. package/dist/core/hooks/index.d.ts.map +1 -0
  209. package/dist/core/hooks/index.js +7 -0
  210. package/dist/core/hooks/resolve/anchor.d.ts +37 -0
  211. package/dist/core/hooks/resolve/anchor.d.ts.map +1 -0
  212. package/dist/core/hooks/resolve/anchor.js +48 -0
  213. package/dist/core/hooks/resolve/coord-root.d.ts +6 -0
  214. package/dist/core/hooks/resolve/coord-root.d.ts.map +1 -0
  215. package/dist/core/hooks/resolve/coord-root.js +27 -0
  216. package/dist/core/hooks/resolve/intent.d.ts +33 -0
  217. package/dist/core/hooks/resolve/intent.d.ts.map +1 -0
  218. package/dist/core/hooks/resolve/intent.js +79 -0
  219. package/dist/core/hooks/resolve/owner.d.ts +42 -0
  220. package/dist/core/hooks/resolve/owner.d.ts.map +1 -0
  221. package/dist/core/hooks/resolve/owner.js +140 -0
  222. package/dist/core/hooks/resolve/transcript.d.ts +26 -0
  223. package/dist/core/hooks/resolve/transcript.d.ts.map +1 -0
  224. package/dist/core/hooks/resolve/transcript.js +73 -0
  225. package/dist/index.d.ts +15 -0
  226. package/dist/index.d.ts.map +1 -0
  227. package/dist/index.js +13 -0
  228. package/dist/lib/agent-browser/client.d.ts +99 -0
  229. package/dist/lib/agent-browser/client.d.ts.map +1 -0
  230. package/dist/lib/agent-browser/client.js +177 -0
  231. package/dist/lib/agent-browser/index.d.ts +2 -0
  232. package/dist/lib/agent-browser/index.d.ts.map +1 -0
  233. package/dist/lib/agent-browser/index.js +1 -0
  234. package/dist/lib/browser/client.d.ts +193 -0
  235. package/dist/lib/browser/client.d.ts.map +1 -0
  236. package/dist/lib/browser/client.js +325 -0
  237. package/dist/lib/browser/dev-overlay.d.ts +23 -0
  238. package/dist/lib/browser/dev-overlay.d.ts.map +1 -0
  239. package/dist/lib/browser/dev-overlay.js +153 -0
  240. package/dist/lib/browser/index.d.ts +5 -0
  241. package/dist/lib/browser/index.d.ts.map +1 -0
  242. package/dist/lib/browser/index.js +2 -0
  243. package/dist/lib/browser/layout.d.ts +79 -0
  244. package/dist/lib/browser/layout.d.ts.map +1 -0
  245. package/dist/lib/browser/layout.js +220 -0
  246. package/dist/lib/browser/visibility.d.ts +86 -0
  247. package/dist/lib/browser/visibility.d.ts.map +1 -0
  248. package/dist/lib/browser/visibility.js +333 -0
  249. package/dist/lib/browser/visual-diff.d.ts +38 -0
  250. package/dist/lib/browser/visual-diff.d.ts.map +1 -0
  251. package/dist/lib/browser/visual-diff.js +107 -0
  252. package/dist/lib/completion/bash.d.ts +25 -0
  253. package/dist/lib/completion/bash.d.ts.map +1 -0
  254. package/dist/lib/completion/bash.js +284 -0
  255. package/dist/lib/completion/fish.d.ts +16 -0
  256. package/dist/lib/completion/fish.d.ts.map +1 -0
  257. package/dist/lib/completion/fish.js +118 -0
  258. package/dist/lib/completion/index.d.ts +5 -0
  259. package/dist/lib/completion/index.d.ts.map +1 -0
  260. package/dist/lib/completion/index.js +4 -0
  261. package/dist/lib/completion/walk.d.ts +68 -0
  262. package/dist/lib/completion/walk.d.ts.map +1 -0
  263. package/dist/lib/completion/walk.js +102 -0
  264. package/dist/lib/completion/zsh.d.ts +13 -0
  265. package/dist/lib/completion/zsh.d.ts.map +1 -0
  266. package/dist/lib/completion/zsh.js +249 -0
  267. package/dist/lib/context/index.d.ts +107 -0
  268. package/dist/lib/context/index.d.ts.map +1 -0
  269. package/dist/lib/context/index.js +275 -0
  270. package/dist/lib/cookies/client.d.ts +131 -0
  271. package/dist/lib/cookies/client.d.ts.map +1 -0
  272. package/dist/lib/cookies/client.js +239 -0
  273. package/dist/lib/cookies/index.d.ts +2 -0
  274. package/dist/lib/cookies/index.d.ts.map +1 -0
  275. package/dist/lib/cookies/index.js +1 -0
  276. package/dist/lib/council/index.d.ts +266 -0
  277. package/dist/lib/council/index.d.ts.map +1 -0
  278. package/dist/lib/council/index.js +674 -0
  279. package/dist/lib/docs-index.d.ts +28 -0
  280. package/dist/lib/docs-index.d.ts.map +1 -0
  281. package/dist/lib/docs-index.js +169 -0
  282. package/dist/lib/docs-lint.d.ts +26 -0
  283. package/dist/lib/docs-lint.d.ts.map +1 -0
  284. package/dist/lib/docs-lint.js +378 -0
  285. package/dist/lib/docs-sweep.d.ts +34 -0
  286. package/dist/lib/docs-sweep.d.ts.map +1 -0
  287. package/dist/lib/docs-sweep.js +304 -0
  288. package/dist/lib/docs.d.ts +27 -0
  289. package/dist/lib/docs.d.ts.map +1 -0
  290. package/dist/lib/docs.js +142 -0
  291. package/dist/lib/env.d.ts +11 -0
  292. package/dist/lib/env.d.ts.map +1 -0
  293. package/dist/lib/env.js +12 -0
  294. package/dist/lib/exec.d.ts +32 -0
  295. package/dist/lib/exec.d.ts.map +1 -0
  296. package/dist/lib/exec.js +54 -0
  297. package/dist/lib/format.d.ts +29 -0
  298. package/dist/lib/format.d.ts.map +1 -0
  299. package/dist/lib/format.js +139 -0
  300. package/dist/lib/http/client.d.ts +56 -0
  301. package/dist/lib/http/client.d.ts.map +1 -0
  302. package/dist/lib/http/client.js +160 -0
  303. package/dist/lib/http/index.d.ts +2 -0
  304. package/dist/lib/http/index.d.ts.map +1 -0
  305. package/dist/lib/http/index.js +1 -0
  306. package/dist/lib/identities/index.d.ts +77 -0
  307. package/dist/lib/identities/index.d.ts.map +1 -0
  308. package/dist/lib/identities/index.js +190 -0
  309. package/dist/lib/machine.d.ts +19 -0
  310. package/dist/lib/machine.d.ts.map +1 -0
  311. package/dist/lib/machine.js +61 -0
  312. package/dist/lib/presence.d.ts +48 -0
  313. package/dist/lib/presence.d.ts.map +1 -0
  314. package/dist/lib/presence.js +123 -0
  315. package/dist/lib/readability/client.d.ts +39 -0
  316. package/dist/lib/readability/client.d.ts.map +1 -0
  317. package/dist/lib/readability/client.js +121 -0
  318. package/dist/lib/readability/index.d.ts +2 -0
  319. package/dist/lib/readability/index.d.ts.map +1 -0
  320. package/dist/lib/readability/index.js +1 -0
  321. package/dist/lib/scratch/index.d.ts +74 -0
  322. package/dist/lib/scratch/index.d.ts.map +1 -0
  323. package/dist/lib/scratch/index.js +393 -0
  324. package/dist/lib/tunnel/gate.d.ts +12 -0
  325. package/dist/lib/tunnel/gate.d.ts.map +1 -0
  326. package/dist/lib/tunnel/gate.js +101 -0
  327. package/dist/lib/tunnel/state.d.ts +34 -0
  328. package/dist/lib/tunnel/state.d.ts.map +1 -0
  329. package/dist/lib/tunnel/state.js +132 -0
  330. package/package.json +160 -8
  331. package/schemas/.gitkeep +0 -0
  332. package/schemas/config.schema.json +109 -0
  333. package/src/cli.ts +22 -0
  334. package/src/commander.ts +242 -0
  335. package/src/commands/.gitkeep +0 -0
  336. package/src/commands/agents.ts +4567 -0
  337. package/src/commands/backup.ts +305 -0
  338. package/src/commands/browse-ai.ts +198 -0
  339. package/src/commands/browse.ts +849 -0
  340. package/src/commands/callers.ts +363 -0
  341. package/src/commands/completion.ts +193 -0
  342. package/src/commands/config-get.ts +161 -0
  343. package/src/commands/context.ts +209 -0
  344. package/src/commands/cookies.ts +198 -0
  345. package/src/commands/docs.ts +174 -0
  346. package/src/commands/doctor.ts +231 -0
  347. package/src/commands/edit-batch.ts +233 -0
  348. package/src/commands/eml.ts +519 -0
  349. package/src/commands/env.ts +254 -0
  350. package/src/commands/fetch.ts +136 -0
  351. package/src/commands/file-history.ts +202 -0
  352. package/src/commands/grep.ts +371 -0
  353. package/src/commands/init.ts +335 -0
  354. package/src/commands/outline.ts +583 -0
  355. package/src/commands/presence.ts +152 -0
  356. package/src/commands/read.ts +64 -0
  357. package/src/commands/scratch.ts +445 -0
  358. package/src/commands/session.ts +187 -0
  359. package/src/commands/sync.ts +306 -0
  360. package/src/commands/toc.ts +218 -0
  361. package/src/commands/tokens.ts +79 -0
  362. package/src/commands/tunnel.ts +633 -0
  363. package/src/commands/uninstall.ts +144 -0
  364. package/src/commands/web.ts +193 -0
  365. package/src/core/agents/canonical-emit.ts +77 -0
  366. package/src/core/agents/cli-emit.ts +64 -0
  367. package/src/core/agents/cli.ts +838 -0
  368. package/src/core/agents/codex-replay.ts +163 -0
  369. package/src/core/agents/coord-client.ts +249 -0
  370. package/src/core/agents/events/consume.ts +196 -0
  371. package/src/core/agents/events/emit.ts +108 -0
  372. package/src/core/agents/events/ulid.ts +51 -0
  373. package/src/core/agents/index.ts +14 -0
  374. package/src/core/agents/paths.ts +16 -0
  375. package/src/core/agents/render/prompt-context.ts +401 -0
  376. package/src/core/agents/render/session-context.ts +341 -0
  377. package/src/core/agents/rules/claim-conflict.ts +282 -0
  378. package/src/core/agents/rules/commit-conflict.ts +303 -0
  379. package/src/core/agents/rules/stop-hook.ts +229 -0
  380. package/src/core/agents/session-events.ts +228 -0
  381. package/src/core/agents/state/activity-log.ts +33 -0
  382. package/src/core/agents/state/council.ts +265 -0
  383. package/src/core/agents/state/heartbeat-projector.ts +488 -0
  384. package/src/core/agents/state/heartbeat-writer.ts +333 -0
  385. package/src/core/agents/state/names.ts +399 -0
  386. package/src/core/agents/state/pidmap.ts +38 -0
  387. package/src/core/agents/state/scratch.ts +121 -0
  388. package/src/core/agents/state/shell-mutation.ts +44 -0
  389. package/src/core/agents/state/stale-sweep.ts +190 -0
  390. package/src/core/config.ts +111 -0
  391. package/src/core/hooks/cli.ts +1247 -0
  392. package/src/core/hooks/effects/image-capture.ts +330 -0
  393. package/src/core/hooks/effects/index.ts +210 -0
  394. package/src/core/hooks/events/emit.ts +120 -0
  395. package/src/core/hooks/events/schema.ts +430 -0
  396. package/src/core/hooks/events/ulid.ts +51 -0
  397. package/src/core/hooks/harness/detect.ts +30 -0
  398. package/src/core/hooks/harness/events.ts +102 -0
  399. package/src/core/hooks/harness/output.ts +100 -0
  400. package/src/core/hooks/harness/parse.ts +180 -0
  401. package/src/core/hooks/index.ts +16 -0
  402. package/src/core/hooks/resolve/anchor.ts +51 -0
  403. package/src/core/hooks/resolve/coord-root.ts +25 -0
  404. package/src/core/hooks/resolve/intent.ts +89 -0
  405. package/src/core/hooks/resolve/owner.ts +140 -0
  406. package/src/core/hooks/resolve/transcript.ts +72 -0
  407. package/src/hooks/.gitkeep +0 -0
  408. package/src/index.ts +15 -0
  409. package/src/lib/agent-browser/client.ts +239 -0
  410. package/src/lib/agent-browser/index.ts +1 -0
  411. package/src/lib/browser/client.ts +449 -0
  412. package/src/lib/browser/dev-overlay.ts +207 -0
  413. package/src/lib/browser/index.ts +24 -0
  414. package/src/lib/browser/layout.ts +288 -0
  415. package/src/lib/browser/visibility.ts +419 -0
  416. package/src/lib/browser/visual-diff.ts +150 -0
  417. package/src/lib/completion/bash.ts +291 -0
  418. package/src/lib/completion/fish.ts +134 -0
  419. package/src/lib/completion/index.ts +10 -0
  420. package/src/lib/completion/walk.ts +184 -0
  421. package/src/lib/completion/zsh.ts +262 -0
  422. package/src/lib/context/index.ts +386 -0
  423. package/src/lib/cookies/client.ts +301 -0
  424. package/src/lib/cookies/index.ts +13 -0
  425. package/src/lib/council/index.ts +803 -0
  426. package/src/lib/docs-index.ts +216 -0
  427. package/src/lib/docs-lint.ts +413 -0
  428. package/src/lib/docs-sweep.ts +348 -0
  429. package/src/lib/docs.ts +199 -0
  430. package/src/lib/env.ts +12 -0
  431. package/src/lib/exec.ts +74 -0
  432. package/src/lib/format.ts +147 -0
  433. package/src/lib/http/client.ts +211 -0
  434. package/src/lib/http/index.ts +1 -0
  435. package/src/lib/identities/index.ts +210 -0
  436. package/src/lib/machine.ts +61 -0
  437. package/src/lib/presence.ts +154 -0
  438. package/src/lib/readability/client.ts +169 -0
  439. package/src/lib/readability/index.ts +5 -0
  440. package/src/lib/readability/turndown-plugin-gfm.d.ts +10 -0
  441. package/src/lib/scratch/index.ts +470 -0
  442. package/src/lib/tunnel/gate.ts +113 -0
  443. package/src/lib/tunnel/state.ts +167 -0
  444. package/src/web/.gitkeep +0 -0
  445. package/index.js +0 -1
@@ -0,0 +1,430 @@
1
+ /**
2
+ * Canonical event schema v1. Inter-module contract between agent-hooks (writer)
3
+ * and agent-coord (consumer + projector).
4
+ *
5
+ * Schema evolution rules:
6
+ * - Forward-compatible only within a major version. Consumers ignore unknown
7
+ * fields. Adding an optional field is a minor bump; removing or retyping a
8
+ * field is a major bump.
9
+ * - Mixed-version streams are legal during migrations; consumers branch on
10
+ * `schema_version`.
11
+ */
12
+
13
+ export const SCHEMA_VERSION = 1 as const;
14
+
15
+ export type Harness = "claude-code" | "cursor" | "codex";
16
+
17
+ export type Source = "agent-hooks" | "agent-coord" | "user" | "system";
18
+
19
+ /**
20
+ * Common envelope every event carries. Tool events, `user_prompt.submit`, and
21
+ * `turn.stop` MUST carry `turn_id`; CLI/state/council/presence/health/session
22
+ * events MAY carry `turn_id` when agent-coord can bind them to the active turn
23
+ * for that owner.
24
+ */
25
+ export interface EventEnvelope<TType extends string, TData> {
26
+ schema_version: typeof SCHEMA_VERSION;
27
+ event_id: string; // ULID, sortable, unique
28
+ event_type: TType;
29
+ ts: string; // ISO-8601 with milliseconds
30
+ instance_id: string; // resolved by agent-hooks
31
+ session_id: string; // harness-level session
32
+ parent_session_id?: string; // present iff event is from a subagent
33
+ turn_id?: string; // present when event is bound to an assistant turn
34
+ parent_turn_id?: string; // present iff this turn is nested under another
35
+ harness: Harness;
36
+ source: Source;
37
+ data: TData;
38
+ }
39
+
40
+ // ── event catalog ───────────────────────────────────────────────────────
41
+
42
+ // Lifecycle
43
+ export type SessionStart = EventEnvelope<
44
+ "session.start",
45
+ {
46
+ started_at: string;
47
+ cwd: string;
48
+ model?: string;
49
+ pid: number;
50
+ }
51
+ >;
52
+
53
+ export type SessionEnd = EventEnvelope<
54
+ "session.end",
55
+ {
56
+ ended_at: string;
57
+ clean_exit: boolean;
58
+ }
59
+ >;
60
+
61
+ export type SubagentStart = EventEnvelope<
62
+ "subagent.start",
63
+ {
64
+ agent_type: string;
65
+ prompt_summary?: string;
66
+ }
67
+ >;
68
+
69
+ export type SubagentStop = EventEnvelope<
70
+ "subagent.stop",
71
+ {
72
+ exit_status: "ok" | "error" | "interrupted";
73
+ }
74
+ >;
75
+
76
+ export type UserPromptSubmit = EventEnvelope<
77
+ "user_prompt.submit",
78
+ {
79
+ prompt_text: string; // clamped
80
+ truncated?: boolean;
81
+ }
82
+ >;
83
+
84
+ export type TurnStop = EventEnvelope<
85
+ "turn.stop",
86
+ {
87
+ tool_call_count: number;
88
+ text_length: number;
89
+ status_box_present: boolean; // adapter sets via transcript scan for `┌─ agent-` prefix
90
+ }
91
+ >;
92
+
93
+ // Session-telemetry (merge path)
94
+ export type CommandStart = EventEnvelope<
95
+ "command.start",
96
+ {
97
+ cmd_id: string;
98
+ intent?: string;
99
+ cmd: string;
100
+ }
101
+ >;
102
+
103
+ export type CommandOutput = EventEnvelope<
104
+ "command.output",
105
+ {
106
+ cmd_id: string;
107
+ stream: "stdout" | "stderr";
108
+ line: string;
109
+ }
110
+ >;
111
+
112
+ export type CommandEnd = EventEnvelope<
113
+ "command.end",
114
+ {
115
+ cmd_id: string;
116
+ exit: number;
117
+ duration_ms: number;
118
+ signal?: string;
119
+ }
120
+ >;
121
+
122
+ export type Narration = EventEnvelope<
123
+ "narration",
124
+ {
125
+ message: string;
126
+ }
127
+ >;
128
+
129
+ // Tools
130
+ export type ToolPreUse = EventEnvelope<
131
+ "tool.pre_use",
132
+ {
133
+ tool_name: string;
134
+ tool_input: unknown; // clamped to 8000 chars when stringified
135
+ intent?: string;
136
+ truncated?: boolean;
137
+ }
138
+ >;
139
+
140
+ export type ToolPostUse = EventEnvelope<
141
+ "tool.post_use",
142
+ {
143
+ tool_name: string;
144
+ output_summary: string; // first 500 + last 500
145
+ exit_status: "ok" | "error";
146
+ duration_ms: number;
147
+ truncated?: boolean;
148
+ }
149
+ >;
150
+
151
+ export type ToolPostUseFailure = EventEnvelope<
152
+ "tool.post_use_failure",
153
+ {
154
+ tool_name: string;
155
+ error: string;
156
+ duration_ms: number;
157
+ }
158
+ >;
159
+
160
+ export type ToolOutputChunk = EventEnvelope<
161
+ "tool.output_chunk",
162
+ {
163
+ chunk: string;
164
+ chunk_no: number;
165
+ stream: "stdout" | "stderr";
166
+ truncated?: boolean;
167
+ }
168
+ >;
169
+
170
+ /**
171
+ * An image an agent viewed (Read tool) or produced (a Bash command wrote it).
172
+ * Emitted by agent-hooks as a side-effect of a tool event when the tool
173
+ * references an image path on disk; the bytes are content-addressed into
174
+ * `.harnery/images/<hash>.<ext>` (dedup) and this event records the provenance
175
+ * for the web image feed. Grouped by `hash` downstream → one card per distinct
176
+ * image with a touch timeline.
177
+ */
178
+ export type ImageCaptured = EventEnvelope<
179
+ "image.captured",
180
+ {
181
+ hash: string; // sha256 of the file bytes, also the blob's basename
182
+ ext: string; // png | jpg | jpeg | gif | webp | bmp | svg
183
+ bytes: number;
184
+ role: "viewed" | "produced";
185
+ source_path: string; // repo-relative when under coordRoot, else absolute
186
+ tool_name: string; // "Read" (viewed) | "Bash" (produced)
187
+ tool_use_id?: string;
188
+ intent?: string; // present for viewed (carried from the tool event)
189
+ command_head?: string; // present for produced (first ~120 chars of the cmd)
190
+ }
191
+ >;
192
+
193
+ // File claims
194
+ export type ClaimAcquire = EventEnvelope<
195
+ "claim.acquire",
196
+ {
197
+ path: string;
198
+ mode: "read" | "write";
199
+ }
200
+ >;
201
+
202
+ export type ClaimRelease = EventEnvelope<
203
+ "claim.release",
204
+ {
205
+ path: string;
206
+ reason: "explicit" | "turn_end" | "session_end" | "heal";
207
+ }
208
+ >;
209
+
210
+ export type ClaimConflict = EventEnvelope<
211
+ "claim.conflict",
212
+ {
213
+ path: string;
214
+ peer_instance_id: string;
215
+ reason?: "ordering_violation" | "concurrent_write";
216
+ }
217
+ >;
218
+
219
+ // Coord state
220
+ export type StateTaskSet = EventEnvelope<
221
+ "state.task_set",
222
+ {
223
+ task: string;
224
+ cleared: boolean;
225
+ }
226
+ >;
227
+
228
+ export type StateStatusChecked = EventEnvelope<
229
+ "state.status_checked",
230
+ {
231
+ format: "box" | "json" | "table";
232
+ agent_count: number;
233
+ included_self: boolean;
234
+ }
235
+ >;
236
+
237
+ export type StateScratchAppend = EventEnvelope<
238
+ "state.scratch_append",
239
+ {
240
+ category: "note" | "plan" | "decision" | "blocker" | "question" | "done" | "handoff";
241
+ body_summary: string;
242
+ }
243
+ >;
244
+
245
+ export type StatePresenceChange = EventEnvelope<
246
+ "state.presence_change",
247
+ {
248
+ from: "mobile" | "office";
249
+ to: "mobile" | "office";
250
+ source: "hook" | "cli" | "user";
251
+ }
252
+ >;
253
+
254
+ export type StateHeartbeat = EventEnvelope<"state.heartbeat", Record<string, never>>;
255
+
256
+ // Council
257
+ export type CouncilOpen = EventEnvelope<
258
+ "council.open",
259
+ {
260
+ council_id: string;
261
+ topic: string;
262
+ members: string[];
263
+ target_doc?: string;
264
+ }
265
+ >;
266
+
267
+ export type CouncilRoundOpen = EventEnvelope<
268
+ "council.round_open",
269
+ {
270
+ council_id: string;
271
+ round_no: number;
272
+ }
273
+ >;
274
+
275
+ export type CouncilContribution = EventEnvelope<
276
+ "council.contribution",
277
+ {
278
+ council_id: string;
279
+ round_no: number;
280
+ member: string;
281
+ body_summary: string;
282
+ }
283
+ >;
284
+
285
+ export type CouncilRoundClose = EventEnvelope<
286
+ "council.round_close",
287
+ {
288
+ council_id: string;
289
+ round_no: number;
290
+ }
291
+ >;
292
+
293
+ export type CouncilClose = EventEnvelope<
294
+ "council.close",
295
+ {
296
+ council_id: string;
297
+ closed_at: string;
298
+ }
299
+ >;
300
+
301
+ export type CouncilArchive = EventEnvelope<
302
+ "council.archive",
303
+ {
304
+ council_id: string;
305
+ }
306
+ >;
307
+
308
+ // Decisions (rule-engine verdicts emitted by agent-coord)
309
+ export type DecisionBlock = EventEnvelope<
310
+ "decision.block",
311
+ {
312
+ rule: string;
313
+ reason: string;
314
+ }
315
+ >;
316
+
317
+ export type DecisionWarn = EventEnvelope<
318
+ "decision.warn",
319
+ {
320
+ rule: string;
321
+ reason: string;
322
+ }
323
+ >;
324
+
325
+ export type DecisionAllow = EventEnvelope<
326
+ "decision.allow",
327
+ {
328
+ rule: string;
329
+ }
330
+ >;
331
+
332
+ // Health
333
+ export type HealthHeartbeatHeal = EventEnvelope<
334
+ "health.heartbeat_heal",
335
+ {
336
+ reason: string;
337
+ }
338
+ >;
339
+
340
+ export type HealthPidmapHeal = EventEnvelope<
341
+ "health.pidmap_heal",
342
+ {
343
+ reason: string;
344
+ }
345
+ >;
346
+
347
+ /**
348
+ * A heartbeat file was removed by stale-sweep. Symmetric with
349
+ * `health.heartbeat_heal` so the full lifecycle (created → healed → swept) is
350
+ * auditable from the event stream alone. Sweeps were silent before, which
351
+ * made "why did this agent vanish?" un-answerable without guesswork.
352
+ * `reason`: "stale" (last_heartbeat past the freshness cutoff) | "unparseable"
353
+ * (JSON.parse failed AND mtime was old) | "missing_ts" (no last_heartbeat AND
354
+ * mtime was old). Fresh-mtime files are never swept regardless of content.
355
+ */
356
+ export type HealthHeartbeatSwept = EventEnvelope<
357
+ "health.heartbeat_swept",
358
+ {
359
+ reason: "stale" | "unparseable" | "missing_ts";
360
+ age_secs?: number;
361
+ }
362
+ >;
363
+
364
+ /**
365
+ * fail-open verdict failure mode. Emitted by agent-hooks when
366
+ * `agent-coord verdict` fails to spawn / exits non-zero / returns malformed
367
+ * JSON / times out. Adapter falls through to ALLOW; the event preserves the
368
+ * fail-open for audit.
369
+ */
370
+ export type HealthVerdictFailure = EventEnvelope<
371
+ "health.verdict_failure",
372
+ {
373
+ failure_kind: "spawn_failed" | "nonzero_exit" | "malformed_json" | "timeout";
374
+ timeout_ms?: number;
375
+ fallback: "allow";
376
+ }
377
+ >;
378
+
379
+ // ── Discriminated union over every event_type ────────────────────────────────
380
+
381
+ export type Event =
382
+ | SessionStart
383
+ | SessionEnd
384
+ | SubagentStart
385
+ | SubagentStop
386
+ | UserPromptSubmit
387
+ | TurnStop
388
+ | CommandStart
389
+ | CommandOutput
390
+ | CommandEnd
391
+ | Narration
392
+ | ToolPreUse
393
+ | ToolPostUse
394
+ | ToolPostUseFailure
395
+ | ToolOutputChunk
396
+ | ImageCaptured
397
+ | ClaimAcquire
398
+ | ClaimRelease
399
+ | ClaimConflict
400
+ | StateTaskSet
401
+ | StateStatusChecked
402
+ | StateScratchAppend
403
+ | StatePresenceChange
404
+ | StateHeartbeat
405
+ | CouncilOpen
406
+ | CouncilRoundOpen
407
+ | CouncilContribution
408
+ | CouncilRoundClose
409
+ | CouncilClose
410
+ | CouncilArchive
411
+ | DecisionBlock
412
+ | DecisionWarn
413
+ | DecisionAllow
414
+ | HealthHeartbeatHeal
415
+ | HealthPidmapHeal
416
+ | HealthHeartbeatSwept
417
+ | HealthVerdictFailure;
418
+
419
+ export type EventType = Event["event_type"];
420
+
421
+ /**
422
+ * Redaction marker that may be attached to any `data` payload during emission.
423
+ * Tracked here so the schema documents the convention; the actual
424
+ * shape lives inside `data` so it doesn't widen the envelope.
425
+ */
426
+ export interface RedactionMarker {
427
+ field: string;
428
+ kind: "secret_signature" | "env_secret_match" | "length_clamp";
429
+ count: number;
430
+ }
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Tiny ULID generator. Crockford-base32, 10-char timestamp (48-bit ms epoch)
3
+ * + 16-char random (80-bit). 26 chars total, monotonically-sortable.
4
+ *
5
+ * Library-free so the module stays dep-free (no `ulid` package). Quality is
6
+ * sufficient for event_id uniqueness: the kth event in a millisecond uses a
7
+ * fresh 80-bit random, collision probability negligible.
8
+ */
9
+
10
+ const ALPHABET = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
11
+
12
+ export function ulid(): string {
13
+ const ts = encodeTime(Date.now());
14
+ const rnd = encodeRandom();
15
+ return ts + rnd;
16
+ }
17
+
18
+ function encodeTime(ms: number): string {
19
+ let out = "";
20
+ let n = BigInt(ms);
21
+ const base = BigInt(32);
22
+ for (let i = 0; i < 10; i++) {
23
+ const mod = Number(n % base);
24
+ out = ALPHABET[mod] + out;
25
+ n = n / base;
26
+ }
27
+ return out;
28
+ }
29
+
30
+ function encodeRandom(): string {
31
+ const bytes = new Uint8Array(10);
32
+ crypto.getRandomValues(bytes);
33
+ // Map each pair of bytes to 3 alphabet chars (5 bits per char, 16 chars).
34
+ let out = "";
35
+ let buf = 0n;
36
+ let bits = 0;
37
+ for (const b of bytes) {
38
+ buf = (buf << 8n) | BigInt(b);
39
+ bits += 8;
40
+ while (bits >= 5) {
41
+ bits -= 5;
42
+ const idx = Number((buf >> BigInt(bits)) & 0x1fn);
43
+ out += ALPHABET[idx];
44
+ }
45
+ }
46
+ if (bits > 0) {
47
+ const idx = Number((buf << BigInt(5 - bits)) & 0x1fn);
48
+ out += ALPHABET[idx];
49
+ }
50
+ return out.slice(0, 16);
51
+ }
@@ -0,0 +1,30 @@
1
+ import { coordEnv } from "../../../lib/env.ts";
2
+ import type { Harness } from "../events/schema.ts";
3
+
4
+ /**
5
+ * Resolve the harness firing the hook. The dispatcher binary is always
6
+ * invoked with `--harness <name>` per the wiring in each harness's settings
7
+ * file (Phase 1). Returns null when the flag is missing; caller falls
8
+ * through to the env-based fallback or skips emission.
9
+ */
10
+ export function detectHarness(argv: readonly string[]): Harness | null {
11
+ for (let i = 0; i < argv.length; i++) {
12
+ const a = argv[i]!;
13
+ if (a === "--harness") {
14
+ return validate(argv[i + 1]);
15
+ }
16
+ if (a.startsWith("--harness=")) {
17
+ return validate(a.slice("--harness=".length));
18
+ }
19
+ }
20
+ return validate(coordEnv("AGENT_COORD_HARNESS"));
21
+ }
22
+
23
+ function validate(v: string | undefined): Harness | null {
24
+ if (v === "claude-code" || v === "cursor" || v === "codex") return v;
25
+ // Legacy: some harnesses use `claude_code` (underscore). Map
26
+ // it through so the env-based fallback works for callers that haven't
27
+ // updated yet.
28
+ if (v === "claude_code") return "claude-code";
29
+ return null;
30
+ }
@@ -0,0 +1,102 @@
1
+ /**
2
+ * Canonical hook-wiring spec per harness: which settings file to write, which
3
+ * event key maps to which `agent-hook <subcommand>`, and how each harness encodes
4
+ * a command hook. Single source of truth for `harn init` (and any future docs /
5
+ * installers) so the wired set can't drift from what agent-hook actually handles.
6
+ *
7
+ * The event lists + entry shapes mirror exactly what a fully-wired project uses
8
+ * for each harness (Claude Code `.claude/settings.json`, Cursor `.cursor/hooks.json`,
9
+ * Codex `.codex/hooks.json`).
10
+ */
11
+
12
+ export type HarnessId = "claude-code" | "cursor" | "codex";
13
+
14
+ export interface HookEvent {
15
+ /** Key under the harness settings file's `hooks` map (e.g. `SessionStart`, `preToolUse`). */
16
+ settingsKey: string;
17
+ /** agent-hook subcommand to invoke for this event. */
18
+ subcommand: string;
19
+ }
20
+
21
+ /**
22
+ * How a harness encodes a single command hook under `hooks.<settingsKey>`:
23
+ * - `claude`: `[{ hooks: [{ type: "command", command }] }]` (Claude Code + Codex)
24
+ * - `cursor`: `[{ command }]` (Cursor: flat entry, no inner `hooks` array)
25
+ */
26
+ export type HookEntryShape = "claude" | "cursor";
27
+
28
+ export interface HarnessSpec {
29
+ /** Settings file to wire, relative to the project root. */
30
+ settingsFile: string;
31
+ /** Events this harness fires, mapped to agent-hook subcommands. */
32
+ events: HookEvent[];
33
+ /** Per-entry encoding under the root `hooks` object. */
34
+ entryShape: HookEntryShape;
35
+ /** When set, ensure this top-level `version` key in the file (Cursor requires `1`). */
36
+ rootVersion?: number;
37
+ }
38
+
39
+ /** Claude Code: `.claude/settings.json`. */
40
+ export const CLAUDE_CODE_EVENTS: HookEvent[] = [
41
+ { settingsKey: "SessionStart", subcommand: "session-start" },
42
+ { settingsKey: "UserPromptSubmit", subcommand: "user-prompt-submit" },
43
+ { settingsKey: "Stop", subcommand: "stop" },
44
+ { settingsKey: "StopFailure", subcommand: "stop-failure" },
45
+ { settingsKey: "SessionEnd", subcommand: "session-end" },
46
+ { settingsKey: "SubagentStart", subcommand: "sub-agent-start" },
47
+ { settingsKey: "SubagentStop", subcommand: "sub-agent-stop" },
48
+ { settingsKey: "PreToolUse", subcommand: "pre-tool-use" },
49
+ { settingsKey: "PostToolUse", subcommand: "post-tool-use" },
50
+ { settingsKey: "PostToolUseFailure", subcommand: "post-tool-use-failure" },
51
+ ];
52
+
53
+ /**
54
+ * Cursor: `.cursor/hooks.json`. camelCase event keys; flat `{ command }` entries;
55
+ * no `StopFailure` event, but a distinct `beforeShellExecution` (shell-mutation warn).
56
+ */
57
+ export const CURSOR_EVENTS: HookEvent[] = [
58
+ { settingsKey: "sessionStart", subcommand: "session-start" },
59
+ { settingsKey: "sessionEnd", subcommand: "session-end" },
60
+ { settingsKey: "preToolUse", subcommand: "pre-tool-use" },
61
+ { settingsKey: "beforeShellExecution", subcommand: "before-shell-execution" },
62
+ { settingsKey: "postToolUse", subcommand: "post-tool-use" },
63
+ { settingsKey: "postToolUseFailure", subcommand: "post-tool-use-failure" },
64
+ { settingsKey: "subagentStart", subcommand: "sub-agent-start" },
65
+ { settingsKey: "subagentStop", subcommand: "sub-agent-stop" },
66
+ { settingsKey: "beforeSubmitPrompt", subcommand: "user-prompt-submit" },
67
+ { settingsKey: "stop", subcommand: "stop" },
68
+ ];
69
+
70
+ /** Codex: `.codex/hooks.json`. PascalCase keys + the same entry shape as Claude Code. */
71
+ export const CODEX_EVENTS: HookEvent[] = [
72
+ { settingsKey: "SessionStart", subcommand: "session-start" },
73
+ { settingsKey: "SessionEnd", subcommand: "session-end" },
74
+ { settingsKey: "PreToolUse", subcommand: "pre-tool-use" },
75
+ { settingsKey: "PostToolUse", subcommand: "post-tool-use" },
76
+ { settingsKey: "PostToolUseFailure", subcommand: "post-tool-use-failure" },
77
+ { settingsKey: "UserPromptSubmit", subcommand: "user-prompt-submit" },
78
+ { settingsKey: "SubagentStart", subcommand: "sub-agent-start" },
79
+ { settingsKey: "SubagentStop", subcommand: "sub-agent-stop" },
80
+ { settingsKey: "Stop", subcommand: "stop" },
81
+ { settingsKey: "StopFailure", subcommand: "stop-failure" },
82
+ ];
83
+
84
+ /** Every supported harness, fully wireable by `harn init`. */
85
+ export const HARNESS_SPECS: Record<HarnessId, HarnessSpec> = {
86
+ "claude-code": {
87
+ settingsFile: ".claude/settings.json",
88
+ events: CLAUDE_CODE_EVENTS,
89
+ entryShape: "claude",
90
+ },
91
+ cursor: {
92
+ settingsFile: ".cursor/hooks.json",
93
+ events: CURSOR_EVENTS,
94
+ entryShape: "cursor",
95
+ rootVersion: 1,
96
+ },
97
+ codex: {
98
+ settingsFile: ".codex/hooks.json",
99
+ events: CODEX_EVENTS,
100
+ entryShape: "claude",
101
+ },
102
+ };