pi-harness-runtime 0.9.25 → 1.1.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 (350) hide show
  1. package/CHANGELOG.md +49 -7
  2. package/README.md +173 -51
  3. package/harness/auto-compact.ts +1 -1
  4. package/harness/autonomous-review.ts +88 -0
  5. package/harness/context-compact-orchestrator.ts +23 -23
  6. package/harness/context-window-manager.ts +5 -5
  7. package/harness/continue-prompt.ts +3 -3
  8. package/harness/e2e/minimax-quota-scraper.ts +5 -5
  9. package/harness/e2e/openai-quota-scraper.ts +13 -8
  10. package/harness/forked-summarizer.ts +4 -4
  11. package/harness/herdr-agents.ts +91 -0
  12. package/harness/index.ts +5 -5
  13. package/harness/loop-code-agent.ts +284 -0
  14. package/harness/loop-controller.ts +201 -0
  15. package/harness/loop-review-agent.ts +295 -0
  16. package/harness/loop-runtime.ts +10 -10
  17. package/harness/loop-types.ts +118 -0
  18. package/harness/notification-events.ts +3 -3
  19. package/harness/output-limit-handler.ts +1 -1
  20. package/harness/partial-recovery.ts +3 -3
  21. package/harness/session-memory.ts +5 -5
  22. package/index.ts +139 -34
  23. package/package.json +1 -1
  24. package/packages/a2a-adapter/package.json +1 -1
  25. package/packages/a2a-adapter/src/types.ts +5 -5
  26. package/packages/auth/package.json +1 -1
  27. package/packages/autonomous-refactor/package.json +1 -1
  28. package/packages/autonomous-runtime/dist/inbox.d.ts +3 -3
  29. package/packages/autonomous-runtime/dist/inbox.js +12 -12
  30. package/packages/autonomous-runtime/dist/lease.js +14 -14
  31. package/packages/autonomous-runtime/dist/types.js +1 -1
  32. package/packages/autonomous-runtime/package.json +1 -1
  33. package/packages/autonomous-runtime/src/inbox.ts +12 -12
  34. package/packages/autonomous-runtime/src/lease.ts +15 -15
  35. package/packages/autonomous-runtime/src/types.ts +13 -13
  36. package/packages/autonomous-runtime/tsconfig.tsbuildinfo +1 -1
  37. package/packages/cache-strategy/package.json +1 -1
  38. package/packages/capability-registry/dist/types.js +1 -1
  39. package/packages/capability-registry/package.json +1 -1
  40. package/packages/capability-registry/src/types.ts +5 -5
  41. package/packages/checkpoint/README.md +6 -6
  42. package/packages/checkpoint/dist/differ.js +2 -2
  43. package/packages/checkpoint/dist/engine.js +3 -3
  44. package/packages/checkpoint/dist/index.js +5 -5
  45. package/packages/checkpoint/dist/storage.js +3 -3
  46. package/packages/checkpoint/dist/types.js +1 -1
  47. package/packages/checkpoint/package.json +1 -1
  48. package/packages/checkpoint/src/differ.ts +2 -2
  49. package/packages/checkpoint/src/engine.ts +3 -3
  50. package/packages/checkpoint/src/index.ts +5 -5
  51. package/packages/checkpoint/src/storage.ts +3 -3
  52. package/packages/checkpoint/src/types.ts +10 -10
  53. package/packages/checkpoint/tsconfig.tsbuildinfo +1 -1
  54. package/packages/cli-plugin-sdk/package.json +1 -1
  55. package/packages/clipboard/dist/src/clipboard.d.ts.map +1 -1
  56. package/packages/clipboard/dist/src/clipboard.js +15 -7
  57. package/packages/clipboard/dist/src/clipboard.js.map +1 -1
  58. package/packages/clipboard/dist/src/copy-sync.d.ts +27 -0
  59. package/packages/clipboard/dist/src/copy-sync.d.ts.map +1 -0
  60. package/packages/clipboard/dist/src/copy-sync.js +170 -0
  61. package/packages/clipboard/dist/src/copy-sync.js.map +1 -0
  62. package/packages/clipboard/dist/src/gist-relay.d.ts +48 -0
  63. package/packages/clipboard/dist/src/gist-relay.d.ts.map +1 -0
  64. package/packages/clipboard/dist/src/gist-relay.js +186 -0
  65. package/packages/clipboard/dist/src/gist-relay.js.map +1 -0
  66. package/packages/clipboard/dist/src/github-login.d.ts +16 -0
  67. package/packages/clipboard/dist/src/github-login.d.ts.map +1 -0
  68. package/packages/clipboard/dist/src/github-login.js +69 -0
  69. package/packages/clipboard/dist/src/github-login.js.map +1 -0
  70. package/packages/clipboard/dist/src/index.d.ts +2 -0
  71. package/packages/clipboard/dist/src/index.d.ts.map +1 -1
  72. package/packages/clipboard/dist/src/index.js +2 -1
  73. package/packages/clipboard/dist/src/index.js.map +1 -1
  74. package/packages/clipboard/package.json +1 -1
  75. package/packages/clipboard/src/clipboard.ts +16 -9
  76. package/packages/clipboard/src/copy-sync.ts +201 -0
  77. package/packages/clipboard/src/gist-relay.ts +240 -0
  78. package/packages/clipboard/src/github-login.ts +107 -0
  79. package/packages/clipboard/src/index.ts +2 -0
  80. package/packages/clipboard/test/mojibake.test.mjs +143 -0
  81. package/packages/code-generation/README.md +13 -13
  82. package/packages/code-generation/dist/faker.js +4 -4
  83. package/packages/code-generation/dist/generator.js +3 -3
  84. package/packages/code-generation/dist/index.js +3 -3
  85. package/packages/code-generation/dist/templates/registry.js +1 -1
  86. package/packages/code-generation/dist/types.js +1 -1
  87. package/packages/code-generation/package.json +1 -1
  88. package/packages/code-generation/src/faker.ts +5 -5
  89. package/packages/code-generation/src/generator.ts +4 -4
  90. package/packages/code-generation/src/index.ts +3 -3
  91. package/packages/code-generation/src/templates/registry.ts +1 -1
  92. package/packages/code-generation/src/types.ts +10 -10
  93. package/packages/code-generation/tsconfig.tsbuildinfo +1 -1
  94. package/packages/code-review/README.md +13 -13
  95. package/packages/code-review/dist/engine.js +3 -3
  96. package/packages/code-review/dist/index.js +3 -3
  97. package/packages/code-review/dist/types.js +1 -1
  98. package/packages/code-review/package.json +1 -1
  99. package/packages/code-review/src/engine.ts +3 -3
  100. package/packages/code-review/src/index.ts +3 -3
  101. package/packages/code-review/src/types.ts +10 -10
  102. package/packages/code-review/tsconfig.tsbuildinfo +1 -1
  103. package/packages/codex-adapter/package.json +1 -1
  104. package/packages/context-compiler/dist/compiler.js +1 -1
  105. package/packages/context-compiler/package.json +1 -1
  106. package/packages/context-compiler/src/compiler.ts +1 -1
  107. package/packages/context-compiler/src/types.ts +11 -11
  108. package/packages/context-compiler/test/context-compiler.test.ts +11 -11
  109. package/packages/context-discovery/package.json +1 -1
  110. package/packages/context-manager/package.json +1 -1
  111. package/packages/cookie-sanitizer/README.md +27 -27
  112. package/packages/cookie-sanitizer/package.json +1 -1
  113. package/packages/cost-optimizer/package.json +1 -1
  114. package/packages/cost-optimizer/src/types.ts +5 -5
  115. package/packages/dependency-analyzer/package.json +1 -1
  116. package/packages/django-plugin/dist/analyzer.js +7 -7
  117. package/packages/django-plugin/package.json +1 -1
  118. package/packages/django-plugin/src/analyzer.ts +7 -7
  119. package/packages/doc-generator/package.json +1 -1
  120. package/packages/evaluation-engine/dist/engine.js +9 -9
  121. package/packages/evaluation-engine/package.json +1 -1
  122. package/packages/evaluation-engine/src/engine.ts +9 -9
  123. package/packages/evaluation-engine/src/types.ts +3 -3
  124. package/packages/evaluation-runner/package.json +1 -1
  125. package/packages/event-bus/dist/src/herdr-bus.d.ts +121 -0
  126. package/packages/event-bus/dist/src/herdr-bus.d.ts.map +1 -0
  127. package/packages/event-bus/dist/src/herdr-bus.js +322 -0
  128. package/packages/event-bus/dist/src/herdr-bus.js.map +1 -0
  129. package/packages/event-bus/dist/src/index.d.ts +2 -0
  130. package/packages/event-bus/dist/src/index.d.ts.map +1 -1
  131. package/packages/event-bus/dist/src/index.js +1 -0
  132. package/packages/event-bus/dist/src/index.js.map +1 -1
  133. package/packages/event-bus/package.json +1 -1
  134. package/packages/event-bus/src/herdr-bus.ts +525 -0
  135. package/packages/event-bus/src/index.ts +29 -0
  136. package/packages/event-store/package.json +1 -1
  137. package/packages/experience-replay/dist/replay.js +7 -7
  138. package/packages/experience-replay/package.json +1 -1
  139. package/packages/experience-replay/src/replay.ts +7 -7
  140. package/packages/experience-replay/src/types.ts +5 -5
  141. package/packages/feedback-collector/package.json +1 -1
  142. package/packages/framework-detector/README.md +18 -18
  143. package/packages/framework-detector/dist/detector.js +3 -3
  144. package/packages/framework-detector/dist/index.js +3 -3
  145. package/packages/framework-detector/dist/signatures/registry.js +24 -24
  146. package/packages/framework-detector/dist/types.js +1 -1
  147. package/packages/framework-detector/package.json +1 -1
  148. package/packages/framework-detector/src/detector.ts +3 -3
  149. package/packages/framework-detector/src/index.ts +3 -3
  150. package/packages/framework-detector/src/signatures/registry.ts +24 -24
  151. package/packages/framework-detector/src/types.ts +7 -7
  152. package/packages/framework-detector/tsconfig.tsbuildinfo +1 -1
  153. package/packages/framework-plugin-sdk/README.md +23 -23
  154. package/packages/framework-plugin-sdk/dist/index.js +2 -2
  155. package/packages/framework-plugin-sdk/dist/manager.js +3 -3
  156. package/packages/framework-plugin-sdk/dist/types.js +2 -2
  157. package/packages/framework-plugin-sdk/package.json +1 -1
  158. package/packages/framework-plugin-sdk/src/index.ts +2 -2
  159. package/packages/framework-plugin-sdk/src/manager.ts +3 -3
  160. package/packages/framework-plugin-sdk/src/types.ts +10 -10
  161. package/packages/framework-plugin-sdk/tsconfig.tsbuildinfo +1 -1
  162. package/packages/frappe-plugin/dist/analyzer.js +8 -8
  163. package/packages/frappe-plugin/dist/types.js +1 -1
  164. package/packages/frappe-plugin/package.json +1 -1
  165. package/packages/frappe-plugin/src/analyzer.ts +8 -8
  166. package/packages/frappe-plugin/src/types.ts +10 -10
  167. package/packages/generic-web-plugin/dist/analyzer.js +5 -5
  168. package/packages/generic-web-plugin/package.json +1 -1
  169. package/packages/generic-web-plugin/src/analyzer.ts +5 -5
  170. package/packages/health-monitor/package.json +1 -1
  171. package/packages/health-monitor/src/monitor.ts +1 -1
  172. package/packages/intent-analyzer/package.json +1 -1
  173. package/packages/laravel-plugin/dist/analyzer.js +11 -11
  174. package/packages/laravel-plugin/package.json +1 -1
  175. package/packages/laravel-plugin/src/analyzer.ts +11 -11
  176. package/packages/learning-engine/dist/engine.js +5 -5
  177. package/packages/learning-engine/dist/types.js +1 -1
  178. package/packages/learning-engine/package.json +1 -1
  179. package/packages/learning-engine/src/engine.ts +5 -5
  180. package/packages/learning-engine/src/types.ts +6 -6
  181. package/packages/mcp-adapter/package.json +1 -1
  182. package/packages/memory-engine/dist/engine.js +8 -8
  183. package/packages/memory-engine/dist/types.js +2 -2
  184. package/packages/memory-engine/package.json +1 -1
  185. package/packages/memory-engine/src/engine.ts +8 -8
  186. package/packages/memory-engine/src/types.ts +9 -9
  187. package/packages/model-registry/package.json +1 -1
  188. package/packages/model-registry/src/types.ts +4 -4
  189. package/packages/nextjs-plugin/dist/analyzer.js +9 -9
  190. package/packages/nextjs-plugin/package.json +1 -1
  191. package/packages/nextjs-plugin/src/analyzer.ts +9 -9
  192. package/packages/notification/dist/notification-center.js +1 -1
  193. package/packages/notification/package.json +1 -1
  194. package/packages/notification/src/notification-center.ts +1 -1
  195. package/packages/observability/dist/alerts.js +2 -2
  196. package/packages/observability/dist/health.js +4 -4
  197. package/packages/observability/dist/index.js +6 -6
  198. package/packages/observability/dist/logger.js +7 -7
  199. package/packages/observability/dist/metrics.js +11 -11
  200. package/packages/observability/dist/tracer.js +3 -3
  201. package/packages/observability/dist/types.js +1 -1
  202. package/packages/observability/package.json +1 -1
  203. package/packages/observability/src/alerts.ts +2 -2
  204. package/packages/observability/src/health.ts +4 -4
  205. package/packages/observability/src/index.ts +6 -6
  206. package/packages/observability/src/logger.ts +7 -7
  207. package/packages/observability/src/metrics.ts +11 -11
  208. package/packages/observability/src/tracer.ts +3 -3
  209. package/packages/observability/src/types.ts +7 -7
  210. package/packages/observability/test/observability.test.ts +4 -4
  211. package/packages/observability/tsconfig.tsbuildinfo +1 -1
  212. package/packages/performance-optimizer/dist/optimizer.js +1 -1
  213. package/packages/performance-optimizer/package.json +1 -1
  214. package/packages/performance-optimizer/src/optimizer.ts +1 -1
  215. package/packages/performance-optimizer/src/types.ts +4 -4
  216. package/packages/privilege-broker/package.json +1 -1
  217. package/packages/project-analyzer/dist/analyzer.js +4 -4
  218. package/packages/project-analyzer/dist/index.js +8 -8
  219. package/packages/project-analyzer/dist/signals.js +3 -3
  220. package/packages/project-analyzer/dist/types.js +1 -1
  221. package/packages/project-analyzer/package.json +1 -1
  222. package/packages/project-analyzer/src/analyzer.ts +4 -4
  223. package/packages/project-analyzer/src/index.ts +9 -9
  224. package/packages/project-analyzer/src/signals.ts +4 -4
  225. package/packages/project-analyzer/src/types.ts +15 -15
  226. package/packages/project-analyzer/test/index.test.ts +17 -17
  227. package/packages/project-analyzer/tsconfig.tsbuildinfo +1 -1
  228. package/packages/projection-engine/package.json +1 -1
  229. package/packages/prompt-compiler/dist/section-builder.js +1 -1
  230. package/packages/prompt-compiler/dist/types.js +3 -3
  231. package/packages/prompt-compiler/package.json +1 -1
  232. package/packages/prompt-compiler/src/section-builder.ts +1 -1
  233. package/packages/prompt-compiler/src/types.ts +12 -12
  234. package/packages/prompt-compiler/test/prompt-compiler.test.ts +12 -12
  235. package/packages/prompt-versioning/package.json +1 -1
  236. package/packages/provider-adapter-sdk/dist/builder.js +1 -1
  237. package/packages/provider-adapter-sdk/dist/index.js +5 -5
  238. package/packages/provider-adapter-sdk/dist/registry.js +1 -1
  239. package/packages/provider-adapter-sdk/dist/tester.js +1 -1
  240. package/packages/provider-adapter-sdk/dist/types.js +1 -1
  241. package/packages/provider-adapter-sdk/package.json +1 -1
  242. package/packages/provider-adapter-sdk/src/builder.ts +1 -1
  243. package/packages/provider-adapter-sdk/src/index.ts +6 -6
  244. package/packages/provider-adapter-sdk/src/registry.ts +1 -1
  245. package/packages/provider-adapter-sdk/src/tester.ts +1 -1
  246. package/packages/provider-adapter-sdk/src/types.ts +5 -5
  247. package/packages/provider-adapter-sdk/tsconfig.tsbuildinfo +1 -1
  248. package/packages/provider-router/package.json +1 -1
  249. package/packages/provider-router/src/types.ts +4 -4
  250. package/packages/provider-selector/package.json +1 -1
  251. package/packages/providers/dist/deepagents-adapter.js +1 -1
  252. package/packages/providers/package.json +1 -1
  253. package/packages/providers/src/deepagents-adapter.ts +1 -1
  254. package/packages/quota-manager/package.json +1 -1
  255. package/packages/rate-limiter/package.json +1 -1
  256. package/packages/react-vite-plugin/dist/analyzer.js +7 -7
  257. package/packages/react-vite-plugin/package.json +1 -1
  258. package/packages/react-vite-plugin/src/analyzer.ts +7 -7
  259. package/packages/release-manager/package.json +1 -1
  260. package/packages/requirement-compiler/dist/compiler.js +17 -17
  261. package/packages/requirement-compiler/dist/types.js +2 -2
  262. package/packages/requirement-compiler/package.json +1 -1
  263. package/packages/requirement-compiler/src/compiler.ts +17 -17
  264. package/packages/requirement-compiler/src/types.ts +21 -21
  265. package/packages/requirement-compiler/test/requirement-compiler.test.ts +17 -17
  266. package/packages/runtime/dist/command-executor.js +1 -1
  267. package/packages/runtime/dist/local-runtime-agent.js +1 -1
  268. package/packages/runtime/dist/policy-engine.js +1 -1
  269. package/packages/runtime/dist/runtime-api.js +1 -1
  270. package/packages/runtime/dist/workspace-manager.js +1 -1
  271. package/packages/runtime/package.json +1 -1
  272. package/packages/runtime/src/command-executor.ts +1 -1
  273. package/packages/runtime/src/local-runtime-agent.ts +1 -1
  274. package/packages/runtime/src/policy-engine.ts +1 -1
  275. package/packages/runtime/src/runtime-api.ts +1 -1
  276. package/packages/runtime/src/workspace-manager.ts +1 -1
  277. package/packages/scheduler/package.json +1 -1
  278. package/packages/scheduler-adapter/package.json +1 -1
  279. package/packages/session/README.md +18 -18
  280. package/packages/session/dist/history.js +3 -3
  281. package/packages/session/dist/index.js +5 -5
  282. package/packages/session/dist/manager.js +3 -3
  283. package/packages/session/dist/policy.js +2 -2
  284. package/packages/session/dist/store.js +2 -2
  285. package/packages/session/dist/types.js +1 -1
  286. package/packages/session/package.json +1 -1
  287. package/packages/session/src/history.ts +3 -3
  288. package/packages/session/src/index.ts +5 -5
  289. package/packages/session/src/manager.ts +3 -3
  290. package/packages/session/src/policy.ts +4 -4
  291. package/packages/session/src/store.ts +3 -3
  292. package/packages/session/src/types.ts +10 -10
  293. package/packages/session/tsconfig.tsbuildinfo +1 -1
  294. package/packages/session-api/package.json +1 -1
  295. package/packages/session-export/package.json +1 -1
  296. package/packages/shared-context/package.json +1 -1
  297. package/packages/skill-registry/package.json +1 -1
  298. package/packages/skill-registry/src/types.ts +4 -4
  299. package/packages/sprint-planner/package.json +1 -1
  300. package/packages/subscription-engine/package.json +1 -1
  301. package/packages/task-compiler/dist/compiler.js +7 -7
  302. package/packages/task-compiler/dist/decompose.js +11 -11
  303. package/packages/task-compiler/dist/file-scope.js +6 -6
  304. package/packages/task-compiler/dist/graph.js +6 -6
  305. package/packages/task-compiler/dist/index.js +2 -2
  306. package/packages/task-compiler/dist/types.js +5 -5
  307. package/packages/task-compiler/dist/validate.js +2 -2
  308. package/packages/task-compiler/dist/verification.js +2 -2
  309. package/packages/task-compiler/package.json +1 -1
  310. package/packages/task-compiler/src/command-policy.ts +1 -1
  311. package/packages/task-compiler/src/compiler.ts +7 -7
  312. package/packages/task-compiler/src/decompose.ts +11 -11
  313. package/packages/task-compiler/src/file-scope.ts +6 -6
  314. package/packages/task-compiler/src/graph.ts +6 -6
  315. package/packages/task-compiler/src/index.ts +3 -3
  316. package/packages/task-compiler/src/types.ts +14 -14
  317. package/packages/task-compiler/src/validate.ts +2 -2
  318. package/packages/task-compiler/src/verification.ts +2 -2
  319. package/packages/task-compiler/test/task-compiler.test.ts +10 -10
  320. package/packages/test-data-generator/README.md +13 -13
  321. package/packages/test-data-generator/dist/faker-adapter.js +4 -4
  322. package/packages/test-data-generator/dist/generator.js +3 -3
  323. package/packages/test-data-generator/dist/index.js +3 -3
  324. package/packages/test-data-generator/dist/types.js +1 -1
  325. package/packages/test-data-generator/package.json +1 -1
  326. package/packages/test-data-generator/src/faker-adapter.ts +4 -4
  327. package/packages/test-data-generator/src/generator.ts +3 -3
  328. package/packages/test-data-generator/src/index.ts +3 -3
  329. package/packages/test-data-generator/src/types.ts +9 -9
  330. package/packages/test-data-generator/tsconfig.tsbuildinfo +1 -1
  331. package/packages/test-generator/package.json +1 -1
  332. package/packages/todo-bd-sync/package.json +22 -0
  333. package/packages/todo-bd-sync/src/detector.ts +150 -0
  334. package/packages/todo-bd-sync/src/extension.ts +101 -0
  335. package/packages/todo-bd-sync/src/index.ts +401 -0
  336. package/packages/todo-bd-sync/src/sync.ts +322 -0
  337. package/packages/todo-bd-sync/src/todo-reminder.ts +418 -0
  338. package/packages/todo-bd-sync/src/types.ts +137 -0
  339. package/packages/token-estimation/package.json +1 -1
  340. package/packages/token-optimizer/package.json +1 -1
  341. package/packages/tui/package.json +1 -1
  342. package/packages/types/package.json +1 -1
  343. package/packages/types/src/agent-worker-types.ts +5 -5
  344. package/packages/types/src/runtime-types.ts +12 -12
  345. package/packages/types/tsconfig.tsbuildinfo +1 -1
  346. package/packages/workflow-events/package.json +1 -1
  347. package/packages/workspace-scanner/package.json +1 -1
  348. package/packages/worktree/package.json +1 -1
  349. package/renderer.ts +7 -7
  350. package/skills/harness-runtime/SKILL.md +15 -15
