orc-ai 0.1.49 → 0.1.50

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 (260) hide show
  1. package/dist/index.js +514 -485
  2. package/dist/skills/orc-platform/SKILL.md +2 -1
  3. package/dist/skills/orc-platform/references/scratchpads.md +140 -0
  4. package/dist/skills/orc-sdlc/references/planning.md +2 -0
  5. package/dist/web/assets/{Agents-C8dJX8px.js → Agents-DT7Kw4C9.js} +1 -1
  6. package/dist/web/assets/Assistant-Bold-gm-uSS1B.woff2 +0 -0
  7. package/dist/web/assets/Assistant-Medium-DrcxCXg3.woff2 +0 -0
  8. package/dist/web/assets/Assistant-Regular-DVxZuzxb.woff2 +0 -0
  9. package/dist/web/assets/Assistant-SemiBold-SCI4bEL9.woff2 +0 -0
  10. package/dist/web/assets/{Attention-BHYo8Lwr.js → Attention-Bibod5n4.js} +1 -1
  11. package/dist/web/assets/{Audit-CS_DZkbJ.js → Audit-DtPRrWXW.js} +1 -1
  12. package/dist/web/assets/{ConfirmDialog-CrSa87VF.js → ConfirmDialog-C_exU7Ga.js} +1 -1
  13. package/dist/web/assets/Dashboard-CUI_9Hz5.js +1 -0
  14. package/dist/web/assets/{DocumentWorkspace-CNyVQTjg.js → DocumentWorkspace-1MKzrR1V.js} +1 -1
  15. package/dist/web/assets/{EmptyState-Ctm7L70B.js → EmptyState-BVLws_BR.js} +1 -1
  16. package/dist/web/assets/{ErrorState-BPTepwiG.js → ErrorState-CwOWC9Qy.js} +1 -1
  17. package/dist/web/assets/{FileEditor-Dh29_xCL.js → FileEditor-Da165c-z.js} +1 -1
  18. package/dist/web/assets/{JobWebhooks-TvAY8p1V.js → JobWebhooks-hQGYLoqm.js} +1 -1
  19. package/dist/web/assets/{Jobs-C5ggSs2T.js → Jobs-8NrwRdn6.js} +3 -3
  20. package/dist/web/assets/Knowledge-HYfSkIC7.js +28 -0
  21. package/dist/web/assets/{PackageCatalog-B1U3vfhW.js → PackageCatalog-136z9RG3.js} +5 -5
  22. package/dist/web/assets/{Pager-ClYYU9et.js → Pager-BNTTeR5A.js} +1 -1
  23. package/dist/web/assets/{PriorityBadge-BW-A50LE.js → PriorityBadge-DHoaJR_M.js} +1 -1
  24. package/dist/web/assets/Projects-k8zYVv6p.js +3 -0
  25. package/dist/web/assets/ResumeActions-RtezaXDE.js +1 -0
  26. package/dist/web/assets/{Rules-DGKsAbTf.js → Rules-DhBnNVaL.js} +1 -1
  27. package/dist/web/assets/Scratchpads-ayvsVZxj.js +20 -0
  28. package/dist/web/assets/Sessions-69xt5f84.js +5 -0
  29. package/dist/web/assets/{Settings-yW1S2q4F.js → Settings-CQgEWLgI.js} +6 -6
  30. package/dist/web/assets/{Skills-BwdXE5nT.js → Skills-DBDN8e6r.js} +3 -3
  31. package/dist/web/assets/{SourceEditor-ft02z20v.js → SourceEditor-YTDMGFWW.js} +1 -1
  32. package/dist/web/assets/{StatusBadge-C5G1fdZh.js → StatusBadge-Cq2xO_SU.js} +1 -1
  33. package/dist/web/assets/TagInput-DDhc6WTI.js +1 -0
  34. package/dist/web/assets/{TaskDetailSheet-fUSHPFB-.js → TaskDetailSheet-BfRXcm8m.js} +2 -2
  35. package/dist/web/assets/{Tasks-uRqvmLz7.js → Tasks-DNk7-wgj.js} +5 -5
  36. package/dist/web/assets/{Terminals-W5nszLI1.js → Terminals-DjEvs39w.js} +7 -7
  37. package/dist/web/assets/{ViewHeader-DXR0ZaMO.js → ViewHeader-B9EgQxZk.js} +1 -1
  38. package/dist/web/assets/{Webhooks-lXLoKWdt.js → Webhooks-BvLKR0jj.js} +1 -1
  39. package/dist/web/assets/abnfDiagram-VCTEODGH-BuQM5S1v.js +1 -0
  40. package/dist/web/assets/ar-SA-G6X2FPQ2-BjnbTjeM.js +10 -0
  41. package/dist/web/assets/arc-DFP6bOTS.js +1 -0
  42. package/dist/web/assets/architectureDiagram-5GKGNRK7-BFJa9U2j.js +36 -0
  43. package/dist/web/assets/arrow-left-BTl_37z8.js +6 -0
  44. package/dist/web/assets/az-AZ-76LH7QW2-B8PZ0GKj.js +1 -0
  45. package/dist/web/assets/bg-BG-XCXSNQG7-DI7GiV-4.js +5 -0
  46. package/dist/web/assets/{blockDiagram-I7D4REHJ-DMrufypV.js → blockDiagram-I7D4REHJ-Cizo9Hl8.js} +3 -3
  47. package/dist/web/assets/bn-BD-2XOGV67Q-Dr7ktQFH.js +5 -0
  48. package/dist/web/assets/{c4Diagram-7LVT6UL2-BUUxjwvU.js → c4Diagram-7LVT6UL2-D8DiqXy4.js} +2 -2
  49. package/dist/web/assets/ca-ES-6MX7JW3Y-DqmXjVpI.js +8 -0
  50. package/dist/web/assets/channel-DbXZPmMe.js +1 -0
  51. package/dist/web/assets/chunk-2Q5K7J3B-JhTVpDn1.js +1 -0
  52. package/dist/web/assets/{chunk-5VM5RSS4-B6lAVcgQ.js → chunk-5VM5RSS4-BZ8K5AGw.js} +1 -1
  53. package/dist/web/assets/chunk-F27PBJKO-_mlKDDbq.js +1 -0
  54. package/dist/web/assets/{chunk-IMKFNOWR-CwyogA-y.js → chunk-IMKFNOWR-BnFGiWsy.js} +1 -1
  55. package/dist/web/assets/chunk-JWPE2WC7-bbN-huXf.js +1 -0
  56. package/dist/web/assets/chunk-POPQ4Y6H-wnVtHn_O.js +1 -0
  57. package/dist/web/assets/{chunk-SVP7TREG-CmiQdvOH.js → chunk-SVP7TREG-B1kaWVdh.js} +4 -4
  58. package/dist/web/assets/{chunk-TICWLB2K-CieIpfOy.js → chunk-TICWLB2K-BQ8K51Oc.js} +1 -1
  59. package/dist/web/assets/chunk-XXDRQBXY-CCJyOiYl.js +1 -0
  60. package/dist/web/assets/classDiagram-ZZMXUADV-BQ5ONiWc.js +1 -0
  61. package/dist/web/assets/classDiagram-v2-VYDZK3BY-BQ5ONiWc.js +1 -0
  62. package/dist/web/assets/copy-DsS5X55x.js +6 -0
  63. package/dist/web/assets/cose-bilkent-JH36ORCC-BKztu1Kn.js +1 -0
  64. package/dist/web/assets/cs-CZ-2BRQDIVT-qn9_RBqW.js +11 -0
  65. package/dist/web/assets/{cynefin-OW5HDTMX-vMXgcpgg.js → cynefin-OW5HDTMX-YAbh6GHR.js} +1 -1
  66. package/dist/web/assets/cynefinDiagram-5FMLGOSQ-CWidjPb8.js +62 -0
  67. package/dist/web/assets/da-DK-5WZEPLOC-DpER4jvL.js +5 -0
  68. package/dist/web/assets/{dagre-GXQ25YYZ-xmoviGlr.js → dagre-GXQ25YYZ-BuzvSdX0.js} +2 -2
  69. package/dist/web/assets/de-DE-XR44H4JA-CtleMrwo.js +8 -0
  70. package/dist/web/assets/{diagram-S7CK7UJ4-CguQzzXs.js → diagram-S7CK7UJ4-Ch-rAjmB.js} +5 -5
  71. package/dist/web/assets/diagram-UQ7AKVKN-DhixRZev.js +41 -0
  72. package/dist/web/assets/{diagram-VSXAHHWV-cuhv3Fvj.js → diagram-VSXAHHWV-4FwHTQjS.js} +3 -3
  73. package/dist/web/assets/diagram-VX7I27RA-BE_c4-lI.js +24 -0
  74. package/dist/web/assets/diagram-Z3DM3KII-j49FiH9W.js +24 -0
  75. package/dist/web/assets/directory-open-01563666-DWU9wJ6I.js +1 -0
  76. package/dist/web/assets/directory-open-4ed118d0-CunoC1EB.js +1 -0
  77. package/dist/web/assets/{download-UgMvjBjR.js → download-DCNlFjgq.js} +1 -1
  78. package/dist/web/assets/ebnfDiagram-PWID7BFC-DJd8fyb-.js +1 -0
  79. package/dist/web/assets/el-GR-BZB4AONW-DOGQ2uKF.js +10 -0
  80. package/dist/web/assets/erDiagram-RLTQ6QDP-CIzsltIW.js +99 -0
  81. package/dist/web/assets/es-ES-U4NZUMDT-BV7Xnx76.js +9 -0
  82. package/dist/web/assets/eu-ES-A7QVB2H4-Cy6tNdQP.js +11 -0
  83. package/dist/web/assets/excalidraw/fonts/Assistant/Assistant-Bold.woff2 +0 -0
  84. package/dist/web/assets/excalidraw/fonts/Assistant/Assistant-Medium.woff2 +0 -0
  85. package/dist/web/assets/excalidraw/fonts/Assistant/Assistant-Regular.woff2 +0 -0
  86. package/dist/web/assets/excalidraw/fonts/Assistant/Assistant-SemiBold.woff2 +0 -0
  87. package/dist/web/assets/excalidraw/fonts/Cascadia/CascadiaCode-Regular.woff2 +0 -0
  88. package/dist/web/assets/excalidraw/fonts/ComicShanns/ComicShanns-Regular-279a7b317d12eb88de06167bd672b4b4.woff2 +0 -0
  89. package/dist/web/assets/excalidraw/fonts/ComicShanns/ComicShanns-Regular-6e066e8de2ac57ea9283adb9c24d7f0c.woff2 +0 -0
  90. package/dist/web/assets/excalidraw/fonts/ComicShanns/ComicShanns-Regular-dc6a8806fa96795d7b3be5026f989a17.woff2 +0 -0
  91. package/dist/web/assets/excalidraw/fonts/ComicShanns/ComicShanns-Regular-fcb0fc02dcbee4c9846b3e2508668039.woff2 +0 -0
  92. package/dist/web/assets/excalidraw/fonts/Excalifont/Excalifont-Regular-349fac6ca4700ffec595a7150a0d1e1d.woff2 +0 -0
  93. package/dist/web/assets/excalidraw/fonts/Excalifont/Excalifont-Regular-3f2c5db56cc93c5a6873b1361d730c16.woff2 +0 -0
  94. package/dist/web/assets/excalidraw/fonts/Excalifont/Excalifont-Regular-41b173a47b57366892116a575a43e2b6.woff2 +0 -0
  95. package/dist/web/assets/excalidraw/fonts/Excalifont/Excalifont-Regular-623ccf21b21ef6b3a0d87738f77eb071.woff2 +0 -0
  96. package/dist/web/assets/excalidraw/fonts/Excalifont/Excalifont-Regular-a88b72a24fb54c9f94e3b5fdaa7481c9.woff2 +0 -0
  97. package/dist/web/assets/excalidraw/fonts/Excalifont/Excalifont-Regular-b9dcf9d2e50a1eaf42fc664b50a3fd0d.woff2 +0 -0
  98. package/dist/web/assets/excalidraw/fonts/Excalifont/Excalifont-Regular-be310b9bcd4f1a43f571c46df7809174.woff2 +0 -0
  99. package/dist/web/assets/excalidraw/fonts/Liberation/LiberationSans-Regular.woff2 +0 -0
  100. package/dist/web/assets/excalidraw/fonts/Lilita/Lilita-Regular-i7dPIFZ9Zz-WBtRtedDbYE98RXi4EwSsbg.woff2 +0 -0
  101. package/dist/web/assets/excalidraw/fonts/Lilita/Lilita-Regular-i7dPIFZ9Zz-WBtRtedDbYEF8RXi4EwQ.woff2 +0 -0
  102. package/dist/web/assets/excalidraw/fonts/Nunito/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTA3j6zbXWjgevT5.woff2 +0 -0
  103. package/dist/web/assets/excalidraw/fonts/Nunito/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTQ3j6zbXWjgeg.woff2 +0 -0
  104. package/dist/web/assets/excalidraw/fonts/Nunito/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTk3j6zbXWjgevT5.woff2 +0 -0
  105. package/dist/web/assets/excalidraw/fonts/Nunito/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTo3j6zbXWjgevT5.woff2 +0 -0
  106. package/dist/web/assets/excalidraw/fonts/Nunito/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTs3j6zbXWjgevT5.woff2 +0 -0
  107. package/dist/web/assets/excalidraw/fonts/Virgil/Virgil-Regular.woff2 +0 -0
  108. package/dist/web/assets/fa-IR-HGAKTJCU-CbOnhX3T.js +8 -0
  109. package/dist/web/assets/fi-FI-Z5N7JZ37-qra5-Mob.js +6 -0
  110. package/dist/web/assets/file-open-002ab408-DIuFHtCF.js +1 -0
  111. package/dist/web/assets/file-open-7c801643-684qeFg4.js +1 -0
  112. package/dist/web/assets/file-save-3189631c-C1wFhQhH.js +1 -0
  113. package/dist/web/assets/file-save-745eba88-Bb9F9Kg7.js +1 -0
  114. package/dist/web/assets/{flowDiagram-HODETNUW-DueO0Ju6.js → flowDiagram-HODETNUW-AX8L-l_p.js} +5 -5
  115. package/dist/web/assets/folder-open-DAIhPqFI.js +11 -0
  116. package/dist/web/assets/fr-FR-RHASNOE6-DN9byp9Y.js +9 -0
  117. package/dist/web/assets/ganttDiagram-EL5Y4UJY-CETcz11y.js +292 -0
  118. package/dist/web/assets/gitGraphDiagram-WWUBYQGX-DrDRWd07.js +106 -0
  119. package/dist/web/assets/gl-ES-HMX3MZ6V-BylDWANB.js +10 -0
  120. package/dist/web/assets/he-IL-6SHJWFNN-BIl3mWuh.js +10 -0
  121. package/dist/web/assets/hi-IN-IWLTKZ5I-DeQ5X6EO.js +4 -0
  122. package/dist/web/assets/highlighted-body-KPVGNVTW-CKHMZ0iS.js +1 -0
  123. package/dist/web/assets/hu-HU-A5ZG7DT2-0hYCWJJc.js +7 -0
  124. package/dist/web/assets/id-ID-SAP4L64H-Dhbb7S2T.js +10 -0
  125. package/dist/web/assets/image-blob-reduce.esm-D6s-rqMO.js +7 -0
  126. package/dist/web/assets/index-3slyF2Z-.js +19 -0
  127. package/dist/web/assets/index-CY60J5zm.css +1 -0
  128. package/dist/web/assets/{index-C_jtMgr7.js → index-Ckq9CvHb.js} +89 -89
  129. package/dist/web/assets/infoDiagram-27XIBGKW-ST1zQCsj.js +2 -0
  130. package/dist/web/assets/{ishikawaDiagram-5VMMS53U-ccIPCUs4.js → ishikawaDiagram-5VMMS53U-B3SJTPoL.js} +5 -5
  131. package/dist/web/assets/it-IT-JPQ66NNP-BhOQg5cl.js +11 -0
  132. package/dist/web/assets/ja-JP-DBVTYXUO-BPw0tly-.js +8 -0
  133. package/dist/web/assets/{journeyDiagram-3NMN7TZE-rRe3uTLu.js → journeyDiagram-3NMN7TZE-B5lzDs3v.js} +2 -2
  134. package/dist/web/assets/kaa-6HZHGXH3-C5_ZIpfZ.js +1 -0
  135. package/dist/web/assets/kab-KAB-ZGHBKWFO-iqn4ZTub.js +8 -0
  136. package/dist/web/assets/{kanban-definition-UXKFOSKX-tAKCWntJ.js → kanban-definition-UXKFOSKX-BwPssY6F.js} +6 -6
  137. package/dist/web/assets/kk-KZ-P5N5QNE5-jAgtA3a3.js +1 -0
  138. package/dist/web/assets/km-KH-HSX4SM5Z-BE4HhYBv.js +11 -0
  139. package/dist/web/assets/ko-KR-MTYHY66A-BeajeVaX.js +9 -0
  140. package/dist/web/assets/ku-TR-6OUDTVRD-AogZs9l4.js +9 -0
  141. package/dist/web/assets/layout-CrpljNKI.js +1 -0
  142. package/dist/web/assets/linear-Bo2HXNnf.js +1 -0
  143. package/dist/web/assets/{list-BL4eRkIg.js → list-W5PAwY_1.js} +1 -1
  144. package/dist/web/assets/live-sessions-C4qBcPbR.js +6 -0
  145. package/dist/web/assets/lt-LT-XHIRWOB4-VJAq27RW.js +3 -0
  146. package/dist/web/assets/lv-LV-5QDEKY6T-DhV43c3O.js +7 -0
  147. package/dist/web/assets/mermaid-HWGCJPDP-CSzVGSXu.js +299 -0
  148. package/dist/web/assets/mermaid.core-BYL6TaO8.js +312 -0
  149. package/dist/web/assets/{mindmap-definition-YA3MSWOX-Cj5-j6a7.js → mindmap-definition-YA3MSWOX-EvJgLjwn.js} +4 -4
  150. package/dist/web/assets/mr-IN-CRQNXWMA-DSWzmLM0.js +13 -0
  151. package/dist/web/assets/my-MM-5M5IBNSE-gJ2ISU-G.js +1 -0
  152. package/dist/web/assets/nb-NO-T6EIAALU-DAwLq2T7.js +10 -0
  153. package/dist/web/assets/nl-NL-IS3SIHDZ-CjE7CpT4.js +8 -0
  154. package/dist/web/assets/nn-NO-6E72VCQL-CTVNnELU.js +8 -0
  155. package/dist/web/assets/oc-FR-POXYY2M6-vcMaQvFU.js +8 -0
  156. package/dist/web/assets/pa-IN-N4M65BXN-DJg1bUGg.js +4 -0
  157. package/dist/web/assets/pegDiagram-XKGWAZYB-TqqcNwRV.js +1 -0
  158. package/dist/web/assets/{pencil-gxvh59uO.js → pencil-CxDR8VFb.js} +1 -1
  159. package/dist/web/assets/percentages-BXMCSKIN-CnGxO6II.js +180 -0
  160. package/dist/web/assets/percentages-BXMCSKIN-DGBKIvAv.css +1 -0
  161. package/dist/web/assets/pica-DVsMi-pt.js +7 -0
  162. package/dist/web/assets/pieDiagram-E7YTZNPT-CjwbCJae.js +39 -0
  163. package/dist/web/assets/pl-PL-T2D74RX3-B499NViP.js +9 -0
  164. package/dist/web/assets/pt-BR-5N22H2LF-C99TatKy.js +9 -0
  165. package/dist/web/assets/pt-PT-UZXXM6DQ-DywHBJAr.js +9 -0
  166. package/dist/web/assets/{quadrantDiagram-AXDQQJYC-DKTP6jS5.js → quadrantDiagram-AXDQQJYC-C8k5-2L4.js} +1 -1
  167. package/dist/web/assets/railroadDiagram-O6MQD6OU-DN6DTUJL.js +1 -0
  168. package/dist/web/assets/{refresh-cw-BQRdbjy6.js → refresh-cw-C429XUIu.js} +1 -1
  169. package/dist/web/assets/{requirementDiagram-BXWQKSXE-B9hH69zu.js → requirementDiagram-BXWQKSXE-Yx4CbxBQ.js} +2 -2
  170. package/dist/web/assets/ro-RO-JPDTUUEW-BrIt0gdu.js +11 -0
  171. package/dist/web/assets/roundRect-0PYZxl1G.js +1 -0
  172. package/dist/web/assets/ru-RU-B4JR7IUQ-DikO_eDS.js +9 -0
  173. package/dist/web/assets/sankeyDiagram-P5KCCOFB-ChZBsAuF.js +40 -0
  174. package/dist/web/assets/{save-CYoz3QKB.js → save-Ca2pCtPv.js} +1 -1
  175. package/dist/web/assets/save-file-B_ZN6-id.js +1 -0
  176. package/dist/web/assets/scratchpad-routes-Cf4VNpSR.js +11 -0
  177. package/dist/web/assets/scroll-area-CUm8aggx.js +1 -0
  178. package/dist/web/assets/{sequenceDiagram-WJ2MYXX4-BF77J63J.js → sequenceDiagram-WJ2MYXX4-BJDwmaZp.js} +2 -2
  179. package/dist/web/assets/si-LK-N5RQ5JYF-BGOkewnb.js +1 -0
  180. package/dist/web/assets/sizeCapture-INFHLROL-DCT6mGJl.js +1 -0
  181. package/dist/web/assets/sk-SK-C5VTKIMK-Ci61SpsN.js +6 -0
  182. package/dist/web/assets/sl-SI-NN7IZMDC--KoF29T9.js +6 -0
  183. package/dist/web/assets/stateDiagram-D77RDMKH-DCAGD_ib.js +1 -0
  184. package/dist/web/assets/stateDiagram-v2-MP3YSRHH-BMQGBnFo.js +1 -0
  185. package/dist/web/assets/subset-shared.chunk-BwhnPDcu.js +84 -0
  186. package/dist/web/assets/subset-worker.chunk-Cnt_77Lu.js +1 -0
  187. package/dist/web/assets/sv-SE-XGPEYMSR-C0StL-sk.js +10 -0
  188. package/dist/web/assets/swimlanes-42K2YHIH-DPwHOZ8T.js +1 -0
  189. package/dist/web/assets/swimlanesDiagram-VR7AAH4N-DGqsbuuX.js +8 -0
  190. package/dist/web/assets/ta-IN-2NMHFXQM-D7MMI2_6.js +9 -0
  191. package/dist/web/assets/{table-D3N_5Wee.js → table-DTKUFFYV.js} +1 -1
  192. package/dist/web/assets/tabs-DcYod54F.js +1 -0
  193. package/dist/web/assets/th-TH-HPSO5L25-hlqKs6HJ.js +2 -0
  194. package/dist/web/assets/{timeline-definition-24CTP7MA-owGoHn8z.js → timeline-definition-24CTP7MA-7K6IPjAN.js} +8 -8
  195. package/dist/web/assets/tr-TR-DEFEU3FU-lJQToQnP.js +7 -0
  196. package/dist/web/assets/{trash-2-D3Ey4I09.js → trash-2-BOe9xa7a.js} +1 -1
  197. package/dist/web/assets/uk-UA-QMV73CPH-HdtjtiKv.js +6 -0
  198. package/dist/web/assets/{upload-DhVOCWST.js → upload-ZufDR-3q.js} +1 -1
  199. package/dist/web/assets/{useDetailRoute-j9nlwack.js → useDetailRoute-BvTqyOr1.js} +1 -1
  200. package/dist/web/assets/{useJobs-Dcl-Vim3.js → useJobs-rLcb_CgS.js} +1 -1
  201. package/dist/web/assets/{useKnowledge-gIjk0_I1.js → useKnowledge-DcZD9AcU.js} +1 -1
  202. package/dist/web/assets/{useListSelection-CSQd_Hmx.js → useListSelection-CyPVxpFj.js} +1 -1
  203. package/dist/web/assets/{useMemories-B8Zpz0Qz.js → useMemories-7v8TIl7-.js} +1 -1
  204. package/dist/web/assets/useProjectScope-C3iwCwG_.js +1 -0
  205. package/dist/web/assets/{useSessions-BrdK-12R.js → useSessions-BL5wWTxP.js} +1 -1
  206. package/dist/web/assets/vennDiagram-4TSXK5OY-Dfm3Tyo8.js +34 -0
  207. package/dist/web/assets/vi-VN-M7AON7JQ-Dj3F3Qzf.js +5 -0
  208. package/dist/web/assets/{view-params-Bm1Qf6KC.js → view-params-BeBdfQW5.js} +1 -1
  209. package/dist/web/assets/{wardleyDiagram-VM6X3IG4-D9GbTBKy.js → wardleyDiagram-VM6X3IG4-B6O-_Buj.js} +2 -2
  210. package/dist/web/assets/{xychartDiagram-S5SC5T6Z-BFqPF2Hl.js → xychartDiagram-S5SC5T6Z-BSRb_uOW.js} +4 -4
  211. package/dist/web/assets/zh-CN-LNUGB5OW-DAzBdZtp.js +10 -0
  212. package/dist/web/assets/zh-HK-E62DVLB3-C_VeJG0z.js +1 -0
  213. package/dist/web/assets/zh-TW-RAJ6MFWO-DRZgKpha.js +9 -0
  214. package/dist/web/index.html +2 -2
  215. package/package.json +1 -1
  216. package/dist/web/assets/Dashboard-V813oIhq.js +0 -1
  217. package/dist/web/assets/Knowledge-BpiN3iVE.js +0 -28
  218. package/dist/web/assets/Projects-DRao5Qpk.js +0 -3
  219. package/dist/web/assets/ResumeActions-DHTOr6GQ.js +0 -11
  220. package/dist/web/assets/Sessions-CWHU6sYy.js +0 -5
  221. package/dist/web/assets/abnfDiagram-VCTEODGH-K8P_VxLi.js +0 -1
  222. package/dist/web/assets/arc-BOl9BKfD.js +0 -1
  223. package/dist/web/assets/architectureDiagram-5GKGNRK7-DIZ15fO5.js +0 -36
  224. package/dist/web/assets/channel-CQFNQIhG.js +0 -1
  225. package/dist/web/assets/chunk-2Q5K7J3B-wRIxA2_q.js +0 -1
  226. package/dist/web/assets/chunk-F27PBJKO-DVuei-Pl.js +0 -1
  227. package/dist/web/assets/chunk-JWPE2WC7-zdsOarNZ.js +0 -1
  228. package/dist/web/assets/chunk-POPQ4Y6H-D3ieeKih.js +0 -1
  229. package/dist/web/assets/chunk-XXDRQBXY-BoTHwisB.js +0 -1
  230. package/dist/web/assets/classDiagram-ZZMXUADV-B5yD90Df.js +0 -1
  231. package/dist/web/assets/classDiagram-v2-VYDZK3BY-B5yD90Df.js +0 -1
  232. package/dist/web/assets/cose-bilkent-JH36ORCC-CtGsuuTW.js +0 -1
  233. package/dist/web/assets/cynefinDiagram-5FMLGOSQ-kMbm5D7e.js +0 -62
  234. package/dist/web/assets/diagram-UQ7AKVKN-CMX0u7Gf.js +0 -41
  235. package/dist/web/assets/diagram-VX7I27RA-Bp_JbX0e.js +0 -24
  236. package/dist/web/assets/diagram-Z3DM3KII-oZ6jRSCd.js +0 -24
  237. package/dist/web/assets/ebnfDiagram-PWID7BFC-DbxnEjb0.js +0 -1
  238. package/dist/web/assets/erDiagram-RLTQ6QDP-Cl5kXPho.js +0 -99
  239. package/dist/web/assets/folder-open-DojCP5NP.js +0 -16
  240. package/dist/web/assets/ganttDiagram-EL5Y4UJY-DNjT4iVH.js +0 -292
  241. package/dist/web/assets/gitGraphDiagram-WWUBYQGX-B4aUQ9gY.js +0 -106
  242. package/dist/web/assets/highlighted-body-KPVGNVTW-gt1u8RcC.js +0 -1
  243. package/dist/web/assets/index-CyjfnRiI.css +0 -1
  244. package/dist/web/assets/infoDiagram-27XIBGKW-CWcOvNAB.js +0 -2
  245. package/dist/web/assets/layout-7xCiQ5Mn.js +0 -1
  246. package/dist/web/assets/linear-WCNhc07o.js +0 -1
  247. package/dist/web/assets/mermaid-HWGCJPDP-C8QwWdo5.js +0 -609
  248. package/dist/web/assets/pegDiagram-XKGWAZYB-BYB3oVZ_.js +0 -1
  249. package/dist/web/assets/pieDiagram-E7YTZNPT-CSbpzXas.js +0 -39
  250. package/dist/web/assets/railroadDiagram-O6MQD6OU-Ct8aPeLX.js +0 -1
  251. package/dist/web/assets/sankeyDiagram-P5KCCOFB-CDqNONxU.js +0 -40
  252. package/dist/web/assets/scroll-area-CU4DGUBA.js +0 -1
  253. package/dist/web/assets/sizeCapture-INFHLROL-Dpubco_U.js +0 -1
  254. package/dist/web/assets/stateDiagram-D77RDMKH-CzslKEYw.js +0 -1
  255. package/dist/web/assets/stateDiagram-v2-MP3YSRHH-DKbNjyV-.js +0 -1
  256. package/dist/web/assets/swimlanes-42K2YHIH-bD_tUjo6.js +0 -1
  257. package/dist/web/assets/swimlanesDiagram-VR7AAH4N-0wAluWQF.js +0 -8
  258. package/dist/web/assets/tabs-CSlEXoxD.js +0 -1
  259. package/dist/web/assets/useProjectScope-Dk0mjyHf.js +0 -1
  260. package/dist/web/assets/vennDiagram-4TSXK5OY-D0_6bldW.js +0 -34
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: orc-platform
3
- description: "Install and use ORC: CLI/API/MCP, auth/settings, projects, tasks/flows, memory, knowledge/KB/digests/embeddings, sessions/handoff, terminals/chat, jobs/gateway, agents/backends/packages, Git/GitHub, SSH, rules/hooks, tags, audit and monitoring."
3
+ description: "Install and use ORC: CLI/API/MCP, auth/settings, projects, tasks/flows, memory, knowledge/KB/digests/embeddings, sessions/handoff, terminals/chat, jobs/gateway, agents/backends/packages, Git/GitHub, SSH, rules/hooks, tags, audit and monitoring, scratchpads (plans, diagrams, interactive pages)."
4
4
  ---
