pi-harness-runtime 0.9.22 → 0.10.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 (393) hide show
  1. package/CHANGELOG.md +49 -7
  2. package/README.md +51 -51
  3. package/footer-status.ts +84 -44
  4. package/harness/auto-compact.ts +1 -1
  5. package/harness/auto-quota-resume.ts +15 -12
  6. package/harness/autonomous-review.ts +88 -0
  7. package/harness/context-compact-orchestrator.ts +23 -23
  8. package/harness/context-window-manager.ts +5 -5
  9. package/harness/continue-prompt.ts +3 -3
  10. package/harness/e2e/minimax-quota-scraper.ts +10 -10
  11. package/harness/e2e/openai-quota-scraper.ts +442 -0
  12. package/harness/forked-summarizer.ts +4 -4
  13. package/harness/herdr-agents.ts +91 -0
  14. package/harness/index.ts +5 -5
  15. package/harness/loop-code-agent.ts +284 -0
  16. package/harness/loop-controller.ts +201 -0
  17. package/harness/loop-review-agent.ts +295 -0
  18. package/harness/loop-runtime.ts +21 -17
  19. package/harness/loop-types.ts +118 -0
  20. package/harness/notification-events.ts +3 -3
  21. package/harness/output-limit-handler.ts +1 -1
  22. package/harness/partial-recovery.ts +3 -3
  23. package/harness/session-memory.ts +5 -5
  24. package/index.ts +211 -80
  25. package/package.json +2 -2
  26. package/packages/a2a-adapter/package.json +1 -1
  27. package/packages/a2a-adapter/src/types.ts +5 -5
  28. package/packages/auth/dist/minimax-browser-auth.d.ts +89 -0
  29. package/packages/auth/dist/minimax-browser-auth.d.ts.map +1 -0
  30. package/packages/auth/dist/minimax-browser-auth.js +890 -0
  31. package/packages/auth/dist/minimax-browser-auth.js.map +1 -0
  32. package/packages/auth/dist/run-minimax-auth.d.ts +19 -0
  33. package/packages/auth/dist/run-minimax-auth.d.ts.map +1 -0
  34. package/packages/auth/dist/run-minimax-auth.js +112 -0
  35. package/packages/auth/dist/run-minimax-auth.js.map +1 -0
  36. package/packages/auth/package.json +1 -1
  37. package/packages/auth/tsconfig.json +9 -0
  38. package/packages/autonomous-refactor/package.json +1 -1
  39. package/packages/autonomous-runtime/dist/inbox.d.ts +3 -3
  40. package/packages/autonomous-runtime/dist/inbox.js +12 -12
  41. package/packages/autonomous-runtime/dist/lease.js +14 -14
  42. package/packages/autonomous-runtime/dist/types.js +1 -1
  43. package/packages/autonomous-runtime/package.json +1 -1
  44. package/packages/autonomous-runtime/src/inbox.ts +12 -12
  45. package/packages/autonomous-runtime/src/lease.ts +15 -15
  46. package/packages/autonomous-runtime/src/types.ts +13 -13
  47. package/packages/autonomous-runtime/tsconfig.tsbuildinfo +1 -1
  48. package/packages/cache-strategy/package.json +1 -1
  49. package/packages/capability-registry/dist/types.js +1 -1
  50. package/packages/capability-registry/package.json +1 -1
  51. package/packages/capability-registry/src/types.ts +5 -5
  52. package/packages/checkpoint/README.md +6 -6
  53. package/packages/checkpoint/dist/differ.js +2 -2
  54. package/packages/checkpoint/dist/engine.js +3 -3
  55. package/packages/checkpoint/dist/index.js +5 -5
  56. package/packages/checkpoint/dist/storage.js +3 -3
  57. package/packages/checkpoint/dist/types.js +1 -1
  58. package/packages/checkpoint/package.json +1 -1
  59. package/packages/checkpoint/src/differ.ts +2 -2
  60. package/packages/checkpoint/src/engine.ts +3 -3
  61. package/packages/checkpoint/src/index.ts +5 -5
  62. package/packages/checkpoint/src/storage.ts +3 -3
  63. package/packages/checkpoint/src/types.ts +10 -10
  64. package/packages/checkpoint/tsconfig.tsbuildinfo +1 -1
  65. package/packages/cli-plugin-sdk/package.json +1 -1
  66. package/packages/clipboard/dist/src/clipboard.d.ts.map +1 -1
  67. package/packages/clipboard/dist/src/clipboard.js +15 -7
  68. package/packages/clipboard/dist/src/clipboard.js.map +1 -1
  69. package/packages/clipboard/package.json +1 -1
  70. package/packages/clipboard/src/clipboard.ts +16 -9
  71. package/packages/code-generation/README.md +13 -13
  72. package/packages/code-generation/dist/faker.js +4 -4
  73. package/packages/code-generation/dist/generator.js +3 -3
  74. package/packages/code-generation/dist/index.js +3 -3
  75. package/packages/code-generation/dist/templates/registry.js +1 -1
  76. package/packages/code-generation/dist/types.js +1 -1
  77. package/packages/code-generation/package.json +1 -1
  78. package/packages/code-generation/src/faker.ts +5 -5
  79. package/packages/code-generation/src/generator.ts +4 -4
  80. package/packages/code-generation/src/index.ts +3 -3
  81. package/packages/code-generation/src/templates/registry.ts +1 -1
  82. package/packages/code-generation/src/types.ts +10 -10
  83. package/packages/code-generation/tsconfig.tsbuildinfo +1 -1
  84. package/packages/code-review/README.md +13 -13
  85. package/packages/code-review/dist/engine.js +3 -3
  86. package/packages/code-review/dist/index.js +3 -3
  87. package/packages/code-review/dist/types.js +1 -1
  88. package/packages/code-review/package.json +1 -1
  89. package/packages/code-review/src/engine.ts +3 -3
  90. package/packages/code-review/src/index.ts +3 -3
  91. package/packages/code-review/src/types.ts +10 -10
  92. package/packages/code-review/tsconfig.tsbuildinfo +1 -1
  93. package/packages/codex-adapter/package.json +1 -1
  94. package/packages/context-compiler/dist/compiler.js +1 -1
  95. package/packages/context-compiler/package.json +1 -1
  96. package/packages/context-compiler/src/compiler.ts +1 -1
  97. package/packages/context-compiler/src/types.ts +11 -11
  98. package/packages/context-compiler/test/context-compiler.test.ts +11 -11
  99. package/packages/context-discovery/package.json +1 -1
  100. package/packages/context-manager/package.json +1 -1
  101. package/packages/cookie-sanitizer/README.md +27 -27
  102. package/packages/cookie-sanitizer/package.json +1 -1
  103. package/packages/cost-optimizer/package.json +1 -1
  104. package/packages/cost-optimizer/src/types.ts +5 -5
  105. package/packages/dependency-analyzer/package.json +1 -1
  106. package/packages/django-plugin/dist/analyzer.js +7 -7
  107. package/packages/django-plugin/package.json +1 -1
  108. package/packages/django-plugin/src/analyzer.ts +7 -7
  109. package/packages/doc-generator/package.json +1 -1
  110. package/packages/evaluation-engine/dist/engine.js +9 -9
  111. package/packages/evaluation-engine/package.json +1 -1
  112. package/packages/evaluation-engine/src/engine.ts +9 -9
  113. package/packages/evaluation-engine/src/types.ts +3 -3
  114. package/packages/evaluation-runner/package.json +1 -1
  115. package/packages/event-bus/dist/src/herdr-bus.d.ts +121 -0
  116. package/packages/event-bus/dist/src/herdr-bus.d.ts.map +1 -0
  117. package/packages/event-bus/dist/src/herdr-bus.js +322 -0
  118. package/packages/event-bus/dist/src/herdr-bus.js.map +1 -0
  119. package/packages/event-bus/dist/src/index.d.ts +2 -0
  120. package/packages/event-bus/dist/src/index.d.ts.map +1 -1
  121. package/packages/event-bus/dist/src/index.js +1 -0
  122. package/packages/event-bus/dist/src/index.js.map +1 -1
  123. package/packages/event-bus/package.json +1 -1
  124. package/packages/event-bus/src/herdr-bus.ts +525 -0
  125. package/packages/event-bus/src/index.ts +29 -0
  126. package/packages/event-store/package.json +1 -1
  127. package/packages/experience-replay/dist/replay.js +7 -7
  128. package/packages/experience-replay/package.json +1 -1
  129. package/packages/experience-replay/src/replay.ts +7 -7
  130. package/packages/experience-replay/src/types.ts +5 -5
  131. package/packages/feedback-collector/package.json +1 -1
  132. package/packages/framework-detector/README.md +18 -18
  133. package/packages/framework-detector/dist/detector.js +3 -3
  134. package/packages/framework-detector/dist/index.js +3 -3
  135. package/packages/framework-detector/dist/signatures/registry.js +24 -24
  136. package/packages/framework-detector/dist/types.js +1 -1
  137. package/packages/framework-detector/package.json +1 -1
  138. package/packages/framework-detector/src/detector.ts +3 -3
  139. package/packages/framework-detector/src/index.ts +3 -3
  140. package/packages/framework-detector/src/signatures/registry.ts +24 -24
  141. package/packages/framework-detector/src/types.ts +7 -7
  142. package/packages/framework-detector/tsconfig.tsbuildinfo +1 -1
  143. package/packages/framework-plugin-sdk/README.md +23 -23
  144. package/packages/framework-plugin-sdk/dist/index.js +2 -2
  145. package/packages/framework-plugin-sdk/dist/manager.js +3 -3
  146. package/packages/framework-plugin-sdk/dist/types.js +2 -2
  147. package/packages/framework-plugin-sdk/package.json +1 -1
  148. package/packages/framework-plugin-sdk/src/index.ts +2 -2
  149. package/packages/framework-plugin-sdk/src/manager.ts +3 -3
  150. package/packages/framework-plugin-sdk/src/types.ts +10 -10
  151. package/packages/framework-plugin-sdk/tsconfig.tsbuildinfo +1 -1
  152. package/packages/frappe-plugin/dist/analyzer.js +8 -8
  153. package/packages/frappe-plugin/dist/types.js +1 -1
  154. package/packages/frappe-plugin/package.json +1 -1
  155. package/packages/frappe-plugin/src/analyzer.ts +8 -8
  156. package/packages/frappe-plugin/src/types.ts +10 -10
  157. package/packages/generic-web-plugin/dist/analyzer.js +5 -5
  158. package/packages/generic-web-plugin/package.json +1 -1
  159. package/packages/generic-web-plugin/src/analyzer.ts +5 -5
  160. package/packages/health-monitor/package.json +1 -1
  161. package/packages/health-monitor/src/monitor.ts +1 -1
  162. package/packages/intent-analyzer/package.json +1 -1
  163. package/packages/laravel-plugin/dist/analyzer.js +11 -11
  164. package/packages/laravel-plugin/package.json +1 -1
  165. package/packages/laravel-plugin/src/analyzer.ts +11 -11
  166. package/packages/learning-engine/dist/engine.js +5 -5
  167. package/packages/learning-engine/dist/types.js +1 -1
  168. package/packages/learning-engine/package.json +1 -1
  169. package/packages/learning-engine/src/engine.ts +5 -5
  170. package/packages/learning-engine/src/types.ts +6 -6
  171. package/packages/mcp-adapter/package.json +1 -1
  172. package/packages/memory-engine/dist/engine.js +8 -8
  173. package/packages/memory-engine/dist/types.js +2 -2
  174. package/packages/memory-engine/package.json +1 -1
  175. package/packages/memory-engine/src/engine.ts +8 -8
  176. package/packages/memory-engine/src/types.ts +9 -9
  177. package/packages/model-registry/package.json +1 -1
  178. package/packages/model-registry/src/types.ts +4 -4
  179. package/packages/nextjs-plugin/dist/analyzer.js +9 -9
  180. package/packages/nextjs-plugin/package.json +1 -1
  181. package/packages/nextjs-plugin/src/analyzer.ts +9 -9
  182. package/packages/notification/dist/notification-center.js +1 -1
  183. package/packages/notification/package.json +1 -1
  184. package/packages/notification/src/notification-center.ts +1 -1
  185. package/packages/observability/dist/alerts.js +2 -2
  186. package/packages/observability/dist/health.js +4 -4
  187. package/packages/observability/dist/index.js +6 -6
  188. package/packages/observability/dist/logger.js +7 -7
  189. package/packages/observability/dist/metrics.js +11 -11
  190. package/packages/observability/dist/tracer.js +3 -3
  191. package/packages/observability/dist/types.js +1 -1
  192. package/packages/observability/package.json +1 -1
  193. package/packages/observability/src/alerts.ts +2 -2
  194. package/packages/observability/src/health.ts +4 -4
  195. package/packages/observability/src/index.ts +6 -6
  196. package/packages/observability/src/logger.ts +7 -7
  197. package/packages/observability/src/metrics.ts +11 -11
  198. package/packages/observability/src/tracer.ts +3 -3
  199. package/packages/observability/src/types.ts +7 -7
  200. package/packages/observability/test/observability.test.ts +4 -4
  201. package/packages/observability/tsconfig.tsbuildinfo +1 -1
  202. package/packages/performance-optimizer/dist/optimizer.js +1 -1
  203. package/packages/performance-optimizer/package.json +1 -1
  204. package/packages/performance-optimizer/src/optimizer.ts +1 -1
  205. package/packages/performance-optimizer/src/types.ts +4 -4
  206. package/packages/privilege-broker/package.json +1 -1
  207. package/packages/project-analyzer/dist/analyzer.js +4 -4
  208. package/packages/project-analyzer/dist/index.js +8 -8
  209. package/packages/project-analyzer/dist/signals.js +3 -3
  210. package/packages/project-analyzer/dist/types.js +1 -1
  211. package/packages/project-analyzer/package.json +1 -1
  212. package/packages/project-analyzer/src/analyzer.ts +4 -4
  213. package/packages/project-analyzer/src/index.ts +9 -9
  214. package/packages/project-analyzer/src/signals.ts +4 -4
  215. package/packages/project-analyzer/src/types.ts +15 -15
  216. package/packages/project-analyzer/test/index.test.ts +17 -17
  217. package/packages/project-analyzer/tsconfig.tsbuildinfo +1 -1
  218. package/packages/projection-engine/package.json +1 -1
  219. package/packages/prompt-compiler/dist/section-builder.js +1 -1
  220. package/packages/prompt-compiler/dist/types.js +3 -3
  221. package/packages/prompt-compiler/package.json +1 -1
  222. package/packages/prompt-compiler/src/section-builder.ts +1 -1
  223. package/packages/prompt-compiler/src/types.ts +12 -12
  224. package/packages/prompt-compiler/test/prompt-compiler.test.ts +12 -12
  225. package/packages/prompt-versioning/package.json +1 -1
  226. package/packages/provider-adapter-sdk/dist/builder.js +1 -1
  227. package/packages/provider-adapter-sdk/dist/index.js +5 -5
  228. package/packages/provider-adapter-sdk/dist/registry.js +1 -1
  229. package/packages/provider-adapter-sdk/dist/tester.js +1 -1
  230. package/packages/provider-adapter-sdk/dist/types.js +1 -1
  231. package/packages/provider-adapter-sdk/package.json +1 -1
  232. package/packages/provider-adapter-sdk/src/builder.ts +1 -1
  233. package/packages/provider-adapter-sdk/src/index.ts +6 -6
  234. package/packages/provider-adapter-sdk/src/registry.ts +1 -1
  235. package/packages/provider-adapter-sdk/src/tester.ts +1 -1
  236. package/packages/provider-adapter-sdk/src/types.ts +5 -5
  237. package/packages/provider-adapter-sdk/tsconfig.tsbuildinfo +1 -1
  238. package/packages/provider-router/package.json +1 -1
  239. package/packages/provider-router/src/types.ts +4 -4
  240. package/packages/provider-selector/package.json +1 -1
  241. package/packages/providers/dist/deepagents-adapter.js +1 -1
  242. package/packages/providers/dist/provider-id.d.ts +5 -0
  243. package/packages/providers/dist/provider-id.d.ts.map +1 -1
  244. package/packages/providers/dist/provider-id.js +6 -1
  245. package/packages/providers/dist/provider-id.js.map +1 -1
  246. package/packages/providers/package.json +1 -1
  247. package/packages/providers/src/deepagents-adapter.ts +1 -1
  248. package/packages/providers/src/provider-id.ts +6 -1
  249. package/packages/quota-manager/dist/tui-usage-monitor.d.ts.map +1 -1
  250. package/packages/quota-manager/dist/tui-usage-monitor.js +0 -6
  251. package/packages/quota-manager/dist/tui-usage-monitor.js.map +1 -1
  252. package/packages/quota-manager/package.json +1 -1
  253. package/packages/quota-manager/src/tui-usage-monitor.ts +0 -21
  254. package/packages/rate-limiter/package.json +1 -1
  255. package/packages/react-vite-plugin/dist/analyzer.js +7 -7
  256. package/packages/react-vite-plugin/package.json +1 -1
  257. package/packages/react-vite-plugin/src/analyzer.ts +7 -7
  258. package/packages/release-manager/package.json +1 -1
  259. package/packages/requirement-compiler/dist/compiler.js +17 -17
  260. package/packages/requirement-compiler/dist/types.js +2 -2
  261. package/packages/requirement-compiler/package.json +1 -1
  262. package/packages/requirement-compiler/src/compiler.ts +17 -17
  263. package/packages/requirement-compiler/src/types.ts +21 -21
  264. package/packages/requirement-compiler/test/requirement-compiler.test.ts +17 -17
  265. package/packages/runtime/dist/command-executor.js +1 -1
  266. package/packages/runtime/dist/local-runtime-agent.js +1 -1
  267. package/packages/runtime/dist/policy-engine.js +1 -1
  268. package/packages/runtime/dist/runtime-api.js +1 -1
  269. package/packages/runtime/dist/workspace-manager.js +1 -1
  270. package/packages/runtime/package.json +1 -1
  271. package/packages/runtime/src/command-executor.ts +1 -1
  272. package/packages/runtime/src/local-runtime-agent.ts +1 -1
  273. package/packages/runtime/src/policy-engine.ts +1 -1
  274. package/packages/runtime/src/runtime-api.ts +1 -1
  275. package/packages/runtime/src/workspace-manager.ts +1 -1
  276. package/packages/scheduler/package.json +1 -1
  277. package/packages/scheduler-adapter/package.json +1 -1
  278. package/packages/session/README.md +18 -18
  279. package/packages/session/dist/history.js +3 -3
  280. package/packages/session/dist/index.js +5 -5
  281. package/packages/session/dist/manager.js +3 -3
  282. package/packages/session/dist/policy.js +2 -2
  283. package/packages/session/dist/store.js +2 -2
  284. package/packages/session/dist/types.js +1 -1
  285. package/packages/session/package.json +1 -1
  286. package/packages/session/src/history.ts +3 -3
  287. package/packages/session/src/index.ts +5 -5
  288. package/packages/session/src/manager.ts +3 -3
  289. package/packages/session/src/policy.ts +4 -4
  290. package/packages/session/src/store.ts +3 -3
  291. package/packages/session/src/types.ts +10 -10
  292. package/packages/session/tsconfig.tsbuildinfo +1 -1
  293. package/packages/session-api/package.json +1 -1
  294. package/packages/session-export/package.json +1 -1
  295. package/packages/shared-context/package.json +1 -1
  296. package/packages/skill-registry/package.json +1 -1
  297. package/packages/skill-registry/src/types.ts +4 -4
  298. package/packages/sprint-planner/package.json +1 -1
  299. package/packages/subscription-engine/package.json +1 -1
  300. package/packages/task-compiler/dist/compiler.js +7 -7
  301. package/packages/task-compiler/dist/decompose.js +11 -11
  302. package/packages/task-compiler/dist/file-scope.js +6 -6
  303. package/packages/task-compiler/dist/graph.js +6 -6
  304. package/packages/task-compiler/dist/index.js +2 -2
  305. package/packages/task-compiler/dist/types.js +5 -5
  306. package/packages/task-compiler/dist/validate.js +2 -2
  307. package/packages/task-compiler/dist/verification.js +2 -2
  308. package/packages/task-compiler/package.json +1 -1
  309. package/packages/task-compiler/src/command-policy.ts +1 -1
  310. package/packages/task-compiler/src/compiler.ts +7 -7
  311. package/packages/task-compiler/src/decompose.ts +11 -11
  312. package/packages/task-compiler/src/file-scope.ts +6 -6
  313. package/packages/task-compiler/src/graph.ts +6 -6
  314. package/packages/task-compiler/src/index.ts +3 -3
  315. package/packages/task-compiler/src/types.ts +14 -14
  316. package/packages/task-compiler/src/validate.ts +2 -2
  317. package/packages/task-compiler/src/verification.ts +2 -2
  318. package/packages/task-compiler/test/task-compiler.test.ts +10 -10
  319. package/packages/test-data-generator/README.md +13 -13
  320. package/packages/test-data-generator/dist/faker-adapter.js +4 -4
  321. package/packages/test-data-generator/dist/generator.js +3 -3
  322. package/packages/test-data-generator/dist/index.js +3 -3
  323. package/packages/test-data-generator/dist/types.js +1 -1
  324. package/packages/test-data-generator/package.json +1 -1
  325. package/packages/test-data-generator/src/faker-adapter.ts +4 -4
  326. package/packages/test-data-generator/src/generator.ts +3 -3
  327. package/packages/test-data-generator/src/index.ts +3 -3
  328. package/packages/test-data-generator/src/types.ts +9 -9
  329. package/packages/test-data-generator/tsconfig.tsbuildinfo +1 -1
  330. package/packages/test-generator/package.json +1 -1
  331. package/packages/token-estimation/package.json +1 -1
  332. package/packages/token-optimizer/package.json +1 -1
  333. package/packages/tui/package.json +1 -1
  334. package/packages/types/package.json +1 -1
  335. package/packages/types/src/agent-worker-types.ts +5 -5
  336. package/packages/types/src/runtime-types.ts +12 -12
  337. package/packages/types/tsconfig.tsbuildinfo +1 -1
  338. package/packages/workflow-events/package.json +1 -1
  339. package/packages/workspace-scanner/package.json +1 -1
  340. package/packages/worktree/package.json +1 -1
  341. package/renderer.ts +7 -7
  342. package/skills/harness-runtime/SKILL.md +15 -15
  343. package/packages/dependency-analyzer/dist/analyzer.d.ts +0 -17
  344. package/packages/dependency-analyzer/dist/analyzer.d.ts.map +0 -1
  345. package/packages/dependency-analyzer/dist/analyzer.js +0 -106
  346. package/packages/dependency-analyzer/dist/analyzer.js.map +0 -1
  347. package/packages/dependency-analyzer/dist/imports.d.ts +0 -12
  348. package/packages/dependency-analyzer/dist/imports.d.ts.map +0 -1
  349. package/packages/dependency-analyzer/dist/imports.js +0 -73
  350. package/packages/dependency-analyzer/dist/imports.js.map +0 -1
  351. package/packages/dependency-analyzer/dist/index.d.ts +0 -4
  352. package/packages/dependency-analyzer/dist/index.d.ts.map +0 -1
  353. package/packages/dependency-analyzer/dist/index.js +0 -3
  354. package/packages/dependency-analyzer/dist/index.js.map +0 -1
  355. package/packages/dependency-analyzer/dist/test/analyzer.test.js +0 -37
  356. package/packages/dependency-analyzer/dist/types.d.ts +0 -28
  357. package/packages/dependency-analyzer/dist/types.d.ts.map +0 -1
  358. package/packages/dependency-analyzer/dist/types.js +0 -5
  359. package/packages/dependency-analyzer/dist/types.js.map +0 -1
  360. package/packages/intent-analyzer/dist/analyzer.d.ts +0 -13
  361. package/packages/intent-analyzer/dist/analyzer.d.ts.map +0 -1
  362. package/packages/intent-analyzer/dist/analyzer.js +0 -72
  363. package/packages/intent-analyzer/dist/analyzer.js.map +0 -1
  364. package/packages/intent-analyzer/dist/index.d.ts +0 -3
  365. package/packages/intent-analyzer/dist/index.d.ts.map +0 -1
  366. package/packages/intent-analyzer/dist/index.js +0 -2
  367. package/packages/intent-analyzer/dist/index.js.map +0 -1
  368. package/packages/intent-analyzer/dist/test/analyzer.test.js +0 -56
  369. package/packages/intent-analyzer/dist/types.d.ts +0 -26
  370. package/packages/intent-analyzer/dist/types.d.ts.map +0 -1
  371. package/packages/intent-analyzer/dist/types.js +0 -7
  372. package/packages/intent-analyzer/dist/types.js.map +0 -1
  373. package/packages/workspace-scanner/dist/detect.d.ts +0 -3
  374. package/packages/workspace-scanner/dist/detect.d.ts.map +0 -1
  375. package/packages/workspace-scanner/dist/detect.js +0 -58
  376. package/packages/workspace-scanner/dist/detect.js.map +0 -1
  377. package/packages/workspace-scanner/dist/git.d.ts +0 -7
  378. package/packages/workspace-scanner/dist/git.d.ts.map +0 -1
  379. package/packages/workspace-scanner/dist/git.js +0 -75
  380. package/packages/workspace-scanner/dist/git.js.map +0 -1
  381. package/packages/workspace-scanner/dist/index.d.ts +0 -5
  382. package/packages/workspace-scanner/dist/index.d.ts.map +0 -1
  383. package/packages/workspace-scanner/dist/index.js +0 -4
  384. package/packages/workspace-scanner/dist/index.js.map +0 -1
  385. package/packages/workspace-scanner/dist/scanner.d.ts +0 -11
  386. package/packages/workspace-scanner/dist/scanner.d.ts.map +0 -1
  387. package/packages/workspace-scanner/dist/scanner.js +0 -46
  388. package/packages/workspace-scanner/dist/scanner.js.map +0 -1
  389. package/packages/workspace-scanner/dist/test/scanner.test.js +0 -34
  390. package/packages/workspace-scanner/dist/types.d.ts +0 -35
  391. package/packages/workspace-scanner/dist/types.d.ts.map +0 -1
  392. package/packages/workspace-scanner/dist/types.js +0 -5
  393. package/packages/workspace-scanner/dist/types.js.map +0 -1