package/CHANGELOG.md CHANGED
@@ -2,6 +2,48 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.10.1](https://github.com/ManotLuijiu/pi-harness-runtime/compare/v0.9.24...v0.10.1) (2026-07-31)
6
+
7
+
8
+ ### Features
9
+
10
+ * blackboard-coordinated loop controller with early exit ([f3cf3ea](https://github.com/ManotLuijiu/pi-harness-runtime/commit/f3cf3ea479170dd75b7e9a7c3515dde230bb0da7))
11
+ * herdr inter-agent event bus for autonomous code review ([1490cdd](https://github.com/ManotLuijiu/pi-harness-runtime/commit/1490cddec80dac812065c3c681984524ad3194e1))
12
+ * loop controller for write-review cycles with early exit ([95066ce](https://github.com/ManotLuijiu/pi-harness-runtime/commit/95066ce8cb58c55eaa14d69fd826b5aaff680c16))
13
+ * release adapters, stale reminder fix, tests, and bug fixes ([5fe5a26](https://github.com/ManotLuijiu/pi-harness-runtime/commit/5fe5a260e0d9a005965b43e4973cbe04a371b85e))
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * **clipboard:** pass UTF-8 bytes directly to xclip via stdin, avoid pipeline corruption ([051ca18](https://github.com/ManotLuijiu/pi-harness-runtime/commit/051ca18fb1deb1169a8a4da16aa9314d2e6ec66d))
19
+ * disable todo-bd auto-reminder (Phase 1 containment) ([e1b16c1](https://github.com/ManotLuijiu/pi-harness-runtime/commit/e1b16c11e34cee8e35ec813081b17dd171671771))
20
+ * herdr-bus refactoring — rename publishers to *Simple variants ([d727591](https://github.com/ManotLuijiu/pi-harness-runtime/commit/d7275913a89deb56a6bcfdb912ea9d17e3a80ce1))
21
+ * import LoopConfig from index.js, remove unused LoopNextAction import ([1100a4e](https://github.com/ManotLuijiu/pi-harness-runtime/commit/1100a4e87433e54416259dfdad41bc5e0def19b3))
22
+ * periodic quota refresh every 15 minutes via setInterval ([f28e700](https://github.com/ManotLuijiu/pi-harness-runtime/commit/f28e7004d089aeada1659f4d55a35461baba76fc))
23
+ * replace all Unicode box-drawing characters with ASCII ([dd4223a](https://github.com/ManotLuijiu/pi-harness-runtime/commit/dd4223abb0e25f746ee09ced05f6b3e40a10eb85))
24
+ * replace Unicode dashes and arrows with ASCII equivalents ([e9027e6](https://github.com/ManotLuijiu/pi-harness-runtime/commit/e9027e689c06fdc1ca2ac4a6365ed6a6a0a384fd))
25
+ * trigger cookie sync on startup so pre-existing cookies aren't ignored ([2914299](https://github.com/ManotLuijiu/pi-harness-runtime/commit/2914299b8caa02acbb06620c7cb8e4870acfa40e))
26
+
27
+ ## [0.10.0](https://github.com/ManotLuijiu/pi-harness-runtime/compare/v0.9.24...v0.10.0) (2026-07-30)
28
+
29
+
30
+ ### Features
31
+
32
+ * blackboard-coordinated loop controller with early exit ([f3cf3ea](https://github.com/ManotLuijiu/pi-harness-runtime/commit/f3cf3ea479170dd75b7e9a7c3515dde230bb0da7))
33
+ * herdr inter-agent event bus for autonomous code review ([1490cdd](https://github.com/ManotLuijiu/pi-harness-runtime/commit/1490cddec80dac812065c3c681984524ad3194e1))
34
+ * loop controller for write-review cycles with early exit ([95066ce](https://github.com/ManotLuijiu/pi-harness-runtime/commit/95066ce8cb58c55eaa14d69fd826b5aaff680c16))
35
+
36
+
37
+ ### Bug Fixes
38
+
39
+ * **clipboard:** pass UTF-8 bytes directly to xclip via stdin, avoid pipeline corruption ([051ca18](https://github.com/ManotLuijiu/pi-harness-runtime/commit/051ca18fb1deb1169a8a4da16aa9314d2e6ec66d))
40
+ * herdr-bus refactoring — rename publishers to *Simple variants ([d727591](https://github.com/ManotLuijiu/pi-harness-runtime/commit/d7275913a89deb56a6bcfdb912ea9d17e3a80ce1))
41
+ * import LoopConfig from index.js, remove unused LoopNextAction import ([1100a4e](https://github.com/ManotLuijiu/pi-harness-runtime/commit/1100a4e87433e54416259dfdad41bc5e0def19b3))
42
+ * periodic quota refresh every 15 minutes via setInterval ([f28e700](https://github.com/ManotLuijiu/pi-harness-runtime/commit/f28e7004d089aeada1659f4d55a35461baba76fc))
43
+ * replace all Unicode box-drawing characters with ASCII ([dd4223a](https://github.com/ManotLuijiu/pi-harness-runtime/commit/dd4223abb0e25f746ee09ced05f6b3e40a10eb85))
44
+ * replace Unicode dashes and arrows with ASCII equivalents ([e9027e6](https://github.com/ManotLuijiu/pi-harness-runtime/commit/e9027e689c06fdc1ca2ac4a6365ed6a6a0a384fd))
45
+ * trigger cookie sync on startup so pre-existing cookies aren't ignored ([2914299](https://github.com/ManotLuijiu/pi-harness-runtime/commit/2914299b8caa02acbb06620c7cb8e4870acfa40e))
46
+
5
47
  ### [0.9.25](https://github.com/ManotLuijiu/pi-harness-runtime/compare/v0.9.21...v0.9.25) (2026-07-27)
6
48
 
7
49
 
@@ -117,7 +159,7 @@ All notable changes to this project will be documented in this file. See [standa
117
159
  ### Bug Fixes
118
160
 
119
161
  * publish missing runtime modules ([3fc7058](https://github.com/ManotLuijiu/pi-harness-runtime/commit/3fc70586d0cd10f4d38eab67e4cadaec20aaeb56))
120
- * **release:** remove redundant Bump version step — was double-bumping version (0.7.10.8.0) when tag pushed ([413ad6d](https://github.com/ManotLuijiu/pi-harness-runtime/commit/413ad6d49356ec62b94e9a4e09d3475ef39bebd6))
162
+ * **release:** remove redundant Bump version step — was double-bumping version (0.7.1->0.8.0) when tag pushed ([413ad6d](https://github.com/ManotLuijiu/pi-harness-runtime/commit/413ad6d49356ec62b94e9a4e09d3475ef39bebd6))
121
163
 
122
164
  ## [0.9.0](https://github.com/ManotLuijiu/pi-harness-runtime/compare/v0.7.1...v0.9.0) (2026-07-13)
123
165
 
@@ -127,7 +169,7 @@ All notable changes to this project will be documented in this file. See [standa
127
169
 
128
170
  ### Bug Fixes
129
171
 
130
- * **release:** remove redundant Bump version step — was double-bumping version (0.7.10.8.0) when tag pushed ([413ad6d](https://github.com/ManotLuijiu/pi-harness-runtime/commit/413ad6d49356ec62b94e9a4e09d3475ef39bebd6))
172
+ * **release:** remove redundant Bump version step — was double-bumping version (0.7.1->0.8.0) when tag pushed ([413ad6d](https://github.com/ManotLuijiu/pi-harness-runtime/commit/413ad6d49356ec62b94e9a4e09d3475ef39bebd6))
131
173
 
132
174
  ### [0.7.1](https://github.com/ManotLuijiu/pi-harness-runtime/compare/v0.6.3...v0.7.1) (2026-07-13)
133
175
 
@@ -158,11 +200,11 @@ All notable changes to this project will be documented in this file. See [standa
158
200
 
159
201
  ### Changed
160
202
 
161
- * **Project rename**: `pi-usage-status` `pi-harness-runtime`
162
- * npm package name: `pi-usage-status` `pi-harness-runtime`
163
- * Repository: `ManotLuijiu/pi-usage-status` `ManotLuijiu/pi-harness-runtime`
164
- * Bundled skill: `usage-status` `harness-runtime` (file path `skills/usage-status/` `skills/harness-runtime/`)
165
- * Status bar key: `usage-status` `harness-runtime`
203
+ * **Project rename**: `pi-usage-status` -> `pi-harness-runtime`
204
+ * npm package name: `pi-usage-status` -> `pi-harness-runtime`
205
+ * Repository: `ManotLuijiu/pi-usage-status` -> `ManotLuijiu/pi-harness-runtime`
206
+ * Bundled skill: `usage-status` -> `harness-runtime` (file path `skills/usage-status/` -> `skills/harness-runtime/`)
207
+ * Status bar key: `usage-status` -> `harness-runtime`
166
208
  * **Data directory unchanged**: still `~/.pi/usage-status/` (preserves existing user data)
167
209
  * **Env var unchanged**: still `PI_USAGE_DIR` (preserves existing user configs)
168
210
  * **Extension symlink unchanged**: still `~/.pi/agent/extensions/pi-usage-status` (repointed to renamed project directory)
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=for-the-badge)](https://opensource.org/licenses/MIT)
5
5
  [![Platform](https://img.shields.io/badge/Platform-macOS%20|Linux-blue?style=for-the-badge)]()
6
6
 
7
- > ⚠️ **Beta Notice — Not Production Ready ⚠️**
7
+ > !️ **Beta Notice — Not Production Ready !️**
8
8
  > This project is in active development. Core features work.
9
9
 
10
10
  **Autonomous AI coding harness for pi: local token tracking + provider mirror + task orchestration.**
@@ -27,6 +27,76 @@ pi install npm:pi-harness-runtime
27
27
 
28
28
  Requires Pi v0.37.3+.
29
29
 
30
+ ### Headless Server Setup (herdr clipboard bridge)
31
+
32
+ If running on a **headless server** via herdr SSH, install the clipboard bridge plugin to enable copy/paste between server and local machine:
33
+
34
+ ```bash
35
+ # 1. Link the plugin (already included in this package)
36
+ cd ~/.config/herdr/plugins
37
+ ln -s ~/.config/herdr/plugins/moocoding.clipboard-bridge moocoding.clipboard-bridge 2>/dev/null || true
38
+
39
+ # 2. Add keybinding to ~/.config/herdr/config.toml
40
+ cat >> ~/.config/herdr/config.toml << 'EOF'
41
+
42
+ [[keys.command]]
43
+ key = "prefix+y"
44
+ type = "plugin_action"
45
+ command = "moocoding.clipboard-bridge.copy"
46
+ description = "Copy selected text via bridge"
47
+ EOF
48
+
49
+ # 3. Reload herdr config
50
+ herdr server reload-config
51
+ ```
52
+
53
+ ### todo-bd-sync (Auto Task Tracker)
54
+
55
+ Automatic two-way sync between rpiv-todo overlay and bd issue tracker.
56
+
57
+ When you use `bd` for issue tracking, this feature automatically syncs tasks.
58
+
59
+ > **Important:** `bd` is **not** implemented or bundled by `pi-harness-runtime`.
60
+ > It is the external **Beads CLI** from the upstream project:
61
+ > `https://github.com/gastownhall/beads`
62
+ >
63
+ > Install it system-wide from upstream, then initialize it in your own project:
64
+
65
+ ```bash
66
+ # Install beads CLI (system-wide - don't clone this repo into your project)
67
+ curl -fsSL https://raw.githubusercontent.com/gastownhall/beads/main/scripts/install.sh | bash
68
+
69
+ # Initialize in YOUR project
70
+ cd your-project
71
+ bd init
72
+
73
+ # Optional: refresh or install richer instructions for your agent
74
+ bd setup codex # Codex CLI - installs skill, AGENTS.md guidance, and hooks
75
+ bd setup claude # Claude Code - installs hooks/settings
76
+ bd setup factory # Factory.ai Droid - creates/updates AGENTS.md
77
+ ```
78
+
79
+ - Install dependencies:
80
+
81
+ ```bash
82
+ # Install rpiv-todo overlay
83
+ pi install npm:@juicesharp/rpiv-todo
84
+
85
+ # Verify bd is available from your upstream beads install
86
+ bd --version
87
+ ```
88
+
89
+ - Works automatically: Just use prompts with multiple steps, and tasks sync to bd
90
+ - Manual commands:
91
+
92
+ ```bash
93
+ /bd-todo-sync # Force sync all mapped tasks
94
+ /bd-todo-status # Show sync status
95
+ ```
96
+
97
+ > **Note:** Auto-reminder is **disabled by default** (bug fix for transcript growth).
98
+ > See [docs/todo-bd-sync.md](docs/todo-bd-sync.md) for details.
99
+
30
100
  ## Usage Commands
31
101
 
32
102
  ```bash
@@ -35,6 +105,8 @@ Requires Pi v0.37.3+.
35
105
  /usage today # today's usage + 5h window
36
106
  /usage week # this week's usage + lifetime totals
37
107
  /usage reset # clear provider mirror
108
+ /bd-todo-sync # Force sync all mapped tasks (todo <-> bd)
109
+ /bd-todo-status # Show todo-bd sync status and dependencies
38
110
  ```
39
111
 
40
112
  ## Harness Commands
@@ -54,10 +126,10 @@ Requires Pi v0.37.3+.
54
126
  /harness start Build a REST API with JWT authentication
55
127
 
56
128
  # Runtime creates task graph:
57
- # task-001: Analyze requirements ready
58
- # task-002: Implement API depends on task-001
59
- # task-003: Write tests depends on task-002
60
- # task-004: Code review depends on task-003
129
+ # task-001: Analyze requirements -> ready
130
+ # task-002: Implement API -> depends on task-001
131
+ # task-003: Write tests -> depends on task-002
132
+ # task-004: Code review -> depends on task-003
61
133
 
62
134
  /harness status
63
135
  # Job: job-123, Status: running
@@ -74,48 +146,48 @@ Requires Pi v0.37.3+.
74
146
  # When all tasks complete:
75
147
  /harness status
76
148
  # Job: job-123, Status: ready_for_client
77
- # Tasks: 4/4 done
149
+ # Tasks: 4/4 done [x]
78
150
  ```
79
151
 
80
152
  ## Architecture
81
153
 
82
154
  ```
83
155
  pi-harness-runtime/
84
- ├── index.ts # Extension entry point
85
- ├── footer-status.ts # Footer bar renderer (local vs. mirror mode)
86
- ├── mirror.ts # Per-provider quota mirror (mirror.json)
87
- ├── harness/
88
- ├── job-state-machine.ts # 14-state lifecycle machine
89
- ├── task-graph.ts # DAG-based task management
90
- ├── master-planner.ts # Requirement task graph
91
- ├── loop-runtime.ts # Core execution loop
92
- ├── repair-engine.ts # Auto-fix failures
93
- ├── blackboard.ts # Agent coordination
94
- ├── context-window-manager.ts # Context tracking
95
- ├── agent-handoff.ts # Clean agent transitions
96
- ├── e2e/
97
- ├── minimax-quota-scraper.ts # Playwright MiniMax scraper
98
- └── playwright-runner.ts # Browser automation
99
- └── project-detector/
100
- └── detector.ts # Auto-detect project type
101
- ├── packages/
102
- ├── cookie-sanitizer/ # Live cookie-file sync via chokidar
103
- ├── providers/ # MiniMax, OpenAI, Codex adapters
104
- ├── quota-manager/ # Quota signal collection
105
- ├── auth/ # MiniMax browser auth
106
- └── worktree/ # Git worktree per task
107
- └── skills/
108
- └── harness-runtime/
109
- └── SKILL.md # Skill documentation
156
+ +-- index.ts # Extension entry point
157
+ +-- footer-status.ts # Footer bar renderer (local vs. mirror mode)
158
+ +-- mirror.ts # Per-provider quota mirror (mirror.json)
159
+ +-- harness/
160
+ | +-- job-state-machine.ts # 14-state lifecycle machine
161
+ | +-- task-graph.ts # DAG-based task management
162
+ | +-- master-planner.ts # Requirement -> task graph
163
+ | +-- loop-runtime.ts # Core execution loop
164
+ | +-- repair-engine.ts # Auto-fix failures
165
+ | +-- blackboard.ts # Agent coordination
166
+ | +-- context-window-manager.ts # Context tracking
167
+ | +-- agent-handoff.ts # Clean agent transitions
168
+ | +-- e2e/
169
+ | | +-- minimax-quota-scraper.ts # Playwright MiniMax scraper
170
+ | | +-- playwright-runner.ts # Browser automation
171
+ | +-- project-detector/
172
+ | +-- detector.ts # Auto-detect project type
173
+ +-- packages/
174
+ | +-- cookie-sanitizer/ # Live cookie-file sync via chokidar
175
+ | +-- providers/ # MiniMax, OpenAI, Codex adapters
176
+ | +-- quota-manager/ # Quota signal collection
177
+ | +-- auth/ # MiniMax browser auth
178
+ | +-- worktree/ # Git worktree per task
179
+ +-- skills/
180
+ +-- harness-runtime/
181
+ +-- SKILL.md # Skill documentation
110
182
  ```
111
183
 
112
184
  ## Job State Machine
113
185
 
114
186
  ```
115
- created planning queued running testing reviewing
116
-
187
+ created -> planning -> queued -> running -> testing -> reviewing
188
+ v v v v v
117
189
  cancelled blocked waiting_human repairing ready_for_client
118
-
190
+ v v
119
191
  paused_quota archived
120
192
  ```
121
193
 
@@ -136,18 +208,18 @@ All data stored locally in `~/.pi/`:
136
208
 
137
209
  ```
138
210
  ~/.pi/
139
- ├── usage-status/ # /usage data
140
- ├── usage.jsonl
141
- └── mirror.json # per-provider quota mirror
142
- ├── harness/ # /harness data
143
- └── jobs/
144
- └── <job-id>/
145
- ├── checkpoint.json
146
- ├── events.jsonl
147
- ├── task-graph.json
148
- ├── blackboard/
149
- └── repair-tasks.jsonl
150
- └── okf/ # (optional) Your custom OKF knowledge
211
+ +-- usage-status/ # /usage data
212
+ | +-- usage.jsonl
213
+ | +-- mirror.json # per-provider quota mirror
214
+ +-- harness/ # /harness data
215
+ | +-- jobs/
216
+ | +-- <job-id>/
217
+ | +-- checkpoint.json
218
+ | +-- events.jsonl
219
+ | +-- task-graph.json
220
+ | +-- blackboard/
221
+ | +-- repair-tasks.jsonl
222
+ +-- okf/ # (optional) Your custom OKF knowledge
151
223
  ```
152
224
 
153
225
  ## Custom OKF Knowledge (Optional)
@@ -156,9 +228,9 @@ Create `~/.pi/okf/` to add your custom knowledge that the runtime reads during c
156
228
 
157
229
  ```
158
230
  ~/.pi/okf/
159
- ├── <skill-name>.md # Your custom skill/procedure
160
- ├── <domain>.md # Domain-specific knowledge
161
- └── <project>.md # Project-specific rules
231
+ +-- <skill-name>.md # Your custom skill/procedure
232
+ +-- <domain>.md # Domain-specific knowledge
233
+ +-- <project>.md # Project-specific rules
162
234
  ```
163
235
 
164
236
  The runtime automatically detects and reads these files. If the folder doesn't exist, compilation proceeds without them.
@@ -221,7 +293,7 @@ MiniMax: cookies not found — drop any cookie file into
221
293
 
222
294
  The runtime watches `~/.pi-harness-runtime/cookies/` for cookie files. Drop any cookie export there — it syncs within ~1 second:
223
295
 
224
- 1. **Install EditThisCookie** Chrome extension export from `platform.minimax.io`
296
+ 1. **Install EditThisCookie** Chrome extension -> export from `platform.minimax.io`
225
297
  2. **Create the drop folder:**
226
298
 
227
299
  ```bash
@@ -245,6 +317,56 @@ The runtime watches `~/.pi-harness-runtime/cookies/` for cookie files. Drop any
245
317
  **Override:** set `QUOTA_COOKIE_FILE=/path/to/your/cookies.txt` to bypass the sanitizer
246
318
  and read a specific file directly.
247
319
 
320
+ ## herdr Integration (Clipboard Bridge)
321
+
322
+ > **⚠️ This only applies when using herdr.dev**
323
+ >
324
+ > If you're using a normal terminal (iTerm2, Terminal.app, etc.), clipboard works fine — no special setup needed.
325
+
326
+ When running on a **headless server via herdr.dev**, clipboard operations need special setup because:
327
+
328
+ - herdr's `copy_on_select` uses OSC52 which fails in VS Code's integrated terminal PTY
329
+ - UTF-8 box-drawing characters (`┌─┐│└`) get corrupted to garbled text
330
+ - Server-side clipboard tools (`xclip`, `wl-copy`) don't exist
331
+
332
+ ### Quick Setup
333
+
334
+ ```bash
335
+ # Copy the example config (includes clipboard bridge keybinding)
336
+ cp config.toml.example ~/.config/herdr/config.toml
337
+
338
+ # Reload herdr config
339
+ herdr server reload-config
340
+ ```
341
+
342
+ ### Usage
343
+
344
+ 1. **Select text** with mouse in herdr terminal
345
+ 2. Press **`prefix+y`** (prefix is `ctrl+b` by default)
346
+ 3. Text is copied via the bridge to your local clipboard
347
+
348
+ ### How It Works
349
+
350
+ ```
351
+ Select text in herdr
352
+
353
+ Press prefix+y (plugin action)
354
+
355
+ ~/.herdr-clipboard (bridge file)
356
+
357
+ SSH reverse tunnel or tmux buffer
358
+
359
+ Your local machine clipboard
360
+ ```
361
+
362
+ ### Files
363
+
364
+ | File | Purpose |
365
+ |------|---------|
366
+ | `config.toml.example` | Template for `~/.config/herdr/config.toml` |
367
+ | `~/.herdr-clipboard` | Bridge file between herdr and clipboard |
368
+ | `~/.config/herdr/plugins/moocoding.clipboard-bridge/` | herdr plugin |
369
+
248
370
  ### Other Providers
249
371
 
250
372
  No setup needed. The runtime reads TUI messages and captures quota-exhaustion signals.
@@ -256,7 +256,7 @@ export class AutoCompactEngine {
256
256
  return existsSync(join(this.rootDir, "continue_prompt.md"));
257
257
  }
258
258
 
259
- // ─── Private Methods ────────────────────────────────────────────────
259
+ // --- Private Methods ------------------------------------------------
260
260
 
261
261
  private ensureDir(): void {
262
262
  if (!existsSync(this.rootDir)) {
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Autonomous Review Agent — polls for code.written events and auto-triggers review.
3
+ * Human on the loop, not in the loop.
4
+ */
5
+ import { existsSync, readFileSync, writeFileSync } from "fs";
6
+ import { join } from "path";
7
+ import {
8
+ createHerdrBus,
9
+ ensureHerdrWorkspace,
10
+ publishReviewCompletedSimple,
11
+ publishReviewRequestedSimple,
12
+ } from "../packages/event-bus/src/herdr-bus.js";
13
+
14
+ const AGENT_ID = "review-agent";
15
+ const REVIEW_TIMEOUT_MS = 5 * 60 * 1000;
16
+
17
+ type CodeWrittenPayload = { taskId: string; files: string[]; branch?: string };
18
+
19
+ async function runReview(
20
+ bus: ReturnType<typeof createHerdrBus>,
21
+ codePayload: CodeWrittenPayload,
22
+ ): Promise<void> {
23
+ const { taskId, files } = codePayload;
24
+ const reportFile = join(
25
+ ensureHerdrWorkspace().reviews,
26
+ `${taskId}-review.md`,
27
+ );
28
+ console.log(`[${AGENT_ID}] Reviewing task ${taskId}, ${files.length} files`);
29
+
30
+ try {
31
+ publishReviewRequestedSimple(bus, taskId, taskId);
32
+
33
+ const fileBlocks = await Promise.all(
34
+ files.map(async (file) => {
35
+ const content = existsSync(file)
36
+ ? readFileSync(file, "utf-8").slice(0, 5000)
37
+ : `[Not found: ${file}]`;
38
+ return `## ${file}\n\n\`\`\`\n${content}\n\`\`\`\n`;
39
+ }),
40
+ );
41
+
42
+ const report = `# Code Review — Task ${taskId}
43
+ ## Files: ${files.join(", ")}
44
+
45
+ > Auto-generated. GPT review tab fills this in.
46
+
47
+ ${fileBlocks.join("\n")}
48
+ `;
49
+ writeFileSync(reportFile, report);
50
+ console.log(`[${AGENT_ID}] Report: ${reportFile}`);
51
+ publishReviewCompletedSimple(bus, taskId, reportFile, "changes_requested");
52
+
53
+ // Wait for GPT tab to update
54
+ await waitForGptReview(reportFile);
55
+ } catch (err) {
56
+ console.error(`[${AGENT_ID}] Review failed:`, err);
57
+ publishReviewCompletedSimple(bus, taskId, reportFile, "failed");
58
+ }
59
+ }
60
+
61
+ async function waitForGptReview(reportFile: string): Promise<void> {
62
+ const deadline = Date.now() + REVIEW_TIMEOUT_MS;
63
+ while (Date.now() < deadline) {
64
+ if (existsSync(reportFile)) {
65
+ const content = readFileSync(reportFile, "utf-8");
66
+ if (!content.includes("Pending")) return;
67
+ }
68
+ await new Promise((r) => setTimeout(r, 5000));
69
+ }
70
+ console.log(`[${AGENT_ID}] GPT review timed out`);
71
+ }
72
+
73
+ async function main(): Promise<void> {
74
+ console.log(`[${AGENT_ID}] Starting...`);
75
+ const bus = createHerdrBus(AGENT_ID);
76
+ ensureHerdrWorkspace();
77
+ bus.subscribe("code.written");
78
+ bus.startPolling(async (payload) => {
79
+ if (payload.topic === "code.written") {
80
+ const data = payload.data as CodeWrittenPayload;
81
+ if (data.files?.length) runReview(bus, data).catch(console.error);
82
+ }
83
+ });
84
+ console.log(`[${AGENT_ID}] Workspace: ${bus.getWorkspace()}`);
85
+ console.log(`[${AGENT_ID}] Polling for code.written...`);
86
+ }
87
+
88
+ main().catch(console.error);
@@ -6,13 +6,13 @@
6
6
  *
7
7
  * Architecture:
8
8
  * LoopRuntime.executeTask()
9
- * └─> CompactOrchestrator.invokeWithCompact()
10
- * ├─> beforeInvoke():
11
- * 1. Estimate token count with buffer awareness
12
- * 2. Check circuit breaker status
13
- * 3. Microcompact: prune old tool results if time-based
14
- * 4. If over autoCompactThreshold → Full compact via forked summarization
15
- * └─> afterInvoke():
9
+ * +-> CompactOrchestrator.invokeWithCompact()
10
+ * +-> beforeInvoke():
11
+ * | 1. Estimate token count with buffer awareness
12
+ * | 2. Check circuit breaker status
13
+ * | 3. Microcompact: prune old tool results if time-based
14
+ * | 4. If over autoCompactThreshold → Full compact via forked summarization
15
+ * +-> afterInvoke():
16
16
  * 1. Update token stats
17
17
  * 2. Handle reactive 413 (context too long)
18
18
  * 3. Generate continue prompt
@@ -38,12 +38,12 @@ import {
38
38
  } from "./context-window-manager.js";
39
39
  import { continuePromptGenerator } from "./continue-prompt.js";
40
40
 
41
- // ─── Re-exports ────────────────────────────────────────────────────────────────
41
+ // --- Re-exports ----------------------------------------------------------------
42
42
 
43
43
  /** Re-export CompactTriggerReason so harness/index.ts can re-export from here */
44
44
  export type { CompactTriggerReason } from "../packages/types/src/runtime-types.js";
45
45
 
46
- // ─── Callbacks ────────────────────────────────────────────────────────────────
46
+ // --- Callbacks ----------------------------------------------------------------
47
47
 
48
48
  /** Callbacks provided by the harness to handle compact side-effects */
49
49
  export interface CompactOrchestratorCallbacks {
@@ -74,7 +74,7 @@ export interface CompactOrchestratorCallbacks {
74
74
  ) => Promise<{ summary: string; droppedCount: number }>;
75
75
  }
76
76
 
77
- // ─── Config ───────────────────────────────────────────────────────────────────
77
+ // --- Config -------------------------------------------------------------------
78
78
 
79
79
  export interface CompactOrchestratorConfig {
80
80
  jobId: string;
@@ -96,7 +96,7 @@ export interface CompactOrchestratorConfig {
96
96
  contextWindowSize?: number;
97
97
  }
98
98
 
99
- // ─── Orchestrator ─────────────────────────────────────────────────────────────
99
+ // --- Orchestrator -------------------------------------------------------------
100
100
 
101
101
  /**
102
102
  * Compact Orchestrator
@@ -166,7 +166,7 @@ export class CompactOrchestrator {
166
166
  const { messages, model, maxOutputTokens } = opts;
167
167
  this.compactAttempts++;
168
168
 
169
- // ── Estimate tokens with buffer awareness ─────────────────────────────
169
+ // -- Estimate tokens with buffer awareness -----------------------------
170
170
  const estimate = this.contextWindow.estimateTokensWithBuffer({
171
171
  messages,
172
172
  tools: opts.tools,
@@ -175,7 +175,7 @@ export class CompactOrchestrator {
175
175
  model: model ?? this.model,
176
176
  });
177
177
 
178
- // ── Circuit breaker check ─────────────────────────────────────────────
178
+ // -- Circuit breaker check ---------------------------------------------
179
179
  if (this.contextWindow.shouldCircuitBreak()) {
180
180
  return {
181
181
  success: false,
@@ -183,7 +183,7 @@ export class CompactOrchestrator {
183
183
  };
184
184
  }
185
185
 
186
- // ── Blocking: must compact before API call ───────────────────────────
186
+ // -- Blocking: must compact before API call ---------------------------
187
187
  if (this.contextWindow.shouldBlockApiCall(estimate)) {
188
188
  callbacks.onPreCompact?.("token_threshold");
189
189
  const compact = await this.runFullCompact(
@@ -206,10 +206,10 @@ export class CompactOrchestrator {
206
206
  this.contextWindow.recordCompactSuccess();
207
207
  }
208
208
 
209
- // ── Time-based microcompact ─────────────────────────────────────────
209
+ // -- Time-based microcompact -----------------------------------------
210
210
  this.tryMicrocompact(messages);
211
211
 
212
- // ── Proactive auto-compact at 85% ──────────────────────────────────
212
+ // -- Proactive auto-compact at 85% ----------------------------------
213
213
  if (this.contextWindow.shouldProactiveCompact(estimate)) {
214
214
  callbacks.onPreCompact?.("token_threshold");
215
215
  const compact = await this.runFullCompact(
@@ -228,7 +228,7 @@ export class CompactOrchestrator {
228
228
  }
229
229
  }
230
230
 
231
- // ── Make the LLM call ───────────────────────────────────────────────
231
+ // -- Make the LLM call -----------------------------------------------
232
232
  const invoke = opts.invokeAgent ?? callbacks.invokeAgent;
233
233
  if (!invoke) {
234
234
  return {
@@ -242,7 +242,7 @@ export class CompactOrchestrator {
242
242
  // Track tool results
243
243
  this.trackToolResults(messages);
244
244
 
245
- // ── Update stats ─────────────────────────────────────────────────────
245
+ // -- Update stats -----------------------------------------------------
246
246
  if (result.usage) {
247
247
  this.contextWindow.updateStats({
248
248
  provider: this.provider,
@@ -252,7 +252,7 @@ export class CompactOrchestrator {
252
252
  });
253
253
  }
254
254
 
255
- // ── Reactive compact on context-too-long error ─────────────────────
255
+ // -- Reactive compact on context-too-long error ---------------------
256
256
  const isContextError = this.isContextTooLongError(result.error);
257
257
 
258
258
  if (isContextError) {
@@ -326,7 +326,7 @@ export class CompactOrchestrator {
326
326
  return { success: false, error: "Nothing to compact" };
327
327
  }
328
328
 
329
- // ── Generate summary ────────────────────────────────────────────────
329
+ // -- Generate summary ------------------------------------------------
330
330
  let summary = "";
331
331
  let droppedCount = oldMessages.length;
332
332
 
@@ -345,7 +345,7 @@ export class CompactOrchestrator {
345
345
  summary = this.heuristicSummary(oldMessages, reason);
346
346
  }
347
347
 
348
- // ── Build compact boundary message ───────────────────────────────────
348
+ // -- Build compact boundary message -----------------------------------
349
349
  const boundaryMsg: CompactableMessage = {
350
350
  role: "system",
351
351
  content: continuePromptGenerator.generateBoundary({
@@ -361,7 +361,7 @@ export class CompactOrchestrator {
361
361
  },
362
362
  };
363
363
 
364
- // ── Preserve tool results from recent messages ───────────────────────
364
+ // -- Preserve tool results from recent messages -----------------------
365
365
  const preservedRecent = recentMessages.map((msg) => {
366
366
  if (msg.role !== "assistant" || !msg.toolResults) return msg;
367
367
  return {
@@ -373,7 +373,7 @@ export class CompactOrchestrator {
373
373
  };
374
374
  });
375
375
 
376
- // ── Rebuild message array ───────────────────────────────────────────
376
+ // -- Rebuild message array -------------------------------------------
377
377
  messages.length = 0;
378
378
  messages.push(boundaryMsg, ...preservedRecent);
379
379