5
5
 
6
6
  # Operate ORC
@@ -36,6 +36,7 @@ verify the returned hash/size without loading the script body into context.
36
36
  | Install, connect an agent, CLI/API/MCP, configure auth, diagnose connectivity | [Setup and interfaces](references/setup.md) |
37
37
  | Recall, create, correct or undo short facts | [Memory](references/memory.md) |
38
38
  | KB intake/search/edit, parsers, embeddings, README/Markdown and living Learnings digests | [Knowledge and documentation](references/knowledge.md) |
39
+ | Scratchpads: plans/docs with mermaid, Excalidraw diagrams, interactive HTML pages with or without ORC access | [Scratchpads](references/scratchpads.md) |
39
40
  | Projects, tasks/flows, jobs, gateway, status, tags and audit | [Work and operations](references/work.md) |
40
41
  | Session continuity/handoff, terminals, chat, SSH execution, Git/GitHub | [Sessions and execution](references/execution.md) |
41
42
  | Archive local coding sessions on remote ORC, incremental sync/deduplication, session retrieval design | [Session archive and search](references/session-archive.md) |
@@ -0,0 +1,140 @@
1
+ # Scratchpads
2
+
3
+ A scratchpad is a working file a human and agents keep and revisit: a plan, a design
4
+ note, a diagram, an interactive page. The human opens it at the deep link that
5
+ `pad_create` returns (`/scratchpad/<id>`, under Library) and can edit it there.
6
+ Use the KB for cited, durable knowledge; memory for short facts; tasks for tracked
7
+ work. A pad is for thinking, showing and iterating with the human.
8
+
9
+ ## Collaborate through a pad
10
+
11
+ A pad is a shared surface: the human edits it in the dashboard while agents read and
12
+ write it through MCP/CLI, and every save is a new revision attributed to its author.
13
+
14
+ 1. **Agent drafts, human shapes.** Draft the plan, design or diagram as a pad, send
15
+ the link and ask for edits in place instead of a long chat reply. The human
16
+ rewrites sections, ticks checklist items, drags diagram boxes or answers inline.
17
+ 2. **Re-read before you continue.** When the human says they changed it (or before
18
+ acting on it later), `pad_get` it and treat their edits as the decision: removed
19
+ steps are out of scope, rewritten text is the new requirement. Say what you took
20
+ from their change.
21
+ 3. **Write back without clobbering.** Update with `if_revision`; on a conflict, re-read
22
+ and merge. Keep the human's wording where they edited; change your own sections.
23
+ 4. **Mark open questions in the pad.** Use a `## Open questions` list or `- [ ]`
24
+ items addressed to the human; when they answer in the pad, fold the answer into
25
+ the plan and remove the question.
26
+ 5. **Hand over between agents and sessions.** Pads outlive the session. Link a
27
+ handoff, task or session event to the pad id; the next agent finds it with
28
+ `pad_list({session:"current"})`, `pad_list({project, q})` or the id, and continues
29
+ from the latest revision rather than a stale local copy.
30
+ 6. **Show, then decide.** For choices that are easier to see than describe (UI
31
+ options, data shape, chart of results), make an `html` or `diagram` pad and ask
32
+ the human to pick. For live ORC data, ask them to "Render with ORC access" after
33
+ they have looked at the page.
34
+
35
+ Approval in a pad is the human's edit or explicit reply, not the absence of changes.
36
+ When a pad settles a durable decision, record it where it belongs (task, KB, memory)
37
+ and link back to the pad.
38
+
39
+ ## Choose the kind
40
+
41
+ | Need | Kind | Content |
42
+ | --- | --- | --- |
43
+ | Plan, spec, RCA, review notes, checklist, flow/sequence diagram | `doc` | Markdown; ```` ```mermaid ```` blocks render as diagrams |
44
+ | Freeform architecture sketch, whiteboard the human will rearrange | `diagram` | `.excalidraw` JSON |
45
+ | Interactive page: chart, calculator, prototype, dashboard, board | `html` | One standalone HTML document |
46
+
47
+ Prefer `doc` with mermaid when the diagram follows from structure (flows, states,
48
+ sequences, ER). Use `diagram` when layout matters or the human will draw on it.
49
+
50
+ ## Create, read, update
51
+
52
+ - MCP: `pad_create({kind, title, content?, project?, tags?})` → id, revision, link.
53
+ Give the human the link. Pads link to the current agent session by default
54
+ (`link_session:false` to skip); `project` is optional.
55
+ - `pad_list({project?, session:"current", kind?, q?})` finds pads; `pad_get({id})`
56
+ returns the header then the raw file.
57
+ - `pad_update({id, content, if_revision})` replaces the whole file. Always pass the
58
+ revision from your last `pad_get`: the human may have edited it. On a mismatch,
59
+ re-read, merge their change and retry; never drop their edit.
60
+ - Large content: create empty, then `pad_update({id, via:"url", if_revision})` and
61
+ `curl -T file <upload_url>`; read with `pad_get({id, via:"url"})`. The upload URL
62
+ only replaces content: change title, tags or project in a separate `pad_update`.
63
+ A stale `if_revision` is refused when minting, and an upload after someone else's
64
+ save is refused with 409.
65
+ - CLI: `orc pad ls|show|new <kind> <title> -f file|pull <id> [file]|push <id> <file> -r <rev>|rm`.
66
+ `pull` then `push -r` is the safe edit loop for a local file.
67
+ - Deleting is permanent; delete only pads you created or were told to remove.
68
+
69
+ ## Plans and docs (`doc`)
70
+
71
+ Write normal Markdown: headings, task lists (`- [ ]`), tables, code. For a living
72
+ plan, keep a short "Status" section at the top and append a dated log rather than
73
+ rewriting history. Diagrams:
74
+
75
+ ````markdown
76
+ ```mermaid
77
+ flowchart LR
78
+ A[Request] --> B{Cached?}
79
+ B -- yes --> C[Return]
80
+ B -- no --> D[Fetch] --> C
81
+ ```
82
+ ````
83
+
84
+ Keep each mermaid block small and valid; one broken block shows an error in place.
85
+
86
+ ## Diagrams (`diagram`)
87
+
88
+ Content is an Excalidraw file. Omit content for an empty canvas the human draws on.
89
+ A minimal file:
90
+
91
+ ```json
92
+ {"type":"excalidraw","version":2,"elements":[
93
+ {"id":"api","type":"rectangle","x":0,"y":0,"width":160,"height":60},
94
+ {"id":"api-label","type":"text","x":20,"y":20,"text":"API","fontSize":20,
95
+ "containerId":"api"}
96
+ ],"appState":{}}
97
+ ```
98
+
99
+ Give elements stable ids so later updates can change them in place. Read the current
100
+ file before editing; the human may have moved things. Image export (PNG/SVG) is a
101
+ human action in the UI.
102
+
103
+ ## Interactive pages (`html`)
104
+
105
+ The page is one HTML document. Inline your CSS/JS or load libraries from a CDN with a
106
+ pinned version and `integrity` + `crossorigin` attributes.
107
+
108
+ **Without ORC access (default).** The page runs in a sandboxed frame with an opaque
109
+ origin: scripts, forms, popups and alerts work, but it cannot read ORC's storage, use the
110
+ dashboard's credentials or navigate the dashboard. Embed the data it needs in the
111
+ page (a JSON `<script>` block or a JS constant). This is right for charts of data you
112
+ already have, prototypes and calculators.
113
+
114
+ **With ORC access.** Only the human can grant it, per view, with "Render with ORC
115
+ access". The page stays in the sandbox and gets `window.orc.fetch(path, init)`; the
116
+ dashboard makes each call as that human and does not hand the page the API secret
117
+ (`path` is an API path starting with `/`, e.g. `/tasks?limit=100`; paths that leave
118
+ the API are refused; `init` takes `method`,
119
+ `headers` and a string/Blob/ArrayBuffer `body`; it returns a fetch `Response`). Access
120
+ ends when they go back to the sandbox, leave, discard to another author's version,
121
+ or anyone else edits the pad. Links the page navigates to do not get access. Write the
122
+ page so it works both ways:
123
+
124
+ ```html
125
+ <script>
126
+ const live = Boolean(window.orc);
127
+ async function loadTasks() {
128
+ if (!live) return SAMPLE_TASKS; // still useful in the sandbox
129
+ const res = await orc.fetch("/tasks?limit=100");
130
+ if (!res.ok) throw new Error(`ORC API ${res.status}`);
131
+ return (await res.json()).tasks;
132
+ }
133
+ </script>
134
+ ```
135
+
136
+ Show which mode the page is in and tell the human that live data needs "Render with
137
+ ORC access". Check routes and limits in the OpenAPI spec (`/openapi.json`) rather than
138
+ guessing. Writes (`POST`/`PATCH`) act as the human: make each one an explicit user
139
+ action in the page, never a side effect of loading. Never put secrets or tokens in a
140
+ pad, and never ask the human to grant access to a page they have not looked at.
@@ -74,6 +74,8 @@ state owner and module responsibilities before implementation. Compare alternati
74
74
  only when a consequential choice is unresolved. A focused prototype can settle an
75
75
  empirical fork; several competing implementations are not mandatory. Keep sketches
76
76
  in the existing plan/handoff; do not add empty production scaffolding by default.
77
+ When the human should review, comment on or reshape a plan, design or diagram, put it
78
+ in an ORC scratchpad and share its link (`orc-platform`, scratchpads reference).
77
79
 
78
80
  Map each criterion to the relevant implementation step and verification evidence.
79
81
  Trace affected public contracts, callers, stored state and version compatibility;
@@ -1,4 +1,4 @@
1
- import{r as b,j as e,m as J,n as X,o as Z,p as M,I,B as k,W as B,O as ee,a as te,u as Y,b as T,L as ae,a7 as ne,a8 as se,a9 as re,aa as ie,ab as oe,ac as de,D as U,d as D}from"./index-C_jtMgr7.js";import{p as le,i as q}from"./public-api-BvD4z7ja.js";import{C as ce}from"./ConfirmDialog-CrSa87VF.js";import{E as G}from"./ErrorState-BPTepwiG.js";import{V as ue}from"./ViewHeader-DXR0ZaMO.js";import{u as me}from"./useDetailRoute-j9nlwack.js";import{u as W}from"./view-params-Bm1Qf6KC.js";const z={specialist:`---
1
+ import{r as b,j as e,m as J,n as X,o as Z,p as M,I,B as k,W as B,O as ee,a as te,u as Y,b as T,L as ae,ai as ne,aj as se,ak as re,al as ie,am as oe,an as de,D as U,d as D}from"./index-Ckq9CvHb.js";import{p as le,i as q}from"./public-api-BvD4z7ja.js";import{C as ce}from"./ConfirmDialog-C_exU7Ga.js";import{E as G}from"./ErrorState-CwOWC9Qy.js";import{V as ue}from"./ViewHeader-B9EgQxZk.js";import{u as me}from"./useDetailRoute-BvTqyOr1.js";import{u as W}from"./view-params-BeBdfQW5.js";const z={specialist:`---
2
2
  name: Specialist
3
3
  description: Describe when to use this specialist
4
4
  ---
@@ -1,2 +1,2 @@
1
- import{F as y,j as t,r as v,a as N,b,d as f,B as c,T as k}from"./index-C_jtMgr7.js";import{V as S}from"./ViewHeader-DXR0ZaMO.js";function A({request:e}){var g;const[r,d]=v.useState(""),[i,l]=v.useState([]),u=N(),n=b({mutationFn:s=>f.humanRequests.respond(e.id,e.version,s),onSettled:()=>u.invalidateQueries({queryKey:["human-requests"]})}),p=b({mutationFn:()=>f.humanRequests.cancel(e.id,e.version),onSettled:()=>u.invalidateQueries({queryKey:["human-requests"]})}),o=e.status==="pending",a=(g=e.input.action)==null?void 0:g.input,m=a!=null&&a.item&&typeof a.item=="object"?a.item:void 0,h=typeof(a==null?void 0:a.threadId)=="string",x=h?{...Object.fromEntries(Object.entries(a??{}).filter(([s])=>!["threadId","turnId","itemId","startedAtMs","item","availableDecisions","proposedExecpolicyAmendment","commandActions","kind"].includes(s))),...m!=null&&m.changes?{changes:m.changes}:{}}:a;return t.jsxs("article",{"data-testid":`attention-request-${e.id}`,className:"rounded-lg border border-border bg-surface p-5 space-y-4",children:[t.jsxs("div",{className:"flex flex-wrap justify-between gap-2 text-xs text-outline",children:[t.jsxs("span",{children:[e.input.kind==="question"?"Question":"Approval"," ·"," ",e.input.origin.backend]}),t.jsx("span",{children:o?"Waiting for you":e.status==="unavailable"?"Agent unavailable":"Answered · waiting for agent delivery"})]}),t.jsx("h2",{className:"text-base font-medium whitespace-pre-wrap",children:e.input.prompt}),t.jsxs("p",{className:"text-xs text-outline break-all",children:["Session ",e.input.origin.session_id]}),e.input.action&&t.jsxs("div",{className:"space-y-2 text-sm",children:[t.jsxs("p",{children:["Host: ",t.jsx("strong",{children:e.input.action.host})," · Folder: ",e.input.action.cwd]}),t.jsxs("pre",{"data-testid":"attention-action",className:"whitespace-pre-wrap break-all rounded-md bg-background p-3 text-xs",children:[e.input.action.tool,`
1
+ import{G as y,j as t,r as v,a as N,b,d as f,B as c,T as k}from"./index-Ckq9CvHb.js";import{V as S}from"./ViewHeader-B9EgQxZk.js";function A({request:e}){var g;const[r,d]=v.useState(""),[i,l]=v.useState([]),u=N(),n=b({mutationFn:s=>f.humanRequests.respond(e.id,e.version,s),onSettled:()=>u.invalidateQueries({queryKey:["human-requests"]})}),p=b({mutationFn:()=>f.humanRequests.cancel(e.id,e.version),onSettled:()=>u.invalidateQueries({queryKey:["human-requests"]})}),o=e.status==="pending",a=(g=e.input.action)==null?void 0:g.input,m=a!=null&&a.item&&typeof a.item=="object"?a.item:void 0,h=typeof(a==null?void 0:a.threadId)=="string",x=h?{...Object.fromEntries(Object.entries(a??{}).filter(([s])=>!["threadId","turnId","itemId","startedAtMs","item","availableDecisions","proposedExecpolicyAmendment","commandActions","kind"].includes(s))),...m!=null&&m.changes?{changes:m.changes}:{}}:a;return t.jsxs("article",{"data-testid":`attention-request-${e.id}`,className:"rounded-lg border border-border bg-surface p-5 space-y-4",children:[t.jsxs("div",{className:"flex flex-wrap justify-between gap-2 text-xs text-outline",children:[t.jsxs("span",{children:[e.input.kind==="question"?"Question":"Approval"," ·"," ",e.input.origin.backend]}),t.jsx("span",{children:o?"Waiting for you":e.status==="unavailable"?"Agent unavailable":"Answered · waiting for agent delivery"})]}),t.jsx("h2",{className:"text-base font-medium whitespace-pre-wrap",children:e.input.prompt}),t.jsxs("p",{className:"text-xs text-outline break-all",children:["Session ",e.input.origin.session_id]}),e.input.action&&t.jsxs("div",{className:"space-y-2 text-sm",children:[t.jsxs("p",{children:["Host: ",t.jsx("strong",{children:e.input.action.host})," · Folder: ",e.input.action.cwd]}),t.jsxs("pre",{"data-testid":"attention-action",className:"whitespace-pre-wrap break-all rounded-md bg-background p-3 text-xs",children:[e.input.action.tool,`
2
2
  `,JSON.stringify(x&&Object.keys(x).length?x:a,null,2)]}),h&&t.jsxs("details",{className:"text-xs text-outline",children:[t.jsx("summary",{className:"cursor-pointer",children:"Full request details"}),t.jsx("pre",{className:"whitespace-pre-wrap break-all mt-2",children:JSON.stringify(a,null,2)})]}),t.jsx("p",{className:"text-outline",children:"Your approval lets this agent continue with its existing permissions."})]}),o&&e.input.kind==="question"&&t.jsxs("form",{className:"space-y-3",onSubmit:s=>{s.preventDefault(),n.mutate({kind:"question",answer:r,...i.length?{selected_choices:i}:{}})},children:[t.jsx("div",{className:"flex flex-wrap gap-2",children:e.input.choices.map(s=>t.jsxs(c,{variant:(e.input.multi_select?i.includes(s):r===s)?"default":"outline",type:"button",className:"h-auto min-h-9 flex-col items-start whitespace-normal text-left",disabled:n.isPending,"data-testid":`attention-choice-${s}`,onClick:()=>{if(e.input.multi_select){const j=i.includes(s)?i.filter(w=>w!==s):[...i,s];l(j),d(j.join(", "))}else d(s)},children:[t.jsx("span",{children:s}),Object.keys(e.input.choice_descriptions).includes(s)&&e.input.choice_descriptions[s]&&t.jsx("span",{className:"text-xs font-normal opacity-75 max-w-sm",children:e.input.choice_descriptions[s]})]},s))}),t.jsxs("label",{htmlFor:`answer-${e.id}`,className:"block text-sm space-y-2",children:[t.jsx("span",{children:"Your answer"}),t.jsx(k,{id:`answer-${e.id}`,"data-testid":"attention-answer",value:r,onChange:s=>{d(s.target.value),l([])},maxLength:16e3,disabled:n.isPending})]}),t.jsx(c,{"data-testid":"attention-send",type:"submit",disabled:!r.trim()||n.isPending,children:n.isPending?"Sending…":"Send answer"})]}),o&&e.input.kind==="approval"&&t.jsxs("div",{className:"flex gap-3",children:[t.jsx(c,{"data-testid":"attention-approve",disabled:n.isPending,onClick:()=>n.mutate({kind:"approval",approved:!0}),children:"Approve"}),t.jsx(c,{"data-testid":"attention-deny",variant:"outline",disabled:n.isPending,onClick:()=>n.mutate({kind:"approval",approved:!1}),children:"Deny"})]}),e.response&&t.jsx("p",{"data-testid":"attention-response",className:"text-sm whitespace-pre-wrap",children:e.response.kind==="question"?e.response.answer:e.response.approved?"Approved":"Denied"}),e.delivery_error&&t.jsx("p",{role:"status",className:"text-sm text-error",children:e.delivery_error}),(o||e.status==="unavailable")&&t.jsx(c,{"data-testid":"attention-cancel",variant:"ghost",disabled:n.isPending||p.isPending,onClick:()=>p.mutate(),children:o?"Cancel request":"Dismiss"}),p.error&&t.jsx("p",{role:"alert",children:p.error.message}),n.error&&t.jsx("p",{role:"alert","data-testid":"attention-error",className:"text-sm text-destructive",children:n.error.message})]})}function P(){var r,d,i;const e=y();return t.jsxs("div",{"data-testid":"attention-view",className:"max-w-4xl",children:[t.jsx(S,{title:"Attention needed",meta:"Questions and approvals from your agents"}),e.isLoading&&t.jsx("p",{role:"status",children:"Loading requests…"}),e.error&&t.jsx("p",{role:"alert",children:e.error.message}),((r=e.data)==null?void 0:r.length)===0&&t.jsx("p",{"data-testid":"attention-empty",className:"text-outline",children:"Nothing needs your attention."}),((d=e.data)==null?void 0:d.length)===100&&t.jsx("p",{className:"text-sm text-outline mb-4",children:"Showing the first 100 requests, with pending requests first. Resolving or dismissing entries reveals more."}),t.jsx("div",{className:"space-y-4",children:(i=e.data)==null?void 0:i.map(l=>t.jsx(A,{request:l},l.id))})]})}export{P as default};
@@ -1 +1 @@
1
- import{j as e,a8 as T,a9 as L,aa as P,ab as R,ac as $,S,ae as O,y as h,r as w,af as A,E as I,X as V}from"./index-C_jtMgr7.js";import{E as H}from"./EmptyState-Ctm7L70B.js";import{E as k}from"./ErrorState-BPTepwiG.js";import{P as z}from"./Pager-ClYYU9et.js";import{S as y}from"./scroll-area-CU4DGUBA.js";import{a as B,b as U}from"./useSessions-BrdK-12R.js";import{T as F,a as J,b as v,c,d as G,e as x}from"./table-D3N_5Wee.js";import{u as M}from"./useDetailRoute-j9nlwack.js";import{u as X}from"./view-params-Bm1Qf6KC.js";import{V as Y}from"./ViewHeader-DXR0ZaMO.js";import{u as Z}from"./useProjectScope-Dk0mjyHf.js";const q={file:"text-outline",task:"text-outline",decision:"text-outline",error:"text-error",git:"text-outline",rule:"text-outline",plan:"text-outline"},K="text-outline";function Q(n){return q[n]??K}function W({sessionId:n,open:a,onClose:r}){const{data:t,isLoading:u,error:p,refetch:j}=B(n??"");return e.jsx(T,{open:a,onOpenChange:o=>!o&&r(),children:e.jsxs(L,{side:"right",className:"w-[540px] max-w-[90vw]",children:[e.jsx(P,{children:e.jsx(R,{children:u?"Loading...":t?`${t.agent??"Session"} ${t.agent_version?`v${t.agent_version}`:""}`:"Session Detail"})}),e.jsxs($,{children:[e.jsx("p",{className:"mb-4 text-sm text-outline",children:"This audit record contains summaries and events. Open Sessions to read native agent conversations or resume them."}),p?e.jsx(k,{message:p.message,onRetry:()=>j()}):u?e.jsx("div",{className:"space-y-4",children:[...Array(4)].map((o,i)=>e.jsx(S,{className:"h-8 w-full bg-surface-highest"},i))}):t?e.jsxs("div",{className:"space-y-6",children:[t.summary&&e.jsx("div",{className:"font-body text-xs text-on-surface leading-relaxed",children:e.jsx(O,{children:t.summary})}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsx(h,{label:"ID",children:e.jsx("span",{className:"font-mono text-xs break-all",children:t.id})}),e.jsx(h,{label:"Project ID",children:t.project_id??"—"}),e.jsx(h,{label:"Job Run ID",children:t.job_run_id??"—"}),e.jsx(h,{label:"Tokens Used",children:t.tokens_used!=null?t.tokens_used.toLocaleString():"—"}),e.jsx(h,{label:"Created",children:new Date(t.created_at).toLocaleString()})]}),t.events.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"font-label text-xs font-medium text-outline mb-3",children:["Events (",t.events.length,")"]}),e.jsx(y,{className:"h-[300px]",children:e.jsx("div",{className:"space-y-1",children:[...t.events].sort((o,i)=>new Date(o.created_at).getTime()-new Date(i.created_at).getTime()).map(o=>e.jsx(ee,{event:o},o.id))})})]}),t.snapshot&&e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-xs font-medium text-outline mb-3",children:"Snapshot"}),e.jsx(y,{className:"h-[200px]",children:e.jsx("pre",{className:"font-mono text-xs text-on-surface-variant whitespace-pre-wrap break-words bg-background border-l border-border p-3",children:t.snapshot})})]})]}):e.jsx("div",{className:"font-body text-xs text-outline py-8 text-center",children:"Session not found"})]})]})})}function ee({event:n}){const[a,r]=w.useState(!1),t=n.data!=null;return e.jsxs("div",{className:"border-b border-border/65",children:[e.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-surface-high transition-colors",onClick:()=>t&&r(!a),"aria-expanded":t?a:void 0,children:[t?a?e.jsx(A,{size:10,className:"text-outline flex-shrink-0"}):e.jsx(I,{size:10,className:"text-outline flex-shrink-0"}):e.jsx("span",{className:"w-[10px] flex-shrink-0"}),e.jsx("span",{className:`inline-flex items-center px-1.5 py-0.5 text-[10px] font-label font-medium ${Q(n.type)}`,children:n.type}),e.jsx("span",{className:"flex-1 font-body text-xs text-outline truncate",children:se(n.data)}),e.jsx("span",{className:"font-label text-[10px] text-outline flex-shrink-0",children:new Date(n.created_at).toLocaleTimeString()})]}),a&&t&&e.jsx("div",{className:"px-3 pb-2",children:e.jsx("pre",{className:"font-mono text-xs text-on-surface-variant whitespace-pre-wrap break-words bg-background border-l border-border/65 p-2 max-h-48 overflow-auto",children:JSON.stringify(n.data,null,2)})})]})}function se(n){if(n==null)return"";if(typeof n=="string")return n;if(typeof n=="object"){const a=n;if(typeof a.path=="string")return a.path;if(typeof a.content=="string")return a.content.length>80?`${a.content.slice(0,80)}...`:a.content;if(typeof a.message=="string")return a.message;if(typeof a.summary=="string")return a.summary;const r=Object.keys(a);return r.length<=3?r.join(", "):`${r.length} fields`}return String(n)}const b=25,m="font-label text-xs font-medium text-outline";function te({projectId:n}){const a=V("sm"),[r,t]=X("order","desc",["asc","desc"]),[u,p]=w.useState({order:r,page:0}),j=u.order===r?u.page:0,o=s=>p({order:r,page:s}),{selectedId:i,openDetail:f,closeDetail:_}=M("/audit","sessionId"),{data:l,isLoading:E,error:N,refetch:D}=U({...n==="all"?{}:{project_id:n},limit:b,offset:j*b,order:r});if(N)return e.jsx(k,{message:N.message,onRetry:()=>D()});const g=(l==null?void 0:l.sessions)??[],C=(l==null?void 0:l.total)??0;return e.jsxs("section",{"data-testid":"logged-sessions",children:[e.jsx("div",{className:"mb-4 flex justify-end",children:e.jsxs("select",{"aria-label":"Sort audit by date","data-testid":"audit-date-sort",value:r,onChange:s=>{o(0),t(s.target.value)},className:"min-h-11 rounded-md border border-control-border bg-background px-3 text-sm text-on-surface",children:[e.jsx("option",{value:"desc",children:"Created: newest first"}),e.jsx("option",{value:"asc",children:"Created: oldest first"})]})}),E?e.jsx("div",{className:"space-y-2",children:[...Array(5)].map((s,d)=>e.jsx(S,{className:"h-10 w-full bg-surface-highest"},d))}):g.length===0?e.jsx(H,{message:"No audit records"}):e.jsxs("div",{className:"min-w-0 overflow-hidden",children:[a?e.jsxs(F,{children:[e.jsx(J,{children:e.jsxs(v,{className:"border-b border-border hover:bg-transparent",children:[e.jsx(c,{className:m,children:"Agent"}),e.jsx(c,{className:`${m} w-24`,children:"Version"}),e.jsx(c,{className:m,children:"Summary"}),e.jsx(c,{className:`${m} w-24`,children:"Project"}),e.jsx(c,{className:`${m} w-28`,children:"Tokens Used"}),e.jsx(c,{className:`${m} w-36`,children:"Created"})]})}),e.jsx(G,{children:g.map(s=>e.jsxs(v,{"data-testid":"session-row","data-session-id":s.id,className:"border-b border-border/65 hover:bg-surface-high cursor-pointer",onClick:()=>f(s.id),children:[e.jsx(x,{className:"font-label text-xs text-primary",children:e.jsx("button",{type:"button",className:"text-left font-medium hover:underline",onClick:d=>{d.stopPropagation(),f(s.id)},children:s.agent??"Session"})}),e.jsx(x,{className:"font-label text-xs text-outline",children:s.agent_version??"—"}),e.jsx(x,{className:"font-body text-xs text-on-surface-variant max-w-sm truncate",children:s.summary??"—"}),e.jsx(x,{className:"font-label text-xs text-outline",children:s.project_id?s.project_id.slice(-6):"—"}),e.jsx(x,{className:"font-label text-xs text-outline text-right",children:s.tokens_used!=null?s.tokens_used.toLocaleString():"—"}),e.jsx(x,{className:"font-label text-xs text-outline",children:new Date(s.created_at).toLocaleString()})]},s.id))})]}):e.jsx("div",{className:"divide-y divide-border",children:g.map(s=>{var d;return e.jsxs("article",{"data-testid":"session-row","data-session-id":s.id,className:"py-4 space-y-3",children:[e.jsx("button",{type:"button",className:"min-h-11 text-sm text-left font-medium text-primary break-words",onClick:()=>f(s.id),children:s.agent??"Session"}),e.jsx("p",{className:"text-sm leading-relaxed text-on-surface break-words",children:s.summary??"No summary recorded"}),e.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-2 text-xs text-outline",children:[e.jsxs("span",{children:["Version ",s.agent_version??"—"]}),e.jsxs("span",{children:[((d=s.tokens_used)==null?void 0:d.toLocaleString())??"—"," tokens"]}),e.jsx("span",{children:s.project_id?`Project ${s.project_id.slice(-6)}`:"Unassigned"}),e.jsx("span",{children:new Date(s.created_at).toLocaleString()})]})]},s.id)})}),e.jsx(z,{page:j,pageSize:b,total:C,onPage:o})]}),e.jsx(W,{sessionId:i,open:!!i,onClose:_})]})}function he({projectId:n}){const a=Z(n);return e.jsxs("div",{children:[e.jsx(Y,{title:"Audit"}),e.jsx("p",{className:"mb-4 text-sm text-outline",children:"Recorded summaries and events. Open Sessions to read conversations or resume a coding agent."}),e.jsx(te,{projectId:a},a)]})}export{he as default};
1
+ import{j as e,aj as T,ak as L,al as P,am as R,an as $,S,ap as O,y as h,r as w,ad as A,F as I,Y as V}from"./index-Ckq9CvHb.js";import{E as H}from"./EmptyState-BVLws_BR.js";import{E as k}from"./ErrorState-CwOWC9Qy.js";import{P as z}from"./Pager-BNTTeR5A.js";import{S as y}from"./scroll-area-CUm8aggx.js";import{a as B,b as U}from"./useSessions-BL5wWTxP.js";import{T as F,a as J,b as v,c,d as Y,e as x}from"./table-DTKUFFYV.js";import{u as G}from"./useDetailRoute-BvTqyOr1.js";import{u as M}from"./view-params-BeBdfQW5.js";import{V as Z}from"./ViewHeader-B9EgQxZk.js";import{u as q}from"./useProjectScope-C3iwCwG_.js";const K={file:"text-outline",task:"text-outline",decision:"text-outline",error:"text-error",git:"text-outline",rule:"text-outline",plan:"text-outline"},Q="text-outline";function W(n){return K[n]??Q}function X({sessionId:n,open:a,onClose:r}){const{data:t,isLoading:u,error:p,refetch:j}=B(n??"");return e.jsx(T,{open:a,onOpenChange:o=>!o&&r(),children:e.jsxs(L,{side:"right",className:"w-[540px] max-w-[90vw]",children:[e.jsx(P,{children:e.jsx(R,{children:u?"Loading...":t?`${t.agent??"Session"} ${t.agent_version?`v${t.agent_version}`:""}`:"Session Detail"})}),e.jsxs($,{children:[e.jsx("p",{className:"mb-4 text-sm text-outline",children:"This audit record contains summaries and events. Open Sessions to read native agent conversations or resume them."}),p?e.jsx(k,{message:p.message,onRetry:()=>j()}):u?e.jsx("div",{className:"space-y-4",children:[...Array(4)].map((o,i)=>e.jsx(S,{className:"h-8 w-full bg-surface-highest"},i))}):t?e.jsxs("div",{className:"space-y-6",children:[t.summary&&e.jsx("div",{className:"font-body text-xs text-on-surface leading-relaxed",children:e.jsx(O,{children:t.summary})}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsx(h,{label:"ID",children:e.jsx("span",{className:"font-mono text-xs break-all",children:t.id})}),e.jsx(h,{label:"Project ID",children:t.project_id??"—"}),e.jsx(h,{label:"Job Run ID",children:t.job_run_id??"—"}),e.jsx(h,{label:"Tokens Used",children:t.tokens_used!=null?t.tokens_used.toLocaleString():"—"}),e.jsx(h,{label:"Created",children:new Date(t.created_at).toLocaleString()})]}),t.events.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"font-label text-xs font-medium text-outline mb-3",children:["Events (",t.events.length,")"]}),e.jsx(y,{className:"h-[300px]",children:e.jsx("div",{className:"space-y-1",children:[...t.events].sort((o,i)=>new Date(o.created_at).getTime()-new Date(i.created_at).getTime()).map(o=>e.jsx(ee,{event:o},o.id))})})]}),t.snapshot&&e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-xs font-medium text-outline mb-3",children:"Snapshot"}),e.jsx(y,{className:"h-[200px]",children:e.jsx("pre",{className:"font-mono text-xs text-on-surface-variant whitespace-pre-wrap break-words bg-background border-l border-border p-3",children:t.snapshot})})]})]}):e.jsx("div",{className:"font-body text-xs text-outline py-8 text-center",children:"Session not found"})]})]})})}function ee({event:n}){const[a,r]=w.useState(!1),t=n.data!=null;return e.jsxs("div",{className:"border-b border-border/65",children:[e.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-surface-high transition-colors",onClick:()=>t&&r(!a),"aria-expanded":t?a:void 0,children:[t?a?e.jsx(A,{size:10,className:"text-outline flex-shrink-0"}):e.jsx(I,{size:10,className:"text-outline flex-shrink-0"}):e.jsx("span",{className:"w-[10px] flex-shrink-0"}),e.jsx("span",{className:`inline-flex items-center px-1.5 py-0.5 text-[10px] font-label font-medium ${W(n.type)}`,children:n.type}),e.jsx("span",{className:"flex-1 font-body text-xs text-outline truncate",children:se(n.data)}),e.jsx("span",{className:"font-label text-[10px] text-outline flex-shrink-0",children:new Date(n.created_at).toLocaleTimeString()})]}),a&&t&&e.jsx("div",{className:"px-3 pb-2",children:e.jsx("pre",{className:"font-mono text-xs text-on-surface-variant whitespace-pre-wrap break-words bg-background border-l border-border/65 p-2 max-h-48 overflow-auto",children:JSON.stringify(n.data,null,2)})})]})}function se(n){if(n==null)return"";if(typeof n=="string")return n;if(typeof n=="object"){const a=n;if(typeof a.path=="string")return a.path;if(typeof a.content=="string")return a.content.length>80?`${a.content.slice(0,80)}...`:a.content;if(typeof a.message=="string")return a.message;if(typeof a.summary=="string")return a.summary;const r=Object.keys(a);return r.length<=3?r.join(", "):`${r.length} fields`}return String(n)}const b=25,m="font-label text-xs font-medium text-outline";function te({projectId:n}){const a=V("sm"),[r,t]=M("order","desc",["asc","desc"]),[u,p]=w.useState({order:r,page:0}),j=u.order===r?u.page:0,o=s=>p({order:r,page:s}),{selectedId:i,openDetail:f,closeDetail:_}=G("/audit","sessionId"),{data:l,isLoading:D,error:N,refetch:E}=U({...n==="all"?{}:{project_id:n},limit:b,offset:j*b,order:r});if(N)return e.jsx(k,{message:N.message,onRetry:()=>E()});const g=(l==null?void 0:l.sessions)??[],C=(l==null?void 0:l.total)??0;return e.jsxs("section",{"data-testid":"logged-sessions",children:[e.jsx("div",{className:"mb-4 flex justify-end",children:e.jsxs("select",{"aria-label":"Sort audit by date","data-testid":"audit-date-sort",value:r,onChange:s=>{o(0),t(s.target.value)},className:"min-h-11 rounded-md border border-control-border bg-background px-3 text-sm text-on-surface",children:[e.jsx("option",{value:"desc",children:"Created: newest first"}),e.jsx("option",{value:"asc",children:"Created: oldest first"})]})}),D?e.jsx("div",{className:"space-y-2",children:[...Array(5)].map((s,d)=>e.jsx(S,{className:"h-10 w-full bg-surface-highest"},d))}):g.length===0?e.jsx(H,{message:"No audit records"}):e.jsxs("div",{className:"min-w-0 overflow-hidden",children:[a?e.jsxs(F,{children:[e.jsx(J,{children:e.jsxs(v,{className:"border-b border-border hover:bg-transparent",children:[e.jsx(c,{className:m,children:"Agent"}),e.jsx(c,{className:`${m} w-24`,children:"Version"}),e.jsx(c,{className:m,children:"Summary"}),e.jsx(c,{className:`${m} w-24`,children:"Project"}),e.jsx(c,{className:`${m} w-28`,children:"Tokens Used"}),e.jsx(c,{className:`${m} w-36`,children:"Created"})]})}),e.jsx(Y,{children:g.map(s=>e.jsxs(v,{"data-testid":"session-row","data-session-id":s.id,className:"border-b border-border/65 hover:bg-surface-high cursor-pointer",onClick:()=>f(s.id),children:[e.jsx(x,{className:"font-label text-xs text-primary",children:e.jsx("button",{type:"button",className:"text-left font-medium hover:underline",onClick:d=>{d.stopPropagation(),f(s.id)},children:s.agent??"Session"})}),e.jsx(x,{className:"font-label text-xs text-outline",children:s.agent_version??"—"}),e.jsx(x,{className:"font-body text-xs text-on-surface-variant max-w-sm truncate",children:s.summary??"—"}),e.jsx(x,{className:"font-label text-xs text-outline",children:s.project_id?s.project_id.slice(-6):"—"}),e.jsx(x,{className:"font-label text-xs text-outline text-right",children:s.tokens_used!=null?s.tokens_used.toLocaleString():"—"}),e.jsx(x,{className:"font-label text-xs text-outline",children:new Date(s.created_at).toLocaleString()})]},s.id))})]}):e.jsx("div",{className:"divide-y divide-border",children:g.map(s=>{var d;return e.jsxs("article",{"data-testid":"session-row","data-session-id":s.id,className:"py-4 space-y-3",children:[e.jsx("button",{type:"button",className:"min-h-11 text-sm text-left font-medium text-primary break-words",onClick:()=>f(s.id),children:s.agent??"Session"}),e.jsx("p",{className:"text-sm leading-relaxed text-on-surface break-words",children:s.summary??"No summary recorded"}),e.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-2 text-xs text-outline",children:[e.jsxs("span",{children:["Version ",s.agent_version??"—"]}),e.jsxs("span",{children:[((d=s.tokens_used)==null?void 0:d.toLocaleString())??"—"," tokens"]}),e.jsx("span",{children:s.project_id?`Project ${s.project_id.slice(-6)}`:"Unassigned"}),e.jsx("span",{children:new Date(s.created_at).toLocaleString()})]})]},s.id)})}),e.jsx(z,{page:j,pageSize:b,total:C,onPage:o})]}),e.jsx(X,{sessionId:i,open:!!i,onClose:_})]})}function he({projectId:n}){const a=q(n);return e.jsxs("div",{children:[e.jsx(Z,{title:"Audit"}),e.jsx("p",{className:"mb-4 text-sm text-outline",children:"Recorded summaries and events. Open Sessions to read conversations or resume a coding agent."}),e.jsx(te,{projectId:a},a)]})}export{he as default};
@@ -1 +1 @@
1
- import{j as e,D as d,m,n as b,o as g,U as h,x as f,B as s}from"./index-C_jtMgr7.js";function j({open:a,onConfirm:o,onCancel:t,title:i,description:l,confirmLabel:n="Delete",variant:c="destructive",isPending:r}){return e.jsx(d,{open:a,onOpenChange:x=>!x&&t(),children:e.jsxs(m,{className:"bg-surface border-surface-highest max-w-sm",children:[e.jsxs(b,{children:[e.jsx(g,{className:"font-headline text-sm text-on-surface",children:i}),e.jsx(h,{className:"font-body text-xs text-outline mt-2",children:l})]}),e.jsxs(f,{className:"mt-4",children:[e.jsx(s,{"data-testid":"confirm-dialog-cancel",type:"button",variant:"ghost",size:"sm",onClick:t,className:"font-label text-xs text-outline",children:"Cancel"}),e.jsx(s,{"data-testid":"confirm-dialog-confirm",type:"button",size:"sm",onClick:o,disabled:r,className:c==="destructive"?"font-label text-xs bg-error/15 text-error border border-error/30 hover:bg-error/25":"font-label text-xs bg-tertiary/15 text-tertiary border border-tertiary/30 hover:bg-tertiary/25",children:r?"...":n})]})]})})}export{j as C};
1
+ import{j as e,D as d,m,n as b,o as g,U as h,x as f,B as s}from"./index-Ckq9CvHb.js";function j({open:a,onConfirm:o,onCancel:t,title:i,description:l,confirmLabel:n="Delete",variant:c="destructive",isPending:r}){return e.jsx(d,{open:a,onOpenChange:x=>!x&&t(),children:e.jsxs(m,{className:"bg-surface border-surface-highest max-w-sm",children:[e.jsxs(b,{children:[e.jsx(g,{className:"font-headline text-sm text-on-surface",children:i}),e.jsx(h,{className:"font-body text-xs text-outline mt-2",children:l})]}),e.jsxs(f,{className:"mt-4",children:[e.jsx(s,{"data-testid":"confirm-dialog-cancel",type:"button",variant:"ghost",size:"sm",onClick:t,className:"font-label text-xs text-outline",children:"Cancel"}),e.jsx(s,{"data-testid":"confirm-dialog-confirm",type:"button",size:"sm",onClick:o,disabled:r,className:c==="destructive"?"font-label text-xs bg-error/15 text-error border border-error/30 hover:bg-error/25":"font-label text-xs bg-tertiary/15 text-tertiary border border-tertiary/30 hover:bg-tertiary/25",children:r?"...":n})]})]})})}export{j as C};
@@ -0,0 +1 @@
1
+ import{J as E,Y as J,Z as U,e as V,M as I,j as t,S as Q}from"./index-Ckq9CvHb.js";import{E as q}from"./ErrorState-CwOWC9Qy.js";import{P as T}from"./PriorityBadge-DHoaJR_M.js";import{R as H}from"./ResumeActions-RtezaXDE.js";import{S}from"./StatusBadge-Cq2xO_SU.js";import{T as W,a as z,b as L,c as h,d as O,e as p}from"./table-DTKUFFYV.js";import{u as Y}from"./useJobs-rLcb_CgS.js";import{u as Z}from"./useMemories-7v8TIl7-.js";import{u as F}from"./useProjectScope-C3iwCwG_.js";import{u as G}from"./useSessions-BL5wWTxP.js";import{f as K,S as $}from"./live-sessions-C4qBcPbR.js";import"./copy-DsS5X55x.js";function l(d,v){return d.isLoading?"…":d.error?"—":v}function us({projectId:d}){var f,_;const v=E(),a=F(d),D=J("sm"),i=s=>{const e=new URL(s,window.location.origin);e.searchParams.set("project",a),v({pathname:e.pathname,search:e.search,hash:e.hash})},o=a==="all"||a==="unassigned"?void 0:{project_id:a},c=U(o),{data:b,isLoading:P}=c,u=Y(o),{data:N}=u,m=Z({project_id:o==null?void 0:o.project_id,limit:1},{enabled:a!=="unassigned"}),R=a==="unassigned"?0:((f=m.data)==null?void 0:f.total)??0,{data:n}=V(),j=G(!0),g=(j.data??[]).filter(s=>a==="all"||(a==="unassigned"?s.project_id===null:s.project_id===a)),w=a==="unassigned"?(N??[]).filter(s=>s.project_id===null):N??[],k=a==="unassigned"?(b??[]).filter(s=>s.project_id===null):b??[],r=k.reduce((s,e)=>(s[e.status]=(s[e.status]??0)+1,s),{}),y=[...k].sort((s,e)=>new Date(e.updated_at).getTime()-new Date(s.updated_at).getTime()).slice(0,8),x=w.filter(s=>s.enabled),A=a==="all"?"All Projects":a==="unassigned"?"Unassigned":((_=n==null?void 0:n.find(s=>s.id===a))==null?void 0:_.name)??"",M=[{label:"Doing",value:l(c,r.doing??0),sub:"in progress",path:"/tasks?view=table&status=doing"},{label:"Review",value:l(c,r.review??0),sub:"awaiting review",path:"/tasks?view=table&status=review"},{label:"Blocked",value:l(c,r.blocked??0),sub:"needs attention",path:"/tasks?view=table&status=blocked"},{label:"Todo",value:l(c,(r.todo??0)+(r.queued??0)),sub:"pending",path:"/tasks?view=board"},{label:"Done",value:l(c,r.done??0),sub:"completed",path:"/tasks?view=table&status=done"}],B=[{label:"Active jobs",value:l(u,x.length),sub:`of ${w.length} total`,path:"/jobs"},{label:"Memories",value:l(m,R),sub:"in this scope",path:I},{label:"Projects",value:(n??[]).filter(s=>s.status==="active").length,sub:"active across workspace",path:"/projects"}];return t.jsxs("div",{"data-activity-preview":!0,"data-testid":"activity-preview",className:"activity-preview",children:[t.jsxs("div",{className:"activity-heading",children:[t.jsxs("div",{children:[t.jsx("h1",{"data-testid":"view-title",children:"Activity"}),t.jsx("p",{"data-testid":"view-meta",children:A||"All projects"})]}),t.jsx("button",{type:"button",className:"activity-primary",onClick:()=>i("/tasks"),children:"View tasks"})]}),[c,u,m,j].some(s=>s.isLoading)&&t.jsx("p",{role:"status",className:"activity-muted mb-4",children:"Loading activity…"}),[{name:"Tasks",query:c},{name:"Jobs",query:u},{name:"Memories",query:m},{name:"Sessions",query:j}].filter(({query:s})=>s.error).map(({name:s,query:e})=>{var C;return t.jsx(q,{message:`${s}: ${((C=e.error)==null?void 0:C.message)??"Could not load activity"}`,onRetry:()=>e.refetch()},s)}),t.jsx("section",{className:"activity-metrics","aria-label":"Task summary",children:M.map(s=>t.jsxs("button",{type:"button","data-testid":"stat-card","data-stat-label":s.label,className:"activity-metric",onClick:()=>i(s.path),children:[t.jsx("span",{className:"activity-metric-label",children:s.label}),t.jsx("span",{"data-testid":"stat-card-value",className:"activity-metric-value",children:s.value}),t.jsx("span",{className:"activity-metric-sub",children:s.sub})]},s.label))}),t.jsx("section",{className:"activity-resources","aria-label":"Workspace summary",children:B.map(s=>t.jsxs("button",{type:"button","data-testid":"stat-card","data-stat-label":s.label,onClick:()=>i(s.path),children:[t.jsx("span",{children:s.label}),t.jsx("span",{"data-testid":"stat-card-value",className:"activity-resource-value",children:s.value}),t.jsx("span",{className:"activity-resource-sub",children:s.sub})]},s.label))}),t.jsxs("section",{className:"activity-section",children:[t.jsxs("div",{className:"activity-section-heading",children:[t.jsx("h2",{children:"Recent tasks"}),t.jsx("button",{type:"button",className:"activity-text-action",onClick:()=>i("/tasks"),children:"View all"})]}),P?t.jsx("div",{className:"space-y-2",children:[0,1,2,3].map(s=>t.jsx(Q,{className:"h-10 w-full"},s))}):y.length===0?t.jsx("p",{className:"activity-empty",children:"No tasks"}):D?t.jsxs(W,{className:"activity-task-table",children:[t.jsx(z,{children:t.jsxs(L,{children:[t.jsx(h,{children:"Task"}),t.jsx(h,{className:"w-36",children:"Status"}),t.jsx(h,{className:"w-28",children:"Priority"}),t.jsx(h,{className:"w-28",children:"Updated"})]})}),t.jsx(O,{children:y.map(s=>t.jsxs(L,{onClick:()=>i(`/tasks/${s.id}`),children:[t.jsx(p,{children:t.jsx("button",{type:"button",className:"activity-task-title",onClick:e=>{e.stopPropagation(),i(`/tasks/${s.id}`)},children:s.title})}),t.jsx(p,{children:t.jsx("span",{className:"activity-status","data-status":s.status,children:t.jsx(S,{status:s.status})})}),t.jsx(p,{children:t.jsx("span",{className:"activity-priority",children:t.jsx(T,{priority:s.priority})})}),t.jsx(p,{className:"activity-muted",children:new Date(s.updated_at).toLocaleDateString()})]},s.id))})]}):t.jsx("div",{className:"activity-task-list",children:y.map(s=>t.jsxs("article",{className:"activity-task-mobile",children:[t.jsx("button",{type:"button",className:"activity-task-title",onClick:()=>i(`/tasks/${s.id}`),children:s.title}),t.jsxs("div",{className:"activity-task-meta",children:[t.jsx("span",{className:"activity-status","data-status":s.status,children:t.jsx(S,{status:s.status})}),t.jsx("span",{className:"activity-priority",children:t.jsx(T,{priority:s.priority})}),t.jsx("span",{children:new Date(s.updated_at).toLocaleDateString()})]})]},s.id))})]}),t.jsxs("div",{className:"activity-secondary",children:[x.length>0&&t.jsxs("section",{className:"activity-section",children:[t.jsxs("div",{className:"activity-section-heading",children:[t.jsx("h2",{children:"Active jobs"}),t.jsx("button",{type:"button",className:"activity-text-action",onClick:()=>i("/jobs"),children:"View all"})]}),t.jsx("div",{className:"activity-row-list",children:x.slice(0,5).map(s=>t.jsxs("button",{type:"button",className:"activity-row",onClick:()=>i(`/jobs/${s.id}`),children:[t.jsxs("span",{className:"activity-row-heading",children:[t.jsx("span",{children:s.name}),t.jsx("span",{className:"activity-muted",children:s.trigger_type})]}),s.last_run_at&&t.jsxs("span",{className:"activity-row-description",children:["Last run ",new Date(s.last_run_at).toLocaleString()]})]},s.id))})]}),g.length>0&&t.jsxs("section",{className:"activity-section",children:[t.jsxs("div",{className:"activity-section-heading",children:[t.jsx("h2",{children:"Agent sessions"}),t.jsx("button",{type:"button",className:"activity-text-action",onClick:()=>i("/sessions"),children:"View all"})]}),t.jsx("div",{className:"activity-row-list",children:g.slice(0,5).map(s=>t.jsxs("div",{className:"activity-row",children:[t.jsxs("button",{type:"button",className:"w-full text-left","data-testid":"activity-session-link","data-session-id":s.id,onClick:()=>i(`/sessions?session=${encodeURIComponent(s.id)}`),children:[t.jsxs("span",{className:"activity-row-heading",children:[t.jsx("span",{children:s.name??s.agent}),t.jsx("span",{className:"activity-muted",children:K(s.last_activity_at)})]}),t.jsxs("span",{className:"activity-row-description inline-flex items-center gap-2",children:[t.jsx("span",{className:`size-1.5 rounded-full ${$[s.status].dot}`}),s.agent," · ",$[s.status].label,s.task?` · ${s.task.title}`:""]})]}),t.jsx(H,{session:s})]},s.id))})]})]}),a==="all"&&(n??[]).length>0&&t.jsxs("section",{className:"activity-section",children:[t.jsxs("div",{className:"activity-section-heading",children:[t.jsx("h2",{children:"Projects"}),t.jsx("button",{type:"button",className:"activity-text-action",onClick:()=>i("/projects"),children:"View all"})]}),t.jsx("div",{className:"activity-projects",children:(n??[]).filter(s=>s.status==="active").slice(0,6).map(s=>t.jsxs("button",{type:"button",className:"activity-row",onClick:()=>i(`/projects/${s.id}`),children:[t.jsx("span",{className:"activity-row-heading",children:s.name}),s.description&&t.jsx("span",{className:"activity-row-description",children:s.description})]},s.id))})]})]})}export{us as default};
@@ -1 +1 @@
1
- import{G as T,H as V,r as o,j as e,J as Y,B as g}from"./index-C_jtMgr7.js";const i=new Map,D=new Set;typeof window<"u"&&window.addEventListener("beforeunload",t=>{i.size&&(t.preventDefault(),t.returnValue="")});function W(t){return D.has(t)?!1:i.has(t)?window.confirm("Discard unsaved changes to this document?")?(i.delete(t),!0):!1:!0}function K({documentId:t,content:s,path:M,onSave:d,testId:N,wikiLinks:C,navigation:k,expanded:R,onExpandedChange:E,layout:F,pageTitle:q,hideFrontmatter:G}){const[H]=T(),J=V(),v=H.get("editorMode"),x=v==="edit"||v==="split"?v:"read",p=o.useRef(i.get(t)??{original:s,content:s}),[w,f]=o.useState(p.current.content),[u,j]=o.useState(p.current.original),[r,z]=o.useState(!1),[y,b]=o.useState(null),S=o.useRef(!1),l=o.useRef(p.current.content),c=w!==u;o.useEffect(()=>{i.has(t)||(f(s),l.current=s,j(s))},[s,t]);function O(a){l.current=a,f(a),a===u?i.delete(t):i.set(t,{original:u,content:a})}async function h(){if(!d||!c||S.current)return;S.current=!0,D.add(t),z(!0),b(null);const a=l.current;try{const n=await d(a,u),m=typeof n=="string"?n:a;j(m),l.current===a?(i.delete(t),l.current=m,f(m)):i.set(t,{original:m,content:l.current})}catch(n){b(n instanceof Error?n.message:"Could not save document")}finally{S.current=!1,D.delete(t),z(!1)}}function P(a){const n=new URLSearchParams(window.location.search);n.set("editorMode",a),n.toString()!==new URLSearchParams(window.location.search).toString()&&J({search:n.toString(),hash:window.location.hash})}function U(){W(t)&&(f(s),j(s),l.current=s,b(null))}const B=d?r?"Saving…":c?"Unsaved changes":"Saved":"Read-only",L=e.jsxs(e.Fragment,{children:[y&&e.jsxs("p",{role:"alert",className:"text-sm text-destructive",children:[y," Your draft has been kept."]}),c&&s!==u&&e.jsx("p",{role:"status",className:"text-sm text-outline",children:"The document changed elsewhere. Your draft is preserved; saving will check for conflicts."})]});return F==="page"?e.jsx("div",{className:"min-w-0","data-testid":"document-workspace",children:e.jsx(Y,{path:M,value:w,onChange:O,onSave:()=>void h(),readOnly:!d||r,testId:N,wikiLinks:C,initialMode:"read",mode:x,onModeChange:P,expanded:R,onExpandedChange:E,layout:"page",pageTitle:q,hideFrontmatter:G,notice:y||c&&s!==u?L:void 0,actions:(x!=="read"||c||r)&&e.jsxs(e.Fragment,{children:[e.jsx("span",{"data-testid":"document-save-status",role:"status",className:"text-xs text-outline",children:B}),d&&(c||r)&&e.jsxs(e.Fragment,{children:[e.jsx(g,{type:"button",size:"sm",variant:"ghost","data-testid":"document-discard",disabled:r,onClick:U,children:"Discard"}),e.jsx(g,{type:"button",size:"sm","data-testid":"document-save",disabled:r,onClick:()=>void h(),children:"Save"})]})]})})}):e.jsx("div",{className:"min-w-0 space-y-3","data-testid":"document-workspace",children:e.jsx(Y,{path:M,value:w,onChange:O,onSave:()=>void h(),readOnly:!d||r,testId:N,wikiLinks:C,initialMode:"read",mode:x,onModeChange:P,expanded:R,onExpandedChange:E,layout:F,header:e.jsxs("div",{className:"space-y-2",children:[k&&e.jsx("div",{className:"mb-3 min-w-0",children:k}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{"data-testid":"document-save-status",role:"status",className:"min-w-0 flex-1 text-sm text-outline",children:B}),d&&e.jsxs(e.Fragment,{children:[e.jsx(g,{type:"button",variant:"ghost","data-testid":"document-discard",disabled:!c||r,onClick:U,children:"Discard changes"}),e.jsx(g,{type:"button","data-testid":"document-save",disabled:!c||r,onClick:()=>void h(),children:"Save changes"})]})]}),L]})})})}export{K as D,W as c};
1
+ import{H as T,J as V,r as o,j as e,K as Y,B as g}from"./index-Ckq9CvHb.js";const i=new Map,D=new Set;typeof window<"u"&&window.addEventListener("beforeunload",t=>{i.size&&(t.preventDefault(),t.returnValue="")});function W(t){return D.has(t)?!1:i.has(t)?window.confirm("Discard unsaved changes to this document?")?(i.delete(t),!0):!1:!0}function G({documentId:t,content:s,path:M,onSave:d,testId:N,wikiLinks:C,navigation:k,expanded:R,onExpandedChange:E,layout:F,pageTitle:q,hideFrontmatter:H}){const[J]=T(),K=V(),v=J.get("editorMode"),x=v==="edit"||v==="split"?v:"read",p=o.useRef(i.get(t)??{original:s,content:s}),[w,f]=o.useState(p.current.content),[u,j]=o.useState(p.current.original),[r,z]=o.useState(!1),[y,b]=o.useState(null),S=o.useRef(!1),l=o.useRef(p.current.content),c=w!==u;o.useEffect(()=>{i.has(t)||(f(s),l.current=s,j(s))},[s,t]);function O(a){l.current=a,f(a),a===u?i.delete(t):i.set(t,{original:u,content:a})}async function h(){if(!d||!c||S.current)return;S.current=!0,D.add(t),z(!0),b(null);const a=l.current;try{const n=await d(a,u),m=typeof n=="string"?n:a;j(m),l.current===a?(i.delete(t),l.current=m,f(m)):i.set(t,{original:m,content:l.current})}catch(n){b(n instanceof Error?n.message:"Could not save document")}finally{S.current=!1,D.delete(t),z(!1)}}function P(a){const n=new URLSearchParams(window.location.search);n.set("editorMode",a),n.toString()!==new URLSearchParams(window.location.search).toString()&&K({search:n.toString(),hash:window.location.hash})}function U(){W(t)&&(f(s),j(s),l.current=s,b(null))}const B=d?r?"Saving…":c?"Unsaved changes":"Saved":"Read-only",L=e.jsxs(e.Fragment,{children:[y&&e.jsxs("p",{role:"alert",className:"text-sm text-destructive",children:[y," Your draft has been kept."]}),c&&s!==u&&e.jsx("p",{role:"status",className:"text-sm text-outline",children:"The document changed elsewhere. Your draft is preserved; saving will check for conflicts."})]});return F==="page"?e.jsx("div",{className:"min-w-0","data-testid":"document-workspace",children:e.jsx(Y,{path:M,value:w,onChange:O,onSave:()=>void h(),readOnly:!d||r,testId:N,wikiLinks:C,initialMode:"read",mode:x,onModeChange:P,expanded:R,onExpandedChange:E,layout:"page",pageTitle:q,hideFrontmatter:H,notice:y||c&&s!==u?L:void 0,actions:(x!=="read"||c||r)&&e.jsxs(e.Fragment,{children:[e.jsx("span",{"data-testid":"document-save-status",role:"status",className:"text-xs text-outline",children:B}),d&&(c||r)&&e.jsxs(e.Fragment,{children:[e.jsx(g,{type:"button",size:"sm",variant:"ghost","data-testid":"document-discard",disabled:r,onClick:U,children:"Discard"}),e.jsx(g,{type:"button",size:"sm","data-testid":"document-save",disabled:r,onClick:()=>void h(),children:"Save"})]})]})})}):e.jsx("div",{className:"min-w-0 space-y-3","data-testid":"document-workspace",children:e.jsx(Y,{path:M,value:w,onChange:O,onSave:()=>void h(),readOnly:!d||r,testId:N,wikiLinks:C,initialMode:"read",mode:x,onModeChange:P,expanded:R,onExpandedChange:E,layout:F,header:e.jsxs("div",{className:"space-y-2",children:[k&&e.jsx("div",{className:"mb-3 min-w-0",children:k}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{"data-testid":"document-save-status",role:"status",className:"min-w-0 flex-1 text-sm text-outline",children:B}),d&&e.jsxs(e.Fragment,{children:[e.jsx(g,{type:"button",variant:"ghost","data-testid":"document-discard",disabled:!c||r,onClick:U,children:"Discard changes"}),e.jsx(g,{type:"button","data-testid":"document-save",disabled:!c||r,onClick:()=>void h(),children:"Save changes"})]})]}),L]})})})}export{G as D,W as c};
@@ -1 +1 @@
1
- import{j as e}from"./index-C_jtMgr7.js";function a({message:t="No data"}){return e.jsx("div",{"data-testid":"empty-state",className:"flex items-center justify-center py-16 text-outline font-body text-sm",children:t})}export{a as E};
1
+ import{j as e}from"./index-Ckq9CvHb.js";function a({message:t="No data"}){return e.jsx("div",{"data-testid":"empty-state",className:"flex items-center justify-center py-16 text-outline font-body text-sm",children:t})}export{a as E};
@@ -1 +1 @@
1
- import{j as e,B as s}from"./index-C_jtMgr7.js";function i({message:r,onRetry:t}){return e.jsxs("div",{"data-testid":"error-state",className:"flex flex-col items-center justify-center gap-3 px-4 py-16",children:[e.jsx("p",{role:"alert",className:"max-w-prose break-words text-center text-sm text-error",children:r}),t&&e.jsx(s,{"data-testid":"error-retry",variant:"outline",size:"sm",onClick:t,children:"Retry"})]})}export{i as E};
1
+ import{j as e,B as s}from"./index-Ckq9CvHb.js";function i({message:r,onRetry:t}){return e.jsxs("div",{"data-testid":"error-state",className:"flex flex-col items-center justify-center gap-3 px-4 py-16",children:[e.jsx("p",{role:"alert",className:"max-w-prose break-words text-center text-sm text-error",children:r}),t&&e.jsx(s,{"data-testid":"error-retry",variant:"outline",size:"sm",onClick:t,children:"Retry"})]})}export{i as E};
@@ -1 +1 @@
1
- import{G as U,r as t,a as V,j as n,V as K,J as $,W as A,d as P}from"./index-C_jtMgr7.js";import{S as G}from"./save-CYoz3QKB.js";const c=new Map;typeof window<"u"&&window.addEventListener("beforeunload",s=>{c.size!==0&&(s.preventDefault(),s.returnValue="")});function W({terminalId:s,path:i,content:u,readOnly:v,onDirty:w}){const[Q,z]=U(),p=Q.get("editorMode"),D=p==="read"||p==="split"?p:"edit",a=`${s}:${i}`,d=t.useRef(c.get(a)??{original:u,content:u}),o=t.useRef(d.current.original),l=t.useRef(d.current.content),[S,g]=t.useState(d.current.content!==d.current.original),[C,j]=t.useState(!1),[E,x]=t.useState(null),[R,b]=t.useState(d.current.content),k=V(),y=t.useRef(()=>{}),h=t.useRef(!1),m=t.useRef(!1),f=t.useRef(w);f.current=w;async function M(){if(h.current||v||l.current===o.current)return;h.current=!0,j(!0),x(null);const e=l.current;try{await P.git.saveFile(s,i,e,o.current),o.current=e;const r=l.current!==e;g(r),m.current&&f.current(r),r?c.set(a,{original:e,content:l.current}):c.delete(a),k.invalidateQueries({queryKey:["checkout-files",s,i]}),k.invalidateQueries({queryKey:["git",s]})}catch(r){x(r instanceof Error?r.message:"Could not save file")}finally{h.current=!1,j(!1)}}y.current=()=>void M(),t.useEffect(()=>(m.current=!0,f.current(d.current.content!==d.current.original),()=>{m.current=!1}),[]),t.useEffect(()=>{h.current||c.has(a)||u===o.current||(o.current=u,l.current=u,b(u),g(!1),m.current&&f.current(!1))},[u,a]);function N(e){l.current=e,b(e);const r=e!==o.current;g(r),f.current(r),r?c.set(a,{original:o.current,content:e}):c.delete(a)}function L(){window.confirm("Discard your edits and reload the file from disk?")&&P.git.files(s,i).then(e=>{if(e.content===null||e.binary||e.truncated)throw new Error("File is no longer editable");o.current=e.content,l.current=e.content,c.delete(a),b(e.content),g(!1),f.current(!1),x(null)}).catch(e=>x(e instanceof Error?e.message:"Could not reload file"))}const F=n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex shrink-0 items-center gap-1 border-b border-surface-highest px-2 py-1",children:[n.jsxs("button",{type:"button","data-testid":"file-save",disabled:!S||C||v,onClick:()=>void M(),className:"flex min-h-11 items-center gap-1 rounded px-2 py-1 text-sm text-primary hover:bg-surface-highest disabled:opacity-40",title:"Save (Ctrl/Cmd+S)",children:[n.jsx(G,{size:14}),C?"Saving…":"Save"]}),n.jsx("span",{"data-testid":"file-save-status",className:"min-w-0 flex-1 truncate text-sm text-on-surface-variant",children:v?"Read-only preview":S?"Unsaved changes":"Saved"})]}),E&&n.jsxs("div",{role:"alert",className:"shrink-0 border-b border-error/30 p-2 text-xs text-error",children:[E,n.jsx("button",{type:"button","data-testid":"file-reload",onClick:L,className:"ml-2 underline",children:"Reload from disk"})]})]});return n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col","data-testid":"file-editor",children:[!K(i)&&F,n.jsx("div",{"data-testid":"file-preview",className:"min-h-0 flex-1 overflow-hidden",children:K(i)?n.jsx($,{path:i,value:R,onChange:N,onSave:()=>y.current(),readOnly:v,height:"100%",testId:"file-editor-input",header:F,mode:D,onModeChange:e=>z(r=>{const q=new URLSearchParams(r);return q.set("editorMode",e),q})}):n.jsx(A,{path:i,value:R,onChange:N,onSave:()=>y.current(),readOnly:v,height:"100%",testId:"file-editor-input"})})]})}export{W as FileEditor};
1
+ import{H as U,r as t,a as V,j as n,V as K,K as $,W as A,d as P}from"./index-Ckq9CvHb.js";import{S as H}from"./save-Ca2pCtPv.js";const c=new Map;typeof window<"u"&&window.addEventListener("beforeunload",s=>{c.size!==0&&(s.preventDefault(),s.returnValue="")});function B({terminalId:s,path:i,content:u,readOnly:v,onDirty:w}){const[Q,z]=U(),p=Q.get("editorMode"),D=p==="read"||p==="split"?p:"edit",a=`${s}:${i}`,d=t.useRef(c.get(a)??{original:u,content:u}),o=t.useRef(d.current.original),l=t.useRef(d.current.content),[S,g]=t.useState(d.current.content!==d.current.original),[C,j]=t.useState(!1),[E,x]=t.useState(null),[R,b]=t.useState(d.current.content),k=V(),y=t.useRef(()=>{}),h=t.useRef(!1),m=t.useRef(!1),f=t.useRef(w);f.current=w;async function M(){if(h.current||v||l.current===o.current)return;h.current=!0,j(!0),x(null);const e=l.current;try{await P.git.saveFile(s,i,e,o.current),o.current=e;const r=l.current!==e;g(r),m.current&&f.current(r),r?c.set(a,{original:e,content:l.current}):c.delete(a),k.invalidateQueries({queryKey:["checkout-files",s,i]}),k.invalidateQueries({queryKey:["git",s]})}catch(r){x(r instanceof Error?r.message:"Could not save file")}finally{h.current=!1,j(!1)}}y.current=()=>void M(),t.useEffect(()=>(m.current=!0,f.current(d.current.content!==d.current.original),()=>{m.current=!1}),[]),t.useEffect(()=>{h.current||c.has(a)||u===o.current||(o.current=u,l.current=u,b(u),g(!1),m.current&&f.current(!1))},[u,a]);function N(e){l.current=e,b(e);const r=e!==o.current;g(r),f.current(r),r?c.set(a,{original:o.current,content:e}):c.delete(a)}function L(){window.confirm("Discard your edits and reload the file from disk?")&&P.git.files(s,i).then(e=>{if(e.content===null||e.binary||e.truncated)throw new Error("File is no longer editable");o.current=e.content,l.current=e.content,c.delete(a),b(e.content),g(!1),f.current(!1),x(null)}).catch(e=>x(e instanceof Error?e.message:"Could not reload file"))}const F=n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex shrink-0 items-center gap-1 border-b border-surface-highest px-2 py-1",children:[n.jsxs("button",{type:"button","data-testid":"file-save",disabled:!S||C||v,onClick:()=>void M(),className:"flex min-h-11 items-center gap-1 rounded px-2 py-1 text-sm text-primary hover:bg-surface-highest disabled:opacity-40",title:"Save (Ctrl/Cmd+S)",children:[n.jsx(H,{size:14}),C?"Saving…":"Save"]}),n.jsx("span",{"data-testid":"file-save-status",className:"min-w-0 flex-1 truncate text-sm text-on-surface-variant",children:v?"Read-only preview":S?"Unsaved changes":"Saved"})]}),E&&n.jsxs("div",{role:"alert",className:"shrink-0 border-b border-error/30 p-2 text-xs text-error",children:[E,n.jsx("button",{type:"button","data-testid":"file-reload",onClick:L,className:"ml-2 underline",children:"Reload from disk"})]})]});return n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col","data-testid":"file-editor",children:[!K(i)&&F,n.jsx("div",{"data-testid":"file-preview",className:"min-h-0 flex-1 overflow-hidden",children:K(i)?n.jsx($,{path:i,value:R,onChange:N,onSave:()=>y.current(),readOnly:v,height:"100%",testId:"file-editor-input",header:F,mode:D,onModeChange:e=>z(r=>{const q=new URLSearchParams(r);return q.set("editorMode",e),q})}):n.jsx(A,{path:i,value:R,onChange:N,onSave:()=>y.current(),readOnly:v,height:"100%",testId:"file-editor-input"})})]})}export{B as FileEditor};
@@ -1 +1 @@
1
- import{u as S,a as f,b as v,d as j,r as h,j as e,B as b,p as w,I as _,L as k,ad as F}from"./index-C_jtMgr7.js";import{E as R}from"./ErrorState-BPTepwiG.js";import{a as $}from"./useJobs-Dcl-Vim3.js";function L(t){return S({queryKey:["webhooks",t],queryFn:()=>j.webhooks.list(t),select:s=>s.webhooks})}function D(t){return S({queryKey:["webhook-deliveries",t],queryFn:()=>j.webhooks.deliveries(t),select:s=>s.deliveries,enabled:!!t,refetchInterval:3e3})}function U(){const t=f();return v({mutationFn:s=>j.webhooks.create(s),onSuccess:()=>t.invalidateQueries({queryKey:["webhooks"]})})}function E(){const t=f();return v({mutationFn:({id:s,...a})=>j.webhooks.update(s,a),onSuccess:()=>t.invalidateQueries({queryKey:["webhooks"]})})}function K(){const t=f();return v({mutationFn:s=>j.webhooks.delete(s),onSuccess:()=>t.invalidateQueries({queryKey:["webhooks"]})})}function I(){return v({mutationFn:t=>j.webhooks.rotate(t)})}function P(t){return[...new Set(t.split(",").map(s=>s.trim()).filter(Boolean))]}function q(t,s,a){return new URL(`/webhooks/${encodeURIComponent(t)}`,new URL(s,a)).href}function z(t){return["localhost","127.0.0.1","[::1]"].includes(new URL(t).hostname)}function N({id:t,testId:s,value:a,onChange:i,placeholder:d}){const[n,r]=h.useState(a.join(", "));return e.jsx(_,{id:t,"data-testid":s,value:n,placeholder:d,onChange:l=>{r(l.target.value),i(l.target.value)}})}function J({projectId:t,onCreated:s}){const a=U(),[i,d]=h.useState(""),[n,r]=h.useState("github"),[l,m]=h.useState(null),u=h.useId();return l?e.jsxs("div",{"data-testid":"webhook-created",className:"space-y-3",children:[e.jsx(W,{hook:l,secret:l.secret}),e.jsx(b,{type:"button",variant:"outline","data-testid":"webhook-setup-done",onClick:()=>{s==null||s(l),m(null),d("")},children:"I've copied the setup details"})]}):e.jsxs("div",{className:"space-y-3","data-testid":"webhook-create-form",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(w,{htmlFor:`${u}-name`,children:"Webhook name"}),e.jsx(_,{id:`${u}-name`,"data-testid":"webhook-name",value:i,onChange:c=>d(c.target.value),maxLength:100,placeholder:"GitHub repository events"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(w,{htmlFor:`${u}-provider`,children:"Provider"}),e.jsxs("select",{id:`${u}-provider`,"data-testid":"webhook-provider",className:"w-full min-h-11 rounded-md border border-control-border bg-background px-3 text-sm",value:n,onChange:c=>r(c.target.value),children:[e.jsx("option",{value:"github",children:"GitHub"}),e.jsx("option",{value:"generic",children:"Other service (HMAC)"})]})]}),e.jsx("p",{className:"text-xs text-outline",children:"Create the event source here. Connect jobs and choose their event filters in Jobs. No job is required to create a webhook."}),a.error&&e.jsx("p",{role:"alert",className:"text-sm text-error",children:a.error.message}),e.jsx(b,{type:"button","data-testid":"webhook-create",disabled:!i.trim()||a.isPending,onClick:()=>a.mutate({name:i.trim(),provider:n,project_id:t??null},{onSuccess:m}),children:a.isPending?"Creating...":"Create webhook"})]})}function A({value:t,onChange:s,projectId:a}){const{data:i,error:d,isLoading:n,refetch:r}=L(a),l=i==null?void 0:i.filter(o=>o.project_id===null||o.project_id===a),[m,u]=h.useState(!1);function c(o){t.some(p=>p.webhook_id===o)||s([...t,{webhook_id:o,events:[],actions:[]}])}function y(o,p,x){s(t.map(g=>g.webhook_id===o?{...g,[p]:P(x)}:g))}return e.jsxs("section",{className:"space-y-3 border-y border-border py-4","data-testid":"job-webhook-picker",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Which webhook should trigger this job?"}),d?e.jsx(R,{message:d.message,onRetry:()=>r()}):e.jsxs(e.Fragment,{children:[e.jsx(w,{htmlFor:"job-webhook-source",children:"Configured webhooks"}),e.jsxs("select",{id:"job-webhook-source","data-testid":"job-webhook-select",className:"w-full min-h-11 rounded-md border border-control-border bg-background px-3 text-sm",value:"",disabled:n,onChange:o=>{o.target.value&&c(o.target.value)},children:[e.jsx("option",{value:"",children:n?"Loading webhooks...":"Select an existing webhook"}),(l??[]).filter(o=>!t.some(p=>p.webhook_id===o.id)).map(o=>e.jsxs("option",{value:o.id,children:[o.name,o.enabled?"":" (disabled)"]},o.id))]}),!n&&!(l!=null&&l.length)&&e.jsx("p",{className:"text-xs text-outline",children:"No webhooks configured for this project yet. Create one below or on the Webhooks page."})]}),t.map(o=>{var p;return e.jsxs("div",{className:"space-y-2 border-t border-border pt-3","data-testid":"job-webhook-binding","data-webhook-id":o.webhook_id,children:[e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:((p=l==null?void 0:l.find(x=>x.id===o.webhook_id))==null?void 0:p.name)??o.webhook_id}),e.jsx(b,{type:"button",variant:"ghost",size:"sm","data-testid":"job-webhook-remove",onClick:()=>s(t.filter(x=>x.webhook_id!==o.webhook_id)),children:"Disconnect"})]}),e.jsx(w,{htmlFor:`events-${o.webhook_id}`,children:"Events for this job"}),e.jsx(N,{id:`events-${o.webhook_id}`,testId:"webhook-events",value:o.events,onChange:x=>y(o.webhook_id,"events",x),placeholder:"pull_request, push (blank accepts all)"}),e.jsx(w,{htmlFor:`actions-${o.webhook_id}`,children:"Actions for this job (optional)"}),e.jsx(N,{id:`actions-${o.webhook_id}`,testId:"webhook-actions",value:o.actions,onChange:x=>y(o.webhook_id,"actions",x),placeholder:"opened, synchronize (blank accepts all)"})]},o.webhook_id)}),e.jsx(b,{type:"button",size:"sm",variant:"outline","data-testid":"webhook-add",onClick:()=>u(!m),children:m?"Close new webhook":"Create a webhook"}),m&&e.jsx(J,{projectId:a,onCreated:o=>{c(o.id),u(!1)}})]})}function Q({job:t}){const s=$(),[a,i]=h.useState(t.webhooks??[]);return e.jsxs("section",{className:"space-y-3","data-testid":"job-webhooks",children:[!t.enabled&&e.jsx("p",{className:"text-sm text-outline",children:"Job disabled. Configure connections now and enable it from Jobs when ready."}),e.jsx(A,{value:a,onChange:i,projectId:t.project_id??void 0}),s.error&&e.jsx("p",{role:"alert",className:"text-sm text-error",children:s.error.message}),e.jsx(b,{type:"button",size:"sm","data-testid":"job-webhooks-save",disabled:s.isPending,onClick:()=>s.mutate({id:t.id,webhooks:a,trigger_type:"webhook"}),children:"Save connections"}),s.isSuccess&&e.jsx("p",{role:"status",className:"text-xs text-outline",children:"Connections saved."}),e.jsx(k,{className:"inline-block text-sm underline",to:`/webhooks?project=${encodeURIComponent(t.project_id??"all")}`,children:"Manage configured webhooks and deliveries"})]})}function C({label:t,value:s,secret:a=!1}){const[i,d]=h.useState(!1),[n,r]=h.useState(!1);return e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs text-outline",children:t}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("code",{className:"min-w-0 flex-1 break-all text-xs","data-testid":a?"webhook-secret":"webhook-url",children:s}),e.jsx(b,{type:"button",size:"sm",variant:"outline","aria-label":`Copy ${t}`,onClick:async()=>{try{await navigator.clipboard.writeText(s),d(!0),r(!1)}catch{r(!0)}},children:i?"Copied":"Copy"})]}),n&&e.jsx("p",{role:"alert",className:"text-xs text-error",children:"Select and copy the value above; clipboard access is unavailable."})]})}function W({hook:t,secret:s}){const a=q(t.token,F(),window.location.origin);return e.jsxs("div",{className:"space-y-3","data-testid":"webhook-setup",children:[e.jsx(C,{label:"Payload URL",value:a}),z(a)&&e.jsx("p",{className:"text-sm text-warning",children:"This address is local. For external providers, use your publicly reachable ORC address with the same /webhooks/ path."}),s?e.jsxs(e.Fragment,{children:[e.jsx(C,{label:"Signing secret",value:s,secret:!0}),e.jsx("p",{className:"text-xs text-outline",children:"Copy the signing secret before leaving. It is shown once."})]}):e.jsx("p",{className:"text-xs text-outline",children:"The signing secret is hidden. Generate a replacement only if you need to reconnect the sender."}),t.provider==="github"?e.jsxs("ol",{className:"list-decimal space-y-1 pl-5 text-sm text-outline",children:[e.jsx("li",{children:"In your repository, open GitHub Settings - Webhooks - Add webhook."}),e.jsx("li",{children:"Paste the Payload URL, select application/json, and enter the signing secret."}),e.jsx("li",{children:"Select the events needed by your connected jobs. Each job has its own filters."}),e.jsx("li",{children:"Send an event and inspect Recent deliveries below."})]}):e.jsx("p",{className:"text-sm text-outline",children:"Send JSON, signed with HMAC-SHA256 of the raw body. Set X-Orc-Signature-256 to sha256=<hex signature>, X-Orc-Event to the event name and X-Orc-Delivery to a unique delivery ID."})]})}function M({hook:t}){var u;const s=E(),a=I(),[i,d]=h.useState(!1),[n,r]=h.useState(!1),[l,m]=h.useState();return e.jsxs("article",{className:"space-y-3 border-b border-border pb-5","data-testid":"webhook-endpoint","data-webhook-id":t.id,children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx("h3",{className:"text-sm font-medium",children:t.name}),e.jsxs("span",{className:"text-xs text-outline",children:[t.provider," - ",t.enabled?"Enabled":"Disabled"]}),e.jsx(b,{type:"button",variant:"outline",size:"sm",disabled:s.isPending,onClick:()=>s.mutate({id:t.id,enabled:!t.enabled}),children:t.enabled?"Disable":"Enable"})]}),e.jsxs("div",{className:"space-y-1","data-testid":"webhook-connected-jobs",children:[e.jsxs("p",{className:"text-xs text-outline",children:["Connected jobs (",t.subscriptions.length,")"]}),t.subscriptions.length?t.subscriptions.map(c=>e.jsxs("div",{className:"text-sm",children:[e.jsx(k,{className:"underline","data-testid":"webhook-job-link",to:`/jobs/${c.job_id}?project=all`,children:c.name}),e.jsxs("span",{className:"text-xs text-outline",children:[" ","- ",c.enabled?"Enabled":"Disabled","; events:"," ",c.events.join(", ")||"all","; actions: ",c.actions.join(", ")||"all"]})]},c.job_id)):e.jsx("p",{className:"text-sm text-outline",children:"No connected jobs. Select this webhook when creating or editing a job."})]}),e.jsx(W,{hook:t,secret:l}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(b,{type:"button",variant:"outline",size:"sm","data-testid":"webhook-deliveries-toggle",onClick:()=>d(!i),children:i?"Hide deliveries":"Recent deliveries"}),e.jsx(b,{type:"button",variant:"ghost",size:"sm",onClick:()=>r(!n),children:"New signing secret"})]}),n&&e.jsxs("div",{className:"space-y-2 text-sm",children:[e.jsx("p",{children:"The sender's existing secret will stop working. Update it after generating the replacement."}),e.jsx(b,{type:"button",variant:"outline",size:"sm",disabled:a.isPending,onClick:()=>a.mutate(t.id,{onSuccess:c=>{m(c.secret),r(!1)}}),children:"Generate replacement secret"})]}),(s.error||a.error)&&e.jsx("p",{role:"alert",className:"text-sm text-error",children:(u=s.error??a.error)==null?void 0:u.message}),i&&e.jsx(H,{id:t.id})]})}function H({id:t}){const{data:s,isLoading:a,error:i,refetch:d}=D(t);return e.jsxs("section",{className:"space-y-2","data-testid":"webhook-deliveries",children:[e.jsx("h4",{className:"text-sm font-medium",children:"Recent deliveries"}),i?e.jsx(R,{message:i.message,onRetry:()=>d()}):a?e.jsx("p",{role:"status",children:"Loading deliveries..."}):s!=null&&s.length?s.map(n=>e.jsxs("div",{className:"space-y-1 border-t border-border py-2 text-xs","data-testid":"webhook-delivery",children:[e.jsxs("div",{className:"flex flex-wrap justify-between gap-2",children:[e.jsxs("span",{children:[n.event,n.action?` / ${n.action}`:""]}),e.jsx("span",{children:n.status})]}),e.jsxs("p",{className:"text-outline",children:[n.repository," ",new Date(n.created_at).toLocaleString()]}),n.status==="ignored"&&e.jsx("p",{className:"text-outline",children:"No enabled connected job matched this event."}),n.error&&e.jsx("p",{className:"text-error",children:n.error}),n.runs.map(r=>e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsxs(k,{className:"underline",to:`/jobs/${r.job_id}?project=all`,children:["Job run: ",r.status]}),r.task_id&&e.jsx(k,{className:"underline",to:`/tasks/${r.task_id}?project=all`,children:"Created task"}),r.session_id&&e.jsx(k,{className:"underline",to:`/audit/${r.session_id}?project=all`,children:"Agent session"})]},r.job_run_id))]},n.id)):e.jsx("p",{className:"text-sm text-outline",children:"No events received yet. Register the endpoint with your provider, then send an event."})]})}export{Q as J,J as W,K as a,M as b,A as c,L as u};
1
+ import{u as S,a as f,b as v,d as j,r as h,j as e,B as b,p as w,I as _,L as k,ao as F}from"./index-Ckq9CvHb.js";import{E as R}from"./ErrorState-CwOWC9Qy.js";import{a as $}from"./useJobs-rLcb_CgS.js";function L(t){return S({queryKey:["webhooks",t],queryFn:()=>j.webhooks.list(t),select:s=>s.webhooks})}function D(t){return S({queryKey:["webhook-deliveries",t],queryFn:()=>j.webhooks.deliveries(t),select:s=>s.deliveries,enabled:!!t,refetchInterval:3e3})}function U(){const t=f();return v({mutationFn:s=>j.webhooks.create(s),onSuccess:()=>t.invalidateQueries({queryKey:["webhooks"]})})}function E(){const t=f();return v({mutationFn:({id:s,...a})=>j.webhooks.update(s,a),onSuccess:()=>t.invalidateQueries({queryKey:["webhooks"]})})}function K(){const t=f();return v({mutationFn:s=>j.webhooks.delete(s),onSuccess:()=>t.invalidateQueries({queryKey:["webhooks"]})})}function I(){return v({mutationFn:t=>j.webhooks.rotate(t)})}function P(t){return[...new Set(t.split(",").map(s=>s.trim()).filter(Boolean))]}function q(t,s,a){return new URL(`/webhooks/${encodeURIComponent(t)}`,new URL(s,a)).href}function z(t){return["localhost","127.0.0.1","[::1]"].includes(new URL(t).hostname)}function N({id:t,testId:s,value:a,onChange:i,placeholder:d}){const[n,r]=h.useState(a.join(", "));return e.jsx(_,{id:t,"data-testid":s,value:n,placeholder:d,onChange:l=>{r(l.target.value),i(l.target.value)}})}function J({projectId:t,onCreated:s}){const a=U(),[i,d]=h.useState(""),[n,r]=h.useState("github"),[l,m]=h.useState(null),u=h.useId();return l?e.jsxs("div",{"data-testid":"webhook-created",className:"space-y-3",children:[e.jsx(W,{hook:l,secret:l.secret}),e.jsx(b,{type:"button",variant:"outline","data-testid":"webhook-setup-done",onClick:()=>{s==null||s(l),m(null),d("")},children:"I've copied the setup details"})]}):e.jsxs("div",{className:"space-y-3","data-testid":"webhook-create-form",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(w,{htmlFor:`${u}-name`,children:"Webhook name"}),e.jsx(_,{id:`${u}-name`,"data-testid":"webhook-name",value:i,onChange:c=>d(c.target.value),maxLength:100,placeholder:"GitHub repository events"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(w,{htmlFor:`${u}-provider`,children:"Provider"}),e.jsxs("select",{id:`${u}-provider`,"data-testid":"webhook-provider",className:"w-full min-h-11 rounded-md border border-control-border bg-background px-3 text-sm",value:n,onChange:c=>r(c.target.value),children:[e.jsx("option",{value:"github",children:"GitHub"}),e.jsx("option",{value:"generic",children:"Other service (HMAC)"})]})]}),e.jsx("p",{className:"text-xs text-outline",children:"Create the event source here. Connect jobs and choose their event filters in Jobs. No job is required to create a webhook."}),a.error&&e.jsx("p",{role:"alert",className:"text-sm text-error",children:a.error.message}),e.jsx(b,{type:"button","data-testid":"webhook-create",disabled:!i.trim()||a.isPending,onClick:()=>a.mutate({name:i.trim(),provider:n,project_id:t??null},{onSuccess:m}),children:a.isPending?"Creating...":"Create webhook"})]})}function A({value:t,onChange:s,projectId:a}){const{data:i,error:d,isLoading:n,refetch:r}=L(a),l=i==null?void 0:i.filter(o=>o.project_id===null||o.project_id===a),[m,u]=h.useState(!1);function c(o){t.some(p=>p.webhook_id===o)||s([...t,{webhook_id:o,events:[],actions:[]}])}function y(o,p,x){s(t.map(g=>g.webhook_id===o?{...g,[p]:P(x)}:g))}return e.jsxs("section",{className:"space-y-3 border-y border-border py-4","data-testid":"job-webhook-picker",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Which webhook should trigger this job?"}),d?e.jsx(R,{message:d.message,onRetry:()=>r()}):e.jsxs(e.Fragment,{children:[e.jsx(w,{htmlFor:"job-webhook-source",children:"Configured webhooks"}),e.jsxs("select",{id:"job-webhook-source","data-testid":"job-webhook-select",className:"w-full min-h-11 rounded-md border border-control-border bg-background px-3 text-sm",value:"",disabled:n,onChange:o=>{o.target.value&&c(o.target.value)},children:[e.jsx("option",{value:"",children:n?"Loading webhooks...":"Select an existing webhook"}),(l??[]).filter(o=>!t.some(p=>p.webhook_id===o.id)).map(o=>e.jsxs("option",{value:o.id,children:[o.name,o.enabled?"":" (disabled)"]},o.id))]}),!n&&!(l!=null&&l.length)&&e.jsx("p",{className:"text-xs text-outline",children:"No webhooks configured for this project yet. Create one below or on the Webhooks page."})]}),t.map(o=>{var p;return e.jsxs("div",{className:"space-y-2 border-t border-border pt-3","data-testid":"job-webhook-binding","data-webhook-id":o.webhook_id,children:[e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:((p=l==null?void 0:l.find(x=>x.id===o.webhook_id))==null?void 0:p.name)??o.webhook_id}),e.jsx(b,{type:"button",variant:"ghost",size:"sm","data-testid":"job-webhook-remove",onClick:()=>s(t.filter(x=>x.webhook_id!==o.webhook_id)),children:"Disconnect"})]}),e.jsx(w,{htmlFor:`events-${o.webhook_id}`,children:"Events for this job"}),e.jsx(N,{id:`events-${o.webhook_id}`,testId:"webhook-events",value:o.events,onChange:x=>y(o.webhook_id,"events",x),placeholder:"pull_request, push (blank accepts all)"}),e.jsx(w,{htmlFor:`actions-${o.webhook_id}`,children:"Actions for this job (optional)"}),e.jsx(N,{id:`actions-${o.webhook_id}`,testId:"webhook-actions",value:o.actions,onChange:x=>y(o.webhook_id,"actions",x),placeholder:"opened, synchronize (blank accepts all)"})]},o.webhook_id)}),e.jsx(b,{type:"button",size:"sm",variant:"outline","data-testid":"webhook-add",onClick:()=>u(!m),children:m?"Close new webhook":"Create a webhook"}),m&&e.jsx(J,{projectId:a,onCreated:o=>{c(o.id),u(!1)}})]})}function Q({job:t}){const s=$(),[a,i]=h.useState(t.webhooks??[]);return e.jsxs("section",{className:"space-y-3","data-testid":"job-webhooks",children:[!t.enabled&&e.jsx("p",{className:"text-sm text-outline",children:"Job disabled. Configure connections now and enable it from Jobs when ready."}),e.jsx(A,{value:a,onChange:i,projectId:t.project_id??void 0}),s.error&&e.jsx("p",{role:"alert",className:"text-sm text-error",children:s.error.message}),e.jsx(b,{type:"button",size:"sm","data-testid":"job-webhooks-save",disabled:s.isPending,onClick:()=>s.mutate({id:t.id,webhooks:a,trigger_type:"webhook"}),children:"Save connections"}),s.isSuccess&&e.jsx("p",{role:"status",className:"text-xs text-outline",children:"Connections saved."}),e.jsx(k,{className:"inline-block text-sm underline",to:`/webhooks?project=${encodeURIComponent(t.project_id??"all")}`,children:"Manage configured webhooks and deliveries"})]})}function C({label:t,value:s,secret:a=!1}){const[i,d]=h.useState(!1),[n,r]=h.useState(!1);return e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs text-outline",children:t}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("code",{className:"min-w-0 flex-1 break-all text-xs","data-testid":a?"webhook-secret":"webhook-url",children:s}),e.jsx(b,{type:"button",size:"sm",variant:"outline","aria-label":`Copy ${t}`,onClick:async()=>{try{await navigator.clipboard.writeText(s),d(!0),r(!1)}catch{r(!0)}},children:i?"Copied":"Copy"})]}),n&&e.jsx("p",{role:"alert",className:"text-xs text-error",children:"Select and copy the value above; clipboard access is unavailable."})]})}function W({hook:t,secret:s}){const a=q(t.token,F(),window.location.origin);return e.jsxs("div",{className:"space-y-3","data-testid":"webhook-setup",children:[e.jsx(C,{label:"Payload URL",value:a}),z(a)&&e.jsx("p",{className:"text-sm text-warning",children:"This address is local. For external providers, use your publicly reachable ORC address with the same /webhooks/ path."}),s?e.jsxs(e.Fragment,{children:[e.jsx(C,{label:"Signing secret",value:s,secret:!0}),e.jsx("p",{className:"text-xs text-outline",children:"Copy the signing secret before leaving. It is shown once."})]}):e.jsx("p",{className:"text-xs text-outline",children:"The signing secret is hidden. Generate a replacement only if you need to reconnect the sender."}),t.provider==="github"?e.jsxs("ol",{className:"list-decimal space-y-1 pl-5 text-sm text-outline",children:[e.jsx("li",{children:"In your repository, open GitHub Settings - Webhooks - Add webhook."}),e.jsx("li",{children:"Paste the Payload URL, select application/json, and enter the signing secret."}),e.jsx("li",{children:"Select the events needed by your connected jobs. Each job has its own filters."}),e.jsx("li",{children:"Send an event and inspect Recent deliveries below."})]}):e.jsx("p",{className:"text-sm text-outline",children:"Send JSON, signed with HMAC-SHA256 of the raw body. Set X-Orc-Signature-256 to sha256=<hex signature>, X-Orc-Event to the event name and X-Orc-Delivery to a unique delivery ID."})]})}function M({hook:t}){var u;const s=E(),a=I(),[i,d]=h.useState(!1),[n,r]=h.useState(!1),[l,m]=h.useState();return e.jsxs("article",{className:"space-y-3 border-b border-border pb-5","data-testid":"webhook-endpoint","data-webhook-id":t.id,children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx("h3",{className:"text-sm font-medium",children:t.name}),e.jsxs("span",{className:"text-xs text-outline",children:[t.provider," - ",t.enabled?"Enabled":"Disabled"]}),e.jsx(b,{type:"button",variant:"outline",size:"sm",disabled:s.isPending,onClick:()=>s.mutate({id:t.id,enabled:!t.enabled}),children:t.enabled?"Disable":"Enable"})]}),e.jsxs("div",{className:"space-y-1","data-testid":"webhook-connected-jobs",children:[e.jsxs("p",{className:"text-xs text-outline",children:["Connected jobs (",t.subscriptions.length,")"]}),t.subscriptions.length?t.subscriptions.map(c=>e.jsxs("div",{className:"text-sm",children:[e.jsx(k,{className:"underline","data-testid":"webhook-job-link",to:`/jobs/${c.job_id}?project=all`,children:c.name}),e.jsxs("span",{className:"text-xs text-outline",children:[" ","- ",c.enabled?"Enabled":"Disabled","; events:"," ",c.events.join(", ")||"all","; actions: ",c.actions.join(", ")||"all"]})]},c.job_id)):e.jsx("p",{className:"text-sm text-outline",children:"No connected jobs. Select this webhook when creating or editing a job."})]}),e.jsx(W,{hook:t,secret:l}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(b,{type:"button",variant:"outline",size:"sm","data-testid":"webhook-deliveries-toggle",onClick:()=>d(!i),children:i?"Hide deliveries":"Recent deliveries"}),e.jsx(b,{type:"button",variant:"ghost",size:"sm",onClick:()=>r(!n),children:"New signing secret"})]}),n&&e.jsxs("div",{className:"space-y-2 text-sm",children:[e.jsx("p",{children:"The sender's existing secret will stop working. Update it after generating the replacement."}),e.jsx(b,{type:"button",variant:"outline",size:"sm",disabled:a.isPending,onClick:()=>a.mutate(t.id,{onSuccess:c=>{m(c.secret),r(!1)}}),children:"Generate replacement secret"})]}),(s.error||a.error)&&e.jsx("p",{role:"alert",className:"text-sm text-error",children:(u=s.error??a.error)==null?void 0:u.message}),i&&e.jsx(H,{id:t.id})]})}function H({id:t}){const{data:s,isLoading:a,error:i,refetch:d}=D(t);return e.jsxs("section",{className:"space-y-2","data-testid":"webhook-deliveries",children:[e.jsx("h4",{className:"text-sm font-medium",children:"Recent deliveries"}),i?e.jsx(R,{message:i.message,onRetry:()=>d()}):a?e.jsx("p",{role:"status",children:"Loading deliveries..."}):s!=null&&s.length?s.map(n=>e.jsxs("div",{className:"space-y-1 border-t border-border py-2 text-xs","data-testid":"webhook-delivery",children:[e.jsxs("div",{className:"flex flex-wrap justify-between gap-2",children:[e.jsxs("span",{children:[n.event,n.action?` / ${n.action}`:""]}),e.jsx("span",{children:n.status})]}),e.jsxs("p",{className:"text-outline",children:[n.repository," ",new Date(n.created_at).toLocaleString()]}),n.status==="ignored"&&e.jsx("p",{className:"text-outline",children:"No enabled connected job matched this event."}),n.error&&e.jsx("p",{className:"text-error",children:n.error}),n.runs.map(r=>e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsxs(k,{className:"underline",to:`/jobs/${r.job_id}?project=all`,children:["Job run: ",r.status]}),r.task_id&&e.jsx(k,{className:"underline",to:`/tasks/${r.task_id}?project=all`,children:"Created task"}),r.session_id&&e.jsx(k,{className:"underline",to:`/audit/${r.session_id}?project=all`,children:"Agent session"})]},r.job_run_id))]},n.id)):e.jsx("p",{className:"text-sm text-outline",children:"No events received yet. Register the endpoint with your provider, then send an event."})]})}export{Q as J,J as W,K as a,M as b,A as c,L as u};