@runweave/server-linux-x64 0.1.8 → 0.1.10

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 (357) hide show
  1. package/manifest.json +1494 -161
  2. package/native.tar.gz +0 -0
  3. package/package.json +1 -1
  4. package/payload/.agents/plugins/marketplace.json +20 -0
  5. package/payload/app-server/build-info.json +4 -4
  6. package/payload/app-server/index.cjs +6 -2
  7. package/payload/app-server/index.cjs.map +1 -1
  8. package/payload/backend/activity-sqlite-worker.cjs +2 -0
  9. package/payload/backend/build-info.json +4 -4
  10. package/payload/backend/dev-resources/control.cjs +5 -1
  11. package/payload/backend/index.cjs +466 -295
  12. package/payload/backend/ios-simulators/pool.py +3 -3
  13. package/payload/backend/scheduled-tasks-sqlite-worker.cjs +2 -0
  14. package/payload/frontend/dist/assets/{_baseUniq-vo4uuhMd.js → _baseUniq--CWv8e7O.js} +1 -1
  15. package/payload/frontend/dist/assets/{access-_jCu7Rgu.js → access-BCF23Qto.js} +1 -1
  16. package/payload/frontend/dist/assets/{advanced-CqOhObYj.js → advanced-D8viCLue.js} +1 -1
  17. package/payload/frontend/dist/assets/{appearance-CrrD5gzC.js → appearance-wPVMx-tB.js} +1 -1
  18. package/payload/frontend/dist/assets/{arc-dbfyHSF0.js → arc-BXffHD7A.js} +1 -1
  19. package/payload/frontend/dist/assets/{architectureDiagram-Q4EWVU46-CntSCAsO.js → architectureDiagram-Q4EWVU46-BXHN9QCj.js} +1 -1
  20. package/payload/frontend/dist/assets/{blockDiagram-DXYQGD6D-Chp0D4qy.js → blockDiagram-DXYQGD6D-DoZjab_0.js} +1 -1
  21. package/payload/frontend/dist/assets/{c4Diagram-AHTNJAMY-CF91pOuW.js → c4Diagram-AHTNJAMY-Ds2E62Z8.js} +1 -1
  22. package/payload/frontend/dist/assets/channel-83CTXkVl.js +1 -0
  23. package/payload/frontend/dist/assets/{chunk-4BX2VUAB-B1gxlVu2.js → chunk-4BX2VUAB-Dk1H2-5_.js} +1 -1
  24. package/payload/frontend/dist/assets/{chunk-4TB4RGXK-Cxt3mj9b.js → chunk-4TB4RGXK-Sg0gzSvg.js} +1 -1
  25. package/payload/frontend/dist/assets/{chunk-55IACEB6-BJT6qNik.js → chunk-55IACEB6-Du_EJG4S.js} +1 -1
  26. package/payload/frontend/dist/assets/{chunk-EDXVE4YY-yI59bCa0.js → chunk-EDXVE4YY-BM1Cs5dU.js} +1 -1
  27. package/payload/frontend/dist/assets/{chunk-FMBD7UC4-CDvncKKJ.js → chunk-FMBD7UC4-BM9thfyY.js} +1 -1
  28. package/payload/frontend/dist/assets/{chunk-OYMX7WX6-BblOIU57.js → chunk-OYMX7WX6-C9Bvn4fo.js} +1 -1
  29. package/payload/frontend/dist/assets/{chunk-QZHKN3VN-rODzNdO0.js → chunk-QZHKN3VN-CaakbFhJ.js} +1 -1
  30. package/payload/frontend/dist/assets/{chunk-YZCP3GAM-B6D4wQwk.js → chunk-YZCP3GAM-DkVNrd40.js} +1 -1
  31. package/payload/frontend/dist/assets/classDiagram-6PBFFD2Q-oR8IYJwC.js +1 -0
  32. package/payload/frontend/dist/assets/classDiagram-v2-HSJHXN6E-oR8IYJwC.js +1 -0
  33. package/payload/frontend/dist/assets/clone-BIDF-bd9.js +1 -0
  34. package/payload/frontend/dist/assets/connection-DIdF_3aa.js +12 -0
  35. package/payload/frontend/dist/assets/{connections-DqDmxS-O.js → connections-DBYC8SFl.js} +1 -1
  36. package/payload/frontend/dist/assets/{cose-bilkent-S5V4N54A-BvwVWp29.js → cose-bilkent-S5V4N54A-B4-fwllY.js} +1 -1
  37. package/payload/frontend/dist/assets/{dagre-KV5264BT-h_K1TH11.js → dagre-KV5264BT-Byu4wqLk.js} +1 -1
  38. package/payload/frontend/dist/assets/{desktop-BQ3kGtKG.js → desktop-aESkh0HL.js} +1 -1
  39. package/payload/frontend/dist/assets/{diagram-5BDNPKRD-B8g2SV6L.js → diagram-5BDNPKRD-DJW8DuCX.js} +1 -1
  40. package/payload/frontend/dist/assets/{diagram-G4DWMVQ6-BOEnrqYm.js → diagram-G4DWMVQ6-DTBvds5J.js} +1 -1
  41. package/payload/frontend/dist/assets/{diagram-MMDJMWI5-DlaN_z71.js → diagram-MMDJMWI5-D42e4xzm.js} +1 -1
  42. package/payload/frontend/dist/assets/{diagram-TYMM5635-C_pSKftn.js → diagram-TYMM5635-BjV43-C_.js} +1 -1
  43. package/payload/frontend/dist/assets/{erDiagram-SMLLAGMA-C2dL-h3I.js → erDiagram-SMLLAGMA-DE47Ibp_.js} +1 -1
  44. package/payload/frontend/dist/assets/{flowDiagram-DWJPFMVM-BmXhKWFj.js → flowDiagram-DWJPFMVM-CjGBlzS4.js} +1 -1
  45. package/payload/frontend/dist/assets/{ganttDiagram-T4ZO3ILL-D_Odnssf.js → ganttDiagram-T4ZO3ILL-vfj40KZi.js} +1 -1
  46. package/payload/frontend/dist/assets/{gitGraphDiagram-UUTBAWPF-DcQdcwKZ.js → gitGraphDiagram-UUTBAWPF-DT5xfRNb.js} +1 -1
  47. package/payload/frontend/dist/assets/{graph-C_XsxefA.js → graph-D-AF6yQT.js} +1 -1
  48. package/payload/frontend/dist/assets/{image-D3hgVr8O.js → image-D9gtSsD9.js} +1 -1
  49. package/payload/frontend/dist/assets/{index-CEUsFFQq.js → index-BPVP2P-2.js} +95 -105
  50. package/payload/frontend/dist/assets/{infoDiagram-42DDH7IO-C6TnRyMi.js → infoDiagram-42DDH7IO-C7ew_uLJ.js} +1 -1
  51. package/payload/frontend/dist/assets/{ishikawaDiagram-UXIWVN3A-BL7rfALJ.js → ishikawaDiagram-UXIWVN3A-B6-YebU9.js} +1 -1
  52. package/payload/frontend/dist/assets/{journeyDiagram-VCZTEJTY-C_6407GW.js → journeyDiagram-VCZTEJTY-BOFgJDA5.js} +1 -1
  53. package/payload/frontend/dist/assets/{kanban-definition-6JOO6SKY-CK61Fd0p.js → kanban-definition-6JOO6SKY-jh06wZYz.js} +1 -1
  54. package/payload/frontend/dist/assets/{layout-DVn6JKbl.js → layout-B4p7V5fB.js} +1 -1
  55. package/payload/frontend/dist/assets/{linear-DyWskq8H.js → linear-D2JWfvdc.js} +1 -1
  56. package/payload/frontend/dist/assets/main-CuRgiPQf.js +706 -0
  57. package/payload/frontend/dist/assets/main-D4_uoZQa.css +33 -0
  58. package/payload/frontend/dist/assets/{min-apbLpSJ3.js → min--jD4Arnm.js} +1 -1
  59. package/payload/frontend/dist/assets/{mindmap-definition-QFDTVHPH-MVHZZbma.js → mindmap-definition-QFDTVHPH-DmzjmSuf.js} +1 -1
  60. package/payload/frontend/dist/assets/{monitoring-BApsVez_.js → monitoring-Tvvk6TfB.js} +1 -1
  61. package/payload/frontend/dist/assets/{notifications-CjxSNLU1.js → notifications-CqP2AQrW.js} +1 -1
  62. package/payload/frontend/dist/assets/{pieDiagram-DEJITSTG-Dhbb0AYU.js → pieDiagram-DEJITSTG-B79qIVe5.js} +1 -1
  63. package/payload/frontend/dist/assets/{quadrantDiagram-34T5L4WZ-Yk6LOF0S.js → quadrantDiagram-34T5L4WZ-DIOj1DhE.js} +1 -1
  64. package/payload/frontend/dist/assets/{record-content-BCJ80KS5.js → record-content-CzGGCbNs.js} +1 -1
  65. package/payload/frontend/dist/assets/{requirementDiagram-MS252O5E-BUhS0PEq.js → requirementDiagram-MS252O5E-C-n1j3tN.js} +1 -1
  66. package/payload/frontend/dist/assets/{sankeyDiagram-XADWPNL6-D2sdxz14.js → sankeyDiagram-XADWPNL6-BVKqWE6C.js} +1 -1
  67. package/payload/frontend/dist/assets/{sequenceDiagram-FGHM5R23-CRere4Fy.js → sequenceDiagram-FGHM5R23-B980Icqs.js} +1 -1
  68. package/payload/frontend/dist/assets/{stateDiagram-FHFEXIEX-_pk-OMlm.js → stateDiagram-FHFEXIEX-C-mJHzhL.js} +1 -1
  69. package/payload/frontend/dist/assets/stateDiagram-v2-QKLJ7IA2-B4L4fK9G.js +1 -0
  70. package/payload/frontend/dist/assets/{status-Dk5rRVQF.js → status-Bv4Czr9-.js} +1 -1
  71. package/payload/frontend/dist/assets/suiji-DyzQqRTE.js +1 -0
  72. package/payload/frontend/dist/assets/{svg-X7YkMMvx.js → svg-C6Aj62ig.js} +1 -1
  73. package/payload/frontend/dist/assets/{tabs-BmKbcPVh.js → tabs-BTUOhdAF.js} +1 -1
  74. package/payload/frontend/dist/assets/{timeline-definition-GMOUNBTQ-BPsI2pMC.js → timeline-definition-GMOUNBTQ-Dr9yRuVq.js} +1 -1
  75. package/payload/frontend/dist/assets/{vennDiagram-DHZGUBPP-BNJkZ1Az.js → vennDiagram-DHZGUBPP-B0Xsg1-Z.js} +1 -1
  76. package/payload/frontend/dist/assets/{wardley-RL74JXVD-CVcYeATS.js → wardley-RL74JXVD-BjIKKaA_.js} +1 -1
  77. package/payload/frontend/dist/assets/{wardleyDiagram-NUSXRM2D-BpLJ0alk.js → wardleyDiagram-NUSXRM2D-DMJ7MEA9.js} +1 -1
  78. package/payload/frontend/dist/assets/{xychartDiagram-5P7HB3ND-BdsYYk4M.js → xychartDiagram-5P7HB3ND-2tvgfdab.js} +1 -1
  79. package/payload/frontend/dist/build-info.json +4 -4
  80. package/payload/frontend/dist/companion.html +1 -1
  81. package/payload/frontend/dist/index.html +3 -3
  82. package/payload/packages/agent-bridge/src/install-pi.mjs +81 -0
  83. package/payload/plugins/pi/dist/SKILL.md +22 -0
  84. package/payload/plugins/pi/dist/bridge/app-server-client.cjs +82 -0
  85. package/payload/plugins/pi/dist/bridge/feishu_stop_notify.sh +169 -0
  86. package/payload/plugins/pi/dist/bridge/runweave-hook-bridge.cjs +583 -0
  87. package/payload/plugins/pi/dist/bridge/runweave-hook-completion.cjs +42 -0
  88. package/payload/plugins/pi/dist/bridge/runweave-hook-payload.cjs +578 -0
  89. package/payload/plugins/pi/dist/bridge/runweave-task-supervision.cjs +167 -0
  90. package/payload/plugins/pi/dist/runweave.js +316 -0
  91. package/payload/plugins/toolkit/.codex-plugin/plugin.json +31 -0
  92. package/payload/plugins/toolkit/README.md +185 -0
  93. package/payload/plugins/toolkit/hooks/AGENTS.md +6 -0
  94. package/payload/plugins/toolkit/hooks/app-server-client.cjs +82 -0
  95. package/payload/plugins/toolkit/hooks/feishu_stop_notify.sh +169 -0
  96. package/payload/plugins/toolkit/hooks/runweave-hook-bridge.cjs +583 -0
  97. package/payload/plugins/toolkit/hooks/runweave-hook-completion.cjs +42 -0
  98. package/payload/plugins/toolkit/hooks/runweave-hook-dispatch.cjs +123 -0
  99. package/payload/plugins/toolkit/hooks/runweave-hook-payload.cjs +578 -0
  100. package/payload/plugins/toolkit/hooks/runweave-task-supervision.cjs +167 -0
  101. package/payload/plugins/toolkit/hooks.json +108 -0
  102. package/payload/plugins/toolkit/skills/acceptance/SKILL.md +70 -0
  103. package/payload/plugins/toolkit/skills/acceptance/agents/openai.yaml +4 -0
  104. package/payload/plugins/toolkit/skills/acceptance/references/capture.md +38 -0
  105. package/payload/plugins/toolkit/skills/acceptance/references/delivery.md +54 -0
  106. package/payload/plugins/toolkit/skills/acceptance/references/gallery-contract.md +84 -0
  107. package/payload/plugins/toolkit/skills/acceptance/references/gallery-copy.md +34 -0
  108. package/payload/plugins/toolkit/skills/acceptance/references/video.md +52 -0
  109. package/payload/plugins/toolkit/skills/acceptance/scripts/capture.py +137 -0
  110. package/payload/plugins/toolkit/skills/acceptance/scripts/common.py +63 -0
  111. package/payload/plugins/toolkit/skills/acceptance/scripts/gallery.py +353 -0
  112. package/payload/plugins/toolkit/skills/acceptance/scripts/preview.py +109 -0
  113. package/payload/plugins/toolkit/skills/acceptance/scripts/video.py +283 -0
  114. package/payload/plugins/toolkit/skills/acceptance/templates/reader.css +576 -0
  115. package/payload/plugins/toolkit/skills/acceptance/templates/reader.html +63 -0
  116. package/payload/plugins/toolkit/skills/acceptance/templates/reader.js +326 -0
  117. package/payload/plugins/toolkit/skills/acceptance/templates/viewer.css +55 -0
  118. package/payload/plugins/toolkit/skills/acceptance-gallery/SKILL.md +8 -0
  119. package/payload/plugins/toolkit/skills/acceptance-gallery/agents/openai.yaml +6 -0
  120. package/payload/plugins/toolkit/skills/acceptance-gallery/references/capture-and-copy.md +3 -0
  121. package/payload/plugins/toolkit/skills/acceptance-gallery/references/content-contract.md +3 -0
  122. package/payload/plugins/toolkit/skills/acceptance-gallery/scripts/gallery.py +9 -0
  123. package/payload/plugins/toolkit/skills/acceptance-video/SKILL.md +8 -0
  124. package/payload/plugins/toolkit/skills/acceptance-video/agents/openai.yaml +6 -0
  125. package/payload/plugins/toolkit/skills/acceptance-video/references/input-and-capture.md +3 -0
  126. package/payload/plugins/toolkit/skills/acceptance-video/references/mobile-review.md +3 -0
  127. package/payload/plugins/toolkit/skills/acceptance-video/scripts/capture.py +9 -0
  128. package/payload/plugins/toolkit/skills/acceptance-video/scripts/video.py +9 -0
  129. package/payload/plugins/toolkit/skills/agent-device/SKILL.md +86 -0
  130. package/payload/plugins/toolkit/skills/agent-device/agents/openai.yaml +4 -0
  131. package/payload/plugins/toolkit/skills/agent-device/references/ios-setup.md +36 -0
  132. package/payload/plugins/toolkit/skills/agent-device/scripts/device.py +398 -0
  133. package/payload/plugins/toolkit/skills/agent-device/scripts/resources.py +248 -0
  134. package/payload/plugins/toolkit/skills/architecture-flow-prototyping/SKILL.md +128 -0
  135. package/payload/plugins/toolkit/skills/architecture-flow-prototyping/agents/openai.yaml +4 -0
  136. package/payload/plugins/toolkit/skills/architecture-flow-prototyping/references/architecture-flow-checklist.md +59 -0
  137. package/payload/plugins/toolkit/skills/architecture-flow-prototyping/references/architecture-flow-guide.md +135 -0
  138. package/payload/plugins/toolkit/skills/architecture-flow-prototyping/references/architecture-flow-handoff-template.md +57 -0
  139. package/payload/plugins/toolkit/skills/ask-first/SKILL.md +81 -0
  140. package/payload/plugins/toolkit/skills/brainstorming/SKILL.md +41 -0
  141. package/payload/plugins/toolkit/skills/browse-record/SKILL.md +35 -0
  142. package/payload/plugins/toolkit/skills/browse-record/references/app-usage.md +19 -0
  143. package/payload/plugins/toolkit/skills/browse-record/references/daily-reporting.md +115 -0
  144. package/payload/plugins/toolkit/skills/browse-record/references/zhihu.md +33 -0
  145. package/payload/plugins/toolkit/skills/browse-record/scripts/app_usage.py +110 -0
  146. package/payload/plugins/toolkit/skills/browse-record/scripts/browse_job.py +385 -0
  147. package/payload/plugins/toolkit/skills/browse-record/scripts/zhihu-read.js +126 -0
  148. package/payload/plugins/toolkit/skills/browse-record/scripts/zhihu_http.py +273 -0
  149. package/payload/plugins/toolkit/skills/clear-technical-explanations/LICENSE +21 -0
  150. package/payload/plugins/toolkit/skills/clear-technical-explanations/SKILL.md +103 -0
  151. package/payload/plugins/toolkit/skills/code-grounded-requirements/SKILL.md +54 -0
  152. package/payload/plugins/toolkit/skills/daily-doc-maintenance/SKILL.md +151 -0
  153. package/payload/plugins/toolkit/skills/daily-record/SKILL.md +63 -0
  154. package/payload/plugins/toolkit/skills/daily-record/agents/openai.yaml +4 -0
  155. package/payload/plugins/toolkit/skills/daily-record/references/browser-history.md +6 -0
  156. package/payload/plugins/toolkit/skills/daily-record/references/feishu.md +90 -0
  157. package/payload/plugins/toolkit/skills/daily-record/references/scheduled-reporting.md +144 -0
  158. package/payload/plugins/toolkit/skills/daily-record/references/scheduled-task.template.json +15 -0
  159. package/payload/plugins/toolkit/skills/daily-record/references/suiji-work-records.md +57 -0
  160. package/payload/plugins/toolkit/skills/daily-record/scripts/feishu.py +280 -0
  161. package/payload/plugins/toolkit/skills/daily-record/scripts/job.py +416 -0
  162. package/payload/plugins/toolkit/skills/daily-record/scripts/job_browser.py +77 -0
  163. package/payload/plugins/toolkit/skills/daily-record/scripts/job_facts.py +132 -0
  164. package/payload/plugins/toolkit/skills/daily-record/scripts/job_isolation.py +69 -0
  165. package/payload/plugins/toolkit/skills/daily-record/scripts/job_materials.py +154 -0
  166. package/payload/plugins/toolkit/skills/daily-record/scripts/job_screen.py +77 -0
  167. package/payload/plugins/toolkit/skills/daily-record/scripts/job_state.py +309 -0
  168. package/payload/plugins/toolkit/skills/daily-refactor/SKILL.md +101 -0
  169. package/payload/plugins/toolkit/skills/daily-refactor/scripts/compare-architecture-reports.mjs +168 -0
  170. package/payload/plugins/toolkit/skills/debugging-strategies/SKILL.md +38 -0
  171. package/payload/plugins/toolkit/skills/debugging-strategies/resources/implementation-playbook.md +520 -0
  172. package/payload/plugins/toolkit/skills/diagnostic-log-debugging/SKILL.md +79 -0
  173. package/payload/plugins/toolkit/skills/doc-coauthoring/SKILL.md +64 -0
  174. package/payload/plugins/toolkit/skills/eli5/LICENSE +21 -0
  175. package/payload/plugins/toolkit/skills/eli5/SKILL.md +18 -0
  176. package/payload/plugins/toolkit/skills/experience/SKILL.md +71 -0
  177. package/payload/plugins/toolkit/skills/experience/package.json +13 -0
  178. package/payload/plugins/toolkit/skills/git-advanced-workflows/SKILL.md +457 -0
  179. package/payload/plugins/toolkit/skills/github-pr/SKILL.md +109 -0
  180. package/payload/plugins/toolkit/skills/github-pr/scripts/github-access.mjs +292 -0
  181. package/payload/plugins/toolkit/skills/github-pr/scripts/preflight.mjs +191 -0
  182. package/payload/plugins/toolkit/skills/github-pr/scripts/source-worktree.mjs +354 -0
  183. package/payload/plugins/toolkit/skills/grill-with-docs/SKILL.md +66 -0
  184. package/payload/plugins/toolkit/skills/grill-with-docs/agents/openai.yaml +6 -0
  185. package/payload/plugins/toolkit/skills/grilling/SKILL.md +14 -0
  186. package/payload/plugins/toolkit/skills/handoff/SKILL.md +98 -0
  187. package/payload/plugins/toolkit/skills/karpathy-guidelines/SKILL.md +73 -0
  188. package/payload/plugins/toolkit/skills/playwright-cli/SKILL.md +562 -0
  189. package/payload/plugins/toolkit/skills/playwright-cli/references/element-attributes.md +23 -0
  190. package/payload/plugins/toolkit/skills/playwright-cli/references/playwright-tests.md +39 -0
  191. package/payload/plugins/toolkit/skills/playwright-cli/references/request-mocking.md +87 -0
  192. package/payload/plugins/toolkit/skills/playwright-cli/references/running-code.md +240 -0
  193. package/payload/plugins/toolkit/skills/playwright-cli/references/session-management.md +226 -0
  194. package/payload/plugins/toolkit/skills/playwright-cli/references/spec-driven-testing.md +312 -0
  195. package/payload/plugins/toolkit/skills/playwright-cli/references/storage-state.md +275 -0
  196. package/payload/plugins/toolkit/skills/playwright-cli/references/test-generation.md +138 -0
  197. package/payload/plugins/toolkit/skills/playwright-cli/references/tracing.md +142 -0
  198. package/payload/plugins/toolkit/skills/playwright-cli/references/video-recording.md +157 -0
  199. package/payload/plugins/toolkit/skills/playwright-cli/templates/standalone.config.json +7 -0
  200. package/payload/plugins/toolkit/skills/product-exploration/SKILL.md +64 -0
  201. package/payload/plugins/toolkit/skills/product-exploration/agents/openai.yaml +5 -0
  202. package/payload/plugins/toolkit/skills/prototype-first-development/SKILL.md +134 -0
  203. package/payload/plugins/toolkit/skills/prototype-first-development/references/html-prototype-template/README.md +88 -0
  204. package/payload/plugins/toolkit/skills/prototype-first-development/references/html-prototype-template/app.js +145 -0
  205. package/payload/plugins/toolkit/skills/prototype-first-development/references/html-prototype-template/index.html +229 -0
  206. package/payload/plugins/toolkit/skills/prototype-first-development/references/html-prototype-template/mock-state.json +60 -0
  207. package/payload/plugins/toolkit/skills/prototype-first-development/references/implementation-plan-handoff-template.md +61 -0
  208. package/payload/plugins/toolkit/skills/prototype-first-development/references/prototype-workflow-checklist.md +64 -0
  209. package/payload/plugins/toolkit/skills/publish-runweave-server/SKILL.md +69 -0
  210. package/payload/plugins/toolkit/skills/publish-runweave-server/agents/openai.yaml +4 -0
  211. package/payload/plugins/toolkit/skills/react-best-practices/AGENTS.md +3227 -0
  212. package/payload/plugins/toolkit/skills/react-best-practices/README.md +127 -0
  213. package/payload/plugins/toolkit/skills/react-best-practices/SKILL.md +143 -0
  214. package/payload/plugins/toolkit/skills/react-best-practices/metadata.json +15 -0
  215. package/payload/plugins/toolkit/skills/react-best-practices/rules/advanced/event-handler-refs.md +55 -0
  216. package/payload/plugins/toolkit/skills/react-best-practices/rules/advanced/init-once.md +42 -0
  217. package/payload/plugins/toolkit/skills/react-best-practices/rules/advanced/use-latest.md +39 -0
  218. package/payload/plugins/toolkit/skills/react-best-practices/rules/async/api-routes.md +38 -0
  219. package/payload/plugins/toolkit/skills/react-best-practices/rules/async/defer-await.md +80 -0
  220. package/payload/plugins/toolkit/skills/react-best-practices/rules/async/dependencies.md +52 -0
  221. package/payload/plugins/toolkit/skills/react-best-practices/rules/async/parallel.md +28 -0
  222. package/payload/plugins/toolkit/skills/react-best-practices/rules/async/suspense-boundaries.md +99 -0
  223. package/payload/plugins/toolkit/skills/react-best-practices/rules/bundle/barrel-imports.md +59 -0
  224. package/payload/plugins/toolkit/skills/react-best-practices/rules/bundle/conditional.md +37 -0
  225. package/payload/plugins/toolkit/skills/react-best-practices/rules/bundle/defer-third-party.md +49 -0
  226. package/payload/plugins/toolkit/skills/react-best-practices/rules/bundle/dynamic-imports.md +35 -0
  227. package/payload/plugins/toolkit/skills/react-best-practices/rules/bundle/preload.md +46 -0
  228. package/payload/plugins/toolkit/skills/react-best-practices/rules/client/event-listeners.md +78 -0
  229. package/payload/plugins/toolkit/skills/react-best-practices/rules/client/localstorage-schema.md +77 -0
  230. package/payload/plugins/toolkit/skills/react-best-practices/rules/client/passive-event-listeners.md +48 -0
  231. package/payload/plugins/toolkit/skills/react-best-practices/rules/client/swr-dedup.md +56 -0
  232. package/payload/plugins/toolkit/skills/react-best-practices/rules/js/batch-dom-css.md +110 -0
  233. package/payload/plugins/toolkit/skills/react-best-practices/rules/js/cache-function-results.md +80 -0
  234. package/payload/plugins/toolkit/skills/react-best-practices/rules/js/cache-property-access.md +28 -0
  235. package/payload/plugins/toolkit/skills/react-best-practices/rules/js/cache-storage.md +70 -0
  236. package/payload/plugins/toolkit/skills/react-best-practices/rules/js/combine-iterations.md +32 -0
  237. package/payload/plugins/toolkit/skills/react-best-practices/rules/js/early-exit.md +50 -0
  238. package/payload/plugins/toolkit/skills/react-best-practices/rules/js/flatmap-filter.md +55 -0
  239. package/payload/plugins/toolkit/skills/react-best-practices/rules/js/hoist-regexp.md +45 -0
  240. package/payload/plugins/toolkit/skills/react-best-practices/rules/js/index-maps.md +37 -0
  241. package/payload/plugins/toolkit/skills/react-best-practices/rules/js/length-check-first.md +50 -0
  242. package/payload/plugins/toolkit/skills/react-best-practices/rules/js/min-max-loop.md +82 -0
  243. package/payload/plugins/toolkit/skills/react-best-practices/rules/js/set-map-lookups.md +24 -0
  244. package/payload/plugins/toolkit/skills/react-best-practices/rules/js/tosorted-immutable.md +57 -0
  245. package/payload/plugins/toolkit/skills/react-best-practices/rules/meta/sections.md +46 -0
  246. package/payload/plugins/toolkit/skills/react-best-practices/rules/meta/template.md +28 -0
  247. package/payload/plugins/toolkit/skills/react-best-practices/rules/rendering/activity.md +26 -0
  248. package/payload/plugins/toolkit/skills/react-best-practices/rules/rendering/animate-svg-wrapper.md +38 -0
  249. package/payload/plugins/toolkit/skills/react-best-practices/rules/rendering/conditional-render.md +32 -0
  250. package/payload/plugins/toolkit/skills/react-best-practices/rules/rendering/content-visibility.md +38 -0
  251. package/payload/plugins/toolkit/skills/react-best-practices/rules/rendering/hoist-jsx.md +36 -0
  252. package/payload/plugins/toolkit/skills/react-best-practices/rules/rendering/hydration-no-flicker.md +72 -0
  253. package/payload/plugins/toolkit/skills/react-best-practices/rules/rendering/hydration-suppress-warning.md +26 -0
  254. package/payload/plugins/toolkit/skills/react-best-practices/rules/rendering/resource-hints.md +89 -0
  255. package/payload/plugins/toolkit/skills/react-best-practices/rules/rendering/script-defer-async.md +71 -0
  256. package/payload/plugins/toolkit/skills/react-best-practices/rules/rendering/svg-precision.md +28 -0
  257. package/payload/plugins/toolkit/skills/react-best-practices/rules/rendering/usetransition-loading.md +75 -0
  258. package/payload/plugins/toolkit/skills/react-best-practices/rules/rerender/defer-reads.md +39 -0
  259. package/payload/plugins/toolkit/skills/react-best-practices/rules/rerender/dependencies.md +45 -0
  260. package/payload/plugins/toolkit/skills/react-best-practices/rules/rerender/derived-state-no-effect.md +40 -0
  261. package/payload/plugins/toolkit/skills/react-best-practices/rules/rerender/derived-state.md +29 -0
  262. package/payload/plugins/toolkit/skills/react-best-practices/rules/rerender/functional-setstate.md +77 -0
  263. package/payload/plugins/toolkit/skills/react-best-practices/rules/rerender/lazy-state-init.md +58 -0
  264. package/payload/plugins/toolkit/skills/react-best-practices/rules/rerender/memo-with-default-value.md +36 -0
  265. package/payload/plugins/toolkit/skills/react-best-practices/rules/rerender/memo.md +44 -0
  266. package/payload/plugins/toolkit/skills/react-best-practices/rules/rerender/move-effect-to-event.md +45 -0
  267. package/payload/plugins/toolkit/skills/react-best-practices/rules/rerender/no-inline-components.md +83 -0
  268. package/payload/plugins/toolkit/skills/react-best-practices/rules/rerender/simple-expression-in-memo.md +35 -0
  269. package/payload/plugins/toolkit/skills/react-best-practices/rules/rerender/transitions.md +40 -0
  270. package/payload/plugins/toolkit/skills/react-best-practices/rules/rerender/use-ref-transient-values.md +73 -0
  271. package/payload/plugins/toolkit/skills/react-best-practices/rules/server/after-nonblocking.md +74 -0
  272. package/payload/plugins/toolkit/skills/react-best-practices/rules/server/auth-actions.md +96 -0
  273. package/payload/plugins/toolkit/skills/react-best-practices/rules/server/cache-lru.md +41 -0
  274. package/payload/plugins/toolkit/skills/react-best-practices/rules/server/cache-react.md +76 -0
  275. package/payload/plugins/toolkit/skills/react-best-practices/rules/server/dedup-props.md +65 -0
  276. package/payload/plugins/toolkit/skills/react-best-practices/rules/server/hoist-static-io.md +139 -0
  277. package/payload/plugins/toolkit/skills/react-best-practices/rules/server/parallel-fetching.md +83 -0
  278. package/payload/plugins/toolkit/skills/react-best-practices/rules/server/serialization.md +38 -0
  279. package/payload/plugins/toolkit/skills/recorded-browser-mcp-verification/SKILL.md +8 -0
  280. package/payload/plugins/toolkit/skills/recorded-browser-mcp-verification/agents/openai.yaml +6 -0
  281. package/payload/plugins/toolkit/skills/reproduce-before-fix/SKILL.md +93 -0
  282. package/payload/plugins/toolkit/skills/reproduce-before-fix/agents/openai.yaml +7 -0
  283. package/payload/plugins/toolkit/skills/review-only/SKILL.md +72 -0
  284. package/payload/plugins/toolkit/skills/review-with-runtime-evidence/SKILL.md +134 -0
  285. package/payload/plugins/toolkit/skills/review-with-runtime-evidence/agents/openai.yaml +7 -0
  286. package/payload/plugins/toolkit/skills/review-with-runtime-evidence/references/contracts.md +114 -0
  287. package/payload/plugins/toolkit/skills/review-with-runtime-evidence/scripts/classify-runtime-verdict.mjs +140 -0
  288. package/payload/plugins/toolkit/skills/review-with-runtime-evidence/scripts/run-static-review.mjs +389 -0
  289. package/payload/plugins/toolkit/skills/review-with-runtime-evidence/scripts/static-review-contract.mjs +243 -0
  290. package/payload/plugins/toolkit/skills/run-test-cases/SKILL.md +63 -0
  291. package/payload/plugins/toolkit/skills/runweave-change-validation/SKILL.md +196 -0
  292. package/payload/plugins/toolkit/skills/runweave-change-validation/agents/openai.yaml +7 -0
  293. package/payload/plugins/toolkit/skills/runweave-change-validation/scripts/assert-dev-session-status.mjs +181 -0
  294. package/payload/plugins/toolkit/skills/runweave-dev-session/SKILL.md +126 -0
  295. package/payload/plugins/toolkit/skills/runweave-dev-session/agents/openai.yaml +7 -0
  296. package/payload/plugins/toolkit/skills/runweave-management/SKILL.md +47 -0
  297. package/payload/plugins/toolkit/skills/scheduled-task/SKILL.md +35 -0
  298. package/payload/plugins/toolkit/skills/shadcn/SKILL.md +245 -0
  299. package/payload/plugins/toolkit/skills/shadcn/agents/openai.yml +5 -0
  300. package/payload/plugins/toolkit/skills/shadcn/assets/shadcn-small.png +0 -0
  301. package/payload/plugins/toolkit/skills/shadcn/assets/shadcn.png +0 -0
  302. package/payload/plugins/toolkit/skills/shadcn/cli.md +276 -0
  303. package/payload/plugins/toolkit/skills/shadcn/customization.md +209 -0
  304. package/payload/plugins/toolkit/skills/shadcn/evals/evals.json +47 -0
  305. package/payload/plugins/toolkit/skills/shadcn/mcp.md +94 -0
  306. package/payload/plugins/toolkit/skills/shadcn/rules/base-vs-radix.md +310 -0
  307. package/payload/plugins/toolkit/skills/shadcn/rules/composition.md +197 -0
  308. package/payload/plugins/toolkit/skills/shadcn/rules/forms.md +198 -0
  309. package/payload/plugins/toolkit/skills/shadcn/rules/icons.md +101 -0
  310. package/payload/plugins/toolkit/skills/shadcn/rules/styling.md +163 -0
  311. package/payload/plugins/toolkit/skills/suiji/SKILL.md +54 -0
  312. package/payload/plugins/toolkit/skills/suiji/references/api.md +72 -0
  313. package/payload/plugins/toolkit/skills/suiji/references/source-adapter.md +40 -0
  314. package/payload/plugins/toolkit/skills/suiji/references/work-records.md +36 -0
  315. package/payload/plugins/toolkit/skills/suiji/scripts/source_adapter.py +46 -0
  316. package/payload/plugins/toolkit/skills/suiji/scripts/suiji.py +358 -0
  317. package/payload/plugins/toolkit/skills/suiji/scripts/work_records.py +328 -0
  318. package/payload/plugins/toolkit/skills/suiji/scripts/work_reports.py +75 -0
  319. package/payload/plugins/toolkit/skills/sync-branch-hard-reset/SKILL.md +59 -0
  320. package/payload/plugins/toolkit/skills/update-runweave-backend/SKILL.md +90 -0
  321. package/payload/plugins/toolkit/skills/update-runweave-backend/agents/openai.yaml +4 -0
  322. package/payload/plugins/toolkit/skills/update-runweave-backend/references/npm-update.md +68 -0
  323. package/payload/plugins/toolkit/skills/update-runweave-backend/references/systemd.md +34 -0
  324. package/payload/plugins/toolkit/skills/update-runweave-desktop/SKILL.md +102 -0
  325. package/payload/plugins/toolkit/skills/update-runweave-ios/SKILL.md +16 -0
  326. package/payload/plugins/toolkit/skills/update-runweave-ios/references/ios-wireless-recovery.md +54 -0
  327. package/payload/plugins/toolkit/skills/using-rw/SKILL.md +265 -0
  328. package/payload/plugins/toolkit/skills/write-plan/SKILL.md +72 -0
  329. package/payload/plugins/toolkit/skills/write-test-cases/SKILL.md +100 -0
  330. package/payload/plugins/toolkit/skills/write-test-cases/assets/test-plan-template.yaml +15 -0
  331. package/payload/plugins/toolkit/skills/write-test-cases/references/coverage-checklist.md +75 -0
  332. package/payload/plugins/toolkit/skills/write-test-cases/references/design-techniques.md +91 -0
  333. package/payload/plugins/toolkit/skills/youtube-reading/SKILL.md +35 -0
  334. package/payload/plugins/toolkit/skills/youtube-reading/agents/openai.yaml +4 -0
  335. package/payload/plugins/toolkit/skills/youtube-reading/assets/runtime-lock.json +92 -0
  336. package/payload/plugins/toolkit/skills/youtube-reading/references/content-contract.md +52 -0
  337. package/payload/plugins/toolkit/skills/youtube-reading/references/setup.md +70 -0
  338. package/payload/plugins/toolkit/skills/youtube-reading/requirements.lock +9 -0
  339. package/payload/plugins/toolkit/skills/youtube-reading/scripts/artifacts.py +206 -0
  340. package/payload/plugins/toolkit/skills/youtube-reading/scripts/runtime.py +424 -0
  341. package/payload/plugins/toolkit/skills/youtube-reading/scripts/youtube_reading.py +314 -0
  342. package/payload/plugins/toolkit-release.json +1 -0
  343. package/payload/pty-host/index.cjs +99 -31
  344. package/payload/scripts/toolkit/codex-state.mjs +75 -0
  345. package/payload/scripts/toolkit/release.mjs +210 -0
  346. package/payload/scripts/toolkit/sync-runtime.mjs +108 -0
  347. package/payload/scripts/toolkit/sync.mjs +585 -0
  348. package/payload/server/index.cjs +5 -1
  349. package/payload/frontend/dist/assets/channel-Bf3IeONI.js +0 -1
  350. package/payload/frontend/dist/assets/classDiagram-6PBFFD2Q-CFsG2SvG.js +0 -1
  351. package/payload/frontend/dist/assets/classDiagram-v2-HSJHXN6E-CFsG2SvG.js +0 -1
  352. package/payload/frontend/dist/assets/clone-CeQXm2YN.js +0 -1
  353. package/payload/frontend/dist/assets/connection-XriXysSc.js +0 -12
  354. package/payload/frontend/dist/assets/main-Cg6Oo1xK.css +0 -33
  355. package/payload/frontend/dist/assets/main-H5R-3_w1.js +0 -696
  356. package/payload/frontend/dist/assets/stateDiagram-v2-QKLJ7IA2-CzpdUl_0.js +0 -1
  357. package/payload/frontend/dist/assets/suiji-CO_L5W1X.js +0 -1