package/index.ts CHANGED
@@ -22,6 +22,7 @@ import type {
22
22
  import { UsageTracker } from "./tracker.ts";
23
23
  import { MirrorStore, type MirrorRecord } from "./mirror.ts";
24
24
  import { MiniMaxQuotaScraper } from "./harness/e2e/minimax-quota-scraper.js";
25
+ import { OpenAIQuotaScraper } from "./harness/e2e/openai-quota-scraper.js";
25
26
  import { parseMiniMaxQuotaText } from "./harness/e2e/minimax-quota-parser.js";
26
27
  import {
27
28
  CookieWatcher,
@@ -64,10 +65,54 @@ import {
64
65
  } from "./harness/blackboard.ts";
65
66
  import { scheduleAutoResume, cancelAutoResume } from "./harness/index.js";
66
67
  import { homedir } from "node:os";
67
- import { existsSync, mkdirSync } from "node:fs";
68
+ import { appendFileSync, existsSync, mkdirSync } from "node:fs";
68
69
  import { join } from "node:path";
69
70
 
70
- // ─── Harness Runtime State ────────────────────────────────────────────
71
+ // --- Debug log → file instead of TUI ---------------------------------
72
+ const DEBUG_LOG_DIR = join(homedir(), ".pi", "harness-logs");
73
+ const DEBUG_LOG_PATH = join(DEBUG_LOG_DIR, "harness-debug.log");
74
+
75
+ try {
76
+ if (!existsSync(DEBUG_LOG_DIR)) mkdirSync(DEBUG_LOG_DIR, { recursive: true });
77
+ } catch {
78
+ /* non-fatal */
79
+ }
80
+
81
+ // Write harness runtime logs to file only (NOT to TUI stdout)
82
+ function _debugLog(...args: unknown[]): void {
83
+ try {
84
+ const line =
85
+ new Date().toISOString() +
86
+ " " +
87
+ args
88
+ .map((a) => (typeof a === "object" ? JSON.stringify(a) : String(a)))
89
+ .join(" ");
90
+ appendFileSync(DEBUG_LOG_PATH, line + "\n");
91
+ } catch {
92
+ // non-fatal
93
+ }
94
+ }
95
+
96
+ // --- Selective console override — harness DEBUG → file only --------
97
+ // Real errors (no [DEBUG prefix) still print to TUI so you notice problems.
98
+ const _origLog = console.log.bind(console);
99
+ const _origError = console.error.bind(console);
100
+
101
+ console.log = (...args: unknown[]) => {
102
+ _origLog(...args);
103
+ _debugLog(...args);
104
+ };
105
+ console.error = (...args: unknown[]) => {
106
+ const first = String(args[0] ?? "");
107
+ if (first.startsWith("[DEBUG")) {
108
+ _debugLog(...args);
109
+ } else {
110
+ _origError(...args);
111
+ _debugLog(...args);
112
+ }
113
+ };
114
+
115
+ // --- Harness Runtime State --------------------------------------------
71
116
  const HARNESS_ROOT_DIR = join(homedir(), ".pi", "harness");
72
117
 
73
118
  interface HarnessSession {
@@ -166,7 +211,7 @@ export default function (pi: ExtensionAPI) {
166
211
  const mirrorStore = new MirrorStore();
167
212
  ensureHarnessDir();
168
213
 
169
- // ─── Auto-track every assistant message ──────────────────────────────
214
+ // --- Auto-track every assistant message ------------------------------
170
215
  pi.on("message_end", async (event, ctx) => {
171
216
  if (isOutputLimitResumePromptMessage(event.message)) {
172
217
  pendingOutputLimitResumeAfterSettled = false;
@@ -175,7 +220,6 @@ export default function (pi: ExtensionAPI) {
175
220
  if (event.message.role !== "assistant") return;
176
221
 
177
222
  // DEBUG: Log model ID
178
- console.log("[DEBUG message_end] ctx.model?.id =", ctx.model?.id);
179
223
 
180
224
  const m = event.message as {
181
225
  role?: string;
@@ -224,18 +268,17 @@ export default function (pi: ExtensionAPI) {
224
268
  try {
225
269
  const text = readMessageText(event.message);
226
270
  if (text) {
227
- console.log(
228
- "[DEBUG message_end] Processing TUI text (first 200 chars):",
229
- text.substring(0, 200),
230
- );
271
+ // "[DEBUG message_end] Processing TUI text (first 200 chars):",
272
+ // text.substring(0, 200),
273
+ // );
231
274
  tuiMonitor.processMessage(text);
232
275
  }
233
276
  } catch (e) {
234
- console.error("[DEBUG message_end] TUI processMessage error:", e);
277
+ // console.error("[DEBUG message_end] TUI processMessage error:", e);
235
278
  }
236
279
  });
237
280
 
238
- // ─── Smart quota fetch for MiniMax status ────────────────────────
281
+ // --- Smart quota fetch for MiniMax status ------------------------
239
282
  const MINIMAX_REFRESH_MIN_INTERVAL_MS = 15 * 60 * 1000;
240
283
  const MINIMAX_REFRESH_TOKEN_THRESHOLD = 200_000;
241
284
  const MINIMAX_REFRESH_REQUEST_THRESHOLD = 12;
@@ -243,7 +286,12 @@ export default function (pi: ExtensionAPI) {
243
286
  ? new MiniMaxQuotaScraper({ cookieFile: process.env.QUOTA_COOKIE_FILE })
244
287
  : new MiniMaxQuotaScraper();
245
288
 
246
- // ─── Cookie sanitizer integration ────────────────────────────────────
289
+ // --- Smart quota fetch for OpenAI status -------------------------
290
+ const OPENAI_REFRESH_MIN_INTERVAL_MS = 5 * 60 * 1000; // 5 minutes
291
+ const _openaiQuotaScraper = new OpenAIQuotaScraper();
292
+ let lastOpenAIQuotaFetchAt = 0;
293
+
294
+ // --- Cookie sanitizer integration ------------------------------------
247
295
  // The drop folder is the user-facing, forgiving input. The canonical
248
296
  // cache (`~/.config/minimax-cookies.txt`) is the runtime-owned,
249
297
  // normalized output that `MiniMaxQuotaScraper` reads. Either being
@@ -266,7 +314,7 @@ export default function (pi: ExtensionAPI) {
266
314
 
267
315
  const cookieQuotaAutoFetchAvailable = hasCookieSource();
268
316
 
269
- // ─── TUI quota signal plumbing (OpenAI / GLM / Anthropic / OpenRouter) ──
317
+ // --- TUI quota signal plumbing (OpenAI / GLM / Anthropic / OpenRouter) --
270
318
  // The TUIUsageMonitor parses provider quota-exhaustion messages from pi's
271
319
  // TUI / message stream and emits signals we write to per-provider mirror
272
320
  // entries. For providers that don't expose a continuous usage API this is
@@ -275,10 +323,9 @@ export default function (pi: ExtensionAPI) {
275
323
  const tuiMonitor = new TUIUsageMonitor({ quotaManager });
276
324
 
277
325
  tuiMonitor.on("signal", (signal: TUIUsageSignal) => {
278
- console.log(
279
- "[DEBUG tuiMonitor signal] Received signal:",
280
- JSON.stringify(signal),
281
- );
326
+ // "[DEBUG tuiMonitor signal] Received signal:",
327
+ // JSON.stringify(signal),
328
+ // );
282
329
  try {
283
330
  writeMirrorRecord(signal.provider as ProviderId, {
284
331
  synced_at: signal.timestamp,
@@ -299,7 +346,7 @@ export default function (pi: ExtensionAPI) {
299
346
  // Live watcher — sanitises on every change in the drop folder.
300
347
  const cookieWatcher = new CookieWatcher({
301
348
  dropDir: cookieDropDir,
302
- syncOptions: { cachePath: cookieCachePath },
349
+ syncOptions: { cachePath: cookieCachePath, providerHint: "minimax" },
303
350
  onEvent: (event) => {
304
351
  if (event.kind === "sync-error" || event.kind === "watcher-error") {
305
352
  const msg = "message" in event ? event.message : "";
@@ -324,6 +371,9 @@ export default function (pi: ExtensionAPI) {
324
371
  });
325
372
  try {
326
373
  cookieWatcher.start();
374
+ // Sync existing drop-folder cookies now (ignoreInitial: true means
375
+ // the watcher won't do this automatically on startup).
376
+ cookieWatcher.triggerNow();
327
377
  } catch (e) {
328
378
  const msg = e instanceof Error ? e.message : String(e);
329
379
  if (msg.includes("ENOSPC")) {
@@ -360,12 +410,11 @@ export default function (pi: ExtensionAPI) {
360
410
  provider: ProviderId,
361
411
  record: Omit<import("./mirror.js").ProviderMirrorRecord, "provider">,
362
412
  ): void {
363
- console.log(
364
- "[DEBUG writeMirrorRecord] Writing record for provider:",
365
- provider,
366
- "record:",
367
- JSON.stringify(record),
368
- );
413
+ // "[DEBUG writeMirrorRecord] Writing record for provider:",
414
+ // provider,
415
+ // "record:",
416
+ // JSON.stringify(record),
417
+ // );
369
418
  mirrorStore.writeProvider(provider, { ...record, provider });
370
419
  if (footerStatusCtx) {
371
420
  refreshFooterStatus(
@@ -399,12 +448,11 @@ export default function (pi: ExtensionAPI) {
399
448
  /** Set the active provider; triggers a footer refresh. */
400
449
  function noteActiveProvider(modelId: string | null | undefined): void {
401
450
  const p = providerFromModelId(modelId);
402
- console.log(
403
- "[DEBUG noteActiveProvider] modelId =",
404
- modelId,
405
- "-> provider =",
406
- p,
407
- );
451
+ // "[DEBUG noteActiveProvider] modelId =",
452
+ // modelId,
453
+ // "-> provider =",
454
+ // p,
455
+ // );
408
456
  if (p !== lastActiveProvider) {
409
457
  lastActiveProvider = p;
410
458
  if (footerStatusCtx) {
@@ -535,43 +583,123 @@ export default function (pi: ExtensionAPI) {
535
583
  }
536
584
  }
537
585
 
586
+ /**
587
+ * Auto-fetch OpenAI quota via ChatGPT Codex analytics.
588
+ * GPT has WEEKLY-ONLY limits (no 5h window).
589
+ */
590
+ async function autoFetchOpenAIQuota(options?: {
591
+ suppressErrors?: boolean;
592
+ }): Promise<boolean> {
593
+ const suppressErrors = options?.suppressErrors === true;
594
+
595
+ try {
596
+ // Try direct API first (faster)
597
+ const directResult = await _openaiQuotaScraper.scrapeDirect();
598
+ if (directResult) {
599
+ writeMirrorRecord("openai", {
600
+ synced_at: directResult.scrapedAt,
601
+ source: "scrape",
602
+ weekly_used_pct: directResult.weeklyUsedPct,
603
+ weekly_resets_at: directResult.weeklyResetsAt,
604
+ weekly_resets_at_epoch: directResult.weeklyResetsAtEpoch,
605
+ // No 5h window for GPT - set to undefined
606
+ h5_used_pct: undefined,
607
+ });
608
+ return true;
609
+ }
610
+
611
+ // Fall back to browser scrape
612
+ const data = await _openaiQuotaScraper.scrape();
613
+ writeMirrorRecord("openai", {
614
+ synced_at: data.scrapedAt,
615
+ source: "scrape",
616
+ weekly_used_pct: data.weeklyUsedPct,
617
+ weekly_resets_at: data.weeklyResetsAt,
618
+ weekly_resets_at_epoch: data.weeklyResetsAtEpoch,
619
+ // No 5h window for GPT - set to undefined
620
+ h5_used_pct: undefined,
621
+ });
622
+ return true;
623
+ } catch (error) {
624
+ if (!suppressErrors) {
625
+ console.error(
626
+ "[pi-harness] OpenAI quota auto-fetch skipped:",
627
+ error instanceof Error ? error.message : String(error),
628
+ );
629
+ }
630
+ return false;
631
+ }
632
+ }
633
+
538
634
  async function maybeAutoFetchQuota(
539
635
  modelId: string | null | undefined,
540
636
  ): Promise<void> {
541
- if (!isMiniMaxModel(modelId) || quotaAutoFetchInFlight) {
542
- return;
543
- }
637
+ const provider = providerFromModelId(modelId);
638
+
639
+ // MiniMax path
640
+ if (provider === "minimax") {
641
+ if (quotaAutoFetchInFlight) return;
544
642
 
545
- const nowMs = Date.now();
546
- if (nowMs - lastQuotaAutoFetchAt < MINIMAX_REFRESH_MIN_INTERVAL_MS) {
643
+ const nowMs = Date.now();
644
+ if (nowMs - lastQuotaAutoFetchAt < MINIMAX_REFRESH_MIN_INTERVAL_MS) {
645
+ return;
646
+ }
647
+
648
+ const mirror = mirrorStore.read();
649
+ const freshness = mirrorStore.freshness(mirror, nowMs);
650
+ const shouldFetchBaseline = !mirror || freshness === "expired";
651
+ const usageSinceSync = getMiniMaxUsageSince(
652
+ mirror?.synced_at ? Date.parse(mirror.synced_at) : 0,
653
+ );
654
+ const shouldFetchFromUsage =
655
+ usageSinceSync.tokens >= MINIMAX_REFRESH_TOKEN_THRESHOLD ||
656
+ usageSinceSync.requests >= MINIMAX_REFRESH_REQUEST_THRESHOLD ||
657
+ (freshness === "stale" && usageSinceSync.requests > 0);
658
+
659
+ if (!shouldFetchBaseline && !shouldFetchFromUsage) {
660
+ return;
661
+ }
662
+
663
+ quotaAutoFetchInFlight = true;
664
+ lastQuotaAutoFetchAt = nowMs;
665
+ try {
666
+ await autoFetchQuota({ suppressErrors: true });
667
+ } finally {
668
+ quotaAutoFetchInFlight = false;
669
+ }
547
670
  return;
548
671
  }
549
672
 
550
- const mirror = mirrorStore.read();
551
- const freshness = mirrorStore.freshness(mirror, nowMs);
552
- const shouldFetchBaseline = !mirror || freshness === "expired";
553
- const usageSinceSync = getMiniMaxUsageSince(
554
- mirror?.synced_at ? Date.parse(mirror.synced_at) : 0,
555
- );
556
- const shouldFetchFromUsage =
557
- usageSinceSync.tokens >= MINIMAX_REFRESH_TOKEN_THRESHOLD ||
558
- usageSinceSync.requests >= MINIMAX_REFRESH_REQUEST_THRESHOLD ||
559
- (freshness === "stale" && usageSinceSync.requests > 0);
673
+ // OpenAI path (GPT has weekly-only limits, no 5h window)
674
+ if (provider === "openai") {
675
+ if (quotaAutoFetchInFlight) return;
676
+
677
+ const nowMs = Date.now();
678
+ if (nowMs - lastOpenAIQuotaFetchAt < OPENAI_REFRESH_MIN_INTERVAL_MS) {
679
+ return;
680
+ }
681
+
682
+ // Check if OpenAI cookie file exists
683
+ const openaiCookieFile = join(homedir(), ".config", "openai-cookies.txt");
684
+ if (!existsSync(openaiCookieFile)) {
685
+ return;
686
+ }
560
687
 
561
- if (!shouldFetchBaseline && !shouldFetchFromUsage) {
688
+ quotaAutoFetchInFlight = true;
689
+ lastOpenAIQuotaFetchAt = nowMs;
690
+ try {
691
+ await autoFetchOpenAIQuota({ suppressErrors: true });
692
+ } finally {
693
+ quotaAutoFetchInFlight = false;
694
+ }
562
695
  return;
563
696
  }
564
697
 
565
- quotaAutoFetchInFlight = true;
566
- lastQuotaAutoFetchAt = nowMs;
567
- try {
568
- await autoFetchQuota({ suppressErrors: true });
569
- } finally {
570
- quotaAutoFetchInFlight = false;
571
- }
698
+ // Other providers (GLM, Anthropic, etc.) - TUI signal path only for now
699
+ return;
572
700
  }
573
701
 
574
- // ─── /usage — show full status ───────────────────────────────────────
702
+ // --- /usage — show full status ---------------------------------------
575
703
  pi.registerCommand("usage", {
576
704
  description: "Show Codex-style usage status (local + provider mirror)",
577
705
  handler: async (_args: string, ctx: ExtensionCommandContext) => {
@@ -589,7 +717,7 @@ export default function (pi: ExtensionAPI) {
589
717
  },
590
718
  });
591
719
 
592
- // ─── /usage refresh — force auto-fetch ────────────────────────────
720
+ // --- /usage refresh — force auto-fetch ----------------------------
593
721
  pi.registerCommand("usage-refresh", {
594
722
  description: "Force refresh quota from provider console",
595
723
  handler: async (_args: string, ctx: ExtensionCommandContext) => {
@@ -614,14 +742,14 @@ export default function (pi: ExtensionAPI) {
614
742
  },
615
743
  });
616
744
 
617
- // ─── /usage today — focused view ─────────────────────────────────────
745
+ // --- /usage today — focused view -------------------------------------
618
746
  pi.registerCommand("usage-today", {
619
747
  description: "Show today's usage + 5h window",
620
748
  handler: async (_args: string, ctx: ExtensionCommandContext) => {
621
749
  const local = aggregateWindows(tracker.all());
622
750
  const lines = [
623
751
  " Today's usage",
624
- "─────────────────────────────────────",
752
+ "-------------------------------------",
625
753
  ` Model: ${ctx.model?.id ?? "unknown"}`,
626
754
  ` Today: ${local.today.tokens} tokens · ${local.today.requests} requests · $${local.today.cost.toFixed(4)}`,
627
755
  ` This 5h: ${local.five_h.tokens} tokens · ${local.five_h.requests} requests · $${local.five_h.cost.toFixed(4)}`,
@@ -632,14 +760,14 @@ export default function (pi: ExtensionAPI) {
632
760
  },
633
761
  });
634
762
 
635
- // ─── /usage week — focused view ──────────────────────────────────────
763
+ // --- /usage week — focused view --------------------------------------
636
764
  pi.registerCommand("usage-week", {
637
765
  description: "Show this week's usage + lifetime totals",
638
766
  handler: async (_args: string, ctx: ExtensionCommandContext) => {
639
767
  const local = aggregateWindows(tracker.all());
640
768
  const lines = [
641
769
  " This week's usage",
642
- "─────────────────────────────────────",
770
+ "-------------------------------------",
643
771
  ` Model: ${ctx.model?.id ?? "unknown"}`,
644
772
  ` This week: ${local.weekly.tokens} tokens · ${local.weekly.requests} requests · $${local.weekly.cost.toFixed(4)}`,
645
773
  ` Lifetime: ${local.lifetime.tokens} tokens · ${local.lifetime.requests} requests · $${local.lifetime.cost.toFixed(4)}`,
@@ -650,7 +778,7 @@ export default function (pi: ExtensionAPI) {
650
778
  },
651
779
  });
652
780
 
653
- // ─── /usage reset — clear mirror ─────────────────────────────────────
781
+ // --- /usage reset — clear mirror -------------------------------------
654
782
  pi.registerCommand("usage-reset", {
655
783
  description: "Clear the provider mirror (force re-sync next time)",
656
784
  handler: async (_args: string, ctx: ExtensionCommandContext) => {
@@ -690,7 +818,7 @@ export default function (pi: ExtensionAPI) {
690
818
  },
691
819
  });
692
820
 
693
- // ─── /harness start — Start a new harness job ──────────────────────
821
+ // --- /harness start — Start a new harness job ----------------------
694
822
  pi.registerCommand("harness-start", {
695
823
  description: "Start a new harness job: /harness start <requirement>",
696
824
  handler: async (args: string, ctx: ExtensionCommandContext) => {
@@ -762,7 +890,7 @@ export default function (pi: ExtensionAPI) {
762
890
  },
763
891
  });
764
892
 
765
- // ─── /harness status — Show harness job status ─────────────────────
893
+ // --- /harness status — Show harness job status ---------------------
766
894
  pi.registerCommand("harness-status", {
767
895
  description: "Show current harness job status",
768
896
  handler: async (_args: string, ctx: ExtensionCommandContext) => {
@@ -783,22 +911,22 @@ export default function (pi: ExtensionAPI) {
783
911
  const progress = currentSession.graph.getProgressSummary();
784
912
  const lines = [
785
913
  `Harness Job Status`,
786
- `${"─".repeat(40)}`,
914
+ `${"-".repeat(40)}`,
787
915
  `Job ID: ${currentSession.jobId}`,
788
916
  `Status: ${summary.status}`,
789
917
  `Terminal: ${summary.isTerminal ? "Yes" : "No"}`,
790
918
  `Can Resume: ${summary.canResume ? "Yes" : "No"}`,
791
- `${"─".repeat(40)}`,
919
+ `${"-".repeat(40)}`,
792
920
  `Tasks: ${progress.done}/${progress.total} done, ${progress.running} running, ${progress.failed} failed`,
793
921
  `Created: ${currentSession.createdAt}`,
794
- `${"─".repeat(40)}`,
922
+ `${"-".repeat(40)}`,
795
923
  `Run /harness tasks for task list`,
796
924
  ];
797
925
  ctx.ui.notify(lines.join("\n"), "info");
798
926
  },
799
927
  });
800
928
 
801
- // ─── /harness tasks — List all tasks ───────────────────────────────
929
+ // --- /harness tasks — List all tasks -------------------------------
802
930
  pi.registerCommand("harness-tasks", {
803
931
  description: "List all tasks in the current harness job",
804
932
  handler: async (_args: string, ctx: ExtensionCommandContext) => {
@@ -821,7 +949,7 @@ export default function (pi: ExtensionAPI) {
821
949
 
822
950
  const lines = [
823
951
  `Tasks for Job ${currentSession.jobId}`,
824
- `${"─".repeat(50)}`,
952
+ `${"-".repeat(50)}`,
825
953
  ];
826
954
 
827
955
  for (const task of tasks) {
@@ -829,14 +957,14 @@ export default function (pi: ExtensionAPI) {
829
957
  lines.push(`[${task.id}] ${status} ${task.title}`);
830
958
  }
831
959
 
832
- lines.push(`${"─".repeat(50)}`);
960
+ lines.push(`${"-".repeat(50)}`);
833
961
  const ready = currentSession.graph.getReadyTasks();
834
962
  lines.push(`${ready.length} tasks ready to execute.`);
835
963
  ctx.ui.notify(lines.join("\n"), "info");
836
964
  },
837
965
  });
838
966
 
839
- // ─── /harness pause — Pause the harness job ───────────────────────
967
+ // --- /harness pause — Pause the harness job -----------------------
840
968
  pi.registerCommand("harness-pause", {
841
969
  description: "Pause the current harness job",
842
970
  handler: async (_args: string, ctx: ExtensionCommandContext) => {
@@ -892,7 +1020,7 @@ export default function (pi: ExtensionAPI) {
892
1020
  },
893
1021
  });
894
1022
 
895
- // ─── /harness resume — Resume the harness job ───────────────────────
1023
+ // --- /harness resume — Resume the harness job -----------------------
896
1024
  pi.registerCommand("harness-resume", {
897
1025
  description: "Resume a paused harness job",
898
1026
  handler: async (_args: string, ctx: ExtensionCommandContext) => {
@@ -928,7 +1056,7 @@ export default function (pi: ExtensionAPI) {
928
1056
  },
929
1057
  });
930
1058
 
931
- // ─── /harness cancel — Cancel the harness job ──────────────────────
1059
+ // --- /harness cancel — Cancel the harness job ----------------------
932
1060
  pi.registerCommand("harness-cancel", {
933
1061
  description: "Cancel the current harness job",
934
1062
  handler: async (_args: string, ctx: ExtensionCommandContext) => {
@@ -965,7 +1093,7 @@ export default function (pi: ExtensionAPI) {
965
1093
  },
966
1094
  });
967
1095
 
968
- // ─── Footer status (persistent badge) ────────────────────────────────
1096
+ // --- Footer status (persistent badge) --------------------------------
969
1097
  pi.on("session_start", (_event, ctx) => {
970
1098
  footerStatusCtx = ctx;
971
1099
  refreshFooterStatus(
@@ -978,7 +1106,6 @@ export default function (pi: ExtensionAPI) {
978
1106
  });
979
1107
 
980
1108
  pi.on("turn_end", (_event, ctx) => {
981
- console.log("[DEBUG turn_end] ctx.model?.id =", ctx.model?.id);
982
1109
  noteActiveProvider(ctx.model?.id ?? null);
983
1110
  footerStatusCtx = ctx;
984
1111
  refreshFooterStatus(
@@ -1045,6 +1172,13 @@ export default function (pi: ExtensionAPI) {
1045
1172
  queueAutoResume("post-compact", "resume", "followUp");
1046
1173
  });
1047
1174
 
1175
+ // --- Periodic quota refresh every 15 minutes ---
1176
+ // `maybeAutoFetchQuota` checks its own rate-limit (MINIMAX_REFRESH_MIN_INTERVAL_MS)
1177
+ // so this is safe to call frequently.
1178
+ setInterval(() => {
1179
+ void maybeAutoFetchQuota(lastActiveProvider ?? null);
1180
+ }, MINIMAX_REFRESH_MIN_INTERVAL_MS);
1181
+
1048
1182
  function queueAutoResume(
1049
1183
  reason: string,
1050
1184
  content: string,
@@ -1106,9 +1240,9 @@ export default function (pi: ExtensionAPI) {
1106
1240
  }
1107
1241
  }
1108
1242
 
1109
- // ──────────────────────────────────────────────────────────────────────
1243
+ // ----------------------------------------------------------------------
1110
1244
  // Helper: refresh persistent footer status with one-line summary
1111
- // ──────────────────────────────────────────────────────────────────────
1245
+ // ----------------------------------------------------------------------
1112
1246
  function refreshFooterStatus(
1113
1247
  ctx: { ui: { setStatus: (key: string, value: string) => void } },
1114
1248
  tracker: UsageTracker,
@@ -1119,14 +1253,11 @@ function refreshFooterStatus(
1119
1253
  const nowMs = Date.now();
1120
1254
  const local = aggregateWindows(tracker.all());
1121
1255
  const provider = getActiveProvider();
1122
- console.log("[DEBUG refreshFooterStatus] provider =", provider);
1123
1256
  const mirror = provider ? mirrorStore.readProvider(provider) : null;
1124
- console.log(
1125
- "[DEBUG refreshFooterStatus] mirror =",
1126
- mirror ? JSON.stringify(mirror) : null,
1127
- );
1257
+ // "[DEBUG refreshFooterStatus] mirror =",
1258
+ // mirror ? JSON.stringify(mirror) : null,
1259
+ // );
1128
1260
  const freshness = mirrorStore.freshness(mirror, nowMs);
1129
- console.log("[DEBUG refreshFooterStatus] freshness =", freshness);
1130
1261
  ctx.ui.setStatus(
1131
1262
  "harness-runtime",
1132
1263
  buildFooterStatusValue(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-harness-runtime",
3
- "version": "0.9.22",
3
+ "version": "0.10.0",
4
4
  "description": "[BETA] Codex-style /usage status + autonomous coding harness for pi. Not production ready — expect breaking changes.",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -80,7 +80,7 @@
80
80
  "@types/node": "^26.1.0",
81
81
  "@types/ws": "^8.18.1",
82
82
  "husky": "^9.1.7",
83
- "playwright": "^1.61.1",
83
+ "playwright": "^1.62.0",
84
84
  "standard-version": "^9.5.0"
85
85
  },
86
86
  "workspaces": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/a2a-adapter",
3
- "version": "0.9.15",
3
+ "version": "0.9.25",
4
4
  "type": "module",
5
5
  "description": "Google Agent-to-Agent (A2A) protocol adapter for pi-harness",
6
6
  "main": "dist/index.js",
@@ -2,7 +2,7 @@
2
2
  * A2A Adapter — Types (RFC-0069)
3
3
  */
4
4
 
5
- // ─── Agent Card ─────────────────────────────────────────────────────────────
5
+ // --- Agent Card -------------------------------------------------------------
6
6
 
7
7
  export interface AgentCard {
8
8
  name: string;
@@ -36,7 +36,7 @@ export interface Authentication {
36
36
  credentials?: string;
37
37
  }
38
38
 
39
- // ─── Task ─────────────────────────────────────────────────────────────────
39
+ // --- Task -----------------------------------------------------------------
40
40
 
41
41
  export type TaskStatus =
42
42
  | "submitted"
@@ -71,7 +71,7 @@ export interface Artifact {
71
71
  parts: Array<{ type: "text"; text: string }>;
72
72
  }
73
73
 
74
- // ─── A2A Requests / Responses ─────────────────────────────────────────────
74
+ // --- A2A Requests / Responses ---------------------------------------------
75
75
 
76
76
  export type A2ARequest =
77
77
  | {
@@ -92,7 +92,7 @@ export interface A2AResponse {
92
92
  error?: { code: number; message: string };
93
93
  }
94
94
 
95
- // ─── A2A Client ─────────────────────────────────────────────────────────
95
+ // --- A2A Client ---------------------------------------------------------
96
96
 
97
97
  export interface A2AClientConfig {
98
98
  timeout?: number;
@@ -104,7 +104,7 @@ export interface TaskHandle {
104
104
  status: TaskStatus;
105
105
  }
106
106
 
107
- // ─── A2A Agent ───────────────────────────────────────────────────────────
107
+ // --- A2A Agent -----------------------------------------------------------
108
108
 
109
109
  export interface A2AAgentConfig {
110
110
  name: string;