jfl 0.4.4 → 0.6.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 (533) hide show
  1. package/dist/commands/context-hub.d.ts +1 -0
  2. package/dist/commands/context-hub.d.ts.map +1 -1
  3. package/dist/commands/context-hub.js +1064 -41
  4. package/dist/commands/context-hub.js.map +1 -1
  5. package/dist/commands/eval.d.ts +1 -1
  6. package/dist/commands/eval.d.ts.map +1 -1
  7. package/dist/commands/eval.js +192 -1
  8. package/dist/commands/eval.js.map +1 -1
  9. package/dist/commands/findings.d.ts +6 -0
  10. package/dist/commands/findings.d.ts.map +1 -0
  11. package/dist/commands/findings.js +203 -0
  12. package/dist/commands/findings.js.map +1 -0
  13. package/dist/commands/hud.d.ts.map +1 -1
  14. package/dist/commands/hud.js +47 -9
  15. package/dist/commands/hud.js.map +1 -1
  16. package/dist/commands/ide.d.ts +27 -0
  17. package/dist/commands/ide.d.ts.map +1 -0
  18. package/dist/commands/ide.js +546 -0
  19. package/dist/commands/ide.js.map +1 -0
  20. package/dist/commands/onboard.d.ts.map +1 -1
  21. package/dist/commands/onboard.js +212 -2
  22. package/dist/commands/onboard.js.map +1 -1
  23. package/dist/commands/openclaw.d.ts +3 -0
  24. package/dist/commands/openclaw.d.ts.map +1 -1
  25. package/dist/commands/openclaw.js +76 -2
  26. package/dist/commands/openclaw.js.map +1 -1
  27. package/dist/commands/peter.d.ts +3 -0
  28. package/dist/commands/peter.d.ts.map +1 -1
  29. package/dist/commands/peter.js +1168 -58
  30. package/dist/commands/peter.js.map +1 -1
  31. package/dist/commands/pi-fleet.d.ts +18 -0
  32. package/dist/commands/pi-fleet.d.ts.map +1 -0
  33. package/dist/commands/pi-fleet.js +382 -0
  34. package/dist/commands/pi-fleet.js.map +1 -0
  35. package/dist/commands/pi.d.ts.map +1 -1
  36. package/dist/commands/pi.js +18 -3
  37. package/dist/commands/pi.js.map +1 -1
  38. package/dist/commands/scope.d.ts.map +1 -1
  39. package/dist/commands/scope.js +90 -1
  40. package/dist/commands/scope.js.map +1 -1
  41. package/dist/commands/services.d.ts.map +1 -1
  42. package/dist/commands/services.js +18 -0
  43. package/dist/commands/services.js.map +1 -1
  44. package/dist/commands/setup.d.ts +12 -0
  45. package/dist/commands/setup.d.ts.map +1 -0
  46. package/dist/commands/setup.js +322 -0
  47. package/dist/commands/setup.js.map +1 -0
  48. package/dist/commands/status.d.ts.map +1 -1
  49. package/dist/commands/status.js +22 -4
  50. package/dist/commands/status.js.map +1 -1
  51. package/dist/commands/train.d.ts +33 -0
  52. package/dist/commands/train.d.ts.map +1 -0
  53. package/dist/commands/train.js +510 -0
  54. package/dist/commands/train.js.map +1 -0
  55. package/dist/commands/verify.d.ts +14 -0
  56. package/dist/commands/verify.d.ts.map +1 -0
  57. package/dist/commands/verify.js +276 -0
  58. package/dist/commands/verify.js.map +1 -0
  59. package/dist/commands/viz.d.ts.map +1 -1
  60. package/dist/commands/viz.js +417 -0
  61. package/dist/commands/viz.js.map +1 -1
  62. package/dist/dashboard-static/assets/index-CW9ZxqX8.css +1 -0
  63. package/dist/dashboard-static/assets/index-DNN__p4K.js +121 -0
  64. package/dist/dashboard-static/index.html +2 -2
  65. package/dist/index.js +324 -64
  66. package/dist/index.js.map +1 -1
  67. package/dist/lib/agent-config.d.ts +52 -0
  68. package/dist/lib/agent-config.d.ts.map +1 -0
  69. package/dist/lib/agent-config.js +231 -0
  70. package/dist/lib/agent-config.js.map +1 -0
  71. package/dist/lib/agent-generator.d.ts +10 -0
  72. package/dist/lib/agent-generator.d.ts.map +1 -1
  73. package/dist/lib/agent-generator.js +64 -10
  74. package/dist/lib/agent-generator.js.map +1 -1
  75. package/dist/lib/agent-session.d.ts +104 -0
  76. package/dist/lib/agent-session.d.ts.map +1 -0
  77. package/dist/lib/agent-session.js +635 -0
  78. package/dist/lib/agent-session.js.map +1 -0
  79. package/dist/lib/eval-snapshot.d.ts +47 -0
  80. package/dist/lib/eval-snapshot.d.ts.map +1 -0
  81. package/dist/lib/eval-snapshot.js +315 -0
  82. package/dist/lib/eval-snapshot.js.map +1 -0
  83. package/dist/lib/eval-store.d.ts +5 -0
  84. package/dist/lib/eval-store.d.ts.map +1 -1
  85. package/dist/lib/eval-store.js +33 -3
  86. package/dist/lib/eval-store.js.map +1 -1
  87. package/dist/lib/findings-engine.d.ts +51 -0
  88. package/dist/lib/findings-engine.d.ts.map +1 -0
  89. package/dist/lib/findings-engine.js +338 -0
  90. package/dist/lib/findings-engine.js.map +1 -0
  91. package/dist/lib/flow-engine.d.ts +8 -0
  92. package/dist/lib/flow-engine.d.ts.map +1 -1
  93. package/dist/lib/flow-engine.js +84 -2
  94. package/dist/lib/flow-engine.js.map +1 -1
  95. package/dist/lib/hub-client.d.ts +1 -0
  96. package/dist/lib/hub-client.d.ts.map +1 -1
  97. package/dist/lib/hub-client.js +33 -6
  98. package/dist/lib/hub-client.js.map +1 -1
  99. package/dist/lib/ide-panes.d.ts +58 -0
  100. package/dist/lib/ide-panes.d.ts.map +1 -0
  101. package/dist/lib/ide-panes.js +508 -0
  102. package/dist/lib/ide-panes.js.map +1 -0
  103. package/dist/lib/memory-db.js +4 -4
  104. package/dist/lib/memory-db.js.map +1 -1
  105. package/dist/lib/memory-indexer.d.ts.map +1 -1
  106. package/dist/lib/memory-indexer.js +3 -0
  107. package/dist/lib/memory-indexer.js.map +1 -1
  108. package/dist/lib/memory-search.d.ts +148 -4
  109. package/dist/lib/memory-search.d.ts.map +1 -1
  110. package/dist/lib/memory-search.js +496 -58
  111. package/dist/lib/memory-search.js.map +1 -1
  112. package/dist/lib/meta-orchestrator.d.ts +104 -0
  113. package/dist/lib/meta-orchestrator.d.ts.map +1 -0
  114. package/dist/lib/meta-orchestrator.js +373 -0
  115. package/dist/lib/meta-orchestrator.js.map +1 -0
  116. package/dist/lib/peer-agent-generator.d.ts.map +1 -1
  117. package/dist/lib/peer-agent-generator.js +43 -19
  118. package/dist/lib/peer-agent-generator.js.map +1 -1
  119. package/dist/lib/pi-sky/bridge.d.ts +55 -0
  120. package/dist/lib/pi-sky/bridge.d.ts.map +1 -0
  121. package/dist/lib/pi-sky/bridge.js +264 -0
  122. package/dist/lib/pi-sky/bridge.js.map +1 -0
  123. package/dist/lib/pi-sky/cost-monitor.d.ts +21 -0
  124. package/dist/lib/pi-sky/cost-monitor.d.ts.map +1 -0
  125. package/dist/lib/pi-sky/cost-monitor.js +126 -0
  126. package/dist/lib/pi-sky/cost-monitor.js.map +1 -0
  127. package/dist/lib/pi-sky/eval-sweep.d.ts +27 -0
  128. package/dist/lib/pi-sky/eval-sweep.d.ts.map +1 -0
  129. package/dist/lib/pi-sky/eval-sweep.js +141 -0
  130. package/dist/lib/pi-sky/eval-sweep.js.map +1 -0
  131. package/dist/lib/pi-sky/event-router.d.ts +32 -0
  132. package/dist/lib/pi-sky/event-router.d.ts.map +1 -0
  133. package/dist/lib/pi-sky/event-router.js +176 -0
  134. package/dist/lib/pi-sky/event-router.js.map +1 -0
  135. package/dist/lib/pi-sky/experiment.d.ts +9 -0
  136. package/dist/lib/pi-sky/experiment.d.ts.map +1 -0
  137. package/dist/lib/pi-sky/experiment.js +83 -0
  138. package/dist/lib/pi-sky/experiment.js.map +1 -0
  139. package/dist/lib/pi-sky/index.d.ts +16 -0
  140. package/dist/lib/pi-sky/index.d.ts.map +1 -0
  141. package/dist/lib/pi-sky/index.js +16 -0
  142. package/dist/lib/pi-sky/index.js.map +1 -0
  143. package/dist/lib/pi-sky/stratus-gate.d.ts +28 -0
  144. package/dist/lib/pi-sky/stratus-gate.d.ts.map +1 -0
  145. package/dist/lib/pi-sky/stratus-gate.js +61 -0
  146. package/dist/lib/pi-sky/stratus-gate.js.map +1 -0
  147. package/dist/lib/pi-sky/swarm.d.ts +28 -0
  148. package/dist/lib/pi-sky/swarm.d.ts.map +1 -0
  149. package/dist/lib/pi-sky/swarm.js +208 -0
  150. package/dist/lib/pi-sky/swarm.js.map +1 -0
  151. package/dist/lib/pi-sky/types.d.ts +139 -0
  152. package/dist/lib/pi-sky/types.d.ts.map +1 -0
  153. package/dist/lib/pi-sky/types.js +2 -0
  154. package/dist/lib/pi-sky/types.js.map +1 -0
  155. package/dist/lib/pi-sky/voice-bridge.d.ts +20 -0
  156. package/dist/lib/pi-sky/voice-bridge.d.ts.map +1 -0
  157. package/dist/lib/pi-sky/voice-bridge.js +91 -0
  158. package/dist/lib/pi-sky/voice-bridge.js.map +1 -0
  159. package/dist/lib/policy-head.d.ts +40 -0
  160. package/dist/lib/policy-head.d.ts.map +1 -0
  161. package/dist/lib/policy-head.js +234 -0
  162. package/dist/lib/policy-head.js.map +1 -0
  163. package/dist/lib/predictor.d.ts +10 -0
  164. package/dist/lib/predictor.d.ts.map +1 -1
  165. package/dist/lib/predictor.js +46 -7
  166. package/dist/lib/predictor.js.map +1 -1
  167. package/dist/lib/replay-buffer.d.ts +93 -0
  168. package/dist/lib/replay-buffer.d.ts.map +1 -0
  169. package/dist/lib/replay-buffer.js +302 -0
  170. package/dist/lib/replay-buffer.js.map +1 -0
  171. package/dist/lib/sentinel-rl.d.ts +97 -0
  172. package/dist/lib/sentinel-rl.d.ts.map +1 -0
  173. package/dist/lib/sentinel-rl.js +430 -0
  174. package/dist/lib/sentinel-rl.js.map +1 -0
  175. package/dist/lib/session-lock.d.ts +61 -0
  176. package/dist/lib/session-lock.d.ts.map +1 -0
  177. package/dist/lib/session-lock.js +438 -0
  178. package/dist/lib/session-lock.js.map +1 -0
  179. package/dist/lib/setup/agent-generator.d.ts +18 -0
  180. package/dist/lib/setup/agent-generator.d.ts.map +1 -0
  181. package/dist/lib/setup/agent-generator.js +114 -0
  182. package/dist/lib/setup/agent-generator.js.map +1 -0
  183. package/dist/lib/setup/context-analyzer.d.ts +16 -0
  184. package/dist/lib/setup/context-analyzer.d.ts.map +1 -0
  185. package/dist/lib/setup/context-analyzer.js +112 -0
  186. package/dist/lib/setup/context-analyzer.js.map +1 -0
  187. package/dist/lib/setup/doc-auditor.d.ts +54 -0
  188. package/dist/lib/setup/doc-auditor.d.ts.map +1 -0
  189. package/dist/lib/setup/doc-auditor.js +629 -0
  190. package/dist/lib/setup/doc-auditor.js.map +1 -0
  191. package/dist/lib/setup/domain-generator.d.ts +7 -0
  192. package/dist/lib/setup/domain-generator.d.ts.map +1 -0
  193. package/dist/lib/setup/domain-generator.js +58 -0
  194. package/dist/lib/setup/domain-generator.js.map +1 -0
  195. package/dist/lib/setup/smart-eval-generator.d.ts +38 -0
  196. package/dist/lib/setup/smart-eval-generator.d.ts.map +1 -0
  197. package/dist/lib/setup/smart-eval-generator.js +378 -0
  198. package/dist/lib/setup/smart-eval-generator.js.map +1 -0
  199. package/dist/lib/setup/smart-recommender.d.ts +63 -0
  200. package/dist/lib/setup/smart-recommender.d.ts.map +1 -0
  201. package/dist/lib/setup/smart-recommender.js +329 -0
  202. package/dist/lib/setup/smart-recommender.js.map +1 -0
  203. package/dist/lib/setup/spec-generator.d.ts +63 -0
  204. package/dist/lib/setup/spec-generator.d.ts.map +1 -0
  205. package/dist/lib/setup/spec-generator.js +310 -0
  206. package/dist/lib/setup/spec-generator.js.map +1 -0
  207. package/dist/lib/setup/violation-agent-generator.d.ts +32 -0
  208. package/dist/lib/setup/violation-agent-generator.d.ts.map +1 -0
  209. package/dist/lib/setup/violation-agent-generator.js +255 -0
  210. package/dist/lib/setup/violation-agent-generator.js.map +1 -0
  211. package/dist/lib/stratus-client.d.ts +1 -0
  212. package/dist/lib/stratus-client.d.ts.map +1 -1
  213. package/dist/lib/stratus-client.js +24 -2
  214. package/dist/lib/stratus-client.js.map +1 -1
  215. package/dist/lib/telemetry-agent-v2.d.ts +128 -0
  216. package/dist/lib/telemetry-agent-v2.d.ts.map +1 -0
  217. package/dist/lib/telemetry-agent-v2.js +1042 -0
  218. package/dist/lib/telemetry-agent-v2.js.map +1 -0
  219. package/dist/lib/telemetry-agent.d.ts.map +1 -1
  220. package/dist/lib/telemetry-agent.js +27 -6
  221. package/dist/lib/telemetry-agent.js.map +1 -1
  222. package/dist/lib/telemetry-digest.d.ts.map +1 -1
  223. package/dist/lib/telemetry-digest.js +27 -5
  224. package/dist/lib/telemetry-digest.js.map +1 -1
  225. package/dist/lib/telemetry.d.ts.map +1 -1
  226. package/dist/lib/telemetry.js +29 -4
  227. package/dist/lib/telemetry.js.map +1 -1
  228. package/dist/lib/text-preprocessing.d.ts +83 -0
  229. package/dist/lib/text-preprocessing.d.ts.map +1 -0
  230. package/dist/lib/text-preprocessing.js +261 -0
  231. package/dist/lib/text-preprocessing.js.map +1 -0
  232. package/dist/lib/training-buffer.d.ts +86 -0
  233. package/dist/lib/training-buffer.d.ts.map +1 -0
  234. package/dist/lib/training-buffer.js +139 -0
  235. package/dist/lib/training-buffer.js.map +1 -0
  236. package/dist/lib/tuple-miner.d.ts +30 -0
  237. package/dist/lib/tuple-miner.d.ts.map +1 -0
  238. package/dist/lib/tuple-miner.js +427 -0
  239. package/dist/lib/tuple-miner.js.map +1 -0
  240. package/dist/lib/vm-backend.d.ts +72 -0
  241. package/dist/lib/vm-backend.d.ts.map +1 -0
  242. package/dist/lib/vm-backend.js +175 -0
  243. package/dist/lib/vm-backend.js.map +1 -0
  244. package/dist/lib/workspace/backend.d.ts +53 -0
  245. package/dist/lib/workspace/backend.d.ts.map +1 -0
  246. package/dist/lib/workspace/backend.js +37 -0
  247. package/dist/lib/workspace/backend.js.map +1 -0
  248. package/dist/lib/workspace/cmux-adapter.d.ts +46 -0
  249. package/dist/lib/workspace/cmux-adapter.d.ts.map +1 -0
  250. package/dist/lib/workspace/cmux-adapter.js +261 -0
  251. package/dist/lib/workspace/cmux-adapter.js.map +1 -0
  252. package/dist/lib/workspace/data-pipeline.d.ts +35 -0
  253. package/dist/lib/workspace/data-pipeline.d.ts.map +1 -0
  254. package/dist/lib/workspace/data-pipeline.js +463 -0
  255. package/dist/lib/workspace/data-pipeline.js.map +1 -0
  256. package/dist/lib/workspace/engine.d.ts +64 -0
  257. package/dist/lib/workspace/engine.d.ts.map +1 -0
  258. package/dist/lib/workspace/engine.js +397 -0
  259. package/dist/lib/workspace/engine.js.map +1 -0
  260. package/dist/lib/workspace/notifications.d.ts +14 -0
  261. package/dist/lib/workspace/notifications.d.ts.map +1 -0
  262. package/dist/lib/workspace/notifications.js +41 -0
  263. package/dist/lib/workspace/notifications.js.map +1 -0
  264. package/dist/lib/workspace/surface-registry.d.ts +49 -0
  265. package/dist/lib/workspace/surface-registry.d.ts.map +1 -0
  266. package/dist/lib/workspace/surface-registry.js +217 -0
  267. package/dist/lib/workspace/surface-registry.js.map +1 -0
  268. package/dist/lib/workspace/surface-type.d.ts +153 -0
  269. package/dist/lib/workspace/surface-type.d.ts.map +1 -0
  270. package/dist/lib/workspace/surface-type.js +9 -0
  271. package/dist/lib/workspace/surface-type.js.map +1 -0
  272. package/dist/lib/workspace/surfaces/agent-overview.d.ts +16 -0
  273. package/dist/lib/workspace/surfaces/agent-overview.d.ts.map +1 -0
  274. package/dist/lib/workspace/surfaces/agent-overview.js +116 -0
  275. package/dist/lib/workspace/surfaces/agent-overview.js.map +1 -0
  276. package/dist/lib/workspace/surfaces/agent.d.ts +16 -0
  277. package/dist/lib/workspace/surfaces/agent.d.ts.map +1 -0
  278. package/dist/lib/workspace/surfaces/agent.js +112 -0
  279. package/dist/lib/workspace/surfaces/agent.js.map +1 -0
  280. package/dist/lib/workspace/surfaces/claude.d.ts +15 -0
  281. package/dist/lib/workspace/surfaces/claude.d.ts.map +1 -0
  282. package/dist/lib/workspace/surfaces/claude.js +23 -0
  283. package/dist/lib/workspace/surfaces/claude.js.map +1 -0
  284. package/dist/lib/workspace/surfaces/dashboard.d.ts +21 -0
  285. package/dist/lib/workspace/surfaces/dashboard.d.ts.map +1 -0
  286. package/dist/lib/workspace/surfaces/dashboard.js +32 -0
  287. package/dist/lib/workspace/surfaces/dashboard.js.map +1 -0
  288. package/dist/lib/workspace/surfaces/eval.d.ts +15 -0
  289. package/dist/lib/workspace/surfaces/eval.d.ts.map +1 -0
  290. package/dist/lib/workspace/surfaces/eval.js +42 -0
  291. package/dist/lib/workspace/surfaces/eval.js.map +1 -0
  292. package/dist/lib/workspace/surfaces/event-stream.d.ts +16 -0
  293. package/dist/lib/workspace/surfaces/event-stream.d.ts.map +1 -0
  294. package/dist/lib/workspace/surfaces/event-stream.js +40 -0
  295. package/dist/lib/workspace/surfaces/event-stream.js.map +1 -0
  296. package/dist/lib/workspace/surfaces/flow.d.ts +16 -0
  297. package/dist/lib/workspace/surfaces/flow.d.ts.map +1 -0
  298. package/dist/lib/workspace/surfaces/flow.js +49 -0
  299. package/dist/lib/workspace/surfaces/flow.js.map +1 -0
  300. package/dist/lib/workspace/surfaces/index.d.ts +16 -0
  301. package/dist/lib/workspace/surfaces/index.d.ts.map +1 -0
  302. package/dist/lib/workspace/surfaces/index.js +16 -0
  303. package/dist/lib/workspace/surfaces/index.js.map +1 -0
  304. package/dist/lib/workspace/surfaces/portfolio.d.ts +16 -0
  305. package/dist/lib/workspace/surfaces/portfolio.d.ts.map +1 -0
  306. package/dist/lib/workspace/surfaces/portfolio.js +102 -0
  307. package/dist/lib/workspace/surfaces/portfolio.js.map +1 -0
  308. package/dist/lib/workspace/surfaces/service.d.ts +16 -0
  309. package/dist/lib/workspace/surfaces/service.d.ts.map +1 -0
  310. package/dist/lib/workspace/surfaces/service.js +45 -0
  311. package/dist/lib/workspace/surfaces/service.js.map +1 -0
  312. package/dist/lib/workspace/surfaces/shell.d.ts +15 -0
  313. package/dist/lib/workspace/surfaces/shell.d.ts.map +1 -0
  314. package/dist/lib/workspace/surfaces/shell.js +19 -0
  315. package/dist/lib/workspace/surfaces/shell.js.map +1 -0
  316. package/dist/lib/workspace/surfaces/telemetry.d.ts +16 -0
  317. package/dist/lib/workspace/surfaces/telemetry.d.ts.map +1 -0
  318. package/dist/lib/workspace/surfaces/telemetry.js +48 -0
  319. package/dist/lib/workspace/surfaces/telemetry.js.map +1 -0
  320. package/dist/lib/workspace/surfaces/topology.d.ts +15 -0
  321. package/dist/lib/workspace/surfaces/topology.d.ts.map +1 -0
  322. package/dist/lib/workspace/surfaces/topology.js +19 -0
  323. package/dist/lib/workspace/surfaces/topology.js.map +1 -0
  324. package/dist/lib/workspace/surfaces/training.d.ts +16 -0
  325. package/dist/lib/workspace/surfaces/training.d.ts.map +1 -0
  326. package/dist/lib/workspace/surfaces/training.js +22 -0
  327. package/dist/lib/workspace/surfaces/training.js.map +1 -0
  328. package/dist/lib/workspace/tmux-adapter.d.ts +27 -0
  329. package/dist/lib/workspace/tmux-adapter.d.ts.map +1 -0
  330. package/dist/lib/workspace/tmux-adapter.js +106 -0
  331. package/dist/lib/workspace/tmux-adapter.js.map +1 -0
  332. package/dist/mcp/context-hub-mcp.js +7 -24
  333. package/dist/mcp/context-hub-mcp.js.map +1 -1
  334. package/dist/types/flows.d.ts +2 -0
  335. package/dist/types/flows.d.ts.map +1 -1
  336. package/dist/types/ide.d.ts +49 -0
  337. package/dist/types/ide.d.ts.map +1 -0
  338. package/dist/types/ide.js +5 -0
  339. package/dist/types/ide.js.map +1 -0
  340. package/dist/types/platform-digest.d.ts +228 -0
  341. package/dist/types/platform-digest.d.ts.map +1 -0
  342. package/dist/types/platform-digest.js +5 -0
  343. package/dist/types/platform-digest.js.map +1 -0
  344. package/dist/types/telemetry-digest.d.ts +2 -0
  345. package/dist/types/telemetry-digest.d.ts.map +1 -1
  346. package/dist/utils/ensure-project.d.ts +1 -0
  347. package/dist/utils/ensure-project.d.ts.map +1 -1
  348. package/dist/utils/ensure-project.js +19 -7
  349. package/dist/utils/ensure-project.js.map +1 -1
  350. package/dist/utils/jfl-config.d.ts +1 -0
  351. package/dist/utils/jfl-config.d.ts.map +1 -1
  352. package/dist/utils/jfl-config.js +19 -1
  353. package/dist/utils/jfl-config.js.map +1 -1
  354. package/dist/utils/jfl-paths.d.ts +5 -0
  355. package/dist/utils/jfl-paths.d.ts.map +1 -1
  356. package/dist/utils/jfl-paths.js +25 -3
  357. package/dist/utils/jfl-paths.js.map +1 -1
  358. package/package.json +3 -2
  359. package/packages/pi/AGENTS.md +112 -0
  360. package/packages/pi/extensions/agent-grid.ts +191 -0
  361. package/packages/pi/extensions/agent-names.ts +178 -0
  362. package/packages/pi/extensions/autoresearch.ts +427 -0
  363. package/packages/pi/extensions/bookmarks.ts +85 -0
  364. package/packages/pi/extensions/context.ts +184 -0
  365. package/packages/pi/extensions/crm-tool.ts +61 -0
  366. package/packages/pi/extensions/eval-tool.ts +224 -0
  367. package/packages/pi/extensions/eval.ts +60 -0
  368. package/packages/pi/extensions/footer.ts +239 -0
  369. package/packages/pi/extensions/hub-resolver.ts +63 -0
  370. package/packages/pi/extensions/hud-tool.ts +145 -0
  371. package/packages/pi/extensions/index.ts +405 -0
  372. package/packages/pi/extensions/journal.ts +224 -0
  373. package/packages/pi/extensions/map-bridge.ts +178 -0
  374. package/packages/pi/extensions/memory-tool.ts +73 -0
  375. package/packages/pi/extensions/notifications.ts +73 -0
  376. package/packages/pi/extensions/peter-parker.ts +202 -0
  377. package/packages/pi/extensions/policy-head-tool.ts +276 -0
  378. package/packages/pi/extensions/portfolio-bridge.ts +90 -0
  379. package/packages/pi/extensions/session.ts +142 -0
  380. package/packages/pi/extensions/shortcuts.ts +259 -0
  381. package/packages/pi/extensions/stratus-bridge.ts +115 -0
  382. package/packages/pi/extensions/synopsis-tool.ts +83 -0
  383. package/packages/pi/extensions/tool-renderers.ts +353 -0
  384. package/packages/pi/extensions/training-buffer-tool.ts +368 -0
  385. package/packages/pi/extensions/types.ts +163 -0
  386. package/packages/pi/package-lock.json +346 -0
  387. package/packages/pi/package.json +44 -0
  388. package/packages/pi/skills/agent-browser/SKILL.md +116 -0
  389. package/packages/pi/skills/brand-architect/SKILL.md +240 -0
  390. package/packages/pi/skills/brand-architect/config.yaml +137 -0
  391. package/packages/pi/skills/campaign-hud/config.yaml +112 -0
  392. package/packages/pi/skills/content-creator/SKILL.md +294 -0
  393. package/packages/pi/skills/context/SKILL.md +65 -0
  394. package/packages/pi/skills/debug/MULTI_AGENT.md +360 -0
  395. package/packages/pi/skills/debug/SKILL.md +554 -0
  396. package/packages/pi/skills/end/SKILL.md +1782 -0
  397. package/packages/pi/skills/eval/SKILL.md +75 -0
  398. package/packages/pi/skills/fly-deploy/SKILL.md +676 -0
  399. package/packages/pi/skills/founder-video/SKILL.md +467 -0
  400. package/packages/pi/skills/hud/SKILL.md +160 -0
  401. package/packages/pi/skills/orchestrate/SKILL.md +74 -0
  402. package/packages/pi/skills/pi-agents/SKILL.md +78 -0
  403. package/packages/pi/skills/react-best-practices/AGENTS.md +2249 -0
  404. package/packages/pi/skills/react-best-practices/README.md +123 -0
  405. package/packages/pi/skills/react-best-practices/SKILL.md +125 -0
  406. package/packages/pi/skills/react-best-practices/metadata.json +15 -0
  407. package/packages/pi/skills/react-best-practices/rules/_sections.md +46 -0
  408. package/packages/pi/skills/react-best-practices/rules/_template.md +28 -0
  409. package/packages/pi/skills/react-best-practices/rules/advanced-event-handler-refs.md +55 -0
  410. package/packages/pi/skills/react-best-practices/rules/advanced-use-latest.md +49 -0
  411. package/packages/pi/skills/react-best-practices/rules/async-api-routes.md +38 -0
  412. package/packages/pi/skills/react-best-practices/rules/async-defer-await.md +80 -0
  413. package/packages/pi/skills/react-best-practices/rules/async-dependencies.md +36 -0
  414. package/packages/pi/skills/react-best-practices/rules/async-parallel.md +28 -0
  415. package/packages/pi/skills/react-best-practices/rules/async-suspense-boundaries.md +99 -0
  416. package/packages/pi/skills/react-best-practices/rules/bundle-barrel-imports.md +59 -0
  417. package/packages/pi/skills/react-best-practices/rules/bundle-conditional.md +31 -0
  418. package/packages/pi/skills/react-best-practices/rules/bundle-defer-third-party.md +49 -0
  419. package/packages/pi/skills/react-best-practices/rules/bundle-dynamic-imports.md +35 -0
  420. package/packages/pi/skills/react-best-practices/rules/bundle-preload.md +50 -0
  421. package/packages/pi/skills/react-best-practices/rules/client-event-listeners.md +74 -0
  422. package/packages/pi/skills/react-best-practices/rules/client-swr-dedup.md +56 -0
  423. package/packages/pi/skills/react-best-practices/rules/js-batch-dom-css.md +82 -0
  424. package/packages/pi/skills/react-best-practices/rules/js-cache-function-results.md +80 -0
  425. package/packages/pi/skills/react-best-practices/rules/js-cache-property-access.md +28 -0
  426. package/packages/pi/skills/react-best-practices/rules/js-cache-storage.md +70 -0
  427. package/packages/pi/skills/react-best-practices/rules/js-combine-iterations.md +32 -0
  428. package/packages/pi/skills/react-best-practices/rules/js-early-exit.md +50 -0
  429. package/packages/pi/skills/react-best-practices/rules/js-hoist-regexp.md +45 -0
  430. package/packages/pi/skills/react-best-practices/rules/js-index-maps.md +37 -0
  431. package/packages/pi/skills/react-best-practices/rules/js-length-check-first.md +49 -0
  432. package/packages/pi/skills/react-best-practices/rules/js-min-max-loop.md +82 -0
  433. package/packages/pi/skills/react-best-practices/rules/js-set-map-lookups.md +24 -0
  434. package/packages/pi/skills/react-best-practices/rules/js-tosorted-immutable.md +57 -0
  435. package/packages/pi/skills/react-best-practices/rules/rendering-activity.md +26 -0
  436. package/packages/pi/skills/react-best-practices/rules/rendering-animate-svg-wrapper.md +47 -0
  437. package/packages/pi/skills/react-best-practices/rules/rendering-conditional-render.md +40 -0
  438. package/packages/pi/skills/react-best-practices/rules/rendering-content-visibility.md +38 -0
  439. package/packages/pi/skills/react-best-practices/rules/rendering-hoist-jsx.md +46 -0
  440. package/packages/pi/skills/react-best-practices/rules/rendering-hydration-no-flicker.md +82 -0
  441. package/packages/pi/skills/react-best-practices/rules/rendering-svg-precision.md +28 -0
  442. package/packages/pi/skills/react-best-practices/rules/rerender-defer-reads.md +39 -0
  443. package/packages/pi/skills/react-best-practices/rules/rerender-dependencies.md +45 -0
  444. package/packages/pi/skills/react-best-practices/rules/rerender-derived-state.md +29 -0
  445. package/packages/pi/skills/react-best-practices/rules/rerender-functional-setstate.md +74 -0
  446. package/packages/pi/skills/react-best-practices/rules/rerender-lazy-state-init.md +58 -0
  447. package/packages/pi/skills/react-best-practices/rules/rerender-memo.md +44 -0
  448. package/packages/pi/skills/react-best-practices/rules/rerender-transitions.md +40 -0
  449. package/packages/pi/skills/react-best-practices/rules/server-after-nonblocking.md +73 -0
  450. package/packages/pi/skills/react-best-practices/rules/server-cache-lru.md +41 -0
  451. package/packages/pi/skills/react-best-practices/rules/server-cache-react.md +26 -0
  452. package/packages/pi/skills/react-best-practices/rules/server-parallel-fetching.md +79 -0
  453. package/packages/pi/skills/react-best-practices/rules/server-serialization.md +38 -0
  454. package/packages/pi/skills/remotion-best-practices/SKILL.md +43 -0
  455. package/packages/pi/skills/remotion-best-practices/rules/3d.md +86 -0
  456. package/packages/pi/skills/remotion-best-practices/rules/animations.md +29 -0
  457. package/packages/pi/skills/remotion-best-practices/rules/assets/charts-bar-chart.tsx +173 -0
  458. package/packages/pi/skills/remotion-best-practices/rules/assets/text-animations-typewriter.tsx +100 -0
  459. package/packages/pi/skills/remotion-best-practices/rules/assets/text-animations-word-highlight.tsx +108 -0
  460. package/packages/pi/skills/remotion-best-practices/rules/assets.md +78 -0
  461. package/packages/pi/skills/remotion-best-practices/rules/audio.md +172 -0
  462. package/packages/pi/skills/remotion-best-practices/rules/calculate-metadata.md +104 -0
  463. package/packages/pi/skills/remotion-best-practices/rules/can-decode.md +75 -0
  464. package/packages/pi/skills/remotion-best-practices/rules/charts.md +58 -0
  465. package/packages/pi/skills/remotion-best-practices/rules/compositions.md +146 -0
  466. package/packages/pi/skills/remotion-best-practices/rules/display-captions.md +126 -0
  467. package/packages/pi/skills/remotion-best-practices/rules/extract-frames.md +229 -0
  468. package/packages/pi/skills/remotion-best-practices/rules/fonts.md +152 -0
  469. package/packages/pi/skills/remotion-best-practices/rules/get-audio-duration.md +58 -0
  470. package/packages/pi/skills/remotion-best-practices/rules/get-video-dimensions.md +68 -0
  471. package/packages/pi/skills/remotion-best-practices/rules/get-video-duration.md +58 -0
  472. package/packages/pi/skills/remotion-best-practices/rules/gifs.md +138 -0
  473. package/packages/pi/skills/remotion-best-practices/rules/images.md +130 -0
  474. package/packages/pi/skills/remotion-best-practices/rules/import-srt-captions.md +67 -0
  475. package/packages/pi/skills/remotion-best-practices/rules/lottie.md +68 -0
  476. package/packages/pi/skills/remotion-best-practices/rules/measuring-dom-nodes.md +35 -0
  477. package/packages/pi/skills/remotion-best-practices/rules/measuring-text.md +143 -0
  478. package/packages/pi/skills/remotion-best-practices/rules/sequencing.md +106 -0
  479. package/packages/pi/skills/remotion-best-practices/rules/tailwind.md +11 -0
  480. package/packages/pi/skills/remotion-best-practices/rules/text-animations.md +20 -0
  481. package/packages/pi/skills/remotion-best-practices/rules/timing.md +179 -0
  482. package/packages/pi/skills/remotion-best-practices/rules/transcribe-captions.md +19 -0
  483. package/packages/pi/skills/remotion-best-practices/rules/transitions.md +122 -0
  484. package/packages/pi/skills/remotion-best-practices/rules/trimming.md +53 -0
  485. package/packages/pi/skills/remotion-best-practices/rules/videos.md +171 -0
  486. package/packages/pi/skills/search/SKILL.md +220 -0
  487. package/packages/pi/skills/spec/SKILL.md +377 -0
  488. package/packages/pi/skills/startup/SKILL.md +315 -0
  489. package/packages/pi/skills/web-architect/SKILL.md +309 -0
  490. package/packages/pi/skills/x-algorithm/SKILL.md +305 -0
  491. package/packages/pi/teams/dev-team.yaml +63 -0
  492. package/packages/pi/teams/gtm-team.yaml +79 -0
  493. package/packages/pi/themes/jfl.theme.json +76 -0
  494. package/packages/pi/tsconfig.json +21 -0
  495. package/scripts/collect-tuples.sh +124 -0
  496. package/scripts/destroy-fleet.sh +37 -0
  497. package/scripts/jfl-ide.sh +48 -0
  498. package/scripts/session/session-cleanup.sh +4 -11
  499. package/scripts/session/session-init.sh +6 -0
  500. package/scripts/session/session-sync.sh +25 -0
  501. package/scripts/setup-branch-protection.sh +106 -0
  502. package/scripts/spawn-fleet.sh +144 -0
  503. package/scripts/train/requirements.txt +5 -0
  504. package/scripts/train/train-policy-head.py +477 -0
  505. package/scripts/train/v2/dataset.py +81 -0
  506. package/scripts/train/v2/domain.json +18 -0
  507. package/scripts/train/v2/eval.py +196 -0
  508. package/scripts/train/v2/generate_data.py +219 -0
  509. package/scripts/train/v2/infer.py +188 -0
  510. package/scripts/train/v2/model.py +112 -0
  511. package/scripts/train/v2/precompute.py +132 -0
  512. package/scripts/train/v2/train.py +302 -0
  513. package/scripts/train/v2/transform_buffer.py +227 -0
  514. package/scripts/train/v2/validate_data.py +115 -0
  515. package/scripts/train-policy-head.py +434 -0
  516. package/scripts/vm-swarm/README.md +301 -0
  517. package/scripts/vm-swarm/collect-tuples.sh +331 -0
  518. package/scripts/vm-swarm/create-base-template.sh +339 -0
  519. package/scripts/vm-swarm/kill-fleet.sh +204 -0
  520. package/scripts/vm-swarm/monitor-fleet.sh +346 -0
  521. package/scripts/vm-swarm/spawn-fleet.sh +304 -0
  522. package/template/.claude/settings.json +2 -15
  523. package/template/.github/workflows/jfl-eval.yml +6 -1
  524. package/template/.github/workflows/jfl-review.yml +4 -0
  525. package/template/scripts/session/session-cleanup.sh +2 -11
  526. package/template/scripts/session/session-end-hub.sh +72 -0
  527. package/template/scripts/session/session-end.sh +69 -6
  528. package/template/scripts/session/session-init.sh +55 -30
  529. package/template/scripts/session/session-lock.sh +464 -0
  530. package/template/scripts/session/session-start-hub.sh +105 -0
  531. package/template/templates/service-agent/workflows/jfl-eval.yml +19 -0
  532. package/dist/dashboard-static/assets/index-B6kRK9Rq.js +0 -116
  533. package/dist/dashboard-static/assets/index-BpdKJPLu.css +0 -1
