@runweave/server-linux-x64 0.1.7 → 0.1.9

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 (352) hide show
  1. package/manifest.json +1487 -156
  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 +3 -3
  6. package/payload/app-server/index.cjs +1 -1
  7. package/payload/backend/build-info.json +4 -4
  8. package/payload/backend/index.cjs +2416 -1684
  9. package/payload/backend/ios-simulators/pool.py +3 -3
  10. package/payload/backend/scheduled-tasks-sqlite-worker.cjs +224 -171
  11. package/payload/frontend/dist/assets/{_baseUniq-i1Ki3twP.js → _baseUniq-qHFga5V8.js} +1 -1
  12. package/payload/frontend/dist/assets/{access-DK9V0f3W.js → access-DgHvmn15.js} +1 -1
  13. package/payload/frontend/dist/assets/{advanced-B13lWv1d.js → advanced-C1Fh14vw.js} +1 -1
  14. package/payload/frontend/dist/assets/{appearance-DumRYmkD.js → appearance-Bs7cSXqO.js} +1 -1
  15. package/payload/frontend/dist/assets/{arc-HKn3_xyV.js → arc-E3iYHQG_.js} +1 -1
  16. package/payload/frontend/dist/assets/{architectureDiagram-Q4EWVU46-C09x7b94.js → architectureDiagram-Q4EWVU46-DgpYpTb9.js} +1 -1
  17. package/payload/frontend/dist/assets/{blockDiagram-DXYQGD6D-CFLFTR6d.js → blockDiagram-DXYQGD6D-CfFOEKZ7.js} +1 -1
  18. package/payload/frontend/dist/assets/{c4Diagram-AHTNJAMY-8P8Q-xqC.js → c4Diagram-AHTNJAMY-BxlHBUj3.js} +1 -1
  19. package/payload/frontend/dist/assets/channel-amxyNKnk.js +1 -0
  20. package/payload/frontend/dist/assets/{chunk-4BX2VUAB-B1KEkTal.js → chunk-4BX2VUAB-xWocgDo8.js} +1 -1
  21. package/payload/frontend/dist/assets/{chunk-4TB4RGXK-Bu_Z47kJ.js → chunk-4TB4RGXK-Bl1cNICf.js} +1 -1
  22. package/payload/frontend/dist/assets/{chunk-55IACEB6-xzHVCHyi.js → chunk-55IACEB6-DVtE836u.js} +1 -1
  23. package/payload/frontend/dist/assets/{chunk-EDXVE4YY-h3HAW06h.js → chunk-EDXVE4YY-Dbd3tDCr.js} +1 -1
  24. package/payload/frontend/dist/assets/{chunk-FMBD7UC4-CQ4faPSh.js → chunk-FMBD7UC4-MPJaTsyN.js} +1 -1
  25. package/payload/frontend/dist/assets/{chunk-OYMX7WX6-CubmLoGT.js → chunk-OYMX7WX6-D3LuudlW.js} +1 -1
  26. package/payload/frontend/dist/assets/{chunk-QZHKN3VN-xk0zKNja.js → chunk-QZHKN3VN-Dn1aF6iQ.js} +1 -1
  27. package/payload/frontend/dist/assets/{chunk-YZCP3GAM-CHpTv8sd.js → chunk-YZCP3GAM-jZYbHnCw.js} +1 -1
  28. package/payload/frontend/dist/assets/classDiagram-6PBFFD2Q-B8cTijjT.js +1 -0
  29. package/payload/frontend/dist/assets/classDiagram-v2-HSJHXN6E-B8cTijjT.js +1 -0
  30. package/payload/frontend/dist/assets/clone-xzI2eGRI.js +1 -0
  31. package/payload/frontend/dist/assets/connection-V2iI-6rM.js +12 -0
  32. package/payload/frontend/dist/assets/{connections-A7InZw2T.js → connections-G_Q7342g.js} +1 -1
  33. package/payload/frontend/dist/assets/{cose-bilkent-S5V4N54A-CQn27vi_.js → cose-bilkent-S5V4N54A-75FLD3RS.js} +1 -1
  34. package/payload/frontend/dist/assets/{dagre-KV5264BT-CClOwB9v.js → dagre-KV5264BT-DEm-DpJL.js} +1 -1
  35. package/payload/frontend/dist/assets/{desktop-BgryfXXM.js → desktop-g5JC-CQd.js} +1 -1
  36. package/payload/frontend/dist/assets/{diagram-5BDNPKRD-DcUJOAmV.js → diagram-5BDNPKRD-BV6P2UTy.js} +1 -1
  37. package/payload/frontend/dist/assets/{diagram-G4DWMVQ6-DdabmTwk.js → diagram-G4DWMVQ6-DuCK-MM2.js} +1 -1
  38. package/payload/frontend/dist/assets/{diagram-MMDJMWI5-DmcxjBIk.js → diagram-MMDJMWI5-D5_GlPgO.js} +1 -1
  39. package/payload/frontend/dist/assets/{diagram-TYMM5635-BUSpXaiN.js → diagram-TYMM5635-QRbOYR1P.js} +1 -1
  40. package/payload/frontend/dist/assets/{erDiagram-SMLLAGMA-vkAXcv5_.js → erDiagram-SMLLAGMA-DefCheAw.js} +1 -1
  41. package/payload/frontend/dist/assets/{flowDiagram-DWJPFMVM-BHDU7BUJ.js → flowDiagram-DWJPFMVM-DVzyWIso.js} +1 -1
  42. package/payload/frontend/dist/assets/{ganttDiagram-T4ZO3ILL-C3lAG7_6.js → ganttDiagram-T4ZO3ILL-BJaClUEF.js} +1 -1
  43. package/payload/frontend/dist/assets/{gitGraphDiagram-UUTBAWPF-DHLyYJf7.js → gitGraphDiagram-UUTBAWPF-BLfbApNz.js} +1 -1
  44. package/payload/frontend/dist/assets/{graph-Bp5bIzXM.js → graph-C-YqFh68.js} +1 -1
  45. package/payload/frontend/dist/assets/{image-DkcKNLTV.js → image-CZo_2Awc.js} +1 -1
  46. package/payload/frontend/dist/assets/{index-BUS7FSlk.js → index-6q2aeqkt.js} +95 -105
  47. package/payload/frontend/dist/assets/{infoDiagram-42DDH7IO-CVp9zvmA.js → infoDiagram-42DDH7IO-BakVOutT.js} +1 -1
  48. package/payload/frontend/dist/assets/{ishikawaDiagram-UXIWVN3A-D07QPX3O.js → ishikawaDiagram-UXIWVN3A-D_1Oa5Dc.js} +1 -1
  49. package/payload/frontend/dist/assets/{journeyDiagram-VCZTEJTY-D-iZPDHM.js → journeyDiagram-VCZTEJTY-Y8TVFv6B.js} +1 -1
  50. package/payload/frontend/dist/assets/{kanban-definition-6JOO6SKY-BR4eWb08.js → kanban-definition-6JOO6SKY-DxeNhTIB.js} +1 -1
  51. package/payload/frontend/dist/assets/{layout-Cyv0DyJm.js → layout-5cMeOTAp.js} +1 -1
  52. package/payload/frontend/dist/assets/{linear-D5M7Pvj1.js → linear-Bnc3ev5g.js} +1 -1
  53. package/payload/frontend/dist/assets/main-3TPtEl66.js +706 -0
  54. package/payload/frontend/dist/assets/main-D4_uoZQa.css +33 -0
  55. package/payload/frontend/dist/assets/{min-BFlloFGg.js → min-BRXKkrS8.js} +1 -1
  56. package/payload/frontend/dist/assets/{mindmap-definition-QFDTVHPH-AKUF178o.js → mindmap-definition-QFDTVHPH-RYZO_BEr.js} +1 -1
  57. package/payload/frontend/dist/assets/{monitoring-B2okceCB.js → monitoring-Fv7kZ4s6.js} +1 -1
  58. package/payload/frontend/dist/assets/{notifications-0lql4_qJ.js → notifications-BzrYqyMH.js} +1 -1
  59. package/payload/frontend/dist/assets/{pieDiagram-DEJITSTG-CRiHmwn7.js → pieDiagram-DEJITSTG-Bzw0dhjz.js} +1 -1
  60. package/payload/frontend/dist/assets/{quadrantDiagram-34T5L4WZ-CzXrq7IJ.js → quadrantDiagram-34T5L4WZ-CQJY_msa.js} +1 -1
  61. package/payload/frontend/dist/assets/{record-content-DTCQKbEj.js → record-content-B7-6olQt.js} +1 -1
  62. package/payload/frontend/dist/assets/{requirementDiagram-MS252O5E-Bbn5ulLV.js → requirementDiagram-MS252O5E-DuP8hAV8.js} +1 -1
  63. package/payload/frontend/dist/assets/{sankeyDiagram-XADWPNL6-D9ZZ46pQ.js → sankeyDiagram-XADWPNL6-D-fQnCZZ.js} +1 -1
  64. package/payload/frontend/dist/assets/{sequenceDiagram-FGHM5R23-DxOP2gDa.js → sequenceDiagram-FGHM5R23-DaZNEccV.js} +1 -1
  65. package/payload/frontend/dist/assets/{stateDiagram-FHFEXIEX-NF_Qq5Cq.js → stateDiagram-FHFEXIEX-CkOLt5R1.js} +1 -1
  66. package/payload/frontend/dist/assets/stateDiagram-v2-QKLJ7IA2-atg1K4nB.js +1 -0
  67. package/payload/frontend/dist/assets/{status-2U71YpVe.js → status-CIIPajZp.js} +1 -1
  68. package/payload/frontend/dist/assets/suiji-C453W-Sg.js +1 -0
  69. package/payload/frontend/dist/assets/{svg-DpI3GSCw.js → svg-BUqAWGtg.js} +1 -1
  70. package/payload/frontend/dist/assets/{tabs-CYKuiiHg.js → tabs-Cwlp1Meu.js} +1 -1
  71. package/payload/frontend/dist/assets/{timeline-definition-GMOUNBTQ-ChEZSNF_.js → timeline-definition-GMOUNBTQ-BOKDMwHS.js} +1 -1
  72. package/payload/frontend/dist/assets/{vennDiagram-DHZGUBPP-Ch26SNbB.js → vennDiagram-DHZGUBPP-fSZjDS41.js} +1 -1
  73. package/payload/frontend/dist/assets/{wardley-RL74JXVD-D0ap5vv0.js → wardley-RL74JXVD-D1KIsvoD.js} +1 -1
  74. package/payload/frontend/dist/assets/{wardleyDiagram-NUSXRM2D-btdjsmHO.js → wardleyDiagram-NUSXRM2D-FMe67dwE.js} +1 -1
  75. package/payload/frontend/dist/assets/{xychartDiagram-5P7HB3ND-CklPtFGT.js → xychartDiagram-5P7HB3ND-B9AM9_9w.js} +1 -1
  76. package/payload/frontend/dist/build-info.json +4 -4
  77. package/payload/frontend/dist/companion.html +1 -1
  78. package/payload/frontend/dist/index.html +3 -3
  79. package/payload/packages/agent-bridge/src/install-pi.mjs +81 -0
  80. package/payload/plugins/pi/dist/SKILL.md +22 -0
  81. package/payload/plugins/pi/dist/bridge/app-server-client.cjs +82 -0
  82. package/payload/plugins/pi/dist/bridge/feishu_stop_notify.sh +169 -0
  83. package/payload/plugins/pi/dist/bridge/runweave-hook-bridge.cjs +583 -0
  84. package/payload/plugins/pi/dist/bridge/runweave-hook-completion.cjs +42 -0
  85. package/payload/plugins/pi/dist/bridge/runweave-hook-payload.cjs +578 -0
  86. package/payload/plugins/pi/dist/bridge/runweave-task-supervision.cjs +167 -0
  87. package/payload/plugins/pi/dist/runweave.js +316 -0
  88. package/payload/plugins/toolkit/.codex-plugin/plugin.json +31 -0
  89. package/payload/plugins/toolkit/README.md +185 -0
  90. package/payload/plugins/toolkit/hooks/AGENTS.md +6 -0
  91. package/payload/plugins/toolkit/hooks/app-server-client.cjs +82 -0
  92. package/payload/plugins/toolkit/hooks/feishu_stop_notify.sh +169 -0
  93. package/payload/plugins/toolkit/hooks/runweave-hook-bridge.cjs +583 -0
  94. package/payload/plugins/toolkit/hooks/runweave-hook-completion.cjs +42 -0
  95. package/payload/plugins/toolkit/hooks/runweave-hook-dispatch.cjs +123 -0
  96. package/payload/plugins/toolkit/hooks/runweave-hook-payload.cjs +578 -0
  97. package/payload/plugins/toolkit/hooks/runweave-task-supervision.cjs +167 -0
  98. package/payload/plugins/toolkit/hooks.json +108 -0
  99. package/payload/plugins/toolkit/skills/acceptance/SKILL.md +70 -0
  100. package/payload/plugins/toolkit/skills/acceptance/agents/openai.yaml +4 -0
  101. package/payload/plugins/toolkit/skills/acceptance/references/capture.md +38 -0
  102. package/payload/plugins/toolkit/skills/acceptance/references/delivery.md +54 -0
  103. package/payload/plugins/toolkit/skills/acceptance/references/gallery-contract.md +84 -0
  104. package/payload/plugins/toolkit/skills/acceptance/references/gallery-copy.md +34 -0
  105. package/payload/plugins/toolkit/skills/acceptance/references/video.md +52 -0
  106. package/payload/plugins/toolkit/skills/acceptance/scripts/capture.py +137 -0
  107. package/payload/plugins/toolkit/skills/acceptance/scripts/common.py +63 -0
  108. package/payload/plugins/toolkit/skills/acceptance/scripts/gallery.py +353 -0
  109. package/payload/plugins/toolkit/skills/acceptance/scripts/preview.py +109 -0
  110. package/payload/plugins/toolkit/skills/acceptance/scripts/video.py +283 -0
  111. package/payload/plugins/toolkit/skills/acceptance/templates/reader.css +576 -0
  112. package/payload/plugins/toolkit/skills/acceptance/templates/reader.html +63 -0
  113. package/payload/plugins/toolkit/skills/acceptance/templates/reader.js +326 -0
  114. package/payload/plugins/toolkit/skills/acceptance/templates/viewer.css +55 -0
  115. package/payload/plugins/toolkit/skills/acceptance-gallery/SKILL.md +8 -0
  116. package/payload/plugins/toolkit/skills/acceptance-gallery/agents/openai.yaml +6 -0
  117. package/payload/plugins/toolkit/skills/acceptance-gallery/references/capture-and-copy.md +3 -0
  118. package/payload/plugins/toolkit/skills/acceptance-gallery/references/content-contract.md +3 -0
  119. package/payload/plugins/toolkit/skills/acceptance-gallery/scripts/gallery.py +9 -0
  120. package/payload/plugins/toolkit/skills/acceptance-video/SKILL.md +8 -0
  121. package/payload/plugins/toolkit/skills/acceptance-video/agents/openai.yaml +6 -0
  122. package/payload/plugins/toolkit/skills/acceptance-video/references/input-and-capture.md +3 -0
  123. package/payload/plugins/toolkit/skills/acceptance-video/references/mobile-review.md +3 -0
  124. package/payload/plugins/toolkit/skills/acceptance-video/scripts/capture.py +9 -0
  125. package/payload/plugins/toolkit/skills/acceptance-video/scripts/video.py +9 -0
  126. package/payload/plugins/toolkit/skills/agent-device/SKILL.md +86 -0
  127. package/payload/plugins/toolkit/skills/agent-device/agents/openai.yaml +4 -0
  128. package/payload/plugins/toolkit/skills/agent-device/references/ios-setup.md +36 -0
  129. package/payload/plugins/toolkit/skills/agent-device/scripts/device.py +398 -0
  130. package/payload/plugins/toolkit/skills/agent-device/scripts/resources.py +248 -0
  131. package/payload/plugins/toolkit/skills/architecture-flow-prototyping/SKILL.md +128 -0
  132. package/payload/plugins/toolkit/skills/architecture-flow-prototyping/agents/openai.yaml +4 -0
  133. package/payload/plugins/toolkit/skills/architecture-flow-prototyping/references/architecture-flow-checklist.md +59 -0
  134. package/payload/plugins/toolkit/skills/architecture-flow-prototyping/references/architecture-flow-guide.md +135 -0
  135. package/payload/plugins/toolkit/skills/architecture-flow-prototyping/references/architecture-flow-handoff-template.md +57 -0
  136. package/payload/plugins/toolkit/skills/ask-first/SKILL.md +81 -0
  137. package/payload/plugins/toolkit/skills/brainstorming/SKILL.md +41 -0
  138. package/payload/plugins/toolkit/skills/browse-record/SKILL.md +35 -0
  139. package/payload/plugins/toolkit/skills/browse-record/references/app-usage.md +19 -0
  140. package/payload/plugins/toolkit/skills/browse-record/references/daily-reporting.md +115 -0
  141. package/payload/plugins/toolkit/skills/browse-record/references/zhihu.md +33 -0
  142. package/payload/plugins/toolkit/skills/browse-record/scripts/app_usage.py +110 -0
  143. package/payload/plugins/toolkit/skills/browse-record/scripts/browse_job.py +385 -0
  144. package/payload/plugins/toolkit/skills/browse-record/scripts/zhihu-read.js +126 -0
  145. package/payload/plugins/toolkit/skills/browse-record/scripts/zhihu_http.py +273 -0
  146. package/payload/plugins/toolkit/skills/clear-technical-explanations/LICENSE +21 -0
  147. package/payload/plugins/toolkit/skills/clear-technical-explanations/SKILL.md +103 -0
  148. package/payload/plugins/toolkit/skills/code-grounded-requirements/SKILL.md +54 -0
  149. package/payload/plugins/toolkit/skills/daily-doc-maintenance/SKILL.md +151 -0
  150. package/payload/plugins/toolkit/skills/daily-record/SKILL.md +63 -0
  151. package/payload/plugins/toolkit/skills/daily-record/agents/openai.yaml +4 -0
  152. package/payload/plugins/toolkit/skills/daily-record/references/browser-history.md +6 -0
  153. package/payload/plugins/toolkit/skills/daily-record/references/feishu.md +90 -0
  154. package/payload/plugins/toolkit/skills/daily-record/references/scheduled-reporting.md +144 -0
  155. package/payload/plugins/toolkit/skills/daily-record/references/scheduled-task.template.json +15 -0
  156. package/payload/plugins/toolkit/skills/daily-record/references/suiji-work-records.md +57 -0
  157. package/payload/plugins/toolkit/skills/daily-record/scripts/feishu.py +280 -0
  158. package/payload/plugins/toolkit/skills/daily-record/scripts/job.py +416 -0
  159. package/payload/plugins/toolkit/skills/daily-record/scripts/job_browser.py +77 -0
  160. package/payload/plugins/toolkit/skills/daily-record/scripts/job_facts.py +132 -0
  161. package/payload/plugins/toolkit/skills/daily-record/scripts/job_isolation.py +69 -0
  162. package/payload/plugins/toolkit/skills/daily-record/scripts/job_materials.py +154 -0
  163. package/payload/plugins/toolkit/skills/daily-record/scripts/job_screen.py +77 -0
  164. package/payload/plugins/toolkit/skills/daily-record/scripts/job_state.py +309 -0
  165. package/payload/plugins/toolkit/skills/daily-refactor/SKILL.md +101 -0
  166. package/payload/plugins/toolkit/skills/daily-refactor/scripts/compare-architecture-reports.mjs +168 -0
  167. package/payload/plugins/toolkit/skills/debugging-strategies/SKILL.md +38 -0
  168. package/payload/plugins/toolkit/skills/debugging-strategies/resources/implementation-playbook.md +520 -0
  169. package/payload/plugins/toolkit/skills/diagnostic-log-debugging/SKILL.md +79 -0
  170. package/payload/plugins/toolkit/skills/doc-coauthoring/SKILL.md +64 -0
  171. package/payload/plugins/toolkit/skills/eli5/LICENSE +21 -0
  172. package/payload/plugins/toolkit/skills/eli5/SKILL.md +18 -0
  173. package/payload/plugins/toolkit/skills/experience/SKILL.md +71 -0
  174. package/payload/plugins/toolkit/skills/experience/package.json +13 -0
  175. package/payload/plugins/toolkit/skills/git-advanced-workflows/SKILL.md +457 -0
  176. package/payload/plugins/toolkit/skills/github-pr/SKILL.md +109 -0
  177. package/payload/plugins/toolkit/skills/github-pr/scripts/github-access.mjs +292 -0
  178. package/payload/plugins/toolkit/skills/github-pr/scripts/preflight.mjs +191 -0
  179. package/payload/plugins/toolkit/skills/github-pr/scripts/source-worktree.mjs +354 -0
  180. package/payload/plugins/toolkit/skills/grill-with-docs/SKILL.md +66 -0
  181. package/payload/plugins/toolkit/skills/grill-with-docs/agents/openai.yaml +6 -0
  182. package/payload/plugins/toolkit/skills/grilling/SKILL.md +14 -0
  183. package/payload/plugins/toolkit/skills/handoff/SKILL.md +98 -0
  184. package/payload/plugins/toolkit/skills/karpathy-guidelines/SKILL.md +73 -0
  185. package/payload/plugins/toolkit/skills/playwright-cli/SKILL.md +562 -0
  186. package/payload/plugins/toolkit/skills/playwright-cli/references/element-attributes.md +23 -0
  187. package/payload/plugins/toolkit/skills/playwright-cli/references/playwright-tests.md +39 -0
  188. package/payload/plugins/toolkit/skills/playwright-cli/references/request-mocking.md +87 -0
  189. package/payload/plugins/toolkit/skills/playwright-cli/references/running-code.md +240 -0
  190. package/payload/plugins/toolkit/skills/playwright-cli/references/session-management.md +226 -0
  191. package/payload/plugins/toolkit/skills/playwright-cli/references/spec-driven-testing.md +312 -0
  192. package/payload/plugins/toolkit/skills/playwright-cli/references/storage-state.md +275 -0
  193. package/payload/plugins/toolkit/skills/playwright-cli/references/test-generation.md +138 -0
  194. package/payload/plugins/toolkit/skills/playwright-cli/references/tracing.md +142 -0
  195. package/payload/plugins/toolkit/skills/playwright-cli/references/video-recording.md +157 -0
  196. package/payload/plugins/toolkit/skills/playwright-cli/templates/standalone.config.json +7 -0
  197. package/payload/plugins/toolkit/skills/product-exploration/SKILL.md +64 -0
  198. package/payload/plugins/toolkit/skills/product-exploration/agents/openai.yaml +5 -0
  199. package/payload/plugins/toolkit/skills/prototype-first-development/SKILL.md +134 -0
  200. package/payload/plugins/toolkit/skills/prototype-first-development/references/html-prototype-template/README.md +88 -0
  201. package/payload/plugins/toolkit/skills/prototype-first-development/references/html-prototype-template/app.js +145 -0
  202. package/payload/plugins/toolkit/skills/prototype-first-development/references/html-prototype-template/index.html +229 -0
  203. package/payload/plugins/toolkit/skills/prototype-first-development/references/html-prototype-template/mock-state.json +60 -0
  204. package/payload/plugins/toolkit/skills/prototype-first-development/references/implementation-plan-handoff-template.md +61 -0
  205. package/payload/plugins/toolkit/skills/prototype-first-development/references/prototype-workflow-checklist.md +64 -0
  206. package/payload/plugins/toolkit/skills/publish-runweave-server/SKILL.md +64 -0
  207. package/payload/plugins/toolkit/skills/publish-runweave-server/agents/openai.yaml +4 -0
  208. package/payload/plugins/toolkit/skills/react-best-practices/AGENTS.md +3227 -0
  209. package/payload/plugins/toolkit/skills/react-best-practices/README.md +127 -0
  210. package/payload/plugins/toolkit/skills/react-best-practices/SKILL.md +143 -0
  211. package/payload/plugins/toolkit/skills/react-best-practices/metadata.json +15 -0
  212. package/payload/plugins/toolkit/skills/react-best-practices/rules/advanced/event-handler-refs.md +55 -0
  213. package/payload/plugins/toolkit/skills/react-best-practices/rules/advanced/init-once.md +42 -0
  214. package/payload/plugins/toolkit/skills/react-best-practices/rules/advanced/use-latest.md +39 -0
  215. package/payload/plugins/toolkit/skills/react-best-practices/rules/async/api-routes.md +38 -0
  216. package/payload/plugins/toolkit/skills/react-best-practices/rules/async/defer-await.md +80 -0
  217. package/payload/plugins/toolkit/skills/react-best-practices/rules/async/dependencies.md +52 -0
  218. package/payload/plugins/toolkit/skills/react-best-practices/rules/async/parallel.md +28 -0
  219. package/payload/plugins/toolkit/skills/react-best-practices/rules/async/suspense-boundaries.md +99 -0
  220. package/payload/plugins/toolkit/skills/react-best-practices/rules/bundle/barrel-imports.md +59 -0
  221. package/payload/plugins/toolkit/skills/react-best-practices/rules/bundle/conditional.md +37 -0
  222. package/payload/plugins/toolkit/skills/react-best-practices/rules/bundle/defer-third-party.md +49 -0
  223. package/payload/plugins/toolkit/skills/react-best-practices/rules/bundle/dynamic-imports.md +35 -0
  224. package/payload/plugins/toolkit/skills/react-best-practices/rules/bundle/preload.md +46 -0
  225. package/payload/plugins/toolkit/skills/react-best-practices/rules/client/event-listeners.md +78 -0
  226. package/payload/plugins/toolkit/skills/react-best-practices/rules/client/localstorage-schema.md +77 -0
  227. package/payload/plugins/toolkit/skills/react-best-practices/rules/client/passive-event-listeners.md +48 -0
  228. package/payload/plugins/toolkit/skills/react-best-practices/rules/client/swr-dedup.md +56 -0
  229. package/payload/plugins/toolkit/skills/react-best-practices/rules/js/batch-dom-css.md +110 -0
  230. package/payload/plugins/toolkit/skills/react-best-practices/rules/js/cache-function-results.md +80 -0
  231. package/payload/plugins/toolkit/skills/react-best-practices/rules/js/cache-property-access.md +28 -0
  232. package/payload/plugins/toolkit/skills/react-best-practices/rules/js/cache-storage.md +70 -0
  233. package/payload/plugins/toolkit/skills/react-best-practices/rules/js/combine-iterations.md +32 -0
  234. package/payload/plugins/toolkit/skills/react-best-practices/rules/js/early-exit.md +50 -0
  235. package/payload/plugins/toolkit/skills/react-best-practices/rules/js/flatmap-filter.md +55 -0
  236. package/payload/plugins/toolkit/skills/react-best-practices/rules/js/hoist-regexp.md +45 -0
  237. package/payload/plugins/toolkit/skills/react-best-practices/rules/js/index-maps.md +37 -0
  238. package/payload/plugins/toolkit/skills/react-best-practices/rules/js/length-check-first.md +50 -0
  239. package/payload/plugins/toolkit/skills/react-best-practices/rules/js/min-max-loop.md +82 -0
  240. package/payload/plugins/toolkit/skills/react-best-practices/rules/js/set-map-lookups.md +24 -0
  241. package/payload/plugins/toolkit/skills/react-best-practices/rules/js/tosorted-immutable.md +57 -0
  242. package/payload/plugins/toolkit/skills/react-best-practices/rules/meta/sections.md +46 -0
  243. package/payload/plugins/toolkit/skills/react-best-practices/rules/meta/template.md +28 -0
  244. package/payload/plugins/toolkit/skills/react-best-practices/rules/rendering/activity.md +26 -0
  245. package/payload/plugins/toolkit/skills/react-best-practices/rules/rendering/animate-svg-wrapper.md +38 -0
  246. package/payload/plugins/toolkit/skills/react-best-practices/rules/rendering/conditional-render.md +32 -0
  247. package/payload/plugins/toolkit/skills/react-best-practices/rules/rendering/content-visibility.md +38 -0
  248. package/payload/plugins/toolkit/skills/react-best-practices/rules/rendering/hoist-jsx.md +36 -0
  249. package/payload/plugins/toolkit/skills/react-best-practices/rules/rendering/hydration-no-flicker.md +72 -0
  250. package/payload/plugins/toolkit/skills/react-best-practices/rules/rendering/hydration-suppress-warning.md +26 -0
  251. package/payload/plugins/toolkit/skills/react-best-practices/rules/rendering/resource-hints.md +89 -0
  252. package/payload/plugins/toolkit/skills/react-best-practices/rules/rendering/script-defer-async.md +71 -0
  253. package/payload/plugins/toolkit/skills/react-best-practices/rules/rendering/svg-precision.md +28 -0
  254. package/payload/plugins/toolkit/skills/react-best-practices/rules/rendering/usetransition-loading.md +75 -0
  255. package/payload/plugins/toolkit/skills/react-best-practices/rules/rerender/defer-reads.md +39 -0
  256. package/payload/plugins/toolkit/skills/react-best-practices/rules/rerender/dependencies.md +45 -0
  257. package/payload/plugins/toolkit/skills/react-best-practices/rules/rerender/derived-state-no-effect.md +40 -0
  258. package/payload/plugins/toolkit/skills/react-best-practices/rules/rerender/derived-state.md +29 -0
  259. package/payload/plugins/toolkit/skills/react-best-practices/rules/rerender/functional-setstate.md +77 -0
  260. package/payload/plugins/toolkit/skills/react-best-practices/rules/rerender/lazy-state-init.md +58 -0
  261. package/payload/plugins/toolkit/skills/react-best-practices/rules/rerender/memo-with-default-value.md +36 -0
  262. package/payload/plugins/toolkit/skills/react-best-practices/rules/rerender/memo.md +44 -0
  263. package/payload/plugins/toolkit/skills/react-best-practices/rules/rerender/move-effect-to-event.md +45 -0
  264. package/payload/plugins/toolkit/skills/react-best-practices/rules/rerender/no-inline-components.md +83 -0
  265. package/payload/plugins/toolkit/skills/react-best-practices/rules/rerender/simple-expression-in-memo.md +35 -0
  266. package/payload/plugins/toolkit/skills/react-best-practices/rules/rerender/transitions.md +40 -0
  267. package/payload/plugins/toolkit/skills/react-best-practices/rules/rerender/use-ref-transient-values.md +73 -0
  268. package/payload/plugins/toolkit/skills/react-best-practices/rules/server/after-nonblocking.md +74 -0
  269. package/payload/plugins/toolkit/skills/react-best-practices/rules/server/auth-actions.md +96 -0
  270. package/payload/plugins/toolkit/skills/react-best-practices/rules/server/cache-lru.md +41 -0
  271. package/payload/plugins/toolkit/skills/react-best-practices/rules/server/cache-react.md +76 -0
  272. package/payload/plugins/toolkit/skills/react-best-practices/rules/server/dedup-props.md +65 -0
  273. package/payload/plugins/toolkit/skills/react-best-practices/rules/server/hoist-static-io.md +139 -0
  274. package/payload/plugins/toolkit/skills/react-best-practices/rules/server/parallel-fetching.md +83 -0
  275. package/payload/plugins/toolkit/skills/react-best-practices/rules/server/serialization.md +38 -0
  276. package/payload/plugins/toolkit/skills/recorded-browser-mcp-verification/SKILL.md +8 -0
  277. package/payload/plugins/toolkit/skills/recorded-browser-mcp-verification/agents/openai.yaml +6 -0
  278. package/payload/plugins/toolkit/skills/reproduce-before-fix/SKILL.md +93 -0
  279. package/payload/plugins/toolkit/skills/reproduce-before-fix/agents/openai.yaml +7 -0
  280. package/payload/plugins/toolkit/skills/review-only/SKILL.md +72 -0
  281. package/payload/plugins/toolkit/skills/review-with-runtime-evidence/SKILL.md +134 -0
  282. package/payload/plugins/toolkit/skills/review-with-runtime-evidence/agents/openai.yaml +7 -0
  283. package/payload/plugins/toolkit/skills/review-with-runtime-evidence/references/contracts.md +114 -0
  284. package/payload/plugins/toolkit/skills/review-with-runtime-evidence/scripts/classify-runtime-verdict.mjs +140 -0
  285. package/payload/plugins/toolkit/skills/review-with-runtime-evidence/scripts/run-static-review.mjs +389 -0
  286. package/payload/plugins/toolkit/skills/review-with-runtime-evidence/scripts/static-review-contract.mjs +243 -0
  287. package/payload/plugins/toolkit/skills/run-test-cases/SKILL.md +63 -0
  288. package/payload/plugins/toolkit/skills/runweave-change-validation/SKILL.md +196 -0
  289. package/payload/plugins/toolkit/skills/runweave-change-validation/agents/openai.yaml +7 -0
  290. package/payload/plugins/toolkit/skills/runweave-change-validation/scripts/assert-dev-session-status.mjs +181 -0
  291. package/payload/plugins/toolkit/skills/runweave-dev-session/SKILL.md +126 -0
  292. package/payload/plugins/toolkit/skills/runweave-dev-session/agents/openai.yaml +7 -0
  293. package/payload/plugins/toolkit/skills/runweave-management/SKILL.md +47 -0
  294. package/payload/plugins/toolkit/skills/scheduled-task/SKILL.md +35 -0
  295. package/payload/plugins/toolkit/skills/shadcn/SKILL.md +245 -0
  296. package/payload/plugins/toolkit/skills/shadcn/agents/openai.yml +5 -0
  297. package/payload/plugins/toolkit/skills/shadcn/assets/shadcn-small.png +0 -0
  298. package/payload/plugins/toolkit/skills/shadcn/assets/shadcn.png +0 -0
  299. package/payload/plugins/toolkit/skills/shadcn/cli.md +276 -0
  300. package/payload/plugins/toolkit/skills/shadcn/customization.md +209 -0
  301. package/payload/plugins/toolkit/skills/shadcn/evals/evals.json +47 -0
  302. package/payload/plugins/toolkit/skills/shadcn/mcp.md +94 -0
  303. package/payload/plugins/toolkit/skills/shadcn/rules/base-vs-radix.md +310 -0
  304. package/payload/plugins/toolkit/skills/shadcn/rules/composition.md +197 -0
  305. package/payload/plugins/toolkit/skills/shadcn/rules/forms.md +198 -0
  306. package/payload/plugins/toolkit/skills/shadcn/rules/icons.md +101 -0
  307. package/payload/plugins/toolkit/skills/shadcn/rules/styling.md +163 -0
  308. package/payload/plugins/toolkit/skills/suiji/SKILL.md +54 -0
  309. package/payload/plugins/toolkit/skills/suiji/references/api.md +72 -0
  310. package/payload/plugins/toolkit/skills/suiji/references/source-adapter.md +40 -0
  311. package/payload/plugins/toolkit/skills/suiji/references/work-records.md +36 -0
  312. package/payload/plugins/toolkit/skills/suiji/scripts/source_adapter.py +46 -0
  313. package/payload/plugins/toolkit/skills/suiji/scripts/suiji.py +358 -0
  314. package/payload/plugins/toolkit/skills/suiji/scripts/work_records.py +328 -0
  315. package/payload/plugins/toolkit/skills/suiji/scripts/work_reports.py +75 -0
  316. package/payload/plugins/toolkit/skills/sync-branch-hard-reset/SKILL.md +59 -0
  317. package/payload/plugins/toolkit/skills/update-runweave-backend/SKILL.md +90 -0
  318. package/payload/plugins/toolkit/skills/update-runweave-backend/agents/openai.yaml +4 -0
  319. package/payload/plugins/toolkit/skills/update-runweave-backend/references/npm-update.md +68 -0
  320. package/payload/plugins/toolkit/skills/update-runweave-backend/references/systemd.md +34 -0
  321. package/payload/plugins/toolkit/skills/update-runweave-desktop/SKILL.md +102 -0
  322. package/payload/plugins/toolkit/skills/update-runweave-ios/SKILL.md +16 -0
  323. package/payload/plugins/toolkit/skills/update-runweave-ios/references/ios-wireless-recovery.md +54 -0
  324. package/payload/plugins/toolkit/skills/using-rw/SKILL.md +265 -0
  325. package/payload/plugins/toolkit/skills/write-plan/SKILL.md +72 -0
  326. package/payload/plugins/toolkit/skills/write-test-cases/SKILL.md +100 -0
  327. package/payload/plugins/toolkit/skills/write-test-cases/assets/test-plan-template.yaml +15 -0
  328. package/payload/plugins/toolkit/skills/write-test-cases/references/coverage-checklist.md +75 -0
  329. package/payload/plugins/toolkit/skills/write-test-cases/references/design-techniques.md +91 -0
  330. package/payload/plugins/toolkit/skills/youtube-reading/SKILL.md +35 -0
  331. package/payload/plugins/toolkit/skills/youtube-reading/agents/openai.yaml +4 -0
  332. package/payload/plugins/toolkit/skills/youtube-reading/assets/runtime-lock.json +92 -0
  333. package/payload/plugins/toolkit/skills/youtube-reading/references/content-contract.md +52 -0
  334. package/payload/plugins/toolkit/skills/youtube-reading/references/setup.md +70 -0
  335. package/payload/plugins/toolkit/skills/youtube-reading/requirements.lock +9 -0
  336. package/payload/plugins/toolkit/skills/youtube-reading/scripts/artifacts.py +206 -0
  337. package/payload/plugins/toolkit/skills/youtube-reading/scripts/runtime.py +424 -0
  338. package/payload/plugins/toolkit/skills/youtube-reading/scripts/youtube_reading.py +314 -0
  339. package/payload/plugins/toolkit-release.json +1 -0
  340. package/payload/scripts/toolkit/codex-state.mjs +75 -0
  341. package/payload/scripts/toolkit/release.mjs +210 -0
  342. package/payload/scripts/toolkit/sync-runtime.mjs +108 -0
  343. package/payload/scripts/toolkit/sync.mjs +585 -0
  344. package/payload/frontend/dist/assets/channel-CuSisha8.js +0 -1
  345. package/payload/frontend/dist/assets/classDiagram-6PBFFD2Q-ClJkT7PY.js +0 -1
  346. package/payload/frontend/dist/assets/classDiagram-v2-HSJHXN6E-ClJkT7PY.js +0 -1
  347. package/payload/frontend/dist/assets/clone-CPcyXi9g.js +0 -1
  348. package/payload/frontend/dist/assets/connection-BhcgnOMb.js +0 -12
  349. package/payload/frontend/dist/assets/main-BDBhLSX2.js +0 -696
  350. package/payload/frontend/dist/assets/main-Cg6Oo1xK.css +0 -33
  351. package/payload/frontend/dist/assets/stateDiagram-v2-QKLJ7IA2-DhdOfEAv.js +0 -1
  352. package/payload/frontend/dist/assets/suiji-DXtfgwxj.js +0 -1
