orc-ai 0.1.53 → 0.1.55
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.
- package/README.md +26 -2
- package/dist/index.js +769 -591
- package/dist/skills/orc-platform/SKILL.md +2 -1
- package/dist/skills/orc-platform/references/channels.md +169 -0
- package/dist/skills/orc-platform/references/setup.md +3 -3
- package/dist/web/assets/Agents-D70pZAkB.js +34 -0
- package/dist/web/assets/Attention-DoTjQvwX.js +2 -0
- package/dist/web/assets/Audit-BilD5tHL.js +1 -0
- package/dist/web/assets/ConfirmDialog-Cyd60q9b.js +1 -0
- package/dist/web/assets/Dashboard-BrpclE6i.js +1 -0
- package/dist/web/assets/DocumentWorkspace-BirLb0Py.js +1 -0
- package/dist/web/assets/{ErrorState-BoQqdsym.js → ErrorState-BrKz7Mii.js} +1 -1
- package/dist/web/assets/FileEditor-Cfl56W9G.js +1 -0
- package/dist/web/assets/JobWebhooks-csgdKaIu.js +1 -0
- package/dist/web/assets/Jobs-BeDH5Nqx.js +1 -0
- package/dist/web/assets/Knowledge-Bhe2osQ9.js +1 -0
- package/dist/web/assets/Markdown-cNY95m5f.js +2 -0
- package/dist/web/assets/MarkdownEditor-CPlYZ0ux.js +2 -0
- package/dist/web/assets/{MarkdownRenderer-B5esWp7J.js → MarkdownRenderer-C4od8dIW.js} +9 -9
- package/dist/web/assets/PackageCatalog-rIC8EqCV.js +8 -0
- package/dist/web/assets/{PackageRunDialog-DxUs3Qnc.js → PackageRunDialog-BPLlcUBW.js} +46 -46
- package/dist/web/assets/{Pager-DQCWHQWA.js → Pager-Bc666Oa5.js} +1 -1
- package/dist/web/assets/{PriorityBadge-ADp-pD5B.js → PriorityBadge-Ccw4iVk7.js} +1 -1
- package/dist/web/assets/Projects-C5tjWMiN.js +3 -0
- package/dist/web/assets/ResponsiveFilters-DAeezpA-.js +1 -0
- package/dist/web/assets/ResumeActions-Xi3gsryf.js +1 -0
- package/dist/web/assets/Rules-u4Yt3UWU.js +18 -0
- package/dist/web/assets/{ScratchpadDiagramEditor-D44NiVP_.js → ScratchpadDiagramEditor-CEZLGEOO.js} +7 -7
- package/dist/web/assets/Scratchpads-BINR8pcN.js +10 -0
- package/dist/web/assets/Sessions-xflxxp3f.js +3 -0
- package/dist/web/assets/Settings-C5tS2MvS.js +6 -0
- package/dist/web/assets/Skills-QaW-IPD1.js +8 -0
- package/dist/web/assets/{SourceEditor-B5CtJBt0.js → SourceEditor-BXHhVnEe.js} +1 -1
- package/dist/web/assets/{StatusBadge-CTFDUHuw.js → StatusBadge-ia651_Df.js} +1 -1
- package/dist/web/assets/TagInput-BCXK-1YG.js +1 -0
- package/dist/web/assets/TaskDetailSheet-BIMcgJGc.js +1 -0
- package/dist/web/assets/Tasks-CsBS5O9A.js +22 -0
- package/dist/web/assets/Terminals-C0aoP7ar.css +1 -0
- package/dist/web/assets/Terminals-D3Yo-p_A.js +3 -0
- package/dist/web/assets/ViewHeader-Ce5HQRJu.js +1 -0
- package/dist/web/assets/Webhooks-BCKPHvAT.js +1 -0
- package/dist/web/assets/{ar-SA-G6X2FPQ2-9uLW-Aib.js → ar-SA-G6X2FPQ2-Dxcs6bnC.js} +1 -1
- package/dist/web/assets/arrow-left-vCG_8rdy.js +1 -0
- package/dist/web/assets/{az-AZ-76LH7QW2-DOqqo97y.js → az-AZ-76LH7QW2-DzTRmo_5.js} +1 -1
- package/dist/web/assets/{bg-BG-XCXSNQG7-BHUaosi9.js → bg-BG-XCXSNQG7-GVnVbOJF.js} +1 -1
- package/dist/web/assets/{bn-BD-2XOGV67Q-_-LDSkWx.js → bn-BD-2XOGV67Q-CBnLWZsm.js} +1 -1
- package/dist/web/assets/bundle-mjs-geeEdoSy.js +1 -0
- package/dist/web/assets/button-CXYVslgR.js +1 -0
- package/dist/web/assets/{ca-ES-6MX7JW3Y-D00wQc68.js → ca-ES-6MX7JW3Y-nF87CFCd.js} +1 -1
- package/dist/web/assets/check-DOY0CJBh.js +1 -0
- package/dist/web/assets/chevron-down-hj6o3_QU.js +1 -0
- package/dist/web/assets/{chunk-EIO257PC-BfeJ3EDs.js → chunk-EIO257PC-C5HXDKyY.js} +1 -1
- package/dist/web/assets/chunk-OB3PAWPO-1IihCzFx.js +4 -0
- package/dist/web/assets/claude-DyzolaFc.svg +3 -0
- package/dist/web/assets/client-nzMXason.js +1 -0
- package/dist/web/assets/codex-BNO0LSlX.svg +1 -0
- package/dist/web/assets/copilot-BALWjOlU.svg +1 -0
- package/dist/web/assets/copy-DZWYRnrF.js +1 -0
- package/dist/web/assets/{cs-CZ-2BRQDIVT-EB-m3ztC.js → cs-CZ-2BRQDIVT-Cz5r5OEj.js} +1 -1
- package/dist/web/assets/cursor-DdfUZ9gB.svg +12 -0
- package/dist/web/assets/{da-DK-5WZEPLOC-DWYR6cGM.js → da-DK-5WZEPLOC-B2TNmBRb.js} +1 -1
- package/dist/web/assets/{de-DE-XR44H4JA-Ck6sMUnJ.js → de-DE-XR44H4JA-BNOqSnix.js} +1 -1
- package/dist/web/assets/dialog-Juth7dP_.js +1 -0
- package/dist/web/assets/dist-DxwmSTqz.js +1 -0
- package/dist/web/assets/dist-bytwC6rk.js +1 -0
- package/dist/web/assets/download-3BU1OMm1.js +1 -0
- package/dist/web/assets/{el-GR-BZB4AONW-DTkIqoGp.js → el-GR-BZB4AONW-BzwJhjCV.js} +1 -1
- package/dist/web/assets/{en-B4ZKOASM-Boq12EIA.js → en-B4ZKOASM-qumcDTz5.js} +1 -1
- package/dist/web/assets/{es-ES-U4NZUMDT-DY7ipP7c.js → es-ES-U4NZUMDT-CYNwXzvM.js} +1 -1
- package/dist/web/assets/{eu-ES-A7QVB2H4-D4Y6LEUc.js → eu-ES-A7QVB2H4-Bt_WsfwK.js} +1 -1
- package/dist/web/assets/{fa-IR-HGAKTJCU-BlO1bnpc.js → fa-IR-HGAKTJCU-TG6ul0gf.js} +1 -1
- package/dist/web/assets/{fi-FI-Z5N7JZ37-CQlPsyFJ.js → fi-FI-Z5N7JZ37-BEmxMqCH.js} +1 -1
- package/dist/web/assets/folder-open-BQI4k9Xd.js +1 -0
- package/dist/web/assets/{fr-FR-RHASNOE6-DsyF_chP.js → fr-FR-RHASNOE6-DVlOJmrm.js} +1 -1
- package/dist/web/assets/{gl-ES-HMX3MZ6V-BGAJPW2y.js → gl-ES-HMX3MZ6V-C51CVUC3.js} +1 -1
- package/dist/web/assets/{he-IL-6SHJWFNN-BCFUF5Bi.js → he-IL-6SHJWFNN-BaHbjpvX.js} +1 -1
- package/dist/web/assets/{hi-IN-IWLTKZ5I-CWKeCfbn.js → hi-IN-IWLTKZ5I-BnsUhtYU.js} +1 -1
- package/dist/web/assets/{highlighted-body-JLMTFACH-CYOy6uZ1.js → highlighted-body-JLMTFACH-CCL_Oa2N.js} +1 -1
- package/dist/web/assets/{hu-HU-A5ZG7DT2-fqogn_m9.js → hu-HU-A5ZG7DT2-DJAd0DXQ.js} +1 -1
- package/dist/web/assets/{id-ID-SAP4L64H-XFT4nLO5.js → id-ID-SAP4L64H-D_Sp4hWt.js} +1 -1
- package/dist/web/assets/{image-GAAHSSAO-CtqEtsMw.js → image-GAAHSSAO-uTNUnk7Z.js} +1 -1
- package/dist/web/assets/{index-CMRGRbC9.js → index-C60WCVxH.js} +23 -79
- package/dist/web/assets/index-ghfkdpY-.css +1 -0
- package/dist/web/assets/{it-IT-JPQ66NNP-CjvUp5j1.js → it-IT-JPQ66NNP-B2VOtgAl.js} +1 -1
- package/dist/web/assets/{ja-JP-DBVTYXUO-WaxwOOp1.js → ja-JP-DBVTYXUO-D8n4LcP-.js} +1 -1
- package/dist/web/assets/{kaa-6HZHGXH3-BABl6rMV.js → kaa-6HZHGXH3-BvK7fQHB.js} +1 -1
- package/dist/web/assets/{kab-KAB-ZGHBKWFO-vrrKDhKa.js → kab-KAB-ZGHBKWFO-CBS-7rLX.js} +1 -1
- package/dist/web/assets/{kk-KZ-P5N5QNE5-DV0HT-Fa.js → kk-KZ-P5N5QNE5-D6rLwfEb.js} +1 -1
- package/dist/web/assets/{km-KH-HSX4SM5Z-CMzRvYB5.js → km-KH-HSX4SM5Z-DQKGOVey.js} +1 -1
- package/dist/web/assets/{ko-KR-MTYHY66A-7XqecPXy.js → ko-KR-MTYHY66A-D-mh0Zog.js} +1 -1
- package/dist/web/assets/{ku-TR-6OUDTVRD-D8O0bwyA.js → ku-TR-6OUDTVRD-02Q4uBGz.js} +1 -1
- package/dist/web/assets/label-wk_QKooL.js +1 -0
- package/dist/web/assets/link-2-Db-kEge7.js +1 -0
- package/dist/web/assets/list-D_3Q3U-9.js +1 -0
- package/dist/web/assets/{lt-LT-XHIRWOB4-DrK90jMT.js → lt-LT-XHIRWOB4-DLL22EcK.js} +1 -1
- package/dist/web/assets/{lv-LV-5QDEKY6T-D7Xl2RRC.js → lv-LV-5QDEKY6T-D3GBaG3q.js} +1 -1
- package/dist/web/assets/mermaid-WFAXDIZX-B8XO7yhf.js +1 -0
- package/dist/web/assets/{mr-IN-CRQNXWMA-CjH1Q3x7.js → mr-IN-CRQNXWMA--HI3GWMp.js} +1 -1
- package/dist/web/assets/{my-MM-5M5IBNSE-CvdwmXcF.js → my-MM-5M5IBNSE-BzpoSrEn.js} +1 -1
- package/dist/web/assets/{nb-NO-T6EIAALU-BWMKi1Br.js → nb-NO-T6EIAALU-BpE3Sd7f.js} +1 -1
- package/dist/web/assets/{nl-NL-IS3SIHDZ-D5A6sC_f.js → nl-NL-IS3SIHDZ-CVXeRx8i.js} +1 -1
- package/dist/web/assets/{nn-NO-6E72VCQL-D-p6QrsB.js → nn-NO-6E72VCQL-c6qBqD3x.js} +1 -1
- package/dist/web/assets/{oc-FR-POXYY2M6-6fyqLMv5.js → oc-FR-POXYY2M6-Cau2e1RB.js} +1 -1
- package/dist/web/assets/{pa-IN-N4M65BXN-D99Vs_Tb.js → pa-IN-N4M65BXN-BZBndxoR.js} +1 -1
- package/dist/web/assets/{percentages-BXMCSKIN-B0BZzQvB.js → percentages-BXMCSKIN-D3Fw5F9S.js} +1 -1
- package/dist/web/assets/{pl-PL-T2D74RX3-cl5WZaGT.js → pl-PL-T2D74RX3-Z_GpAanN.js} +1 -1
- package/dist/web/assets/{pt-BR-5N22H2LF-T6l12jm6.js → pt-BR-5N22H2LF-BlVpEHGK.js} +1 -1
- package/dist/web/assets/{pt-PT-UZXXM6DQ-DnxUMvhO.js → pt-PT-UZXXM6DQ-QuQH0hsZ.js} +1 -1
- package/dist/web/assets/{ro-RO-JPDTUUEW-w6wCZHtR.js → ro-RO-JPDTUUEW-BGlQpI3X.js} +1 -1
- package/dist/web/assets/{ru-RU-B4JR7IUQ-DMaA4CQ-.js → ru-RU-B4JR7IUQ-CHU0e8TZ.js} +1 -1
- package/dist/web/assets/save-CMSSgXiS.js +1 -0
- package/dist/web/assets/schemas-CGoaq3B4.js +55 -0
- package/dist/web/assets/scratchpad-routes-Dbj7u895.js +1 -0
- package/dist/web/assets/scroll-area-D0FZFdju.js +1 -0
- package/dist/web/assets/select-Cj-m0J9A.js +1 -0
- package/dist/web/assets/{si-LK-N5RQ5JYF-Coe9-5Yb.js → si-LK-N5RQ5JYF-9PXfGp8N.js} +1 -1
- package/dist/web/assets/{sk-SK-C5VTKIMK-Bq23BXvP.js → sk-SK-C5VTKIMK-CuzZf_b9.js} +1 -1
- package/dist/web/assets/{sl-SI-NN7IZMDC-WZEKy1qu.js → sl-SI-NN7IZMDC-DrOH-WzJ.js} +1 -1
- package/dist/web/assets/subset-shared.chunk-CNd4ljrr.js +1 -0
- package/dist/web/assets/{subset-worker.chunk-CAbfOFrS.js → subset-worker.chunk-C1uKhPt9.js} +1 -1
- package/dist/web/assets/{sv-SE-XGPEYMSR-p1gc_GrE.js → sv-SE-XGPEYMSR-BhIUxUn8.js} +1 -1
- package/dist/web/assets/{ta-IN-2NMHFXQM-o8J0vNj1.js → ta-IN-2NMHFXQM-DxBax1RW.js} +1 -1
- package/dist/web/assets/table-Cri9EUoE.js +1 -0
- package/dist/web/assets/{tabs-DltQVo38.js → tabs-Cv3KJIRq.js} +1 -1
- package/dist/web/assets/textarea-Bt1FBmGL.js +1 -0
- package/dist/web/assets/{th-TH-HPSO5L25-pt7Zt9xm.js → th-TH-HPSO5L25-DA8qp-YV.js} +1 -1
- package/dist/web/assets/{tr-TR-DEFEU3FU-BENdvVvp.js → tr-TR-DEFEU3FU-3u6WSMcx.js} +1 -1
- package/dist/web/assets/{uk-UA-QMV73CPH-CenI2hX1.js → uk-UA-QMV73CPH-BbCm-sIk.js} +1 -1
- package/dist/web/assets/upload-BZ3CpmMe.js +1 -0
- package/dist/web/assets/useDetailRoute-DOhAbdV7.js +1 -0
- package/dist/web/assets/useJobs-B2da-s4n.js +1 -0
- package/dist/web/assets/useKnowledge-BGBP3GLW.js +1 -0
- package/dist/web/assets/useListSelection-ZreW_5e4.js +1 -0
- package/dist/web/assets/{useMemories-D0tEN20z.js → useMemories-UaTju2A_.js} +1 -1
- package/dist/web/assets/useProjectScope-DtEj9j-P.js +1 -0
- package/dist/web/assets/useSessions-BNSlPToV.js +1 -0
- package/dist/web/assets/{vi-VN-M7AON7JQ-REgvRLzg.js → vi-VN-M7AON7JQ-DgsVZ_V1.js} +1 -1
- package/dist/web/assets/view-params-DD7i9s5g.js +1 -0
- package/dist/web/assets/x-CiIWeCBP.js +1 -0
- package/dist/web/assets/{zh-CN-LNUGB5OW-Ceo4z5r5.js → zh-CN-LNUGB5OW-DOVvsMem.js} +1 -1
- package/dist/web/assets/{zh-HK-E62DVLB3-CFQOn9E1.js → zh-HK-E62DVLB3-BuhcmxhT.js} +1 -1
- package/dist/web/assets/{zh-TW-RAJ6MFWO-GpxYPogk.js → zh-TW-RAJ6MFWO-DieBH0AH.js} +1 -1
- package/dist/web/index.html +19 -18
- package/dist/web/provider-notices.txt +58 -0
- package/package.json +1 -1
- package/dist/web/assets/Agents-D71JHI2H.js +0 -34
- package/dist/web/assets/Attention-C_LKxdwf.js +0 -2
- package/dist/web/assets/Audit-BWh52YwS.js +0 -1
- package/dist/web/assets/ConfirmDialog-D25Wf6Nc.js +0 -1
- package/dist/web/assets/Dashboard-DmYJjKna.js +0 -1
- package/dist/web/assets/DocumentWorkspace-CW6S2i4-.js +0 -1
- package/dist/web/assets/FileEditor-_z3t0Dbd.js +0 -1
- package/dist/web/assets/JobWebhooks-Z4MXZNvH.js +0 -1
- package/dist/web/assets/Jobs-B-7i16mV.js +0 -1
- package/dist/web/assets/Knowledge-DX3nwzng.js +0 -1
- package/dist/web/assets/Markdown-BYChkZ3Z.js +0 -2
- package/dist/web/assets/MarkdownEditor-BMQq1cAY.js +0 -2
- package/dist/web/assets/PackageCatalog-CYF3tX8J.js +0 -8
- package/dist/web/assets/Projects-C2Ei5Q8Q.js +0 -3
- package/dist/web/assets/RemoteFolderBrowser-Btryj6gG.js +0 -1
- package/dist/web/assets/ResumeActions-1gJa3nsX.js +0 -1
- package/dist/web/assets/Rules-CZvA-Eis.js +0 -18
- package/dist/web/assets/Scratchpads-DP_v2hc8.js +0 -10
- package/dist/web/assets/Sessions-Ctd49sC9.js +0 -3
- package/dist/web/assets/Settings-BmbdT6Mp.js +0 -5
- package/dist/web/assets/Skills-C_bBvy92.js +0 -8
- package/dist/web/assets/TagInput-T6rDuQ7O.js +0 -1
- package/dist/web/assets/TaskDetailSheet-BiIQ82AG.js +0 -1
- package/dist/web/assets/Tasks-OQmOaNqh.js +0 -24
- package/dist/web/assets/Terminals-DISwtHL-.css +0 -1
- package/dist/web/assets/Terminals-DVu5OtGU.js +0 -3
- package/dist/web/assets/ViewHeader-DHM9SSkD.js +0 -1
- package/dist/web/assets/Webhooks-CDNv5fUD.js +0 -1
- package/dist/web/assets/arrow-left-Czr-LF4l.js +0 -1
- package/dist/web/assets/bundle-mjs-CdK3cBzO.js +0 -1
- package/dist/web/assets/button-BHKbOsmj.js +0 -1
- package/dist/web/assets/check-hFtKhUSV.js +0 -1
- package/dist/web/assets/chevron-down-D2sszSv3.js +0 -1
- package/dist/web/assets/client-BwhkVepQ.js +0 -1
- package/dist/web/assets/copy-d40YbOUX.js +0 -1
- package/dist/web/assets/createLucideIcon-jLuHkL03.js +0 -1
- package/dist/web/assets/dist-B9K53eWS.js +0 -1
- package/dist/web/assets/dist-ClOxCp9t.js +0 -1
- package/dist/web/assets/dist-D3PXSw6Q.js +0 -1
- package/dist/web/assets/dist-HH469UWY.js +0 -1
- package/dist/web/assets/download-WG9NKrMe.js +0 -1
- package/dist/web/assets/folder-open-D5XA0mXE.js +0 -1
- package/dist/web/assets/index-BCGI8JzG.css +0 -1
- package/dist/web/assets/label-BQ1Lr4sA.js +0 -1
- package/dist/web/assets/link-2-DSYfKX_9.js +0 -1
- package/dist/web/assets/list-DhKHpsuX.js +0 -1
- package/dist/web/assets/mermaid-WFAXDIZX-CiFtUZlz.js +0 -1
- package/dist/web/assets/react-dom-DTbwZiiP.js +0 -1
- package/dist/web/assets/save-3DxWVsBU.js +0 -1
- package/dist/web/assets/scratchpad-routes-B75DnNPp.js +0 -1
- package/dist/web/assets/scroll-area-DMjOmHf5.js +0 -1
- package/dist/web/assets/select-CBHDS40x.js +0 -1
- package/dist/web/assets/subset-shared.chunk-CAD0Eg6H.js +0 -1
- package/dist/web/assets/table-ByS-sgsb.js +0 -1
- package/dist/web/assets/upload-Djrxq3zy.js +0 -1
- package/dist/web/assets/useDetailRoute-C8xQeILG.js +0 -1
- package/dist/web/assets/useJobs-CCQUWZt3.js +0 -1
- package/dist/web/assets/useKnowledge-DbjT1a0E.js +0 -1
- package/dist/web/assets/useListSelection-CgpNqqAb.js +0 -1
- package/dist/web/assets/useProjectScope-CZEfU9mq.js +0 -1
- package/dist/web/assets/useSessions-C2GU4FkG.js +0 -1
- package/dist/web/assets/view-params-BqRwdnv0.js +0 -1
- package/dist/web/assets/x-BKorzD7S.js +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: orc-platform
|
|
3
|
-
description: "Operate ORC: CLI/API/MCP, auth/settings, projects, tasks/flows, memory/KB/digests/embeddings, sessions/handoff, terminals/chat, jobs/gateway, agents/backends/packages, Git/GitHub/SSH, rules/hooks, tags/audit, scratchpads (plans, diagrams, HTML), dashboard links."
|
|
3
|
+
description: "Operate ORC: CLI/API/MCP, auth/settings, projects, tasks/flows, memory/KB/digests/embeddings, sessions/handoff, terminals/chat, jobs/channels/gateway, agents/backends/packages, Git/GitHub/SSH, rules/hooks, tags/audit, scratchpads (plans, diagrams, HTML), dashboard links."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Operate ORC
|
|
@@ -39,6 +39,7 @@ verify the returned hash/size without loading the script body into context.
|
|
|
39
39
|
| KB intake/search/edit, parsers, embeddings, README/Markdown and living Learnings digests | [Knowledge and documentation](references/knowledge.md) |
|
|
40
40
|
| Scratchpads: plans/docs with mermaid, Excalidraw diagrams, interactive HTML pages with or without ORC access | [Scratchpads](references/scratchpads.md) |
|
|
41
41
|
| Projects, tasks/flows, jobs, gateway, status, tags and audit | [Work and operations](references/work.md) |
|
|
42
|
+
| Channel setup, Telegram/Slack, inbound agent routing, outbound API/MCP, Markdown/native payloads | [Channels](references/channels.md) |
|
|
42
43
|
| Session continuity/handoff, terminals, chat, SSH execution, Git/GitHub | [Sessions and execution](references/execution.md) |
|
|
43
44
|
| Archive local coding sessions on remote ORC, incremental sync/deduplication, session retrieval design | [Session archive and search](references/session-archive.md) |
|
|
44
45
|
| Deterministic rules, hooks and enforcement capabilities | [Rules](references/rules.md) |
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# Channels: messages, setup and inbound routing
|
|
2
|
+
|
|
3
|
+
Channels are bidirectional: an approved inbound message can invoke an agent through an ordered route; an authorized agent can send independently through MCP or HTTP API. Settings > Channels manages connections, recipients and rules. Telegram and Slack are initially supported.
|
|
4
|
+
|
|
5
|
+
## Discover before sending
|
|
6
|
+
|
|
7
|
+
1. Select the intended ORC installation and project; call context as usual.
|
|
8
|
+
2. Call `channel_list` for connections, readiness, provider capabilities and native API documentation.
|
|
9
|
+
3. Call `channel_targets` with a connection ID. Use a configured recipient alias such as `me`; never invent chat IDs or choose a different recipient on failure.
|
|
10
|
+
4. Call `channel_send`; retain its receipt ID. Use `channel_message_get` to inspect delivery and `channel_message_update` to edit an accepted message.
|
|
11
|
+
|
|
12
|
+
All request bodies are JSON. Examples below are MCP arguments; the equivalent send API is `POST /api/channels/messages` with the same body (use `project_id` for HTTP requests).
|
|
13
|
+
|
|
14
|
+
```json
|
|
15
|
+
{
|
|
16
|
+
"connection": "personal-telegram",
|
|
17
|
+
"target": "me",
|
|
18
|
+
"message": {
|
|
19
|
+
"text": "**Task completed**\nTests passed.\n\n- API updated\n- Documentation updated",
|
|
20
|
+
"links": [{ "label": "Open task", "url": "https://orc.example/tasks/123" }]
|
|
21
|
+
},
|
|
22
|
+
"idempotency_key": "task-123-summary-v1"
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Common Markdown is the default: emphasis, lists, code and links render automatically for the provider. Use `message.format: "plain"` for literal text. Long generated messages split safely; check returned warnings for presentation fallback. `thread_id` selects a reply thread within an approved destination; a destination bound to a specific thread cannot be redirected.
|
|
27
|
+
|
|
28
|
+
## Full native message control
|
|
29
|
+
|
|
30
|
+
`overrides` is a native provider JSON object. It is not a list of ORC instructions and has no extra provider-name wrapper. Every provider-supported message option, including new fields ORC does not know about, passes through. Explicit values replace generated values; arrays replace entire arrays. The provider validates native options. ORC does not automatically rewrite, split or sanitize explicit native presentation.
|
|
31
|
+
|
|
32
|
+
Slack, using native Block Kit:
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
{
|
|
36
|
+
"connection": "work-slack",
|
|
37
|
+
"target": "me",
|
|
38
|
+
"message": { "text": "Task completed. Open the task in ORC." },
|
|
39
|
+
"overrides": {
|
|
40
|
+
"unfurl_links": false,
|
|
41
|
+
"blocks": [
|
|
42
|
+
{ "type": "section", "text": { "type": "mrkdwn", "text": "*Task completed*\nAll checks passed." } },
|
|
43
|
+
{ "type": "actions", "elements": [
|
|
44
|
+
{ "type": "button", "action_id": "open-task", "text": { "type": "plain_text", "text": "Open task" }, "url": "https://orc.example/tasks/123" }
|
|
45
|
+
] }
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Telegram, using native HTML and an inline keyboard:
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"connection": "personal-telegram",
|
|
56
|
+
"target": "me",
|
|
57
|
+
"message": { "text": "Task completed." },
|
|
58
|
+
"overrides": {
|
|
59
|
+
"text": "<b>Task completed</b>\n<code>12 tests passed</code>",
|
|
60
|
+
"parse_mode": "HTML",
|
|
61
|
+
"disable_notification": true,
|
|
62
|
+
"reply_markup": { "inline_keyboard": [[
|
|
63
|
+
{ "text": "Open task", "url": "https://orc.example/tasks/123" }
|
|
64
|
+
]] }
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Keep fallback text useful for Slack notifications and accessibility. Escape your own native HTML/mrkdwn as the provider requires. Overrides are bounded JSON, not an arbitrary HTTP proxy: ORC controls credentials, provider endpoint, message ownership and authorized destination. `channel_send` uses Telegram `sendMessage` or Slack `chat.postMessage`; overriding message options does not select another API operation. Native attachment/block options are available on those methods; separate file-upload endpoints are not implied.
|
|
70
|
+
|
|
71
|
+
Connection `config.message_defaults` can set native message defaults. Precedence is generated common message, then connection defaults, then per-send overrides. Credentials never belong in config/message payloads.
|
|
72
|
+
|
|
73
|
+
Native references: [Telegram sendMessage](https://core.telegram.org/bots/api#sendmessage), [Telegram formatting](https://core.telegram.org/bots/api#formatting-options), [Slack chat.postMessage](https://docs.slack.dev/reference/methods/chat.postMessage/), [Slack Block Kit](https://docs.slack.dev/block-kit/).
|
|
74
|
+
|
|
75
|
+
## Setup
|
|
76
|
+
|
|
77
|
+
Telegram: use BotFather to obtain a bot token or select `ORC_TELEGRAM_TOKEN` in Settings. Save and verify the bot, enable the connection, then use Pair my Telegram. Open the expiring link, start the bot and confirm the candidate user/chat in authenticated Settings. This creates `me` for outbound messaging; inbound and Attention are separate opt-ins. ORC uses long polling. A webhook or another active poller is an ownership conflict; do not delete a webhook or steal the bot automatically.
|
|
78
|
+
|
|
79
|
+
Slack: copy the manifest in Settings, create/install a Slack app in the intended workspace, enable Socket Mode, and configure the bot token and app token (`connections:write`). `ORC_SLACK_BOT_TOKEN` and `ORC_SLACK_APP_TOKEN` are supported. Verify the workspace. Pair a private DM through Pair my Slack, or configure an approved channel ID and sender IDs manually. Invite the bot to channel destinations. Permissions and event subscriptions must cover the selected conversation types; inspect provider errors such as `missing_scope`, `not_in_channel`, or `channel_not_found`.
|
|
80
|
+
|
|
81
|
+
Pairing is short-lived, single-use and requires authenticated confirmation. Only one listener owns a provider account. Secrets are server-side encrypted or referenced through environment variables and are never returned to agents or the browser. Never paste bot credentials into an MCP message, scratchpad or job prompt.
|
|
82
|
+
|
|
83
|
+
## Ordered inbound routing
|
|
84
|
+
|
|
85
|
+
Enable inbound on an approved destination and list allowed sender IDs. Authorization precedes routing. Rules run in saved order; the first enabled matching rule wins. No match launches no agent. An ignore rule stops routing. No implicit fallthrough into a general-purpose agent handler is allowed.
|
|
86
|
+
|
|
87
|
+
Settings provides a visual builder for nested **Match all (AND)**, **Match any (OR)** and **Exclude matches (NOT)** groups. Conditions use named fields, comparisons and typed values; no JSON editing is needed. Numbered rules show their conditions and destination. Move rules up/down to set priority; disabled rules are skipped. Apply a rule, then save the connection. Preview uses saved rules and never invokes an agent.
|
|
88
|
+
|
|
89
|
+
The separate **Otherwise** rule is optional, fixed last, and runs only after every enabled condition rule fails. It can route to an agent or ignore silently; recipient/project authorization still applies. With no enabled default, authorized unmatched messages get setup guidance and no agent starts. Reply setup and newly added rules insert before Otherwise. HTTP configuration represents this final fallback with `condition: {"always":true}`; the API rejects multiple defaults, a default before other rules, or a nested `always` predicate.
|
|
90
|
+
|
|
91
|
+
API condition trees support `all`, `any` and `not`, with at most five levels and 100 condition nodes. Predicates have `field`, `op`, and `value`. Fields: `sender`, `chat`, `thread`, `text`, `command`, `is_direct`, `is_mention`, `kind`. Operators: `is`, `in`, `contains`, `starts_with`. `in` uses a string array; boolean comparisons use JSON booleans. Comparisons are case-sensitive. No arbitrary scripts or unbounded regular expressions.
|
|
92
|
+
|
|
93
|
+
```json
|
|
94
|
+
{
|
|
95
|
+
"id": "private-work",
|
|
96
|
+
"name": "Nir's private work messages",
|
|
97
|
+
"enabled": true,
|
|
98
|
+
"condition": {
|
|
99
|
+
"all": [
|
|
100
|
+
{ "field": "is_direct", "op": "is", "value": true },
|
|
101
|
+
{ "any": [
|
|
102
|
+
{ "field": "command", "op": "is", "value": "work" },
|
|
103
|
+
{ "field": "text", "op": "starts_with", "value": "ORC " }
|
|
104
|
+
] },
|
|
105
|
+
{ "not": { "field": "text", "op": "contains", "value": "ignore" } }
|
|
106
|
+
]
|
|
107
|
+
},
|
|
108
|
+
"action": { "type": "agent", "agent": "codex", "project_id": "PROJECT_ID" }
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
An agent action names its backend and project; optional `profile` selects an existing agent profile. The project needs an active scope directory available on the configured execution host. Sessions are separated by connection, chat/thread, sender and route/action. Agent replies return through the original destination. Pairing and Attention commands are handled before ordinary routing. Native button callbacks have `kind: "action"`; their value (or Slack action ID when no value exists) is untrusted input that can reach an agent only through an authorized matching route. New rules default to `kind: "message"`; use an action rule to handle custom buttons. A rule without a kind condition can match either kind. A callback never directly executes a command or bypasses native permissions.
|
|
113
|
+
|
|
114
|
+
Use the saved-rule preview in Settings, or `POST /api/channels/{id}/route-test`, to test authorization and rule matching without invoking an agent.
|
|
115
|
+
|
|
116
|
+
## Questions, approvals and delivery
|
|
117
|
+
|
|
118
|
+
Use existing `human_request` / `human_request_get` / `human_request_acknowledge` tools for durable questions and approvals. Select provider notifications with `notify`; the destination must opt into Questions and approvals. Channel-native agent requests enter the same Attention store. `/attention` replies are bound to the offered connection, recipient, chat/thread, request version and expiry. Approval messages do not bypass ORC rules or native permissions.
|
|
119
|
+
|
|
120
|
+
`accepted` means the provider accepted a message, not that Nir read it. `failed` means a definite provider rejection; `unknown` means the request may have reached the provider; `partial` means some chunks succeeded. Inspect unknown/partial outcomes before retrying. The same idempotency key and identical request return the same receipt; reusing a key with different content conflicts. Never promise exactly-once delivery across network failures.
|
|
121
|
+
|
|
122
|
+
Receipt/idempotency metadata and inbound duplicate records are retained for 30 days. Expired pairing/action metadata is pruned after a further day. Queued invocations recheck current authorization and routing before execution. Editing a recipient does not redirect an already running agent's reply. A detected competing Telegram poller leaves the connection stopped; resolve the conflict and save explicitly to retry.
|
|
123
|
+
|
|
124
|
+
HTTP API: provider discovery and `/channels`; `PUT /channels/{id}` for revision-checked configuration; `/channels/{id}/verify`, `/targets`, `/pairings`, `/route-test`; `/channels/pairings/{id}` and `/confirm`; `POST /channels/messages`; `GET`/`PATCH /channels/messages/{id}`. Prefix paths with `/api`. API and MCP use the same service and validation. The SDK exposes `channels` methods. Routine agent MCP does not expose credential/setup writes.
|
|
125
|
+
|
|
126
|
+
Definitions live in SQLite (`channels`, `channel_targets`, `channel_routes`). Provider configuration and encrypted credential references are JSON fields; rule order is explicit. Preserve the returned `revision` when saving configuration; reload on a conflict rather than overwriting someone else's changes.
|
|
127
|
+
|
|
128
|
+
## Two-way conversations and chat controls
|
|
129
|
+
|
|
130
|
+
In Settings → Channels, pair a recipient, then choose **Set up agent replies**. Select its default project, agent and optional model, apply, then save. Agent `default` follows Chat Settings. The flow enables inbound/outbound/questions and retains recipient project restrictions. Earlier routing rules retain priority. Every selected project needs an active working folder available on the execution host.
|
|
131
|
+
|
|
132
|
+
The first matching rule supplies defaults. Ordinary messages reach the selected agent; follow-ups resume its native session. Conversations are separated by connection, chat, thread, sender and route. Sessions and model choices are additionally separated by project. Unmatched messages explain setup; explicit ignore rules remain silent. Unapproved senders invoke neither controls nor agents.
|
|
133
|
+
|
|
134
|
+
The intentionally small control menu manages chat:
|
|
135
|
+
|
|
136
|
+
- `/help`: chat controls and custom shortcuts.
|
|
137
|
+
- `/status`: active project/folder, agent, model and session.
|
|
138
|
+
- `/project [name-or-id|default]`: choose an allowed project with buttons or by name. The project's configured working folder is the agent spawn directory. Returning to a project resumes its selected conversation. Recipient project restrictions are enforced on selection and every subsequent turn.
|
|
139
|
+
- `/agent [name|default]`: choose an agent with buttons or restore the routing default. Conversations for different agents remain separate and can be selected again.
|
|
140
|
+
- `/model [id|default]`: choose from the available model catalog or supply an explicit ID. Restore the route/backend default with `default`; the choice takes effect on the next turn and persists with that session.
|
|
141
|
+
- `/session new|list|switch <id-or-number>|stop`: create, select or stop sessions in the active project. Switch controls restore that session's agent/model. `/stop` immediately cancels the active turn and already queued input.
|
|
142
|
+
|
|
143
|
+
Tasks, jobs and other ORC operations belong to the agent's tools. Unknown slash input goes to the backend's native command vocabulary. Sensitive operations still use existing human approvals.
|
|
144
|
+
|
|
145
|
+
Slack uses the app's `/orc` entry point: `/orc help`, `/orc project my-project`, `/orc session new`, `/orc summary task-123`. The Slack manifest registers `/orc` with the `commands` scope. Plain messages and mentions use the same routing pipeline. Telegram registers the chat controls and configured shortcuts in its command menu.
|
|
146
|
+
|
|
147
|
+
Configure shortcuts in Settings → Custom commands, or connection config JSON:
|
|
148
|
+
|
|
149
|
+
```json
|
|
150
|
+
{"commands":[{"command":"summary","description":"Summarize a task","prompt":"Summarize task $ARGUMENTS and return its ORC link."}]}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
`/summary task-123` expands the prompt after authorization/routing. `$ARGUMENTS` is literal string substitution, never shell evaluation. Without the placeholder, arguments are appended. Shortcuts cannot replace chat controls or expand project permissions. Native message overrides remain independent of shortcuts.
|
|
154
|
+
|
|
155
|
+
Questions and approvals reuse durable Attention requests. Buttons are bound to the originating sender, connection, recipient and thread. Plain text answers the single pending question offered to that conversation; multiple questions require explicit response instructions. Plain “yes” never grants approval. Sensitive requests remain in ORC; revoking project access or disabling approvals immediately blocks old controls.
|
|
156
|
+
|
|
157
|
+
## Delivery and recovery
|
|
158
|
+
|
|
159
|
+
- A provider-accepted receipt proves API acceptance, not that a human read it. Native IDs and immutable original destination are retained; moving a recipient alias cannot redirect message edits.
|
|
160
|
+
- Safe provider rate-limit responses may retry with bounded provider-specified delay. Ambiguous network outcomes never retry automatically. Multi-chunk partial send/edit outcomes are persisted for inspection.
|
|
161
|
+
- Native content fields such as `text`, `blocks` and `attachments` stay intact. Delivery-only overrides retain common Markdown rendering and long-message chunking. Explicit arrays replace generated arrays.
|
|
162
|
+
- Telegram polling cursors are persisted per connection/account. New setup ignores old backlog; reconnects resume new messages received during downtime. Already claimed/interrupted agent turns are not automatically replayed, preventing duplicate tool effects. Inspect the session before intentionally resending.
|
|
163
|
+
- Provider ownership leases prevent competing listeners within shared ORC storage. An external Telegram conflict stops until explicit configuration retry. Credential rotation refreshes the affected transport; Slack is ready only after its socket opens.
|
|
164
|
+
|
|
165
|
+
## Shared chat guidance and tool discovery
|
|
166
|
+
|
|
167
|
+
Channel conversations reuse the dashboard's configured chat system prompt. The shared baseline suggests reading relevant built-in ORC skills when real task work is needed: orc-sdlc for engineering and orc-platform for platform operations. Custom chat instructions are preserved. Meta mode is the default, so agents discover tools without receiving the full domain catalog up front. Full mode remains an explicit integration option.
|
|
168
|
+
|
|
169
|
+
Tool allowlists are a separate backend capability. Claude adapters enforce native tool restrictions; their existing ORC MCP namespace exception still allows ORC operations. Codex does not advertise allowlist enforcement, and unsupported explicit/profile allowlists are rejected rather than silently ignored. These allowlists are not an OS sandbox or an ORC operation permission policy. Channel recipient/project authorization and native human approval checks still apply independently.
|
|
@@ -98,7 +98,7 @@ HTTP MCP use `<origin>/mcp` and the configured auth header; do not append `/api`
|
|
|
98
98
|
to that MCP endpoint. Preserve other MCP servers when editing client config.
|
|
99
99
|
|
|
100
100
|
Stdio `orc mcp` defaults to meta mode; pass `--mode full` to list every domain
|
|
101
|
-
tool directly. HTTP `/mcp` defaults to
|
|
101
|
+
tool directly. HTTP `/mcp` also defaults to meta; `/mcp?mode=full` explicitly lists all domain tools. Meta mode exposes `tool_search`, `tool_describe`, `tool_invoke`:
|
|
102
102
|
search by intent, describe unknown arguments, then invoke the selected tool.
|
|
103
103
|
Reach `context` and other named tools through `tool_invoke` in meta mode.
|
|
104
104
|
Connectors, loaded skills and installed hooks do not establish equal enforcement
|
|
@@ -118,9 +118,9 @@ mode. Keep API authentication in the configured Authorization header.
|
|
|
118
118
|
Examples, relative to the selected ORC origin:
|
|
119
119
|
|
|
120
120
|
```text
|
|
121
|
-
/mcp #
|
|
121
|
+
/mcp # meta tools, existing tool/config defaults
|
|
122
122
|
/mcp?mode=meta # meta tools, existing tool/config defaults
|
|
123
|
-
/mcp?project=orc #
|
|
123
|
+
/mcp?project=orc # meta tools, ORC project defaults
|
|
124
124
|
/mcp?projects=orc,project2 # full tools, both projects
|
|
125
125
|
/mcp?projects=orc,project2&mode=meta # both projects through meta tools
|
|
126
126
|
```
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import{a as e}from"./rolldown-runtime-DSDNlrLa.js";import{n as t,t as n}from"./jsx-runtime-CVMpzJz9.js";import{n as r}from"./QueryClientProvider-DlPztvhd.js";import{n as i,t as a}from"./useMutation-HX90wI4L.js";import{t as o,u as s}from"./chunk-OB3PAWPO-1IihCzFx.js";import{t as c}from"./button-CXYVslgR.js";import{t as l}from"./label-wk_QKooL.js";import{n as u}from"./client-nzMXason.js";import{a as d,n as f,o as p,t as m}from"./dialog-Juth7dP_.js";import{Ft as h,G as g,It as _,K as v,Nt as y,Pt as b,W as x,X as S,Y as C,ct as w,ln as T,p as E}from"./index-C60WCVxH.js";import{i as D,n as O,t as k}from"./PackageRunDialog-BPLlcUBW.js";import{t as A}from"./ConfirmDialog-Cyd60q9b.js";import{t as j}from"./ErrorState-BrKz7Mii.js";import{t as M}from"./ViewHeader-Ce5HQRJu.js";import{t as N}from"./useDetailRoute-DOhAbdV7.js";import{t as P}from"./view-params-DD7i9s5g.js";var F=e(t(),1),I={specialist:`---
|
|
2
|
+
name: Specialist
|
|
3
|
+
description: Describe when to use this specialist
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
You are a specialist. Define your role, scope, and expected output.
|
|
7
|
+
`,reviewer:`---
|
|
8
|
+
name: Reviewer
|
|
9
|
+
description: Review changes and report actionable findings
|
|
10
|
+
tools:
|
|
11
|
+
Read: true
|
|
12
|
+
Grep: true
|
|
13
|
+
Bash: false
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
Review the working diff. Check correctness, security, and tests. Cite file paths and explain each finding.
|
|
17
|
+
`,builder:`---
|
|
18
|
+
name: Builder
|
|
19
|
+
description: Implement changes and verify the result
|
|
20
|
+
tools:
|
|
21
|
+
Read: true
|
|
22
|
+
Edit: true
|
|
23
|
+
Write: true
|
|
24
|
+
Bash: true
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
Implement the requested change, preserve unrelated work, and run relevant checks. Report the result and any remaining issues.
|
|
28
|
+
`};function L(e){let t=O(e,{stringKeys:!0});if(t.errors.length)throw Error(t.errors[0].message);if(t.warnings.length)throw Error(t.warnings[0].message);if(!D(t.contents))throw Error(`YAML configuration must be a mapping.`);let n=t.toJS({maxAliasCount:100});if(!n||typeof n!=`object`||Array.isArray(n))throw Error(`YAML configuration must be a mapping.`);return JSON.stringify(n),{document:t,fields:n}}function R(e){let t=e.replace(/^\uFEFF/,``).match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n([\s\S]*))?$/);if(!t)throw Error(`Add YAML configuration between --- lines, followed by instructions.`);return{...L(t[1]),body:t[2]??``,newline:e.includes(`\r
|
|
29
|
+
`)?`\r
|
|
30
|
+
`:`
|
|
31
|
+
`,bom:e.startsWith(``)?``:``}}function z(e,t,n){let r=R(e);n===void 0?r.document.delete(t):r.document.set(t,n);let i=r.document.toString().trimEnd().replace(/\n/g,r.newline);return`${r.bom}---${r.newline}${i}${r.newline}---${r.newline}${r.body}`}function B(e,t){let n=e.match(/^((?:\uFEFF)?---\r?\n[\s\S]*?\r?\n---)(?:\r?\n[\s\S]*)?$/)?.[1];if(!n)throw Error(`Missing YAML configuration.`);return`${n}${e.includes(`\r
|
|
32
|
+
`)?`\r
|
|
33
|
+
`:`
|
|
34
|
+
`}${t}`}function V(e){let t=e.tools;if(t===void 0)return[];if(typeof t==`string`)return t.split(/[\s,]+/).filter(Boolean).map(e=>({name:e,allowed:!0}));if(Array.isArray(t)&&t.every(e=>typeof e==`string`))return t.map(e=>({name:e,allowed:!0}));if(t&&typeof t==`object`&&!Array.isArray(t))return Object.entries(t).map(([e,t])=>{if(typeof t!=`boolean`)throw Error(`Tool "${e}" must be true or false.`);return{name:e,allowed:t}});throw Error(`Tools must be a mapping of names to true/false, a list, or a string.`)}function H(e,t){let n=R(e);D(n.document.get(`tools`,!0))||n.document.set(`tools`,{});let r=n.document.get(`tools`,!0);if(D(r))for(let{name:e}of V(n.fields))t.some(t=>t.name===e)||n.document.deleteIn([`tools`,e]);for(let e of t)n.document.setIn([`tools`,e.name],e.allowed);return`${n.bom}---${n.newline}${n.document.toString().trimEnd().replace(/\n/g,n.newline)}${n.newline}---${n.newline}${n.body}`}var U=n();function W(e){return V(e).map(e=>({...e,key:crypto.randomUUID()}))}function G({agent:e,pending:t,error:n,onSave:r}){let[i,a]=(0,F.useState)(e?.id??``),[o,s]=(0,F.useState)(e?.raw??I.specialist),[u,m]=(0,F.useState)(`fields`),[h,g]=(0,F.useState)(()=>e?W(e.fields):[]),[v,y]=(0,F.useState)(),b=(0,F.useMemo)(()=>{try{return{value:R(o),error:void 0}}catch(e){return{value:void 0,error:e.message}}},[o]),x=b.value?.fields,S;h.some(e=>!e.name.trim())?S=`Enter a name for every tool.`:new Set(h.map(e=>e.name.trim())).size!==h.length&&(S=`Tool names must be unique.`);let C=e?`Save changes`:`Create agent`;function T(e){g(e),e.every(e=>e.name.trim())&&new Set(e.map(e=>e.name.trim())).size===e.length&&s(H(o,e.map(e=>({...e,name:e.name.trim()}))))}function E(){if(y(void 0),u===`fields`){if(S)return;m(`source`)}else try{let e=R(o);for(let t of[`name`,`description`,`model`,`color`])if(e.fields[t]!==void 0&&typeof e.fields[t]!=`string`)throw Error(`${t} must be a string to edit it in the form.`);g(W(e.fields)),m(`fields`)}catch(e){y(e.message)}}return(0,U.jsxs)(f,{className:`max-w-3xl max-h-[90vh] overflow-y-auto`,children:[(0,U.jsx)(d,{children:(0,U.jsx)(p,{children:e?`Edit ${e.name}`:`New shared agent`})}),(0,U.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>{e.preventDefault(),r(i,o)},children:[(0,U.jsxs)(`fieldset`,{disabled:t,className:`space-y-4`,children:[!e&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(l,{htmlFor:`agent-template`,children:`Starting template`}),(0,U.jsxs)(`select`,{id:`agent-template`,"data-testid":`agent-template`,className:`w-full border rounded-xs p-2 bg-surface`,defaultValue:`specialist`,onChange:e=>{let t=I[e.target.value];s(t),g(W(R(t).fields)),y(void 0)},children:[(0,U.jsx)(`option`,{value:`specialist`,children:`General specialist`}),(0,U.jsx)(`option`,{value:`reviewer`,children:`Reviewer`}),(0,U.jsx)(`option`,{value:`builder`,children:`Builder`})]})]}),(0,U.jsx)(l,{htmlFor:`agent-id`,children:`Agent ID`}),(0,U.jsx)(_,{id:`agent-id`,"data-testid":`agent-id-input`,value:i,disabled:!!e,onChange:e=>a(e.target.value),placeholder:`security-review`}),(0,U.jsx)(c,{type:`button`,variant:`outline`,"data-testid":`agent-editor-mode`,onClick:E,disabled:u===`fields`&&!!S,children:u===`fields`?`Edit YAML + Markdown`:`Edit fields`}),u===`source`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(l,{htmlFor:`agent-definition`,children:`YAML configuration + Markdown instructions`}),(0,U.jsx)(w,{id:`agent-definition`,testId:`agent-content-input`,path:`agent.agent.md`,readOnly:t,height:400,value:o,onChange:e=>{s(e),y(void 0)}})]}):x&&(0,U.jsxs)(U.Fragment,{children:[[[`name`,`Name`],[`description`,`Description`],[`model`,`Model (optional)`],[`color`,`Color (optional)`]].map(([e,t])=>(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(l,{htmlFor:`agent-${e}`,children:t}),(0,U.jsx)(_,{id:`agent-${e}`,"data-testid":`agent-${e}-input`,value:typeof x[e]==`string`?x[e]:``,onChange:t=>s(z(o,e,t.target.value||(e===`description`?``:void 0)))})]},e)),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,U.jsx)(`input`,{"data-testid":`agent-custom-tools`,type:`checkbox`,checked:x.tools!==void 0,onChange:e=>{g([]),s(z(o,`tools`,e.target.checked?{}:void 0))}}),` `,`Customize tool access`]}),(0,U.jsx)(`p`,{className:`text-xs text-outline`,children:`Use the tool names supported by your chosen backend. With customization off, the backend's default tools apply. An empty custom list allows no tools.`}),x.tools!==void 0&&(0,U.jsxs)(U.Fragment,{children:[h.map((e,t)=>(0,U.jsxs)(`div`,{"data-testid":`agent-tool-row`,className:`flex items-center gap-2`,children:[(0,U.jsx)(_,{"data-testid":`agent-tool-name`,"aria-label":`Tool ${t+1} name`,value:e.name,list:`agent-tool-suggestions`,onChange:e=>T(h.map((n,r)=>r===t?{...n,name:e.target.value}:n))}),(0,U.jsxs)(`label`,{className:`flex items-center gap-1 text-sm`,children:[(0,U.jsx)(`input`,{"data-testid":`agent-tool-allowed`,type:`checkbox`,checked:e.allowed,onChange:e=>T(h.map((n,r)=>r===t?{...n,allowed:e.target.checked}:n))}),` `,`Allowed`]}),(0,U.jsx)(c,{"data-testid":`agent-tool-remove`,type:`button`,variant:`outline`,onClick:()=>T(h.filter((e,n)=>n!==t)),children:`Remove`})]},e.key)),(0,U.jsx)(`datalist`,{id:`agent-tool-suggestions`,children:[`Read`,`Grep`,`Glob`,`Edit`,`Write`,`Bash`].map(e=>(0,U.jsx)(`option`,{value:e},e))}),(0,U.jsx)(c,{"data-testid":`agent-tool-add`,type:`button`,variant:`outline`,onClick:()=>T([...h,{key:crypto.randomUUID(),name:``,allowed:!0}]),children:`Add tool`})]})]}),(0,U.jsx)(l,{htmlFor:`agent-instructions`,children:`Instructions`}),(0,U.jsx)(w,{id:`agent-instructions`,testId:`agent-instructions-input`,path:`instructions.md`,readOnly:t,height:240,value:b.value?.body??``,onChange:e=>s(B(o,e))}),(0,U.jsx)(`p`,{className:`text-xs text-outline`,children:`Use YAML + Markdown to edit handoffs and additional configuration. Custom fields are preserved.`})]})]}),(n||b.error||v||u===`fields`&&S)&&(0,U.jsx)(`p`,{"data-testid":`agent-editor-error`,role:`alert`,className:`text-destructive`,children:n||b.error||v||S}),(0,U.jsx)(c,{"data-testid":`agent-submit`,type:`submit`,disabled:t||!i.trim()||!o.trim()||!!b.error||u===`fields`&&!!S,children:t?`Saving...`:C})]})]})}function K({embedded:e=!1}){let t=s(),n=new URLSearchParams(t.search).get(`project`)??`all`,[l,d]=P(`editorMode`,`read`,[`read`,`edit`,`split`]),[f,p]=P(`agentQuery`,``),D=r(),O=i({queryKey:[`agents`],queryFn:()=>u.agents.list()}),{selectedId:I,openDetail:L,closeDetail:R}=N(e?`/packages/agents`:`/agents`,`agentId`),z=i({queryKey:[`agent`,I],queryFn:()=>u.agents.get(I),enabled:!!I}),[B,V]=(0,F.useState)(!1),[H,W]=(0,F.useState)(),[K,q]=(0,F.useState)(!1),[J,Y]=(0,F.useState)(),X=a({mutationFn:u.agents.create,onSuccess:()=>{D.invalidateQueries({queryKey:[`agents`]}),V(!1)}}),Z=a({mutationFn:u.agents.delete,onSuccess:()=>{q(!1),R(),D.invalidateQueries({queryKey:[`agents`]}),D.invalidateQueries({queryKey:[`agent-packages`]}),D.invalidateQueries({queryKey:[`agent`]})}}),Q=a({mutationFn:({profile:e,content:t})=>u.agents.update(e.id,{content:t,expectedRaw:e.raw,expectedPath:e.path}),onSuccess:e=>{D.setQueryData([`agent`,e.id],e),D.invalidateQueries({queryKey:[`agents`]}),D.invalidateQueries({queryKey:[`agent-packages`]}),W(void 0)}});if(O.error)return(0,U.jsx)(j,{message:O.error.message,onRetry:()=>void O.refetch()});let $=(O.data?.agents??[]).filter(e=>`${e.name} ${e.id} ${e.description}`.toLowerCase().includes(f.toLowerCase()));return(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsx)(M,{title:e?`Agent definitions`:`Agents`,level:e?2:1,meta:O.data?.agents.length??0,help:`Shared specialist instructions, models and tools for connected coding agents. Add definitions to packages for reuse.`,action:(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsxs)(y,{children:[(0,U.jsx)(h,{asChild:!0,children:(0,U.jsx)(c,{variant:`ghost`,size:`icon`,"data-testid":`agent-actions-menu`,"aria-label":`Agent resources`,children:(0,U.jsx)(T,{size:16})})}),(0,U.jsxs)(b,{"aria-label":`Agent resources`,align:`end`,className:`w-60 space-y-1 p-1`,children:[(0,U.jsx)(c,{asChild:!0,variant:`ghost`,className:`w-full justify-start`,children:(0,U.jsx)(o,{to:E(`/packages`,n,t.search),"data-testid":`agents-packages-link`,children:`Manage packages`})}),(0,U.jsx)(`a`,{className:`block rounded-md px-3 py-2 text-xs text-muted-foreground hover:bg-surface focus-visible:outline focus-visible:outline-2 focus-visible:outline-focus`,href:`https://microsoft.github.io/apm/producer/author-primitives/instructions-and-agents/`,target:`_blank`,rel:`noreferrer`,children:`APM agent format`})]})]}),(0,U.jsx)(c,{"data-testid":`new-agent-button`,onClick:()=>{X.reset(),V(!0)},children:`New agent`})]})}),(O.data?.broken??[]).map(e=>(0,U.jsxs)(`p`,{role:`alert`,className:`text-destructive`,children:[e.path,`: `,e.error]},e.path)),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(_,{className:`min-w-[180px] max-w-lg flex-1`,"aria-label":`Find an agent`,placeholder:`Find an agent by name or purpose…`,value:f,onChange:e=>p(e.target.value,{replace:!0})}),f&&(0,U.jsx)(c,{variant:`ghost`,onClick:()=>p(``),children:`Clear`})]}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[O.isLoading&&(0,U.jsx)(`p`,{role:`status`,"data-testid":`page-loading`,children:`Loading agents…`}),$.map(e=>(0,U.jsxs)(`button`,{type:`button`,"data-testid":`agent-row`,"data-agent-id":e.id,onClick:()=>L(e.id),className:`grid w-full gap-x-6 gap-y-1 border-b border-outline-variant px-2 py-3 text-left hover:bg-surface-low sm:grid-cols-[minmax(0,1fr)_minmax(0,2fr)]`,children:[(0,U.jsx)(`span`,{className:`block wrap-break-word text-sm font-medium`,children:e.name}),(0,U.jsxs)(`span`,{className:`block truncate text-xs text-muted-foreground sm:col-start-1 sm:row-start-2`,title:`${e.id} · ${e.source}`,children:[e.id,` · `,e.source]}),(0,U.jsx)(`p`,{className:`line-clamp-2 wrap-break-word text-sm leading-relaxed text-muted-foreground sm:col-start-2 sm:row-start-1 sm:row-span-2`,children:e.description})]},e.id)),!O.isLoading&&!$.length&&(0,U.jsx)(`p`,{"data-testid":`page-empty`,className:`text-sm text-muted-foreground`,children:f?`No agents match this search. Try another name or clear the filter.`:`Create an agent or import specialists from Packages.`})]}),(0,U.jsx)(x,{open:!!I,onOpenChange:e=>!e&&R(),children:(0,U.jsxs)(v,{defaultWidth:860,resizeKey:`agents`,"data-testid":`agent-detail-sheet`,children:[(0,U.jsx)(C,{children:(0,U.jsx)(S,{children:z.data?.name??`Agent profile`})}),(0,U.jsx)(g,{children:z.error?(0,U.jsx)(j,{message:z.error.message,onRetry:()=>void z.refetch()}):z.data?(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsx)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:z.data.description}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 border-b border-outline-variant pb-3`,"data-testid":`agent-actions`,children:[(0,U.jsx)(c,{size:`sm`,"data-testid":`agent-launch`,onClick:()=>z.data&&Y({name:`agent-launch`,packages:[],backend:z.data.fields.tools===void 0?`codex`:`claude`,tool:`apm`,cwd:``,agent:z.data.id,prompt:``}),children:`Launch agent`}),(0,U.jsx)(c,{size:`sm`,"data-testid":`agent-edit`,variant:`ghost`,onClick:async()=>{Q.reset();let e=await z.refetch();e.data&&W(e.data)},children:`Edit agent`}),(0,U.jsx)(c,{size:`sm`,"data-testid":`agent-delete`,variant:`ghost`,className:`ml-auto text-error`,onClick:()=>{Z.reset(),q(!0)},disabled:Z.isPending,children:`Delete`})]}),Z.error&&(0,U.jsx)(`p`,{"data-testid":`agent-delete-error`,role:`alert`,className:`text-destructive`,children:Z.error.message}),(0,U.jsxs)(`dl`,{className:`grid grid-cols-2 gap-4 text-sm`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Model`}),(0,U.jsx)(`dd`,{className:`mt-1 wrap-break-word`,children:z.data.fields.model??`Coding-agent default`})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Tools`}),(0,U.jsx)(`dd`,{className:`mt-1`,children:z.data.fields.tools===void 0?`Coding-agent default`:`Defined by this agent; requires Claude`})]})]}),(0,U.jsx)(`h4`,{className:`text-sm font-medium`,children:`Instructions`}),(0,U.jsx)(w,{path:`agent.agent.md`,mode:l,onModeChange:d,value:z.data.raw,readOnly:!0,layout:`page`,hideFrontmatter:!0,pageTitle:z.data.name,testId:`agent-content`}),(0,U.jsxs)(`details`,{className:`border-t border-outline-variant pt-3 text-sm`,children:[(0,U.jsx)(`summary`,{className:`cursor-pointer text-muted-foreground`,children:`Source and configuration`}),(0,U.jsxs)(`p`,{className:`my-3 text-xs text-muted-foreground break-all`,children:[z.data.id,` · `,z.data.source,` definition`]}),(0,U.jsx)(`pre`,{"data-testid":`agent-fields`,className:`max-h-80 overflow-auto rounded bg-background p-3 text-xs`,children:JSON.stringify(z.data.fields,null,2)}),(0,U.jsxs)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:[`To use this agent in a flow, set `,(0,U.jsxs)(`code`,{children:[`"agent": "`,z.data.id,`"`]}),` on its agent node.`]})]})]}):(0,U.jsx)(`p`,{children:`Loading...`})})]})}),(0,U.jsx)(A,{open:K,title:`Delete ${z.data?.name??`agent`}?`,description:`This permanently deletes the agent definition "${I}". Other agents and package resources are kept. Flows referencing this agent will need another profile.`,isPending:Z.isPending,onCancel:()=>!Z.isPending&&q(!1),onConfirm:()=>{I&&Z.mutate(I,{onError:()=>q(!1)})}}),J&&(0,U.jsx)(k,{initial:J,onClose:()=>Y(void 0)}),(0,U.jsx)(m,{open:B,onOpenChange:e=>!X.isPending&&V(e),children:B&&(0,U.jsx)(G,{pending:X.isPending,error:X.error?.message,onSave:(e,t)=>X.mutate({id:e,content:t})})}),(0,U.jsx)(m,{open:!!H,onOpenChange:e=>!e&&!Q.isPending&&W(void 0),children:H&&(0,U.jsx)(G,{agent:H,pending:Q.isPending,error:Q.error?.message,onSave:(e,t)=>Q.mutate({profile:H,content:t})},H.id)})]})}export{K as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as e}from"./rolldown-runtime-DSDNlrLa.js";import{n as t,t as n}from"./jsx-runtime-CVMpzJz9.js";import{n as r}from"./QueryClientProvider-DlPztvhd.js";import{t as i}from"./useMutation-HX90wI4L.js";import{f as a,m as o}from"./chunk-OB3PAWPO-1IihCzFx.js";import{t as s}from"./button-CXYVslgR.js";import{n as c}from"./client-nzMXason.js";import{t as l}from"./textarea-Bt1FBmGL.js";import{F as u,It as d,Rt as f,d as p,en as m,f as h,nn as g,u as _,un as v}from"./index-C60WCVxH.js";import{t as y}from"./ViewHeader-Ce5HQRJu.js";import{c as b}from"./live-sessions-D07BClP7.js";import{i as x,n as S}from"./terminal-links-B3ce99i1.js";var C=e(t(),1),w=n();function T({request:e,actions:t}){let n=e.input.command,[a,o]=(0,C.useState)(e.response?.kind===`command`?e.response.script??n?.script??``:n?.script??``),[f,p]=(0,C.useState)({}),[m,h]=(0,C.useState)(!1),g=r(),_=i({mutationFn:async()=>{let t=f;return p({}),c.humanRequests.run(e.id,e.version,a,t)},onSettled:()=>g.invalidateQueries({queryKey:[`human-requests`]})});if(!n)return null;let v=e.status===`pending`&&!_.isPending;return(0,w.jsxs)(`div`,{className:`space-y-2`,children:[(0,w.jsxs)(`dl`,{className:`flex min-w-0 flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground`,children:[(0,w.jsxs)(`div`,{className:`flex min-w-0 gap-1`,children:[(0,w.jsx)(`dt`,{children:`Host:`}),(0,w.jsx)(`dd`,{className:`wrap-anywhere`,children:n.host??`Local`})]}),(0,w.jsxs)(`div`,{className:`flex min-w-0 gap-1`,children:[(0,w.jsx)(`dt`,{children:`Folder:`}),(0,w.jsx)(`dd`,{className:`wrap-anywhere`,children:n.cwd})]})]}),(0,w.jsxs)(`form`,{className:`space-y-2`,onSubmit:e=>{e.preventDefault(),v&&_.mutate()},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,w.jsx)(`span`,{className:`text-xs font-medium`,children:`Command to run`}),v&&(0,w.jsx)(s,{type:`button`,size:`sm`,variant:`ghost`,"data-testid":`attention-edit-command`,"aria-expanded":m,"aria-controls":`command-${e.id}`,onClick:()=>h(!m),children:m?`Done editing`:`Edit command`})]}),m&&v?(0,w.jsxs)(`label`,{htmlFor:`command-${e.id}`,className:`block`,children:[(0,w.jsx)(`span`,{className:`sr-only`,children:`Command to run`}),(0,w.jsx)(l,{id:`command-${e.id}`,"data-testid":`attention-command`,value:e.response?.kind===`command`?e.response.script??a:a,onChange:e=>o(e.target.value),disabled:!v,maxLength:16e3,className:`min-h-20 font-mono text-xs`})]}):(0,w.jsx)(`section`,{"aria-label":`Command to run`,tabIndex:0,"data-testid":`attention-command-preview`,className:`max-h-40 overflow-auto rounded-sm bg-surface px-2 py-1.5 focus-visible:outline-2 focus-visible:outline-focus`,children:(0,w.jsx)(`pre`,{className:`whitespace-pre-wrap wrap-anywhere font-mono text-xs`,children:e.response?.kind===`command`?e.response.script??a:a})})]}),(0,w.jsx)(`div`,{className:`grid gap-x-3 gap-y-2 sm:grid-cols-2`,children:v&&n.arguments.map(t=>(0,w.jsxs)(`label`,{htmlFor:`argument-${e.id}-${t.name}`,className:`block min-w-0 space-y-1 text-xs`,children:[(0,w.jsxs)(`span`,{className:`flex flex-wrap items-baseline gap-x-2`,children:[(0,w.jsxs)(`span`,{children:[t.label,t.required?``:` (optional)`]}),(0,w.jsx)(`code`,{"data-testid":`attention-argument-name-${t.name}`,className:`break-all font-mono text-xs text-muted-foreground`,children:`ORC_INPUT_${t.name}`})]}),(0,w.jsx)(d,{id:`argument-${e.id}-${t.name}`,type:`password`,autoComplete:`off`,"data-testid":`attention-argument-${t.name}`,value:f[t.name]??``,required:t.required,maxLength:16e3,"aria-describedby":t.description?`argument-help-${e.id}-${t.name}`:void 0,onChange:e=>p(n=>({...n,[t.name]:e.target.value}))}),t.description&&(0,w.jsx)(`span`,{id:`argument-help-${e.id}-${t.name}`,className:`block text-muted-foreground`,children:t.description})]},t.name))}),(v||_.isPending||e.status===`running`)&&(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[(0,w.jsx)(s,{"data-testid":`attention-run`,type:`submit`,size:`sm`,disabled:!v||!a.trim()||n.arguments.some(e=>e.required&&!f[e.name]),children:_.isPending||e.status===`running`?`Running…`:`Run command`}),v&&t,(0,w.jsx)(u,{label:`Secure input handling`,testId:`attention-input-help`,children:`All entered values are used only for this run and redacted from its output. The agent receives the result without the raw inputs.`})]}),_.error&&(0,w.jsx)(`p`,{role:`alert`,children:`Could not confirm completion. Refresh the request before trying again.`})]}),e.response?.kind===`command`&&(0,w.jsxs)(`div`,{"data-testid":`attention-command-result`,className:`space-y-2`,children:[(0,w.jsxs)(`p`,{children:[`Exit code: `,e.response.exit_code]}),(0,w.jsxs)(`pre`,{className:`whitespace-pre-wrap break-all text-xs`,children:[e.response.stdout,e.response.stderr]}),e.response.truncated&&(0,w.jsx)(`p`,{children:`Output was truncated.`})]})]})}var E={pending:`Needs reply`,running:`Running`,unavailable:`Agent unavailable`,answered:`Waiting for delivery`,delivered:`Delivered`,cancelled:`Cancelled`,expired:`Expired`};function D(e){return e.input.kind===`command`?e.input.command?.host??`Local`:e.input.action?e.input.action.host:e.input.origin.execution_host===void 0?null:e.input.origin.execution_host??`Local`}function O({session:e}){let t=a(),[n]=o(),{terminals:r}=f(),i=S(r,e.id);return(0,w.jsxs)(`article`,{"data-testid":`attention-session-${e.id}`,className:`grid min-w-0 gap-2 border-b border-border py-3 @xl/attention:grid-cols-[minmax(0,1fr)_auto] @xl/attention:items-center`,children:[(0,w.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,w.jsx)(`h2`,{className:`text-sm font-medium wrap-break-word`,children:e.name??`Coding session`}),(0,w.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-2 text-xs text-muted-foreground`,children:[(0,w.jsx)(`span`,{className:`text-warning`,children:`Question`}),(0,w.jsx)(`span`,{children:e.agent}),(0,w.jsx)(`span`,{children:e.host??`Local`}),(0,w.jsx)(`span`,{children:`Reply in the original session`})]})]}),(0,w.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[i&&(0,w.jsx)(s,{size:`sm`,variant:`ghost`,onClick:()=>t(b(x(i.id),n.get(`project`))),children:`Open terminal`}),(0,w.jsx)(s,{size:`sm`,variant:`ghost`,onClick:()=>{let r=new URLSearchParams(n);r.set(`session`,e.id),t({pathname:`/sessions`,search:r.toString()})},children:`View session`})]})]})}function k({request:e,expanded:t,onToggle:n}){let[d,f]=(0,C.useState)(``),[p,h]=(0,C.useState)([]),[_,y]=(0,C.useState)(e.input.choices.length===0),b=r(),x=a(),[S]=o(),O=i({mutationFn:t=>c.humanRequests.respond(e.id,e.version,t),onSettled:()=>b.invalidateQueries({queryKey:[`human-requests`]})}),k=i({mutationFn:()=>c.humanRequests.cancel(e.id,e.version),onSettled:()=>b.invalidateQueries({queryKey:[`human-requests`]})}),A=e.status===`pending`,j=E[e.status],M=D(e),N=O.isPending||k.isPending,P=(0,w.jsxs)(w.Fragment,{children:[e.input.origin.chat_thread_id&&(0,w.jsxs)(s,{"data-testid":`attention-open-chat`,size:`sm`,variant:`ghost`,type:`button`,onClick:()=>{let t=new URLSearchParams(S);t.set(`chat`,`open`),t.set(`chatThread`,e.input.origin.chat_thread_id??``),x({search:t.toString()})},children:[(0,w.jsx)(g,{size:14}),` Open chat`]}),(A||e.status===`unavailable`)&&(0,w.jsx)(s,{"data-testid":`attention-cancel`,size:`sm`,variant:`ghost`,type:`button`,disabled:N,onClick:()=>k.mutate(),children:k.isPending?A?`Cancelling…`:`Dismissing…`:A?`Cancel request`:`Dismiss`})]}),F=e.input.action?.input,I=F?.item&&typeof F.item==`object`?F.item:void 0,L=typeof F?.threadId==`string`,R=L?{...Object.fromEntries(Object.entries(F??{}).filter(([e])=>![`threadId`,`turnId`,`itemId`,`startedAtMs`,`item`,`availableDecisions`,`proposedExecpolicyAmendment`,`commandActions`,`kind`].includes(e))),...I?.changes?{changes:I.changes}:{}}:F;return(0,w.jsxs)(`article`,{"data-testid":`attention-request-${e.id}`,className:`min-w-0 border-b border-border`,children:[(0,w.jsxs)(`div`,{className:`flex min-h-11 items-center gap-3 py-1`,children:[(0,w.jsx)(`h2`,{className:`min-w-0 flex-1`,children:(0,w.jsxs)(`button`,{type:`button`,"data-testid":`attention-review`,"aria-expanded":t,"aria-controls":`request-details-${e.id}`,onClick:n,className:`flex min-h-11 w-full min-w-0 items-center gap-2 rounded-sm py-1 text-left focus-visible:outline-2 focus-visible:outline-focus sm:min-h-9 [@media(pointer:coarse)]:min-h-11`,children:[(0,w.jsx)(v,{"aria-hidden":`true`,size:14,className:`shrink-0 text-muted-foreground ${t?`rotate-90`:``}`}),(0,w.jsxs)(`span`,{className:`min-w-0`,children:[(0,w.jsx)(`span`,{className:`block text-sm font-medium wrap-anywhere ${t?`whitespace-pre-wrap`:`line-clamp-1`}`,children:e.input.title??e.input.prompt}),(0,w.jsxs)(`span`,{className:`block truncate text-xs font-normal text-muted-foreground`,children:[e.input.origin.session_title??e.input.origin.backend,M&&` · ${M}`]})]})]})}),(0,w.jsx)(`span`,{className:`shrink-0 text-xs ${A?`text-warning`:`text-muted-foreground`}`,children:j})]}),(0,w.jsxs)(`div`,{id:`request-details-${e.id}`,hidden:!t,className:t?`max-w-3xl space-y-3 pb-3 pl-6`:`hidden`,children:[(0,w.jsxs)(`div`,{className:`min-w-0 space-y-2`,children:[e.input.title&&(0,w.jsx)(`p`,{className:`text-sm whitespace-pre-wrap wrap-anywhere`,children:e.input.prompt}),(0,w.jsxs)(`details`,{className:`text-xs text-muted-foreground`,children:[(0,w.jsx)(`summary`,{"data-testid":`attention-details-toggle`,className:`min-h-8 cursor-pointer py-1 [@media(pointer:coarse)]:min-h-11`,children:`Request details`}),(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground`,children:[(0,w.jsxs)(`span`,{className:A?`text-warning`:void 0,children:[e.input.kind===`command`?`Command`:e.input.kind===`question`?`Question`:`Approval`,` `,`· `,e.input.origin.backend]}),(e.input.rule_binding||e.input.rule_bindings?.length)&&(0,w.jsx)(`span`,{children:`ORC rule`})]}),(0,w.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground`,children:[(0,w.jsxs)(`span`,{className:`min-w-0 max-w-full truncate`,title:e.input.origin.session_title??e.input.origin.session_id,children:[e.input.origin.session_title??`Session ${e.input.origin.session_id}`,e.input.origin.execution_host!==void 0&&` · ${e.input.origin.execution_host??`Local`}`]}),(0,w.jsxs)(`span`,{className:`flex flex-wrap gap-x-2`,"data-testid":`attention-date`,children:[(0,w.jsxs)(`span`,{children:[`Created`,` `,(0,w.jsx)(`time`,{dateTime:new Date(e.created_at).toISOString(),title:new Date(e.created_at).toLocaleString(),children:new Date(e.created_at).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`})})]}),e.responded_at!==null&&(0,w.jsxs)(`span`,{children:[`Answered`,` `,(0,w.jsx)(`time`,{dateTime:new Date(e.responded_at).toISOString(),title:new Date(e.responded_at).toLocaleString(),children:new Date(e.responded_at).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`})})]})]})]})]}),e.input.kind===`command`&&(0,w.jsx)(T,{request:e,actions:P}),e.input.action&&(0,w.jsxs)(`div`,{className:`min-w-0 space-y-2 text-sm`,children:[(0,w.jsxs)(`dl`,{className:`flex min-w-0 flex-wrap gap-x-4 gap-y-1 text-xs`,children:[(0,w.jsxs)(`div`,{className:`flex min-w-0 gap-1`,children:[(0,w.jsx)(`dt`,{className:`text-muted-foreground`,children:`Host:`}),(0,w.jsx)(`dd`,{className:`wrap-anywhere`,children:e.input.action.host})]}),(0,w.jsxs)(`div`,{className:`flex min-w-0 gap-1`,children:[(0,w.jsx)(`dt`,{className:`text-muted-foreground`,children:`Folder:`}),(0,w.jsx)(`dd`,{className:`wrap-anywhere`,children:e.input.action.cwd})]})]}),(0,w.jsx)(`section`,{"aria-label":`Requested action`,tabIndex:0,className:`max-h-64 overflow-auto whitespace-pre-wrap wrap-anywhere rounded-md border border-border p-2 font-mono text-xs focus-visible:outline-2 focus-visible:outline-focus`,children:(0,w.jsxs)(`pre`,{"data-testid":`attention-action`,className:`whitespace-pre-wrap wrap-anywhere`,children:[e.input.action.tool,`
|
|
2
|
+
`,JSON.stringify(R&&Object.keys(R).length?R:F,null,2)]})}),L&&(0,w.jsxs)(`details`,{className:`text-xs text-outline`,children:[(0,w.jsx)(`summary`,{className:`min-h-11 cursor-pointer py-1 sm:min-h-8 [@media(pointer:coarse)]:min-h-11`,children:`Full request details`}),(0,w.jsx)(`pre`,{className:`whitespace-pre-wrap break-all mt-2`,children:JSON.stringify(F,null,2)})]})]})]}),(0,w.jsxs)(`div`,{className:`min-w-0 space-y-2`,children:[A&&e.input.kind===`question`&&(0,w.jsxs)(`form`,{className:`space-y-2`,onSubmit:e=>{e.preventDefault(),O.mutate({kind:`question`,answer:d,...p.length?{selected_choices:p}:{}})},children:[(0,w.jsx)(`div`,{className:`grid gap-1 @xl/attention:grid-cols-2 @4xl/attention:grid-cols-1`,children:e.input.choices.map(t=>(0,w.jsxs)(`label`,{className:`flex min-h-11 min-w-0 cursor-pointer items-start gap-2 rounded-md px-2 py-1.5 text-sm sm:min-h-8 [@media(pointer:coarse)]:min-h-11 hover:bg-surface ${(e.input.multi_select?p.includes(t):d===t)?`bg-surface-highest`:``}`,"data-testid":`attention-choice-${t}`,children:[(0,w.jsx)(`input`,{type:e.input.multi_select?`checkbox`:`radio`,name:`choice-${e.id}`,checked:e.input.multi_select?p.includes(t):d===t,disabled:N,className:`mt-1 size-3.5 shrink-0 accent-primary`,onChange:()=>{if(e.input.multi_select){let e=p.includes(t)?p.filter(e=>e!==t):[...p,t];h(e),f(e.join(`, `))}else f(t)}}),(0,w.jsxs)(`span`,{className:`min-w-0 wrap-anywhere`,children:[(0,w.jsx)(`span`,{children:t}),Object.keys(e.input.choice_descriptions).includes(t)&&e.input.choice_descriptions[t]&&(0,w.jsx)(`span`,{className:`block text-xs font-normal text-muted-foreground`,children:e.input.choice_descriptions[t]})]})]},t))}),e.input.choices.length>0&&(0,w.jsxs)(s,{type:`button`,size:`sm`,variant:`ghost`,"data-testid":`attention-edit-answer`,"aria-expanded":_,"aria-controls":`answer-editor-${e.id}`,disabled:N,onClick:()=>y(!_),children:[(0,w.jsx)(m,{size:14}),` `,_?`Hide editor`:`Write an answer`]}),(0,w.jsxs)(`label`,{id:`answer-editor-${e.id}`,htmlFor:`answer-${e.id}`,hidden:!_,className:_?`block text-sm space-y-1`:`hidden`,children:[(0,w.jsx)(`span`,{children:`Your answer`}),(0,w.jsx)(l,{id:`answer-${e.id}`,"data-testid":`attention-answer`,value:d,onChange:e=>{f(e.target.value),h([])},maxLength:16e3,disabled:N,rows:2,className:`min-h-20 max-h-48 resize-y`})]}),(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[(0,w.jsx)(s,{size:`sm`,"data-testid":`attention-send`,type:`submit`,disabled:!d.trim()||N,children:O.isPending?`Sending…`:`Send answer`}),P]})]}),A&&e.input.kind===`approval`&&(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[(0,w.jsx)(s,{size:`sm`,"data-testid":`attention-approve`,disabled:N,onClick:()=>O.mutate({kind:`approval`,approved:!0}),children:`Approve`}),(0,w.jsx)(s,{size:`sm`,"data-testid":`attention-deny`,variant:`outline`,disabled:N,onClick:()=>O.mutate({kind:`approval`,approved:!1}),children:`Deny`}),(0,w.jsx)(u,{label:`Approval permissions`,testId:`attention-approval-help`,children:`Your approval lets this agent continue with its existing permissions.`}),P]}),e.response&&e.response.kind!==`command`&&(0,w.jsx)(`p`,{"data-testid":`attention-response`,className:`text-sm whitespace-pre-wrap wrap-anywhere`,children:e.response.kind===`question`?e.response.answer:e.response.approved?`Approved`:`Denied`}),!A&&(0,w.jsx)(`div`,{className:`flex flex-wrap items-center gap-1`,children:P})]})]}),e.delivery_error&&(0,w.jsx)(`p`,{role:`status`,className:`pb-2 pl-6 text-sm text-error`,children:e.delivery_error}),k.error&&(0,w.jsx)(`p`,{role:`alert`,children:k.error.message}),O.error&&(0,w.jsx)(`p`,{role:`alert`,"data-testid":`attention-error`,className:`text-sm text-destructive`,children:O.error.message})]})}function A(){let[e,t]=(0,C.useState)(null),n=h(),r=_(),i=p(),c=a(),[l]=o();return(0,w.jsxs)(`div`,{"data-testid":`attention-view`,className:`@container/attention min-w-0`,children:[(0,w.jsx)(y,{title:`Attention needed`,meta:n.data?n.data.length+r.data.length+i.data.length:void 0,help:`Questions and approvals from your agents. Live Codex questions can also appear as session notices. Direct responses require an ORC connection or a supported hook; ACPX CLI does not expose pending approvals to ORC.`}),n.isLoading&&(0,w.jsx)(`p`,{role:`status`,children:`Loading requests…`}),n.error&&(0,w.jsx)(`p`,{role:`alert`,children:n.error.message}),r.error&&(0,w.jsxs)(`p`,{role:`alert`,children:[`Could not check waiting sessions: `,r.error.message]}),i.error&&(0,w.jsxs)(`p`,{role:`alert`,children:[`Could not check waiting chats: `,i.error.message]}),n.data?.length===0&&!n.error&&!r.isLoading&&!r.error&&!i.isLoading&&!i.error&&r.data.length===0&&i.data.length===0&&(0,w.jsx)(`p`,{"data-testid":`attention-empty`,className:`grid min-h-[min(40dvh,20rem)] place-items-center text-sm text-muted-foreground`,children:`Nothing needs your attention.`}),n.data?.length===100&&(0,w.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.`}),(0,w.jsxs)(`div`,{children:[i.data.map(e=>(0,w.jsxs)(`article`,{"data-testid":`attention-chat-${e.thread_id}`,className:`grid min-w-0 gap-2 border-b border-border py-3 @xl/attention:grid-cols-[minmax(0,1fr)_auto] @xl/attention:items-center`,children:[(0,w.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,w.jsx)(`h2`,{className:`text-sm font-medium wrap-break-word`,children:e.title}),(0,w.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-2 text-xs text-muted-foreground`,children:[(0,w.jsx)(`span`,{className:`text-warning`,children:e.kind===`question`?`Question`:`Approval`}),(0,w.jsx)(`span`,{children:e.agent}),(0,w.jsx)(`span`,{children:e.host??`Local`}),(0,w.jsx)(`span`,{children:`Chat`})]})]}),(0,w.jsx)(s,{size:`sm`,variant:`ghost`,className:`justify-self-start @xl/attention:justify-self-end`,onClick:()=>{let t=new URLSearchParams(l);t.set(`chat`,`open`),t.set(`chatThread`,e.thread_id),c({search:t.toString()})},children:`Open chat`})]},`${e.thread_id}:${e.request_key}`)),r.data.map(e=>(0,w.jsx)(O,{session:e},e.id)),n.data?.map(n=>(0,w.jsx)(k,{request:n,expanded:e===n.id,onToggle:()=>t(e=>e===n.id?null:n.id)},n.id))]})]})}export{A as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./rolldown-runtime-DSDNlrLa.js";import{n as t,t as n}from"./jsx-runtime-CVMpzJz9.js";import{t as r}from"./scroll-area-D0FZFdju.js";import{t as i}from"./chevron-down-hj6o3_QU.js";import{t as a}from"./Markdown-cNY95m5f.js";import{Et as o,G as s,K as c,U as l,W as u,X as d,Y as f,st as p,un as m}from"./index-C60WCVxH.js";import{t as h}from"./ErrorState-BrKz7Mii.js";import{t as g}from"./ViewHeader-Ce5HQRJu.js";import{t as _}from"./useDetailRoute-DOhAbdV7.js";import{t as v}from"./view-params-DD7i9s5g.js";import{t as y}from"./EmptyState-YM4VSLR9.js";import{t as b}from"./Pager-Bc666Oa5.js";import{i as x,r as S}from"./useSessions-BNSlPToV.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-Cri9EUoE.js";import{t as k}from"./useProjectScope-DtEj9j-P.js";var A=e(t(),1),j=n(),M={file:`text-outline`,task:`text-outline`,decision:`text-outline`,error:`text-error`,git:`text-outline`,rule:`text-outline`,plan:`text-outline`},N=`text-outline`;function P(e){return M[e]??N}function F({sessionId:e,open:t,onClose:n}){let{data:i,isLoading:o,error:m,refetch:g}=x(e??``);return(0,j.jsx)(u,{open:t,onOpenChange:e=>!e&&n(),children:(0,j.jsxs)(c,{side:`right`,defaultWidth:540,resizeKey:`sessions`,children:[(0,j.jsx)(f,{children:(0,j.jsx)(d,{children:o?`Loading...`:i?`${i.agent??`Session`} ${i.agent_version?`v${i.agent_version}`:``}`:`Session Detail`})}),(0,j.jsxs)(s,{children:[(0,j.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.`}),m?(0,j.jsx)(h,{message:m.message,onRetry:()=>g()}):o?(0,j.jsx)(`div`,{className:`space-y-4`,children:[...[,,,,]].map((e,t)=>(0,j.jsx)(l,{className:`h-8 w-full bg-surface-highest`},t))}):i?(0,j.jsxs)(`div`,{className:`space-y-6`,children:[i.summary&&(0,j.jsx)(`div`,{className:`font-body text-xs text-on-surface leading-relaxed`,children:(0,j.jsx)(a,{children:i.summary})}),(0,j.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-4`,children:[(0,j.jsx)(p,{label:`ID`,children:(0,j.jsx)(`span`,{className:`font-mono text-xs break-all`,children:i.id})}),(0,j.jsx)(p,{label:`Project ID`,children:i.project_id??`—`}),(0,j.jsx)(p,{label:`Job Run ID`,children:i.job_run_id??`—`}),(0,j.jsx)(p,{label:`Tokens Used`,children:i.tokens_used==null?`—`:i.tokens_used.toLocaleString()}),(0,j.jsx)(p,{label:`Created`,children:new Date(i.created_at).toLocaleString()})]}),i.events.length>0&&(0,j.jsxs)(`div`,{children:[(0,j.jsxs)(`div`,{className:`font-label text-xs font-medium text-outline mb-3`,children:[`Events (`,i.events.length,`)`]}),(0,j.jsx)(r,{className:`h-[300px]`,children:(0,j.jsx)(`div`,{className:`space-y-1`,children:[...i.events].sort((e,t)=>new Date(e.created_at).getTime()-new Date(t.created_at).getTime()).map(e=>(0,j.jsx)(I,{event:e},e.id))})})]}),i.snapshot&&(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`div`,{className:`font-label text-xs font-medium text-outline mb-3`,children:`Snapshot`}),(0,j.jsx)(r,{className:`h-[200px]`,children:(0,j.jsx)(`pre`,{className:`font-mono text-xs text-on-surface-variant whitespace-pre-wrap wrap-break-word bg-background border-l border-border p-3`,children:i.snapshot})})]})]}):(0,j.jsx)(`div`,{className:`font-body text-xs text-outline py-8 text-center`,children:`Session not found`})]})]})})}function I({event:e}){let[t,n]=(0,A.useState)(!1),r=e.data!=null;return(0,j.jsxs)(`div`,{className:`border-b border-border/65`,children:[(0,j.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:()=>r&&n(!t),"aria-expanded":r?t:void 0,children:[r?t?(0,j.jsx)(i,{size:10,className:`text-outline shrink-0`}):(0,j.jsx)(m,{size:10,className:`text-outline shrink-0`}):(0,j.jsx)(`span`,{className:`w-[10px] shrink-0`}),(0,j.jsx)(`span`,{className:`inline-flex items-center px-1.5 py-0.5 text-[10px] font-label font-medium ${P(e.type)}`,children:e.type}),(0,j.jsx)(`span`,{className:`flex-1 font-body text-xs text-outline truncate`,children:L(e.data)}),(0,j.jsx)(`span`,{className:`font-label text-[10px] text-outline shrink-0`,children:new Date(e.created_at).toLocaleTimeString()})]}),t&&r&&(0,j.jsx)(`div`,{className:`px-3 pb-2`,children:(0,j.jsx)(`pre`,{className:`font-mono text-xs text-on-surface-variant whitespace-pre-wrap wrap-break-word bg-background border-l border-border/65 p-2 max-h-48 overflow-auto`,children:JSON.stringify(e.data,null,2)})})]})}function L(e){if(e==null)return``;if(typeof e==`string`)return e;if(typeof e==`object`){let t=e;if(typeof t.path==`string`)return t.path;if(typeof t.content==`string`)return t.content.length>80?`${t.content.slice(0,80)}...`:t.content;if(typeof t.message==`string`)return t.message;if(typeof t.summary==`string`)return t.summary;let n=Object.keys(t);return n.length<=3?n.join(`, `):`${n.length} fields`}return String(e)}var R=25,z=`font-label text-xs font-medium text-outline`;function B({projectId:e}){let t=o(`xl`),[n,r]=v(`order`,`desc`,[`asc`,`desc`]),[i,a]=(0,A.useState)({order:n,page:0}),s=i.order===n?i.page:0,c=e=>a({order:n,page:e}),{selectedId:u,openDetail:d,closeDetail:f}=_(`/audit`,`sessionId`),{data:p,isLoading:m,error:g,refetch:x}=S({...e===`all`?{}:{project_id:e},limit:R,offset:s*R,order:n});if(g)return(0,j.jsx)(h,{message:g.message,onRetry:()=>x()});let k=p?.sessions??[],M=p?.total??0;return(0,j.jsxs)(`section`,{"data-testid":`logged-sessions`,children:[(0,j.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-between gap-2`,children:[(0,j.jsxs)(`span`,{className:`text-xs text-outline`,children:[M,` records`]}),(0,j.jsxs)(`select`,{"aria-label":`Sort audit by date`,"data-testid":`audit-date-sort`,value:n,onChange:e=>{c(0),r(e.target.value)},className:`form-control form-control-single w-auto max-w-full`,children:[(0,j.jsx)(`option`,{value:`desc`,children:`Created: newest first`}),(0,j.jsx)(`option`,{value:`asc`,children:`Created: oldest first`})]})]}),m?(0,j.jsx)(`div`,{className:`space-y-2`,children:[...[,,,,,]].map((e,t)=>(0,j.jsx)(l,{className:`h-10 w-full bg-surface-highest`},t))}):k.length===0?(0,j.jsx)(y,{message:`No audit records`}):(0,j.jsxs)(`div`,{className:`min-w-0 overflow-hidden`,children:[t?(0,j.jsxs)(O,{children:[(0,j.jsx)(C,{children:(0,j.jsxs)(E,{className:`border-b border-border hover:bg-transparent`,children:[(0,j.jsx)(w,{className:z,children:`Agent`}),(0,j.jsx)(w,{className:`${z} w-24`,children:`Version`}),(0,j.jsx)(w,{className:z,children:`Summary`}),(0,j.jsx)(w,{className:`${z} w-24`,children:`Project`}),(0,j.jsx)(w,{className:`${z} w-28`,children:`Tokens used`}),(0,j.jsx)(w,{className:`${z} w-36`,children:`Created`})]})}),(0,j.jsx)(T,{children:k.map(e=>(0,j.jsxs)(E,{"data-testid":`session-row`,"data-session-id":e.id,className:`border-b border-border/65 hover:bg-surface-high cursor-pointer`,onClick:()=>d(e.id),children:[(0,j.jsx)(D,{className:`font-label text-xs text-primary`,children:(0,j.jsx)(`button`,{type:`button`,className:`text-left font-medium hover:underline`,onClick:t=>{t.stopPropagation(),d(e.id)},children:e.agent??`Session`})}),(0,j.jsx)(D,{className:`font-label text-xs text-outline`,children:e.agent_version??`—`}),(0,j.jsx)(D,{className:`font-body text-xs text-on-surface-variant max-w-sm truncate`,children:e.summary??`—`}),(0,j.jsx)(D,{className:`font-label text-xs text-outline`,children:e.project_id?e.project_id.slice(-6):`—`}),(0,j.jsx)(D,{className:`font-label text-xs text-outline text-right`,children:e.tokens_used==null?`—`:e.tokens_used.toLocaleString()}),(0,j.jsx)(D,{className:`font-label text-xs text-outline`,children:new Date(e.created_at).toLocaleString()})]},e.id))})]}):(0,j.jsx)(`div`,{className:`divide-y divide-border`,children:k.map(e=>(0,j.jsxs)(`article`,{"data-testid":`session-row`,"data-session-id":e.id,className:`py-3 space-y-2`,children:[(0,j.jsx)(`button`,{type:`button`,className:`min-h-8 text-sm text-left font-medium text-primary wrap-break-word`,onClick:()=>d(e.id),children:e.agent??`Session`}),(0,j.jsx)(`p`,{className:`text-sm leading-relaxed text-on-surface wrap-break-word`,children:e.summary??`No summary recorded`}),(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-2 text-xs text-outline`,children:[(0,j.jsxs)(`span`,{children:[`Version `,e.agent_version??`—`]}),(0,j.jsxs)(`span`,{children:[e.tokens_used?.toLocaleString()??`—`,` tokens`]}),(0,j.jsx)(`span`,{children:e.project_id?`Project ${e.project_id.slice(-6)}`:`Unassigned`}),(0,j.jsx)(`span`,{children:new Date(e.created_at).toLocaleString()})]})]},e.id))}),(0,j.jsx)(b,{page:s,pageSize:R,total:M,onPage:c})]}),(0,j.jsx)(F,{sessionId:u,open:!!u,onClose:f})]})}function V({projectId:e}){let t=k(e);return(0,j.jsxs)(`div`,{children:[(0,j.jsx)(g,{title:`Audit`,help:`Recorded summaries and events. Open Sessions to read conversations or resume a coding agent.`}),(0,j.jsx)(B,{projectId:t},t)]})}export{V as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./jsx-runtime-CVMpzJz9.js";import{t}from"./button-CXYVslgR.js";import{a as n,i as r,n as i,o as a,r as o,t as s}from"./dialog-Juth7dP_.js";var c=e();function l({open:e,onConfirm:l,onCancel:u,title:d,description:f,confirmLabel:p=`Delete`,variant:m=`destructive`,isPending:h}){return(0,c.jsx)(s,{open:e,onOpenChange:e=>!e&&u(),children:(0,c.jsxs)(i,{className:`bg-surface border-surface-highest max-w-sm`,children:[(0,c.jsxs)(n,{children:[(0,c.jsx)(a,{className:`font-headline text-sm text-on-surface`,children:d}),(0,c.jsx)(o,{className:`font-body text-xs text-outline mt-2`,children:f})]}),(0,c.jsxs)(r,{className:`mt-4`,children:[(0,c.jsx)(t,{"data-testid":`confirm-dialog-cancel`,type:`button`,variant:`ghost`,size:`sm`,onClick:u,className:`font-label text-xs text-outline`,children:`Cancel`}),(0,c.jsx)(t,{"data-testid":`confirm-dialog-confirm`,variant:`ghost`,type:`button`,size:`sm`,onClick:l,disabled:h,className:m===`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:h?`...`:p})]})]})})}export{l as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./jsx-runtime-CVMpzJz9.js";import{f as t}from"./chunk-OB3PAWPO-1IihCzFx.js";import{t as n}from"./button-CXYVslgR.js";import{Et as r,M as i,S as a,U as o,_t as s}from"./index-C60WCVxH.js";import{t as c}from"./ErrorState-BrKz7Mii.js";import{t as l}from"./ViewHeader-Ce5HQRJu.js";import{a as u,t as d}from"./live-sessions-D07BClP7.js";import{n as f}from"./useSessions-BNSlPToV.js";import{a as p,i as m,n as h,o as g,r as _,t as v}from"./table-Cri9EUoE.js";import{t as y}from"./useProjectScope-DtEj9j-P.js";import{t as b}from"./PriorityBadge-Ccw4iVk7.js";import{t as x}from"./ResumeActions-Xi3gsryf.js";import{t as S}from"./StatusBadge-ia651_Df.js";import{o as C}from"./useJobs-B2da-s4n.js";import{r as w}from"./useMemories-UaTju2A_.js";var T=e();function E(e,t){return e.isLoading?`…`:e.error?`—`:t}function D({projectId:e}){let D=t(),O=y(e),k=r(`sm`),A=e=>{let t=new URL(e,window.location.origin);t.searchParams.set(`project`,O),D({pathname:t.pathname,search:t.search,hash:t.hash})},j=O===`all`?void 0:{project_id:O},M=i(j),{data:N,isLoading:P}=M,F=C(j),{data:I}=F,L=w({project_id:j?.project_id,limit:1},{enabled:O!==`unassigned`}),R=O===`unassigned`?0:L.data?.total??0,{data:z}=s(),B=f(!0,j?.project_id),V=(B.data??[]).filter(e=>O===`all`||(O===`unassigned`?e.project_id===null:e.project_id===O)),H=O===`unassigned`?(I??[]).filter(e=>e.project_id===null):I??[],U=O===`unassigned`?(N??[]).filter(e=>e.project_id===null):N??[],W=U.reduce((e,t)=>(e[t.status]=(e[t.status]??0)+1,e),{}),G=[...U].sort((e,t)=>new Date(t.updated_at).getTime()-new Date(e.updated_at).getTime()).slice(0,8),K=H.filter(e=>e.enabled),q=O===`all`?`All Projects`:O===`unassigned`?`Unassigned`:z?.find(e=>e.id===O)?.name??``,J=[{label:`Doing`,value:E(M,W.doing??0),sub:`in progress`,path:`/tasks?view=table&status=doing`},{label:`Review`,value:E(M,W.review??0),sub:`awaiting review`,path:`/tasks?view=table&status=review`},{label:`Blocked`,value:E(M,W.blocked??0),sub:`needs attention`,path:`/tasks?view=table&status=blocked`},{label:`Todo`,value:E(M,(W.todo??0)+(W.queued??0)),sub:`pending`,path:`/tasks?view=board`},{label:`Done`,value:E(M,W.done??0),sub:`completed`,path:`/tasks?view=table&status=done`}],Y=[{label:`Active jobs`,value:E(F,K.length),sub:`of ${H.length} total`,path:`/jobs`},{label:`Memories`,value:E(L,R),sub:`in this scope`,path:a},{label:`Projects`,value:(z??[]).filter(e=>e.status===`active`).length,sub:`active across workspace`,path:`/projects`}];return(0,T.jsxs)(`div`,{"data-activity-preview":!0,"data-testid":`activity-preview`,className:`activity-preview`,children:[(0,T.jsx)(l,{title:`Activity`,meta:q||`All projects`,action:(0,T.jsx)(n,{onClick:()=>A(`/tasks`),children:`View tasks`})}),[M,F,L,B].some(e=>e.isLoading)&&(0,T.jsx)(`p`,{role:`status`,className:`activity-muted mb-4`,children:`Loading activity…`}),[{name:`Tasks`,query:M},{name:`Jobs`,query:F},{name:`Memories`,query:L},{name:`Sessions`,query:B}].filter(({query:e})=>e.error).map(({name:e,query:t})=>(0,T.jsx)(c,{message:`${e}: ${t.error?.message??`Could not load activity`}`,onRetry:()=>t.refetch()},e)),(0,T.jsx)(`section`,{className:`activity-metrics`,"aria-label":`Task summary`,children:J.map(e=>(0,T.jsxs)(`button`,{type:`button`,"data-testid":`stat-card`,"data-stat-label":e.label,className:`activity-metric`,onClick:()=>A(e.path),children:[(0,T.jsx)(`span`,{className:`activity-metric-label`,children:e.label}),(0,T.jsx)(`span`,{"data-testid":`stat-card-value`,className:`activity-metric-value`,children:e.value}),(0,T.jsx)(`span`,{className:`activity-metric-sub`,children:e.sub})]},e.label))}),(0,T.jsx)(`section`,{className:`activity-resources`,"aria-label":`Workspace summary`,children:Y.map(e=>(0,T.jsxs)(`button`,{type:`button`,"data-testid":`stat-card`,"data-stat-label":e.label,onClick:()=>A(e.path),children:[(0,T.jsx)(`span`,{children:e.label}),(0,T.jsx)(`span`,{"data-testid":`stat-card-value`,className:`activity-resource-value`,children:e.value}),(0,T.jsx)(`span`,{className:`activity-resource-sub`,children:e.sub})]},e.label))}),(0,T.jsxs)(`section`,{className:`activity-section`,children:[(0,T.jsxs)(`div`,{className:`activity-section-heading`,children:[(0,T.jsx)(`h2`,{children:`Recent tasks`}),(0,T.jsx)(`button`,{type:`button`,className:`activity-text-action`,onClick:()=>A(`/tasks`),children:`View all`})]}),P?(0,T.jsx)(`div`,{className:`space-y-2`,children:[0,1,2,3].map(e=>(0,T.jsx)(o,{className:`h-10 w-full`},e))}):G.length===0?(0,T.jsx)(`p`,{className:`activity-empty`,children:`No tasks`}):k?(0,T.jsxs)(v,{className:`activity-task-table`,children:[(0,T.jsx)(p,{children:(0,T.jsxs)(g,{children:[(0,T.jsx)(m,{children:`Task`}),(0,T.jsx)(m,{className:`w-36`,children:`Status`}),(0,T.jsx)(m,{className:`w-28`,children:`Priority`}),(0,T.jsx)(m,{className:`w-28`,children:`Updated`})]})}),(0,T.jsx)(h,{children:G.map(e=>(0,T.jsxs)(g,{onClick:()=>A(`/tasks/${e.id}`),children:[(0,T.jsx)(_,{children:(0,T.jsx)(`button`,{type:`button`,className:`activity-task-title`,onClick:t=>{t.stopPropagation(),A(`/tasks/${e.id}`)},children:e.title})}),(0,T.jsx)(_,{children:(0,T.jsx)(`span`,{className:`activity-status`,"data-status":e.status,children:(0,T.jsx)(S,{status:e.status})})}),(0,T.jsx)(_,{children:(0,T.jsx)(`span`,{className:`activity-priority`,children:(0,T.jsx)(b,{priority:e.priority})})}),(0,T.jsx)(_,{className:`activity-muted`,children:new Date(e.updated_at).toLocaleDateString()})]},e.id))})]}):(0,T.jsx)(`div`,{className:`activity-task-list`,children:G.map(e=>(0,T.jsxs)(`article`,{className:`activity-task-mobile`,children:[(0,T.jsx)(`button`,{type:`button`,className:`activity-task-title`,onClick:()=>A(`/tasks/${e.id}`),children:e.title}),(0,T.jsxs)(`div`,{className:`activity-task-meta`,children:[(0,T.jsx)(`span`,{className:`activity-status`,"data-status":e.status,children:(0,T.jsx)(S,{status:e.status})}),(0,T.jsx)(`span`,{className:`activity-priority`,children:(0,T.jsx)(b,{priority:e.priority})}),(0,T.jsx)(`span`,{children:new Date(e.updated_at).toLocaleDateString()})]})]},e.id))})]}),(0,T.jsxs)(`div`,{className:`activity-secondary`,children:[K.length>0&&(0,T.jsxs)(`section`,{className:`activity-section`,children:[(0,T.jsxs)(`div`,{className:`activity-section-heading`,children:[(0,T.jsx)(`h2`,{children:`Active jobs`}),(0,T.jsx)(`button`,{type:`button`,className:`activity-text-action`,onClick:()=>A(`/jobs`),children:`View all`})]}),(0,T.jsx)(`div`,{className:`activity-row-list`,children:K.slice(0,5).map(e=>(0,T.jsxs)(`button`,{type:`button`,className:`activity-row`,onClick:()=>A(`/jobs/${e.id}`),children:[(0,T.jsxs)(`span`,{className:`activity-row-heading`,children:[(0,T.jsx)(`span`,{children:e.name}),(0,T.jsx)(`span`,{className:`activity-muted`,children:e.trigger_type})]}),e.last_run_at&&(0,T.jsxs)(`span`,{className:`activity-row-description`,children:[`Last run `,new Date(e.last_run_at).toLocaleString()]})]},e.id))})]}),V.length>0&&(0,T.jsxs)(`section`,{className:`activity-section`,children:[(0,T.jsxs)(`div`,{className:`activity-section-heading`,children:[(0,T.jsx)(`h2`,{children:`Agent sessions`}),(0,T.jsx)(`button`,{type:`button`,className:`activity-text-action`,onClick:()=>A(`/sessions`),children:`View all`})]}),(0,T.jsx)(`div`,{className:`activity-row-list`,children:V.slice(0,5).map(e=>(0,T.jsxs)(`div`,{className:`activity-row`,children:[(0,T.jsxs)(`button`,{type:`button`,className:`w-full text-left`,"data-testid":`activity-session-link`,"data-session-id":e.id,onClick:()=>A(`/sessions?session=${encodeURIComponent(e.id)}`),children:[(0,T.jsxs)(`span`,{className:`activity-row-heading`,children:[(0,T.jsx)(`span`,{children:e.name??e.agent}),(0,T.jsx)(`span`,{className:`activity-muted`,children:u(e.last_activity_at)})]}),(0,T.jsxs)(`span`,{className:`activity-row-description inline-flex items-center gap-2`,children:[(0,T.jsx)(`span`,{className:`size-1.5 rounded-full ${d[e.status].dot}`}),e.agent,` · `,d[e.status].label,e.task?` · ${e.task.title}`:``]})]}),(0,T.jsx)(x,{session:e})]},e.id))})]})]}),O===`all`&&(z??[]).length>0&&(0,T.jsxs)(`section`,{className:`activity-section`,children:[(0,T.jsxs)(`div`,{className:`activity-section-heading`,children:[(0,T.jsx)(`h2`,{children:`Projects`}),(0,T.jsx)(`button`,{type:`button`,className:`activity-text-action`,onClick:()=>A(`/projects`),children:`View all`})]}),(0,T.jsx)(`div`,{className:`activity-projects`,children:(z??[]).filter(e=>e.status===`active`).slice(0,6).map(e=>(0,T.jsxs)(`button`,{type:`button`,className:`activity-row`,onClick:()=>A(`/projects/${e.id}`),children:[(0,T.jsx)(`span`,{className:`activity-row-heading`,children:e.name}),e.description&&(0,T.jsx)(`span`,{className:`activity-row-description`,children:e.description})]},e.id))})]})]})}export{D as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./rolldown-runtime-DSDNlrLa.js";import{n as t,t as n}from"./jsx-runtime-CVMpzJz9.js";import{f as r,m as i}from"./chunk-OB3PAWPO-1IihCzFx.js";import{t as a}from"./button-CXYVslgR.js";import{t as o}from"./MarkdownEditor-CPlYZ0ux.js";var s=e(t(),1),c=n(),l=new Map,u=new Set;typeof window<`u`&&window.addEventListener(`beforeunload`,e=>{l.size&&(e.preventDefault(),e.returnValue=``)});function d(e){return u.has(e)?!1:l.has(e)?window.confirm(`Discard unsaved changes to this document?`)?(l.delete(e),!0):!1:!0}function f({documentId:e,content:t,path:n,onSave:f,testId:p,wikiLinks:m,navigation:h,expanded:g,onExpandedChange:_,layout:v,pageTitle:y,hideFrontmatter:b,compact:x}){let[S]=i(),C=r(),w=S.get(`editorMode`),T=w===`edit`||w===`split`?w:`read`,E=(0,s.useRef)(l.get(e)??{original:t,content:t}),[D,O]=(0,s.useState)(E.current.content),[k,A]=(0,s.useState)(E.current.original),[j,M]=(0,s.useState)(!1),[N,P]=(0,s.useState)(null),F=(0,s.useRef)(!1),I=(0,s.useRef)(E.current.content),L=D!==k;(0,s.useEffect)(()=>{l.has(e)||(O(t),I.current=t,A(t))},[t,e]);function R(t){I.current=t,O(t),t===k?l.delete(e):l.set(e,{original:k,content:t})}async function z(){if(!f||!L||F.current)return;F.current=!0,u.add(e),M(!0),P(null);let t=I.current;try{let n=await f(t,k),r=typeof n==`string`?n:t;A(r),I.current===t?(l.delete(e),I.current=r,O(r)):l.set(e,{original:r,content:I.current})}catch(e){P(e instanceof Error?e.message:`Could not save document`)}finally{F.current=!1,u.delete(e),M(!1)}}function B(e){let t=new URLSearchParams(window.location.search);t.set(`editorMode`,e),t.toString()!==new URLSearchParams(window.location.search).toString()&&C({search:t.toString(),hash:window.location.hash})}function V(){d(e)&&(O(t),A(t),I.current=t,P(null))}let H=f?j?`Saving…`:L?`Unsaved changes`:`Saved`:`Read-only`,U=(0,c.jsxs)(c.Fragment,{children:[N&&(0,c.jsxs)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:[N,` Your draft has been kept.`]}),L&&t!==k&&(0,c.jsx)(`p`,{role:`status`,className:`text-sm text-outline`,children:`The document changed elsewhere. Your draft is preserved; saving will check for conflicts.`})]});return v===`page`?(0,c.jsx)(`div`,{className:`min-w-0`,"data-testid":`document-workspace`,children:(0,c.jsx)(o,{path:n,value:D,onChange:R,onSave:()=>void z(),readOnly:!f||j,testId:p,wikiLinks:m,initialMode:`read`,mode:T,onModeChange:B,expanded:g,onExpandedChange:_,layout:`page`,pageTitle:y,hideFrontmatter:b,compact:x,notice:N||L&&t!==k?U:void 0,actions:(T!==`read`||L||j)&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(`span`,{"data-testid":`document-save-status`,role:`status`,className:`text-xs text-outline`,children:H}),f&&(L||j)&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(a,{type:`button`,size:`sm`,variant:`ghost`,"data-testid":`document-discard`,disabled:j,onClick:V,children:`Discard`}),(0,c.jsx)(a,{type:`button`,size:`sm`,"data-testid":`document-save`,disabled:j,onClick:()=>void z(),children:`Save`})]})]})})}):(0,c.jsx)(`div`,{className:`min-w-0 space-y-3`,"data-testid":`document-workspace`,children:(0,c.jsx)(o,{path:n,value:D,onChange:R,onSave:()=>void z(),readOnly:!f||j,testId:p,wikiLinks:m,initialMode:`read`,mode:T,onModeChange:B,expanded:g,onExpandedChange:_,layout:v,compact:x,header:(0,c.jsxs)(`div`,{className:`space-y-2`,children:[h&&(0,c.jsx)(`div`,{className:`mb-3 min-w-0`,children:h}),(0,c.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,c.jsx)(`span`,{"data-testid":`document-save-status`,role:`status`,className:`min-w-0 flex-1 text-sm text-outline`,children:H}),f&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(a,{type:`button`,variant:`ghost`,"data-testid":`document-discard`,disabled:!L||j,onClick:V,children:`Discard changes`}),(0,c.jsx)(a,{type:`button`,"data-testid":`document-save`,disabled:!L||j,onClick:()=>void z(),children:`Save changes`})]})]}),U]})})})}export{d as n,f as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime-CVMpzJz9.js";import{t}from"./button-
|
|
1
|
+
import{t as e}from"./jsx-runtime-CVMpzJz9.js";import{t}from"./button-CXYVslgR.js";var n=e();function r({message:e,onRetry:r}){return(0,n.jsxs)(`div`,{"data-testid":`error-state`,className:`flex flex-col items-center justify-center gap-3 px-4 py-16`,children:[(0,n.jsx)(`p`,{role:`alert`,className:`max-w-prose wrap-break-word text-center text-sm text-error`,children:e}),r&&(0,n.jsx)(t,{"data-testid":`error-retry`,variant:`outline`,size:`sm`,onClick:r,children:`Retry`})]})}export{r as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./rolldown-runtime-DSDNlrLa.js";import{n as t,t as n}from"./jsx-runtime-CVMpzJz9.js";import{n as r}from"./QueryClientProvider-DlPztvhd.js";import{m as i}from"./chunk-OB3PAWPO-1IihCzFx.js";import{n as a}from"./client-nzMXason.js";import{t as o}from"./MarkdownEditor-CPlYZ0ux.js";import{t as s}from"./save-CMSSgXiS.js";import{t as c}from"./file-kind-BYU1kv95.js";import{ct as l}from"./index-C60WCVxH.js";var u=e(t(),1),d=n(),f=new Map;typeof window<`u`&&window.addEventListener(`beforeunload`,e=>{f.size!==0&&(e.preventDefault(),e.returnValue=``)});function p({terminalId:e,path:t,content:n,readOnly:p,onDirty:m}){let[h,g]=i(),_=h.get(`editorMode`),v=_===`read`||_===`split`?_:`edit`,y=`${e}:${t}`,b=(0,u.useRef)(f.get(y)??{original:n,content:n}),x=(0,u.useRef)(b.current.original),S=(0,u.useRef)(b.current.content),[C,w]=(0,u.useState)(b.current.content!==b.current.original),[T,E]=(0,u.useState)(!1),[D,O]=(0,u.useState)(null),[k,A]=(0,u.useState)(b.current.content),j=r(),M=(0,u.useRef)(()=>{}),N=(0,u.useRef)(!1),P=(0,u.useRef)(!1),F=(0,u.useRef)(m);F.current=m;async function I(){if(N.current||p||S.current===x.current)return;N.current=!0,E(!0),O(null);let n=S.current;try{await a.git.saveFile(e,t,n,x.current),x.current=n;let r=S.current!==n;w(r),P.current&&F.current(r),r?f.set(y,{original:n,content:S.current}):f.delete(y),j.invalidateQueries({queryKey:[`checkout-files`,e,t]}),j.invalidateQueries({queryKey:[`git`,e]})}catch(e){O(e instanceof Error?e.message:`Could not save file`)}finally{N.current=!1,E(!1)}}M.current=()=>void I(),(0,u.useEffect)(()=>(P.current=!0,F.current(b.current.content!==b.current.original),()=>{P.current=!1}),[]),(0,u.useEffect)(()=>{N.current||f.has(y)||n===x.current||(x.current=n,S.current=n,A(n),w(!1),P.current&&F.current(!1))},[n,y]);function L(e){S.current=e,A(e);let t=e!==x.current;w(t),F.current(t),t?f.set(y,{original:x.current,content:e}):f.delete(y)}function R(){window.confirm(`Discard your edits and reload the file from disk?`)&&a.git.files(e,t).then(e=>{if(e.content===null||e.binary||e.truncated)throw Error(`File is no longer editable`);x.current=e.content,S.current=e.content,f.delete(y),A(e.content),w(!1),F.current(!1),O(null)}).catch(e=>O(e instanceof Error?e.message:`Could not reload file`))}let z=(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 border-b border-surface-highest px-2 py-1`,children:[(0,d.jsxs)(`button`,{type:`button`,"data-testid":`file-save`,disabled:!C||T||p,onClick:()=>void I(),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:[(0,d.jsx)(s,{size:14}),T?`Saving…`:`Save`]}),(0,d.jsx)(`span`,{"data-testid":`file-save-status`,className:`min-w-0 flex-1 truncate text-sm text-on-surface-variant`,children:p?`Read-only preview`:C?`Unsaved changes`:`Saved`})]}),D&&(0,d.jsxs)(`div`,{role:`alert`,className:`shrink-0 border-b border-error/30 p-2 text-xs text-error`,children:[D,(0,d.jsx)(`button`,{type:`button`,"data-testid":`file-reload`,onClick:R,className:`ml-2 underline`,children:`Reload from disk`})]})]});return(0,d.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"data-testid":`file-editor`,children:[!c(t)&&z,(0,d.jsx)(`div`,{"data-testid":`file-preview`,className:`min-h-0 flex-1 overflow-hidden`,children:c(t)?(0,d.jsx)(o,{path:t,value:k,onChange:L,onSave:()=>M.current(),readOnly:p,height:`100%`,testId:`file-editor-input`,header:z,mode:v,onModeChange:e=>g(t=>{let n=new URLSearchParams(t);return n.set(`editorMode`,e),n})}):(0,d.jsx)(l,{path:t,value:k,onChange:L,onSave:()=>M.current(),readOnly:p,height:`100%`,testId:`file-editor-input`})})]})}export{p as FileEditor};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./rolldown-runtime-DSDNlrLa.js";import{n as t,t as n}from"./jsx-runtime-CVMpzJz9.js";import{n as r}from"./QueryClientProvider-DlPztvhd.js";import{n as i,t as a}from"./useMutation-HX90wI4L.js";import{t as o}from"./chunk-OB3PAWPO-1IihCzFx.js";import{t as s}from"./button-CXYVslgR.js";import{t as c}from"./label-wk_QKooL.js";import{a as l,n as u}from"./client-nzMXason.js";import{It as d}from"./index-C60WCVxH.js";import{t as f}from"./ErrorState-BrKz7Mii.js";import{l as p}from"./useJobs-B2da-s4n.js";var m=e(t(),1);function h(e){return i({queryKey:[`webhooks`,e],queryFn:()=>u.webhooks.list(e),select:e=>e.webhooks})}function g(e){return i({queryKey:[`webhook-deliveries`,e],queryFn:()=>u.webhooks.deliveries(e),select:e=>e.deliveries,enabled:!!e,refetchInterval:3e3})}function _(){let e=r();return a({mutationFn:e=>u.webhooks.create(e),onSuccess:()=>e.invalidateQueries({queryKey:[`webhooks`]})})}function v(){let e=r();return a({mutationFn:({id:e,...t})=>u.webhooks.update(e,t),onSuccess:()=>e.invalidateQueries({queryKey:[`webhooks`]})})}function y(){let e=r();return a({mutationFn:e=>u.webhooks.delete(e),onSuccess:()=>e.invalidateQueries({queryKey:[`webhooks`]})})}function b(){return a({mutationFn:e=>u.webhooks.rotate(e)})}function x(e){return[...new Set(e.split(`,`).map(e=>e.trim()).filter(Boolean))]}function S(e,t,n){return new URL(`/webhooks/${encodeURIComponent(e)}`,new URL(t,n)).href}function C(e){return[`localhost`,`127.0.0.1`,`[::1]`].includes(new URL(e).hostname)}var w=n();function T({id:e,testId:t,value:n,onChange:r,placeholder:i}){let[a,o]=(0,m.useState)(n.join(`, `));return(0,w.jsx)(d,{id:e,"data-testid":t,value:a,placeholder:i,onChange:e=>{o(e.target.value),r(e.target.value)}})}function E({projectId:e,onCreated:t}){let n=_(),[r,i]=(0,m.useState)(``),[a,o]=(0,m.useState)(`github`),[l,u]=(0,m.useState)(null),f=(0,m.useId)();return l?(0,w.jsxs)(`div`,{"data-testid":`webhook-created`,className:`space-y-3`,children:[(0,w.jsx)(A,{hook:l,secret:l.secret}),(0,w.jsx)(s,{type:`button`,variant:`outline`,"data-testid":`webhook-setup-done`,onClick:()=>{t?.(l),u(null),i(``)},children:`I've copied the setup details`})]}):(0,w.jsxs)(`div`,{className:`space-y-3`,"data-testid":`webhook-create-form`,children:[(0,w.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,w.jsx)(c,{htmlFor:`${f}-name`,children:`Webhook name`}),(0,w.jsx)(d,{id:`${f}-name`,"data-testid":`webhook-name`,value:r,onChange:e=>i(e.target.value),maxLength:100,placeholder:`GitHub repository events`})]}),(0,w.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,w.jsx)(c,{htmlFor:`${f}-provider`,children:`Provider`}),(0,w.jsxs)(`select`,{id:`${f}-provider`,"data-testid":`webhook-provider`,className:`w-full min-h-8 rounded-md border border-control-border bg-background px-3 text-sm`,value:a,onChange:e=>o(e.target.value),children:[(0,w.jsx)(`option`,{value:`github`,children:`GitHub`}),(0,w.jsx)(`option`,{value:`generic`,children:`Other service (HMAC)`})]})]}),(0,w.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.`}),n.error&&(0,w.jsx)(`p`,{role:`alert`,className:`text-sm text-error`,children:n.error.message}),(0,w.jsx)(s,{type:`button`,"data-testid":`webhook-create`,disabled:!r.trim()||n.isPending,onClick:()=>n.mutate({name:r.trim(),provider:a,project_id:e??null},{onSuccess:u}),children:n.isPending?`Creating...`:`Create webhook`})]})}function D({value:e,onChange:t,projectId:n}){let{data:r,error:i,isLoading:a,refetch:o}=h(n),l=r?.filter(e=>e.project_id===null||e.project_id===n),[u,d]=(0,m.useState)(!1);function p(n){e.some(e=>e.webhook_id===n)||t([...e,{webhook_id:n,events:[],actions:[]}])}function g(n,r,i){t(e.map(e=>e.webhook_id===n?{...e,[r]:x(i)}:e))}return(0,w.jsxs)(`section`,{className:`space-y-3 border-y border-border py-4`,"data-testid":`job-webhook-picker`,children:[(0,w.jsx)(`h3`,{className:`text-sm font-medium`,children:`Which webhook should trigger this job?`}),i?(0,w.jsx)(f,{message:i.message,onRetry:()=>o()}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(c,{htmlFor:`job-webhook-source`,children:`Configured webhooks`}),(0,w.jsxs)(`select`,{id:`job-webhook-source`,"data-testid":`job-webhook-select`,className:`w-full min-h-8 rounded-md border border-control-border bg-background px-3 text-sm`,value:``,disabled:a,onChange:e=>{e.target.value&&p(e.target.value)},children:[(0,w.jsx)(`option`,{value:``,children:a?`Loading webhooks...`:`Select an existing webhook`}),(l??[]).filter(t=>!e.some(e=>e.webhook_id===t.id)).map(e=>(0,w.jsxs)(`option`,{value:e.id,children:[e.name,e.enabled?``:` (disabled)`]},e.id))]}),!a&&!l?.length&&(0,w.jsx)(`p`,{className:`text-xs text-outline`,children:`No webhooks configured for this project yet. Create one below or on the Webhooks page.`})]}),e.map(n=>(0,w.jsxs)(`div`,{className:`space-y-2 border-t border-border pt-3`,"data-testid":`job-webhook-binding`,"data-webhook-id":n.webhook_id,children:[(0,w.jsxs)(`div`,{className:`flex justify-between gap-2`,children:[(0,w.jsx)(`span`,{className:`text-sm font-medium`,children:l?.find(e=>e.id===n.webhook_id)?.name??n.webhook_id}),(0,w.jsx)(s,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`job-webhook-remove`,onClick:()=>t(e.filter(e=>e.webhook_id!==n.webhook_id)),children:`Disconnect`})]}),(0,w.jsx)(c,{htmlFor:`events-${n.webhook_id}`,children:`Events for this job`}),(0,w.jsx)(T,{id:`events-${n.webhook_id}`,testId:`webhook-events`,value:n.events,onChange:e=>g(n.webhook_id,`events`,e),placeholder:`pull_request, push (blank accepts all)`}),(0,w.jsx)(c,{htmlFor:`actions-${n.webhook_id}`,children:`Actions for this job (optional)`}),(0,w.jsx)(T,{id:`actions-${n.webhook_id}`,testId:`webhook-actions`,value:n.actions,onChange:e=>g(n.webhook_id,`actions`,e),placeholder:`opened, synchronize (blank accepts all)`})]},n.webhook_id)),(0,w.jsx)(s,{type:`button`,size:`sm`,variant:`outline`,"data-testid":`webhook-add`,onClick:()=>d(!u),children:u?`Close new webhook`:`Create a webhook`}),u&&(0,w.jsx)(E,{projectId:n,onCreated:e=>{p(e.id),d(!1)}})]})}function O({job:e}){let t=p(),[n,r]=(0,m.useState)(e.webhooks??[]);return(0,w.jsxs)(`section`,{className:`space-y-3`,"data-testid":`job-webhooks`,children:[!e.enabled&&(0,w.jsx)(`p`,{className:`text-sm text-outline`,children:`Job disabled. Configure connections now and enable it from Jobs when ready.`}),(0,w.jsx)(D,{value:n,onChange:r,projectId:e.project_id??void 0}),t.error&&(0,w.jsx)(`p`,{role:`alert`,className:`text-sm text-error`,children:t.error.message}),(0,w.jsx)(s,{type:`button`,size:`sm`,"data-testid":`job-webhooks-save`,disabled:t.isPending,onClick:()=>t.mutate({id:e.id,webhooks:n,trigger_type:`webhook`}),children:`Save connections`}),t.isSuccess&&(0,w.jsx)(`p`,{role:`status`,className:`text-xs text-outline`,children:`Connections saved.`}),(0,w.jsx)(o,{className:`inline-block text-sm underline`,to:`/webhooks?project=${encodeURIComponent(e.project_id??`all`)}`,children:`Manage configured webhooks and deliveries`})]})}function k({label:e,value:t,secret:n=!1}){let[r,i]=(0,m.useState)(!1),[a,o]=(0,m.useState)(!1);return(0,w.jsxs)(`div`,{className:`space-y-1`,children:[(0,w.jsx)(`p`,{className:`text-xs text-outline`,children:e}),(0,w.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,w.jsx)(`code`,{className:`min-w-0 flex-1 break-all text-xs`,"data-testid":n?`webhook-secret`:`webhook-url`,children:t}),(0,w.jsx)(s,{type:`button`,size:`sm`,variant:`outline`,"aria-label":`Copy ${e}`,onClick:async()=>{try{await navigator.clipboard.writeText(t),i(!0),o(!1)}catch{o(!0)}},children:r?`Copied`:`Copy`})]}),a&&(0,w.jsx)(`p`,{role:`alert`,className:`text-xs text-error`,children:`Select and copy the value above; clipboard access is unavailable.`})]})}function A({hook:e,secret:t,showInstructions:n=!0,instructionsId:r}){let i=S(e.token,l(),window.location.origin);return(0,w.jsxs)(`div`,{className:`space-y-3`,"data-testid":`webhook-setup`,children:[(0,w.jsx)(k,{label:`Payload URL`,value:i}),C(i)&&(0,w.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.`}),n&&(0,w.jsxs)(`div`,{id:r,"data-testid":`webhook-setup-instructions`,className:`space-y-3`,children:[t?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(k,{label:`Signing secret`,value:t,secret:!0}),(0,w.jsx)(`p`,{className:`text-xs text-outline`,children:`Copy the signing secret before leaving. It is shown once.`})]}):(0,w.jsx)(`p`,{className:`text-xs text-outline`,children:`The signing secret is hidden. Generate a replacement only if you need to reconnect the sender.`}),e.provider===`github`?(0,w.jsxs)(`ol`,{className:`list-decimal space-y-1 pl-5 text-sm text-outline`,children:[(0,w.jsx)(`li`,{children:`In your repository, open GitHub Settings - Webhooks - Add webhook.`}),(0,w.jsx)(`li`,{children:`Paste the Payload URL, select application/json, and enter the signing secret.`}),(0,w.jsx)(`li`,{children:`Select the events needed by your connected jobs. Each job has its own filters.`}),(0,w.jsx)(`li`,{children:`Send a test event, then open Recent deliveries for this webhook.`})]}):(0,w.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 j({hook:e}){let t=v(),n=b(),[r,i]=(0,m.useState)(!1),[a,c]=(0,m.useState)(!1),[l,u]=(0,m.useState)(!1),[d,f]=(0,m.useState)(),p=(0,m.useId)();return(0,w.jsxs)(`article`,{className:`space-y-3 border-b border-border pb-5`,"data-testid":`webhook-endpoint`,"data-webhook-id":e.id,children:[(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,w.jsx)(`h3`,{className:`text-sm font-medium`,children:e.name}),(0,w.jsxs)(`span`,{className:`text-xs text-outline`,children:[e.provider,` - `,e.enabled?`Enabled`:`Disabled`]}),(0,w.jsx)(s,{type:`button`,variant:`outline`,size:`sm`,disabled:t.isPending,onClick:()=>t.mutate({id:e.id,enabled:!e.enabled}),children:e.enabled?`Disable`:`Enable`})]}),(0,w.jsxs)(`div`,{className:`space-y-1`,"data-testid":`webhook-connected-jobs`,children:[(0,w.jsxs)(`p`,{className:`text-xs text-outline`,children:[`Connected jobs (`,e.subscriptions.length,`)`]}),e.subscriptions.length?e.subscriptions.map(e=>(0,w.jsxs)(`div`,{className:`text-sm`,children:[(0,w.jsx)(o,{className:`underline`,"data-testid":`webhook-job-link`,to:`/jobs/${e.job_id}?project=all`,children:e.name}),(0,w.jsxs)(`span`,{className:`text-xs text-outline`,children:[` `,`- `,e.enabled?`Enabled`:`Disabled`,`; events:`,` `,e.events.join(`, `)||`all`,`; actions:`,` `,e.actions.join(`, `)||`all`]})]},e.job_id)):null]}),(0,w.jsx)(A,{hook:e,secret:d,showInstructions:a,instructionsId:p}),(0,w.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,w.jsx)(s,{type:`button`,variant:`outline`,size:`sm`,"data-testid":`webhook-deliveries-toggle`,onClick:()=>i(!r),children:r?`Hide deliveries`:`Recent deliveries`}),(0,w.jsx)(s,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`webhook-setup-toggle`,"aria-expanded":a,"aria-controls":a?p:void 0,disabled:n.isPending,onClick:()=>{a&&f(void 0),c(!a),u(!1)},children:a?d?`I've copied the setup details`:`Hide setup`:`Setup instructions`})]}),a&&(0,w.jsx)(s,{type:`button`,variant:`ghost`,size:`sm`,disabled:n.isPending,onClick:()=>u(!l),children:`New signing secret`}),a&&l&&(0,w.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,w.jsx)(`p`,{children:`The sender's existing secret will stop working. Update it after generating the replacement.`}),(0,w.jsx)(s,{type:`button`,variant:`outline`,size:`sm`,disabled:n.isPending,onClick:()=>n.mutate(e.id,{onSuccess:e=>{f(e.secret),c(!0),u(!1)}}),children:`Generate replacement secret`})]}),(t.error||n.error)&&(0,w.jsx)(`p`,{role:`alert`,className:`text-sm text-error`,children:(t.error??n.error)?.message}),r&&(0,w.jsx)(M,{id:e.id})]})}function M({id:e}){let{data:t,isLoading:n,error:r,refetch:i}=g(e);return(0,w.jsxs)(`section`,{className:`space-y-2`,"data-testid":`webhook-deliveries`,children:[(0,w.jsx)(`h4`,{className:`text-sm font-medium`,children:`Recent deliveries`}),r?(0,w.jsx)(f,{message:r.message,onRetry:()=>i()}):n?(0,w.jsx)(`p`,{role:`status`,children:`Loading deliveries...`}):t?.length?t.map(e=>(0,w.jsxs)(`div`,{className:`space-y-1 border-t border-border py-2 text-xs`,"data-testid":`webhook-delivery`,children:[(0,w.jsxs)(`div`,{className:`flex flex-wrap justify-between gap-2`,children:[(0,w.jsxs)(`span`,{children:[e.event,e.action?` / ${e.action}`:``]}),(0,w.jsx)(`span`,{children:e.status})]}),(0,w.jsxs)(`p`,{className:`text-outline`,children:[e.repository,` `,new Date(e.created_at).toLocaleString()]}),e.status===`ignored`&&(0,w.jsx)(`p`,{className:`text-outline`,children:`No enabled connected job matched this event.`}),e.error&&(0,w.jsx)(`p`,{className:`text-error`,children:e.error}),e.runs.map(e=>(0,w.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,w.jsxs)(o,{className:`underline`,to:`/jobs/${e.job_id}?project=all`,children:[`Job run: `,e.status]}),e.task_id&&(0,w.jsx)(o,{className:`underline`,to:`/tasks/${e.task_id}?project=all`,children:`Created task`}),e.session_id&&(0,w.jsx)(o,{className:`underline`,to:`/audit/${e.session_id}?project=all`,children:`Agent session`})]},e.job_run_id))]},e.id)):(0,w.jsx)(`p`,{className:`text-sm text-outline`,children:`No events received yet. Register the endpoint with your provider, then send an event.`})]})}export{y as a,D as i,E as n,h as o,j as r,O as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./rolldown-runtime-DSDNlrLa.js";import{n as t,t as n}from"./jsx-runtime-CVMpzJz9.js";import{t as r}from"./chunk-OB3PAWPO-1IihCzFx.js";import{t as i}from"./button-CXYVslgR.js";import{t as a}from"./label-wk_QKooL.js";import{t as o}from"./scroll-area-D0FZFdju.js";import{a as s,i as c,n as l,r as u,t as d}from"./select-Cj-m0J9A.js";import{d as f}from"./client-nzMXason.js";import{t as p}from"./chevron-down-hj6o3_QU.js";import{t as m}from"./ResponsiveFilters-DAeezpA-.js";import{t as h}from"./textarea-Bt1FBmGL.js";import{a as g,i as _,o as v}from"./dialog-Juth7dP_.js";import{$t as y,Ct as b,Et as x,G as S,It as C,J as w,K as T,P as E,St as D,U as O,W as k,X as A,Y as j,Zt as M,_t as N,bt as P,en as F,ft as I,qt as L,st as R,un as z,wt as B,xt as V}from"./index-C60WCVxH.js";import{t as H}from"./ConfirmDialog-Cyd60q9b.js";import{t as U}from"./ErrorState-BrKz7Mii.js";import{t as W}from"./ViewHeader-Ce5HQRJu.js";import{t as ee}from"./useDetailRoute-DOhAbdV7.js";import{t as G}from"./view-params-DD7i9s5g.js";import{t as K}from"./EmptyState-YM4VSLR9.js";import{a as te,i as q,n as ne,o as re,r as J,t as ie}from"./table-Cri9EUoE.js";import{t as ae}from"./useProjectScope-DtEj9j-P.js";import{t as oe}from"./StatusBadge-ia651_Df.js";import{a as se,c as ce,i as le,l as Y,n as ue,o as de,r as fe,s as pe,t as me}from"./useJobs-B2da-s4n.js";import{n as he,t as ge}from"./useListSelection-ZreW_5e4.js";import{i as _e,t as ve}from"./JobWebhooks-csgdKaIu.js";var ye={name:`play`,size:24,node:[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]};ye.node;var X=f(ye),be={name:`power`,size:24,node:[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]};be.node;var xe=f(be),Z=e(t(),1),Q=n();function Se(e){return e.type===`command`?!!e.command.trim():e.type===`agent`?!!(e.prompt.trim()&&e.backend.trim()):!!e.title.trim()}function Ce({value:e,onChange:t}){let n=(0,Z.useId)(),{data:r}=I();return(0,Q.jsxs)(`section`,{className:`space-y-3 border-y border-border py-4`,"data-testid":`job-action-fields`,children:[(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(a,{htmlFor:`${n}-type`,children:`What should this job do?`}),(0,Q.jsxs)(`select`,{id:`${n}-type`,"data-testid":`job-action-type`,className:`w-full min-h-8 rounded-md border border-control-border bg-background px-3 text-sm`,value:e.type,onChange:e=>{e.target.value===`command`&&t({type:`command`,command:``}),e.target.value===`agent`&&t({type:`agent`,backend:`codex-cli`,prompt:``,auto_approve:!1}),e.target.value===`task`&&t({type:`task`,title:``,body:``,start_automatically:!1})},children:[(0,Q.jsx)(`option`,{value:`command`,children:`Run command`}),(0,Q.jsx)(`option`,{value:`agent`,children:`Run agent`}),(0,Q.jsx)(`option`,{value:`task`,children:`Create task`})]})]}),e.type===`command`&&(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(a,{htmlFor:`${n}-command`,children:`Command`}),(0,Q.jsx)(h,{id:`${n}-command`,"aria-label":`Command`,"data-testid":`job-command-input`,value:e.command,onChange:n=>t({...e,command:n.target.value}),rows:3,placeholder:`bun run build`,required:!0})]}),e.type===`agent`&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(a,{htmlFor:`${n}-backend`,children:`Agent backend`}),(0,Q.jsx)(C,{id:`${n}-backend`,"data-testid":`job-agent-backend`,value:e.backend,list:`${n}-backends`,onChange:n=>t({...e,backend:n.target.value}),required:!0}),(0,Q.jsx)(`datalist`,{id:`${n}-backends`,children:r?.backends.map(e=>(0,Q.jsx)(`option`,{value:e.name,children:e.available?`Available`:`Unavailable`},e.name))})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(a,{htmlFor:`${n}-model`,children:`Model (optional)`}),(0,Q.jsx)(C,{id:`${n}-model`,"data-testid":`job-agent-model`,value:e.model??``,onChange:n=>t({...e,model:n.target.value||void 0})})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(a,{htmlFor:`${n}-prompt`,children:`Instructions`}),(0,Q.jsx)(h,{id:`${n}-prompt`,"data-testid":`job-agent-prompt`,value:e.prompt,onChange:n=>t({...e,prompt:n.target.value}),required:!0,rows:4})]}),(0,Q.jsxs)(`label`,{className:`flex min-h-11 items-center gap-2 text-sm`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:e.auto_approve,onChange:n=>t({...e,auto_approve:n.target.checked})}),`Allow agent tools automatically`]}),(0,Q.jsx)(`p`,{className:`text-xs text-outline`,children:`Starts a tracked agent session. When automatic tool approval is off, permission requests are denied.`})]}),e.type===`task`&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(a,{htmlFor:`${n}-title`,children:`Task title`}),(0,Q.jsx)(C,{id:`${n}-title`,"data-testid":`job-task-title`,value:e.title,onChange:n=>t({...e,title:n.target.value}),required:!0,maxLength:200})]}),(0,Q.jsx)(E,{label:`Task instructions`,id:`${n}-body`,"data-testid":`job-task-body`,value:e.body,onChange:n=>t({...e,body:n}),rows:4}),(0,Q.jsxs)(`label`,{className:`flex min-h-11 items-center gap-2 text-sm`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,"data-testid":`job-task-autostart`,checked:e.start_automatically,onChange:n=>t({...e,start_automatically:n.target.checked})}),`Start the task flow automatically`]}),e.start_automatically&&(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(a,{htmlFor:`${n}-flow`,children:`Flow (blank uses the configured default)`}),(0,Q.jsx)(C,{id:`${n}-flow`,"data-testid":`job-task-flow`,value:e.flow_name??``,onChange:n=>t({...e,flow_name:n.target.value||void 0})})]}),(0,Q.jsx)(`p`,{className:`text-xs text-outline`,children:`Creates a task in this job's project. Automatic start is off by default; the task waits for a manual flow start.`})]})]})}function we({jobId:e,open:t,onClose:n,onEdit:r,projectScope:a=`all`}){let{data:o,isLoading:s,error:c,refetch:l}=fe(e),u=o&&(a===`all`||(a===`unassigned`?o.project_id===null:o.project_id===a)),d=u?o:void 0;(0,Z.useEffect)(()=>{t&&o&&!u&&n()},[t,o,u,n]);let{data:f,isLoading:p,error:m,refetch:h}=se(d?.id??null),g=ce(),_=Y(),[v,y]=(0,Z.useState)(null);return(0,Q.jsx)(k,{open:t,onOpenChange:e=>!e&&n(),children:(0,Q.jsxs)(T,{"data-testid":`job-detail-sheet`,children:[(0,Q.jsxs)(j,{children:[(0,Q.jsx)(A,{children:d?.name??`Job details`}),d?.description&&(0,Q.jsx)(`p`,{className:`font-body text-xs text-outline mt-1`,children:d.description})]}),(0,Q.jsx)(S,{children:c?(0,Q.jsx)(U,{message:c.message,onRetry:()=>l()}):s?(0,Q.jsx)(`div`,{className:`space-y-3`,children:[...[,,,,,,]].map((e,t)=>(0,Q.jsx)(O,{className:`h-8 w-full bg-surface-highest`},t))}):d?(0,Q.jsxs)(`div`,{className:`space-y-6`,children:[(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(R,{label:`Action`,children:(0,Q.jsx)(`pre`,{className:`font-mono text-xs bg-background p-2 rounded-lg border border-surface-highest overflow-x-auto whitespace-pre-wrap break-all`,children:d.action?.type===`agent`?`Run agent (${d.action.backend}): ${d.action.prompt}`:d.action?.type===`task`?`Create task: ${d.action.title}`:d.command})}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-4`,children:[(0,Q.jsx)(R,{label:`Trigger Type`,children:(0,Q.jsx)(`span`,{className:`font-label text-xs px-2 py-0.5 bg-surface-highest text-on-surface-variant border border-surface-highest/50 inline-flex`,children:d.trigger_type})}),(0,Q.jsx)(R,{label:`Enabled`,children:(0,Q.jsx)(`span`,{className:`font-label text-xs font-bold ${d.enabled?`text-secondary`:`text-outline`}`,children:d.enabled?`● ON`:`○ OFF`})})]}),d.cron_expr&&(0,Q.jsx)(R,{label:`Cron Expression`,children:(0,Q.jsx)(`code`,{className:`font-mono text-xs`,children:d.cron_expr})}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-4`,children:[(0,Q.jsxs)(R,{label:`Timeout`,children:[d.timeout_secs,`s`]}),(0,Q.jsx)(R,{label:`Max Retries`,children:d.max_retries}),(0,Q.jsx)(R,{label:`Overlap`,children:d.overlap})]}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-4`,children:[(0,Q.jsx)(R,{label:`Notify On`,children:d.notify_on}),(0,Q.jsx)(R,{label:`Run Count`,children:d.run_count})]}),d.next_run_at&&(0,Q.jsx)(R,{label:`Next Run`,children:new Date(d.next_run_at).toLocaleString()})]}),!d.command.startsWith(`__`)&&(0,Q.jsx)(ve,{job:d},d.id),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`font-label text-xs font-medium text-outline mb-3`,children:`Recent runs`}),m?(0,Q.jsx)(U,{message:m.message,onRetry:()=>h()}):p?(0,Q.jsx)(`div`,{className:`space-y-2`,children:[...[,,,]].map((e,t)=>(0,Q.jsx)(O,{className:`h-8 w-full bg-surface-highest`},t))}):f?.length?(0,Q.jsx)(`div`,{className:`space-y-1`,children:f.map(t=>(0,Q.jsx)(Te,{run:t,jobId:e,expanded:v===t.id,onToggle:()=>y(v===t.id?null:t.id)},t.id))}):(0,Q.jsx)(`div`,{className:`font-label text-xs text-outline py-4 text-center`,children:`No runs yet`})]})]}):(0,Q.jsx)(`p`,{className:`text-sm text-outline`,children:`Job not found`})}),(0,Q.jsxs)(w,{className:`flex-wrap`,children:[(_.error||g.error)&&(0,Q.jsx)(`p`,{role:`alert`,className:`w-full text-sm text-error`,children:(_.error??g.error)?.message}),d&&r&&(0,Q.jsxs)(i,{"data-testid":`job-detail-edit`,size:`sm`,variant:`outline`,onClick:()=>r(d),children:[(0,Q.jsx)(F,{size:16}),`Edit job`]}),d&&(0,Q.jsxs)(i,{size:`sm`,variant:`ghost`,disabled:_.isPending,onClick:()=>_.mutate({id:d.id,enabled:!d.enabled}),className:`font-label text-xs font-medium`,children:[(0,Q.jsx)(xe,{size:12,className:`mr-1.5`}),d.enabled?`Disable`:`Enable`]}),d&&(0,Q.jsxs)(i,{variant:`ghost`,size:`sm`,disabled:g.isPending,onClick:()=>g.mutate(d.id),className:`font-label text-xs font-medium bg-transparent text-on-surface border border-control-border hover:bg-surface`,children:[(0,Q.jsx)(X,{size:12,className:`mr-1.5`}),g.isPending?`Triggering...`:`Trigger run`]})]})]})})}function Te({run:e,jobId:t,expanded:n,onToggle:i}){return(0,Q.jsxs)(`div`,{className:`min-w-0 border-y border-border overflow-hidden bg-background`,children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:i,"aria-expanded":n,className:`w-full flex items-center gap-3 px-3 py-2 hover:bg-surface transition-colors text-left`,children:[n?(0,Q.jsx)(p,{size:12,className:`text-outline shrink-0`}):(0,Q.jsx)(z,{size:12,className:`text-outline shrink-0`}),(0,Q.jsx)(oe,{status:e.status,type:`job`}),(0,Q.jsxs)(`span`,{className:`font-label text-xs text-outline flex-1`,children:[e.started_at?new Date(e.started_at).toLocaleString():`—`,e.ended_at&&(0,Q.jsxs)(`span`,{className:`ml-2`,children:[`\\u2192 `,new Date(e.ended_at).toLocaleString()]})]}),e.exit_code!==null&&(0,Q.jsxs)(`span`,{className:`font-mono text-xs ${e.exit_code===0?`text-secondary`:`text-error`}`,children:[`exit `,e.exit_code]})]}),(e.task_id||e.session_id)&&(0,Q.jsxs)(`div`,{className:`flex gap-3 px-3 py-2 text-xs`,children:[e.task_id&&(0,Q.jsx)(r,{className:`underline`,"data-testid":`job-run-task-link`,to:`/tasks/${e.task_id}?project=all`,children:`Created task`}),e.session_id&&(0,Q.jsx)(r,{className:`underline`,"data-testid":`job-run-session-link`,to:`/audit/${e.session_id}?project=all`,children:`Agent session`})]}),e.error_msg&&(0,Q.jsx)(`div`,{className:`px-3 pb-2`,children:(0,Q.jsx)(`span`,{className:`font-body text-xs text-error`,children:e.error_msg})}),n&&(0,Q.jsx)(Ee,{jobId:t,runId:e.id})]})}function Ee({jobId:e,runId:t}){let{data:n,isLoading:r,error:i,refetch:a}=le(e,t);return i?(0,Q.jsx)(U,{message:i.message,onRetry:()=>a()}):r?(0,Q.jsx)(`div`,{className:`px-3 pb-3`,children:(0,Q.jsx)(O,{className:`h-24 w-full bg-surface-highest`})}):n?.length?(0,Q.jsx)(`div`,{className:`mx-3 mb-3 rounded-lg overflow-hidden border border-surface-highest`,children:(0,Q.jsx)(o,{className:`h-[240px]`,children:(0,Q.jsx)(`pre`,{className:`font-mono text-xs leading-relaxed bg-background p-3`,children:n.map(e=>(0,Q.jsx)(`div`,{className:e.stream===`stderr`?`text-error`:`text-on-surface`,children:e.line},e.id))})})}):(0,Q.jsx)(`div`,{className:`px-3 pb-3 font-label text-xs text-outline`,children:`No log output`})}var $=[`one-shot`,`cron`,`watch`,`webhook`,`manual`,`bridge-msg`],De=[`skip`,`queue`,`kill`],Oe=[`never`,`failure`,`always`];function ke({projectId:e}){let t=x(`xl`),[n,r]=G(`jobQuery`,``),[a,o]=G(`jobStatus`,`all`,[`all`,`enabled`,`disabled`]),[s,c]=G(`jobTrigger`,`all`,[`all`,...$]),l=ae(e),u=l===`all`||l===`unassigned`?void 0:l,{data:d,isLoading:f,error:p,refetch:h}=de({project_id:l===`all`?void 0:l,limit:100}),g=(l===`unassigned`?d?.filter(e=>e.project_id===null):d)?.filter(e=>(!n||`${e.name} ${e.description??``} ${e.command??``}`.toLowerCase().includes(n.toLowerCase()))&&(a===`all`||e.enabled===(a===`enabled`))&&(s===`all`||e.trigger_type===s)),_=JSON.stringify([l,n,a,s]),v=ce(),b=ue(),S=Y(),w=pe(),T=w.data?.scope===_?w.data:void 0,E=ge((g??[]).map(e=>e.id),_);async function D(e){let t=await w.mutateAsync({ids:E.selectedIds,enabled:e,scope:_});E.select(t.failed.map(e=>e.id))}let{selectedId:k,openDetail:A,closeDetail:j}=ee(`/jobs`,`jobId`),[N,P]=(0,Z.useState)(!1),[I,R]=(0,Z.useState)(null),[z,B]=(0,Z.useState)(null);if(p)return(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(W,{title:`Jobs`}),(0,Q.jsx)(U,{message:p.message,onRetry:()=>h()})]});let V=(g??[]).filter(e=>e.enabled).length;return(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(W,{title:`Jobs`,compact:!0,meta:`${V}/${(g??[]).length} enabled`,action:(0,Q.jsxs)(i,{"data-testid":`new-job-button`,size:`sm`,onClick:()=>P(!0),className:`font-label text-xs font-medium bg-primary text-primary-foreground hover:bg-primary/90`,children:[(0,Q.jsx)(y,{size:12,className:`mr-1`}),` New job`]})}),(0,Q.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:[(0,Q.jsxs)(`div`,{className:`relative min-w-0 flex-1 lg:max-w-md`,children:[(0,Q.jsx)(M,{size:14,className:`absolute left-3 top-1/2 -translate-y-1/2 text-outline`}),(0,Q.jsx)(C,{type:`search`,"aria-label":`Search jobs`,"data-testid":`job-search`,placeholder:`Search jobs…`,value:n,onChange:e=>r(e.target.value,{replace:!0}),className:`h-11 pl-9 text-base lg:h-9 lg:text-sm`})]}),(0,Q.jsxs)(m,{activeCount:Number(a!==`all`)+Number(s!==`all`),children:[(0,Q.jsxs)(`select`,{"aria-label":`Job status`,"data-testid":`job-status-filter`,value:a,onChange:e=>o(e.target.value),className:`form-control form-control-single max-w-full`,children:[(0,Q.jsx)(`option`,{value:`all`,children:`All statuses`}),(0,Q.jsx)(`option`,{value:`enabled`,children:`Enabled`}),(0,Q.jsx)(`option`,{value:`disabled`,children:`Disabled`})]}),(0,Q.jsxs)(`select`,{"aria-label":`Job trigger`,"data-testid":`job-trigger-filter`,value:s,onChange:e=>c(e.target.value),className:`form-control form-control-single max-w-full`,children:[(0,Q.jsx)(`option`,{value:`all`,children:`All triggers`}),$.map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))]})]})]}),(v.error||b.error||S.error)&&(0,Q.jsx)(`p`,{role:`alert`,className:`mb-4 text-sm text-error`,children:(v.error??b.error??S.error)?.message}),!!g?.length&&(0,Q.jsxs)(he,{resourceLabel:`jobs`,count:E.selectedIds.length,allSelected:E.allSelected,someSelected:E.someSelected,onSelectAll:E.selectAll,onClear:E.clear,disabled:w.isPending,children:[(0,Q.jsx)(i,{type:`button`,variant:`outline`,size:`sm`,"data-testid":`jobs-bulk-enable`,disabled:w.isPending||S.isPending,onClick:()=>void D(!0),children:`Enable selected`}),(0,Q.jsx)(i,{type:`button`,variant:`outline`,size:`sm`,"data-testid":`jobs-bulk-disable`,disabled:w.isPending||S.isPending,onClick:()=>void D(!1),children:`Disable selected`})]}),w.isPending&&(0,Q.jsx)(`p`,{role:`status`,className:`mb-3 text-sm text-outline`,children:`Updating selected jobs…`}),!w.isPending&&T&&(0,Q.jsxs)(`div`,{className:`mb-3 space-y-1 text-sm`,"data-testid":`jobs-bulk-result`,role:`status`,children:[(0,Q.jsxs)(`p`,{children:[T.succeeded.length,` jobs `,T.enabled?`enabled`:`disabled`,`.`]}),T.failed.map(e=>(0,Q.jsxs)(`p`,{className:`text-error`,children:[g?.find(t=>t.id===e.id)?.name??e.id,`: `,e.error,`. Still selected for retry.`]},e.id))]}),f?(0,Q.jsx)(`div`,{role:`status`,"aria-label":`Loading jobs`,className:`space-y-2`,children:[...[,,,]].map((e,t)=>(0,Q.jsx)(O,{className:`h-12 w-full bg-surface-highest`},t))}):(g??[]).length===0?(0,Q.jsx)(K,{message:n||a!==`all`||s!==`all`?`No jobs match`:`No jobs configured`}):t?(0,Q.jsx)(`div`,{className:`min-w-0 overflow-hidden`,children:(0,Q.jsxs)(ie,{children:[(0,Q.jsx)(te,{children:(0,Q.jsxs)(re,{className:`border-b border-border hover:bg-transparent`,children:[(0,Q.jsx)(q,{className:`w-11`,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Select jobs`})}),(0,Q.jsx)(q,{className:`font-label text-xs font-medium text-outline`,children:`Name`}),(0,Q.jsx)(q,{className:`font-label text-xs font-medium text-outline w-24`,children:`Trigger`}),(0,Q.jsx)(q,{className:`font-label text-xs font-medium text-outline w-48`,children:`Action`}),(0,Q.jsx)(q,{className:`font-label text-xs font-medium text-outline w-16`,children:`Enabled`}),(0,Q.jsx)(q,{className:`font-label text-xs font-medium text-outline w-36`,children:`Last Run`}),(0,Q.jsx)(q,{className:`font-label text-xs font-medium text-outline w-16`,children:`Runs`}),(0,Q.jsx)(q,{className:`font-label text-xs font-medium text-outline w-36`,children:`Next Run`}),(0,Q.jsx)(q,{className:`w-28`})]})}),(0,Q.jsx)(ne,{children:(g??[]).map(e=>(0,Q.jsxs)(re,{"data-testid":`job-row`,"data-job-id":e.id,"data-job-name":e.name,className:`border-b border-border/65 hover:bg-surface-high cursor-pointer`,onClick:()=>A(e.id),children:[(0,Q.jsx)(J,{children:(0,Q.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,"aria-label":`Select ${e.name}`,"data-testid":`job-select`,checked:E.selectedIds.includes(e.id),disabled:w.isPending,onClick:e=>e.stopPropagation(),onChange:()=>E.toggle(e.id)})}),(0,Q.jsxs)(J,{children:[(0,Q.jsx)(`button`,{type:`button`,className:`font-body text-sm font-medium text-on-surface text-left hover:text-primary`,"data-testid":`job-open-detail`,onClick:t=>{t.stopPropagation(),A(e.id)},children:e.name}),e.description&&(0,Q.jsx)(`div`,{className:`font-body text-sm text-outline mt-0.5 truncate max-w-[200px]`,children:e.description})]}),(0,Q.jsx)(J,{children:(0,Q.jsx)(`span`,{className:`font-label text-xs text-on-surface-variant inline-flex`,children:e.trigger_type})}),(0,Q.jsx)(J,{children:(0,Q.jsx)(`code`,{className:`font-mono text-xs text-outline truncate block max-w-[180px]`,children:e.action?.type===`agent`?`Agent: ${e.action.backend}`:e.action?.type===`task`?`Task: ${e.action.title}`:e.command})}),(0,Q.jsx)(J,{children:(0,Q.jsx)(i,{type:`button`,"data-testid":`job-toggle-enabled`,variant:`outline`,size:`sm`,"aria-label":`${e.enabled?`Disable`:`Enable`} ${e.name}`,"aria-pressed":e.enabled,disabled:S.isPending||w.isPending,onClick:t=>{t.stopPropagation(),S.mutate({id:e.id,enabled:!e.enabled})},children:e.enabled?`Disable`:`Enable`})}),(0,Q.jsx)(J,{className:`font-label text-xs text-outline`,children:e.last_run_at?new Date(e.last_run_at).toLocaleString():`—`}),(0,Q.jsx)(J,{className:`font-label text-xs text-outline`,children:e.run_count}),(0,Q.jsx)(J,{className:`font-label text-xs text-outline`,children:e.next_run_at?new Date(e.next_run_at).toLocaleString():`—`}),(0,Q.jsx)(J,{children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,onClick:e=>e.stopPropagation(),children:[(0,Q.jsxs)(i,{variant:`ghost`,"data-testid":`job-trigger`,size:`sm`,disabled:v.isPending,onClick:()=>v.mutate(e.id),className:`font-label text-sm min-h-8 px-3 bg-transparent text-on-surface border border-border hover:bg-surface-high`,children:[(0,Q.jsx)(X,{size:10,className:`mr-1`}),` Run`]}),(0,Q.jsx)(i,{type:`button`,"data-testid":`job-edit`,variant:`ghost`,size:`icon`,"aria-label":`Edit ${e.name}`,onClick:()=>R(e),className:`inline-flex min-h-8 min-w-8 items-center justify-center rounded-md text-outline hover:text-primary hover:bg-surface-highest`,children:(0,Q.jsx)(F,{size:16})}),(0,Q.jsx)(i,{type:`button`,"data-testid":`job-delete`,variant:`ghost`,size:`icon`,"aria-label":`Delete ${e.name}`,onClick:()=>B(e),className:`inline-flex min-h-8 min-w-8 items-center justify-center rounded-md text-outline hover:text-error hover:bg-error/10`,children:(0,Q.jsx)(L,{size:12})})]})})]},e.id))})]})}):(0,Q.jsx)(`div`,{className:`divide-y divide-border`,children:(g??[]).map(e=>(0,Q.jsxs)(`article`,{"data-testid":`job-row`,"data-job-id":e.id,"data-job-name":e.name,className:`py-3 space-y-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary shrink-0 mt-1`,"aria-label":`Select ${e.name}`,"data-testid":`job-select`,checked:E.selectedIds.includes(e.id),disabled:w.isPending,onChange:()=>E.toggle(e.id)}),(0,Q.jsx)(`button`,{type:`button`,className:`min-w-0 flex-1 text-left font-medium text-sm text-on-surface wrap-break-word hover:text-primary`,"data-testid":`job-open-detail`,onClick:()=>A(e.id),children:e.name}),(0,Q.jsx)(i,{type:`button`,"data-testid":`job-toggle-enabled`,variant:`outline`,size:`sm`,"aria-label":`${e.enabled?`Disable`:`Enable`} ${e.name}`,"aria-pressed":e.enabled,disabled:S.isPending||w.isPending,onClick:()=>S.mutate({id:e.id,enabled:!e.enabled}),children:e.enabled?`Disable`:`Enable`})]}),e.description&&(0,Q.jsx)(`p`,{className:`text-sm text-outline wrap-break-word`,children:e.description}),(0,Q.jsx)(`code`,{className:`block whitespace-pre-wrap break-all text-xs text-on-surface-variant`,children:e.action?.type===`agent`?`Agent: ${e.action.backend}`:e.action?.type===`task`?`Task: ${e.action.title}`:e.command}),(0,Q.jsxs)(`p`,{className:`text-xs text-outline`,children:[e.trigger_type,` · `,e.run_count,` runs`,e.next_run_at?` · Next: ${new Date(e.next_run_at).toLocaleString()}`:``]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsxs)(i,{"data-testid":`job-edit`,variant:`ghost`,size:`sm`,onClick:()=>R(e),children:[(0,Q.jsx)(F,{}),`Edit`]}),(0,Q.jsxs)(i,{"data-testid":`job-trigger`,variant:`ghost`,size:`sm`,disabled:v.isPending,onClick:()=>v.mutate(e.id),children:[(0,Q.jsx)(X,{}),`Run`]}),(0,Q.jsx)(i,{"data-testid":`job-delete`,"aria-label":`Delete ${e.name}`,variant:`ghost`,size:`icon`,onClick:()=>B(e),children:(0,Q.jsx)(L,{})})]})]},e.id))}),(0,Q.jsx)(we,{projectScope:l,jobId:k,open:!!k,onClose:j,onEdit:e=>{j(),R(e)}}),N&&(0,Q.jsx)(Ae,{defaultProjectId:u,open:N,onClose:()=>P(!1)}),I&&(0,Q.jsx)(je,{job:I,open:!!I,onClose:()=>R(null)}),z&&(0,Q.jsx)(H,{open:!!z,title:`Delete Job`,description:`Delete job "${z.name}"? This cannot be undone.`,confirmLabel:`Delete`,variant:`destructive`,isPending:b.isPending,onConfirm:()=>{b.mutate(z.id,{onSuccess:()=>B(null)})},onCancel:()=>B(null)})]})}function Ae({defaultProjectId:e,open:t,onClose:n}){let{data:r}=N(),o=b([{id:`details`,label:`Details`},{id:`execution`,label:`Execution`},{id:`automation`,label:`Automation`}],t),[f,p]=(0,Z.useState)(``),[m,h]=(0,Z.useState)(``),[y,x]=(0,Z.useState)({type:`command`,command:``}),[S,w]=(0,Z.useState)([]),[T,E]=(0,Z.useState)(`manual`),[O,k]=(0,Z.useState)(``),[A,j]=(0,Z.useState)(`300`),[M,F]=(0,Z.useState)(`0`),[I,L]=(0,Z.useState)(`skip`),[R,z]=(0,Z.useState)(`failure`),[H,U]=(0,Z.useState)(``),[W,ee]=(0,Z.useState)(e??``),G=me(),[K,te]=(0,Z.useState)(!1),q=(e,t=n)=>{if(e.preventDefault(),T===`webhook`&&!S.length){o.invalid(`automation`,`Select at least one webhook for this trigger.`);return}if(!f.trim()||!Se(y))return;let r={name:f.trim(),description:m.trim(),action:y,webhooks:T===`webhook`?S:[],trigger_type:T,enabled:K,cron_expr:T===`cron`&&O.trim()||void 0,timeout_secs:Number.parseInt(A,10)||void 0,max_retries:Number.parseInt(M,10),overlap:I,notify_on:R,project_id:W||void 0,working_dir:H.trim()||void 0};G.mutate(r,{onSuccess:t})};return(0,Q.jsx)(B,{open:t,onClose:n,busy:G.isPending,dirty:JSON.stringify([f,m,y,S,T,O,A,M,I,R,H,W,K])!==JSON.stringify([``,``,{type:`command`,command:``},[],`manual`,``,`300`,`0`,`skip`,`failure`,``,e??``,!1]),children:(e,t)=>(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(g,{children:(0,Q.jsx)(v,{className:`font-headline text-sm font-medium text-on-surface`,children:`New job`})}),(0,Q.jsx)(`form`,{noValidate:!0,ref:o.form,onSubmit:e=>o.submit(e,()=>q(e,t)),className:`min-h-0`,children:(0,Q.jsxs)(D,{steps:o,children:[(0,Q.jsxs)(`div`,{className:`work-form-body space-y-4`,children:[(0,Q.jsxs)(V,{steps:o,id:`details`,children:[(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(a,{className:`font-label text-xs font-medium text-outline`,children:`Name *`}),(0,Q.jsx)(C,{required:!0,"aria-label":`Name`,"data-testid":`job-name-input`,value:f,onChange:e=>p(e.target.value),placeholder:`Job name...`,className:`bg-background border-control-border text-on-surface font-body text-sm`,autoFocus:!0})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(a,{className:`font-label text-xs font-medium text-outline`,children:`Description`}),(0,Q.jsx)(C,{"aria-label":`Description`,value:m,onChange:e=>h(e.target.value),placeholder:`Optional description...`,className:`bg-background border-control-border text-on-surface font-body text-sm`})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(a,{className:`font-label text-xs font-medium text-outline`,children:`Project`}),(0,Q.jsxs)(d,{value:W||`__none__`,onValueChange:e=>{ee(e===`__none__`?``:e),w([])},children:[(0,Q.jsx)(c,{"aria-label":`Project`,"data-testid":`job-project-select`,className:`bg-background border-control-border text-on-surface font-body text-sm min-h-8`,children:(0,Q.jsx)(s,{})}),(0,Q.jsxs)(l,{className:`bg-surface border-border`,children:[(0,Q.jsx)(u,{value:`__none__`,className:`font-body text-sm`,children:`None`}),r?.map(e=>(0,Q.jsx)(u,{value:e.id,className:`font-body text-sm`,children:e.name},e.id))]})]})]})]}),(0,Q.jsxs)(V,{steps:o,id:`execution`,children:[(0,Q.jsx)(Ce,{value:y,onChange:x}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(a,{className:`font-label text-xs font-medium text-outline`,children:`Working Dir`}),(0,Q.jsx)(C,{"aria-label":`Working directory`,value:H,onChange:e=>U(e.target.value),placeholder:`/path/to/dir`,className:`bg-background border-control-border text-on-surface font-body text-sm`})]}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-3 md:col-span-2`,children:[(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(a,{className:`font-label text-xs font-medium text-outline`,children:`Timeout (s)`}),(0,Q.jsx)(C,{"aria-label":`Timeout in seconds`,type:`number`,min:1,required:!0,value:A,onChange:e=>j(e.target.value),className:`bg-background border-control-border text-on-surface font-body text-sm`})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(a,{className:`font-label text-xs font-medium text-outline`,children:`Retries`}),(0,Q.jsx)(C,{"aria-label":`Maximum retries`,type:`number`,min:0,required:!0,value:M,onChange:e=>F(e.target.value),className:`bg-background border-control-border text-on-surface font-body text-sm`})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(a,{className:`font-label text-xs font-medium text-outline`,children:`Overlap`}),(0,Q.jsxs)(d,{value:I,onValueChange:e=>L(e),children:[(0,Q.jsx)(c,{"aria-label":`Overlap`,className:`bg-background border-control-border text-on-surface font-body text-sm min-h-8`,children:(0,Q.jsx)(s,{})}),(0,Q.jsx)(l,{className:`bg-surface border-border`,children:De.map(e=>(0,Q.jsx)(u,{value:e,className:`font-body text-sm`,children:e},e))})]})]})]})]}),(0,Q.jsxs)(V,{steps:o,id:`automation`,children:[(0,Q.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-2 md:col-span-2`,children:[(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(a,{className:`font-label text-xs font-medium text-outline`,children:`Trigger`}),(0,Q.jsxs)(d,{value:T,onValueChange:e=>E(e),children:[(0,Q.jsx)(c,{"aria-label":`Trigger type`,"data-testid":`job-trigger-type`,className:`bg-background border-control-border text-on-surface font-body text-sm min-h-8`,children:(0,Q.jsx)(s,{})}),(0,Q.jsx)(l,{className:`bg-surface border-border`,children:$.map(e=>(0,Q.jsx)(u,{value:e,"data-testid":`job-trigger-${e}`,className:`font-body text-sm`,children:e},e))})]})]}),T===`webhook`&&(0,Q.jsx)(`div`,{className:`sm:col-span-2`,children:(0,Q.jsx)(_e,{value:S,onChange:w,projectId:W||void 0})}),T===`cron`&&(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(a,{className:`font-label text-xs font-medium text-outline`,children:`Cron expression`}),(0,Q.jsx)(C,{required:!0,"aria-label":`Cron expression`,value:O,onChange:e=>k(e.target.value),placeholder:`*/5 * * * *`,className:`bg-background border-control-border text-on-surface font-mono text-xs`})]})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(a,{className:`font-label text-xs font-medium text-outline`,children:`Notify On`}),(0,Q.jsxs)(d,{value:R,onValueChange:e=>z(e),children:[(0,Q.jsx)(c,{"aria-label":`Notify on`,className:`bg-background border-control-border text-on-surface font-body text-sm min-h-8`,children:(0,Q.jsx)(s,{})}),(0,Q.jsx)(l,{className:`bg-surface border-border`,children:Oe.map(e=>(0,Q.jsx)(u,{value:e,className:`font-body text-sm`,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm md:col-span-2`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,"data-testid":`job-create-enabled`,checked:K,onChange:e=>te(e.target.checked),className:`size-4 accent-primary`}),`Enable this job immediately`]}),(0,Q.jsx)(`p`,{className:`text-xs text-outline md:col-span-2`,children:`Created disabled unless you enable it above.`})]}),(0,Q.jsx)(`div`,{className:`md:col-span-2`,children:G.error&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-error`,children:G.error.message})}),o.error&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-error`,children:o.error})]}),(0,Q.jsxs)(_,{className:`work-form-footer`,children:[(0,Q.jsx)(i,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`form-cancel`,onClick:e,className:`font-label text-xs text-outline`,children:`Cancel`}),(0,Q.jsx)(P,{steps:o,busy:G.isPending,children:(0,Q.jsx)(i,{"data-testid":`job-submit`,type:`submit`,size:`sm`,disabled:G.isPending,className:`font-label text-xs bg-primary text-primary-foreground hover:bg-primary/90`,children:G.isPending?`Creating...`:T===`webhook`?`Create job`:`Create`})})]})]})})]})})}function je({job:e,open:t,onClose:n}){let r=b([{id:`details`,label:`Details`},{id:`execution`,label:`Execution`},{id:`automation`,label:`Automation`}],t),[o,f]=(0,Z.useState)(e.name),[p,m]=(0,Z.useState)(e.description??``),[h,y]=(0,Z.useState)(e.action??{type:`command`,command:e.command}),[x,S]=(0,Z.useState)(e.webhooks??[]),[w,T]=(0,Z.useState)(e.trigger_type),[E,O]=(0,Z.useState)(e.cron_expr??``),[k,A]=(0,Z.useState)(String(e.timeout_secs)),[j,M]=(0,Z.useState)(String(e.max_retries)),[N,F]=(0,Z.useState)(e.overlap),[I,L]=(0,Z.useState)(e.notify_on),[R,z]=(0,Z.useState)(e.enabled),H=Y(),U=(t,i=n)=>{if(t.preventDefault(),w===`webhook`&&!x.length){r.invalid(`automation`,`Select at least one webhook for this trigger.`);return}if(!o.trim()||!Se(h))return;let a={id:e.id,name:o.trim(),description:p.trim(),action:h,webhooks:w===`webhook`?x:[],trigger_type:w,cron_expr:w===`cron`&&E.trim()||void 0,timeout_secs:Number.parseInt(k,10)||void 0,max_retries:Number.parseInt(j,10),overlap:N,notify_on:I,enabled:R};H.mutate(a,{onSuccess:i})};return(0,Q.jsx)(B,{open:t,onClose:n,busy:H.isPending,dirty:JSON.stringify([o,p,h,x,w,E,k,j,N,I,R])!==JSON.stringify([e.name,e.description??``,e.action??{type:`command`,command:e.command},e.webhooks??[],e.trigger_type,e.cron_expr??``,String(e.timeout_secs),String(e.max_retries),e.overlap,e.notify_on,e.enabled]),children:(t,n)=>(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(g,{children:(0,Q.jsx)(v,{className:`font-headline text-sm font-medium text-on-surface`,children:`Edit job`})}),(0,Q.jsx)(`form`,{noValidate:!0,ref:r.form,id:`edit-job-form`,onSubmit:e=>r.submit(e,()=>U(e,n)),className:`min-h-0`,children:(0,Q.jsxs)(D,{steps:r,children:[(0,Q.jsxs)(`div`,{className:`work-form-body space-y-4`,children:[(0,Q.jsxs)(V,{steps:r,id:`details`,children:[(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(a,{className:`font-label text-xs font-medium text-outline`,children:`Name *`}),(0,Q.jsx)(C,{required:!0,"aria-label":`Name`,value:o,onChange:e=>f(e.target.value),className:`bg-background border-control-border text-on-surface font-body text-sm`})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(a,{className:`font-label text-xs font-medium text-outline`,children:`Description`}),(0,Q.jsx)(C,{"aria-label":`Description`,value:p,onChange:e=>m(e.target.value),className:`bg-background border-control-border text-on-surface font-body text-sm`})]})]}),(0,Q.jsxs)(V,{steps:r,id:`execution`,children:[(0,Q.jsx)(Ce,{value:h,onChange:y}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-3 md:col-span-2`,children:[(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(a,{className:`font-label text-xs font-medium text-outline`,children:`Timeout (s)`}),(0,Q.jsx)(C,{"aria-label":`Timeout in seconds`,type:`number`,min:1,required:!0,value:k,onChange:e=>A(e.target.value),className:`bg-background border-control-border text-on-surface font-body text-sm`})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(a,{className:`font-label text-xs font-medium text-outline`,children:`Retries`}),(0,Q.jsx)(C,{"aria-label":`Maximum retries`,type:`number`,min:0,required:!0,value:j,onChange:e=>M(e.target.value),className:`bg-background border-control-border text-on-surface font-body text-sm`})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(a,{className:`font-label text-xs font-medium text-outline`,children:`Overlap`}),(0,Q.jsxs)(d,{value:N,onValueChange:e=>F(e),children:[(0,Q.jsx)(c,{"aria-label":`Overlap`,className:`bg-background border-control-border text-on-surface font-body text-sm min-h-8`,children:(0,Q.jsx)(s,{})}),(0,Q.jsx)(l,{className:`bg-surface border-border`,children:De.map(e=>(0,Q.jsx)(u,{value:e,className:`font-body text-sm`,children:e},e))})]})]})]})]}),(0,Q.jsxs)(V,{steps:r,id:`automation`,children:[(0,Q.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-2 md:col-span-2`,children:[(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(a,{className:`font-label text-xs font-medium text-outline`,children:`Trigger`}),(0,Q.jsxs)(d,{value:w,onValueChange:e=>T(e),children:[(0,Q.jsx)(c,{"aria-label":`Trigger type`,"data-testid":`job-trigger-type`,className:`bg-background border-control-border text-on-surface font-body text-sm min-h-8`,children:(0,Q.jsx)(s,{})}),(0,Q.jsx)(l,{className:`bg-surface border-border`,children:$.map(e=>(0,Q.jsx)(u,{value:e,"data-testid":`job-trigger-${e}`,className:`font-body text-sm`,children:e},e))})]})]}),w===`webhook`&&(0,Q.jsx)(`div`,{className:`sm:col-span-2`,children:(0,Q.jsx)(_e,{value:x,onChange:S,projectId:e.project_id??void 0})}),w===`cron`&&(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(a,{className:`font-label text-xs font-medium text-outline`,children:`Cron expression`}),(0,Q.jsx)(C,{required:!0,"aria-label":`Cron expression`,value:E,onChange:e=>O(e.target.value),placeholder:`*/5 * * * *`,className:`bg-background border-control-border text-on-surface font-mono text-xs`})]})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(a,{className:`font-label text-xs font-medium text-outline`,children:`Notify On`}),(0,Q.jsxs)(d,{value:I,onValueChange:e=>L(e),children:[(0,Q.jsx)(c,{"aria-label":`Notify on`,className:`bg-background border-control-border text-on-surface font-body text-sm min-h-8`,children:(0,Q.jsx)(s,{})}),(0,Q.jsx)(l,{className:`bg-surface border-border`,children:Oe.map(e=>(0,Q.jsx)(u,{value:e,className:`font-body text-sm`,children:e},e))})]})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(a,{className:`font-label text-xs font-medium text-outline`,children:`Enabled`}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>z(!R),className:`w-full min-h-11 rounded-md flex items-center justify-center border font-label text-xs font-medium transition-colors ${R?`bg-surface-highest text-on-surface border-border`:`bg-background text-outline border-border`}`,children:R?`● Enabled`:`○ Disabled`})]})]}),(0,Q.jsx)(`div`,{className:`md:col-span-2`,children:H.error&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-error`,children:H.error.message})}),r.error&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-error`,children:r.error})]}),(0,Q.jsxs)(_,{className:`work-form-footer`,children:[(0,Q.jsx)(i,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`form-cancel`,onClick:t,className:`font-label text-xs text-outline`,children:`Cancel`}),(0,Q.jsx)(P,{steps:r,busy:H.isPending,children:(0,Q.jsx)(i,{"data-testid":`job-edit-submit`,form:`edit-job-form`,type:`submit`,size:`sm`,disabled:H.isPending,className:`font-label text-xs bg-primary text-primary-foreground hover:bg-primary/90`,children:H.isPending?`Saving...`:`Save`})})]})]})})]})})}export{ke as default};
|