@@ -0,0 +1,353 @@
1
+ /**
2
+ * Tool Renderers
3
+ *
4
+ * Custom renderCall/renderResult for all JFL tools.
5
+ * Transforms plain text output into themed, collapsible TUI components
6
+ * with icons, borders, color-coded sections, and smart truncation.
7
+ *
8
+ * @purpose Beautiful TUI rendering for jfl_hud, jfl_context, jfl_crm, jfl_memory_search, jfl_synopsis, jfl_eval_status, jfl_eval_compare, jfl_policy_score, jfl_policy_rank, jfl_training_buffer, jfl_mine_tuples
9
+ */
10
+
11
+ import type { PiTheme } from "./types.js"
12
+
13
+ // ─── Shared helpers ──────────────────────────────────────────────────────────
14
+
15
+ function truncLine(text: string, maxW: number): string {
16
+ const stripped = text.replace(/\x1b\[[0-9;]*m/g, "")
17
+ if (stripped.length <= maxW) return text
18
+ return text.slice(0, maxW - 1) + "…"
19
+ }
20
+
21
+ function wrapText(text: string, width: number): string[] {
22
+ const lines: string[] = []
23
+ for (const raw of text.split("\n")) {
24
+ if (raw.length <= width) { lines.push(raw); continue }
25
+ let pos = 0
26
+ while (pos < raw.length) {
27
+ lines.push(raw.slice(pos, pos + width))
28
+ pos += width
29
+ }
30
+ }
31
+ return lines
32
+ }
33
+
34
+ function sectionBorder(theme: PiTheme, label: string, width: number): string {
35
+ const labelStr = ` ${label} `
36
+ const rest = Math.max(0, width - labelStr.length - 4)
37
+ return theme.fg("border", "──") + theme.fg("accent", labelStr) + theme.fg("border", "─".repeat(rest))
38
+ }
39
+
40
+ // ─── HUD Tool ───────────────────────────────────────────────────────────────
41
+
42
+ export function hudRenderCall(args: Record<string, any>, theme: PiTheme): any {
43
+ const label = theme.fg("accent", "◆") + " " + theme.fg("toolTitle", theme.bold("HUD"))
44
+ return { render: () => [label], invalidate() {} }
45
+ }
46
+
47
+ export function hudRenderResult(result: any, opts: { expanded: boolean }, theme: PiTheme): any {
48
+ const raw = extractText(result)
49
+ const lines = raw.split("\n").filter(Boolean)
50
+
51
+ if (!opts.expanded && lines.length > 5) {
52
+ const display = lines.slice(0, 5).map(l => theme.fg("toolOutput", l))
53
+ display.push(theme.fg("dim", `... ${lines.length - 5} more lines (Ctrl+O)`))
54
+ return { render: () => display, invalidate() {} }
55
+ }
56
+
57
+ const themed = lines.map(line => {
58
+ if (line.startsWith("◆")) return theme.fg("accent", line)
59
+ if (line.includes("Phase:")) return theme.fg("warning", line)
60
+ if (/^\s*(Pipeline|Deal|Stage)/i.test(line)) return theme.fg("accent", line)
61
+ return theme.fg("toolOutput", line)
62
+ })
63
+
64
+ return { render: () => themed, invalidate() {} }
65
+ }
66
+
67
+ // ─── Context Tool ───────────────────────────────────────────────────────────
68
+
69
+ export function contextRenderCall(args: Record<string, any>, theme: PiTheme): any {
70
+ const query = args.query ?? ""
71
+ const label = theme.fg("toolTitle", theme.bold("context ")) + theme.fg("accent", `"${query}"`)
72
+ return { render: () => [label], invalidate() {} }
73
+ }
74
+
75
+ export function contextRenderResult(result: any, opts: { expanded: boolean }, theme: PiTheme): any {
76
+ const MAX_W = 140
77
+ const raw = extractText(result)
78
+ if (raw === "No relevant context found." || raw === "No context available.") {
79
+ return { render: () => [theme.fg("dim", "No relevant context found")], invalidate() {} }
80
+ }
81
+
82
+ const sections = raw.split(/---\n/).filter(Boolean)
83
+ const lines: string[] = []
84
+
85
+ const max = opts.expanded ? sections.length : Math.min(sections.length, 3)
86
+ for (let i = 0; i < max; i++) {
87
+ const section = sections[i].trim()
88
+ const firstLine = section.split("\n")[0] ?? ""
89
+
90
+ if (firstLine.startsWith("[")) {
91
+ const typeMatch = firstLine.match(/^\[(\w+)\]\s*(.*)/)
92
+ if (typeMatch) {
93
+ const typeColor = typeMatch[1] === "decision" ? "warning" : typeMatch[1] === "feature" ? "success" : "muted"
94
+ lines.push(truncLine(`${theme.fg(typeColor, `[${typeMatch[1]}]`)} ${theme.fg("text", typeMatch[2])}`, MAX_W))
95
+ } else {
96
+ lines.push(truncLine(theme.fg("text", firstLine), MAX_W))
97
+ }
98
+ } else {
99
+ lines.push(truncLine(theme.fg("text", firstLine), MAX_W))
100
+ }
101
+
102
+ if (opts.expanded) {
103
+ const rest = section.split("\n").slice(1)
104
+ for (const l of rest) lines.push(truncLine(theme.fg("muted", l), MAX_W))
105
+ lines.push("")
106
+ }
107
+ }
108
+
109
+ if (!opts.expanded && sections.length > 3) {
110
+ lines.push(theme.fg("dim", `... ${sections.length - 3} more results (Ctrl+O)`))
111
+ }
112
+
113
+ return { render: () => lines, invalidate() {} }
114
+ }
115
+
116
+ // ─── CRM Tool ───────────────────────────────────────────────────────────────
117
+
118
+ export function crmRenderCall(args: Record<string, any>, theme: PiTheme): any {
119
+ const cmd = args.command ?? "list"
120
+ const extra = args.args ? ` ${args.args}` : ""
121
+ const label = theme.fg("toolTitle", theme.bold("crm ")) + theme.fg("accent", cmd) + theme.fg("dim", extra)
122
+ return { render: () => [label], invalidate() {} }
123
+ }
124
+
125
+ export function crmRenderResult(result: any, opts: { expanded: boolean }, theme: PiTheme): any {
126
+ const raw = extractText(result)
127
+ if (raw.startsWith("Error")) {
128
+ return { render: () => [theme.fg("error", raw)], invalidate() {} }
129
+ }
130
+
131
+ const lines = raw.split("\n").filter(Boolean)
132
+ const themed = lines.map(line => {
133
+ if (/active|open|hot/i.test(line)) return theme.fg("success", line)
134
+ if (/stale|cold|lost/i.test(line)) return theme.fg("error", line)
135
+ if (/pipeline|deal|stage/i.test(line)) return theme.fg("accent", line)
136
+ if (line.startsWith("─") || line.startsWith("│") || line.startsWith("┌")) return theme.fg("border", line)
137
+ return theme.fg("toolOutput", line)
138
+ })
139
+
140
+ if (!opts.expanded && themed.length > 8) {
141
+ const display = themed.slice(0, 8)
142
+ display.push(theme.fg("dim", `... ${themed.length - 8} more (Ctrl+O)`))
143
+ return { render: () => display, invalidate() {} }
144
+ }
145
+
146
+ return { render: () => themed, invalidate() {} }
147
+ }
148
+
149
+ // ─── Memory Search Tool ─────────────────────────────────────────────────────
150
+
151
+ export function memoryRenderCall(args: Record<string, any>, theme: PiTheme): any {
152
+ const query = args.query ?? ""
153
+ const type = args.type && args.type !== "all" ? ` [${args.type}]` : ""
154
+ const label = theme.fg("toolTitle", theme.bold("memory ")) + theme.fg("accent", `"${query}"`) + theme.fg("muted", type)
155
+ return { render: () => [label], invalidate() {} }
156
+ }
157
+
158
+ export function memoryRenderResult(result: any, opts: { expanded: boolean }, theme: PiTheme): any {
159
+ const raw = extractText(result)
160
+ if (raw.includes("unavailable") || raw.includes("No memories")) {
161
+ return { render: () => [theme.fg("dim", raw)], invalidate() {} }
162
+ }
163
+
164
+ const entries = raw.split(/\n\n---\n\n/).filter(Boolean)
165
+ const lines: string[] = []
166
+
167
+ const max = opts.expanded ? entries.length : Math.min(entries.length, 4)
168
+ for (let i = 0; i < max; i++) {
169
+ const entry = entries[i].trim()
170
+ const [header, ...body] = entry.split("\n")
171
+ if (header) lines.push(theme.fg("accent", header))
172
+ if (opts.expanded) {
173
+ for (const l of body) lines.push(theme.fg("muted", l))
174
+ lines.push("")
175
+ } else if (body.length > 0) {
176
+ lines.push(theme.fg("dim", body[0].slice(0, 80) + (body[0].length > 80 ? "…" : "")))
177
+ }
178
+ }
179
+
180
+ if (!opts.expanded && entries.length > 4) {
181
+ lines.push(theme.fg("dim", `... ${entries.length - 4} more (Ctrl+O)`))
182
+ }
183
+
184
+ return { render: () => lines, invalidate() {} }
185
+ }
186
+
187
+ // ─── Synopsis Tool ──────────────────────────────────────────────────────────
188
+
189
+ export function synopsisRenderCall(args: Record<string, any>, theme: PiTheme): any {
190
+ const hours = args.hours ?? 24
191
+ const author = args.author ? ` by ${args.author}` : ""
192
+ const label = theme.fg("toolTitle", theme.bold("synopsis ")) + theme.fg("accent", `${hours}h`) + theme.fg("muted", author)
193
+ return { render: () => [label], invalidate() {} }
194
+ }
195
+
196
+ export function synopsisRenderResult(result: any, opts: { expanded: boolean }, theme: PiTheme): any {
197
+ const raw = extractText(result)
198
+ const lines = raw.split("\n")
199
+ const themed: string[] = []
200
+
201
+ for (const line of lines) {
202
+ if (/^#+\s/.test(line)) themed.push(theme.fg("accent", theme.bold(line)))
203
+ else if (/^-\s/.test(line)) themed.push(theme.fg("muted", " ") + theme.fg("text", line.slice(2)))
204
+ else if (/feature|feat/i.test(line)) themed.push(theme.fg("success", line))
205
+ else if (/fix|bug/i.test(line)) themed.push(theme.fg("error", line))
206
+ else if (/decision/i.test(line)) themed.push(theme.fg("warning", line))
207
+ else if (/time|hours|minutes/i.test(line)) themed.push(theme.fg("dim", line))
208
+ else themed.push(theme.fg("toolOutput", line))
209
+ }
210
+
211
+ if (!opts.expanded && themed.length > 15) {
212
+ const display = themed.slice(0, 15)
213
+ display.push(theme.fg("dim", `... ${themed.length - 15} more lines (Ctrl+O)`))
214
+ return { render: () => display, invalidate() {} }
215
+ }
216
+
217
+ return { render: () => themed, invalidate() {} }
218
+ }
219
+
220
+ // ─── Eval Status Tool ───────────────────────────────────────────────────────
221
+
222
+ export function evalStatusRenderCall(args: Record<string, any>, theme: PiTheme): any {
223
+ const label = theme.fg("toolTitle", theme.bold("eval")) + " " + theme.fg("accent", "status")
224
+ return { render: () => [label], invalidate() {} }
225
+ }
226
+
227
+ export function evalStatusRenderResult(result: any, opts: { expanded: boolean }, theme: PiTheme): any {
228
+ const raw = extractText(result)
229
+ const lines = raw.split("\n").filter(Boolean)
230
+ const themed = lines.map(line => {
231
+ const scoreMatch = line.match(/([\d.]+)/)
232
+ if (scoreMatch) {
233
+ const score = parseFloat(scoreMatch[1])
234
+ if (score >= 0.8) return theme.fg("success", line)
235
+ if (score >= 0.5) return theme.fg("warning", line)
236
+ return theme.fg("error", line)
237
+ }
238
+ if (/trend|delta|improved/i.test(line)) return theme.fg("accent", line)
239
+ return theme.fg("toolOutput", line)
240
+ })
241
+
242
+ return { render: () => themed, invalidate() {} }
243
+ }
244
+
245
+ // ─── Eval Compare Tool ──────────────────────────────────────────────────────
246
+
247
+ export function evalCompareRenderCall(args: Record<string, any>, theme: PiTheme): any {
248
+ const a = args.a ?? "-2"
249
+ const b = args.b ?? "-1"
250
+ const label = theme.fg("toolTitle", theme.bold("eval")) + " " + theme.fg("accent", `compare ${a} ↔ ${b}`)
251
+ return { render: () => [label], invalidate() {} }
252
+ }
253
+
254
+ export function evalCompareRenderResult(result: any, _opts: { expanded: boolean }, theme: PiTheme): any {
255
+ const raw = extractText(result)
256
+ const lines = raw.split("\n").filter(Boolean).map(line => {
257
+ if (/improved|↑|better/i.test(line)) return theme.fg("success", line)
258
+ if (/regressed|↓|worse/i.test(line)) return theme.fg("error", line)
259
+ if (/unchanged|same/i.test(line)) return theme.fg("dim", line)
260
+ return theme.fg("toolOutput", line)
261
+ })
262
+ return { render: () => lines, invalidate() {} }
263
+ }
264
+
265
+ // ─── Policy Score Tool ──────────────────────────────────────────────────────
266
+
267
+ export function policyScoreRenderCall(args: Record<string, any>, theme: PiTheme): any {
268
+ const action = args.action_type ?? "?"
269
+ const scope = args.scope ? `[${args.scope}]` : ""
270
+ const label = theme.fg("toolTitle", theme.bold("policy ")) + theme.fg("accent", action) + " " + theme.fg("dim", scope)
271
+ return { render: () => [label], invalidate() {} }
272
+ }
273
+
274
+ export function policyScoreRenderResult(result: any, _opts: { expanded: boolean }, theme: PiTheme): any {
275
+ const raw = extractText(result)
276
+ const lines = raw.split("\n").filter(Boolean).map(line => {
277
+ if (/positive|recommend|high/i.test(line)) return theme.fg("success", line)
278
+ if (/negative|avoid|low/i.test(line)) return theme.fg("error", line)
279
+ if (/delta|score|predict/i.test(line)) return theme.fg("accent", line)
280
+ return theme.fg("toolOutput", line)
281
+ })
282
+ return { render: () => lines, invalidate() {} }
283
+ }
284
+
285
+ // ─── Policy Rank Tool ───────────────────────────────────────────────────────
286
+
287
+ export function policyRankRenderCall(args: Record<string, any>, theme: PiTheme): any {
288
+ let count = 0
289
+ try { count = JSON.parse(args.actions ?? "[]").length } catch {}
290
+ const label = theme.fg("toolTitle", theme.bold("policy ")) + theme.fg("accent", `rank ${count} actions`)
291
+ return { render: () => [label], invalidate() {} }
292
+ }
293
+
294
+ export function policyRankRenderResult(result: any, _opts: { expanded: boolean }, theme: PiTheme): any {
295
+ const raw = extractText(result)
296
+ const lines = raw.split("\n").filter(Boolean)
297
+ const themed = lines.map((line, i) => {
298
+ const medal = i === 0 ? theme.fg("warning", "🥇") : i === 1 ? theme.fg("muted", "🥈") : i === 2 ? theme.fg("muted", "🥉") : theme.fg("dim", ` ${i + 1}.`)
299
+ if (/delta|score/i.test(line)) return `${medal} ${theme.fg("accent", line)}`
300
+ return `${medal} ${theme.fg("toolOutput", line)}`
301
+ })
302
+ return { render: () => themed, invalidate() {} }
303
+ }
304
+
305
+ // ─── Training Buffer Tool ───────────────────────────────────────────────────
306
+
307
+ export function trainingBufferRenderCall(args: Record<string, any>, theme: PiTheme): any {
308
+ const action = args.action_type ?? "?"
309
+ const outcome = args.outcome ?? ""
310
+ const icon = outcome === "improved" ? theme.fg("success", "↑") : outcome === "regressed" ? theme.fg("error", "↓") : theme.fg("dim", "→")
311
+ const label = theme.fg("toolTitle", theme.bold("train ")) + `${icon} ${theme.fg("accent", action)}`
312
+ return { render: () => [label], invalidate() {} }
313
+ }
314
+
315
+ export function trainingBufferRenderResult(result: any, _opts: { expanded: boolean }, theme: PiTheme): any {
316
+ const raw = extractText(result)
317
+ const line = raw.includes("recorded") || raw.includes("saved")
318
+ ? theme.fg("success", "✓ ") + theme.fg("muted", raw)
319
+ : theme.fg("toolOutput", raw)
320
+ return { render: () => [line], invalidate() {} }
321
+ }
322
+
323
+ // ─── Mine Tuples Tool ───────────────────────────────────────────────────────
324
+
325
+ export function mineTuplesRenderCall(args: Record<string, any>, theme: PiTheme): any {
326
+ const source = args.source ?? "all"
327
+ const write = args.write === "yes" ? theme.fg("warning", " (write)") : ""
328
+ const label = theme.fg("toolTitle", theme.bold("mine ")) + theme.fg("accent", source) + write
329
+ return { render: () => [label], invalidate() {} }
330
+ }
331
+
332
+ export function mineTuplesRenderResult(result: any, _opts: { expanded: boolean }, theme: PiTheme): any {
333
+ const raw = extractText(result)
334
+ const lines = raw.split("\n").filter(Boolean).map(line => {
335
+ if (/mined|extracted|found/i.test(line)) return theme.fg("success", line)
336
+ if (/error|failed/i.test(line)) return theme.fg("error", line)
337
+ return theme.fg("toolOutput", line)
338
+ })
339
+ return { render: () => lines, invalidate() {} }
340
+ }
341
+
342
+ // ─── Extract text helper ────────────────────────────────────────────────────
343
+
344
+ function extractText(result: any): string {
345
+ if (typeof result === "string") return result
346
+ if (result?.details?.raw) return String(result.details.raw)
347
+ if (result?.content) {
348
+ for (const c of result.content) {
349
+ if (c?.type === "text") return c.text
350
+ }
351
+ }
352
+ return String(result ?? "")
353
+ }