@@ -0,0 +1,583 @@
1
+ #!/usr/bin/env node
2
+ /* global __dirname, fetch, process, require, URL */
3
+ /* eslint-disable @typescript-eslint/no-require-imports */
4
+
5
+ const { spawn, spawnSync } = require("node:child_process");
6
+ const { setTimeout } = require("node:timers");
7
+ const fs = require("node:fs");
8
+ const path = require("node:path");
9
+ const crypto = require("node:crypto");
10
+ const { postCompletionHook } = require("./runweave-hook-completion.cjs");
11
+ const {
12
+ STOP_EVENTS,
13
+ isNestedCodexProcess,
14
+ isFeishuAttentionHook,
15
+ buildAppServerBaseEvent,
16
+ buildCompletionHookBody,
17
+ deriveAgentHookEndpoint,
18
+ deriveCompletionEndpoint,
19
+ extractCompletionSummary,
20
+ extractToolHook,
21
+ extractUserPrompt,
22
+ normalizeEventName,
23
+ normalizeReason,
24
+ normalizeSource,
25
+ parseTmuxSocketPath,
26
+ parseArgs,
27
+ parsePayload,
28
+ readHookEvent,
29
+ readNotificationType,
30
+ readTmuxPaneContext,
31
+ readThreadId,
32
+ toAgentHookStateEvent,
33
+ } = require("./runweave-hook-payload.cjs");
34
+ const {
35
+ discoverAppServer,
36
+ postAppServerEvent,
37
+ } = require("./app-server-client.cjs");
38
+
39
+ function redactEndpoint(endpoint) {
40
+ if (!endpoint) {
41
+ return undefined;
42
+ }
43
+ try {
44
+ const url = new URL(endpoint);
45
+ return `${url.origin}${url.pathname}`;
46
+ } catch {
47
+ return "[invalid endpoint]";
48
+ }
49
+ }
50
+
51
+ function appendDebugLog(message, details) {
52
+ const logPath = process.env.RUNWEAVE_HOOK_DEBUG_LOG;
53
+ if (!logPath) {
54
+ return;
55
+ }
56
+ try {
57
+ fs.mkdirSync(path.dirname(logPath), { recursive: true });
58
+ fs.appendFileSync(
59
+ logPath,
60
+ `${JSON.stringify({
61
+ at: new Date().toISOString(),
62
+ source: "hook-bridge",
63
+ message,
64
+ details,
65
+ })}\n`,
66
+ "utf8",
67
+ );
68
+ } catch {
69
+ // Ignore diagnostic logging failures.
70
+ }
71
+ }
72
+
73
+ function readTmuxSessionEnv() {
74
+ const sessionName = process.env.RUNWEAVE_TMUX_SESSION_NAME;
75
+ const socketPath = parseTmuxSocketPath(process.env.TMUX);
76
+ if (!sessionName || !socketPath) {
77
+ return { refreshed: false, reason: "missing_tmux_env" };
78
+ }
79
+
80
+ const result = spawnSync(
81
+ process.env.RUNWEAVE_RUNTIME_TMUX_BINARY || "tmux",
82
+ ["-S", socketPath, "show-environment", "-t", sessionName],
83
+ {
84
+ encoding: "utf8",
85
+ timeout: 2000,
86
+ maxBuffer: 256 * 1024,
87
+ },
88
+ );
89
+ if (result.error || result.status !== 0) {
90
+ return {
91
+ refreshed: false,
92
+ reason: "tmux_show_environment_failed",
93
+ error: result.error instanceof Error ? result.error.message : undefined,
94
+ status: result.status,
95
+ };
96
+ }
97
+
98
+ const env = {};
99
+ for (const line of String(result.stdout || "").split(/\r?\n/)) {
100
+ if (line.startsWith("-RUNWEAVE_")) {
101
+ delete process.env[line.slice(1)];
102
+ continue;
103
+ }
104
+ if (!line.startsWith("RUNWEAVE_")) {
105
+ continue;
106
+ }
107
+ const separatorIndex = line.indexOf("=");
108
+ if (separatorIndex <= 0) {
109
+ continue;
110
+ }
111
+ env[line.slice(0, separatorIndex)] = line.slice(separatorIndex + 1);
112
+ }
113
+
114
+ for (const [key, value] of Object.entries(env)) {
115
+ process.env[key] = value;
116
+ }
117
+
118
+ return {
119
+ refreshed: Object.keys(env).length > 0,
120
+ sessionName,
121
+ socketPath,
122
+ keys: Object.keys(env).sort(),
123
+ };
124
+ }
125
+
126
+ function notifyDesktop(source, options = {}) {
127
+ if (process.env.RUNWEAVE_HOOK_SUPPRESS_DESKTOP_NOTIFY === "1") {
128
+ return;
129
+ }
130
+ if (process.platform !== "darwin") {
131
+ return;
132
+ }
133
+ const labels = { claude: "Claude", codex: "Codex", trae: "Trae" };
134
+ const name = source === "pi" ? "Pi" : labels[source] || "AI";
135
+ const notificationType = options.notificationType || null;
136
+ // traex attention notifications ask the user to come back and choose/confirm,
137
+ // rather than reporting a finished turn, so use a matching title/body.
138
+ const title =
139
+ notificationType === "permission_prompt" ||
140
+ notificationType === "idle_prompt"
141
+ ? `${name} 需要你选择/确认`
142
+ : `${name} 完成了`;
143
+ const body =
144
+ notificationType === "permission_prompt" ||
145
+ notificationType === "idle_prompt"
146
+ ? "回到终端处理"
147
+ : "回来接管终端";
148
+ try {
149
+ spawn(
150
+ "/usr/bin/osascript",
151
+ ["-e", `display notification "${body}" with title "${title}"`],
152
+ { stdio: "ignore", detached: true },
153
+ ).unref();
154
+ spawn("/usr/bin/afplay", ["/System/Library/Sounds/Glass.aiff"], {
155
+ stdio: "ignore",
156
+ detached: true,
157
+ }).unref();
158
+ } catch {
159
+ // Ignore desktop notification failures.
160
+ }
161
+ }
162
+
163
+ function notifyFeishu(payload, source, terminalSessionId, terminalPanelId) {
164
+ if (process.env.RUNWEAVE_HOOK_SUPPRESS_FEISHU_NOTIFY === "1") return;
165
+ const script = path.join(__dirname, "feishu_stop_notify.sh");
166
+ try {
167
+ if (!fs.existsSync(script)) {
168
+ return;
169
+ }
170
+ const child = spawn(script, [], {
171
+ stdio: ["pipe", "ignore", "ignore"],
172
+ detached: true,
173
+ env: { ...process.env, RUNWEAVE_HOOK_NODE: process.execPath },
174
+ });
175
+ child.on("error", () => {});
176
+ child.stdin.end(
177
+ JSON.stringify({
178
+ ...payload,
179
+ last_assistant_message: extractCompletionSummary(payload),
180
+ source,
181
+ terminalSessionId,
182
+ terminalPanelId: terminalPanelId || undefined,
183
+ projectId: process.env.RUNWEAVE_PROJECT_ID || undefined,
184
+ }),
185
+ );
186
+ child.unref();
187
+ } catch {
188
+ // Ignore Feishu notification failures.
189
+ }
190
+ }
191
+
192
+ function readStdin() {
193
+ return new Promise((resolve) => {
194
+ let data = "";
195
+ process.stdin.setEncoding("utf8");
196
+ process.stdin.on("data", (chunk) => {
197
+ data += chunk;
198
+ });
199
+ process.stdin.on("end", () => {
200
+ resolve(data);
201
+ });
202
+ process.stdin.resume();
203
+ });
204
+ }
205
+
206
+ async function postAgentHook({
207
+ endpoint,
208
+ token,
209
+ terminalSessionId,
210
+ agent,
211
+ hookEvent,
212
+ threadId,
213
+ panelId,
214
+ tmuxPaneId,
215
+ commandName,
216
+ rawHookEvent,
217
+ sessionSource,
218
+ query,
219
+ assistantResponse,
220
+ toolHook,
221
+ activityEventId,
222
+ operationId,
223
+ pi,
224
+ }) {
225
+ let body = JSON.stringify({
226
+ activityEventId,
227
+ ...(pi ? { pi } : {}),
228
+ ...(operationId ? { operationId } : {}),
229
+ terminalSessionId,
230
+ projectId: process.env.RUNWEAVE_PROJECT_ID || undefined,
231
+ ...(threadId ? { threadId } : {}),
232
+ ...(panelId ? { panelId } : {}),
233
+ ...(tmuxPaneId ? { tmuxPaneId } : {}),
234
+ commandName: commandName || null,
235
+ rawHookEvent: String(rawHookEvent || hookEvent),
236
+ ...(sessionSource ? { sessionSource } : {}),
237
+ ...(query ? { query } : {}),
238
+ ...(assistantResponse ? { response: assistantResponse } : {}),
239
+ ...(toolHook?.toolUseId ? { toolUseId: toolHook.toolUseId } : {}),
240
+ ...(toolHook?.toolName ? { toolName: toolHook.toolName } : {}),
241
+ ...(toolHook?.toolInput !== undefined
242
+ ? { toolInput: toolHook.toolInput }
243
+ : {}),
244
+ ...(toolHook?.toolResult !== undefined
245
+ ? { toolResult: toolHook.toolResult }
246
+ : {}),
247
+ ...(hookEvent === "ToolCompleted" && toolHook?.toolExecution
248
+ ? { toolExecution: toolHook.toolExecution }
249
+ : {}),
250
+ agent,
251
+ hookEvent,
252
+ });
253
+ let lastError;
254
+ for (let attempt = 1; attempt <= 2; attempt += 1) {
255
+ try {
256
+ const response = await fetch(endpoint, {
257
+ method: "POST",
258
+ headers: {
259
+ "Content-Type": "application/json",
260
+ "X-Runweave-Hook-Token": token,
261
+ },
262
+ body,
263
+ });
264
+ if (response.status === 400 && attempt === 1 && toolHook?.toolExecution) {
265
+ const error = await response.json().catch(() => null);
266
+ if (error?.errors?.formErrors?.includes(
267
+ "Unrecognized key(s) in object: 'toolExecution'",
268
+ )) {
269
+ // Older Backends reject unknown fields. Preserve the tool event and
270
+ // its content there, leaving the outcome unknown until they upgrade.
271
+ const legacy = JSON.parse(body);
272
+ delete legacy.toolExecution;
273
+ body = JSON.stringify(legacy);
274
+ continue;
275
+ }
276
+ }
277
+ if (response.ok || response.status < 500 || attempt === 2) {
278
+ return { ok: response.ok, status: response.status, attempt };
279
+ }
280
+ lastError = new Error(`hook_endpoint_${response.status}`);
281
+ } catch (error) {
282
+ lastError = error;
283
+ if (attempt === 2) break;
284
+ }
285
+ await new Promise((resolve) => setTimeout(resolve, 100));
286
+ }
287
+ return {
288
+ ok: false,
289
+ error: lastError instanceof Error ? lastError.message : String(lastError),
290
+ };
291
+ }
292
+
293
+ async function main() {
294
+ const args = parseArgs(process.argv.slice(2));
295
+ const payload = parsePayload(await readStdin());
296
+ const rawEvent = readHookEvent(payload);
297
+ const normalizedEvent = normalizeEventName(rawEvent);
298
+ // Subagents inherit the parent pane/thread identity, but do not end its turn.
299
+ if (normalizedEvent === "subagent_stop" || normalizedEvent === "subagentstop") {
300
+ appendDebugLog("hook bridge skipped subagent stop", {
301
+ threadId: readThreadId(payload),
302
+ });
303
+ return;
304
+ }
305
+ const tmuxEnvRefresh = normalizedEvent === "interrupt" ? { refreshed: false } : readTmuxSessionEnv();
306
+ const tmuxPaneContext = normalizedEvent === "interrupt" ? { panelId: process.env.RUNWEAVE_TERMINAL_PANEL_ID } : readTmuxPaneContext(spawnSync);
307
+ if (tmuxPaneContext.panelId) {
308
+ process.env.RUNWEAVE_TERMINAL_PANEL_ID = tmuxPaneContext.panelId;
309
+ } else if (parseTmuxSocketPath(process.env.TMUX) && process.env.TMUX_PANE) {
310
+ delete process.env.RUNWEAVE_TERMINAL_PANEL_ID;
311
+ }
312
+ const commandName = args.commandName || tmuxPaneContext.commandName;
313
+ const normalizedCommandName = process.platform === "win32"
314
+ ? String(commandName || "").trim().replace(/\\/g, "/")
315
+ .split("/").at(-1).toLowerCase().replace(/\.(exe|cmd|bat)$/i, "")
316
+ : String(commandName || "").toLowerCase();
317
+ let source = normalizeSource(args.source);
318
+ if (source === "unknown") {
319
+ if (["codex", "claude", "trae", "traecli", "traex"].includes(normalizedCommandName)) {
320
+ source = normalizedCommandName;
321
+ }
322
+ }
323
+ const completionReason = normalizeReason(args.reason);
324
+ const threadId = readThreadId(payload);
325
+ const stateHookEvent =
326
+ ["pi", "codex", "trae", "traecli", "traex"].includes(source)
327
+ ? toAgentHookStateEvent(normalizedEvent)
328
+ : null;
329
+ // Compaction continues the turn; child CLIs do not own the parent terminal.
330
+ if (
331
+ source === "codex" &&
332
+ ((stateHookEvent === "SessionStart" && payload.source === "compact") ||
333
+ isNestedCodexProcess(spawnSync))
334
+ ) {
335
+ appendDebugLog("hook bridge skipped codex hook", {
336
+ threadId,
337
+ reason: payload.source === "compact" ? "compaction" : "nested_codex",
338
+ });
339
+ return;
340
+ }
341
+ const toolHook = extractToolHook(payload);
342
+ // Preserve Traex's existing completion/desktop attention behavior. Other
343
+ // structured attention events below send only Feishu, without a completion.
344
+ const notificationType =
345
+ normalizedEvent === "notification" ? readNotificationType(payload) : null;
346
+ const isTraexAttentionNotification =
347
+ (source === "trae" || source === "traex" || source === "traecli") &&
348
+ (notificationType === "permission_prompt" ||
349
+ notificationType === "idle_prompt");
350
+ const effectiveCompletionReason = isTraexAttentionNotification
351
+ ? "notify"
352
+ : completionReason;
353
+ const shouldRecordCompletion = (source !== "pi" || payload.pi?.outcome === "completed") && (
354
+ isTraexAttentionNotification ||
355
+ effectiveCompletionReason !== "hook_stop" ||
356
+ STOP_EVENTS.has(normalizedEvent));
357
+
358
+ // The managed TUI owns the primary/side relationship. Never let child or
359
+ // unclassified events enter completion, Activity, notification or supervision paths.
360
+ if (source === "codex" && process.env.RUNWEAVE_CODEX_CONTEXT_PATH) {
361
+ let context;
362
+ try { context = JSON.parse(fs.readFileSync(process.env.RUNWEAVE_CODEX_CONTEXT_PATH, "utf8")); }
363
+ catch { return; }
364
+ const sameLaunch = context.generation === process.env.RUNWEAVE_CODEX_CONTEXT_GENERATION &&
365
+ context.operationId === process.env.RUNWEAVE_TERMINAL_AGENT_OPERATION_ID;
366
+ const initialPrimary = normalizedEvent === "sessionstart" && payload.source === "startup" && context.revision === 0;
367
+ if (!sameLaunch || context.closed || (!initialPrimary && context.primaryThreadId !== threadId)) return;
368
+ }
369
+
370
+ const endpoint = process.env.RUNWEAVE_HOOK_ENDPOINT;
371
+ const stateEndpoint = deriveAgentHookEndpoint(endpoint);
372
+ const completionEndpoint =
373
+ process.env.RUNWEAVE_COMPLETION_HOOK_ENDPOINT ||
374
+ deriveCompletionEndpoint(endpoint);
375
+ const token = process.env.RUNWEAVE_HOOK_TOKEN;
376
+ const terminalSessionId = process.env.RUNWEAVE_TERMINAL_SESSION_ID;
377
+ const terminalPanelId = process.env.RUNWEAVE_TERMINAL_PANEL_ID || null;
378
+ const tmuxPaneId = process.env.TMUX_PANE || null;
379
+ appendDebugLog("hook bridge invoked", {
380
+ rawEvent: String(rawEvent || "Unknown"),
381
+ normalizedEvent,
382
+ source,
383
+ terminalSessionId: terminalSessionId || null,
384
+ terminalPanelId,
385
+ tmuxPaneId,
386
+ tmuxPaneContext,
387
+ projectId: process.env.RUNWEAVE_PROJECT_ID || null,
388
+ hasToken: Boolean(token),
389
+ endpoint: redactEndpoint(endpoint),
390
+ stateEndpoint: redactEndpoint(stateEndpoint),
391
+ completionEndpoint: redactEndpoint(completionEndpoint),
392
+ threadId,
393
+ stateHookEvent,
394
+ commandName,
395
+ notificationType,
396
+ isTraexAttentionNotification,
397
+ shouldRecordCompletion,
398
+ tmuxEnvRefresh,
399
+ });
400
+ // Only notify / report for completions inside a Runweave terminal. The hook
401
+ // can be installed through AI CLI hook config or plugins, so without
402
+ // this gate every AI CLI stop in any external terminal would trigger desktop
403
+ // and Feishu notifications.
404
+ if (!token || !terminalSessionId) {
405
+ appendDebugLog("hook bridge skipped missing env", {
406
+ rawEvent: String(rawEvent || "Unknown"),
407
+ hasToken: Boolean(token),
408
+ hasTerminalSessionId: Boolean(terminalSessionId),
409
+ endpoint: redactEndpoint(endpoint),
410
+ completionEndpoint: redactEndpoint(completionEndpoint),
411
+ });
412
+ return;
413
+ }
414
+
415
+ if (normalizedEvent === "stop") {
416
+ const summary = extractCompletionSummary(payload);
417
+ if (summary) payload.last_assistant_message = summary;
418
+ }
419
+ payload.runweaveHookEventId = crypto.randomUUID();
420
+ const appServerClient = await discoverAppServer();
421
+ if (!appServerClient) {
422
+ appendDebugLog("hook bridge app-server unavailable", {
423
+ terminalSessionId,
424
+ });
425
+ } else {
426
+ const result = await postAppServerEvent(
427
+ appServerClient,
428
+ buildAppServerBaseEvent({
429
+ kind: "agent.hook",
430
+ payload,
431
+ rawEvent,
432
+ normalizedEvent,
433
+ stateHookEvent,
434
+ source,
435
+ terminalSessionId,
436
+ threadId,
437
+ commandName,
438
+ dedupePrefix: "hook",
439
+ }),
440
+ );
441
+ appendDebugLog("hook bridge posted app-server hook event", {
442
+ terminalSessionId,
443
+ ...result,
444
+ });
445
+ if (!result.ok) {
446
+ appendDebugLog("hook bridge app-server post failed", {
447
+ terminalSessionId,
448
+ kind: "agent.hook",
449
+ ...result,
450
+ });
451
+ }
452
+ }
453
+
454
+ if (stateHookEvent && stateEndpoint) {
455
+ const activityEventId = payload.runweaveHookEventId;
456
+ const result = await postAgentHook({
457
+ endpoint: stateEndpoint,
458
+ token,
459
+ terminalSessionId,
460
+ agent: source,
461
+ hookEvent: stateHookEvent,
462
+ threadId,
463
+ panelId: terminalPanelId,
464
+ tmuxPaneId,
465
+ commandName,
466
+ rawHookEvent: rawEvent,
467
+ sessionSource:
468
+ payload.source === "startup" || payload.source === "resume"
469
+ ? payload.source
470
+ : undefined,
471
+ query:
472
+ stateHookEvent === "UserPromptSubmit"
473
+ ? extractUserPrompt(payload)
474
+ : undefined,
475
+ assistantResponse:
476
+ normalizedEvent === "stop"
477
+ ? extractCompletionSummary(payload)
478
+ : undefined,
479
+ toolHook:
480
+ stateHookEvent === "ToolRequested" || stateHookEvent === "ToolCompleted"
481
+ ? toolHook
482
+ : undefined,
483
+ activityEventId,
484
+ ...(source === "pi" ? { pi: payload.pi } : {}),
485
+ operationId: process.env.RUNWEAVE_TERMINAL_AGENT_OPERATION_ID || null,
486
+ });
487
+ appendDebugLog("hook bridge posted agent hook", {
488
+ terminalSessionId,
489
+ hookEvent: stateHookEvent,
490
+ endpoint: redactEndpoint(stateEndpoint),
491
+ ...result,
492
+ });
493
+ }
494
+
495
+ if (isFeishuAttentionHook(payload, source) && !shouldRecordCompletion && completionEndpoint) {
496
+ const attentionPayload = { ...payload, feishuNotificationOnly: true, last_assistant_message: "任务需要你确认或处理,请回到对应终端。" };
497
+ const result = await postCompletionHook({ endpoint: completionEndpoint, token, terminalSessionId,
498
+ payload: attentionPayload, source, completionReason: "notify", rawEvent, commandName });
499
+ if (result.accepted) {
500
+ notifyFeishu({ ...attentionPayload, hook_event_name: "Stop", feishuNotificationId: result.notificationId }, source, terminalSessionId, terminalPanelId);
501
+ }
502
+ }
503
+
504
+ if (shouldRecordCompletion && completionEndpoint) {
505
+ if (source !== "pi") {
506
+ notifyDesktop(source, { notificationType });
507
+ }
508
+ if (appServerClient) {
509
+ const completionBody = buildCompletionHookBody({
510
+ terminalSessionId,
511
+ payload,
512
+ source,
513
+ completionReason: effectiveCompletionReason,
514
+ rawEvent,
515
+ commandName,
516
+ });
517
+ const completionEvent = buildAppServerBaseEvent({
518
+ kind: "agent.completion",
519
+ payload,
520
+ rawEvent,
521
+ normalizedEvent,
522
+ stateHookEvent,
523
+ source,
524
+ terminalSessionId,
525
+ threadId,
526
+ commandName,
527
+ dedupePrefix: "completion",
528
+ });
529
+ completionEvent.payload = {
530
+ ...(completionBody.pi ? { pi: completionBody.pi } : {}),
531
+ source: completionBody.source,
532
+ completionReason: completionBody.completionReason,
533
+ commandName: completionBody.commandName,
534
+ rawHookEvent: completionBody.rawHookEvent,
535
+ hookEvent: completionBody.hookEvent,
536
+ cwd: completionBody.cwd,
537
+ summary: completionBody.summary,
538
+ operationId: completionBody.operationId,
539
+ };
540
+ const result = await postAppServerEvent(appServerClient, completionEvent);
541
+ appendDebugLog("hook bridge posted app-server completion event", {
542
+ terminalSessionId,
543
+ ...result,
544
+ });
545
+ if (!result.ok) {
546
+ appendDebugLog("hook bridge app-server post failed", {
547
+ terminalSessionId,
548
+ kind: "agent.completion",
549
+ ...result,
550
+ });
551
+ }
552
+ }
553
+ const result = await postCompletionHook({
554
+ endpoint: completionEndpoint,
555
+ token,
556
+ terminalSessionId,
557
+ payload,
558
+ source,
559
+ completionReason: effectiveCompletionReason,
560
+ rawEvent,
561
+ commandName,
562
+ });
563
+ if (source === "pi" && result.accepted) {
564
+ notifyDesktop(source, { notificationType });
565
+ }
566
+ if (result.accepted) {
567
+ notifyFeishu({ ...payload, ...(isTraexAttentionNotification ? { hook_event_name: "Stop", last_assistant_message: "任务需要你确认或处理,请回到对应终端。" } : {}), feishuNotificationId: result.notificationId }, source, terminalSessionId, terminalPanelId);
568
+ }
569
+ appendDebugLog("hook bridge posted completion hook", {
570
+ terminalSessionId,
571
+ rawEvent: String(rawEvent || "Stop"),
572
+ endpoint: redactEndpoint(completionEndpoint),
573
+ ...result,
574
+ });
575
+ }
576
+ }
577
+
578
+ main().catch((error) => {
579
+ appendDebugLog("hook bridge failed", {
580
+ error: error instanceof Error ? error.message : String(error),
581
+ });
582
+ process.exitCode = 0;
583
+ });
@@ -0,0 +1,42 @@
1
+ /* global fetch, module, require */
2
+ /* eslint-disable @typescript-eslint/no-require-imports */
3
+ const { buildCompletionHookBody } = require("./runweave-hook-payload.cjs");
4
+
5
+ async function postCompletionHook({
6
+ endpoint,
7
+ token,
8
+ terminalSessionId,
9
+ payload,
10
+ source,
11
+ completionReason,
12
+ rawEvent,
13
+ commandName,
14
+ }) {
15
+ const body = buildCompletionHookBody({
16
+ terminalSessionId,
17
+ payload,
18
+ source,
19
+ completionReason,
20
+ rawEvent,
21
+ commandName,
22
+ });
23
+ try {
24
+ const response = await fetch(endpoint, {
25
+ method: "POST",
26
+ headers: {
27
+ "Content-Type": "application/json",
28
+ "X-Runweave-Hook-Token": token,
29
+ },
30
+ body: JSON.stringify(body),
31
+ });
32
+ const result = await response.json().catch(() => null);
33
+ return { ok: response.ok, status: response.status, accepted: Boolean(result?.event || result?.notificationId) && !result?.ignored, notificationId: result?.notificationId ?? (result?.event?.payload?.completionRevision ? String(result.event.payload.completionRevision) : undefined) };
34
+ } catch (error) {
35
+ return {
36
+ ok: false,
37
+ error: error instanceof Error ? error.message : String(error),
38
+ };
39
+ }
40
+ }
41
+
42
+ module.exports = { postCompletionHook };