@@ -0,0 +1,123 @@
1
+ #!/usr/bin/env node
2
+ /* global __dirname, process, require */
3
+ /* eslint-disable @typescript-eslint/no-require-imports */
4
+
5
+ const { spawn } = require("node:child_process");
6
+ const path = require("node:path");
7
+
8
+ const SOURCES = new Set(["codex", "trae", "traecli", "traex", "claude"]);
9
+
10
+ function normalizeSource(value) {
11
+ const source = String(value || "")
12
+ .trim()
13
+ .toLowerCase();
14
+ return SOURCES.has(source) ? source : null;
15
+ }
16
+
17
+ function inferPluginRootSource(value) {
18
+ if (!value) {
19
+ return null;
20
+ }
21
+ const parts = path.resolve(value).split(path.sep).filter(Boolean);
22
+ if (hasAdjacentPathParts(parts, ".codex", "plugins")) {
23
+ return "codex";
24
+ }
25
+ if (hasPathSequence(parts, [".trae", "plugins"])) {
26
+ return "trae";
27
+ }
28
+ if (hasAdjacentPathParts(parts, ".claude", "plugins")) {
29
+ return "claude";
30
+ }
31
+ return null;
32
+ }
33
+
34
+ function hasAdjacentPathParts(parts, first, second) {
35
+ return parts.some(
36
+ (part, index) => part === first && parts[index + 1] === second,
37
+ );
38
+ }
39
+
40
+ function hasPathSequence(parts, sequence) {
41
+ let sequenceIndex = 0;
42
+ for (const part of parts) {
43
+ if (part !== sequence[sequenceIndex]) {
44
+ continue;
45
+ }
46
+ sequenceIndex += 1;
47
+ if (sequenceIndex === sequence.length) {
48
+ return true;
49
+ }
50
+ }
51
+ return false;
52
+ }
53
+
54
+ function inferSource() {
55
+ const sourceIndex = process.argv.indexOf("--source");
56
+ const argumentSource =
57
+ sourceIndex >= 0 ? normalizeSource(process.argv[sourceIndex + 1]) : null;
58
+ if (argumentSource) return argumentSource;
59
+ const explicit = normalizeSource(process.env.RUNWEAVE_HOOK_SOURCE);
60
+ if (explicit) {
61
+ return explicit;
62
+ }
63
+
64
+ const pluginRootSource = inferPluginRootSource(path.resolve(__dirname, ".."));
65
+ if (pluginRootSource) {
66
+ return pluginRootSource;
67
+ }
68
+ const inferredSources = new Set();
69
+ if (process.env.CODEX_PLUGIN_ROOT) {
70
+ inferredSources.add(
71
+ inferPluginRootSource(process.env.CODEX_PLUGIN_ROOT) || "codex",
72
+ );
73
+ }
74
+ if (process.env.CLAUDE_PLUGIN_ROOT) {
75
+ inferredSources.add(
76
+ inferPluginRootSource(process.env.CLAUDE_PLUGIN_ROOT) || "claude",
77
+ );
78
+ }
79
+ return inferredSources.size === 1 ? [...inferredSources][0] : "unknown";
80
+ }
81
+
82
+ function main() {
83
+ const bridgePath = path.join(__dirname, "runweave-hook-bridge.cjs");
84
+ const source = inferSource();
85
+ const child = spawn(
86
+ process.execPath,
87
+ [bridgePath, "--source", source, ...process.argv.slice(2)],
88
+ {
89
+ stdio: ["pipe", "pipe", "ignore"],
90
+ },
91
+ );
92
+
93
+ process.stdin.pipe(child.stdin);
94
+ // Only Codex Stop may return a native continuation. Validate before passing
95
+ // stdout through so diagnostics can never become hook instructions.
96
+ let output = "";
97
+ child.stdout.on("data", (chunk) => {
98
+ if (output.length < 16000) output += chunk;
99
+ });
100
+ child.on("error", () => {
101
+ process.exitCode = 0;
102
+ });
103
+ child.on("close", () => {
104
+ if (source === "codex") {
105
+ try {
106
+ const result = JSON.parse(output);
107
+ if (
108
+ result.decision === "block" &&
109
+ typeof result.reason === "string" &&
110
+ result.reason.startsWith("[runweave-task-supervision:")
111
+ )
112
+ process.stdout.write(
113
+ JSON.stringify({ decision: "block", reason: result.reason }),
114
+ );
115
+ } catch {
116
+ /* Empty output is the normal allow-stop path. */
117
+ }
118
+ }
119
+ process.exitCode = 0;
120
+ });
121
+ }
122
+
123
+ main();
@@ -0,0 +1,578 @@
1
+ /* global module, process, require, Buffer */
2
+ /* eslint-disable @typescript-eslint/no-require-imports */
3
+
4
+ const fs = require("node:fs");
5
+ const os = require("node:os");
6
+ const path = require("node:path");
7
+
8
+ const STOP_EVENTS = new Set(["stop"]);
9
+ const COMPLETION_REASONS = new Set([
10
+ "hook_stop",
11
+ "notify",
12
+ "ai_process_exit",
13
+ "manual",
14
+ ]);
15
+
16
+ function parseTmuxSocketPath(value) {
17
+ if (!value) {
18
+ return null;
19
+ }
20
+ const socketPath = String(value).split(",")[0]?.trim();
21
+ return socketPath || null;
22
+ }
23
+
24
+ function getCommandBasename(command) {
25
+ const normalized = String(command || "")
26
+ .trim()
27
+ .replace(/\\+/g, "/");
28
+ if (!normalized) {
29
+ return null;
30
+ }
31
+ const basename = normalized.split("/").filter(Boolean).at(-1) || normalized;
32
+ return basename || null;
33
+ }
34
+
35
+ function isNestedCodexProcess(spawnSync) {
36
+ // A nested CLI inherits terminal/pane identity. Its hook still belongs to
37
+ // the child CLI, even when tmux reports the parent as the foreground command.
38
+ const result = spawnSync("ps", ["-ww", "-axo", "pid=,ppid=,args="], {
39
+ encoding: "utf8",
40
+ timeout: 1000,
41
+ maxBuffer: 2 * 1024 * 1024,
42
+ });
43
+ // Reject only proven nesting; an unavailable process snapshot must not
44
+ // disable normal hooks or shared-daemon hooks with a different ancestry.
45
+ if (result.error || result.status !== 0) return false;
46
+ const processes = new Map();
47
+ for (const line of String(result.stdout || "").split(/\r?\n/)) {
48
+ const match = line.match(/^\s*(\d+)\s+(\d+)\s+(\S+)(?:\s+(.*?))?\s*$/);
49
+ if (match) {
50
+ processes.set(Number(match[1]), {
51
+ parent: Number(match[2]),
52
+ command: getCommandBasename(match[3]),
53
+ // Shared app-server and its daemon supervisor both use the codex
54
+ // executable. Neither is a parent CLI that owns this terminal.
55
+ appServer: /^app-server(?:\s|$)/.test(match[4] || ""),
56
+ });
57
+ }
58
+ }
59
+ let codexCount = 0;
60
+ const visited = new Set();
61
+ for (let pid = process.ppid; pid > 1 && !visited.has(pid); ) {
62
+ visited.add(pid);
63
+ const entry = processes.get(pid);
64
+ if (!entry) break;
65
+ if (entry.command === "codex" && !entry.appServer && ++codexCount > 1) return true;
66
+ pid = entry.parent;
67
+ }
68
+ return false;
69
+ }
70
+
71
+ function readTmuxPaneContext(spawnSync) {
72
+ const socketPath = parseTmuxSocketPath(process.env.TMUX);
73
+ const tmuxPaneId = process.env.TMUX_PANE;
74
+ if (!socketPath || !tmuxPaneId) {
75
+ return {
76
+ commandName: null,
77
+ panelId: null,
78
+ resolved: false,
79
+ reason: "missing_tmux_context",
80
+ };
81
+ }
82
+ const separator = "__RUNWEAVE_METADATA_FIELD__";
83
+ let result;
84
+ let attempts = 0;
85
+ while (attempts < 2) {
86
+ attempts += 1;
87
+ result = spawnSync(
88
+ process.env.RUNWEAVE_RUNTIME_TMUX_BINARY || "tmux",
89
+ [
90
+ "-S",
91
+ socketPath,
92
+ "display-message",
93
+ "-p",
94
+ "-t",
95
+ tmuxPaneId,
96
+ [
97
+ "#{@runweave_agent_prepare_command}",
98
+ "#{@runweave_agent_prepare_exit}",
99
+ "#{@runweave_command}",
100
+ "#{pane_current_command}",
101
+ "#{@runweave_panel_id}",
102
+ ].join(separator),
103
+ ],
104
+ {
105
+ encoding: "utf8",
106
+ timeout: 1000,
107
+ maxBuffer: 32 * 1024,
108
+ },
109
+ );
110
+ if (!result.error && result.status === 0) {
111
+ break;
112
+ }
113
+ }
114
+ if (!result || result.error || result.status !== 0) {
115
+ return {
116
+ commandName: null,
117
+ panelId: null,
118
+ resolved: false,
119
+ reason: "tmux_display_message_failed",
120
+ attempts,
121
+ status: result?.status ?? null,
122
+ error: result?.error instanceof Error ? result.error.message : null,
123
+ };
124
+ }
125
+ const [
126
+ agentPrepareCommand = "",
127
+ agentPrepareExit = "",
128
+ runweaveCommand = "",
129
+ paneCommand = "",
130
+ panelId = "",
131
+ ] = String(result.stdout || "")
132
+ .replace(/\r?\n$/, "")
133
+ .split(separator);
134
+ const normalizedPaneCommand = getCommandBasename(paneCommand);
135
+ const paneAtInteractivePrompt = ["bash", "fish", "sh", "zsh"].includes(
136
+ normalizedPaneCommand,
137
+ );
138
+ const pendingAgentCommand =
139
+ agentPrepareExit.startsWith("pending:") &&
140
+ (Boolean(runweaveCommand.trim()) || !paneAtInteractivePrompt)
141
+ ? getCommandBasename(agentPrepareCommand)
142
+ : null;
143
+ return {
144
+ commandName:
145
+ pendingAgentCommand ||
146
+ getCommandBasename(runweaveCommand) ||
147
+ getCommandBasename(paneCommand),
148
+ panelId: panelId.trim() || null,
149
+ resolved: true,
150
+ reason: null,
151
+ attempts,
152
+ };
153
+ }
154
+
155
+ function normalizeSummaryText(value) {
156
+ if (typeof value !== "string") {
157
+ return null;
158
+ }
159
+ const trimmed = value.trim();
160
+ if (!trimmed) {
161
+ return null;
162
+ }
163
+ return trimmed.length > 8000
164
+ ? `${trimmed.slice(0, 8000)}\n...[truncated]`
165
+ : trimmed;
166
+ }
167
+
168
+ function extractCompletionSummary(payload) {
169
+ const directKeys = [
170
+ "last_assistant_message",
171
+ "lastAssistantMessage",
172
+ "last_agent_message",
173
+ "assistant_message",
174
+ "assistantMessage",
175
+ ];
176
+ for (const key of directKeys) {
177
+ const normalized = normalizeSummaryText(payload?.[key]);
178
+ if (normalized) {
179
+ return normalized;
180
+ }
181
+ }
182
+ const fromTranscript = readTranscriptReply(payload);
183
+ if (fromTranscript) return fromTranscript;
184
+ for (const key of [
185
+ "summary",
186
+ "message",
187
+ "last_message",
188
+ "lastMessage",
189
+ "response",
190
+ "output",
191
+ "text",
192
+ "content",
193
+ "body",
194
+ ]) {
195
+ const normalized = normalizeSummaryText(payload?.[key]);
196
+ if (normalized) return normalized;
197
+ }
198
+ return null;
199
+ }
200
+
201
+ function readTranscriptReply(payload) {
202
+ if (Array.isArray(payload?.transcript))
203
+ return lastAssistantReply(payload.transcript);
204
+ const sessionId = readThreadId(payload);
205
+ const candidates = [payload?.transcript_path];
206
+ if (sessionId && /^[A-Za-z0-9_-]+$/.test(sessionId)) {
207
+ candidates.push(
208
+ path.join(
209
+ os.homedir(),
210
+ "Library/Caches/coco/sessions",
211
+ sessionId,
212
+ "events.jsonl",
213
+ ),
214
+ );
215
+ }
216
+ for (const candidate of candidates) {
217
+ if (typeof candidate !== "string" || !candidate) continue;
218
+ let descriptor;
219
+ try {
220
+ descriptor = fs.openSync(candidate, "r");
221
+ const stat = fs.fstatSync(descriptor);
222
+ if (!stat.isFile()) continue;
223
+ // Bound hook work even for very long conversations and tool output.
224
+ const start = Math.max(0, stat.size - 1024 * 1024);
225
+ const buffer = Buffer.alloc(stat.size - start);
226
+ const bytes = fs.readSync(descriptor, buffer, 0, buffer.length, start);
227
+ const tail = buffer.subarray(0, bytes).toString("utf8");
228
+ const lines = (start ? tail.slice(tail.indexOf("\n") + 1) : tail).split(
229
+ /\r?\n/,
230
+ );
231
+ const records = lines.flatMap((line) => {
232
+ try {
233
+ return [JSON.parse(line)];
234
+ } catch {
235
+ return [];
236
+ }
237
+ });
238
+ return lastAssistantReply(records);
239
+ } catch {
240
+ // A missing transcript must not prevent completion reporting.
241
+ } finally {
242
+ if (descriptor !== undefined) fs.closeSync(descriptor);
243
+ }
244
+ }
245
+ return null;
246
+ }
247
+
248
+ function lastAssistantReply(records) {
249
+ for (let index = records.length - 1; index >= 0; index -= 1) {
250
+ const record = records[index];
251
+ if (record?.type === "event_msg") {
252
+ if (record.payload?.type === "task_complete") {
253
+ const completed = normalizeSummaryText(
254
+ record.payload.last_agent_message,
255
+ );
256
+ if (completed) return completed;
257
+ }
258
+ if (record.payload?.type === "task_started") return null;
259
+ }
260
+ const item =
261
+ record?.type === "response_item"
262
+ ? record.payload
263
+ : (record?.message?.message ??
264
+ (typeof record?.message === "object" ? record.message : record));
265
+ const role = item?.role ?? item?.type;
266
+ if (role === "user") return null;
267
+ if (role !== "assistant" && role !== "agent") continue;
268
+ if (item.phase && item.phase !== "final_answer") continue;
269
+ const content = Array.isArray(item.content)
270
+ ? item.content
271
+ .filter((part) => part.type === "text" || part.type === "output_text")
272
+ .map((part) => part.text ?? "")
273
+ .join("\n")
274
+ : (item.content ?? item.text ?? item.message);
275
+ const normalized = normalizeSummaryText(content);
276
+ if (normalized) return normalized;
277
+ }
278
+ return null;
279
+ }
280
+
281
+ function extractUserPrompt(payload) {
282
+ for (const key of [
283
+ "prompt",
284
+ "query",
285
+ "user_prompt",
286
+ "userPrompt",
287
+ "message",
288
+ ]) {
289
+ const normalized = normalizeSummaryText(payload?.[key]);
290
+ if (normalized) return normalized.slice(0, 8000);
291
+ }
292
+ return null;
293
+ }
294
+
295
+ function extractToolHook(payload) {
296
+ const toolUseId =
297
+ payload?.tool_use_id ?? payload?.toolUseId ?? payload?.tool_call_id;
298
+ const toolName = payload?.tool_name ?? payload?.toolName ?? payload?.name;
299
+ const toolResult = payload?.tool_response ?? payload?.tool_result ?? payload?.output;
300
+ // Read provider metadata only. Text output (including JSON-looking text) is
301
+ // untrusted tool content and cannot establish execution success or failure.
302
+ const exitCode = payload?.exit_code ?? toolResult?.exit_code;
303
+ const isError = payload?.is_error ?? toolResult?.is_error;
304
+ const toolExecution = {
305
+ ...(Number.isSafeInteger(exitCode) ? { exitCode } : {}),
306
+ ...(typeof isError === "boolean" ? { isError } : {}),
307
+ };
308
+ return {
309
+ toolUseId:
310
+ typeof toolUseId === "string" && toolUseId.trim()
311
+ ? toolUseId.trim()
312
+ : null,
313
+ toolName:
314
+ typeof toolName === "string" && toolName.trim() ? toolName.trim() : null,
315
+ toolInput: payload?.tool_input ?? payload?.input,
316
+ toolResult,
317
+ ...(Object.keys(toolExecution).length ? { toolExecution } : {}),
318
+ };
319
+ }
320
+
321
+ function parseArgs(argv) {
322
+ const args = { source: "unknown", reason: "hook_stop", commandName: null };
323
+ for (let index = 0; index < argv.length; index += 1) {
324
+ if (argv[index] === "--source" && argv[index + 1]) {
325
+ args.source = argv[index + 1];
326
+ index += 1;
327
+ } else if (argv[index] === "--reason" && argv[index + 1]) {
328
+ args.reason = argv[index + 1];
329
+ index += 1;
330
+ } else if (argv[index] === "--command-name" && argv[index + 1]) {
331
+ args.commandName = argv[index + 1];
332
+ index += 1;
333
+ }
334
+ }
335
+ return args;
336
+ }
337
+
338
+ function parsePayload(raw) {
339
+ if (!raw.trim()) {
340
+ return {};
341
+ }
342
+
343
+ try {
344
+ const parsed = JSON.parse(raw);
345
+ return parsed && typeof parsed === "object" ? parsed : {};
346
+ } catch {
347
+ return {};
348
+ }
349
+ }
350
+
351
+ function readHookEvent(payload) {
352
+ return (
353
+ payload.hook_event_name ??
354
+ payload.hookEventName ??
355
+ payload.eventName ??
356
+ payload.event ??
357
+ "Unknown"
358
+ );
359
+ }
360
+
361
+ function readNotificationType(payload) {
362
+ const raw = payload.notification_type ?? payload.notificationType;
363
+ return typeof raw === "string" && raw.trim()
364
+ ? raw.trim().toLowerCase()
365
+ : null;
366
+ }
367
+
368
+ function isFeishuAttentionHook(payload, source) {
369
+ const event = normalizeEventName(readHookEvent(payload));
370
+ return (event === "notification" && ["permission_prompt", "idle_prompt"].includes(readNotificationType(payload))) ||
371
+ (toAgentHookStateEvent(event) === "ToolRequested" &&
372
+ ["request_user_input", "functions.request_user_input", "AskUserQuestion"].includes(extractToolHook(payload).toolName)) ||
373
+ (source === "pi" && payload.pi?.event === "ui_prompt_start");
374
+ }
375
+
376
+ function readThreadId(payload) {
377
+ const raw =
378
+ payload.threadId ??
379
+ payload.thread_id ??
380
+ payload.sessionId ??
381
+ payload.session_id;
382
+ return typeof raw === "string" && raw.trim() ? raw.trim() : null;
383
+ }
384
+
385
+ function normalizeEventName(raw) {
386
+ return String(raw || "Unknown")
387
+ .trim()
388
+ .toLowerCase()
389
+ .replace(/[-\s]+/g, "_");
390
+ }
391
+
392
+ function normalizeSource(raw) {
393
+ const source = String(raw || "unknown")
394
+ .trim()
395
+ .toLowerCase();
396
+ if (
397
+ source === "claude" ||
398
+ source === "codex" ||
399
+ source === "trae" ||
400
+ source === "traecli" ||
401
+ source === "pi" || source === "traex"
402
+ ) {
403
+ return source;
404
+ }
405
+ return "unknown";
406
+ }
407
+
408
+ function normalizeReason(raw) {
409
+ const reason = String(raw || "hook_stop")
410
+ .trim()
411
+ .toLowerCase();
412
+ return COMPLETION_REASONS.has(reason) ? reason : "hook_stop";
413
+ }
414
+
415
+ function deriveCompletionEndpoint(endpoint) {
416
+ if (!endpoint) {
417
+ return undefined;
418
+ }
419
+ return endpoint.replace(
420
+ /\/internal\/terminal\/agent-hook\/?$/,
421
+ "/internal/terminal-completion",
422
+ );
423
+ }
424
+
425
+ function deriveAgentHookEndpoint(endpoint) {
426
+ if (!endpoint) {
427
+ return undefined;
428
+ }
429
+ return endpoint.replace(
430
+ /\/internal\/terminal-completion\/?$/,
431
+ "/internal/terminal/agent-hook",
432
+ );
433
+ }
434
+
435
+ function toAgentHookStateEvent(normalizedEvent) {
436
+ if (normalizedEvent === "agentmetadata") return "AgentMetadata";
437
+ if (
438
+ normalizedEvent === "sessionstart" ||
439
+ normalizedEvent === "session_start"
440
+ ) {
441
+ return "SessionStart";
442
+ }
443
+ if (
444
+ normalizedEvent === "userpromptsubmit" ||
445
+ normalizedEvent === "user_prompt_submit"
446
+ ) {
447
+ return "UserPromptSubmit";
448
+ }
449
+ if (STOP_EVENTS.has(normalizedEvent)) {
450
+ return "Stop";
451
+ }
452
+ if (normalizedEvent === "pretooluse" || normalizedEvent === "pre_tool_use") {
453
+ return "ToolRequested";
454
+ }
455
+ if (
456
+ normalizedEvent === "posttooluse" ||
457
+ normalizedEvent === "post_tool_use"
458
+ ) {
459
+ return "ToolCompleted";
460
+ }
461
+ return null;
462
+ }
463
+
464
+ function buildCompletionHookBody({
465
+ terminalSessionId,
466
+ payload,
467
+ source,
468
+ completionReason,
469
+ rawEvent,
470
+ commandName,
471
+ }) {
472
+ return {
473
+ terminalSessionId,
474
+ source,
475
+ ...(payload.feishuNotificationOnly ? { feishuNotificationOnly: true } : {}),
476
+ ...(source === "pi" && payload.pi ? { pi: payload.pi } : {}),
477
+ completionReason,
478
+ commandName: commandName || null,
479
+ rawHookEvent: String(rawEvent || "Stop"),
480
+ hookEvent: String(rawEvent || "Stop"),
481
+ summary: extractCompletionSummary(payload),
482
+ threadId: readThreadId(payload),
483
+ operationId: process.env.RUNWEAVE_TERMINAL_AGENT_OPERATION_ID || null,
484
+ panelId: process.env.RUNWEAVE_TERMINAL_PANEL_ID || null,
485
+ tmuxPaneId: process.env.TMUX_PANE || null,
486
+ cwd:
487
+ typeof payload.cwd === "string" && payload.cwd.trim()
488
+ ? payload.cwd
489
+ : process.env.PWD || null,
490
+ };
491
+ }
492
+
493
+ function buildAppServerBaseEvent({
494
+ kind,
495
+ payload,
496
+ rawEvent,
497
+ normalizedEvent,
498
+ stateHookEvent,
499
+ source,
500
+ terminalSessionId,
501
+ threadId,
502
+ commandName,
503
+ dedupePrefix,
504
+ }) {
505
+ const terminalPanelId = process.env.RUNWEAVE_TERMINAL_PANEL_ID || null;
506
+ const tmuxPaneId = process.env.TMUX_PANE || null;
507
+ return {
508
+ kind,
509
+ source: {
510
+ app: "hook",
511
+ instanceId: `${source}:${terminalSessionId}`,
512
+ pid: process.pid,
513
+ },
514
+ scope: {
515
+ projectId: process.env.RUNWEAVE_PROJECT_ID || null,
516
+ terminalSessionId,
517
+ terminalPanelId,
518
+ terminalTmuxPaneId: tmuxPaneId,
519
+ cwd:
520
+ typeof payload.cwd === "string" && payload.cwd.trim()
521
+ ? payload.cwd
522
+ : process.env.PWD || null,
523
+ },
524
+ dedupeKey: payload.pi ? `${dedupePrefix}:pi:${payload.pi.instanceId}:${payload.pi.sequence}` : `${dedupePrefix}:${source}:${terminalSessionId}:${String(
525
+ rawEvent || "Unknown",
526
+ )}:${threadId || "no-thread"}:${Date.now()}`,
527
+ correlationId: threadId,
528
+ payload: {
529
+ source,
530
+ ...(source === "pi" && payload.pi ? { pi: payload.pi } : {}),
531
+ threadId,
532
+ rawHookEvent: String(rawEvent || "Unknown"),
533
+ normalizedEvent,
534
+ stateHookEvent,
535
+ activityEventId: payload.runweaveHookEventId,
536
+ ...(stateHookEvent === "UserPromptSubmit" ? { query: extractUserPrompt(payload) } : {}),
537
+ panelId: terminalPanelId,
538
+ tmuxPaneId,
539
+ commandName: commandName || null,
540
+ operationId: process.env.RUNWEAVE_TERMINAL_AGENT_OPERATION_ID || null,
541
+ },
542
+ };
543
+ }
544
+
545
+ module.exports = {
546
+ isNestedCodexProcess,
547
+ isFeishuAttentionHook,
548
+ STOP_EVENTS,
549
+ buildAppServerBaseEvent,
550
+ buildCompletionHookBody,
551
+ deriveAgentHookEndpoint,
552
+ deriveCompletionEndpoint,
553
+ extractCompletionSummary,
554
+ extractToolHook,
555
+ extractUserPrompt,
556
+ normalizeEventName,
557
+ normalizeReason,
558
+ normalizeSource,
559
+ parseTmuxSocketPath,
560
+ parseArgs,
561
+ parsePayload,
562
+ readHookEvent,
563
+ readNotificationType,
564
+ readTmuxPaneContext,
565
+ readThreadId,
566
+ toAgentHookStateEvent,
567
+ };
568
+
569
+ // The standalone Feishu script uses the same extractor as the completion hook.
570
+ if (require.main === module) {
571
+ try {
572
+ process.stdout.write(
573
+ extractCompletionSummary(JSON.parse(fs.readFileSync(0, "utf8"))) ?? "",
574
+ );
575
+ } catch {
576
+ process.exitCode = 0;
577
+ }
578
+ }